From 1e5f939be008393deb95667c7bf76c57c5c18d0d Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Tue, 28 May 2024 13:33:22 +0300 Subject: [PATCH] [SteamPriceConverter] update to 0.2 fix some bugs --- SteamPriceConverter/SteamPriceConverter.user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SteamPriceConverter/SteamPriceConverter.user.js b/SteamPriceConverter/SteamPriceConverter.user.js index 2ad0af6..aea7c0a 100644 --- a/SteamPriceConverter/SteamPriceConverter.user.js +++ b/SteamPriceConverter/SteamPriceConverter.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Steam Price Converter // @namespace https://github.com/Maks1mS/userscripts -// @version 0.1 +// @version 0.2 // @description Converts prices to rubles // @author Maxim Slipenko // @match https://store.steampowered.com/* @@ -50,8 +50,8 @@ function getCurrentValute() { const walletText = document.getElementById('header_wallet_balance').innerText; - const symbol = Object.keys(SYMBOL_TO_CODE_MAPPING).find(symbol => walletText.includes(symbol)) - return SYMBOL_TO_CODE_MAPPING[symbol]; + state.source_symbol = Object.keys(SYMBOL_TO_CODE_MAPPING).find(symbol => walletText.includes(symbol)) + return SYMBOL_TO_CODE_MAPPING[state.source_symbol]; } async function main() { @@ -69,7 +69,7 @@ } function replace(convert) { - let r = document.evaluate('//text()[contains(., \"₸\")]',document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + let r = document.evaluate(`//text()[contains(., \"${state.source_symbol}\")]`,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (let i = 0; i < r.snapshotLength; i++) { let n = r.snapshotItem(i);