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');
|
||||
header.dom().removeClass('hidden');
|
||||
lychee.loadingBar.css('opacity', 1);
|
||||
|
||||
// Adjust position or size of photo
|
||||
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');
|
||||
header.dom().addClass('hidden');
|
||||
lychee.loadingBar.css('opacity', 0);
|
||||
|
||||
// Adjust position or size of photo
|
||||
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin);
|
||||
|
@ -132,7 +132,7 @@ $(document).ready(function() {
|
||||
/* Fullscreen on mobile */
|
||||
.on('touchend', '#image', function(e) {
|
||||
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();
|
||||
}
|
||||
})
|
||||
|
@ -5,7 +5,15 @@
|
||||
|
||||
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!';
|
||||
|
||||
// Move header down
|
||||
if (visible.controls()) header.dom().addClass('error');
|
||||
if (visible.header()) header.dom().addClass('error');
|
||||
|
||||
// Modify loading
|
||||
lychee.loadingBar
|
||||
loadingBar.dom()
|
||||
.removeClass('loading uploading error')
|
||||
.addClass(status)
|
||||
.html('<h1>Error: <span>' + errorText + '</span></h1>')
|
||||
@ -32,8 +40,12 @@ loadingBar.show = function(status, errorText) {
|
||||
.css('height', '40px');
|
||||
|
||||
// Set timeout
|
||||
clearTimeout(lychee.loadingBar.data('timeout'));
|
||||
lychee.loadingBar.data('timeout', setTimeout(function() { loadingBar.hide(true) }, 3000));
|
||||
clearTimeout(loadingBar._timeout);
|
||||
loadingBar._timeout = setTimeout(function() {
|
||||
|
||||
loadingBar.hide(true)
|
||||
|
||||
}, 3000);
|
||||
|
||||
return true;
|
||||
|
||||
@ -45,19 +57,19 @@ loadingBar.show = function(status, errorText) {
|
||||
loadingBar.status = 'loading';
|
||||
|
||||
// Set timeout
|
||||
clearTimeout(lychee.loadingBar.data('timeout'));
|
||||
lychee.loadingBar.data('timeout', setTimeout(function() {
|
||||
clearTimeout(loadingBar._timeout);
|
||||
loadingBar._timeout = setTimeout(function() {
|
||||
|
||||
// Move header down
|
||||
if (visible.controls()) header.dom().addClass('loading');
|
||||
if (visible.header()) header.dom().addClass('loading');
|
||||
|
||||
// Modify loading
|
||||
lychee.loadingBar
|
||||
loadingBar.dom()
|
||||
.removeClass('loading uploading error')
|
||||
.addClass('loading')
|
||||
.show();
|
||||
|
||||
}, 1000));
|
||||
}, 1000);
|
||||
|
||||
return true;
|
||||
|
||||
@ -73,16 +85,16 @@ loadingBar.hide = function(force) {
|
||||
loadingBar.status = null;
|
||||
|
||||
// Move header up
|
||||
if (visible.controls()) header.dom().removeClass('error loading');
|
||||
if (visible.header()) header.dom().removeClass('error loading');
|
||||
|
||||
// Modify loading
|
||||
lychee.loadingBar
|
||||
loadingBar.dom()
|
||||
.html('')
|
||||
.css('height', '3px');
|
||||
|
||||
// Set timeout
|
||||
clearTimeout(lychee.loadingBar.data('timeout'));
|
||||
setTimeout(function() { lychee.loadingBar.hide() }, 300);
|
||||
clearTimeout(loadingBar._timeout);
|
||||
setTimeout(function() { loadingBar.dom().hide() }, 300);
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ lychee = {
|
||||
dropbox: false,
|
||||
dropboxKey: '',
|
||||
|
||||
loadingBar: $('#loading'),
|
||||
content: $('#content'),
|
||||
imageview: $('#imageview'),
|
||||
infobox: $('#infobox')
|
||||
|
@ -409,7 +409,7 @@ view.photo = {
|
||||
|
||||
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'),
|
||||
$previousArrow = lychee.imageview.find('a#previous'),
|
||||
|
@ -37,8 +37,8 @@ visible.infoboxbutton = function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
visible.controls = function() {
|
||||
if (lychee.loadingBar.css('opacity')<1) return false;
|
||||
visible.header = function() {
|
||||
if (header.dom().hasClass('hidden')===true) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user