Pengguna:Hidayatsrf/massRollback.js

Catatan: Setelah menyimpan, Anda harus memintas tembolok (cache) peramban Anda untuk melihat perubahannya. Google Chrome, Firefox, Microsoft Edge dan Safari: Tahan tombol Shift dan klik Muat ulang (Reload) di tombol bilah alat. Untuk detail dan instruksi tentang peramban lain, lihat halaman menghapus singgahan (Inggris).

//Mass rollback function
//Written by John254 and modified/rewritten by Writ Keeper; original is at https://en.wiki-indonesia.club/wiki/User:John254/mass_rollback.js
//Adapted from User:Mr.Z-man/rollbackSummary.js
//Instructions: Selecting the "rollback all" tab when viewing a user's contributions history
//will open all rollback links displayed there. (Use with caution)
  
function rollbackEverythingWKMR() 
{
	var userName = /Contributions\/(.+)/.exec(mw.config.get("wgTitle"))[1];
	var tokenRegex = /token=([^&]+)/;
	var titleRegex = /title=([^&]+)/;
	$("a[href*='action=rollback']").each(function(ind, el)
	{
		var regexResults = tokenRegex.exec(el.href);
		rollbackToken = decodeURIComponent(regexResults[1]);
		
		var postInfo = {action:"rollback",title:titleRegex.exec(el.href)[1],token:rollbackToken,user:userName};
		$.post("/w/api.php", postInfo, function()
		{
			$(el).after("reverted");
			$(el).remove();
		});
	});
}
$(document).ready(function()
{
	if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0)
	{
		mw.util.addPortletLink('p-cactions', 'javascript:rollbackEverythingWKMR()', "batalkan semua", "ca-rollbackeverything", "rollback all edits displayed here");
		$("#ca-rollbackeverything").click(function(){return confirm("Yakin membatalkan *semuanya*?")});
	}
});