From 8d4039b678c2e35e3fd6834d56b8db6879beab89 Mon Sep 17 00:00:00 2001 From: Brice Maron <brice@bmaron.net> Date: Fri, 14 Oct 2011 23:51:51 +0200 Subject: [PATCH] Add loading message to image lightbox and tweak events --- apps/files_imageviewer/css/lightbox.css | 11 ++++++++++- apps/files_imageviewer/js/lightbox.js | 17 ++++++++++++----- core/img/loading-dark.gif | Bin 0 -> 673 bytes 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 core/img/loading-dark.gif diff --git a/apps/files_imageviewer/css/lightbox.css b/apps/files_imageviewer/css/lightbox.css index a6e844a2e28..d96dd051b1e 100644 --- a/apps/files_imageviewer/css/lightbox.css +++ b/apps/files_imageviewer/css/lightbox.css @@ -20,4 +20,13 @@ margin-left:auto; margin-right:auto; z-index:9999; -} \ No newline at end of file +} + +#lightbox_loader{ + text-align:center; + position:fixed; + top: 40%; + left: 50%; + color:white; +} +#lightbox_loader img { margin-right: 1em;} \ No newline at end of file diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js index 847954d2f15..4f079b6d8af 100644 --- a/apps/files_imageviewer/js/lightbox.js +++ b/apps/files_imageviewer/js/lightbox.js @@ -2,11 +2,17 @@ var lightBoxShown=false; $(document).ready(function() { images={};//image cache - var overlay=$('<div id="lightbox_overlay"/>'); + loading_str = t('files_imageviewer','Loading'); + var overlay=$('<div id="lightbox_overlay"><div id="lightbox_loader"><img /></div></div>'); + overlay.find('#lightbox_loader img') + .attr('src',OC.imagePath('core', 'loading-dark.gif')) + .attr('alt',loading_str) + .after(loading_str); $( 'body' ).append(overlay); var container=$('<div id="lightbox"/>'); $( 'body' ).append(container); - $( 'body' ).click(hideLightbox); + $( '#lightbox_overlay' ).click(hideLightbox); + $( '#lightbox' ).click(hideLightbox); if(typeof FileActions!=='undefined'){ FileActions.register('image','View','',function(filename){ viewImage($('#dir').val(),filename); @@ -35,7 +41,8 @@ function viewImage(dir,file){ var img = new Image(); img.onload = function(){ images[location]=img; - showLightbox(container,img); + if($('#lightbox_overlay').is(':visible')) + showLightbox(container,img); } img.src = location; }else{ @@ -67,10 +74,10 @@ function showLightbox(container,img){ } function hideLightbox(event){ - if(lightBoxShown){ + if(event){ event.stopPropagation(); $('#lightbox_overlay').hide(); $('#lightbox').hide(); lightBoxShown=false; } -} +} \ No newline at end of file diff --git a/core/img/loading-dark.gif b/core/img/loading-dark.gif new file mode 100644 index 0000000000000000000000000000000000000000..5fe86acabc41f3cd97b09eb626e5e9020d5ea28e GIT binary patch literal 673 zcmZ?wbhEHb6krfw_{0DL|Ns24v9{i`YZs6)XV$Em>gt^AY{h?4&PAz-C8;S2<(VZJ z3W-^X6*>8dDSDZCY55F_KUo;KfLay*bNji51UowhxEkphFf#&$bU;Re3};|A=Gb-T zpTQ~5Y~f@MD-Ovy?0z%SI9)dy9@-@`^WZkUgd>LvFX%=~Sl(U6ZYjaT?v?%A185}J zXhvjnOhD%N^(ZPxxA5%V@T|+F&?zt^!BA2m!N)aPYDJCA*3$cL6D8Oi6s}7=YIBy{ zq^hDN1T}~W*&s8HT}H~<ryNgAI5Q<opRF}nhVP4{-$zfU#2Kp#WIk}6*}PZg*a~f? z$hYEu7@H6C8?8){n!ld~Y7{fFQ9!>XscN4xYMc0GPFQ?v_cG2_MIIJIm-a*%!BuWe z8!pN-Ck4fRwv{)q(2?ptv82e-2j({xWOIx-b`_~>dp%DP`5^Jxr;$gk>~KO%Qpl9n zmYs4LkxrWDPdNxM%e}ObKdc5eCukDP7*=FsfX-1kG{I8*amn*Nx8@m09+!EbsOPk8 z?y2xKiwt?#xJ8N+cW*HLK9#Z2U;}68?)kZzUNCdmkj())=gz+moPsy!gvQQde0Qs` zU}{3g-NZR}O{TRvx*atTnUFAh8zV2vAqRokh7E_Votp?Vh8@EgV9c*hb-FS~^ST@d t$6<xO<Ar=Ih6XE7ZCDo|aR?Y)VYiktDU>EjG|h_^oWQ_f4N5p*002a;)W84$ literal 0 HcmV?d00001 -- GitLab