Are you sure you want to delete the album '$${ albumTitle }' and all of the photos it contains? This action can't be undone!
` } else { @@ -234,11 +237,11 @@ album.delete = function(albumIDs) { album.setTitle = function(albumIDs) { - let oldTitle = '', - msg = '' + let oldTitle = '' + let msg = '' if (!albumIDs) return false - if (albumIDs instanceof Array===false) albumIDs = [albumIDs] + if (albumIDs instanceof Array===false) albumIDs = [ albumIDs ] if (albumIDs.length===1) { @@ -246,18 +249,13 @@ album.setTitle = function(albumIDs) { if (album.json) oldTitle = album.json.title else if (albums.json) oldTitle = albums.getByID(albumIDs).title - if (!oldTitle) oldTitle = '' - } const action = function(data) { - let newTitle = data.title - basicModal.close() - // Set title to Untitled when empty - newTitle = (newTitle==='') ? 'Untitled' : newTitle + let newTitle = data.title if (visible.album()) { @@ -315,7 +313,7 @@ album.setTitle = function(albumIDs) { album.setDescription = function(albumID) { - let oldDescription = album.json.description.replace(/'/g, ''') + let oldDescription = album.json.description const action = function(data) { @@ -365,12 +363,12 @@ album.setPublic = function(albumID, modal, e) { if (modal===true) { - let text = '', - action = {} + let text = '' + let action = {} action.fn = () => { - // setPublic function without showing the modal + // Call setPublic function without showing the modal album.setPublic(album.getID(), false, e) } @@ -393,11 +391,11 @@ album.setPublic = function(albumID, modal, e) { @@ -433,9 +431,8 @@ album.setPublic = function(albumID, modal, e) { } }) - // Active visible by default (public = 0) - if ((album.json.public==='1' && album.json.visible==='1') || (album.json.public==='0')) $('.basicModal .choice input[name="visible"]').click() - if (album.json.downloadable==='1') $('.basicModal .choice input[name="downloadable"]').click() + if (album.json.public==='1' && album.json.visible==='0') $('.basicModal .choice input[name="hidden"]').click() + if (album.json.downloadable==='1') $('.basicModal .choice input[name="downloadable"]').click() $('.basicModal .choice input[name="password"]').on('change', function() { @@ -455,8 +452,8 @@ album.setPublic = function(albumID, modal, e) { album.json.public = '1' // Set visible - if ($('.basicModal .choice input[name="visible"]:checked').length===1) album.json.visible = '1' - else album.json.visible = '0' + if ($('.basicModal .choice input[name="hidden"]:checked').length===1) album.json.visible = '0' + else album.json.visible = '1' // Set downloadable if ($('.basicModal .choice input[name="downloadable"]:checked').length===1) album.json.downloadable = '1' @@ -484,12 +481,12 @@ album.setPublic = function(albumID, modal, e) { // Set data and refresh view if (visible.album()) { - album.json.visible = (album.json.public==='0') ? '0' : album.json.visible + album.json.visible = (album.json.public==='0') ? '1' : album.json.visible album.json.downloadable = (album.json.public==='0') ? '0' : album.json.downloadable album.json.password = (album.json.public==='0') ? '0' : album.json.password view.album.public() - view.album.visible() + view.album.hidden() view.album.downloadable() view.album.password() @@ -515,8 +512,8 @@ album.setPublic = function(albumID, modal, e) { album.share = function(service) { - let link = '', - url = location.href + let link = '' + let url = location.href switch (service) { case 'twitter': @@ -539,8 +536,8 @@ album.share = function(service) { album.getArchive = function(albumID) { - let link, - url = `${ api.path }?function=Album::getArchive&albumID=${ albumID }` + let link = '' + let url = `${ api.path }?function=Album::getArchive&albumID=${ albumID }` if (location.href.indexOf('index.html')>0) link = location.href.replace(location.hash, '').replace('index.html', url) else link = location.href.replace(location.hash, '') + url @@ -553,26 +550,26 @@ album.getArchive = function(albumID) { album.merge = function(albumIDs) { - let title = '', - sTitle = '', - msg = '' + let title = '' + let sTitle = '' + let msg = '' if (!albumIDs) return false - if (albumIDs instanceof Array===false) albumIDs = [albumIDs] + if (albumIDs instanceof Array===false) albumIDs = [ albumIDs ] // Get title of first album if (albums.json) title = albums.getByID(albumIDs[0]).title - if (!title) title = '' - title = title.replace(/'/g, ''') + // Fallback for first album without a title + if (title==='') title = 'Untitled' if (albumIDs.length===2) { // Get title of second album if (albums.json) sTitle = albums.getByID(albumIDs[1]).title - if (!sTitle) sTitle = '' - sTitle = sTitle.replace(/'/g, ''') + // Fallback for second album without a title + if (sTitle==='') sTitle = 'Untitled' msg = lychee.html`Are you sure you want to merge the album '$${ sTitle }' into the album '$${ title }'?
` @@ -596,7 +593,7 @@ album.merge = function(albumIDs) { lychee.error(null, params, data) } else { albums.refresh() - albums.load() + lychee.goto() } }) diff --git a/src/scripts/albums.js b/src/scripts/albums.js index ef6b6d1..26f8ea7 100644 --- a/src/scripts/albums.js +++ b/src/scripts/albums.js @@ -17,7 +17,7 @@ albums.load = function() { if (albums.json===null) { - api.post('Album::getAll', {}, function(data) { + api.post('Albums::get', {}, function(data) { let waitTime = 0 @@ -134,7 +134,7 @@ albums.deleteByID = function(albumID) { if (!albums.json) return false if (!albums.json.albums) return false - var deleted = false + let deleted = false $.each(albums.json.albums, function(i) { diff --git a/src/scripts/api.js b/src/scripts/api.js index 3301dbd..d45a007 100644 --- a/src/scripts/api.js +++ b/src/scripts/api.js @@ -5,7 +5,7 @@ api = { - path : 'php/api.php', + path : 'php/index.php', onError : null } @@ -14,11 +14,11 @@ api.post = function(fn, params, callback) { loadingBar.show() - params = $.extend({function: fn}, params) + params = $.extend({ function: fn }, params) const success = (data) => { - setTimeout(() => loadingBar.hide(), 100) + setTimeout(loadingBar.hide, 100) // Catch errors if (typeof data==='string' && data.substring(0, 7)==='Error: ') { @@ -27,16 +27,13 @@ api.post = function(fn, params, callback) { } // Convert 1 to true and an empty string to false - if (data==='1') data = true - else if (data==='') data = false + if (data==='true') data = true + else if (data==='false') data = false // Convert to JSON if string start with '{' and ends with '}' - if (typeof data==='string' && - data.substring(0, 1)==='{' && - data.substring(data.length-1, data.length)==='}') data = $.parseJSON(data) - - // Output response when debug mode is enabled - if (lychee.debugMode) console.log(data) + if (typeof data==='string' && data.substring(0, 1)==='{' && data.substring(data.length - 1, data.length)==='}') { + data = $.parseJSON(data) + } callback(data) diff --git a/src/scripts/build.js b/src/scripts/build.js index 75cc311..620d36f 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -115,16 +115,16 @@ build.photo = function(data) { build.imageview = function(data, visibleControls) { - let html = '', - hasMedium = data.medium!=='' + let html = '' + let hasMedium = data.medium!=='' if (hasMedium===false) { - html += lychee.html`This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.
", + body: 'This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.
', buttons: { action: { title: 'Show Album', @@ -500,11 +513,11 @@ photo.setDescription = function(photoID) { photo.editTags = function(photoIDs) { - let oldTags = '', - msg = '' + let oldTags = '' + let msg = '' if (!photoIDs) return false - if (photoIDs instanceof Array===false) photoIDs = [photoIDs] + if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ] // Get tags if (visible.photo()) oldTags = photo.json.tags @@ -553,7 +566,7 @@ photo.editTags = function(photoIDs) { photo.setTags = function(photoIDs, tags) { if (!photoIDs) return false - if (photoIDs instanceof Array===false) photoIDs = [photoIDs] + if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ] // Parse tags tags = tags.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g, ',') @@ -591,14 +604,14 @@ photo.deleteTag = function(photoID, index) { // Save photo.json.tags = tags.toString() - photo.setTags([photoID], photo.json.tags) + photo.setTags([ photoID ], photo.json.tags) } photo.share = function(photoID, service) { - let link = '', - url = photo.getViewLink(photoID) + let link = '' + let url = photo.getViewLink(photoID) switch (service) { case 'twitter': @@ -621,14 +634,14 @@ photo.share = function(photoID, service) { break } - if (link.length!=='') location.href = link + if (link!=='') location.href = link } photo.getArchive = function(photoID) { - let link, - url = `${ api.path }?function=Photo::getArchive&photoID=${ photoID }` + let link + let url = `${ api.path }?function=Photo::getArchive&photoID=${ photoID }` if (location.href.indexOf('index.html')>0) link = location.href.replace(location.hash, '').replace('index.html', url) else link = location.href.replace(location.hash, '') + url diff --git a/src/scripts/search.js b/src/scripts/search.js index af7e142..216c8c8 100755 --- a/src/scripts/search.js +++ b/src/scripts/search.js @@ -19,9 +19,9 @@ search.find = function(term) { api.post('search', { term }, function(data) { - let html = '', - albumsData = '', - photosData = '' + let html = '' + let albumsData = '' + let photosData = '' // Build albums if (data && data.albums) { @@ -47,7 +47,7 @@ search.find = function(term) { if (albumsData==='' && photosData==='') html = 'error' else if (albumsData==='') html = build.divider('Photos') + photosData else if (photosData==='') html = build.divider('Albums') + albumsData - else html = build.divider('Photos') + photosData + build.divider('Albums') + albumsData + else html = build.divider('Albums') + albumsData + build.divider('Photos') + photosData // Only refresh view when search results are different if (search.hash!==data.hash) { @@ -94,7 +94,7 @@ search.reset = function() { search.hash = null lychee.animate('.divider', 'fadeOut') - albums.load() + lychee.goto() } diff --git a/src/scripts/settings.js b/src/scripts/settings.js index 876ef8b..8fd92d6 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -9,11 +9,11 @@ settings.createConfig = function() { const action = function(data) { - let dbName = data.dbName || '', - dbUser = data.dbUser || '', - dbPassword = data.dbPassword || '', - dbHost = data.dbHost || '', - dbTablePrefix = data.dbTablePrefix || '' + let dbName = data.dbName || '' + let dbUser = data.dbUser || '' + let dbPassword = data.dbPassword || '' + let dbHost = data.dbHost || '' + let dbTablePrefix = data.dbTablePrefix || '' if (dbUser.length<1) { basicModal.error('dbUser') @@ -31,7 +31,7 @@ settings.createConfig = function() { dbTablePrefix } - api.post('Database::createConfig', params, function(data) { + api.post('Config::create', params, function(data) { if (data!==true) { @@ -140,8 +140,8 @@ settings.createLogin = function() { const action = function(data) { - let username = data.username, - password = data.password + let username = data.username + let password = data.password if (username.length<1) { basicModal.error('username') @@ -204,9 +204,9 @@ settings.setLogin = function() { const action = function(data) { - let oldPassword = data.oldPassword || '', - username = data.username || '', - password = data.password || '' + let oldPassword = data.oldPassword || '' + let username = data.username || '' + let password = data.password || '' if (oldPassword.length<1) { basicModal.error('oldPassword') @@ -269,8 +269,8 @@ settings.setLogin = function() { settings.setSorting = function() { - let sortingPhotos = [], - sortingAlbums = [] + let sortingPhotos = [] + let sortingAlbums = [] const action = function() { diff --git a/src/scripts/sidebar.js b/src/scripts/sidebar.js index f628506..48fb2a9 100644 --- a/src/scripts/sidebar.js +++ b/src/scripts/sidebar.js @@ -30,14 +30,14 @@ sidebar.bind = function() { // event handlers should be removed before binding a new one. // Event Name - let eventName = lychee.getEventName(); + let eventName = lychee.getEventName() sidebar .dom('#edit_title') .off(eventName) .on(eventName, function() { - if (visible.photo()) photo.setTitle([photo.getID()]) - else if (visible.album()) album.setTitle([album.getID()]) + if (visible.photo()) photo.setTitle([ photo.getID() ]) + else if (visible.album()) album.setTitle([ album.getID() ]) }) sidebar @@ -52,7 +52,7 @@ sidebar.bind = function() { .dom('#edit_tags') .off(eventName) .on(eventName, function() { - photo.editTags([photo.getID()]) + photo.editTags([ photo.getID() ]) }) sidebar @@ -114,10 +114,10 @@ sidebar.createStructure.photo = function(data) { if (data==null || data==='') return false - let editable = false, - exifHash = data.takestamp + data.make + data.model + data.shutter + data.aperture + data.focal + data.iso, - structure = {}, - _public = '' + let editable = false + let exifHash = data.takestamp + data.make + data.model + data.shutter + data.aperture + data.focal + data.iso + let structure = {} + let _public = '' // Enable editable when user logged in if (lychee.publicMode===false) editable = true @@ -220,12 +220,12 @@ sidebar.createStructure.album = function(data) { if (data==null || data==='') return false - let editable = false, - structure = {}, - _public = '', - visible = '', - downloadable = '', - password = '' + let editable = false + let structure = {} + let _public = '' + let hidden = '' + let downloadable = '' + let password = '' // Enable editable when user logged in if (lychee.publicMode===false) editable = true @@ -242,14 +242,14 @@ sidebar.createStructure.album = function(data) { } - // Set value for visible + // Set value for hidden switch (data.visible) { - case '0' : visible = 'No' + case '0' : hidden = 'Yes' break - case '1' : visible = 'Yes' + case '1' : hidden = 'No' break - default : visible = '-' + default : hidden = '-' break } @@ -301,7 +301,7 @@ sidebar.createStructure.album = function(data) { type : sidebar.types.DEFAULT, rows : [ { title: 'Public', value: _public }, - { title: 'Visible', value: visible }, + { title: 'Hidden', value: hidden }, { title: 'Downloadable', value: downloadable }, { title: 'Password', value: password } ] @@ -367,8 +367,8 @@ sidebar.render = function(structure) { let renderTags = function(section) { - let _html = '', - editable = '' + let _html = '' + let editable = '' // Add edit-icon to the value when editable if (section.editable===true) editable = build.editIcon('edit_tags') diff --git a/src/scripts/upload.js b/src/scripts/upload.js index 2d473af..d99d6c1 100755 --- a/src/scripts/upload.js +++ b/src/scripts/upload.js @@ -40,16 +40,16 @@ upload.start = { local: function(files) { - let albumID = album.getID(), - error = false, - warning = false + let albumID = album.getID() + let error = false + let warning = false const process = function(files, file) { - let formData = new FormData(), - xhr = new XMLHttpRequest(), - pre_progress = 0, - progress = 0 + let formData = new FormData() + let xhr = new XMLHttpRequest() + let pre_progress = 0 + let progress = 0 const finish = function() { @@ -115,23 +115,22 @@ upload.start = { formData.append('function', 'Photo::add') formData.append('albumID', albumID) - formData.append('tags', '') formData.append(0, file) xhr.open('POST', api.path) xhr.onload = function() { - let wait = false, - errorText = '' + let wait = false + let errorText = '' file.ready = true // Set status - if (xhr.status===200 && xhr.responseText==='1') { + if (xhr.status===200 && xhr.responseText==='true') { // Success - $('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status') + $('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status') .html('Finished') .addClass('success') @@ -143,7 +142,7 @@ upload.start = { error = true // Error Status - $('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status') + $('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status') .html('Failed') .addClass('error') @@ -153,7 +152,7 @@ upload.start = { warning = true // Warning Status - $('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status') + $('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status') .html('Skipped') .addClass('warning') @@ -163,13 +162,13 @@ upload.start = { error = true // Error Status - $('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status') + $('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status') .html('Failed') .addClass('error') } - $('.basicModal .rows .row:nth-child(' + (file.num+1) + ') p.notice') + $('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') p.notice') .html(errorText) .show() @@ -210,11 +209,11 @@ upload.start = { // Scroll to the uploading file let scrollPos = 0 - if ((file.num+1)>4) scrollPos = (file.num + 1 - 4) * 40 + if ((file.num + 1)>4) scrollPos = (file.num + 1 - 4) * 40 $('.basicModal .rows').scrollTop(scrollPos) // Set status to processing - $('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status').html('Processing') + $('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status').html('Processing') // Upload next file if (file.next!=null) process(files, file.next) @@ -236,7 +235,7 @@ upload.start = { files[i].ready = false files[i].supported = true - if (i < files.length-1) files[i].next = files[i+1] + if (i < files.length-1) files[i].next = files[i + 1] else files[i].next = null // Check if file is supported @@ -387,7 +386,7 @@ upload.start = { // Go back to the album overview to show the imported albums if (visible.albums()) lychee.load() - else lychee.goto('') + else lychee.goto() basicModal.close() @@ -480,7 +479,7 @@ upload.start = { } // Remove last comma - links = links.substr(0, links.length-1) + links = links.substr(0, links.length - 1) upload.show('Importing from Dropbox', files, function() { diff --git a/src/scripts/view.js b/src/scripts/view.js index 099295a..198a4fd 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -26,8 +26,8 @@ view.albums = { init: function() { - let smartData = '', - albumsData = '' + let smartData = '' + let albumsData = '' // Smart Albums if (lychee.publicMode===false) { @@ -246,10 +246,10 @@ view.album = { }, - visible: function() { + hidden: function() { - if (album.json.visible==='1') sidebar.changeAttr('visible', 'Yes') - else sidebar.changeAttr('visible', 'No') + if (album.json.visible==='1') sidebar.changeAttr('hidden', 'No') + else sidebar.changeAttr('hidden', 'Yes') }, @@ -271,8 +271,8 @@ view.album = { if ((visible.album() || !album.json.init) && !visible.photo()) { - let structure = sidebar.createStructure.album(album.json), - html = sidebar.render(structure) + let structure = sidebar.createStructure.album(album.json) + let html = sidebar.render(structure) sidebar.dom('.sidebar__wrapper').html(html) sidebar.bind() @@ -408,27 +408,33 @@ view.photo = { lychee.imageview.html(build.imageview(photo.json, visible.header())) - let $nextArrow = lychee.imageview.find('a#next'), - $previousArrow = lychee.imageview.find('a#previous'), - photoID = photo.getID(), - hasNext = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].nextPhoto!=='', - hasPrevious = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].previousPhoto!=='' + let $nextArrow = lychee.imageview.find('a#next') + let $previousArrow = lychee.imageview.find('a#previous') + let photoID = photo.getID() + let hasNext = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].nextPhoto!=='' + let hasPrevious = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].previousPhoto!=='' - if (hasNext===false || lychee.viewMode===true) { $nextArrow.hide() } - else { + if (hasNext===false || lychee.viewMode===true) { - let nextPhotoID = album.json.content[photoID].nextPhoto, - nextPhoto = album.json.content[nextPhotoID] + $nextArrow.hide() + + } else { + + let nextPhotoID = album.json.content[photoID].nextPhoto + let nextPhoto = album.json.content[nextPhotoID] $nextArrow.css('background-image', lychee.html`linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("$${ nextPhoto.thumbUrl }")`) } - if (hasPrevious===false || lychee.viewMode===true) { $previousArrow.hide() } - else { + if (hasPrevious===false || lychee.viewMode===true) { - let previousPhotoID = album.json.content[photoID].previousPhoto, - previousPhoto = album.json.content[previousPhotoID] + $previousArrow.hide() + + } else { + + let previousPhotoID = album.json.content[photoID].previousPhoto + let previousPhoto = album.json.content[previousPhotoID] $previousArrow.css('background-image', lychee.html`linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("$${ previousPhoto.thumbUrl }")`) @@ -438,8 +444,8 @@ view.photo = { sidebar: function() { - let structure = sidebar.createStructure.photo(photo.json), - html = sidebar.render(structure) + let structure = sidebar.createStructure.photo(photo.json) + let html = sidebar.render(structure) sidebar.dom('.sidebar__wrapper').html(html) sidebar.bind() diff --git a/src/scripts/view/main.js b/src/scripts/view/main.js index 5f03cbe..329892e 100644 --- a/src/scripts/view/main.js +++ b/src/scripts/view/main.js @@ -11,8 +11,8 @@ lychee.content = $('.content') lychee.getEventName = function() { - let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement), - eventName = (touchendSupport===true ? 'touchend' : 'click') + let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement) + let eventName = (touchendSupport===true ? 'touchend' : 'click') return eventName @@ -39,8 +39,8 @@ lychee.html = function(literalSections, ...substs) { // Use raw literal sections: we don’t want // backslashes (\n etc.) to be interpreted - let raw = literalSections.raw, - result = '' + let raw = literalSections.raw + let result = '' substs.forEach((subst, i) => { @@ -63,7 +63,7 @@ lychee.html = function(literalSections, ...substs) { // Take care of last literal section // (Never fails, because an empty template string // produces one literal section, an empty string) - result += raw[raw.length-1] + result += raw[raw.length - 1] return result @@ -88,7 +88,7 @@ $(document).ready(function() { // Direct Link header.dom('#button_direct').on(eventName, function() { - let link = $('#imageview #image').css('background-image').replace(/"/g,'').replace(/url\(|\)$/ig, '') + let link = $('#imageview img').attr('src').replace(/"/g,'').replace(/url\(|\)$/ig, '') window.open(link, '_newtab') }) @@ -127,8 +127,8 @@ const loadPhotoInfo = function(photoID) { imageview.addClass('fadeIn').show() // Render Sidebar - let structure = sidebar.createStructure.photo(data), - html = sidebar.render(structure) + let structure = sidebar.createStructure.photo(data) + let html = sidebar.render(structure) sidebar.dom('.sidebar__wrapper').html(html) sidebar.bind() diff --git a/src/styles/_animations.scss b/src/styles/_animations.scss index d104dd9..7f8b3d5 100755 --- a/src/styles/_animations.scss +++ b/src/styles/_animations.scss @@ -65,18 +65,6 @@ } } -// PopIn -------------------------------------------------------------- // -@keyframes popIn { - 0% { - opacity: 0; - transform: scale(0); - } - 100% { - opacity: 1; - transform: scale(1); - } -} - // Pulse -------------------------------------------------------------- // @keyframes pulse { 0% { diff --git a/src/styles/_header.scss b/src/styles/_header.scss index 96f29fe..f727063 100644 --- a/src/styles/_header.scss +++ b/src/styles/_header.scss @@ -19,7 +19,7 @@ background: none; border-bottom: none; - .header__error { background-color: rgba(10, 10, 10, .99); } + &.header--error { background-color: rgba(10, 10, 10, .99); } } // Toolbars -------------------------------------------------------------- // diff --git a/src/styles/_imageview.scss b/src/styles/_imageview.scss index 31ccd57..d50dc57 100644 --- a/src/styles/_imageview.scss +++ b/src/styles/_imageview.scss @@ -21,21 +21,25 @@ right: 30px; bottom: 30px; left: 30px; - transition: top .3s, right .3s, bottom .3s, left .3s, opacity .2s, transform .2s; + margin: auto; + max-width: calc(100% - 60px); + max-height: calc(100% - 90px); + width: auto; + height: auto; + transition: top .3s, right .3s, bottom .3s, left .3s, max-width .3s, max-height .3s; will-change: transform; - display: flex; - justify-content: center; - align-items: center; - animation-name: zoomIn; animation-duration: .3s; animation-timing-function: $timingBounce; @media (max-width: 640px) { + top: 60px; right: 20px; bottom: 20px; left: 20px; + max-width: calc(100% - 40px); + max-height: calc(100% - 80px); } } @@ -44,20 +48,8 @@ right: 0; bottom: 0; left: 0; - } - - #image > div { - width: 0; - height: 0; - } - - #image img { - position: absolute; max-width: 100%; max-height: 100%; - width: auto; - height: auto; - transform: translate(-50%, -50%); } // Previous/Next Buttons -------------------------------------------------------------- // diff --git a/view.php b/view.php index f051f21..638af87 100644 --- a/view.php +++ b/view.php @@ -25,16 +25,9 @@ # Load required files require(__DIR__ . '/php/define.php'); require(__DIR__ . '/php/autoload.php'); - require(__DIR__ . '/php/modules/misc.php'); - require(LYCHEE_CONFIG_FILE); + require(__DIR__ . '/php/helpers/getGraphHeader.php'); - # Define the table prefix - if (!isset($dbTablePrefix)) $dbTablePrefix = ''; - defineTablePrefix($dbTablePrefix); - - $database = Database::connect($dbHost, $dbUser, $dbPassword, $dbName); - - echo getGraphHeader($database, $_GET['p']); + echo getGraphHeader($_GET['p']); }