User:BrownHairedGirl/metadata.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:BrownHairedGirl/metadata. |
/* Modified version of User:Outriggr/metadata.js */
var linkColor = "#002BB8";
var linkLead = '<a style="color:' + linkColor + ';" href="/wiki/Category:Wikipedia 1.0 assessments">';
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='. <i>Currently a <a href="' + wgServer + '/w/index.php?title=Wikipedia:Good_article_candidates" style="color:' + linkColor + ';">Good Article candidate</a></i>.';}
else if ( talk.match(/\{\{fac}/i ) ) { otherInfo='. <i>Currently a <a href="' + wgServer + '/w/index.php?title=Wikipedia:Featured_article_candidates/' + wgPageName + '&redirect=no" style="color:' + linkColor + ';">Featured Article candidate</a></i>.';}
else if ( talk.match(/\{\{FormerFA2?/i) || talk.match(/currentstatus *= *FFA/i) ) {otherInfo='. <i>A <a href="' + wgServer + '/w/index.php?title=Category:Wikipedia former featured articles/" style="color:' + linkColor + ';">former</a> Featured Article</i>.';}
if (WPieTag) {
var headings = document.getElementsByTagName("h1");
var encodedURI = "http://en.wikipedia.org/w/index.php?title=Talk:" + encodeURIComponent(headings[0].innerHTML) + "&action=edit§ion=0";
otherInfo = otherInfo + "<span style='margin-left:3em' /><span onclick='if (document.getElementById(\"wpieshowtag\").style.display == \"block\") {document.getElementById(\"wpieshowtag\").style.display = \"none\";} else {document.getElementById(\"wpieshowtag\").style.display = \"block\";}'><img alt='' src='/media/wikipedia/commons/thumb/4/45/Flag_of_Ireland.svg/22px-Flag_of_Ireland.svg.png' width='22' height='11' border='0'> <span style='color:#0029BD'>Show/hide WPIE tag</span></span><div id='wpieshowtag' style='display:none; background-color:green; font-weight:bold; margin: 0.3em 1em 1em 1em; padding: 0.2em 1em 1em 1em;'><a href='http://en.wikipedia.org/wiki/Wikipedia:WikiProject_Ireland/Assessment' style='background-color:white; padding:4px;'>WikiProject Ireland assessment</a><div style='font-weight:bold; clear:left; color:black; padding:0.5em; background-color:white;'>Tag = <code style='color:green;'>" + WPieTag[0] + "</code><br /><a href=\"" + encodedURI + "\" title=\"Edit the talk page to change the tag\">Edit tag</a></div></div>";
}
else {
otherInfo = otherInfo + "<span style='margin-left:3em'><i><b>Not tagged</i></b> for <a href='http://en.wikipedia.org/wiki/Wikipedia:WikiProject_Ireland'>WikiProject Ireland</a></span>"
}
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 = "<i>" + slogan + "</i> " + t.charAt(0).toLowerCase() + t.substring(1) + info;
}
function wpie_update(slogan, info) {
t = document.getElementById("siteSub").innerHTML;
document.getElementById("siteSub").innerHTML = "<i>" + slogan + "</i> " + 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);