User:Phlip/cologneblue.js
From Homestar Runner Wiki
(Difference between revisions)
| Line 1: | Line 1: | ||
| - | + | // include utility functions | |
| - | + | document.write('<script type="text/javascript" src="/index.php?title=User:Phlip/utilities.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
function dostuff() | function dostuff() | ||
{ | { | ||
| - | + | if (utilities.cologneBlueNewMessages()) | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
{ | { | ||
| - | + | var div = document.createElement("div") | |
| - | + | div.className = "newmessagesbox"; // intentionally not "usermessages" - take that, fake message boxes! | |
| - | + | div.appendChild(document.createTextNode("You have ")); | |
| - | + | var a = document.createElement("a") | |
| - | + | a.href = utilities.localurl("Phlip", 3); | |
| - | + | a.appendChild(document.createTextNode("new messages")); | |
| - | + | div.appendChild(a); | |
| - | + | div.appendChild(document.createTextNode(" (")); | |
| + | a = document.createElement("a") | ||
| + | a.href = utilities.localurl("Phlip", 3, "diff=cur"); | ||
| + | a.appendChild(document.createTextNode("diff")); | ||
| + | div.appendChild(a); | ||
| + | div.appendChild(document.createTextNode(") (")); | ||
| + | a = document.createElement("a") | ||
| + | a.href = utilities.localurl("Phlip", 3, "action=history"); | ||
| + | a.appendChild(document.createTextNode("history")); | ||
| + | div.appendChild(a); | ||
| + | div.appendChild(document.createTextNode(").")); | ||
| - | + | var article = document.getElementById('article'); | |
| - | + | article.insertBefore(div, article.firstChild); | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
} | } | ||
| + | document.body.appendChild(document.createTextNode(utilities.getArticleNamespace() + ".." + utilities.getArticleTitle())); | ||
| - | + | if (utilities.getArticleNamespace() == 2 || utilities.getArticleNamespace() == 3) | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
{ | { | ||
| - | + | var username = utilities.getArticleTitle(); | |
| - | + | var i = username.indexOf('/') | |
| - | + | if (i >= 0) | |
| + | username = username.substr(0, i); | ||
| + | var link = utilities.addCologneBlueQuickbarLink(utilities.localurl(username, 2), username, "Context"); | ||
| + | if (link) | ||
| + | link.parentNode.insertBefore(document.createElement('hr'), link); | ||
| + | utilities.addCologneBlueQuickbarLink(utilities.localurl(username, 3), username + " talk", "Context"); | ||
| + | utilities.addCologneBlueQuickbarLink(utilities.localurl("Contributions/" + username, -1), "Contribs", "Context"); | ||
| + | utilities.addCologneBlueQuickbarLink(utilities.localurl("Log", -1, "user=" + username), "Show Logs (user)", "Context"); | ||
| + | utilities.addCologneBlueQuickbarLink(utilities.localurl("Log", -1, "page=User:" + username), "Show Logs (target)", "Context"); | ||
} | } | ||
| - | + | utilities.addCologneBlueQuickbarLink("http://validator.w3.org/check?uri=" + escape(utilities.getArticleURL()), "Validate", "External"); | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | utilities.addCologneBlueTopbarLink("javascript:alert('hi')", "Start", true); | |
| - | + | utilities.addCologneBlueTopbarLink("javascript:alert('hi')", "End"); | |
| - | + | var ns = utilities.getArticleNamespace(); | |
| - | + | var t = utilities.getArticleTitle(); | |
| - | + | if (utilities.talknamespace[ns]) | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | if ( | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
{ | { | ||
| - | + | var talklink = utilities.addCologneBlueSubtopbarLink(utilities.localurl(t, utilities.talknamespace [ns]), utilities.namespacedescription[utilities.talknamespace [ns]], true); | |
| - | + | if (utilities.talknamespace[ns] == ns) | |
| - | + | talklink.style.fontWeight = "bold"; | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
} | } | ||
| + | var pagelink = utilities.addCologneBlueSubtopbarLink(utilities.localurl(t, utilities.articlenamespace[ns]), utilities.namespacedescription[utilities.articlenamespace[ns]], true); | ||
| + | if (utilities.articlenamespace[ns] == ns) | ||
| + | pagelink.style.fontWeight = "bold"; | ||
// highlight IP addresses (eg in Recent Changes) | // highlight IP addresses (eg in Recent Changes) | ||
| Line 207: | Line 67: | ||
links[i].className += " ipcontribs"; | links[i].className += " ipcontribs"; | ||
} | } | ||
| - | |||
// these two lines stolen from [[User:Tom/monobook.js]] | // these two lines stolen from [[User:Tom/monobook.js]] | ||
if (window.addEventListener) window.addEventListener("load",dostuff,false); | if (window.addEventListener) window.addEventListener("load",dostuff,false); | ||
else if (window.attachEvent) window.attachEvent("onload",dostuff); | else if (window.attachEvent) window.attachEvent("onload",dostuff); | ||
Revision as of 19:20, 24 May 2006
// include utility functions
document.write('<script type="text/javascript" src="/index.php?title=User:Phlip/utilities.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
function dostuff()
{
if (utilities.cologneBlueNewMessages())
{
var div = document.createElement("div")
div.className = "newmessagesbox"; // intentionally not "usermessages" - take that, fake message boxes!
div.appendChild(document.createTextNode("You have "));
var a = document.createElement("a")
a.href = utilities.localurl("Phlip", 3);
a.appendChild(document.createTextNode("new messages"));
div.appendChild(a);
div.appendChild(document.createTextNode(" ("));
a = document.createElement("a")
a.href = utilities.localurl("Phlip", 3, "diff=cur");
a.appendChild(document.createTextNode("diff"));
div.appendChild(a);
div.appendChild(document.createTextNode(") ("));
a = document.createElement("a")
a.href = utilities.localurl("Phlip", 3, "action=history");
a.appendChild(document.createTextNode("history"));
div.appendChild(a);
div.appendChild(document.createTextNode(")."));
var article = document.getElementById('article');
article.insertBefore(div, article.firstChild);
}
document.body.appendChild(document.createTextNode(utilities.getArticleNamespace() + ".." + utilities.getArticleTitle()));
if (utilities.getArticleNamespace() == 2 || utilities.getArticleNamespace() == 3)
{
var username = utilities.getArticleTitle();
var i = username.indexOf('/')
if (i >= 0)
username = username.substr(0, i);
var link = utilities.addCologneBlueQuickbarLink(utilities.localurl(username, 2), username, "Context");
if (link)
link.parentNode.insertBefore(document.createElement('hr'), link);
utilities.addCologneBlueQuickbarLink(utilities.localurl(username, 3), username + " talk", "Context");
utilities.addCologneBlueQuickbarLink(utilities.localurl("Contributions/" + username, -1), "Contribs", "Context");
utilities.addCologneBlueQuickbarLink(utilities.localurl("Log", -1, "user=" + username), "Show Logs (user)", "Context");
utilities.addCologneBlueQuickbarLink(utilities.localurl("Log", -1, "page=User:" + username), "Show Logs (target)", "Context");
}
utilities.addCologneBlueQuickbarLink("http://validator.w3.org/check?uri=" + escape(utilities.getArticleURL()), "Validate", "External");
utilities.addCologneBlueTopbarLink("javascript:alert('hi')", "Start", true);
utilities.addCologneBlueTopbarLink("javascript:alert('hi')", "End");
var ns = utilities.getArticleNamespace();
var t = utilities.getArticleTitle();
if (utilities.talknamespace[ns])
{
var talklink = utilities.addCologneBlueSubtopbarLink(utilities.localurl(t, utilities.talknamespace [ns]), utilities.namespacedescription[utilities.talknamespace [ns]], true);
if (utilities.talknamespace[ns] == ns)
talklink.style.fontWeight = "bold";
}
var pagelink = utilities.addCologneBlueSubtopbarLink(utilities.localurl(t, utilities.articlenamespace[ns]), utilities.namespacedescription[utilities.articlenamespace[ns]], true);
if (utilities.articlenamespace[ns] == ns)
pagelink.style.fontWeight = "bold";
// highlight IP addresses (eg in Recent Changes)
links = document.getElementsByTagName("a");
regex = /Special:Contributions(\/|&target=)[\d.]+$/;
for (i = 0; i < links.length; i++)
if (regex.test(links[i].href))
links[i].className += " ipcontribs";
}
// these two lines stolen from [[User:Tom/monobook.js]]
if (window.addEventListener) window.addEventListener("load",dostuff,false);
else if (window.attachEvent) window.attachEvent("onload",dostuff);
