User:Closedmouth/blah.js

/** * Proposed deletion script for broken redirects * @author Legoktm, MZMcBride * Public domain; 2013 */ var csdlink = mw.util.addPortletLink( 'p-cactions',                                     '#',                                      'speedy',                                      'ca-csd',                                      'Delete this page' ); // Bind click handler $( csdlink ).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: 'delete',               titles: 'beepboop', // Hello. I'm here.               format: 'json'             } ).done(     function( data ) {        var delete_token = data.query.pages['-1'].deletetoken;        api.post( { action: 'delete', title: page_title, reason: 'G8: Talk page of a nonexistent or deleted page', token: delete_token } ).done( function( data ) { window.location = '/wiki/'+page_title; }   );                     }                     );     }