User:DannyS712/ExpandHistory.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. |
This user script seems to have a documentation page at User:DannyS712/ExpandHistory. |
// Install the newest version with:
// <code><nowiki> {{subst:Iusc|User:DannyS712/ExpandHistory.js}} </nowiki></code>
// or with
// <code><nowiki> importScript( 'User:DannyS712/ExpandHistory.js' ); // Backlink: [[User:DannyS712/ExpandHistory.js]] </nowiki></code>
//
// If forking this script, please note my contributions / give me credit
$(function (){
var ExpandHistory_config = {
name: '[[User:DannyS712/ExpandHistory|ExpandHistory.js]]',
version: 1.0,
debug: false
};
mw.loader.using( 'mediawiki.util', function () {
$(document).ready( function () {
var action = mw.config.get('wgAction');
if (action && action === 'history'){
ExpandHistory();
}
} );
} );
function ExpandHistory(){
var links = $('a:textEquals("500")');
var thousand;
if (ExpandHistory_config.debug) console.log( links );
links.each( function() {
thousand = $(this).clone();
thousand[0].href = thousand[0].href.replace(/limit=500/, 'limit=1000');
thousand[0].textContent = '1000';
thousand = thousand[0];
this.after( thousand );
this.after( ' | ' );
});
}
// Attribution: copied from https://stackoverflow.com/questions/6673777/select-link-by-text-exact-match#
$.expr[':'].textEquals = function(a, i, m) {
return $(a).text().match("^" + m[3] + "$");
};
});