var jsonlock,cont_w,perrow,ratio,data,linkage,range_support=false,showall=false,sliderobject; // default images per row (only displayed initially, because we're using local storage to remember what each user prefers) perrow=3; // thumbnail ratio ratio=0.6; /*//////////////////////////// end of user-configurable options ////////////////////////////*/ // container width cont_w=$("#images").width(); // local storage stuff if(Modernizr.localstorage){ perrow=localStorage.perrow ? localStorage.perrow : perrow; } // range stuff if(Modernizr.inputtypes.range){ $("#slider").addClass('html5'); sliderobject=$("#slider input"); sliderobject.val(perrow).show(); sliderobject.bind('mouseup',function(){ imageSize($(this).val()); }); }else{ $("#slider").addClass('jq'); sliderobject=$("#slider_jq"); sliderobject.show().slider({ 'min' : 3, 'max' : 10, change : function(){ imageSize($(this).slider("option","value")); } }).slider('value',perrow); } function urlencode (str) { str = (str+'').toString(); return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A')/*.replace(/%2F/g, '/')*/; } function urldecode (str) { return decodeURIComponent(str.replace(/\+/g, '%20')); } function obIsEmpty(o) { for(var i in o){ return false; } return true; } function imageSize(perrow){ var imgwidth=(cont_w/perrow)-8; var twidth=Math.floor(imgwidth-6); var theight=Math.floor((imgwidth*ratio)-6); if(Modernizr.csstransitions){ $("#images .image > a > img").css({ 'width':twidth+'px', 'height':theight+'px' }); }else{ $("#images .image > a > img").animate({ 'width':twidth+'px', 'height':theight+'px' },600); } $("#slider_n").html(perrow); if(Modernizr.localstorage){ localStorage.perrow=perrow; } } function showallbars(mmm){ if(mmm){ $('.bar').css('opacity','0.9'); showall=true; }else{ $('.bar').css('opacity','0'); showall=false; } } function getImages(dir){ var totalhref='', pathhtml, firstpart=false, firstdir=false; dir=urldecode(dir); $("#images").slideUp('slow',function(){ $("#images").empty(); jsonlock=Math.floor(Math.random()*99999); $.getJSON("_tastygallery/do.php?d="+urlencode(dir)+"&lock="+jsonlock+"&cb=?", function(data){ if($(".warning.w_empty").length){ $(".warning.w_empty").hide(); } if(jsonlock == data.jsonlock){ if(data.status==0){ for(i in data.cdirs){ totalhref+=data.cdirs[i]; pathhtml='
'; if(firstpart){ $("#paths").append(pathhtml); }else{ $("#paths").html(pathhtml); } firstpart=true; } if(!obIsEmpty(data.dirs)){ $("#paths").append(''); $("#path_go").click(function(){ $("#path_more").animate({height: 'toggle'},600); }); for(i in data.dirs){ dirhtml='
'+data.dirs[i]+'';
if(firstdir){
$("#path_more").append(dirhtml);
}else{
$("#path_more").html(dirhtml);
}
firstdir=true;
}
}
if(!obIsEmpty(data.images)){
for(i in data.images){
$("#images").append(
''
);
var fboxw=(data.images[i].w > 800) ? 800 : data.images[i].w;
var fboxh=Math.floor(data.images[i].h/(data.images[i].w/fboxw));
$('#img'+i+' a.uhh').fancybox({
autoScale: false,
autoDimensions: false,
width: fboxw,
height: fboxh,
content: '
| Version | '+ ''+t_version+' | '+ '
| Info | '+ 'tastydev.net | '+ '
| Copyright | '+ 'Vlad Harbuz | '+ '