User:Euphoria/common.js: Difference between revisions
From Test Wiki
Content deleted Content added
fix |
fix |
||
| Line 81: | Line 81: | ||
const link = $(heading).find('a').first(); |
const link = $(heading).find('a').first(); |
||
if (!link.length) { |
if (!link.length) { |
||
mw.notify('Cannot find target page link!', {title: 'VfDcloser', type: 'error', timeout: |
mw.notify('Cannot find target page link!', {title: 'VfDcloser', type: 'error', timeout: 2000}); |
||
setTimeout(() => location.reload(), |
setTimeout(() => location.reload(), 2000); |
||
return; |
return; |
||
} |
} |
||
| Line 88: | Line 88: | ||
const targetPage = link.attr('title') || link.text().trim(); |
const targetPage = link.attr('title') || link.text().trim(); |
||
if (!targetPage) { |
if (!targetPage) { |
||
mw.notify('Cannot determine target page title!', {title: 'VfDcloser', type: 'error', timeout: |
mw.notify('Cannot determine target page title!', {title: 'VfDcloser', type: 'error', timeout: 2000}); |
||
setTimeout(() => location.reload(), |
setTimeout(() => location.reload(), 2000); |
||
return; |
return; |
||
} |
} |
||
| Line 107: | Line 107: | ||
api.postWithToken('csrf', {action: 'delete', title: talkPage, reason: 'Parent page deleted via VfD'}) |
api.postWithToken('csrf', {action: 'delete', title: talkPage, reason: 'Parent page deleted via VfD'}) |
||
.done(() => { |
.done(() => { |
||
mw.notify('Discussion closed. Page and talk page deleted.', {title: 'VfDcloser', type: 'success', timeout: |
mw.notify('Discussion closed. Page and talk page deleted.', {title: 'VfDcloser', type: 'success', timeout: 2000}); |
||
setTimeout(() => location.reload(), |
setTimeout(() => location.reload(), 2000); |
||
}).fail(err => mw.notify('Error deleting talk page: ' + JSON.stringify(err), {title: 'VfDcloser', type: 'error', timeout: 5000})); |
}).fail(err => mw.notify('Error deleting talk page: ' + JSON.stringify(err), {title: 'VfDcloser', type: 'error', timeout: 5000})); |
||
} else { |
} else { |
||
mw.notify('Discussion closed. Page deleted.', {title: 'VfDcloser', type: 'success', timeout: |
mw.notify('Discussion closed. Page deleted.', {title: 'VfDcloser', type: 'success', timeout: 2000}); |
||
setTimeout(() => location.reload(), |
setTimeout(() => location.reload(), 2000); |
||
} |
} |
||
}); |
}); |
||
| Line 164: | Line 164: | ||
minor: true |
minor: true |
||
}).done(() => { |
}).done(() => { |
||
mw.notify('Discussion closed. Page and talk page updated.', {title: 'VfDcloser', type: 'success', timeout: |
mw.notify('Discussion closed. Page and talk page updated.', {title: 'VfDcloser', type: 'success', timeout: 2000}); |
||
setTimeout(() => location.reload(), |
setTimeout(() => location.reload(), 2000); |
||
}).fail(err => mw.notify('Error editing talk page: ' + JSON.stringify(err), {title: 'VfDcloser', type: 'error', timeout: 5000})); |
}).fail(err => mw.notify('Error editing talk page: ' + JSON.stringify(err), {title: 'VfDcloser', type: 'error', timeout: 5000})); |
||
}); |
}); |
||