Użytkownik:Michał56/common.js: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
Znacznik: edytor źródłowy |
M Znacznik: edytor źródłowy |
||
Linia 22: | Linia 22: | ||
}; |
}; |
||
} |
} |
||
window.fdButtons = []; |
|||
;(function($, mw) { |
|||
switch (mw.config.get('wgCanonicalSpecialPageName')) { |
|||
case "Contributions": |
|||
$('#contentSub a:nth-child(8)').after(' • <a id="nuke" href="http://nonsensopedia.wikia.com/wiki/Special:Nuke/' + mw.config.get('wgPageName').split('/')[1] + '">masowe usuwanie</a>'); |
|||
break; |
|||
} |
|||
}) (this.jQuery, this.mediaWiki); |
|||
;(function($, mw) { |
|||
switch (mw.config.get('wgCanonicalSpecialPageName')) { |
|||
case "Contributions": |
|||
function info() { |
|||
alert('Ta funkcjonalność jest w trakcie rozwoju, niestety nie jest jeszcze dostępna.'); |
|||
} |
|||
$('#contentSub a:nth-child(7)').after(' • <a href="#" id="MultiLookupLink">MultiLookup</a>'); |
|||
break; |
|||
} |
|||
$('#MultiLookupLink').click(function() { |
|||
info(); |
|||
}); |
|||
window.fdButtons.push( |
|||
}) (this.jQuery, this.mediaWiki); |
|||
{ |
|||
summary: '[[Nonsensopedia:Bo tak|Bo tak]]', |
|||
label: 'Bo tak' |
|||
;(function($, mw) { |
|||
}, |
|||
switch (mw.config.get('wgCanonicalSpecialPageName')) { |
|||
{ |
|||
case "Contributions": |
|||
summary: '[[Nonsensopedia:Wandalizm|Wandalizm]]', |
|||
$('#contentSub a:nth-child(9)').after(' • <a href="#" id="contribs-tools">narzędzia</a>'); |
|||
label: 'Wandalizm' |
|||
break; |
|||
}, |
|||
} |
|||
{ |
|||
}) (this.jQuery, this.mediaWiki); |
|||
summary: '[[Nonsensopedia:Prywata|Prywata]]', |
|||
label: 'Prywata' |
|||
;(function($, mw) { |
|||
} |
|||
var username = mw.config.get("wgPageName").split("/")[1]; |
|||
); |
|||
var token = mw.user.tokens.get("editToken"); |
|||
importArticles( { |
|||
var walls = [ |
|||
type: 'script', |
|||
articles: [ |
|||
"Nachrichtenseite", |
|||
// ... |
|||
'u:dev:FastDelete/code.js', |
|||
// ... |
|||
] |
|||
"Üzenőfal", |
|||
} ); |
|||
"Bacheca", |
|||
"メッセージ ウォール", |
|||
"Prikbord", |
|||
"Tablica wiadomości", |
|||
"Mural de mensagens", |
|||
"Стіна обговорення", |
|||
"Стена обсуждения", |
|||
"留言墙" |
|||
]; |
|||
$('#contribs-tools').click(function() { |
|||
$.showCustomModal('Narzędzia — <span id="nazwa_usera">' + username + '</span>', '<div class="input-group"><label>Powód:</label><input id="reason" type="text" maxlength="150" value="[[w:c:community:help:vandalism|Vandalism]]"> <span id="banReasonV" class="button">V</span> <span id="banReasonS" class="button">S</span> <span id="banReasonP" class="button">P</span> <span id="banReasonOB" class="button">OB</span> </div><br/><div class="input-group"><label>Czas blokady:</label><input id="time" type="text" maxlength="150" value="2 weeks"> <span id="banTime12h" class="button">12h</span> <span id="banTime2w" class="button">2w</span> <span id="banTime3m" class="button">3m</span> <span id="banTimeInf" class="button">inf</span> </div><br/><fieldset><legend style="font-family: Arial; font-weight: bold">Inne operacje</legend><center><a href="/wiki/Specjalna:Rejestr/block?page=Użytkownik:' + username + '" id="blockLog">Blokady</a> • <a href="/wiki/Specjalna:Rejestr/' + username + '" id="log">Rejestry</a> • <a href="/wiki/User Talk:' + username + '" id="talk">Dyskusja</a> • <a href="/wiki/Specjalna:Pliki/' + username + '" id="files">Pliki</a> • <a href="/wiki/Specjalna:Usunięty_wkład/' + username + '" id="deleteCo">Usunięty wkład</a> • <a href="/wiki/Specjalna:Uprawnienia/' + username + '" id="rights">Uprawnienia</a>', { |
|||
id: 'tools', |
|||
width: 650, |
|||
buttons: [{ |
|||
message: 'Cofnij wszystko', |
|||
id: 'RollbackAllButton', |
|||
defaultButton: true, |
|||
handler: function() { |
|||
rollbackAll(); |
|||
} |
|||
}, { |
|||
message: 'Cofnij i usuń', |
|||
id: 'DeleteAndRollbackButton', |
|||
defaultButton: true, |
|||
handler: function() { |
|||
deleteAll(); |
|||
rollbackAll(); |
|||
} |
|||
}, { |
|||
message: 'Wszystkie poprzednie', |
|||
id: 'AllBeforeButton', |
|||
defaultButton: true, |
|||
handler: function() { |
|||
deleteAll(); |
|||
rollbackAll(); |
|||
} |
|||
}, { |
|||
message: 'Usuń wszystko', |
|||
id: 'DeleteAllButton', |
|||
defaultButton: true, |
|||
handler: function() { |
|||
deleteAll(); |
|||
} |
|||
}, { |
|||
message: 'Zablokuj', |
|||
id: 'BlockButton', |
|||
defaultButton: true, |
|||
handler: function() { |
|||
block(); |
|||
} |
|||
}, { |
|||
message: 'Nuke', |
|||
id: 'NukeButton', |
|||
defaultButton: true, |
|||
handler: function() { |
|||
deleteNuke(); |
|||
} |
|||
}] |
|||
}); |
|||
var ReasonBan = document.getElementById("reason"); |
|||
var TimeBan = document.getElementById("time"); |
|||
document.getElementById("banReasonV").onclick = function() { |
|||
ReasonBan.value = '[[w:c:community:help:vandalism|Vandalism]]'; |
|||
} |
|||
document.getElementById("banReasonS").onclick = function() { |
|||
ReasonBan.value = '[[w:c:community:help:spam|Spam]]'; |
|||
} |
|||
document.getElementById("banReasonP").onclick = function() { |
|||
ReasonBan.value = '[[w:c:nonsensopedia:Nonsensopedia:Prywata|Prywata]]'; |
|||
} |
|||
document.getElementById("banReasonOB").onclick = function() { |
|||
ReasonBan.value = 'Omijanie bana'; |
|||
TimeBan.value = 'infinite'; |
|||
} |
|||
document.getElementById("banTime12h").onclick = function() { |
|||
TimeBan.value = '12 hours'; |
|||
} |
|||
document.getElementById("banTime2w").onclick = function() { |
|||
TimeBan.value = '2 weeks'; |
|||
} |
|||
document.getElementById("banTime3m").onclick = function() { |
|||
TimeBan.value = '3 months'; |
|||
} |
|||
document.getElementById("banTimeInf").onclick = function() { |
|||
TimeBan.value = 'infinite'; |
|||
} |
|||
}); |
|||
function apiDelete(page,reason) { |
|||
new mw.Api().post({ |
|||
format: 'json', |
|||
action: 'delete', |
|||
title: page, |
|||
reason: reason, |
|||
bot: true, |
|||
token: token |
|||
}) |
|||
.done(function(d) { |
|||
if (!d.error) { |
|||
console.log('done'); |
|||
} else { |
|||
console.log('Wystąpił błąd podczas usuwania strony: - '+ d.error.code); |
|||
} |
|||
}) |
|||
.fail(function() { |
|||
console.log('Wystąpił błąd podczas usuwania strony: '+page+'!'); |
|||
}); |
|||
} |
|||
function rollbackAll() { |
|||
$('.mw-rollback-link a').each(function() { |
|||
var href = $(this).attr('href'); |
|||
$.get(href); |
|||
$(this).text('Gotowe!').parents().eq(2).css({'color':'grey','text-decoration':'line-through'}).removeAttr('href'); |
|||
}); |
|||
} |
|||
function block() { |
|||
var czas = document.getElementById("time").value; |
|||
var powod = document.getElementById("reason").value; |
|||
var duration = prompt('Wybrany czas:', czas), |
|||
blockReason = prompt('Wybrany powód:', powod); |
|||
if (!duration) { |
|||
alert('Pole „Wybrany czas” nie może być puste!'); |
|||
return; |
|||
} else if (!blockReason) { |
|||
alert('Pole „Wybrany powód” nie może być puste!'); |
|||
return; |
|||
} |
|||
new mw.Api().post({ |
|||
format: 'json', |
|||
action: 'block', |
|||
user: username, |
|||
expiry: duration, |
|||
nocreate: 0, |
|||
autoblock: 0, |
|||
reason: blockReason, |
|||
bot: true, |
|||
token: token |
|||
}) |
|||
.done(function(d) { |
|||
if (!d.error) { |
|||
alert(username+' został pomyślnie zablokowany!'); |
|||
} |
|||
else { |
|||
alert('Wystąpił błąd podczas blokowania'); |
|||
} |
|||
}) |
|||
.fail(function() { |
|||
alert('Wystąpił błąd podczas blokowania: '+username+'!'); |
|||
}) |
|||
} |
|||
function deleteAll() { |
|||
var deleteReason = 'Cleanup'; |
|||
$('li .newpage ~ a').each(function() { |
|||
var title = $(this).attr('title'); |
|||
if (walls.indexOf(title.split(':')[0]) !== -1) |
|||
return; |
|||
apiDelete(title,deleteReason); |
|||
$(this).parent().css({'color':'grey','text-decoration':'line-through'}).removeAttr('href'); |
|||
}); |
|||
$('#mw-content-text ul li').each(function() { |
|||
var title = $(this).children('a').first().attr('title'); |
|||
if (title.split('-').length == 1 || title.split('/@comment').length == 1) |
|||
return; |
|||
apiDelete(title,deleteReason); |
|||
$(this).css({'color':'grey','text-decoration':'line-through'}).removeAttr('href'); |
|||
}); |
|||
} |
|||
function deleteNuke() { |
|||
window.open('http://nonsensopedia.wikia.com/wiki/Special:Nuke/' + username); |
|||
} |
|||
function closeTools() { |
|||
$('#tools').closeModal(); |
|||
} |
|||
}) (this.jQuery, this.mediaWiki); |
Wersja z 13:23, 10 lut 2016
if (typeof (mwCustomEditButtons) != 'undefined') {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/26/Button_latinas.png",
"speedTip": "Wstaw polskie cudzysłowy",
"tagOpen": "„",
"tagClose": "”",
"sampleText": ""
};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/3/3f/Button_headline_-_2.png",
"speedTip": "Wstaw półpauzę",
"tagOpen": "–",
"tagClose": "",
"sampleText": ""
};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "https://commons.wikimedia.org/wiki/Category:MediaWiki_edit_toolbar_formatting_buttons#/media/File:Pulsante_tmp.png",
"speedTip": "Wstaw podpis",
"tagOpen": "{{Michał56}} <nowiki>{{subst:#time:H:i, M d, Y|+1 hour}} (CET)</nowiki>",
"tagClose": "",
"sampleText": ""
};
}
window.fdButtons = [];
window.fdButtons.push(
{
summary: '[[Nonsensopedia:Bo tak|Bo tak]]',
label: 'Bo tak'
},
{
summary: '[[Nonsensopedia:Wandalizm|Wandalizm]]',
label: 'Wandalizm'
},
{
summary: '[[Nonsensopedia:Prywata|Prywata]]',
label: 'Prywata'
}
);
importArticles( {
type: 'script',
articles: [
// ...
'u:dev:FastDelete/code.js',
// ...
]
} );