Advertisement
nPhoenix

habboflashclient.js

Aug 8th, 2012
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var swfobject = function () {
  2.     var aq = "undefined",
  3.         aD = "object",
  4.         ab = "Shockwave Flash",
  5.         X = "ShockwaveFlash.ShockwaveFlash",
  6.         aE = "application/x-shockwave-flash",
  7.         ac = "SWFObjectExprInst",
  8.         ax = "onreadystatechange",
  9.         af = window,
  10.         aL = document,
  11.         aB = navigator,
  12.         aa = false,
  13.         Z = [aN],
  14.         aG = [],
  15.         ag = [],
  16.         al = [],
  17.         aJ, ad, ap, at, ak = false,
  18.         aU = false,
  19.         aH, an, aI = true,
  20.         ah = function () {
  21.             var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq,
  22.                 e = aB.userAgent.toLowerCase(),
  23.                 c = aB.platform.toLowerCase(),
  24.                 h = c ? /win/.test(c) : /win/.test(e),
  25.                 j = c ? /mac/.test(c) : /mac/.test(e),
  26.                 g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,
  27.                 d = !+"\v1",
  28.                 f = [0, 0, 0],
  29.                 k = null;
  30.             if (typeof aB.plugins != aq && typeof aB.plugins[ab] == aD) {
  31.                 k = aB.plugins[ab].description;
  32.                 if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes[aE] && !aB.mimeTypes[aE].enabledPlugin)) {
  33.                     aa = true;
  34.                     d = false;
  35.                     k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
  36.                     f[0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10);
  37.                     f[1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
  38.                     f[2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0
  39.                 }
  40.             } else {
  41.                 if (typeof af.ActiveXObject != aq) {
  42.                     try {
  43.                         var i = new ActiveXObject(X);
  44.                         if (i) {
  45.                             k = i.GetVariable("$version");
  46.                             if (k) {
  47.                                 d = true;
  48.                                 k = k.split(" ")[1].split(",");
  49.                                 f = [parseInt(k[0], 10), parseInt(k[1], 10), parseInt(k[2], 10)]
  50.                             }
  51.                         }
  52.                     } catch (b) {}
  53.                 }
  54.             }
  55.             return {
  56.                 w3: a,
  57.                 pv: f,
  58.                 wk: g,
  59.                 ie: d,
  60.                 win: h,
  61.                 mac: j
  62.             }
  63.         }(),
  64.         aK = function () {
  65.             if (!ah.w3) {
  66.                 return
  67.             }
  68.             if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body")[0] || aL.body))) {
  69.                 aP()
  70.             }
  71.             if (!ak) {
  72.                 if (typeof aL.addEventListener != aq) {
  73.                     aL.addEventListener("DOMContentLoaded", aP, false)
  74.                 }
  75.                 if (ah.ie && ah.win) {
  76.                     aL.attachEvent(ax, function () {
  77.                         if (aL.readyState == "complete") {
  78.                             aL.detachEvent(ax, arguments.callee);
  79.                             aP()
  80.                         }
  81.                     });
  82.                     if (af == top) {
  83.                         (function () {
  84.                             if (ak) {
  85.                                 return
  86.                             }
  87.                             try {
  88.                                 aL.documentElement.doScroll("left")
  89.                             } catch (a) {
  90.                                 setTimeout(arguments.callee, 0);
  91.                                 return
  92.                             }
  93.                             aP()
  94.                         })()
  95.                     }
  96.                 }
  97.                 if (ah.wk) {
  98.                     (function () {
  99.                         if (ak) {
  100.                             return
  101.                         }
  102.                         if (!/loaded|complete/.test(aL.readyState)) {
  103.                             setTimeout(arguments.callee, 0);
  104.                             return
  105.                         }
  106.                         aP()
  107.                     })()
  108.                 }
  109.                 aC(aP)
  110.             }
  111.         }();
  112.  
  113.     function aP() {
  114.         if (ak) {
  115.             return
  116.         }
  117.         try {
  118.             var b = aL.getElementsByTagName("body")[0].appendChild(ar("span"));
  119.             b.parentNode.removeChild(b)
  120.         } catch (a) {
  121.             return
  122.         }
  123.         ak = true;
  124.         var d = Z.length;
  125.         for (var c = 0; c < d; c++) {
  126.             Z[c]()
  127.         }
  128.     }
  129.     function aj(a) {
  130.         if (ak) {
  131.             a()
  132.         } else {
  133.             Z[Z.length] = a
  134.         }
  135.     }
  136.     function aC(a) {
  137.         if (typeof af.addEventListener != aq) {
  138.             af.addEventListener("load", a, false)
  139.         } else {
  140.             if (typeof aL.addEventListener != aq) {
  141.                 aL.addEventListener("load", a, false)
  142.             } else {
  143.                 if (typeof af.attachEvent != aq) {
  144.                     aM(af, "onload", a)
  145.                 } else {
  146.                     if (typeof af.onload == "function") {
  147.                         var b = af.onload;
  148.                         af.onload = function () {
  149.                             b();
  150.                             a()
  151.                         }
  152.                     } else {
  153.                         af.onload = a
  154.                     }
  155.                 }
  156.             }
  157.         }
  158.     }
  159.     function aN() {
  160.         if (aa) {
  161.             Y()
  162.         } else {
  163.             am()
  164.         }
  165.     }
  166.     function Y() {
  167.         var d = aL.getElementsByTagName("body")[0];
  168.         var b = ar(aD);
  169.         b.setAttribute("type", aE);
  170.         var a = d.appendChild(b);
  171.         if (a) {
  172.             var c = 0;
  173.             (function () {
  174.                 if (typeof a.GetVariable != aq) {
  175.                     var e = a.GetVariable("$version");
  176.                     if (e) {
  177.                         e = e.split(" ")[1].split(",");
  178.                         ah.pv = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10)]
  179.                     }
  180.                 } else {
  181.                     if (c < 10) {
  182.                         c++;
  183.                         setTimeout(arguments.callee, 10);
  184.                         return
  185.                     }
  186.                 }
  187.                 d.removeChild(b);
  188.                 a = null;
  189.                 am()
  190.             })()
  191.         } else {
  192.             am()
  193.         }
  194.     }
  195.     function am() {
  196.         var g = aG.length;
  197.         if (g > 0) {
  198.             for (var h = 0; h < g; h++) {
  199.                 var c = aG[h].id;
  200.                 var l = aG[h].callbackFn;
  201.                 var a = {
  202.                     success: false,
  203.                     id: c
  204.                 };
  205.                 if (ah.pv[0] > 0) {
  206.                     var i = aS(c);
  207.                     if (i) {
  208.                         if (ao(aG[h].swfVersion) && !(ah.wk && ah.wk < 312)) {
  209.                             ay(c, true);
  210.                             if (l) {
  211.                                 a.success = true;
  212.                                 a.ref = av(c);
  213.                                 l(a)
  214.                             }
  215.                         } else {
  216.                             if (aG[h].expressInstall && au()) {
  217.                                 var e = {};
  218.                                 e.data = aG[h].expressInstall;
  219.                                 e.width = i.getAttribute("width") || "0";
  220.                                 e.height = i.getAttribute("height") || "0";
  221.                                 if (i.getAttribute("class")) {
  222.                                     e.styleclass = i.getAttribute("class")
  223.                                 }
  224.                                 if (i.getAttribute("align")) {
  225.                                     e.align = i.getAttribute("align")
  226.                                 }
  227.                                 var f = {};
  228.                                 var d = i.getElementsByTagName("param");
  229.                                 var k = d.length;
  230.                                 for (var j = 0; j < k; j++) {
  231.                                     if (d[j].getAttribute("name").toLowerCase() != "movie") {
  232.                                         f[d[j].getAttribute("name")] = d[j].getAttribute("value")
  233.                                     }
  234.                                 }
  235.                                 ae(e, f, c, l)
  236.                             } else {
  237.                                 aF(i);
  238.                                 if (l) {
  239.                                     l(a)
  240.                                 }
  241.                             }
  242.                         }
  243.                     }
  244.                 } else {
  245.                     ay(c, true);
  246.                     if (l) {
  247.                         var b = av(c);
  248.                         if (b && typeof b.SetVariable != aq) {
  249.                             a.success = true;
  250.                             a.ref = b
  251.                         }
  252.                         l(a)
  253.                     }
  254.                 }
  255.             }
  256.         }
  257.     }
  258.     function av(b) {
  259.         var d = null;
  260.         var c = aS(b);
  261.         if (c && c.nodeName == "OBJECT") {
  262.             if (typeof c.SetVariable != aq) {
  263.                 d = c
  264.             } else {
  265.                 var a = c.getElementsByTagName(aD)[0];
  266.                 if (a) {
  267.                     d = a
  268.                 }
  269.             }
  270.         }
  271.         return d
  272.     }
  273.     function au() {
  274.         return !aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312)
  275.     }
  276.     function ae(f, d, h, e) {
  277.         aU = true;
  278.         ap = e || null;
  279.         at = {
  280.             success: false,
  281.             id: h
  282.         };
  283.         var a = aS(h);
  284.         if (a) {
  285.             if (a.nodeName == "OBJECT") {
  286.                 aJ = aO(a);
  287.                 ad = null
  288.             } else {
  289.                 aJ = a;
  290.                 ad = h
  291.             }
  292.             f.id = ac;
  293.             if (typeof f.width == aq || (!/%$/.test(f.width) && parseInt(f.width, 10) < 310)) {
  294.                 f.width = "310"
  295.             }
  296.             if (typeof f.height == aq || (!/%$/.test(f.height) && parseInt(f.height, 10) < 137)) {
  297.                 f.height = "137"
  298.             }
  299.             aL.title = aL.title.slice(0, 47) + " - Flash Player Installation";
  300.             var b = ah.ie && ah.win ? "ActiveX" : "PlugIn",
  301.                 c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title;
  302.             if (typeof d.flashvars != aq) {
  303.                 d.flashvars += "&" + c
  304.             } else {
  305.                 d.flashvars = c
  306.             }
  307.             if (ah.ie && ah.win && a.readyState != 4) {
  308.                 var g = ar("div");
  309.                 h += "SWFObjectNew";
  310.                 g.setAttribute("id", h);
  311.                 a.parentNode.insertBefore(g, a);
  312.                 a.style.display = "none";
  313.                 (function () {
  314.                     if (a.readyState == 4) {
  315.                         a.parentNode.removeChild(a)
  316.                     } else {
  317.                         setTimeout(arguments.callee, 10)
  318.                     }
  319.                 })()
  320.             }
  321.             aA(f, d, h)
  322.         }
  323.     }
  324.     function aF(a) {
  325.         if (ah.ie && ah.win && a.readyState != 4) {
  326.             var b = ar("div");
  327.             a.parentNode.insertBefore(b, a);
  328.             b.parentNode.replaceChild(aO(a), b);
  329.             a.style.display = "none";
  330.             (function () {
  331.                 if (a.readyState == 4) {
  332.                     a.parentNode.removeChild(a)
  333.                 } else {
  334.                     setTimeout(arguments.callee, 10)
  335.                 }
  336.             })()
  337.         } else {
  338.             a.parentNode.replaceChild(aO(a), a)
  339.         }
  340.     }
  341.     function aO(b) {
  342.         var d = ar("div");
  343.         if (ah.win && ah.ie) {
  344.             d.innerHTML = b.innerHTML
  345.         } else {
  346.             var e = b.getElementsByTagName(aD)[0];
  347.             if (e) {
  348.                 var a = e.childNodes;
  349.                 if (a) {
  350.                     var f = a.length;
  351.                     for (var c = 0; c < f; c++) {
  352.                         if (!(a[c].nodeType == 1 && a[c].nodeName == "PARAM") && !(a[c].nodeType == 8)) {
  353.                             d.appendChild(a[c].cloneNode(true))
  354.                         }
  355.                     }
  356.                 }
  357.             }
  358.         }
  359.         return d
  360.     }
  361.     function aA(e, g, c) {
  362.         var d, a = aS(c);
  363.         if (ah.wk && ah.wk < 312) {
  364.             return d
  365.         }
  366.         if (a) {
  367.             if (typeof e.id == aq) {
  368.                 e.id = c
  369.             }
  370.             if (ah.ie && ah.win) {
  371.                 var f = "";
  372.                 for (var i in e) {
  373.                     if (e[i] != Object.prototype[i]) {
  374.                         if (i.toLowerCase() == "data") {
  375.                             g.movie = e[i]
  376.                         } else {
  377.                             if (i.toLowerCase() == "styleclass") {
  378.                                 f += ' class="' + e[i] + '"'
  379.                             } else {
  380.                                 if (i.toLowerCase() != "classid") {
  381.                                     f += " " + i + '="' + e[i] + '"'
  382.                                 }
  383.                             }
  384.                         }
  385.                     }
  386.                 }
  387.                 var h = "";
  388.                 for (var j in g) {
  389.                     if (g[j] != Object.prototype[j]) {
  390.                         h += '<param name="' + j + '" value="' + g[j] + '" />'
  391.                     }
  392.                 }
  393.                 a.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + f + ">" + h + "</object>";
  394.                 ag[ag.length] = e.id;
  395.                 d = aS(e.id)
  396.             } else {
  397.                 var b = ar(aD);
  398.                 b.setAttribute("type", aE);
  399.                 for (var k in e) {
  400.                     if (e[k] != Object.prototype[k]) {
  401.                         if (k.toLowerCase() == "styleclass") {
  402.                             b.setAttribute("class", e[k])
  403.                         } else {
  404.                             if (k.toLowerCase() != "classid") {
  405.                                 b.setAttribute(k, e[k])
  406.                             }
  407.                         }
  408.                     }
  409.                 }
  410.                 for (var l in g) {
  411.                     if (g[l] != Object.prototype[l] && l.toLowerCase() != "movie") {
  412.                         aQ(b, l, g[l])
  413.                     }
  414.                 }
  415.                 a.parentNode.replaceChild(b, a);
  416.                 d = b
  417.             }
  418.         }
  419.         return d
  420.     }
  421.     function aQ(b, d, c) {
  422.         var a = ar("param");
  423.         a.setAttribute("name", d);
  424.         a.setAttribute("value", c);
  425.         b.appendChild(a)
  426.     }
  427.     function aw(a) {
  428.         var b = aS(a);
  429.         if (b && b.nodeName == "OBJECT") {
  430.             if (ah.ie && ah.win) {
  431.                 b.style.display = "none";
  432.                 (function () {
  433.                     if (b.readyState == 4) {
  434.                         aT(a)
  435.                     } else {
  436.                         setTimeout(arguments.callee, 10)
  437.                     }
  438.                 })()
  439.             } else {
  440.                 b.parentNode.removeChild(b)
  441.             }
  442.         }
  443.     }
  444.     function aT(a) {
  445.         var b = aS(a);
  446.         if (b) {
  447.             for (var c in b) {
  448.                 if (typeof b[c] == "function") {
  449.                     b[c] = null
  450.                 }
  451.             }
  452.             b.parentNode.removeChild(b)
  453.         }
  454.     }
  455.     function aS(a) {
  456.         var c = null;
  457.         try {
  458.             c = aL.getElementById(a)
  459.         } catch (b) {}
  460.         return c
  461.     }
  462.     function ar(a) {
  463.         return aL.createElement(a)
  464.     }
  465.     function aM(a, c, b) {
  466.         a.attachEvent(c, b);
  467.         al[al.length] = [a, c, b]
  468.     }
  469.     function ao(a) {
  470.         var b = ah.pv,
  471.             c = a.split(".");
  472.         c[0] = parseInt(c[0], 10);
  473.         c[1] = parseInt(c[1], 10) || 0;
  474.         c[2] = parseInt(c[2], 10) || 0;
  475.         return (b[0] > c[0] || (b[0] == c[0] && b[1] > c[1]) || (b[0] == c[0] && b[1] == c[1] && b[2] >= c[2])) ? true : false
  476.     }
  477.     function az(b, f, a, c) {
  478.         if (ah.ie && ah.mac) {
  479.             return
  480.         }
  481.         var e = aL.getElementsByTagName("head")[0];
  482.         if (!e) {
  483.             return
  484.         }
  485.         var g = (a && typeof a == "string") ? a : "screen";
  486.         if (c) {
  487.             aH = null;
  488.             an = null
  489.         }
  490.         if (!aH || an != g) {
  491.             var d = ar("style");
  492.             d.setAttribute("type", "text/css");
  493.             d.setAttribute("media", g);
  494.             aH = e.appendChild(d);
  495.             if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) {
  496.                 aH = aL.styleSheets[aL.styleSheets.length - 1]
  497.             }
  498.             an = g
  499.         }
  500.         if (ah.ie && ah.win) {
  501.             if (aH && typeof aH.addRule == aD) {
  502.                 aH.addRule(b, f)
  503.             }
  504.         } else {
  505.             if (aH && typeof aL.createTextNode != aq) {
  506.                 aH.appendChild(aL.createTextNode(b + " {" + f + "}"))
  507.             }
  508.         }
  509.     }
  510.     function ay(a, c) {
  511.         if (!aI) {
  512.             return
  513.         }
  514.         var b = c ? "visible" : "hidden";
  515.         if (ak && aS(a)) {
  516.             aS(a).style.visibility = b
  517.         } else {
  518.             az("#" + a, "visibility:" + b)
  519.         }
  520.     }
  521.     function ai(b) {
  522.         var a = /[\\\"<>\.;]/;
  523.         var c = a.exec(b) != null;
  524.         return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b
  525.     }
  526.     var aR = function () {
  527.         if (ah.ie && ah.win) {
  528.             window.attachEvent("onunload", function () {
  529.                 var a = al.length;
  530.                 for (var b = 0; b < a; b++) {
  531.                     al[b][0].detachEvent(al[b][1], al[b][2])
  532.                 }
  533.                 var d = ag.length;
  534.                 for (var c = 0; c < d; c++) {
  535.                     aw(ag[c])
  536.                 }
  537.                 for (var e in ah) {
  538.                     ah[e] = null
  539.                 }
  540.                 ah = null;
  541.                 for (var f in swfobject) {
  542.                     swfobject[f] = null
  543.                 }
  544.                 swfobject = null
  545.             })
  546.         }
  547.     }();
  548.     return {
  549.         registerObject: function (a, e, c, b) {
  550.             if (ah.w3 && a && e) {
  551.                 var d = {};
  552.                 d.id = a;
  553.                 d.swfVersion = e;
  554.                 d.expressInstall = c;
  555.                 d.callbackFn = b;
  556.                 aG[aG.length] = d;
  557.                 ay(a, false)
  558.             } else {
  559.                 if (b) {
  560.                     b({
  561.                         success: false,
  562.                         id: a
  563.                     })
  564.                 }
  565.             }
  566.         },
  567.         getObjectById: function (a) {
  568.             if (ah.w3) {
  569.                 return av(a)
  570.             }
  571.         },
  572.         embedSWF: function (k, e, h, f, c, a, b, i, g, j) {
  573.             var d = {
  574.                 success: false,
  575.                 id: e
  576.             };
  577.             if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) {
  578.                 ay(e, false);
  579.                 aj(function () {
  580.                     h += "";
  581.                     f += "";
  582.                     var q = {};
  583.                     if (g && typeof g === aD) {
  584.                         for (var o in g) {
  585.                             q[o] = g[o]
  586.                         }
  587.                     }
  588.                     q.data = k;
  589.                     q.width = h;
  590.                     q.height = f;
  591.                     var n = {};
  592.                     if (i && typeof i === aD) {
  593.                         for (var p in i) {
  594.                             n[p] = i[p]
  595.                         }
  596.                     }
  597.                     if (b && typeof b === aD) {
  598.                         for (var l in b) {
  599.                             if (typeof n.flashvars != aq) {
  600.                                 n.flashvars += "&" + l + "=" + b[l]
  601.                             } else {
  602.                                 n.flashvars = l + "=" + b[l]
  603.                             }
  604.                         }
  605.                     }
  606.                     if (ao(c)) {
  607.                         var m = aA(q, n, e);
  608.                         if (q.id == e) {
  609.                             ay(e, true)
  610.                         }
  611.                         d.success = true;
  612.                         d.ref = m
  613.                     } else {
  614.                         if (a && au()) {
  615.                             q.data = a;
  616.                             ae(q, n, e, j);
  617.                             return
  618.                         } else {
  619.                             ay(e, true)
  620.                         }
  621.                     }
  622.                     if (j) {
  623.                         j(d)
  624.                     }
  625.                 })
  626.             } else {
  627.                 if (j) {
  628.                     j(d)
  629.                 }
  630.             }
  631.         },
  632.         switchOffAutoHideShow: function () {
  633.             aI = false
  634.         },
  635.         ua: ah,
  636.         getFlashPlayerVersion: function () {
  637.             return {
  638.                 major: ah.pv[0],
  639.                 minor: ah.pv[1],
  640.                 release: ah.pv[2]
  641.             }
  642.         },
  643.         hasFlashPlayerVersion: ao,
  644.         createSWF: function (a, b, c) {
  645.             if (ah.w3) {
  646.                 return aA(a, b, c)
  647.             } else {
  648.                 return undefined
  649.             }
  650.         },
  651.         showExpressInstall: function (b, a, d, c) {
  652.             if (ah.w3 && au()) {
  653.                 ae(b, a, d, c)
  654.             }
  655.         },
  656.         removeSWF: function (a) {
  657.             if (ah.w3) {
  658.                 aw(a)
  659.             }
  660.         },
  661.         createCSS: function (b, a, c, d) {
  662.             if (ah.w3) {
  663.                 az(b, a, c, d)
  664.             }
  665.         },
  666.         addDomLoadEvent: aj,
  667.         addLoadEvent: aC,
  668.         getQueryParamValue: function (b) {
  669.             var a = aL.location.search || aL.location.hash;
  670.             if (a) {
  671.                 if (/\?/.test(a)) {
  672.                     a = a.split("?")[1]
  673.                 }
  674.                 if (b == null) {
  675.                     return ai(a)
  676.                 }
  677.                 var c = a.split("&");
  678.                 for (var d = 0; d < c.length; d++) {
  679.                     if (c[d].substring(0, c[d].indexOf("=")) == b) {
  680.                         return ai(c[d].substring((c[d].indexOf("=") + 1)))
  681.                     }
  682.                 }
  683.             }
  684.             return ""
  685.         },
  686.         expressInstallCallback: function () {
  687.             if (aU) {
  688.                 var a = aS(ac);
  689.                 if (a && aJ) {
  690.                     a.parentNode.replaceChild(aJ, a);
  691.                     if (ad) {
  692.                         ay(ad, true);
  693.                         if (ah.ie && ah.win) {
  694.                             aJ.style.display = "block"
  695.                         }
  696.                     }
  697.                     if (ap) {
  698.                         ap(at)
  699.                     }
  700.                 }
  701.                 aU = false
  702.             }
  703.         }
  704.     }
  705. }();
  706. var Pinger = {
  707.     forever: false,
  708.     timer: null,
  709.     invokeCount: 0,
  710.     start: function (a) {
  711.         if (Pinger.timer == null) {
  712.             if (a) {
  713.                 Pinger.forever = a
  714.             }
  715.             Pinger.timer = new PeriodicalExecuter(Pinger.onTimerEvent, 600);
  716.             Pinger.timer.execute()
  717.         }
  718.     },
  719.     onTimerEvent: function () {
  720.         new Ajax.Request("/pingsession", {
  721.             onSuccess: function (a, b) {
  722.                 if (b && b.privilegeLevel != 1) {
  723.                     Pinger.stop()
  724.                 }
  725.             }
  726.         });
  727.         Pinger.invokeCount++;
  728.         if (!Pinger.forever && Pinger.invokeCount > 3) {
  729.             Pinger.stop()
  730.         }
  731.     },
  732.     stop: function () {
  733.         if (Pinger.timer != null) {
  734.             Pinger.timer.stop();
  735.             Pinger.timer = null
  736.         }
  737.     }
  738. };
  739. HabbletLoader = {
  740.     currentPoll: null,
  741.     loadedHabblets: [],
  742.     loadingStatus: [],
  743.     needsFlashKbWorkaround: function () {
  744.         var a = navigator.userAgent.match(/Firefox\/(\d+.\d+)/);
  745.         var e = (a != null ? parseFloat(a[1]) : 0) >= 3.5;
  746.         var c = navigator.userAgent.match(/Chrome/) != null;
  747.         var d = navigator.userAgent.match(/Chrome\/(\d+.\d+.)/);
  748.         var b = (d != null ? parseFloat(d[1]) : 0) >= 7;
  749.         return HabbletLoader.isWindowsPlatform() && ((Prototype.Browser.Gecko && !e) || (Prototype.Browser.WebKit ? (c ? !b : true) : false))
  750.     },
  751.     isWindowsPlatform: function () {
  752.         return navigator.userAgent.indexOf("Windows") > -1
  753.     },
  754.     show: function (habbletId, habbletWrapper, data) {
  755.         if (HabbletLoader.needsFlashKbWorkaround()) {
  756.             $("client-ui").addClassName("x-workaround");
  757.             if (habbletId == "credits" || habbletId == "fbAppRequest") {
  758.                 $("client-ui").addClassName("x-workaround-wide")
  759.             }
  760.         }
  761.         if (typeof habbletWrapper != "undefined") {
  762.             habbletWrapper.show();
  763.             HabbletLoader.bringToTop(habbletWrapper);
  764.             if (typeof data == "string") {
  765.                 try {
  766.                     var sender = eval("__" + habbletId + "__sendmsg__");
  767.                     sender.apply(null, [data])
  768.                 } catch (e) {}
  769.             }
  770.             if (HabbletLoader.isWindowsPlatform() && Prototype.Browser.WebKit) {
  771.                 $("content").setStyle({
  772.                     width: habbletWrapper.getWidth() + "px"
  773.                 })
  774.             }
  775.         }
  776.     },
  777.     hide: function (a) {
  778.         if (HabbletLoader.needsFlashKbWorkaround()) {
  779.             $("client-ui").removeClassName("x-workaround");
  780.             $("client-ui").removeClassName("x-workaround-wide")
  781.         }
  782.         if (typeof a != "undefined") {
  783.             a.hide()
  784.         }
  785.     },
  786.     load: function (g, c) {
  787.         var i = true;
  788.         var f = false;
  789.         var b = true;
  790.         var a = false;
  791.         var e = {
  792.             fromHabblet: "true"
  793.         };
  794.         if (g == "roomenterad") {
  795.             i = false;
  796.             b = false;
  797.             e = {
  798.                 contentWidth: $("flash-wrapper").offsetWidth
  799.             };
  800.             if (HabbletLoader.needsFlashKbWorkaround()) {
  801.                 return
  802.             }
  803.         }
  804.         if (g == "externalLink") {
  805.             i = false;
  806.             b = false;
  807.             a = true;
  808.             e = {
  809.                 url: c
  810.             }
  811.         }
  812.         if (g == "fbLike") {
  813.             i = false;
  814.             b = false;
  815.             a = true;
  816.             e = {
  817.                 roomId: c
  818.             };
  819.             f = true
  820.         }
  821.         if (g == "fbAppRequest") {
  822.             i = false;
  823.             a = true;
  824.             b = false;
  825.             e = c
  826.         }
  827.         if (g == "avatars") {
  828.             a = true
  829.         }
  830.         if (g == "credits") {
  831.             e = {
  832.                 openedInNewWindow: (window == window.top)
  833.             }
  834.         }
  835.         if (typeof HabbletLoader.loadedHabblets[g] != "undefined" && !a) {
  836.             HabbletLoader.show(g, HabbletLoader.loadedHabblets[g], c);
  837.             return
  838.         }
  839.         if (typeof HabbletLoader.loadingStatus[g] != "undefined") {
  840.             return
  841.         }
  842.         HabbletLoader.loadingStatus[g] = 1;
  843.         var d = $("content");
  844.         if (b) {
  845.             var h = Builder.node("div", {
  846.                 id: "loading-" + g,
  847.                 className: "client-habblet-container loading-element"
  848.             }, [Builder.node("img", {
  849.                 src: habboStaticFilePath + "/v2/images/lightwindow/ajax-loading.gif"
  850.             }), Builder.node("p", g)]);
  851.             d.appendChild(h);
  852.             HabbletLoader.bringToTop(h)
  853.         }
  854.         new Ajax.Request("/habblet/cproxy?habbletKey=" + g, {
  855.             method: "post",
  856.             parameters: e,
  857.             onComplete: function (n, r) {
  858.                 if (n.responseText.length == 0 || (r != null && r.disabled)) {
  859.                     delete HabbletLoader.loadingStatus[g];
  860.                     if (b) {
  861.                         d.removeChild($("loading-" + g))
  862.                     }
  863.                     return
  864.                 }
  865.                 var p = n.responseText.indexOf("<!-- dependencies");
  866.                 if (p > -1) {
  867.                     var k = n.responseText.substring(p + 17);
  868.                     k = k.substring(0, k.lastIndexOf("-->"));
  869.                     var q = k.match(new RegExp('<s*link rel="stylesheet".*?>', "g"));
  870.                     if (q) {
  871.                         for (var o = 0; o < q.length; o++) {
  872.                             var j = /href="(.*?)"/.exec(q[o]);
  873.                             if (j.length == 2) {
  874.                                 HabbletLoader.loadDependency(j[1], "css")
  875.                             }
  876.                         }
  877.                     }
  878.                     var l = function () {
  879.                         var t = $(g) || Builder.node("div", {
  880.                             id: g,
  881.                             "class": "client-habblet-container contains-" + g + (i ? " draggable" : "")
  882.                         });
  883.                         d.appendChild(t);
  884.                         t = $(t);
  885.                         if (i && Prototype.Browser.IE) {
  886.                             var v = parseInt(t.getStyle("right"), 10);
  887.                             var x = 0 - v - t.getWidth();
  888.                             t.setStyle({
  889.                                 left: x + "px"
  890.                             })
  891.                         }
  892.                         if (f && !$("client-ui").hasClassName("x-workaround")) {
  893.                             var s = 0;
  894.                             var u = 0;
  895.                             if (document.all) {
  896.                                 s = document.body.clientWidth;
  897.                                 u = document.body.clientHeight
  898.                             } else {
  899.                                 if ("innerWidth" in window) {
  900.                                     s = window.innerWidth;
  901.                                     u = window.innerHeight
  902.                                 }
  903.                             }
  904.                             if (s != 0 && u != 0) {
  905.                                 t.setStyle({
  906.                                     right: (s - t.getWidth()) / 2 + "px"
  907.                                 });
  908.                                 t.setStyle({
  909.                                     top: (u - t.getHeight()) / 2 + "px"
  910.                                 })
  911.                             }
  912.                         }
  913.                         t.update(n.responseText.replace('document.observe("dom:loaded",', "HabbletLoader.exec(")).show();
  914.                         Rounder.init();
  915.                         t.select(".habblet-close").each(function (w) {
  916.                             $(w).observe("click", function () {
  917.                                 HabbletLoader.hide(t)
  918.                             })
  919.                         });
  920.                         HabbletLoader.loadedHabblets[g] = t;
  921.                         setTimeout(function () {
  922.                             HabbletLoader.show(g, t, c);
  923.                             if ($("client-ui") && !$("client-ui").hasClassName("x-workaround") && i) {
  924.                                 new Draggable(t, {
  925.                                     handle: t.select(".title")[0],
  926.                                     starteffect: null,
  927.                                     endeffect: null,
  928.                                     onStart: function (y) {
  929.                                         var w = y.element.id;
  930.                                         y.positionBeforeDrag = HabbletLoader.loadedHabblets[w].positionedOffset()
  931.                                     },
  932.                                     onEnd: function (z) {
  933.                                         var w = z.element.id;
  934.                                         if (!HabbletLoader.isInPageBounds(w)) {
  935.                                             var y = z.positionBeforeDrag;
  936.                                             new Effect.Move(HabbletLoader.loadedHabblets[w], {
  937.                                                 x: y.left,
  938.                                                 y: y.top,
  939.                                                 mode: "absolute",
  940.                                                 duration: 0.5,
  941.                                                 transition: Effect.Transitions.spring
  942.                                             })
  943.                                         }
  944.                                     }
  945.                                 })
  946.                             }
  947.                         }, 300);
  948.                         delete HabbletLoader.loadingStatus[g];
  949.                         t.observe("click", function (w) {
  950.                             HabbletLoader.bringToTop(t)
  951.                         });
  952.                         if (b) {
  953.                             d.removeChild($("loading-" + g))
  954.                         }
  955.                     };
  956.                     var m = k.match(new RegExp("<s*script.*?>", "g"));
  957.                     if (m) {
  958.                         for (var o = 0; o < m.length; o++) {
  959.                             var j = /src="(.*?)"/.exec(m[o]);
  960.                             if (j != null && j.length == 2) {
  961.                                 HabbletLoader.loadDependency(j[1], "js")
  962.                             }
  963.                         }
  964.                         HabbletLoader.currentPoll = setInterval(function () {
  965.                             HabbletLoader.poll("__" + g + "__defined__", l)
  966.                         }, 500)
  967.                     } else {
  968.                         l.apply(null)
  969.                     }
  970.                 }
  971.             }
  972.         })
  973.     },
  974.     poll: function (statement, onReady) {
  975.         var ready = false;
  976.         try {
  977.             ready = eval(statement)
  978.         } catch (e) {}
  979.         if (ready) {
  980.             clearInterval(HabbletLoader.currentPoll);
  981.             onReady.apply(null)
  982.         }
  983.     },
  984.     loadDependency: function (a, b) {
  985.         if (b == "js") {
  986.             var c = document.createElement("script");
  987.             c.setAttribute("type", "text/javascript");
  988.             c.setAttribute("src", a)
  989.         } else {
  990.             if (b == "css") {
  991.                 var c = document.createElement("link");
  992.                 c.setAttribute("rel", "stylesheet");
  993.                 c.setAttribute("type", "text/css");
  994.                 c.setAttribute("href", a)
  995.             }
  996.         }
  997.         if (typeof c != "undefined") {
  998.             document.getElementsByTagName("head")[0].appendChild(c)
  999.         }
  1000.     },
  1001.     exec: function (a) {
  1002.         a.apply(null)
  1003.     },
  1004.     openLink: function (a) {
  1005.         while (a.tagName.toLowerCase() != "a") {
  1006.             a = a.parentNode
  1007.         }
  1008.         if (a.href) {
  1009.             if (window.opener != null && window.opener.name == "habboMain") {
  1010.                 window.opener.location.href = a.href;
  1011.                 window.opener.focus()
  1012.             } else {
  1013.                 window.open(a.href, "habboMain")
  1014.             }
  1015.         }
  1016.     },
  1017.     bringToTop: function (b) {
  1018.         var a = $$(".client-habblet-container");
  1019.         if (a.length > 1) {
  1020.             var c = 0;
  1021.             a.each(function (d) {
  1022.                 c = Math.max(d.style.zIndex, c)
  1023.             });
  1024.             b.style.zIndex = c + 1
  1025.         }
  1026.     },
  1027.     removeHabblet: function (a) {
  1028.         var b = $("content");
  1029.         if (typeof HabbletLoader.loadingStatus[a] != "undefined") {
  1030.             return
  1031.         }
  1032.         if (typeof HabbletLoader.loadedHabblets[a] != "undefined") {
  1033.             b.removeChild($(a));
  1034.             delete HabbletLoader.loadedHabblets[a]
  1035.         }
  1036.     },
  1037.     isInPageBounds: function (a) {
  1038.         var b = HabbletLoader.loadedHabblets[a];
  1039.         var c = b.viewportOffset();
  1040.         if (c.left + b.getWidth() <= 20) {
  1041.             return false
  1042.         } else {
  1043.             if (c.top + 15 <= 0) {
  1044.                 return false
  1045.             }
  1046.         }
  1047.         return true
  1048.     }
  1049. };
  1050. var FlashHabboClient = (function () {
  1051.     var a = function () {
  1052.         Event.observe(window, "unload", function () {
  1053.             Cookie.erase("habboclient");
  1054.             if (FlashExternalInterface.loginLogEnabled && !FlashExternalInterface.clientInited) {
  1055.                 new Ajax.Request(habboReqPath + "/clientlog/update", {
  1056.                     method: "post",
  1057.                     parameters: {
  1058.                         flashStep: "client.window.closed"
  1059.                     },
  1060.                     asynchronous: false
  1061.                 })
  1062.             }
  1063.         })
  1064.     };
  1065.     window.habboClient = true;
  1066.     ensureOpenerIsLoggedIn();
  1067.     a();
  1068.     var b = function () {
  1069.         swfobject.createCSS("html", "height:100%;");
  1070.         swfobject.createCSS("body", "height:100%;");
  1071.         swfobject.createCSS("#flash-container", "margin:0; width:100%; height:100%;")
  1072.     };
  1073.     if (typeof facebookUser == "undefined") {
  1074.         swfobject.addDomLoadEvent(b)
  1075.     }
  1076.     document.observe("dom:loaded", function () {
  1077.         if (!swfobject.hasFlashPlayerVersion("10.1.0")) {
  1078.             HabboView.run();
  1079.             FlashExternalInterface.logLoginStep("web.flash_missing")
  1080.         }
  1081.     });
  1082.     return {
  1083.         cacheCheck: function () {
  1084.             new Ajax.Request(habboReqPath + "/cacheCheck", {
  1085.                 method: "get",
  1086.                 parameters: {
  1087.                     r: new Date().getTime()
  1088.                 },
  1089.                 onSuccess: function (c, d) {
  1090.                     if (d && d.result == "false" && window.location.href.indexOf("t=") == -1) {
  1091.                         window.location.href = window.location.href + (window.location.href.indexOf("?") > 0 ? "&" : "?") + "t=" + new Date().getTime()
  1092.                     }
  1093.                 }
  1094.             })
  1095.         }
  1096.     }
  1097. })();
  1098. var FlashExternalInterface = (function () {
  1099.     var f = null;
  1100.     var b = 0;
  1101.     var g = null;
  1102.     var d = function () {
  1103.         if (!f) {
  1104.             f = window.setInterval(function () {
  1105.                 var k = new Date().getTime();
  1106.                 if (b < k - 15 * 60 * 1000) {
  1107.                     e("keepalive", "");
  1108.                     b = k
  1109.                 }
  1110.             }, 10 * 60 * 1000)
  1111.         }
  1112.     };
  1113.     var e = function (m, k, l) {
  1114.         d();
  1115.         if (l < 0) {
  1116.             l = undefined
  1117.         }
  1118.         if (typeof _gaq != "undefined") {
  1119.             _gaq.push(["_trackEvent", "client", m, k, l])
  1120.         }
  1121.     };
  1122.     var j = function (k) {
  1123.         d();
  1124.         if (typeof _gaq != "undefined") {
  1125.             _gaq.push(["_trackPageview", "/client/" + k])
  1126.         }
  1127.     };
  1128.     var i = function (n) {
  1129.         if (FlashExternalInterface.nielsenUrl) {
  1130.             c();
  1131.             var o = FlashExternalInterface.nielsenUrl + "/client/" + n;
  1132.             var k = o;
  1133.             if (g) {
  1134.                 k = k + "&rp=" + g
  1135.             }
  1136.             var m = o.match(/&si=([^&]*)/);
  1137.             if (m) {
  1138.                 g = m[1]
  1139.             } else {
  1140.                 g = null
  1141.             }
  1142.             var l = new Image(1, 1);
  1143.             l.src = k
  1144.         }
  1145.     };
  1146.     var h = null;
  1147.     var c = function () {
  1148.         if (!h) {
  1149.             h = window.setInterval(function () {
  1150.                 i("keepalive")
  1151.             }, 15 * 60 * 1000)
  1152.         }
  1153.     };
  1154.     var a = {
  1155.         authentication: function (k, l) {
  1156.             i("loggedin");
  1157.             j("loggedin")
  1158.         },
  1159.         navigator: function (k, l) {
  1160.             if (k == "private" || k == "public") {
  1161.                 j(k + "/" + l)
  1162.             } else {
  1163.                 e("navigator", k)
  1164.             }
  1165.         },
  1166.         catalogue: function (k, l) {
  1167.             if (k == "open") {
  1168.                 e("catalogue", "open")
  1169.             } else {
  1170.                 e("catalogue", l.toString())
  1171.             }
  1172.         },
  1173.         achievement: function (k, l) {
  1174.             e("achievement", l.toString())
  1175.         },
  1176.         habblet: function (k, l) {
  1177.             if (k == "news") {
  1178.                 j(k + "/" + l)
  1179.             } else {
  1180.                 e(k, l.toString())
  1181.             }
  1182.         },
  1183.         room_ad: function (k, l) {
  1184.             e("room_ad", l + "_" + k)
  1185.         }
  1186.     };
  1187.     return {
  1188.         legacyTrack: function (n, k, m) {
  1189.             if ("console" in window && "log" in console) {
  1190.                 console.log("action = [" + n + "], label = [" + k + "], data = [" + m + "]")
  1191.             }
  1192.             if ("authentication" == n && "authok" == k) {
  1193.                 $(document).fire("habbo:authok")
  1194.             }
  1195.             var l = a[n];
  1196.             if (l) {
  1197.                 l.apply(this, [k, m])
  1198.             } else {
  1199.                 e(n, k)
  1200.             }
  1201.         },
  1202.         track: function (m, k, l) {
  1203.             if ("console" in window && "log" in console) {
  1204.                 console.log("action = [" + m + "], label = [" + k + "], value = [" + l + "]")
  1205.             }
  1206.             e(m, k, l)
  1207.         },
  1208.         logError: function (k) {
  1209.             if ("console" in window) {
  1210.                 console.log("errorCode = " + k)
  1211.             }
  1212.         },
  1213.         logEventLog: function (k) {
  1214.             new Ajax.Request(habboReqPath + "/eventlog", {
  1215.                 method: "post",
  1216.                 parameters: {
  1217.                     errorData: k
  1218.                 }
  1219.             })
  1220.         },
  1221.         logWarn: function (k) {
  1222.             new Ajax.Request(habboReqPath + "/habbo/flash_client_warning", {
  1223.                 method: "post",
  1224.                 parameters: k
  1225.             })
  1226.         },
  1227.         logLoginStep: function (k, l) {
  1228.             setTimeout(function () {
  1229.                 if (k == "client.init.auth.ok") {
  1230.                     FlashExternalInterface.clientInited = true
  1231.                 }
  1232.                 if (FlashExternalInterface.loginLogEnabled) {
  1233.                     if (Object.isUndefined(l) || l == null) {
  1234.                         new Ajax.Request(habboReqPath + "/clientlog/update", {
  1235.                             method: "post",
  1236.                             parameters: {
  1237.                                 flashStep: k
  1238.                             }
  1239.                         })
  1240.                     } else {
  1241.                         new Ajax.Request(habboReqPath + "/clientlog/update", {
  1242.                             method: "post",
  1243.                             parameters: {
  1244.                                 flashStep: k,
  1245.                                 data: l
  1246.                             }
  1247.                         })
  1248.                     }
  1249.                 }
  1250.             }, 100)
  1251.         },
  1252.         openHabblet: function (k, l) {
  1253.             HabbletLoader.load(k, l);
  1254.             FlashExternalInterface.legacyTrack("habblet", k, "open")
  1255.         },
  1256.         closeHabblet: function (k) {
  1257.             HabbletLoader.hide($(k))
  1258.         },
  1259.         postAchievement: function (k, l) {
  1260.             if (FacebookIntegration) {
  1261.                 FacebookIntegration.publishAchievementStory(k, l)
  1262.             }
  1263.         },
  1264.         postAchievementShareBonus: function (k, n, m, l) {
  1265.             if (FacebookIntegration) {
  1266.                 FacebookIntegration.publishAchievementScoreBonus(k, n, m, l)
  1267.             }
  1268.         },
  1269.         postXmasViral: function (k, o, n, l, m) {
  1270.             if (FacebookIntegration) {
  1271.                 FacebookIntegration.publishXmasViral(k, o, n, l, m || "feed")
  1272.             }
  1273.         },
  1274.         openExternalLink: function (k) {
  1275.             HabbletLoader.load("externalLink", k)
  1276.         },
  1277.         fbLike: function (k) {
  1278.             HabbletLoader.load("fbLike", k)
  1279.         },
  1280.         roomVisited: function (k) {
  1281.             FlashExternalInterface.lastVisitedRoomId = k
  1282.         },
  1283.         logout: function () {
  1284.             if (window.opener) {
  1285.                 try {
  1286.                     window.opener.location = FlashExternalInterface.signoutUrl;
  1287.                     window.close()
  1288.                 } catch (k) {
  1289.                     window.location = FlashExternalInterface.signoutUrl
  1290.                 }
  1291.             } else {
  1292.                 window.location = FlashExternalInterface.signoutUrl
  1293.             }
  1294.         },
  1295.         embedSwfCallback: function (k) {
  1296.             if (k && k.success) {
  1297.                 FlashExternalInterface.clientElement = k.ref
  1298.             }
  1299.         },
  1300.         authenticateFacebook: function () {
  1301.             FacebookIntegration.getAccessToken("${restFbApiHelper.facebookCookieName}", '${restFbApiHelper.extendedPermissions!""}')
  1302.         },
  1303.         listPlugins: function () {
  1304.             var k = "";
  1305.             if (navigator.plugins != null && navigator.plugins.length > 0) {
  1306.                 k = [].slice.call(navigator.plugins).map(function (l) {
  1307.                     return l.filename + l.version + l.name + [].slice.call(l).map(function (m) {
  1308.                         return m.type + m.suffixes
  1309.                     }).join("")
  1310.                 }).sort().join(", ")
  1311.             }
  1312.             return k
  1313.         }
  1314.     }
  1315. })();
  1316. FlashExternalInterface.loginLogEnabled = false;
  1317. FlashExternalInterface.nielsenUrl = null;
  1318. FlashExternalInterface.clientInited = false;
  1319. FlashExternalInterface.clientElement = null;
  1320. FlashExternalInterface.lastVisitedRoomId = null;
  1321. var ExternalClickHandler = {
  1322.     trackClick: function (a, d, b) {
  1323.         if (b) {
  1324.             var c = window.open(a + "&hash=" + d, "_blank", "menubar=1,status=1,resizable=1,scrollbars=1,location=1,toolbar=1");
  1325.             if (window.focus) {
  1326.                 c.focus()
  1327.             }
  1328.         }
  1329.         HabbletLoader.hide($("externalLink"));
  1330.         new Ajax.Request("/habblet/external_link", {
  1331.             parameters: {
  1332.                 url: a,
  1333.                 hash: d,
  1334.                 clicked: b
  1335.             }
  1336.         })
  1337.     },
  1338.     clickCancel: function (a, b) {
  1339.         ExternalClickHandler.trackClick(a, b, false)
  1340.     },
  1341.     clickContinue: function (a, b) {
  1342.         ExternalClickHandler.trackClick(a, b, true)
  1343.     }
  1344. };
  1345. var RightClick = {
  1346.     init: function (b, a) {
  1347.         this.FlashObjectID = a;
  1348.         this.FlashContainerID = b;
  1349.         this.Cache = this.FlashObjectID;
  1350.         if (window.addEventListener) {
  1351.             window.addEventListener("mousedown", this.onGeckoMouse(), true)
  1352.         } else {
  1353.             document.getElementById(this.FlashContainerID).onmouseup = function () {
  1354.                 document.getElementById(RightClick.FlashContainerID).releaseCapture()
  1355.             };
  1356.             document.oncontextmenu = function () {
  1357.                 if (window.event.srcElement.id == RightClick.FlashObjectID) {
  1358.                     return false
  1359.                 } else {
  1360.                     RightClick.Cache = "nan"
  1361.                 }
  1362.             };
  1363.             document.getElementById(this.FlashContainerID).onmousedown = RightClick.onIEMouse
  1364.         }
  1365.     },
  1366.     killEvents: function (a) {
  1367.         if (a) {
  1368.             if (a.stopPropagation) {
  1369.                 a.stopPropagation()
  1370.             }
  1371.             if (a.preventDefault) {
  1372.                 a.preventDefault()
  1373.             }
  1374.             if (a.preventCapture) {
  1375.                 a.preventCapture()
  1376.             }
  1377.             if (a.preventBubble) {
  1378.                 a.preventBubble()
  1379.             }
  1380.         }
  1381.     },
  1382.     onGeckoMouse: function (a) {
  1383.         return function (b) {
  1384.             if (b.button != 0) {
  1385.                 RightClick.killEvents(b);
  1386.                 if (b.target.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) {
  1387.                     RightClick.call()
  1388.                 }
  1389.                 RightClick.Cache = b.target.id
  1390.             }
  1391.         }
  1392.     },
  1393.     onIEMouse: function () {
  1394.         if (event.button > 1) {
  1395.             if (window.event.srcElement.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) {
  1396.                 RightClick.call()
  1397.             }
  1398.             document.getElementById(RightClick.FlashContainerID).setCapture();
  1399.             if (window.event.srcElement.id) {
  1400.                 RightClick.Cache = window.event.srcElement.id
  1401.             }
  1402.         }
  1403.     },
  1404.     call: function () {}
  1405. };
  1406. var loadedGameUrl;
  1407. var FlashExternalGameInterface = (function () {
  1408.     return {
  1409.         showGame: function (a) {
  1410.             $("flash-wrapper").addClassName("hidden");
  1411.             var b = (a.indexOf("?") == -1) ? "?" : "&";
  1412.             loadedGameUrl = a + b + "habbo_origin=" + document.URL;
  1413.             $("game-content").src = loadedGameUrl;
  1414.             $("game-content").addClassName("visible")
  1415.         },
  1416.         hideGame: function () {
  1417.             $("flash-wrapper").removeClassName("hidden");
  1418.             $("game-content").src = null;
  1419.             $("game-content").removeClassName("visible")
  1420.         },
  1421.         sendGameEvent: function (a) {
  1422.             $("game-content").contentWindow.postMessage(a, loadedGameUrl)
  1423.         }
  1424.     }
  1425. })();
  1426. var onGameMessage = function (d) {
  1427.     var e = d.data;
  1428.     if (e.indexOf("HabboGameAPI") == -1) {
  1429.         return false
  1430.     }
  1431.     var a = e.indexOf(";");
  1432.     var c = e.substr(0, a);
  1433.     var b = e.substr(a + 1);
  1434.     if (b == "HabboGameAPI_exit_game") {
  1435.         FlashExternalGameInterface.hideGame();
  1436.         $("flash-container").HabboGameJsAPIEventToHabbo(e)
  1437.     } else {
  1438.         $("flash-container").HabboGameJsAPIEventToHabbo(e)
  1439.     }
  1440. };
  1441. if (typeof window.addEventListener != "undefined") {
  1442.     window.addEventListener("message", onGameMessage, false)
  1443. } else {
  1444.     if (typeof window.attachEvent != "undefined") {
  1445.         window.attachEvent("onGameMessage", onGameMessage)
  1446.     }
  1447. }
  1448. var Embed = {
  1449.     embedWindowName: "embed",
  1450.     docWindowName: "habboMain",
  1451.     docWindowParams: "toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes",
  1452.     rpxWindowName: "rpxLogin",
  1453.     rpxWindowParams: "toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=750,height=440",
  1454.     setEmbedWindowName: function () {
  1455.         window.name = Embed.embedWindowName
  1456.     },
  1457.     openRpxLoginPopup: function (b, a, d) {
  1458.         var c = window.open(b.href, Embed.rpxWindowName, Embed.rpxWindowParams);
  1459.         if (window.focus) {
  1460.             c.focus()
  1461.         }
  1462.     },
  1463.     openSigninPopup: function (a) {
  1464.         var d = (screen.width / 2) - (700 / 2);
  1465.         var c = (screen.height / 2.5) - (450 / 2);
  1466.         var b = window.open(a.href, null, "toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=450,left=" + d + ",top=" + c);
  1467.         if (window.focus) {
  1468.             b.focus()
  1469.         }
  1470.     },
  1471.     openFullscreenHabbo: function (c, b) {
  1472.         var a = FlashExternalInterface.lastVisitedRoomId;
  1473.         if (a != null && a != "" && c != null) {
  1474.             c += "&roomId=" + a + "&forwardId=2"
  1475.         }
  1476.         window.name = "old-client";
  1477.         HabboClient.openOrFocus(c);
  1478.         window.location.href = b || "/embed"
  1479.     },
  1480.     decorateNaviLinks: function (a) {
  1481.         $$("#navi a").each(function (c) {
  1482.             var b = false;
  1483.             if (a && c.href.indexOf("/credits") != -1) {
  1484.                 b = true;
  1485.                 c.removeAttribute("href");
  1486.                 c.setStyle({
  1487.                     cursor: "pointer"
  1488.                 })
  1489.             }
  1490.             Event.observe(c, "click", function (g) {
  1491.                 Event.stop(g);
  1492.                 var d = Event.element(g);
  1493.                 if (b) {
  1494.                     HabbletLoader.load("credits");
  1495.                     return
  1496.                 }
  1497.                 var f = window.open(d.href, "_blank", Embed.docWindowParams);
  1498.                 if (window.focus) {
  1499.                     f.focus()
  1500.                 }
  1501.             })
  1502.         })
  1503.     },
  1504.     registerUnloadReloadHook: function () {
  1505.         Event.observe(window, "unload", function () {
  1506.             if (window.opener && window.opener != window) {
  1507.                 window.opener.location.replace(window.opener.location.href)
  1508.             }
  1509.         })
  1510.     },
  1511.     decorateFooterLinks: function () {
  1512.         $$("#footer p a").each(function (a) {
  1513.             Event.observe(a, "click", function (d) {
  1514.                 Event.stop(d);
  1515.                 var b = Event.element(d);
  1516.                 var c = window.open(b.href, "_blank", Embed.docWindowParams);
  1517.                 if (window.focus) {
  1518.                     c.focus()
  1519.                 }
  1520.             })
  1521.         })
  1522.     },
  1523.     decorateLogoLink: function () {
  1524.         $$("#right-buttons h1 a").each(function (a) {
  1525.             Event.observe(a, "click", function (d) {
  1526.                 Event.stop(d);
  1527.                 var b = Event.element(d);
  1528.                 var c = window.open(b.href, Embed.docWindowName, Embed.docWindowParams);
  1529.                 if (window.focus) {
  1530.                     c.focus()
  1531.                 }
  1532.             })
  1533.         })
  1534.     }
  1535. };
  1536. Ajax.JSONRequest = Class.create(Ajax.Base, (function () {
  1537.     var b = 0,
  1538.         a = document.getElementsByTagName("head")[0] || document.body;
  1539.     return {
  1540.         initialize: function ($super, d, c) {
  1541.             $super(c);
  1542.             this.options.url = d;
  1543.             this.options.callbackParamName = this.options.callbackParamName || "callback";
  1544.             this.options.timeout = this.options.timeout || 10;
  1545.             this.options.invokeImmediately = (!Object.isUndefined(this.options.invokeImmediately)) ? this.options.invokeImmediately : true;
  1546.             if (!Object.isUndefined(this.options.parameters) && Object.isString(this.options.parameters)) {
  1547.                 this.options.parameters = this.options.parameters.toQueryParams()
  1548.             }
  1549.             if (this.options.invokeImmediately) {
  1550.                 this.request()
  1551.             }
  1552.         },
  1553.         _cleanup: function () {
  1554.             if (this.timeout) {
  1555.                 clearTimeout(this.timeout);
  1556.                 this.timeout = null
  1557.             }
  1558.             if (this.transport && Object.isElement(this.transport)) {
  1559.                 this.transport.remove();
  1560.                 this.transport = null
  1561.             }
  1562.         },
  1563.         request: function () {
  1564.             var d = new Ajax.JSONResponse(this);
  1565.             var g = this.options.callbackParamName,
  1566.                 f = "_prototypeJSONPCallback_" + (b++),
  1567.                 c = function () {
  1568.                     if (Object.isFunction(this.options.onComplete)) {
  1569.                         this.options.onComplete.call(this, d)
  1570.                     }
  1571.                     Ajax.Responders.dispatch("onComplete", this, d)
  1572.                 }.bind(this);
  1573.             if (this.options.parameters[g] !== undefined) {
  1574.                 f = this.options.parameters[g]
  1575.             } else {
  1576.                 this.options.parameters[g] = f
  1577.             }
  1578.             this.options.parameters[g] = f;
  1579.             var e = this.options.url + ((this.options.url.include("?") ? "&" : "?") + Object.toQueryString(this.options.parameters));
  1580.             window[f] = function (h) {
  1581.                 this._cleanup();
  1582.                 window[f] = undefined;
  1583.                 d.status = 200;
  1584.                 d.statusText = "OK";
  1585.                 d.setResponseContent(h);
  1586.                 if (Object.isFunction(this.options.onSuccess)) {
  1587.                     this.options.onSuccess.call(this, d)
  1588.                 }
  1589.                 Ajax.Responders.dispatch("onSuccess", this, d);
  1590.                 c()
  1591.             }.bind(this);
  1592.             this.transport = new Element("script", {
  1593.                 type: "text/javascript",
  1594.                 src: e
  1595.             });
  1596.             if (Object.isFunction(this.options.onCreate)) {
  1597.                 this.options.onCreate.call(this, d)
  1598.             }
  1599.             Ajax.Responders.dispatch("onCreate", this);
  1600.             a.appendChild(this.transport);
  1601.             this.timeout = setTimeout(function () {
  1602.                 this._cleanup();
  1603.                 window[f] = Prototype.emptyFunction;
  1604.                 if (Object.isFunction(this.options.onFailure)) {
  1605.                     d.status = 504;
  1606.                     d.statusText = "Gateway Timeout";
  1607.                     this.options.onFailure.call(this, d)
  1608.                 }
  1609.                 c()
  1610.             }.bind(this), this.options.timeout * 1000)
  1611.         },
  1612.         toString: function () {
  1613.             return "[object Ajax.JSONRequest]"
  1614.         }
  1615.     }
  1616. })());
  1617. Ajax.JSONResponse = Class.create({
  1618.     initialize: function (a) {
  1619.         this.request = a
  1620.     },
  1621.     request: undefined,
  1622.     status: 0,
  1623.     statusText: "",
  1624.     responseJSON: undefined,
  1625.     responseText: undefined,
  1626.     setResponseContent: function (a) {
  1627.         this.responseJSON = a;
  1628.         this.responseText = Object.toJSON(a)
  1629.     },
  1630.     getTransport: function () {
  1631.         if (this.request) {
  1632.             return this.request.transport
  1633.         }
  1634.     },
  1635.     toString: function () {
  1636.         return "[object Ajax.JSONResponse]"
  1637.     }
  1638. });
  1639. var ClientTwitter = {
  1640.     poll: function (a, c, b) {
  1641.         var d = {
  1642.             include_rts: "false",
  1643.             exclude_replies: "true",
  1644.             include_entities: "true",
  1645.             screen_name: a,
  1646.             count: c
  1647.         };
  1648.         if (b != undefined && b != "") {
  1649.             d.since_id = b
  1650.         }
  1651.         new Ajax.JSONRequest("//api.twitter.com/1/statuses/user_timeline.json", {
  1652.             callbackParamName: "callback",
  1653.             parameters: d,
  1654.             onSuccess: function (e) {
  1655.                 FlashExternalInterface.clientElement.twitterPollHandler(e.responseText)
  1656.             },
  1657.             onFailure: function (e) {
  1658.                 FlashExternalInterface.clientElement.twitterPollHandlerFailed(this.options.parameters.screenName)
  1659.             }
  1660.         })
  1661.     }
  1662. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement