├── .gitignore ├── blocker.png ├── fonts ├── glyphicons-halflings-regular.eot ├── glyphicons-halflings-regular.eot@ ├── glyphicons-halflings-regular.ttf ├── glyphicons-halflings-regular.woff └── glyphicons-halflings-regular.svg ├── proxy.php ├── custom.js ├── readme.md ├── quadtree.js ├── proxy.js ├── index.html ├── main_out.js └── js └── jquery.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /blocker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DnAp/Agar.io-Reverse-Engineering/HEAD/blocker.png -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DnAp/Agar.io-Reverse-Engineering/HEAD/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.eot@: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DnAp/Agar.io-Reverse-Engineering/HEAD/fonts/glyphicons-halflings-regular.eot@ -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DnAp/Agar.io-Reverse-Engineering/HEAD/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DnAp/Agar.io-Reverse-Engineering/HEAD/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /proxy.php: -------------------------------------------------------------------------------- 1 | array( 9 | 'method' => 'POST', 10 | 'header' => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL, 11 | 'content' => file_get_contents('php://input'), 12 | ), 13 | )); 14 | } 15 | 16 | echo file_get_contents($url, false, $context); -------------------------------------------------------------------------------- /custom.js: -------------------------------------------------------------------------------- 1 | 2 | jQuery('#playBtn').click(function() { 3 | if (jQuery('#iphack').val() != "" ) { 4 | setRegion(jQuery('#iphack').val()); 5 | } 6 | return false; 7 | }); 8 | 9 | $('a[data-toggle="tab"]').on('click', function (e) { 10 | console.log($(this).attr('tab')); 11 | $('.tab-pane').each(function(i) { 12 | $(this).hide(); 13 | console.log(this); 14 | }); 15 | $("#"+$(this).attr('tab')).show(); 16 | console.log($("#"+$(this).attr('tab'))); 17 | }); 18 | 19 | for (var skin in excludes) { 20 | $("#skin-list").append(""); 21 | } 22 | 23 | $('#skin-list option').click(function(e) { 24 | if (e.shiftKey) { 25 | $('#skin-list').val($(this).val()); 26 | } 27 | } 28 | ); 29 | 30 | $('#skin-list').change(function(e) { 31 | $("#skin-img").attr('src',"http://agar.io/skins/" + $(e.target).val() + ".png"); 32 | }); 33 | 34 | function setSkin(){ 35 | var s = $('#skin-list').val(); 36 | $("#nick").val(s); 37 | $("#home").show(); 38 | } 39 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Agar.io Reverse Engineering 2 | ======== 3 | 4 | ## Support discontinued, it is not working now ## 5 | 6 | 7 | **Author:** 8 | * DnAp 9 | * TheZero 10 | 11 | ## Feature ## 12 | * Reverse engineering main_out.js with user frendly variables names 13 | * Greater field of view - zoom rate from 10 to 10.35 14 | * Depict circle around big points 15 | * Show mass for all points 16 | * Color enemy 17 | 18 | ## Color enemy ## 19 | * Green - small food 20 | * Sea green - food 21 | * Blue - friend, safe mass 22 | * Red - predator 23 | 24 | ## To start ## 25 | Copy files to your server and open http://localhost/index.html 26 | 27 | ## Code Logic - Websocket API ## 28 | [termnology: B=Byte, I=int, U=uint, F=float] 29 | 30 | #### Data sended #### 31 | 32 | * send 5B (1B=255 + 4B=1) when opened connection 33 | * send name: 0(1B) + characters ascii(2B each, to support other languages) 34 | * send actions: 1B number(command) 35 | - 1 : spectate 36 | - 17: space key (split) 37 | - 18: Q key _(apparently don't work)_ 38 | - 19: Q keyup, close game _(apparently don't work)_ 39 | - 21: W key (eject mass) 40 | * send normalized location: 21B 41 | - 16(1BI) + xPos(8BF) + yPos(8BF) + 0(4BI) 42 | 43 | #### Data Received #### 44 | * 16: main loop which called very often with updated locations of everyone. following data format. 45 | - 2BU: number points to destroy. probably first eating second. 46 | - info of above points: id of first(4BU) + id of 2nd(4BU) 47 | - id of a point(4BU)+x(4BF)+y(4BF)+size(4BF)+color[R(1BU)+G(1BU)+B(1BU)]+ 48 | - isVirus(1BU)+[padding=f(isVirus)]+name(2BU,till 0)+2B unused+ 49 | - numUpdateCodes(4BU)+list of ids(4BU) probably to destroy 50 | 51 | * 17: returns normalization params, px, py and ratio 52 | - this message never came 53 | * 20: resets points. 54 | - this message never came 55 | * 32: informs the client which cell belongs to the player. 56 | - sent every time you split or respawn. 57 | * 48: elements with name. 58 | - probably old leaderboard method. also doesnt come here 59 | * 49: leaderboard 60 | - name and ids list sorted by rank (top 10) 61 | * 64: size of canvas 62 | - comes when select region. fixed for all regions 63 | -------------------------------------------------------------------------------- /quadtree.js: -------------------------------------------------------------------------------- 1 | /* Maybe https://github.com/silflow/quadtree-javascript */ 2 | var QUAD={};QUAD.init=function(args){var TOP_LEFT=0;var TOP_RIGHT=1;var BOTTOM_LEFT=2;var BOTTOM_RIGHT=3;var PARENT=4;var maxChildren=args.maxChildren||2;var maxDepth=args.maxDepth||4;function Node(x,y,w,h,depth){this.x=x;this.y=y;this.w=w;this.h=h;this.depth=depth;this.items=[];this.nodes=[];} 3 | Node.prototype={x:0,y:0,w:0,h:0,depth:0,items:null,nodes:null,exists:function(selector){for(var i=0;i=selector.x&&item.y>=selector.y&&item.x=maxChildren&&this.depth=this.y+ this.h/2){if(callback(BOTTOM_LEFT))return true;}} 11 | if(item.x>=this.x+(this.w/2)){if(item.y=this.y+ this.h/2){if(callback(BOTTOM_RIGHT))return true;}} 13 | return false;},divide:function(){var childrenDepth=this.depth+ 1;var width=(this.w/2);var height=(this.h/2);this.nodes.push(new Node(this.x,this.y,width,height,childrenDepth));this.nodes.push(new Node(this.x+ width,this.y,width,height,childrenDepth));this.nodes.push(new Node(this.x,this.y+ height,width,height,childrenDepth));this.nodes.push(new Node(this.x+ width,this.y+ height,width,height,childrenDepth));var oldChildren=this.items;this.items=[];for(var i=0;i=0){ 22 | console.log('ProxyRequest: ' + request.url); 23 | if(request.url.indexOf("?info")<0){ 24 | var post_data = request.toString(); 25 | var post_options = { 26 | host: 'm.agar.io', 27 | port: '80', 28 | path: '/', 29 | method: 'POST', 30 | headers: { 31 | 'Content-Type': 'application/x-www-form-urlencoded', 32 | 'Content-Length': post_data.length 33 | } 34 | }; 35 | 36 | // Set up the request 37 | var post_req = http.request(post_options, function(res) { 38 | res.setEncoding('utf8'); 39 | res.on('data', function (chunk) { 40 | console.log('PResponse: ' + chunk); 41 | response.writeHead(200, {"Content-Type": "text/plain"}); 42 | response.write(chunk); 43 | response.end(); 44 | }); 45 | }); 46 | 47 | // post the data 48 | post_req.write(post_data); 49 | post_req.end(); 50 | }else{ 51 | http.get("http://m.agar.io/info", function(res) { 52 | // Buffer the body entirely for processing as a whole. 53 | var bodyChunks = []; 54 | res.on('data', function(chunk) { 55 | // You can process streamed parts here... 56 | bodyChunks.push(chunk); 57 | }).on('end', function() { 58 | var body = Buffer.concat(bodyChunks); 59 | console.log("GResponse: " + body); 60 | response.writeHead(200, {"Content-Type": "text/plain"}); 61 | response.write(body); 62 | response.end(); 63 | }) 64 | }).on('error', function(e) { 65 | console.log("GError: " + e.message); 66 | }); 67 | } 68 | 69 | return; 70 | } 71 | 72 | if(!exists) { 73 | response.writeHead(404, {"Content-Type": "text/plain"}); 74 | response.write("404 Not Found\n"); 75 | response.end(); 76 | return; 77 | } 78 | 79 | if (fs.statSync(filename).isDirectory()) filename += '/index.html'; 80 | 81 | fs.readFile(filename, "binary", function(err, file) { 82 | if(err) { 83 | response.writeHead(500, {"Content-Type": "text/plain"}); 84 | response.write(err + "\n"); 85 | response.end(); 86 | return; 87 | } 88 | 89 | var headers = {}; 90 | var contentType = contentTypesByExtension[path.extname(filename)]; 91 | if (contentType) headers["Content-Type"] = contentType; 92 | response.writeHead(200, headers); 93 | response.write(file, "binary"); 94 | response.end(); 95 | }); 96 | }); 97 | }).listen(parseInt(port, 10)); 98 | 99 | console.log("Static file server running at\n => http://localhost:" + port + "/\nCTRL + C to shutdown"); -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Agar.io - Assistant 13 | 14 | 15 | 116 | 117 | 118 |
119 |
120 |
121 | 122 | 126 |
127 |
128 | 129 |
130 |
131 |

Hello

132 |
133 |
134 | 135 |
136 |
137 | 138 |
139 |
140 | 151 | 155 |

156 |
157 |
158 | 159 | 160 |
161 |
162 |
163 |
164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 |
174 |
175 |
176 |
177 |
178 | Move your mouse to control your cell.
179 | Press Space to split.
180 | Press W to eject some mass
181 |
182 | This version is developed for educational purpose only.
183 | Send the pull-request to github
184 | Play the original agar.io 185 |
186 |
187 | 188 |
189 |
190 | Privacy Policy 191 | | 192 | Changelog 193 |
194 |
195 | 196 |
197 |
198 |
199 |
200 |

Skins

201 |
202 |
203 |
204 | 206 |
207 |
208 |
209 |
210 | Set Skin 211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 | 225 |
226 |
227 | 228 | 229 |
 
230 | 231 | 232 | 233 | 234 | 235 | 242 | 243 | 244 | 245 | -------------------------------------------------------------------------------- /main_out.js: -------------------------------------------------------------------------------- 1 | (function(window_, jQuery) { 2 | 3 | var minMass = 100000; 4 | 5 | function init() { 6 | render(); 7 | setInterval(render, 18E4); 8 | canvas = canvas2 = document.getElementById("canvas"); 9 | ctx = canvas.getContext("2d"); 10 | canvas.onmousedown = function(e) { 11 | if (options) { 12 | var z0 = e.clientX - (5 + width / 5 / 2); 13 | var z1 = e.clientY - (5 + width / 5 / 2); 14 | if (Math.sqrt(z0 * z0 + z1 * z1) <= width / 5 / 2) { 15 | sendMousePosition(); 16 | emit(17); 17 | return; 18 | } 19 | } 20 | reset(); 21 | sendMousePosition(); 22 | }; 23 | canvas.onmousemove = function(e) { 24 | mouseX = e.clientX; 25 | mouseY = e.clientY; 26 | reset(); 27 | }; 28 | canvas.onmouseup = function(evt) { 29 | }; 30 | var keySpace = false; 31 | var keyQ = false; 32 | var keyW = false; 33 | window_.onkeydown = function(e) { 34 | if (!(32 != e.keyCode)) { // space 35 | if (!keySpace) { 36 | sendMousePosition(); 37 | emit(17); 38 | keySpace = true; 39 | } 40 | } 41 | if (!(81 != e.keyCode)) { // q 42 | if (!keyQ) { 43 | emit(18); 44 | keyQ = true; 45 | } 46 | } 47 | if (!(87 != e.keyCode)) { // w 48 | if (!keyW) { 49 | sendMousePosition(); 50 | emit(21); 51 | keyW = true; 52 | } 53 | } 54 | 55 | if (!(27 != e.keyCode)) { // esc 56 | jQuery("#overlays").toggle(200); 57 | } 58 | }; 59 | window_.onkeyup = function(event) { 60 | if (32 == event.keyCode) { // space 61 | keySpace = false; 62 | } 63 | if (87 == event.keyCode) { // w 64 | keyW = false; 65 | } 66 | if (81 == event.keyCode) {// q 67 | if (keyQ) { 68 | emit(19); 69 | keyQ = false; 70 | } 71 | } 72 | }; 73 | window_.onblur = function() { 74 | emit(19); 75 | keyW = keyQ = keySpace = false; 76 | }; 77 | window_.onresize = onResize; 78 | onResize(); 79 | if (window_.requestAnimationFrame) { 80 | window_.requestAnimationFrame(anim); 81 | } else { 82 | setInterval(draw, 1E3 / 60); 83 | } 84 | setInterval(sendMousePosition, 100); 85 | setRegion(jQuery("#region").val()); 86 | } 87 | function processData() { 88 | if (0.5 > ratio) { 89 | body = null; 90 | } else { 91 | var minX = Number.POSITIVE_INFINITY; 92 | var minY = Number.POSITIVE_INFINITY; 93 | var maxX = Number.NEGATIVE_INFINITY; 94 | var maxY = Number.NEGATIVE_INFINITY; 95 | var newDuration = 0; 96 | var i = 0; 97 | for (; i < items.length; i++) { 98 | newDuration = Math.max(items[i].size, newDuration); 99 | minX = Math.min(items[i].x, minX); 100 | minY = Math.min(items[i].y, minY); 101 | maxX = Math.max(items[i].x, maxX); 102 | maxY = Math.max(items[i].y, maxY); 103 | } 104 | context = QUAD.init({ 105 | minX: minX - (newDuration + 100), 106 | minY: minY - (newDuration + 100), 107 | maxX: maxX + (newDuration + 100), 108 | maxY: maxY + (newDuration + 100) 109 | }); 110 | 111 | for (i = 0; i < items.length; i++) { 112 | if (minX = items[i], minX.shouldRender()) { 113 | minY = 0; 114 | for (; minY < minX.points.length; ++minY) { 115 | context.insert(minX.points[minY]); 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | function getProxyUrl() 123 | { 124 | return document.location.href.replace(/\/(index\.html|)$/, "")+"/proxy.php"; 125 | } 126 | 127 | function render() { 128 | if (null == old) { 129 | old = {}; 130 | jQuery("#region").children().each(function() { 131 | var option = jQuery(this); 132 | var name = option.val(); 133 | if (name) { 134 | old[name] = option.text(); 135 | } 136 | }); 137 | } 138 | var url; 139 | if(document.location.host == 'localhost' || document.location.host=='agar.io'){ 140 | url = 'http://m.agar.io/info'; 141 | }else{ 142 | url = document.location.href 143 | url = getProxyUrl()+'?info=1'; 144 | } 145 | jQuery.get(url, function(b) { 146 | var name; 147 | for (name in b.regions) { 148 | jQuery('#region option[value="' + name + '"]').text(old[name] + " (" + b.regions[name].numPlayers + " players)"); 149 | } 150 | }, "json"); 151 | } 152 | function setRegion(mat) { 153 | if (mat) { 154 | if (mat != dest) { 155 | dest = mat; 156 | after(); 157 | } 158 | } 159 | } 160 | function next() { 161 | var url; 162 | if(document.location.host == 'localhost' || document.location.host=='agar.io'){ 163 | url = 'http://m.agar.io/'; 164 | }else{ 165 | url = getProxyUrl(); 166 | } 167 | console.log("Find " + dest + gameMode); 168 | jQuery.ajax(url, { 169 | error : function() { 170 | setTimeout(next, 1E3); 171 | }, 172 | success : function(status) { 173 | status = status.split("\n"); 174 | jQuery('#iphack').val(status[0]); 175 | open("ws://" + status[0]); 176 | }, 177 | dataType : "text", 178 | method : "POST", 179 | cache : false, 180 | crossDomain : true, 181 | data : dest + gameMode || "?" 182 | }); 183 | } 184 | function after() { 185 | if(dest) { 186 | jQuery("#connecting").show(); 187 | next(); 188 | } 189 | } 190 | function open(url) { 191 | if (ws) { 192 | ws.onopen = null; 193 | ws.onmessage = null; 194 | ws.onclose = null; 195 | try { 196 | ws.close(); 197 | }catch (e) {} 198 | ws = null; 199 | } 200 | bucket = []; 201 | myPoints = []; 202 | nodes = {}; 203 | items = []; 204 | sprites = []; 205 | elements = []; 206 | img = angles = null; 207 | closingAnimationTime = 0; 208 | console.log("Connecting to " + url); 209 | ws = new WebSocket(url); 210 | ws.binaryType = "arraybuffer"; 211 | ws.onopen = listener; 212 | ws.onmessage = parse; 213 | ws.onclose = report; 214 | ws.onerror = function() { 215 | console.log("socket error"); 216 | }; 217 | } 218 | function listener(data) { 219 | jQuery("#connecting").hide(); 220 | console.log("socket open"); 221 | data = new ArrayBuffer(5); 222 | var view = new DataView(data); 223 | view.setUint8(0, 255); 224 | view.setUint32(1, 1, true); 225 | ws.send(data); 226 | sendNickname(); 227 | } 228 | function report(failing_message) { 229 | console.log("socket close"); 230 | setTimeout(after, 500); 231 | } 232 | function parse(target) { 233 | function encode() { 234 | var utftext = ""; 235 | while(true) { 236 | var c = data.getUint16(i, true); 237 | i += 2; 238 | if (0 == c) { 239 | break; 240 | } 241 | utftext += String.fromCharCode(c); 242 | } 243 | return utftext; 244 | } 245 | var i = 1; 246 | var data = new DataView(target.data); 247 | var seek; 248 | switch(data.getUint8(0)) { 249 | case 16: 250 | run(data); 251 | break; 252 | case 17: 253 | px = data.getFloat32(1, true); 254 | py = data.getFloat32(5, true); 255 | ratio1 = data.getFloat32(9, true); 256 | break; 257 | case 20: 258 | myPoints = []; 259 | bucket = []; 260 | break; 261 | case 32: 262 | bucket.push(data.getUint32(1, true)); 263 | break; 264 | case 49: 265 | if (null != angles) { 266 | break; 267 | } 268 | target = data.getUint32(i, true); 269 | i += 4; 270 | elements = []; 271 | seek = 0; 272 | for (;seek < target;++seek) { 273 | var r = data.getUint32(i, true); 274 | i = i + 4; 275 | elements.push({ 276 | id : r, 277 | name : encode() 278 | }); 279 | } 280 | redraw(); 281 | break; 282 | case 50: 283 | angles = []; 284 | target = data.getUint32(i, true); 285 | i += 4; 286 | seek = 0; 287 | for (;seek < target;++seek) { 288 | angles.push(data.getFloat32(i, true)); 289 | i += 4; 290 | } 291 | redraw(); 292 | break; 293 | case 64: 294 | left = data.getFloat64(1, true); 295 | bottom = data.getFloat64(9, true); 296 | right = data.getFloat64(17, true); 297 | top = data.getFloat64(25, true); 298 | px = (right + left) / 2; 299 | py = (top + bottom) / 2; 300 | ratio1 = 1; 301 | if (myPoints.length == 0) { 302 | px = (right + left) / 2; 303 | py = (top + bottom) / 2; 304 | ratio = ratio1; 305 | } 306 | } 307 | } 308 | function run(d) { 309 | timestamp = +new Date; 310 | var key = Math.random(); 311 | var offset = 1; 312 | aa = false; 313 | var id = d.getUint16(offset, true); 314 | offset = offset + 2; 315 | var pointX = 0; 316 | for (;pointX < id;++pointX) { 317 | var pointY = nodes[d.getUint32(offset, true)]; 318 | var pointSize = nodes[d.getUint32(offset + 4, true)]; 319 | offset = offset + 8; 320 | if (pointY) { 321 | if (pointSize) { 322 | pointSize.destroy(); 323 | pointSize.ox = pointSize.x; 324 | pointSize.oy = pointSize.y; 325 | pointSize.oSize = pointSize.size; 326 | pointSize.nx = pointY.x; 327 | pointSize.ny = pointY.y; 328 | pointSize.nSize = pointSize.size; 329 | pointSize.updateTime = timestamp; 330 | } 331 | } 332 | } 333 | while(true) { 334 | id = d.getUint32(offset, true); 335 | offset += 4; 336 | if (0 == id) { 337 | break; 338 | } 339 | pointX = d.getFloat32(offset, true); 340 | offset = offset + 4; 341 | pointY = d.getFloat32(offset, true); 342 | offset = offset + 4; 343 | pointSize = d.getFloat32(offset, true); 344 | offset = offset + 4; 345 | var colorR = d.getUint8(offset); 346 | offset++; 347 | var colorG = d.getUint8(offset++); 348 | var colorB = d.getUint8(offset++); 349 | var pointColor = (colorR << 16 | colorG << 8 | colorB).toString(16); 350 | for (;6 > pointColor.length;) { 351 | pointColor = "0" + pointColor; 352 | } 353 | pointColor = "#" + pointColor; 354 | var pointName = d.getUint8(offset++); 355 | var pointIsVirus = !!(pointName & 1); 356 | var pointIsAgitated = !!(pointName & 16); 357 | if (pointName & 2) { 358 | offset += 4; 359 | } 360 | if (pointName & 4) { 361 | offset += 8; 362 | } 363 | if (pointName & 8) { 364 | offset += 16; 365 | } 366 | pointName = ""; 367 | while(true){ 368 | var data = d.getUint16(offset, true); 369 | offset = offset + 2; 370 | if (0 == data) { 371 | break; 372 | } 373 | pointName += String.fromCharCode(data); 374 | } 375 | data = null; 376 | if (nodes.hasOwnProperty(id)) { 377 | data = nodes[id]; 378 | data.updatePos(); 379 | data.ox = data.x; 380 | data.oy = data.y; 381 | data.oSize = data.size; 382 | data.color = pointColor; 383 | } else { 384 | data = new Points(id, pointX, pointY, pointSize, pointColor, pointName); 385 | data.pX = pointX; 386 | data.pY = pointY; 387 | } 388 | data.isVirus = pointIsVirus; 389 | data.isAgitated = pointIsAgitated; 390 | data.nx = pointX; 391 | data.ny = pointY; 392 | data.nSize = pointSize; 393 | data.updateCode = key; 394 | data.updateTime = timestamp; 395 | if (-1 != bucket.indexOf(id)) { 396 | if (myPoints.indexOf(data) == -1) { 397 | document.getElementById("overlays").style.display = "none"; 398 | myPoints.push(data); 399 | if (1 == myPoints.length) { 400 | px = data.x; 401 | py = data.y; 402 | } 403 | } 404 | } 405 | } 406 | d.getUint16(offset, true); 407 | offset += 2; 408 | pointY = d.getUint32(offset, true); 409 | offset += 4; 410 | pointX = 0; 411 | for (;pointX < pointY;pointX++) { 412 | id = d.getUint32(offset, true); 413 | offset += 4; 414 | if (nodes[id]) { 415 | nodes[id].updateCode = key; 416 | } 417 | } 418 | pointX = 0; 419 | for (;pointX < items.length;pointX++) { 420 | if (items[pointX].updateCode != key) { 421 | items[pointX--].destroy(); 422 | } 423 | } 424 | if (aa) { 425 | if (0 == myPoints.length) { 426 | jQuery("#overlays").fadeIn(3E3); 427 | } 428 | } 429 | } 430 | function reset() { 431 | mouseX2 = (mouseX - width / 2) / ratio + px; 432 | mouseY2 = (mouseY - height / 2) / ratio + py; 433 | } 434 | 435 | function isConnect() { 436 | return ws != null && ws.readyState == ws.OPEN; 437 | } 438 | 439 | function sendMousePosition() { 440 | if (isConnect()) { 441 | var z0 = mouseX - width / 2; 442 | var z1 = mouseY - height / 2; 443 | 444 | //mouseX2 = z0 / ratio + px; 445 | //mouseY2 = z1 / ratio + px; 446 | 447 | if (!(64 > z0 * z0 + z1 * z1)) { 448 | if (!(val == mouseX2 && min == mouseY2)) { 449 | val = mouseX2; 450 | min = mouseY2; 451 | z0 = new ArrayBuffer(21); 452 | z1 = new DataView(z0); 453 | z1.setUint8(0, 16); 454 | z1.setFloat64(1, mouseX2, true); 455 | z1.setFloat64(9, mouseY2, true); 456 | z1.setUint32(17, 0, true); 457 | ws.send(z0); 458 | } 459 | } 460 | } 461 | } 462 | function sendNickname() { 463 | if (isConnect() && result != null) { 464 | var buf = new ArrayBuffer(1 + 2 * result.length); 465 | var view = new DataView(buf); 466 | view.setUint8(0, 0); 467 | var i = 0; 468 | for (;i < result.length;++i) { 469 | view.setUint16(1 + 2 * i, result.charCodeAt(i), true); 470 | } 471 | ws.send(buf); 472 | } 473 | } 474 | function emit(opt_attributes) { 475 | if (ws != null && ws.readyState == ws.OPEN) { 476 | var buf = new ArrayBuffer(1); 477 | (new DataView(buf)).setUint8(0, opt_attributes); 478 | ws.send(buf); 479 | } 480 | } 481 | function anim() { 482 | draw(); 483 | window_.requestAnimationFrame(anim); 484 | } 485 | function onResize() { 486 | width = window_.innerWidth; 487 | height = window_.innerHeight; 488 | canvas2.width = canvas.width = width; 489 | canvas2.height = canvas.height = height; 490 | draw(); 491 | } 492 | 493 | function build() { 494 | if (myPoints.length != 0) { 495 | var score = 0; 496 | minMass = 10000000; 497 | for (var i = 0 ;i < myPoints.length;i++) { 498 | score += myPoints[i].size; 499 | if(minMass > myPoints[i].size){ 500 | minMass = myPoints[i].size; 501 | } 502 | } 503 | score = Math.pow(Math.min(64 / score, 1), 0.4) * Math.max(height / 1080, width / 1920); 504 | ratio = (9 * ratio + score) / screenRenderSize ; 505 | } 506 | } 507 | function draw() { 508 | var tick = +new Date; 509 | Ba++; 510 | timestamp = +new Date; 511 | if (0 < myPoints.length) { 512 | build(); 513 | var w = 0; 514 | var d = 0; 515 | var i = 0; 516 | for (;i < myPoints.length;i++) { 517 | myPoints[i].updatePos(); 518 | w += myPoints[i].x / myPoints.length; 519 | d += myPoints[i].y / myPoints.length; 520 | } 521 | px = w; 522 | py = d; 523 | ratio1 = ratio; 524 | px = (px + w) / 2; 525 | py = (py + d) / 2; 526 | } else { 527 | px = (29 * px + px) / 30; 528 | py = (29 * py + py) / 30; 529 | ratio = (9 * ratio + ratio) / 10; 530 | } 531 | processData(); 532 | reset(); 533 | ctx.clearRect(0, 0, width, height); 534 | ctx.fillStyle = darkTheme ? "#111111" : "#F2FBFF"; 535 | ctx.fillRect(0, 0, width, height); 536 | ctx.save(); 537 | ctx.strokeStyle = darkTheme ? "#AAAAAA" : "#000000"; 538 | ctx.globalAlpha = 0.2; 539 | ctx.scale(ratio, ratio); 540 | w = width / ratio; 541 | d = height / ratio; 542 | i = -0.5 + ( w / 2 -px) % 50; 543 | for (;i < w;i += 50) { 544 | ctx.beginPath(); 545 | ctx.moveTo(i, 0); 546 | ctx.lineTo(i, d); 547 | ctx.stroke(); 548 | } 549 | i = -0.5 + (-py + d / 2) % 50; 550 | for (;i < d;i += 50) { 551 | ctx.beginPath(); 552 | ctx.moveTo(0, i); 553 | ctx.lineTo(w, i); 554 | ctx.stroke(); 555 | } 556 | ctx.restore(); 557 | 558 | items.sort(function(a, b) { 559 | return a.size == b.size ? a.id - b.id : a.size - b.size; 560 | }); 561 | ctx.save(); 562 | ctx.translate(width / 2, height / 2); 563 | ctx.scale(ratio, ratio); 564 | ctx.translate(-px, -py); 565 | i = 0; 566 | for (;i < sprites.length;i++) { 567 | sprites[i].draw(); 568 | } 569 | i = 0; 570 | for (;i < items.length;i++) { 571 | items[i].draw(); 572 | } 573 | 574 | ctx.restore(); 575 | if (img) { 576 | ctx.drawImage(img, width - img.width - 10, 10); 577 | } 578 | closingAnimationTime = Math.max(closingAnimationTime, getHeight()); 579 | if (0 != closingAnimationTime) { 580 | if (null == button) { 581 | button = new SVGPlotFunction(24, "#FFFFFF"); 582 | } 583 | button.setValue("Score: " + ~~(closingAnimationTime / 100)); 584 | d = button.render(); 585 | w = d.width; 586 | ctx.globalAlpha = 0.2; 587 | ctx.fillStyle = "#000000"; 588 | ctx.fillRect(10, height - 10 - 24 - 10, w + 10, 34); 589 | ctx.globalAlpha = 1; 590 | ctx.drawImage(d, 15, height - 10 - 24 - 5); 591 | 592 | if (null == button2) { 593 | button2 = new SVGPlotFunction(24, "#FFFFFF"); 594 | } 595 | button2.setValue("Server "+gameMode.substr(1)+": " + ws.url); 596 | d = button2.render(); 597 | w = d.width; 598 | ctx.globalAlpha = 0.4; 599 | ctx.fillStyle = "#000000"; 600 | ctx.fillRect(width - w - 20, height - 10 - 24 - 10, w + 10, 34); 601 | ctx.globalAlpha = 1; 602 | ctx.drawImage(d, width - w - 15, height - 10 - 24 - 5); 603 | } 604 | clear(); 605 | tick = +new Date - tick; 606 | if (tick > 1E3 / 60) { 607 | n_players -= 0.01; 608 | } else { 609 | if (tick < 1E3 / 65) { 610 | n_players += 0.01; 611 | } 612 | } 613 | if (0.4 > n_players) { 614 | n_players = 0.4; 615 | } 616 | if (1 < n_players) { 617 | n_players = 1; 618 | } 619 | } 620 | function clear() { 621 | if (options && copy.width) { 622 | var dim = width / 5; 623 | ctx.drawImage(copy, 5, 5, dim, dim); 624 | } 625 | } 626 | function getHeight() { 627 | var value = 0; 628 | var second = 0; 629 | for (;second < myPoints.length;second++) { 630 | value += myPoints[second].nSize * myPoints[second].nSize; 631 | } 632 | return value; 633 | } 634 | function redraw() { 635 | img = null; 636 | if (null != angles || 0 != elements.length) { 637 | if (null != angles || nickName) { 638 | img = document.createElement("canvas"); 639 | var ctx = img.getContext("2d"); 640 | var i = 60; 641 | i = null == angles ? i + 24 * elements.length : i + 180; 642 | var n = Math.min(200, 0.3 * width) / 200; 643 | img.width = 200 * n; 644 | img.height = i * n; 645 | ctx.scale(n, n); 646 | ctx.globalAlpha = 0.4; 647 | ctx.fillStyle = "#000000"; 648 | ctx.fillRect(0, 0, 200, i); 649 | ctx.globalAlpha = 1; 650 | ctx.fillStyle = "#FFFFFF"; 651 | n = "Leaderboard"; 652 | ctx.font = "30px Ubuntu"; 653 | ctx.fillText(n, 100 - ctx.measureText(n).width / 2, 40); 654 | if (null == angles) { 655 | ctx.font = "20px Ubuntu"; 656 | i = 0; 657 | for (;i < elements.length;++i) { 658 | n = elements[i].name || "An unnamed cell"; 659 | if (!nickName) { 660 | n = "An unnamed cell"; 661 | } 662 | if (-1 != bucket.indexOf(elements[i].id)) { 663 | if (myPoints[0].name) { 664 | n = myPoints[0].name; 665 | } 666 | ctx.fillStyle = "#FFAAAA"; 667 | } else { 668 | ctx.fillStyle = "#FFFFFF"; 669 | } 670 | n = i + 1 + ". " + n; 671 | ctx.fillText(n, 100 - ctx.measureText(n).width / 2, 70 + 24 * i); 672 | } 673 | } else { 674 | i = n = 0; 675 | for (;i < angles.length;++i) { 676 | var angEnd = n + angles[i] * Math.PI * 2; 677 | ctx.fillStyle = css[i + 1]; 678 | ctx.beginPath(); 679 | ctx.moveTo(100, 140); 680 | ctx.arc(100, 140, 80, n, angEnd, false); 681 | ctx.fill(); 682 | n = angEnd; 683 | } 684 | } 685 | } 686 | } 687 | } 688 | function Points(id, x, y, size, color, name) { 689 | items.push(this); 690 | nodes[id] = this; 691 | this.id = id; 692 | this.ox = this.x = x; 693 | this.oy = this.y = y; 694 | this.oSize = this.size = size; 695 | this.color = color; 696 | this.points = []; 697 | this.pointsAcc = []; 698 | this.createPoints(); 699 | this.setName(name); 700 | } 701 | function isArray(val) { 702 | val = val.toString(16); 703 | while(val.length < 6) { 704 | val = "0" + val; 705 | } 706 | return "#" + val; 707 | } 708 | function SVGPlotFunction(n, Var, stroke, plot) { 709 | if (n) { 710 | this._size = n; 711 | } 712 | if (Var) { 713 | this._color = Var; 714 | } 715 | this._stroke = !!stroke; 716 | if (plot) { 717 | this._strokeColor = plot; 718 | } 719 | } 720 | //if ("agar.io" != window_.location.hostname && ("localhost" != window_.location.hostname && "10.10.2.13" != window_.location.hostname)) { 721 | // window_.location = "http://agar.io/"; 722 | //} else 723 | { 724 | var canvas2; 725 | var ctx; 726 | var canvas; 727 | var width; 728 | var height; 729 | var context = null; 730 | var ws = null; 731 | var px = 0; 732 | var py = 0; 733 | var bucket = []; 734 | var myPoints = []; 735 | var nodes = {}; 736 | var items = []; 737 | var sprites = []; 738 | var elements = []; 739 | var mouseX = 0; 740 | var mouseY = 0; 741 | var mouseX2 = -1; 742 | var mouseY2 = -1; 743 | var Ba = 0; 744 | var timestamp = 0; 745 | var result = null; 746 | var left = 0; 747 | var bottom = 0; 748 | var right = 1E4; 749 | var top = 1E4; 750 | var ratio = 1; 751 | var ratio1 = 1; 752 | var screenRenderSize = 10; 753 | var dest = null; 754 | var showSkins = true; 755 | var nickName = true; 756 | var isColors = false; 757 | var isRadar = false; 758 | var isTypesHack = false; 759 | var aa = false; 760 | var closingAnimationTime = 0; 761 | 762 | var angles = null; 763 | var css = ["#333333", "#FF3333", "#33FF33", "#3333FF"]; 764 | var darkTheme = false; 765 | var isShowMass = false; 766 | var options = "ontouchstart" in window_ && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 767 | var copy = new Image; 768 | copy.src = "http://agar.io/img/split.png"; 769 | var old = null; 770 | var gameMode = ""; 771 | window_.setNick = function(subKey) { 772 | jQuery("#adsBottom").hide(); 773 | result = subKey; 774 | sendNickname(); 775 | jQuery("#overlays").hide(); 776 | closingAnimationTime = 0; 777 | }; 778 | window_.setRegion = setRegion; 779 | window_.setSkins = function(val) { 780 | showSkins = val; 781 | }; 782 | window_.setNames = function(o2) { 783 | nickName = o2; 784 | }; 785 | window_.setDarkTheme = function(newColor) { 786 | darkTheme = newColor; 787 | }; 788 | window_.setColors = function(data) { 789 | isColors = data; 790 | }; 791 | window_.setRadar = function(data) { 792 | isRadar = data; 793 | }; 794 | window_.setTypesHack = function(data) { 795 | isTypesHack = data; 796 | }; 797 | window_.setScreenHack = function(data) { 798 | if ( data ) { 799 | screenRenderSize = 10.35; 800 | } else { 801 | screenRenderSize = 10; 802 | } 803 | }; 804 | window_.setShowMass = function(val) { 805 | isShowMass = val; 806 | }; 807 | window_.spectate = function () { 808 | emit(1); 809 | jQuery("#adsBottom").hide(); 810 | jQuery("#overlays").hide(); 811 | }; 812 | 813 | window_.setGameMode = function(val) { 814 | if (val != gameMode) { 815 | /** @type {number} */ 816 | gameMode = val; 817 | after(); 818 | } 819 | }; 820 | window_.connect = open; 821 | var val = -1; 822 | var min = -1; 823 | var img = null; 824 | var n_players = 1; 825 | var button = null; 826 | var button2 = null; 827 | var sources = {}; 828 | excludes = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;hitler;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;ussr;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".split(";"); 829 | var names = ["m'blob"]; 830 | Points.prototype = { 831 | id : 0, 832 | points : null, 833 | pointsAcc : null, 834 | name : null, 835 | nameCache : null, 836 | sizeCache : null, 837 | x : 0, 838 | y : 0, 839 | size : 0, 840 | ox : 0, 841 | oy : 0, 842 | oSize : 0, 843 | nx : 0, 844 | ny : 0, 845 | nSize : 0, 846 | updateTime : 0, 847 | updateCode : 0, 848 | drawTime : 0, 849 | destroyed : false, 850 | isVirus : false, 851 | isAgitated : false, 852 | wasSimpleDrawing : true, 853 | destroy : function() { 854 | var i; 855 | i = 0; 856 | for (;i < items.length;i++) { 857 | if (items[i] == this) { 858 | items.splice(i, 1); 859 | break; 860 | } 861 | } 862 | delete nodes[this.id]; 863 | i = myPoints.indexOf(this); 864 | if (i != -1) { 865 | aa = true; 866 | myPoints.splice(i, 1); 867 | } 868 | i = bucket.indexOf(this.id); 869 | if (-1 != i) { 870 | bucket.splice(i, 1); 871 | } 872 | this.destroyed = true; 873 | sprites.push(this); 874 | }, 875 | getNameSize : function() { 876 | return Math.max(~~(0.3 * this.size), 24); 877 | }, 878 | setName : function(name) { 879 | if (this.name = name) { 880 | if (null == this.nameCache) { 881 | this.nameCache = new SVGPlotFunction(this.getNameSize(), "#FFFFFF", true, "#000000"); 882 | } else { 883 | this.nameCache.setSize(this.getNameSize()); 884 | } 885 | this.nameCache.setValue(this.name); 886 | } 887 | }, 888 | createPoints : function() { 889 | var max = this.getNumPoints(); 890 | while(this.points.length > max) { 891 | var i = ~~(Math.random() * this.points.length); 892 | this.points.splice(i, 1); 893 | this.pointsAcc.splice(i, 1); 894 | } 895 | if (0 == this.points.length) { 896 | if (0 < max) { 897 | this.points.push({ 898 | c : this, 899 | v : this.size, 900 | x : this.x, 901 | y : this.y 902 | }); 903 | this.pointsAcc.push(Math.random() - 0.5); 904 | } 905 | } 906 | while(this.points.length < max) { 907 | i = ~~(Math.random() * this.points.length); 908 | var pt = this.points[i]; 909 | this.points.splice(i, 0, { 910 | c : this, 911 | v : pt.v, 912 | x : pt.x, 913 | y : pt.y 914 | }); 915 | this.pointsAcc.splice(i, 0, this.pointsAcc[i]); 916 | } 917 | }, 918 | getNumPoints : function() { 919 | var rh = 10; 920 | if (20 > this.size) { 921 | rh = 5; 922 | } 923 | if (this.isVirus) { 924 | rh = 30; 925 | } 926 | return~~Math.max(this.size * ratio * (this.isVirus ? Math.min(2 * n_players, 1) : n_players), rh); 927 | }, 928 | movePoints : function() { 929 | this.createPoints(); 930 | var points = this.points; 931 | var chars = this.pointsAcc; 932 | var l = points.length; 933 | var i = 0; 934 | for (;i < l;++i) { 935 | var y = chars[(i - 1 + l) % l]; 936 | var v = chars[(i + 1) % l]; 937 | chars[i] += (Math.random() - 0.5) * (this.isAgitated ? 3 : 1); 938 | chars[i] *= 0.7; 939 | if (10 < chars[i]) { 940 | chars[i] = 10; 941 | } 942 | if (-10 > chars[i]) { 943 | chars[i] = -10; 944 | } 945 | chars[i] = (y + v + 8 * chars[i]) / 10; 946 | } 947 | var self = this; 948 | for (i = 0;i < l;++i) { 949 | var value = points[i].v; 950 | y = points[(i - 1 + l) % l].v; 951 | v = points[(i + 1) % l].v; 952 | if (15 < this.size) { 953 | var m = false; 954 | var startX = points[i].x; 955 | var startY = points[i].y; 956 | context.retrieve2(startX - 5, startY - 5, 10, 10, function(vars) { 957 | if (vars.c != self) { 958 | if (25 > (startX - vars.x) * (startX - vars.x) + (startY - vars.y) * (startY - vars.y)) { 959 | m = true; 960 | } 961 | } 962 | }); 963 | if (!m) { 964 | if (points[i].x < left || (points[i].y < bottom || (points[i].x > right || points[i].y > top))) { 965 | m = true; 966 | } 967 | } 968 | if (m) { 969 | if (0 < chars[i]) { 970 | chars[i] = 0; 971 | } 972 | chars[i] -= 1; 973 | } 974 | } 975 | value += chars[i]; 976 | if (value < 0) { 977 | value = 0; 978 | } 979 | if(this.isAgitated){ 980 | value = (19 * value + this.size) / 20; 981 | }else{ 982 | value = (12 * value + this.size) / 13 983 | } 984 | points[i].v = (y + v + 8 * value) / 10; 985 | y = 2 * Math.PI / l; 986 | v = this.points[i].v; 987 | if (this.isVirus) { 988 | if (0 == i % 2) { 989 | v += 5; 990 | } 991 | } 992 | points[i].x = this.x + Math.cos(y * i) * v; 993 | points[i].y = this.y + Math.sin(y * i) * v; 994 | } 995 | }, 996 | updatePos : function() { 997 | var A; 998 | A = (timestamp - this.updateTime) / 120; 999 | A = 0 > A ? 0 : 1 < A ? 1 : A; 1000 | A = A * A * (3 - 2 * A); 1001 | var getNameSize = this.getNameSize(); 1002 | if (this.destroyed && 1 <= A) { 1003 | var idx = sprites.indexOf(this); 1004 | if (-1 != idx) { 1005 | sprites.splice(idx, 1); 1006 | } 1007 | } 1008 | this.x = A * (this.nx - this.ox) + this.ox; 1009 | this.y = A * (this.ny - this.oy) + this.oy; 1010 | this.size = A * (this.nSize - this.oSize) + this.oSize; 1011 | return A; 1012 | }, 1013 | shouldRender : function() { 1014 | if(this.x + this.size + 40 < px - width / 2 / ratio) 1015 | return false; 1016 | if(this.y + this.size + 40 < py - height / 2 / ratio) 1017 | return false; 1018 | if(this.x - this.size - 40 > px + width / 2 / ratio) 1019 | return false; 1020 | if(this.y - this.size - 40 > py + height / 2 / ratio) 1021 | return false; 1022 | return true; 1023 | }, 1024 | draw : function() { 1025 | if (this.shouldRender()) { 1026 | var y_position = !this.isVirus && (!this.isAgitated && 0.5 > ratio); 1027 | if (this.wasSimpleDrawing && !y_position) { 1028 | for (var j = 0;j < this.points.length;j++) { 1029 | this.points[j].v = this.size; 1030 | } 1031 | } 1032 | this.wasSimpleDrawing = y_position; 1033 | ctx.save(); 1034 | this.drawTime = timestamp; 1035 | var key = this.updatePos(); 1036 | if (this.destroyed) { 1037 | ctx.globalAlpha *= 1 - key; 1038 | } 1039 | ctx.lineWidth = 10; 1040 | ctx.lineCap = "round"; 1041 | ctx.lineJoin = this.isVirus ? "mitter" : "round"; 1042 | 1043 | this.movePoints(); 1044 | if (isColors) { 1045 | ctx.fillStyle = "#FFFFFF"; 1046 | ctx.strokeStyle = "#AAAAAA"; 1047 | } else { 1048 | if(isTypesHack) { 1049 | if (myPoints.indexOf(this) != -1) { 1050 | this.color = '#E2FF07'; 1051 | } else if (!this.isVirus && this.size > 14) { 1052 | if (this.size * 0.9 > minMass) { 1053 | this.color = '#FF3107'; 1054 | } else if (this.size < (minMass / 1.414213562) * 0.9) { 1055 | this.color = '#57FF07'; 1056 | } else if (this.size < minMass * 0.9) { 1057 | this.color = '#07FFB0'; 1058 | } else { 1059 | this.color = '#4106FF'; 1060 | } 1061 | } 1062 | } 1063 | ctx.fillStyle = this.color; 1064 | ctx.strokeStyle = this.color; 1065 | } 1066 | 1067 | if (y_position) { 1068 | ctx.beginPath(); 1069 | ctx.arc(this.x, this.y, this.size, 0, 2 * Math.PI, false); 1070 | } else { 1071 | this.movePoints(); 1072 | ctx.beginPath(); 1073 | key = this.getNumPoints(); 1074 | ctx.moveTo(this.points[0].x, this.points[0].y); 1075 | var a = false; 1076 | for (var src = 1;src <= key;src++) { 1077 | var i = src % key; 1078 | ctx.lineTo(this.points[i].x, this.points[i].y); 1079 | } 1080 | } 1081 | ctx.closePath(); 1082 | key = this.name.toLowerCase(); 1083 | src = null; 1084 | if (!this.isAgitated && showSkins && gameMode == "") { 1085 | if (excludes.indexOf(key) != -1) { 1086 | if (!sources.hasOwnProperty(key)) { 1087 | sources[key] = new Image; 1088 | sources[key].src = "http://agar.io/skins/" + key + ".png"; 1089 | } 1090 | if(sources[key].width != 0 && sources[key].complete) { 1091 | src = sources[key]; 1092 | } 1093 | } 1094 | } 1095 | key = src ? -1 != names.indexOf(key) : false; 1096 | if (!y_position) { 1097 | ctx.stroke(); 1098 | } 1099 | ctx.fill(); 1100 | 1101 | 1102 | if (src != null) { 1103 | if (src.width > 0) { 1104 | if (!key) { 1105 | ctx.save(); 1106 | ctx.clip(); 1107 | ctx.drawImage(src, this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size); 1108 | ctx.restore(); 1109 | } 1110 | } 1111 | } 1112 | if (isColors || 15 < this.size) { 1113 | ctx.strokeStyle = "#000000"; 1114 | ctx.globalAlpha *= 0.1; 1115 | ctx.stroke(); 1116 | } 1117 | ctx.globalAlpha = 1; 1118 | if (src != null) { 1119 | if (0 < src.width) { 1120 | if (key) { 1121 | ctx.drawImage(src, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); 1122 | } 1123 | } 1124 | } 1125 | var player = myPoints.indexOf(this) != -1; 1126 | src = ~~this.y; 1127 | if (nickName || player) { 1128 | if (this.name) { 1129 | if (this.nameCache) { 1130 | i = this.nameCache.render(); 1131 | ctx.drawImage(i, ~~this.x - ~~(i.width / 2), src - ~~(i.height / 2)); 1132 | src += i.height / 2 + 4; 1133 | } 1134 | } 1135 | } 1136 | 1137 | 1138 | if (this.size > 11 && isShowMass /*&& player*/) { 1139 | if (this.sizeCache == null) { 1140 | this.sizeCache = new SVGPlotFunction(this.getNameSize() / 2, "#FFFFFF", true, "#000000"); 1141 | } 1142 | this.sizeCache.setSize(this.getNameSize() / 2); 1143 | this.sizeCache.setValue(~~(this.size * this.size / 100)); 1144 | i = this.sizeCache.render(); 1145 | ctx.drawImage(i, ~~this.x - ~~(i.width / 2), src - ~~(i.height / 2)); 1146 | } 1147 | 1148 | // aura 1149 | if( isRadar && !this.isVirus && this.size > minMass*2 && this.size < minMass*4 ) { 1150 | ctx.beginPath(); 1151 | ctx.arc(this.x, this.y, this.size*3.5, 0, 2 * Math.PI); 1152 | ctx.strokeStyle = 'rgba(0, 0, 255, 0.1)'; 1153 | ctx.fillStyle = 'rgba(0, 0, 255, 0.1)'; 1154 | ctx.fill(); 1155 | ctx.stroke(); 1156 | } 1157 | ctx.restore(); 1158 | 1159 | } 1160 | } 1161 | }; 1162 | SVGPlotFunction.prototype = { 1163 | _value : "", 1164 | _color : "#000000", 1165 | _stroke : false, 1166 | _strokeColor : "#000000", 1167 | _size : 16, 1168 | _canvas : null, 1169 | _ctx : null, 1170 | _dirty : false, 1171 | _scale : 1, 1172 | setSize : function(size) { 1173 | if (this._size != size) { 1174 | this._size = size; 1175 | this._dirty = true; 1176 | } 1177 | }, 1178 | setColor : function(color) { 1179 | if (this._color != color) { 1180 | this._color = color; 1181 | this._dirty = true; 1182 | } 1183 | }, 1184 | setStroke : function(stroke) { 1185 | if (this._stroke != stroke) { 1186 | this._stroke = stroke; 1187 | this._dirty = true; 1188 | } 1189 | }, 1190 | setStrokeColor : function(b) { 1191 | if (this._strokeColor != b) { 1192 | this._strokeColor = b; 1193 | this._dirty = true; 1194 | } 1195 | }, 1196 | setValue : function(value) { 1197 | if (value != this._value) { 1198 | this._value = value; 1199 | this._dirty = true; 1200 | } 1201 | }, 1202 | render : function() { 1203 | if (null == this._canvas) { 1204 | this._canvas = document.createElement("canvas"); 1205 | this._ctx = this._canvas.getContext("2d"); 1206 | } 1207 | if (this._dirty) { 1208 | var canvas = this._canvas; 1209 | var ctx = this._ctx; 1210 | var mass = this._value; 1211 | var scale = this._scale; 1212 | var fontSize = this._size; 1213 | var font = fontSize + "px Ubuntu"; 1214 | ctx.font = font; 1215 | var parentWidth = ctx.measureText(mass).width; 1216 | var PX = ~~(0.2 * fontSize); 1217 | canvas.width = (parentWidth + 6) * scale; 1218 | canvas.height = (fontSize + PX) * scale; 1219 | ctx.font = font; 1220 | ctx.scale(scale, scale); 1221 | ctx.globalAlpha = 1; 1222 | ctx.lineWidth = 3; 1223 | ctx.strokeStyle = this._strokeColor; 1224 | ctx.fillStyle = this._color; 1225 | if (this._stroke) { 1226 | ctx.strokeText(mass, 3, fontSize - PX / 2); 1227 | } 1228 | ctx.fillText(mass, 3, fontSize - PX / 2); 1229 | } 1230 | return this._canvas; 1231 | } 1232 | }; 1233 | window_.onload = init; 1234 | } 1235 | })(window, jQuery); 1236 | -------------------------------------------------------------------------------- /fonts/glyphicons-halflings-regular.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /js/jquery.js: -------------------------------------------------------------------------------- 1 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.3",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("