User:TransporterMan/monobook.js
Appearance
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. |
The accompanying .css page for this skin can be added at User:TransporterMan/monobook.css. |
//importScript('User:TheJosh/Scripts/NewPagePatrol.js');
importScript('User:Ais523/watchlistnotifier.js');
importScript('User:Steven Zhang/DRW.js');
importScript("User:Yuvipanda/wizard/wizard.js");
//prevent wikiED from jumping down and turn off duplicate warnings
var wikEdConfig = { 'scrollToEdit': false, 'scrollToPreview': false, 'doCloneWarnings': false };
//Modification by SDG of ("User:PleaseStand/subsearch.js") to search current page and subpages, not just subpages
// line below was: textbox.value += " prefix:" + nsPrefix + wgTitle + "/";
// Script will not work, author says, in Vector
/*global window, addOnloadHook, addHandler, SubsearchJsConfig,
wgNamespaceNumber, wgFormattedNamespaces, wgTitle*/
// Global variables
var SubsearchJsCheckbox;
// Event handler called when a search is performed
function SubsearchJsSubmitHandler() {
// Local variables
var textbox; var nsPrefix = "";
if(SubsearchJsCheckbox.checked) {
// Note that the main namespace (0) has no prefix.
if(mw.config.get('wgNamespaceNumber')) {
nsPrefix = mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceNumber')] + ":";
}
textbox = window.document.getElementById("searchInput");
textbox.value += " prefix:" + nsPrefix + mw.config.get('wgTitle');
SubsearchJsCheckbox.checked = false;
}
return true;
}
$(function () {
// Local variables
var label; var labelText; var searchform;
try {
if(typeof SubsearchJsConfig != "object") {
// Default configuration
SubsearchJsConfig = {
text: "\u00a0Subpages only",
tooltip: "Search only the subpages of the current page",
accesskey: "",
style: "display: block; font-size: 80%; margin-top: 0.4em;",
namespaces: // Update the following line from http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces&format=json
{"query":{"namespaces":{"-2":{"id":-2,"*":"Media","canonical":"Media"},"-1":{"id":-1,"*":"Special","canonical":"Special"},"0":{"id":0,"*":"","content":""},"1":{"id":1,"*":"Talk","subpages":"","canonical":"Talk"},"2":{"id":2,"*":"User","subpages":"","canonical":"User"},"3":{"id":3,"*":"User talk","subpages":"","canonical":"User talk"},"4":{"id":4,"*":"Wikipedia","subpages":"","canonical":"Project"},"5":{"id":5,"*":"Wikipedia talk","subpages":"","canonical":"Project talk"},"6":{"id":6,"*":"File","canonical":"File"},"7":{"id":7,"*":"File talk","subpages":"","canonical":"File talk"},"8":{"id":8,"*":"MediaWiki","canonical":"MediaWiki"},"9":{"id":9,"*":"MediaWiki talk","subpages":"","canonical":"MediaWiki talk"},"10":{"id":10,"*":"Template","subpages":"","canonical":"Template"},"11":{"id":11,"*":"Template talk","subpages":"","canonical":"Template talk"},"12":{"id":12,"*":"Help","subpages":"","canonical":"Help"},"13":{"id":13,"*":"Help talk","subpages":"","canonical":"Help talk"},"14":{"id":14,"*":"Category","canonical":"Category"},"15":{"id":15,"*":"Category talk","subpages":"","canonical":"Category talk"},"100":{"id":100,"*":"Portal","subpages":"","canonical":"Portal"},"101":{"id":101,"*":"Portal talk","subpages":"","canonical":"Portal talk"},"108":{"id":108,"*":"Book","subpages":"","canonical":"Book"},"109":{"id":109,"*":"Book talk","subpages":"","canonical":"Book talk"}}}}
};
}
// Make sure the current page's namespace has subpages turned on.
if(!SubsearchJsConfig.namespaces.query.namespaces[mw.config.get('wgNamespaceNumber')].
hasOwnProperty("subpages")) {
return false;
}
// Add the checkbox if so.
label = window.document.createElement("label");
label.setAttribute("title", SubsearchJsConfig.tooltip);
label.setAttribute("style", SubsearchJsConfig.style);
SubsearchJsCheckbox = window.document.createElement("input");
SubsearchJsCheckbox.setAttribute("type", "checkbox");
SubsearchJsCheckbox.setAttribute("accesskey", SubsearchJsConfig.accesskey);
label.appendChild(SubsearchJsCheckbox);
labelText = window.document.createTextNode(SubsearchJsConfig.text);
label.appendChild(labelText);
searchform = window.document.getElementById("searchform");
searchform.appendChild(label);
// Add the submit handler to the search form.
addHandler(searchform, "submit", SubsearchJsSubmitHandler);
} catch(e) {}
return false;
});
//Modification by SDG of ("User:PleaseStand/subsearch.js") ends
//Adds subpage link to left bar
$( function () {
mw.util.addPortletLink("p-tb", mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace("$1", "Special:PrefixIndex/"+mw.config.get('wgPageName')+"/"), "Subpages", "t-subpages", "See all subpages of this page");
});
//Adds multiple history and edit tabs
//Source - [[User:Js/6tabs-vector]]
if (mw.config.get('wgNamespaceNumber') >= 0)
$(function(){
var pCactions = document.getElementById('p-cactions');
if (!pCactions) return;
var caMain = pCactions.getElementsByTagName('li')[0];
var caTalk = document.getElementById('ca-talk');
var caEdit = document.getElementById('ca-edit');
if (!caEdit) caEdit = document.getElementById('ca-viewsource');
var caHistory = document.getElementById('ca-history');
if (!caMain || !caTalk || !caEdit || !caHistory) return;
var el_move, el_create, id2;
if (mw.config.get('wgNamespaceNumber') % 2) { //talk space
el_move = caTalk; el_create = caMain; id2 = '';
} else {
el_move = caMain; el_create = caTalk; id2 = 'discussion';
}
caEdit.firstChild.innerHTML = 'edit';
caHistory.firstChild.innerHTML = 'hist';
el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
var href = el_create.firstChild.getAttribute('href', 2);
if (el_create.className.indexOf('new') < 0){
mw.util.addPortletLink('p-cactions', href + '?action=history', 'hist',
'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
mw.util.addPortletLink('p-cactions', href + '?action=edit', 'edit',
'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
}
caMain.style.marginRight = '0.3em';
caTalk.style.marginRight = '0.3em';
caTalk.style.marginLeft = '1.6em';
})
//