Updated code style
This commit is contained in:
parent
eb887c7ca8
commit
606968f349
@ -2,9 +2,9 @@ function gup(b) {
|
||||
|
||||
b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]")
|
||||
|
||||
let a = "[\\?&]" + b + "=([^&#]*)",
|
||||
d = new RegExp(a),
|
||||
c = d.exec(window.location.href)
|
||||
let a = "[\\?&]" + b + "=([^&#]*)"
|
||||
let d = new RegExp(a)
|
||||
let c = d.exec(window.location.href)
|
||||
|
||||
if (c === null) return ''
|
||||
else return c[1]
|
||||
|
@ -146,9 +146,9 @@ album.add = function() {
|
||||
|
||||
album.delete = function(albumIDs) {
|
||||
|
||||
let action = {},
|
||||
cancel = {},
|
||||
msg = ''
|
||||
let action = {}
|
||||
let cancel = {}
|
||||
let msg = ''
|
||||
|
||||
if (!albumIDs) return false
|
||||
if (albumIDs instanceof Array===false) albumIDs = [ albumIDs ]
|
||||
@ -234,8 +234,8 @@ 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 ]
|
||||
@ -365,12 +365,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)
|
||||
|
||||
}
|
||||
@ -515,8 +515,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 +539,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,9 +553,9 @@ 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 ]
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -31,9 +31,9 @@ api.post = function(fn, params, callback) {
|
||||
else if (data==='') 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)
|
||||
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)
|
||||
|
@ -115,8 +115,8 @@ build.photo = function(data) {
|
||||
|
||||
build.imageview = function(data, visibleControls) {
|
||||
|
||||
let html = '',
|
||||
hasMedium = data.medium!==''
|
||||
let html = ''
|
||||
let hasMedium = data.medium!==''
|
||||
|
||||
if (hasMedium===false) {
|
||||
|
||||
|
@ -236,7 +236,7 @@ contextMenu.photoMore = function(photoID, e) {
|
||||
|
||||
contextMenu.move = function(photoIDs, e) {
|
||||
|
||||
var items = []
|
||||
let items = []
|
||||
|
||||
api.post('Album::getAll', {}, function(data) {
|
||||
|
||||
@ -278,8 +278,8 @@ contextMenu.move = function(photoIDs, e) {
|
||||
|
||||
contextMenu.sharePhoto = function(photoID, e) {
|
||||
|
||||
let link = photo.getViewLink(photoID),
|
||||
iconClass = 'ionicons'
|
||||
let link = photo.getViewLink(photoID)
|
||||
let iconClass = 'ionicons'
|
||||
|
||||
let items = [
|
||||
{ title: `<input readonly id="link" value="${ link }">`, fn: () => {}, class: 'basicContext__item--noHover' },
|
||||
|
@ -99,8 +99,8 @@ header.hide = function(e, delay = 500) {
|
||||
|
||||
header.setTitle = function(title = 'Untitled') {
|
||||
|
||||
let $title = header.dom('.header__title'),
|
||||
html = lychee.html`$${ title }${ build.iconic('caret-bottom') }`
|
||||
let $title = header.dom('.header__title')
|
||||
let html = lychee.html`$${ title }${ build.iconic('caret-bottom') }`
|
||||
|
||||
$title.html(html)
|
||||
|
||||
|
@ -24,31 +24,31 @@ $(document).ready(function() {
|
||||
|
||||
// Keyboard
|
||||
Mousetrap
|
||||
.bind('left', function() {
|
||||
.bind([ 'left' ], function() {
|
||||
if (visible.photo()) { $('#imageview a#previous').click(); return false }
|
||||
})
|
||||
.bind('right', function() {
|
||||
.bind([ 'right' ], function() {
|
||||
if (visible.photo()) { $('#imageview a#next').click(); return false }
|
||||
})
|
||||
.bind('u', function() {
|
||||
.bind([ 'u' ], function() {
|
||||
if (!visible.photo()) { $('#upload_files').click(); return false }
|
||||
})
|
||||
.bind([ 's', 'f' ], function() {
|
||||
if (visible.photo()) { header.dom('#button_star').click(); return false }
|
||||
else if (visible.albums()) { header.dom('.header__search').focus(); return false }
|
||||
})
|
||||
.bind('r', function() {
|
||||
.bind([ 'r' ], function() {
|
||||
if (visible.album()) { album.setTitle(album.getID()); return false }
|
||||
else if (visible.photo()) { photo.setTitle([photo.getID()]); return false }
|
||||
})
|
||||
.bind('d', function() {
|
||||
.bind([ 'd' ], function() {
|
||||
if (visible.photo()) { photo.setDescription(photo.getID()); return false }
|
||||
else if (visible.album()) { album.setDescription(album.getID()); return false }
|
||||
})
|
||||
.bind('t', function() {
|
||||
.bind([ 't' ], function() {
|
||||
if (visible.photo()) { photo.editTags([photo.getID()]); return false }
|
||||
})
|
||||
.bind('i', function() {
|
||||
.bind([ 'i' ], function() {
|
||||
if (!visible.multiselect()) { sidebar.toggle(); return false }
|
||||
})
|
||||
.bind([ 'command+backspace', 'ctrl+backspace' ], function() {
|
||||
|
@ -84,8 +84,8 @@ lychee.init = function() {
|
||||
|
||||
lychee.login = function(data) {
|
||||
|
||||
let user = data.username,
|
||||
password = data.password
|
||||
let user = data.username
|
||||
let password = data.password
|
||||
|
||||
let params = {
|
||||
user,
|
||||
@ -169,9 +169,9 @@ lychee.goto = function(url) {
|
||||
|
||||
lychee.load = function() {
|
||||
|
||||
let albumID = '',
|
||||
photoID = '',
|
||||
hash = document.location.hash.replace('#', '').split('/')
|
||||
let albumID = ''
|
||||
let photoID = ''
|
||||
let hash = document.location.hash.replace('#', '').split('/')
|
||||
|
||||
$('.no_content').remove()
|
||||
contextMenu.close()
|
||||
@ -227,9 +227,13 @@ lychee.load = function() {
|
||||
|
||||
lychee.getUpdate = function() {
|
||||
|
||||
const success = function(data) {
|
||||
if (data.lychee.version>parseInt(lychee.versionCode)) $('.version span').show()
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url : lychee.updatePath,
|
||||
success : function(data) { if (data.lychee.version>parseInt(lychee.versionCode)) $('.version span').show() },
|
||||
success : success
|
||||
})
|
||||
|
||||
}
|
||||
@ -256,12 +260,12 @@ lychee.setMode = function(mode) {
|
||||
.off('drop')
|
||||
|
||||
Mousetrap
|
||||
.unbind('u')
|
||||
.unbind('s')
|
||||
.unbind('f')
|
||||
.unbind('r')
|
||||
.unbind('d')
|
||||
.unbind('t')
|
||||
.unbind([ 'u' ])
|
||||
.unbind([ 's' ])
|
||||
.unbind([ 'f' ])
|
||||
.unbind([ 'r' ])
|
||||
.unbind([ 'd' ])
|
||||
.unbind([ 't' ])
|
||||
.unbind([ 'command+backspace', 'ctrl+backspace' ])
|
||||
.unbind([ 'command+a', 'ctrl+a' ])
|
||||
|
||||
@ -272,6 +276,7 @@ lychee.setMode = function(mode) {
|
||||
} else if (mode==='view') {
|
||||
|
||||
Mousetrap.unbind([ 'esc', 'command+up' ])
|
||||
|
||||
$('#button_back, a#next, a#previous').remove()
|
||||
$('.no_content').remove()
|
||||
|
||||
@ -306,8 +311,8 @@ lychee.animate = function(obj, animation) {
|
||||
|
||||
lychee.retinize = function(path = '') {
|
||||
|
||||
let extention = path.split('.').pop(),
|
||||
isPhoto = extention!=='svg'
|
||||
let extention = path.split('.').pop()
|
||||
let isPhoto = extention!=='svg'
|
||||
|
||||
if (isPhoto===true) {
|
||||
|
||||
@ -329,8 +334,8 @@ lychee.loadDropbox = function(callback) {
|
||||
|
||||
loadingBar.show()
|
||||
|
||||
let g = document.createElement('script'),
|
||||
s = document.getElementsByTagName('script')[0]
|
||||
let g = document.createElement('script')
|
||||
let s = document.getElementsByTagName('script')[0]
|
||||
|
||||
g.src = 'https://www.dropbox.com/static/api/1/dropins.js'
|
||||
g.id = 'dropboxjs'
|
||||
@ -360,8 +365,8 @@ lychee.loadDropbox = function(callback) {
|
||||
|
||||
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
|
||||
|
||||
@ -388,8 +393,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) => {
|
||||
|
||||
|
@ -89,8 +89,8 @@ multiselect.resize = function(e) {
|
||||
multiselect.position.bottom === null ||
|
||||
multiselect.position.left === null) return false
|
||||
|
||||
let newSize = {},
|
||||
documentSize = {}
|
||||
let newSize = {}
|
||||
let documentSize = {}
|
||||
|
||||
// Get the position of the mouse
|
||||
let mousePos = {
|
||||
@ -167,8 +167,8 @@ multiselect.getSize = function() {
|
||||
|
||||
if (!visible.multiselect()) return false
|
||||
|
||||
let $elem = $('#multiselect'),
|
||||
offset = $elem.offset()
|
||||
let $elem = $('#multiselect')
|
||||
let offset = $elem.offset()
|
||||
|
||||
return {
|
||||
top : offset.top,
|
||||
@ -181,9 +181,9 @@ multiselect.getSize = function() {
|
||||
|
||||
multiselect.getSelection = function(e) {
|
||||
|
||||
let tolerance = 150,
|
||||
ids = [],
|
||||
size = multiselect.getSize()
|
||||
let tolerance = 150
|
||||
let ids = []
|
||||
let size = multiselect.getSize()
|
||||
|
||||
if (visible.contextMenu()) return false
|
||||
if (!visible.multiselect()) return false
|
||||
|
@ -71,8 +71,8 @@ photo.preloadNext = function(photoID) {
|
||||
album.json.content[photoID] &&
|
||||
album.json.content[photoID].nextPhoto!='') {
|
||||
|
||||
let nextPhoto = album.json.content[photoID].nextPhoto,
|
||||
url = album.json.content[nextPhoto].url
|
||||
let nextPhoto = album.json.content[photoID].nextPhoto
|
||||
let url = album.json.content[nextPhoto].url
|
||||
|
||||
$('head [data-prefetch]').remove()
|
||||
$('head').append(`<link data-prefetch rel="prefetch" href="${ url }">`)
|
||||
@ -171,10 +171,10 @@ photo.duplicate = function(photoIDs) {
|
||||
|
||||
photo.delete = function(photoIDs) {
|
||||
|
||||
let action = {},
|
||||
cancel = {},
|
||||
msg = '',
|
||||
photoTitle = ''
|
||||
let action = {}
|
||||
let cancel = {}
|
||||
let msg = ''
|
||||
let photoTitle = ''
|
||||
|
||||
if (!photoIDs) return false
|
||||
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||
@ -192,8 +192,8 @@ photo.delete = function(photoIDs) {
|
||||
|
||||
action.fn = function() {
|
||||
|
||||
let nextPhoto,
|
||||
previousPhoto
|
||||
let nextPhoto
|
||||
let previousPhoto
|
||||
|
||||
basicModal.close()
|
||||
|
||||
@ -269,8 +269,8 @@ photo.delete = function(photoIDs) {
|
||||
|
||||
photo.setTitle = function(photoIDs) {
|
||||
|
||||
let oldTitle = '',
|
||||
msg = ''
|
||||
let oldTitle = ''
|
||||
let msg = ''
|
||||
|
||||
if (!photoIDs) return false
|
||||
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||
@ -335,8 +335,8 @@ photo.setTitle = function(photoIDs) {
|
||||
|
||||
photo.setAlbum = function(photoIDs, albumID) {
|
||||
|
||||
let nextPhoto,
|
||||
previousPhoto
|
||||
let nextPhoto
|
||||
let previousPhoto
|
||||
|
||||
if (!photoIDs) return false
|
||||
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||
@ -416,7 +416,7 @@ photo.setPublic = function(photoID, e) {
|
||||
}
|
||||
|
||||
basicModal.show({
|
||||
body: "<p>This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.</p>",
|
||||
body: '<p>This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.</p>',
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Show Album',
|
||||
@ -500,8 +500,8 @@ 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 ]
|
||||
@ -597,8 +597,8 @@ photo.deleteTag = function(photoID, index) {
|
||||
|
||||
photo.share = function(photoID, service) {
|
||||
|
||||
let link = '',
|
||||
url = photo.getViewLink(photoID)
|
||||
let link = ''
|
||||
let url = photo.getViewLink(photoID)
|
||||
|
||||
switch (service) {
|
||||
case 'twitter':
|
||||
@ -627,8 +627,8 @@ photo.share = function(photoID, service) {
|
||||
|
||||
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
|
||||
|
@ -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) {
|
||||
|
@ -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')
|
||||
@ -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() {
|
||||
|
||||
|
@ -30,7 +30,7 @@ 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')
|
||||
@ -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 visible = ''
|
||||
let downloadable = ''
|
||||
let password = ''
|
||||
|
||||
// Enable editable when user logged in
|
||||
if (lychee.publicMode===false) editable = true
|
||||
@ -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')
|
||||
|
@ -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() {
|
||||
|
||||
@ -122,8 +122,8 @@ upload.start = {
|
||||
|
||||
xhr.onload = function() {
|
||||
|
||||
let wait = false,
|
||||
errorText = ''
|
||||
let wait = false
|
||||
let errorText = ''
|
||||
|
||||
file.ready = true
|
||||
|
||||
|
@ -26,8 +26,8 @@ view.albums = {
|
||||
|
||||
init: function() {
|
||||
|
||||
let smartData = '',
|
||||
albumsData = ''
|
||||
let smartData = ''
|
||||
let albumsData = ''
|
||||
|
||||
// Smart Albums
|
||||
if (lychee.publicMode===false) {
|
||||
@ -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()
|
||||
|
@ -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) => {
|
||||
|
||||
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user