User:Alexis Jazz/TakeAHikeMobileDiff.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//MobileDiff, take a hike! This script is hereby irrevocably released as WTFPL<nowiki>
window.MDTAH = {};
var MDTAH = window.MDTAH;
var mw = window.mw;
if ( window.location.href.match(/\.m\./) ) {
	MDTAH.patchLink = function(element) {
		if ( mw.config.get('wgCanonicalSpecialPageName') == 'History' ) {
			element.href = element.href.replace(/\.m\./,'.').replace(/\/[^\/]+\/([0-9]*)$/,mw.config.get('wgScript') + '?diff=$1&useskin=minerva');
		} else {
			element.href = element.href.replace(/\.m\./,'.').replace(/php\?.*diff=([0-9]*).*/,'php?diff=$1&useskin=minerva');
		}
	};
	if ( mw.config.get('wgCanonicalSpecialPageName') == 'Recentchanges' ) {
		mw.util.addCSS('.unFuckedUserLink{display:table;}');
		$('.mw-userlink').addClass('unFuckedUserLink').removeClass('mw-userlink');
		for (MDTAH.int=0;MDTAH.int<$('.mw-changeslist-diff').length;MDTAH.int++) {
			MDTAH.patchLink($('.mw-changeslist-diff')[MDTAH.int]);
		}
		$('.mw-changeslist-line-inner').on('click',function(){if ( ! document.activeElement || document.activeElement.nodeName != 'A' ) { window.location = $('.mw-changeslist-line-inner:hover .mw-changeslist-diff')[0].href;}});
	}
	if ( mw.config.get('wgCanonicalSpecialPageName') == 'History' ) {
		for (MDTAH.int=0;MDTAH.int<$('.page-summary .title').length;MDTAH.int++) {
			MDTAH.patchLink($('.page-summary .title')[MDTAH.int]);
		}
	}
}
//</nowiki>