// From [[Wikipedia:WikiProject User_scripts/Scripts/All_diffs_above_here]], revision 167033167
function openAdahLinks(kk)
{
var as = document.getElementsByTagName('a');
var k = 0;
for (n=0; n<as.length; n++) {
if (as[n].innerHTML == 'diff') {
if (k <= kk) {
window.open(as[n].href, '_blank');
}
k++;
}
}
}
function addAdahLinks()
{
if (wgCanonicalNamespace == 'Special' && wgCanonicalSpecialPageName == 'Watchlist') {
var as = document.getElementsByTagName('a');
var k = 0;
for (n=0; n<as.length; n++) {
if (as[n].innerHTML == 'diff') {
var tn = document.createTextNode(') (');
var link = document.createElement('a');
link.href = 'javascript:openAdahLinks(' + (k++) + ')';
link.appendChild(document.createTextNode('adah'), null);
as[n].parentNode.insertBefore(tn , as[n].nextSibling.nextSibling);
as[n].parentNode.insertBefore(link , as[n].nextSibling.nextSibling);
}
}
}
}
$(addAdahLinks);
// load talk page inline
if(wgNamespaceNumber==0) addOnloadHook(getTalkPage)
function getTalkPage() { var tlink = document.getElementById('ca-talk'); if(tlink.className == 'new') return; var url = tlink.getElementsByTagName('a')[0].href; url += (url.indexOf('?')==-1) ? '?action=render' : '&action=render' ; var tp = document.createElement('div'); tp.style.border = '1px solid blue'; tp.style.margin = '.5em 0'; tp.style.padding = '.35em'; tp.style.height = '128em'; tp.style.overflow = 'auto'; tp.id = 'ajax-talkpage'; tp.appendChild(document.createTextNode('fetching talk page...')); document.getElementById('bodyContent').appendChild(tp); getXML(url,getTalkPageStateChange);}
function getTalkPageStateChange() { switch (getReq.readyState) { case 4:
if (getReq.status == 200) { var tp = document.getElementById('ajax-talkpage'); clearNode(tp); var txt = getReq.responseText; tp.innerHTML = txt;} else { tp.appendChild(document.createTextNode('** Problem ** ' + getReq.statusText))
}
break;}
}
function clearNode(obj) { while(obj.firstChild) obj.removeChild(obj.firstChild);}
function getText(obj) { if (obj.nodeType == 3) return obj.nodeValue; var txt = new Array(); var i=0; while(obj.childNodes[i]) { txt[txt.length] = getText(obj.childNodes[i]); i++;}
return txt.join('');}
function getXML(url,func) { if (window.XMLHttpRequest) { getReq = new XMLHttpRequest();} else if (window.ActiveXObject) { getReq = new ActiveXObject('Microsoft.XMLHTTP');}
if (getReq) { getReq.onreadystatechange = func; try { getReq.open('GET', url, true); getReq.send('');} catch (e) { alert(e);}
} else { alert('XMLHTTPRequest not supported');}
}
// Edit summary
if (wgAction=='edit' && document.URL.indexOf('§ion=0') != -1)
$(function(){
document.getElementById('wpSummary').value = "/* Intro */ ";
})
importScript('Wikipedia:AutoEd/formatter.js');