Difference between revisions of "MediaWiki:Common.js"
From Dungeon Defenders 2 Wiki
Line 2: | Line 2: | ||
/* Replaces the word "gems" with the gem icon in texts where gem costs are mentioned */ | /* Replaces the word "gems" with the gem icon in texts where gem costs are mentioned */ | ||
− | + | Array.from(document.getElementsByClassName('gem-cost-included')).forEach(function (element) { | |
− | element.textContent = element.textContent.replace(/gems\s*?(\d+)|(\d+)\s*?gems/ | + | element.textContent = element.textContent.replace(/gems\s*?(\d+)|(\d+)\s*?gems/gi, '[[File:Gem Icon.png|18px]] $1$2') |
}) | }) |
Revision as of 22:28, 14 February 2023
/* Any JavaScript here will be loaded for all users on every page load. */ /* Replaces the word "gems" with the gem icon in texts where gem costs are mentioned */ Array.from(document.getElementsByClassName('gem-cost-included')).forEach(function (element) { element.textContent = element.textContent.replace(/gems\s*?(\d+)|(\d+)\s*?gems/gi, '[[File:Gem Icon.png|18px]] $1$2') })