Jump to content

User:DannyS712 test/GTK.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.
//<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>