Pengguna:FBN122645/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 with modifications by TheDJ; 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(editSummary) 
{
	if(editSummary === null)
	{
		return false;
	}
	var userName = mw.config.get("wgRelevantUserName");
	var titleRegex = /title=([^&]+)/;
	
	mw.loader.using( 'mediawiki.api.rollback' ).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("dibalikkan");
				$(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 all", "ca-rollbackeverything", "balikkan semua suntingan yang ditampilkan di sini");
			$("#ca-rollbackeverything").click( function(event)
			{
				event.preventDefault();
				mw.loader.load( [ 'mediawiki.api.rollback' ] ); //start loading, while the user is in the prompt
				return rollbackEverythingWKMR(prompt("Masukkan ringkasan suntingan, atau biarkan kosong untuk menggunakan ringkasan bawaan (atau tekan Batal untuk membatalkan proses pembalikkan secara keseluruhan)"));
			});
		});
	}
});