User:BrownHairedGirl/metadata.js

/* Modified version of User:Outriggr/metadata.js */ var linkColor = "#002BB8"; var linkLead = '';

function loadXMLDoc(url) {   // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { var tpreq = new XMLHttpRequest; }   // branch for IE/Windows ActiveX version else if (window.ActiveXObject) { var tpreq = new ActiveXObject("Microsoft.XMLHTTP"); }

if (tpreq) { tpreq.onreadystatechange = function { if (tpreq.readyState==4) { // if "OK" if (tpreq.status==200) { getAssessment(tpreq); }        // else { alert("Problem retrieving data:" + tpreq.statusText); } }     // else { alert("Problem retrieving data:" + tpreq.statusText); } };

tpreq.open("GET", url, true); tpreq.send(""); } }

function getAssessment(myreq) {   var talk = myreq.responseText; //.toLowerCase; var otherInfo = "";

/* WP:IE addition by BHG */ var wp_ie_re = /\{\{(WikiProject Ireland|WPIRELAND|WPIreland|IrelandProj|Irelandproj|Ireland Proj)[^\}]+\}\}/m; /* WPieTag = talk.match(wp_ie_re); WPieTag = wp_ie_re.exec(talk);

if ( talk.match( /\{\{ganominee/i ) ) { otherInfo='. Currently a Good Article candidate.';}

else if ( talk.match(/\{\{fac}/i ) ) { otherInfo='. Currently a Featured Article candidate.';}

else if ( talk.match(/\{\{FormerFA2?/i) || talk.match(/currentstatus *= *FFA/i) ) {otherInfo='. A former Featured Article.';}

if (WPieTag) { var headings = document.getElementsByTagName("h1"); var encodedURI = "http://en.wikipedia.org/w/index.php?title=Talk:" + encodeURIComponent(headings[0].innerHTML) + "&action=edit&section=0";

otherInfo = otherInfo + "  Show/hide WPIE tag WikiProject Ireland assessment Tag = Edit tag  "; } else { otherInfo = otherInfo + " Not tagged for WikiProject Ireland " }

if ( talk.match(/class *= *a/i) ) { update("#007BFF", "An " + linkLead + "A-class</a> article", otherInfo);}

else if ( talk.match(/\{\{ga[|}]/i ) || talk.match(/currentstatus *= *(ffa\/)?ga/i) ) { update("#007700", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Good Articles">Good Article</a>', otherInfo);}

else if ( talk.match(/class *= *b/i) ) { update("#999933", "A " + linkLead + "B-class</a> article", otherInfo);}

else if ( talk.match(/class *= *start/i) ) { update("#BB6600", "A " + linkLead + "Start-class</a> article", otherInfo);}

else if ( talk.match(/class *= *stub/i) ) { update("#990011", "A " + linkLead + "Stub-class</a> article", otherInfo);}

else if ( talk.match(/class *= *list/i) ) { update("#990011", "A " + linkLead + "List-class</a> article", otherInfo);}

else if ( talk.match(/class *= *temp/i) ) { update("#990011", "A " + linkLead + "Template-class</a> article", otherInfo);}

else { update("#000000", "An " + linkLead + "unassessed</a> article", otherInfo);}

}

function update(color, slogan, info) { document.getElementsByTagName("h1")[0].style.cssText = "color: " + color + ";"; t = document.getElementById("siteSub").innerHTML; document.getElementById("siteSub").innerHTML = "" + slogan + " " +            t.charAt(0).toLowerCase + t.substring(1) + info; }

function wpie_update(slogan, info) { t = document.getElementById("siteSub").innerHTML; document.getElementById("siteSub").innerHTML = "" + slogan + " " +            t.charAt(0).toLowerCase + t.substring(1) + info; }

function begin { if ( wgNamespaceNumber==0 && !location.pathname.match('/w/index.php') ) { if ( document.getElementById("ca-talk").className == "new" ) { update("#000000", "An " + linkLead + "unassessed</a> article", ""); }   else if ( document.getElementById("featured-star") ) {update("#0066CC", 'A <a style="color:' + linkColor + ';" href="/wiki/Wikipedia:Featured Articles">Featured Article</a>', "");} else { var url = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=Talk:" + wgTitle + "&action=raw"; loadXMLDoc(url); } } }

addOnloadHook(begin);