MediaWiki:Common.js

From PHIGHTING! Wiki
Revision as of 03:26, 17 April 2024 by Sillyvizion (talk | contribs)

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

const dynamicColorLibrary = {
	Sword:"#D84C4C",
	Skateboard:"#FF0000",
	Biograft:"#FE6A00",
	Katana:"#F95757",
	Ban_Hammer:"#3A3A82",
	Rocket:"#527CAE",
	Slingshot:"#499FB8",
	Hyperlaser:"#2A8DB0",
	Shuriken:"#7CC740",
	Scythe:"#23806F",
	Medkit:"#2CBEA1",
	Boombox:"#93BA49",
	Subspace:"#FF006F",
	Vine_Staff:"#FF5877",
	"Template:PhighterNav":"rgb(255,120,40)"
};

$( '.fp-discord' ).html( '<iframe src="https://discord.com/widget?id=933210573297057812&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>' );

/* Template:PhighterRainbow */

$(".pr-phighter").find("img").bind("webkitAnimationEnd mozAnimationEnd animationEnd", function(){
  $(this).removeClass("pr-animated");
});

$(".pr-phighter").find("img").hover(function(){
  $(this).addClass("pr-animated");        
});

$(".pr-phighter").find("a").attr("href","javascript:void(0);");

/* NINJISY's silly little broker */
$(".ninjisy-broker").find("img").bind("webkitAnimationEnd mozAnimationEnd animationEnd", function(){
  $(this).removeClass("pr-animated");
});

$(".ninjisy-broker").find("img").hover(function(){
  $(this).addClass("pr-animated");        
});

/* Pronoun tooltip */

if ($("h3:contains(Pronoun(s))").length > 0) {
  $("h3:contains(Pronoun(s))").next()[0].title = 'Demons are agender and use any pronouns - these are just the ones most commonly used for them!';
  $("h3:contains(Pronoun(s))").next().eq(0).addClass("pr-tooltip");
};

if(document.querySelectorAll("#ph-nav-dynamic-color").length > 0)
{
	const nodeList = document.querySelectorAll("#ph-nav-dynamic-color");
	const dynamicColor = dynamicColorLibrary[location.href.split("https://phighting.wiki/wiki/")[1].split("/")[0]];
	
	for(x in nodeList)
	{
		nodeList[x].addEventListener("mouseover", function (e)
		{
			e.style.color = dynamicColor;
			e.style.boxShadow = `5px 5px 0px 0px ${dynamicColor}`;
		});
	};
};