User:Aaron Rotenberg/monobook.js

// /*


 * Contributions button on user pages ***



addOnloadHook(function {	if (mw.config.get('wgCanonicalNamespace') == "User" || mw.config.get('wgCanonicalNamespace') == "User_talk") {		var slashIndex = mw.config.get('wgTitle').indexOf("/");		var mainTitle = (slashIndex == -1) ? mw.config.get('wgTitle') : mw.config.get('wgTitle').substring(0, slashIndex);		mw.util.addPortletLink("p-cactions", "/wiki/Special:Contributions/" + mainTitle, "contributions", "ar-contributions-button", "View this user's contributions");	} });

/*


 * Recent changes highlighting ***



addOnloadHook(function {	var content = document.getElementById("content");

if (mw.config.get('wgCanonicalNamespace') == "Special" && mw.config.get('wgTitle') == "RecentChanges") { var entries = content.getElementsByTagName("li"); for (var i = 0; i < entries.length; i++) { var entry = entries[i];

// If MediaWiki highlights the byte delta, it is < -500 and we don't have to parse it. var strongs = entry.getElementsByTagName("strong"); var found = false; for (var j = 0; j < strongs.length; j++) { var element = strongs[j]; if (element.className == "mw-plusminus-neg") { highlight(entry); found = true; break; }			}

if (!found) { var spans = entry.getElementsByTagName("span"); for (var j = 0; j < spans.length; j++) { var element = spans[j]; if (element.className == "mw-plusminus-pos"							|| element.className == "mw-plusminus-null"							|| element.className == "mw-plusminus-neg") { var text = element.firstChild.nodeValue.replace(/,/g,""); var value = text.substring(1, text.length - 1) * 1; // Convert string to number. if (value <= -500 || value >= 2000) { highlight(entry); }						break; }				}			}		}	} });

function highlight(element) { element.style.background = "#ffce7b"; }

/*


 * Article tags box ***

var tagToolbarDiv;

addOnloadHook(function { var content = document.getElementById("content");  var topHeading = document.getElementById("siteNotice");

if (mw.config.get('wgCanonicalNamespace') == "" && document.editform) { tagToolbarDiv = document.createElement("div"); tagToolbarDiv.setAttribute("style",	"margin:7px; border:1px solid #aaaaaa; padding:3px; text-align:center;"); // Forced to use this...? toggleVisibility(tagToolbarDiv);

//////////////////////////////////////////////////   tagToolbarDiv.innerHTML = " General: " + "Needs expansion | " + "Needs wikification | " + "Orphan | " + "Bad article title | " + "Intro too short | " + "Intro needs a rewrite | " + "Lists need cleanup | " + "Describes fiction in in-universe style | " + "<a href='#' onclick='javascript:tagButtonClicked(\"globalize\"); return false;'>Not a worldwide view</a>" + " " +

" References: " + "<a href='#' onclick='javascript:tagButtonClicked(\"unreferenced\"); return false;'>No references</a> | " + "<a href='#' onclick='javascript:tagButtonClicked(\"refimprove\"); return false;'>Not enough good references</a> | " + "<a href='#' onclick='javascript:tagButtonClicked(\"original research\"); return false;'>Possible original research</a> | " + "<a href='#' onclick='javascript:tagButtonClicked(\"citation style\"); return false;'>Unclear citation style</a>" + " " +

" Time-related: " + "<a href='#' onclick='javascript:tagButtonClicked(\"update\"); return false;'>Needs to be updated</a> | " + "<a href='#' onclick='javascript:tagButtonClicked(\"current\"); return false;'>Current event</a> | " + "<a href='#' onclick='javascript:tagButtonClicked(\"future\"); return false;'>Scheduled or expected future event</a> | " + "<a href='#' onclick='javascript:tagButtonClicked(\"recent death\"); return false;'>Person who recently died</a>" + " " +

" " +        "<a href='/wiki/WP:Template messages'>See more</a> | " + "<a href='#' onclick='javascript:toggleVisibility(tagToolbarDiv); return false;'>Close this box</a>" + " ";   //////////////////////////////////////////////////

content.insertBefore(tagToolbarDiv, topHeading);

mw.util.addPortletLink("p-cactions", "javascript:toggleVisibility(tagToolbarDiv);",	"tag", "ar-tag-button", "Tag this article with a template notice"); } });

function tagButtonClicked(templateName) { document.editform.wpTextbox1.value = "\n" + document.editform.wpTextbox1.value; }

function toggleVisibility(item) { if (item.style.display == "none") { item.style.display = "block"; } else { item.style.display = "none"; } }

//