Changes

MediaWiki:Common.js

31 bytes removed, 00:16, 16 November 2023
Replacing template literals as they are not supported by ES5 and attempting to use single quotes for currencyIcons dictionary
/* Replaces currency keywords (Gold, Gems, Defender Medals) with their icon in elements which include currency costs */
const currencyIcons = {
"Gem": "'<a href=\"/wiki/Gems\" class=\"image\"><img alt=\"Gem Icon.png\" src=\"/images/8/8d/Gem_Icon.png\" width=\"18\"></a>"', "Gold": "'<a href=\"/wiki/Gold\" class=\"image\"><img alt=\"Gold Icon.png\" src=\"/images/2/26/Gold_Icon.png\" width=\"18\"></a>"', "Defender Medal": "'<a href=\"/wiki/Defender_Medals\" class=\"image\"><img alt=\"Defender Medal Icon.png\" src=\"/images/a/a7/Defender_Medal_Icon.png\" width=\"18\"></a>"'
}
Array.from(document.getElementsByClassName('currency-included')).forEach(function (element) {
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