0
0
mirror of https://github.com/Maks1mS/userscripts.git synced 2024-12-24 00:33:03 +03:00

[SteamPriceConverter] update to 0.4

fix some bugs
This commit is contained in:
Maxim Slipenko 2024-06-22 23:29:56 +03:00
parent db9d93407d
commit 5de1a557f1

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Steam Price Converter // @name Steam Price Converter
// @namespace https://github.com/Maks1mS/userscripts // @namespace https://github.com/Maks1mS/userscripts
// @version 0.3 // @version 0.4
// @description Converts prices to rubles // @description Converts prices to rubles
// @author Maxim Slipenko // @author Maxim Slipenko
// @match https://store.steampowered.com/* // @match https://store.steampowered.com/*
@ -23,6 +23,9 @@
source_symbol: undefined source_symbol: undefined
} }
const delay = (ms) =>
new Promise(resolve => setTimeout(resolve, ms));
async function getRates() { async function getRates() {
const arr = await new Promise((resolve, reject) => { const arr = await new Promise((resolve, reject) => {
GM_xmlhttpRequest({ GM_xmlhttpRequest({
@ -62,12 +65,12 @@
return; return;
} }
setTimeout(75); await delay(75);
const convert = (n) => +(n * rates[source_valute].value).toFixed(2); const convert = (n) => +(n * rates[source_valute].value).toFixed(2);
replace(convert); replace(convert);
GM_registerMenuCommand("update", () => replace(convert), "u"); // GM_registerMenuCommand("update", () => replace(convert), "u");
} }
function replace(convert) { function replace(convert) {