Greasy Fork

Greasy Fork is available in English.

Steam_ARS&pуб_to_RMB

把steam上的俄罗斯卢布和阿根廷比索换算成人民币

当前为 2021-02-10 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name Steam_ARS&pуб_to_RMB
// @namespace Steam_ARS&pуб_to_RMB
// @match https://store.steampowered.com/*
// @license MIT License
// @description 把steam上的俄罗斯卢布和阿根廷比索换算成人民币
// @version 1.3
// ==/UserScript==


var ars2rmb = 13.68
var rus2rmb = 11.5049

var price = document.querySelectorAll('.game_area_dlc_price','.game_purchase_price.price','.discount_final_price', '.btn_addtocart btn_packageinfo', '.game_purchase_price', '.game_area_dlc_price', '.global_action_link', '.salepreviewwidgets_StoreSalePriceBox_3j4dI')

function trans_ars(price) {
    let ind;
    let re = /(\D*)(\d\S*)/;
    for (ind in price) {
        if (re.test(price[ind].textContent)) {
            var matchItem = re.exec(price[ind].textContent)
            if (matchItem[1].indexOf('ARS') >= 0) {
                let p = matchItem[2].replace('.', '').replace(',', '.')
                price[ind].textContent = '¥' + (p / ars2rmb).toFixed(2)
            }
        }
    }
}


function trans_rus(price) {
    let ind;
    let re = /(\d\S*)(\D*)/;
    for (ind in price) {
        if (re.test(price[ind].textContent)) {
            var matchItem = re.exec(price[ind].textContent)
            if (matchItem[2].indexOf('pуб') >= 0) {
                let p = matchItem[1].replace('.', '').replace(',', '.')
                price[ind].textContent = '¥' + (p / rus2rmb).toFixed(2)
            }
        }
    }
}


trans_ars(price)
trans_rus(price)