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: Reverted Mobile edit Mobile web edit |
||
| Line 4: | Line 4: | ||
// Dodaj przycisk "Nominate for deletion" do paska narzędzi |
// Dodaj przycisk "Nominate for deletion" do paska narzędzi |
||
mw.util.addPortletLink( |
mw.util.addPortletLink( |
||
'p- |
'p-tb', |
||
'#', |
'#', |
||
'Nominate for deletion', |
'Nominate for deletion', |
||
| Line 55: | Line 55: | ||
$('<h3>').text('Nominate for deletion').appendTo(popup); |
$('<h3>').text('Nominate for deletion').appendTo(popup); |
||
// Informacja o zasadach RfD |
// Informacja o zasadach RfD i link do Wikipedia:Requests for deletion |
||
$('<p>').text('Before nominating, please read the deletion policy and guidelines on the Wikipedia:Requests for deletion page.').css({ |
$('<p>').text('Before nominating, please read the deletion policy and guidelines on the Wikipedia:Requests for deletion page.').css({ |
||
'font-size': '14px', |
'font-size': '14px', |
||
| Line 63: | Line 63: | ||
'font-size': '14px', |
'font-size': '14px', |
||
'color': '#0073e6', |
'color': '#0073e6', |
||
'text-decoration': 'underline' |
'text-decoration': 'underline', |
||
'display': 'block', |
|||
'margin-bottom': '15px' |
|||
}).appendTo(popup); |
}).appendTo(popup); |
||
// CheckBox do potwierdzenia zapoznania się z polityką |
|||
const policyCheckbox = $('<input>').attr({ |
|||
'type': 'checkbox', |
|||
'id': 'policy-confirmation' |
|||
}).css({ |
|||
'margin-right': '5px' |
|||
}); |
|||
$('<label>').attr('for', 'policy-confirmation').text('I have read and agree with the deletion policy').prepend(policyCheckbox).appendTo(popup); |
|||
// Pole na krótki powód |
// Pole na krótki powód |
||
$('<label>').attr('for', 'deletion-short-reason').text('Short reason:'). |
$('<label>').attr('for', 'deletion-short-reason').text('Short reason:').css({ |
||
'display': 'block', |
|||
'margin-top': '15px' |
|||
}).appendTo(popup); |
|||
const shortReasonInput = $('<input>').attr({ |
const shortReasonInput = $('<input>').attr({ |
||
'type': 'text', |
'type': 'text', |
||
| Line 74: | Line 88: | ||
}).css({ |
}).css({ |
||
'width': '100%', |
'width': '100%', |
||
'padding': ' |
'padding': '6px', |
||
'margin': ' |
'margin': '5px 0' |
||
}).appendTo(popup); |
}).appendTo(popup); |
||
// Pole na szczegółowy powód |
// Pole na szczegółowy powód |
||
$('<label>').attr('for', 'deletion-detailed-reason').text('Detailed reason for discussion:'). |
$('<label>').attr('for', 'deletion-detailed-reason').text('Detailed reason for discussion:').css({ |
||
'display': 'block', |
|||
'margin-top': '10px' |
|||
}).appendTo(popup); |
|||
const detailedReasonInput = $('<textarea>').attr({ |
const detailedReasonInput = $('<textarea>').attr({ |
||
'id': 'deletion-detailed-reason', |
'id': 'deletion-detailed-reason', |
||
| Line 85: | Line 102: | ||
}).css({ |
}).css({ |
||
'width': '100%', |
'width': '100%', |
||
'padding': ' |
'padding': '6px', |
||
'height': ' |
'height': '80px', |
||
'margin': ' |
'margin': '5px 0' |
||
}).appendTo(popup); |
}).appendTo(popup); |
||
| Line 98: | Line 115: | ||
'border': 'none', |
'border': 'none', |
||
'border-radius': '5px', |
'border-radius': '5px', |
||
'cursor': 'pointer' |
'cursor': 'pointer', |
||
'margin-top': '10px' |
|||
}).on('click', function() { |
}).on('click', function() { |
||
if (!policyCheckbox.is(':checked')) { |
|||
alert('Please confirm you have read the deletion policy.'); |
|||
return; |
|||
} |
|||
const shortReason = shortReasonInput.val().trim(); |
const shortReason = shortReasonInput.val().trim(); |
||
const detailedReason = detailedReasonInput.val().trim(); |
const detailedReason = detailedReasonInput.val().trim(); |
||
| Line 127: | Line 149: | ||
function tagPageForDeletion(reason) { |
function tagPageForDeletion(reason) { |
||
const tag = `{{rfd|${reason}}}`; |
const tag = `{{rfd|${reason}}}`; |
||
const editSummary = 'Nominating for deletion'; |
const editSummary = 'Nominating for deletion ([[User:BZPN/RfD.js|RfD]])'; |
||
new mw.Api().postWithToken('csrf', { |
new mw.Api().postWithToken('csrf', { |
||
| Line 151: | Line 173: | ||
title: discussionPageTitle, |
title: discussionPageTitle, |
||
text: discussionContent, |
text: discussionContent, |
||
summary: 'Starting deletion discussion', |
summary: 'Starting deletion discussion ([[User:BZPN/RfD.js|RfD]])', |
||
watchlist: 'watch', |
watchlist: 'watch', |
||
}).done(function() { |
}).done(function() { |
||
| Line 168: | Line 190: | ||
return { |
return { |
||
text: discussionLink + '\n' + revision.content, |
text: discussionLink + '\n' + revision.content, |
||
summary: 'Adding new deletion discussion', |
summary: 'Adding new deletion discussion ([[User:BZPN/RfD.js|RfD]])', |
||
watchlist: 'watch', |
watchlist: 'watch', |
||
}; |
}; |
||
| Line 187: | Line 209: | ||
title: `User talk:${creator}`, |
title: `User talk:${creator}`, |
||
appendtext: '\n' + notification, |
appendtext: '\n' + notification, |
||
summary: 'Notifying page creator about deletion nomination', |
summary: 'Notifying page creator about deletion nomination ([[User:BZPN/RfD.js|RfD]])', |
||
watchlist: 'watch', |
watchlist: 'watch', |
||
}).done(function() { |
}).done(function() { |
||