diff --git a/galleryscript.js b/galleryscript.js index d6fe2c2..a8db192 100644 --- a/galleryscript.js +++ b/galleryscript.js @@ -18,740 +18,6 @@ Copyright 2012 Ville Rantanen */ -var maxThumb=10; -var uagent = navigator.userAgent.toLowerCase(); -var pathlist=[]; -var pathimage=[]; -var imagelist=[]; -var filelist=[]; -var imagedesc=[]; -var imagetime=[]; -var marklist=[] -var currentimage=-1; -var currentlist=-1; -var originals=false; -var fullscreen=false; -var zoom=false; -var preloader; -var slideshowtimer; -var slideshowinterval; -var configupdatetimer; -var sorttype=""; - -function setup() { - // Setup run at the load of page. - if (notsupported()) { - return; - } - //hidethumbs(); - document.onkeydown=keypressed; - slideshowinterval=request('auto'); - if (slideshowinterval!=0) { - slideshowtimer=setInterval('slidenext()',1000*Math.abs(slideshowinterval)); - } - fullscreen=request('full')==1; - originals=request('orig')==1; - request('sort'); - var req=request('p'); - if (req==-1) { req=request('q'); } - if (req!=-1) { - showimage(req); - } else { - thumblist(0,-1); - subfolderbiglist(); - } - return; -} - -function showimage(i) { - // Main function to show a single image - if (i>imagelist.length-1 || i<0) { return; } - thumblist(i,i); - showbigimage(i); - preload(i); - subfoldersmalllist(); - currentimage=i; - setProgress(i); - return; -} - -function showbigimage(i) { - // The medium version of image in the big image container - if (i==-1) { return; } - var ob=document.getElementById('imagecontainer'); - var width=document.body.clientWidth-30; - var height=document.body.clientHeight-225; - if (fullscreen) { height=height+200; } - if (originals) { mediumstr=encodeURIComponent(imagelist[i]); } - else { mediumstr='_med/med_'+encodeURIComponent(imagelist[i])+'.jpg'; } - ob.innerHTML='
'; - document.getElementById('imagesingle').style.maxWidth=width; - ob.style.height=height; - document.getElementById('imagesingle').style.maxHeight=height; - var dc=document.getElementById('desccontainer'); - dc.innerHTML=getProgressEl()+currentlink(i)+imagedesc[i]; - dc.style.display='block'; - if (zoom) { - $(document).ready(function() { - - var options = { - zoomType: 'innerzoom', - preloadImages: false, - alwaysOn:true, - }; - $('#imagesingle').css('width',width); - $('#imagesingle').css('height',height); - $('#imagesingle').css('display','none'); - // hide the distorted imagesingle - var bigImg=new Image(); - bigImg.src=encodeURIComponent(imagelist[i]); - $('.linktobig').jqzoom(options); - $(bigImg).load(function() { - if (bigImg.width < width) { - var leftoffset=(width - bigImg.width)/2; - $('.zoompad').css('left',leftoffset); - $('body').css('overflow-x','hidden'); - } - }); - }); - } - return; -} - -function currentlink(i) { - // gets the search term for this image - index = location.href.split("?"); - s='['+String(i+1)+'] '; - return s; -} - -function preload(i) { - // preloads left and right images - if (imagelist.length==0) { return; } - ob=document.getElementById('preloadcontainer'); - right=Math.max(0,i+1); - right=Math.min(right,imagelist.length-1); - left=Math.max(0,i-1); - left=Math.min(left,imagelist.length-1); - if (originals) { - prestr='
';
- prestr+='
';
- }
- maxThumb=getmaxthumbs();
- ends=getThumbStartEnd(i+maxThumb,maxThumb);
- for (n=ends.first; n!['+titlestring(imagedesc[i])+'](_tn/tn_'+encodeURIComponent(imagelist[i])+'.jpg)
';
- }
- thumbstr+='
';
+ prestr+='
';
+ }
+ maxThumb=getmaxthumbs();
+ ends=getThumbStartEnd(i+maxThumb,maxThumb);
+ for (n=ends.first; n!['+titlestring(imagedesc[i])+'](_tn/tn_'+encodeURIComponent(imagelist[i])+'.jpg)
';
+ }
+ thumbstr+='