Terraria Wiki

  • Discussions are now available on the Terraria Wiki.
  • Miss the old Hydra Skin? Try out our Hydralize gadget! Visit the preferences page while logged in and turn on the gadget.

READ MORE

Terraria Wiki
Register
Advertisement

View this page in other languages: Deutschfrançaismagyar한국어polskiportuguêsрусскийукраїнська中文


CSS and JavaScript changes must comply with the wiki design rules.


Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
//<nowiki>
/**
 * Admin highlighter 2.0
 * ---------------------
 * [[User:Theopolisme/Scripts/adminhighlighter]]
 * A jQuery/mediawiki-heavy rewrite of [[User:Amalthea/userhighlighter.js]]
 * 
 * This script highlights links to admins' userpages or talkpages in bodyContent
 * (that is, everything but the tabs, personal links at the top of the screen and sidebar)
 * by giving them a cyan background.
 *
 */
$(document).ready(function(){
	var urlPre = 'http://terraria.gamepedia.com';
    var adminList = 'MediaWiki:AdminList.js';
	$.getJSON(urlPre + '/index.php?action=raw&ctype=application/json&title=' + adminList, function(data){
		ADMINHIGHLIGHT_EXTLINKS = window.ADMINHIGHLIGHT_EXTLINKS || false;
		ADMINHIGHLIGHT_NAMESPACES = [-1,2,3];
		mw.loader.using(['mediawiki.util','mediawiki.Uri', 'mediawiki.Title'], function() {
			mw.util.addCSS(".userhighlighter_sysop.userhighlighter_sysop {background-color: #00FFFF !important}");
			$('#bodyContent a').each(function(index,linkraw){
				try {
					var link = $(linkraw);
					var url = link.attr('href');

					// Skip <a> elements that aren't actually links; skip anchors
					if (!url || url.charAt(0) === '#') return; 

					//require http(s) links, avoid "javascript:..." etc. which mw.Uri does not support
					if (url.lastIndexOf("http://", 0) != 0 && url.lastIndexOf("https://", 0) != 0 && url.lastIndexOf("/", 0) != 0) return; 
					var uri = new mw.Uri(url);

					// Skip links with query strings if highlighting external links is disabled
					if (!ADMINHIGHLIGHT_EXTLINKS && !$.isEmptyObject(uri.query)) return; 
					if (uri.host == 'terraria.gamepedia.com') {

						// Try to get the title parameter of URL; if not available, remove '/wiki/' and use that
						var mwtitle = new mw.Title(mw.util.getParamValue('title',url) || decodeURIComponent(uri.path.slice(6))); 
						if ($.inArray(mwtitle.getNamespaceId(), ADMINHIGHLIGHT_NAMESPACES)>=0) {
							var user = mwtitle.getMain().replace(/_/g," ");

							// For special page "Contributions/<username>"
							if (mwtitle.getNamespaceId() === -1) user = user.replace('Contributions/',''); 
							if (data[user] == 1) {

								// Override the above color by using a.userhighlighter_sysop.userhighlighter_sysop {background-color: COLOR !important}
								link.addClass('userhighlighter_sysop'); 
							}
						}
					}
				} catch (e) {

					// Sometimes we will run into unparsable links, so just log these and move on
					window.console && console.error('Admin highlighter recoverable error',e.message);
				}
			});
		});
	});
});
//</nowiki>
Advertisement