Added loadingBar.dom, changed visible.header
This commit is contained in:
parent
cfe99df0da
commit
61cf46be1f
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
@ -24,7 +24,6 @@ header.show = function() {
|
|||||||
|
|
||||||
lychee.imageview.removeClass('full');
|
lychee.imageview.removeClass('full');
|
||||||
header.dom().removeClass('hidden');
|
header.dom().removeClass('hidden');
|
||||||
lychee.loadingBar.css('opacity', 1);
|
|
||||||
|
|
||||||
// Adjust position or size of photo
|
// Adjust position or size of photo
|
||||||
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin);
|
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin);
|
||||||
@ -46,7 +45,6 @@ header.hide = function(e, delay) {
|
|||||||
|
|
||||||
lychee.imageview.addClass('full');
|
lychee.imageview.addClass('full');
|
||||||
header.dom().addClass('hidden');
|
header.dom().addClass('hidden');
|
||||||
lychee.loadingBar.css('opacity', 0);
|
|
||||||
|
|
||||||
// Adjust position or size of photo
|
// Adjust position or size of photo
|
||||||
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin);
|
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin);
|
||||||
|
@ -132,7 +132,7 @@ $(document).ready(function() {
|
|||||||
/* Fullscreen on mobile */
|
/* Fullscreen on mobile */
|
||||||
.on('touchend', '#image', function(e) {
|
.on('touchend', '#image', function(e) {
|
||||||
if (swipe.obj===null||(swipe.offset>=-5&&swipe.offset<=5)) {
|
if (swipe.obj===null||(swipe.offset>=-5&&swipe.offset<=5)) {
|
||||||
if (visible.controls()) header.hide(e, 0);
|
if (visible.header()) header.hide(e, 0);
|
||||||
else header.show();
|
else header.show();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -5,7 +5,15 @@
|
|||||||
|
|
||||||
loadingBar = {
|
loadingBar = {
|
||||||
|
|
||||||
status: null
|
status: null,
|
||||||
|
_dom: $('#loading')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
loadingBar.dom = function(selector) {
|
||||||
|
|
||||||
|
if (selector===undefined||selector===null||selector==='') return loadingBar._dom;
|
||||||
|
return loadingBar._dom.find(selector);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,10 +29,10 @@ loadingBar.show = function(status, errorText) {
|
|||||||
if (!errorText) errorText = 'Whoops, it looks like something went wrong. Please reload the site and try again!';
|
if (!errorText) errorText = 'Whoops, it looks like something went wrong. Please reload the site and try again!';
|
||||||
|
|
||||||
// Move header down
|
// Move header down
|
||||||
if (visible.controls()) header.dom().addClass('error');
|
if (visible.header()) header.dom().addClass('error');
|
||||||
|
|
||||||
// Modify loading
|
// Modify loading
|
||||||
lychee.loadingBar
|
loadingBar.dom()
|
||||||
.removeClass('loading uploading error')
|
.removeClass('loading uploading error')
|
||||||
.addClass(status)
|
.addClass(status)
|
||||||
.html('<h1>Error: <span>' + errorText + '</span></h1>')
|
.html('<h1>Error: <span>' + errorText + '</span></h1>')
|
||||||
@ -32,8 +40,12 @@ loadingBar.show = function(status, errorText) {
|
|||||||
.css('height', '40px');
|
.css('height', '40px');
|
||||||
|
|
||||||
// Set timeout
|
// Set timeout
|
||||||
clearTimeout(lychee.loadingBar.data('timeout'));
|
clearTimeout(loadingBar._timeout);
|
||||||
lychee.loadingBar.data('timeout', setTimeout(function() { loadingBar.hide(true) }, 3000));
|
loadingBar._timeout = setTimeout(function() {
|
||||||
|
|
||||||
|
loadingBar.hide(true)
|
||||||
|
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -45,19 +57,19 @@ loadingBar.show = function(status, errorText) {
|
|||||||
loadingBar.status = 'loading';
|
loadingBar.status = 'loading';
|
||||||
|
|
||||||
// Set timeout
|
// Set timeout
|
||||||
clearTimeout(lychee.loadingBar.data('timeout'));
|
clearTimeout(loadingBar._timeout);
|
||||||
lychee.loadingBar.data('timeout', setTimeout(function() {
|
loadingBar._timeout = setTimeout(function() {
|
||||||
|
|
||||||
// Move header down
|
// Move header down
|
||||||
if (visible.controls()) header.dom().addClass('loading');
|
if (visible.header()) header.dom().addClass('loading');
|
||||||
|
|
||||||
// Modify loading
|
// Modify loading
|
||||||
lychee.loadingBar
|
loadingBar.dom()
|
||||||
.removeClass('loading uploading error')
|
.removeClass('loading uploading error')
|
||||||
.addClass('loading')
|
.addClass('loading')
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
}, 1000));
|
}, 1000);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -73,16 +85,16 @@ loadingBar.hide = function(force) {
|
|||||||
loadingBar.status = null;
|
loadingBar.status = null;
|
||||||
|
|
||||||
// Move header up
|
// Move header up
|
||||||
if (visible.controls()) header.dom().removeClass('error loading');
|
if (visible.header()) header.dom().removeClass('error loading');
|
||||||
|
|
||||||
// Modify loading
|
// Modify loading
|
||||||
lychee.loadingBar
|
loadingBar.dom()
|
||||||
.html('')
|
.html('')
|
||||||
.css('height', '3px');
|
.css('height', '3px');
|
||||||
|
|
||||||
// Set timeout
|
// Set timeout
|
||||||
clearTimeout(lychee.loadingBar.data('timeout'));
|
clearTimeout(loadingBar._timeout);
|
||||||
setTimeout(function() { lychee.loadingBar.hide() }, 300);
|
setTimeout(function() { loadingBar.dom().hide() }, 300);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ lychee = {
|
|||||||
dropbox: false,
|
dropbox: false,
|
||||||
dropboxKey: '',
|
dropboxKey: '',
|
||||||
|
|
||||||
loadingBar: $('#loading'),
|
|
||||||
content: $('#content'),
|
content: $('#content'),
|
||||||
imageview: $('#imageview'),
|
imageview: $('#imageview'),
|
||||||
infobox: $('#infobox')
|
infobox: $('#infobox')
|
||||||
|
@ -409,7 +409,7 @@ view.photo = {
|
|||||||
|
|
||||||
photo: function() {
|
photo: function() {
|
||||||
|
|
||||||
lychee.imageview.html(build.imageview(photo.json, photo.getSize(), visible.controls()));
|
lychee.imageview.html(build.imageview(photo.json, photo.getSize(), visible.header()));
|
||||||
|
|
||||||
var $nextArrow = lychee.imageview.find('a#next'),
|
var $nextArrow = lychee.imageview.find('a#next'),
|
||||||
$previousArrow = lychee.imageview.find('a#previous'),
|
$previousArrow = lychee.imageview.find('a#previous'),
|
||||||
|
@ -37,8 +37,8 @@ visible.infoboxbutton = function() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
visible.controls = function() {
|
visible.header = function() {
|
||||||
if (lychee.loadingBar.css('opacity')<1) return false;
|
if (header.dom().hasClass('hidden')===true) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user