Użytkownik:Dominiol/monobook.js: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
M Znacznik: rewert |
|||
Linia 3: | Linia 3: | ||
var ajaxRefresh = 30000; |
var ajaxRefresh = 30000; |
||
//<pre><nowiki> |
|||
function sB() { |
function sB() { |
||
$('#ca-edit').prepend('<a id="ekst">Eksterminuj</a>'); |
$('#ca-edit').prepend('<a id="ekst">Eksterminuj</a>'); |
||
Linia 31: | Linia 32: | ||
$('#ekst').click(eksterminuj); |
$('#ekst').click(eksterminuj); |
||
//</nowiki></pre> |
Wersja z 15:35, 20 lut 2013
importScriptPage('AjaxRC/code.js', 'dev');
ajaxPages = ['Specjalna:Ostatnie_zmiany'];
var ajaxRefresh = 30000;
//<pre><nowiki>
function sB() {
$('#ca-edit').prepend('<a id="ekst">Eksterminuj</a>');
}
$(document).ready(sB);
function eksterminuj() {
$.ajax({
url: mw.util.wikiScript( 'api' ),
data: {
format: 'json',
action: 'edit',
title: mw.config.get( 'wgPageName' ),
prependtext: '{{tre}}',
token: mw.user.tokens.get('editToken')
},
dataType: 'json',
type: 'POST',
success: function( data ) {
window.location.reload(),
},
error: function( xhr ) {
alert( 'Error: Request failed.' );
}
});
}
$('#ekst').click(eksterminuj);
//</nowiki></pre>