MediaWiki:Gadget-FastDelete.js: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
Polskacafe (dyskusja • edycje) (sutener żuli) |
Polskacafe (dyskusja • edycje) |
||
Linia 22: | Linia 22: | ||
break; |
break; |
||
case 'timeless': |
case 'timeless': |
||
for (var i = 0; i < edButtons.length; i++) $(' |
for (var i = 0; i < edButtons.length; i++) $('#p-cactions > .mw-portlet-body > ul').prepend('<li class="edButton"><a title="Usuń z powodem: '+ window.edButtons[i].summary + '" data-summary="' + window.edButtons[i].summary + '" data-id="edButton">'+window.edButtons[i].name+'</a></li>'); |
||
break; |
break; |
||
} |
} |
Wersja z 02:41, 18 cze 2022
if (!window.edButtons) {
window.edButtons = [{summary: "[[Nonsensopedia:Spam|Spam]]", name: "Spam"}, {summary: "[[Nonsensopedia:Prywata|Prywata]]", name: "Prywata"}, {summary: "[[Nonsensopedia:Bo tak|Bo tak]]", name: "Bo tak"}, {summary: "Wynik głosowania na [[Nonsensopedia:Strony do usunięcia|SDU]]", name: "SDU"}];
}
/* Ajax Fast Delete
inspired by https://dev.wikia.com/wiki/MediaWiki:FastDelete/code.js
Author: Sir Polskacafe
Works with cologneblue, modern, (dark)vector, monobook
*/
function fastDelete() {
"use strict";
if (!window.edButtons || $('#ca-delete').lenght || mw.config.get("wgNamespaceNumber") === -1) {
return;
}
var skin = mw.config.get("skin");
switch(skin) {
case 'vector':
for (var i = 0; i < edButtons.length; i++)
$('#p-views .vector-menu-content-list').prepend('<li class="edButton collapsible"><span><a title="Usuń z powodem: '+ window.edButtons[i].summary + '" data-summary="' + window.edButtons[i].summary + '" data-id="edButton">'+window.edButtons[i].name+'</a></span></li>');
break;
case 'monobook':
for (var i = 0; i < edButtons.length; i++) $('#p-cactions > .pBody > ul').append('<li class="edButton"><a title="Usuń z powodem: '+ window.edButtons[i].summary + '" data-summary="' + window.edButtons[i].summary + '" data-id="edButton">'+window.edButtons[i].name+'</a></li>');
break;
case 'timeless':
for (var i = 0; i < edButtons.length; i++) $('#p-cactions > .mw-portlet-body > ul').prepend('<li class="edButton"><a title="Usuń z powodem: '+ window.edButtons[i].summary + '" data-summary="' + window.edButtons[i].summary + '" data-id="edButton">'+window.edButtons[i].name+'</a></li>');
break;
}
$("a[data-id='edButton']").css('color', 'red').css('font-weight', 'bold');
$('a[data-id="edButton"]').click(function(){
if (!confirm("Czy chcesz usunąć tę stronę?")) { return; }
(new mw.Api())
.post({
action: 'delete',
title: mw.config.get('wgPageName'),
reason: $(this).attr('data-summary'),
token: mw.user.tokens.get('csrfToken')
})
.done(function (res) {
location.reload();
});});
}
jQuery(document).ready(fastDelete);