User:Year2000Prob/monobook.js: Difference between revisions

Content deleted Content added
mNo edit summary
m Maintenance: Replacing legacy global variable (phab:T72470)
 
(17 intermediate revisions by one other user not shown)
Line 2:
window.importScript = function(src) {
var self = arguments.callee;
if (!self.imported) self.imported = [];
if (arguments.length == 0) {
var imported = self.imported;
delete self.imported.length = 0;
return imported;
};
var attrs, format = function(ns,src){return typeof self.namespaces[ns]=="function"?self.namespaces[ns](src):(self.namespaces[ns]||mw.config.get('wgServer')+mw.config.get('wgScript')+"?title={{{src}}}&action=raw&ctype=text/javascript").replace("{{{src}}}", src)};
if (!self.imported) self.imported = [];
var format = function(wscript, src) {
var lang, source = src;
return wscript.replace(/\{{3}lang\|([a-z]{2})\}{3}/, function(m) {
lang = m[1];
if (/^([a-z]{2})\:/.test(source)) {
var n = source.match(/^([a-z]{2})\:/);
lang = n[1];
source = source.substr(n[0].length);
};
return lang;
}).replace("{{{src}}}", encodeURIComponent(source.replace(" ", "_")))};
var attrs;
if (typeof src == "object") {
attrs = src;
Line 29 ⟶ 18:
script.setAttribute("src", (self.namespaces && /^\[{2}([^\n\r\t]+)\]{2}$/.test(src) ? (function() {
var source = src.match(/^\[{2}([^\n\r\t]+)\]{2}$/)[1],
path = format(self.namespaces["#default"] || "{{{src}}}", source);
for (var ns in self.namespaces) {
if (source.indexOf(ns + ":") == 0) {
path = format(self.namespaces[ns], source.substring(ns.length + 1)); break}};
return path})() : encodeURI(src)));
if (attrs) {
Line 45 ⟶ 34:
// End importScript function. Copy below this line at your own risk.
 
var MWVersion = (function(z) {
var whichsite = ({ // define whichsite (string: "wp" if on Wikipedia, "hrw" if on HRWiki; "hrfw" if on HRFWiki)
var na = sourcez.match(/^([a0-z9]{2})\:.([0-9]*)/);
var langb = ma[12];
if (b.length == 1) b = "0" + b;
return Number(a[1] + "." + b);
var})(wgVersion), whichsite = ({ // define whichsite (string: "wp" if on Wikipedia, "hrw" if on HRWiki; "hrfw" if on HRFWiki)
"http://en.wikipedia.org": "wp",
"http://www.hrwiki.org": "hrw",
"http://fanstuff.hrwiki.org": "hrfw",
"http://wwwwuw.clamburger.org": "wuw"
})[wgServer] || wgServer"null";
 
importScript.namespaces = {"#default": "http://function(src) {{{lang|en}}}.wikipedia.org/w/index.php?title={{{src}}}&action=raw&ctype=text/javascript"};
var formatv = (function(wscript, srcs) {
var n if= s.match(/^([a-z]{2})\:/.test(source)), {l = n[1];
sources = sources.substr(n[0].length); return [s, l];
})(src); return "http://" + v[1] + ".wikipedia.org/w/index.php?title=" + encodeURIComponent(v[0].replace(" ", "_")) + "&action=raw&ctype=text/javascript"}};
 
var Y2P = new Object();
importScript({src: "[[en:User:Year2000Prob/Y2P.MediaWiki.js]]", onload: function() {
window._onload = window.onload;
window.onload = function() {
Line 77 ⟶ 75:
addTo: "p-cactions"
})();
if (whichsite == ("hrfw"||"wuw")) Y2P.AddPortletItem({
text: "Sysop Alert Button",
url: "http://alert.clamburger.org/",
Line 83 ⟶ 81:
before: "n-usersguide"
})();
if (whichsite !== ("hrw"||"wphrfw")) Y2P.AddPortletItem({
text: "Wiki User Wiki",
url: "http://www.clamburger.org/wuw/",
Line 91 ⟶ 89:
 
Y2P.ChangeActions({
"nstab-main": "boring fanstuffpage",
"nstab-user": "stupid parson",
"nstab-project": "don't leave without reading this",
Line 112 ⟶ 110:
if ($("#ca-edit").get(0) && /^(view|purge)$/i.test(wgAction)) {
if ($("#sectionlink-0").get(0)) $("#sectionlink-0").before("<a class='sectionlink' href='" + $("#ca-edit a").attr("href") + "&section=top'>edit</a>/");
else $("#contentSub").css("display", "block").html(($("#contentSub").html() ? $("#contentSub").html() + "\t" : "") + "[<a class='sectionlink' href='" + $("#ca-edit a").attr("href") + "&section=top'>edit</a>]");
};
 
var sidebar = $(".portlet:not(#p-personal, #p-cactions, #p-logo) h5")div.css("cursor", "defaultpBody").click(function() {;
$sidebar.css(this"border-left", "none").parent().find("div.pBodyh5").slideTogglecss("slowcursor", "default");
// The click event is made obsolete by MediaWiki 1.14
}).parent().find("div.pBody").css("border-left", "none").hide();
if (MWVersion == 1.14) sidebar.hide().parent().find("h5").click(function() {
} $(this).parent().find("div.pBody").cssslideToggle("border-left", "noneslow").hide(});
if (/^Special\:(Recent[Cc]hanges|Watchlist)$/.test(wgPageName)) {
$("h1.firstHeading").html($("h1.firstHeading").html() + " (<a id='rcUpdate' href='javascript:;'>refresh</a>)");
$("a#rcUpdate").click(function() {
$("#bodyContent ul.special").html("<li>Updating...</li>").load(wgScript + "?title=Special:Recentchanges" + wgPageName + " #bodyContent ul.special li")})};
$("#bodyContent div:has(span#RCM0)").html("<span>Updating...</span>").load(wgScript + "?title=" + wgPageName + " #bodyContent div:has(span#RCM0) span");
 
});
// I hope this works with Shadowbox
});
$("#bodyContent img").attr("rel", "shadowbox[All images]").each(function() {
var self = $(this), url = (function() {
return $("#bodyContent img", $.get(self.attr("href")).responseXML).get(0).getAttribute("src");
})();
self.attr("href", url);
});
});
}})();
}})("http://year2000prob.freehostia.com/wp-content/uploads/2008/09/shadowbox-2.0.js")();
 
var wikEdUsing = "(using [[" + (whichsite != "wp" ? "wikipedia:" : "") + "User:Cacycle/wikEd|wikEd]])",
Line 137 ⟶ 134:
wikEdCloseToolbarPreset = true,
wikEdButtonsOnTop = false,
wikedScripts = importScript("[[en:User:Cacycle/diff.js]]")("[[en:User:Pilaf/livepreview.js]]")("[[en:User:Cacycle/RegExTypoFix.js]]")("[[en:User:Cacycle/wikEd.js]]")();
 
importScript("[[de:Benutzer:ASM/quickedit.js]]")("[[en:User:Lupin/popups.js]]")(); // import Popups so it'll work globally if possible, instead of just on Wikipedia
 
var ywmpScript = importScript("http://mediaplayer.yahoo.com/latest")()[0];