Changes

Jump to: navigation, search

MediaWiki:Common.js

9 bytes added, 06:55, 16 November 2023
Amending regex again
Array.from(document.getElementsByClassName('currency-included')).forEach(function (element) {
if (!element.innerHTML.match(/Gem|Gold|Defender Medal/i)) return
const currencyRegex = /(Gem|Gold|Defender Medal)s? (\d.*?)(?= |$|\n)|(\d.*?) (Gem|Gold|Defender Medal)s?/gi
const phrases = element.innerHTML.match(currencyRegex)
phrases.forEach(function (phrase){
/* Replaces the XP keyword with the Ascension XP icon in elements which include Ascension XP numbers */
Array.from(document.getElementsByClassName('ascension-xp')).forEach(function (element) {
element.innerHTML = element.innerHTML.replace(/XP (\d.*?)(?= |$|\n)|(\d.*?) XP/gi, '<a href="/wiki/Experience" class="image"><img alt="Ascension XP Icon.png" src="/images/c/cf/Ascension_XP_Icon.png" width="18"></a> $1$2')
})
/* Replaces the XP keyword with the Defender Pass XP icon in elements which include Defender Pass XP numbers */
Array.from(document.getElementsByClassName('pass-xp')).forEach(function (element) {
element.innerHTML = element.innerHTML.replace(/XP (\d.*?)(?= |$|\n)|(\d.*?) XP/gi, '<a class="image"><img alt="Defender Pass XP Icon.png" src="/images/2/23/Defender_Pass_XP_Icon.png" width="18"></a> $1$2')
})
WikiDefender, bureaucrat, administrator
618
edits

Navigation menu