User:MPGuy2824/db-r2.js

/* jshint laxbreak: true, undef: true, maxerr:999 */ /* globals console, window, document, $, mw, OO, extraJs */ // $.when(	// Resource loader modules	mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.Title']),	// Page ready	$.ready ).then(function { /* ========== Config ============================================================================ */ var config = {	// MediaWiki configuration values	mw: mw.config.get( [ 'wgPageName' ] ) };

/* ========== API =============================================================================== */ var API = new mw.Api( {	ajax: {	headers: {'Api-User-Agent': 'db-r2/'} } } );

// --- Add link to 'More' menu (or user-specified portlet) which starts everything --- mw.util.addPortletLink( (window.m2d_portlet||'p-cactions'), '#', 'db-r2', 'ca-db-r2', null, null, "#ca-move"); $('#ca-db-r2').on('click', function(e) {		e.preventDefault;

API.postWithToken( 'csrf', {			action: 'edit',			title: config.mw.wgPageName,			prependtext: '\n',			summary: 'R2 speedy deletion request'		} ) .done( function { window.location.reload; } ) .fail( function(c, r) {		} ); }); }); //