User:Codingmasters/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:Codingmasters/monobook.css. |
<!-- TWINKLE revert scripts -->
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
<!-- TWINKLE user warning templates -->
importScript('User:AzaToth/morebits.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklewarn.js');
<!-- TWINKLE vandalism reporting -->
importScript('User:AzaToth/morebits.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklearv.js');
<!-- TWINKLE protection -->
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinkleprotect.js');
<!-- TWINKLE deletion proposal -->
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinkleprod.js');
<!-- TWINKLE settings -->
TwinkleConfig = {
revertMaxRevisions : 25,
userTalkPageMode : 'window',
showSharedIPNotice : true,
openTalkPage : [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert : false,
openAOLAnonTalkPage : false,
summaryAd : " using [[WP:TWINKLE|TWINKLE]]",
deletionSummaryAd : " using [[WP:TWINKLE|TWINKLE]]",
protectionSummaryAd : " using [[WP:TWINKLE|TWINKLE]]",
watchSpeedyPages : [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
watchProdPages : false,
openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
watchRevertedPages : [ ],
markRevertedPagesAsMinor : [ ],
deleteTalkPageOnDelete : false,
markWarningsAsMinor : false,
markAIVReportAsMinor : false,
markSpeedyPagesAsMinor : false,
markProdPagesAsMinor : false,
confirmUsernameToAIV : true,
toolboxButtons : [ ]
};
<!-- WikiMiniAtlas -->
// [[User:Dschwen/wikiminiatlas2.js]] - please include this line
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Dschwen/wikiminiatlas2.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
<!-- AddLinks -->
// --- ADD VARIOUS LINKS ----
if(!addToolBoxLink) {
function addToolboxLink(url, name, id){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, url, name, id);
}}
//
if(!addTopLink) {
function addTopLink(url, name, id){
var personal = document.getElementById('p-personal').getElementsByTagName('ul')[0];
addlilink(personal, url, name, id);
}}
//
if(!addNavLink) {
function addNavLink(url, name, id){
var navigation = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
addlilink(navigation, url, name, id);
}}
//
if(!addTab) {
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key);
}}
if(!addLink) {
function addLink(where, url, name, id, title, key, after){
//* where is the id of the toolbar where the button should be added;
// i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
//
//* url is the URL which will be called when the button is clicked.
// javascript: urls can be used to do more complex things.
//
//* name is what will appear as the name of the button.
//
//* id is the id of the button; it's best to define one.
// Use a prefix to make sure its unique. Optional.
//
//* title is the tooltip title that gives a longer description
// of the button; if you define a accesskey, mention it here. Optional.
//
//* key is the char you want for the accesskey. Optional.
//
//* after is the id of the button you want to follow this one. Optional.
//
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);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
tabs.appendChild(li);
}
if(id) {
if(key && title) { ta[id] = [key, title]; }
else if(key) { ta[id] = [key, '']; }
else if(title) { ta[id] = ['', title];}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}}
if(!addlilink) {
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);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}}
<!-- LoadIPInfo -->
//Load IP info. Written by GeorgeMoney using Wizardry Dragon's API
var data_ipinfo = new Object();
function ip_callback(data) {
data_ipinfo = data;
}
try {
var ip_regex = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/;
if(ip_regex.test(wgTitle)
||ip_regex.test(location.href.split('/')[location.href.split('/').length - 1].split('?')[0])
||ip_regex.test(location.href.split('target=')[1].split('&')[0])
) {
var ip_use = ip_regex.test(wgTitle)?wgTitle:location.href.replace(/^.*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*?$/, '$1');
document.write('<script src="http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&format=json&lang='+wgContentLanguage+'&callback=ip_callback"></script>');
document.write(
'<style type="text/css">'+
'.ip-info {'+
'border: 3px solid red;'+
'padding: 5px;'+
'background: honeydew'+
'}'+
'.ip-info li {'+
'margin-left: 2em;'+
'}'+
'</style>');
addOnloadHook(function() {
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tbs, "javascript:/*void(load_ipinfo()); */void(get_ipinfo());", "ip info", 'ca-ipinfo', 'Get ip info');
});
function iterate_data(newdiv, dat) {
for(var x in dat) {
if(typeof dat[x] == 'object') {
iterate_data(newdiv, dat[x]);
} else {
newdiv.innerHTML += '<li><b>'+x+'</b>: '+dat[x]+'</li>\n';
}
}
}
function load_ipinfo() {
var script = document.createElement('script');
script.src = 'http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&format=json&lang='+wgContentLanguage+'&callback=ip_callback';
document.getElementsByTagName('head')[0].appendChild(script);
}
function get_ipinfo() {
var newdiv = document.createElement('div');
newdiv.className = 'ip-info';
newdiv.id = 'ip-info';
newdiv.innerHTML = 'IP info for '+ip_use+' <small>(retrieved from <a href="http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&lang='+wgContentLanguage+'">http://hemlock.knams.wikimedia.org/~wizardrydragon/lookup_hostmask.php?ip='+ip_use+'&lang='+wgContentLanguage+'</a></small>)<br>';
newdiv.innerHTML += '<ul>';
iterate_data(newdiv, data_ipinfo);
newdiv.innerHTML += '</ul>';
document.getElementById('content').insertBefore(newdiv, document.getElementById('content').getElementsByTagName('h1')[0].nextSibling);
document.getElementById('ca-ipinfo').firstChild.innerHTML = 'Collapse IP info';
document.getElementById('ca-ipinfo').firstChild.href = 'javascript:void(hide_ipinfo())';
}
function hide_ipinfo() {
document.getElementById('ca-ipinfo').firstChild.innerHTML = 'ip info';
document.getElementById('ca-ipinfo').firstChild.href = 'javascript:void(show_ipinfo())';
document.getElementById('ip-info').style.display = 'none';
}
function show_ipinfo() {
document.getElementById('ca-ipinfo').firstChild.innerHTML = 'Collapse IP info';
document.getElementById('ca-ipinfo').firstChild.href = 'javascript:void(hide_ipinfo())';
document.getElementById('ip-info').style.display = 'block';
}
}
} catch(e) { }
//
<!-- AutoWelcome -->
//Auto welcome user script written by GeorgeMoney
if(welcome == undefined) {
//If you would like to make your own config you have 2 options:
//1:Copy the entire code to your monobook and change the config
//2:Copy everything, from this line until you see 'end config', into your monobook.js, and include the module to your monobook via an import function
var welcome={};welcome.edit={};welcome.link={};welcome.link.tab={};welcome.link.newUserLog={};welcome.link.redLinkTalk={};welcome.options={};
//config
welcome.edit.summary = "Welcome to Wikipedia!";
welcome.edit.text = "{{sub" + "st:User:GeorgeMoney/Welcome}}" + "\n" + "~~" + "~~";
welcome.edit.textAnon = "{{sub" + "st:Welcomeip}}" + "\n" + "~~" + "~~";
welcome.edit.button = 'wpSave';
welcome.link.newUserLog.defaultColor = "blue";
welcome.link.newUserLog.clickedColor = "green";
welcome.link.newUserLog.text = "[welcome]";
welcome.link.redLinkTalk.defaultColor = "blue";
welcome.link.redLinkTalk.clickedColor = "green";
welcome.link.redLinkTalk.text = "[welcome]";
welcome.link.redLinkTalk.blink = false;
welcome.link.tab.text = "welcome!";
welcome.link.tab.accessKey = 'a';
welcome.options.newUserLogaddReloadButton = true;
welcome.options.newUserLogEnabled = true;
welcome.options.redLinkTalkEnabled = true;
welcome.options.addTab = true;
welcome.options.askIfPageIsNotBlank = true;
welcome.options.maxLinks = 1000;
welcome.options.warnIfOverMaxLinks = false;
//end config
}
//main script
if(welcome.options.newUserLogEnabled && (/Special(%3A|:)Log(\/newusers$|(.*?&|\?)type=newusers)/i).test(window.location.href)) {
if(window.location.hash != "") window.location.hash = "";
else {
addOnloadHook(function() {
var lis = document.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li');
for (var i=0; i<lis.length; i++) {
var li = lis[i];
var url = li.firstChild.nextSibling.nextSibling.nextSibling.href;
var charao = (url.indexOf('?') != -1)?'&':'?';
url += charao+"autowelcome=true"
var link = document.createElement('a');
link.appendChild(document.createTextNode(welcome.link.newUserLog.text));
link.style.color = welcome.link.newUserLog.defaultColor;
monclick = function() {
//this.style = { };
this.style.textDecoration = 'none';
this.style.color = welcome.link.newUserLog.clickedColor;
var n = parseInt(this.name.split('_')[2]);
var newhref = "#anchor_welcome_"+(n+1);
this.onmouseover = function() { return false; }
this.onfocus = function() { return false; }
this.onclick = function() {
window.open(this.href);
this.onclick = function() { return false; };
return false;
}
this.onmousedown = function() { return false; }
this.onmouseup = function() { return false; }
this.onmouseout = function() {
//var n = parseInt(this.name.split('_')[2]);
//var newhref = "#anchor_welcome_"+(n+1);
//this.href /**/+= '&hasdone=true'; //newhref;
//this.href=newhref;
this.href = "javascript:void(0);";
this.onmouseout = function() {
return false;
}
};
//this.href = newhref;
//this.tagName = 'SPAN';
//this.innerHTML = 'welcomed';
this.style.cursor = "default";
};
//link.onfocus = monclick;
link.onmouseup = monclick;
link.href = url;
link.id = "id_welcome_"+i;
link.name = "anchor_welcome_"+i;
li.appendChild(link);
}
if(welcome.options.newUserLogaddReloadButton) {
var h1 = document.getElementsByTagName('h1')[0];
var button = document.createElement('input');
button.onclick = function() {
if(window.location.hash != "")
window.location.hash = "";
location.reload();
}
button.value = "reload";
button.type = "button";
h1.parentNode.insertBefore(button, h1.nextSibling);
}
});
}
}
if(welcome.options.redLinkTalkEnabled && !((/Special(%3A|:)Log(\/newusers$|(.*?&|\?)type=newusers)/i).test(window.location.href)) && ( ( (wgNamespaceNumber > -1 && wgNamespaceNumber % 2 != 0) || (wgCanonicalNamespace == "Wikipedia"||wgCanonicalNamespace == 'Special') ) || !wgIsArticle )) {
addOnloadHook(function() {
var alinks = document.getElementById('bodyContent').getElementsByTagName('a');
if(alinks.length > welcome.options.maxLinks) {
if(welcome.options.warnIfOverMaxLinks)
var ok_to_go = confirm("This page has over "+welcome.options.maxLinks+" links.\n"
+"Searching for red links to add welcome links might take a while and freeze your"
+" browser\nTo continue and add welcome links, press ok.");
else var ok_to_go = false;
} else var ok_to_go = true;
if(!ok_to_go) return;
for(var i=0, j=0; i<alinks.length; i++) {
var lin = alinks[i];
if(lin.className == "new" && (/User([_ ]talk)?:/i).test(lin.href) && lin.href.substr('http://en.wikipedia.org/w/index.php?title='.length).indexOf('/') == -1) {
var url = lin.href;
url = url.replace('User:', 'User_talk:');
var charao = (url.indexOf('?') != -1)?'&':'?';
url += charao+"autowelcome=true"
var nlin = document.createElement('a');
nlin.appendChild(document.createTextNode(welcome.link.redLinkTalk.text));
nlin.style.color = welcome.link.redLinkTalk.defaultColor;
monclick = function() {
this.style.textDecoration = 'none';
this.style.color = welcome.link.redLinkTalk.clickedColor;
var n = parseInt(this.name.split('_')[2]);
var newhref = "#anchor_welcome_"+(n+1);
this.onmouseover = function() { return false; }
this.onfocus = function() { return false; }
this.onclick = function() {
window.open(this.href);
this.onclick = function() { return false; };
return false;
}
this.onmousedown = function() { return false; }
this.onmouseup = function() { return false; }
this.onmouseout = function() {
//var n = parseInt(this.name.split('_')[2]);
//var newhref = "#anchor_welcome_"+(n+1);
//this.href /**/+= '&hasdone=true'; //newhref;
//this.href=newhref;
this.href = "javascript:void(0);";
this.onmouseout = function() {
return false;
}
};
//this.href = newhref;
//this.tagName = 'SPAN';
//this.innerHTML = 'welcomed';
this.style.cursor = "default";
};
nlin.onmouseup = monclick;
nlin.href = url;
nlin.id = "id_welcome_"+j;
nlin.name = "anchor_welcome_"+j;
if(welcome.link.redLinkTalk.blink) nlin.style.textDecoration = 'blink';
try { //alert(lin+lin.href+lin.className+lin.innerHTML+lin.nextSibling);
if(lin.nextSibling) {
lin.parentNode
.insertBefore(
nlin,
lin.nextSibling
);
} else {
lin.parentNode
.appendChild(
nlin
);
}
j++;
} catch(e) {
//alert(lin+lin.href+lin.className+lin.innerHTML+lin.nextSibling);
//alert(e.toString());
}
}
}
});
}
if(welcome.options.addTab && ( wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk' ) ) {
addOnloadHook(function() {
try {
var href = document.getElementById('ca-edit').firstChild.href;
var charao = (href.indexOf('?') != -1)?'&':'?';
href += charao+"autowelcome=true";
if(wgCanonicalNamespace == 'User') href = href.replace(/User:/i, 'User_talk:');
var tbs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tbs, href, welcome.link.tab.text, 'ca-welcome', 'Welcome '+wgTitle, welcome.link.tab.accessKey);
} catch(e) { }
});
}
if(window.location.href.indexOf('autowelcome=true') != -1
&&window.location.href.indexOf('action=edit') == -1) {
window.location.href += '&action=edit';
}
if(window.location.href.indexOf('action=edit') != -1
&& window.location.href.indexOf('autowelcome=true') != -1) {
if(window.location.href.indexOf('hasdone=true') != -1) {
location.href = location.href.split('action=edit')[0]
.split('autowelcome=true')[0];
} else {
addOnloadHook(function() {
var text = document.getElementById('wpTextbox1').value;
if(welcome.options.askIfPageIsNotBlank && text != '') {
var oktogo = confirm("There was other text detected on this page\nWould you like to continue with the welcome?");
} else var oktogo = true;
var newtext = text + '\n';
if((/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/).test(wgPageName))
newtext += welcome.edit.textAnon;
else
newtext += welcome.edit.text;
document.getElementById('wpTextbox1').value = newtext;
document.getElementById('wpSummary').value = welcome.edit.summary;
if(!oktogo) return;
document.getElementById(welcome.edit.button).click();
});
}
}
//
<!-- stubremove -->
// BEGIN STUBFIX CODE
//check if we are editing and we want to stubfix
if (window.location.href.indexOf('action=edit') != -1 && window.location.href.indexOf('stubfix=1') != -1) {
function stubfix() {
document.getElementById('wpSummary').value = "Removing stub";
var contents = document.getElementById('wpTextbox1').value;
var newcontents = contents.replace(/\{\{.*?stubs?(\|?.*)\}\}/g, "");
document.getElementById('wpTextbox1').value = newcontents;
document.getElementById('wpWatchthis').checked = "";
document.getElementById('wpDiff').click();
}
addOnloadHook(function(){ stubfix(); });
}
//Check if it's article to add the tab
if(wgCanonicalNamespace == "") {
addOnloadHook(function(){
var taburl = "http://en.wikipedia.org/w/index.php?title="+wgPageName+"&action=edit&stubfix=1";
addTab(taburl, "rms", "ca-stubrem", "This removes stub tag.");
});
}
//END STUBFIX CODE
//
<!-- AfD Helper -->
/**** afd helper ****/
document.write('<script type="text/javascript"' +
'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' +
'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */
<!-- AutoComplete -->
// [[User:Zocky/AutoComplete.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Zocky/AutoComplete.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
<!-- Picture Popups -->
// [[User:Zocky/PicturePopups.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Zocky/PicturePopups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
<!-- Search Box -->
// [[User:Zocky/SearchBox.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');