Changes

Jump to: navigation, search

MediaWiki:Common.js

2 bytes removed, 00:09, 14 December 2024
m
no edit summary
/* Any JavaScript here will be loaded for all users on every page load. */
function tabberGoTo(thisElement, tabName, id) {
let tabbertab = thisElement;
 
while (!tabbertab.classList.contains('tabbertab')) {
tabbertab = tabbertab.parentElement
}
 
const tabberParent = tabbertab.parentElement;
const tabberChildren = Array.from(tabberParent.children);
// Switch tabs
tabbertab.style.display = 'none';
tabberChildren.find(child => child.title === tabName).style.display = 'block';
 
// Handle tabbernav CSS
const nav = tabberChildren.find(child => child.classList.contains('tabbernav'));
for (const child of Array.from(nav.children)) {
if (child.firstElementChild.title === tabbertab.title) { child.classList = '' }
if (child.firstElementChild.title === tabName) { child.classList = 'tabberactive' }
}
 
document.getElementById(id).scrollIntoView({ behavior: "smooth", block: "end" })
}
/* Replaces currency keywords (Gold, Gems, Defender Medals) with their icon in elements which include currency costs */
element.innerHTML = element.innerHTML.replace(/Legendary/gi, '<a class="image"> <img alt="Legendary Icon.png" src="/images/1/11/Legendary_Icon.png" width="18"> <span style="color: #FF9900;">Legendary</span> </a>');
element.innerHTML = element.innerHTML.replace(/Godly/gi, '<a class="image"> <img alt="Godly Icon.png" src="/images/d/d0/Godly_Icon.png" width="18"> <span style="color: #00FFFF;">Godly</span> </a>');
}); function tabberGoTo(thisElement, tabName, id) { let tabbertab = thisElement;  while (!tabbertab.classList.contains('tabbertab')) { tabbertab = tabbertab.parentElement }  const tabberParent = tabbertab.parentElement; const tabberChildren = Array.from(tabberParent.children); // Switch tabs tabbertab.style.display = 'none'; tabberChildren.find(child => child.title === tabName).style.display = 'block';  // Handle tabbernav CSS const nav = tabberChildren.find(child => child.classList.contains('tabbernav')); for (const child of Array.from(nav.children)) { if (child.firstElementChild.title === tabbertab.title) { child.classList = '' } if (child.firstElementChild.title === tabName) { child.classList = 'tabberactive' } }  document.getElementById(id).scrollIntoView({ behavior: "smooth", block: "end" })}
WikiDefender, bureaucrat, administrator
725
edits

Navigation menu