User:OJJ/hromadnyrollback.js
< User:OJJ
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
//Mass rollback function
//Tato verze zalozena na :en:User:Writ Keeper/Scripts/massRollback.js
function rollbackEverythingWKMR(editSummary)
{
if(editSummary === null)
{
return false;
}
var userName = mw.config.get("wgRelevantUserName");
var titleRegex = /title=([^&]+)/;
mw.loader.using( 'mediawiki.api' ).done( function()
{
var api = new mw.Api();
$("a[href*='action=rollback']").each(function(ind, el)
{
var params = {};
if( editSummary != '' )
{
params.summary = editSummary;
}
api.rollback( decodeURIComponent(titleRegex.exec(el.href)[1]), userName, params).done( function()
{
$(el).after("Hotovo!");
$(el).remove();
} );
} );
} );
return false;
}
$(document).ready(function()
{
if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0)
{
mw.loader.using("mediawiki.util").done( function ()
{
mw.util.addPortletLink('p-cactions', '#', "Rollback", "ca-rollbackeverything", "Vrátiť všetky aktuálne úpravy redaktora");
$("#ca-rollbackeverything").click( function(event)
{
event.preventDefault();
mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt
return rollbackEverythingWKMR(prompt("Zhrnutie úprav:"));
});
});
}
});