Added an indication that the images are loading when maximized in the same window.

This commit is contained in:
Savetheinternet 2010-11-03 23:53:31 +11:00
parent bb1abb85e1
commit d1ad51a84d

12
main.js
View File

@ -6,7 +6,6 @@ function highlightReply(id)
if (divs[i].className.indexOf('post') != -1) if (divs[i].className.indexOf('post') != -1)
divs[i].className = divs[i].className.replace(/highlighted/, ''); divs[i].className = divs[i].className.replace(/highlighted/, '');
} }
if (id) if (id)
document.getElementById('reply_'+id).className += ' highlighted'; document.getElementById('reply_'+id).className += ' highlighted';
} }
@ -39,17 +38,22 @@ function init()
link = document.getElementsByTagName('a'); link = document.getElementsByTagName('a');
for ( i in link ) { for ( i in link ) {
if(typeof link[i] == "object" && link[i].childNodes[0].src) { if(typeof link[i] == "object" && link[i].childNodes[0].src) {
link[i].onclick = function() { link[i].onclick = function() {
if(!this.tag) { if(!this.tag) {
this.tag = this.childNodes[0].src; this.tag = this.childNodes[0].src;
this.childNodes[0].src = this.href; this.childNodes[0].src = this.href;
this.childNodes[0].style.width = 'auto'; this.childNodes[0].style.width = 'auto';
this.childNodes[0].style.height='auto'; this.childNodes[0].style.height = 'auto';
this.childNodes[0].style.opacity = '0.4';
this.childNodes[0].style.filter = 'alpha(opacity=40)';
this.childNodes[0].onload = function() {
this.style.opacity = '1';
this.style.filter = '';
}
} else { } else {
this.childNodes[0].src = this.tag; this.childNodes[0].src = this.tag;
this.childNodes[0].style.width = 'auto'; this.childNodes[0].style.width = 'auto';
this.childNodes[0].style.height='auto'; this.childNodes[0].style.height = 'auto';
this.tag = ''; this.tag = '';
} }
return false; return false;