User:BZPN/RfD.js: Difference between revisions

From Test Wiki
Content deleted Content added
BZPN (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit
BZPN (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit
Line 17: Line 17:
openDeletionPopup();
openDeletionPopup();
};
};
}// === Wstaw ten fragment PRZED openDeletionPopup ===
}
// === Wstaw ten fragment PRZED openDeletionPopup ===


// Dodaj zakładkę Quick Delete do popupu
// Dodanie zakładki Quick Delete do popupu
function addQuickDeleteTab(popup) {
function addQuickDeleteTab(popup) {
const quickDeleteTab = $('<div>').attr('id', 'quick-delete-tab').css({
const quickDeleteTab = $('<div>').attr('id', 'quick-delete-tab').css({
Line 89: Line 88:
}
}


// === Koniec fragmentu PRZED openDeletionPopup ===
// Funkcja do oznaczania strony do szybkiego usunięcia
function tagPageForQuickDeletion(reason) {
const tag = `{{qd|${reason}}}`;
const editSummary = 'Nominating for quick deletion ([[User :BZPN/RfD.js|QD]])';


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.');
closeDeletionPopup(); // Zamknij popup po pomyślnym oznaczeniu
}).fail(function() {
alert('Failed to tag the page for quick deletion. Please try again.');
});
}

// === Koniec fragmentu PRZED openDeletionPopup ===
// Tworzenie i otwarcie okna popup dla nominacji do usunięcia
// Tworzenie i otwarcie okna popup dla nominacji do usunięcia
function openDeletionPopup() {
function openDeletionPopup() {