Steam Badge Helper

Add various features to Steam focus on Trading Cards and Badges

当前为 2015-11-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Steam Badge Helper
  3. // @namespace iFantz7E.SteamBadgeHelper
  4. // @version 1.17
  5. // @description Add various features to Steam focus on Trading Cards and Badges
  6. // @match http://store.steampowered.com/*
  7. // @match http://steamcommunity.com/*
  8. // @match https://store.steampowered.com/*
  9. // @match http://forums.steampowered.com/*
  10. // @match https://steamcommunity.com/*
  11. // @match http://store.akamai.steampowered.com/*
  12. // @match http://store.steamgames.com/*
  13. // @run-at document-start
  14. // @grant GM_getValue
  15. // @grant GM_setValue
  16. // @grant GM_listValues
  17. // @grant GM_deleteValue
  18. // @grant GM_xmlhttpRequest
  19. // @grant GM_addStyle
  20. // @icon http://store.steampowered.com/favicon.ico
  21. // @copyright 2014, 7-elephant
  22. // ==/UserScript==
  23.  
  24. // http://userscripts.org/scripts/show/186163
  25. // https://greasyfork.org/en/scripts/5348-steam-badge-helper
  26.  
  27. (function ()
  28. {
  29. var timeStart = new Date();
  30.  
  31. // ===== Config =====
  32.  
  33. var enableDebug = false;
  34. var enableDebugConsole = true;
  35. var enableCleanLink = true;
  36. var enableGreenlightNoAutoplay = true;
  37. var enableMoveGreenlitHeader = true;
  38. var enableLinkBadgeToFriend = true;
  39. var enableLinkStoreToBadge = true;
  40. var enableLinkForumToBadge = true;
  41. var enableLinkBadgeToForum = true;
  42. var enableLinkMarketToBadge = true;
  43. var enableLinkBadgeToMarket = true;
  44. var enableLinkProfile = true;
  45. var enableCompareBadge = true;
  46. var enableAlwaysClearCache = false;
  47. var enableCleanSteamMenu = true;
  48. var enableHideEnhancedBadgePrice = true;
  49. var enableAutoscrollSearch = true;
  50. var enableSwapTitle = true;
  51. var enableShowTitleNoti = true;
  52. var enableResizeTradeWindow = true;
  53. var enableMoveMenuEditProfile = true;
  54. var enableRefreshError = true;
  55. var enableSetAllCheckBox = true;
  56. var enableStoreFocus = true;
  57. var enableStoreHideSection = true;
  58. var enableCache = true;
  59. var enableDebugCache = false;
  60. var timeCacheExpireSec = 300;
  61. var appCards = ["286120", "203990", "32200", "259720", "245550", "306410", "249610", "291130"
  62. , "218640", "268420", "46500", "102200", "301680", "273770", "264320", "339290", "340280"
  63. , "273830", "303850", "346200", "353980", "296070", "380770", "294190"];
  64. var appCardMaps = {"202970": "202990", "234510": "35450"};
  65. var appDlcs = // Exclude
  66. [
  67. "230889", "256576", "256611", "258643", "222606", "222615", "222618", "277751"
  68. ];
  69. // ===== End Config =====
  70.  
  71. // ===== Cache =====
  72.  
  73. var tmpl_time = "badge_{APP}_time";
  74. var tmpl_price = "badge_{APP}_{SET}_{NUM}_price";
  75. var tmpl_url = "badge_{APP}_{SET}_{NUM}_url";
  76. var tmpl_owned = "badge_{APP}_{SET}_{NUM}_owned";
  77.  
  78. function clearCache()
  79. {
  80. var keep = ["counter"];
  81. var cache = GM_listValues()
  82. debug("clearCache: " + cache.length);
  83. for (var i = 0; i < cache.length; i++)
  84. {
  85. if (keep.indexOf(cache[i]) < 0)
  86. {
  87. GM_deleteValue(cache[i]);
  88. }
  89. }
  90. }
  91. if (enableAlwaysClearCache) clearCache();
  92.  
  93. function debugCache()
  94. {
  95. var cache = GM_listValues()
  96. if (enableDebugCache)
  97. {
  98. debug("debugCache: ");
  99. if (cache != null) for (var i = 0; i < cache.length; i++)
  100. {
  101. debug("-> " + cache[i] + ": " + GM_getValue(cache[i], 0));
  102. }
  103. }
  104. debug("debugCache: " + (cache == null ? 0 : cache.length));
  105. }
  106. setTimeout(debugCache, 0);
  107.  
  108. function generateCacheName(tmpl, app, isFoil, number)
  109. {
  110. var name = tmpl.replace("{APP}", app);
  111. if (isFoil != null)
  112. {
  113. var set = isFoil ? "F1" : "N1";
  114. name = name.replace("{SET}", set);
  115. }
  116. if (number != null)
  117. {
  118. name = name.replace("{NUM}", number);
  119. }
  120. return name;
  121. }
  122. function generateCacheNameTime(app)
  123. {
  124. return generateCacheName(tmpl_time, app);
  125. }
  126. function generateCacheNamePrice(app, isFoil, number)
  127. {
  128. return generateCacheName(tmpl_price, app, isFoil, number);
  129. }
  130. function generateCacheNameUrl(app, isFoil, number)
  131. {
  132. return generateCacheName(tmpl_url, app, isFoil, number);
  133. }
  134. function generateCacheNameOwned(app, isFoil, number)
  135. {
  136. return generateCacheName(tmpl_owned, app, isFoil, number);
  137. }
  138.  
  139. function getCacheTime(app)
  140. {
  141. var name = generateCacheNameTime(app);
  142. return GM_getValue(name, 0);
  143. }
  144. function getCacheTimeDiff(app)
  145. {
  146. return parseInt((new Date()) / 1000 - getCacheTime(app));
  147. }
  148. function setCacheTime(app)
  149. {
  150. var name = generateCacheNameTime(app);
  151. GM_setValue(name, parseInt((new Date()) / 1000));
  152. }
  153. function checkCacheExpire(app)
  154. {
  155. var cacheDiff = getCacheTimeDiff(app);
  156. var isCacheExpire = cacheDiff < 0 || cacheDiff > timeCacheExpireSec;
  157. debug("cacheTimeDiff: " + cacheDiff + "s");
  158. debug("isCacheExpire: " + isCacheExpire);
  159. return isCacheExpire;
  160. }
  161.  
  162. function getCachePrice(app, isFoil, number)
  163. {
  164. var name = generateCacheNamePrice(app, isFoil, number);
  165. return GM_getValue(name, 0);
  166. }
  167. function setCachePrice(app, isFoil, number, data)
  168. {
  169. var name = generateCacheNamePrice(app, isFoil, number);
  170. GM_setValue(name, data);
  171. }
  172.  
  173. function getCacheUrl(app, isFoil, number)
  174. {
  175. var name = generateCacheNameUrl(app, isFoil, number);
  176. return GM_getValue(name, 0);
  177. }
  178. function setCacheUrl(app, isFoil, number, data)
  179. {
  180. var name = generateCacheNameUrl(app, isFoil, number);
  181. GM_setValue(name, data);
  182. }
  183.  
  184. function getCacheOwned(app, isFoil, number)
  185. {
  186. var name = generateCacheNameOwned(app, isFoil, number);
  187. return GM_getValue(name, 0);
  188. }
  189. function setCacheOwned(app, isFoil, number, data)
  190. {
  191. var name = generateCacheNameOwned(app, isFoil, number);
  192. GM_setValue(name, data);
  193. }
  194.  
  195. // ===== End Cache =====
  196.  
  197. // ===== Helper =====
  198.  
  199. setTimeout(function ()
  200. {
  201. var counter = GM_getValue('counter', 0);
  202. GM_setValue('counter', ++counter);
  203. }, 0);
  204.  
  205. function debug(msg)
  206. {
  207. try
  208. {
  209. msg = msg ? (new String(msg)).trim().replace(/\s\s/gi, "").replace(/\s/gi, " ") : "";
  210. if (enableDebugConsole)
  211. console.log(msg);
  212. if (enableDebug)
  213. {
  214. var divDebugID = "div_debug_7e";
  215. var divDebugOuterID = divDebugID + "_outer";
  216. var divOut = document.getElementById(divDebugOuterID);
  217. var div = document.getElementById(divDebugID);
  218.  
  219. var isExistOuter = divOut != null;
  220. if (!isExistOuter)
  221. {
  222. divOut = document.createElement("div");
  223. divOut.id = divDebugOuterID;
  224. divOut.style = "font-family:'Courier New', Courier; font-size: 11px; z-index: 999999; padding: 3px; text-align: left;"
  225. + " border: 3px solid orange; color: black; background-color: rgba(255,255,255,0.9);"
  226. + " position: fixed; top: 3px; left: 3px; overflow-x:hidden; overflow-y:scroll; resize: both;";
  227. divOut.style.width = "150px";
  228. divOut.style.height = "100px";
  229.  
  230. if (div == null)
  231. {
  232. div = document.createElement("div");
  233. div.id = divDebugID;
  234. div.style.minWidth = "1000px";
  235. div.innerHTML = "<span style='font-weight: bold; line-height: 18px;'>Debug:</span>";
  236. }
  237. divOut.appendChild(div);
  238. document.body.appendChild(divOut);
  239. }
  240. div.innerHTML = div.innerHTML + " <br/> " + msg;
  241. divOut.scrollTop = divOut.scrollHeight;
  242. }
  243. }
  244. catch (e)
  245. {
  246. console.log("Ex: " + e);
  247. }
  248. }
  249.  
  250. function debugTime(header)
  251. {
  252. header = header ? (new String(header)) + ": " : "";
  253. var ms = (new Date()) - timeStart;
  254. debug(header + ms + "ms");
  255. }
  256.  
  257. function randNum()
  258. {
  259. return parseInt(Math.random() * 900000 + 100000);
  260. }
  261.  
  262. function randTempID()
  263. {
  264. return "id_temp_7e_" + randNum();
  265. }
  266.  
  267. function createDivTemp(id, html)
  268. {
  269. var div = document.getElementById(id);
  270. if (div == null)
  271. {
  272. div = document.createElement("div");
  273. div.id = id;
  274. document.body.appendChild(div);
  275. }
  276. div.style.display = "none";
  277. div.style.zIndex = "-999999";
  278.  
  279. // remove all external sources
  280. var pattScript = /(<(script|meta|link|style|title)[^>]*>|<\/(script|meta|link|style|title)>)/gi;
  281. html = html.replace(pattScript, "");
  282.  
  283. div.innerHTML = html;
  284. }
  285.  
  286. function removeDivTemp(id)
  287. {
  288. var ele = document.getElementById(id);
  289. ele.parentNode.removeChild(ele);
  290. }
  291.  
  292. function attachOnLoad(callback)
  293. {
  294. window.addEventListener("load", function (e) {
  295. callback();
  296. });
  297. }
  298. function attachOnReady(callback)
  299. {
  300. document.addEventListener("DOMContentLoaded", function (e) {
  301. if (document.readyState === "interactive")
  302. {
  303. callback();
  304. }
  305. });
  306. }
  307. function reload()
  308. {
  309. window.location = window.location.href;
  310. }
  311. function isError()
  312. {
  313. var retVal =
  314. window.location == window.parent.location
  315. &&
  316. (
  317. (
  318. document.querySelector("body.headerless_page"
  319. + ", body.flat_page"
  320. + ", #main"
  321. + ", #supernav"
  322. + ", table.tborder"
  323. + ", #headerrow"
  324. + ", #global_header"
  325. + ", .page_header_ctn"
  326. + ", .search_page"
  327. + ", #bigpicture_about"
  328. + ", #ig_bottom"
  329. + ", #feedHeaderContainer") == null
  330. )
  331. ||
  332. (
  333. document.querySelector(".profile_fatalerror_message") != null
  334. || document.querySelector("#error_msg") != null
  335. //|| document.querySelector("#message") != null
  336. )
  337. );
  338. return retVal;
  339. }
  340. function isErrorCard()
  341. {
  342. var retVal = document.querySelectorAll("#message > p.returnLink").length > 0;
  343. return retVal;
  344. }
  345. function isErrorMarket()
  346. {
  347. var retVal = document.querySelectorAll("#searchResultsTable > .market_listing_table_message").length > 0
  348. ;//&& document.querySelector("#hover_content") == null);
  349. return retVal;
  350. }
  351. function getQueryByName(name)
  352. {
  353. name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
  354. var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
  355. results = regex.exec(location.search);
  356. return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  357. }
  358.  
  359. // ===== End Helper =====
  360.  
  361.  
  362. // ===== Cleaner =====
  363. /** Auto refresh when error
  364. */
  365. function refreshError()
  366. {
  367. if(isError())
  368. {
  369. debug("refreshError: activated");
  370. setTimeout(reload, 3000);
  371. }
  372. }
  373. function refreshErrorCard()
  374. {
  375. if(isErrorCard())
  376. {
  377. debug("refreshErrorCard: activated");
  378. setTimeout(reload, 3000);
  379. }
  380. }
  381. function refreshErrorMarket()
  382. {
  383. if(isErrorMarket())
  384. {
  385. debug("refreshErrorMarket: activated");
  386. setTimeout(reload, 3000);
  387. }
  388. }
  389. function refreshErrorTimeout(tm)
  390. {
  391. function refresh()
  392. {
  393. var url = document.documentURI;
  394. var pattCard = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\/[0-9]+/i;
  395. var pattTrade = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/tradeoffers\//i;
  396. var pattMarket = /^http:\/\/steamcommunity.com\/market\/listings\/[0-9]+/i;
  397.  
  398. if (url.indexOf("#") < 0 && url.indexOf("json") < 0 && url.indexOf("xml") < 0)
  399. {
  400. setTimeout(refreshError, tm);
  401. if (pattCard.test(url) || pattTrade.test(url))
  402. {
  403. setTimeout(refreshErrorCard, tm);
  404. }
  405.  
  406. if (pattMarket.test(url))
  407. {
  408. setTimeout(refreshErrorMarket, tm);
  409. }
  410. }
  411. }
  412. attachOnLoad(refresh);
  413. }
  414. if (enableRefreshError) refreshErrorTimeout(3000);
  415. /** Remove unnessary parameters in URL
  416. */
  417. function cleanLink()
  418. {
  419. var url = document.documentURI;
  420. var pattApp = /^http[s]?:\/\/store.steampowered.com\/(app|sub)\/[0-9]+/i;
  421. var pattBadge = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\/[0-9]+/i;
  422. var pattFork = /^http[s]?:\/\/store\.(.+steampowered|steamgames)\.com\//i;
  423. var pattParam = /\/\?.*$/
  424. var pattParamCC = /\/\?cc\=.*$/
  425. var urlNew = url;
  426. if (pattApp.test(url))
  427. {
  428. var urlNews = url.match(pattApp);
  429. if (urlNews != null)
  430. {
  431. var urlTail = url.replace(pattApp, "");
  432. if (urlTail == "")
  433. {
  434. urlNew = urlNews[0] + "/";
  435. }
  436. else if (urlTail != "/")
  437. {
  438. if (!pattParamCC.test(urlTail) && pattParam.test(urlTail))
  439. {
  440. urlNew = urlNews[0] + "/";
  441. }
  442. }
  443. }
  444. }
  445. else if (pattBadge.test(url))
  446. {
  447. var urlNews = url.match(pattBadge);
  448. if (urlNews != null)
  449. {
  450. var urlTail = url.replace(pattBadge, "");
  451.  
  452. if (urlTail.charAt(0) != "/")
  453. {
  454. urlNew = urlNews[0] + "/" + urlTail;
  455. }
  456. }
  457. }
  458. else if (pattFork.test(url))
  459. {
  460. urlNew = url.replace(pattFork, "http://store.steampowered.com/");
  461. }
  462. if (urlNew != url)
  463. {
  464. debug("cleanLink: activated");
  465. window.location = urlNew;
  466. }
  467. }
  468. if (enableCleanLink) cleanLink();
  469.  
  470. /** Change search parameter to page 1 to determine visited links
  471. */
  472. function cleanLinkSearch()
  473. {
  474. var pattSearch = /snr=1_7_7_230_150_[0-9]+/i
  475.  
  476. var as = document.querySelectorAll("a.search_result_row");
  477. for (var j = 0; j < as.length; j++)
  478. {
  479. var urlSearch = as[j].href;
  480. urlSearch = urlSearch.replace(pattSearch, "snr=1_7_7_230_150_1");
  481. as[j].href = urlSearch;
  482. }
  483.  
  484. document.addEventListener("DOMNodeInserted", onNodeInserted);
  485. function onNodeInserted(e)
  486. {
  487. try
  488. {
  489. var node = e.target;
  490. if (node.classList.contains("search_result_row"))
  491. {
  492. var urlSearch = node.href;
  493. urlSearch = urlSearch.replace(pattSearch, "snr=1_7_7_230_150_1");
  494. node.href = urlSearch;
  495. }
  496. var count = document.querySelectorAll(".search_result_row").length;
  497. var divs = document.querySelectorAll(".search_pagination_left");
  498. for (var i = 0; i < divs.length; i++)
  499. {
  500. var oldVals = divs[i].innerHTML.match(/[0-9]+/g);
  501. var oldVal = oldVals[oldVals.length > 0 ? oldVals.length-1 : 0];
  502. divs[i].innerHTML = "showing " + count + " of " + oldVal;
  503. }
  504. }
  505. catch (ex)
  506. {
  507. }
  508. }
  509. if (enableAutoscrollSearch)
  510. {
  511. var divButton = document.createElement("div");
  512. divButton.classList.add("btn_client_small");
  513. divButton.id = "divAutoscroll";
  514. divButton.style = "position: fixed; right: 20px; bottom: 20px; z-index:3;";
  515. divButton.innerHTML = "<a href='' onclick='document.addEventListener(\"DOMNodeInserted\", function(){ window.scrollTo(0,document.body.scrollHeight); }); this.parentElement.style.display=\"none\"; window.scrollTo(0,document.body.scrollHeight); return false;'>Autoscroll to end</a>";
  516. document.body.appendChild(divButton);
  517. }
  518. }
  519. function cleanLinkSearchTimeout(tm)
  520. {
  521. var url = document.documentURI;
  522. var patt = /^http[s]?:\/\/store.steampowered.com\/search\//i;
  523.  
  524. if (patt.test(url))
  525. {
  526. setTimeout(cleanLinkSearch, tm);
  527. }
  528. }
  529. if (enableCleanLink) cleanLinkSearchTimeout(100);
  530.  
  531. /** Remove link lifter in URL
  532. */
  533. function cleanLinkLifter()
  534. {
  535. var url = document.documentURI;
  536. var patt = /^http[s]?:\/\/steamcommunity.com\//i;
  537. var pattHome = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/home/i;
  538. function cleanLifter()
  539. {
  540. var lifter = "https://steamcommunity.com/linkfilter/";
  541. var lifterLen = lifter.length;
  542. var lifter2 = "?url=";
  543. var lifterLen2 = lifter2.length;
  544. var js = "javascript:"
  545. var jsLen = js.length;
  546. var as = document.getElementsByTagName("a");
  547. for (var i = 0; i < as.length; i++)
  548. {
  549. var urlLink = as[i].href;
  550. if (urlLink.indexOf(lifter) == 0)
  551. {
  552. urlLink = urlLink.substr(lifterLen);
  553. if (urlLink.indexOf(lifter2) == 0)
  554. {
  555. urlLink = urlLink.substr(lifterLen2);
  556. }
  557. as[i].href = urlLink;
  558. }
  559. else if (patt.test(url) && urlLink.indexOf(js) == 0)
  560. {
  561. if (as[i].getAttribute('onclick') == null)
  562. {
  563. urlLink = decodeURIComponent(urlLink.substr(jsLen));
  564. as[i].setAttribute('onclick', urlLink + "; return false;");
  565. }
  566. }
  567. }
  568. }
  569. var cleanLifterTimeoutId = 0;
  570. function cleanLifterTimeout()
  571. {
  572. clearTimeout(cleanLifterTimeoutId);
  573. cleanLifterTimeoutId = setTimeout(cleanLifter, 1000);
  574. }
  575. attachOnReady(cleanLifter);
  576. if (pattHome.test(url))
  577. {
  578. document.addEventListener("DOMNodeInserted", cleanLifterTimeout);
  579. }
  580. }
  581. if (enableCleanLink) cleanLinkLifter();
  582.  
  583. /** Clean Steam's menu on top
  584. */
  585. function cleanSteamMenuTimeout(tm)
  586. {
  587. GM_addStyle(
  588. " .header_installsteam_btn_content , .header_installsteam_btn { display: none; } " // Steam header
  589. + " #enhanced_pulldown { display: none; } " // Enhanced Steam header
  590. + " #soe-t-menu { display: none !important; } " // SOE header
  591. );
  592. attachOnReady(function ()
  593. {
  594. setTimeout(function()
  595. {
  596. var soe_menu = document.querySelector("#soe-t-menu");
  597. if (soe_menu != null)
  598. {
  599. soe_menu.textContent = "SOE";
  600. var parent = soe_menu.parentElement;
  601. for (var i = 0; i < parent.childNodes.length; i++)
  602. {
  603. var node = parent.childNodes[i];
  604. if (node.nodeName == "#text" && node.nodeValue.toString().trim() == "|")
  605. {
  606. node.parentElement.removeChild(node);
  607. break;
  608. }
  609. }
  610. soe_menu.parentElement.parentElement.insertBefore(soe_menu, null);
  611. }
  612. }, tm);
  613. });
  614. var menu = document.querySelector("#account_pulldown");
  615. if (menu != null)
  616. {
  617. menu.addEventListener('mouseover', function() {
  618. GM_addStyle(
  619. " #enhanced_pulldown { display: inline-block !important; } " // Enhanced Steam header
  620. + " #soe-t-menu { display: inline-block !important; } " // SOE header
  621. );
  622. });
  623. }
  624. // fix market transaction display // temp
  625. GM_addStyle("#market_transactions .transactionRowTitle { display: inline-block; padding-right: 5px; }");
  626. /*
  627. setTimeout(function()
  628. {
  629. var as = document.querySelectorAll(".header_installsteam_btn_content , .header_installsteam_btn");
  630. for (var i = 0; i < as.length; i++)
  631. {
  632. as[i].style.display = "none";
  633. }
  634. }, tm);
  635. attachOnLoad(function ()
  636. {
  637. setTimeout(function()
  638. {
  639. var aE = document.getElementById("enhanced_pulldown");
  640. if (aE != null)
  641. {
  642. aE.style.display = "none";
  643. }
  644. }, tm);
  645. });
  646. */
  647. }
  648. if (enableCleanSteamMenu) cleanSteamMenuTimeout(0);
  649.  
  650. /** Hide EnhancedSteam's price on Badge page
  651. */
  652. function hideEnhancedBadgePrice()
  653. {
  654. GM_addStyle(".es_card_search { display: none !important; } ");
  655. /*
  656. document.addEventListener("DOMNodeInserted", onNodeInserted);
  657. function onNodeInserted(e)
  658. {
  659. try
  660. {
  661. var node = e.target;
  662. if (node.classList.contains("es_card_search"))
  663. {
  664. debug("hideEnhanced: " + node.innerHTML);
  665. node.style.display = "none";
  666. }
  667. }
  668. catch (ex)
  669. {
  670. }
  671. }
  672. */
  673. }
  674. function hideEnhancedBadgePriceTimeout(tm)
  675. {
  676. var url = document.documentURI;
  677. var patt = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\/[0-9]+/i;
  678.  
  679. if (patt.test(url))
  680. {
  681. setTimeout(hideEnhancedBadgePrice, tm);
  682. }
  683. }
  684. if (enableHideEnhancedBadgePrice) hideEnhancedBadgePriceTimeout(0);
  685.  
  686. // ===== End Cleaner =====
  687.  
  688. // ===== Main =====
  689.  
  690. /** Disable autoplay on Greenlight page while autoplay option is on
  691. */
  692. function disableGreenlightAutoplay()
  693. {
  694. var iframes = document.getElementsByTagName("iframe");
  695. for (var i in iframes)
  696. {
  697. if (iframes[i].className == "highlight_flash_player_notice")
  698. {
  699. iframes[i].src = iframes[i].src.replace("autoplay=1", "autoplay=0");
  700. }
  701. }
  702. }
  703. function disableGreenlightAutoplayTimeout(tm)
  704. {
  705. var url = document.documentURI;
  706. var patt = /^http:\/\/steamcommunity.com\/sharedfiles\/filedetails\//i;
  707.  
  708. if (patt.test(url))
  709. {
  710. attachOnLoad(function ()
  711. {
  712. setTimeout(disableGreenlightAutoplay, tm);
  713. });
  714. }
  715. }
  716. if (enableGreenlightNoAutoplay) disableGreenlightAutoplayTimeout(0);
  717.  
  718. /** Move Greenlit header to match voting section of Greenlight item
  719. */
  720. function moveGreenlitHeader()
  721. {
  722. var eleGreenlit = document.querySelector(".flag");
  723. var eleArea = document.querySelector(".workshopItemPreviewArea");
  724. if (eleGreenlit != null && eleArea != null)
  725. {
  726. eleArea.appendChild(eleGreenlit.parentElement.parentElement);
  727. }
  728. }
  729. function moveGreenlitHeaderReady(tm)
  730. {
  731. var url = document.documentURI;
  732. var patt = /^http:\/\/steamcommunity.com\/sharedfiles\/filedetails\//i;
  733.  
  734. if (patt.test(url))
  735. {
  736. attachOnReady(function ()
  737. {
  738. moveGreenlitHeader();
  739. });
  740. }
  741. }
  742. if (enableMoveGreenlitHeader) moveGreenlitHeaderReady();
  743.  
  744. /** Move button in Edit Profile page to right
  745. */
  746. function moveMenuEditProfile()
  747. {
  748. GM_addStyle(
  749. ".group_content_bodytext { position: fixed; top: 400px; margin-left: 680px; line-height: 34px; z-index: 10; } "
  750. + ".rightcol { position: fixed; top: 230px; margin-left: 658px; z-index: 10; } "
  751. + ".saved_changes_msg { width: 610px; } "
  752. );
  753. }
  754. function moveMenuEditProfileTimeout(tm)
  755. {
  756. var url = document.documentURI;
  757. var patt = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/edit/i;
  758.  
  759. if (patt.test(url))
  760. {
  761. setTimeout(moveMenuEditProfile, tm);
  762. }
  763. }
  764. if (enableMoveMenuEditProfile) moveMenuEditProfileTimeout(0);
  765.  
  766. /** Add small button on friend section in Badge page to view friends' Badge page for comparing cards
  767. * Reduce height of Review textbox
  768. */
  769. function linkBadgeToFriend()
  770. {
  771. var url = document.documentURI;
  772. var pattHead = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]*/i;
  773. var urlTail = url.replace(pattHead, "");
  774. var pattProfile = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)/i;
  775.  
  776. var styleCorrect = "";
  777. // fix long card name show incorrect column of cards
  778. styleCorrect += ".badge_card_set_card .badge_card_set_text { width: 220px; } ";
  779. // fix Firefox show incorrect column of friends' avatar
  780. styleCorrect += ".persona { line-height: 16px; } ";
  781. // fix EnhancedSteam show incorrect size of next badge progress
  782. styleCorrect += ".gamecard_badge_progress .badge_info { width: 250px !important; } ";
  783. GM_addStyle(styleCorrect);
  784. var els = document.getElementsByTagName("div");
  785. for (var i in els)
  786. {
  787. if (els[i].className == "badge_friends_have_earned_friends"
  788. || els[i].className == "badge_friendwithgamecard")
  789. {
  790. var as = els[i].getElementsByTagName("a");
  791. var limit = 1;
  792. var curLimit = 0;
  793.  
  794. for (var j in as)
  795. {
  796. var a = as[j];
  797. if (pattProfile.test(a.href))
  798. {
  799. var badgeUrl = a.href + urlTail;
  800.  
  801. if (els[i].className == "badge_friends_have_earned_friends"
  802. || !a.parentNode.classList.contains("playerAvatar"))
  803. {
  804. a.href = badgeUrl;
  805. }
  806.  
  807. if (curLimit < limit && els[i].className == "badge_friendwithgamecard")
  808. {
  809. elActs = els[i].getElementsByClassName("badge_friendwithgamecard_actions");
  810. for (var k in elActs)
  811. {
  812. elActs[k].innerHTML = elActs[k].innerHTML
  813. + " <a class='btn_grey_grey btn_medium' title=\"View friend\'s badge\" href='"
  814. + badgeUrl
  815. + "'><img style='height:16px; opacity:0.66'"
  816. + " src='http://cdn4.store.steampowered.com/public/images/ico/ico_cards.png'></a> ";
  817. curLimit += 1;
  818. }
  819. }
  820. }
  821. } // end for
  822. }
  823. }
  824. }
  825. function linkBadgeToFriendTimeout(tm)
  826. {
  827. var url = document.documentURI;
  828. var patt = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\/[0-9]+/i;
  829.  
  830. if (patt.test(url) && !isErrorCard())
  831. {
  832. setTimeout(linkBadgeToFriend, tm);
  833. }
  834. }
  835. if (enableLinkBadgeToFriend) linkBadgeToFriendTimeout(100);
  836.  
  837. /** Add button on top of Store page to view Badge page
  838. */
  839. function linkStoreToBadge()
  840. {
  841. var url = document.documentURI;
  842. var patt = /^http[s]?:\/\/store.steampowered.com\/app\//i;
  843. var pattEnd = /[^0-9].*$/i;
  844. var app = url.replace(patt, "").replace(pattEnd, "");
  845.  
  846. var aOwner = document.querySelector("#global_actions > .user_avatar");
  847. var isLoggedIn = aOwner != null;
  848. var ownerUrl = isLoggedIn ? aOwner.href.substr(0, aOwner.href.length - 1) : "http://steamcommunity.com/my";
  849. var isOwned = document.querySelector(".game_area_already_owned") != null;
  850.  
  851. var urlCard = "category2=29";
  852. var titleCard = "Steam Trading Cards";
  853. var urlDlc = "category1=21";
  854. var titleDlc = "Downloadable Content";
  855. var urlAch = "category2=22";
  856. var titleAch = "Steam Achievement";
  857. var isBadge = false;
  858. var isBadgeMap = false;
  859. var isAch = false;
  860. var as = document.querySelectorAll(".game_area_details_specs a");
  861. for (var i = 0; i < as.length; i++)
  862. {
  863. if (appDlcs.indexOf(app) > -1 || as[i].href.indexOf(urlDlc) > -1 || as[i].textContent == titleDlc)
  864. {
  865. isBadge = false;
  866. isAch = false;
  867. break;
  868. }
  869. else if (as[i].href.indexOf(urlCard) > -1 || as[i].textContent == titleCard)
  870. {
  871. isBadge = true;
  872. }
  873. else if (as[i].href.indexOf(urlAch) > -1 || as[i].textContent == titleAch)
  874. {
  875. isAch = true;
  876. }
  877. }
  878. if (appCardMaps[app] != null)
  879. {
  880. isBadge = true;
  881. isBadgeMap = true;
  882. }
  883. else if (!isBadge)
  884. {
  885. if (appCards.indexOf(app) > -1)
  886. {
  887. isBadge = true;
  888. }
  889. }
  890. if (isBadge)
  891. {
  892. var appCard = app;
  893. if (isBadgeMap)
  894. {
  895. appCard = appCardMaps[app];
  896. }
  897. var divs = document.getElementsByClassName("apphub_OtherSiteInfo");
  898. for (var i = 0; i < divs.length; i++)
  899. {
  900. divs[i].innerHTML = divs[i].innerHTML
  901. + " &nbsp;<a class=\"btnv6_blue_hoverfade btn_medium\""
  902. + " href=\"" + ownerUrl + "/gamecards/" + appCard + "/\">"
  903. + "<span>Trading Cards</span></a>";
  904. }
  905. }
  906. if (false && isAch)
  907. {
  908. var urlAchLink = (isLoggedIn && isOwned ? ownerUrl + "/stats/appid/" : "http://steamcommunity.com/stats/")
  909. + app + "/achievements/";
  910. var divCommu = document.querySelector(".communitylink .block_content_inner");
  911. if (divCommu != null)
  912. {
  913. var aAch = ' <a class="linkbar" href="' + urlAchLink + '">'
  914. + '<div class="rightblock" style="margin-top: 3px;"><img src="http://cdn4.store.steampowered.com/public/images/ico/ico_achievements.png"'
  915. + ' align="top" border="0" style="margin-right: -9px; height: 20px; margin-top: -5px;"></div>'
  916. + 'View Steam Achievements</a>';
  917. divCommu.innerHTML = divCommu.innerHTML + aAch;
  918. }
  919. /*var divDemo = document.querySelector("#demo_block > div");
  920. if (divDemo != null)
  921. {
  922. var divAch = '<div class="demo_area_button"><a class="game_area_wishlist_btn" href="'
  923. + urlAchLink + '">View Steam Achievements</a></div>';
  924. divDemo.innerHTML = divAch + divDemo.innerHTML;
  925. }*/
  926. }
  927. var txtRec = document.getElementById("game_recommendation");
  928. if (txtRec != null)
  929. {
  930. // reduce height of review textbox
  931. txtRec.style.height = "16px";
  932. txtRec.onfocus = function(){txtRec.style.height="150px";};
  933. }
  934. if (!isLoggedIn)
  935. {
  936. var eleLoginMain = document.querySelector("a.global_action_link[href*='/login/']");
  937. var eleLoginQueue = document.querySelector(".queue_actions_ctn a[href*='/login/']");
  938. if (eleLoginMain != null && eleLoginQueue != null)
  939. {
  940. eleLoginMain.setAttribute("href", eleLoginQueue.getAttribute("href"));
  941. }
  942. }
  943. GM_addStyle(".game_area_dlc_row, .tab_item { display: inherit !important; } ");
  944. }
  945. function linkStoreToBadgeTimeout(tm)
  946. {
  947. var url = document.documentURI;
  948. var patt = /^http[s]?:\/\/store.steampowered.com\/(app|sub)\//i;
  949.  
  950. if (patt.test(url))
  951. {
  952. attachOnLoad(function()
  953. {
  954. setTimeout(linkStoreToBadge, tm);
  955. });
  956. }
  957. }
  958. if (enableLinkStoreToBadge) linkStoreToBadgeTimeout(100);
  959.  
  960. /** Add button in Forum page to view Badge page
  961. * Mark topic to determine visited links
  962. */
  963. function linkForumToBadge()
  964. {
  965. var url = document.documentURI;
  966. var pattAppHead = /^http[s]?:\/\/steamcommunity.com\/app\//i;
  967. var pattAppTail = /[^0-9]+.*/i;
  968. var app = url.replace(pattAppHead, "").replace(pattAppTail, "");
  969.  
  970. var aOwner = document.querySelector("div.user_avatar > div.playerAvatar > a");
  971. var isLoggedIn = aOwner != null;
  972. var ownerUrl = isLoggedIn ? aOwner.href : "http://steamcommunity.com/my";
  973.  
  974. var divs = document.getElementsByClassName("apphub_OtherSiteInfo");
  975. for (var j = 0; j < divs.length; j++)
  976. {
  977. var aBadge = " <a class='btn_darkblue_white_innerfade btn_medium' href='"
  978. + ownerUrl + "/gamecards/" + app
  979. + "/'><span>Trading Cards</span></a> ";
  980. divs[j].innerHTML = divs[j].innerHTML + aBadge;
  981. }
  982. function markTopic()
  983. {
  984. var as = document.getElementsByClassName("forum_topic_overlay");
  985. for (var i = 0; i < as.length; i++)
  986. {
  987. // mark topic
  988. as[i].style.borderLeft = "3px solid";
  989. }
  990. }
  991. markTopic();
  992. document.addEventListener("DOMNodeInserted", markTopic);
  993. }
  994. function linkForumToBadgeTimeout(tm)
  995. {
  996. var url = document.documentURI;
  997. var patt = /^http:\/\/steamcommunity.com\/app\/[0-9]+\/tradingforum\//i;
  998.  
  999. if (patt.test(url))
  1000. {
  1001. setTimeout(linkForumToBadge, tm);
  1002. }
  1003. }
  1004. if (enableLinkForumToBadge) linkForumToBadgeTimeout(100);
  1005.  
  1006. /** Add buttons in Badge page to view Trading Forum, Store, friend's Inventory and my Badge page
  1007. */
  1008. function linkBadgeToForum()
  1009. {
  1010. var url = document.documentURI;
  1011.  
  1012. var pattAppHead = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\//i;
  1013. var pattAppTail = /[^0-9]+.*/i;
  1014. var app = url.replace(pattAppHead, "").replace(pattAppTail, "");
  1015. GM_addStyle(".sbh_badge_menu_right { float: right; margin-left: 5px; } ");
  1016.  
  1017. var divs = document.getElementsByClassName("gamecards_inventorylink");
  1018. if (divs.length > 0)
  1019. {
  1020. var aStoreUrl = "http://store.steampowered.com/app/" + app + "/";
  1021. var aForumUrl = "http://steamcommunity.com/app/" + app + "/tradingforum/";
  1022. var aCustom = " <a class='btn_grey_grey btn_small_thin sbh_badge_menu_right' href='" + aStoreUrl + "'>"
  1023. + " <span>Visit Store Page</span></a> "
  1024. + " <a class='btn_grey_grey btn_small_thin sbh_badge_menu_right' href='" + aForumUrl + "'>"
  1025. + " <span>Visit Trade Forum</span></a> ";
  1026.  
  1027. divs[0].innerHTML = divs[0].innerHTML + aCustom;
  1028. }
  1029.  
  1030. var aOwner = document.querySelector("div.user_avatar > div.playerAvatar > a");
  1031. var isLoggedIn = aOwner != null;
  1032. var ownerUrl = isLoggedIn ? aOwner.href : "http://steamcommunity.com/my";
  1033.  
  1034. var aFriend = document.querySelector(".profile_small_header_name > a");
  1035. var isFriendExist = aFriend != null;
  1036. var friendUrl = isFriendExist ? aFriend.href : "http://steamcommunity.com/my";
  1037. var friendName = isFriendExist ? aFriend.textContent.trim() : "my"
  1038. var friendNameOwner = isFriendExist ? friendName + "'s" : friendName;
  1039.  
  1040. var isOwner = isLoggedIn && ownerUrl == friendUrl;
  1041.  
  1042. if (!isOwner)
  1043. {
  1044. var divInv;
  1045. if (divs.length > 0)
  1046. {
  1047. divInv = divs[0];
  1048. }
  1049. else
  1050. {
  1051. divInv = document.createElement("div");
  1052. divInv.classList.add("gamecards_inventorylink");
  1053. var divBadge = document.querySelector(".badge_detail_tasks");
  1054. if (divBadge != null)
  1055. {
  1056. divBadge.insertBefore(divInv, divBadge.firstChild);
  1057. }
  1058. }
  1059. var aFrInvUrl = friendUrl + "/inventory/#753_6";
  1060. var aOwnUrl = url.replace(pattAppHead, ownerUrl + "/gamecards/");
  1061. divInv.innerHTML = divInv.innerHTML
  1062. + "<a class='btn_grey_grey btn_small_thin' href='" + aFrInvUrl + "'><span>View cards in "
  1063. + friendNameOwner + " Inventory</span></a> "
  1064. + " <a class='btn_grey_grey btn_small_thin' href='" + aOwnUrl + "'><span>View my Progress</span></a> ";
  1065.  
  1066. }
  1067. }
  1068. function linkBadgeToForumTimeout(tm)
  1069. {
  1070. var url = document.documentURI;
  1071. var patt = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\/[0-9]+/i;
  1072.  
  1073. if (patt.test(url) && !isErrorCard())
  1074. {
  1075. setTimeout(linkBadgeToForum, tm);
  1076. }
  1077. }
  1078. if (enableLinkBadgeToForum) linkBadgeToForumTimeout(1);
  1079.  
  1080. /** Add button in Market page to view Badge and Store page
  1081. */
  1082. function linkMarketToBadge()
  1083. {
  1084. var url = document.documentURI;
  1085.  
  1086. var pattAppHead = /^http[s]?:\/\/steamcommunity.com\/market\/listings\/753\//i;
  1087. var pattAppTail = /[^0-9]+.*/i;
  1088. var pattNumber = /[0-9]+/;
  1089. var app = url.replace(pattAppHead, "").replace(pattAppTail, "");
  1090.  
  1091. var aOwner = document.querySelector("div.user_avatar > div.playerAvatar > a");
  1092. var isLoggedIn = aOwner != null;
  1093. var ownerUrl = isLoggedIn ? aOwner.href : "http://steamcommunity.com/my";
  1094.  
  1095. GM_addStyle(
  1096. "#market_buynow_dialog_purchase > span:nth-child(1) { line-height: 80px; padding: 0px 50px 0px 50px !important; } "
  1097. + "#market_buynow_dialog { width: 850px; } "
  1098. + ".market_listing_table_header { margin: 0px; } "
  1099. + ".market_listing_row { margin-top: 2px; } "
  1100. );
  1101. var div_tabL = document.querySelectorAll("div.market_large_tab_well");
  1102. for (var i = 0; i < div_tabL.length; i++)
  1103. {
  1104. // reduce height of header
  1105. div_tabL[i].style.height = "50px";
  1106. }
  1107. var div_tabLB = document.querySelectorAll("div.market_large_tab_well_gradient");
  1108. for (var i = 0; i < div_tabLB.length; i++)
  1109. {
  1110. div_tabLB[i].style.height = "65px";
  1111. }
  1112.  
  1113. var div_store = document.getElementById("largeiteminfo_game_name");
  1114. if (div_store != null)
  1115. {
  1116. div_store.innerHTML = "<a href='http://store.steampowered.com/app/" + app + "/'>"
  1117. + div_store.innerHTML + "</a>";
  1118. }
  1119.  
  1120. var isFoil = false;
  1121. var ele_name = document.getElementById("largeiteminfo_item_name");
  1122. if (ele_name != null)
  1123. {
  1124. isFoil = (ele_name.innerHTML.search("Foil") > -1);
  1125. ele_name.innerHTML = "<a href='" + ownerUrl + "/gamecards/" + app
  1126. + (isFoil ? "/?border=1" : "/") + "'>" + ele_name.innerHTML + "</a>";
  1127. }
  1128.  
  1129. var ele_icon = document.getElementsByClassName("item_desc_game_icon");
  1130. for (var i = 0; i < ele_icon.length; i++)
  1131. {
  1132. ele_icon[i].innerHTML = "<a href='http://store.steampowered.com/app/" + app + "/'>"
  1133. + ele_icon[i].innerHTML + "</a>";
  1134. }
  1135.  
  1136. var div_nav = document.getElementsByClassName("market_large_tab_well");
  1137. for (var j = 0; j < div_nav.length; j++)
  1138. {
  1139. var aBadge = ' <div class="apphub_OtherSiteInfo" '
  1140. + 'style="position: relative; float: right; right: 2px; top: 2px;"> '
  1141. + '<a style="position: relative; z-index: 1;" class="btn_darkblue_white_innerfade btn_medium" '
  1142. + 'href="#" onclick="document.getElementById(\'pricehistory\').style.display = \'inherit\'; '
  1143. + 'document.querySelector(\'.pricehistory_zoom_controls\').style.display = \'inherit\'; return false; " >'
  1144. + '<span>Show History</span></a> &nbsp;'
  1145. + '<a style="position: relative; z-index: 1;" class="btn_darkblue_white_innerfade btn_medium" '
  1146. + 'href="http://store.steampowered.com/app/' + app + '"><span>Store Page</span></a> &nbsp;'
  1147. + '<a class="btn_darkblue_white_innerfade btn_medium" '
  1148. + 'href="' + ownerUrl + '/gamecards/' + app + (isFoil ? "/?border=1" : "/")
  1149. + '"><span>Trading Cards</span></a></div>';
  1150. div_nav[j].innerHTML = div_nav[j].innerHTML + aBadge;
  1151. GM_addStyle(
  1152. "#pricehistory, .pricehistory_zoom_controls { display: none } "
  1153. );
  1154. }
  1155. var span_list = document.querySelectorAll("div.market_listing_row > div:nth-child(3) > span:nth-child(1) > span:nth-child(1)");
  1156. for (var i = 0; i < span_list.length; i++)
  1157. {
  1158. if (!pattNumber.test(span_list[i].textContent))
  1159. {
  1160. span_list[i].parentElement.parentElement.parentElement.style.display = "none";
  1161. }
  1162. }
  1163. // preview bg in profile
  1164. {
  1165. if (ownerUrl != "http://steamcommunity.com/my")
  1166. {
  1167. var aImg = document.querySelector("#largeiteminfo_item_actions > a");
  1168. if (aImg != null)
  1169. {
  1170. var img = aImg.href;
  1171. if (img.indexOf(".jpg") > -1)
  1172. {
  1173. var urlPreview = ownerUrl + "?previewbg=" + img;
  1174. var a = document.createElement("a");
  1175. a.classList.add("btn_small");
  1176. a.classList.add("btn_grey_white_innerfade");
  1177. a.setAttribute("target", "_blank");
  1178. a.href = urlPreview;
  1179. a.innerHTML = '<span>Preview in Profile</span>';
  1180. aImg.parentElement.appendChild(a);
  1181. }
  1182. }
  1183. }
  1184. }
  1185. }
  1186. function linkMarketToBadgeTimeout(tm)
  1187. {
  1188. var url = document.documentURI;
  1189. var patt = /^http:\/\/steamcommunity.com\/market\/listings\/753\/[0-9]+/i;
  1190.  
  1191. if (patt.test(url) && !isErrorMarket())
  1192. {
  1193. setTimeout(linkMarketToBadge, tm);
  1194. }
  1195. }
  1196. if (enableLinkMarketToBadge) linkMarketToBadgeTimeout(100);
  1197.  
  1198. /** Add price of each cards in Badge page and link to Market page
  1199. */
  1200. function linkBadgeToMarket()
  1201. {
  1202. GM_addStyle(
  1203. ".div_market_price { padding-top: 1px; } "
  1204. + ".gamecard_badge_craftbtn_ctn .badge_craft_button { width: 160px !important; } "
  1205. );
  1206. var url = document.documentURI;
  1207.  
  1208. var pattAppHead = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\//i;
  1209. var pattAppTail = /[^0-9]+.*/i;
  1210. var app = url.replace(pattAppHead, "").replace(pattAppTail, "");
  1211. var isFoil = url.indexOf("border=1") > -1;
  1212. var urlExternal = "http://www.steamcardexchange.net/index.php?gamepage-appid-" + app;
  1213. var urlMarket = "http://steamcommunity.com/market/listings/753/";
  1214. var priceCards = new Array();
  1215. var priceUrls = new Array();
  1216. updatePrice();
  1217.  
  1218. var isCacheExpire = checkCacheExpire(app);
  1219. if (isCacheExpire || !enableCache)
  1220. {
  1221. setTimeout(function ()
  1222. {
  1223. GM_xmlhttpRequest({
  1224. method: "GET",
  1225. url: urlExternal,
  1226. onload: getExternalPrice,
  1227. });
  1228. }, 0);
  1229. }
  1230.  
  1231. function getExternalPrice(res)
  1232. {
  1233. try
  1234. {
  1235. var pattNumCard = /Card [0-9]+ of /i;
  1236. var pattMarket = /^http:\/\/steamcommunity.com\/market\/listings\/753\//i;
  1237. var pattPrice = /(Price: |Last seen: )/i;
  1238.  
  1239. var aOwner = document.querySelector("div.user_avatar > div.playerAvatar > a");
  1240. var isLoggedIn = aOwner != null;
  1241. var ownerUrl = isLoggedIn ? aOwner.href : "http://steamcommunity.com/my";
  1242.  
  1243. var aFriend = document.querySelector(".profile_small_header_name > a");
  1244. var isFriendExist = aFriend != null;
  1245. var friendUrl = isFriendExist ? aFriend.href : "http://steamcommunity.com/my";
  1246. var friendName = isFriendExist ? aFriend.textContent.trim() : "my"
  1247. var friendNameOwner = isFriendExist ? friendName + "'s" : friendName;
  1248.  
  1249. var isOwner = isLoggedIn && ownerUrl == friendUrl;
  1250.  
  1251. var divTempID = randTempID();
  1252. createDivTemp(divTempID, res.responseText);
  1253. try
  1254. {
  1255. //debug("ID: "+divTempID);
  1256. var divTemp = document.getElementById(divTempID);
  1257. var numCard = 0;
  1258. try
  1259. {
  1260. var spanNumber = divTemp.getElementsByClassName("element-count")[0];
  1261. if (spanNumber == null)
  1262. {
  1263. debug("Warning: can't get price");
  1264. return;
  1265. }
  1266. numCard = parseInt(spanNumber.textContent.replace(pattNumCard, ""));
  1267. }
  1268. catch (e)
  1269. {
  1270. debug("Ex: " + e);
  1271. }
  1272. var offsetCard = isFoil ? numCard : 0;
  1273. var curCard = 0;
  1274.  
  1275. var isCacheExpire = checkCacheExpire(app);
  1276.  
  1277. priceCards = new Array();
  1278. priceUrls = new Array();
  1279.  
  1280. var as = divTemp.getElementsByClassName("button-blue");
  1281. for (var i = 0; i < as.length; i++)
  1282. {
  1283. if (pattMarket.test(as[i].href))
  1284. {
  1285. if (curCard < numCard * 2)
  1286. {
  1287. var cPrice = as[i].textContent.replace(pattPrice, "").trim();
  1288. var cUrl = as[i].href.replace(urlMarket, "");
  1289.  
  1290. var indexCard = curCard - offsetCard;
  1291. if (indexCard >= 0 && indexCard < numCard)
  1292. {
  1293. priceCards[indexCard] = cPrice;
  1294. priceUrls[indexCard] = cUrl;
  1295. }
  1296.  
  1297. // cache
  1298. if (enableCache && isCacheExpire)
  1299. {
  1300. setCacheTime(app);
  1301. if (curCard < numCard)
  1302. {
  1303. setCachePrice(app, false, curCard, cPrice);
  1304. setCacheUrl(app, false, curCard, cUrl);
  1305. }
  1306. else // foil
  1307. {
  1308. setCachePrice(app, true, curCard - numCard, cPrice);
  1309. setCacheUrl(app, true, curCard - numCard, cUrl);
  1310. }
  1311. }
  1312.  
  1313. curCard += 1;
  1314. }
  1315. else
  1316. {
  1317. break;
  1318. }
  1319. }
  1320. }
  1321. }
  1322. catch (e)
  1323. {
  1324. debug("Ex: " + e);
  1325. }
  1326. removeDivTemp(divTempID);
  1327.  
  1328. updatePrice();
  1329.  
  1330. debugTime("getExternalPrice");
  1331. }
  1332. catch (e)
  1333. {
  1334. debug("Ex: " + e);
  1335. }
  1336. }
  1337.  
  1338. function updatePrice()
  1339. {
  1340. var pattNum = /[0-9\.]+/;
  1341. var colorUp = "#CC0000";
  1342. var colorDown = "#009900";
  1343.  
  1344. if (enableCache)
  1345. {
  1346. priceCards = new Array();
  1347. priceUrls = new Array();
  1348. for (var i = 0; i < 15; i++)
  1349. {
  1350. var p = getCachePrice(app, isFoil, i);
  1351. var u = getCacheUrl(app, isFoil, i);
  1352. if (p != 0 && u != 0)
  1353. {
  1354. priceCards[i] = p;
  1355. priceUrls[i] = u;
  1356. }
  1357. else
  1358. {
  1359. break;
  1360. }
  1361. }
  1362. }
  1363.  
  1364. var texts = document.getElementsByClassName("badge_card_set_card");
  1365. var numCard = texts.length;
  1366. var priceSet = 0;
  1367. for (var j = 0; j < texts.length; j++)
  1368. {
  1369. var pUrl = priceUrls[j] ? urlMarket + priceUrls[j] : "";
  1370. var pCard = priceCards[j] ? priceCards[j] : "-";
  1371. var pOnClick = priceCards[j] ? "" : " onclick='return false;' ";
  1372. var pDiff = "";
  1373. var pCardOld = "";
  1374. var divTexts = texts[j].querySelectorAll("div.badge_card_set_text");
  1375. var divText = divTexts[divTexts.length - 1];
  1376. var divMarkets = texts[j].getElementsByClassName("div_market_price");
  1377. var divMarket;
  1378. if (divMarkets.length == 0)
  1379. {
  1380. divMarket = document.createElement("div");
  1381. divMarket.classList.add("div_market_price");
  1382. divMarket.style.cssFloat = "right";
  1383. divText.appendChild(divMarket);
  1384. }
  1385. else
  1386. {
  1387. divMarket = divMarkets[0];
  1388. var as = divMarket.getElementsByTagName("a");
  1389. if (as.length > 0)
  1390. {
  1391. var pOld = as[0].textContent;
  1392. var pValOld = pOld.match(pattNum);
  1393. if (pValOld != null)
  1394. {
  1395. //debug("oldPrice[" + j + "]: "+ pValOld);
  1396. pCardOld = "title='Cache Price: " + pOld + "'";
  1397. var pVal = pCard.match(pattNum);
  1398. pVal = pVal ? pVal : 0;
  1399. priceSet += parseFloat(pVal);
  1400. var pValDiff = (parseFloat(pVal) - parseFloat(pValOld)).toFixed(2);
  1401. if(pValDiff > 0)
  1402. {
  1403. pDiff = "<span style='cursor: help; color: " + colorUp + ";' "
  1404. + pCardOld + ">+" + pValDiff + "</span>";
  1405. }
  1406. else if (pValDiff < 0)
  1407. {
  1408. pDiff = "<span style='cursor: help; color: " + colorDown + ";' "
  1409. + pCardOld + ">" + pValDiff + "</span>";
  1410. }
  1411. else
  1412. {
  1413. pCardOld = "";
  1414. }
  1415. }
  1416. }
  1417. }
  1418.  
  1419. divMarket.innerHTML = pDiff + " <a href='" + pUrl + "' " + pOnClick + " title='Lowest Price'>" + pCard + "</a>";
  1420. } // end for
  1421. if (priceSet > 0)
  1422. {
  1423. debug("priceSet: " + priceSet);
  1424. }
  1425. }
  1426. }
  1427. function linkBadgeToMarketTimeout(tm)
  1428. {
  1429. var url = document.documentURI;
  1430. var patt = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\/[0-9]+/i;
  1431.  
  1432. if (patt.test(url) && !isErrorCard())
  1433. {
  1434. setTimeout(linkBadgeToMarket, tm);
  1435. }
  1436. }
  1437. if (enableLinkBadgeToMarket) linkBadgeToMarketTimeout(0);
  1438.  
  1439. /** Compare my cards and friend's cards in Badge page
  1440. * Mark color of my cards count (Green) and friend's cards count (Blue)
  1441. */
  1442. function compareBadge()
  1443. {
  1444. var url = document.documentURI;
  1445.  
  1446. var pattAppHead = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\//i;
  1447. var pattAppTail = /[^0-9]+.*/i;
  1448. var app = url.replace(pattAppHead, "").replace(pattAppTail, "");
  1449.  
  1450. {
  1451. try
  1452. {
  1453. var pattNumCard = /Card [0-9]+ of /i;
  1454. var pattMarket = /^http:\/\/steamcommunity.com\/market\/listings\/753\//i;
  1455. var pattPrice = /Price: /i;
  1456.  
  1457. var isFoil = url.indexOf("border=1") > -1;
  1458.  
  1459. var aOwner = document.querySelector("div.user_avatar > div.playerAvatar > a");
  1460. var isLoggedIn = aOwner != null;
  1461. var ownerUrl = isLoggedIn ? aOwner.href : "http://steamcommunity.com/my";
  1462.  
  1463. var aFriend = document.querySelector(".profile_small_header_name > a");
  1464. var isFriendExist = aFriend != null;
  1465. var friendUrl = isFriendExist ? aFriend.href : "http://steamcommunity.com/my";
  1466. var friendName = isFriendExist ? aFriend.textContent.trim() : "my"
  1467. var friendNameOwner = isFriendExist ? friendName + "'s" : friendName;
  1468.  
  1469. var isOwner = isLoggedIn && ownerUrl == friendUrl;
  1470.  
  1471. //debug("ownerUrl: "+ownerUrl);
  1472. //debug("friendUrl: "+friendUrl);
  1473.  
  1474. var texts = document.getElementsByClassName("badge_card_set_card");
  1475. var numCard = texts.length;
  1476.  
  1477. //debug("isOwner: "+isOwner);
  1478. //debug("numCard: "+numCard);
  1479.  
  1480. for (var j = 0; j < numCard; j++)
  1481. {
  1482. var divQty = texts[j].querySelector("div.badge_card_set_text_qty");
  1483. var numQty = "(0)";
  1484. if (divQty != null)
  1485. {
  1486. numQty = divQty.textContent.trim();
  1487. }
  1488. else
  1489. {
  1490. divQty = document.createElement("div");
  1491. divQty.classList.add("badge_card_set_text_qty");
  1492. divQty.innerHTML = numQty;
  1493.  
  1494. var divCtn = texts[j].querySelector("div.game_card_ctn");
  1495. if (divCtn != null)
  1496. {
  1497. var divTexts = texts[j].querySelectorAll("div.badge_card_set_text");
  1498. if (divTexts.length < 2)
  1499. {
  1500. texts[j].insertBefore(divQty, divCtn.nextSibling);
  1501. }
  1502. else
  1503. {
  1504. divTexts[0].insertBefore(divQty, divTexts[0].firstChild);
  1505. }
  1506. }
  1507. }
  1508. //debug("numQty: "+numQty);
  1509. } // end for
  1510.  
  1511. var colorOwner = "#8CBE0F";
  1512. var colorFriend = "#5491CF";
  1513. var colorZeroOwner = "#557309";
  1514. var colorZeroFriend = "#355C82";
  1515. var countCardAll = 0;
  1516.  
  1517. var divQtys = document.querySelectorAll("div.badge_card_set_text_qty");
  1518. for (var k = 0; k < divQtys.length; k++)
  1519. {
  1520. var num = divQtys[k].textContent.trim().replace(/[\(\)]/gi, "");
  1521. countCardAll += parseInt(num);
  1522. divQtys[k].innerHTML = "";
  1523.  
  1524. var spanNum = document.createElement("span");
  1525. spanNum.classList.add("span_card_qty");
  1526. spanNum.style.cursor = "help";
  1527. spanNum.innerHTML = " (" + num + ") ";
  1528. divQtys[k].insertBefore(spanNum, null);
  1529.  
  1530. if (isOwner)
  1531. {
  1532. spanNum.classList.add("span_card_qty_owner");
  1533. spanNum.style.color = num > "0" ? colorOwner : colorZeroOwner;
  1534. spanNum.title = "My cards: " + num;
  1535. }
  1536. else
  1537. {
  1538. spanNum.classList.add("span_card_qty_friend");
  1539. spanNum.style.color = num > "0" ? colorFriend : colorZeroFriend;
  1540. spanNum.title = friendNameOwner + " cards: " + num;
  1541. }
  1542. }
  1543. debug("countCard: " + countCardAll);
  1544. debug("maxSet: " + parseInt(countCardAll / numCard));
  1545.  
  1546. if (!isOwner)
  1547. {
  1548. var pattProfile = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]*/i;
  1549. var urlExternal = url.replace(pattProfile, ownerUrl);
  1550. //debug("urlExternal: "+urlExternal);
  1551.  
  1552. setTimeout(function ()
  1553. {
  1554. GM_xmlhttpRequest({
  1555. method: "GET",
  1556. url: urlExternal,
  1557. onload: compareCard,
  1558. });
  1559. }, 0);
  1560.  
  1561. function compareCard(res)
  1562. {
  1563. var divTempID = randTempID();
  1564. createDivTemp(divTempID, res.responseText);
  1565. try
  1566. {
  1567. //debug("ID: "+divTempID);
  1568. var divTemp = document.getElementById(divTempID);
  1569.  
  1570. var owner_texts = divTemp.getElementsByClassName("badge_card_set_card");
  1571. var owner_numCard = owner_texts.length;
  1572.  
  1573. if (numCard == owner_numCard)
  1574. {
  1575. var owner_numQtys = new Array();
  1576.  
  1577. for (var i = 0; i < owner_texts.length; i++)
  1578. {
  1579. var owner_divQty = owner_texts[i].querySelector("div.badge_card_set_text_qty");
  1580. if (owner_divQty != null)
  1581. {
  1582. owner_numQtys[i] = owner_divQty.textContent.trim().replace(/[\(\)]/gi, "");
  1583. }
  1584. else
  1585. {
  1586. owner_numQtys[i] = "0";
  1587. }
  1588. //debug("owner_numQtys[i]: "+owner_numQtys[i]);
  1589. } // end for
  1590.  
  1591. var friend_divQtys = document.querySelectorAll("div.badge_card_set_text_qty");
  1592. for (var k = 0; k < friend_divQtys.length; k++)
  1593. {
  1594. var owner_spanNum = friend_divQtys[k].querySelector("span_card_qty_owner");
  1595. if (owner_spanNum == null)
  1596. {
  1597. owner_spanNum = document.createElement("span");
  1598. owner_spanNum.classList.add("span_card_qty");
  1599. owner_spanNum.style.cursor = "help";
  1600. owner_spanNum.classList.add("span_card_qty_owner");
  1601. owner_spanNum.style.color = owner_numQtys[k] > "0" ? colorOwner : colorZeroOwner;
  1602. owner_spanNum.title = "My cards: " + owner_numQtys[k];
  1603. friend_divQtys[k].insertBefore(owner_spanNum, friend_divQtys[k].firstChild);
  1604. }
  1605. owner_spanNum.innerHTML = " (" + owner_numQtys[k] + ") ";
  1606. }
  1607. }
  1608. }
  1609. catch (e)
  1610. {
  1611. debug("Ex: " + e);
  1612. }
  1613. removeDivTemp(divTempID);
  1614. debugTime("compareBadge");
  1615. }
  1616. }
  1617. }
  1618. catch (e)
  1619. {
  1620. debug("Ex: " + e);
  1621. }
  1622. }
  1623. }
  1624. function compareBadgeTimeout(tm)
  1625. {
  1626. var url = document.documentURI;
  1627. var patt = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/gamecards\/[0-9]+/i;
  1628.  
  1629. if (patt.test(url) && !isErrorCard())
  1630. {
  1631. setTimeout(compareBadge, tm);
  1632. }
  1633. }
  1634. if (enableCompareBadge) compareBadgeTimeout(0);
  1635.  
  1636. function editTitle()
  1637. {
  1638. try
  1639. {
  1640. var titleOld = document.title;
  1641. var titleNew = titleOld;
  1642. var titleNoti = "";
  1643. var pattSale = /[0-9]+%/i;
  1644. if (enableSwapTitle)
  1645. {
  1646. var splitSpace = titleOld.split(" ");
  1647. if (splitSpace.length > 1)
  1648. {
  1649. if (pattSale.test(splitSpace[1]))
  1650. {
  1651. splitSpace.splice(0, 1);
  1652. splitSpace.splice(1, 1);
  1653. titleOld = splitSpace.join(" ");
  1654. }
  1655. }
  1656. var split = titleOld.split("::").reverse();
  1657. for (var i = 0; i < split.length; i++)
  1658. {
  1659. split[i] = split[i].trim();
  1660. }
  1661. titleNew = split.join(" :: ");
  1662. document.title = titleNew;
  1663. var divH = document.querySelector("#header_notification_area");
  1664. if (divH != null)
  1665. {
  1666. divH.addEventListener('mouseover', function() {
  1667. document.title = titleNew;
  1668. });
  1669. }
  1670. }
  1671. if (enableShowTitleNoti)
  1672. {
  1673. var noti = document.querySelector("#header_notification_link");
  1674. if (noti != null)
  1675. {
  1676. function updateTitleNoti()
  1677. {
  1678. var notiNum = noti.textContent.trim();
  1679. if (notiNum != "" && notiNum != "0")
  1680. {
  1681. debug("updateTitleNoti: "+notiNum);
  1682. titleNoti = "("+notiNum+") ";
  1683. }
  1684. else
  1685. {
  1686. titleNoti = "";
  1687. }
  1688. if (document.title != titleNoti + titleNew)
  1689. {
  1690. debug("changeTitle: "+notiNum);
  1691. document.title = titleNoti + titleNew;
  1692. }
  1693. }
  1694. updateTitleNoti();
  1695. /*
  1696. var timeoutID = -1;
  1697. noti.addEventListener("DOMSubtreeModified", function (e) {
  1698. debug("DOMSubtreeModified");
  1699. try
  1700. {
  1701. clearTimeout(timeoutID);
  1702. }
  1703. catch (ex)
  1704. {
  1705. }
  1706. updateTitleNoti();
  1707. });
  1708. noti.addEventListener("DOMNodeInserted", function (e) {
  1709. debug("DOMNodeInserted");
  1710. try
  1711. {
  1712. clearTimeout(timeoutID);
  1713. }
  1714. catch (ex)
  1715. {
  1716. }
  1717. updateTitleNoti();
  1718. });
  1719. noti.addEventListener("DOMNodeRemoved", function (e) {
  1720. debug("DOMNodeRemoved");
  1721. timeoutID = setTimeout(updateTitleNoti,100);
  1722. });
  1723. */
  1724. }
  1725. }
  1726. }
  1727. catch (ex)
  1728. {
  1729. debug("editTitle: "+ex);
  1730. }
  1731. }
  1732. function editTitleAttach()
  1733. {
  1734. attachOnReady(editTitle);
  1735. }
  1736. if (enableSwapTitle || enableShowTitleNoti) editTitleAttach();
  1737.  
  1738. /** Resize trade window that is larger than 768px
  1739. */
  1740. function resizeTradeWindow()
  1741. {
  1742. if (window.innerHeight < 800)
  1743. {
  1744. GM_addStyle("#mainContent { transform: scale(0.8, 0.8); transform-origin: 50% 0px 0px; }");
  1745. if (window.innerWidth > 1000)
  1746. {
  1747. //window.resizeBy(-240,0);
  1748. //window.moveBy(200,0);
  1749. }
  1750. var ele = document.querySelector(".trade_partner_info_block");
  1751. if (ele != null)
  1752. {
  1753. ele.scrollIntoView();
  1754. }
  1755. }
  1756. }
  1757. function resizeTradeWindowTimeout(tm)
  1758. {
  1759. var url = document.documentURI;
  1760. var patt = /^http[s]?:\/\/steamcommunity.com\/(tradeoffer|trade)\//i;
  1761.  
  1762. if (patt.test(url))
  1763. {
  1764. setTimeout(resizeTradeWindow, tm);
  1765. }
  1766. }
  1767. if (enableResizeTradeWindow) resizeTradeWindowTimeout(0);
  1768. /** Add link in profile page
  1769. */
  1770. function linkProfile()
  1771. {
  1772. GM_addStyle(".achievement_progress_bar_ctn { width: 118px; margin-left: 4px; } ");
  1773. var url = document.documentURI;
  1774. var urlOwner = url;
  1775. if (urlOwner[urlOwner.length-1] != "/")
  1776. {
  1777. urlOwner = urlOwner + "/";
  1778. }
  1779. var urlName = urlOwner + "namehistory/";
  1780. var urlPost = urlOwner + "posthistory/";
  1781. var labelName = "Name History";
  1782. var labelPost = "Post History";
  1783. var arrUrl = ["", urlName, urlPost];
  1784. var arrLbl = ["", labelName, labelPost];
  1785. var divOuter = document.querySelector(".profile_item_links");
  1786. if (divOuter != null)
  1787. {
  1788. for (var i = 0; i < arrUrl.length; i++)
  1789. {
  1790. var div = document.createElement("div");
  1791. if (div != null)
  1792. {
  1793. div.className = "profile_count_link";
  1794. div.innerHTML = '<a href="' + arrUrl[i] + '"><span class="count_link_label">'
  1795. + arrLbl[i] + '</span> <span class="profile_count_link_total"> </span></a>';
  1796. divOuter.appendChild(div);
  1797. }
  1798. }
  1799. }
  1800. // preview bg in profile
  1801. function previewBg()
  1802. {
  1803. var bg = getQueryByName("previewbg");
  1804. if (bg != "")
  1805. {
  1806. var divBg = document.querySelector("div.has_profile_background");
  1807. if (divBg != null)
  1808. {
  1809. divBg.style.backgroundImage = "url('" + bg + "')";
  1810. }
  1811. var divBgIn = document.querySelector("div.profile_background_image_content");
  1812. if (divBgIn != null)
  1813. {
  1814. divBgIn.style.backgroundImage = "url('" + bg + "')";
  1815. }
  1816. }
  1817. }
  1818. attachOnLoad(previewBg);
  1819. }
  1820. function linkProfileReady()
  1821. {
  1822. var url = document.documentURI;
  1823. var patt = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+(\/?\?.*)?\/?$/i;
  1824. if (patt.test(url))
  1825. {
  1826. attachOnReady(linkProfile);
  1827. }
  1828. }
  1829. if (enableLinkProfile) linkProfileReady();
  1830. /** Set all checkbox to checked
  1831. */
  1832. function setAllCheckBox()
  1833. {
  1834. var ids = ["market_buynow_dialog_accept_ssa", "market_sell_dialog_accept_ssa", "accept_ssa", "verify_country_only"];
  1835. for (var i = 0; i < ids.length; i++)
  1836. {
  1837. var input = document.getElementById(ids[i]);
  1838. if (input != null)
  1839. {
  1840. input.checked = true;
  1841. }
  1842. }
  1843. }
  1844. function setAllCheckBoxReady()
  1845. {
  1846. var url = document.documentURI;
  1847. var pattMarket = /^http:\/\/steamcommunity.com\/market\/listings\/[0-9]+/i;
  1848. var pattInv = /^http[s]?:\/\/steamcommunity.com\/(id|profiles)\/[^\/]+\/inventory/i;
  1849. var pattCart = /^http[s]?:\/\/store.steampowered.com\/checkout/i;
  1850. if (pattMarket.test(url) || pattInv.test(url) || pattCart.test(url))
  1851. {
  1852. attachOnReady(setAllCheckBox);
  1853. }
  1854. }
  1855. if (enableSetAllCheckBox) setAllCheckBoxReady();
  1856. /** Scroll store page to easy view
  1857. */
  1858. function storeFocus()
  1859. {
  1860. var eleAccount = document.querySelector("#account_pulldown");
  1861. if (eleAccount != null)
  1862. {
  1863. var divHead = document.querySelector(".breadcrumbs > .blockbg, .breadcrumbs > a, div.auction_block:nth-child(1)");
  1864. if (divHead != null)
  1865. {
  1866. divHead.scrollIntoView();
  1867. }
  1868. }
  1869. }
  1870. function storeFocusReady()
  1871. {
  1872. var url = document.documentURI;
  1873. var patt = /^http[s]?:\/\/(store.steampowered.com\/(app|sub)\/|steamcommunity.com\/(auction\/item\/|sharedfiles\/filedetails\/\?id=))/i;
  1874. if (patt.test(url))
  1875. {
  1876. attachOnReady(storeFocus);
  1877. }
  1878. }
  1879. if (enableStoreFocus) storeFocusReady();
  1880. /** Hide queue in already owned in store page
  1881. */
  1882. function storeHideSection()
  1883. {
  1884. var divOwn = document.querySelector(".already_owned_actions");
  1885. if (divOwn != null)
  1886. {
  1887. GM_addStyle(
  1888. ".game_area_already_owned { margin-top: 10px !important; } "
  1889. + ".queue_ctn { display: none; } "
  1890. + "#review_container, .reviewPostedDescription, .review_box > .thumb { display: none; } "
  1891. + ".sbh_margin_left { margin-left: 5px; } "
  1892. + ".game_area_play_stats { min-height: 50px; } "
  1893. + "#review_container { margin-top: 30px; } "
  1894. );
  1895. var html = ""
  1896. html += ' <a class="btnv6_blue_hoverfade btn_medium right sbh_margin_left" onclick="'
  1897. + "var sbhQueue = document.querySelector('.queue_ctn');"
  1898. + "if (sbhQueue != null) { sbhQueue.style.display = 'inherit'; sbhQueue = null;} "
  1899. + "this.style.display = 'none'; return false;"
  1900. + '"><span>Show Follow</span></a> ';
  1901. var divReview = document.querySelector("#review_container, .reviewPostedDescription");
  1902. if (divReview != null)
  1903. {
  1904. html += ' <a class="btnv6_blue_hoverfade btn_medium right sbh_margin_left" onclick="'
  1905. + "var sbhReview = document.querySelector('#review_container, .reviewPostedDescription'); "
  1906. + "if (sbhReview != null) { sbhReview.style.display = 'inherit'; sbhReview = null; } "
  1907. + "var sbhReviewThumb = document.querySelector('.review_box > .thumb'); "
  1908. + "if (sbhReviewThumb != null) { sbhReviewThumb.style.display = 'inherit'; sbhReviewThumb = null; } "
  1909. + "this.style.display = 'none'; return false;"
  1910. + '"><span>Show Review</span></a> ';
  1911. }
  1912. divOwn.innerHTML += html;
  1913. }
  1914. }
  1915. function storeHideSectionReady()
  1916. {
  1917. var url = document.documentURI;
  1918. var patt = /^http[s]?:\/\/store.steampowered.com\/app\//i;
  1919. if (patt.test(url))
  1920. {
  1921. attachOnReady(storeHideSection);
  1922. }
  1923. }
  1924. if (enableStoreHideSection) storeHideSectionReady();
  1925. // ===== End Main =====
  1926.  
  1927. attachOnReady(function()
  1928. {
  1929. debugTime("ready");
  1930. });
  1931.  
  1932. attachOnLoad(function()
  1933. {
  1934. debugTime("load");
  1935. });
  1936. function testEvent()
  1937. {
  1938. /*document.addEventListener("DOMCharacterDataModified", function (e) {
  1939. debugTime("DOMCharacterDataModified");
  1940. });
  1941. document.querySelector("#header_notification_link").addEventListener("DOMSubtreeModified", function (e) {
  1942. debugTime("DOMSubtreeModified");
  1943. });*/
  1944. }
  1945. attachOnLoad(testEvent);
  1946. })();