Updated several files (ES2015)

This commit is contained in:
Tobias Reich 2015-07-12 13:51:06 +02:00
parent d4470341ff
commit 1326524ade
8 changed files with 269 additions and 274 deletions

BIN
dist/main.js vendored Executable file → Normal file

Binary file not shown.

BIN
dist/view.js vendored

Binary file not shown.

View File

@ -1,12 +1,12 @@
function gup(b) {
b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
b = b.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]")
var a = "[\\?&]" + b + "=([^&#]*)",
let a = "[\\?&]" + b + "=([^&#]*)",
d = new RegExp(a),
c = d.exec(window.location.href);
c = d.exec(window.location.href)
if (c === null) return '';
else return c[1];
if (c === null) return ''
else return c[1]
};
}

View File

@ -1,74 +1,74 @@
(function($) {
var Swipe = function(el) {
var self = this;
var self = this
this.el = $(el);
this.pos = { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };
this.startTime;
this.el = $(el)
this.pos = { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } }
this.startTime
el.on('touchstart', function(e) { self.touchStart(e); });
el.on('touchmove', function(e) { self.touchMove(e); });
el.on('touchend', function(e) { self.swipeEnd(); });
el.on('mousedown', function(e) { self.mouseDown(e); });
};
el.on('touchstart', function(e) { self.touchStart(e) })
el.on('touchmove', function(e) { self.touchMove(e) })
el.on('touchend', function(e) { self.swipeEnd() })
el.on('mousedown', function(e) { self.mouseDown(e) })
}
Swipe.prototype = {
touchStart: function(e) {
var touch = e.originalEvent.touches[0];
var touch = e.originalEvent.touches[0]
this.swipeStart(e, touch.pageX, touch.pageY);
this.swipeStart(e, touch.pageX, touch.pageY)
},
touchMove: function(e) {
var touch = e.originalEvent.touches[0];
var touch = e.originalEvent.touches[0]
this.swipeMove(e, touch.pageX, touch.pageY);
this.swipeMove(e, touch.pageX, touch.pageY)
},
mouseDown: function(e) {
var self = this;
var self = this
this.swipeStart(e, e.pageX, e.pageY);
this.swipeStart(e, e.pageX, e.pageY)
this.el.on('mousemove', function(e) { self.mouseMove(e); });
this.el.on('mouseup', function() { self.mouseUp(); });
this.el.on('mousemove', function(e) { self.mouseMove(e) })
this.el.on('mouseup', function() { self.mouseUp() })
},
mouseMove: function(e) {
this.swipeMove(e, e.pageX, e.pageY);
this.swipeMove(e, e.pageX, e.pageY)
},
mouseUp: function(e) {
this.swipeEnd(e);
this.swipeEnd(e)
this.el.off('mousemove');
this.el.off('mouseup');
this.el.off('mousemove')
this.el.off('mouseup')
},
swipeStart: function(e, x, y) {
this.pos.start.x = x;
this.pos.start.y = y;
this.pos.end.x = x;
this.pos.end.y = y;
this.pos.start.x = x
this.pos.start.y = y
this.pos.end.x = x
this.pos.end.y = y
this.startTime = new Date().getTime();
this.startTime = new Date().getTime()
this.trigger('swipeStart', e);
this.trigger('swipeStart', e)
},
swipeMove: function(e, x, y) {
this.pos.end.x = x;
this.pos.end.y = y;
this.pos.end.x = x
this.pos.end.y = y
this.trigger('swipeMove', e);
this.trigger('swipeMove', e)
},
swipeEnd: function(e) {
this.trigger('swipeEnd', e);
this.trigger('swipeEnd', e)
},
trigger: function(e, originalEvent) {
var self = this;
var self = this
var
event = $.Event(e),
@ -78,31 +78,31 @@
direction = 'up',
distance = Math.round(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))),
angle = Math.round(radians * 180 / Math.PI),
speed = Math.round(distance / ( new Date().getTime() - self.startTime ) * 1000);
speed = Math.round(distance / ( new Date().getTime() - self.startTime ) * 1000)
if ( angle < 0 ) {
angle = 360 - Math.abs(angle);
angle = 360 - Math.abs(angle)
}
if ( ( angle <= 45 && angle >= 0 ) || ( angle <= 360 && angle >= 315 ) ) {
direction = 'left';
direction = 'left'
} else if ( angle >= 135 && angle <= 225 ) {
direction = 'right';
direction = 'right'
} else if ( angle > 45 && angle < 135 ) {
direction = 'down';
direction = 'down'
}
event.originalEvent = originalEvent;
event.originalEvent = originalEvent
event.swipe = { x: x, y: y, direction: direction, distance: distance, angle: angle, speed: speed };
event.swipe = { x: x, y: y, direction: direction, distance: distance, angle: angle, speed: speed }
$(self.el).trigger(event);
$(self.el).trigger(event)
}
};
}
$.fn.swipe = function() {
var swipe = new Swipe(this);
var swipe = new Swipe(this)
return this;
};
})(jQuery);
return this
}
})(jQuery)

View File

@ -660,8 +660,8 @@ photo.getSize = function() {
// Calculate pixel ratio of screen
if (pixelRatio!==undefined && pixelRatio>1) {
view.width = view.width * pixelRatio
view.height = view.height * pixelRatio
view.width = view.width * pixelRatio
view.height = view.height * pixelRatio
}
// Medium available and

View File

@ -1,6 +1,6 @@
/**
* @description Responsible to reflect data changes to the UI.
* @copyright 2015 by Tobias Reich
* @description Responsible to reflect data changes to the UI.
* @copyright 2015 by Tobias Reich
*/
view = {}
@ -9,14 +9,14 @@ view.albums = {
init: function() {
view.albums.title();
view.albums.content.init();
view.albums.title()
view.albums.content.init()
},
title: function() {
lychee.setTitle('Albums', false);
lychee.setTitle('Albums', false)
},
@ -26,68 +26,67 @@ view.albums = {
init: function() {
var smartData = '',
albumsData = '';
let smartData = '',
albumsData = ''
/* Smart Albums */
// Smart Albums
if (lychee.publicMode===false) {
albums.parse(albums.json.smartalbums.unsorted);
albums.parse(albums.json.smartalbums.public);
albums.parse(albums.json.smartalbums.starred);
albums.parse(albums.json.smartalbums.recent);
albums.parse(albums.json.smartalbums.unsorted)
albums.parse(albums.json.smartalbums.public)
albums.parse(albums.json.smartalbums.starred)
albums.parse(albums.json.smartalbums.recent)
smartData = build.divider('Smart Albums') + build.album(albums.json.smartalbums.unsorted) + build.album(albums.json.smartalbums.public) + build.album(albums.json.smartalbums.starred) + build.album(albums.json.smartalbums.recent);
smartData = build.divider('Smart Albums') + build.album(albums.json.smartalbums.unsorted) + build.album(albums.json.smartalbums.public) + build.album(albums.json.smartalbums.starred) + build.album(albums.json.smartalbums.recent)
}
/* Albums */
if (albums.json.albums&&albums.json.num!==0) {
// Albums
if (albums.json.albums && albums.json.num!==0) {
$.each(albums.json.albums, function() {
albums.parse(this);
albumsData += build.album(this);
});
albums.parse(this)
albumsData += build.album(this)
})
// Add divider
if (lychee.publicMode===false) albumsData = build.divider('Albums') + albumsData;
if (lychee.publicMode===false) albumsData = build.divider('Albums') + albumsData
}
if (smartData===''&&albumsData==='') {
lychee.content.html('');
$('body').append(build.no_content('eye'));
if (smartData==='' && albumsData==='') {
lychee.content.html('')
$('body').append(build.no_content('eye'))
} else {
lychee.content.html(smartData + albumsData);
lychee.content.html(smartData + albumsData)
}
// Restore scroll position
if (view.albums.content.scrollPosition!==null&&
view.albums.content.scrollPosition!==0) {
$(document).scrollTop(view.albums.content.scrollPosition);
if (view.albums.content.scrollPosition!==null && view.albums.content.scrollPosition!==0) {
$(document).scrollTop(view.albums.content.scrollPosition)
}
},
title: function(albumID) {
var title = albums.getByID(albumID).title;
let title = albums.getByID(albumID).title
$('.album[data-id="' + albumID + '"] .overlay h1')
.html(title)
.attr('title', title);
.attr('title', title)
},
delete: function(albumID) {
$('.album[data-id="' + albumID + '"]').css('opacity', 0).animate({
width: 0,
marginLeft: 0
width : 0,
marginLeft : 0
}, 300, function() {
$(this).remove();
if (albums.json.num<=0) lychee.content.find('.divider:last-child').remove();
});
$(this).remove()
if (albums.json.num<=0) lychee.content.find('.divider:last-child').remove()
})
}
@ -99,38 +98,38 @@ view.album = {
init: function() {
album.parse();
album.parse()
view.album.sidebar();
view.album.title();
view.album.public();
view.album.content.init();
view.album.sidebar()
view.album.title()
view.album.public()
view.album.content.init()
album.json.init = 1;
album.json.init = 1
},
title: function() {
if ((visible.album()||!album.json.init)&&!visible.photo()) {
if ((visible.album() || !album.json.init) && !visible.photo()) {
switch (album.getID()) {
case 'f':
lychee.setTitle('Starred', false);
break;
lychee.setTitle('Starred', false)
break
case 's':
lychee.setTitle('Public', false);
break;
lychee.setTitle('Public', false)
break
case 'r':
lychee.setTitle('Recent', false);
break;
lychee.setTitle('Recent', false)
break
case '0':
lychee.setTitle('Unsorted', false);
break;
lychee.setTitle('Unsorted', false)
break
default:
if (album.json.init) sidebar.changeAttr('title', album.json.title);
lychee.setTitle(album.json.title, true);
break;
if (album.json.init) sidebar.changeAttr('title', album.json.title)
lychee.setTitle(album.json.title, true)
break
}
}
@ -141,64 +140,64 @@ view.album = {
init: function() {
var photosData = '';
let photosData = ''
if (album.json.content&&album.json.content!==false) {
if (album.json.content && album.json.content!==false) {
// Build photos
$.each(album.json.content, function() {
photosData += build.photo(this);
});
photosData += build.photo(this)
})
}
// Save and reset scroll position
view.albums.content.scrollPosition = $(document).scrollTop();
requestAnimationFrame(() => $(document).scrollTop(0));
view.albums.content.scrollPosition = $(document).scrollTop()
requestAnimationFrame(() => $(document).scrollTop(0))
// Add photos to view
lychee.content.html(photosData);
lychee.content.html(photosData)
},
title: function(photoID) {
var title = album.json.content[photoID].title;
let title = album.json.content[photoID].title
$('.photo[data-id="' + photoID + '"] .overlay h1')
.html(title)
.attr('title', title);
.attr('title', title)
},
star: function(photoID) {
$('.photo[data-id="' + photoID + '"] .iconic-star').remove();
if (album.json.content[photoID].star==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-star'>" + build.iconic('star') + "</a>");
$('.photo[data-id="' + photoID + '"] .iconic-star').remove()
if (album.json.content[photoID].star==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-star'>" + build.iconic('star') + "</a>")
},
public: function(photoID) {
$('.photo[data-id="' + photoID + '"] .iconic-share').remove();
if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-share'>" + build.iconic('eye') + "</a>");
$('.photo[data-id="' + photoID + '"] .iconic-share').remove()
if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-share'>" + build.iconic('eye') + "</a>")
},
delete: function(photoID) {
$('.photo[data-id="' + photoID + '"]').css('opacity', 0).animate({
width: 0,
marginLeft: 0
width : 0,
marginLeft : 0
}, 300, function() {
$(this).remove();
$(this).remove()
// Only when search is not active
if (!visible.albums()) {
album.json.num--;
view.album.num();
view.album.title();
album.json.num--
view.album.num()
view.album.title()
}
});
})
}
@ -206,13 +205,13 @@ view.album = {
description: function() {
sidebar.changeAttr('description', album.json.description);
sidebar.changeAttr('description', album.json.description)
},
num: function() {
sidebar.changeAttr('images', album.json.num);
sidebar.changeAttr('images', album.json.num)
},
@ -222,53 +221,54 @@ view.album = {
$('#button_share_album')
.addClass('active')
.attr('title', 'Share Album');
.attr('title', 'Share Album')
$('.photo .iconic-share').remove();
$('.photo .iconic-share').remove()
if (album.json.init) sidebar.changeAttr('public', 'Yes');
if (album.json.init) sidebar.changeAttr('public', 'Yes')
} else {
$('#button_share_album')
.removeClass('active')
.attr('title', 'Make Public');
.attr('title', 'Make Public')
if (album.json.init) sidebar.changeAttr('public', 'No')
if (album.json.init) sidebar.changeAttr('public', 'No');
}
},
visible: function() {
if (album.json.visible==='1') sidebar.changeAttr('visible', 'Yes');
else sidebar.changeAttr('visible', 'No');
if (album.json.visible==='1') sidebar.changeAttr('visible', 'Yes')
else sidebar.changeAttr('visible', 'No')
},
downloadable: function() {
if (album.json.downloadable==='1') sidebar.changeAttr('downloadable', 'Yes');
else sidebar.changeAttr('downloadable', 'No');
if (album.json.downloadable==='1') sidebar.changeAttr('downloadable', 'Yes')
else sidebar.changeAttr('downloadable', 'No')
},
password: function() {
if (album.json.password==='1') sidebar.changeAttr('password', 'Yes');
else sidebar.changeAttr('password', 'No');
if (album.json.password==='1') sidebar.changeAttr('password', 'Yes')
else sidebar.changeAttr('password', 'No')
},
sidebar: function() {
if ((visible.album()||!album.json.init)&&!visible.photo()) {
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),
html = sidebar.render(structure)
sidebar.dom('.wrapper').html(html);
sidebar.bind();
sidebar.dom('.wrapper').html(html)
sidebar.bind()
}
@ -280,151 +280,161 @@ view.photo = {
init: function() {
photo.parse();
photo.parse()
view.photo.sidebar();
view.photo.title();
view.photo.star();
view.photo.public();
view.photo.photo();
view.photo.sidebar()
view.photo.title()
view.photo.star()
view.photo.public()
view.photo.photo()
photo.json.init = 1;
photo.json.init = 1
},
show: function() {
// Change header
lychee.content.addClass('view');
header.setMode('photo');
lychee.content.addClass('view')
header.setMode('photo')
// Make body not scrollable
$('body').css('overflow', 'hidden');
$('body').css('overflow', 'hidden')
// Fullscreen
$(document)
.bind('mouseenter', header.show)
.bind('mouseleave', header.hide);
.bind('mouseleave', header.hide)
lychee.animate(lychee.imageview, 'fadeIn');
lychee.animate(lychee.imageview, 'fadeIn')
},
hide: function() {
header.show();
header.show()
lychee.content.removeClass('view');
header.setMode('album');
lychee.content.removeClass('view')
header.setMode('album')
// Make body scrollable
$('body').css('overflow', 'auto');
$('body').css('overflow', 'auto')
// Disable Fullscreen
$(document)
.unbind('mouseenter')
.unbind('mouseleave');
.unbind('mouseleave')
// Hide Photo
lychee.animate(lychee.imageview, 'fadeOut');
setTimeout(function() {
lychee.imageview.hide();
view.album.sidebar();
}, 300);
lychee.animate(lychee.imageview, 'fadeOut')
setTimeout(() => {
lychee.imageview.hide()
view.album.sidebar()
}, 300)
},
title: function() {
if (photo.json.init) sidebar.changeAttr('title', photo.json.title);
lychee.setTitle(photo.json.title, true);
if (photo.json.init) sidebar.changeAttr('title', photo.json.title)
lychee.setTitle(photo.json.title, true)
},
description: function() {
if (photo.json.init) sidebar.changeAttr('description', photo.json.description);
if (photo.json.init) sidebar.changeAttr('description', photo.json.description)
},
star: function() {
if (photo.json.star==1) {
if (photo.json.star==='1') {
// Starred
$('#button_star')
.addClass('active')
.attr('title', 'Unstar Photo');
.attr('title', 'Unstar Photo')
} else {
// Unstarred
$('#button_star').removeClass('active');
$('#button_star').attr('title', 'Star Photo');
$('#button_star').removeClass('active')
$('#button_star').attr('title', 'Star Photo')
}
},
public: function() {
if (photo.json.public==='1'||photo.json.public==='2') {
if (photo.json.public==='1' || photo.json.public==='2') {
// Photo public
$('#button_share')
.addClass('active')
.attr('title', 'Share Photo');
if (photo.json.init) sidebar.changeAttr('public', 'Yes');
.attr('title', 'Share Photo')
if (photo.json.init) sidebar.changeAttr('public', 'Yes')
} else {
// Photo private
$('#button_share')
.removeClass('active')
.attr('title', 'Make Public');
if (photo.json.init) sidebar.changeAttr('public', 'No');
.attr('title', 'Make Public')
if (photo.json.init) sidebar.changeAttr('public', 'No')
}
},
tags: function() {
sidebar.changeAttr('tags', build.tags(photo.json.tags));
sidebar.bind();
sidebar.changeAttr('tags', build.tags(photo.json.tags))
sidebar.bind()
},
photo: function() {
lychee.imageview.html(build.imageview(photo.json, photo.getSize(), visible.header()));
lychee.imageview.html(build.imageview(photo.json, photo.getSize(), visible.header()))
var $nextArrow = lychee.imageview.find('a#next'),
$previousArrow = lychee.imageview.find('a#previous'),
hasNext = album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].nextPhoto==='',
hasPrevious = album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].previousPhoto==='';
let $nextArrow = lychee.imageview.find('a#next'),
$previousArrow = lychee.imageview.find('a#previous'),
hasNext = album.json && album.json.content && album.json.content[photo.getID()] && album.json.content[photo.getID()].nextPhoto==='',
hasPrevious = album.json && album.json.content && album.json.content[photo.getID()] && album.json.content[photo.getID()].previousPhoto===''
if (hasNext||lychee.viewMode) { $nextArrow.hide(); }
if (hasNext || lychee.viewMode) { $nextArrow.hide() }
else {
var nextPhotoID = album.json.content[photo.getID()].nextPhoto,
nextPhoto = album.json.content[nextPhotoID];
let nextPhotoID = album.json.content[photo.getID()].nextPhoto,
nextPhoto = album.json.content[nextPhotoID]
$nextArrow.css('background-image', 'linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("' + nextPhoto.thumbUrl + '")');
$nextArrow.css('background-image', `linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("${ nextPhoto.thumbUrl }")`)
}
if (hasPrevious||lychee.viewMode) { $previousArrow.hide(); }
if (hasPrevious || lychee.viewMode) { $previousArrow.hide() }
else {
var previousPhotoID = album.json.content[photo.getID()].previousPhoto,
previousPhoto = album.json.content[previousPhotoID];
let previousPhotoID = album.json.content[photo.getID()].previousPhoto,
previousPhoto = album.json.content[previousPhotoID]
$previousArrow.css('background-image', 'linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("' + previousPhoto.thumbUrl + '")');
$previousArrow.css('background-image', `linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("${ previousPhoto.thumbUrl }")`)
};
}
},
sidebar: function() {
var structure = sidebar.createStructure.photo(photo.json),
html = sidebar.render(structure);
let structure = sidebar.createStructure.photo(photo.json),
html = sidebar.render(structure)
sidebar.dom('.wrapper').html(html);
sidebar.bind();
sidebar.dom('.wrapper').html(html)
sidebar.bind()
}

View File

@ -1,79 +1,75 @@
/**
* @description Used to view single photos with view.php
* @copyright 2015 by Tobias Reich
* @description Used to view single photos with view.php
* @copyright 2015 by Tobias Reich
*/
var lychee = { content: $('#content') },
loadingBar = { show() {}, hide() {} }
imageview = $('#imageview');
let lychee = { content: $('#content') },
loadingBar = { show() {}, hide() {} }
imageview = $('#imageview')
$(document).ready(function() {
// Event Name
var 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),
eventName = (touchendSupport===true ? 'touchend' : 'click')
// Set API error handler
api.onError = error;
api.onError = error
// Infobox
header.dom('#button_info').on(eventName, sidebar.toggle);
header.dom('#button_info').on(eventName, sidebar.toggle)
// Direct Link
header.dom('#button_direct').on(eventName, function() {
var link = $('#imageview #image').css('background-image').replace(/"/g,'').replace(/url\(|\)$/ig, '');
window.open(link, '_newtab');
let link = $('#imageview #image').css('background-image').replace(/"/g,'').replace(/url\(|\)$/ig, '')
window.open(link, '_newtab')
});
})
loadPhotoInfo(gup('p'));
loadPhotoInfo(gup('p'))
});
})
getPhotoSize = function(photo) {
const getPhotoSize = function(photo) {
// Size can be 'big', 'medium' or 'small'
// Default is big
// Small is centered in the middle of the screen
var size = 'big',
scaled = false,
hasMedium = photo.medium!=='',
pixelRatio = window.devicePixelRatio,
view = {
width: $(window).width()-60,
height: $(window).height()-100
};
let size = 'big',
scaled = false,
hasMedium = photo.medium!=='',
pixelRatio = window.devicePixelRatio,
view = {
width: $(window).width() - 60,
height: $(window).height() - 100
}
// Detect if the photo will be shown scaled,
// because the screen size is smaller than the photo
if (photo.width>view.width||
photo.width>view.height) scaled = true;
if (photo.json.width>view.width || photo.json.height>view.height) scaled = true
// Calculate pixel ratio of screen
if (pixelRatio!==undefined&&pixelRatio>1) {
view.width = view.width * pixelRatio;
view.height = view.height * pixelRatio;
if (pixelRatio!==undefined && pixelRatio>1) {
view.width = view.width * pixelRatio
view.height = view.height * pixelRatio
}
// Medium available and
// Medium still bigger than screen
if (hasMedium===true&&
(1920>view.width&&1080>view.height)) size = 'medium';
if (hasMedium===true && (1920>view.width && 1080>view.height)) size = 'medium'
// Photo not scaled
// Photo smaller then screen
if (scaled===false&&
(photo.width<view.width&&
photo.width<view.height)) size = 'small';
if (scaled===false && (photo.json.width<view.width&& photo.json.width<view.height)) size = 'small'
return size;
return size
}
loadPhotoInfo = function(photoID) {
const loadPhotoInfo = function(photoID) {
var params = {
let params = {
photoID,
albumID: 0,
password: ''
@ -81,50 +77,46 @@ loadPhotoInfo = function(photoID) {
api.post('Photo::get', params, function(data) {
if (data==='Warning: Photo private!'||
data==='Warning: Wrong password!') {
if (data==='Warning: Photo private!' || data==='Warning: Wrong password!') {
$('body').append(build.no_content('question-mark'));
$('body').removeClass('view');
header.dom().remove();
return false;
$('body').append(build.no_content('question-mark'))
$('body').removeClass('view')
header.dom().remove()
return false
}
/* Set title */
// Set title
if (!data.title) data.title = 'Untitled'
document.title = 'Lychee - ' + data.title
header.dom('#title').html(data.title)
if (!data.title) data.title = 'Untitled';
document.title = 'Lychee - ' + data.title;
header.dom('#title').html(data.title);
let size = getPhotoSize(data)
/* Render HTML */
// Render HTML
imageview.html(build.imageview(data, size, true))
imageview.find('.arrow_wrapper').remove()
imageview.addClass('fadeIn').show()
var size = getPhotoSize(data);
// Render Sidebar
let structure = sidebar.createStructure.photo(data),
html = sidebar.render(structure)
imageview.html(build.imageview(data, size, true));
imageview.find('.arrow_wrapper').remove();
imageview.addClass('fadeIn').show();
sidebar.dom('.wrapper').html(html)
sidebar.bind()
/* Render Sidebar */
var structure = sidebar.createStructure.photo(data),
html = sidebar.render(structure);
sidebar.dom('.wrapper').html(html);
sidebar.bind();
});
})
}
error = function(errorThrown, params, data) {
const error = function(errorThrown, params, data) {
console.error({
description: errorThrown,
params: params,
response: data
});
description : errorThrown,
params : params,
response : data
})
loadingBar.show('error', errorThrown);
loadingBar.show('error', errorThrown)
}

View File

@ -1,17 +1,17 @@
/**
* @description This module is used to check if elements are visible or not.
* @copyright 2015 by Tobias Reich
* @description This module is used to check if elements are visible or not.
* @copyright 2015 by Tobias Reich
*/
visible = {}
visible.albums = function() {
if ($('#tools_albums').css('display')==='block') return true
if (header.dom('#tools_albums').css('display')==='block') return true
return false
}
visible.album = function() {
if ($('#tools_album').css('display')==='block') return true
if (header.dom('#tools_album').css('display')==='block') return true
return false
}
@ -31,7 +31,6 @@ visible.sidebar = function() {
}
visible.sidebarbutton = function() {
if (visible.albums()) return false
if (visible.photo()) return true
if (visible.album() && $('#button_info_album:visible').length>0) return true
return false
@ -43,13 +42,7 @@ visible.header = function() {
}
visible.message = function() {
if ($('.message').length>0) return true
return false
}
visible.signin = function() {
if ($('.message .sign_in').length>0) return true
return false
return basicModal.visible()
}
visible.contextMenu = function() {