Ogame Alt Statistic

Ogame Alternative Statistic

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

  1. // ==UserScript==
  2. // @name Ogame Alt Statistic
  3. // @description Ogame Alternative Statistic
  4. // @include http://*.ogame.gameforge.com/game/index.php?*
  5. // @exclude http://board.ogame.*
  6. // @version 0.5
  7. // @author IgorZ
  8. // @namespace https://greasyfork.org/users/14097
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. //1000*60*30 = 30 min.
  13. //Timeout between getting stats from the cache and loading it from XML source
  14. var TIMEOUT = 1000 * 60 * 30;
  15. var INACTIVE_PLAYER_TIMEOUT = 1000 * 60 * 60 * 3;
  16. //Players that have less points than MIN_POINTS_FILTER will not be shown on the stats page
  17. var MIN_POINTS_FILTER = 1000;
  18.  
  19. //Adding 'Alt' href in the 'Bar' section
  20. if (document.getElementById('bar')) {
  21. var item = document.createElement('a');
  22. item.setAttribute("href", "javascript:void(0);");
  23. item.setAttribute("id", "alt");
  24. item.innerHTML = 'Alt';
  25. var mas = [];
  26. $('#bar').find('li').each(function () {
  27. mas.push($(this));
  28. });
  29. mas[3].append(item);
  30. }
  31.  
  32. $('#alt').click(function () {
  33. $("#inhalt").html("");
  34. var result = "";
  35. result += '<div id="highscoreContent" class="contentbox">';
  36. result += '<div class="header"><h2>Alt statistics (XML api)</h2></div>';
  37. result += '<div class="content">';
  38. result += '<div id="row">';
  39.  
  40. result += '<div class="buttons" id="categoryButtons" style="display:inline; float:left; height:54px; margin:6px 0 0 7px; padding:0; width:320px;">';
  41.  
  42. result += '<a id="points" class="navButton active" href="javascript:void(0);" rel="1">';
  43. result += '<img src="http://gf2.geo.gfsrv.net/cdndf/3e567d6f16d040326c7a0ea29a4f41.gif" height="54" width="54">';
  44. result += '<span class="marker"></span><span class="textlabel">Очки</span></a>';
  45.  
  46. result += '<a id="fleet" class="navButton" href="javascript:void(0);" rel="2">';
  47. result += '<img src="http://gf2.geo.gfsrv.net/cdndf/3e567d6f16d040326c7a0ea29a4f41.gif" height="54" width="54">';
  48. result += '<span class="marker"></span><span class="textlabel">Вооружение</span></a>';
  49. result += '<a id="economy" class="navButton" href="javascript:void(0);" rel="3">';
  50. result += '<img src="http://gf2.geo.gfsrv.net/cdndf/3e567d6f16d040326c7a0ea29a4f41.gif" height="54" width="54">';
  51. result += '<span class="marker"></span><span class="textlabel">(I)</span></a>';
  52. result += '<div id="i">';
  53. result += '<a id="economy" class="navButton" href="javascript:void(0);" rel="4">';
  54. result += '<img src="http://gf2.geo.gfsrv.net/cdndf/3e567d6f16d040326c7a0ea29a4f41.gif" height="54" width="54">';
  55. result += '<span class="marker"></span><span class="textlabel">(i)</span></a></div>';
  56.  
  57. result += '</div>';
  58. result += '';
  59.  
  60. result += '</div>';
  61. result += '<div class="" id="stat_list_content"></div>';
  62.  
  63. $("#inhalt").append(result);
  64.  
  65. bindButtons();
  66. $('#points').click();
  67. });
  68.  
  69. var result = "";
  70.  
  71. //Forming the table header
  72. function formTable() {
  73. result += '<table id="ranks" class="userHighscore">';
  74. result += '<thead>';
  75. result += '<tr>';
  76. result += '<td class="position">Позиция</td>';
  77. result += '<td class="name">Имя игрока (Очки чести)</td>';
  78. result += '<td class="score" align="center">Очки</td>';
  79. result += '</tr>';
  80. result += '</thead>';
  81. result += '<tbody>';
  82. }
  83.  
  84. //Splitting digits with a dot. Ex: 111222 -> 111.222
  85. function niceNumber(x) {
  86. var parts = x.toString().split(".");
  87. parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
  88. return parts.join(".");
  89. }
  90.  
  91. //Appending new rows to the result string
  92. function appendRows(param) {
  93. var position = param[0];
  94. var alliance = param[1];
  95. var player = param[2];
  96. var honor = param[3];
  97. var score = param[4];
  98. var honor_position = param[5];
  99. var size = param[6];
  100. var status = param[7];
  101. var myName = getMyName();
  102.  
  103. result += '<tbody>';
  104. if (player == myName) {
  105. result += '<tr class="myrank">';
  106. } else {
  107. result += '<tr class="">';
  108. }
  109. result += '<td class="position">' + position + '</td>';
  110. //====================honorRank=================================================================================
  111. //console.log("player: " + player + ", honor: " + honor + ", honor_position: " + honor_position);
  112. result += '<td class="name">';
  113. if ((honor_position <= 10) && (honor >= 150000)) {
  114. result += '<span class="honorRank rank_starlord1">&nbsp;</span>';
  115. } else if (honor_position <= 100 && (honor >= 2500)) {
  116. result += '<span class="honorRank rank_starlord2">&nbsp;</span>';
  117. } else if ((honor_position <= 250) && (honor >= 250)) {
  118. result += '<span class="honorRank rank_starlord3">&nbsp;</span>';
  119.  
  120. } else if ((honor_position >= size - 10) && (honor <= -15000)) {
  121. result += '<span class="honorRank rank_bandit1">&nbsp;</span>';
  122. } else if ((honor_position >= size - 100) && (honor <= -2500)) {
  123. result += '<span class="honorRank rank_bandit2">&nbsp;</span>';
  124. } else if ((honor_position >= size - 250) && (honor <= -500)) {
  125. result += '<span class="honorRank rank_bandit3">&nbsp;</span>';
  126. }
  127. //==============================================================================================================
  128. if (alliance != null) {
  129. result += '<span class="ally-tag"><a href="javascript:void(0);" target="_ally">[' + alliance + ']</a></span>';
  130. }
  131. //====================Name + Status=============================================================================
  132. if (status == null) {
  133. result += '&nbsp;<span class="status_abbr_honorableTarget playername">' + player + '</span>';
  134. } else if (status == "I") {
  135. result += '&nbsp;<span class="playername">' + player + ' (I)</span>';
  136. } else if (status == "i") {
  137. result += '&nbsp;<span class="playername">' + player + ' (i)</span>';
  138. } else if ((status == "v") || (status == "vi") || (status == "vI")) {
  139. result += '&nbsp;<span class="playername" style="color: cyan;">' + player + '</span>';
  140. } else if ((status == "vb") || (status == "vib") || (status == "vIb")) {
  141. result += '&nbsp;<span class="playername" style="text-decoration: line-through;">' + player + '</span>';
  142. } else if (status == "a") {
  143. result += '&nbsp;<span class="playername" style="color: #F48406;">' + player + '</span>';
  144. }
  145. //==============================================================================================================
  146. if (honor >= 0) {
  147. result += '<span class="honorScore">&nbsp;(<span class="undermark">' + niceNumber(honor) + '</span>)</span></td>';
  148. } else {
  149. result += '<span class="honorScore">&nbsp;(<span class="overmark">' + niceNumber(honor) + '</span>)</span></td>';
  150. }
  151. result += '<td class="score">' + niceNumber(score) + '</td>';
  152. result += '</tr>';
  153. }
  154. function getMyName() {
  155. var name = $('.textBeefy').html();
  156. name = $.trim(name);
  157. return name;
  158. }
  159.  
  160. //Time formatter
  161. function formatTime(time) {
  162. var date = new Date(time * 1000);
  163. var hours = date.getHours();
  164. var minutes = "0" + date.getMinutes();
  165. var seconds = "0" + date.getSeconds();
  166. return hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
  167. }
  168.  
  169. //XML loader
  170. function getHighscoreXML() {
  171. var ogame_url = window.location.origin;
  172. ogame_url += "/api/highscore.xml?category=1&type=0";
  173. return $.ajax({
  174. type: "GET",
  175. url: ogame_url,
  176. dataType: "xml"
  177. });
  178. }
  179.  
  180. //XML loader
  181. function getMilitaryXML() {
  182. var ogame_url = window.location.origin;
  183. ogame_url += "/api/highscore.xml?category=1&type=3";
  184. return $.ajax({
  185. type: "GET",
  186. url: ogame_url,
  187. dataType: "xml"
  188. });
  189. }
  190.  
  191. //XML loader
  192. function getPlayersXML() {
  193. var ogame_url = window.location.origin;
  194. ogame_url += "/api/players.xml";
  195. return $.ajax({
  196. type: "GET",
  197. url: ogame_url,
  198. dataType: "xml"
  199. });
  200. }
  201.  
  202. //XML loader
  203. function getAlliancesXML() {
  204. var ogame_url = window.location.origin;
  205. ogame_url += "/api/alliances.xml";
  206. return $.ajax({
  207. type: "GET",
  208. url: ogame_url,
  209. dataType: "xml"
  210. });
  211. }
  212.  
  213. //XML loader
  214. function getHonorXML() {
  215. var ogame_url = window.location.origin;
  216. ogame_url += "/api/highscore.xml?category=1&type=7";
  217. return $.ajax({
  218. type: "GET",
  219. url: ogame_url,
  220. dataType: "xml"
  221. });
  222. }
  223. //XML loader
  224. function getUniverseXML() {
  225. var ogame_url = window.location.origin;
  226. ogame_url += "/api/universe.xml";
  227. return $.ajax({
  228. type: "GET",
  229. url: ogame_url,
  230. dataType: "xml"
  231. });
  232. }
  233. //Players XML parser
  234. function parseXML_Players(args) {
  235. console.log("[ Parsing new XML Players ]");
  236. formTable();
  237. var highscoreXML = args[0];
  238. var playersXML = args[1];
  239. var alliancesXML = args[2];
  240. var honorXML = args[3];
  241. // var uniXML = args[4];
  242. var size = 0;
  243. $(honorXML).find('player').each(function () {
  244. size++;
  245. });
  246. var timestamp;
  247. $(playersXML).find('players').each(function () {
  248. timestamp = $(this).attr('timestamp');
  249. console.log("[ Players XML Timestamp: " + formatTime(timestamp) + " ]");
  250. });
  251. $(highscoreXML).find('highscore').each(function () {
  252. timestamp = $(this).attr('timestamp');
  253. console.log("[ Highscore XML Timestamp: " + formatTime(timestamp) + " ]");
  254. });
  255. $(highscoreXML).find('player').each(function () {
  256. var id = $(this).attr('id');
  257. var name;
  258. var alliance_id;
  259. var status;
  260. var position = $(this).attr('position');
  261. var score = $(this).attr('score');
  262. $(playersXML).find('player[id=' + id + ']').each(function () {
  263. name = $(this).attr('name');
  264. alliance_id = $(this).attr('alliance');
  265. status = $(this).attr('status');
  266. });
  267. var alliance;
  268. $(alliancesXML).find('alliance[id=' + alliance_id + ']').each(function () {
  269. alliance = $(this).attr('tag');
  270. });
  271. // var coords;
  272. // $(uniXML).find('planet[player=' + id + ']').each(function () {
  273. // coords = $(this).attr('coords');
  274. // return false;
  275. // });
  276. var honor;
  277. var honor_position;
  278. $(honorXML).find('player[id=' + id + ']').each(function () {
  279. honor = $(this).attr('score');
  280. honor_position = $(this).attr('position');
  281. });
  282. if (alliance != null) {
  283. var player = position + " - " + "[" + alliance + "]" + name + "(" + honor + ")" + " - " + score;
  284. } else {
  285. var player = position + " - " + name + "(" + honor + ")" + " - " + score;
  286. }
  287. var params = [position, alliance, name, honor, score, honor_position, size, status];
  288. if (score >= MIN_POINTS_FILTER) {
  289. appendRows(params);
  290. }
  291. });
  292. var url_split = window.location.origin.split('.');
  293. var ls = "ALT_Ogame_Statistic_Players_" + url_split[0];
  294. localStorage[ls] = result;
  295. $("#stat_list_content").append(result);
  296. }
  297.  
  298.  
  299. //Military XML parser
  300. function parseXML_Military(args) {
  301. console.log("[ Parsing new XML Military ]");
  302. formTable();
  303. var militaryXML = args[0];
  304. var playersXML = args[1];
  305. var alliancesXML = args[2];
  306. var honorXML = args[3];
  307. var size = 0;
  308. $(honorXML).find('player').each(function () {
  309. size++;
  310. });
  311. var timestamp;
  312. $(playersXML).find('players').each(function () {
  313. timestamp = $(this).attr('timestamp');
  314. console.log("[ Players XML Timestamp: " + formatTime(timestamp) + " ]");
  315. });
  316. $(militaryXML).find('highscore').each(function () {
  317. timestamp = $(this).attr('timestamp');
  318. console.log("[ Military XML Timestamp: " + formatTime(timestamp) + " ]");
  319. });
  320. $(militaryXML).find('player').each(function () {
  321. var id = $(this).attr('id');
  322. var name;
  323. var alliance_id;
  324. var status;
  325. var position = $(this).attr('position');
  326. var score = $(this).attr('score');
  327. $(playersXML).find('player[id=' + id + ']').each(function () {
  328. name = $(this).attr('name');
  329. alliance_id = $(this).attr('alliance');
  330. status = $(this).attr('status');
  331. });
  332. var alliance;
  333. $(alliancesXML).find('alliance[id=' + alliance_id + ']').each(function () {
  334. alliance = $(this).attr('tag');
  335. });
  336. var honor;
  337. var honor_position;
  338. $(honorXML).find('player[id=' + id + ']').each(function () {
  339. honor = $(this).attr('score');
  340. honor_position = $(this).attr('position');
  341. });
  342.  
  343. if (alliance != null) {
  344. var player = position + " - " + "[" + alliance + "]" + name + "(" + honor + ")" + " - " + score;
  345. } else {
  346. var player = position + " - " + name + "(" + honor + ")" + " - " + score;
  347. }
  348. var params = [position, alliance, name, honor, score, honor_position, size, status];
  349.  
  350. if (score >= MIN_POINTS_FILTER) {
  351. appendRows(params);
  352. }
  353. });
  354. var url_split = window.location.origin.split('.');
  355. var ls = "ALT_Ogame_Statistic_Military_" + url_split[0];
  356. localStorage[ls] = result;
  357. $("#stat_list_content").append(result);
  358. }
  359. //Inactives XML parser
  360. function parseXML_Inactive(args, scan_I) {
  361. console.log("[ Parsing new XML Inactives ]");
  362. formTable();
  363. var highscoreXML = args[0];
  364. var playersXML = args[1];
  365. var alliancesXML = args[2];
  366. var honorXML = args[3];
  367. var size = 0;
  368. $(honorXML).find('player').each(function () {
  369. size++;
  370. });
  371. var timestamp;
  372. $(playersXML).find('players').each(function () {
  373. timestamp = $(this).attr('timestamp');
  374. console.log("[ Inactives XML Timestamp: " + formatTime(timestamp) + " ]");
  375. });
  376. $(highscoreXML).find('highscore').each(function () {
  377. timestamp = $(this).attr('timestamp');
  378. console.log("[ Highscore XML Timestamp: " + formatTime(timestamp) + " ]");
  379. });
  380. $(highscoreXML).find('player').each(function () {
  381. var id = $(this).attr('id');
  382. var name;
  383. var alliance_id;
  384. var status;
  385. var position = $(this).attr('position');
  386. var score = $(this).attr('score');
  387. $(playersXML).find('player[id=' + id + ']').each(function () {
  388. name = $(this).attr('name');
  389. alliance_id = $(this).attr('alliance');
  390. status = $(this).attr('status');
  391. });
  392. var alliance;
  393. $(alliancesXML).find('alliance[id=' + alliance_id + ']').each(function () {
  394. alliance = $(this).attr('tag');
  395. });
  396. var honor;
  397. var honor_position;
  398. $(honorXML).find('player[id=' + id + ']').each(function () {
  399. honor = $(this).attr('score');
  400. honor_position = $(this).attr('position');
  401. });
  402. if (alliance != null) {
  403. var player = position + " - " + "[" + alliance + "]" + name + "(" + honor + ")" + " - " + score;
  404. } else {
  405. var player = position + " - " + name + "(" + honor + ")" + " - " + score;
  406. }
  407. var params_I = [position, alliance, name, honor, score, honor_position, size, status];
  408. var params_i = [position, alliance, name, honor, score, honor_position, size, status];
  409. if ((score >= MIN_POINTS_FILTER) && (status == "I") && (scan_I)) {
  410. appendRows(params_I);
  411. } else if ((score >= MIN_POINTS_FILTER) && (status == "i") && (!scan_I)) {
  412. appendRows(params_i);
  413. }
  414. });
  415. var url_split = window.location.origin.split('.');
  416. var lsi = "ALT_Ogame_Statistic_i_" + url_split[0];
  417. var lsI = "ALT_Ogame_Statistic_I_" + url_split[0];
  418. if (scan_I) {
  419. localStorage[lsI] = result;
  420. } else {
  421. localStorage[lsi] = result;
  422. }
  423. $("#stat_list_content").append(result);
  424. }
  425.  
  426.  
  427. //Time logger
  428. function getTimeTillNextUpdate(timestamp, timeout) {
  429. var time_left_min = timeout - (new Date().getTime() - parseInt(timestamp));
  430. var time_left_sec = Math.round(time_left_min / 1000);
  431. time_left_min = Math.round(time_left_min / 1000 / 60);
  432. console.log("[!] Next XML update is in: " + time_left_min + " min. (" + time_left_sec + " sec.)");
  433. }
  434.  
  435. //###################################################################################################################
  436. function bindButtons() {
  437.  
  438. //JS Points button binding
  439. $('#points').click(function () {
  440. var currentTime_pl = new Date().getTime();
  441. if (localStorage["ALT_TimeStamp_Players"] == null) {
  442. console.log("[ No 'ALT_TimeStamp_Players' was found. Setting new 'ALT_TimeStamp_Players' ]");
  443. localStorage["ALT_TimeStamp_Players"] = currentTime_pl;
  444. }
  445. $('#points').addClass("active");
  446. $('#fleet').removeClass("active");
  447. $('#economy').removeClass("active");
  448. $('#i > #economy').removeClass("active");
  449. $("#stat_list_content").html("");
  450. var url_split = window.location.origin.split('.');
  451. var ls = "ALT_Ogame_Statistic_Players_" + url_split[0];
  452. console.log("[ Time diff (players): " + (TIMEOUT + parseInt(localStorage["ALT_TimeStamp_Players"]) - currentTime_pl) + " ]");
  453. if ((currentTime_pl > (TIMEOUT + parseInt(localStorage["ALT_TimeStamp_Players"]))) || (localStorage[ls] == null)) {
  454. localStorage["ALT_TimeStamp_Players"] = currentTime_pl;
  455. $.when(getHighscoreXML(), getPlayersXML(), getAlliancesXML(), getHonorXML()).done(function (a0, a1, a2, a3) {
  456. $("#stat_list_content").html("");
  457. result = "";
  458. var f = [];
  459. f[0] = a0;
  460. f[1] = a1;
  461. f[2] = a2;
  462. f[3] = a3;
  463. parseXML_Players(f);
  464. });
  465. } else {
  466. console.log("[ Getting XML Players from cache ]");
  467. $("#stat_list_content").html("");
  468. result = localStorage[ls];
  469. $("#stat_list_content").append(result);
  470. getTimeTillNextUpdate(localStorage["ALT_TimeStamp_Players"], TIMEOUT);
  471. }
  472. });
  473.  
  474.  
  475. //JS Military button binding
  476. $('#fleet').click(function () {
  477. var currentTime_mil = new Date().getTime();
  478. if (localStorage["ALT_TimeStamp_Military"] == null) {
  479. console.log("[ No 'ALT_TimeStamp_Military' was found. Setting new 'ALT_TimeStamp_Military' ]");
  480. localStorage["ALT_TimeStamp_Military"] = currentTime_mil;
  481. }
  482. $('#fleet').addClass("active");
  483. $('#points').removeClass("active");
  484. $('#economy').removeClass("active");
  485. $('#i > #economy').removeClass("active");
  486. $("#stat_list_content").html("");
  487. var url_split = window.location.origin.split('.');
  488. var ls = "ALT_Ogame_Statistic_Military_" + url_split[0];
  489. console.log("[ Time diff (military): " + (TIMEOUT + parseInt(localStorage["ALT_TimeStamp_Military"]) - currentTime_mil) + " ]");
  490. if ((currentTime_mil > (TIMEOUT + parseInt(localStorage["ALT_TimeStamp_Military"]))) || (localStorage[ls] == null)) {
  491. localStorage["ALT_TimeStamp_Military"] = currentTime_mil;
  492. $.when(getMilitaryXML(), getPlayersXML(), getAlliancesXML(), getHonorXML()).done(function (a0, a1, a2, a3) {
  493. $("#stat_list_content").html("");
  494. result = "";
  495. var f = [];
  496. f[0] = a0;
  497. f[1] = a1;
  498. f[2] = a2;
  499. f[3] = a3;
  500. parseXML_Military(f);
  501. });
  502. } else {
  503. console.log("[ Getting XML Military from cache ]");
  504. $("#stat_list_content").html("");
  505. result = localStorage[ls];
  506. $("#stat_list_content").append(result);
  507. getTimeTillNextUpdate(localStorage["ALT_TimeStamp_Military"], TIMEOUT);
  508. }
  509. });
  510. //JS Inactive (I) button binding
  511. $('#economy').click(function () {
  512. var currentTime_mil = new Date().getTime();
  513. if (localStorage["ALT_TimeStamp_I"] == null) {
  514. console.log("[ No 'ALT_TimeStamp_I' was found. Setting new 'ALT_TimeStamp_I' ]");
  515. localStorage["ALT_TimeStamp_I"] = currentTime_mil;
  516. }
  517. var url_split = window.location.origin.split('.');
  518. var ls = "ALT_Ogame_Statistic_I_" + url_split[0];
  519. $('#fleet').removeClass("active");
  520. $('#points').removeClass("active");
  521. $('#economy').addClass("active");
  522. $('#i > #economy').removeClass("active");
  523. $("#stat_list_content").html("");
  524. console.log("[ Time diff (inactive): " + (INACTIVE_PLAYER_TIMEOUT + parseInt(localStorage["ALT_TimeStamp_I"]) - currentTime_mil) + " ]");
  525. if ((currentTime_mil > (INACTIVE_PLAYER_TIMEOUT + parseInt(localStorage["ALT_TimeStamp_I"]))) || (localStorage[ls] == null)) {
  526. localStorage["ALT_TimeStamp_I"] = currentTime_mil;
  527. $.when(getHighscoreXML(), getPlayersXML(), getAlliancesXML(), getHonorXML()).done(function (a0, a1, a2, a3) {
  528. $("#stat_list_content").html("");
  529. result = "";
  530. var f = [];
  531. f[0] = a0;
  532. f[1] = a1;
  533. f[2] = a2;
  534. f[3] = a3;
  535. parseXML_Inactive(f, true);
  536. });
  537. } else {
  538. console.log("[ Getting XML Inactive (I) from cache ]");
  539. $("#stat_list_content").html("");
  540. result = localStorage[ls];
  541. $("#stat_list_content").append(result);
  542. getTimeTillNextUpdate(localStorage["ALT_TimeStamp_I"], INACTIVE_PLAYER_TIMEOUT);
  543. }
  544. });
  545. //JS Inactive (i) button binding
  546. $('#i > #economy').click(function () {
  547. var currentTime_mil = new Date().getTime();
  548. if (localStorage["ALT_TimeStamp_i"] == null) {
  549. console.log("[ No 'ALT_TimeStamp_i' was found. Setting new 'ALT_TimeStamp_i' ]");
  550. localStorage["ALT_TimeStamp_i"] = currentTime_mil;
  551. }
  552. var url_split = window.location.origin.split('.');
  553. var ls = "ALT_Ogame_Statistic_i_" + url_split[0];
  554. $('#fleet').removeClass("active");
  555. $('#points').removeClass("active");
  556. $('#economy').removeClass("active");
  557. $('#i > #economy').addClass("active");
  558. $("#stat_list_content").html("");
  559. console.log("[ Time diff (inactive): " + (INACTIVE_PLAYER_TIMEOUT + parseInt(localStorage["ALT_TimeStamp_i"]) - currentTime_mil) + " ]");
  560. if ((currentTime_mil > (INACTIVE_PLAYER_TIMEOUT + parseInt(localStorage["ALT_TimeStamp_i"]))) || (localStorage[ls] == null)) {
  561. localStorage["ALT_TimeStamp_i"] = currentTime_mil;
  562. $.when(getHighscoreXML(), getPlayersXML(), getAlliancesXML(), getHonorXML()).done(function (a0, a1, a2, a3) {
  563. $("#stat_list_content").html("");
  564. result = "";
  565. var f = [];
  566. f[0] = a0;
  567. f[1] = a1;
  568. f[2] = a2;
  569. f[3] = a3;
  570. parseXML_Inactive(f, false);
  571. });
  572. } else {
  573. console.log("[ Getting XML Inactive (i) from cache ]");
  574. $("#stat_list_content").html("");
  575. result = localStorage[ls];
  576. $("#stat_list_content").append(result);
  577. getTimeTillNextUpdate(localStorage["ALT_TimeStamp_i"], INACTIVE_PLAYER_TIMEOUT);
  578. }
  579. });
  580. }
  581.  
  582.  
  583. })();