User:Euphoria/common.js: Difference between revisions

From Test Wiki
Content deleted Content added
Undo revision 65917 by Euphoria (talk)
Tag: Undo
fix
Line 48:
e.preventDefault();
if (!confirm('Are you sure you want to close as ' + actionObj.name + '?')) return;
 
// Disable button to prevent double clicks
btn.disabled = true;
 
const api = new mw.Api();
Line 76 ⟶ 79:
minor: true
}).done(function() {
// Extract target article from heading DOM (first wikilink)
const link = $(heading).find('a').first();
if (!link.length) {
Line 92 ⟶ 94:
reason: '[[' + mw.config.get('wgPageName') + ']]'
}).done(() => {
// Also delete talk page
const talkPage = 'Talk:' + targetPage;
api.postWithToken('csrf', {
Line 104 ⟶ 105:
}).fail(err => alert('Error deleting page: ' + err));
} else {
// Keep / No consensus: remove {{vfd-new}} from article
api.get({
action: 'query',
Line 126 ⟶ 127:
minor: true
}).done(() => {
// Talk page update
const talkPage = 'Talk:' + targetPage;
api.get({