// ==UserScript== // @name Steam_ARS&pуб_to_RMB // @namespace Steam_ARS&pуб_to_RMB // @match https://store.steampowered.com/* // @license MIT License // @description 把steam上的俄罗斯卢布和阿根廷比索换算成人民币 // @version 0.0.1.20210210075054 // @downloadURL none // ==/UserScript== var ars2rmb = 13.68 var rus2rmb=11.5049 var price = document.querySelectorAll('.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*)(\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] price[ind].textContent = '¥' + (p / rus2rmb).toFixed(2) } } } } trans_ars(price) trans_rus(price)