User:Cometstyles/monobook.js
Appearance
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// [[User:Lupin/popups.js]]
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
popupAdminLinks=true;
popupLastEditLink=false;
popupOnlyArticleLinks=false;
/***********************************************************************
EDIT SECTION ZERO
***********************************************************************/
// [[Wikipedia:WikiProject_User_scripts/Scripts/Add_edit_section_0]]
//If you are not editing a page, a tab will appear allowing you to eidt the
// 0th section of a page (the top area usually used as an introduction.
/* Edit section zero caption button */
$(function () {
var x;
if (!(x = document.getElementById('ca-edit') )) return;
var url;
if (!(url = x.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
var y = mw.util.addPortletLink('p-cactions', url+"§ion=0", '0', 'ca-edit-0',
'Edit the lead section of this page', '0', x.nextSibling);
y.className = x.className; // steal classes from the the edit tab...
x.className = 'istalk'; // ...and make the edit tab have no right margin
// exception: don't steal the "selected" class unless actually editing section 0:
if (/(^| )selected( |$)/.test(y.className)) {
if (!document.editform || !document.editform.wpSection
|| document.editform.wpSection.value != "0") {
y.className = y.className.replace(/(^| )selected( |$)/g, "$1");
x.className += ' selected';
}
}
});
/* End */
/***********************************************************************
LAST DIFF TAB
***********************************************************************/
// addLastDiff
function addLastDiff()
{
mw.util.addPortletLink('p-cactions', 'http://simple.wikipedia.org/w/index.php?title=' +
wgPageName + "&diff=cur&oldid=prev", 'last', 'ca-last', 'Show most recent diff');
}
$(addLastDiff);
/***********************************************************************
POPUPS
***********************************************************************/
/***********************************************************************
// [[:en:User:Lupin/popups.js]]
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
popupDelay=1;
popupFixRedirs=true;
popupFixDabs=true;
popupRevertSummaryPrompt=true;
popupAdminLinks=true;
//popupOnlyArticleLinks=false;
***********************************************************************/
/*************
*** Ajax sysop
*** by [[m:user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Ajax_sysop>
*************/
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Ajax_sysop.js&action=raw&ctype=text/javascript');
/***********************************************************************
EXTRA EDIT BUTTONS
***********************************************************************/
// Extra edit page buttons [[Wikipedia:Tools/Editing_tools#Misc._Editing_tools]]
// This is based on the original code on Wikipedia:Tools/Editing tools
//
// The original code was on the project page and needed to be cut and paste to the user's
// monobook.js page. However, this caused problems with the quote marks. So I have moved
// it to its own page.
//
// I do not know a lot about Javascript so please do not ask for a complicated change
//
// See the [[User:MarkS/Extra edit buttons]] for changes log
function InsertButtonsToToolBar()
{
d = new Date();
todayISO = d.getFullYear()+"-";
if (d.getMonth() > 8) {
todayISO += (d.getMonth()+1)+"-";
} else {
todayISO += "0"+(d.getMonth()+1)+"-";
}
if (d.getDate() > 9) {
todayISO += d.getDate();
} else {
todayISO += "0"+d.getDate();
}
//Strike-Out Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
"speedTip": "Strike",
"tagOpen": "<s>",
"tagClose": "</s>",
"sampleText": "Strike-through text"}
//Table button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
"speedTip": "Table",
"tagOpen": "\n{| border='1' \n|- \n| 1 || 2\n|- \n| 3 || 4",
"tagClose": "\n|}\n",
"sampleText": ""}
//Line break button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
"speedTip": "Line break",
"tagOpen": "<br />",
"tagClose": "",
"sampleText": ""}
//Gallery
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",
"speedTip": "Insert a picture gallery",
"tagOpen": "\n<gallery>\n",
"tagClose": "\n</gallery>",
"sampleText": "Image:FileName.jpg|Caption1\\Image:FileName2.jpg|Caption2"}
//Category button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/5a/Button_category_alt.png",
"speedTip": "Category",
"tagOpen": "[[Category:",
"tagClose": "]]",
"sampleText": "Category title"}
//Reference link button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",
"speedTip": "<ref>",
"tagOpen": "<ref>",
"tagClose": "</ref>",
"sampleText": "Insert reference material"}
//Reference button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a0/Button_references_alt.png",
"speedTip": "Reference footer",
"tagOpen": "==References==\n{{reflist}}",
"tagClose": "",
"sampleText": ""}
//ref+cite web
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/b8/Button_Globe.png",
"speedTip": "Reference footer",
"tagOpen": "<ref>{{cite web|url=",
"tagClose": "|title=|publisher=|accessdate="+todayISO+"}}</ref>",
"sampleText": ""}
//redirect
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
"speedTip": "Redirect",
"tagOpen": "#REDIRECT [[",
"tagClose": "]]",
"sampleText": ""}
//welcome
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/8/83/Button_biocitas.png",
"speedTip": "Welcome message",
"tagOpen": "{{sub" + "st:welcomeg}}~~" + "~~",
"tagClose": "",
"sampleText": ""}
}
$( InsertButtonsToToolBar );
/***********************************************************************
VANDAL VARNINGS
***********************************************************************/
// BASED ON User:Pilotguy/whackamole.js
// To fight vandalism
// **************
// Warnings
// **************
function whackEdit (message, msg2, summary) {
var f = document.editform ;
var tbox = document.editform.wpTextbox1 ;
var a = "" + (window.getSelection ? window.getSelection()
: document.getSelection ? document.getSelection()
: document.selection.createRange().text);
if (msg2 != "") {
a = prompt ("Article name?\n(Empty+OK for a generic message.)\n(Cancel now aborts.)", a) ;
if (a == null) return ;
if (a != null && a != "") {
message = message.replace(/\|/,"|"+a) ;
summary += " in [[" + a + "]]" ;
} else {
message = msg2 ;
}
}
f.wpTextbox1.value += message + " ~~" + "~~\n" ;
f.wpSummary.value = summary ;
f.wpMinoredit.checked=false;
f.wpWatchthis.checked=false;
f.wpTextbox1.focus();
if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ;
}
function whackWarn1 () {
whackEdit ("{{subst"+":test|}}", "{{subst"+":test}}", "Experimenting");
}
function whackWarn2 () {
whackEdit ("{{subst"+":test2|}}", "{{subst"+":test2}}", "Nonsense edit");
}
function whackWarn2a () {
whackEdit ("{{subst"+":test2a|}}", "{{subst"+":test2a}}", "Removing content");
}
function whackWarn3 () {
whackEdit ("{{subst"+":test3|}}", "{{subst"+":test3}}", "Please stop vandalizing");
}
function whackWarn4 () {
whackEdit ("{{subst"+":test4|}}", "{{subst"+":test4}}", "Last chance to stop vandalising");
}
function whackOnlyWarning () {
whackEdit ("{{subst"+":test4im|}}", "{{subst"+":test4im}}", "Last chance to stop vandalising");
}
function whackBlocked() {
whackEdit ("{{subst"+":block}}", "", "Blocked");
}
function whackBlocked2() {
whackEdit ("{{subst"+":block2}}", "", "Blocked");
}
function whackSpam () {
whackEdit ("{{subst"+":spam|}}", "{{subst"+":spam}}", "Don't spam");
}
// **************************************************
// Installation
// **************************************************
window.whack_addlilink=function(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;
}
window.whack_addToolboxLink=function(url, name, id){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
whack_addlilink(tb, url, name, id);
}
window.playWhackMoles=function() {
if (document.title.match("Editing User talk:") ) {
whack_addToolboxLink('javascript:{whackWarn1();};void(0);',
'Warn Test', 'toolbox_warn1');
whack_addToolboxLink('javascript:{whackWarn2();};void(0);',
'Warn Nonsense', 'toolbox_warn2');
whack_addToolboxLink('javascript:{whackWarn2a();};void(0);',
'Warn Don\'t remove', 'toolbox_warn2a');
whack_addToolboxLink('javascript:{whackWarn3();};void(0);',
'Warn Please stop', 'toolbox_warn3');
whack_addToolboxLink('javascript:{whackWarn4();};void(0);',
'Warn Last chance', 'toolbox_warn4');
whack_addToolboxLink('javascript:{whackOnlyWarning();};void(0);',
'Only warning', 'toolbox_onlywarning');
whack_addToolboxLink('javascript:{whackSpam ();};void(0);',
'Warn Spam', 'toolbox_spam');
whack_addToolboxLink('javascript:{whackBlocked();};void(0);',
'Warn Blocked1', 'toolbox_block1');
whack_addToolboxLink('javascript:{whackBlocked2();};void(0);',
'Warn Blocked2', 'toolbox_block2');
} else {
whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Wantedpages',
'Wanted pages', 'toolbox_wantedpages');
whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Wantedcategories',
'Wanted cats', 'toolbox_wantedcats');
whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Shortpages',
'Short pages', 'toolbox_shortpages');
whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Withoutinterwiki',
'Without iw', 'toolbox_uncatpages');
whack_addToolboxLink('http://simple.wikipedia.org/wiki/Special:Uncategorizedpages',
'Uncat pages', 'toolbox_uncatpages');
}
}
// onload
window.simpleAddOnload=function(f) {
if (window.addEventListener) window.addEventListener("load", f, false);
else if (window.attachEvent) window.attachEvent("onload",f);
}
simpleAddOnload(playWhackMoles);
/***********************************************************************
PURGE TAB
***********************************************************************/
/* addPurge */
$(function () {
var hist; var url;
if (!(hist = document.getElementById('ca-history') )) return;
if (!(url = hist.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
'*', 'ca-purge', 'Purge cache', '0');
});
// *****************************************************************
// Load various external scripts
// *****************************************************************
function appendScript(url) {
var scriptElem = document.createElement('script');
scriptElem.setAttribute('src',url);
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
appendScript('http://www.wikia.com/index.php?title=User:Splarka/fastdelete.js&action=raw&ctype=text/javascript&dontcountme=s')
appendScript('http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js&action=raw&ctype=text/javascript&dontcountme=s')
appendScript('http://meta.wikimedia.org/w/index.php?title=MediaWiki:Gadget-blockoptions.js&action=raw&ctype=text/javascript&dontcountme=s')
// *****************************************************************
// Custom automatic delete buttons
// *****************************************************************
// Adds customizable one-click deletion buttons to any deletable page.
// Requires w:User:Splarka/fastdelete.js in appendScript();
var fdButtons = [];
fdButtons[fdButtons.length] = {
'summary': '[[WP:QD#G1|QD G1]]: Complete nonsense',
'label': 'non'};
fdButtons[fdButtons.length] = {
'summary': 'Test, please use the [[Wikipedia:sandbox|sandbox]]',
'label': 'test'};
fdButtons[fdButtons.length] = {
'summary': 'Author/User Request',
'label': 'req'};
fdButtons[fdButtons.length] = {
'summary': '[[WP:QD#G3|QD G3]]: Vandalism',
'label': 'van'
};