User:BZPN/RfD.js: Difference between revisions
From Test Wiki
Content deleted Content added
No edit summary Tags: Manual revert Reverted Mobile edit Mobile web edit |
No edit summary Tags: Manual revert 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-cactions', |
||
'#', |
'#', |
||
'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 |
||
$('<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:').appendTo(popup); |
||
'display': 'block', |
|||
'margin-top': '15px' |
|||
}).appendTo(popup); |
|||
const shortReasonInput = $('<input>').attr({ |
const shortReasonInput = $('<input>').attr({ |
||
'type': 'text', |
'type': 'text', |
||
| Line 88: | Line 74: | ||
}).css({ |
}).css({ |
||
'width': '100%', |
'width': '100%', |
||
'padding': ' |
'padding': '8px', |
||
'margin': ' |
'margin': '10px 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:').appendTo(popup); |
||
'display': 'block', |
|||
'margin-top': '10px' |
|||
}).appendTo(popup); |
|||
const detailedReasonInput = $('<textarea>').attr({ |
const detailedReasonInput = $('<textarea>').attr({ |
||
'id': 'deletion-detailed-reason', |
'id': 'deletion-detailed-reason', |
||
| Line 102: | Line 85: | ||
}).css({ |
}).css({ |
||
'width': '100%', |
'width': '100%', |
||
'padding': ' |
'padding': '8px', |
||
'height': ' |
'height': '100px', |
||
'margin': ' |
'margin': '10px 0' |
||
}).appendTo(popup); |
}).appendTo(popup); |
||
| Line 115: | Line 98: | ||
'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 149: | Line 127: | ||
function tagPageForDeletion(reason) { |
function tagPageForDeletion(reason) { |
||
const tag = `{{rfd|${reason}}}`; |
const tag = `{{rfd|${reason}}}`; |
||
const editSummary = 'Nominating for deletion |
const editSummary = 'Nominating for deletion'; |
||
new mw.Api().postWithToken('csrf', { |
new mw.Api().postWithToken('csrf', { |
||
| Line 173: | Line 151: | ||
title: discussionPageTitle, |
title: discussionPageTitle, |
||
text: discussionContent, |
text: discussionContent, |
||
summary: 'Starting deletion discussion |
summary: 'Starting deletion discussion', |
||
watchlist: 'watch', |
watchlist: 'watch', |
||
}).done(function() { |
}).done(function() { |
||
| Line 190: | Line 168: | ||
return { |
return { |
||
text: discussionLink + '\n' + revision.content, |
text: discussionLink + '\n' + revision.content, |
||
summary: 'Adding new deletion discussion |
summary: 'Adding new deletion discussion', |
||
watchlist: 'watch', |
watchlist: 'watch', |
||
}; |
}; |
||
| Line 209: | Line 187: | ||
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', |
||
watchlist: 'watch', |
watchlist: 'watch', |
||
}).done(function() { |
}).done(function() { |
||