User:Euphoria/common.js: Difference between revisions

From Test Wiki
Content deleted Content added
Tag: Reverted
Undo revision 65917 by Euphoria (talk)
Tag: Undo
Line 48: Line 48:
e.preventDefault();
e.preventDefault();
if (!confirm('Are you sure you want to close as ' + actionObj.name + '?')) return;
if (!confirm('Are you sure you want to close as ' + actionObj.name + '?')) return;

// Disable the button and show hourglass while processing
btn.disabled = true;
btn.textContent = '⏳';


const api = new mw.Api();
const api = new mw.Api();
Line 80: Line 76:
minor: true
minor: true
}).done(function() {
}).done(function() {
// Extract target article from heading DOM (first wikilink)
const link = $(heading).find('a').first();
const link = $(heading).find('a').first();
if (!link.length) {
if (!link.length) {
Line 95: Line 92:
reason: '[[' + mw.config.get('wgPageName') + ']]'
reason: '[[' + mw.config.get('wgPageName') + ']]'
}).done(() => {
}).done(() => {
// Also delete talk page
const talkPage = 'Talk:' + targetPage;
const talkPage = 'Talk:' + targetPage;
api.postWithToken('csrf', {
api.postWithToken('csrf', {
Line 106: Line 104:
}).fail(err => alert('Error deleting page: ' + err));
}).fail(err => alert('Error deleting page: ' + err));
} else {
} else {
// Keep / No consensus
// Keep / No consensus: remove {{vfd-new}} from article
api.get({
api.get({
action: 'query',
action: 'query',
Line 128: Line 126:
minor: true
minor: true
}).done(() => {
}).done(() => {
// Talk page update
const talkPage = 'Talk:' + targetPage;
const talkPage = 'Talk:' + targetPage;
api.get({
api.get({