MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ var classFilter = ''; var factionFilter = ''; var tierFilter = '';

$(function {	$('#HeroSearch').html(''); });

$('#ClassSearch').children('div').on('click', function(e) {	var value = this.children[0].title;	if (classFilter === value)	{		classFilter = ;	}	else	{		classFilter = value	}	var p = document.getElementById("ClassSearch");	for(var i=0; i<p.children.length; i++)	{		var c = p.children[i];		if(classFilter === )		{			c.style.opacity = 1;				} 		else if (c.children[0].title === classFilter)		{			c.style.opacity = 1;		}		else		{			c.style.opacity = 0.5;			}	}	FilterHeroes; });

$('#FactionSearch').children('div').on('click', function(e) {	var value = this.children[0].title;	if (factionFilter === value)	{		factionFilter = ;	}	else	{		factionFilter = value	}	var p = document.getElementById("FactionSearch");	for(var i=0; i<p.children.length; i++)	{		var c = p.children[i];		if(factionFilter === )		{			c.style.opacity = 1;				} 		else if (c.children[0].title === factionFilter)		{			c.style.opacity = 1;		}		else		{			c.style.opacity = 0.5;			}	}	FilterHeroes; });

$('#TierSearch').children('div').on('click', function(e) {	var value = this.children[0].title;	if (tierFilter === value)	{		tierFilter = ;	}	else	{		tierFilter = value	}	var p = document.getElementById("TierSearch");	for(var i=0; i<p.children.length; i++)	{		var c = p.children[i];		if(tierFilter === )		{			c.style.opacity = 1;				} 		else if (c.children[0].title === tierFilter)		{			c.style.opacity = 1;		}		else		{			c.style.opacity = 0.5;			}	}	FilterHeroes; });

function FilterHeroes {	var heroes = document.getElementById("HeroList"); var filter = document.getElementById("HeroSearchBox").value.toUpperCase; for(var i=0; i -1; validClass = classFilter === '' || child.children["class"].innerText.toUpperCase.indexOf(classFilter.toUpperCase) > -1; validFaction = factionFilter === '' || child.children["faction"].innerText.toUpperCase.indexOf(factionFilter.toUpperCase) > -1; validTier = tierFilter === '' || child.children["tier"].innerText.toUpperCase.indexOf(tierFilter.toUpperCase) > -1; if (validText && validClass && validFaction && validTier) {			child.style.display = ''; }		else {			child.style.display = 'none'; }	} }

/* Skill search function below */

var parsingData = [ {		"type": "priority", "name": "front row", "keywords": ["FRONT ROW"] },	{		"type": "priority", "name": "back row", "keywords": ["BACK ROW"] },		{		"type": "target", "name": "self", "keywords": ["SELF", "OWN"] },	{		"type": "target", "name": "random", "keywords": ["RANDOM", "PARTY HEROES"] },	{		"type": "target", "name": "all", "keywords": ["ALL PARTY HEROES", "EXCEPT SELF"] },	{		"type": "target", "name": "mage", "keywords": ["MAGE"] },		{		"type": "target", "name": "support", "keywords": ["SUPPORT"] },		{		"type": "target", "name": "ranger", "keywords": ["RANGER"] },		{		"type": "target", "name": "tank", "keywords": ["TANK"] },	{		"type": "target", "name": "assassin", "keywords": ["ASSASSIN"] },	{		"type": "target", "name": "warrior", "keywords": ["WARRIOR"] },	{		"type": "target", "name": "penglai", "keywords": ["PENGLAI"] },		{		"type": "target", "name": "western alliance", "keywords": ["WESTERN ALLIANCE"] },   {		"type": "target", "name": "lowest HP", "keywords": ["LOWEST HP"] },   {		"type": "target", "name": "highest HP", "keywords": ["HIGHEST HP"] },	   {		"type": "target", "name": "highest ATK", "keywords": ["HIGHEST ATK"] },   {		"type": "target", "name": "lowest PDEF", "keywords": ["LOWEST PDEF", "LOWEST PHYSICAL DEFENSE"] },   {		"type": "damageType", "name": "true", "keywords": ["TRUE DAMAGE"] },   {		"type": "damageType", "name": "physical", "keywords": ["PHYSICAL DAMAGE"] },   {		"type": "damageType", "name": "magic", "keywords": ["MAGIC DAMAGE"] },   {		"type": "damageType", "name": "elemental", "keywords": ["ELEMENTAL DAMAGE"] },   {		"type": "damageType", "name": "crit", "keywords": ["CRIT DAMAGE"] },	   {		"type": "statusEffect", "name": "weaken", "keywords": ["WEAKEN"] },		   {		"type": "statusEffect", "name": "strengthen", "keywords": ["STRENGTHEN"] },   {		"type": "statusEffect", "name": "taunt", "keywords": ["TAUNT"] },   {		"type": "statusEffect", "name": "stun", "keywords": ["STUN"] },   {		"type": "statusEffect", "name": "silence", "keywords": ["SILENCE"] },	   {		"type": "statusEffect", "name": "steal", "keywords": ["STEAL"] },		   {		"type": "statusEffect", "name": "paralysis", "keywords": ["PARALYSIS"] },   {		"type": "statusEffect", "name": "poison", "keywords": ["POISON"] },	   {		"type": "statusEffect", "name": "burn", "keywords": ["BURN"] },   {		"type": "statusEffect", "name": "hidden", "keywords": ["HIDING"] },	   {		"type": "statusEffect", "name": "immune", "keywords": ["IMMUNE"] },   {		"type": "statusEffect", "name": "dispel", "keywords": ["DISPEL"] },	   {		"type": "statusEffect", "name": "purify", "keywords": ["PURIFY"] },	   {		"type": "statusEffect", "name": "guardian", "keywords": ["GUARDIAN"] },   {		"type": "statusEffect", "name": "heal", "keywords": ["CAST A HEALING", "CASTS A HEALING", "CASTING A HEALING", "CASTS A RECOVERY", "CAST A RECOVERY", "RECOVER HP", "RECOVERS HP"] },	   {		"type": "statusEffect", "name": "heal up", "keywords": ["NCREASE THE RATE OF HEALING"] },	   {		"type": "statusEffect", "name": "heal down", "keywords": ["HEALING EFFECT ON THE AFFECTED TARGET IS REDUCED"] },	{		"type": "statusEffect", "name": "HP up", "keywords": ["INCREASES SELF HP"] },	{		"type": "statusEffect", "name": "HP down", "keywords": ["DEDUCTS OF THE CASTER'S HP"] },   {		"type": "statusEffect", "name": "energy up", "keywords": ["ADDITIONAL ENERGIES", "CAST A ENERGY GRANT", "CAST AN ENERGY GRANT"] },	{		"type": "statusEffect", "name": "energy down", "keywords": ["ENERGY REDUCTION", "REDUCES ENERGIES"] },	{		"type": "statusEffect", "name": "speed up", "keywords": ["INCREASES OWN SPEED", "INCREASING THE TARGET'S SPEED", "INCREASING THEIR SPEED"] },	   {		"type": "statusEffect", "name": "speed down", "keywords": ["DECREASING SPEED", "DECREASING THE SPEED"] },   {		"type": "statusEffect", "name": "CRIT up", "keywords": ["CRIT CHANCE", "INCREASE OWN CRIT RATE"] },   {		"type": "statusEffect", "name": "CDMG up", "keywords": ["INCREASING THEIR CDMG", "INCREASE OWN CRIT DAMAGE", "INCREASING THEIR CRIT DAMAGE"] },   {		"type": "statusEffect", "name": "ATK up", "keywords": ["INCREASE ATK", "INCREASES ATK", "INCREASING SELF ATK", "INCREASES SELF ATK", "INCREASES THEIR ATK", "INCREASE THEIR ATK", "INCREASE OWN ATK", "INCREASES OWN ATK"] },	   {		"type": "statusEffect", "name": "ATK down", "keywords": ["DECREASING THE TARGET'S ATK", "DECREASING THEIR ATK"] },	   {		"type": "statusEffect", "name": "PATK down", "keywords": ["REDUCING THE TARGET'S PHYSICAL DAMAGE"] },	   {		"type": "statusEffect", "name": "DEF up", "keywords": ["INCREASING THEIR ARMOR"] },   {		"type": "statusEffect", "name": "MDEF up", "keywords": ["INCREASE THE MAGIC DEFENSE", "INCREASES THE MAGIC DEFENSE", "INCREASES SELF MAGIC DEFENSE", "INCREASES THEIR MAGIC DEFENSE"] },   {		"type": "statusEffect", "name": "MRES up", "keywords": ["INCREASE THE MAGIC RESISTANCE","INCREASES THE MAGIC RESISTANCE", "INCREASES THEIR MAGIC RESISTANCE"] },   {		"type": "statusEffect", "name": "PDEF up", "keywords": ["INCREASE THE PHYSICAL DEFENSE", "INCREASES THE PHYSICAL DEFENSE", "INCREASING THE TARGET'S PHYSICAL DEFENSE"] },	   {		"type": "statusEffect", "name": "PRES up", "keywords": ["INCREASE THE PHYSICAL RESISTANCE", "INCREASES THE PHYSICAL RESISTANCE", "INCREASE THE TARGETS' PHYSICAL RESISTANCE"] },   {		"type": "statusEffect", "name": "PDEF down", "keywords": ["DECREASING THE AFFECTED TARGET'S PHYSICAL DEFENSE"] }];

function FilterSkills {	var list = document.getElementById("skills"); var oneIsChecked = false; for(var i=0; i -1) {					found = true; break; }			}			if (found) {				list.children[i].style.display = 'flex'; }			else {				list.children[i].style.display = 'none'; }		}		else {			list.children[i].style.display = 'flex'; }	} }

// populate keywords $(function {	var searchPriority = document.getElementById("SearchPriority");	var searchTarget = document.getElementById("SearchTarget");	var searchDamageType = document.getElementById("SearchDamageType");	var searchEffect = document.getElementById("SearchEffect");	for (var i=0; i'+data.name+' ';				break;			case "target":				searchTarget.innerHTML += ''+data.name+' ';				break;			case "damageType":				searchDamageType.innerHTML += ''+data.name+' ';				break;			case "statusEffect":				searchEffect.innerHTML += ''+data.name+' '; break; }	}	var list = document.getElementById("skills");

for(var i=0; i -1) {					if (output.innerText === '') {						output.innerText = data.name; }					else {						output.innerText = output.innerText + ", " + data.name; }					break; }			}		}	} });