Jump to content

MediaWiki:Gadget-confirmationRollback-mobile.js: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
don't use innerText as it isn't supported in Firefox, which (presumably) causes problems in Firefox for Android
clean up comments; no need to contact me before editing
 
Line 1: Line 1:
/*********************************************************************
/********************************************************************
** ***WARNING: GLOBAL GADGET FILE*** **
** ***WARNING: GLOBAL GADGET FILE*** **
** any changes to this file will affect many users **
** Any changes to this file will affect many users. Please discuss **
** please discuss changes on the talk page or at **
** changes on the talk page or at [[WP:VPT]] before editing. **
********************************************************************/
** [[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>
//<nowiki>

Latest revision as of 20:08, 10 August 2020

/********************************************************************
**                ***WARNING: GLOBAL GADGET FILE***                **
** Any changes to this file will affect many users. Please discuss **
**    changes on the talk page or at [[WP:VPT]] before editing.    **
********************************************************************/

//<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 = 'Rollback ' + (count ? count + ' edits' : 'edit') + ' by ' + mw.util.getParamValue('from',e.target.href) + '?';
			if(!confirm(message)) return e.preventDefault();
		});
	}
}());
//</nowiki>