MediaWiki:Gadget-confirmationRollback-mobile.js

Dari Wikipedia bahasa Indonesia, ensiklopedia bebas

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).

/************************************************************************
**                ***WARNING: GLOBAL GADGET FILE***                    **
**         any changes to this file will affect many users             **
**          please discuss changes on the talk page or at              **
**             [[Wikipedia talk:Gadget]] before editing                **
**     (consider dropping the script author a note as well...)         **
**                                                                     **
*************************************************************************
**         Script: confirmationRollback-mobile                         **
**         Author: MusikAnimal                                         **
**  Documentation: [[en:User:MusikAnimal/confirmationRollback-mobile]] **
**                                                                     **
*************************************************************************/

//<nowiki>
(function() {
	if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
		$(".mw-rollback-link").on('click', function(e) {
			var linkText = $(e.target).text(),
				count = linkText.match(/\d/) ? linkText.match(/\d+/)[0] : null,
				message = 'Kembalikan ' + (count ? count + ' suntingan' : 'suntingan') + ' oleh ' + mw.util.getParamValue('from',e.target.href) + '?';
			if(!confirm(message)) return e.preventDefault();
		});
	}
}());
//</nowiki>