diff --git a/Qalbum.py b/Qalbum.py
index 5784f42..61c7437 100755
--- a/Qalbum.py
+++ b/Qalbum.py
@@ -132,20 +132,25 @@ def getpathlist(path,options=False):
def pathscript(path,list):
''' Returns the javascript string of pathlist and pathimage arrays '''
- scrstr=''
+ this_str+='image:"" }'
+ elements.append(this_str)
+ scrstr+=','.join(elements)+'];'
return scrstr
def pathlinks(path,list):
''' Returns the HTML string of subfolders '''
+ if len(list)==0:
+ return '
'
pathstr='
'
pathstr+='
Subfolders
'
for p in list:
@@ -164,24 +169,28 @@ def pathlinks(path,list):
def imagescript(path,list):
''' Returns the javascript string of imagelist and imagedesc '''
- strout=''
+ strout+=','.join(elements)+'];'
return strout
def imagelinks(path,list):
''' Returns the HTML string of images '''
+ if len(list)==0:
+ return ''
strout='');
$('#imagesingle').css('width',width);
$('#imagesingle').css('height',height);
} else { // is image
$('#imagecontainer').html('
'+linkToBig+
- '
');
+ '
');
$('#imagesingle').css('max-width',width);
$('#imagesingle').css('max-height',height);
if ($.browser.msie) { // IE does not work with max*
$('#imagesingle').css('width','auto');
$('#imagesingle').css('height',height);
}
- $('#imagesingle').css('background-image','url("_tn/tn_'+encodeURIComponent(imagelist[i])+'.jpg")');
+ $('#imagesingle').css('background-image','url("_tn/tn_'+encodeURIComponent(imagelist[i].name)+'.jpg")');
}
$('#imagecontainer').css('height',height);
$('#imagecontainer').data('ID',i);
@@ -1037,13 +1031,13 @@ function showbigimage(i) {
showimage(currentimage);
});
- $('#desccontainer').html(getProgressEl()+currentlink(i)+imagedesc[i]);
+ $('#desccontainer').html(getProgressEl()+currentlink(i)+imagelist[i].desc);
$('#desccontainer').css('display','block');
if (fullscreen) {
$('#imagecontainer')[0].scrollIntoView(true);
}
addswipe('#imagecontainer');
- if (zoom & !isHTML(imagelist[i])) {
+ if (zoom & !isHTML(imagelist[i].name)) {
$(document).ready(function() {
var options = {
@@ -1056,7 +1050,7 @@ function showbigimage(i) {
$('#imagesingle').css('display','none');
// hide the distorted imagesingle
var bigImg=new Image();
- bigImg.src=encodeURIComponent(imagelist[i]);
+ bigImg.src=encodeURIComponent(imagelist[i].name);
$('.linktobig').jqzoom(options);
$(bigImg).load(function() {
if (bigImg.width < width) {
@@ -1073,7 +1067,7 @@ function showbigimage(i) {
function currentlink(i) {
// gets the search term for this image
index = location.href.split("?");
- s='['+String(i+1)+'] ';
+ s='['+String(i+1)+'] ';
return s;
}
@@ -1085,20 +1079,20 @@ function preload(i) {
left=Math.max(0,i-1);
left=Math.min(left,imagelist.length-1);
if (originals) {
- prestr='';
- prestr+='';
+ prestr='';
+ prestr+='';
} else {
- prestr='';
- prestr+='';
+ prestr='';
+ prestr+='';
}
maxThumb=getmaxthumbs();
ends=getThumbStartEnd(i+maxThumb,maxThumb);
for (n=ends.first; n';
+ prestr+='';
}
ends=getThumbStartEnd(i-maxThumb,maxThumb);
for (n=ends.first; n';
+ prestr+='';
}
$('#preloadcontainer').html(prestr);
preloadcheck();
@@ -1146,10 +1140,10 @@ function thumblist(n,curr) {
' (S)etup';
thumbstr='
';
}
if (pathlist.length==0) {
$('#pathcontainer').html('');
@@ -1268,14 +1263,12 @@ function subfolderdetaillist() {
}
function sortlist(property) {
// sorts the image list based on time or name, or reverse sort
- var templist=[]
- var tempmark=[]
- var tempcurrent=imagelist[currentimage];
- for (i in imagelist) {
- templist.push({name:imagelist[i], time:imagetime[i], desc:imagedesc[i]});
- }
+ if (currentimage!=-1) { var tempcurrent=imagelist[currentimage].name; }
+ var templist=imagelist;
+ var tempmark=[];
+
for (i in marklist) {
- tempmark.push(imagelist[marklist[i]]);
+ tempmark.push(imagelist[marklist[i]].name);
}
if (property=='time') {
templist.sort(function(a,b) {
@@ -1294,20 +1287,21 @@ function sortlist(property) {
if (property=='rev') {
templist.reverse();
}
- for (i in imagelist) {
- imagelist[i]=templist[i].name;
- imagetime[i]=templist[i].time;
- imagedesc[i]=templist[i].desc;
- if (imagelist[i] == tempcurrent) {
- currentimage=parseInt(i);
- }
- }
+
+ imagelist=templist;
var markidx=0;
marklist=[];
- for (i in tempmark) {
- markidx=imagelist.indexOf(tempmark[i]);
+ for (i in imagelist) {
+ markidx=tempmark.indexOf(imagelist[i].name);
if (markidx!=-1) {
- marklist.push(markidx);
+ marklist.push(parseInt(i));
+ }
+ }
+ if (currentimage!=-1) {
+ for (i in imagelist) {
+ if (imagelist[i].name == tempcurrent) {
+ currentimage=parseInt(i);
+ }
}
}
thumblist(currentimage,currentimage);
@@ -1323,7 +1317,7 @@ function request(type) {
// Fetch ?q=search request and present first match.
if ((query[0]=="q") && query.length>1 && query[1].length>0) {
for (imname in imagelist) {
- if (imagelist[imname].indexOf(unescape(query[1])) != -1) {
+ if (imagelist[imname].name.indexOf(unescape(query[1])) != -1) {
return parseInt(imname);
break;
}
@@ -1415,8 +1409,8 @@ function marklisteditor() {
var dlstr='X'+
- ''+imagelist[marklist[i]]+'';
- dlstr+=imagelist[marklist[i]]+'%0A';
+ ''+imagelist[marklist[i]].name+'';
+ dlstr+=imagelist[marklist[i]].name+'%0A';
}
dlstr+='">Download as file';
liststr+='
'+
@@ -1437,7 +1431,7 @@ function marklisttable() {
cel.cols=80;
cel.hasfocus=false;
for (i in marklist) {
- cel.value=cel.value+'"'+imagelist[marklist[i]]+'"\r\n';
+ cel.value=cel.value+'"'+imagelist[marklist[i]].name+'"\r\n';
}
var rows=cel.value.split(/\r?\n|\r/).length + 1;
cel.rows=rows;