User:Krinkle/Scripts/Countervandalism.js
< User:Krinkle | Scripts
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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/**
* Various tools, scripts and UI modications I find helpful in patrolling and fighting vandalism.
*
* Usage:
*
// [[File:Krinkle_Countervandalism.js]]
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/Countervandalism.js&action=raw&ctype=text/javascript');
*
* @version 2021-01-06
* @source https://meta.wikimedia.org/wiki/User:Krinkle/Scripts/Countervandalism.js
*/
(function () {
// [[File:Krinkle_RTRC.js]]
mw.loader.getState('ext.gadget.rtrc') ? mw.loader.load('ext.gadget.rtrc') : mw.loader.load('https://www.mediawiki.org/w/load.php?debug=false&modules=ext.gadget.rtrc&lang=' + mw.config.get('wgUserLanguage', 'en'));
// [[File:Krinkle_WhatLeavesHere.js]]
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/Tools/WhatLeavesHere.js&action=raw&ctype=text/javascript');
// [[File:Krinkle_CVNSimpleOverlay_wiki.js]]
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/CVNSimpleOverlay_wiki.js&action=raw&ctype=text/javascript');
$.when(mw.loader.using(['mediawiki.util']), $.ready).then(function () {
// Extra links
mw.util.addPortletLink('p-tb', mw.util.getUrl('Special:Prefixindex/' + mw.config.get('wgPageName')), 'Prefixindex', 'tb-prefixindex');
});
/* Vector only */
if (mw.config.get('skin') === 'vector') {
/**
* Add "Purge" content action link.
*
* Dependencies: mediawiki.util, mediawiki.api
*
* @source https://www.mediawiki.org/wiki/Snippets/Purge_action
* @revision 2016-05-17
*/
$.when(mw.loader.using(['mediawiki.util', 'mediawiki.api']), $.ready).then(function () {
if ($('#ca-purge').length) return;
var node = mw.util.addPortletLink( 'p-cactions',
mw.util.getUrl(null, { action: 'purge' }),
'Purge',
'ca-purge',
'Purge the server cache of this page'
);
$(node).on('click', function (e) {
var tag = 'snippet-purge-' + (++$.guid);
mw.notify('Purging...', { tag: tag });
new mw.Api().post({ action: 'purge', titles: mw.config.get('wgPageName'), forcelinkupdate: '1' }).then(function () {
mw.notify('Purge completed.', { tag: tag });
location.reload();
}, function () {
mw.notify('Purge failed.', { type: 'error', tag: tag });
});
e.preventDefault();
});
});
}
}());