网易BUFF价格比例(找挂刀)插件

找挂刀,看比例,挑玄学

安裝腳本?
作者推薦腳本

您可能也會喜歡 CSGO饰品2D/3D对比

安裝腳本
  1. // ==UserScript==
  2. // @name 网易BUFF价格比例(找挂刀)插件
  3. // @icon https://s1.ax1x.com/2022/03/25/qt3mcj.png
  4. // @description 找挂刀,看比例,挑玄学
  5. // @version 2.4.41
  6. // @note 更新于 2024-10-27 14:00:06.936
  7. // @author Pronax
  8. // @homepageURL https://gf.qytechs.cn/zh-CN/users/412840-newell-gabe-l
  9. // @license AGPL-3.0
  10. // @copyright 2021, Pronax
  11. // @include /https:\/\/buff\.163\.com\/(market|goods)\/(csgo|dota2|rust|h1z1|tf2|pubg|pubg_recycle|\d+)/
  12. // @run-at document-body
  13. // @grant GM_info
  14. // @grant GM_addStyle
  15. // @grant GM_setValue
  16. // @grant GM_getValue
  17. // @grant GM_xmlhttpRequest
  18. // @grant GM_registerMenuCommand
  19. // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-toast-plugin/1.3.2/jquery.toast.min.js
  20. // @connect steamcommunity.com
  21. // @namespace https://gf.qytechs.cn/zh-CN/users/412840-newell-gabe-l
  22. // ==/UserScript==
  23.  
  24. (function () {
  25.  
  26. 'use strict';
  27.  
  28. // 防止重复安装冲突
  29. if ($(".logo").hasClass("buffHelperLoaded")) { return; }
  30. $(".logo").addClass("buffHelperLoaded");
  31.  
  32. // 全局(插件环境)异常捕获
  33. window.onerror = function (e) {
  34. try {
  35. // e.returnValue = false; 值为false时不会触发console.error事件
  36. if (!e.error) { return; } // 通常是浏览器内各种原因导致的报错
  37. let scriptName = undefined;
  38. // let errorType = undefined; 也许可以用来区分scriptManager,但是现在用不上
  39. let renderingEngine = window.navigator.userAgent.match(/(Chrome|Firefox)\/([^ ]*)/);
  40. let lineno = e.lineno;
  41. switch (renderingEngine && renderingEngine[1]) {
  42. case "Chrome":
  43. // chrome+TamperMonkey在这个脚本内报错的情况下会需要两次decode
  44. scriptName = decodeURIComponent(decodeURIComponent(e.filename.match(/([^\/=]*)\.user\.js/)[1]));
  45. lineno -= 534;
  46. // errorType = e.message.match(/^Uncaught ([a-zA-Z]*): /)[1];
  47. break;
  48. case "Firefox":
  49. scriptName = decodeURIComponent(e.error.stack.match(/\/([^\/]*)\.user\.js/)[1]).trim();
  50. lineno -= 1;
  51. // errorType = e.message.match(/^([a-zA-Z]*): /)[1];
  52. break;
  53. default:
  54. return;
  55. }
  56. if (scriptName == "网易BUFF价格比例(找挂刀)插件") {
  57. let colno = e.colno;
  58. let errorMsg = e.error.message;
  59. let msgBody = `内核:${renderingEngine[0]}<br/>版本:${GM_info.script.version}<br/>区域:${helper_config.steamCurrency} ${steamConnection ? 200 : steamConnection == undefined ? "Unknow" : 404}<br/>位置:${lineno}:${colno}<br/>信息:${errorMsg}<br/>路径:${location.pathname}<br/>哈希:${location.hash}`;
  60. let msgHtml = `恭喜!你可能发现了一个bug<hr/>${msgBody}<hr/>点击下面的链接可以直接进行反馈<br/><a href='mailto:funkyturkey@yeah.net?subject=【${GM_info.script.version}】${lineno}:${colno} ${errorMsg}&body=${encodeURIComponent(msgBody.replaceAll("<br/>", "\r\n"))}'>邮件反馈</a><a href="https://gf.qytechs.cn/zh-CN/scripts/410137/feedback#post-discussion" target="_blank">反馈贴反馈</a>`;
  61. showMessage("出现了意料之外的错误", msgHtml, "error", false);
  62. } else {
  63. console.log(`插件名称:${scriptName}\n代码位置:${e.lineno}:${e.colno}\n错误信息:${e.message}`);
  64. }
  65. } catch {
  66. console.warn("unhandled 捕获了一个错误:", e);
  67. }
  68. }
  69.  
  70. const STEAM_ORDER_SCALE_TEMPLATE = "<span class=\"f_12px f_Bold l_Right steam_temp steam_order_scale\"></span>";
  71. const STEAM_SOLD_NUMBER_TEMPLATE = "<span class=\"f_12px c_Green f_Bold l_Right steam_temp steam_sold_number\"></span>";
  72. const STEAM_ORDER_NUMBER_TEMPLATE = "<span class=\"f_12px c_Gray f_Bold l_Right steam_temp steam_order_number\"></span>";
  73. const ERROR_TEMPLATE = "<span class=\"f_12px c_Error f_Bold l_Right steam_temp steam_order_number_error\"></span>";
  74. const WARNING_TEMPLATE = "<span class=\"f_12px c_Orange f_Bold l_Right steam_temp steam_order_number_error\"></span>";
  75. const INFO_TEMPLATE = "<span class=\"f_12px c_Blue f_Bold l_Right steam_temp steam_order_number_error\"></span>";
  76. const HIGHLIGHT_TEMPLATE = "<span class=\"f_12px c_Highlight f_Bold l_Right steam_temp steam_order_number_error\"></span>";
  77. const ENHANCEMENT_SUPPORT_LIST = Array("rifle", "knife", "pistol", "smg", "machinegun", "shotgun", "hands");
  78. const DEFAULT_CONFIG = {
  79. maxRange: 1,
  80. minRange: 0.63,
  81. needSort: null,
  82. pageSize: 20,
  83. reverseSticker: false,
  84. orderFloatLeft: false,
  85. overrideSortRule: false,
  86. sortAfterAllDone: true,
  87. marketColorLow: "#ff1e1e",
  88. marketColorHigh: "#5027ff",
  89. steamCurrency: "CNY",
  90. currencyEffectCalculate: false,
  91. displaySoldNumber: false,
  92. buffSellThreshold: 0,
  93. };
  94.  
  95. const g_rgCurrencyData = { "AED": { "strCode": "AED", "eCurrencyCode": 32, "strSymbol": "AED", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "ARS": { "strCode": "ARS", "eCurrencyCode": 34, "strSymbol": "ARS$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": " " }, "AUD": { "strCode": "AUD", "eCurrencyCode": 21, "strSymbol": "A$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "BRL": { "strCode": "BRL", "eCurrencyCode": 7, "strSymbol": "R$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": " " }, "CAD": { "strCode": "CAD", "eCurrencyCode": 20, "strSymbol": "CDN$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "CHF": { "strCode": "CHF", "eCurrencyCode": 4, "strSymbol": "CHF", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": " ", "strSymbolAndNumberSeparator": " " }, "CLP": { "strCode": "CLP", "eCurrencyCode": 25, "strSymbol": "CLP$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": " " }, "CNY": { "strCode": "CNY", "eCurrencyCode": 23, "strSymbol": "¥", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "COP": { "strCode": "COP", "eCurrencyCode": 27, "strSymbol": "COL$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": " " }, "CRC": { "strCode": "CRC", "eCurrencyCode": 40, "strSymbol": "₡", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": "" }, "CZK": { "strCode": "CZK", "eCurrencyCode": 44, "strSymbol": "Kč", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "DKK": { "strCode": "DKK", "eCurrencyCode": 45, "strSymbol": "kr.", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "EUR": { "strCode": "EUR", "eCurrencyCode": 3, "strSymbol": "€", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ",", "strThousandsSeparator": " ", "strSymbolAndNumberSeparator": "" }, "GBP": { "strCode": "GBP", "eCurrencyCode": 2, "strSymbol": "£", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "HKD": { "strCode": "HKD", "eCurrencyCode": 29, "strSymbol": "HK$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "HRK": { "strCode": "HRK", "eCurrencyCode": 43, "strSymbol": "kn", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "HUF": { "strCode": "HUF", "eCurrencyCode": 46, "strSymbol": "Ft", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "IDR": { "strCode": "IDR", "eCurrencyCode": 10, "strSymbol": "Rp", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ".", "strThousandsSeparator": " ", "strSymbolAndNumberSeparator": " " }, "ILS": { "strCode": "ILS", "eCurrencyCode": 35, "strSymbol": "₪", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "INR": { "strCode": "INR", "eCurrencyCode": 24, "strSymbol": "₹", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "JPY": { "strCode": "JPY", "eCurrencyCode": 8, "strSymbol": "¥", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "KRW": { "strCode": "KRW", "eCurrencyCode": 16, "strSymbol": "₩", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "KWD": { "strCode": "KWD", "eCurrencyCode": 38, "strSymbol": "KD", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "KZT": { "strCode": "KZT", "eCurrencyCode": 37, "strSymbol": "₸", "bSymbolIsPrefix": false, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": " ", "strSymbolAndNumberSeparator": "" }, "MXN": { "strCode": "MXN", "eCurrencyCode": 19, "strSymbol": "Mex$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "MYR": { "strCode": "MYR", "eCurrencyCode": 11, "strSymbol": "RM", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "NOK": { "strCode": "NOK", "eCurrencyCode": 9, "strSymbol": "kr", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": " " }, "NZD": { "strCode": "NZD", "eCurrencyCode": 22, "strSymbol": "NZ$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "PEN": { "strCode": "PEN", "eCurrencyCode": 26, "strSymbol": "S/.", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "PHP": { "strCode": "PHP", "eCurrencyCode": 12, "strSymbol": "P", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "PLN": { "strCode": "PLN", "eCurrencyCode": 6, "strSymbol": "zł", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ",", "strThousandsSeparator": " ", "strSymbolAndNumberSeparator": "" }, "QAR": { "strCode": "QAR", "eCurrencyCode": 39, "strSymbol": "QR", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "RMB": { "strCode": "RMB", "eCurrencyCode": 23, "strSymbol": "¥", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "RON": { "strCode": "RON", "eCurrencyCode": 47, "strSymbol": "lei", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "RUB": { "strCode": "RUB", "eCurrencyCode": 5, "strSymbol": "pуб.", "bSymbolIsPrefix": false, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": "", "strSymbolAndNumberSeparator": " " }, "SAR": { "strCode": "SAR", "eCurrencyCode": 31, "strSymbol": "SR", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "SEK": { "strCode": "SEK", "eCurrencyCode": 33, "strSymbol": "kr", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "SGD": { "strCode": "SGD", "eCurrencyCode": 13, "strSymbol": "S$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "THB": { "strCode": "THB", "eCurrencyCode": 14, "strSymbol": "฿", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "TRY": { "strCode": "TRY", "eCurrencyCode": 17, "strSymbol": "TL", "bSymbolIsPrefix": false, "bWholeUnitsOnly": false, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": " " }, "TWD": { "strCode": "TWD", "eCurrencyCode": 30, "strSymbol": "NT$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": " " }, "UAH": { "strCode": "UAH", "eCurrencyCode": 18, "strSymbol": "₴", "bSymbolIsPrefix": false, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": " ", "strSymbolAndNumberSeparator": "" }, "USD": { "strCode": "USD", "eCurrencyCode": 1, "strSymbol": "$", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": ",", "strSymbolAndNumberSeparator": "" }, "UYU": { "strCode": "UYU", "eCurrencyCode": 41, "strSymbol": "$U", "bSymbolIsPrefix": true, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": "" }, "VND": { "strCode": "VND", "eCurrencyCode": 15, "strSymbol": "₫", "bSymbolIsPrefix": false, "bWholeUnitsOnly": true, "strDecimalSymbol": ",", "strThousandsSeparator": ".", "strSymbolAndNumberSeparator": "" }, "ZAR": { "strCode": "ZAR", "eCurrencyCode": 28, "strSymbol": "R", "bSymbolIsPrefix": true, "bWholeUnitsOnly": false, "strDecimalSymbol": ".", "strThousandsSeparator": " ", "strSymbolAndNumberSeparator": " " } }
  96. const g_rgWalletInfo = {
  97. "wallet_currency": 23,
  98. "wallet_country": "CN",
  99. "wallet_state": "",
  100. "wallet_fee": "1",
  101. "wallet_fee_minimum": "1",
  102. "wallet_fee_percent": "0.05",
  103. "wallet_publisher_fee_percent_default": "0.10",
  104. "wallet_fee_base": "0",
  105. "wallet_balance": "20028",
  106. "wallet_delayed_balance": "0",
  107. "wallet_max_balance": "1300000",
  108. "wallet_trade_max_balance": "1170000"
  109. }
  110.  
  111. var helper_config = loadConfig();
  112. var steamCurrency;
  113. var exchangeRate = GM_getValue("exchangeRate") || {
  114. FtoC: 1,
  115. CtoF: 1,
  116. time_next_update_unix: 0,
  117. time_update_unix: 0
  118. };
  119. var ajaxTimeout = 20000;
  120. var steamConnection = undefined;
  121. var steamFailedTimes = 0;
  122. var market_color_high = [];
  123. var market_color_low = [];
  124. var itemCount = 0;
  125. var itemNum = 0;
  126. var needSort;
  127.  
  128. // 翻页类的操作没有重新加载的必要,用var可以直接当缓存用,不过只适用某个具体商品详情页
  129. var steam_lowest_sell_order = 0; // steam最低出售价
  130. var steam_highest_buy_order = 0; // steam最高求购价
  131.  
  132. // toast CSS
  133. GM_addStyle(".jq-toast-wrap{display:block;position:fixed;width:250px;pointer-events:none!important;margin:0;padding:0;letter-spacing:normal;z-index:9000!important}.jq-toast-wrap *{margin:0;padding:0}.jq-toast-wrap.bottom-left{bottom:20px;left:20px}.jq-toast-wrap.bottom-right{bottom:20px;right:40px}.jq-toast-wrap.top-left{top:20px;left:20px}.jq-toast-wrap.top-right{top:20px;right:74px}.jq-toast-single{display:block;width:100%;padding:10px;margin:0 0 5px;border-radius:4px;font-size:15px;font-family:arial,sans-serif;line-height:18px;position:relative;pointer-events:all!important;background-color:#444;color:white;white-space:normal;word-break:break-all;overflow:hidden}.jq-toast-single hr{border:1px solid #fff;margin:4px 0}.jq-toast-single h2{font-family:arial,sans-serif;font-size:18px;font-weight:bold;margin:0 0 7px;background:0;color:inherit;line-height:inherit;letter-spacing:normal}.jq-toast-single a{color:#eee;text-decoration:none;font-weight:bold;border-bottom:1px solid white;margin-right:8px}.jq-toast-single ul{margin:0 0 0 15px;background:0;padding:0}.jq-toast-single ul li{list-style-type:disc!important;line-height:17px;background:0;margin:0;padding:0;letter-spacing:normal}.close-jq-toast-single{position:absolute;top:2px;right:5px;font-size:22px;cursor:pointer}.jq-toast-loader{display:block;position:absolute;bottom:0;height:4px;width:0;left:0;background:#000!important;opacity:.4}.jq-toast-loaded{width:100%}.jq-has-icon{padding:10px 10px 10px 43px;background-repeat:no-repeat;background-position:10px}.jq-icon-info{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=');background-color:#2878c1e6;color:#d9edf7;border-color:#bce8f1}.jq-icon-warning{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=');background-color:#F89406cc;color:#fcf8e3;border-color:#faebcc}.jq-icon-error{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=');background-color:#d4372fcc;color:#f2dede;border-color:#ebccd1}.jq-icon-success{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==');color:#dff0d8;background-color:#059850e6;border-color:#d6e9c6}.jq-icon-info:hover{background-color:#2878c1}.jq-icon-warning:hover{background-color:#e48b06}.jq-icon-error:hover{background-color:#c53d36}.jq-icon-success:hover{background-color:#059850}");
  134. // 设置界面
  135. GM_addStyle(".helper_importantA{font-size:22px;font-weight:bold;color:#ffa914 !important}.helper_importantA:hover{color:#ff2c2c !important}.helper-setting input[type=number]{max-width:70px}input[type=\"number\"]{-moz-appearance:textfield}.helper-setting-shadow{position:fixed;justify-content:center;align-items:center;display:none;z-index:100;top:0;right:0;bottom:0;left:0;margin:0;background:#00000066}.helper-setting{background:#fff;border-radius:5px;padding:30px 40px 10px;top:25%;opacity:0.95;}.w-Checkbox.helper-setting-option>span:first-child{margin:0!important;font-size:14px}.helper-setting-steamConnection i.icon{margin-left:0!important}.helper-setting .list_tb span,.helper-setting .list_tb i.icon{margin-left:12px}.helper-setting .icon_status_progressing{animation:rotate-L 1.5s linear infinite;-webkit-animation:rotate-L 1.5s linear infinite}.helper-setting>.list_tb tr:last-child>td{border-bottom:0}.helper-setting td.setting-title{height:0;border:0;padding:5px 0 0 0}");
  136. $("body").append('<div class="cont_main helper-setting-shadow"><div class="helper-setting"><b>基础设定</b><span id="helper-version" style="float: right;">插件版本:</span><table class="list_tb"><tbody><tr><td class="t_Left c_Gray">STEAM连接性:</td><td class="t_Left helper-setting-steamConnection"><span class="c_Yellow"><i class="icon icon_status_waiting"></i>未知</span></td><td class="t_Right"><span class="c_DGrey steamConnectionCountdown" style="display: none;"></span><a href="javascript:void(0);" id="helper-setting-checkBtn" class="i_Btn i_Btn_small">检测</a></td></tr><tr><td class="t_Left c_Gray">Steam参考货币</td><td class="t_Left" colspan="2"><span><div id="helper-setting-currency" class="w-Select helper-setting-option" data-option-target="steamCurrency" style="width: 120px; visibility: visible;"><h3 style="margin:0;font-weight:normal;">默认</h3><i class="icon icon_drop"></i><ul style="width: 120px;height: 200px;overflow: auto;" class="steam-currency-selector"></ul></div></span><i class="icon icon_qa j_tips_handler helper-warning-currency" data-title="说明:" data-content="选择获取steam数据时使用什么货币,会影响税后价格、求购价格等\n默认为CNY(¥)" data-direction="right"></i><span><div id="helper-setting-currencyEffectCalculate" class="w-Checkbox helper-setting-option" data-option-target="currencyEffectCalculate" value=""><span value="true"><i class="icon icon_checkbox"></i>无视汇率</span></div></span><i class="icon icon_qa j_tips_handler helper-warning-currency" data-title="说明:" data-content="勾选后不会将外币转回人民币进行计算(无特殊需求不用开)" data-direction="right"></i></td></tr></tbody><tbody><tr><td class="t_Left setting-title" colspan="3"><b>市场页设定</b></td></tr><tr><td class="t_Left c_Gray">在售数量门槛</td><td class="t_Left"><span><input type="number" id="helper-setting-buffSellThreshold" data-option-target="buffSellThreshold" class="i_Text helper-setting-option" min="0" step="1"></span><i class="icon icon_qa j_tips_handler helper-warning-sell-threshold" data-title="说明:" data-content="在售量小于设定值的商品会被略过,可以减少对steam的请求" data-direction="right"></i></td><td class="t_Right"></td></tr><tr><td class="t_Left c_Gray" width="120">覆盖排序规则</td><td class="t_Left"><span><div id="helper-setting-stickerSort" class="w-Checkbox helper-setting-option" data-option-target="overrideSortRule" value=""><span value="true"><i class="icon icon_checkbox"></i>启用 </span></div></span><i class="icon icon_qa j_tips_handler" data-title="说明:" data-content="开启后使用buff排序时插件不进行排序(可以手动排,不影响设置)" data-direction="right"></i></td><td class="t_Right"></td></tr><tr><td class="t_Left c_Gray" width="120">完成后排序</td><td class="t_Left"><span><div id="helper-setting-sortAfterAllDone" class="w-Checkbox helper-setting-option" data-option-target="sortAfterAllDone" value=""><span value="true"><i class="icon icon_checkbox"></i>启用 </span></div></span><i class="icon icon_qa j_tips_handler" data-title="说明:" data-content="等待所有饰品比例都加载完成后再进行排序" data-direction="right"></i></td><td class="t_Right"></td></tr><tr><td class="t_Left c_Gray">默认排序规则</td><td class="t_Left"><span><div id="helper-setting-sortRule" class="w-Select helper-setting-option" data-option-target="needSort" style="visibility: visible;"><h3 style="margin:0;font-weight:normal;">不排序</h3><i class="icon icon_drop"></i><ul style="width: 130px;"><li value="null">不排序</li><li value="buff-sort_asc">按buff比例从低到高</li><li value="buff-sort_desc">按buff比例从高到低</li><li value="order-sort_asc">按求购比例从低到高</li><li value="order-sort_desc">按求购比例从高到低</li></ul></div></span></td><td class="t_Right"><i class="icon icon_qa j_tips_handler" data-title="说明:" data-content="只能排序当前加载的页面,全局排序请自行寻找其他插件" data-direction="right"></i></td></tr><tr><td class="t_Left c_Gray">每页显示数量</td><td class="t_Left"><span><input type="number" id="helper-setting-pageSize" data-option-target="pageSize" class="i_Text helper-setting-option" min="1" max="80" step="1"></span><i class="icon icon_qa j_tips_handler helper-warning-pageNum" data-title="修改每页显示数量" data-content="可能增加封号概率,小白勿用,默认值20,最大值80" data-direction="right"></i></td><td class="t_Right"></td></tr><tr><td class="t_Left c_Gray">渐变色</td><td class="t_Left" colspan="2"><span class="c_DGray">最小 <input type="color" id="helper-setting-marketColorLow" data-option-target="marketColorLow" class="helper-setting-option"></span><i class="icon icon_qa j_tips_handler" data-title="" data-content="渐变最小值:比例越接近最小值(默认是0.63)会越趋近这个颜色\n渐变最大值:比例越接近最大值(默认是1)会越趋近这个颜色" data-direction="bottom"></i><span class="c_DGray">最大 <input type="color" id="helper-setting-marketColorHigh" data-option-target="marketColorHigh" class="helper-setting-option"></span></td></tr><tr><td class="t_Left c_Gray">比例极值</td><td class="t_Left" colspan="2"><span class="c_DGray">最小 <input type="number" id="helper-setting-minRange" data-option-target="minRange" class="i_Text helper-setting-option" min="0" max="1" step="0.01"></span><i class="icon icon_qa j_tips_handler" data-title="" data-content="比例最小值:小于等于这个值的比例会直接渲染成最小值渐变色\n比例最大值:大于等于这个值的比例会直接渲染成最大值渐变色" data-direction="bottom"></i><span class="c_DGray">最大 <input type="number" id="helper-setting-maxRange" data-option-target="maxRange" class="i_Text helper-setting-option" min="1" max="100"></span></td></tr></tbody><tbody><tr><td class="t_Left setting-title" colspan="3"><b>商品页设定</b></td></tr><tr><td class="t_Left c_Gray">求购列表靠左显示</td><td class="t_Left"><span><div id="helper-setting-orderFloatLeft" class="w-Checkbox helper-setting-option" data-option-target="orderFloatLeft"><span value="true"><i class="icon icon_checkbox"></i>启用 </span></div></span><i class="icon icon_qa j_tips_handler" data-title="说明:" data-content="决定求购列表是否显示在左侧(饰品图片之后)" data-direction="right"></i></td><td class="t_Right"></td></tr><tr><td class="t_Left c_Gray">反向贴纸顺序</td><td class="t_Left"><span><div id="helper-setting-reverseSticker" class="w-Checkbox helper-setting-option" data-option-target="reverseSticker"><span value="true"><i class="icon icon_checkbox"></i>启用 </span></div></span><i class="icon icon_qa j_tips_handler" data-title="说明:" data-content="将饰品贴纸的顺序倒转,保持和检视时枪上的顺序一样" data-direction="right"></i></td><td class="t_Right"></td></tr><tr><td class="t_Center" colspan="3"><a href="https://gf.qytechs.cn/zh-CN/scripts/410137" class="helper_importantA">插件免费 请勿上当 官网安装 防止盗号</a><br /></td></tr><tr><td class="t_Center" colspan="3"><a href="https://gf.qytechs.cn/zh-CN/scripts/410137">插件官网</a><span><a href="https://gf.qytechs.cn/zh-CN/scripts/410137#support">常见问题</a></span><span><a href="javascript:void(0);" id="helper-setting-resetAll" class="i_Btn i_Btn_small">恢复默认设置</a></span><span><a href="https://gf.qytechs.cn/zh-CN/scripts/410137#additional-info">使用教程</a></span><span><a href="https://gf.qytechs.cn/zh-CN/scripts/410137/feedback#post-discussion">问题反馈</a></span></td></tr></tbody></table></div></div>');
  137. // 初始化货币
  138. initCurrency();
  139. // 添加翻页和设置按钮,初始化部分数据
  140. initHelper();
  141.  
  142. if (location.pathname.startsWith("/goods/")) {
  143. // 自带css
  144. GM_addStyle(".market_commodity_orders_header_promote {color: whitesmoke;}#steam_sold{margin-top:5px}#steam_order{margin-top:5px}#steam_order_error{margin-top:5px;font-size: medium;font-weight: bold;color: #ff1e3e;}.market_listing_price_with_fee{color: #ffae3a;font-size: 12px;margin-left: 6px;}");
  145. GM_addStyle(".steam-link{float:right;margin-top:3px}.detail-cont>.blank20{height:10px}");
  146. // 组件css
  147. GM_addStyle(".paymentIcon{padding:1px 17px 0 !important;position:absolute}a.j_shoptip_handler{margin-right:10px}.user-thum{margin: 0;}.list_tb_csgo>tr>th:first-child{width:5px}.list_tb_csgo>tr>th:nth-child(2){padding-right:9px}.list_tb_csgo>tr>th:nth-child(4){min-width:185px !important}.list_tb_csgo .pic-cont{width:112px;height:84px}.list_tb_csgo .pic-cont img{height:100%;}.csgo_sticker.has_wear{position:absolute;display: inline-block;margin:10px 0 0 270px}.csgo_sticker.has_wear .stickers{width:62px;height:48px;margin:0;background: 0;}.stag{margin:0 0 0 2px !important;padding: 4px 6px;float:none !important}.float_rank{color: green;}.stickers:hover{opacity:1!important}");
  148. GM_addStyle(".tooltip .tooltiptext{visibility:hidden;border: 1px solid #d0d0d0;width:128px;height:96px;background-color:#fbfbfbc7;position:absolute;z-index:60;bottom:100%;margin-left:-62px;border-radius:10px}.tooltip:hover .tooltiptext{visibility:visible}");
  149. // 求购列表css
  150. GM_addStyle(".market_commodity_orders_table.order_float_left{margin: 0 10px 0 0;float: left;}.market_commodity_orders_table{margin: 0 0 0 10px;height:100%;float:right;border-collapse:separate;background-color:rgba(0,0,0,0.3);}.market_commodity_orders_table tr:nth-child(even){background-color:#242b33}.market_commodity_orders_table td{text-align:center;padding:4px}.market_commodity_orders_table th{padding:4px;margin:0;text-align:center;font-size:16px;font-weight:normal}");
  151. // 求购警告css
  152. GM_addStyle('#steam_order .warning{ position: relative; margin: 0 0 0 4px; display: inline-flex; vertical-align: text-bottom; } #steam_order .warning .tips { visibility: hidden; position: absolute; width: 200px; top: 100%; left: 0; background: #111111; padding: 4px;} #steam_order:hover .warning .tips { visibility: visible; }');
  153.  
  154. (function initSteamLink() {
  155. if (!document.querySelector(".detail-cont")) {
  156. requestIdleCallback(initSteamLink, { timeout: 300 });
  157. return;
  158. }
  159. $(".detail-pic").css("background-repeat", "round").children().width(250);
  160. if ($("#j_game-switcher").data("current") == "dota2") {
  161. $(".detail-cont>p").append($(".detail-summ>a").clone().addClass("steam-link"));
  162. } else {
  163. $(".detail-cont>div:first").append($(".detail-summ>a").clone().addClass("steam-link"));
  164. }
  165.  
  166. // 适配 ”饰品比例计算脚本“ gf.qytechs.cn/scripts/35597
  167. // 防止排版冲突混乱
  168. $(".detail-summ>a").hide();
  169. $(".detail-cont").css("margin-left", 0);
  170. })();
  171.  
  172. $(document).ajaxSuccess(function (event, status, header, result) {
  173. if (/^\/api\/market\/goods\/sell_order/.exec(header.url) && result.data && result.data.goods_infos[getGoodsId()] && result.data.total_count) {
  174. steamFailedTimes = 0;
  175. buffHelperModule_inspestEnhancementCsgo(result.data);
  176. buffHelperGoodsDetailScale(result.data);
  177. }
  178. });
  179. } else if (location.pathname.startsWith("/market/")) {
  180. // 主要样式
  181. GM_addStyle(".steam_temp{margin-top: inherit;}#sort_scale{display:inline-block;padding:0 6px 0 16px;cursor:pointer;height:32px;margin-left:5px;line-height:32px;text-align:center;border-radius:4px;min-width:60px;border:1px solid #45536c;color:#63779b;vertical-align:middle}#sort_scale.enabled{background:#45536c;color:#fff}.list_card li{padding-bottom:0}.list_card li h3{margin: 4px 8px;}.list_card li p{margin: 6px 8px;}.list_card li>p>span.l_Left{margin-top:inherit}.list_card li>p>strong.f_Strong{display:block;font-size:20px;min-height:20px;}.price_scale{padding-top:2px}");
  182. // 进度条样式
  183. GM_addStyle(".helper-loading{position:absolute;margin:11px}.helper-progress-bar{height:20px;background:linear-gradient(130deg, rgb(33 86 183 / 61%) 20%, rgb(15 116 187 / 35%) 85%, transparent);width:0;z-index:1000}");
  184.  
  185. $(document).ajaxSend(function (event, xhr, header, result) {
  186. if (/^\/api\/market\/goods/.exec(header.url)) {
  187. header.url += "&page_size=" + helper_config.pageSize;
  188. $(".helper-progress-bar").remove();
  189. $(".helper-loading").remove();
  190. steamFailedTimes = 0;
  191. }
  192. });
  193. $(document).ajaxSuccess(function (event, xhr, header, result) {
  194. if (/^\/api\/market\/goods/.exec(header.url) && result.data && result.data.total_count) {
  195. buffHelperMarkerListScale(result.data.items);
  196. } else if (/\/api\/market\/sell_order\/top_bookmarked/.exec(header.url)) {
  197. let warningTimes = GM_getValue("top_bookmarked-warning") || 0;
  198. if (warningTimes < 3) {
  199. GM_setValue("top_bookmarked-warning", ++warningTimes);
  200. showMessage("插件不会在热门关注运行", "出售、求购板块都可以使用<br/>哪有人会关注溢价商品的比例呢?", "warning", 16000 - 4000 * warningTimes);
  201. }
  202. }
  203. });
  204. if ($(".block-header>.l_Right").length == 0) {
  205. setTimeout(initSortBtn, 100);
  206. } else {
  207. initSortBtn();
  208. }
  209. }
  210.  
  211. // 商品详情
  212. window.buffHelperGoodsDetailScale = function (data) {
  213. // 检测商品是否加载完成
  214. if ($("#market-selling-list").length == 0) {
  215. setTimeout(buffHelperGoodsDetailScale, 100);
  216. return;
  217. }
  218. $(".detail-cont").append("<i class=\"icon icon_uploading helper-loading\" style='margin: 5px;'></i>");
  219. goodsDetailLoadData(data);
  220.  
  221. async function goodsDetailLoadData(data, secendTry) {
  222. let price_list = $(".f_Strong");
  223. let isLogined = $("#navbar-cash-amount").length == 1;
  224. let isFirstTime = $(".good_scale").length == 0;
  225. let buff_item_id = getGoodsId();
  226. let app_id = data.goods_infos[buff_item_id].appid;
  227. let hash_name = escape(data.goods_infos[buff_item_id].market_hash_name);
  228. let steamLink = $(".detail-summ>a").attr("href") || `https://steamcommunity.com/market/listings/${app_id}/${hash_name}`;
  229. let items = data.items;
  230. let steam_price_cny = data.goods_infos[buff_item_id].steam_price_cny * 100;
  231. if (isFirstTime) {
  232. getSteamSoldNumber(app_id, hash_name).then((soldNumber) => {
  233. if (soldNumber.success) {
  234. $(".detail-cont").append(`<div id="steam_sold">有 <span class="market_commodity_orders_header_promote">${soldNumber.volume || 0}</span> 份在 24 小时内售出</div>`);
  235. } else {
  236. $(".detail-cont").append(`<div id="steam_sold_error">获取steam销量失败,原因:${soldNumber.statusText.split(",")[0]}</div>`);
  237. }
  238. });
  239. let orderList = await getSteamOrderList(buff_item_id, steamLink);
  240. if (orderList.success) {
  241. steam_highest_buy_order = orderList.highest_buy_order && {
  242. origin: orderList.highest_buy_order,
  243. cny: FtoC(orderList.highest_buy_order)
  244. };
  245. steam_lowest_sell_order = orderList.lowest_sell_order && {
  246. origin: orderList.lowest_sell_order,
  247. cny: FtoC(orderList.lowest_sell_order)
  248. };
  249. if (orderList.buy_order_table != "") {
  250. $(".detail-cont").append(`<div id='steam_order'>${orderList.buy_order_summary}</div>`);
  251. $(".detail-pic").after(orderList.buy_order_table);
  252. let buff_sell_price = data.items[0].price;
  253. $(".market_commodity_orders_header_promote:last").after(`<small class='market_listing_price_with_fee'>${getScale(buff_sell_price, steam_highest_buy_order.cny)}</small>`);
  254. // 求购表格
  255. $(".market_commodity_orders_table th:first").after("<th>比例</th>");
  256. let orderTableList = $(".market_commodity_orders_table tr");
  257. let viableScale = 0 // steam订购单比例低于1的数量
  258. for (let i = 1; i < orderTableList.length; i++) {
  259. let td = $(orderTableList[i]).find("td:first");
  260. let td_count = $(orderTableList[i]).find("td:last");
  261. let priceGroup = convertPrice(td.text());
  262. let scale = getScale(buff_sell_price, FtoC(priceGroup[1] + (priceGroup[3] || "00")))
  263. td.after(`<td>${scale}</td>`);
  264.  
  265. // 检查steam订购单异常情况,若只有个别比例低于1,提醒用户,排除用于尾部统计的最后一行
  266. if (scale < 1 && i < orderTableList.length - 1) {
  267. viableScale += parseInt(td_count.text())
  268. }
  269. }
  270. // 当只有个别比例低于1时,添加提醒
  271. switch (true) {
  272. case viableScale == 0: break;
  273. case viableScale < 3:
  274. $('#steam_order').append(`<div class="warning" style="color: red;"><i class="icon icon_warning_mid" style="filter: invert(1) hue-rotate(120deg)"></i><div class="tips">仅有个别Steam订购单比例低于1,小心卖家自设虚假订购单</div></div>`)
  275. break;
  276. case viableScale < 5:
  277. $('#steam_order').append(`<div class="warning" style="color: orange;"><i class="icon icon_warning_mid"></i><div class="tips">比例低于1的Steam订购单过少,请小心购买</div></div>`)
  278. break;
  279. }
  280.  
  281. if (helper_config.orderFloatLeft) {
  282. $(".market_commodity_orders_table").addClass("order_float_left");
  283. }
  284. }
  285. } else {
  286. if ((!secendTry) && orderList.status == "500") {
  287. setTimeout(() => {
  288. goodsDetailLoadData(data, true);
  289. }, 100);
  290. return;
  291. }
  292. $(".detail-cont").append(`<div id='steam_order_error'>${orderList.statusText}</div>`);
  293. }
  294. }
  295. $(".helper-loading").remove();
  296. $(".detail-tab-cont th:last").before('<th style="width: 45px;" class="t_Left"><span>比例</span></th>');
  297. if (steam_lowest_sell_order) {
  298. $(".f_Strong .hide-usd")[0].innerText = getWithoutFeePrice(steam_lowest_sell_order.origin, 1);
  299. } else {
  300. $(".f_Strong .hide-usd")[0].innerText = getWithoutFeePrice(steam_price_cny, 1, "CNY");
  301. }
  302. for (let i = 0; i < items.length; i++) {
  303. let buff_sell_price = items[i].price;
  304. let scale = getScale(buff_sell_price, steam_lowest_sell_order ? steam_lowest_sell_order.cny : steam_price_cny);
  305. if (scale === Infinity) {
  306. scale = "∞";
  307. }
  308. if (!i) {
  309. let color;
  310. switch (true) {
  311. case scale > 0.9: color = "#a0ffc5"; break;
  312. case scale > 0.8: color = "#b8ff8a"; break;
  313. case scale > 0.74: color = "#fff054"; break;
  314. case scale > 0.67: color = "#ff7e15"; break;
  315. default: color = "#ff0049"; break;
  316. }
  317. if (isFirstTime) {
  318. $(".steam-link").prop("href", $(".steam-link").prop("href") + "?buffPrice=" + buff_sell_price);
  319. $(price_list[isLogined ? 1 : 0]).append($(`<big class='good_scale' style='color:${color};margin-left: 6px'>${scale}</big>`));
  320. } else {
  321. $(".steam-link").prop("href", $(".steam-link").prop("href").replace(/\d{0,6}[.]?\d{0,2}$/, buff_sell_price));
  322. $(".good_scale").text(scale).css("color", color);
  323. }
  324. }
  325. $(price_list[i + (isLogined ? 2 : 1)]).parents("td").after(`<td class="t_Left"><div style="display:table-cell;text-align:center;"><b class="seller_scale">${scale}</b><p class="c_Gray f_12px">${steam_highest_buy_order ? getScale(buff_sell_price, steam_highest_buy_order.cny) : ''}</p></div></td>`);
  326. }
  327. daemonThread();
  328. }
  329. }
  330.  
  331. // 市场目录
  332. window.buffHelperMarkerListScale = async function (items) {
  333. // 检测商品是否加载完成
  334. if ($("#j_list_card>ul>li").length == 0) {
  335. setTimeout(buffHelperMarkerListScale, 100);
  336. return;
  337. }
  338. $(".list_card li>p>span.l_Right").removeClass("l_Right").addClass("l_Left");
  339. let randomID = Math.round(Math.random() * 1000);
  340. let goods = $("#j_list_card>ul>li");
  341. itemNum = items.length;
  342. // 添加进度条
  343. $(".tab>li.on").append("<i id=helper-loading-" + randomID + " class=\"icon icon_uploading helper-loading\"></i>");
  344. $(".market-list .blank20:last").prepend('<div id=helper-progress-bar-' + randomID + ' class="helper-progress-bar"></div>');
  345. for (let i = 0; i < goods.length; i++) {
  346. $(goods[i]).attr("data-default-sort", i);
  347. if (items[i].sell_num == 0) {
  348. updateProgressBar(randomID);
  349. continue;
  350. }
  351. await marketListLoadData(items[i], goods[i], randomID);
  352. }
  353.  
  354. async function marketListLoadData(item, good, randomID, secendTry) {
  355. let target = $(good).find("p>strong.f_Strong")[0];
  356. let buff_item_id = item.id; // buff商品ID
  357. let buff_buy_num = item.buy_num; // buff求购数量
  358. let buff_buy_max_price = item.buy_max_price; // buff求购最高价
  359. let buff_sell_num = item.sell_num; // buff在售数量
  360. let buff_sell_min_price = item.sell_min_price; // buff出售最低价
  361. let steam_price_cny = item.goods_info.steam_price_cny * 100; // buff提供的steam国区售价
  362. let steam_market_url = item.steam_market_url; // steam市场链接
  363. let buff_sell_reference_price = item.sell_reference_price; // buff出售参考价(没卵用)
  364. let steam_highest_buy_order = undefined; // 不能使用全局变量,不然未成功加载的数据比例会错误
  365. let steam_lowest_sell_order = undefined; // 不能使用全局变量,不然未成功加载的数据比例会错误
  366. $(good).attr("data-order-sort", Infinity);
  367. $(good).attr("data-sold_number-sort", Infinity);
  368. if (helper_config.buffSellThreshold >= buff_sell_num) {
  369. $(good).attr("data-buff-sort", Infinity);
  370. $(target).after($(HIGHLIGHT_TEMPLATE).text("已忽略"));
  371. } else {
  372. let orderList = await getSteamOrderList(buff_item_id, steam_market_url);
  373. if (orderList.success) {
  374. steam_highest_buy_order = orderList.highest_buy_order && {
  375. origin: orderList.highest_buy_order,
  376. cny: FtoC(orderList.highest_buy_order)
  377. };
  378. steam_lowest_sell_order = orderList.lowest_sell_order && {
  379. origin: orderList.lowest_sell_order,
  380. cny: FtoC(orderList.lowest_sell_order)
  381. };
  382. // 没有有效的订购单
  383. if (orderList.buy_order_table == "") {
  384. $(target).after($(INFO_TEMPLATE).text("没有有效订购单"));
  385. } else {
  386. let steamOrderScale = getScale(buff_sell_min_price, steam_highest_buy_order.cny);
  387. if (helper_config.displaySoldNumber) {
  388. let soldNumber = await getSteamSoldNumber(item.appid, item.market_hash_name);
  389. if (soldNumber.success) {
  390. soldNumber.volume = soldNumber.volume.replace(",", "");
  391. $(good).attr("data-sold_number-sort", soldNumber.volume || 0);
  392. $(target).after($(STEAM_SOLD_NUMBER_TEMPLATE).text((soldNumber.volume || 0) + "┊"));
  393. } else {
  394. let text = soldNumber.statusTextShort;
  395. $(target).after($(STEAM_SOLD_NUMBER_TEMPLATE).text((text ? text : "错误") + "┊"));
  396. }
  397. } else {
  398. let orderNumber = $(orderList.buy_order_summary)[0].innerText;
  399. $(good).attr("data-order-sort", steamOrderScale);
  400. $(target).after($(STEAM_ORDER_NUMBER_TEMPLATE).text(orderNumber + "┊"));
  401. }
  402. paintingGradient(steamOrderScale, target, 4, STEAM_ORDER_SCALE_TEMPLATE);
  403. }
  404. } else {
  405. if ((!secendTry) && orderList.status == 500) {
  406. setTimeout(() => {
  407. marketListLoadData(item, good, randomID, true);
  408. }, 100);
  409. return;
  410. }
  411. $(target).after($(ERROR_TEMPLATE).text(orderList.statusText.split(",")[0]));
  412. }
  413. let withoutFeePrice = getWithoutFeePrice(steam_lowest_sell_order ? steam_lowest_sell_order.origin : steam_price_cny);
  414. let scale = getScale(buff_sell_min_price, steam_lowest_sell_order ? steam_lowest_sell_order.cny : steam_price_cny);
  415. $(good).attr("data-buff-sort", scale);
  416. $(target).prepend(`<span>${target.childNodes[0].textContent}</span>`);
  417. target.childNodes[1].remove();
  418. $(target).append($("<span class=\"f_12px f_Bold c_Gray\"></span>").css("margin-left", "5px").text(withoutFeePrice));
  419. paintingGradient(scale, target, 3);
  420. withoutFeePrice = target.children[target.children.length - 2];
  421. scale = target.children[target.children.length - 1];
  422. let strWidth = 5;
  423. for (let i = 0; i < target.children.length; i++) {
  424. strWidth += target.children[i].offsetWidth;
  425. }
  426. let displayPrice = $(target).text().match(/([€₽\$¥]\s)((\d+)(\.\d{1,2})?)/) || [""];
  427. let tryMe = 0;
  428. while (strWidth >= 192) {
  429. switch (tryMe++) {
  430. // 超长以后显示的越少越好,所以不用toFixed以免出现小数是0的情况
  431. case 0: // 0/1
  432. withoutFeePrice.innerText = Math.round(withoutFeePrice.innerText * 10) / 10;
  433. break;
  434. case 1: // 0/2
  435. withoutFeePrice.innerText = Math.round(withoutFeePrice.innerText);
  436. break;
  437. case 2: // 0/1
  438. scale.innerText = Math.round(scale.innerText * 10) / 10;
  439. break;
  440. case 3: // 0/3
  441. let text = displayPrice[1] + Math.ceil(displayPrice[2]); // 价格抹零
  442. $(target).text(text);
  443. displayPrice = text.match(/([€₽\$¥]\s)((\d+)(\.\d{1,2})?)/);
  444. break;
  445. case 4: // 0/2
  446. scale.innerText = Math.ceil(scale.innerText);
  447. break;
  448. case 5: // no one's gonna know
  449. // $(target).text((+displayPrice[3]).toString(16));
  450. // withoutFeePrice.innerText = withoutFeePrice.innerText.toString(16);
  451. withoutFeePrice.innerText = "";
  452. strWidth = 0;
  453. continue;
  454. }
  455. strWidth = 5;
  456. for (let i = 0; i < target.children.length; i++) {
  457. strWidth += target.children[i].offsetWidth;
  458. }
  459. }
  460. }
  461. if (needSort && (helper_config.sortAfterAllDone ? itemCount == itemNum - 1 : true)) {
  462. let arr = needSort.split("_");
  463. sortGoods("data-" + arr[0], arr[1] == "asc");
  464. }
  465. updateProgressBar(randomID);
  466. }
  467. }
  468.  
  469. // 检视增强模组
  470. window.buffHelperModule_inspestEnhancementCsgo = function (data) {
  471. // 检测商品是否加载完成
  472. if ($("#market-selling-list").length == 0) {
  473. setTimeout(buffHelperModule_inspestEnhancementCsgo, 100);
  474. return;
  475. }
  476. if ($("#market-selling-list").hasClass("buffed")) { return; }
  477. $("#market-selling-list").addClass("buffed");
  478. // 不支持微信时给个占位图标
  479. let alipayIcon = $(".icon_payment_alipay");
  480. for (let i = 0; i < alipayIcon.length; i++) {
  481. let element = alipayIcon[i];
  482. if (!element.nextElementSibling) {
  483. $(element).after('<i class="icon icon_select_wx_small" style="opacity:0;" title="Support BUFF Balances-bank card"></i>');
  484. }
  485. }
  486. // 支付图标移动到购买按钮下
  487. let paymentIcon = $(".icon_payment_alipay,.icon_payment_others").parent();
  488. paymentIcon.addClass("paymentIcon on");
  489. $(".paymentIcon .icon_payment_alipay").addClass("icon_select_alipay_small").removeClass("icon_payment_alipay");
  490. $(".paymentIcon .icon_payment_others").addClass("icon_select_wx_small").removeClass("icon_payment_others");
  491. for (let i = 0; i < paymentIcon.length; i++) {
  492. const element = paymentIcon[i];
  493. $(element).parent().next().append(element);
  494. }
  495. // 检测是否支持这个类型/游戏的饰品
  496. let goods_id = getGoodsId();
  497. if (data.goods_infos[goods_id].appid != 730 || ENHANCEMENT_SUPPORT_LIST.indexOf(data.goods_infos[goods_id].tags.category_group.internal_name) < 0) { return; }
  498. // 英文页面标志
  499. let isEn = $("#j_lang-switcher").data("current") === "en";
  500. // 整体CSS
  501. $(".list_tb_csgo>tr>th.t_Left")[0].style.width = "550px";
  502. // 给检视按钮去掉点击属性,防止产生图片无法关闭的bug
  503. $(".csgo_inspect_img_btn").attr("disabled", true).css({
  504. "pointer-events": "none"
  505. });
  506. // 给饰品图片加入点击属性用于检视
  507. $(".pic-cont.item-detail-img").click(function () {
  508. this.children[1].click();
  509. }).mouseenter(function () {
  510. $(this).css("background", $(this.children[1]).css("background"));
  511. }).mouseleave(function () {
  512. $(this).css("background", "");
  513. }).css({
  514. "cursor": "pointer"
  515. });
  516. // 拿到每个饰品对应的dom
  517. let skin_list = $(".list_tb_csgo").find("[id^='sell_order_']");
  518. for (let i = 0; i < skin_list.length; i++) {
  519. let mom = skin_list[i];
  520. // 贴纸移动到图片dom中(保证垂直居中)
  521. let sticker = $(mom).find(".csgo_sticker");
  522. $(sticker).addClass("sticker_parent_div");
  523. $(mom).find("td:nth-child(2)").prepend(sticker);
  524. getItemDetail(mom);
  525. }
  526. // 渐变/淬火等特殊皮肤的tag
  527. let stags = $(".stag");
  528. for (let i = 0; i < stags.length; i++) {
  529. let stag = $(stags[i]);
  530. stag.prev().append(stag);
  531. }
  532. // 贴纸大图
  533. let stickers = $(".stickers");
  534. for (let i = 0; i < stickers.length; i++) {
  535. let element = stickers[i];
  536. element.innerHTML += "<span class='tooltiptext'>" + element.innerHTML + "</span>";
  537. }
  538. $("span.f_12px.c_Gray:contains('%')").css("margin-left", "6px");
  539. stickers.addClass("tooltip");
  540. // 贴纸遮盖
  541. stickers = $(".stickers.masked");
  542. let min = 0.3;
  543. for (let i = 0; i < stickers.length; i++) {
  544. let float = parseInt(stickers[i].nextElementSibling.innerText);
  545. $(stickers[i]).css("opacity", float * (1 - min) / 100 + min);
  546. }
  547. $(".stickers.masked").removeClass("masked");
  548. // 贴纸顺序
  549. if (helper_config.reverseSticker) {
  550. $(".sticker-cont").css("float", "right");
  551. }
  552. // 英文页面3D检视
  553. if (isEn) {
  554. $(".ctag.btn_3d").html($(".ctag.btn_3d").html().substr(0, 37));
  555. }
  556.  
  557. function getItemDetail(parent, secondTime) {
  558. if ($(parent).find(".textOne")[0]) { return; }
  559. // 拿到每个饰品的图片对象
  560. let skin = $(parent).find(".item-detail-img")[0];
  561. // 获取饰品对应的信息并加载进data
  562. let classid = $(skin).data("classid");
  563. let instanceid = $(skin).data("instanceid");
  564. let sell_order_id = $(skin).data("orderid");
  565. let origin = $(skin).data("origin");
  566. let assetid = $(skin).data("assetid");
  567. let data = {
  568. appid: 730,
  569. game: "csgo",
  570. classid: classid,
  571. instanceid: instanceid,
  572. sell_order_id: sell_order_id,
  573. origin: origin,
  574. assetid: assetid
  575. };
  576. // 发送异步请求获取饰品详情
  577. $.ajax({
  578. url: "/market/item_detail",
  579. method: "get",
  580. timeout: ajaxTimeout,
  581. data: data,
  582. success: function (data) {
  583. let result = $(data)[0];
  584. // 获取待添加种子的dom对象
  585. let origin_float = $(parent).find(".wear-value")[0];
  586. try {
  587. let seed = "<div class='wear-value'>图案模板(seed):&nbsp;<b style='color:crimson'>" + $(result).find(".skin-info>p:first").text().match(/\d{1,}/)[0] + "</b></div>";
  588. $(origin_float).before(seed);
  589. } catch (error) {
  590. if (secondTime) {
  591. $(origin_float).before("<div class='wear-value'><b style='color:crimson'>获取失败,请稍后再试</b></div>");
  592. return;
  593. } else {
  594. setTimeout(getItemDetail(parent, true), 500);
  595. }
  596. }
  597. // 获取名称标签对象
  598. let name = $(result).find("p.name_tag")[0];
  599. if (name) {
  600. // 设定名称标签的样式
  601. $(name).css({
  602. "background": "transparent",
  603. "padding": "0"
  604. });
  605. // 获取待添加名称标签的对象并添加名称标签
  606. let targ_name = $(parent).find(".csgo_value")[0];
  607. $(targ_name).before(name);
  608. }
  609. // 截取皮肤磨损并加粗
  610. origin_float.innerHTML = "磨损: <b>" + origin_float.innerText.match(/0[.]\d*/)[0] + "</b>";
  611. // 获取排名对象
  612. let rank = $(result).find(".skin-info>.des")[0];
  613. if (rank) {
  614. // 位置在种子后面
  615. $(parent).find(".csgo_value>.wear-value:first").append("<span style='margin-left:10px'>磨损排名:&nbsp;<b class='float_rank'>" + rank.innerText.match(/\d{1,}/)[0] + "</b></span>");
  616. // 位置在磨损后面
  617. // $(origin_float).html(origin_float.innerHTML + "<i class='float_rank'>「#<b>" + rank.innerText.match(/\d{1,}/)[0] + "</b>」</i>");
  618. }
  619. },
  620. error: function (msg) {
  621. if (msg.status == 429) {
  622. msg.statusText = "请求太频繁";
  623. }
  624. console.log("error:", msg);
  625. let origin_float = $(parent).find(".wear-value")[0];
  626. $(origin_float).before("<div class='wear-value'><b style='color:crimson'>" + msg.statusText + "</b></div>");
  627. }
  628. });
  629. }
  630.  
  631. };
  632.  
  633. function initHelper() {
  634. if ($(".floatbar>ul").length == 0) {
  635. setTimeout(() => { initHelper(); }, 100);
  636. return;
  637. }
  638. if ($("#buff_tool_nextpage").length != 0) { return; }
  639. if (!GM_getValue("helper_alert_first")) {
  640. $("body").append('<div id="j_w-Toast" class="w-Toast_warning" style="display: block; margin-left: -195px; margin-top: -35px;"><p><i class="icon icon_warning_mid"></i>你应该是第一次安装“网易BUFF价格比例(找挂刀)插件” 本插件完全免费,让你付费购买的都是骗子。请熟知。</p> <div> <a href="javascript:void(0)" class="agreementsBtn i_Btn i_Btn_mid i_Btn_D_red" style="margin-top: 15px;">我已知晓<span class="agreementsCountDown" style="margin-left:10px">5</span></a></div></div>');
  641. let count = 5;
  642. let countDown = setInterval(function () {
  643. if (--count == 0) {
  644. clearInterval(countDown);
  645. $(".agreementsCountDown").remove();
  646. } else {
  647. $(".agreementsCountDown").text(count);
  648. }
  649. }, 1000);
  650. $(".agreementsBtn").click(function () {
  651. if (!count) {
  652. GM_setValue("helper_alert_first", true);
  653. $("#j_w-Toast").hide("normal", () => {
  654. $("#j_w-Toast").remove();
  655. });
  656. } else {
  657. alert("认真看一会,还有" + count + "秒就可以点了");
  658. }
  659. });
  660. }
  661. // 设置按钮
  662. $(".floatbar>ul").prepend("<li><a id='buff_tool_setting'><i class='icon icon_menu_setting'></i><p>设置</p></a></li>");
  663. $("#buff_tool_setting").click(function () {
  664. openSettingPanel();
  665. }).parent().css("cursor", "pointer");
  666. // 下一页按钮
  667. $(".floatbar>ul").prepend("<li><a id='buff_tool_nextpage'><i class='icon icon_slide_right2' style='height: 40px;width: 39px;'></i><p>下一页</p></a></li>");
  668. $("#buff_tool_nextpage").click(function () {
  669. $(".page-link.next").click();
  670. $("#sort_scale").removeClass();
  671. }).parent().css("cursor", "pointer");
  672. // 初始化设置页面
  673. $("#helper-version").text($("#helper-version").text() + GM_info.script.version);
  674. $("#helper-setting-checkBtn").click(() => { checkSteamConnection() });
  675. $("#helper-setting-resetAll").click(() => { resetConfig(); });
  676. $(".helper-setting-shadow").click(function (e) {
  677. if (e.target == this) {
  678. $(this).fadeOut();
  679. }
  680. });
  681. // 添加设置页面操作
  682. $(".helper-setting").change(function (e) {
  683. let target = e.target;
  684. let optionTarget = target.dataset.optionTarget;
  685. let val = target.getAttribute("value") ? target.getAttribute("value") : target.value;
  686. helper_config[optionTarget] = val;
  687. if (optionTarget == "steamCurrency" && g_rgCurrencyData[val].eCurrencyCode != 23) {
  688. let toast = showMessage(`正在获取${val}的汇率`, "访问时间取决于steam访问速度,期间请不要关闭页面", "info", 20000);
  689. updateRate(1, toast);
  690. } else {
  691. GM_setValue("helper_config", helper_config);
  692. }
  693. init();
  694. });
  695. // 注册(不可用)管理工具菜单
  696. GM_registerMenuCommand('打开设置面板', () => {
  697. openSettingPanel();
  698. });
  699. GM_registerMenuCommand('插件官网', () => {
  700. window.open("https://gf.qytechs.cn/zh-CN/scripts/410137");
  701. });
  702. // 初始化设置页面后填装面板
  703. init();
  704. }
  705.  
  706. function openSettingPanel() {
  707. updateSteamStatus();
  708. $(".helper-setting-shadow").css({
  709. "opacity": 0,
  710. "display": "flex"
  711. }).animate({ opacity: '1' }, 300);
  712. }
  713.  
  714. function loadConfig() {
  715. let config = GM_getValue("helper_config");
  716. if (config && Object.keys(config).length) {
  717. // 旧版更新到新版导致无数据
  718. config.pageSize = config.pageSize ? config.pageSize : 20;
  719. return config;
  720. }
  721. return clone(DEFAULT_CONFIG);
  722. }
  723.  
  724. function resetConfig() {
  725. GM_setValue("helper_config", null);
  726. GM_setValue("exchangeRate", null);
  727. GM_setValue("top_bookmarked-warning", null);
  728. helper_config = clone(DEFAULT_CONFIG);
  729. init();
  730. showMessage("重置成功", "插件已恢复初始设定", "info", 2000);
  731. }
  732.  
  733. function initCurrency() {
  734. for (let key in g_rgCurrencyData) {
  735. $(".steam-currency-selector").append("<li value=" + g_rgCurrencyData[key].strCode + ">" + g_rgCurrencyData[key].strCode + "(" + g_rgCurrencyData[key].strSymbol + ")</li>");
  736. }
  737. syncCurrency();
  738. if (steamCurrency.eCurrencyCode != 23) {
  739. updateRate();
  740. }
  741. }
  742.  
  743. function init() {
  744. $(".helper-setting>.list_tb .on").removeClass("on");
  745.  
  746. if (helper_config.currencyEffectCalculate) {
  747. $("#helper-setting-currencyEffectCalculate").attr("value", helper_config.currencyEffectCalculate).children(":first").addClass("on");
  748. }
  749. if (helper_config.overrideSortRule) {
  750. $("#helper-setting-stickerSort").attr("value", helper_config.overrideSortRule).children(":first").addClass("on");
  751. }
  752. if (helper_config.sortAfterAllDone) {
  753. $("#helper-setting-sortAfterAllDone").attr("value", helper_config.sortAfterAllDone).children(":first").addClass("on");
  754. }
  755. if (helper_config.orderFloatLeft) {
  756. $("#helper-setting-orderFloatLeft").attr("value", helper_config.orderFloatLeft).children(":first").addClass("on");
  757. $(".market_commodity_orders_table").addClass("order_float_left");
  758. } else {
  759. $(".market_commodity_orders_table").removeClass("order_float_left");
  760. }
  761. if (helper_config.reverseSticker) {
  762. $("#helper-setting-reverseSticker").attr("value", helper_config.reverseSticker).children(":first").addClass("on");
  763. }
  764. reverseStickers(helper_config.reverseSticker);
  765. syncSort();
  766. $("#helper-setting-pageSize").val(helper_config.pageSize);
  767. $("#helper-setting-buffSellThreshold").val(helper_config.buffSellThreshold);
  768. $("#helper-setting-maxRange").val(helper_config.maxRange);
  769. $("#helper-setting-minRange").val(helper_config.minRange);
  770. $("#helper-setting-marketColorLow").val(helper_config.marketColorLow);
  771. $("#helper-setting-marketColorHigh").val(helper_config.marketColorHigh);
  772. updateSteamStatus();
  773. syncCurrency();
  774. parseColor();
  775. }
  776.  
  777. function initSortBtn() {
  778. $(".block-header>.l_Right").append($('<div class="w-Select-Multi w-Select-scroll buff-helper-sort" style="visibility: visible; width: 140px;"><h3 id="helper-sort-text">比例排序</h3><i class="icon icon_drop"></i><ul style="width: 140px;"><li data-value="null">默认</li><li data-value="buff-sort_asc"><span class="w-Order_asc">buff比例从低到高<i class="icon icon_order"></i></span></li><li data-value="buff-sort_desc"><span class="w-Order_des">buff比例从高到低<i class="icon icon_order"></i></span></li><li data-value="order-sort_asc"><span class="w-Order_asc">求购比例从低到高<i class="icon icon_order"></i></span></li><li data-value="order-sort_desc"><span class="w-Order_des">求购比例从高到低<i class="icon icon_order"></i></span></li></ul></div>'));
  779. var sortBtnTimeout;
  780. $(".buff-helper-sort").click(function () {
  781. $(this).addClass("on");
  782. clearTimeout(sortBtnTimeout);
  783. }).mouseleave(function () {
  784. let t = $(this);
  785. if (t.hasClass("on")) {
  786. sortBtnTimeout = setTimeout(() => t.removeClass("on"), 300);
  787. }
  788. });
  789. $(".buff-helper-sort li").click(function (e) {
  790. e.stopPropagation();
  791. needSort = this.dataset.value;
  792. if (this.dataset.value == "null") {
  793. $("#helper-sort-text").text("比例排序");
  794. sortGoods("data-default-sort", true);
  795. } else {
  796. $("#helper-sort-text").text(this.innerText);
  797. let arr = this.dataset.value.split("_");
  798. sortGoods("data-" + arr[0], arr[1] == "asc");
  799. }
  800. $(".buff-helper-sort").removeClass("on");
  801. });
  802. syncSort();
  803. setTimeout(() => {
  804. // 修改buff排序时重置比例排序规则
  805. $("div[name='sort_by']").change(function () {
  806. if (helper_config.overrideSortRule && this.getAttribute("value")) {
  807. needSort = this.dataset.value;
  808. $("#helper-sort-text").text("默认");
  809. }
  810. });
  811. }, 500);
  812. }
  813.  
  814. function syncSort() {
  815. needSort = helper_config.needSort;
  816. $("#helper-setting-sortRule>h3").text($("#helper-setting-sortRule li[value=" + helper_config.needSort + "]").addClass("on").text());
  817. $("#helper-sort-text").text($(".buff-helper-sort li[data-value=" + helper_config.needSort + "]").click().text());
  818. }
  819.  
  820. function reverseStickers(isLeft) {
  821. $(".sticker-cont").css("float", isLeft ? "right" : "left"); // 没写错
  822. }
  823.  
  824. function updateSteamStatus() {
  825. if (steamConnection === undefined) {
  826. } else if (steamConnection) {
  827. if (!$(".helper-setting-steamConnection>.c_Green").text()) {
  828. $(".helper-setting-steamConnection").html("<span class=\"c_Green\"><i class=\"icon icon_status_success\"></i>正常</span>");
  829. }
  830. } else {
  831. $(".helper-setting-steamConnection").html("<span class=\"c_DRed\"><i class=\"icon icon_status_failed\"></i>无法连接</span>");
  832. }
  833. }
  834.  
  835. function syncCurrency() {
  836. steamCurrency = g_rgCurrencyData[helper_config.steamCurrency];
  837. $("#helper-setting-currency").attr("value", steamCurrency.strCode);
  838. $("#helper-setting-currency>h3").text($("#helper-setting-currency li[value=" + steamCurrency.strCode + "]").addClass("on").text());
  839. }
  840.  
  841. function parseColor() {
  842. market_color_high = helper_config.marketColorHigh.match(/[0-9a-f]{2}/ig);
  843. market_color_low = helper_config.marketColorLow.match(/[0-9a-f]{2}/ig);
  844. for (let i = 2; i >= 0; i--) {
  845. market_color_high[i] = parseInt(market_color_high[i], 16);
  846. market_color_low[i] = parseInt(market_color_low[i], 16);
  847. }
  848. }
  849.  
  850. function sortGoods(sortRule, isAsc) {
  851. $("#j_list_card>ul>li").sort(function (a, b) {
  852. let av = $(a).attr(sortRule) - 0;
  853. let bv = $(b).attr(sortRule) - 0;
  854. let result = 0;
  855. if (isAsc) {
  856. result = av - bv;
  857. } else {
  858. result = bv - av;
  859. }
  860. return result === NaN ? 0 : result;
  861. }).appendTo("#j_list_card>ul");
  862. }
  863.  
  864. function checkSteamConnection() {
  865. let interval = 0;
  866. $(".helper-setting-steamConnection").html("<span class=\"c_Blue\"><i class=\"icon icon_status_progressing\"></i>检测中</span>");
  867. $("#helper-setting-checkBtn").css("visibility", "hidden");
  868. let startTime = new Date().getTime();
  869. let endTime = 0;
  870. steamConnection = undefined;
  871. GM_xmlhttpRequest({
  872. url: "https://steamcommunity.com/market/",
  873. timeout: ajaxTimeout,
  874. method: "get",
  875. onloadstart: function (event) {
  876. countdown(19);
  877. },
  878. onload: function (res) {
  879. if (res && res.status == 200) {
  880. endTime = new Date().getTime();
  881. changeSteamStatus(true);
  882. } else {
  883. console.log("检测steam连接性出错:状态错误", res);
  884. changeSteamStatus(false);
  885. }
  886. },
  887. onerror: function (err) {
  888. console.log("检测steam连接性出错:连接错误", err);
  889. changeSteamStatus(false);
  890. },
  891. ontimeout: function () {
  892. console.log("检测steam连接性出错:尝试超时");
  893. changeSteamStatus(false);
  894. }
  895. });
  896.  
  897. function changeSteamStatus(status) {
  898. clearInterval(interval);
  899. $(".steamConnectionCountdown").hide();
  900. steamConnection = status;
  901. if (status) {
  902. $(".helper-setting-steamConnection").html("<span class=\"c_Green\"><i class=\"icon icon_status_success\"></i>正常</span><span class=\"c_DGray f_12px\">" + (endTime - startTime) + "ms</span>");
  903. } else {
  904. $(".helper-setting-steamConnection").html("<span class=\"c_DRed\"><i class=\"icon icon_status_failed\"></i>无法连接</span>");
  905. }
  906. $("#helper-setting-checkBtn").css("visibility", "visible");
  907. }
  908.  
  909. function countdown(count) {
  910. $(".steamConnectionCountdown").text("20s").show();
  911. interval = setInterval(() => {
  912. $(".steamConnectionCountdown").text(count-- + "s");
  913. }, 1000);
  914. }
  915. }
  916.  
  917. function failedSteamConnection() {
  918. if (++steamFailedTimes > (itemNum >> 2)) {
  919. steamConnection = false;
  920. }
  921. }
  922.  
  923. function updateProgressBar(ID) {
  924. let bar = $("#helper-progress-bar-" + ID);
  925. bar.width(++itemCount / itemNum * 100 + "%")
  926. if (itemCount >= itemNum) {
  927. itemCount = 0;
  928. $("#helper-loading-" + ID).remove();
  929. bar.fadeOut(500);
  930. }
  931. }
  932.  
  933. function paintingGradient(scale, target, position, template = '<strong class="f_16px f_Strong price_scale l_Right"></strong>') {
  934. let red = gradient(market_color_high[0], market_color_low[0], scale);
  935. let green = gradient(market_color_high[1], market_color_low[1], scale);
  936. let blue = gradient(market_color_high[2], market_color_low[2], scale);
  937. switch (position) {
  938. case 1:
  939. $(target).before($(template).css("color", "rgb(" + red + "," + green + "," + blue + ")").text(scale));
  940. break;
  941. case 2:
  942. $(target).prepend($(template).css("color", "rgb(" + red + "," + green + "," + blue + ")").text(scale));
  943. break;
  944. case 3:
  945. $(target).append($(template).css("color", "rgb(" + red + "," + green + "," + blue + ")").text(scale));
  946. break;
  947. case 4:
  948. $(target).after($(template).css("color", "rgb(" + red + "," + green + "," + blue + ")").text(scale));
  949. break;
  950. default:
  951. $(target).append($(template).css("color", "rgb(" + red + "," + green + "," + blue + ")").text(scale));
  952. }
  953. }
  954.  
  955. // 用来检测是否安装了其他buff插件,安装了就对布局做出相应调整防止排版混乱
  956. function daemonThread() {
  957. let count = 30
  958. let daemonThreadInterval = setInterval(() => {
  959. if (count--) {
  960. if ($(".afkout").length || $("#infolist").length) {
  961. $("#steam_order").remove();
  962. $(".detail-summ>a").show();
  963. $(".steam-link").hide();
  964. clearInterval(daemonThreadInterval);
  965. }
  966. } else {
  967. clearInterval(daemonThreadInterval);
  968. }
  969. }, 100);
  970. }
  971.  
  972. // json only
  973. function clone(obj) {
  974. return JSON.parse(JSON.stringify(obj));
  975. }
  976.  
  977. // 小数: "167639.87", "167639", ".87", "87"
  978. // 整数: "186267", "186267"
  979. function convertPrice(str) {
  980. str = str.replace(steamCurrency.strThousandsSeparator, "");
  981. if (steamCurrency.strDecimalSymbol !== ".") {
  982. str = str.replace(steamCurrency.strDecimalSymbol, ".");
  983. }
  984. return str.match(/(\d+)(\.(\d{1,2}))?/);
  985. }
  986.  
  987. function addCurrencySymbol(origin, currencyCode) {
  988. let currencyData = g_rgCurrencyData[currencyCode];
  989. if (currencyData.bSymbolIsPrefix) {
  990. return currencyData.strSymbol + currencyData.strSymbolAndNumberSeparator + origin;
  991. } else {
  992. return origin + currencyData.strSymbolAndNumberSeparator + currencyData.strSymbol;
  993. }
  994. }
  995.  
  996. // Foreign exchange to Chinese Yuan
  997. function FtoC(valueInCents) {
  998. if (steamCurrency.eCurrencyCode != 23 && (!helper_config.currencyEffectCalculate)) {
  999. return valueInCents * exchangeRate.FtoC;
  1000. }
  1001. return valueInCents;
  1002. }
  1003. // Chinese Yuan to Foreign exchange
  1004. function CtoF(valueInCents) {
  1005. if (steamCurrency.eCurrencyCode != 23 && (!helper_config.currencyEffectCalculate)) {
  1006. return valueInCents * exchangeRate.CtoF;
  1007. }
  1008. return valueInCents;
  1009. }
  1010.  
  1011. function getScale(sellerPrice, buyerPriceInCents) {
  1012. let amount = calculateFeeAmount(buyerPriceInCents);
  1013. return (sellerPrice / v_currencyformat(amount.amount - amount.fees)).toFixed(2);
  1014. }
  1015.  
  1016. // symbolType 0, 1, 2
  1017. // eg. originPrice = 4907856 (ARS, value in cents)
  1018. // 0: 49078.56 convert to float
  1019. // 1: ARS$ 49078.56 float with symbol
  1020. // 2: ARS$ 49.078,56 locale string
  1021. function getWithoutFeePrice(originPriceInCents, symbolType = 0, currencyCode = steamCurrency.strCode) {
  1022. let amount = calculateFeeAmount(originPriceInCents);
  1023. switch (symbolType) {
  1024. case 0:
  1025. return v_currencyformat(amount.amount - amount.fees);
  1026. case 1:
  1027. return addCurrencySymbol(v_currencyformat(amount.amount - amount.fees), currencyCode);
  1028. case 2:
  1029. return v_currencyformat(amount.amount - amount.fees, currencyCode);
  1030. }
  1031. }
  1032.  
  1033. function showMessage(title, msg, type = "info", time = 5000, position = 'top-right') {
  1034. return $.toast({
  1035. text: msg,
  1036. heading: title,
  1037. icon: type,
  1038. showHideTransition: 'fade', // fade, slide or plain
  1039. allowToastClose: true,
  1040. hideAfter: time, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
  1041. stack: 5, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time
  1042. position: position, // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
  1043. textAlign: 'left', // Text alignment i.e. left, right or center
  1044. // loader: false, // Whether to show loader or not. True by default 没看懂loader什么意思¯\(°_o)/¯
  1045. // loaderBg: '#9EC600', // Background color of the toast loader
  1046. // beforeShow: function () {}, // will be triggered before the toast is shown
  1047. // afterShown: function () {}, // will be triggered after the toat has been shown
  1048. // beforeHide: function () {}, // will be triggered before the toast gets hidden
  1049. // afterHidden: function () {} // will be triggered after the toast has been hidden
  1050. });
  1051. }
  1052.  
  1053. function gradient(max, min, f) {
  1054. if (f == "∞") { return max; }
  1055. if (f >= helper_config.maxRange || f <= helper_config.minRange) {
  1056. f = f >= helper_config.maxRange ? 1 : 0;
  1057. } else {
  1058. f = (f - helper_config.minRange) / (helper_config.maxRange - helper_config.minRange);
  1059. }
  1060. return max >= min ? f * (max - min) + min : (1 - f) * (min - max) + max;
  1061. }
  1062.  
  1063. function getGoodsId() {
  1064. let result = location.pathname.match(/\/goods\/(\d+)/);
  1065. if (result) return result[1]; return null;
  1066. }
  1067.  
  1068. function escape(englishName) {
  1069. return encodeURIComponent(englishName).replaceAll("(", "%28").replaceAll(")", "%29");
  1070. }
  1071.  
  1072. // --------------------- copy from steam -----------------------
  1073. // 售价算税
  1074. function calculateFeeAmount(amount) {
  1075. if (!g_rgWalletInfo['wallet_fee'])
  1076. return 0;
  1077.  
  1078. var publisherFee = (typeof g_rgWalletInfo['wallet_publisher_fee_percent_default'] == 'undefined') ? 0 : g_rgWalletInfo['wallet_publisher_fee_percent_default'];
  1079.  
  1080. // Since CalculateFeeAmount has a Math.floor, we could be off a cent or two. Let's check:
  1081. var iterations = 0; // shouldn't be needed, but included to be sure nothing unforseen causes us to get stuck
  1082. var nEstimatedAmountOfWalletFundsReceivedByOtherParty = parseInt((amount - parseInt(g_rgWalletInfo['wallet_fee_base'])) / (parseFloat(g_rgWalletInfo['wallet_fee_percent']) + parseFloat(publisherFee) + 1));
  1083.  
  1084. var bEverUndershot = false;
  1085. var fees = CalculateAmountToSendForDesiredReceivedAmount(nEstimatedAmountOfWalletFundsReceivedByOtherParty, publisherFee);
  1086. while (fees.amount != amount && iterations < 10) {
  1087. if (fees.amount > amount) {
  1088. if (bEverUndershot) {
  1089. fees = CalculateAmountToSendForDesiredReceivedAmount(nEstimatedAmountOfWalletFundsReceivedByOtherParty - 1, publisherFee);
  1090. fees.steam_fee += (amount - fees.amount);
  1091. fees.fees += (amount - fees.amount);
  1092. fees.amount = amount;
  1093. break;
  1094. }
  1095. else {
  1096. nEstimatedAmountOfWalletFundsReceivedByOtherParty--;
  1097. }
  1098. }
  1099. else {
  1100. bEverUndershot = true;
  1101. nEstimatedAmountOfWalletFundsReceivedByOtherParty++;
  1102. }
  1103.  
  1104. fees = CalculateAmountToSendForDesiredReceivedAmount(nEstimatedAmountOfWalletFundsReceivedByOtherParty, publisherFee);
  1105. iterations++;
  1106. }
  1107.  
  1108. // fees.amount should equal the passed in amount
  1109. return fees;
  1110.  
  1111. function CalculateAmountToSendForDesiredReceivedAmount(receivedAmount, publisherFee) {
  1112. if (!g_rgWalletInfo['wallet_fee']) {
  1113. return receivedAmount;
  1114. }
  1115.  
  1116. publisherFee = (typeof publisherFee == 'undefined') ? 0 : publisherFee;
  1117.  
  1118. var nSteamFee = parseInt(Math.floor(Math.max(receivedAmount * parseFloat(g_rgWalletInfo['wallet_fee_percent']), g_rgWalletInfo['wallet_fee_minimum']) + parseInt(g_rgWalletInfo['wallet_fee_base'])));
  1119. var nPublisherFee = parseInt(Math.floor(publisherFee > 0 ? Math.max(receivedAmount * publisherFee, 1) : 0));
  1120. var nAmountToSend = receivedAmount + nSteamFee + nPublisherFee;
  1121.  
  1122. return {
  1123. steam_fee: nSteamFee,
  1124. publisher_fee: nPublisherFee,
  1125. fees: nSteamFee + nPublisherFee,
  1126. amount: parseInt(nAmountToSend)
  1127. };
  1128. }
  1129. }
  1130. // 小数点左移两位,并且加货币符号(可选)
  1131. function v_currencyformat(valueInCents, currencyCode) {
  1132. var currencyFormat = `${parseInt(valueInCents = Math.abs(+valueInCents / 100 || 0).toFixed(2), 10)}`;
  1133.  
  1134. if (g_rgCurrencyData[currencyCode]) {
  1135. var currencyData = g_rgCurrencyData[currencyCode];
  1136.  
  1137. const j = (currencyFormat.length > 3 ? currencyFormat.length % 3 : 0);
  1138. const thousand_formatted = `${j ? currencyFormat.substr(0, j) + currencyData.strThousandsSeparator : ''}${currencyFormat.substr(j).replace(/(\d{3})(?=\d)/g, `$1${currencyData.strThousandsSeparator}`)}`;
  1139. const decimal_formatted = `${currencyData.strDecimalSymbol}${Math.abs(valueInCents - currencyFormat).toFixed(2).slice(2)}`;
  1140. const formatted = `${thousand_formatted}${currencyData.bWholeUnitsOnly ? decimal_formatted.replace(`${currencyData.strDecimalSymbol}00`, '') : decimal_formatted}`;
  1141.  
  1142. var currencyReturn = currencyData.bSymbolIsPrefix
  1143. ? `${currencyData.strSymbol}${currencyData.strSymbolAndNumberSeparator}${formatted}`
  1144. : `${formatted}${currencyData.strSymbolAndNumberSeparator}${currencyData.strSymbol}`;
  1145.  
  1146. if (currencyCode == 'USD') {
  1147. return currencyReturn + ' USD';
  1148. }
  1149. else if (currencyCode == 'EUR') {
  1150. return currencyReturn.replace(',00', ',--');
  1151. }
  1152. else {
  1153. return currencyReturn;
  1154. }
  1155. }
  1156. else {
  1157. return valueInCents;
  1158. }
  1159. }
  1160. // ---------------------- end ------------------------
  1161.  
  1162. function errorTranslator(err) {
  1163. const msg = {
  1164. "0": "访问steam失败,请检查网络连接性",
  1165. "200": "无法处理结果,结果集无法使用",
  1166. "400": "请求参数错误,服务器无法理解参数",
  1167. "404": "页面不存在,无法找到请求的资源",
  1168. "408": "访问steam超时,请检查网络连接性",
  1169. "429": "请求次数过多,饮个茶再来吧",
  1170. "500": "服务器内部错误,请稍后重试"
  1171. };
  1172. const shortMsg = {
  1173. "0": "无网络",
  1174. "200": "请重试",
  1175. "400": "参数错误",
  1176. "404": "无内容",
  1177. "408": "超时",
  1178. "429": "频繁",
  1179. "500": "请重试"
  1180. };
  1181. switch (err.status) {
  1182. case 0:
  1183. failedSteamConnection();
  1184. break;
  1185. case 429:
  1186. steamConnection = true;
  1187. break;
  1188. }
  1189. err.statusText = msg[err.status];
  1190. err.statusTextShort = shortMsg[err.status];
  1191. return err;
  1192. }
  1193.  
  1194. function updateRate(force, toast) {
  1195. if ((!force) && exchangeRate && exchangeRate.time_next_update_unix > Date.now()) {
  1196. return;
  1197. }
  1198. if ((!steamConnection) && steamConnection != undefined) {
  1199. toast && toast.reset();
  1200. showMessage("无网络时无法获取汇率", "没有设置被改变", 'warning');
  1201. return;
  1202. }
  1203. GM_xmlhttpRequest({
  1204. // 10000元锚点
  1205. url: `https://steamcommunity.com/market/listings/730/Souvenir%20Sawed-Off%20|%20Snake%20Camo%20(Well-Worn)/render/?query=&start=40&count=100&currency=${g_rgCurrencyData[helper_config.steamCurrency].eCurrencyCode}`,
  1206. // 热门锚点
  1207. // url: `https://steamcommunity.com/market/listings/730/AK-47%20%7C%20Asiimov%20%28Field-Tested%29/render/?start=0&count=50&currency=${g_rgCurrencyData[helper_config.steamCurrency].eCurrencyCode}`,
  1208. url: `https://steamcommunity.com/market/listings/730/AK-47%20%7C%20Redline%20%28Field-Tested%29/render/?start=0&count=50&currency=${g_rgCurrencyData[helper_config.steamCurrency].eCurrencyCode}`,
  1209. method: "get",
  1210. timeout: ajaxTimeout,
  1211. onload: function (response) {
  1212. toast && toast.reset();
  1213. let data = response.status == 200 ? JSON.parse(response.responseText) : {};
  1214. // if (data.success && data.listinginfo["3296062994072312107"]) {
  1215. // if (data.listinginfo["3296062994072312107"].converted_currencyid % 2000 != g_rgCurrencyData[helper_config.steamCurrency].eCurrencyCode) {
  1216. // return; // 对结果返回前的多次操作进行屏蔽,只取最后一次的结果
  1217. // }
  1218. // let timeUnix = Date.now();
  1219. // exchangeRate = {
  1220. // FtoC: (data.listinginfo["3296062994072312107"].price / data.listinginfo["3296062994072312107"].converted_price).toFixed(6),
  1221. // CtoF: (data.listinginfo["3296062994072312107"].converted_price / data.listinginfo["3296062994072312107"].price).toFixed(6),
  1222. // currencyCode: g_rgCurrencyData[helper_config.steamCurrency].strCode,
  1223. // time_next_update_unix: timeUnix + 10800000,
  1224. // time_update_unix: timeUnix
  1225. // }
  1226. // GM_setValue("exchangeRate", exchangeRate);
  1227. // GM_setValue("helper_config", helper_config);
  1228. // showMessage("获取汇率成功", `已经同步${helper_config.steamCurrency}的最新汇率`, "success");
  1229. // return;
  1230. // }
  1231. // in case of emergency
  1232. // 找到人民币上架的记录,直接通过原货币和目标货币获取汇率
  1233. if (data.success) {
  1234. for (let key in data.listinginfo) {
  1235. if (data.listinginfo[key].currencyid == 2023) {
  1236. if (data.listinginfo[key].converted_currencyid % 2000 != g_rgCurrencyData[helper_config.steamCurrency].eCurrencyCode) {return;}
  1237. let timeUnix = Date.now();
  1238. exchangeRate = {
  1239. FtoC: (data.listinginfo[key].price / data.listinginfo[key].converted_price).toFixed(6),
  1240. CtoF: (data.listinginfo[key].converted_price / data.listinginfo[key].price).toFixed(6),
  1241. currencyCode: g_rgCurrencyData[helper_config.steamCurrency].strCode,
  1242. time_next_update_unix: timeUnix + 10800000,
  1243. time_update_unix: timeUnix
  1244. }
  1245. GM_setValue("exchangeRate", exchangeRate);
  1246. GM_setValue("helper_config", helper_config);
  1247. showMessage("获取汇率成功", `已经同步${helper_config.steamCurrency}的最新汇率`, "success");
  1248. return;
  1249. }
  1250. }
  1251. }
  1252. console.log("获取汇率时错误:", response);
  1253. showMessage("获取汇率时错误", errorTranslator(response).statusText, 'error');
  1254. },
  1255. onerror: function (err) {
  1256. console.log("获取汇率失败:", err);
  1257. showMessage("获取汇率失败", errorTranslator(err).statusText, 'error');
  1258. },
  1259. ontimeout: function () {
  1260. failedSteamConnection();
  1261. let err = { "status": 408, "statusText": "连接steam超时,请检查steam市场连接性" };
  1262. console.log("获取汇率超时:", err);
  1263. showMessage("获取汇率超时", err.statusText, 'error');
  1264. }
  1265. });
  1266. }
  1267.  
  1268. function getItemId(buff_item_id, steamLink) {
  1269. return new Promise(function (resolve, reject) {
  1270. let steam_item_id = GM_getValue(buff_item_id);
  1271. if (steam_item_id) {
  1272. resolve(steam_item_id);
  1273. return;
  1274. } else if (steam_item_id === null) {
  1275. reject({ status: 404, statusText: "物品不在货架上" });
  1276. }
  1277. GM_xmlhttpRequest({
  1278. url: steamLink,
  1279. timeout: ajaxTimeout,
  1280. method: "get",
  1281. onload: function (res) {
  1282. if (res.status == 200) {
  1283. let html = res.responseText; // 页面很大
  1284. try {
  1285. steam_item_id = /Market_LoadOrderSpread\(\s?(\d+)\s?\)/.exec(html)[1];
  1286. } catch (error) {
  1287. steamConnection = true;
  1288. GM_setValue(buff_item_id, null);
  1289. res.status = 404;
  1290. res.statusText = "物品不在货架上";
  1291. console.log("获取itemID状态异常:", res);
  1292. reject(res);
  1293. return;
  1294. }
  1295. GM_setValue(buff_item_id, steam_item_id);
  1296. resolve(steam_item_id);
  1297. } else {
  1298. console.log("获取itemID状态异常:", res);
  1299. reject(errorTranslator(res));
  1300. }
  1301. },
  1302. onerror: function (err) {
  1303. console.log("获取itemID错误:", err);
  1304. reject(errorTranslator(err));
  1305. },
  1306. ontimeout: function () {
  1307. failedSteamConnection();
  1308. let err = { "status": 408, "statusText": "连接steam超时,请检查steam市场连接性" };
  1309. console.log("获取itemID超时:", err);
  1310. reject(err);
  1311. }
  1312. });
  1313. });
  1314. }
  1315.  
  1316. function getSteamOrderList(buff_item_id, steamLink) {
  1317. return new Promise(function (resolve, reject) {
  1318. if ((!steamConnection) && steamConnection != undefined) {
  1319. let err = { "status": 408, "statusText": "无法访问steam" };
  1320. resolve(err);
  1321. return;
  1322. }
  1323. getItemId(buff_item_id, steamLink).then(function onFulfilled(steam_item_id) {
  1324. GM_xmlhttpRequest({
  1325. url: `https://steamcommunity.com/market/itemordershistogram?country=CN&language=schinese&currency=${steamCurrency.eCurrencyCode}&item_nameid=${steam_item_id}&two_factor=0`,
  1326. timeout: ajaxTimeout,
  1327. headers: {
  1328. "referer": steamLink,
  1329. "X-Requested-With": "XMLHttpRequest",
  1330. "Host": "steamcommunity.com",
  1331. "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35"
  1332. },
  1333. method: "get",
  1334. onload: function (res) {
  1335. if (res.status == 200) {
  1336. steamConnection = true;
  1337. resolve(JSON.parse(res.responseText));
  1338. return;
  1339. }
  1340. console.log("访问steamorder状态异常:", res);
  1341. resolve(errorTranslator(res));
  1342. },
  1343. onerror: function (err) {
  1344. console.log("访问steamorder列表出错:", err);
  1345. resolve(errorTranslator(err));
  1346. },
  1347. ontimeout: function () {
  1348. failedSteamConnection();
  1349. let err = { "status": 408, "statusText": "连接steam超时,请检查steam市场连接性" };
  1350. console.log("访问steamorder列表超时:", err);
  1351. resolve(err);
  1352. }
  1353. });
  1354. }).catch(function onRejected(err) {
  1355. resolve(err);
  1356. });
  1357. });
  1358. }
  1359.  
  1360. function getSteamSoldNumber(app_id, hash_name) {
  1361. return new Promise(function (resolve) {
  1362. if ((!steamConnection) && steamConnection != undefined) {
  1363. let err = { "status": 408, "statusText": "无法访问steam" };
  1364. resolve(err);
  1365. return;
  1366. }
  1367. GM_xmlhttpRequest({
  1368. url: `https://steamcommunity.com/market/priceoverview/?appid=${app_id}&currency=${steamCurrency.eCurrencyCode}&market_hash_name=${hash_name}`,
  1369. timeout: ajaxTimeout,
  1370. headers: {
  1371. "referer": `https://steamcommunity.com/market/listings/${app_id}/${hash_name}`,
  1372. "X-Requested-With": "XMLHttpRequest",
  1373. "Host": "steamcommunity.com",
  1374. "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35"
  1375. },
  1376. method: "get",
  1377. onload: function (res) {
  1378. if (res.status == 200) {
  1379. steamConnection = true;
  1380. let json = JSON.parse(res.responseText);
  1381. if (json.success) {
  1382. resolve(json);
  1383. return;
  1384. }
  1385. }
  1386. console.log("访问steam销售数量状态异常:", res);
  1387. resolve(errorTranslator(res));
  1388. },
  1389. onerror: function (err) {
  1390. console.log("访问steam销售数量出错:", err);
  1391. resolve(errorTranslator(err));
  1392. },
  1393. ontimeout: function () {
  1394. failedSteamConnection();
  1395. let err = { "status": 408, "statusText": "连接steam超时,请检查steam市场连接性" };
  1396. console.log("访问steam销售数量超时:", err);
  1397. resolve(err);
  1398. }
  1399. });
  1400. });
  1401. }
  1402.  
  1403. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址