User:The Obento Musubi/monobook.js/default.js
Appearance
(Redirected from User:Cuyler91093/monobook.js/default.js)
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:The Obento Musubi/monobook.js/default. |
/* <pre><nowiki> */
// ========== XHMTL Functions Needed ==========
if (document.implementation.createDocument) {
var gml_xmlparser = new DOMParser();
}
function gml_XMLParse(string) {
if (document.implementation.createDocument) {
return gml_xmlparser.parseFromString(string, "text/xml");
} else if (window.ActiveXObject) {
var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM");
gml_xmldoc.async = "false";
ret = gml_xmldoc.loadXML(string);
if (!ret)
return null;
return gml_xmldoc.documentElement;
}
return null;
}
var gml_xmlhttp;
function HTTPClient() {
var gml_http;
if(window.XMLHttpRequest) {
gml_http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
gml_http = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
gml_http = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
gml_http = false;
}
}
}
return gml_http;
}
// ========== Basic Functions Needed ==========
function addlilink(tabs, url, name, id, title, key) {
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if (id) {
li.id = id;
}
li.appendChild(na);
tabs.appendChild(li);
na.accesskey = key;
var pref = 'alt-';
if ((((clientPC.indexOf('AppleWebKit') != -1) && (clientPC.indexOf('spoofer') == -1)) || navigator.userAgent.toLowerCase().indexOf( 'mac' ) != -1 )) { pref = 'control-'; }
if (clientPC.indexOf('opera') != -1) { pref = 'shift-esc-'; }
if (key && title) { na.title = title + ' [' + pref + key + ']'; }
else if (title) { na.title = title; }
else if (key) { na.title = '[' + pref + key + ']'; }
akeytt();
return li;
}
function addToolboxLink(url, name, id){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, url, name, id);
}
function addTab(url, name, id, title, key) {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
function getPname(alt) {
z = document.getElementById("content").childNodes;
for (var n = 0; n < z.length; n++) {
if (z[n].className == "firstHeading") {
stmpPage = z[n].textContent.replace(/Editing /,"");
if (alt == "name") {
stmpPage = stmpPage.replace(getNameSpace()+":","");
}
return stmpPage;
}
};
}
function getNameSpace() {
z = document.getElementById("content").childNodes;
for (var n = 0; n < z.length; n++) {
if (z[n].className == "firstHeading") {
if (z[n].textContent.indexOf("Template") != -1) { return "Template"; }
if (z[n].textContent.indexOf("Wikipedia") != -1) { return "Wikipedia"; }
if (z[n].textContent.indexOf("Portal") != -1) { return "Portal"; }
if (z[n].textContent.indexOf("Image") != -1) { return "Image"; }
if (z[n].textContent.indexOf("Category") != -1) { return "Category"; }
if (z[n].textContent.indexOf("User") != -1) { return "User"; }
if (z[n].textContent.indexOf("User talk") != -1) { return "User talk"; }
return "Article";
}
};
}
/* </nowiki></pre> */