Now it gets a little more complicated, but there might be an easier way, it just hasn't occurred to me.
Add this line (red) to the photogallery.prototype.showpage function in the photogallery.js file:
Code:
photogallery.prototype.showpage=function(gdiv, pagenumber){
photogallery.rel=pagenumber;
var totalitems=this.galleryarray.length //total number of images
var showstartindex=pagenumber*(this.rows*this.cols) //array index of div to start showing per pagenumber setting
var showendindex=showstartindex+(this.rows*this.cols) //array index of div to stop showing after per pagenumber setting
var tablecells=gdiv.getElementsByTagName("td")
for (var i=showstartindex, currentcell=0; i<showendindex && i<totalitems; i++, currentcell++) //Loop thru this page's images and populate cells with them
tablecells[currentcell].innerHTML=this.createImage(this.galleryarray[i])
while (currentcell<tablecells.length){ //For unused cells, if any, clear out its contents
tablecells[currentcell].innerHTML=""
currentcell++
}
}
Then add this cookie code from quirksmode.org to the very end of the photogallery.js file:
Code:
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
Add this (red) to the thepics.onselectphoto function we created before:
Code:
thepics.onselectphoto=function(img, link){
if (link!=null) //if this image is hyperlinked
createCookie('nav',photogallery.rel);
var page=win . . .
Finally, add this script at the end of the page in the iframe, right before the closing </body> tag:
Code:
<script type="text/javascript">
;(function(){
if(!window.opera&&readCookie('nav')){
for (var a=document.links, i = a.length-1; i > -1; --i)
if(a[i].rel==readCookie('nav'))
a[i].onclick();
eraseCookie('nav')
}})();
</script>
Bookmarks