User:Z388/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 is at User:Z388/monobook.css. |
// [[User:Lupin/popups.js]]<pre><nowiki>
/**** 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]] */
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
function aivlist(type) {
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
var ip = prompt("Enter IP address", "");
var reason = prompt("Enter reason for listing", "");
t.value += "*{{" + type + "|" + ip +"}} " + reason + "--~" + "~" + "~" + "~";
f.wpSummary.value = "Listing " + ip;
f.submit();
}
addOnloadHook(
function addaivlink() {
if (document.title.indexOf("Editing Wikipedia:Administrator intervention against vandalism") != -1)
{
addTab("javascript:aivlist('vandal')", "vandal", "ca-vandal", "Report a vandal", "");
addTab("javascript:aivlist('ipvandal')", "ipvandal", "ca-ipvandal", "Report an ipvandal", "");
} }
);
function addToolboxLink(url, name, id){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, url, name, id);
}
addOnloadHook(tblinks);
function tblinks() {
var tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlimenu(tabs, 'Monobooks', 'mb');
var mb = document.getElementById('mb').getElementsByTagName('ul')[0];
addlilink(mb, '/wiki/User:Z388/monobook.js', 'monobook.js');
addlilink(mb, '/wiki/User:Z388/monobook.css', 'monobook.css');
addlimenu(tabs, 'Links', 'misclinks');
var misclinks = document.getElementById('misclinks').getElementsByTagName('ul')[0];
addlilink(misclinks, '/wiki/WP:RfA', 'Requests for Adminship');
addlilink(misclinks, '/wiki/Category:Wikipedians looking for help', 'Help Me!');
addlilink(misclinks, '/wiki/WP:AFD/Today', 'Today\'s AFDs');
addlilink(misclinks, '/wiki/Special:Log/newusers', 'New Users');
addlilink(misclinks, '/wiki/Special:Newpages', 'New Pages');
addlilink(misclinks, '/wiki/WP:AFC', 'Requests for Creation');
if (document.title.indexOf("Editing") == 0)
{
addToolboxLink('javascript:tagwos(prompt("Tag?"), confirm("Is it a template you\'re adding?"))', 'Tag page');
addToolboxLink('javascript:cat(prompt("Category"), confirm("Is it a category you\'re adding?"))', 'Categorize');
addToolboxLink("javascript:delbec()", "Speedy delete");
addlimenu(tabs, 'Preset tags', 'pretags');
var pretags = document.getElementById('pretags').getElementsByTagName('ul')[0];
addlilink(pretags, 'javascript:tag("wikify", "Wikify")', 'Wikify');
addlilink(pretags, 'javascript:tag("expand", "Expand")', 'Expand');
addlilink(pretags, 'javascript:tag("POV", "POV disputed - see talk page")', 'POV');
addlilink(pretags, 'javascript:tag("disputed", "Accuracy disputed - see talk page")', 'Disputed');
addlilink(pretags, 'javascript:tag("unreferenced", "Not referenced")', 'Unreferenced');
addlilink(pretags, 'javascript:tag("cleanup-date|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}", "Cleanup")', 'Cleanup');
addlilink(pretags, 'javascript:tag("unreferenced", "Not referenced")', 'Unreferenced');
}
if(document.title.indexOf("Editing User talk:") == 0)
{
addToolboxLink('javascript:warn()', 'Warn');
addlimenu(tabs, 'Talk Messages', 'talkm');
var talkm = document.getElementById('talkm').getElementsByTagName('ul')[0];
addlilink(talkm, 'javascript:autoMessage("{{subst:Welcome}} ~~~~", "Welcome to Wikipedia!", "save")', 'Welcome', '');
addlilink(talkm, 'javascript:autoMessage("{{subst:anon}} Thanks, ~~~~", "Create an account!", "save")', 'Anon welcome', '');
addlilink(talkm, '/wiki/Wikipedia:Template_messages/User_talk_namespace', 'Other messages');
}
}
function addlimenu(tabs, name, id)
{
(na = document.createElement("a")).appendChild(document.createTextNode(name));
na.href = "#";
var mn = document.createElement("ul");
(li = document.createElement("li")).appendChild(na);
li.appendChild(mn);
if(id) li.id = id;
li.className = 'tabmenu';
tabs.appendChild(li);
return mn; // useful because it gives us the <ul> to add <li>s to
}
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;
}
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key)
};
//Slightly upgraded
function warn()
{
var txt = document.editform.wpTextbox1;
var type = prompt("Which standard warning do you wish to issue?");
var severity = prompt("How severe is the violation?");
var page = prompt("What page?");
if(type.length == 0) type = "test";
if(severity.length == 0) severity = "1";
var msgtext = "{{subst:" + type + severity + "|" + page + "}} ~~~~";
if(page.length == 0) page = "Wikipedia";
var summary = "Your recent edits to " + page ;
document.editform.wpSummary.value = summary;
if(txt.value.length > 0) txt.value += '\n';
txt.value += msgtext;
document.editform.submit();
}
function delbec()
{
var txt = document.editform.wpTextbox1;
var type = prompt("Which criteria?");
var msgtext = "{{db-" + type + "}}\n";
var summary = "Speedy delete: " + type;
document.editform.wpSummary.value = summary;
if(txt.value.length > 0) txt.value += '\n';
txt.value = msgtext + txt.value;
document.editform.submit();
}
function tagwos(message, istemplate)
{
tag(message, istemplate, "Add " + message);
}
function tag(message, istemplate, summary)
{
var auto=confirm("Auto-save?");
var txt = document.editform.wpTextbox1;
if (istemplate==true) { message="{{"+message+"}}";}
var msg = message;
var message = message+"\n";
txt.value = message + txt.value;
txt = document.editform.wpSummary;
if (txt.value!="") { summary=txt.value+"; "+summary; }
txt.value = summary;
if (auto==true)
{
document.editform.submit();
}
}
function cat(message, iscat)
{
var auto=confirm("Auto-save?");
var txt = document.editform.wpTextbox1;
if (iscat==true) { message="[[Category:"+message+"]]";}
var sum = message;
var message = "\n"+message;
txt.value = txt.value + message;
txt = document.editform.wpSummary;
summary = "Add category: " + sum;
if (txt.value!="") { summary=txt.value+"; "+summary; }
txt.value = summary;
if (auto==true)
{
document.editform.submit();
}
}
function autoMessage(msgtext, summary, saveopt)
{
var txt = document.editform.wpTextbox1;
document.editform.wpSummary.value = summary;
if(txt.value.length > 0) txt.value += '\n';
txt.value += msgtext;
if(saveopt == 'save')
{
document.editform.submit();
}
else if(saveopt == 'preview')
{
document.editform.wpPreview.click();
}
else if(saveopt == 'diff')
{
document.editform.wpDiff.click();
}
}
function wpTextboxReplace()
{
var s = prompt("Search regexp:");
if(s){
var r = prompt("Replace /"+s+"/ with:");
if(!r && r != '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "mg"), r);
}
}
addOnloadHook(function () {
if (document.forms.editform) {
mw.util.addPortletLink('p-cactions', 'javascript:wpTextboxReplace()', 'replace', 'ca-replace',
'Regexp replace for the edit window', 'R', document.getElementById('ca-history'));
}
});
//
//</nowiki></pre>