A lightweight FCGI blog written in python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
pylog/gallery.js

57 lines
1.6 KiB

// Create function to load image
function loadImg(src){
var body = document.getElementsByTagName("body")[0];
var div = document.getElementById("gallery_container");
if( !div ) {
div = document.createElement('div');
div.setAttribute('id', 'gallery_container');
body.appendChild(div);
var anch = document.createElement('a');
anch.setAttribute('href', '#');
div.appendChild(anch);
var close = new Image();
close.src = "_img/close.png"
close.id = "gallery_close";
close.onclick = function(){
div.style.visibility='hidden';
return false;
}
anch.appendChild(close);
anch = document.createElement('a');
anch.setAttribute('href', '#');
var prev = new Image();
anch.appendChild(prev);
div.appendChild(anch);
prev.src = "_img/prev.png";
prev.id = "gallery_prev";
var img = new Image()
div.appendChild(img);
img.src = src;
anch = document.createElement('a');
anch.setAttribute('href', '#');
var next = new Image();
anch.appendChild(next);
div.appendChild(anch);
next.src = "_img/next.png";
next.id = "gallery_next";
}else{
var oldimg = div.getElementsByTagName("img");
if( oldimg ){
for( var i=0; i<oldimg.length; i++){
if( oldimg[i].parentNode == div ){
oldimg[i].src = src;
}
}
}
div.style.visibility='visible';
}
}