User:Euphoria/common.js: Difference between revisions
From Test Wiki
Content deleted Content added
fix |
⏳ Tag: Reverted |
||
| 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 76: | Line 80: | ||
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 92: | Line 95: | ||
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 104: | Line 106: | ||
}).fail(err => alert('Error deleting page: ' + err)); |
}).fail(err => alert('Error deleting page: ' + err)); |
||
} else { |
} else { |
||
// Keep / No consensus |
// Keep / No consensus |
||
api.get({ |
api.get({ |
||
action: 'query', |
action: 'query', |
||
| Line 126: | Line 128: | ||
minor: true |
minor: true |
||
}).done(() => { |
}).done(() => { |
||
// Talk page update |
|||
const talkPage = 'Talk:' + targetPage; |
const talkPage = 'Talk:' + targetPage; |
||
api.get({ |
api.get({ |
||