fullscreen feature

This commit is contained in:
q
2012-01-13 20:41:56 +02:00
parent 8c98f36d43
commit 15ac4b4f97
2 changed files with 33 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ from datetime import datetime
# (c) ville.rantanen@helsinki.fi # (c) ville.rantanen@helsinki.fi
__version__='1.4' __version__='1.5b'
webfilesearch=re.compile('.*index.html$|.*gallerystyle.css$|.*galleryscript.js$|.*descriptions.csv$|\..*',re.I) webfilesearch=re.compile('.*index.html$|.*gallerystyle.css$|.*galleryscript.js$|.*descriptions.csv$|\..*',re.I)
imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.svg$|.*\.pdf$',re.I) imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.svg$|.*\.pdf$',re.I)
@@ -440,7 +440,7 @@ folder is the root folder of the image album.'''
shutil.copyfile(os.path.join(fullpath,'galleryscript.js'),os.path.join(startpath,'galleryscript.js')) shutil.copyfile(os.path.join(fullpath,'galleryscript.js'),os.path.join(startpath,'galleryscript.js'))
global footer global footer
footer=''' footer='''
<div id="footer">Generated with Qalbum '''+__version__+''' ('''+datetime.today().strftime("%y-%m-%d %H:%M")+''')</div> <div id="footer">Generated with Qalbum '''+__version__+''' ('''+datetime.today().strftime("%y-%m-%d %H:%M")+''') <a href="http://code.google.com/p/qalbum/wiki/Usage" target="_TOP">Need help?</a></div>
<script language="javascript">setup();</script> <script language="javascript">setup();</script>
</BODY> </BODY>
</HTML>''' </HTML>'''

View File

@@ -26,6 +26,7 @@ var marklist=[]
var currentimage=-1; var currentimage=-1;
var currentlist=-1; var currentlist=-1;
var originals=false; var originals=false;
var fullscreen=false;
var preloader; var preloader;
var slideshowtimer; var slideshowtimer;
var slideshowinterval; var slideshowinterval;
@@ -41,6 +42,8 @@ function setup() {
if (slideshowinterval!=0) { if (slideshowinterval!=0) {
slideshowtimer=setInterval('slidenext()',1000*Math.abs(slideshowinterval)); slideshowtimer=setInterval('slidenext()',1000*Math.abs(slideshowinterval));
} }
fullscreen=request('full')==1;
originals=request('orig')==1;
var req=request('p'); var req=request('p');
if (req==-1) { req=request('q'); } if (req==-1) { req=request('q'); }
if (req!=-1) { if (req!=-1) {
@@ -69,6 +72,7 @@ function showbigimage(i) {
ob=document.getElementById('imagecontainer'); ob=document.getElementById('imagecontainer');
width=document.body.clientWidth-30; width=document.body.clientWidth-30;
height=document.body.clientHeight-225; height=document.body.clientHeight-225;
if (fullscreen) { height=height+200; }
if (originals) { mediumstr=encodeURIComponent(imagelist[i]); } if (originals) { mediumstr=encodeURIComponent(imagelist[i]); }
else { mediumstr='_med/med_'+encodeURIComponent(imagelist[i])+'.jpg'; } else { mediumstr='_med/med_'+encodeURIComponent(imagelist[i])+'.jpg'; }
ob.innerHTML='<div class="imagebig"><a href="'+encodeURIComponent(imagelist[i])+'" target="_blank"><img id="imagesingle" src="'+mediumstr+'"></a></div>'; ob.innerHTML='<div class="imagebig"><a href="'+encodeURIComponent(imagelist[i])+'" target="_blank"><img id="imagesingle" src="'+mediumstr+'"></a></div>';
@@ -146,7 +150,8 @@ function thumblist(n,curr) {
'<span>Order:</span><span class="menuitem" id="sortalpha" onclick="sortlist(\'alpha\')">name</span>/'+ '<span>Order:</span><span class="menuitem" id="sortalpha" onclick="sortlist(\'alpha\')">name</span>/'+
'<span class="menuitem" id="sorttime" onclick="sortlist(\'time\')">time</span>/'+ '<span class="menuitem" id="sorttime" onclick="sortlist(\'time\')">time</span>/'+
'<span class="menuitem" id="sortrev" onclick="sortlist(\'rev\')">reverse</span>'+ '<span class="menuitem" id="sortrev" onclick="sortlist(\'rev\')">reverse</span>'+
'<span>Original:</span><span class="menuitem" id="originals" onclick="fliporiginals()">'+String(originals)+'</span></span>'; '<span>Original:</span><span class="menuitem" id="originals" onclick="fliporiginals()">'+String(originals)+'</span>'+
'<span>Fullscreen:</span><span class="menuitem" id="fullscreen" onclick="flipfullscreen()">'+String(fullscreen)+'</span></span>';
thumbstr='<div><span class="headsmall">Images</span>'+menustr+'</div><div id="thumbrow">'+leftstr; thumbstr='<div><span class="headsmall">Images</span>'+menustr+'</div><div id="thumbrow">'+leftstr;
for (i=startI; i<endI; i++) { for (i=startI; i<endI; i++) {
thumbstr+='<span id="n'+i+'" class="imagebox thumbbox"><img class="thumbimage" title="'+titlestring(imagedesc[i])+'" onclick="showimage('+String(i)+')" src="_tn/tn_'+encodeURIComponent(imagelist[i])+'.jpg"><br/><a href="'+encodeURIComponent(imagelist[i])+'" target="_blank">'+nicestring((imagelist[i]))+'</a></span>'; thumbstr+='<span id="n'+i+'" class="imagebox thumbbox"><img class="thumbimage" title="'+titlestring(imagedesc[i])+'" onclick="showimage('+String(i)+')" src="_tn/tn_'+encodeURIComponent(imagelist[i])+'.jpg"><br/><a href="'+encodeURIComponent(imagelist[i])+'" target="_blank">'+nicestring((imagelist[i]))+'</a></span>';
@@ -314,6 +319,22 @@ function request(type) {
return retval; return retval;
} }
} }
if (type=="full") {
// Fetch ?full=1
if ((query[0]=="full") && query.length>1 && query[1].length>0) {
var retval=parseInt(query[1]);
if (isNaN(retval)) { return 0; }
return retval;
}
}
if (type=="orig") {
// Fetch ?orig=1
if ((query[0]=="orig") && query.length>1 && query[1].length>0) {
var retval=parseInt(query[1]);
if (isNaN(retval)) { return 0; }
return retval;
}
}
} }
if (type=="auto") { return 0; } if (type=="auto") { return 0; }
return -1; return -1;
@@ -444,6 +465,15 @@ function fliporiginals() {
showimage(currentimage); showimage(currentimage);
} }
function flipfullscreen() {
// show thumbrow / not
if (fullscreen)
{ fullscreen=false; }
else
{ fullscreen=true; }
showimage(currentimage);
}
function getmaxthumbs() { function getmaxthumbs() {
return Math.floor((document.body.clientWidth-30)/100)-2; return Math.floor((document.body.clientWidth-30)/100)-2;
} }