Advertisement
Guest User

Untitled

a guest
May 5th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.52 KB | None | 0 0
  1. (function(a, c) {
  2. function r(a, d) {
  3. if (d) {
  4. var f = new Date;
  5. f.setTime(f.getTime() + 864E5 * d);
  6. f = "; expires=" + f.toGMTString()
  7. } else f = "";
  8. document.cookie = "agario_redirect=" + a + f + "; path=/"
  9. }
  10.  
  11. function N() {
  12. for (var a = document.cookie.split(";"), d = 0; d < a.length; d++) {
  13. for (var f = a[d];
  14. " " == f.charAt(0);) f = f.substring(1, f.length);
  15. if (0 == f.indexOf("agario_redirect=")) return f.substring(16, f.length)
  16. }
  17. return null
  18. }
  19.  
  20. function O() {
  21. c.get(P + "//gc.agar.io", function(a) {
  22. var d = a.split(" ");
  23. a = d[0];
  24. d = d[1] || "";
  25. q.hasOwnProperty(a) && ("string" == typeof q[a] ? MC.getRegion() || MC.setRegion(q[a]) : q[a].hasOwnProperty(d) && (MC.getRegion() || MC.setRegion(q[a][d])))
  26. }, "text")
  27. }
  28.  
  29. function Q() {
  30. a.onkeydown = function(b) {
  31. if (!y[b.keyCode]) switch (y[b.keyCode] = !0, b.keyCode) {
  32. case 32:
  33. a.core && a.core.split && a.core.split();
  34. b.preventDefault();
  35. break;
  36. case 87:
  37. a.core && a.core.eject && a.core.eject();
  38. break;
  39. case 81:
  40. a.core && a.core.specialOn && a.core.specialOn();
  41. break;
  42. case 27:
  43. b.preventDefault(), MC.showNickDialog(300), c("#oferwallContainer").is(":visible") && a.closeOfferwall(), c("#videoContainer").is(":visible") && a.closeVideoContainer()
  44. }
  45. };
  46. a.onkeyup = function(b) {
  47. y[b.keyCode] = !1;
  48. 81 == b.keyCode && a.specialOff && a.core.specialOff()
  49. }
  50. }
  51.  
  52. function B(b) {
  53. b.preventDefault();
  54. a.core && a.core.playerZoom && a.core.playerZoom(b.wheelDelta / -120 || b.detail || 0)
  55. }
  56.  
  57. function R() {
  58. e = t
  59. }
  60.  
  61. function C(a) {
  62. e.context = "google" == a ? "google" : "facebook";
  63. u()
  64. }
  65.  
  66. function u() {
  67. a.localStorage[n] = JSON.stringify(e);
  68. e = JSON.parse(a.localStorage[n]);
  69. a.storageInfo = e;
  70. "google" == e.context ? (c("#gPlusShare").show(), c("#fbShare").hide()) : (c("#gPlusShare").hide(), c("#fbShare").show())
  71. }
  72.  
  73. function D(b) {
  74. c("#helloContainer").attr("data-has-account-data");
  75. "" != b.displayName && (b.name = b.displayName);
  76. if (null == b.name || void 0 == b.name) b.name = "";
  77. var d = b.name.lastIndexOf("_"); - 1 != d && (b.name = b.name.substring(0, d));
  78. c("#helloContainer").attr("data-has-account-data", "1");
  79. c("#helloContainer").attr("data-logged-in", "1");
  80. c(".agario-profile-panel .progress-bar-star").text(b.level);
  81. c(".agario-exp-bar .progress-bar-text").text(b.xp + "/" + b.xpNeeded + " XP");
  82. c(".agario-exp-bar .progress-bar").css("width", (88 * b.xp / b.xpNeeded).toFixed(2) + "%");
  83. c(".agario-profile-name").text(b.name);
  84. "" != b.picture && c(".agario-profile-picture").attr("src", b.picture);
  85. e.userInfo.level = b.level;
  86. e.userInfo.xp = b.xp;
  87. e.userInfo.xpNeeded = b.xpNeeded;
  88. e.userInfo.displayName = b.name;
  89. e.userInfo.loggedIn = "1";
  90. a.updateStorage()
  91. }
  92.  
  93. function p(b, d) {
  94. var f = b;
  95. if (e.userInfo.loggedIn) {
  96. var v = c("#helloContainer").is(":visible") && "1" == c("#helloContainer").attr("data-has-account-data");
  97. if (null == f || void 0 == f) f = e.userInfo;
  98. if (v) {
  99. var l = +c(".agario-exp-bar .progress-bar-text").first().text().split("/")[0],
  100. v = +c(".agario-exp-bar .progress-bar-text").first().text().split("/")[1].split(" ")[0],
  101. k = c(".agario-profile-panel .progress-bar-star").first().text();
  102. if (k != f.level) p({
  103. xp: v,
  104. xpNeeded: v,
  105. level: k
  106. }, function() {
  107. c(".agario-profile-panel .progress-bar-star").text(f.level);
  108. c(".agario-exp-bar .progress-bar").css("width", "100%");
  109. c(".progress-bar-star").addClass("animated tada").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() {
  110. c(".progress-bar-star").removeClass("animated tada")
  111. });
  112. setTimeout(function() {
  113. c(".agario-exp-bar .progress-bar-text").text(f.xpNeeded + "/" + f.xpNeeded + " XP");
  114. p({
  115. xp: 0,
  116. xpNeeded: f.xpNeeded,
  117. level: f.level
  118. }, function() {
  119. p(f)
  120. })
  121. }, 1E3)
  122. });
  123. else {
  124. var g = Date.now(),
  125. m = function() {
  126. var b;
  127. b = (Date.now() - g) / 1E3;
  128. b = 0 > b ? 0 : 1 < b ? 1 : b;
  129. b = b * b * (3 - 2 * b);
  130. c(".agario-exp-bar .progress-bar-text").text(~~(l + (f.xp - l) * b) + "/" + f.xpNeeded + " XP");
  131. c(".agario-exp-bar .progress-bar").css("width", (88 * (l + (f.xp - l) * b) / f.xpNeeded).toFixed(2) + "%");
  132. d && d();
  133. 1 > b && a.requestAnimationFrame(m)
  134. };
  135. a.requestAnimationFrame(m)
  136. }
  137. }
  138. }
  139. }
  140.  
  141. function E() {
  142. function b() {
  143. null == a.FB ? alert("You seem to have something blocking Facebook on your browser, please check for any extensions") : (e.loginIntent = "1", a.updateStorage(), a.FB.login(function(a) {
  144. F(a)
  145. }, {
  146. scope: "public_profile, email"
  147. }))
  148. }
  149. 1 != G && 0 != z && 0 != H && (G = !0, ("1" == a.storageInfo.loginIntent && "facebook" == a.storageInfo.context || I) && a.FB.getLoginStatus(function(b) {
  150. "connected" === b.status ? F(b) : a.logout()
  151. }), a.facebookRelogin = b, a.facebookLogin = b)
  152. }
  153.  
  154. function F(b) {
  155. if ("connected" == b.status) {
  156. var d = b.authResponse.accessToken;
  157. null == d || "undefined" == d || "" == d ? (3 > J && (J++, a.facebookRelogin()), a.logout()) : (a.MC.doLoginWithFB(d), g.cache.login_info = [d, "facebook"], a.FB.api("/me/picture?width=180&height=180", function(d) {
  158. e.userInfo.picture = d.data.url;
  159. a.updateStorage();
  160. c(".agario-profile-picture").attr("src", d.data.url);
  161. e.userInfo.socialId = b.authResponse.userID;
  162. w()
  163. }), c("#helloContainer").attr("data-logged-in", "1"), e.context = "facebook", e.loginIntent = "1", a.updateStorage(), a.MC.showInstructionsPanel(!0))
  164. }
  165. }
  166.  
  167. function T(b) {
  168. var d = c(".stats-time-alive").text();
  169. return a.parseString(b, "%@", [d.split(":")[0], d.split(":")[1], c(".stats-highest-mass").text()])
  170. }
  171. var h = document.createElement("canvas");
  172. if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == h || null == h.getContext || null == a.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this");
  173. else {
  174. var z = !1,
  175. x = {};
  176. (function() {
  177. var b = a.location.search;
  178. "?" == b.charAt(0) && (b = b.slice(1));
  179. for (var b = b.split("&"), d = 0; d < b.length; d++) {
  180. var c = b[d].split("=");
  181. x[c[0]] = c[1]
  182. }
  183. })();
  184. a.queryString = x;
  185. var I = "fb" in x,
  186. h = "miniclip" in x,
  187. U = function() {
  188. r("", -1)
  189. },
  190. K = "http:" != a.location.protocol,
  191. V = "1" == N(),
  192. L = !1;
  193. I || h || (K && !V ? (r("1", 1), a.location.href = "http:" + a.location.href.substring(a.location.protocol.length), L = !0) : r("", -1));
  194. K || r("", -1);
  195. L || setTimeout(U, 3E3);
  196. if (!a.agarioNoInit) {
  197. var P = a.location.protocol,
  198. h = a.navigator.userAgent;
  199. if (-1 != h.indexOf("Android")) a.ga && a.ga("send", "event", "MobileRedirect", "PlayStore"), setTimeout(function() {
  200. a.location.href = "https://play.google.com/store/apps/details?id=com.miniclip.agar.io"
  201. }, 1E3);
  202. else if (-1 != h.indexOf("iPhone") || -1 != h.indexOf("iPad") || -1 != h.indexOf("iPod")) a.ga && a.ga("send", "event", "MobileRedirect", "AppStore"), setTimeout(function() {
  203. a.location.href = "https://itunes.apple.com/app/agar.io/id995999703?mt=8&at=1l3vajp"
  204. }, 1E3);
  205. else {
  206. var g = {};
  207. a.agarApp = g;
  208. (new Image).src = "/img/split.png";
  209. a.agarioInit = function() {
  210. z = !0;
  211. MC.wasInitialized();
  212. null != a.localStorage[n] && (e = JSON.parse(a.localStorage[n]));
  213. "1" == e.loginIntent && C(e.context);
  214. "" == e.userInfo.name && "" == e.userInfo.displayName || D(e.userInfo);
  215. E();
  216. g.a.b();
  217. O();
  218. MC.getLatestConfigurationID();
  219. g.core.init();
  220. MC.refreshRegionInfo();
  221. setInterval(MC.refreshRegionInfo, 18E4);
  222. /firefox/i.test(navigator.userAgent) ? document.addEventListener("DOMMouseScroll", B, !1) : document.body.onmousewheel = B;
  223. MC.getRegion() && c("#region").val(MC.getRegion());
  224. MC.checkRegion();
  225. MC.setRegion(c("#region").val());
  226. presetGameMode && MC.setGameMode(presetGameMode, !1);
  227. MC.reconnect();
  228. MC.showNickDialog(0);
  229. a.location.hash && 6 <= a.location.hash.length && MC.joinParty(a.location.hash);
  230. a.MC.setInGameState(!1)
  231. };
  232. a.setAcid = function() {};
  233. var y = {};
  234. a.addKeyListeners = Q;
  235. h = function(b) {
  236. var d = {},
  237. f = !1,
  238. e = {
  239. skipDraw: !0,
  240. predictionModifier: 1.1
  241. };
  242. b.init = function() {
  243. g.account.init();
  244. g.google.g();
  245. g.a.init();
  246. (f = "debug" in a.queryString) && g.debug.showDebug()
  247. };
  248. b.bind = function(a, b) {
  249. c(d).bind(a, b)
  250. };
  251. b.unbind = function(a, b) {
  252. c(d).unbind(a, b)
  253. };
  254. b.trigger = function(a, b) {
  255. c(d).trigger(a, b)
  256. };
  257. b.__defineGetter__("debug", function() {
  258. return f
  259. });
  260. b.__defineSetter__("debug", function(a) {
  261. return f = a
  262. });
  263. b.__defineGetter__("proxy", function() {
  264. return a.MC
  265. });
  266. b.__defineGetter__("config", function() {
  267. return e
  268. });
  269. return b
  270. }({});
  271. g.core = h;
  272. g.cache = {};
  273. h = function(a) {
  274. function d(a, b, d, f) {
  275. a = a + "Canvas";
  276. var e = c("<canvas>", {
  277. id: a
  278. });
  279. k.append(e);
  280. d = new SmoothieChart(d);
  281. for (e = 0; e < b.length; e++) {
  282. var l = b[e],
  283. m = _.extend(S, f[e]);
  284. d.addTimeSeries(l, m)
  285. }
  286. d.streamTo(document.getElementById(a), 0)
  287. }
  288.  
  289. function f(a, b) {
  290. m[a] = e();
  291. d(a, [m[a]], b, [{
  292. strokeStyle: "rgba(0, 255, 0, 1)",
  293. fillStyle: "rgba(0, 255, 0, 0.2)",
  294. lineWidth: 2
  295. }])
  296. }
  297.  
  298. function e() {
  299. return new TimeSeries({
  300. w: !1
  301. })
  302. }
  303. var l = !1,
  304. k, h = !1,
  305. m = {},
  306. S = {
  307. strokeStyle: "rgba(0, 255, 0, 1)",
  308. fillStyle: "rgba(0, 255, 0, 0.2)",
  309. lineWidth: 2
  310. };
  311. a.showDebug = function() {
  312. l || (k = c("#debug-overlay"), f("networkUpdate", {
  313. name: "network updates",
  314. minValue: 0,
  315. maxValue: 240
  316. }), m.rttSDev = e(), m.rttMean = e(), d("rttMean", [m.rttSDev, m.rttMean], {
  317. name: "rtt",
  318. minValue: 0,
  319. maxValue: 120
  320. }, [{
  321. strokeStyle: "rgba(255, 0, 0, 1)",
  322. fillStyle: "rgba(0, 255, 0, 0.2)",
  323. lineWidth: 2
  324. }, {
  325. strokeStyle: "rgba(0, 255, 0, 1)",
  326. fillStyle: "rgba(0, 255, 0, 0)",
  327. lineWidth: 2
  328. }]), f("fps", {
  329. name: "fps",
  330. minValue: 0,
  331. maxValue: 70
  332. }), l = !0);
  333. g.core.debug = !0;
  334. k.show()
  335. };
  336. a.hideDebug = function() {
  337. k.hide();
  338. g.core.debug = !1
  339. };
  340. a.updateChart = function(a, b, d) {
  341. l && a in m && m[a].append(b, d)
  342. };
  343. a.__defineGetter__("showPrediction", function() {
  344. return h
  345. });
  346. a.__defineSetter__("showPrediction", function(a) {
  347. return h = a
  348. });
  349. return a
  350. }({});
  351. g.debug = h;
  352. var q = {
  353. AF: "JP-Tokyo",
  354. AX: "EU-London",
  355. AL: "EU-London",
  356. DZ: "EU-London",
  357. AS: "SG-Singapore",
  358. AD: "EU-London",
  359. AO: "EU-London",
  360. AI: "US-Atlanta",
  361. AG: "US-Atlanta",
  362. AR: "BR-Brazil",
  363. AM: "JP-Tokyo",
  364. AW: "US-Atlanta",
  365. AU: "SG-Singapore",
  366. AT: "EU-London",
  367. AZ: "JP-Tokyo",
  368. BS: "US-Atlanta",
  369. BH: "JP-Tokyo",
  370. BD: "JP-Tokyo",
  371. BB: "US-Atlanta",
  372. BY: "EU-London",
  373. BE: "EU-London",
  374. BZ: "US-Atlanta",
  375. BJ: "EU-London",
  376. BM: "US-Atlanta",
  377. BT: "JP-Tokyo",
  378. BO: "BR-Brazil",
  379. BQ: "US-Atlanta",
  380. BA: "EU-London",
  381. BW: "EU-London",
  382. BR: "BR-Brazil",
  383. IO: "JP-Tokyo",
  384. VG: "US-Atlanta",
  385. BN: "JP-Tokyo",
  386. BG: "EU-London",
  387. BF: "EU-London",
  388. BI: "EU-London",
  389. KH: "JP-Tokyo",
  390. CM: "EU-London",
  391. CA: "US-Atlanta",
  392. CV: "EU-London",
  393. KY: "US-Atlanta",
  394. CF: "EU-London",
  395. TD: "EU-London",
  396. CL: "BR-Brazil",
  397. CN: "CN-China",
  398. CX: "JP-Tokyo",
  399. CC: "JP-Tokyo",
  400. CO: "BR-Brazil",
  401. KM: "EU-London",
  402. CD: "EU-London",
  403. CG: "EU-London",
  404. CK: "SG-Singapore",
  405. CR: "US-Atlanta",
  406. CI: "EU-London",
  407. HR: "EU-London",
  408. CU: "US-Atlanta",
  409. CW: "US-Atlanta",
  410. CY: "JP-Tokyo",
  411. CZ: "EU-London",
  412. DK: "EU-London",
  413. DJ: "EU-London",
  414. DM: "US-Atlanta",
  415. DO: "US-Atlanta",
  416. EC: "BR-Brazil",
  417. EG: "EU-London",
  418. SV: "US-Atlanta",
  419. GQ: "EU-London",
  420. ER: "EU-London",
  421. EE: "EU-London",
  422. ET: "EU-London",
  423. FO: "EU-London",
  424. FK: "BR-Brazil",
  425. FJ: "SG-Singapore",
  426. FI: "EU-London",
  427. FR: "EU-London",
  428. GF: "BR-Brazil",
  429. PF: "SG-Singapore",
  430. GA: "EU-London",
  431. GM: "EU-London",
  432. GE: "JP-Tokyo",
  433. DE: "EU-London",
  434. GH: "EU-London",
  435. GI: "EU-London",
  436. GR: "EU-London",
  437. GL: "US-Atlanta",
  438. GD: "US-Atlanta",
  439. GP: "US-Atlanta",
  440. GU: "SG-Singapore",
  441. GT: "US-Atlanta",
  442. GG: "EU-London",
  443. GN: "EU-London",
  444. GW: "EU-London",
  445. GY: "BR-Brazil",
  446. HT: "US-Atlanta",
  447. VA: "EU-London",
  448. HN: "US-Atlanta",
  449. HK: "JP-Tokyo",
  450. HU: "EU-London",
  451. IS: "EU-London",
  452. IN: "JP-Tokyo",
  453. ID: "JP-Tokyo",
  454. IR: "JP-Tokyo",
  455. IQ: "JP-Tokyo",
  456. IE: "EU-London",
  457. IM: "EU-London",
  458. IL: "JP-Tokyo",
  459. IT: "EU-London",
  460. JM: "US-Atlanta",
  461. JP: "JP-Tokyo",
  462. JE: "EU-London",
  463. JO: "JP-Tokyo",
  464. KZ: "JP-Tokyo",
  465. KE: "EU-London",
  466. KI: "SG-Singapore",
  467. KP: "JP-Tokyo",
  468. KR: "JP-Tokyo",
  469. KW: "JP-Tokyo",
  470. KG: "JP-Tokyo",
  471. LA: "JP-Tokyo",
  472. LV: "EU-London",
  473. LB: "JP-Tokyo",
  474. LS: "EU-London",
  475. LR: "EU-London",
  476. LY: "EU-London",
  477. LI: "EU-London",
  478. LT: "EU-London",
  479. LU: "EU-London",
  480. MO: "JP-Tokyo",
  481. MK: "EU-London",
  482. MG: "EU-London",
  483. MW: "EU-London",
  484. MY: "JP-Tokyo",
  485. MV: "JP-Tokyo",
  486. ML: "EU-London",
  487. MT: "EU-London",
  488. MH: "SG-Singapore",
  489. MQ: "US-Atlanta",
  490. MR: "EU-London",
  491. MU: "EU-London",
  492. YT: "EU-London",
  493. MX: "US-Atlanta",
  494. FM: "SG-Singapore",
  495. MD: "EU-London",
  496. MC: "EU-London",
  497. MN: "JP-Tokyo",
  498. ME: "EU-London",
  499. MS: "US-Atlanta",
  500. MA: "EU-London",
  501. MZ: "EU-London",
  502. MM: "JP-Tokyo",
  503. NA: "EU-London",
  504. NR: "SG-Singapore",
  505. NP: "JP-Tokyo",
  506. NL: "EU-London",
  507. NC: "SG-Singapore",
  508. NZ: "SG-Singapore",
  509. NI: "US-Atlanta",
  510. NE: "EU-London",
  511. NG: "EU-London",
  512. NU: "SG-Singapore",
  513. NF: "SG-Singapore",
  514. MP: "SG-Singapore",
  515. NO: "EU-London",
  516. OM: "JP-Tokyo",
  517. PK: "JP-Tokyo",
  518. PW: "SG-Singapore",
  519. PS: "JP-Tokyo",
  520. PA: "US-Atlanta",
  521. PG: "SG-Singapore",
  522. PY: "BR-Brazil",
  523. PE: "BR-Brazil",
  524. PH: "JP-Tokyo",
  525. PN: "SG-Singapore",
  526. PL: "EU-London",
  527. PT: "EU-London",
  528. PR: "US-Atlanta",
  529. QA: "JP-Tokyo",
  530. RE: "EU-London",
  531. RO: "EU-London",
  532. RU: "RU-Russia",
  533. RW: "EU-London",
  534. BL: "US-Atlanta",
  535. SH: "EU-London",
  536. KN: "US-Atlanta",
  537. LC: "US-Atlanta",
  538. MF: "US-Atlanta",
  539. PM: "US-Atlanta",
  540. VC: "US-Atlanta",
  541. WS: "SG-Singapore",
  542. SM: "EU-London",
  543. ST: "EU-London",
  544. SA: "EU-London",
  545. SN: "EU-London",
  546. RS: "EU-London",
  547. SC: "EU-London",
  548. SL: "EU-London",
  549. SG: "JP-Tokyo",
  550. SX: "US-Atlanta",
  551. SK: "EU-London",
  552. SI: "EU-London",
  553. SB: "SG-Singapore",
  554. SO: "EU-London",
  555. ZA: "EU-London",
  556. SS: "EU-London",
  557. ES: "EU-London",
  558. LK: "JP-Tokyo",
  559. SD: "EU-London",
  560. SR: "BR-Brazil",
  561. SJ: "EU-London",
  562. SZ: "EU-London",
  563. SE: "EU-London",
  564. CH: "EU-London",
  565. SY: "EU-London",
  566. TW: "JP-Tokyo",
  567. TJ: "JP-Tokyo",
  568. TZ: "EU-London",
  569. TH: "JP-Tokyo",
  570. TL: "JP-Tokyo",
  571. TG: "EU-London",
  572. TK: "SG-Singapore",
  573. TO: "SG-Singapore",
  574. TT: "US-Atlanta",
  575. TN: "EU-London",
  576. TR: "TK-Turkey",
  577. TM: "JP-Tokyo",
  578. TC: "US-Atlanta",
  579. TV: "SG-Singapore",
  580. UG: "EU-London",
  581. UA: "EU-London",
  582. AE: "EU-London",
  583. GB: "EU-London",
  584. US: "US-Atlanta",
  585. UM: "SG-Singapore",
  586. VI: "US-Atlanta",
  587. UY: "BR-Brazil",
  588. UZ: "JP-Tokyo",
  589. VU: "SG-Singapore",
  590. VE: "BR-Brazil",
  591. VN: "JP-Tokyo",
  592. WF: "SG-Singapore",
  593. EH: "EU-London",
  594. YE: "JP-Tokyo",
  595. ZM: "EU-London",
  596. ZW: "EU-London"
  597. };
  598. a.Maths = function(a) {
  599. function d(a, b, d) {
  600. return a < b ? b : a > d ? d : a
  601. }
  602. a.s = function(a, b, c) {
  603. c = d(c, 0, 1);
  604. return a + c * (b - a)
  605. };
  606. a.o = d;
  607. a.fixed = function(a, b) {
  608. var d = Math.pow(10, b);
  609. return ~~(a * d) / d
  610. };
  611. return a
  612. }({});
  613. a.Utils = function(a) {
  614. a.v = function() {
  615. for (var a = new Date, b = [a.getMonth() + 1, a.getDate(), a.getFullYear()], a = [a.getHours(), a.getMinutes(), a.getSeconds()], c = 1; 3 > c; c++) 10 > a[c] && (a[c] = "0" + a[c]);
  616. return "[" + b.join("/") + " " + a.join(":") + "]"
  617. };
  618. return a
  619. }({});
  620. Date.now || (Date.now = function() {
  621. return (new Date).getTime()
  622. });
  623. var n = "storeObjectInfo",
  624. t = {
  625. context: null,
  626. defaultProvider: "facebook",
  627. loginIntent: "0",
  628. userInfo: {
  629. socialToken: null,
  630. tokenExpires: "",
  631. level: "",
  632. xp: "",
  633. xpNeeded: "",
  634. name: "",
  635. picture: "",
  636. displayName: "",
  637. loggedIn: "0",
  638. socialId: ""
  639. }
  640. },
  641. e = a.defaultSt = t;
  642. a.storageInfo = e;
  643. a.createDefaultStorage = R;
  644. a.updateStorage = u;
  645. a.checkLoginStatus = function() {
  646. "1" == e.loginIntent && (w(), C(e.context))
  647. };
  648. var w = function() {
  649. a.MC.setProfilePicture(e.userInfo.picture);
  650. a.MC.setSocialId(e.userInfo.socialId)
  651. };
  652. a.logout = function() {
  653. e = t;
  654. delete a.localStorage[n];
  655. a.localStorage[n] = JSON.stringify(t);
  656. u();
  657. M();
  658. g.cache.sentGameServerLogin = !1;
  659. delete g.cache.login_info;
  660. c("#helloContainer").attr("data-logged-in", "0");
  661. c("#helloContainer").attr("data-has-account-data", "0");
  662. c(".timer").text("");
  663. c("#gPlusShare").hide();
  664. c("#fbShare").show();
  665. c("#user-id-tag").text("");
  666. c(".shop-blocker").fadeOut(100);
  667. MC.doLogout();
  668. MC.reconnect()
  669. };
  670. a.animateAccountData = p;
  671. a.toggleSocialLogin = function() {
  672. c("#socialLoginContainer").toggle();
  673. c("#settings").hide();
  674. c("#instructions").hide();
  675. MC.showInstructionsPanel()
  676. };
  677. a.toggleSettings = function() {
  678. c("#settings").toggle();
  679. c("#socialLoginContainer").hide();
  680. c("#instructions").hide();
  681. MC.showInstructionsPanel()
  682. };
  683. g.account = function(b) {
  684. function d() {}
  685.  
  686. function f(b, c) {
  687. if (null == h || h.id != c.id) h = c, null != a.ssa_json && (a.ssa_json.applicationUserId = "" + c.id, a.ssa_json.custom_user_id = "" + c.id), "undefined" != typeof SSA_CORE && SSA_CORE.start()
  688. }
  689. var h = null;
  690. b.init = function() {
  691. g.core.bind("user_login", f);
  692. g.core.bind("user_logout", d)
  693. };
  694. b.setUserData = function(a) {
  695. D(a)
  696. };
  697. b.setAccountData = function(a, b) {
  698. var d = c("#helloContainer").attr("data-has-account-data", "1");
  699. e.userInfo.xp = a.xp;
  700. e.userInfo.xpNeeded = a.xpNeeded;
  701. e.userInfo.level = a.level;
  702. u();
  703. d && b ? p(a) : (c(".agario-profile-panel .progress-bar-star").text(a.level), c(".agario-exp-bar .progress-bar-text").text(a.xp + "/" + a.xpNeeded + " XP"), c(".agario-exp-bar .progress-bar").css("width", (88 * a.xp / a.xpNeeded).toFixed(2) + "%"))
  704. };
  705. b.m = function(a) {
  706. p(a)
  707. };
  708. return b
  709. }({});
  710. var J = 0,
  711. H = !1,
  712. G = !1;
  713. a.fbAsyncInit = function() {
  714. a.FB.init({
  715. appId: EnvConfig.fb_app_id,
  716. cookie: !0,
  717. xfbml: !0,
  718. status: !0,
  719. version: "v2.2"
  720. });
  721. H = !0;
  722. E()
  723. };
  724. var A = !1;
  725. (function(b) {
  726. function d() {
  727. var a = document.createElement("script");
  728. a.type = "text/javascript";
  729. a.async = !0;
  730. a.src = "//apis.google.com/js/client:platform.js?onload=gapiAsyncInit";
  731. var b = document.getElementsByTagName("script")[0];
  732. b.parentNode.insertBefore(a, b);
  733. g = !0
  734. }
  735. var e = {},
  736. g = !1;
  737. a.gapiAsyncInit = function() {
  738. c(e).trigger("initialized")
  739. };
  740. b.google = {
  741. g: function() {
  742. d()
  743. },
  744. f: function(b, c) {
  745. a.gapi.client.load("plus", "v1", function() {
  746. console.log("fetching me profile");
  747. gapi.client.plus.people.get({
  748. userId: "me"
  749. }).execute(function(a) {
  750. c(a)
  751. })
  752. })
  753. }
  754. };
  755. b.j = function(a) {
  756. g || d();
  757. "undefined" !== typeof gapi ? a() : c(e).bind("initialized", a)
  758. };
  759. return b
  760. })(g);
  761. h = function(b) {
  762. function d(b) {
  763. a.MC.doLoginWithGPlus(b);
  764. g.cache.login_info = [b, "google"];
  765. a.MC.showInstructionsPanel(!0)
  766. }
  767.  
  768. function f(a) {
  769. e.userInfo.picture = a;
  770. c(".agario-profile-picture").attr("src", a)
  771. }
  772. var h = !1,
  773. l = !1,
  774. k = null,
  775. n = {
  776. client_id: EnvConfig.gplus_client_id,
  777. cookie_policy: "single_host_origin",
  778. scope: "profile email"
  779. };
  780. b.a = {
  781. c: function() {
  782. return k
  783. },
  784. init: function() {
  785. var b = this;
  786. g.j(function() {
  787. a.gapi.ytsubscribe.go("agarYoutube");
  788. h = !0;
  789. b.b()
  790. })
  791. },
  792. b: function() {
  793. if (1 != l && 0 != z && 0 != h) {
  794. l = !0;
  795. var b = e && "1" == e.loginIntent && "google" == e.context,
  796. c = this;
  797. a.gapi.load("auth2", function() {
  798. k = a.gapi.auth2.init(n);
  799. k.attachClickHandler(document.getElementById("gplusLogin"), {}, function(a) {
  800. console.log("googleUser : " + a)
  801. }, function(a) {
  802. console.log("failed to login in google plus: ", JSON.stringify(a, void 0, 2))
  803. });
  804. k.currentUser.listen(_.bind(c.i, c));
  805. b && 1 == k.isSignedIn.get() && k.signIn()
  806. })
  807. }
  808. },
  809. i: function(b) {
  810. if (k && b && k.isSignedIn.get() && !A) {
  811. A = !0;
  812. e.loginIntent = "1";
  813. var c = b.getAuthResponse(),
  814. h = c.access_token;
  815. a.c = c;
  816. console.log("loggedIn with G+!");
  817. var l = b.getBasicProfile();
  818. b = l.getImageUrl();
  819. void 0 == b ? g.google.f(c, function(b) {
  820. b.result.isPlusUser ? (b && f(b.image.url), d(h), b && (e.userInfo.picture = b.image.url), e.userInfo.socialId = l.getId(), w()) : (alert("Please add Google+ to your Google account and try again.\nOr you can login with another account."), a.logout())
  821. }) : (f(b), e.userInfo.picture = b, e.userInfo.socialId = l.getId(), w(), d(h));
  822. e.context = "google";
  823. a.updateStorage()
  824. }
  825. },
  826. h: function() {
  827. k && (k.signOut(), A = !1)
  828. }
  829. };
  830. return b
  831. }(g);
  832. a.gplusModule = h;
  833. var M = function() {
  834. g.a.h()
  835. };
  836. a.logoutGooglePlus = M;
  837. a.getStatsString = T;
  838. a.twitterShareStats = function() {
  839. a.open("https://twitter.com/intent/tweet?text=" + a.getStatsString("tt_share_stats"), "Agar.io", "width=660,height=310,menubar=no,toolbar=no,resizable=yes,scrollbars=no,left=" + (a.screenX + a.innerWidth / 2 - 330) + ",top=" + (a.innerHeight - 310) / 2)
  840. };
  841. a.fbShareStats = function() {
  842. var b = a.i18n("fb_matchresults_title"),
  843. c = a.i18n("fb_matchresults_description"),
  844. e = a.getStatsString("fb_matchresults_subtitle");
  845. a.FB.ui({
  846. method: "feed",
  847. display: "iframe",
  848. name: b,
  849. caption: c,
  850. description: e,
  851. link: "http://agar.io",
  852. u: "http://static2.miniclipcdn.com/mobile/agar/Agar.io_matchresults_fb_1200x630.png",
  853. l: {
  854. name: "play now!",
  855. link: "http://agar.io"
  856. }
  857. })
  858. };
  859. a.fillSocialValues = function(b, c) {
  860. 1 == a.isChrome && "google" == a.storageInfo.context && a.gapi.interactivepost.render(c, {
  861. contenturl: EnvConfig.game_url,
  862. clientid: EnvConfig.gplus_client_id,
  863. cookiepolicy: "http://agar.io",
  864. prefilltext: b,
  865. calltoactionlabel: "BEAT",
  866. calltoactionurl: EnvConfig.game_url
  867. })
  868. };
  869. c(function() {
  870. "MAsyncInit" in a && a.MAsyncInit();
  871. c("[data-itr]").each(function() {
  872. var b = c(this),
  873. d = b.attr("data-itr");
  874. b.html(a.i18n(d))
  875. })
  876. })
  877. }
  878. }
  879. }
  880. })(window, window.jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement