Jump to content

User:SMcCandlish/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//Testing – temporary "holding pen" for imported scripts to try out:

/* From: https://mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter#Ignoring_unclosed_br_and_hr_tags
   but docs warn "this will impact performance": */
syntaxHighlighterConfig = {
    voidTags: ["br", "hr", "BR", "HR"],
};

/* Doc: https://en.wikipedia.org/wiki/User:SMcCandlish/TidyRefs */
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:SMcCandlish/TidyRefs.js&action=raw&ctype=text/javascript');

/* Doc: https://en.wikipedia.org/wiki/User:Nardog/RefRenamer */
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/RefRenamer.js&action=raw&ctype=text/javascript');

/* Doc: https://en.wikipedia.org/wiki/User:Kaniivel/Reference_Organizer
I'm using a fork of it, described here: https://en.wikipedia.org/wiki/User_talk:Kaniivel/Reference_Organizer#Forked_it */
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Argenti_Aertheri/RefConsolidate_start.js&action=raw&ctype=text/javascript');

/* Trying this also from: mw:User:Remember_the_dot/Syntax_highlighter#Ignoring_unclosed_br_and_hr_tags */
syntaxHighlighterConfig = {
    timeout: 30,
};

/* Adding Cat-a-Lot, tweaked for en.wikipedia; doc: https://commons.wikimedia.org/wiki/Help:Gadget-Cat-a-lot */
mw.loader.load('https://en.wikipedia.org/wiki/User:%D7%A7%D7%99%D7%A4%D7%95%D7%93%D7%A0%D7%97%D7%A9/cat-a-lot.js'); // Backlink: [[User:קיפודנחש/cat-a-lot.js]]

/* Adding reFill (fixes bare URL citations); doc: https://en.wikipedia.org/wiki/Wikipedia:ReFill */
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript');

/* https://en.wikipedia.org/wiki/User:DannyS712/AjaxRollbackSummary
   enable custom edit summaries for rollback: */
mw.loader.load('User:DannyS712/AjaxRollbackSummary.js&action=raw&ctype=text/javascript'); 

//End testing.

// Javascript Wiki Browser variant of WP:AWB; see WP:Joeytje50/JWB for deets:
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');

// Detect broken Harvard citations (docs at User:Trappist the monk/HarvErrors):
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Trappist the monk/HarvErrors.js&action=raw&ctype=text/javascript');
// Trappit's version is a less blunt an instrument than Ucucha's original.

// Ohconfucius's "MOSNUM dates": https://en.wikipedia.org/wiki/User:Ohconfucius/script/MOSNUM dates
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:SMcCandlish/MOSNUMdates.js&action=raw&ctype=text/javascript');
// OhConfucius's "ENGVARB": https://en.wikipedia.org/wiki/User:Ohconfucius/EngvarB
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Ohconfucius/script/EngvarB.js&action=raw&ctype=text/javascript');
// Ohconfucius's "formatgeneral": https://en.wikipedia.org/wiki/User:Ohconfucius/script/formatgeneral
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Ohconfucius/script/formatgeneral.js&action=raw&ctype=text/javascript');
// Ohconfucius's "flagcruft": https://en.wikipedia.org/wiki/User:Ohconfucius/script/flagcruft
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Ohconfucius/script/flagcruft.js&action=raw&ctype=text/javascript');
// Ohconfucius's "Common Terms" delinker (also does some flagcruft cleanup): https://en.wikipedia.org/wiki/User:Ohconfucius/script/Common_Terms
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Ohconfucius/script/Common_Terms.js&action=raw&ctype=text/javascript');

// "TidyCitations": https://en.wikipedia.org/wiki/User:SMcCandlish/TidyCitations
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:SMcCandlish/TidyCitations.js&action=raw&ctype=text/javascript');

// Highlight admin names – style tweaked in common.css
//  - moved to https://meta.wikimedia.org/wiki/User:SMcCandlish/global.js

// Show some basic user info underneath usernames at the top of user and user talk pages
//  - moved to https://meta.wikimedia.org/wiki/User:SMcCandlish/global.js

// Similar to the above but does it as icons to the side of the username; Not sure which I prefer:
//  - moved to https://meta.wikimedia.org/wiki/User:SMcCandlish/global.js

// Turn on the "Other Projects Sidebar" features
//  - moved to https://meta.wikimedia.org/wiki/User:SMcCandlish/global.js

// Copyvio Detector, in left sidebar
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Ahecht/Scripts/CVD.js&action=raw&bcache=1&maxage=86400&ctype=text/javascript' ); // doc: [[User:Ahecht/Scripts/CVD]]

// lintHint - gives WP:LINT (HTML errors) analysis tool in button at top right
// - Doc: https://en.wikipedia.org/wiki/User:PerfektesChaos/js/lintHint
// - Config: https://en.wikipedia.org/wiki/Special:BlankPage/preferencesGadgetOptions#lintHint
// - Test arbitrary code or pages: https://en.wikipedia.org/wiki/Special:BlankPage/lintHint
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/lintHint/r.js&action=raw&bcache=1&maxage=86400&ctype=text/javascript" );

// Cleanup links to disambiguation pages (run it at the DAB page in question)
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Qwertyytrewqqwerty/DisamAssist.js&action=raw&bcache=1&maxage=86400&ctype=text/javascript' );
// Highlight duplicate links within the same page; docs: User:Evad37/duplinks-alt
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Evad37/duplinks-alt.js&action=raw&ctype=text/javascript');

// Selectively roll back all of a vandal's edits
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Writ Keeper/Scripts/massRollback.js&action=raw&bcache=1&maxage=86400&ctype=text/javascript' );

// Get slightly more informative details about WikiData in watchlist entries:
//  - moved to meta:User:SMcCandlish/global.js

// do some markup to edits by blocked users
//  - moved to meta:User:SMcCandlish/global.js

// remove ugly styles from buttons:
$(".oo-ui-buttonInputWidget").removeClass("oo-ui-buttonInputWidget");
$(".oo-ui-buttonElement-button").removeClass("oo-ui-buttonElement-button");
// and checkboxes:
$(".oo-ui-checkboxInputWidget").removeClass("oo-ui-checkboxInputWidget");
// remove inflated field margins:
$(".oo-ui-fieldLayout-header").removeClass("oo-ui-fieldLayout-header");

// Add [[WP:Reflinks]] launcher in the toolbox on left
$.when(mw.loader.using(['mediawiki.util']), $.ready).then(function () {
 mw.util.addPortletLink(
  "p-tb",     // toolbox portlet
  "http://dispenser.homenet.org/~dispenser/cgi-bin/webreflinks.py/" + mw.config.get('wgPageName')
   + "?client=script&citeweb=on&overwrite=&limit=20&lang=" + mw.config.get('wgContentLanguage'),
  "Reflinks"  // link label
)});

// Add a portlet to open user subpages to the personal toolbar, placed before the Preferences portlet:
// - This one will not work on sites that don't use English for "User:", etc.
mw.util.addPortletLink(
 'p-personal',
 '/wiki/Special:PrefixIndex/User:SMcCandlish',
 'subpages',
 'pt-subpages',
 'Your subpages',
 null,
 '#pt-preferences'
);

// Install WP:AutoEd tools in "More" menu:
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/complete.js&action=raw&bcache=1&maxage=86400&ctype=text/javascript" );

//Automatically tick the "Move subpages" option when moving pages.
//  - moved to meta:User:SMcCandlish/global.js

// Add link to watchlist template's /doc files:
//  - moved to https://meta.wikimedia.org/wiki/User:SMcCandlish/global.js