Changes

MediaWiki:Common.js

69 bytes added, 00:21, 16 November 2023
Adding a guard clause to prevent errors when currency can potentially be undefined
Array.from(document.getElementsByClassName('currency-included')).forEach(function (element) {
if (!element.innerHTML.match(/Gem|Gold|Defender Medal/i)) return
const currency = element.innerHTML.match(/Gem|Gold|Defender Medal/i).toString()
element.innerHTML = element.innerHTML.replace(/(Gem|Gold|Defender Medal)s? (\d.*?)\b|(\d.*?) (Gem|Gold|Defender Medal)s?/gi, currencyIcons[currency] + "$2$3")
WikiDefender, bureaucrat, administrator
618
edits