User:JuhkoDev/recent.js

//Tuoreet muutokset //

$(recent);

var rec; var orequest; function recent { var bodye = document.getElementsByTagName('body') [0]; //Body-elementti //Lista rec=document.createElement('div'); rec.setAttribute('id','rec'); rec.setAttribute('style','position:absolute; top:0; right:40px; background-color:#f8f8f8; border:1px solid #606080; width:50%; z-index:3; font-size:11px; padding:1em; display:none;'); bodye.appendChild(rec); //Päivitys rre=document.createElement('div'); rre.setAttribute('id','rre'); rre.setAttribute('style','position:absolute; top:120px; right:0px; z-index:4; width:40px; height:40px; cursor:pointer; display:none;'); rre.setAttribute('onClick','recContent;'); rre.innerHTML=''; bodye.appendChild(rre); //Näytä tai piilota rshow=document.createElement('div'); rshow.setAttribute('id','rec'); rshow.setAttribute('style','position:absolute; top:80px; right:0px; z-index:4; width:40px; height:40px; cursor:pointer;'); rshow.setAttribute('onClick','rShowHide;'); rshow.innerHTML=''; bodye.appendChild(rshow); rec.innerHTML=''; } function rShowHide { if(document.getElementById('rec').style.display == "none") { document.getElementById('rec').style.display = "block"; document.getElementById('rre').style.display = "block"; document.getElementById('rec').innerHTML='Wait...'; recContent; } else { document.getElementById('rec').style.display = "none"; document.getElementById('rre').style.display = "none"; } } // function getrec {

orequest = new XMLHttpRequest; sURL = "/w/index.php?title=Special:RecentChanges&hidemyself=1&hidepatrolled=1&hideliu=1"

orequest.onreadystatechange=loadready; orequest.open("GET",sURL,true); orequest.setRequestHeader("User-Agent",navigator.userAgent); orequest.send(null); }

function loadready {

if(orequest.status==200) { document.getElementById("rec").innerHTML = orequest.responseText;

var startpos=document.getElementById("rec").innerHTML.indexOf(' '); var endpos=document.getElementById("rec").innerHTML.indexOf(''); document.getElementById("rec").innerHTML=rec.innerHTML.substr(startpos,endpos-startpos); /* if(orequest.status==4) { var lis = document.getElementsByTagName("li"); for(i=0;i++;i<lis.length) { if(lis[i].getElementsByClass) } } } else document.getElementById("rec").innerHTML = "Error while reading page";

} function recContent { getrec; }