User:Year2000Prob/monobook.js: Difference between revisions

Content deleted Content added
I hope this new formula works.
No edit summary
Line 9:
if (!self.imported) self.imported = [];
var format = function(wscript, source) {
var deflang, lang, src = source;
returnwscript = [wscript.replace(/\{{3}src(?:lang\|(.+)[a-z]{2}\-[A-Za-z]{2}|(.+)[a-z]{2,6})?\}{3}/, function(m) {
var deflang = m[1];
src = m.length == 1 ? source : source.replace(new RegExp("^" + m[1] + "$"), m[2]);
if (/^([a-z]{2}\-[A-Za-z]{2}|[a-z]{2,6})\:/.test(src)) {
var n = src.match(/^([a-z]{2}\-[A-Za-z]{2}|[a-z]{2,6})\:/);
lang = n[1];
src = src.substr(n[0].length);
};
return encodeURIComponent(src.replace("lang ",|| "_"))deflang;
}).replace(/\"{{3}lang\|([a-z]{2src})\}{3}/i", langencodeURIComponent(src.replace(" ||", "$1_"), src]))};
var attrs;
if (typeof src == "object") {
Line 28:
script.setAttribute("type", "text/javascript");
script.setAttribute("src", (self.namespaces ? (function() {
var source = src.match(/\[{2}([^\n\r\t]+)(\|[^\n\r\t]*?)?\]{2}/)[1],
var _f path = format(self.namespaces["#default"] || "{{{src}}}", srcsource), path = _f[0], source = _f[1];
for (var ns in self.namespaces) {
if (source.indexOf(ns + ":") == 0) {
_fpath = format(self.namespaces[ns], srcsource.substring(ns.length + 1)); break}};
path = _f[0]; source = _f[1]; break}};
return path})() : encodeURI(src)));
if (attrs) {
Line 52:
})[wgServer] || wgServer;
 
importScript.namespaces = {"#default": "http://{{{lang|en}}}.wikipedia.org/w/index.php?title={{{src|\\[{2}([^\\n\\r\\t]+)(\\|[^\\n\\r\\t]*?)?\\]{2}|$1}}}&action=raw&ctype=text/javascript"};
 
var Y2P = new Object();