User:Michael.C.Wright/global.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.
// XReport - fast reporting - [[User:TenWhile6/XReport]]
//mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:TenWhile6/XReport.js&action=raw&ctype=text/javascript');
/*******************
** Scripts on specific wikis
*******************/
//<nowiki>
switch (mw.config.get('wgDBname')) {
case 'enwikisource':
break;
case 'enwiki':
break;
case 'enwikinews':
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType: 'script', cache: true }).then(function() {
pathoschild.TemplateScript.add([
// add your own templates or scripts here
{ name: 'Article: Review → Stale', script: function(editor) {
editor.replace(/{{review}}/gi, '{{stale}}');
editor.replace(/\[\[Category:review\]\]/gi, '');
}, editSummary: 'Mark as stale.', forNamespaces: '0' },
{ name: 'Article stale', template: '{{Stale}}\r', position: 'before', editSummary: 'Mark as stale', forNamespaces: '0' },
{ name: 'Article: Stale → Abandoned', script: function(editor) {
editor.replace(/{{stale}}/gi, '{{subst:aband}}');
}, editSummary: 'Mark as abandoned.', forNamespaces: '0' },
{ name: 'Article abandoned', template: '{{subst:aband}}\r', position: 'before', editSummary: 'Mark as abandoned', forNamespaces: '0' },
{ name: 'Under review', template: '{{under review}}\r', position: 'before', editSummary: 'Place under review.', forNamespaces: '0' },
{ name: 'Delete: Vandalism', template: '{{delete|a3}}\r', position: 'before', editSummary: 'Mark for deletion. Vandalism.', forNamespaces: '' },
{ name: 'Delete: Spam', template: '{{delete|a6}}\r', position: 'before', editSummary: 'Mark for deletion. Spam.', forNamespaces: '' },
{ name: 'Delete: Out of Scope', template: '{{delete|a12}}\r', position: 'before', editSummary: 'Mark for deletion. Out of scope.', forNamespaces: '' },
{ name: 'Delete: Nonsensical', template: '{{delete|a1}}\r', position: 'before', editSummary: 'Mark for deletion. Nonsensical.', forNamespaces: '' },
{ name: 'Delete: Copyvio', template: '{{delete|a11}}\r', position: 'before', editSummary: 'Mark for deletion. Copyvio template does not mark for speedy deletion.', forNamespaces: '' },
{ name: 'Delete: Orphaned talk', template: '{{delete|talk}}\r', position: 'before', editSummary: 'Mark for deletion. Orphanded talkpage.', forNamespaces: ['talk'] },
{ name: 'Delete: Anonymous talk', template: '{{delete|g3}}\r', position: 'before', editSummary: 'Mark for deletion. Non-registered user. Message(s) no longer relevant.', forNamespaces: ['talk'] },
{ name: 'Usertalk: Spam warning', template: '{{Spam warning}} —~~~~', position: 'before', editSummary: 'Spam warning', forNamespaces: 'User talk' },
{ name: 'Usertalk: Vandal warning', template: '{{Vandal warning}} —~~~~', position: 'before', editSummary: 'Vandal warning', forNamespaces: 'User talk' },
{ name: 'Usertalk: Pre-review', template: '==Pre-review==\r{{Pre-review\r|evaluated-url=\r|status=\r|copyright=\r|earwig-permalink=\r|newsworthy=\r|verifiable=\r|npov=\r|style=\r|author-notes=\r|reviewer-notes=\r}}\r', position: 'cursor', editSummary: 'Add template:Pre-review', forNamespaces: 'User talk' },
{ name: 'Talk: Stale Gatwick', template: 'The article went stale while waiting for a review, unfortunately. If there is more recent news coverage for the event, the article can be refocused on the newest event and resubmitted for review. We call this gatwicking and you can read about it here: [[WN:Gatwicking]]. —~~~~', position: 'cursor', editSummary: 'Mark as stale. Suggest Gatwicking.', forNamespaces: 'talk' },
{
name: 'Smart quotes to straight',
script: function(editor) {
// Replace all instances of curly or smart quotes with straight quotes
editor.replace(/[“”]/g, '"');
editor.replace(/[‘’]/g, "'");
editor.appendEditSummary('Replace curly or smart quotation marks with straight quotation marks.');
},
enabled: true
},
{
name: 'Remove {{Verify}} template',
script: function(editor) {
// Remove all occurrences of {{Verify}} with or without parameters
editor.replace(/\{\{Verify.*?\}\}/gi, '');
editor.appendEditSummary('Remove all instances of the {{Verify}} template.');
},
enabled: true
},
{
name: 'Hide {{Verify}} templates',
script: function(editor) {
// Find all instances of {{Verify}} that do not already have "visibility=hidden"
editor.replace(/\{\{Verify(?![^}]*visibility\s*=\s*hidden)(.*?)\}\}/gi, '{{Verify$1|visibility=hidden}}');
editor.appendEditSummary('Add "visibility=hidden" to all instances of the {{Verify}} template without it.');
},
enabled: true
}
]);
});
break;
case 'metawiki':
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType: 'script', cache: true }).then(function() {
pathoschild.TemplateScript.add([
// add your own templates or scripts here
{ name: 'Request global block', template: '=== Global block for [[Special:Contributions/${clipboardContent}|${clipboardContent}]] ===/r{{Status}}/r{{Luxotool|${clipboardContent}}}/rDescription, evidence, diffs, etc. --~~~~', position: 'after', editSummary: 'Global block request for ${clipboardContent}}' },
]);
});
break;
}
//</nowiki>