User:Energy X/common.js

/*importScriptPage('MultiUpload/code.js', 'dev');

nullEditDelay = 1000; importScriptPage('MediaWiki:MassNullEdit/code.js', 'dev');

var pokedex_entry = Array.from(document.querySelectorAll(".pokedex_entry")); var element_p, element_span, height, code;

for(var i = 0; i < pokedex_entry.length; i++) { element_p = Array.from(document.querySelectorAll(".pokedex_entry li p")); element_span = Array.from(document.querySelectorAll(".pokedex_entry li span"));

for(var j = 0; j < element_p.length; j++) { height = element_p[j].offsetHeight + "px"; element_span[j].style.lineHeight = height;

code = element_span[j].innerHTML;

switch (code) { case "Red and Blue": element_span[j].style.background = "linear-gradient(#F11, #11F)"; element_span[j].style.color = "white"; break;

case "Yellow": element_span[j].style.background = "yellow"; break;

case "Gold": element_span[j].style.background = "#DAA520"; break;

case "Silver": element_span[j].style.background = "#C0C0C0"; break;

case "Crystal": element_span[j].style.background = "#4FD9FF"; break;

case "Ruby": element_span[j].style.background = "#DC143C"; element_span[j].style.color = "white"; break;

case "Sapphire": element_span[j].style.background = "#0000CD"; element_span[j].style.color = "white"; break;

case "FireRed": element_span[j].style.background = "#FF7327"; break;

case "LeafGreen": element_span[j].style.background = "#00DD00"; break;

case "Emerald": element_span[j].style.background = "#00A000"; element_span[j].style.color = "white"; break;

case "Diamond": element_span[j].style.background = "#6495ED"; break;

case "Pearl": element_span[j].style.background = "#FFAAAA"; break;

case "Platinum": element_span[j].style.background = "#808080"; element_span[j].style.color = "white"; break;

case "HeartGold": element_span[j].style.background = "#BC9E00"; break;

case "SoulSilver": element_span[j].style.background = "#E1E1E1"; break;

case "Black": element_span[j].style.background = "black"; element_span[j].style.color = "white"; break;

case "White": element_span[j].style.background = "white"; break;

case "Black 2": element_span[j].style.background = "#555"; element_span[j].style.color = "white"; break;

case "White 2": element_span[j].style.background = "#ddd"; break;

case "X": element_span[j].style.background = "#005E9C"; element_span[j].style.color = "white"; break;

case "Y": element_span[j].style.background = "#D12A43"; element_span[j].style.color = "white"; break;

case "Omega Ruby": element_span[j].style.background = "#8B0000"; element_span[j].style.color = "white"; break;

case "Alpha Sapphire": element_span[j].style.background = "#00008B"; element_span[j].style.color = "white"; break;

case "Sun": element_span[j].style.background = "#FFA500"; break;

case "Moon": element_span[j].style.background = "#1E90FF"; break;

case "Ultra Sun": element_span[j].style.background = "linear-gradient(#FFA500, black)"; element_span[j].style.color = "white"; break;

case "Ultra Moon": element_span[j].style.background = "linear-gradient(#1E90FF, black)"; element_span[j].style.color = "white"; break;

case "Let's Go Pikachu": element_span[j].style.background = "#FFD733"; break;

case "Let's Go Eevee": element_span[j].style.background = "brown"; element_span[j].style.color = "white"; break;

case "Sword": element_span[j].style.background = "#0EBFE9"; break;

case "Shield": element_span[j].style.background = "#CB2241"; break; }   } } function poke_type(element_class){ var color = "black"; switch(element_class) { case "Grass": color = "green"; break; case "Fire": color = "red"; break; case "Water": color = "blue"; break; }

return color; }

/* Movebox template */

// Get class for color var table = document.querySelector(".movebox table");

var table_class_prim = table.className.split(" ")[0]; var table_class_sec = table.className.split(" ")[1]; var prim_color = poke_type(table_class_prim); var sec_color = poke_type(table_class_sec);

// If no secondary type if(sec_color.match("black")) sec_color = prim_color;

// Apply colors to borders and background table.style.borderColor = prim_color;

var table_cell = Array.from(document.querySelectorAll(".movebox table td")); var sliders = Array.from(document.querySelectorAll(".movebox .wikia-slideshow"));

var tabber = Array.from(document.querySelectorAll(".movebox .tabbertab")); //document.querySelector(".movebox .tabbernav").style.borderColor = prim_color;

for(var i = 0; i < sliders.length; i++){ sliders[i].style.background = "linear-gradient(" + prim_color + "," + sec_color + ")"; tabber[i].style.borderColor = prim_color; }

//document.querySelector(".movebox table thead").style.background = prim_color;

for(var i = 0; i < table_cell.length; i++) table_cell[i].style.borderColor = sec_color;