MediaWiki:Gadget-confirmationRollback-mobile.js

Catatan: Selepas menyiarkan perubahan, anda mungkin perlu memintas cache pelayar untuk melihatnya.

  • Firefox / Safari: Tahan Shift sambil mengklik Reload, atau tekan sama ada Ctrl-F5 atau Ctrl-R (⌘-R pada Mac)
  • Google Chrome: Tekan Ctrl-Shift-R (⌘-Shift-R pada Mac)
  • Internet Explorer / Edge: Tahan Ctrl sambil mengklik Refresh, atau tekan Ctrl-F5
  • Opera: Tekan Ctrl-F5.
/*********************************************************************
**                ***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: [[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 = 'Undur semula ' + (count ? count + ' suntingan' : 'suntingan') + ' oleh ' + mw.util.getParamValue('from',e.target.href) + '?';
			if(!confirm(message)) return e.preventDefault();
		});
	}
}());
//</nowiki>