Skip to content

Instantly share code, notes, and snippets.

@skrashevich
Last active May 14, 2025 10:57
Show Gist options
  • Save skrashevich/117f8c4d9d8f3add3a996a162a37d929 to your computer and use it in GitHub Desktop.
Save skrashevich/117f8c4d9d8f3add3a996a162a37d929 to your computer and use it in GitHub Desktop.
Steam Currency Convert: Convert KZT to RUB
// ==UserScript==
// @name Steam Currency Convert: Convert KZT to RUB
// @description View KZT prices on Steam in RUB
// @version 0.1
// @author Sergei Krashevich
// @namespace SteamKZTRUB
// @match https://store.steampowered.com/*
// @downloadURL https://gist.githubusercontent.com/skrashevich/117f8c4d9d8f3add3a996a162a37d929/raw/SteamKZTtoRUBconvert.user.js
// @updateURL https://gist.githubusercontent.com/skrashevich/117f8c4d9d8f3add3a996a162a37d929/raw/SteamKZTtoRUBconvert.user.js
// @license MIT License
// ==/UserScript==
(function() {
'use strict';
// При текущем курсе (14.05.2025): 1 RUB = 6.3946 KZT
var er = 6.3946;
var labels = [
'discount_original_price',
'discount_final_price',
'game_purchase_price',
'game_area_dlc_price',
'global_action_link',
'salepreviewwidgets_StoreSalePriceBox_3j4dI',
'cart_estimated_total',
'price'
];
function moneyExchange(labels) {
var re = /(\D*)([\d\.,]+)/;
labels.forEach(function(label) {
var elems = document.querySelectorAll('.' + label);
if (!elems.length) return;
elems.forEach(function(el) {
var text = el.textContent.trim();
var m = re.exec(text);
if (m && m[1].indexOf('KZT') >= 0) {
// Убираем разделители тысяч и меняем запятую на точку
var p = m[2].replace(/\./g, '').replace(',', '.');
var rub = (parseFloat(p) / er).toFixed(2);
el.textContent = '₽' + rub;
}
});
});
}
// Ждём подгрузки страницы
setTimeout(function() {
moneyExchange(labels);
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment