Updated code style
This commit is contained in:
parent
eb887c7ca8
commit
606968f349
@ -2,9 +2,9 @@ function gup(b) {
|
|||||||
|
|
||||||
b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]")
|
b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]")
|
||||||
|
|
||||||
let a = "[\\?&]" + b + "=([^&#]*)",
|
let a = "[\\?&]" + b + "=([^&#]*)"
|
||||||
d = new RegExp(a),
|
let d = new RegExp(a)
|
||||||
c = d.exec(window.location.href)
|
let c = d.exec(window.location.href)
|
||||||
|
|
||||||
if (c === null) return ''
|
if (c === null) return ''
|
||||||
else return c[1]
|
else return c[1]
|
||||||
|
@ -146,12 +146,12 @@ album.add = function() {
|
|||||||
|
|
||||||
album.delete = function(albumIDs) {
|
album.delete = function(albumIDs) {
|
||||||
|
|
||||||
let action = {},
|
let action = {}
|
||||||
cancel = {},
|
let cancel = {}
|
||||||
msg = ''
|
let msg = ''
|
||||||
|
|
||||||
if (!albumIDs) return false
|
if (!albumIDs) return false
|
||||||
if (albumIDs instanceof Array===false) albumIDs = [albumIDs]
|
if (albumIDs instanceof Array===false) albumIDs = [ albumIDs ]
|
||||||
|
|
||||||
action.fn = function() {
|
action.fn = function() {
|
||||||
|
|
||||||
@ -234,11 +234,11 @@ album.delete = function(albumIDs) {
|
|||||||
|
|
||||||
album.setTitle = function(albumIDs) {
|
album.setTitle = function(albumIDs) {
|
||||||
|
|
||||||
let oldTitle = '',
|
let oldTitle = ''
|
||||||
msg = ''
|
let msg = ''
|
||||||
|
|
||||||
if (!albumIDs) return false
|
if (!albumIDs) return false
|
||||||
if (albumIDs instanceof Array===false) albumIDs = [albumIDs]
|
if (albumIDs instanceof Array===false) albumIDs = [ albumIDs ]
|
||||||
|
|
||||||
if (albumIDs.length===1) {
|
if (albumIDs.length===1) {
|
||||||
|
|
||||||
@ -365,12 +365,12 @@ album.setPublic = function(albumID, modal, e) {
|
|||||||
|
|
||||||
if (modal===true) {
|
if (modal===true) {
|
||||||
|
|
||||||
let text = '',
|
let text = ''
|
||||||
action = {}
|
let action = {}
|
||||||
|
|
||||||
action.fn = () => {
|
action.fn = () => {
|
||||||
|
|
||||||
// setPublic function without showing the modal
|
// Call setPublic function without showing the modal
|
||||||
album.setPublic(album.getID(), false, e)
|
album.setPublic(album.getID(), false, e)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -515,8 +515,8 @@ album.setPublic = function(albumID, modal, e) {
|
|||||||
|
|
||||||
album.share = function(service) {
|
album.share = function(service) {
|
||||||
|
|
||||||
let link = '',
|
let link = ''
|
||||||
url = location.href
|
let url = location.href
|
||||||
|
|
||||||
switch (service) {
|
switch (service) {
|
||||||
case 'twitter':
|
case 'twitter':
|
||||||
@ -539,8 +539,8 @@ album.share = function(service) {
|
|||||||
|
|
||||||
album.getArchive = function(albumID) {
|
album.getArchive = function(albumID) {
|
||||||
|
|
||||||
let link,
|
let link = ''
|
||||||
url = `${ api.path }?function=Album::getArchive&albumID=${ albumID }`
|
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)
|
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
|
else link = location.href.replace(location.hash, '') + url
|
||||||
@ -553,12 +553,12 @@ album.getArchive = function(albumID) {
|
|||||||
|
|
||||||
album.merge = function(albumIDs) {
|
album.merge = function(albumIDs) {
|
||||||
|
|
||||||
let title = '',
|
let title = ''
|
||||||
sTitle = '',
|
let sTitle = ''
|
||||||
msg = ''
|
let msg = ''
|
||||||
|
|
||||||
if (!albumIDs) return false
|
if (!albumIDs) return false
|
||||||
if (albumIDs instanceof Array===false) albumIDs = [albumIDs]
|
if (albumIDs instanceof Array===false) albumIDs = [ albumIDs ]
|
||||||
|
|
||||||
// Get title of first album
|
// Get title of first album
|
||||||
if (albums.json) title = albums.getByID(albumIDs[0]).title
|
if (albums.json) title = albums.getByID(albumIDs[0]).title
|
||||||
|
@ -134,7 +134,7 @@ albums.deleteByID = function(albumID) {
|
|||||||
if (!albums.json) return false
|
if (!albums.json) return false
|
||||||
if (!albums.json.albums) return false
|
if (!albums.json.albums) return false
|
||||||
|
|
||||||
var deleted = false
|
let deleted = false
|
||||||
|
|
||||||
$.each(albums.json.albums, function(i) {
|
$.each(albums.json.albums, function(i) {
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ api.post = function(fn, params, callback) {
|
|||||||
|
|
||||||
loadingBar.show()
|
loadingBar.show()
|
||||||
|
|
||||||
params = $.extend({function: fn}, params)
|
params = $.extend({ function: fn }, params)
|
||||||
|
|
||||||
const success = (data) => {
|
const success = (data) => {
|
||||||
|
|
||||||
@ -31,9 +31,9 @@ api.post = function(fn, params, callback) {
|
|||||||
else if (data==='') data = false
|
else if (data==='') data = false
|
||||||
|
|
||||||
// Convert to JSON if string start with '{' and ends with '}'
|
// Convert to JSON if string start with '{' and ends with '}'
|
||||||
if (typeof data==='string' &&
|
if (typeof data==='string' && data.substring(0, 1)==='{' && data.substring(data.length - 1, data.length)==='}') {
|
||||||
data.substring(0, 1)==='{' &&
|
data = $.parseJSON(data)
|
||||||
data.substring(data.length-1, data.length)==='}') data = $.parseJSON(data)
|
}
|
||||||
|
|
||||||
// Output response when debug mode is enabled
|
// Output response when debug mode is enabled
|
||||||
if (lychee.debugMode) console.log(data)
|
if (lychee.debugMode) console.log(data)
|
||||||
|
@ -115,8 +115,8 @@ build.photo = function(data) {
|
|||||||
|
|
||||||
build.imageview = function(data, visibleControls) {
|
build.imageview = function(data, visibleControls) {
|
||||||
|
|
||||||
let html = '',
|
let html = ''
|
||||||
hasMedium = data.medium!==''
|
let hasMedium = data.medium!==''
|
||||||
|
|
||||||
if (hasMedium===false) {
|
if (hasMedium===false) {
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ build.uploadModal = function(title, files) {
|
|||||||
|
|
||||||
let file = files[i]
|
let file = files[i]
|
||||||
|
|
||||||
if (file.name.length>40) file.name = file.name.substr(0, 17) + '...' + file.name.substr(file.name.length-20, 20)
|
if (file.name.length>40) file.name = file.name.substr(0, 17) + '...' + file.name.substr(file.name.length - 20, 20)
|
||||||
|
|
||||||
html += lychee.html`
|
html += lychee.html`
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
|
@ -53,9 +53,9 @@ contextMenu.album = function(albumID, e) {
|
|||||||
let showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1)
|
let showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1)
|
||||||
|
|
||||||
let items = [
|
let items = [
|
||||||
{ title: build.iconic('pencil') + 'Rename', fn: () => album.setTitle([albumID]) },
|
{ title: build.iconic('pencil') + 'Rename', fn: () => album.setTitle([ albumID ]) },
|
||||||
{ title: build.iconic('collapse-left') + 'Merge', visible: showMerge, fn: () => { basicContext.close(); contextMenu.mergeAlbum(albumID, e) } },
|
{ title: build.iconic('collapse-left') + 'Merge', visible: showMerge, fn: () => { basicContext.close(); contextMenu.mergeAlbum(albumID, e) } },
|
||||||
{ title: build.iconic('trash') + 'Delete', fn: () => album.delete([albumID]) }
|
{ title: build.iconic('trash') + 'Delete', fn: () => album.delete([ albumID ]) }
|
||||||
]
|
]
|
||||||
|
|
||||||
$('.album[data-id="' + albumID + '"]').addClass('active')
|
$('.album[data-id="' + albumID + '"]').addClass('active')
|
||||||
@ -111,7 +111,7 @@ contextMenu.albumTitle = function(albumID, e) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
items.unshift({ title: build.iconic('pencil') + 'Rename', fn: () => album.setTitle([albumID]) })
|
items.unshift({ title: build.iconic('pencil') + 'Rename', fn: () => album.setTitle([ albumID ]) })
|
||||||
|
|
||||||
basicContext.show(items, e.originalEvent, contextMenu.close)
|
basicContext.show(items, e.originalEvent, contextMenu.close)
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ contextMenu.mergeAlbum = function(albumID, e) {
|
|||||||
|
|
||||||
let title = lychee.html`<img class='cover' width='16' height='16' src='$${ this.thumbs[0] }'><div class='title'>$${ this.title }</div>`
|
let title = lychee.html`<img class='cover' width='16' height='16' src='$${ this.thumbs[0] }'><div class='title'>$${ this.title }</div>`
|
||||||
|
|
||||||
if (this.id!=albumID) items.push({ title, fn: () => album.merge([albumID, this.id]) })
|
if (this.id!=albumID) items.push({ title, fn: () => album.merge([ albumID, this.id ]) })
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -154,13 +154,13 @@ contextMenu.photo = function(photoID, e) {
|
|||||||
// in order to keep the selection
|
// in order to keep the selection
|
||||||
|
|
||||||
let items = [
|
let items = [
|
||||||
{ title: build.iconic('star') + 'Star', fn: () => photo.setStar([photoID]) },
|
{ title: build.iconic('star') + 'Star', fn: () => photo.setStar([ photoID ]) },
|
||||||
{ title: build.iconic('tag') + 'Tags', fn: () => photo.editTags([photoID]) },
|
{ title: build.iconic('tag') + 'Tags', fn: () => photo.editTags([ photoID ]) },
|
||||||
{ },
|
{ },
|
||||||
{ title: build.iconic('pencil') + 'Rename', fn: () => photo.setTitle([photoID]) },
|
{ title: build.iconic('pencil') + 'Rename', fn: () => photo.setTitle([ photoID ]) },
|
||||||
{ title: build.iconic('layers') + 'Duplicate', fn: () => photo.duplicate([photoID]) },
|
{ title: build.iconic('layers') + 'Duplicate', fn: () => photo.duplicate([ photoID ]) },
|
||||||
{ title: build.iconic('folder') + 'Move', fn: () => { basicContext.close(); contextMenu.move([photoID], e) } },
|
{ title: build.iconic('folder') + 'Move', fn: () => { basicContext.close(); contextMenu.move([ photoID ], e) } },
|
||||||
{ title: build.iconic('trash') + 'Delete', fn: () => photo.delete([photoID]) }
|
{ title: build.iconic('trash') + 'Delete', fn: () => photo.delete([ photoID ]) }
|
||||||
]
|
]
|
||||||
|
|
||||||
$('.photo[data-id="' + photoID + '"]').addClass('active')
|
$('.photo[data-id="' + photoID + '"]').addClass('active')
|
||||||
@ -194,7 +194,7 @@ contextMenu.photoMulti = function(photoIDs, e) {
|
|||||||
contextMenu.photoTitle = function(albumID, photoID, e) {
|
contextMenu.photoTitle = function(albumID, photoID, e) {
|
||||||
|
|
||||||
let items = [
|
let items = [
|
||||||
{ title: build.iconic('pencil') + 'Rename', fn: () => photo.setTitle([photoID]) }
|
{ title: build.iconic('pencil') + 'Rename', fn: () => photo.setTitle([ photoID ]) }
|
||||||
]
|
]
|
||||||
|
|
||||||
let data = album.json
|
let data = album.json
|
||||||
@ -236,7 +236,7 @@ contextMenu.photoMore = function(photoID, e) {
|
|||||||
|
|
||||||
contextMenu.move = function(photoIDs, e) {
|
contextMenu.move = function(photoIDs, e) {
|
||||||
|
|
||||||
var items = []
|
let items = []
|
||||||
|
|
||||||
api.post('Album::getAll', {}, function(data) {
|
api.post('Album::getAll', {}, function(data) {
|
||||||
|
|
||||||
@ -278,8 +278,8 @@ contextMenu.move = function(photoIDs, e) {
|
|||||||
|
|
||||||
contextMenu.sharePhoto = function(photoID, e) {
|
contextMenu.sharePhoto = function(photoID, e) {
|
||||||
|
|
||||||
let link = photo.getViewLink(photoID),
|
let link = photo.getViewLink(photoID)
|
||||||
iconClass = 'ionicons'
|
let iconClass = 'ionicons'
|
||||||
|
|
||||||
let items = [
|
let items = [
|
||||||
{ title: `<input readonly id="link" value="${ link }">`, fn: () => {}, class: 'basicContext__item--noHover' },
|
{ title: `<input readonly id="link" value="${ link }">`, fn: () => {}, class: 'basicContext__item--noHover' },
|
||||||
|
@ -46,17 +46,17 @@ header.bind = function() {
|
|||||||
header.dom('#button_info') .on(eventName, sidebar.toggle)
|
header.dom('#button_info') .on(eventName, sidebar.toggle)
|
||||||
header.dom('.button_add') .on(eventName, contextMenu.add)
|
header.dom('.button_add') .on(eventName, contextMenu.add)
|
||||||
header.dom('#button_more') .on(eventName, function(e) { contextMenu.photoMore(photo.getID(), e) })
|
header.dom('#button_more') .on(eventName, function(e) { contextMenu.photoMore(photo.getID(), e) })
|
||||||
header.dom('#button_move') .on(eventName, function(e) { contextMenu.move([photo.getID()], e) })
|
header.dom('#button_move') .on(eventName, function(e) { contextMenu.move([ photo.getID() ], e) })
|
||||||
header.dom('.header__hostedwith') .on(eventName, function() { window.open(lychee.website) })
|
header.dom('.header__hostedwith') .on(eventName, function() { window.open(lychee.website) })
|
||||||
header.dom('#button_trash_album') .on(eventName, function() { album.delete([album.getID()]) })
|
header.dom('#button_trash_album') .on(eventName, function() { album.delete([ album.getID() ]) })
|
||||||
header.dom('#button_trash') .on(eventName, function() { photo.delete([photo.getID()]) })
|
header.dom('#button_trash') .on(eventName, function() { photo.delete([ photo.getID() ]) })
|
||||||
header.dom('#button_archive') .on(eventName, function() { album.getArchive(album.getID()) })
|
header.dom('#button_archive') .on(eventName, function() { album.getArchive(album.getID()) })
|
||||||
header.dom('#button_star') .on(eventName, function() { photo.setStar([photo.getID()]) })
|
header.dom('#button_star') .on(eventName, function() { photo.setStar([ photo.getID() ]) })
|
||||||
header.dom('#button_back_home') .on(eventName, function() { lychee.goto('') })
|
header.dom('#button_back_home') .on(eventName, function() { lychee.goto('') })
|
||||||
header.dom('#button_back') .on(eventName, function() { lychee.goto(album.getID()) })
|
header.dom('#button_back') .on(eventName, function() { lychee.goto(album.getID()) })
|
||||||
|
|
||||||
header.dom('.header__search').on('keyup click', function() { search.find($(this).val()) })
|
header.dom('.header__search').on('keyup click', function() { search.find($(this).val()) })
|
||||||
header.dom('.header__clear').on(eventName, function () {
|
header.dom('.header__clear').on(eventName, function() {
|
||||||
header.dom('.header__search').focus()
|
header.dom('.header__search').focus()
|
||||||
search.reset()
|
search.reset()
|
||||||
})
|
})
|
||||||
@ -99,8 +99,8 @@ header.hide = function(e, delay = 500) {
|
|||||||
|
|
||||||
header.setTitle = function(title = 'Untitled') {
|
header.setTitle = function(title = 'Untitled') {
|
||||||
|
|
||||||
let $title = header.dom('.header__title'),
|
let $title = header.dom('.header__title')
|
||||||
html = lychee.html`$${ title }${ build.iconic('caret-bottom') }`
|
let html = lychee.html`$${ title }${ build.iconic('caret-bottom') }`
|
||||||
|
|
||||||
$title.html(html)
|
$title.html(html)
|
||||||
|
|
||||||
|
@ -24,38 +24,38 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Keyboard
|
// Keyboard
|
||||||
Mousetrap
|
Mousetrap
|
||||||
.bind('left', function() {
|
.bind([ 'left' ], function() {
|
||||||
if (visible.photo()) { $('#imageview a#previous').click(); return false }
|
if (visible.photo()) { $('#imageview a#previous').click(); return false }
|
||||||
})
|
})
|
||||||
.bind('right', function() {
|
.bind([ 'right' ], function() {
|
||||||
if (visible.photo()) { $('#imageview a#next').click(); return false }
|
if (visible.photo()) { $('#imageview a#next').click(); return false }
|
||||||
})
|
})
|
||||||
.bind('u', function() {
|
.bind([ 'u' ], function() {
|
||||||
if (!visible.photo()) { $('#upload_files').click(); return false }
|
if (!visible.photo()) { $('#upload_files').click(); return false }
|
||||||
})
|
})
|
||||||
.bind(['s', 'f'], function() {
|
.bind([ 's', 'f' ], function() {
|
||||||
if (visible.photo()) { header.dom('#button_star').click(); return false }
|
if (visible.photo()) { header.dom('#button_star').click(); return false }
|
||||||
else if (visible.albums()) { header.dom('.header__search').focus(); 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 }
|
if (visible.album()) { album.setTitle(album.getID()); return false }
|
||||||
else if (visible.photo()) { photo.setTitle([photo.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 }
|
if (visible.photo()) { photo.setDescription(photo.getID()); return false }
|
||||||
else if (visible.album()) { album.setDescription(album.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 }
|
if (visible.photo()) { photo.editTags([photo.getID()]); return false }
|
||||||
})
|
})
|
||||||
.bind('i', function() {
|
.bind([ 'i' ], function() {
|
||||||
if (!visible.multiselect()) { sidebar.toggle(); return false }
|
if (!visible.multiselect()) { sidebar.toggle(); return false }
|
||||||
})
|
})
|
||||||
.bind(['command+backspace', 'ctrl+backspace'], function() {
|
.bind([ 'command+backspace', 'ctrl+backspace' ], function() {
|
||||||
if (visible.photo() && basicModal.visible()===false) { photo.delete([photo.getID()]); return false }
|
if (visible.photo() && basicModal.visible()===false) { photo.delete([photo.getID()]); return false }
|
||||||
else if (visible.album() && basicModal.visible()===false) { album.delete([album.getID()]); return false }
|
else if (visible.album() && basicModal.visible()===false) { album.delete([album.getID()]); return false }
|
||||||
})
|
})
|
||||||
.bind(['command+a', 'ctrl+a'], function() {
|
.bind([ 'command+a', 'ctrl+a' ], function() {
|
||||||
if (visible.album() && basicModal.visible()===false) { multiselect.selectAll(); return false }
|
if (visible.album() && basicModal.visible()===false) { multiselect.selectAll(); return false }
|
||||||
else if (visible.albums() && basicModal.visible()===false) { multiselect.selectAll(); return false }
|
else if (visible.albums() && basicModal.visible()===false) { multiselect.selectAll(); return false }
|
||||||
})
|
})
|
||||||
@ -64,7 +64,7 @@ $(document).ready(function() {
|
|||||||
if (basicModal.visible()===true) basicModal.action()
|
if (basicModal.visible()===true) basicModal.action()
|
||||||
})
|
})
|
||||||
|
|
||||||
Mousetrap.bindGlobal(['esc', 'command+up'], function() {
|
Mousetrap.bindGlobal([ 'esc', 'command+up' ], function() {
|
||||||
if (basicModal.visible()===true) basicModal.cancel()
|
if (basicModal.visible()===true) basicModal.cancel()
|
||||||
else if (visible.contextMenu()) contextMenu.close()
|
else if (visible.contextMenu()) contextMenu.close()
|
||||||
else if (visible.photo()) lychee.goto(album.getID())
|
else if (visible.photo()) lychee.goto(album.getID())
|
||||||
|
@ -84,8 +84,8 @@ lychee.init = function() {
|
|||||||
|
|
||||||
lychee.login = function(data) {
|
lychee.login = function(data) {
|
||||||
|
|
||||||
let user = data.username,
|
let user = data.username
|
||||||
password = data.password
|
let password = data.password
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
user,
|
user,
|
||||||
@ -169,9 +169,9 @@ lychee.goto = function(url) {
|
|||||||
|
|
||||||
lychee.load = function() {
|
lychee.load = function() {
|
||||||
|
|
||||||
let albumID = '',
|
let albumID = ''
|
||||||
photoID = '',
|
let photoID = ''
|
||||||
hash = document.location.hash.replace('#', '').split('/')
|
let hash = document.location.hash.replace('#', '').split('/')
|
||||||
|
|
||||||
$('.no_content').remove()
|
$('.no_content').remove()
|
||||||
contextMenu.close()
|
contextMenu.close()
|
||||||
@ -227,9 +227,13 @@ lychee.load = function() {
|
|||||||
|
|
||||||
lychee.getUpdate = function() {
|
lychee.getUpdate = function() {
|
||||||
|
|
||||||
|
const success = function(data) {
|
||||||
|
if (data.lychee.version>parseInt(lychee.versionCode)) $('.version span').show()
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : lychee.updatePath,
|
url : lychee.updatePath,
|
||||||
success : function(data) { if (data.lychee.version>parseInt(lychee.versionCode)) $('.version span').show() },
|
success : success
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -256,14 +260,14 @@ lychee.setMode = function(mode) {
|
|||||||
.off('drop')
|
.off('drop')
|
||||||
|
|
||||||
Mousetrap
|
Mousetrap
|
||||||
.unbind('u')
|
.unbind([ 'u' ])
|
||||||
.unbind('s')
|
.unbind([ 's' ])
|
||||||
.unbind('f')
|
.unbind([ 'f' ])
|
||||||
.unbind('r')
|
.unbind([ 'r' ])
|
||||||
.unbind('d')
|
.unbind([ 'd' ])
|
||||||
.unbind('t')
|
.unbind([ 't' ])
|
||||||
.unbind(['command+backspace', 'ctrl+backspace'])
|
.unbind([ 'command+backspace', 'ctrl+backspace' ])
|
||||||
.unbind(['command+a', 'ctrl+a'])
|
.unbind([ 'command+a', 'ctrl+a' ])
|
||||||
|
|
||||||
if (mode==='public') {
|
if (mode==='public') {
|
||||||
|
|
||||||
@ -271,7 +275,8 @@ lychee.setMode = function(mode) {
|
|||||||
|
|
||||||
} else if (mode==='view') {
|
} else if (mode==='view') {
|
||||||
|
|
||||||
Mousetrap.unbind(['esc', 'command+up'])
|
Mousetrap.unbind([ 'esc', 'command+up' ])
|
||||||
|
|
||||||
$('#button_back, a#next, a#previous').remove()
|
$('#button_back, a#next, a#previous').remove()
|
||||||
$('.no_content').remove()
|
$('.no_content').remove()
|
||||||
|
|
||||||
@ -285,8 +290,8 @@ lychee.setMode = function(mode) {
|
|||||||
lychee.animate = function(obj, animation) {
|
lychee.animate = function(obj, animation) {
|
||||||
|
|
||||||
let animations = [
|
let animations = [
|
||||||
['fadeIn', 'fadeOut'],
|
[ 'fadeIn', 'fadeOut' ],
|
||||||
['contentZoomIn', 'contentZoomOut']
|
[ 'contentZoomIn', 'contentZoomOut' ]
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!obj.jQuery) obj = $(obj)
|
if (!obj.jQuery) obj = $(obj)
|
||||||
@ -306,8 +311,8 @@ lychee.animate = function(obj, animation) {
|
|||||||
|
|
||||||
lychee.retinize = function(path = '') {
|
lychee.retinize = function(path = '') {
|
||||||
|
|
||||||
let extention = path.split('.').pop(),
|
let extention = path.split('.').pop()
|
||||||
isPhoto = extention!=='svg'
|
let isPhoto = extention!=='svg'
|
||||||
|
|
||||||
if (isPhoto===true) {
|
if (isPhoto===true) {
|
||||||
|
|
||||||
@ -329,8 +334,8 @@ lychee.loadDropbox = function(callback) {
|
|||||||
|
|
||||||
loadingBar.show()
|
loadingBar.show()
|
||||||
|
|
||||||
let g = document.createElement('script'),
|
let g = document.createElement('script')
|
||||||
s = document.getElementsByTagName('script')[0]
|
let s = document.getElementsByTagName('script')[0]
|
||||||
|
|
||||||
g.src = 'https://www.dropbox.com/static/api/1/dropins.js'
|
g.src = 'https://www.dropbox.com/static/api/1/dropins.js'
|
||||||
g.id = 'dropboxjs'
|
g.id = 'dropboxjs'
|
||||||
@ -360,8 +365,8 @@ lychee.loadDropbox = function(callback) {
|
|||||||
|
|
||||||
lychee.getEventName = function() {
|
lychee.getEventName = function() {
|
||||||
|
|
||||||
let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement),
|
let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement)
|
||||||
eventName = (touchendSupport===true ? 'touchend' : 'click')
|
let eventName = (touchendSupport===true ? 'touchend' : 'click')
|
||||||
|
|
||||||
return eventName
|
return eventName
|
||||||
|
|
||||||
@ -388,8 +393,8 @@ lychee.html = function(literalSections, ...substs) {
|
|||||||
|
|
||||||
// Use raw literal sections: we don’t want
|
// Use raw literal sections: we don’t want
|
||||||
// backslashes (\n etc.) to be interpreted
|
// backslashes (\n etc.) to be interpreted
|
||||||
let raw = literalSections.raw,
|
let raw = literalSections.raw
|
||||||
result = ''
|
let result = ''
|
||||||
|
|
||||||
substs.forEach((subst, i) => {
|
substs.forEach((subst, i) => {
|
||||||
|
|
||||||
@ -412,7 +417,7 @@ lychee.html = function(literalSections, ...substs) {
|
|||||||
// Take care of last literal section
|
// Take care of last literal section
|
||||||
// (Never fails, because an empty template string
|
// (Never fails, because an empty template string
|
||||||
// produces one literal section, an empty string)
|
// produces one literal section, an empty string)
|
||||||
result += raw[raw.length-1]
|
result += raw[raw.length - 1]
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ multiselect.resize = function(e) {
|
|||||||
multiselect.position.bottom === null ||
|
multiselect.position.bottom === null ||
|
||||||
multiselect.position.left === null) return false
|
multiselect.position.left === null) return false
|
||||||
|
|
||||||
let newSize = {},
|
let newSize = {}
|
||||||
documentSize = {}
|
let documentSize = {}
|
||||||
|
|
||||||
// Get the position of the mouse
|
// Get the position of the mouse
|
||||||
let mousePos = {
|
let mousePos = {
|
||||||
@ -114,7 +114,7 @@ multiselect.resize = function(e) {
|
|||||||
|
|
||||||
// Do not leave the screen
|
// Do not leave the screen
|
||||||
newSize.height = mousePos.y - multiselect.position.top
|
newSize.height = mousePos.y - multiselect.position.top
|
||||||
if ((multiselect.position.top+newSize.height)>=documentSize.height) {
|
if ((multiselect.position.top + newSize.height)>=documentSize.height) {
|
||||||
newSize.height -= (multiselect.position.top + newSize.height) - documentSize.height + 2
|
newSize.height -= (multiselect.position.top + newSize.height) - documentSize.height + 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ multiselect.resize = function(e) {
|
|||||||
|
|
||||||
// Do not leave the screen
|
// Do not leave the screen
|
||||||
newSize.width = mousePos.x - multiselect.position.left
|
newSize.width = mousePos.x - multiselect.position.left
|
||||||
if ((multiselect.position.left+newSize.width)>=documentSize.width) {
|
if ((multiselect.position.left + newSize.width)>=documentSize.width) {
|
||||||
newSize.width -= (multiselect.position.left + newSize.width) - documentSize.width + 2
|
newSize.width -= (multiselect.position.left + newSize.width) - documentSize.width + 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,8 +167,8 @@ multiselect.getSize = function() {
|
|||||||
|
|
||||||
if (!visible.multiselect()) return false
|
if (!visible.multiselect()) return false
|
||||||
|
|
||||||
let $elem = $('#multiselect'),
|
let $elem = $('#multiselect')
|
||||||
offset = $elem.offset()
|
let offset = $elem.offset()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
top : offset.top,
|
top : offset.top,
|
||||||
@ -181,9 +181,9 @@ multiselect.getSize = function() {
|
|||||||
|
|
||||||
multiselect.getSelection = function(e) {
|
multiselect.getSelection = function(e) {
|
||||||
|
|
||||||
let tolerance = 150,
|
let tolerance = 150
|
||||||
ids = [],
|
let ids = []
|
||||||
size = multiselect.getSize()
|
let size = multiselect.getSize()
|
||||||
|
|
||||||
if (visible.contextMenu()) return false
|
if (visible.contextMenu()) return false
|
||||||
if (!visible.multiselect()) return false
|
if (!visible.multiselect()) return false
|
||||||
@ -192,19 +192,19 @@ multiselect.getSelection = function(e) {
|
|||||||
|
|
||||||
let offset = $(this).offset()
|
let offset = $(this).offset()
|
||||||
|
|
||||||
if (offset.top>=(size.top-tolerance) &&
|
if (offset.top>=(size.top - tolerance) &&
|
||||||
offset.left>=(size.left-tolerance) &&
|
offset.left>=(size.left - tolerance) &&
|
||||||
(offset.top+206)<=(size.top+size.height+tolerance) &&
|
(offset.top + 206)<=(size.top + size.height + tolerance) &&
|
||||||
(offset.left+206)<=(size.left+size.width+tolerance)) {
|
(offset.left + 206)<=(size.left + size.width + tolerance)) {
|
||||||
|
|
||||||
let id = $(this).data('id')
|
let id = $(this).data('id')
|
||||||
|
|
||||||
if (id!=='0' && id!==0 && id!=='f' && id!=='s' && id!=='r' && id!=null) {
|
if (id!=='0' && id!==0 && id!=='f' && id!=='s' && id!=='r' && id!=null) {
|
||||||
|
|
||||||
ids.push(id)
|
ids.push(id)
|
||||||
$(this).addClass('active')
|
$(this).addClass('active')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ photo.preloadNext = function(photoID) {
|
|||||||
album.json.content[photoID] &&
|
album.json.content[photoID] &&
|
||||||
album.json.content[photoID].nextPhoto!='') {
|
album.json.content[photoID].nextPhoto!='') {
|
||||||
|
|
||||||
let nextPhoto = album.json.content[photoID].nextPhoto,
|
let nextPhoto = album.json.content[photoID].nextPhoto
|
||||||
url = album.json.content[nextPhoto].url
|
let url = album.json.content[nextPhoto].url
|
||||||
|
|
||||||
$('head [data-prefetch]').remove()
|
$('head [data-prefetch]').remove()
|
||||||
$('head').append(`<link data-prefetch rel="prefetch" href="${ url }">`)
|
$('head').append(`<link data-prefetch rel="prefetch" href="${ url }">`)
|
||||||
@ -152,7 +152,7 @@ photo.next = function(animate) {
|
|||||||
photo.duplicate = function(photoIDs) {
|
photo.duplicate = function(photoIDs) {
|
||||||
|
|
||||||
if (!photoIDs) return false
|
if (!photoIDs) return false
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs]
|
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||||
|
|
||||||
albums.refresh()
|
albums.refresh()
|
||||||
|
|
||||||
@ -171,13 +171,13 @@ photo.duplicate = function(photoIDs) {
|
|||||||
|
|
||||||
photo.delete = function(photoIDs) {
|
photo.delete = function(photoIDs) {
|
||||||
|
|
||||||
let action = {},
|
let action = {}
|
||||||
cancel = {},
|
let cancel = {}
|
||||||
msg = '',
|
let msg = ''
|
||||||
photoTitle = ''
|
let photoTitle = ''
|
||||||
|
|
||||||
if (!photoIDs) return false
|
if (!photoIDs) return false
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs]
|
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||||
|
|
||||||
if (photoIDs.length===1) {
|
if (photoIDs.length===1) {
|
||||||
|
|
||||||
@ -192,8 +192,8 @@ photo.delete = function(photoIDs) {
|
|||||||
|
|
||||||
action.fn = function() {
|
action.fn = function() {
|
||||||
|
|
||||||
let nextPhoto,
|
let nextPhoto
|
||||||
previousPhoto
|
let previousPhoto
|
||||||
|
|
||||||
basicModal.close()
|
basicModal.close()
|
||||||
|
|
||||||
@ -269,11 +269,11 @@ photo.delete = function(photoIDs) {
|
|||||||
|
|
||||||
photo.setTitle = function(photoIDs) {
|
photo.setTitle = function(photoIDs) {
|
||||||
|
|
||||||
let oldTitle = '',
|
let oldTitle = ''
|
||||||
msg = ''
|
let msg = ''
|
||||||
|
|
||||||
if (!photoIDs) return false
|
if (!photoIDs) return false
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs]
|
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||||
|
|
||||||
if (photoIDs.length===1) {
|
if (photoIDs.length===1) {
|
||||||
|
|
||||||
@ -300,8 +300,8 @@ photo.setTitle = function(photoIDs) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
photoIDs: photoIDs.join(),
|
photoIDs : photoIDs.join(),
|
||||||
title: newTitle
|
title : newTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
api.post('Photo::setTitle', params, function(data) {
|
api.post('Photo::setTitle', params, function(data) {
|
||||||
@ -335,11 +335,11 @@ photo.setTitle = function(photoIDs) {
|
|||||||
|
|
||||||
photo.setAlbum = function(photoIDs, albumID) {
|
photo.setAlbum = function(photoIDs, albumID) {
|
||||||
|
|
||||||
let nextPhoto,
|
let nextPhoto
|
||||||
previousPhoto
|
let previousPhoto
|
||||||
|
|
||||||
if (!photoIDs) return false
|
if (!photoIDs) return false
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs]
|
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||||
|
|
||||||
if (visible.photo) lychee.goto(album.getID())
|
if (visible.photo) lychee.goto(album.getID())
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ photo.setPublic = function(photoID, e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
basicModal.show({
|
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: {
|
buttons: {
|
||||||
action: {
|
action: {
|
||||||
title: 'Show Album',
|
title: 'Show Album',
|
||||||
@ -500,11 +500,11 @@ photo.setDescription = function(photoID) {
|
|||||||
|
|
||||||
photo.editTags = function(photoIDs) {
|
photo.editTags = function(photoIDs) {
|
||||||
|
|
||||||
let oldTags = '',
|
let oldTags = ''
|
||||||
msg = ''
|
let msg = ''
|
||||||
|
|
||||||
if (!photoIDs) return false
|
if (!photoIDs) return false
|
||||||
if (photoIDs instanceof Array===false) photoIDs = [photoIDs]
|
if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ]
|
||||||
|
|
||||||
// Get tags
|
// Get tags
|
||||||
if (visible.photo()) oldTags = photo.json.tags
|
if (visible.photo()) oldTags = photo.json.tags
|
||||||
@ -591,14 +591,14 @@ photo.deleteTag = function(photoID, index) {
|
|||||||
|
|
||||||
// Save
|
// Save
|
||||||
photo.json.tags = tags.toString()
|
photo.json.tags = tags.toString()
|
||||||
photo.setTags([photoID], photo.json.tags)
|
photo.setTags([ photoID ], photo.json.tags)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
photo.share = function(photoID, service) {
|
photo.share = function(photoID, service) {
|
||||||
|
|
||||||
let link = '',
|
let link = ''
|
||||||
url = photo.getViewLink(photoID)
|
let url = photo.getViewLink(photoID)
|
||||||
|
|
||||||
switch (service) {
|
switch (service) {
|
||||||
case 'twitter':
|
case 'twitter':
|
||||||
@ -627,8 +627,8 @@ photo.share = function(photoID, service) {
|
|||||||
|
|
||||||
photo.getArchive = function(photoID) {
|
photo.getArchive = function(photoID) {
|
||||||
|
|
||||||
let link,
|
let link
|
||||||
url = `${ api.path }?function=Photo::getArchive&photoID=${ photoID }`
|
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)
|
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
|
else link = location.href.replace(location.hash, '') + url
|
||||||
|
@ -19,9 +19,9 @@ search.find = function(term) {
|
|||||||
|
|
||||||
api.post('search', { term }, function(data) {
|
api.post('search', { term }, function(data) {
|
||||||
|
|
||||||
let html = '',
|
let html = ''
|
||||||
albumsData = '',
|
let albumsData = ''
|
||||||
photosData = ''
|
let photosData = ''
|
||||||
|
|
||||||
// Build albums
|
// Build albums
|
||||||
if (data && data.albums) {
|
if (data && data.albums) {
|
||||||
|
@ -9,11 +9,11 @@ settings.createConfig = function() {
|
|||||||
|
|
||||||
const action = function(data) {
|
const action = function(data) {
|
||||||
|
|
||||||
let dbName = data.dbName || '',
|
let dbName = data.dbName || ''
|
||||||
dbUser = data.dbUser || '',
|
let dbUser = data.dbUser || ''
|
||||||
dbPassword = data.dbPassword || '',
|
let dbPassword = data.dbPassword || ''
|
||||||
dbHost = data.dbHost || '',
|
let dbHost = data.dbHost || ''
|
||||||
dbTablePrefix = data.dbTablePrefix || ''
|
let dbTablePrefix = data.dbTablePrefix || ''
|
||||||
|
|
||||||
if (dbUser.length<1) {
|
if (dbUser.length<1) {
|
||||||
basicModal.error('dbUser')
|
basicModal.error('dbUser')
|
||||||
@ -140,8 +140,8 @@ settings.createLogin = function() {
|
|||||||
|
|
||||||
const action = function(data) {
|
const action = function(data) {
|
||||||
|
|
||||||
let username = data.username,
|
let username = data.username
|
||||||
password = data.password
|
let password = data.password
|
||||||
|
|
||||||
if (username.length<1) {
|
if (username.length<1) {
|
||||||
basicModal.error('username')
|
basicModal.error('username')
|
||||||
@ -204,9 +204,9 @@ settings.setLogin = function() {
|
|||||||
|
|
||||||
const action = function(data) {
|
const action = function(data) {
|
||||||
|
|
||||||
let oldPassword = data.oldPassword || '',
|
let oldPassword = data.oldPassword || ''
|
||||||
username = data.username || '',
|
let username = data.username || ''
|
||||||
password = data.password || ''
|
let password = data.password || ''
|
||||||
|
|
||||||
if (oldPassword.length<1) {
|
if (oldPassword.length<1) {
|
||||||
basicModal.error('oldPassword')
|
basicModal.error('oldPassword')
|
||||||
@ -269,8 +269,8 @@ settings.setLogin = function() {
|
|||||||
|
|
||||||
settings.setSorting = function() {
|
settings.setSorting = function() {
|
||||||
|
|
||||||
let sortingPhotos = [],
|
let sortingPhotos = []
|
||||||
sortingAlbums = []
|
let sortingAlbums = []
|
||||||
|
|
||||||
const action = function() {
|
const action = function() {
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ sidebar.bind = function() {
|
|||||||
// event handlers should be removed before binding a new one.
|
// event handlers should be removed before binding a new one.
|
||||||
|
|
||||||
// Event Name
|
// Event Name
|
||||||
let eventName = lychee.getEventName();
|
let eventName = lychee.getEventName()
|
||||||
|
|
||||||
sidebar
|
sidebar
|
||||||
.dom('#edit_title')
|
.dom('#edit_title')
|
||||||
.off(eventName)
|
.off(eventName)
|
||||||
.on(eventName, function() {
|
.on(eventName, function() {
|
||||||
if (visible.photo()) photo.setTitle([photo.getID()])
|
if (visible.photo()) photo.setTitle([ photo.getID() ])
|
||||||
else if (visible.album()) album.setTitle([album.getID()])
|
else if (visible.album()) album.setTitle([ album.getID() ])
|
||||||
})
|
})
|
||||||
|
|
||||||
sidebar
|
sidebar
|
||||||
@ -52,7 +52,7 @@ sidebar.bind = function() {
|
|||||||
.dom('#edit_tags')
|
.dom('#edit_tags')
|
||||||
.off(eventName)
|
.off(eventName)
|
||||||
.on(eventName, function() {
|
.on(eventName, function() {
|
||||||
photo.editTags([photo.getID()])
|
photo.editTags([ photo.getID() ])
|
||||||
})
|
})
|
||||||
|
|
||||||
sidebar
|
sidebar
|
||||||
@ -114,10 +114,10 @@ sidebar.createStructure.photo = function(data) {
|
|||||||
|
|
||||||
if (data==null || data==='') return false
|
if (data==null || data==='') return false
|
||||||
|
|
||||||
let editable = false,
|
let editable = false
|
||||||
exifHash = data.takestamp + data.make + data.model + data.shutter + data.aperture + data.focal + data.iso,
|
let exifHash = data.takestamp + data.make + data.model + data.shutter + data.aperture + data.focal + data.iso
|
||||||
structure = {},
|
let structure = {}
|
||||||
_public = ''
|
let _public = ''
|
||||||
|
|
||||||
// Enable editable when user logged in
|
// Enable editable when user logged in
|
||||||
if (lychee.publicMode===false) editable = true
|
if (lychee.publicMode===false) editable = true
|
||||||
@ -220,12 +220,12 @@ sidebar.createStructure.album = function(data) {
|
|||||||
|
|
||||||
if (data==null || data==='') return false
|
if (data==null || data==='') return false
|
||||||
|
|
||||||
let editable = false,
|
let editable = false
|
||||||
structure = {},
|
let structure = {}
|
||||||
_public = '',
|
let _public = ''
|
||||||
visible = '',
|
let visible = ''
|
||||||
downloadable = '',
|
let downloadable = ''
|
||||||
password = ''
|
let password = ''
|
||||||
|
|
||||||
// Enable editable when user logged in
|
// Enable editable when user logged in
|
||||||
if (lychee.publicMode===false) editable = true
|
if (lychee.publicMode===false) editable = true
|
||||||
@ -367,8 +367,8 @@ sidebar.render = function(structure) {
|
|||||||
|
|
||||||
let renderTags = function(section) {
|
let renderTags = function(section) {
|
||||||
|
|
||||||
let _html = '',
|
let _html = ''
|
||||||
editable = ''
|
let editable = ''
|
||||||
|
|
||||||
// Add edit-icon to the value when editable
|
// Add edit-icon to the value when editable
|
||||||
if (section.editable===true) editable = build.editIcon('edit_tags')
|
if (section.editable===true) editable = build.editIcon('edit_tags')
|
||||||
|
@ -40,16 +40,16 @@ upload.start = {
|
|||||||
|
|
||||||
local: function(files) {
|
local: function(files) {
|
||||||
|
|
||||||
let albumID = album.getID(),
|
let albumID = album.getID()
|
||||||
error = false,
|
let error = false
|
||||||
warning = false
|
let warning = false
|
||||||
|
|
||||||
const process = function(files, file) {
|
const process = function(files, file) {
|
||||||
|
|
||||||
let formData = new FormData(),
|
let formData = new FormData()
|
||||||
xhr = new XMLHttpRequest(),
|
let xhr = new XMLHttpRequest()
|
||||||
pre_progress = 0,
|
let pre_progress = 0
|
||||||
progress = 0
|
let progress = 0
|
||||||
|
|
||||||
const finish = function() {
|
const finish = function() {
|
||||||
|
|
||||||
@ -122,8 +122,8 @@ upload.start = {
|
|||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
|
|
||||||
let wait = false,
|
let wait = false
|
||||||
errorText = ''
|
let errorText = ''
|
||||||
|
|
||||||
file.ready = true
|
file.ready = true
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ upload.start = {
|
|||||||
if (xhr.status===200 && xhr.responseText==='1') {
|
if (xhr.status===200 && xhr.responseText==='1') {
|
||||||
|
|
||||||
// Success
|
// Success
|
||||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
$('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status')
|
||||||
.html('Finished')
|
.html('Finished')
|
||||||
.addClass('success')
|
.addClass('success')
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ upload.start = {
|
|||||||
error = true
|
error = true
|
||||||
|
|
||||||
// Error Status
|
// Error Status
|
||||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
$('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status')
|
||||||
.html('Failed')
|
.html('Failed')
|
||||||
.addClass('error')
|
.addClass('error')
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ upload.start = {
|
|||||||
warning = true
|
warning = true
|
||||||
|
|
||||||
// Warning Status
|
// Warning Status
|
||||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
$('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status')
|
||||||
.html('Skipped')
|
.html('Skipped')
|
||||||
.addClass('warning')
|
.addClass('warning')
|
||||||
|
|
||||||
@ -163,13 +163,13 @@ upload.start = {
|
|||||||
error = true
|
error = true
|
||||||
|
|
||||||
// Error Status
|
// Error Status
|
||||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
$('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status')
|
||||||
.html('Failed')
|
.html('Failed')
|
||||||
.addClass('error')
|
.addClass('error')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') p.notice')
|
$('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') p.notice')
|
||||||
.html(errorText)
|
.html(errorText)
|
||||||
.show()
|
.show()
|
||||||
|
|
||||||
@ -210,11 +210,11 @@ upload.start = {
|
|||||||
|
|
||||||
// Scroll to the uploading file
|
// Scroll to the uploading file
|
||||||
let scrollPos = 0
|
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)
|
$('.basicModal .rows').scrollTop(scrollPos)
|
||||||
|
|
||||||
// Set status to processing
|
// 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
|
// Upload next file
|
||||||
if (file.next!=null) process(files, file.next)
|
if (file.next!=null) process(files, file.next)
|
||||||
@ -236,7 +236,7 @@ upload.start = {
|
|||||||
files[i].ready = false
|
files[i].ready = false
|
||||||
files[i].supported = true
|
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
|
else files[i].next = null
|
||||||
|
|
||||||
// Check if file is supported
|
// Check if file is supported
|
||||||
@ -480,7 +480,7 @@ upload.start = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove last comma
|
// Remove last comma
|
||||||
links = links.substr(0, links.length-1)
|
links = links.substr(0, links.length - 1)
|
||||||
|
|
||||||
upload.show('Importing from Dropbox', files, function() {
|
upload.show('Importing from Dropbox', files, function() {
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ view.albums = {
|
|||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
|
|
||||||
let smartData = '',
|
let smartData = ''
|
||||||
albumsData = ''
|
let albumsData = ''
|
||||||
|
|
||||||
// Smart Albums
|
// Smart Albums
|
||||||
if (lychee.publicMode===false) {
|
if (lychee.publicMode===false) {
|
||||||
@ -271,8 +271,8 @@ view.album = {
|
|||||||
|
|
||||||
if ((visible.album() || !album.json.init) && !visible.photo()) {
|
if ((visible.album() || !album.json.init) && !visible.photo()) {
|
||||||
|
|
||||||
let structure = sidebar.createStructure.album(album.json),
|
let structure = sidebar.createStructure.album(album.json)
|
||||||
html = sidebar.render(structure)
|
let html = sidebar.render(structure)
|
||||||
|
|
||||||
sidebar.dom('.sidebar__wrapper').html(html)
|
sidebar.dom('.sidebar__wrapper').html(html)
|
||||||
sidebar.bind()
|
sidebar.bind()
|
||||||
@ -408,27 +408,33 @@ view.photo = {
|
|||||||
|
|
||||||
lychee.imageview.html(build.imageview(photo.json, visible.header()))
|
lychee.imageview.html(build.imageview(photo.json, visible.header()))
|
||||||
|
|
||||||
let $nextArrow = lychee.imageview.find('a#next'),
|
let $nextArrow = lychee.imageview.find('a#next')
|
||||||
$previousArrow = lychee.imageview.find('a#previous'),
|
let $previousArrow = lychee.imageview.find('a#previous')
|
||||||
photoID = photo.getID(),
|
let photoID = photo.getID()
|
||||||
hasNext = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].nextPhoto!=='',
|
let 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 hasPrevious = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].previousPhoto!==''
|
||||||
|
|
||||||
if (hasNext===false || lychee.viewMode===true) { $nextArrow.hide() }
|
if (hasNext===false || lychee.viewMode===true) {
|
||||||
else {
|
|
||||||
|
|
||||||
let nextPhotoID = album.json.content[photoID].nextPhoto,
|
$nextArrow.hide()
|
||||||
nextPhoto = album.json.content[nextPhotoID]
|
|
||||||
|
} 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 }")`)
|
$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() }
|
if (hasPrevious===false || lychee.viewMode===true) {
|
||||||
else {
|
|
||||||
|
|
||||||
let previousPhotoID = album.json.content[photoID].previousPhoto,
|
$previousArrow.hide()
|
||||||
previousPhoto = album.json.content[previousPhotoID]
|
|
||||||
|
} 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 }")`)
|
$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() {
|
sidebar: function() {
|
||||||
|
|
||||||
let structure = sidebar.createStructure.photo(photo.json),
|
let structure = sidebar.createStructure.photo(photo.json)
|
||||||
html = sidebar.render(structure)
|
let html = sidebar.render(structure)
|
||||||
|
|
||||||
sidebar.dom('.sidebar__wrapper').html(html)
|
sidebar.dom('.sidebar__wrapper').html(html)
|
||||||
sidebar.bind()
|
sidebar.bind()
|
||||||
|
@ -11,8 +11,8 @@ lychee.content = $('.content')
|
|||||||
|
|
||||||
lychee.getEventName = function() {
|
lychee.getEventName = function() {
|
||||||
|
|
||||||
let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement),
|
let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement)
|
||||||
eventName = (touchendSupport===true ? 'touchend' : 'click')
|
let eventName = (touchendSupport===true ? 'touchend' : 'click')
|
||||||
|
|
||||||
return eventName
|
return eventName
|
||||||
|
|
||||||
@ -39,8 +39,8 @@ lychee.html = function(literalSections, ...substs) {
|
|||||||
|
|
||||||
// Use raw literal sections: we don’t want
|
// Use raw literal sections: we don’t want
|
||||||
// backslashes (\n etc.) to be interpreted
|
// backslashes (\n etc.) to be interpreted
|
||||||
let raw = literalSections.raw,
|
let raw = literalSections.raw
|
||||||
result = ''
|
let result = ''
|
||||||
|
|
||||||
substs.forEach((subst, i) => {
|
substs.forEach((subst, i) => {
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ lychee.html = function(literalSections, ...substs) {
|
|||||||
// Take care of last literal section
|
// Take care of last literal section
|
||||||
// (Never fails, because an empty template string
|
// (Never fails, because an empty template string
|
||||||
// produces one literal section, an empty string)
|
// produces one literal section, an empty string)
|
||||||
result += raw[raw.length-1]
|
result += raw[raw.length - 1]
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -127,8 +127,8 @@ const loadPhotoInfo = function(photoID) {
|
|||||||
imageview.addClass('fadeIn').show()
|
imageview.addClass('fadeIn').show()
|
||||||
|
|
||||||
// Render Sidebar
|
// Render Sidebar
|
||||||
let structure = sidebar.createStructure.photo(data),
|
let structure = sidebar.createStructure.photo(data)
|
||||||
html = sidebar.render(structure)
|
let html = sidebar.render(structure)
|
||||||
|
|
||||||
sidebar.dom('.sidebar__wrapper').html(html)
|
sidebar.dom('.sidebar__wrapper').html(html)
|
||||||
sidebar.bind()
|
sidebar.bind()
|
||||||
|
Loading…
Reference in New Issue
Block a user