User:Technical 13/common.js

This is an old revision of this page, as edited by Technical 13 (talk | contribs) at 17:41, 20 January 2014 (and just the teahouse script for now.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
/*
$('li.toclevel-2').each(function(){
	$(this).html($(this).html().replace('<span>(<span>e<span>dit</span></span> | <span>t<span>alk</span></span> | <span>h<span>istory</span></span> <span>| <span>p<span>rotect</span></span> | <span>d<span>elete</span></span></span> | <span>l<span>i</span>nk<span>s</span></span> | <span>w<span>atch</span></span> | <span>log<span>s</span></span> | <span>v</span><span>iews</span>)</span>',''));
});

var pageName = mw.config.get( 'wgPageName' );

if (pageName == "Special:Watchlist") {
	$('td').each(function(){
		$(this).html($(this).html().replace('since last visit','new'));
	});
}

importScript( 'User:Anomie/previewtemplatelastmod.js' ); // Linkback: [[User:Anomie/previewtemplatelastmod.js]]
importScript( 'User:Equazcion/ScriptInstaller.js' );// [[User:Equazcion/ScriptInstaller]]
importScript( 'User:Technical 13/Scripts/fileRedlinks.js' );// [[User:Technical 13/Scripts/fileRedlinks]]
importScript( 'User:Technical 13/Scripts/admin eye.js' );// [[User:Technical 13/Scripts/admin eye]]
// // // importScript( 'User:Technical_13/Scripts/GANreview.js' );// [[User:Technical_13/Scripts/GANreview]]
importScript( 'User:Technical_13/Scripts/CommonHebrewUserNames.js' );// [[User:Technical_13/Scripts/CommonHebrewUserNames]]
importScript( 'User:Technical_13/Scripts/Gadget-BugCreateNew.js' );// [[User:Technical_13/Scripts/Gadget-BugCreateNew]]*/
importScript( 'User:Technical_13/Scripts/Teahouse.js' );// [[User:Technical_13/Scripts/Teahouse]]
/*
importScript( 'User:Technical_13/Scripts/Gadget-LiveClock.js' );// [[User:Technical_13/Scripts/Gadget-LiveClock]]
// importScript( 'User:Technical_13/Scripts/Gadget-listStyles.js' );// [[User:Technical_13/Scripts/Gadget-listStyles]]

importScript( "User:Theo's Little Bot/afch/afchelper.js" );// [[User:Theo's Little Bot/afch/afchelper.js]]
// importScript( 'MediaWiki:Gadget-afchelper-beta.js' );// Pushed beta [[MediaWiki:Gadget-afchelper-beta.js]]

//// importScript( 'Wikipedia:AutoEd/complete.js' );// [[WP:AutoEd]]
//?  importScript( 'User:Writ Keeper/Scripts/teahouseUtility.js' );// 1-click to + TH invite/tb to a user [[User:Writ Keeper]]
importScript( 'User:Lupin/recent2.js' );// Lupin's AVT tool [[User:Lupin]]
importScript( 'User:Technical 13/Scripts/LagToHours.js' );// based on [[User:Equazcion/LagToMinutes]]

/* Shrink all things on my "Contributions" page that no-one has edited since me. *//*
$('.mw-uctop').closest('li').css({"font-size":"6px", "text-decoration":"italic"});

/* Refresh my WatchList page when viewing every minute
if (pageName == "Special:Watchlist" || pageName == "Special:RecentChanges") {
	setTimeout(function(){___location = ''},180000);// Currently set to a static 3 minutes... May make it dynamic 1 min for PC 3 for mobile.
	var timeNow = new Date();
	var minNow = timeNow.getMinutes();
	var minNow = minNow - 3;
	var timeCheck = new Date();
	timeCheck.setMinutes(minNow);
	var postTime = $('td.mw-enhanced-rc').html();
	var nbsp = (postTime.match(/&nbsp;/g)||[]).length;
	for (i=0;i<nbsp;i++) {var postTime = postTime.replace('&nbsp;', '');}
	var postTime = postTime.replace('<span class="mw-enhancedchanges-arrow-space"></span>', '');
	var postTime = postTime.replace('<abbr class="newpage" title="This edit created a new page">N</abbr>', '');
	var postTime = postTime.replace('<abbr class="minoredit" title="This is a minor edit">m</abbr>', '');
	var postTime = postTime.replace('<abbr class="botedit" title="This edit was performed by a bot">b</abbr>', '');
	var postTime = postTime.replace('<abbr class="unpatrolled" title="This edit has not yet been patrolled">!</abbr>', '');
	var postTime = postTime.split(':', '2');
	var postHour = postTime[0];
	var postMin = postTime[1];
	var timePost = new Date();
	timePost.setHours(postHour);
	timePost.setMinutes(postMin);
	var timePost = timePost.getTime();
	var timeCheck = timeCheck.getTime();
	var timeNow = timeNow.toLocaleTimeString();
	var headTitle = timeNow + " - " + document.title;
	if (timePost >= timeCheck) {
		var enhRC = $('td.mw-enhanced-rc').html();
		$('td[class^="mw-enhanced-rc"]').each(function() {this.innerHTML = this.innerHTML.replace(enhRC, '<span style="font-weight: bold; font-size: 12pt;">' + enhRC + '</span>');});
// Using this styles ALL times	   $('td[class^="mw-enhanced-rc"]').css({"font-weight":"bold", "font-size":"12pt"});
		var headTitlePrefix = "N";
	}
/* I don't want to see what needs to be patrolled here until I can patrol everything or none of mine need patrolling
//	if ($('abbr.unpatrolled:first').length != 0){
//		var patrolRequired = $('abbr.unpatrolled:first').text();
//		var headTitlePrefix = patrolRequired + headTitlePrefix;
//	}*//*
	if (headTitlePrefix){ headTitle = headTitlePrefix + " - " + headTitle; }
	document.title = headTitle;
}
*//*

if (pageName == "User:Technical_13" || pageName == "User:Technical_13/common.js") {
	/* test section *//*
	var pageWatchers = 0;
	$.ajax({
		url: '//en.wikipedia.org/w/api.php?action=query&prop=info&format=json&inprop=watchers&titles=' + pageName,
		dataType: 'json',
		success: function (result) {
			var pageID = $.map(result.query.pages, function (v, k) {
				return k;
			})[0];
			pageWatchers = result.query.pages[pageID].watchers;
		}
	});
	/* test section *//*
	var oldTitle = document.title;
	var osVer = "?";
	if (navigator.appVersion.indexOf("Win") != -1) {
		var osName = "Windows";
	} else if (navigator.appVersion.indexOf("Mac") != -1) {
		var osName = "MacOS";
	} else if (navigator.appVersion.indexOf("X11") != -1) {
		var osName = "UNIX";
	} else if (navigator.appVersion.indexOf("Linux") != -1) {
		var osName = "Linux";
	} else if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) != "null") {
		osName = navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i);
		var isMobile = TRUE;
	} else {
		osName = "?";
	}
	if (navigator.userAgent.indexOf("Firefox") != -1) {
		var browserName = "Firefox";
		var browserVerStart = navigator.userAgent.lastIndexOf("/") + 1;
		var browserVer = navigator.userAgent.substr(browserVerStart);
		if (navigator.oscpu == "Windows NT 6.2; Win64; x64" || navigator.oscpu ==  "Windows NT 6.2; WOW64") {
			osVer = "8 (64-bit)";
		} else if (navigator.oscpu == "Windows NT 6.2") {
			osVer = "8";
		} else if (navigator.oscpu == "Windows NT 6.1; Win64; x64" || navigator.oscpu ==  "Windows NT 6.1; WOW64") {
			osVer = "7 (64-bit)";
		} else if (navigator.oscpu == "Windows NT 6.1") {
			osVer = "7";
		} else if (navigator.oscpu == "Windows NT 6.0; Win64; x64" || navigator.oscpu ==  "Windows NT 6.0; WOW64") {
			osVer = "Vista (64-bit)";
		} else if (navigator.oscpu == "Windows NT 6.0") {
			osVer = "Vista";
		} else if (navigator.oscpu == "Windows NT 5.1") {
			osVer = "XP";
		} else {
			alert(navigator.oscpu);
			osVer = "version that is so old that I'm going to refuse to tell you.  UPGRADE YOUR SYSTEM!";
		}
	} else if (navigator.userAgent.indexOf("OPR") != -1) {
		var browserName = "Opera";
		var browserVerStart = navigator.userAgent.lastIndexOf("OPR/") + 4;
		var browserVer = navigator.userAgent.substr(browserVerStart);
	} else if (navigator.userAgent.indexOf("Chrome") != -1) {
		var browserName = "Chrome";
		var browserVerStart = navigator.userAgent.lastIndexOf("Chrome/") + 7;
		var browserVer = navigator.userAgent.substr(browserVerStart);
		var browserVerEnd = browserVer.indexOf(" ");
		browserVer = browserVer.slice(0, browserVerEnd);
	} else if (navigator.userAgent.indexOf("Safari") != -1) {
		var browserName = "Safari";
		var browserVerStart = navigator.userAgent.lastIndexOf("Version/") + 8;
		var browserVer = navigator.userAgent.substr(browserVerStart);
		var browserVerEnd = browserVer.indexOf(" ");
		browserVer = browserVer.slice(0, browserVerEnd);
	} else if (navigator.userAgent.indexOf("MSIE") != -1) {
		var browserName = "Internet Explorer";
		var browserVerStart = navigator.userAgent.lastIndexOf("MSIE") + 5;
		var browserVer = navigator.userAgent.substr(browserVerStart);
		var browserVerEnd = browserVer.indexOf("; ");
		browserVer = browserVer.slice(0, browserVerEnd);
	} else {
		var browserName = navigator.userAgent;
		var browserVer = navigator.userAgent;
	}
	if (isNaN(window.screen.width)) {
		var screenWidth = "?";
	} else {
		var screenWidth = window.screen.width;
	}
	if (isNaN(window.screen.height)) {
		var screenHeight = "?";
	} else {
		var screenHeight = window.screen.height;
	}
	if (isNaN(window.screen.pixelDepth)) {
		var screenDepth = "?";
	} else {
		var screenDepth = window.screen.pixelDepth;
	}
	var osNameVer = osName + " " + osVer;
	var browserNameVer = browserName + " " + browserVer;
	if (screenWidth != "?" && screenHeight != "?") {
		var screenRes = screenWidth + "×" + screenHeight;
		var screenMP = screenWidth * screenHeight / 1000000;
		if (screenDepth != "?") {
			screenRes = screenRes + "×" + screenDepth;
		}
		var screenResolution = "Your resolution is set to " + screenRes + " (" + screenMP + " MegaPixels)";
		var screenResolutionLinked = "Your resolution is set to " + screenRes + " (" + screenMP + " <a href='http://enwp.org/Pixel#Megapixel'>MegaPixels</a>)";
	}

	console.info( 'Done: %d', pageWatchers );
	var currentTitle = "You are running " + browserNameVer + " on a " + osNameVer + " system. " + screenResolution + " - " + oldTitle;
	var currentSiteSub = "You are running " + browserNameVer + " on a " + osNameVer + " system. " + screenResolutionLinked + " - " + oldTitle;
	document.title = currentTitle;
	document.getElementById("siteSub").innerHTML = currentSiteSub;
}
*/