Steam Game show in NGA

在 NGA论坛 发帖中显示 Steam 游戏信息 移植自 Steamcn.com 同名插件

  1. // ==UserScript==
  2. // @name Steam Game show in NGA
  3. // @namespace https://gf.qytechs.cn/zh-CN/scripts/16390-steam-game-show-in-nga
  4. // @version 1.07
  5. // @require http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js
  6. // @description 在 NGA论坛 发帖中显示 Steam 游戏信息 移植自 Steamcn.com 同名插件
  7. // @author 原作者 Deparsoul @ steamcn ,由 Lyragosa 移植到NGA
  8. // @include /^http://(bbs\.ngacn\.cc|nga\.178\.com|bbs\.nga\.cn)/(read\.php|thread\.php\?fid=414|nuke\.php\?func=steamsync)/
  9. // @grant GM_xmlhttpRequest
  10. // @license MIT License
  11. // ==/UserScript==
  12.  
  13. console.log("Lyragosa Steam App Show in NGA load success");
  14.  
  15.  
  16. if (location.href.indexOf('/nuke.php?func=steamsync')>0) {
  17. //var unixTimestamp = new Date(Unix timestamp * 1000)
  18. var commonTime = getTimeNow();
  19. var ownnum = 0;
  20. var wishnum = 0;
  21. if (localStorage.getItem("own") != null) {
  22. ownnum = eval(localStorage.getItem("own")).length;
  23. }
  24. if (localStorage.getItem("wish") != null) {
  25. wishnum = eval(localStorage.getItem("wish")).length;
  26. }
  27. jQuery("body").append("<h2 id='page_title'><a href='http://bbs.ngacn.cc'>BBS.NGACN.CC</a> &nbsp; Steam 信息同步</h2>已经重新尝试同步 Steam 愿望单和已购物品信息 于 "+ commonTime + ",如果读取失败,请检查你的浏览器是否已经登录(不可用)你的 Steam 帐号。<BR>你已购物品(含DLC)共计 <b>"+ ownnum +"</b> 个,愿望单中物品共计 <b>" + wishnum + "</b> 个。 <BR> ");
  28. jQuery("body").append("此信息仅供在NGA直接显示链接颜色使用,<span class='linkOwn'>已购物品将用绿色背景表示</span>,<span class='linkWish'>愿望单中物品将用蓝色背景表示</span>。<BR> 鼠标提示框中的信息需要在提示框中的同步区进行同步。 <BR> 之所以需要两次同步,是因为此脚本<b>并没有整合在NGA,而是由第三方制作</b>。<br>如果你喜欢本插件,请向二哥提议在论坛内置此功能。");
  29. sync();
  30. console.log("sync success");
  31. }
  32.  
  33. if (location.href.indexOf('/thread.php?fid=414')>0) {
  34. //console.log(jQuery("#m_pbtntop div div").html());
  35. jQuery("#m_pbtntop div div.right_ table tbody tr").prepend('<td><a href="/nuke.php?func=steamsync" target="_blank" class="b blue"><nobr><span style="font-size:1.23em">同步我的 Steam 信息</span></nobr></a></td>');
  36. }
  37. /* SYNC END */
  38.  
  39. var currentScript = "0";
  40. function setScriptVersion(a) {
  41. currentScript = a;
  42. jQuery("#noScript").hide();
  43. jQuery("#withScript").show();
  44. jQuery("#progress").show();
  45. flag_desura = false;
  46. flag_userdata = false;
  47. flag_wish = true;
  48. }
  49. function checkLast() {
  50. if (localStorage.last) {
  51. jQuery("#reset").fadeIn();
  52. jQuery("#lastTime").text(localStorage.last);
  53. var c = JSON.parse(localStorage.own);
  54. var e = JSON.parse(localStorage.wish);
  55. jQuery("#lastOwn").text(c.length);
  56. jQuery("#lastWish").text(e.length);
  57. if (localStorage.sub) {
  58. var d = JSON.parse(localStorage.sub);
  59. jQuery("#lastSub").html(" | 订阅(SUB):<strong>" + d.length + "</strong>")
  60. } else {
  61. jQuery("#lastSub").html("")
  62. }
  63. if (localStorage.desura) {
  64. var b = JSON.parse(localStorage.desura);
  65. jQuery("#lastDesura").html(" | Desura:<strong>" + b.length + "</strong>")
  66. } else {
  67. jQuery("#lastDesura").html("")
  68. }
  69. var a = jQuery("#lastSync");
  70. if (a.hasClass("alert-info")) {
  71. a.removeClass("alert-info").addClass("alert-success")
  72. } else {
  73. a.addClass("alert-info")
  74. }
  75. if (localStorage.avatar) {
  76. jQuery("#avatar img").attr("src", localStorage.avatar);
  77. jQuery("#avatar a").attr("href", localStorage.profileurl);
  78. jQuery("#avatar span").text(localStorage.personaname);
  79. jQuery("#avatar").show()
  80. } else {
  81. jQuery("#avatar").hide()
  82. }
  83. a.fadeIn()
  84. }
  85. }
  86. var flag_own = false;
  87. var flag_wish = false;
  88. var flag_userdata = true;
  89. var flag_desura = true;
  90. function checkFinish() {
  91. if (flag_own && flag_wish && flag_desura && flag_userdata) {
  92. localStorage.last = getTimeNow();
  93. checkLast();
  94. syncAnywhere();
  95. //ga("send", "event", "sync", "finish");
  96. //ga("set", "dimension2", "Finish Sync");
  97. //ga("set", "metric1", 1)
  98. }
  99. }
  100. function syncAnywhere() {
  101. if (sa) {
  102. if (localStorage.steamid != su) {
  103. need_login()
  104. } else {
  105. var a = {id: localStorage.steamid, avatar: localStorage.avatar, personaname: localStorage.personaname, profileurl: localStorage.profileurl};
  106. if (localStorage.own) {
  107. a.own = JSON.parse(localStorage.own)
  108. }
  109. if (localStorage.wish) {
  110. a.wish = JSON.parse(localStorage.wish)
  111. }
  112. if (localStorage.sub) {
  113. a.sub = JSON.parse(localStorage.sub)
  114. }
  115. if (localStorage.desura) {
  116. a.desura = JSON.parse(localStorage.desura)
  117. }
  118. jQuery("#sa").slideDown();
  119. $.post("sync_anywhere", {d: JSON.stringify(a), csrf: csrf}).done(function (b) {
  120. if (b != "1") {
  121. jQuery("#sa_after strong").html(b)
  122. }
  123. jQuery("#sa_before").slideUp();
  124. jQuery("#sa_after").slideDown()
  125. })
  126. }
  127. }
  128. }
  129. function checkBrowser() {
  130. var a = {explorer: {ie: /msie ([\d.]+).*\.net clr (\d\.){1,2}\d+\)$/, firefox: /firefox\/([\d.]+)/, chrome: /chrome\/([\d.]+)/, opera: /opera.([\d.]+)/, safari: /version\/([\d.]+).*safari/, se: /msie ([\d.]+).*\.net clr (\d\.){1,2}\d+; 360se\)$/, sougou: /msie ([\d.]+).*\.net clr (\d\.){1,2}\d+; .*metasr.*\d\)$/, maxthon: /maxthon\/([\d.]+)/}};
  131. var c = navigator.userAgent.toLowerCase();
  132. var b = null;
  133. (b = c.match(a.explorer.ie)) ? a.ie = b[1] : (b = c.match(a.explorer.firefox)) ? a.firefox = b[1] : (b = c.match(a.explorer.chrome)) ? a.chrome = b[1] : (b = c.match(a.explorer.opera)) ? a.opera = b[1] : (b = c.match(a.explorer.safari)) ? a.safari = b[1] : (b = c.match(a.explorer.se)) ? a.se = b[1] : (b = c.match(a.explorer.sougou)) ? a.sougou = b[1] : (b = c.match(a.explorer.maxthon)) ? a.maxthon = b[1] : false;
  134. if (a.firefox || a.chrome) {
  135. return true
  136. } else {
  137. return false
  138. }
  139. }
  140. function noScriptSync() {
  141. jQuery("#noScriptSync").unbind("click").text("正在进行免脚本同步,请确认已将用户资料设为公开");
  142. if (localStorage.steamid && localStorage.profileurl) {
  143. jQuery("#progress").slideDown();
  144. jQuery("#nav-desura").fadeIn();
  145. var a = localStorage.steamid;
  146. $.getJSON("syncProxy.php?type=own&id=" + a, function (d) {
  147. if (d.response.game_count) {
  148. var f = d.response.games;
  149. var b = new Array();
  150. for (var c = 0; c < f.length; ++c) {
  151. b.push(parseInt(f[c].appid))
  152. }
  153. localStorage.own = JSON.stringify(b);
  154. show_status("#own", b.length);
  155. flag_own = true;
  156. var e = localStorage.profileurl;
  157. $.getJSON("syncProxy.php?type=wish&id=" + e, function (h) {
  158. var j = new Array();
  159. for (var g = 0; g < h.length; ++g) {
  160. j.push(parseInt(h[g]))
  161. }
  162. localStorage.wish = JSON.stringify(j);
  163. show_status("#wish", j.length);
  164. flag_wish = true;
  165. //ga("send", "event", "sync", "noScriptSync");
  166. checkFinish()
  167. })
  168. } else {
  169. need_public()
  170. }
  171. })
  172. } else {
  173. need_login()
  174. }
  175. }
  176. function checkScript() {
  177. if (jQuery("#noScript").is(":visible")) {
  178. //ga("send", "event", "script", "not installed");
  179. //ga("set", "dimension1", "No Script");
  180. if (checkBrowser()) {
  181. jQuery("#installScript").fadeIn()
  182. }
  183. jQuery("#noScriptSync").fadeIn();
  184. if (localStorage.noScriptSync) {
  185. noScriptSync()
  186. } else {
  187. jQuery("#noScriptSync").click(function () {
  188. localStorage.noScriptSync = true;
  189. noScriptSync();
  190. return false
  191. })
  192. }
  193. } else {
  194. if (currentScript < latestScript) {
  195. jQuery("#oldScript").show()
  196. }
  197. //ga("send", "event", "script", "installed");
  198. //ga("set", "dimension1", "With Script");
  199. localStorage.removeItem("noScriptSync")
  200. }
  201. }
  202. function getTimeNow() {
  203. return new Date().toLocaleString()
  204. }
  205. function show_status(b, a) {
  206. if (b == "#own") {
  207. //ga("set", "metric2", a)
  208. } else {
  209. if (b == "#wish") {
  210. //ga("set", "metric3", a)
  211. }
  212. }
  213. if (a >= 0) {
  214. jQuery(b + "_after strong").text("成功读取并记录了 " + a + " 个条目")
  215. } else {
  216. if (a == -1) {
  217. jQuery(b + "_after strong").text("读取失败,未登录(不可用) Steam")
  218. } else {
  219. if (a == -2) {
  220. jQuery(b + "_after strong").text("读取失败,无法访问 Steam")
  221. }
  222. }
  223. }
  224. jQuery(b + "_before").slideUp();
  225. jQuery(b + "_after").slideDown();
  226. //ga("send", "event", "game stat", localStorage.steamid + "-" + localStorage.personaname + b, a)
  227. }
  228. function proc_own(d) {
  229. var c = d;
  230. var a = c.match(/var rgGames = (.*);/);
  231. if (a) {
  232. var b = c.match(/g_steamID = "(\d+)";/);
  233. if (b) {
  234. localStorage.steamid = b[1]
  235. }
  236. var b = c.match(/personaName = (".*");/);
  237. if (b) {
  238. localStorage.personaname = JSON.parse(b[1])
  239. }
  240. var b = c.match(/var profileLink = "(.*)";/);
  241. if (b) {
  242. localStorage.profileurl = b[1] + "/"
  243. }
  244. var b = c.match(/<div class="profile_small_header_avatar">\s*<div[^>]+>\s*<img src="([^"]+)/);
  245. if (b) {
  246. localStorage.avatar = b[1].replace("_medium.jpg", ".jpg")
  247. }
  248. flag_own = true;
  249. checkFinish()
  250. } else {
  251. if (c.match(/global_action_link/)) {
  252. show_status("#own", -1);
  253. need_login()
  254. } else {
  255. show_status("#own", -2)
  256. }
  257. }
  258. }
  259. function proc_wish(f) {
  260. var a = f;
  261. var d = jQuery(a);
  262. var c = d.find('#tabs_basebg>form>input[name="appid"]');
  263. var b = d.find(".wishlist_empty_notice").length > 0;
  264. if (c.length > 0 || b) {
  265. var e = new Array();
  266. c.each(function () {
  267. e.push(parseInt(jQuery(this).val()))
  268. });
  269. localStorage.wish = JSON.stringify(e);
  270. show_status("#wish", e.length);
  271. flag_wish = true;
  272. checkFinish()
  273. } else {
  274. if (d.find(".global_action_link")) {
  275. show_status("#wish", -1);
  276. need_login()
  277. } else {
  278. show_status("#wish", -2)
  279. }
  280. }
  281. }
  282. function proc_userdata(b) {
  283. var d = JSON.parse(b);
  284. if (d) {
  285. var a = d.rgOwnedApps;
  286. var e = d.rgWishlist;
  287. var c = d.rgOwnedPackages;
  288. if (a || e || c) {
  289. localStorage.own = JSON.stringify(a);
  290. localStorage.wish = JSON.stringify(e);
  291. localStorage.sub = JSON.stringify(c);
  292. show_status("#own", a.length);
  293. show_status("#wish", e.length);
  294. show_status("#sub", c.length);
  295. if (a.length + e.length + c.length == 0) {
  296. jQuery("#progress").prepend('<div class="alert alert-danger"><strong><a href="https://store.steampowered.com/login" target="_blank" style="color:white">未读取到 Steam 用户数据,请点击此处,确认是否已经登录(不可用) Steam 商店</a></strong></div>')
  297. }
  298. flag_userdata = true;
  299. checkFinish()
  300. }
  301. }
  302. }
  303. function proc_desura(c) {
  304. var e = JSON.parse(c);
  305. var a = [];
  306. if (e && e.success) {
  307. var f = e.games;
  308. if (f) {
  309. for (var b = 0; b < f.length; ++b) {
  310. var d = f[b];
  311. a.push("/games/" + d[2])
  312. }
  313. }
  314. }
  315. show_status("#desura", a.length);
  316. if (a.length < 1) {
  317. jQuery("#desura_after strong").html('<a target="_blank" href="http://www.desura.com/collection">请检查是否已经登录(不可用)</a>')
  318. } else {
  319. localStorage.desura = JSON.stringify(a)
  320. }
  321. flag_desura = true;
  322. checkFinish()
  323. }
  324. function proc_test(a) {
  325. console.log(a)
  326. }
  327. function need_login() {
  328. jQuery("#progress").slideUp();
  329. jQuery("#needLogin").slideDown();
  330. //ga("send", "event", "sync", "need login")
  331. }
  332. function need_public() {
  333. jQuery("#progress").slideUp();
  334. jQuery("#needPublic").slideDown();
  335. jQuery("#clickPublic").click(function () {
  336. jQuery(this).removeClass("btn-danger").addClass("btn-inverse").text("已经设置好了?点这里刷新").unbind("click").click(function () {
  337. location.reload();
  338. return false
  339. })
  340. });
  341. //ga("send", "event", "sync", "need public")
  342. }
  343.  
  344.  
  345.  
  346. //Script Injection
  347. function exec(fn) {
  348. var script = document.createElement('script');
  349. script.setAttribute("type", "application/javascript");
  350. script.textContent = fn;
  351. document.body.appendChild(script);
  352. document.body.removeChild(script);
  353. }
  354.  
  355. //Load url and call proc function
  356. function load(url, id){
  357. GM_xmlhttpRequest({
  358. method: "GET",
  359. url: url,
  360. onload: function(response) {
  361. // console.log(response.responseText)
  362. //exec('proc_'+id+'("'+addslashes(response.responseText)+'")');
  363. if (id=='own') {
  364. proc_own(addslashes(response.responseText))
  365. }
  366. else if (id == 'userdata') {
  367. proc_userdata(response.responseText)
  368. }
  369. }
  370. });
  371. }
  372.  
  373. function sync() {
  374. load('http://steamcommunity.com/my/games?tab=all', 'own');
  375. load('http://store.steampowered.com/dynamicstore/userdata/?random='+Math.random(), 'userdata');
  376. }
  377.  
  378. //Add slashes to string
  379. function addslashes(string) {
  380. return string.replace(/\\/g, '\\\\').
  381. replace(/\u0008/g, '\\b').
  382. replace(/\t/g, '\\t').
  383. replace(/\n/g, '\\n').
  384. replace(/\f/g, '\\f').
  385. replace(/\r/g, '\\r').
  386. replace(/'/g, '\\\'').
  387. replace(/"/g, '\\"');
  388. }
  389.  
  390.  
  391.  
  392. (function (c) {
  393. var o = 300;
  394. var f = 1;
  395. var e = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch;
  396. if (e) {
  397. console.log("This is a device with touch support.")
  398. }
  399. function a(w) {
  400. var v = jQuery(w);
  401. var u = v.prev();
  402. u.removeClass("touched");
  403. v.stop().clearQueue().fadeOut(o)
  404. }
  405.  
  406. function t(v) {
  407. var w = v.height();
  408. var D = v.prev();
  409. var E = D.position().left + D.outerWidth();
  410. var C = D.position().top - 5;
  411. var z = D.offsetParent().offset();
  412. var B = jQuery(window).scrollLeft() + jQuery(window).width() - z.left;
  413. var A = jQuery(window).scrollTop() - z.top;
  414. var u = A + jQuery(window).height();
  415. if (B - E < 320) {
  416. E = B - 320;
  417. C = D.position().top + D.outerHeight()
  418. }
  419. if (u - C < w) {
  420. C = u - w
  421. }
  422. C = C < A + 16 ? A + 16 : C;
  423. v.css("left", E).css("top", C)
  424. }
  425.  
  426. function m(w) {
  427. var u = null;
  428. var x;
  429. if (x = w.match(/\/store\.steampowered\.com\/((sub|app)\/\d+)/)) {
  430. u = x[1]
  431. } else {
  432. if (x = w.match(/\/steamcommunity\.com\/((sub|app)\/\d+)/)) {
  433. u = x[1]
  434. }
  435. }
  436. if (!u) {
  437. var z = null;
  438. if (x = w.match(/\/www\.steamgifts\.com\/giveaway\/\w{5}\/([a-z0-9-]+)/)) {
  439. z = x[1]
  440. } else {
  441. if (x = w.match(/www\.gamersgate\.(?:com|co\.uk)\/[A-Z0-9-]+\/([a-z0-9-]+?)(-([2-4]|two|three|four)-pack-bundle)?(\/|$)/)) {
  442. z = x[1]
  443. } else {
  444. if (x = w.match(/www\.greenmangaming\.com\/.*\/games\/.+?\/([a-z0-9-]+?)(-([2-4]|two|three|four)-pack)?(\/|$)/)) {
  445. z = x[1]
  446. } else {
  447. if (x = w.match(/getgamesgo\.com\/product\/([a-z0-9-]+?)(-steam|-mac|-mac-steam)?(\/|$)/)) {
  448. z = x[1]
  449. } else {
  450. if (x = w.match(/www\.macgamestore\.com\/product\/\d+\/([\-\w]+?)(\/|$)/)) {
  451. z = x[1]
  452. } else {
  453. if (x = w.match(/www\.game\.co\.uk\/\w+\/([\-\w]+?)-\d+(\/|$)/)) {
  454. z = x[1]
  455. } else {
  456. if (x = w.match(/store.indiegala.com\/.*\/([a-z0-9-]+?)(-([2-4]|two|three|four)-pack-bundle)?\.html/)) {
  457. z = x[1]
  458. }
  459. }
  460. }
  461. }
  462. }
  463. }
  464. }
  465. if (z) {
  466. u = "guess/" + z
  467. }
  468. }
  469. if (!u) {
  470. var v = /(www\.amazon\.com)\/(gp\/product|dp)\/([A-Z0-9]+)/;
  471. var x = v.exec(w);
  472. if (x != null) {
  473. var y = x[1];
  474. var A = x[3];
  475. u = "amazon/" + y + "/dp/" + A
  476. }
  477. }
  478. if (!u) {
  479. var x = w.match(/(store\.sonkwo\.com\/node|www\.sonkwo\.com\/products)\/(\d+)/);
  480. if (x != null) {
  481. var A = x[2];
  482. u = "sonkwo/" + A
  483. }
  484. }
  485. return u
  486. }
  487.  
  488. var i = 0;
  489.  
  490. function r(x) {
  491. var B = jQuery(x);
  492. if (B.data("_infoAdded")) {
  493. return false
  494. }
  495. B.data("_infoAdded", true);
  496. var v = B[0].href;
  497. var E = m(v);
  498. if (!E) {
  499. return false
  500. }
  501. var z = false;
  502. var C = E;
  503. var D = "";
  504. var u;
  505. if (B.next().hasClass("steamInfoWrapper")) {
  506. D = B.next().attr("id")
  507. } else {
  508. ++i;
  509. D = "steam_info_" + C.replace(/[\/.]/g, "_") + "_" + i;
  510. u = jQuery('<div style="display:none" class="steamInfoWrapper"><div class="png_loading"></div><iframe frameBorder="0" allowtransparency="true">Loading</iframe></div>');
  511. u.attr("id", D);
  512. u.find("iframe").attr("src", c + "/tooltip#" + C + "#" + D);
  513. B.after(u);
  514. z = true
  515. }
  516. var A = "#" + D;
  517. u = jQuery(A);
  518. var w = null;
  519.  
  520. function y() {
  521. jQuery(".steamInfoWrapper:not(" + A + ")").stop().clearQueue().hide().css("opacity", "1");
  522. clearTimeout(w);
  523. u.find("iframe")[0].contentWindow.postMessage("show", "*");
  524. t(u);
  525. u.fadeIn(o)
  526. }
  527.  
  528. B.bind("mousemove", function () {
  529. y()
  530. });
  531. B.bind("click", function () {
  532. if (e) {
  533. if (B.hasClass("touched")) {
  534. return true
  535. } else {
  536. jQuery("a.touched").removeClass("touched");
  537. B.addClass("touched");
  538. return false
  539. }
  540. }
  541. return true
  542. });
  543. B.mouseout(function () {
  544. w = setTimeout(function () {
  545. a(A)
  546. }, 500)
  547. });
  548. u.hover(function () {
  549. if (w) {
  550. clearTimeout(w);
  551. w = null
  552. } else {
  553. w = setTimeout(function () {
  554. a(A)
  555. }, 500)
  556. }
  557. });
  558. return z
  559. }
  560.  
  561. var l = 0;
  562.  
  563. function h() {
  564. if (jQuery("#steamInfoGetOwnAndWish").length == 0) {
  565. jQuery('<iframe style="display:none" id="steamInfoGetOwnAndWish" src="' + c + '/tooltip" />').appendTo("body")
  566. }
  567. }
  568.  
  569. var p = [];
  570. var q = [];
  571. var k = [];
  572. var b = [];
  573. if (localStorage.getItem("own") != null) {
  574. p = eval(localStorage.getItem("own"))
  575. }
  576. if (localStorage.getItem("wish") != null) {
  577. q = eval(localStorage.getItem("wish"))
  578. }
  579.  
  580. function s() {
  581. jQuery("a").each(function () {
  582. var x = jQuery(this);
  583. var u = String(x.attr("href"));
  584. var v;
  585. if (v = u.match(/\/(store\.steampowered|steamcommunity)\.com\/(app|sub)\/(\d+)/)) {
  586. //console.log(x);
  587. //console.log(u);
  588. var w = v[2];
  589. //console.log(localStorage.valueOf())
  590. // console.log(p)
  591. var y = parseInt(v[3]);
  592. if (w == "app") {
  593. if (p.indexOf(y) !== -1) {
  594. x.addClass("linkOwn")
  595.  
  596.  
  597. } else {
  598. if (q.indexOf(y) !== -1) {
  599. x.addClass("linkWish")
  600. }
  601. }
  602. } else {
  603. if (w == "sub") {
  604. if (k.indexOf(y) !== -1) {
  605. x.addClass("linkOwn")
  606. }
  607. }
  608. }
  609.  
  610.  
  611.  
  612. }
  613.  
  614. if (x.data("_hoverAdded")) {
  615. return
  616. }
  617. x.data("_hoverAdded", true);
  618. if (!m(u)) {
  619. return
  620. }
  621. x.hover(function () {
  622. r(this);
  623. if (!x.hasClass("loaded")) {
  624. n(f, x)
  625. }
  626. x.addClass("loaded")
  627. })
  628. });
  629. l += 1000;
  630. setTimeout(function () {
  631. s()
  632. }, l)
  633. }
  634.  
  635. var d = 0;
  636.  
  637. function j(w) {
  638. var v = jQuery(w);
  639. if (v.data("_preChecked")) {
  640. return
  641. }
  642. v.data("_preChecked", true);
  643. var u = String(v.attr("href"));
  644. if (!m(u)) {
  645. return
  646. }
  647. if (r(w)) {
  648. --d
  649. }
  650. }
  651.  
  652. function n(w, x) {
  653. d = w;
  654. var u = jQuery("a");
  655. if (x) {
  656. x = u.index(x);
  657. for (var v = x; v < u.length; ++v) {
  658. j(u[v]);
  659. if (d <= 0) {
  660. return false
  661. }
  662. }
  663. }
  664. u.each(function () {
  665. j(this);
  666. if (d <= 0) {
  667. return false
  668. }
  669. })
  670. }
  671.  
  672. jQuery("head").prepend('<link rel="stylesheet" href="' + c + '/assets/css/steam_info.css" type="text/css" />');
  673. jQuery(function () {
  674. s();
  675. n(f);
  676. if (d > 0) {
  677. h()
  678. }
  679. });
  680. function g(w) {
  681. if (w.data.sub) {
  682. k = JSON.parse(w.data.sub)
  683. } else {
  684. if (w.data.own || w.data.wish) {
  685. p = JSON.parse(w.data.own);
  686. q = JSON.parse(w.data.wish);
  687. jQuery(".steam_info_trigger_text").each(function () {
  688. var A = jQuery(this);
  689. var y = String(A.data("href"));
  690. var z;
  691. if (z = y.match(/\/(store\.steampowered|steamcommunity)\.com\/app\/(\d+)/)) {
  692. var B = parseInt(z[2]);
  693. if (p.indexOf(B) !== -1) {
  694. A.addClass("steam_info_own")
  695. } else {
  696. if (q.indexOf(B) !== -1) {
  697. A.addClass("steam_info_wish")
  698. }
  699. }
  700. }
  701. })
  702. } else {
  703. if (w.data.desura) {
  704. b = JSON.parse(w.data.desura);
  705. jQuery('a[href^="http://www.desura.com/games/"]').each(function () {
  706. var B = jQuery(this);
  707.  
  708. B.addClass("linkDesura");
  709. var y = String(B.attr("href"));
  710. var A;
  711. if (A = y.match(/\/\/www\.desura\.com(\/[^\/]*\/[^\/#?]*)/)) {
  712. var z = A[1];
  713. z = z.toLowerCase();
  714. if (b.indexOf(z) !== -1) {
  715. B.addClass("linkOwn")
  716. }
  717. }
  718. })
  719. } else {
  720. var u = w.data.height;
  721. var x = w.data.src;
  722. var v = jQuery('iframe[src="' + x + '"]').closest("div");
  723. v.height(u + 1);
  724. t(v)
  725. }
  726. }
  727. }
  728. }
  729.  
  730. window.addEventListener("message", g, false)
  731. })("http://steamdb.sinaapp.com");
  732.  
  733.  
  734.  
  735.  
  736.  

QingJ © 2025

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