Changes

MediaWiki:Common.js

3 bytes removed, 06:17, 16 November 2023
Fixing regex mistake (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.*?)(?=[ |$])|(\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.*?)(?=[ |$])|(\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.*?)(?=[ |$])|(\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