您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Exchange price on steam
当前为
// ==UserScript== // @name Steam Price Exchanger // @namespace http://tampermonkey.net/ // @version 0.1 // @description Exchange price on steam // @author lzt // @match https://store.steampowered.com/* // @grant GM_xmlhttpRequest // @connect qq.ip138.com // @run-at document-end // ==/UserScript== (function() { 'use strict'; // Your code here... var rub = null var ars = null GM_xmlhttpRequest({ method: "get", url: 'https://qq.ip138.com/hl.asp?from=RUB&to=CNY&q=1', responseType: 'document', onload: function(r) { rub = parseFloat(r.response.getElementsByTagName('tr')[2].childNodes[2].innerText); console.log(rub + " RUB/CNY"); fillprice(rub, 'pуб'); } }); GM_xmlhttpRequest({ method: "get", url: 'https://qq.ip138.com/hl.asp?from=ARS&to=CNY&q=1', responseType: 'document', onload: function(r) { ars = parseFloat(r.response.getElementsByTagName('tr')[2].childNodes[2].innerText); console.log(ars + " ARS/CNY"); fillprice(ars, 'ARS'); } }); function fillprice(rate, unit){ var lists = document.evaluate("//*[contains(text(), '" + unit + "')]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ) for(let i = 0; i < lists.snapshotLength; i++) { var re = new RegExp(unit == "ARS"?"ARS\\$?\\s*[0-9.,]+":"[0-9.,]+\\s*pуб.?", "ig") var s = lists.snapshotItem(i).firstChild.nodeValue.match(re) if (s != null) { for(let j = 0; j < s.length; j++) { var price = s[j].replace(".", "") price = price.replace(",", ".") price = "¥" + parseInt(parseFloat(price.match(/[0-9.]+/))*rate).toString() lists.snapshotItem(i).firstChild.nodeValue = lists.snapshotItem(i).firstChild.nodeValue.replace(s[j], s[j] + "(" + price + ")") } } } } })();