User:DannyS712 test/GTK.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. |
Documentation for this user script can be added at User:DannyS712 test/GTK. |
//<nowiki>
$(function (){
var CFDS_config = {
version: 2.0,
debug: false
};
var CFDS_this_link = '[[WP:CFDS#Current requests]]';
var CFDS_summary = 'Prepend speedy renaming template per ' + CFDS_this_link;
mw.loader.using( 'mediawiki.util', function () {
importScript('User:DannyS712 test/prepend.js');
$(document).ready( function () {
mw.util.addPortletLink ( 'p-cactions', 'javascript:void(0)', 'CFDS', 'ca-CFDS', 'Prepend speedy renaming template');
$('#ca-CFDS').on('click', function() {
CFDS();
} );
} );
} );
function CFDS(){
var name = mw.config.get( 'wgPageName' );
name = name.replace(/_/g, " ");
console.log( name );
//Change this line to determine what the template says
var new_name = name.replace(/vice-presidential/gi, "vice presidential");
console.log ( new_name );
var template = '{{subst:Cfr-speedy|' + new_name + '}}';
console.log ( template );
prepend( CFDS_summary, template );
}
});
//</nowiki>