回复
7
查看
276
收藏
7

9

赠楼

10%

赠楼率

2478

蒸汽

138

主题

7273

帖子

7020

积分
发表于 昨天 23:11 · 安徽 | 显示全部楼层 |阅读模式
本文为 其乐用户(UID:376220) 发布的原创文章,转摘前请联系该用户获得许可
本帖最后由 376220 于 2025-7-11 23:22 编辑

原脚本:https://keylol.com/t129183-1-1
但脚本好像已经被删除了,中间改过几个版本,而这次夏促发现出现了夏促卡牌随机无法加载出价格的问题
检查了一下原因是促销开始一周前的神秘卡牌(促销开始后会转换为正常的促销卡牌)偶尔也会在过滤结果中,导致匹配错误
修改方法是在市场过滤器里加上可出售的过滤条件:

$J.getJSON('//steamcommunity.com/market/search/render/?start=0&count=20&category_753_cardborder[]=tag_cardborder_'+foil+'&appid=753&category_753_Game[]=tag_app_'+appid, function(data){
修改为
$J.getJSON('//steamcommunity.com/market/search/render/?start=0&count=40&category_753_cardborder[]=tag_cardborder_'+foil+'&appid=753&category_753_item_class%5B%5D=marketable&category_753_Game[]=tag_app_'+appid, function(data){
即可正常使用

考虑到原始链接已经无法打开,这里放上修改后的版本:

  1. // ==UserScript==
  2. // @name            Enhanced Steam Community
  3. // @author          Deparsoul & onisuly
  4. // @namespace       https://greasyfork.org/users/726
  5. // @description     Add some extra functions to Steam Community
  6. // @copyright       2015+,  Deparsoul & onisuly
  7. // @version         2019.11.29
  8. // @icon            https://store.steampowered.com/favicon.ico
  9. // @license         GPL version 3 or any later version
  10. // @include         http*://steamcommunity.com/*
  11. // @include         http*://store.steampowered.com/*
  12. // @run-at          document-end
  13. // @grant           GM_xmlhttpRequest
  14. // @connect         www.steamcardexchange.net
  15. // ==/UserScript==

  16. /*
  17. *This program is free software: you can redistribute it and/or modify
  18. *it under the terms of the GNU General Public License as published by
  19. *the Free Software Foundation, either version 3 of the License, or
  20. *(at your option) any later version.
  21. *
  22. *This program is distributed in the hope that it will be useful,
  23. *but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  25. *GNU General Public License for more details.
  26. *
  27. *You should have received a copy of the GNU General Public License
  28. *along with this program.  If not, see <http://www.gnu.org/licenses/>.
  29. */
  30. // 下面用了一个将代码嵌入到网页中的技巧
  31. function escMain() {

  32. // Enhanced Steam Community 代码开始

  33. $J = $J || jQuery;
  34. // 多语言支持
  35. var escSteamLanguage = escGetCookie("Steam_Language");
  36. var escMatch;
  37. if (!escSteamLanguage) {
  38.     // 尝试从网页中检测出语言
  39.     escMatch = document.head.innerHTML.match(/l=([a-z]+)/);
  40.     if (escMatch) {
  41.         escSteamLanguage = escMatch[1];
  42.     }
  43. }
  44. // 默认语言字符串
  45. var escT = {};
  46. {
  47.     escT.Market           = "View in Market";
  48.     escT.MarketAll        = "All";
  49.     escT.MarketCard       = "Card";
  50.     escT.MarketBackground = "Background";
  51.     escT.MarketEmoticon   = "Emoticon";
  52.     escT.Inventory        = "View in My Inventory";
  53.     escT.Showcase         = "Card Showcase";
  54.     escT.EditBKG          = "Edit Background";
  55.     escT.BKGTips          = "Please enter your background image link:\n(resolution:1920x1200)";
  56.     escT.SearchFriends    = "Search Friends";
  57.     escT.WebChat          = "Web Chat";
  58.     escT.OneClickBuying   = "1-Click buying";
  59.     escT.ViewMarket       = "View in Market";
  60.     escT.SellItem         = "Sell";
  61.     escT.BKGAlert         = "Please set a background in edit profile page first!";
  62.     escT.ViewBKG          = "View Background";
  63.     escT.ViewBKGSign      = "Profile Background";
  64.     escT.LibrarySearch           = "Advanced Search";
  65.     escT.BatchBuyCard     = "Batch Buy Cards (Beta, Use at Your Own Risk)";
  66.     escT.BatchBuyBtn      = "Batch Buy";
  67.     escT.BatchBuyConfirm  = "Batch Buy Confirmation";
  68.     escT.BatchBuyMessage  = "Your current buy orders will be canceled. Please keep this window open while placing orders. And you need to pay at most ";
  69.     escT.BatchBuyCheck    = "Fail to fetch market info. You may need to open the market page of any card and try again";
  70.     escT.Confirm          = "Confirm";
  71.     escT.Cancel           = "Cancel";
  72.     escT.Name             = "Name";
  73.     escT.Demand           = "Demand";
  74.     escT.Supply           = "Supply";
  75.     escT.Order            = "Order";
  76.     escT.Owned            = "Owned";
  77.     escT.Loading          = "Loading...";
  78.     escT.TargetLevel      = "Target Level";
  79.     escT.CurrentLevel     = "Current Level";
  80.     escT.BoosterPack      = "Booster Pack";
  81.     escT.ThreeCardAvg     = "Three Cards";
  82.     escT.Fail             = "Fail";
  83.     escT.BatchBuyModes    = ["Buy Them Now", "Lowest Sell", "Highest Buy", "Second Buy", "Lowest"];
  84. }
  85. // 中文支持,可仿照此格式扩展其他语言
  86. if (escSteamLanguage == "schinese") {
  87.     escT.Market           = "在“市场”中查看";
  88.     escT.MarketAll        = "全部";
  89.     escT.MarketCard       = "卡牌";
  90.     escT.MarketBackground = "背景";
  91.     escT.MarketEmoticon   = "表情";
  92.     escT.Inventory        = "在我的“库存”中查看";
  93.     escT.Showcase         = "卡片展示橱窗";
  94.     escT.EditBKG          = "编辑背景图";
  95.     escT.BKGTips          = "请输入你的背景图链接:\n(分辨率:1920x1200)";
  96.     escT.SearchFriends    = "搜索好友";
  97.     escT.WebChat          = "网页聊天";
  98.     escT.OneClickBuying   = "一键购买";
  99.     escT.ViewMarket       = "在市场中查看";
  100.     escT.SellItem         = "出售";
  101.     escT.BKGAlert         = "请先在编辑个人资料页面设置一个背景!";
  102.     escT.ViewBKG          = "查看背景图";
  103.     escT.ViewBKGSign      = "个人资料背景";
  104.     escT.LibrarySearch           = "高级搜索";
  105.     escT.BatchBuyCard     = "批量购买卡牌(测试中,风险自负)";
  106.     escT.BatchBuyBtn      = "批量下单";
  107.     escT.BatchBuyConfirm  = "批量购买确认";
  108.     escT.BatchBuyMessage  = "请注意,你目前已有的订购单会被取消。下单需要一段时间,请不要关闭窗口。本次批量下单的总金额为:";
  109.     escT.BatchBuyCheck    = "无法获取市场信息,你可能需要先打开某张卡片的市场页面,再重新尝试本功能";
  110.     escT.Confirm          = "确认";
  111.     escT.Cancel           = "取消";
  112.     escT.Name             = "名称";
  113.     escT.Demand           = "需要";
  114.     escT.Supply           = "供给";
  115.     escT.Order            = "订单";
  116.     escT.Owned            = "已有";
  117.     escT.Loading          = "加载中...";
  118.     escT.TargetLevel      = "目标等级";
  119.     escT.CurrentLevel     = "当前等级";
  120.     escT.BoosterPack      = "补充包";
  121.     escT.ThreeCardAvg     = "三张卡";
  122.     escT.Fail             = "出错";
  123.     escT.BatchBuyModes    = ["尽快买齐", "最低卖价", "最高买价", "第二买价", "最低出价"];
  124. }else if (escSteamLanguage == "tchinese") {
  125.     escT.Market           = "在“市集”中查看";
  126.     escT.MarketAll        = "全部";
  127.     escT.MarketCard       = "卡片";
  128.     escT.MarketBackground = "背景";
  129.     escT.MarketEmoticon   = "表情";
  130.     escT.Inventory        = "在我的“物品库”中查看";
  131.     escT.Showcase         = "卡片展示橱窗";
  132.     escT.EditBKG          = "编辑背景图";
  133.     escT.BKGTips          = "请输入你的背景图连结:\n(解析度:1920x1200)";
  134.     escT.SearchFriends    = "搜索好友";
  135.     escT.WebChat          = "网页聊天";
  136.     escT.OneClickBuying   = "一键购买";
  137.     escT.ViewMarket       = "在市场中查看";
  138.     escT.SellItem         = "贩卖";
  139.     escT.BKGAlert         = "请先在编辑个人档案页面设置一个背景!";
  140.     escT.ViewBKG          = "查看背景图";
  141.     escT.ViewBKGSign      = "个人档案背景";
  142.     escT.LibrarySearch           = "高级搜索";
  143.     escT.BatchBuyCard     = "批量购买卡牌(测试中,风险自负)";
  144.     escT.BatchBuyBtn      = "批量下单";
  145.     escT.BatchBuyConfirm  = "批量购买确认";
  146.     escT.BatchBuyMessage  = "请注意,你目前已有的买单会被取消。下单需要一段时间,请不要关闭窗口。买单的总金额为:";
  147.     escT.BatchBuyCheck    = "无法获取市场信息,你可能需要先打开某张卡片的市场页面,再重新尝试本功能";
  148.     escT.Confirm          = "确认";
  149.     escT.Cancel           = "取消";
  150.     escT.Name             = "名称";
  151.     escT.Demand           = "需要";
  152.     escT.Supply           = "供给";
  153.     escT.Order            = "订单";
  154.     escT.Owned            = "已有";
  155.     escT.Loading          = "加载中...";
  156.     escT.TargetLevel      = "目标等级";
  157.     escT.CurrentLevel     = "当前等级";
  158.     escT.BoosterPack      = "补充包";
  159.     escT.ThreeCardAvg     = "三张卡";
  160.     escT.Fail             = "出错";
  161.     escT.BatchBuyModes    = ["尽快买齐", "最低卖价", "最高买价", "第二买价", "最低出价"];
  162. }

  163. var escUrlBase = $J('#global_actions .user_avatar').attr('href');
  164. var escUrlInventory = escUrlBase + 'inventory/';

  165. if (location.href.match(/^https?:\/\/steamcommunity\.com\/(id|profiles)\/.+\/gamecards\/[0-9]+/)) {
  166.     // 某个游戏的徽章页面
  167.     escEnhanceBadges();
  168. } else if (location.href.match(/^https?:\/\/store\.steampowered\.com\/recommended\/friendactivity/)) {
  169.     // 好友活动页面
  170.     setTimeout(escFriendActivity, 100);
  171. } else if (location.href.match(/^https?:\/\/steamcommunity\.com\/market\/listings\/.+/)) {
  172.     // 市场商品页面
  173.     escOneClickBuying();
  174. } else if (location.href.match(/^https?:\/\/steamcommunity\.com\/market\/search\?.+/)) {
  175.     // 市场搜索页面
  176.     escEnhanceMarketSearch();
  177. } else if (location.href.match(/^https?:\/\/store\.steampowered\.com\/agecheck\/app\/[0-9]+\//)) {
  178.     // 年龄检查页面
  179.     escSkipAgeCheck();
  180. } else if (location.href.match(/^https?:\/\/steamcommunity\.com\/(id|profiles)\/.+\/friends/)) {
  181.     // 好友页面
  182.     escEnhanceFriends();
  183. } else if (location.href.match(/^https?:\/\/steamcommunity\.com\/(id|profiles)\/.+\/inventory/)) {
  184.     // 库存页面
  185.     escMatch = location.href.match(/(#.*)\?filter=(.*)/);
  186.     if (escMatch) {
  187.         location.hash = escMatch[1];
  188.         escApplyInventoryFilter(0, escMatch[2]);
  189.     }
  190.     escEnhanceInventory();
  191. } else if (location.href.match(/^https?:\/\/steamcommunity\.com\/tradeoffer\/.+/)) {
  192.     // 离线交易页面
  193.     setTimeout(escEnhanceTradeOffer, 500);
  194. }

  195. function escFriendActivity() {
  196.     for (var prefix in g_rgPagingControls) {
  197.         var originalResponseHandler = g_rgPagingControls[prefix].m_fnResponseHandler;
  198.         g_rgPagingControls[prefix].SetResponseHandler(function (response) {
  199.             originalResponseHandler(response);
  200.             $J('img[src$="friendactivity_noimage.jpg"]').each(function () {
  201.                 var $img = $J(this);
  202.                 var $link = $J(this).parent();
  203.                 var appid = $link.data('ds-appid');
  204.                 if (appid) {
  205.                     $link.attr('href', '//store.steampowered.com/app/' + appid + '/?cc=hk');
  206.                     $img.attr('src', '//cdn.akamai.steamstatic.com/steam/apps/' + appid + '/capsule_sm_120.jpg');
  207.                 }
  208.             });
  209.         });
  210.     }
  211. }

  212. function escEnhanceTradeOffer() {
  213.     // 防止库存页卡住的迷之代码
  214.     $J('#inventory_select_their_inventory').click();
  215.     $J('#inventory_select_your_inventory').click();

  216.     // 过滤对应的 appid
  217.     var match = location.href.match(/for_tradingcard=(\d+)_/);
  218.     if (match) {
  219.         var appid = match[1];
  220.         setTimeout('TradePageSelectInventory(UserYou, 753, 0)', 5);
  221.         var filter = 'tag_filter_753_0_Game_app_' + appid;
  222.         function apply_filter() {
  223.             escApplyInventoryFilter(0, filter);
  224.         }
  225.         setTimeout(apply_filter, 500);
  226.         $J('#inventory_select_their_inventory, #inventory_select_your_inventory').click(apply_filter);
  227.     }
  228. }

  229. function escChangeMarketSearchPageSize() {
  230.     if (!escGetLS('market_pagesize')) {
  231.         escSetLS('market_pagesize', 20);
  232.     }

  233.     var pagesize = escGetLS('market_pagesize');

  234.     g_oSearchResults.SetPageChangedHandler(function () {
  235.         escShowInventoryAmount();
  236.     });

  237.     if (pagesize && g_oSearchResults.m_cPageSize != pagesize && typeof g_oSearchResults !== undefined) {
  238.         g_oSearchResults.m_cPageSize = pagesize;
  239.         g_oSearchResults.m_bLoading = false;
  240.         HandleHashChange(0);
  241.         g_oSearchResults.GoToPage(0, true);
  242.         $J('#searchResultsRows').stop().fadeTo(0, 1.0);
  243.     }
  244. }

  245. function escEnhanceMarketSearch() {
  246.     escShowInventoryAmount();
  247.     setTimeout(escChangeMarketSearchPageSize, 300);
  248. }

  249. // 打开库存时自动激活指定过滤条件
  250. function escApplyInventoryFilter(i, filter) {
  251.     // 尝试展开过滤器列表
  252.     if (g_ActiveInventory && g_ActiveInventory.ShowTags)
  253.         g_ActiveInventory.ShowTags();

  254.     if (filter) {
  255.         if ($J('#' + filter).length) {
  256.             $J('#' + filter).click();
  257.         } else {
  258.             ++i;
  259.             if (i < 20) // 限制重试次数
  260.                 setTimeout('escApplyInventoryFilter(' + i + ', "' + filter + '")', 500);
  261.         }
  262.     }
  263. }

  264. // 接收 SCE 数据
  265. function escProcBadges(data) {
  266.     // 将 SCE 页面中的链接替换成支持 https 的域名
  267.     data = data.replace(/https?:\/\/(community\.edgecast\.steamstatic\.com|steamcommunity-a\.akamaihd\.net|cdn\.steamcommunity\.com)\//g, "//steamcommunity-a.akamaihd.net/");
  268.     data = data.replace(/https?:\/\/(cdn\.edgecast\.steamstatic\.com|steamcdn-a\.akamaihd\.net|cdn\.akamai\.steamstatic\.com)\//g, "//steamcdn-a.akamaihd.net/");
  269.     $J('.gamecard_badge_progress').css('bottom', 'auto').css('top', 0);
  270.     var sce = $J(data);
  271.     // 普通徽章
  272.     var badges = sce.find('h3:contains("BADGES"):not(:contains("FOIL"))').closest('.content-box');
  273.     if (window.location.href.indexOf('?border=1') != -1) {
  274.         // 闪亮徽章
  275.         badges = sce.find('h3:contains("FOIL BADGES")').closest('.content-box');
  276.     }
  277.     badges.find('.showcase-element-container.badge>.showcase-element').each(function () {
  278.         var badge = $J(this);
  279.         if (badge.text()) {
  280.             //$J('.gamecard_badge_progress').remove();
  281.             var img = badge.find('.element-image').attr('src');
  282.             var text = badge.find('.element-text').text();
  283.             var level = badge.find('.element-experience').html();
  284.             $J('.badge_content.gamecard_details').append('<div class="badge_info" style="float:left;width:80px;text-align:center;padding:5px;min-height:150px;"><div class="badge_info_image"><img src="' + img + '"></div><div class="badge_info_description"><div class="badge_info_title">' + text + '</div><div>' + level + '</div></div><div style="clear: left;"></div></div>')
  285.         }
  286.     });
  287.     $J('.badge_content.gamecard_details').append('<div style="clear: both"></div>');
  288.     sce.find('h3:contains("EMOTICONS")').closest('.content-box').find('.showcase-element-container.emoticon>.showcase-element').each(function () {
  289.         var item = $J(this);
  290.         if (item.text()) {
  291.             $J('.badge_content.gamecard_details').append('<div class="badge_info" style="float:left;width:80px;text-align:center;padding:5px;"><div><img src="' + item.find('.element-image.small').attr('src') + '"></div><div><img src="' + item.find('.element-image.big').attr('src') + '"></div><div><div class="badge_info_title">' + item.find('.element-text').text() + '</div><div>' + item.find('.element-experience').text() + '</div></div><div style="clear: left;"></div></div>')
  292.         }
  293.     });
  294.     $J('.badge_content.gamecard_details').append('<div style="clear: both"></div>');
  295.     sce.find('h3:contains("BACKGROUNDS")').closest('.content-box').find('.showcase-element-container.background>.showcase-element').each(function () {
  296.         var item = $J(this);
  297.         if (item.text()) {
  298.             $J('.badge_content.gamecard_details').append('<div class="badge_info" style="float:left;width:160px;text-align:center;padding:5px;"><div><a target="_blank" href="' + item.find('.element-image').attr('href') + '"><img src="' + item.find('.element-image img').attr('src').replace('112x70f', '160x100f') + '"></a></div><div><div class="badge_info_title">' + item.find('.element-text').text() + '</div><div>' + item.find('.element-experience').text() + '</div></div><div style="clear: left;"></div></div>')
  299.         }
  300.     });
  301. }

  302. // 为徽章页面添加在库存、市场、SCE 查看的选项(似乎会覆盖原有链接)
  303. function escEnhanceBadges() {
  304.     var cards = []; // 保存卡片信息
  305.     var booster = null; // 补充包信息
  306.     var appid = location.href.match(/gamecards\/(\d+)(?!\w)/)[1];

  307.     var batch_state = 0; // 状态:0=为初始化,1=正在初始化,2=初始化完成,3=正在下单

  308.     var target_level = 5;   // 目标等级
  309.     var current_level = 0;  // 当前等级
  310.     var current_badge = $J('.badge_current .badge_info_description>div:eq(1)');
  311.     if (current_badge.length) {
  312.         current_level = parseInt(current_badge.text().match(/\d+/));
  313.     }

  314.     // foil = 1 为闪卡, 0 为普通卡
  315.     var foil = window.location.href.indexOf('?border=1') != -1;
  316.     if (foil) {
  317.         foil = 1;
  318.         target_level = 1;
  319.     } else {
  320.         foil = 0;
  321.     }
  322.     var link_market = '//steamcommunity.com/market/search?q=&category_753_Game[]=tag_app_' + appid + '&category_753_item_class[]=tag_item_class_2&appid=753';
  323.     var link_inventory = escUrlInventory + "#753_6" + "?filter=tag_filter_753_6_Game_app_" + appid;
  324.     var link_showcase = 'https://www.steamcardexchange.net/index.php?gamepage-appid-' + appid;
  325.     $J('.gamecards_inventorylink:first').html('<a class="btn_grey_grey btn_small_thin" target="_blank" id="batch_buy_card" href=' + link_market + '><span>' + escT.BatchBuyCard + '</span></a>&nbsp;<a class="btn_grey_grey btn_small_thin" target="_blank" href=' + link_market + '><span>' + escT.Market + '</span></a>&nbsp;<a class="btn_grey_grey btn_small_thin" target="_blank" href=' + link_inventory + '><span>' + escT.Inventory + '</span></a>&nbsp;<a class="btn_grey_grey btn_small_thin" target="_blank" href=' + link_showcase + '><span>' + escT.Showcase + '</span></a>&nbsp;');

  326.     // 将空值转换成问号
  327.     function text_wrapper(value) {
  328.         if (value !== undefined)
  329.             return value;
  330.         else
  331.             return '?';
  332.     }

  333.     // 刷新统计表格
  334.     function refresh_market_table() {
  335.         var i, j;
  336.         // 构造表头
  337.         var content = '<table cellpadding=5 style="margin:auto;font-size:90%;">';
  338.         content += '<tr><th>' + escT.MarketCard + '</th><th>' + escT.Name + '</th><th>' + escT.Owned + '</th><th>' + escT.Demand + '</th>';
  339.         for (j = 0; j < escT.BatchBuyModes.length; ++j) {
  340.             content += '<th>' + escT.BatchBuyModes[j] + '</th>';
  341.         }
  342.         content += '<th>'+escT.Supply+'</th><th>'+escT.Order+'</th></tr>';

  343.         // 用于统计三张卡片均价
  344.         var set_cost = 0;
  345.         var set_count = 0;

  346.         var total_cost = []; // 用于统计总费用
  347.         var total_estimate = [];
  348.         var is_complete = true; // 用于判断数据是否已经加载完
  349.         for (i = 0; i < cards.length; i++) {
  350.             var card = cards[i];
  351.             var demand = target_level - current_level - card.count;
  352.             if (demand < 0) demand = 0;
  353.             if (card.price !== undefined) {
  354.                 set_cost += card.price[0]; // 使用最低卖价
  355.                 set_count++;
  356.                 var buy_now_remain = demand;
  357.                 var buy_now_amount, buy_now_price = 0, buy_now_total = 0, buy_now_limit = 0;
  358.                 for (j = 0; j < card.graph_sell.length; ++j) {
  359.                     if (buy_now_limit && card.graph_sell[j][0] > buy_now_limit)
  360.                         break;
  361.                     buy_now_price = card.graph_sell[j][0];
  362.                     if (!buy_now_limit)
  363.                         buy_now_limit = buy_now_price * 2;
  364.                     buy_now_amount = card.graph_sell[j][1];
  365.                     if (j > 0)
  366.                         buy_now_amount -= card.graph_sell[j - 1][1];
  367.                     buy_now_amount = Math.min(buy_now_amount, buy_now_remain);
  368.                     buy_now_total += buy_now_price * buy_now_amount;
  369.                     buy_now_remain -= buy_now_amount;
  370.                     if (buy_now_remain <= 0)
  371.                         break;
  372.                 }
  373.                 //buy_now_price = Math.ceil(buy_now_price * 10) / 100; // dummy price for debug
  374.                 card.price[0] = buy_now_price;
  375.                 buy_now_amount = demand - buy_now_remain;
  376.                 var buy_now_text = format_price(buy_now_price) + ' x ' + buy_now_amount + ' ≈ ' + format_price(buy_now_total);
  377.                 if (buy_now_amount < demand)
  378.                     buy_now_text = '<span style="color:red">' + buy_now_text + '</span>';
  379.                 card.price_text[0] = buy_now_text;
  380.                 total_estimate[0] = (total_estimate[0] || 0) + buy_now_total;
  381.                 for (j = 0; j < card.price.length; ++j) {
  382.                     if (total_cost[j] === undefined)
  383.                         total_cost[j] = 0;
  384.                     total_cost[j] += demand * card.price[j];
  385.                 }
  386.             } else {
  387.                 is_complete = false;
  388.             }
  389.             // 构造数据行
  390.             content += '<tr><td><img src="' + card.img + '" style="height:32px;"></td><td><a target="_blank" href="//steamcommunity.com/market/listings/753/' + encodeURIComponent(card.hash) + '">' + card.name + '</td><td>' + card.count + '</a></td><td>' + demand + '</td>';
  391.             for (j = 0; j < escT.BatchBuyModes.length; ++j) {
  392.                 if (card.price_text && card.price_text[j]) {
  393.                     content += '<td>' + card.price_text[j] + '</td>';
  394.                 } else {
  395.                     content += '<td>?</td>';
  396.                 }
  397.             }
  398.             content += '<td>' + text_wrapper(card.quantity) + '</td><td>' + text_wrapper(card.order) + '</td></tr>';
  399.         }
  400.         content += "</table>";
  401.         if (booster) {
  402.             var b = '<a target="_blank" href="' + booster.link + '">' + escT.BoosterPack + '</a>: ' + booster.price + '&nbsp;';
  403.             if (is_complete) {
  404.                 b += escT.ThreeCardAvg + ': ' + format_price(set_cost / set_count * 3);
  405.             }
  406.             content = b + content;
  407.         }
  408.         // 如果加载完成,显示按钮并更新总费用
  409.         if (is_complete) {
  410.             for (j = 0; j < total_cost.length; ++j) {
  411.                 $J('.btn_batch_buy:eq(' + j + ') span.total_cost').text(format_price(total_cost[j]) + (total_estimate[j] ? ' ≈ ' + format_price(total_estimate[j]) : ''));
  412.             }
  413.             if (batch_state == 1) {
  414.                 $J('.btn_batch_buy').fadeIn();
  415.                 batch_state = 2;
  416.             }
  417.         }
  418.         $J('#market_data').html(content);
  419.     }

  420.     // 调用 Steam 网页接口所需要的几个变量,会在分析市场页面的时候填写
  421.     var g_sessionID = '';
  422.     var g_walletCurrency = '';
  423.     var g_strCountryCode = '';
  424.     var g_strLanguage = '';

  425.     // 改用官方函数格式化价格
  426.     function format_price(price) {
  427.         return v_currencyformat(price * 100, GetCurrencyCode(g_walletCurrency), g_strCountryCode);
  428.     }

  429.     // 读取第 i 张卡的市场信息,延迟递归
  430.     function load_card_listing(i) {
  431.         if (i >= cards.length)
  432.             return;
  433.         var card = cards[i];
  434.         if (card.hash === undefined) {
  435.             load_card_listing(i + 1);
  436.             return;
  437.         }
  438.         $J.get('//steamcommunity.com/market/listings/753/' + encodeURIComponent(card.hash), function (data) {
  439.             g_sessionID = data.match(/g_sessionID = "([^"]+)"/)[1];
  440.             g_walletCurrency = parseInt(data.match(/"wallet_currency":(\d+)/)[1]);
  441.             g_strLanguage = data.match(/g_strLanguage = "([^"]+)"/)[1];
  442.             g_strCountryCode = data.match(/g_strCountryCode = "([^"]+)"/)[1];
  443.             var nameid = data.match(/Market_LoadOrderSpread\( (\d+)/)[1];
  444.             var order = data.match(/id="mybuyorder_(\d+)">[\s\S]*<span class="market_listing_price">\s*<span class="market_listing_inline_buyorder_qty">(.+?) @<\/span>\s*(.*?)\s*<\/span>/);
  445.             card.nameid = nameid;

  446.             // 是否有买单
  447.             card.order = '0';
  448.             if(order){
  449.                 card.order_id = order[1];
  450.                 card.order_price = order[2];
  451.                 card.order_amount = order[3];
  452.                 card.order = order[3]+' x '+order[2];
  453.             }

  454.             // 获取买卖信息
  455.             $J.ajax({
  456.                 url: '//steamcommunity.com/market/itemordershistogram',
  457.                 type: 'GET',
  458.                 data: {
  459.                     country: g_strCountryCode,
  460.                     language: g_strLanguage,
  461.                     currency: g_walletCurrency,
  462.                     item_nameid: nameid
  463.                 }
  464.             }).success(function(data){
  465.                 var graph_sell = data.sell_order_graph; // 卖单
  466.                 var graph_buy = data.buy_order_graph;   // 买单
  467.                 card.graph_sell = graph_sell;
  468.                 // 如果没有卖单则不进行处理
  469.                 if (!graph_sell.length)
  470.                     return;
  471.                 // 如果没有买单则将最低价卖单作为买单
  472.                 if (!graph_buy.length)
  473.                     graph_buy = [graph_sell[0]];

  474.                 card.price = []; // 价格信息
  475.                 card.price_text = []; // 价格的文字说明

  476.                 // 尽快买齐(先占位,之后根据购买数量动态计算)
  477.                 card.price.push(null);
  478.                 card.price_text.push(null);

  479.                 // 最低卖单
  480.                 card.price.push(graph_sell[0][0]);
  481.                 card.price_text.push(format_price(graph_sell[0][0]) + ' x ' + graph_sell[0][1]);

  482.                 var j = 0;
  483.                 // 最高买单
  484.                 card.price.push(graph_buy[j][0]);
  485.                 card.price_text.push(format_price(graph_buy[j][0]) + ' x ' + graph_buy[j][1]);

  486.                 if (graph_buy[1]) {
  487.                     j = 1;
  488.                 }
  489.                 // 次高买单
  490.                 card.price.push(graph_buy[j][0]);
  491.                 card.price_text.push(format_price(graph_buy[j][0]) + ' x ' + graph_buy[j][1]);

  492.                 j = graph_buy.length - 1;
  493.                 // 最低价格
  494.                 card.price.push(graph_buy[j][0]);
  495.                 card.price_text.push(format_price(graph_buy[j][0]) + ' x ' + graph_buy[j][1]);

  496.                 refresh_market_table();
  497.             });

  498.             refresh_market_table();
  499.             setTimeout(function () { load_card_listing(i + 1); }, 500);
  500.         }).fail(function () {
  501.             // TODO: 这里可能需要一个更好的解决方法
  502.             alert(escT.BatchBuyCheck);
  503.         });
  504.     }

  505.     // 开始批量下单,mode 为出价模式为
  506.     function batch_buy(mode) {
  507.         // 取消第 i 张卡片的订单,延迟递归
  508.         function cancel_buy(i) {
  509.             // 全部取消后开始下单
  510.             if (i == cards.length) {
  511.                 place_buy(0);
  512.                 return;
  513.             }
  514.             var card = cards[i];
  515.             if (card.order_id !== undefined) {
  516.                 $J.post('/market/cancelbuyorder/', { sessionid: g_sessionID, buy_orderid: card.order_id }, function (data) {
  517.                     if (data.success == 1) {
  518.                         card.order = '0';
  519.                     } else {
  520.                         card.order = escT.Fail;
  521.                     }
  522.                     refresh_market_table();
  523.                     setTimeout(function () { cancel_buy(i + 1); }, 500);
  524.                 });
  525.             } else {
  526.                 cancel_buy(i + 1);
  527.             }
  528.         }

  529.         // 为第 i 张卡片下单
  530.         function place_buy(i) {
  531.             if (i == cards.length) {
  532.                 return;
  533.             }
  534.             var card = cards[i];
  535.             var demand = target_level - current_level - card.count;
  536.             if (card.hash !== undefined && demand > 0) {
  537.                 var price = card.price[mode];
  538.                 $J.ajax({
  539.                     url: 'https://steamcommunity.com/market/createbuyorder/',
  540.                     type: 'POST',
  541.                     data: {
  542.                         sessionid: g_sessionID,
  543.                         currency: g_walletCurrency,
  544.                         appid: 753,
  545.                         market_hash_name: card.hash,
  546.                         price_total: Math.round(demand * price * 100),
  547.                         quantity: demand
  548.                     },
  549.                     crossDomain: true,
  550.                     xhrFields: { withCredentials: true }
  551.                 }).done(function (data) {
  552.                     if (data.success == 1) {
  553.                         card.order = format_price(price) + ' x ' + demand;
  554.                     } else {
  555.                         card.order = escT.Fail;
  556.                     }
  557.                     refresh_market_table();
  558.                     setTimeout(function () { place_buy(i + 1); }, 500);
  559.                 });
  560.             } else {
  561.                 place_buy(i + 1);
  562.             }
  563.         }

  564.         // 先取消已有订单
  565.         cancel_buy(0);
  566.     }

  567.     // 在按钮上绑定批量买卡的初始化函数
  568.     $J('#batch_buy_card').click(function () {
  569.         if (batch_state == 0) {
  570.             batch_state = 1;
  571.             var t = $J(this).closest('.badge_detail_tasks');
  572.             t.before('<div class="badge_detail_tasks"><div class="gamecards_inventorylink">'+escT.CurrentLevel+' : <span style="background-color: rgba(0, 0, 0, 0.2); border: 1px solid #000; border-radius: 3px; box-shadow: 1px 1px 0 0 rgba(91, 132, 181, 0.2); color: #909090; width: 30px; display: inline-block;">'+current_level+'</span>&nbsp;'+escT.TargetLevel+' : <input type="text" value="5" id="target_level" style="width:30px;"></div><div class="gamecards_inventorylink" id="market_data">'+escT.Loading+'</div></div><div style="clear: both"></div>');

  573.             // 出价按钮
  574.             var btn = '&nbsp;' + escT.BatchBuyBtn + ':';
  575.             for (var j = 0; j < escT.BatchBuyModes.length; ++j) {
  576.                 btn += '&nbsp;<a class="btn_grey_grey btn_small_thin btn_batch_buy" style="display:none;" data-mode="' + j + '"><span>' + escT.BatchBuyModes[j] + ' <span class="total_cost">?</span></span></a>';
  577.             }
  578.             $J('#target_level').after(btn);
  579.             $J('.btn_batch_buy').click(function(){
  580.                 var btn = $J(this);
  581.                 var total_cost = btn.find('.total_cost').text();
  582.                 var mode = btn.data('mode');
  583.                 ShowConfirmDialog(
  584.                     escT.BatchBuyConfirm,
  585.                     escT.BatchBuyMessage + total_cost,
  586.                     escT.Confirm + ' (' + total_cost + ')',
  587.                     escT.Cancel
  588.                 ).done(function () {
  589.                     $J('.btn_batch_buy').fadeOut();
  590.                     batch_buy(mode);
  591.                 });
  592.             });

  593.             // 输入等级
  594.             $J('#target_level').keyup(function () {
  595.                 var t = $J(this).val();
  596.                 if (!isNaN(t)) {
  597.                     t = parseInt(t);
  598.                     target_level = t;
  599.                     refresh_market_table();
  600.                 }
  601.             });

  602.             // 读取卡片基本信息
  603.             $J('.badge_detail_tasks .badge_card_set_cards .badge_card_set_card').each(function () {
  604.                 var card = $J(this);
  605.                 var name = card.find('.badge_card_set_text:eq(0)').text().replace(/^\s+\(\d+\)/, '').trim();
  606.                 var count = card.find('.badge_card_set_text_qty').text();
  607.                 if(count)
  608.                     count = parseInt(count.replace(/[()]/g, ''));
  609.                 else
  610.                     count = 0;
  611.                 var img = card.find('img.gamecard').attr('src');
  612.                 cards.push({
  613.                     'name': name,
  614.                     'img': img,
  615.                     'count': count
  616.                 });
  617.             });

  618.             // 检查补充包价格
  619.             if (foil == 0) {
  620.                 $J.getJSON('//steamcommunity.com/market/search/render/?category_753_item_class[]=tag_item_class_5&appid=753&category_753_Game[]=tag_app_' + appid, function (data) {
  621.                     var list = $J('<div>' + data.results_html + '</div>');
  622.                     var l = list.find('.market_listing_row_link');
  623.                     if (l.length == 1) {
  624.                         var quantity = l.find('.market_listing_num_listings_qty').text();
  625.                         quantity = parseInt(quantity.replace(/[^\d]/, ''));
  626.                         var link = l.attr('href');
  627.                         var price = l.find('.market_listing_their_price .market_table_value>span.normal_price').text().trim();
  628.                         booster = {
  629.                             'link': link,
  630.                             'quantity': quantity,
  631.                             'price': price
  632.                         };
  633.                     }
  634.                     //console.log('booster', booster);
  635.                 });
  636.             }

  637.             // 通过市场获取所有卡片列表
  638.             $J.getJSON('//steamcommunity.com/market/search/render/?start=0&count=40&category_753_cardborder[]=tag_cardborder_'+foil+'&appid=753&category_753_item_class%5B%5D=marketable&category_753_Game[]=tag_app_'+appid, function(data){
  639.                 var list = $J('<div>'+data.results_html+'</div>');
  640.                 list.find('.market_listing_row_link').each(function(){
  641.                     var l = $J(this);
  642.                     //var name = l.find('.market_listing_item_name').text().trim();
  643.                     //var img = l.find('.market_listing_item_img').attr('src').replace('/62fx62f', '');
  644.                     var quantity = l.find('.market_listing_num_listings_qty').text();
  645.                     quantity = parseInt(quantity.replace(/[^\d]/, ''));
  646.                     var link = l.attr('href');
  647.                     var hash = link.match(/\/753\/([^?]+)/)[1];
  648.                     var hash_zh=l.find('.market_listing_item_name[id]');
  649.                     console.log(link,hash,hash_zh);
  650.                     if(hash_zh){
  651.                         hash_zh=$J.trim(hash_zh.text()).replace(' (闪亮)',' (Foil)');
  652.                     }else{
  653.                         hash_zh=null;
  654.                     }
  655.                     hash = decodeURIComponent(hash);
  656.                     var i = -1;
  657.                     var match, hash_name;
  658.                     //i = cards.findIndexCallback(function (c) { return c.img == img; });
  659.                     if (i < 0 && (match = hash.match(/\d+-(.*)/))) {
  660.                         hash_name = match[1].trim();
  661.                         i = cards.findIndex(function (c) { return c.name == hash_name || c.name==hash_zh; });
  662.                     }
  663.                     if (i < 0 && (match = hash.match(/\d+-(.*)\((Foil|Foil Trading Card|Trading Card)\)/))) {
  664.                         hash_name = match[1].trim();
  665.                         hash_zh=hash_zh.replace(' (Foil)','');
  666.                         i = cards.findIndex(function (c) { return c.name == hash_name|| c.name==hash_zh;});
  667.                     }
  668.                     if (i > -1) {
  669.                         cards[i]['quantity'] = quantity;
  670.                         cards[i]['hash'] = hash;
  671.                     }
  672.                     //console.log('cards', cards);
  673.                     refresh_market_table();
  674.                 });
  675.                 load_card_listing(0);
  676.             });
  677.         }
  678.         return false;
  679.     });

  680.     // 高亮数量
  681.     $J('.badge_card_set_text_qty').css('color', 'red');
  682. }

  683. function escListingClickPurchase(){
  684.     $('market_buynow_dialog_purchase').click();
  685.     $('market_buynow_dialog_cancel').click();
  686. }

  687. function escOneClickBuying(){
  688.     // 添加一键购买选项
  689.     var $cb = $J('<span class="market_listing_filter_searchhint" style="padding-left: 5px;"><label style="color:red;"><input id="escOneClickBuying" type="checkbox" />'+escT.OneClickBuying+'</label></span>');
  690.     $cb.appendTo("#market_listing_filter_form");

  691.     if(escGetLS("one_click_buying")){
  692.         $J('#escOneClickBuying').prop('checked', true);
  693.     }else{
  694.         $J('#escOneClickBuying').prop('checked', false);
  695.     }
  696.     $J('#escOneClickBuying').change(function(){
  697.         escSetLS("one_click_buying", $J(this).prop('checked'), 365);
  698.     });

  699.     $J("#searchResultsTable").on("click", ".market_listing_buy_button", function(){
  700.         var $row = $J(this).closest('.market_listing_row');
  701.         var price = $row.find(".market_listing_price_with_fee").text().match(/([\d.]+)/);
  702.         price = parseFloat(price[1]);
  703.         if(escGetLS("one_click_buying") && price<5){
  704.             $J('#market_buynow_dialog').css({opacity: 0});
  705.             setTimeout('escListingClickPurchase()', 100);
  706.             $J(this).html('<img src="//steamcommunity-a.akamaihd.net/public/images/login/throbber.gif">');
  707.             $row.delay(20000).fadeTo('slow', 0);
  708.         }else{
  709.             $J('#market_buynow_dialog').css({opacity: 1});
  710.         }
  711.     });

  712.     // 自动勾选同意协议
  713.     $J('#market_buynow_dialog_accept_ssa, #market_buyorder_dialog_accept_ssa').prop('checked', true);
  714. }

  715. // cookie 操作函数
  716. function escGetCookie(c_name) {
  717.     if (document.cookie.length > 0) {
  718.         c_start = document.cookie.indexOf(c_name + '=');
  719.         if (c_start != -1) {
  720.             c_start = c_start + c_name.length + 1;
  721.             c_end = document.cookie.indexOf(';', c_start);
  722.             if (c_end == -1) c_end = document.cookie.length;
  723.             return unescape(document.cookie.substring(c_start, c_end));
  724.         }
  725.     }
  726.     return '';
  727. }

  728. function escSetCookie(c_name, value, expiredays) {
  729.     var exdate = new Date();
  730.     exdate.setDate(exdate.getDate() + expiredays);
  731.     document.cookie = c_name + '=' + escape(value) + ( (expiredays == null) ? '' : '; expires=' + exdate.toGMTString() ) + ';path=/';
  732. }

  733. function escGetLS(key) {
  734.     var val = null;
  735.     if (typeof localStorage !== undefined && localStorage['esc_' + key] !== undefined) {
  736.         val = JSON.parse(localStorage['esc_' + key]);
  737.     }
  738.     return val;
  739. }

  740. function escSetLS(key, val) {
  741.     if (typeof localStorage !== undefined) {
  742.         localStorage['esc_' + key] = JSON.stringify(val);
  743.     }
  744. }

  745. function escSkipAgeCheck() {
  746.     escSetCookie('birthtime', -473356799, 365);
  747.     window.location = window.location;
  748. }

  749. function escEnhanceFriends() {
  750.     $J('.manage_friends_btn_ctn').prepend('<span class="btn_grey_black btn_details btn_small btn_manage_friends"><span><a target="_blank" href="//steamcommunity.com/chat/">' + escT.WebChat + '</a></span></span>');
  751. }

  752. function escShowInventoryAmount() {
  753.     var inventory = escGetLS('inventory');
  754.     $J('.market_listing_row_link').each(function () {
  755.         var link = $J(this);
  756.         link.find('.market_listing_item_esc_amount').remove();
  757.         var href = link.attr('href');
  758.         var match = href.match(/steamcommunity\.com\/market\/listings\/([^$?]*)/);
  759.         if (match != null) {
  760.             var identifier = decodeURIComponent(match[1]);
  761.             if (inventory && inventory.hasOwnProperty(identifier)) {
  762.                 var amount = inventory[identifier];
  763.                 link.find('.market_listing_item_name').prepend('<span style="color:red;" class="market_listing_item_esc_amount">(' + amount + ') </span>');
  764.             }
  765.         }
  766.     });
  767. }

  768. function escUpdateInventoryCache() {
  769.     if (!g_steamID)
  770.         return;
  771.     if (!g_ActiveUser || g_ActiveUser.strSteamId != g_steamID)
  772.         return;
  773.     var app = {};
  774.     for (var appid in g_ActiveUser.rgAppInfo) {
  775.         var a = g_ActiveUser.rgAppInfo[appid];
  776.         var con = [];
  777.         for (var id in a.rgContexts) {
  778.             con.push(id);
  779.         }
  780.         app[appid] = con;
  781.     }
  782.     escSetLS('inventory_app', app);
  783.     app = escGetLS('inventory_app');
  784.     var inventory = {};
  785.     for (var appid in app) {
  786.         var a = app[appid];
  787.         for (var i = 0; i < a.length; ++i) {
  788.             var id = a[i];
  789.             $J.getJSON(escUrlInventory + 'json/' + appid + '/' + id + '/', function (data) {
  790.                 if (data.success) {
  791.                     var inv = data.rgInventory;
  792.                     var des = data.rgDescriptions;
  793.                     for (var id in inv) {
  794.                         var i = inv[id];
  795.                         var d = des[i.classid + '_' + i.instanceid];
  796.                         if (!d) {
  797.                             continue;
  798.                         }
  799.                         var name = d.name;
  800.                         if (d.market_name)
  801.                             name = d.market_name;
  802.                         if (d.market_hash_name)
  803.                             name = d.market_hash_name;
  804.                         var identifier = d.appid + '/' + name;
  805.                         var amount = parseInt(i.amount);
  806.                         if (inventory.hasOwnProperty(identifier)) {
  807.                             inventory[identifier] += amount;
  808.                         } else {
  809.                             inventory[identifier] = amount;
  810.                         }
  811.                     }
  812.                     escSetLS('inventory', inventory);
  813.                 }
  814.             });
  815.         }
  816.     }
  817. }

  818. function escEnhanceInventory() {
  819.     // 自动勾选同意协议
  820.     $J('#market_sell_dialog_accept_ssa').prop('checked', true);

  821.     // 引入显示价格列表所需要的样式表
  822.     $J('head').append('<link type="text/css" rel="stylesheet" href="//steamcommunity-a.akamaihd.net/public/css/skin_1/economy_market.css?v=1617814919">');

  823.     var div = $J('<div style="border-top: 1px solid rgb(93, 137, 44); padding-top: 10px; margin-top: 8px;"></div>');
  824.     div.append('<style>.market_listing_action_buttons{display:none;}</style><div class="market_content_block market_home_listing_table market_home_main_listing_table market_listing_table" id="searchResultsTable"><div id="searchResultsRows"></div></div>');
  825.     $J('#market_sell_dialog .newmodal_content').append(div);

  826.     $J('#market_sell_dialog_accept').click(function () {
  827.         // 记住上次的售价
  828.         if ($J('#market_sell_currency_input').val())
  829.             escSetLS('last_sell_price', $J('#market_sell_currency_input').val());
  830.     });

  831.     $J('.market_dialog_input').keydown(function (e) {
  832.         // 记住上次的售价
  833.         if ($J('#market_sell_currency_input').val())
  834.             escSetLS('last_sell_price', $J('#market_sell_currency_input').val());
  835.         // Ctrl + Enter 直接上架
  836.         if (e.ctrlKey && e.keyCode == 13) {
  837.             setTimeout(function () {
  838.                 if (SellItemDialog.m_bWaitingForUserToConfirm) {
  839.                     $('market_sell_dialog_ok').click();
  840.                 }
  841.             }, 100);
  842.         }
  843.     });

  844.     // 覆盖出售按钮函数
  845.     var originalSell = window.SellCurrentSelection;
  846.     window.SellCurrentSelection = function(){
  847.         var result = $J("#searchResultsRows");
  848.         result.hide();
  849.         var selected_item = window.g_ActiveInventory.selectedItem;
  850.         selected_item = selected_item.description || selected_item;
  851.         var appid = selected_item.appid;
  852.         var market_hash_name = selected_item.market_hash_name || selected_item.market_name;
  853.         if (market_hash_name) {
  854.             $J.getJSON("//steamcommunity.com/market/listings/" + appid + "/" + encodeURIComponent(market_hash_name) + "/render/", {
  855.                 query: "",
  856.                 start: 0,
  857.                 count: 20,
  858.                 country: g_strCountryCode,
  859.                 language: g_strLanguage,
  860.                 currency: typeof g_rgWalletInfo != 'undefined' ? g_rgWalletInfo['wallet_currency'] : 1
  861.             }, function (data) {
  862.                 result.html(data.results_html).slideDown('slow');
  863.                 //result.prepend("0 - 20 / "+data.total_count);
  864.             });
  865.         }
  866.         originalSell();
  867.         if (escGetLS('last_sell_price')) {
  868.             $J('#market_sell_currency_input').val(escGetLS('last_sell_price'));
  869.             SellItemDialog.OnInputKeyUp();
  870.         }
  871.         // 将出售框定位到顶部
  872.         $J('#market_sell_dialog').css('top', $J(window).scrollTop());
  873.     };
  874.     setTimeout(escUpdateInventoryCache, 1000);
  875. }

  876. // Enhanced Steam Community 代码结束

  877. }

  878. // 将上面的代码插入到网页中
  879. var script = escMain.toString();
  880. script = script.slice(script.indexOf('{') + 1, -1);
  881. exec(script);

  882. var match = location.href.match(/^https?:\/\/steamcommunity.com\/(id|profiles)\/.+\/gamecards\/([0-9]+)/);
  883. if (match) {
  884.     // 某个游戏的徽章页面
  885.     var appid = match[2];
  886.     load('https://www.steamcardexchange.net/index.php?gamepage-appid-' + appid, 'Badges');
  887. }

  888. // Script Injection
  889. function exec(fn) {
  890.     var script = document.createElement('script');
  891.     script.setAttribute('type', 'application/javascript');
  892.     script.textContent = fn;
  893.     document.body.appendChild(script);
  894.     document.body.removeChild(script);
  895. }

  896. // Load url and call proc function
  897. function load(url, id) {
  898.     GM_xmlhttpRequest({
  899.         method: "GET",
  900.         url: url,
  901.         onload: function (response) {
  902.             exec('escProc' + id + '("' + addslashes(response.responseText) + '")');
  903.         }
  904.     });
  905. }

  906. // Add slashes to string
  907. function addslashes(string) {
  908.     return string
  909.         .replace(/\\/g, '\\\\')
  910.         .replace(/\u0008/g, '\\b')
  911.         .replace(/\t/g, '\\t')
  912.         .replace(/\n/g, '\\n')
  913.         .replace(/\f/g, '\\f')
  914.         .replace(/\r/g, '\\r')
  915.         .replace(/'/g, '\\\'')
  916.         .replace(/"/g, '\\"');
  917. }
复制代码
回复

使用道具 举报

浏览本版块需要:
1. 初阶会员或更高等级;
2. (点击此处)绑定Steam账号
您需要登录后才可以回帖 登录 | 注册

本版积分规则

欢迎发帖参与讨论 o(*≧▽≦)ツ,请注意
1. 寻求帮助或答案的帖子请发到问题互助版块,悬赏有助于问题解决的速度。发错可能失去在该板块发布主题的权限(了解更多
2. 表达观点可以,也请务必注意语气和用词,以免影响他人浏览,特别是针对其他会员的内容。如觉得违规可使用举报功能 交由管理人员处理,请勿引用对方的内容。
3. 开箱晒物交易中心游戏互鉴福利放送版块请注意额外的置顶版规。
4. 除了提问帖和交易帖以外,不确认发在哪个版块的帖子可以先发在谈天说地

  作为民间站点,自 2004 年起为广大中文 Steam 用户提供技术支持与讨论空间。历经二十余载风雨,如今已发展为国内最大的正版玩家据点。

列表模式 · · 微博 · Bilibili频道 · Steam 群组 · 贴吧 · QQ群 
Keylol 其乐 ©2004-2025 Chinese Steam User Fan Site.
Designed by Lee in Balestier, Powered by Discuz!
推荐使用 ChromeMicrosoft Edge 来浏览本站
广告投放|手机版|广州数趣信息科技有限公司 版权所有|其乐 Keylol ( 粤ICP备17068105号 )
GMT+8, 2025-7-12 07:54
快速回复 返回顶部 返回列表