From 61cf46be1fbe16242fa1c5075f544719c5211a1b Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 6 Mar 2015 22:48:41 +0100 Subject: [PATCH] Added loadingBar.dom, changed visible.header --- dist/main.js | Bin 171291 -> 171235 bytes src/scripts/header.js | 2 -- src/scripts/init.js | 2 +- src/scripts/loadingBar.js | 40 +++++++++++++++++++++++++------------- src/scripts/lychee.js | 1 - src/scripts/view.js | 2 +- src/scripts/visible.js | 4 ++-- 7 files changed, 30 insertions(+), 21 deletions(-) diff --git a/dist/main.js b/dist/main.js index 86557f86d9598e9520f7ce0f9daade9bfc31be59..f27e724e98f255c2f25fc0af930a072bc317e3e2 100644 GIT binary patch delta 3911 zcmb7HX>1(T9oO5~#<2sr?3g&QvpaUyGuiQEoy+Mih&b(Wv%=iQYge_P3`NoWfwY|DpR}(UAJ7t)U7cumox|5q#KJ#%x_sD zL4$!MLKDkKa->h1mYKhE$;@)5*m=*DJ=u~gTgA=m)X>b$nrm2NX)jYKF#o!xtsrMh z<5+*bbT!t~OXYqhdl@O=D2~2Ur``_3%fT<{GF0|*hC4mYeZ!QzW9Qu@ckQr9Ay@6_ zJ%`D<%=f!HI@VKpv&acV0-EnCgh!C${8Y z|MB??SfSt+3R;?FQf?|D!qfgAmvuHkX#*6WEW13kjH!F4VXdxYHBY;8DzCeWYZ_D+ zrKB+`Qh!`%huaPaBBB1n!W7n6*V=t7ZN`MK5YxDu)541KR*tykL^Q&N6=o919o0Zw zOv4j_EXhu~FN0*$kUOqgW8tLZna{bDPm;9P1zsec;%G)D!IuaJfKpSPbX`1y%zn2k z+5p{}R&-*OR{RL-b1Np1`-8F0+4x+)W|Y^-v+J}$b~d$ody^7GXVhFQFY=9)995@0 z#nW9+)Dbc&dP-h%bjuq?x=V$ECyyh+jsEFbVD^{9AynX=WIwNr;}`s_m8Dl@pwX%f zcbA#AGb)o=F{g$&!mfdJSbs9WcqRJnshd(v9TBJGTsZ)8IwL!>SxL5P>Qk?_(+msXA4&s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~RKFK+%@|E;3cdx)POL^k zM^4;N< zzXKgVuO=`vsKN-euHawQ^&qZ&^dQ#f9vzq^u35GLqmbd#BJQy2oX4tUHmHv0H^@L* z^*4{_Tc%JH`|78U&gZJ>ZO2exjMN94D}AR_VudtUgMnweB4BEH<}&Et@eD4Z;M6m> z!T9{M+omFi$6r`1O7yiC-yA?f)+bIW z)2W`!m^yCo;N4RRXy|zD+2(mjEyk3|!U0CbPQ{%O{QY$aC%2!z8q&K@58(ZQ(+Fra z^Tw-vgodrt33j!6rV|;ZEVdiNmR7P2@1R{*tG1HW=!vy=FCoiO-nH)8)3e~g*c$T3 zX~LE;pCyQQcuSUS??$JUjGdlialbwd^GZb;Hpf^&jK(}XlO+qGqkSD&&@(&T#Cod=C(7a|FdFyJlNAzsukgh!k^hBa@@#!>?!U>Hp zSvT#;fJ#Y#Kat8~xT_D9N~S0%D00=o_(?lD_(cs7lQ|~V6)OjH0lxt~S*hS_W7nTrnYDDuV#B_a z#@AH;%6NSFa=|U=Xfnn6hZP{>+W-$^<7DG>sv7o)#nQayjFY6X$STt!W18g{1q}A< z4Y&RyBLRif^vjay9^oTzleW-*o1|-hd6RhLf662$WonRlti72!w(mNYS6lW^(%BR~ z_iys@Ia-)KOFHK>*L7S>uooB;zVs3KR{sSiieXxoeEbMG+?Nof3kA=-MS8q@Yu&>%m1q^K5MV(nL90}HQW)V$7g-sHeqopy#Fle2!DE(+&rVfEn~6> zD{qnoA^U{PzEJENpAa?rd1dv#hEF*fo;@7tX*r*(+Pj|+gUmZmNH3P9MUz`escj{Z z7k3G4S&^>`P#+nMEbGDimYf{yIN%Y(`026wUnPPm)7qa#BL_sA8r~B*x%gb7YMpmS cc$406N55bqie8X|&sLJMHdTA&Xk;$=4-DlxQvd(} diff --git a/src/scripts/header.js b/src/scripts/header.js index e03da05..e63af5c 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -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); diff --git a/src/scripts/init.js b/src/scripts/init.js index 4468f51..ea99009 100755 --- a/src/scripts/init.js +++ b/src/scripts/init.js @@ -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(); } }) diff --git a/src/scripts/loadingBar.js b/src/scripts/loadingBar.js index 94a6287..4ed505b 100755 --- a/src/scripts/loadingBar.js +++ b/src/scripts/loadingBar.js @@ -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('

Error: ' + errorText + '

') @@ -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); } diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index 6cda479..d80f32f 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -25,7 +25,6 @@ lychee = { dropbox: false, dropboxKey: '', - loadingBar: $('#loading'), content: $('#content'), imageview: $('#imageview'), infobox: $('#infobox') diff --git a/src/scripts/view.js b/src/scripts/view.js index 55f23fa..b664974 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -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'), diff --git a/src/scripts/visible.js b/src/scripts/visible.js index 58a40ca..82edfdd 100755 --- a/src/scripts/visible.js +++ b/src/scripts/visible.js @@ -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; }