User:BZPN/RfD.js: Difference between revisions
From Test Wiki
Content deleted Content added
No edit summary Tags: Mobile edit Mobile web edit |
No edit summary Tags: Mobile edit Mobile web edit |
||
Line 22: | Line 22: | ||
// Dodanie zakładki Quick Delete do popupu |
// Dodanie zakładki Quick Delete do popupu |
||
function addQuickDeleteTab(popup) { |
function addQuickDeleteTab(popup) { |
||
// Tworzenie zakładki QD i formularza |
|||
const quickDeleteTab = $('<div>').attr('id', 'quick-delete-tab').css({ |
const quickDeleteTab = $('<div>').attr('id', 'quick-delete-tab').css({ |
||
'display': 'none' // Domyślnie ukryty |
'display': 'none' // Domyślnie ukryty |
||
}).appendTo(popup); |
}).appendTo(popup); |
||
Line 64: | Line 63: | ||
{ value: 'A5', text: 'Not in English' }, |
{ value: 'A5', text: 'Not in English' }, |
||
{ value: 'A6', text: 'Hoax' } |
{ value: 'A6', text: 'Hoax' } |
||
// Dodaj inne powody w razie potrzeby |
|||
]; |
]; |
||
// Dodaj powody do select |
|||
$.each(reasons, function(index, reason) { |
$.each(reasons, function(index, reason) { |
||
quickDeleteSelect.append($('<option>').attr('value', reason.value).text(reason.text)); |
quickDeleteSelect.append($('<option>').attr('value', reason.value).text(reason.text)); |
||
}); |
|||
} |
|||
// Funkcja wstawiająca tag QD na górę strony |
|||
function insertQuickDeleteTag(reason) { |
|||
const tag = `{{QD|${reason}}}`; |
|||
const editSummary = `Tagging page for quick deletion (Reason: ${reason})`; |
|||
new mw.Api().postWithToken('csrf', { |
|||
action: 'edit', |
|||
title: mw.config.get('wgPageName'), |
|||
prependtext: tag + '\n', |
|||
summary: editSummary, |
|||
watchlist: 'watch', |
|||
}).done(function() { |
|||
alert('Page tagged for quick deletion.'); |
|||
}).fail(function() { |
|||
alert('Failed to tag the page for quick deletion. Please try again.'); |
|||
}); |
}); |
||
} |
} |