User:Christian75/monobook.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.
/* importScript('User:Christian75/Snippets/Replace a page's contents with something else.js'); */
/* [[Snippets/Replace a page's contents with something else]] */
/**
* Proposed deletion script for wikimediafoundation.org
* @author Legoktm, MZMcBride
* Public domain; 2013
*/
// <nowiki>
var prodlink = mw.util.addPortletLink( 'p-cactions',
'#',
'empty page!!!',
'ca-prod',
'empty page!!!' );
// Bind click handler
$( prodlink ).click( function () {
var page_title = mw.config.get('wgPageName');
prod( page_title );
});
function prod( page_title ) {
var api = new mw.Api();
api.get( { action: 'query',
prop: 'info',
intoken: 'edit',
titles: 'beepboop', // Hello. I'm here.
format: 'json'
} ).done(
function( data ) {
var edit_token = data.query.pages['-1'].edittoken;
console.log(edit_token);
api.post( { action: 'edit',
title: page_title,
text: 'test',
summary: 'test',
token: edit_token
} ).done(
function( data ) {
window.location = '/wiki/'+page_title;
} );
}
); }