您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
买买买
当前为
// ==UserScript== // @name c5 extension // @namespace // @version 1.0 // @description 买买买 // @author out // @match *://www.c5game.com/* // @grant GM_xmlhttpRequest // @grant GM_addStyle // @require https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js // @connect steamcommunity.com // @namespace out // ==/UserScript== (function() { 'use strict'; // Your code here... $(document).ready(function(){ GM_addStyle(".price > div{margin:5px 0px;font-size:14px;}" +".price > div:nth-child(1) span{color:#e46409;}" +".price > div:nth-child(2) span{color:#7ccc35;}" +".price > div:nth-child(3) span{color:#1ee44a;}" +".price > div > span{ text-align:center;display:-moz-inline-box; display:inline-block; width:80px;}" +".sb{font-size:14px;}" +".sb > strong:nth-child(1){margin-left:70px;}" +".sb > strong:nth-child(2){margin-left:50px;}" ); if($(".right_steam").length!==0){ var href = $(".right_steam a").attr("href"); GM_xmlhttpRequest({ method: "GET", url: href, timeout:5000, onload: function(res){ if(res.status == "200" &&res.responseText!=="null"){ var g_sessionID = res.responseText.match(/g_sessionID = "([^"]+)"/)[1]; var g_walletCurrency = parseInt(res.responseText.match(/"wallet_currency":(\d+)/)[1]); var g_strLanguage = res.responseText.match(/g_strLanguage = "([^"]+)"/)[1]; var g_strCountryCode = res.responseText.match(/g_strCountryCode = "([^"]+)"/)[1]; var nameid = res.responseText.match(/Market_LoadOrderSpread\( (\d+)/)[1]; if(!nameid) return; GM_xmlhttpRequest({ timeout:5000, method: "GET", url: "https://steamcommunity.com/market/itemordershistogram?country=" + g_strCountryCode + "&language=" + g_strLanguage + "¤cy=" + g_walletCurrency + "&item_nameid=" + nameid, responseType: "json", onload: function(data){ var obj = data.response; if(obj){ if(!obj.lowest_sell_order&&!obj.highest_buy_order) return; $("div.hero > span:first").hide(); $("div.hero > div.right_steam").css("float","none"); var $pinfo = $("<div class=\"price\"><div><strong>价格:</strong><span></span><span></span></div><div><strong>税后:</strong><span></span><span></span></div><div><strong>比例:</strong><span></span><span></span></div>"); if(obj.lowest_sell_order){ var lowest_sell_order = parseInt(obj.lowest_sell_order); $pinfo.find("span:eq(0)").text(obj.price_prefix + " " + lowest_sell_order/100); var lsnofee = calcfee(lowest_sell_order); $pinfo.find("span:eq(2)").text(obj.price_prefix + " " + lsnofee/100); } if(obj.highest_buy_order){ var highest_buy_order = parseInt(obj.highest_buy_order); $pinfo.find("span:eq(1)").text(obj.price_prefix + " " + highest_buy_order/100); var hbnofee = calcfee(highest_buy_order); $pinfo.find("span:eq(3)").text(obj.price_prefix + " " + hbnofee/100); } $("div.hero").css("margin","5px 0px"); $("div.hero").parent().append($("<div class=\"sb\"><strong>出售</strong><strong>求购</strong></div>")).append($pinfo); calcratio(lsnofee,hbnofee); } }, ontimeout:steam302, onerror: steam302 }); } }, ontimeout:steam302, onerror: steam302 }); } function steam302(){ $("div.hero").parent().append($("<div style=\"color:#FF0033;\"><strong>查询超时,建议使用<a href=\"https://steamcn.com/t339527-1-1\">Steam302</a></strong></div>")); } function getFloat(str){ if(str.indexOf(".")!=-1){ var xs = str.length-str.indexOf(".")-1; var price = parseFloat(str.replace(/[^0-9]/ig,"")); while(xs){ price/=10; xs--; } return price; } return parseFloat(str.replace(/[^0-9]/ig,"")); } function calcfee(p){ var pnofee = Math.max(Math.floor(p/1.15),1); var vfee = Math.max(Math.floor(pnofee*0.1),1); var pfee = Math.max(Math.floor(pnofee*0.05),1); while((pnofee + vfee + pfee) != p){ if((pnofee + vfee + pfee) > p) pnofee--; if((pnofee + vfee + pfee) < p) pnofee++; vfee = Math.max(Math.floor(pnofee*0.1),1); pfee = Math.max(Math.floor(pnofee*0.05),1); } return pnofee; } function calcratio(l,h){ var t = setInterval(function(){ var c5_price = getFloat($(".sale-item-lists span.ft-orange:first").text()); if(!c5_price){ c5_price = getFloat($(".sale-item-lists span.ft-gold:first").text()); } if(c5_price){ var $pinfo = $("div.price"); if(l) $pinfo.find("span:eq(4)").text((c5_price*100/l).toFixed(2)); if(h) $pinfo.find("span:eq(5)").text((c5_price*100/h).toFixed(2)); clearInterval(t); } },500); } }); })();