Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mamayaya1
GitHub Repository: mamayaya1/game
Path: blob/main/projects/defend-the-tank/game.js
4626 views
1
var _SETTINGS = {
2
MarketJSGameCenter: {
3
Activator: {
4
Enabled: !1,
5
Position: {
6
Top: "15%",
7
Left: "0"
8
}
9
},
10
API: {
11
Enabled: !1,
12
Log: {
13
Events: {
14
InitializeGame: !0,
15
EndGame: !0,
16
Level: {
17
Begin: !0,
18
End: !0,
19
Win: !0,
20
Lose: !0,
21
Draw: !0
22
}
23
}
24
}
25
}
26
},
27
API: {
28
Enabled: !1,
29
Log: {
30
Events: {
31
InitializeGame: !0,
32
EndGame: !0,
33
Level: {
34
Begin: !0,
35
End: !0,
36
Win: !0,
37
Lose: !0,
38
Draw: !0
39
}
40
}
41
}
42
},
43
Ad: {
44
Mobile: {
45
Preroll: {
46
Enabled: !1,
47
Duration: 5,
48
Width: 300,
49
Height: 250,
50
Rotation: {
51
Enabled: !1,
52
Weight: {
53
MobileAdInGamePreroll: 40,
54
MobileAdInGamePreroll2: 40,
55
MobileAdInGamePreroll3: 20
56
}
57
}
58
},
59
Header: {
60
Enabled: !1,
61
Duration: 5,
62
Width: 320,
63
Height: 50,
64
Rotation: {
65
Enabled: !1,
66
Weight: {
67
MobileAdInGameHeader: 40,
68
MobileAdInGameHeader2: 40,
69
MobileAdInGameHeader3: 20
70
}
71
}
72
},
73
Footer: {
74
Enabled: !1,
75
Duration: 5,
76
Width: 320,
77
Height: 50,
78
Rotation: {
79
Enabled: !1,
80
Weight: {
81
MobileAdInGameFooter: 40,
82
MobileAdInGameFooter2: 40,
83
MobileAdInGameFooter3: 20
84
}
85
}
86
},
87
End: {
88
Enabled: !1,
89
Duration: 1,
90
Width: 300,
91
Height: 250,
92
Rotation: {
93
Enabled: !1,
94
Weight: {
95
MobileAdInGameEnd: 40,
96
MobileAdInGameEnd2: 40,
97
MobileAdInGameEnd3: 20
98
}
99
}
100
}
101
}
102
},
103
Language: {
104
Default: "en"
105
},
106
DeveloperBranding: {
107
Splash: {
108
Enabled: !1
109
},
110
Logo: {
111
Enabled: !1,
112
Link: "https://www.arcadebull.com",
113
LinkEnabled: !1,
114
NewWindow: !0,
115
Width: 166,
116
Height: 61
117
}
118
},
119
Branding: {
120
Splash: {
121
Enabled: !1
122
},
123
Logo: {
124
Enabled: !1,
125
Link: "https://www.arcadebull.com",
126
LinkEnabled: !1,
127
NewWindow: !0,
128
Width: 166,
129
Height: 61
130
}
131
},
132
MoreGames: {
133
Enabled: !1,
134
Link: "https://www.arcadebull.com/",
135
NewWindow: !0
136
},
137
Gamecenter: {
138
Enabled: !1
139
}
140
};
141
var _STRINGS = {
142
Ad: {
143
Mobile: {
144
Preroll: {
145
ReadyIn: "The game is ready in ",
146
Loading: "Your game is loading...",
147
Close: "Close"
148
},
149
Header: {
150
ReadyIn: "The game is ready in ",
151
Loading: "Your game is loading...",
152
Close: "Close"
153
},
154
End: {
155
ReadyIn: "Advertisement ends in ",
156
Loading: "Please wait ...",
157
Close: "Close"
158
}
159
}
160
},
161
Splash: {
162
Loading: "Loading ...",
163
LogoLine1: "Some text here",
164
LogoLine2: "powered by MarketJS",
165
LogoLine3: "none"
166
},
167
Game: {
168
SelectPlayer: "Select Player",
169
Win: "You win!",
170
Lose: "You lose!",
171
Score: "Score",
172
Time: "Time"
173
},
174
Results: {
175
Title: "High score"
176
},
177
UnitStatistics: {
178
Tank: {
179
M1: {
180
HP: 3E3,
181
Armor: 50,
182
Cost: 0,
183
Upgrades: {
184
Cost: {
185
Base: 1E3,
186
Increment: 1E3
187
},
188
HP: {
189
Base: 100,
190
Increment: 10
191
},
192
Armor: {
193
Base: 5,
194
Increment: 2
195
}
196
},
197
Seats: {
198
One: [43, 143],
199
Two: [60, 17],
200
Three: [141, 81]
201
}
202
},
203
M2: {
204
HP: 2E3,
205
Armor: 25,
206
Cost: 1E4,
207
Upgrades: {
208
Cost: {
209
Base: 1E3,
210
Increment: 1E3
211
},
212
HP: {
213
Base: 25,
214
Increment: 5
215
},
216
Armor: {
217
Base: 1,
218
Increment: 2
219
}
220
}
221
},
222
M3: {
223
HP: 2800,
224
Armor: 10,
225
Cost: 3E4,
226
Upgrades: {
227
Cost: {
228
Base: 1E3,
229
Increment: 1E3
230
},
231
HP: {
232
Base: 100,
233
Increment: 10
234
},
235
Armor: {
236
Base: 2,
237
Increment: 2
238
}
239
}
240
}
241
}
242
}
243
};
244
var MobileAdInGamePreroll = {
245
};
246
var MobileAdInGameHeader = {
247
};
248
var MobileAdInGameFooter = {
249
};
250
var MobileAdInGameEnd = {
251
};
252
! function(b, c) {
253
"object" == typeof module && "object" == typeof module.exports ? module.exports = b.document ? c(b, !0) : function(b) {
254
if (!b.document) throw Error("jQuery requires a window with a document");
255
return c(b)
256
} : c(b)
257
}("undefined" != typeof window ? window : this, function(b, c) {
258
function d(b, c) {
259
c = c || A;
260
var v = c.createElement("script");
261
v.text = b;
262
c.head.appendChild(v).parentNode.removeChild(v)
263
}
264
265
function e(b) {
266
var c = !!b && "length" in b && b.length,
267
v = j.type(b);
268
return "function" !== v && !j.isWindow(b) && ("array" === v || 0 === c || "number" == typeof c && 0 < c && c - 1 in b)
269
}
270
271
function f(b, c) {
272
return b.nodeName && b.nodeName.toLowerCase() === c.toLowerCase()
273
}
274
275
function l(b, c, v) {
276
return j.isFunction(c) ? j.grep(b, function(b, x) {
277
return !!c.call(b, x, b) !== v
278
}) : c.nodeType ? j.grep(b, function(b) {
279
return b === c !== v
280
}) : "string" != typeof c ? j.grep(b, function(b) {
281
return -1 < Da.call(c, b) !== v
282
}) : Cc.test(c) ? j.filter(c, b, v) : (c = j.filter(c, b), j.grep(b, function(b) {
283
return -1 < Da.call(c, b) !== v && 1 === b.nodeType
284
}))
285
}
286
287
function q(b, c) {
288
for (;
289
(b = b[c]) && 1 !== b.nodeType;);
290
return b
291
}
292
293
function r(b) {
294
return b
295
}
296
297
function g(b) {
298
throw b;
299
}
300
301
function m(b, c, v, d) {
302
var g;
303
try {
304
b && j.isFunction(g = b.promise) ? g.call(b).done(c).fail(v) : b && j.isFunction(g = b.then) ? g.call(b, c, v) : c.apply(void 0, [b].slice(d))
305
} catch (B) {
306
v.apply(void 0, [B])
307
}
308
}
309
310
function n() {
311
A.removeEventListener("DOMContentLoaded", n);
312
b.removeEventListener("load", n);
313
j.ready()
314
}
315
316
function p() {
317
this.expando = j.expando + p.uid++
318
}
319
320
function s(b, c, v) {
321
var d;
322
if (void 0 === v && 1 === b.nodeType)
323
if (d = "data-" + c.replace(Dc, "-$&").toLowerCase(), v = b.getAttribute(d), "string" == typeof v) {
324
try {
325
v = "true" === v || "false" !== v && ("null" === v ? null : v === +v + "" ? +v : Ec.test(v) ? JSON.parse(v) : v)
326
} catch (g) {}
327
Q.set(b, c, v)
328
} else v = void 0;
329
return v
330
}
331
332
function u(b, c, v, d) {
333
var g, B = 1,
334
f = 20,
335
e = d ? function() {
336
return d.cur()
337
} : function() {
338
return j.css(b, c, "")
339
},
340
m = e(),
341
n = v && v[3] || (j.cssNumber[c] ? "" : "px"),
342
l = (j.cssNumber[c] || "px" !== n && +m) && Ea.exec(j.css(b, c));
343
if (l && l[3] !== n) {
344
n = n || l[3];
345
v = v || [];
346
l = +m || 1;
347
do B = B || ".5", l /= B, j.style(b, c, l + n); while (B !== (B = e() / m) && 1 !== B && --f)
348
}
349
return v && (l = +l || +m || 0, g = v[1] ? l + (v[1] + 1) * v[2] : +v[2], d && (d.unit = n, d.start = l, d.end = g)), g
350
}
351
352
function t(b, c) {
353
for (var v, d, g = [], B = 0, f = b.length; B < f; B++)
354
if (d = b[B], d.style)
355
if (v = d.style.display, c) {
356
if ("none" === v && (g[B] = D.get(d, "display") || null, g[B] || (d.style.display = "")), "" === d.style.display && Ma(d)) {
357
v = g;
358
var e = B,
359
m, n = void 0;
360
m = d.ownerDocument;
361
var l = d.nodeName;
362
m = (d = Ab[l]) ? d : (n = m.body.appendChild(m.createElement(l)), d = j.css(n, "display"), n.parentNode.removeChild(n), "none" === d && (d = "block"), Ab[l] = d, d);
363
v[e] = m
364
}
365
} else "none" !== v && (g[B] = "none", D.set(d, "display", v));
366
for (B = 0; B < f; B++) null != g[B] && (b[B].style.display = g[B]);
367
return b
368
}
369
370
function y(b, c) {
371
var v;
372
return v = "undefined" != typeof b.getElementsByTagName ? b.getElementsByTagName(c || "*") : "undefined" != typeof b.querySelectorAll ? b.querySelectorAll(c || "*") : [], void 0 === c || c && f(b, c) ? j.merge([b], v) : v
373
}
374
375
function G(b, c) {
376
for (var v = 0, d = b.length; v < d; v++) D.set(b[v], "globalEval", !c || D.get(c[v], "globalEval"))
377
}
378
379
function F(b, c, v, d, g) {
380
for (var B, f, e, m, n = c.createDocumentFragment(), l = [], p = 0, s = b.length; p < s; p++)
381
if (B = b[p], B || 0 === B)
382
if ("object" === j.type(B)) j.merge(l, B.nodeType ? [B] : B);
383
else if (Fc.test(B)) {
384
f = f || n.appendChild(c.createElement("div"));
385
e = (Bb.exec(B) || ["", ""])[1].toLowerCase();
386
e = T[e] || T._default;
387
f.innerHTML = e[1] + j.htmlPrefilter(B) + e[2];
388
for (e = e[0]; e--;) f = f.lastChild;
389
j.merge(l, f.childNodes);
390
f = n.firstChild;
391
f.textContent = ""
392
} else l.push(c.createTextNode(B));
393
n.textContent = "";
394
for (p = 0; B = l[p++];)
395
if (d && -1 < j.inArray(B, d)) g && g.push(B);
396
else if (m = j.contains(B.ownerDocument, B), f = y(n.appendChild(B), "script"), m && G(f), v)
397
for (e = 0; B = f[e++];) Cb.test(B.type || "") && v.push(B);
398
return n
399
}
400
401
function J() {
402
return !0
403
}
404
405
function U() {
406
return !1
407
}
408
409
function ma() {
410
try {
411
return A.activeElement
412
} catch (b) {}
413
}
414
415
function P(b, c, v, d, g, f) {
416
var e, m;
417
if ("object" == typeof c) {
418
"string" != typeof v && (d = d || v, v = void 0);
419
for (m in c) P(b, m, v, d, c[m], f);
420
return b
421
}
422
if (null == d && null == g ? (g = v, d = v = void 0) : null == g && ("string" == typeof v ? (g = d, d = void 0) : (g = d, d = v, v = void 0)), !1 === g) g = U;
423
else if (!g) return b;
424
return 1 === f && (e = g, g = function(b) {
425
return j().off(b), e.apply(this, arguments)
426
}, g.guid = e.guid || (e.guid = j.guid++)), b.each(function() {
427
j.event.add(this, c, g, d, v)
428
})
429
}
430
431
function Db(b, c) {
432
return f(b, "table") && f(11 !== c.nodeType ? c : c.firstChild, "tr") ? j(">tbody", b)[0] || b : b
433
}
434
435
function Gc(b) {
436
return b.type = (null !== b.getAttribute("type")) + "/" + b.type, b
437
}
438
439
function Hc(b) {
440
var c = Ic.exec(b.type);
441
return c ? b.type = c[1] : b.removeAttribute("type"), b
442
}
443
444
function Eb(b, c) {
445
var d, g, K, f, e, m;
446
if (1 === c.nodeType) {
447
if (D.hasData(b) && (d = D.access(b), g = D.set(c, d), m = d.events))
448
for (K in delete g.handle, g.events = {}, m) {
449
d = 0;
450
for (g = m[K].length; d < g; d++) j.event.add(c, K, m[K][d])
451
}
452
Q.hasData(b) && (f = Q.access(b), e = j.extend({}, f), Q.set(c, e))
453
}
454
}
455
456
function xa(b, c, v, g) {
457
c = Fb.apply([], c);
458
var K, f, e, m, n = 0,
459
l = b.length,
460
p = l - 1,
461
s = c[0],
462
r = j.isFunction(s);
463
if (r || 1 < l && "string" == typeof s && !H.checkClone && Jc.test(s)) return b.each(function(d) {
464
var j = b.eq(d);
465
r && (c[0] = s.call(this, d, j.html()));
466
xa(j, c, v, g)
467
});
468
if (l && (K = F(c, b[0].ownerDocument, !1, b, g), f = K.firstChild, 1 === K.childNodes.length && (K = f), f || g)) {
469
f = j.map(y(K, "script"), Gc);
470
for (e = f.length; n < l; n++) m = K, n !== p && (m = j.clone(m, !0, !0), e && j.merge(f, y(m, "script"))), v.call(b[n], m, n);
471
if (e) {
472
K = f[f.length - 1].ownerDocument;
473
j.map(f, Hc);
474
for (n = 0; n < e; n++) m = f[n], Cb.test(m.type || "") && !D.access(m, "globalEval") && j.contains(K, m) && (m.src ? j._evalUrl && j._evalUrl(m.src) : d(m.textContent.replace(Lc, ""), K))
475
}
476
}
477
return b
478
}
479
480
function Gb(b, c, d) {
481
for (var g = c ? j.filter(c, b) : b, K = 0; null != (c = g[K]); K++) d || 1 !== c.nodeType || j.cleanData(y(c)), c.parentNode && (d && j.contains(c.ownerDocument, c) && G(y(c, "script")), c.parentNode.removeChild(c));
482
return b
483
}
484
485
function Fa(b, c, d) {
486
var g, K, f, e, m = b.style;
487
return d = d || Na(b), d && (e = d.getPropertyValue(c) || d[c], "" !== e || j.contains(b.ownerDocument, b) || (e = j.style(b, c)), !H.pixelMarginRight() && gb.test(e) && Hb.test(c) && (g = m.width, K = m.minWidth, f = m.maxWidth, m.minWidth = m.maxWidth = m.width = e, e = d.width, m.width = g, m.minWidth = K, m.maxWidth = f)), void 0 !== e ? e + "" : e
488
}
489
490
function Ib(b, c) {
491
return {
492
get: function() {
493
return b() ? void delete this.get : (this.get = c).apply(this, arguments)
494
}
495
}
496
}
497
498
function Jb(b) {
499
var c = j.cssProps[b];
500
if (!c) {
501
var c = j.cssProps,
502
d;
503
a: if (d = b, !(d in Kb)) {
504
for (var g = d[0].toUpperCase() + d.slice(1), K = Lb.length; K--;)
505
if (d = Lb[K] + g, d in Kb) break a;
506
d = void 0
507
}
508
c = c[b] = d || b
509
}
510
return c
511
}
512
513
function Mb(b, c, d) {
514
return (b = Ea.exec(c)) ? Math.max(0, b[2] - (d || 0)) + (b[3] || "px") : c
515
}
516
517
function Nb(b, c, d, g, K) {
518
var e = 0;
519
for (c = d === (g ? "border" : "content") ? 4 : "width" === c ? 1 : 0; 4 > c; c += 2) "margin" === d && (e += j.css(b, d + na[c], !0, K)), g ? ("content" === d && (e -= j.css(b, "padding" + na[c], !0, K)), "margin" !== d && (e -= j.css(b, "border" + na[c] + "Width", !0, K))) : (e += j.css(b, "padding" + na[c], !0, K), "padding" !== d && (e += j.css(b, "border" + na[c] + "Width", !0, K)));
520
return e
521
}
522
523
function Ob(b, c, d) {
524
var g, K = Na(b),
525
e = Fa(b, c, K),
526
f = "border-box" === j.css(b, "boxSizing", !1, K);
527
return gb.test(e) ? e : (g = f && (H.boxSizingReliable() || e === b.style[c]), "auto" === e && (e = b["offset" + c[0].toUpperCase() + c.slice(1)]), e = parseFloat(e) || 0, e + Nb(b, c, d || (f ? "border" : "content"), g, K) + "px")
528
}
529
530
function R(b, c, d, g, j) {
531
return new R.prototype.init(b, c, d, g, j)
532
}
533
534
function hb() {
535
Oa && (!1 === A.hidden && b.requestAnimationFrame ? b.requestAnimationFrame(hb) : b.setTimeout(hb, j.fx.interval), j.fx.tick())
536
}
537
538
function Pb() {
539
return b.setTimeout(function() {
540
ya = void 0
541
}), ya = j.now()
542
}
543
544
function Pa(b, c) {
545
var d, g = 0,
546
j = {
547
height: b
548
};
549
for (c = c ? 1 : 0; 4 > g; g += 2 - c) d = na[g], j["margin" + d] = j["padding" + d] = b;
550
return c && (j.opacity = j.width = b), j
551
}
552
553
function Qb(b, c, d) {
554
for (var g, j = (Z.tweeners[c] || []).concat(Z.tweeners["*"]), e = 0, f = j.length; e < f; e++)
555
if (g = j[e].call(d, c, b)) return g
556
}
557
558
function Z(b, c, d) {
559
var g, e, f = 0,
560
m = Z.prefilters.length,
561
n = j.Deferred().always(function() {
562
delete l.elem
563
}),
564
l = function() {
565
if (e) return !1;
566
for (var c = ya || Pb(), c = Math.max(0, p.startTime + p.duration - c), z = 1 - (c / p.duration || 0), d = 0, v = p.tweens.length; d < v; d++) p.tweens[d].run(z);
567
return n.notifyWith(b, [p, z, c]), 1 > z && v ? c : (v || n.notifyWith(b, [p, 1, 0]), n.resolveWith(b, [p]), !1)
568
},
569
p = n.promise({
570
elem: b,
571
props: j.extend({}, c),
572
opts: j.extend(!0, {
573
specialEasing: {},
574
easing: j.easing._default
575
}, d),
576
originalProperties: c,
577
originalOptions: d,
578
startTime: ya || Pb(),
579
duration: d.duration,
580
tweens: [],
581
createTween: function(c, z) {
582
var d = j.Tween(b, p.opts, c, z, p.opts.specialEasing[c] || p.opts.easing);
583
return p.tweens.push(d), d
584
},
585
stop: function(c) {
586
var z = 0,
587
d = c ? p.tweens.length : 0;
588
if (e) return this;
589
for (e = !0; z < d; z++) p.tweens[z].run(1);
590
return c ? (n.notifyWith(b, [p, 1, 0]), n.resolveWith(b, [p, c])) : n.rejectWith(b, [p, c]), this
591
}
592
});
593
c = p.props;
594
d = p.opts.specialEasing;
595
var s, r, q, u;
596
for (g in c)
597
if (s = j.camelCase(g), r = d[s], q = c[g], Array.isArray(q) && (r = q[1], q = c[g] = q[0]), g !== s && (c[s] = q, delete c[g]), u = j.cssHooks[s], u && "expand" in u)
598
for (g in q = u.expand(q), delete c[s], q) g in c || (c[g] = q[g], d[g] = r);
599
else d[s] = r;
600
for (; f < m; f++)
601
if (g = Z.prefilters[f].call(p, b, c, p.opts)) return j.isFunction(g.stop) && (j._queueHooks(p.elem, p.opts.queue).stop = j.proxy(g.stop, g)), g;
602
return j.map(c, Qb, p), j.isFunction(p.opts.start) && p.opts.start.call(b, p), p.progress(p.opts.progress).done(p.opts.done, p.opts.complete).fail(p.opts.fail).always(p.opts.always), j.fx.timer(j.extend(l, {
603
elem: b,
604
anim: p,
605
queue: p.opts.queue
606
})), p
607
}
608
609
function oa(b) {
610
return (b.match(V) || []).join(" ")
611
}
612
613
function pa(b) {
614
return b.getAttribute && b.getAttribute("class") || ""
615
}
616
617
function ib(b, c, d, g) {
618
var e;
619
if (Array.isArray(c)) j.each(c, function(c, z) {
620
d || Mc.test(b) ? g(b, z) : ib(b + "[" + ("object" == typeof z && null != z ? c : "") + "]", z, d, g)
621
});
622
else if (d || "object" !== j.type(c)) g(b, c);
623
else
624
for (e in c) ib(b + "[" + e + "]", c[e], d, g)
625
}
626
627
function Rb(b) {
628
return function(c, d) {
629
"string" != typeof c && (d = c, c = "*");
630
var g, e = 0,
631
f = c.toLowerCase().match(V) || [];
632
if (j.isFunction(d))
633
for (; g = f[e++];) "+" === g[0] ? (g = g.slice(1) || "*", (b[g] = b[g] || []).unshift(d)) : (b[g] = b[g] || []).push(d)
634
}
635
}
636
637
function Sb(b, c, d, g) {
638
function e(n) {
639
var l;
640
return f[n] = !0, j.each(b[n] || [], function(b, x) {
641
var j = x(c, d, g);
642
return "string" != typeof j || m || f[j] ? m ? !(l = j) : void 0 : (c.dataTypes.unshift(j), e(j), !1)
643
}), l
644
}
645
var f = {},
646
m = b === jb;
647
return e(c.dataTypes[0]) || !f["*"] && e("*")
648
}
649
650
function kb(b, c) {
651
var d, g, e = j.ajaxSettings.flatOptions || {};
652
for (d in c) void 0 !== c[d] && ((e[d] ? b : g || (g = {}))[d] = c[d]);
653
return g && j.extend(!0, b, g), b
654
}
655
var qa = [],
656
A = b.document,
657
Nc = Object.getPrototypeOf,
658
ra = qa.slice,
659
Fb = qa.concat,
660
lb = qa.push,
661
Da = qa.indexOf,
662
Qa = {},
663
Tb = Qa.toString,
664
Ra = Qa.hasOwnProperty,
665
Ub = Ra.toString,
666
Oc = Ub.call(Object),
667
H = {},
668
j = function(b, c) {
669
return new j.fn.init(b, c)
670
},
671
Pc = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
672
Qc = /^-ms-/,
673
Rc = /-([a-z])/g,
674
Sc = function(b, c) {
675
return c.toUpperCase()
676
};
677
j.fn = j.prototype = {
678
jquery: "3.2.1",
679
constructor: j,
680
length: 0,
681
toArray: function() {
682
return ra.call(this)
683
},
684
get: function(b) {
685
return null == b ? ra.call(this) : 0 > b ? this[b + this.length] : this[b]
686
},
687
pushStack: function(b) {
688
b = j.merge(this.constructor(), b);
689
return b.prevObject = this, b
690
},
691
each: function(b) {
692
return j.each(this, b)
693
},
694
map: function(b) {
695
return this.pushStack(j.map(this, function(c, d) {
696
return b.call(c, d, c)
697
}))
698
},
699
slice: function() {
700
return this.pushStack(ra.apply(this, arguments))
701
},
702
first: function() {
703
return this.eq(0)
704
},
705
last: function() {
706
return this.eq(-1)
707
},
708
eq: function(b) {
709
var c = this.length;
710
b = +b + (0 > b ? c : 0);
711
return this.pushStack(0 <= b && b < c ? [this[b]] : [])
712
},
713
end: function() {
714
return this.prevObject || this.constructor()
715
},
716
push: lb,
717
sort: qa.sort,
718
splice: qa.splice
719
};
720
j.extend = j.fn.extend = function() {
721
var b, c, d, g, e, f, m = arguments[0] || {},
722
n = 1,
723
l = arguments.length,
724
p = !1;
725
"boolean" == typeof m && (p = m, m = arguments[n] || {}, n++);
726
"object" == typeof m || j.isFunction(m) || (m = {});
727
for (n === l && (m = this, n--); n < l; n++)
728
if (null != (b = arguments[n]))
729
for (c in b) d = m[c], g = b[c], m !== g && (p && g && (j.isPlainObject(g) || (e = Array.isArray(g))) ? (e ? (e = !1, f = d && Array.isArray(d) ? d : []) : f = d && j.isPlainObject(d) ? d : {}, m[c] = j.extend(p, f, g)) : void 0 !== g && (m[c] = g));
730
return m
731
};
732
j.extend({
733
expando: "jQuery" + ("3.2.1" + Math.random()).replace(/\D/g, ""),
734
isReady: !0,
735
error: function(b) {
736
throw Error(b);
737
},
738
noop: function() {},
739
isFunction: function(b) {
740
return "function" === j.type(b)
741
},
742
isWindow: function(b) {
743
return null != b && b === b.window
744
},
745
isNumeric: function(b) {
746
var c = j.type(b);
747
return ("number" === c || "string" === c) && !isNaN(b - parseFloat(b))
748
},
749
isPlainObject: function(b) {
750
var c, d;
751
return !(!b || "[object Object]" !== Tb.call(b)) && (!(c = Nc(b)) || (d = Ra.call(c, "constructor") && c.constructor, "function" == typeof d && Ub.call(d) === Oc))
752
},
753
isEmptyObject: function(b) {
754
for (var c in b) return !1;
755
return !0
756
},
757
type: function(b) {
758
return null == b ? b + "" : "object" == typeof b || "function" == typeof b ? Qa[Tb.call(b)] || "object" : typeof b
759
},
760
globalEval: function(b) {
761
d(b)
762
},
763
camelCase: function(b) {
764
return b.replace(Qc, "ms-").replace(Rc, Sc)
765
},
766
each: function(b, c) {
767
var d, g = 0;
768
if (e(b))
769
for (d = b.length; g < d && !1 !== c.call(b[g], g, b[g]); g++);
770
else
771
for (g in b)
772
if (!1 === c.call(b[g], g, b[g])) break; return b
773
},
774
trim: function(b) {
775
return null == b ? "" : (b + "").replace(Pc, "")
776
},
777
makeArray: function(b, c) {
778
var d = c || [];
779
return null != b && (e(Object(b)) ? j.merge(d, "string" == typeof b ? [b] : b) : lb.call(d, b)), d
780
},
781
inArray: function(b, c, d) {
782
return null == c ? -1 : Da.call(c, b, d)
783
},
784
merge: function(b, c) {
785
for (var d = +c.length, g = 0, j = b.length; g < d; g++) b[j++] = c[g];
786
return b.length = j, b
787
},
788
grep: function(b, c, d) {
789
for (var g = [], j = 0, e = b.length, f = !d; j < e; j++) d = !c(b[j], j), d !== f && g.push(b[j]);
790
return g
791
},
792
map: function(b, c, d) {
793
var g, j, f = 0,
794
m = [];
795
if (e(b))
796
for (g = b.length; f < g; f++) j = c(b[f], f, d), null != j && m.push(j);
797
else
798
for (f in b) j = c(b[f], f, d), null != j && m.push(j);
799
return Fb.apply([], m)
800
},
801
guid: 1,
802
proxy: function(b, c) {
803
var d, g, e;
804
if ("string" == typeof c && (d = b[c], c = b, b = d), j.isFunction(b)) return g = ra.call(arguments, 2), e = function() {
805
return b.apply(c || this, g.concat(ra.call(arguments)))
806
}, e.guid = b.guid = b.guid || j.guid++, e
807
},
808
now: Date.now,
809
support: H
810
});
811
"function" == typeof Symbol && (j.fn[Symbol.iterator] = qa[Symbol.iterator]);
812
j.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function(b, c) {
813
Qa["[object " + c + "]"] = c.toLowerCase()
814
});
815
var ia, mb = b,
816
E = function(b, c, d, g) {
817
var j, e, f, m, n, l = c && c.ownerDocument,
818
p = c ? c.nodeType : 9;
819
if (d = d || [], "string" != typeof b || !b || 1 !== p && 9 !== p && 11 !== p) return d;
820
if (!g && ((c ? c.ownerDocument || c : W) !== I && ja(c), c = c || I, X)) {
821
if (11 !== p && (m = Tc.exec(b)))
822
if (j = m[1])
823
if (9 === p) {
824
if (!(e = c.getElementById(j))) return d;
825
if (e.id === j) return d.push(e), d
826
} else {
827
if (l && (e = l.getElementById(j)) && Ga(c, e) && e.id === j) return d.push(e), d
828
} else {
829
if (m[2]) return ka.apply(d, c.getElementsByTagName(b)), d;
830
if ((j = m[3]) && M.getElementsByClassName && c.getElementsByClassName) return ka.apply(d, c.getElementsByClassName(j)), d
831
} if (M.qsa && !Sa[b + " "] && (!O || !O.test(b))) {
832
if (1 !== p) l = c, n = b;
833
else if ("object" !== c.nodeName.toLowerCase()) {
834
(f = c.getAttribute("id")) ? f = f.replace(Vb, Wb): c.setAttribute("id", f = N);
835
e = Ha(b);
836
for (j = e.length; j--;) e[j] = "#" + f + " " + Ta(e[j]);
837
n = e.join(",");
838
l = nb.test(b) && ob(c.parentNode) || c
839
}
840
if (n) try {
841
return ka.apply(d, l.querySelectorAll(n)), d
842
} catch (s) {} finally {
843
f === N && c.removeAttribute("id")
844
}
845
}
846
}
847
return Xb(b.replace(Ua, "$1"), c, d, g)
848
},
849
pb = function() {
850
function b(d, g) {
851
return c.push(d + " ") > C.cacheLength && delete b[c.shift()], b[d + " "] = g
852
}
853
var c = [];
854
return b
855
},
856
aa = function(b) {
857
return b[N] = !0, b
858
},
859
ca = function(b) {
860
var c = I.createElement("fieldset");
861
try {
862
return !!b(c)
863
} catch (d) {
864
return !1
865
} finally {
866
c.parentNode && c.parentNode.removeChild(c)
867
}
868
},
869
qb = function(b, c) {
870
for (var d = b.split("|"), g = d.length; g--;) C.attrHandle[d[g]] = c
871
},
872
Yb = function(b, c) {
873
var d = c && b,
874
g = d && 1 === b.nodeType && 1 === c.nodeType && b.sourceIndex - c.sourceIndex;
875
if (g) return g;
876
if (d)
877
for (; d = d.nextSibling;)
878
if (d === c) return -1;
879
return b ? 1 : -1
880
},
881
Uc = function(b) {
882
return function(c) {
883
return "input" === c.nodeName.toLowerCase() && c.type === b
884
}
885
},
886
Vc = function(b) {
887
return function(c) {
888
var d = c.nodeName.toLowerCase();
889
return ("input" === d || "button" === d) && c.type === b
890
}
891
},
892
Zb = function(b) {
893
return function(c) {
894
return "form" in c ? c.parentNode && !1 === c.disabled ? "label" in c ? "label" in c.parentNode ? c.parentNode.disabled === b : c.disabled === b : c.isDisabled === b || c.isDisabled !== !b && Wc(c) === b : c.disabled === b : "label" in c && c.disabled === b
895
}
896
},
897
sa = function(b) {
898
return aa(function(c) {
899
return c = +c, aa(function(d, g) {
900
for (var j, e = b([], d.length, c), f = e.length; f--;) d[j = e[f]] && (d[j] = !(g[j] = d[j]))
901
})
902
})
903
},
904
ob = function(b) {
905
return b && "undefined" != typeof b.getElementsByTagName && b
906
},
907
$b = function() {},
908
Ta = function(b) {
909
for (var c = 0, d = b.length, g = ""; c < d; c++) g += b[c].value;
910
return g
911
},
912
Va = function(b, c, d) {
913
var g = c.dir,
914
j = c.next,
915
e = j || g,
916
f = d && "parentNode" === e,
917
m = Xc++;
918
return c.first ? function(c, d, z) {
919
for (; c = c[g];)
920
if (1 === c.nodeType || f) return b(c, d, z);
921
return !1
922
} : function(c, d, z) {
923
var v, n, l, p = [da, m];
924
if (z)
925
for (; c = c[g];) {
926
if ((1 === c.nodeType || f) && b(c, d, z)) return !0
927
} else
928
for (; c = c[g];)
929
if (1 === c.nodeType || f)
930
if (l = c[N] || (c[N] = {}), n = l[c.uniqueID] || (l[c.uniqueID] = {}), j && j === c.nodeName.toLowerCase()) c = c[g] || c;
931
else {
932
if ((v = n[e]) && v[0] === da && v[1] === m) return p[2] = v[2];
933
if (n[e] = p, p[2] = b(c, d, z)) return !0
934
}
935
return !1
936
}
937
},
938
rb = function(b) {
939
return 1 < b.length ? function(c, d, g) {
940
for (var j = b.length; j--;)
941
if (!b[j](c, d, g)) return !1;
942
return !0
943
} : b[0]
944
},
945
Wa = function(b, c, d, g, j) {
946
for (var e, f = [], m = 0, n = b.length, l = null != c; m < n; m++)(e = b[m]) && (d && !d(e, g, j) || (f.push(e), l && c.push(m)));
947
return f
948
},
949
sb = function(b, c, d, g, j, e) {
950
return g && !g[N] && (g = sb(g)), j && !j[N] && (j = sb(j, e)), aa(function(e, f, m, n) {
951
var B, l, p = [],
952
s = [],
953
r = f.length,
954
q;
955
if (!(q = e)) {
956
q = c || "*";
957
for (var u = m.nodeType ? [m] : m, t = [], y = 0, D = u.length; y < D; y++) E(q, u[y], t);
958
q = t
959
}
960
q = !b || !e && c ? q : Wa(q, p, b, m, n);
961
u = d ? j || (e ? b : r || g) ? [] : f : q;
962
if (d && d(q, u, m, n), g) {
963
B = Wa(u, s);
964
g(B, [], m, n);
965
for (m = B.length; m--;)(l = B[m]) && (u[s[m]] = !(q[s[m]] = l))
966
}
967
if (e) {
968
if (j || b) {
969
if (j) {
970
B = [];
971
for (m = u.length; m--;)(l = u[m]) && B.push(q[m] = l);
972
j(null, u = [], B, n)
973
}
974
for (m = u.length; m--;)(l = u[m]) && -1 < (B = j ? ta(e, l) : p[m]) && (e[B] = !(f[B] = l))
975
}
976
} else u = Wa(u === f ? u.splice(r, u.length) : u), j ? j(null, f, u, n) : ka.apply(f, u)
977
})
978
},
979
tb = function(b) {
980
var c, d, g, j = b.length,
981
e = C.relative[b[0].type];
982
d = e || C.relative[" "];
983
for (var f = e ? 1 : 0, m = Va(function(b) {
984
return b === c
985
}, d, !0), n = Va(function(b) {
986
return -1 < ta(c, b)
987
}, d, !0), l = [
988
function(b, x, d) {
989
b = !e && (d || x !== Xa) || ((c = x).nodeType ? m(b, x, d) : n(b, x, d));
990
return c = null, b
991
}
992
]; f < j; f++)
993
if (d = C.relative[b[f].type]) l = [Va(rb(l), d)];
994
else {
995
if (d = C.filter[b[f].type].apply(null, b[f].matches), d[N]) {
996
for (g = ++f; g < j && !C.relative[b[g].type]; g++);
997
return sb(1 < f && rb(l), 1 < f && Ta(b.slice(0, f - 1).concat({
998
value: " " === b[f - 2].type ? "*" : ""
999
})).replace(Ua, "$1"), d, f < g && tb(b.slice(f, g)), g < j && tb(b = b.slice(g)), g < j && Ta(b))
1000
}
1001
l.push(d)
1002
}
1003
return rb(l)
1004
},
1005
za, M, C, Ya, ac, Ha, ub, Xb, Xa, la, Aa, ja, I, Y, X, O, ua, Za, Ga, N = "sizzle" + 1 * new Date,
1006
W = mb.document,
1007
da = 0,
1008
Xc = 0,
1009
bc = pb(),
1010
cc = pb(),
1011
Sa = pb(),
1012
vb = function(b, c) {
1013
return b === c && (Aa = !0), 0
1014
},
1015
Yc = {}.hasOwnProperty,
1016
va = [],
1017
Zc = va.pop,
1018
$c = va.push,
1019
ka = va.push,
1020
dc = va.slice,
1021
ta = function(b, c) {
1022
for (var d = 0, g = b.length; d < g; d++)
1023
if (b[d] === c) return d;
1024
return -1
1025
},
1026
ad = /[\x20\t\r\n\f]+/g,
1027
Ua = /^[\x20\t\r\n\f]+|((?:^|[^\\])(?:\\.)*)[\x20\t\r\n\f]+$/g,
1028
bd = /^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,
1029
cd = /^[\x20\t\r\n\f]*([>+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,
1030
dd = /=[\x20\t\r\n\f]*([^\]'"]*?)[\x20\t\r\n\f]*\]/g,
1031
ed = RegExp(":((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"),
1032
fd = /^(?:\\.|[\w-]|[^\x00-\xa0])+$/,
1033
$a = {
1034
ID: /^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,
1035
CLASS: /^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,
1036
TAG: /^((?:\\.|[\w-]|[^\x00-\xa0])+|[*])/,
1037
ATTR: RegExp("^\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\]"),
1038
PSEUDO: RegExp("^:((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"),
1039
CHILD: RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)", "i"),
1040
bool: RegExp("^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$", "i"),
1041
needsContext: RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)", "i")
1042
},
1043
gd = /^(?:input|select|textarea|button)$/i,
1044
hd = /^h\d$/i,
1045
Ia = /^[^{]+\{\s*\[native \w/,
1046
Tc = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
1047
nb = /[+~]/,
1048
ea = /\\([\da-f]{1,6}[\x20\t\r\n\f]?|([\x20\t\r\n\f])|.)/ig,
1049
fa = function(b, c, d) {
1050
b = "0x" + c - 65536;
1051
return b !== b || d ? c : 0 > b ? String.fromCharCode(b + 65536) : String.fromCharCode(b >> 10 | 55296, 1023 & b | 56320)
1052
},
1053
Vb = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
1054
Wb = function(b, c) {
1055
return c ? "\x00" === b ? "\ufffd" : b.slice(0, -1) + "\\" + b.charCodeAt(b.length - 1).toString(16) + " " : "\\" + b
1056
},
1057
ec = function() {
1058
ja()
1059
},
1060
Wc = Va(function(b) {
1061
return !0 === b.disabled && ("form" in b || "label" in b)
1062
}, {
1063
dir: "parentNode",
1064
next: "legend"
1065
});
1066
try {
1067
ka.apply(va = dc.call(W.childNodes), W.childNodes), va[W.childNodes.length].nodeType
1068
} catch (Kd) {
1069
ka = {
1070
apply: va.length ? function(b, c) {
1071
$c.apply(b, dc.call(c))
1072
} : function(b, c) {
1073
for (var d = b.length, g = 0; b[d++] = c[g++];);
1074
b.length = d - 1
1075
}
1076
}
1077
}
1078
M = E.support = {};
1079
ac = E.isXML = function(b) {
1080
b = b && (b.ownerDocument || b).documentElement;
1081
return !!b && "HTML" !== b.nodeName
1082
};
1083
ja = E.setDocument = function(b) {
1084
var c, d;
1085
b = b ? b.ownerDocument || b : W;
1086
return b !== I && 9 === b.nodeType && b.documentElement ? (I = b, Y = I.documentElement, X = !ac(I), W !== I && (d = I.defaultView) && d.top !== d && (d.addEventListener ? d.addEventListener("unload", ec, !1) : d.attachEvent && d.attachEvent("onunload", ec)), M.attributes = ca(function(b) {
1087
return b.className = "i", !b.getAttribute("className")
1088
}), M.getElementsByTagName = ca(function(b) {
1089
return b.appendChild(I.createComment("")), !b.getElementsByTagName("*").length
1090
}), M.getElementsByClassName = Ia.test(I.getElementsByClassName), M.getById = ca(function(b) {
1091
return Y.appendChild(b).id = N, !I.getElementsByName || !I.getElementsByName(N).length
1092
}), M.getById ? (C.filter.ID = function(b) {
1093
var c = b.replace(ea, fa);
1094
return function(b) {
1095
return b.getAttribute("id") === c
1096
}
1097
}, C.find.ID = function(b, c) {
1098
if ("undefined" != typeof c.getElementById && X) {
1099
var x = c.getElementById(b);
1100
return x ? [x] : []
1101
}
1102
}) : (C.filter.ID = function(b) {
1103
var c = b.replace(ea, fa);
1104
return function(b) {
1105
return (b = "undefined" != typeof b.getAttributeNode && b.getAttributeNode("id")) && b.value === c
1106
}
1107
}, C.find.ID = function(b, c) {
1108
if ("undefined" != typeof c.getElementById && X) {
1109
var x, d, g, z = c.getElementById(b);
1110
if (z) {
1111
if (x = z.getAttributeNode("id"), x && x.value === b) return [z];
1112
g = c.getElementsByName(b);
1113
for (d = 0; z = g[d++];)
1114
if (x = z.getAttributeNode("id"), x && x.value === b) return [z]
1115
}
1116
return []
1117
}
1118
}), C.find.TAG = M.getElementsByTagName ? function(b, c) {
1119
return "undefined" != typeof c.getElementsByTagName ? c.getElementsByTagName(b) : M.qsa ? c.querySelectorAll(b) : void 0
1120
} : function(b, c) {
1121
var x, d = [],
1122
g = 0,
1123
z = c.getElementsByTagName(b);
1124
if ("*" === b) {
1125
for (; x = z[g++];) 1 === x.nodeType && d.push(x);
1126
return d
1127
}
1128
return z
1129
}, C.find.CLASS = M.getElementsByClassName && function(b, c) {
1130
if ("undefined" != typeof c.getElementsByClassName && X) return c.getElementsByClassName(b)
1131
}, ua = [], O = [], (M.qsa = Ia.test(I.querySelectorAll)) && (ca(function(b) {
1132
Y.appendChild(b).innerHTML = "<a id='" + N + "'></a><select id='" + N + "-\r\\' msallowcapture=''><option selected=''></option></select>";
1133
b.querySelectorAll("[msallowcapture^='']").length && O.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")");
1134
b.querySelectorAll("[selected]").length || O.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)");
1135
b.querySelectorAll("[id~=" + N + "-]").length || O.push("~=");
1136
b.querySelectorAll(":checked").length || O.push(":checked");
1137
b.querySelectorAll("a#" + N + "+*").length || O.push(".#.+[+~]")
1138
}), ca(function(b) {
1139
b.innerHTML = "<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";
1140
var c = I.createElement("input");
1141
c.setAttribute("type", "hidden");
1142
b.appendChild(c).setAttribute("name", "D");
1143
b.querySelectorAll("[name=d]").length && O.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?=");
1144
2 !== b.querySelectorAll(":enabled").length && O.push(":enabled", ":disabled");
1145
Y.appendChild(b).disabled = !0;
1146
2 !== b.querySelectorAll(":disabled").length && O.push(":enabled", ":disabled");
1147
b.querySelectorAll("*,:x");
1148
O.push(",.*:")
1149
})), (M.matchesSelector = Ia.test(Za = Y.matches || Y.webkitMatchesSelector || Y.mozMatchesSelector || Y.oMatchesSelector || Y.msMatchesSelector)) && ca(function(b) {
1150
M.disconnectedMatch = Za.call(b, "*");
1151
Za.call(b, "[s!='']:x");
1152
ua.push("!=", ":((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)")
1153
}), O = O.length && RegExp(O.join("|")), ua = ua.length && RegExp(ua.join("|")), c = Ia.test(Y.compareDocumentPosition), Ga = c || Ia.test(Y.contains) ? function(b, c) {
1154
var x = 9 === b.nodeType ? b.documentElement : b,
1155
d = c && c.parentNode;
1156
return b === d || !(!d || 1 !== d.nodeType || !(x.contains ? x.contains(d) : b.compareDocumentPosition && 16 & b.compareDocumentPosition(d)))
1157
} : function(b, c) {
1158
if (c)
1159
for (; c = c.parentNode;)
1160
if (c === b) return !0;
1161
return !1
1162
}, vb = c ? function(b, c) {
1163
if (b === c) return Aa = !0, 0;
1164
var x = !b.compareDocumentPosition - !c.compareDocumentPosition;
1165
return x ? x : (x = (b.ownerDocument || b) === (c.ownerDocument || c) ? b.compareDocumentPosition(c) : 1, 1 & x || !M.sortDetached && c.compareDocumentPosition(b) === x ? b === I || b.ownerDocument === W && Ga(W, b) ? -1 : c === I || c.ownerDocument === W && Ga(W, c) ? 1 : la ? ta(la, b) - ta(la, c) : 0 : 4 & x ? -1 : 1)
1166
} : function(b, c) {
1167
if (b === c) return Aa = !0, 0;
1168
var x, d = 0;
1169
x = b.parentNode;
1170
var g = c.parentNode,
1171
z = [b],
1172
j = [c];
1173
if (!x || !g) return b === I ? -1 : c === I ? 1 : x ? -1 : g ? 1 : la ? ta(la, b) - ta(la, c) : 0;
1174
if (x === g) return Yb(b, c);
1175
for (x = b; x = x.parentNode;) z.unshift(x);
1176
for (x = c; x = x.parentNode;) j.unshift(x);
1177
for (; z[d] === j[d];) d++;
1178
return d ? Yb(z[d], j[d]) : z[d] === W ? -1 : j[d] === W ? 1 : 0
1179
}, I) : I
1180
};
1181
E.matches = function(b, c) {
1182
return E(b, null, null, c)
1183
};
1184
E.matchesSelector = function(b, c) {
1185
if ((b.ownerDocument || b) !== I && ja(b), c = c.replace(dd, "='$1']"), M.matchesSelector && X && !Sa[c + " "] && (!ua || !ua.test(c)) && (!O || !O.test(c))) try {
1186
var d = Za.call(b, c);
1187
if (d || M.disconnectedMatch || b.document && 11 !== b.document.nodeType) return d
1188
} catch (g) {}
1189
return 0 < E(c, I, null, [b]).length
1190
};
1191
E.contains = function(b, c) {
1192
return (b.ownerDocument || b) !== I && ja(b), Ga(b, c)
1193
};
1194
E.attr = function(b, c) {
1195
(b.ownerDocument || b) !== I && ja(b);
1196
var d = C.attrHandle[c.toLowerCase()],
1197
d = d && Yc.call(C.attrHandle, c.toLowerCase()) ? d(b, c, !X) : void 0;
1198
return void 0 !== d ? d : M.attributes || !X ? b.getAttribute(c) : (d = b.getAttributeNode(c)) && d.specified ? d.value : null
1199
};
1200
E.escape = function(b) {
1201
return (b + "").replace(Vb, Wb)
1202
};
1203
E.error = function(b) {
1204
throw Error("Syntax error, unrecognized expression: " + b);
1205
};
1206
E.uniqueSort = function(b) {
1207
var c, d = [],
1208
g = 0,
1209
j = 0;
1210
if (Aa = !M.detectDuplicates, la = !M.sortStable && b.slice(0), b.sort(vb), Aa) {
1211
for (; c = b[j++];) c === b[j] && (g = d.push(j));
1212
for (; g--;) b.splice(d[g], 1)
1213
}
1214
return la = null, b
1215
};
1216
Ya = E.getText = function(b) {
1217
var c, d = "",
1218
g = 0;
1219
if (c = b.nodeType)
1220
if (1 === c || 9 === c || 11 === c) {
1221
if ("string" == typeof b.textContent) return b.textContent;
1222
for (b = b.firstChild; b; b = b.nextSibling) d += Ya(b)
1223
} else {
1224
if (3 === c || 4 === c) return b.nodeValue
1225
} else
1226
for (; c = b[g++];) d += Ya(c);
1227
return d
1228
};
1229
C = E.selectors = {
1230
cacheLength: 50,
1231
createPseudo: aa,
1232
match: $a,
1233
attrHandle: {},
1234
find: {},
1235
relative: {
1236
">": {
1237
dir: "parentNode",
1238
first: !0
1239
},
1240
" ": {
1241
dir: "parentNode"
1242
},
1243
"+": {
1244
dir: "previousSibling",
1245
first: !0
1246
},
1247
"~": {
1248
dir: "previousSibling"
1249
}
1250
},
1251
preFilter: {
1252
ATTR: function(b) {
1253
return b[1] = b[1].replace(ea, fa), b[3] = (b[3] || b[4] || b[5] || "").replace(ea, fa), "~=" === b[2] && (b[3] = " " + b[3] + " "), b.slice(0, 4)
1254
},
1255
CHILD: function(b) {
1256
return b[1] = b[1].toLowerCase(), "nth" === b[1].slice(0, 3) ? (b[3] || E.error(b[0]), b[4] = +(b[4] ? b[5] + (b[6] || 1) : 2 * ("even" === b[3] || "odd" === b[3])), b[5] = +(b[7] + b[8] || "odd" === b[3])) : b[3] && E.error(b[0]), b
1257
},
1258
PSEUDO: function(b) {
1259
var c, d = !b[6] && b[2];
1260
return $a.CHILD.test(b[0]) ? null : (b[3] ? b[2] = b[4] || b[5] || "" : d && ed.test(d) && (c = Ha(d, !0)) && (c = d.indexOf(")", d.length - c) - d.length) && (b[0] = b[0].slice(0, c), b[2] = d.slice(0, c)), b.slice(0, 3))
1261
}
1262
},
1263
filter: {
1264
TAG: function(b) {
1265
var c = b.replace(ea, fa).toLowerCase();
1266
return "*" === b ? function() {
1267
return !0
1268
} : function(b) {
1269
return b.nodeName && b.nodeName.toLowerCase() === c
1270
}
1271
},
1272
CLASS: function(b) {
1273
var c = bc[b + " "];
1274
return c || (c = RegExp("(^|[\\x20\\t\\r\\n\\f])" + b + "([\\x20\\t\\r\\n\\f]|$)")) && bc(b, function(b) {
1275
return c.test("string" == typeof b.className && b.className || "undefined" != typeof b.getAttribute && b.getAttribute("class") || "")
1276
})
1277
},
1278
ATTR: function(b, c, d) {
1279
return function(g) {
1280
g = E.attr(g, b);
1281
return null == g ? "!=" === c : !c || (g += "", "=" === c ? g === d : "!=" === c ? g !== d : "^=" === c ? d && 0 === g.indexOf(d) : "*=" === c ? d && -1 < g.indexOf(d) : "$=" === c ? d && g.slice(-d.length) === d : "~=" === c ? -1 < (" " + g.replace(ad, " ") + " ").indexOf(d) : "|=" === c && (g === d || g.slice(0, d.length + 1) === d + "-"))
1282
}
1283
},
1284
CHILD: function(b, c, d, g, j) {
1285
var e = "nth" !== b.slice(0, 3),
1286
f = "last" !== b.slice(-4),
1287
m = "of-type" === c;
1288
return 1 === g && 0 === j ? function(b) {
1289
return !!b.parentNode
1290
} : function(c, d, z) {
1291
var v, n, l, p, s, r;
1292
d = e !== f ? "nextSibling" : "previousSibling";
1293
var q = c.parentNode,
1294
u = m && c.nodeName.toLowerCase();
1295
z = !z && !m;
1296
var t = !1;
1297
if (q) {
1298
if (e) {
1299
for (; d;) {
1300
for (p = c; p = p[d];)
1301
if (m ? p.nodeName.toLowerCase() === u : 1 === p.nodeType) return !1;
1302
r = d = "only" === b && !r && "nextSibling"
1303
}
1304
return !0
1305
}
1306
if (r = [f ? q.firstChild : q.lastChild], f && z) {
1307
p = q;
1308
l = p[N] || (p[N] = {});
1309
n = l[p.uniqueID] || (l[p.uniqueID] = {});
1310
v = n[b] || [];
1311
t = (s = v[0] === da && v[1]) && v[2];
1312
for (p = s && q.childNodes[s]; p = ++s && p && p[d] || (t = s = 0) || r.pop();)
1313
if (1 === p.nodeType && ++t && p === c) {
1314
n[b] = [da, s, t];
1315
break
1316
}
1317
} else if (z && (p = c, l = p[N] || (p[N] = {}), n = l[p.uniqueID] || (l[p.uniqueID] = {}), v = n[b] || [], s = v[0] === da && v[1], t = s), !1 === t)
1318
for (;
1319
(p = ++s && p && p[d] || (t = s = 0) || r.pop()) && (!(m ? p.nodeName.toLowerCase() === u : 1 === p.nodeType) || !++t || !(z && (l = p[N] || (p[N] = {}), n = l[p.uniqueID] || (l[p.uniqueID] = {}), n[b] = [da, t]), p === c)););
1320
return t -= j, t === g || 0 === t % g && 0 <= t / g
1321
}
1322
}
1323
},
1324
PSEUDO: function(b, c) {
1325
var d, g = C.pseudos[b] || C.setFilters[b.toLowerCase()] || E.error("unsupported pseudo: " + b);
1326
return g[N] ? g(c) : 1 < g.length ? (d = [b, b, "", c], C.setFilters.hasOwnProperty(b.toLowerCase()) ? aa(function(b, d) {
1327
for (var x, j = g(b, c), v = j.length; v--;) x = ta(b, j[v]), b[x] = !(d[x] = j[v])
1328
}) : function(b) {
1329
return g(b, 0, d)
1330
}) : g
1331
}
1332
},
1333
pseudos: {
1334
not: aa(function(b) {
1335
var c = [],
1336
d = [],
1337
g = ub(b.replace(Ua, "$1"));
1338
return g[N] ? aa(function(b, c, d, x) {
1339
var z;
1340
d = g(b, null, x, []);
1341
for (x = b.length; x--;)(z = d[x]) && (b[x] = !(c[x] = z))
1342
}) : function(b, x, j) {
1343
return c[0] = b, g(c, null, j, d), c[0] = null, !d.pop()
1344
}
1345
}),
1346
has: aa(function(b) {
1347
return function(c) {
1348
return 0 < E(b, c).length
1349
}
1350
}),
1351
contains: aa(function(b) {
1352
return b = b.replace(ea, fa),
1353
function(c) {
1354
return -1 < (c.textContent || c.innerText || Ya(c)).indexOf(b)
1355
}
1356
}),
1357
lang: aa(function(b) {
1358
return fd.test(b || "") || E.error("unsupported lang: " + b), b = b.replace(ea, fa).toLowerCase(),
1359
function(c) {
1360
var d;
1361
do
1362
if (d = X ? c.lang : c.getAttribute("xml:lang") || c.getAttribute("lang")) return d = d.toLowerCase(), d === b || 0 === d.indexOf(b + "-");
1363
while ((c = c.parentNode) && 1 === c.nodeType);
1364
return !1
1365
}
1366
}),
1367
target: function(b) {
1368
var c = mb.location && mb.location.hash;
1369
return c && c.slice(1) === b.id
1370
},
1371
root: function(b) {
1372
return b === Y
1373
},
1374
focus: function(b) {
1375
return b === I.activeElement && (!I.hasFocus || I.hasFocus()) && !(!b.type && !b.href && !~b.tabIndex)
1376
},
1377
enabled: Zb(!1),
1378
disabled: Zb(!0),
1379
checked: function(b) {
1380
var c = b.nodeName.toLowerCase();
1381
return "input" === c && !!b.checked || "option" === c && !!b.selected
1382
},
1383
selected: function(b) {
1384
return b.parentNode && b.parentNode.selectedIndex, !0 === b.selected
1385
},
1386
empty: function(b) {
1387
for (b = b.firstChild; b; b = b.nextSibling)
1388
if (6 > b.nodeType) return !1;
1389
return !0
1390
},
1391
parent: function(b) {
1392
return !C.pseudos.empty(b)
1393
},
1394
header: function(b) {
1395
return hd.test(b.nodeName)
1396
},
1397
input: function(b) {
1398
return gd.test(b.nodeName)
1399
},
1400
button: function(b) {
1401
var c = b.nodeName.toLowerCase();
1402
return "input" === c && "button" === b.type || "button" === c
1403
},
1404
text: function(b) {
1405
var c;
1406
return "input" === b.nodeName.toLowerCase() && "text" === b.type && (null == (c = b.getAttribute("type")) || "text" === c.toLowerCase())
1407
},
1408
first: sa(function() {
1409
return [0]
1410
}),
1411
last: sa(function(b, c) {
1412
return [c - 1]
1413
}),
1414
eq: sa(function(b, c, d) {
1415
return [0 > d ? d + c : d]
1416
}),
1417
even: sa(function(b, c) {
1418
for (var d = 0; d < c; d += 2) b.push(d);
1419
return b
1420
}),
1421
odd: sa(function(b, c) {
1422
for (var d = 1; d < c; d += 2) b.push(d);
1423
return b
1424
}),
1425
lt: sa(function(b, c, d) {
1426
for (c = 0 > d ? d + c : d; 0 <= --c;) b.push(c);
1427
return b
1428
}),
1429
gt: sa(function(b, c, d) {
1430
for (d = 0 > d ? d + c : d; ++d < c;) b.push(d);
1431
return b
1432
})
1433
}
1434
};
1435
C.pseudos.nth = C.pseudos.eq;
1436
for (za in {
1437
radio: !0,
1438
checkbox: !0,
1439
file: !0,
1440
password: !0,
1441
image: !0
1442
}) C.pseudos[za] = Uc(za);
1443
for (za in {
1444
submit: !0,
1445
reset: !0
1446
}) C.pseudos[za] = Vc(za);
1447
$b.prototype = C.filters = C.pseudos;
1448
C.setFilters = new $b;
1449
Ha = E.tokenize = function(b, c) {
1450
var d, g, j, e, f, m, n;
1451
if (f = cc[b + " "]) return c ? 0 : f.slice(0);
1452
f = b;
1453
m = [];
1454
for (n = C.preFilter; f;) {
1455
d && !(g = bd.exec(f)) || (g && (f = f.slice(g[0].length) || f), m.push(j = []));
1456
d = !1;
1457
(g = cd.exec(f)) && (d = g.shift(), j.push({
1458
value: d,
1459
type: g[0].replace(Ua, " ")
1460
}), f = f.slice(d.length));
1461
for (e in C.filter)!(g = $a[e].exec(f)) || n[e] && !(g = n[e](g)) || (d = g.shift(), j.push({
1462
value: d,
1463
type: e,
1464
matches: g
1465
}), f = f.slice(d.length));
1466
if (!d) break
1467
}
1468
return c ? f.length : f ? E.error(b) : cc(b, m).slice(0)
1469
};
1470
ia = (ub = E.compile = function(b, c) {
1471
var d, g = [],
1472
j = [],
1473
e = Sa[b + " "];
1474
if (!e) {
1475
c || (c = Ha(b));
1476
for (d = c.length; d--;) e = tb(c[d]), e[N] ? g.push(e) : j.push(e);
1477
d = Sa;
1478
var f = 0 < g.length,
1479
m = 0 < j.length,
1480
e = function(b, c, d, x, z) {
1481
var e, v, n, l = 0,
1482
p = "0",
1483
B = b && [],
1484
s = [],
1485
r = Xa,
1486
q = b || m && C.find.TAG("*", z),
1487
u = da += null == r ? 1 : Math.random() || 0.1,
1488
t = q.length;
1489
for (z && (Xa = c === I || c || z); p !== t && null != (e = q[p]); p++) {
1490
if (m && e) {
1491
v = 0;
1492
for (c || e.ownerDocument === I || (ja(e), d = !X); n = j[v++];)
1493
if (n(e, c || I, d)) {
1494
x.push(e);
1495
break
1496
}
1497
z && (da = u)
1498
}
1499
f && ((e = !n && e) && l--, b && B.push(e))
1500
}
1501
if (l += p, f && p !== l) {
1502
for (v = 0; n = g[v++];) n(B, s, c, d);
1503
if (b) {
1504
if (0 < l)
1505
for (; p--;) B[p] || s[p] || (s[p] = Zc.call(x));
1506
s = Wa(s)
1507
}
1508
ka.apply(x, s);
1509
z && !b && 0 < s.length && 1 < l + g.length && E.uniqueSort(x)
1510
}
1511
return z && (da = u, Xa = r), B
1512
},
1513
e = f ? aa(e) : e,
1514
e = d(b, e);
1515
e.selector = b
1516
}
1517
return e
1518
}, Xb = E.select = function(b, c, d, g) {
1519
var j, e, f, m, n, l = "function" == typeof b && b,
1520
p = !g && Ha(b = l.selector || b);
1521
if (d = d || [], 1 === p.length) {
1522
if (e = p[0] = p[0].slice(0), 2 < e.length && "ID" === (f = e[0]).type && 9 === c.nodeType && X && C.relative[e[1].type]) {
1523
if (c = (C.find.ID(f.matches[0].replace(ea, fa), c) || [])[0], !c) return d;
1524
l && (c = c.parentNode);
1525
b = b.slice(e.shift().value.length)
1526
}
1527
for (j = $a.needsContext.test(b) ? 0 : e.length; j-- && !(f = e[j], C.relative[m = f.type]);)
1528
if ((n = C.find[m]) && (g = n(f.matches[0].replace(ea, fa), nb.test(e[0].type) && ob(c.parentNode) || c))) {
1529
if (e.splice(j, 1), b = g.length && Ta(e), !b) return ka.apply(d, g), d;
1530
break
1531
}
1532
}
1533
return (l || ub(b, p))(g, c, !X, d, !c || nb.test(b) && ob(c.parentNode) || c), d
1534
}, M.sortStable = N.split("").sort(vb).join("") === N, M.detectDuplicates = !!Aa, ja(), M.sortDetached = ca(function(b) {
1535
return 1 & b.compareDocumentPosition(I.createElement("fieldset"))
1536
}), ca(function(b) {
1537
return b.innerHTML = "<a href='#'></a>", "#" === b.firstChild.getAttribute("href")
1538
}) || qb("type|href|height|width", function(b, c, d) {
1539
if (!d) return b.getAttribute(c, "type" === c.toLowerCase() ? 1 : 2)
1540
}), M.attributes && ca(function(b) {
1541
return b.innerHTML = "<input/>", b.firstChild.setAttribute("value", ""), "" === b.firstChild.getAttribute("value")
1542
}) || qb("value", function(b, c, d) {
1543
if (!d && "input" === b.nodeName.toLowerCase()) return b.defaultValue
1544
}), ca(function(b) {
1545
return null == b.getAttribute("disabled")
1546
}) || qb("checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", function(b, c, d) {
1547
var g;
1548
if (!d) return !0 === b[c] ? c.toLowerCase() : (g = b.getAttributeNode(c)) && g.specified ? g.value : null
1549
}), E);
1550
j.find = ia;
1551
j.expr = ia.selectors;
1552
j.expr[":"] = j.expr.pseudos;
1553
j.uniqueSort = j.unique = ia.uniqueSort;
1554
j.text = ia.getText;
1555
j.isXMLDoc = ia.isXML;
1556
j.contains = ia.contains;
1557
j.escapeSelector = ia.escape;
1558
var Ba = function(b, c, d) {
1559
for (var g = [], e = void 0 !== d;
1560
(b = b[c]) && 9 !== b.nodeType;)
1561
if (1 === b.nodeType) {
1562
if (e && j(b).is(d)) break;
1563
g.push(b)
1564
}
1565
return g
1566
},
1567
fc = function(b, c) {
1568
for (var d = []; b; b = b.nextSibling) 1 === b.nodeType && b !== c && d.push(b);
1569
return d
1570
},
1571
gc = j.expr.match.needsContext,
1572
hc = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,
1573
Cc = /^.[^:#\[\.,]*$/;
1574
j.filter = function(b, c, d) {
1575
var g = c[0];
1576
return d && (b = ":not(" + b + ")"), 1 === c.length && 1 === g.nodeType ? j.find.matchesSelector(g, b) ? [g] : [] : j.find.matches(b, j.grep(c, function(b) {
1577
return 1 === b.nodeType
1578
}))
1579
};
1580
j.fn.extend({
1581
find: function(b) {
1582
var c, d, g = this.length,
1583
e = this;
1584
if ("string" != typeof b) return this.pushStack(j(b).filter(function() {
1585
for (c = 0; c < g; c++)
1586
if (j.contains(e[c], this)) return !0
1587
}));
1588
d = this.pushStack([]);
1589
for (c = 0; c < g; c++) j.find(b, e[c], d);
1590
return 1 < g ? j.uniqueSort(d) : d
1591
},
1592
filter: function(b) {
1593
return this.pushStack(l(this, b || [], !1))
1594
},
1595
not: function(b) {
1596
return this.pushStack(l(this, b || [], !0))
1597
},
1598
is: function(b) {
1599
return !!l(this, "string" == typeof b && gc.test(b) ? j(b) : b || [], !1).length
1600
}
1601
});
1602
var ic, id = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;
1603
(j.fn.init = function(b, c, d) {
1604
var g, e;
1605
if (!b) return this;
1606
if (d = d || ic, "string" == typeof b) {
1607
if (g = "<" === b[0] && ">" === b[b.length - 1] && 3 <= b.length ? [null, b, null] : id.exec(b), !g || !g[1] && c) return !c || c.jquery ? (c || d).find(b) : this.constructor(c).find(b);
1608
if (g[1]) {
1609
if (c = c instanceof j ? c[0] : c, j.merge(this, j.parseHTML(g[1], c && c.nodeType ? c.ownerDocument || c : A, !0)), hc.test(g[1]) && j.isPlainObject(c))
1610
for (g in c) j.isFunction(this[g]) ? this[g](c[g]) : this.attr(g, c[g]);
1611
return this
1612
}
1613
return e = A.getElementById(g[2]), e && (this[0] = e, this.length = 1), this
1614
}
1615
return b.nodeType ? (this[0] = b, this.length = 1, this) : j.isFunction(b) ? void 0 !== d.ready ? d.ready(b) : b(j) : j.makeArray(b, this)
1616
}).prototype = j.fn;
1617
ic = j(A);
1618
var jd = /^(?:parents|prev(?:Until|All))/,
1619
kd = {
1620
children: !0,
1621
contents: !0,
1622
next: !0,
1623
prev: !0
1624
};
1625
j.fn.extend({
1626
has: function(b) {
1627
var c = j(b, this),
1628
d = c.length;
1629
return this.filter(function() {
1630
for (var b = 0; b < d; b++)
1631
if (j.contains(this, c[b])) return !0
1632
})
1633
},
1634
closest: function(b, c) {
1635
var d, g = 0,
1636
e = this.length,
1637
f = [],
1638
m = "string" != typeof b && j(b);
1639
if (!gc.test(b))
1640
for (; g < e; g++)
1641
for (d = this[g]; d && d !== c; d = d.parentNode)
1642
if (11 > d.nodeType && (m ? -1 < m.index(d) : 1 === d.nodeType && j.find.matchesSelector(d, b))) {
1643
f.push(d);
1644
break
1645
}
1646
return this.pushStack(1 < f.length ? j.uniqueSort(f) : f)
1647
},
1648
index: function(b) {
1649
return b ? "string" == typeof b ? Da.call(j(b), this[0]) : Da.call(this, b.jquery ? b[0] : b) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1
1650
},
1651
add: function(b, c) {
1652
return this.pushStack(j.uniqueSort(j.merge(this.get(), j(b, c))))
1653
},
1654
addBack: function(b) {
1655
return this.add(null == b ? this.prevObject : this.prevObject.filter(b))
1656
}
1657
});
1658
j.each({
1659
parent: function(b) {
1660
return (b = b.parentNode) && 11 !== b.nodeType ? b : null
1661
},
1662
parents: function(b) {
1663
return Ba(b, "parentNode")
1664
},
1665
parentsUntil: function(b, c, d) {
1666
return Ba(b, "parentNode", d)
1667
},
1668
next: function(b) {
1669
return q(b, "nextSibling")
1670
},
1671
prev: function(b) {
1672
return q(b, "previousSibling")
1673
},
1674
nextAll: function(b) {
1675
return Ba(b, "nextSibling")
1676
},
1677
prevAll: function(b) {
1678
return Ba(b, "previousSibling")
1679
},
1680
nextUntil: function(b, c, d) {
1681
return Ba(b, "nextSibling", d)
1682
},
1683
prevUntil: function(b, c, d) {
1684
return Ba(b, "previousSibling", d)
1685
},
1686
siblings: function(b) {
1687
return fc((b.parentNode || {}).firstChild, b)
1688
},
1689
children: function(b) {
1690
return fc(b.firstChild)
1691
},
1692
contents: function(b) {
1693
return f(b, "iframe") ? b.contentDocument : (f(b, "template") && (b = b.content || b), j.merge([], b.childNodes))
1694
}
1695
}, function(b, c) {
1696
j.fn[b] = function(d, g) {
1697
var e = j.map(this, c, d);
1698
return "Until" !== b.slice(-5) && (g = d), g && "string" == typeof g && (e = j.filter(g, e)), 1 < this.length && (kd[b] || j.uniqueSort(e), jd.test(b) && e.reverse()), this.pushStack(e)
1699
}
1700
});
1701
var V = /[^\x20\t\r\n\f]+/g;
1702
j.Callbacks = function(b) {
1703
var c;
1704
if ("string" == typeof b) {
1705
var d = {};
1706
c = (j.each(b.match(V) || [], function(b, c) {
1707
d[c] = !0
1708
}), d)
1709
} else c = j.extend({}, b);
1710
b = c;
1711
var g, e, f, m, n = [],
1712
l = [],
1713
p = -1,
1714
s = function() {
1715
m = m || b.once;
1716
for (f = g = !0; l.length; p = -1)
1717
for (e = l.shift(); ++p < n.length;)!1 === n[p].apply(e[0], e[1]) && b.stopOnFalse && (p = n.length, e = !1);
1718
b.memory || (e = !1);
1719
g = !1;
1720
m && (n = e ? [] : "")
1721
},
1722
r = {
1723
add: function() {
1724
return n && (e && !g && (p = n.length - 1, l.push(e)), function Kc(c) {
1725
j.each(c, function(c, d) {
1726
j.isFunction(d) ? b.unique && r.has(d) || n.push(d) : d && d.length && "string" !== j.type(d) && Kc(d)
1727
})
1728
}(arguments), e && !g && s()), this
1729
},
1730
remove: function() {
1731
return j.each(arguments, function(b, c) {
1732
for (var d; - 1 < (d = j.inArray(c, n, d));) n.splice(d, 1), d <= p && p--
1733
}), this
1734
},
1735
has: function(b) {
1736
return b ? -1 < j.inArray(b, n) : 0 < n.length
1737
},
1738
empty: function() {
1739
return n && (n = []), this
1740
},
1741
disable: function() {
1742
return m = l = [], n = e = "", this
1743
},
1744
disabled: function() {
1745
return !n
1746
},
1747
lock: function() {
1748
return m = l = [], e || g || (n = e = ""), this
1749
},
1750
locked: function() {
1751
return !!m
1752
},
1753
fireWith: function(b, c) {
1754
return m || (c = c || [], c = [b, c.slice ? c.slice() : c], l.push(c), g || s()), this
1755
},
1756
fire: function() {
1757
return r.fireWith(this, arguments), this
1758
},
1759
fired: function() {
1760
return !!f
1761
}
1762
};
1763
return r
1764
};
1765
j.extend({
1766
Deferred: function(c) {
1767
var d = [
1768
["notify", "progress", j.Callbacks("memory"), j.Callbacks("memory"), 2],
1769
["resolve", "done", j.Callbacks("once memory"), j.Callbacks("once memory"), 0, "resolved"],
1770
["reject", "fail", j.Callbacks("once memory"), j.Callbacks("once memory"), 1, "rejected"]
1771
],
1772
e = "pending",
1773
f = {
1774
state: function() {
1775
return e
1776
},
1777
always: function() {
1778
return m.done(arguments).fail(arguments), this
1779
},
1780
"catch": function(b) {
1781
return f.then(null, b)
1782
},
1783
pipe: function() {
1784
var b = arguments;
1785
return j.Deferred(function(c) {
1786
j.each(d, function(d, g) {
1787
var x = j.isFunction(b[g[4]]) && b[g[4]];
1788
m[g[1]](function() {
1789
var b = x && x.apply(this, arguments);
1790
b && j.isFunction(b.promise) ? b.promise().progress(c.notify).done(c.resolve).fail(c.reject) : c[g[0] + "With"](this, x ? [b] : arguments)
1791
})
1792
});
1793
b = null
1794
}).promise()
1795
},
1796
then: function(c, x, e) {
1797
function f(c, d, x, e) {
1798
return function() {
1799
var z = this,
1800
v = arguments,
1801
n = function() {
1802
var b, n;
1803
if (!(c < m)) {
1804
if (b = x.apply(z, v), b === d.promise()) throw new TypeError("Thenable self-resolution");
1805
n = b && ("object" == typeof b || "function" == typeof b) && b.then;
1806
j.isFunction(n) ? e ? n.call(b, f(m, d, r, e), f(m, d, g, e)) : (m++, n.call(b, f(m, d, r, e), f(m, d, g, e), f(m, d, r, d.notifyWith))) : (x !== r && (z = void 0, v = [b]), (e || d.resolveWith)(z, v))
1807
}
1808
},
1809
l = e ? n : function() {
1810
try {
1811
n()
1812
} catch (b) {
1813
j.Deferred.exceptionHook && j.Deferred.exceptionHook(b, l.stackTrace), c + 1 >= m && (x !== g && (z = void 0, v = [b]), d.rejectWith(z, v))
1814
}
1815
};
1816
c ? l() : (j.Deferred.getStackHook && (l.stackTrace = j.Deferred.getStackHook()), b.setTimeout(l))
1817
}
1818
}
1819
var m = 0;
1820
return j.Deferred(function(b) {
1821
d[0][3].add(f(0, b, j.isFunction(e) ? e : r, b.notifyWith));
1822
d[1][3].add(f(0, b, j.isFunction(c) ? c : r));
1823
d[2][3].add(f(0, b, j.isFunction(x) ? x : g))
1824
}).promise()
1825
},
1826
promise: function(b) {
1827
return null != b ? j.extend(b, f) : f
1828
}
1829
},
1830
m = {};
1831
return j.each(d, function(b, c) {
1832
var g = c[2],
1833
x = c[5];
1834
f[c[1]] = g.add;
1835
x && g.add(function() {
1836
e = x
1837
}, d[3 - b][2].disable, d[0][2].lock);
1838
g.add(c[3].fire);
1839
m[c[0]] = function() {
1840
return m[c[0] + "With"](this === m ? void 0 : this, arguments), this
1841
};
1842
m[c[0] + "With"] = g.fireWith
1843
}), f.promise(m), c && c.call(m, m), m
1844
},
1845
when: function(b) {
1846
var c = arguments.length,
1847
d = c,
1848
g = Array(d),
1849
e = ra.call(arguments),
1850
f = j.Deferred(),
1851
n = function(b) {
1852
return function(d) {
1853
g[b] = this;
1854
e[b] = 1 < arguments.length ? ra.call(arguments) : d;
1855
--c || f.resolveWith(g, e)
1856
}
1857
};
1858
if (1 >= c && (m(b, f.done(n(d)).resolve, f.reject, !c), "pending" === f.state() || j.isFunction(e[d] && e[d].then))) return f.then();
1859
for (; d--;) m(e[d], n(d), f.reject);
1860
return f.promise()
1861
}
1862
});
1863
var ld = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
1864
j.Deferred.exceptionHook = function(c, d) {
1865
b.console && b.console.warn && c && ld.test(c.name) && b.console.warn("jQuery.Deferred exception: " + c.message, c.stack, d)
1866
};
1867
j.readyException = function(c) {
1868
b.setTimeout(function() {
1869
throw c;
1870
})
1871
};
1872
var wb = j.Deferred();
1873
j.fn.ready = function(b) {
1874
return wb.then(b)["catch"](function(b) {
1875
j.readyException(b)
1876
}), this
1877
};
1878
j.extend({
1879
isReady: !1,
1880
readyWait: 1,
1881
ready: function(b) {
1882
(!0 === b ? --j.readyWait : j.isReady) || (j.isReady = !0, !0 !== b && 0 < --j.readyWait || wb.resolveWith(A, [j]))
1883
}
1884
});
1885
j.ready.then = wb.then;
1886
"complete" === A.readyState || "loading" !== A.readyState && !A.documentElement.doScroll ? b.setTimeout(j.ready) : (A.addEventListener("DOMContentLoaded", n), b.addEventListener("load", n));
1887
var ha = function(b, c, d, g, e, f, m) {
1888
var n = 0,
1889
l = b.length,
1890
p = null == d;
1891
if ("object" === j.type(d))
1892
for (n in e = !0, d) ha(b, c, n, d[n], !0, f, m);
1893
else if (void 0 !== g && (e = !0, j.isFunction(g) || (m = !0), p && (m ? (c.call(b, g), c = null) : (p = c, c = function(b, c, d) {
1894
return p.call(j(b), d)
1895
})), c))
1896
for (; n < l; n++) c(b[n], d, m ? g : g.call(b[n], n, c(b[n], d)));
1897
return e ? b : p ? c.call(b) : l ? c(b[0], d) : f
1898
},
1899
ab = function(b) {
1900
return 1 === b.nodeType || 9 === b.nodeType || !+b.nodeType
1901
};
1902
p.uid = 1;
1903
p.prototype = {
1904
cache: function(b) {
1905
var c = b[this.expando];
1906
return c || (c = {}, ab(b) && (b.nodeType ? b[this.expando] = c : Object.defineProperty(b, this.expando, {
1907
value: c,
1908
configurable: !0
1909
}))), c
1910
},
1911
set: function(b, c, d) {
1912
var g;
1913
b = this.cache(b);
1914
if ("string" == typeof c) b[j.camelCase(c)] = d;
1915
else
1916
for (g in c) b[j.camelCase(g)] = c[g];
1917
return b
1918
},
1919
get: function(b, c) {
1920
return void 0 === c ? this.cache(b) : b[this.expando] && b[this.expando][j.camelCase(c)]
1921
},
1922
access: function(b, c, d) {
1923
return void 0 === c || c && "string" == typeof c && void 0 === d ? this.get(b, c) : (this.set(b, c, d), void 0 !== d ? d : c)
1924
},
1925
remove: function(b, c) {
1926
var d, g = b[this.expando];
1927
if (void 0 !== g) {
1928
if (void 0 !== c) {
1929
Array.isArray(c) ? c = c.map(j.camelCase) : (c = j.camelCase(c), c = c in g ? [c] : c.match(V) || []);
1930
for (d = c.length; d--;) delete g[c[d]]
1931
}(void 0 === c || j.isEmptyObject(g)) && (b.nodeType ? b[this.expando] = void 0 : delete b[this.expando])
1932
}
1933
},
1934
hasData: function(b) {
1935
b = b[this.expando];
1936
return void 0 !== b && !j.isEmptyObject(b)
1937
}
1938
};
1939
var D = new p,
1940
Q = new p,
1941
Ec = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
1942
Dc = /[A-Z]/g;
1943
j.extend({
1944
hasData: function(b) {
1945
return Q.hasData(b) || D.hasData(b)
1946
},
1947
data: function(b, c, d) {
1948
return Q.access(b, c, d)
1949
},
1950
removeData: function(b, c) {
1951
Q.remove(b, c)
1952
},
1953
_data: function(b, c, d) {
1954
return D.access(b, c, d)
1955
},
1956
_removeData: function(b, c) {
1957
D.remove(b, c)
1958
}
1959
});
1960
j.fn.extend({
1961
data: function(b, c) {
1962
var d, g, e, f = this[0],
1963
m = f && f.attributes;
1964
if (void 0 === b) {
1965
if (this.length && (e = Q.get(f), 1 === f.nodeType && !D.get(f, "hasDataAttrs"))) {
1966
for (d = m.length; d--;) m[d] && (g = m[d].name, 0 === g.indexOf("data-") && (g = j.camelCase(g.slice(5)), s(f, g, e[g])));
1967
D.set(f, "hasDataAttrs", !0)
1968
}
1969
return e
1970
}
1971
return "object" == typeof b ? this.each(function() {
1972
Q.set(this, b)
1973
}) : ha(this, function(c) {
1974
var d;
1975
if (f && void 0 === c) {
1976
if ((d = Q.get(f, b), void 0 !== d) || (d = s(f, b), void 0 !== d)) return d
1977
} else this.each(function() {
1978
Q.set(this, b, c)
1979
})
1980
}, null, c, 1 < arguments.length, null, !0)
1981
},
1982
removeData: function(b) {
1983
return this.each(function() {
1984
Q.remove(this, b)
1985
})
1986
}
1987
});
1988
j.extend({
1989
queue: function(b, c, d) {
1990
var g;
1991
if (b) return c = (c || "fx") + "queue", g = D.get(b, c), d && (!g || Array.isArray(d) ? g = D.access(b, c, j.makeArray(d)) : g.push(d)), g || []
1992
},
1993
dequeue: function(b, c) {
1994
c = c || "fx";
1995
var d = j.queue(b, c),
1996
g = d.length,
1997
e = d.shift(),
1998
f = j._queueHooks(b, c),
1999
m = function() {
2000
j.dequeue(b, c)
2001
};
2002
"inprogress" === e && (e = d.shift(), g--);
2003
e && ("fx" === c && d.unshift("inprogress"), delete f.stop, e.call(b, m, f));
2004
!g && f && f.empty.fire()
2005
},
2006
_queueHooks: function(b, c) {
2007
var d = c + "queueHooks";
2008
return D.get(b, d) || D.access(b, d, {
2009
empty: j.Callbacks("once memory").add(function() {
2010
D.remove(b, [c + "queue", d])
2011
})
2012
})
2013
}
2014
});
2015
j.fn.extend({
2016
queue: function(b, c) {
2017
var d = 2;
2018
return "string" != typeof b && (c = b, b = "fx", d--), arguments.length < d ? j.queue(this[0], b) : void 0 === c ? this : this.each(function() {
2019
var d = j.queue(this, b, c);
2020
j._queueHooks(this, b);
2021
"fx" === b && "inprogress" !== d[0] && j.dequeue(this, b)
2022
})
2023
},
2024
dequeue: function(b) {
2025
return this.each(function() {
2026
j.dequeue(this, b)
2027
})
2028
},
2029
clearQueue: function(b) {
2030
return this.queue(b || "fx", [])
2031
},
2032
promise: function(b, c) {
2033
var d, g = 1,
2034
e = j.Deferred(),
2035
f = this,
2036
m = this.length,
2037
n = function() {
2038
--g || e.resolveWith(f, [f])
2039
};
2040
"string" != typeof b && (c = b, b = void 0);
2041
for (b = b || "fx"; m--;)(d = D.get(f[m], b + "queueHooks")) && d.empty && (g++, d.empty.add(n));
2042
return n(), e.promise(c)
2043
}
2044
});
2045
var jc = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
2046
Ea = RegExp("^(?:([+-])=|)(" + jc + ")([a-z%]*)$", "i"),
2047
na = ["Top", "Right", "Bottom", "Left"],
2048
Ma = function(b, c) {
2049
return b = c || b, "none" === b.style.display || "" === b.style.display && j.contains(b.ownerDocument, b) && "none" === j.css(b, "display")
2050
},
2051
kc = function(b, c, d, g) {
2052
var e, j = {};
2053
for (e in c) j[e] = b.style[e], b.style[e] = c[e];
2054
d = d.apply(b, g || []);
2055
for (e in c) b.style[e] = j[e];
2056
return d
2057
},
2058
Ab = {};
2059
j.fn.extend({
2060
show: function() {
2061
return t(this, !0)
2062
},
2063
hide: function() {
2064
return t(this)
2065
},
2066
toggle: function(b) {
2067
return "boolean" == typeof b ? b ? this.show() : this.hide() : this.each(function() {
2068
Ma(this) ? j(this).show() : j(this).hide()
2069
})
2070
}
2071
});
2072
var lc = /^(?:checkbox|radio)$/i,
2073
Bb = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i,
2074
Cb = /^$|\/(?:java|ecma)script/i,
2075
T = {
2076
option: [1, "<select multiple='multiple'>", "</select>"],
2077
thead: [1, "<table>", "</table>"],
2078
col: [2, "<table><colgroup>", "</colgroup></table>"],
2079
tr: [2, "<table><tbody>", "</tbody></table>"],
2080
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
2081
_default: [0, "", ""]
2082
};
2083
T.optgroup = T.option;
2084
T.tbody = T.tfoot = T.colgroup = T.caption = T.thead;
2085
T.th = T.td;
2086
var Fc = /<|&#?\w+;/,
2087
bb = A.createDocumentFragment().appendChild(A.createElement("div")),
2088
cb = A.createElement("input");
2089
cb.setAttribute("type", "radio");
2090
cb.setAttribute("checked", "checked");
2091
cb.setAttribute("name", "t");
2092
bb.appendChild(cb);
2093
H.checkClone = bb.cloneNode(!0).cloneNode(!0).lastChild.checked;
2094
bb.innerHTML = "<textarea>x</textarea>";
2095
H.noCloneChecked = !!bb.cloneNode(!0).lastChild.defaultValue;
2096
!0;
2097
var db = A.documentElement,
2098
md = /^key/,
2099
nd = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
2100
mc = /^([^.]*)(?:\.(.+)|)/;
2101
j.event = {
2102
global: {},
2103
add: function(b, c, d, g, e) {
2104
var f, m, n, l, p, s, r, q, u, t;
2105
if (p = D.get(b)) {
2106
d.handler && (f = d, d = f.handler, e = f.selector);
2107
e && j.find.matchesSelector(db, e);
2108
d.guid || (d.guid = j.guid++);
2109
(l = p.events) || (l = p.events = {});
2110
(m = p.handle) || (m = p.handle = function(c) {
2111
return "undefined" != typeof j && j.event.triggered !== c.type ? j.event.dispatch.apply(b, arguments) : void 0
2112
});
2113
c = (c || "").match(V) || [""];
2114
for (p = c.length; p--;) n = mc.exec(c[p]) || [], u = t = n[1], n = (n[2] || "").split(".").sort(), u && (r = j.event.special[u] || {}, u = (e ? r.delegateType : r.bindType) || u, r = j.event.special[u] || {}, s = j.extend({
2115
type: u,
2116
origType: t,
2117
data: g,
2118
handler: d,
2119
guid: d.guid,
2120
selector: e,
2121
needsContext: e && j.expr.match.needsContext.test(e),
2122
namespace: n.join(".")
2123
}, f), (q = l[u]) || (q = l[u] = [], q.delegateCount = 0, r.setup && !1 !== r.setup.call(b, g, n, m) || b.addEventListener && b.addEventListener(u, m)), r.add && (r.add.call(b, s), s.handler.guid || (s.handler.guid = d.guid)), e ? q.splice(q.delegateCount++, 0, s) : q.push(s), j.event.global[u] = !0)
2124
}
2125
},
2126
remove: function(b, c, d, g, e) {
2127
var f, m, n, l, p, s, r, q, u, t, y, C = D.hasData(b) && D.get(b);
2128
if (C && (l = C.events)) {
2129
c = (c || "").match(V) || [""];
2130
for (p = c.length; p--;)
2131
if (n = mc.exec(c[p]) || [], u = y = n[1], t = (n[2] || "").split(".").sort(), u) {
2132
r = j.event.special[u] || {};
2133
u = (g ? r.delegateType : r.bindType) || u;
2134
q = l[u] || [];
2135
n = n[2] && RegExp("(^|\\.)" + t.join("\\.(?:.*\\.|)") + "(\\.|$)");
2136
for (m = f = q.length; f--;) s = q[f], !e && y !== s.origType || d && d.guid !== s.guid || n && !n.test(s.namespace) || g && g !== s.selector && ("**" !== g || !s.selector) || (q.splice(f, 1), s.selector && q.delegateCount--, r.remove && r.remove.call(b, s));
2137
m && !q.length && (r.teardown && !1 !== r.teardown.call(b, t, C.handle) || j.removeEvent(b, u, C.handle), delete l[u])
2138
} else
2139
for (u in l) j.event.remove(b, u + c[p], d, g, !0);
2140
j.isEmptyObject(l) && D.remove(b, "handle events")
2141
}
2142
},
2143
dispatch: function(b) {
2144
var c = j.event.fix(b),
2145
d, g, e, f, m, n, l = Array(arguments.length);
2146
g = (D.get(this, "events") || {})[c.type] || [];
2147
var p = j.event.special[c.type] || {};
2148
l[0] = c;
2149
for (d = 1; d < arguments.length; d++) l[d] = arguments[d];
2150
if (c.delegateTarget = this, !p.preDispatch || !1 !== p.preDispatch.call(this, c)) {
2151
n = j.event.handlers.call(this, c, g);
2152
for (d = 0;
2153
(f = n[d++]) && !c.isPropagationStopped();) {
2154
c.currentTarget = f.elem;
2155
for (g = 0;
2156
(m = f.handlers[g++]) && !c.isImmediatePropagationStopped();) c.rnamespace && !c.rnamespace.test(m.namespace) || (c.handleObj = m, c.data = m.data, e = ((j.event.special[m.origType] || {}).handle || m.handler).apply(f.elem, l), void 0 !== e && !1 === (c.result = e) && (c.preventDefault(), c.stopPropagation()))
2157
}
2158
return p.postDispatch && p.postDispatch.call(this, c), c.result
2159
}
2160
},
2161
handlers: function(b, c) {
2162
var d, g, e, f, m, n = [],
2163
l = c.delegateCount,
2164
p = b.target;
2165
if (l && p.nodeType && !("click" === b.type && 1 <= b.button))
2166
for (; p !== this; p = p.parentNode || this)
2167
if (1 === p.nodeType && ("click" !== b.type || !0 !== p.disabled)) {
2168
f = [];
2169
m = {};
2170
for (d = 0; d < l; d++) g = c[d], e = g.selector + " ", void 0 === m[e] && (m[e] = g.needsContext ? -1 < j(e, this).index(p) : j.find(e, this, null, [p]).length), m[e] && f.push(g);
2171
f.length && n.push({
2172
elem: p,
2173
handlers: f
2174
})
2175
}
2176
return p = this, l < c.length && n.push({
2177
elem: p,
2178
handlers: c.slice(l)
2179
}), n
2180
},
2181
addProp: function(b, c) {
2182
Object.defineProperty(j.Event.prototype, b, {
2183
enumerable: !0,
2184
configurable: !0,
2185
get: j.isFunction(c) ? function() {
2186
if (this.originalEvent) return c(this.originalEvent)
2187
} : function() {
2188
if (this.originalEvent) return this.originalEvent[b]
2189
},
2190
set: function(c) {
2191
Object.defineProperty(this, b, {
2192
enumerable: !0,
2193
configurable: !0,
2194
writable: !0,
2195
value: c
2196
})
2197
}
2198
})
2199
},
2200
fix: function(b) {
2201
return b[j.expando] ? b : new j.Event(b)
2202
},
2203
special: {
2204
load: {
2205
noBubble: !0
2206
},
2207
focus: {
2208
trigger: function() {
2209
if (this !== ma() && this.focus) return this.focus(), !1
2210
},
2211
delegateType: "focusin"
2212
},
2213
blur: {
2214
trigger: function() {
2215
if (this === ma() && this.blur) return this.blur(), !1
2216
},
2217
delegateType: "focusout"
2218
},
2219
click: {
2220
trigger: function() {
2221
if ("checkbox" === this.type && this.click && f(this, "input")) return this.click(), !1
2222
},
2223
_default: function(b) {
2224
return f(b.target, "a")
2225
}
2226
},
2227
beforeunload: {
2228
postDispatch: function(b) {
2229
void 0 !== b.result && b.originalEvent && (b.originalEvent.returnValue = b.result)
2230
}
2231
}
2232
}
2233
};
2234
j.removeEvent = function(b, c, d) {
2235
b.removeEventListener && b.removeEventListener(c, d)
2236
};
2237
j.Event = function(b, c) {
2238
return this instanceof j.Event ? (b && b.type ? (this.originalEvent = b, this.type = b.type, this.isDefaultPrevented = b.defaultPrevented || void 0 === b.defaultPrevented && !1 === b.returnValue ? J : U, this.target = b.target && 3 === b.target.nodeType ? b.target.parentNode : b.target, this.currentTarget = b.currentTarget, this.relatedTarget = b.relatedTarget) : this.type = b, c && j.extend(this, c), this.timeStamp = b && b.timeStamp || j.now(), void(this[j.expando] = !0)) : new j.Event(b, c)
2239
};
2240
j.Event.prototype = {
2241
constructor: j.Event,
2242
isDefaultPrevented: U,
2243
isPropagationStopped: U,
2244
isImmediatePropagationStopped: U,
2245
isSimulated: !1,
2246
preventDefault: function() {
2247
var b = this.originalEvent;
2248
this.isDefaultPrevented = J;
2249
b && !this.isSimulated && b.preventDefault()
2250
},
2251
stopPropagation: function() {
2252
var b = this.originalEvent;
2253
this.isPropagationStopped = J;
2254
b && !this.isSimulated && b.stopPropagation()
2255
},
2256
stopImmediatePropagation: function() {
2257
var b = this.originalEvent;
2258
this.isImmediatePropagationStopped = J;
2259
b && !this.isSimulated && b.stopImmediatePropagation();
2260
this.stopPropagation()
2261
}
2262
};
2263
j.each({
2264
altKey: !0,
2265
bubbles: !0,
2266
cancelable: !0,
2267
changedTouches: !0,
2268
ctrlKey: !0,
2269
detail: !0,
2270
eventPhase: !0,
2271
metaKey: !0,
2272
pageX: !0,
2273
pageY: !0,
2274
shiftKey: !0,
2275
view: !0,
2276
"char": !0,
2277
charCode: !0,
2278
key: !0,
2279
keyCode: !0,
2280
button: !0,
2281
buttons: !0,
2282
clientX: !0,
2283
clientY: !0,
2284
offsetX: !0,
2285
offsetY: !0,
2286
pointerId: !0,
2287
pointerType: !0,
2288
screenX: !0,
2289
screenY: !0,
2290
targetTouches: !0,
2291
toElement: !0,
2292
touches: !0,
2293
which: function(b) {
2294
var c = b.button;
2295
return null == b.which && md.test(b.type) ? null != b.charCode ? b.charCode : b.keyCode : !b.which && void 0 !== c && nd.test(b.type) ? 1 & c ? 1 : 2 & c ? 3 : 4 & c ? 2 : 0 : b.which
2296
}
2297
}, j.event.addProp);
2298
j.each({
2299
mouseenter: "mouseover",
2300
mouseleave: "mouseout",
2301
pointerenter: "pointerover",
2302
pointerleave: "pointerout"
2303
}, function(b, c) {
2304
j.event.special[b] = {
2305
delegateType: c,
2306
bindType: c,
2307
handle: function(b) {
2308
var d, g = b.relatedTarget,
2309
e = b.handleObj;
2310
return g && (g === this || j.contains(this, g)) || (b.type = e.origType, d = e.handler.apply(this, arguments), b.type = c), d
2311
}
2312
}
2313
});
2314
j.fn.extend({
2315
on: function(b, c, d, g) {
2316
return P(this, b, c, d, g)
2317
},
2318
one: function(b, c, d, g) {
2319
return P(this, b, c, d, g, 1)
2320
},
2321
off: function(b, c, d) {
2322
var g, e;
2323
if (b && b.preventDefault && b.handleObj) return g = b.handleObj, j(b.delegateTarget).off(g.namespace ? g.origType + "." + g.namespace : g.origType, g.selector, g.handler), this;
2324
if ("object" == typeof b) {
2325
for (e in b) this.off(e, c, b[e]);
2326
return this
2327
}
2328
return !1 !== c && "function" != typeof c || (d = c, c = void 0), !1 === d && (d = U), this.each(function() {
2329
j.event.remove(this, b, d, c)
2330
})
2331
}
2332
});
2333
var od = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
2334
pd = /<script|<style|<link/i,
2335
Jc = /checked\s*(?:[^=]|=\s*.checked.)/i,
2336
Ic = /^true\/(.*)/,
2337
Lc = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
2338
j.extend({
2339
htmlPrefilter: function(b) {
2340
return b.replace(od, "<$1></$2>")
2341
},
2342
clone: function(b, c, d) {
2343
var g, e, f, m, n = b.cloneNode(!0),
2344
p = j.contains(b.ownerDocument, b);
2345
if (!H.noCloneChecked && !(1 !== b.nodeType && 11 !== b.nodeType || j.isXMLDoc(b))) {
2346
m = y(n);
2347
f = y(b);
2348
g = 0;
2349
for (e = f.length; g < e; g++) {
2350
var l = f[g],
2351
s = m[g],
2352
r = s.nodeName.toLowerCase();
2353
"input" === r && lc.test(l.type) ? s.checked = l.checked : "input" !== r && "textarea" !== r || (s.defaultValue = l.defaultValue)
2354
}
2355
}
2356
if (c)
2357
if (d) {
2358
f = f || y(b);
2359
m = m || y(n);
2360
g = 0;
2361
for (e = f.length; g < e; g++) Eb(f[g], m[g])
2362
} else Eb(b, n);
2363
return m = y(n, "script"), 0 < m.length && G(m, !p && y(b, "script")), n
2364
},
2365
cleanData: function(b) {
2366
for (var c, d, g, e = j.event.special, f = 0; void 0 !== (d = b[f]); f++)
2367
if (ab(d)) {
2368
if (c = d[D.expando]) {
2369
if (c.events)
2370
for (g in c.events) e[g] ? j.event.remove(d, g) : j.removeEvent(d, g, c.handle);
2371
d[D.expando] = void 0
2372
}
2373
d[Q.expando] && (d[Q.expando] = void 0)
2374
}
2375
}
2376
});
2377
j.fn.extend({
2378
detach: function(b) {
2379
return Gb(this, b, !0)
2380
},
2381
remove: function(b) {
2382
return Gb(this, b)
2383
},
2384
text: function(b) {
2385
return ha(this, function(b) {
2386
return void 0 === b ? j.text(this) : this.empty().each(function() {
2387
1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || (this.textContent = b)
2388
})
2389
}, null, b, arguments.length)
2390
},
2391
append: function() {
2392
return xa(this, arguments, function(b) {
2393
(1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) && Db(this, b).appendChild(b)
2394
})
2395
},
2396
prepend: function() {
2397
return xa(this, arguments, function(b) {
2398
if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
2399
var c = Db(this, b);
2400
c.insertBefore(b, c.firstChild)
2401
}
2402
})
2403
},
2404
before: function() {
2405
return xa(this, arguments, function(b) {
2406
this.parentNode && this.parentNode.insertBefore(b, this)
2407
})
2408
},
2409
after: function() {
2410
return xa(this, arguments, function(b) {
2411
this.parentNode && this.parentNode.insertBefore(b, this.nextSibling)
2412
})
2413
},
2414
empty: function() {
2415
for (var b, c = 0; null != (b = this[c]); c++) 1 === b.nodeType && (j.cleanData(y(b, !1)), b.textContent = "");
2416
return this
2417
},
2418
clone: function(b, c) {
2419
return b = null != b && b, c = null == c ? b : c, this.map(function() {
2420
return j.clone(this, b, c)
2421
})
2422
},
2423
html: function(b) {
2424
return ha(this, function(b) {
2425
var c = this[0] || {},
2426
d = 0,
2427
g = this.length;
2428
if (void 0 === b && 1 === c.nodeType) return c.innerHTML;
2429
if ("string" == typeof b && !pd.test(b) && !T[(Bb.exec(b) || ["", ""])[1].toLowerCase()]) {
2430
b = j.htmlPrefilter(b);
2431
try {
2432
for (; d < g; d++) c = this[d] || {}, 1 === c.nodeType && (j.cleanData(y(c, !1)), c.innerHTML = b);
2433
c = 0
2434
} catch (e) {}
2435
}
2436
c && this.empty().append(b)
2437
}, null, b, arguments.length)
2438
},
2439
replaceWith: function() {
2440
var b = [];
2441
return xa(this, arguments, function(c) {
2442
var d = this.parentNode;
2443
0 > j.inArray(this, b) && (j.cleanData(y(this)), d && d.replaceChild(c, this))
2444
}, b)
2445
}
2446
});
2447
j.each({
2448
appendTo: "append",
2449
prependTo: "prepend",
2450
insertBefore: "before",
2451
insertAfter: "after",
2452
replaceAll: "replaceWith"
2453
}, function(b, c) {
2454
j.fn[b] = function(b) {
2455
for (var d = [], g = j(b), e = g.length - 1, f = 0; f <= e; f++) b = f === e ? this : this.clone(!0), j(g[f])[c](b), lb.apply(d, b.get());
2456
return this.pushStack(d)
2457
}
2458
});
2459
var Hb = /^margin/,
2460
gb = RegExp("^(" + jc + ")(?!px)[a-z%]+$", "i"),
2461
Na = function(c) {
2462
var d = c.ownerDocument.defaultView;
2463
return d && d.opener || (d = b), d.getComputedStyle(c)
2464
},
2465
fb = function() {
2466
if (ba) {
2467
ba.style.cssText = "box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%";
2468
ba.innerHTML = "";
2469
db.appendChild(eb);
2470
var c = b.getComputedStyle(ba);
2471
nc = "1%" !== c.top;
2472
oc = "2px" === c.marginLeft;
2473
pc = "4px" === c.width;
2474
ba.style.marginRight = "50%";
2475
qc = "4px" === c.marginRight;
2476
db.removeChild(eb);
2477
ba = null
2478
}
2479
},
2480
nc, pc, qc, oc, eb = A.createElement("div"),
2481
ba = A.createElement("div");
2482
ba.style && (ba.style.backgroundClip = "content-box", ba.cloneNode(!0).style.backgroundClip = "", H.clearCloneStyle = "content-box" === ba.style.backgroundClip, eb.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute", eb.appendChild(ba), j.extend(H, {
2483
pixelPosition: function() {
2484
return fb(), nc
2485
},
2486
boxSizingReliable: function() {
2487
return fb(), pc
2488
},
2489
pixelMarginRight: function() {
2490
return fb(), qc
2491
},
2492
reliableMarginLeft: function() {
2493
return fb(), oc
2494
}
2495
}));
2496
!0;
2497
var qd = /^(none|table(?!-c[ea]).+)/,
2498
rc = /^--/,
2499
rd = {
2500
position: "absolute",
2501
visibility: "hidden",
2502
display: "block"
2503
},
2504
sc = {
2505
letterSpacing: "0",
2506
fontWeight: "400"
2507
},
2508
Lb = ["Webkit", "Moz", "ms"],
2509
Kb = A.createElement("div").style;
2510
j.extend({
2511
cssHooks: {
2512
opacity: {
2513
get: function(b, c) {
2514
if (c) {
2515
var d = Fa(b, "opacity");
2516
return "" === d ? "1" : d
2517
}
2518
}
2519
}
2520
},
2521
cssNumber: {
2522
animationIterationCount: !0,
2523
columnCount: !0,
2524
fillOpacity: !0,
2525
flexGrow: !0,
2526
flexShrink: !0,
2527
fontWeight: !0,
2528
lineHeight: !0,
2529
opacity: !0,
2530
order: !0,
2531
orphans: !0,
2532
widows: !0,
2533
zIndex: !0,
2534
zoom: !0
2535
},
2536
cssProps: {
2537
"float": "cssFloat"
2538
},
2539
style: function(b, c, d, g) {
2540
if (b && 3 !== b.nodeType && 8 !== b.nodeType && b.style) {
2541
var e, f, m, n = j.camelCase(c),
2542
p = rc.test(c),
2543
l = b.style;
2544
return p || (c = Jb(n)), m = j.cssHooks[c] || j.cssHooks[n], void 0 === d ? m && "get" in m && void 0 !== (e = m.get(b, !1, g)) ? e : l[c] : (f = typeof d, "string" === f && (e = Ea.exec(d)) && e[1] && (d = u(b, c, e), f = "number"), null != d && d === d && ("number" === f && (d += e && e[3] || (j.cssNumber[n] ? "" : "px")), H.clearCloneStyle || "" !== d || 0 !== c.indexOf("background") || (l[c] = "inherit"), m && "set" in m && void 0 === (d = m.set(b, d, g)) || (p ? l.setProperty(c, d) : l[c] = d)), void 0)
2545
}
2546
},
2547
css: function(b, c, d, g) {
2548
var e, f, m, n = j.camelCase(c);
2549
return rc.test(c) || (c = Jb(n)), m = j.cssHooks[c] || j.cssHooks[n], m && "get" in m && (e = m.get(b, !0, d)), void 0 === e && (e = Fa(b, c, g)), "normal" === e && c in sc && (e = sc[c]), "" === d || d ? (f = parseFloat(e), !0 === d || isFinite(f) ? f || 0 : e) : e
2550
}
2551
});
2552
j.each(["height", "width"], function(b, c) {
2553
j.cssHooks[c] = {
2554
get: function(b, d, g) {
2555
if (d) return !qd.test(j.css(b, "display")) || b.getClientRects().length && b.getBoundingClientRect().width ? Ob(b, c, g) : kc(b, rd, function() {
2556
return Ob(b, c, g)
2557
})
2558
},
2559
set: function(b, d, g) {
2560
var e, f = g && Na(b);
2561
g = g && Nb(b, c, g, "border-box" === j.css(b, "boxSizing", !1, f), f);
2562
return g && (e = Ea.exec(d)) && "px" !== (e[3] || "px") && (b.style[c] = d, d = j.css(b, c)), Mb(b, d, g)
2563
}
2564
}
2565
});
2566
j.cssHooks.marginLeft = Ib(H.reliableMarginLeft, function(b, c) {
2567
if (c) return (parseFloat(Fa(b, "marginLeft")) || b.getBoundingClientRect().left - kc(b, {
2568
marginLeft: 0
2569
}, function() {
2570
return b.getBoundingClientRect().left
2571
})) + "px"
2572
});
2573
j.each({
2574
margin: "",
2575
padding: "",
2576
border: "Width"
2577
}, function(b, c) {
2578
j.cssHooks[b + c] = {
2579
expand: function(d) {
2580
var g = 0,
2581
e = {};
2582
for (d = "string" == typeof d ? d.split(" ") : [d]; 4 > g; g++) e[b + na[g] + c] = d[g] || d[g - 2] || d[0];
2583
return e
2584
}
2585
};
2586
Hb.test(b) || (j.cssHooks[b + c].set = Mb)
2587
});
2588
j.fn.extend({
2589
css: function(b, c) {
2590
return ha(this, function(b, c, d) {
2591
var g, e = {},
2592
f = 0;
2593
if (Array.isArray(c)) {
2594
d = Na(b);
2595
for (g = c.length; f < g; f++) e[c[f]] = j.css(b, c[f], !1, d);
2596
return e
2597
}
2598
return void 0 !== d ? j.style(b, c, d) : j.css(b, c)
2599
}, b, c, 1 < arguments.length)
2600
}
2601
});
2602
j.Tween = R;
2603
R.prototype = {
2604
constructor: R,
2605
init: function(b, c, d, g, e, f) {
2606
this.elem = b;
2607
this.prop = d;
2608
this.easing = e || j.easing._default;
2609
this.options = c;
2610
this.start = this.now = this.cur();
2611
this.end = g;
2612
this.unit = f || (j.cssNumber[d] ? "" : "px")
2613
},
2614
cur: function() {
2615
var b = R.propHooks[this.prop];
2616
return b && b.get ? b.get(this) : R.propHooks._default.get(this)
2617
},
2618
run: function(b) {
2619
var c, d = R.propHooks[this.prop];
2620
return this.options.duration ? this.pos = c = j.easing[this.easing](b, this.options.duration * b, 0, 1, this.options.duration) : this.pos = c = b, this.now = (this.end - this.start) * c + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), d && d.set ? d.set(this) : R.propHooks._default.set(this), this
2621
}
2622
};
2623
R.prototype.init.prototype = R.prototype;
2624
R.propHooks = {
2625
_default: {
2626
get: function(b) {
2627
var c;
2628
return 1 !== b.elem.nodeType || null != b.elem[b.prop] && null == b.elem.style[b.prop] ? b.elem[b.prop] : (c = j.css(b.elem, b.prop, ""), c && "auto" !== c ? c : 0)
2629
},
2630
set: function(b) {
2631
j.fx.step[b.prop] ? j.fx.step[b.prop](b) : 1 !== b.elem.nodeType || null == b.elem.style[j.cssProps[b.prop]] && !j.cssHooks[b.prop] ? b.elem[b.prop] = b.now : j.style(b.elem, b.prop, b.now + b.unit)
2632
}
2633
}
2634
};
2635
R.propHooks.scrollTop = R.propHooks.scrollLeft = {
2636
set: function(b) {
2637
b.elem.nodeType && b.elem.parentNode && (b.elem[b.prop] = b.now)
2638
}
2639
};
2640
j.easing = {
2641
linear: function(b) {
2642
return b
2643
},
2644
swing: function(b) {
2645
return 0.5 - Math.cos(b * Math.PI) / 2
2646
},
2647
_default: "swing"
2648
};
2649
j.fx = R.prototype.init;
2650
j.fx.step = {};
2651
var ya, Oa, sd = /^(?:toggle|show|hide)$/,
2652
td = /queueHooks$/;
2653
j.Animation = j.extend(Z, {
2654
tweeners: {
2655
"*": [
2656
function(b, c) {
2657
var d = this.createTween(b, c);
2658
return u(d.elem, b, Ea.exec(c), d), d
2659
}
2660
]
2661
},
2662
tweener: function(b, c) {
2663
j.isFunction(b) ? (c = b, b = ["*"]) : b = b.match(V);
2664
for (var d, g = 0, e = b.length; g < e; g++) d = b[g], Z.tweeners[d] = Z.tweeners[d] || [], Z.tweeners[d].unshift(c)
2665
},
2666
prefilters: [
2667
function(b, c, d) {
2668
var g, e, f, m, n, l, p, s, r = "width" in c || "height" in c,
2669
q = this,
2670
u = {},
2671
y = b.style,
2672
C = b.nodeType && Ma(b),
2673
A = D.get(b, "fxshow");
2674
d.queue || (m = j._queueHooks(b, "fx"), null == m.unqueued && (m.unqueued = 0, n = m.empty.fire, m.empty.fire = function() {
2675
m.unqueued || n()
2676
}), m.unqueued++, q.always(function() {
2677
q.always(function() {
2678
m.unqueued--;
2679
j.queue(b, "fx").length || m.empty.fire()
2680
})
2681
}));
2682
for (g in c)
2683
if (e = c[g], sd.test(e)) {
2684
if (delete c[g], f = f || "toggle" === e, e === (C ? "hide" : "show")) {
2685
if ("show" !== e || !A || void 0 === A[g]) continue;
2686
C = !0
2687
}
2688
u[g] = A && A[g] || j.style(b, g)
2689
}
2690
if (l = !j.isEmptyObject(c), l || !j.isEmptyObject(u))
2691
for (g in r && 1 === b.nodeType && (d.overflow = [y.overflow, y.overflowX, y.overflowY], p = A && A.display, null == p && (p = D.get(b, "display")), s = j.css(b, "display"), "none" === s && (p ? s = p : (t([b], !0), p = b.style.display || p, s = j.css(b, "display"), t([b]))), ("inline" === s || "inline-block" === s && null != p) && "none" === j.css(b, "float") && (l || (q.done(function() {
2692
y.display = p
2693
}), null == p && (s = y.display, p = "none" === s ? "" : s)), y.display = "inline-block")), d.overflow && (y.overflow = "hidden", q.always(function() {
2694
y.overflow = d.overflow[0];
2695
y.overflowX = d.overflow[1];
2696
y.overflowY = d.overflow[2]
2697
})), l = !1, u) l || (A ? "hidden" in A && (C = A.hidden) : A = D.access(b, "fxshow", {
2698
display: p
2699
}), f && (A.hidden = !C), C && t([b], !0), q.done(function() {
2700
C || t([b]);
2701
D.remove(b, "fxshow");
2702
for (g in u) j.style(b, g, u[g])
2703
})), l = Qb(C ? A[g] : 0, g, q), g in A || (A[g] = l.start, C && (l.end = l.start, l.start = 0))
2704
}
2705
],
2706
prefilter: function(b, c) {
2707
c ? Z.prefilters.unshift(b) : Z.prefilters.push(b)
2708
}
2709
});
2710
j.speed = function(b, c, d) {
2711
var g = b && "object" == typeof b ? j.extend({}, b) : {
2712
complete: d || !d && c || j.isFunction(b) && b,
2713
duration: b,
2714
easing: d && c || c && !j.isFunction(c) && c
2715
};
2716
return j.fx.off ? g.duration = 0 : "number" != typeof g.duration && (g.duration in j.fx.speeds ? g.duration = j.fx.speeds[g.duration] : g.duration = j.fx.speeds._default), null != g.queue && !0 !== g.queue || (g.queue = "fx"), g.old = g.complete, g.complete = function() {
2717
j.isFunction(g.old) && g.old.call(this);
2718
g.queue && j.dequeue(this, g.queue)
2719
}, g
2720
};
2721
j.fn.extend({
2722
fadeTo: function(b, c, d, g) {
2723
return this.filter(Ma).css("opacity", 0).show().end().animate({
2724
opacity: c
2725
}, b, d, g)
2726
},
2727
animate: function(b, c, d, g) {
2728
var e = j.isEmptyObject(b),
2729
f = j.speed(c, d, g);
2730
c = function() {
2731
var c = Z(this, j.extend({}, b), f);
2732
(e || D.get(this, "finish")) && c.stop(!0)
2733
};
2734
return c.finish = c, e || !1 === f.queue ? this.each(c) : this.queue(f.queue, c)
2735
},
2736
stop: function(b, c, d) {
2737
var g = function(b) {
2738
var c = b.stop;
2739
delete b.stop;
2740
c(d)
2741
};
2742
return "string" != typeof b && (d = c, c = b, b = void 0), c && !1 !== b && this.queue(b || "fx", []), this.each(function() {
2743
var c = !0,
2744
e = null != b && b + "queueHooks",
2745
f = j.timers,
2746
m = D.get(this);
2747
if (e) m[e] && m[e].stop && g(m[e]);
2748
else
2749
for (e in m) m[e] && m[e].stop && td.test(e) && g(m[e]);
2750
for (e = f.length; e--;) f[e].elem !== this || null != b && f[e].queue !== b || (f[e].anim.stop(d), c = !1, f.splice(e, 1));
2751
!c && d || j.dequeue(this, b)
2752
})
2753
},
2754
finish: function(b) {
2755
return !1 !== b && (b = b || "fx"), this.each(function() {
2756
var c, d = D.get(this),
2757
g = d[b + "queue"];
2758
c = d[b + "queueHooks"];
2759
var e = j.timers,
2760
f = g ? g.length : 0;
2761
d.finish = !0;
2762
j.queue(this, b, []);
2763
c && c.stop && c.stop.call(this, !0);
2764
for (c = e.length; c--;) e[c].elem === this && e[c].queue === b && (e[c].anim.stop(!0), e.splice(c, 1));
2765
for (c = 0; c < f; c++) g[c] && g[c].finish && g[c].finish.call(this);
2766
delete d.finish
2767
})
2768
}
2769
});
2770
j.each(["toggle", "show", "hide"], function(b, c) {
2771
var d = j.fn[c];
2772
j.fn[c] = function(b, g, e) {
2773
return null == b || "boolean" == typeof b ? d.apply(this, arguments) : this.animate(Pa(c, !0), b, g, e)
2774
}
2775
});
2776
j.each({
2777
slideDown: Pa("show"),
2778
slideUp: Pa("hide"),
2779
slideToggle: Pa("toggle"),
2780
fadeIn: {
2781
opacity: "show"
2782
},
2783
fadeOut: {
2784
opacity: "hide"
2785
},
2786
fadeToggle: {
2787
opacity: "toggle"
2788
}
2789
}, function(b, c) {
2790
j.fn[b] = function(b, d, g) {
2791
return this.animate(c, b, d, g)
2792
}
2793
});
2794
j.timers = [];
2795
j.fx.tick = function() {
2796
var b, c = 0,
2797
d = j.timers;
2798
for (ya = j.now(); c < d.length; c++) b = d[c], b() || d[c] !== b || d.splice(c--, 1);
2799
d.length || j.fx.stop();
2800
ya = void 0
2801
};
2802
j.fx.timer = function(b) {
2803
j.timers.push(b);
2804
j.fx.start()
2805
};
2806
j.fx.interval = 13;
2807
j.fx.start = function() {
2808
Oa || (Oa = !0, hb())
2809
};
2810
j.fx.stop = function() {
2811
Oa = null
2812
};
2813
j.fx.speeds = {
2814
slow: 600,
2815
fast: 200,
2816
_default: 400
2817
};
2818
j.fn.delay = function(c, d) {
2819
return c = j.fx ? j.fx.speeds[c] || c : c, d = d || "fx", this.queue(d, function(d, g) {
2820
var e = b.setTimeout(d, c);
2821
g.stop = function() {
2822
b.clearTimeout(e)
2823
}
2824
})
2825
};
2826
var Ca = A.createElement("input"),
2827
ud = A.createElement("select").appendChild(A.createElement("option"));
2828
Ca.type = "checkbox";
2829
H.checkOn = "" !== Ca.value;
2830
H.optSelected = ud.selected;
2831
Ca = A.createElement("input");
2832
Ca.value = "t";
2833
Ca.type = "radio";
2834
H.radioValue = "t" === Ca.value;
2835
var tc, Ja = j.expr.attrHandle;
2836
j.fn.extend({
2837
attr: function(b, c) {
2838
return ha(this, j.attr, b, c, 1 < arguments.length)
2839
},
2840
removeAttr: function(b) {
2841
return this.each(function() {
2842
j.removeAttr(this, b)
2843
})
2844
}
2845
});
2846
j.extend({
2847
attr: function(b, c, d) {
2848
var g, e, f = b.nodeType;
2849
if (3 !== f && 8 !== f && 2 !== f) return "undefined" == typeof b.getAttribute ? j.prop(b, c, d) : (1 === f && j.isXMLDoc(b) || (e = j.attrHooks[c.toLowerCase()] || (j.expr.match.bool.test(c) ? tc : void 0)), void 0 !== d ? null === d ? void j.removeAttr(b, c) : e && "set" in e && void 0 !== (g = e.set(b, d, c)) ? g : (b.setAttribute(c, d + ""), d) : e && "get" in e && null !== (g = e.get(b, c)) ? g : (g = j.find.attr(b, c), null == g ? void 0 : g))
2850
},
2851
attrHooks: {
2852
type: {
2853
set: function(b, c) {
2854
if (!H.radioValue && "radio" === c && f(b, "input")) {
2855
var d = b.value;
2856
return b.setAttribute("type", c), d && (b.value = d), c
2857
}
2858
}
2859
}
2860
},
2861
removeAttr: function(b, c) {
2862
var d, g = 0,
2863
e = c && c.match(V);
2864
if (e && 1 === b.nodeType)
2865
for (; d = e[g++];) b.removeAttribute(d)
2866
}
2867
});
2868
tc = {
2869
set: function(b, c, d) {
2870
return !1 === c ? j.removeAttr(b, d) : b.setAttribute(d, d), d
2871
}
2872
};
2873
j.each(j.expr.match.bool.source.match(/\w+/g), function(b, c) {
2874
var d = Ja[c] || j.find.attr;
2875
Ja[c] = function(b, c, g) {
2876
var e, f, j = c.toLowerCase();
2877
return g || (f = Ja[j], Ja[j] = e, e = null != d(b, c, g) ? j : null, Ja[j] = f), e
2878
}
2879
});
2880
var vd = /^(?:input|select|textarea|button)$/i,
2881
wd = /^(?:a|area)$/i;
2882
j.fn.extend({
2883
prop: function(b, c) {
2884
return ha(this, j.prop, b, c, 1 < arguments.length)
2885
},
2886
removeProp: function(b) {
2887
return this.each(function() {
2888
delete this[j.propFix[b] || b]
2889
})
2890
}
2891
});
2892
j.extend({
2893
prop: function(b, c, d) {
2894
var g, e, f = b.nodeType;
2895
if (3 !== f && 8 !== f && 2 !== f) return 1 === f && j.isXMLDoc(b) || (c = j.propFix[c] || c, e = j.propHooks[c]), void 0 !== d ? e && "set" in e && void 0 !== (g = e.set(b, d, c)) ? g : b[c] = d : e && "get" in
2896
e && null !== (g = e.get(b, c)) ? g : b[c]
2897
},
2898
propHooks: {
2899
tabIndex: {
2900
get: function(b) {
2901
var c = j.find.attr(b, "tabindex");
2902
return c ? parseInt(c, 10) : vd.test(b.nodeName) || wd.test(b.nodeName) && b.href ? 0 : -1
2903
}
2904
}
2905
},
2906
propFix: {
2907
"for": "htmlFor",
2908
"class": "className"
2909
}
2910
});
2911
H.optSelected || (j.propHooks.selected = {
2912
get: function(b) {
2913
b = b.parentNode;
2914
return b && b.parentNode && b.parentNode.selectedIndex, null
2915
},
2916
set: function(b) {
2917
b = b.parentNode;
2918
b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex)
2919
}
2920
});
2921
j.each("tabIndex readOnly maxLength cellSpacing cellPadding rowSpan colSpan useMap frameBorder contentEditable".split(" "), function() {
2922
j.propFix[this.toLowerCase()] = this
2923
});
2924
j.fn.extend({
2925
addClass: function(b) {
2926
var c, d, g, e, f, m, n = 0;
2927
if (j.isFunction(b)) return this.each(function(c) {
2928
j(this).addClass(b.call(this, c, pa(this)))
2929
});
2930
if ("string" == typeof b && b)
2931
for (c = b.match(V) || []; d = this[n++];)
2932
if (e = pa(d), g = 1 === d.nodeType && " " + oa(e) + " ") {
2933
for (m = 0; f = c[m++];) 0 > g.indexOf(" " + f + " ") && (g += f + " ");
2934
g = oa(g);
2935
e !== g && d.setAttribute("class", g)
2936
}
2937
return this
2938
},
2939
removeClass: function(b) {
2940
var c, d, g, e, f, m, n = 0;
2941
if (j.isFunction(b)) return this.each(function(c) {
2942
j(this).removeClass(b.call(this, c, pa(this)))
2943
});
2944
if (!arguments.length) return this.attr("class", "");
2945
if ("string" == typeof b && b)
2946
for (c = b.match(V) || []; d = this[n++];)
2947
if (e = pa(d), g = 1 === d.nodeType && " " + oa(e) + " ") {
2948
for (m = 0; f = c[m++];)
2949
for (; - 1 < g.indexOf(" " + f + " ");) g = g.replace(" " + f + " ", " ");
2950
g = oa(g);
2951
e !== g && d.setAttribute("class", g)
2952
}
2953
return this
2954
},
2955
toggleClass: function(b, c) {
2956
var d = typeof b;
2957
return "boolean" == typeof c && "string" === d ? c ? this.addClass(b) : this.removeClass(b) : j.isFunction(b) ? this.each(function(d) {
2958
j(this).toggleClass(b.call(this, d, pa(this), c), c)
2959
}) : this.each(function() {
2960
var c, g, e, f;
2961
if ("string" === d) {
2962
g = 0;
2963
e = j(this);
2964
for (f = b.match(V) || []; c = f[g++];) e.hasClass(c) ? e.removeClass(c) : e.addClass(c)
2965
} else void 0 !== b && "boolean" !== d || (c = pa(this), c && D.set(this, "__className__", c), this.setAttribute && this.setAttribute("class", c || !1 === b ? "" : D.get(this, "__className__") || ""))
2966
})
2967
},
2968
hasClass: function(b) {
2969
var c, d = 0;
2970
for (b = " " + b + " "; c = this[d++];)
2971
if (1 === c.nodeType && -1 < (" " + oa(pa(c)) + " ").indexOf(b)) return !0;
2972
return !1
2973
}
2974
});
2975
var xd = /\r/g;
2976
j.fn.extend({
2977
val: function(b) {
2978
var c, d, g, e = this[0];
2979
if (arguments.length) return g = j.isFunction(b), this.each(function(d) {
2980
var e;
2981
1 === this.nodeType && (e = g ? b.call(this, d, j(this).val()) : b, null == e ? e = "" : "number" == typeof e ? e += "" : Array.isArray(e) && (e = j.map(e, function(b) {
2982
return null == b ? "" : b + ""
2983
})), c = j.valHooks[this.type] || j.valHooks[this.nodeName.toLowerCase()], c && "set" in c && void 0 !== c.set(this, e, "value") || (this.value = e))
2984
});
2985
if (e) return c = j.valHooks[e.type] || j.valHooks[e.nodeName.toLowerCase()], c && "get" in c && void 0 !== (d = c.get(e, "value")) ? d : (d = e.value, "string" == typeof d ? d.replace(xd, "") : null == d ? "" : d)
2986
}
2987
});
2988
j.extend({
2989
valHooks: {
2990
option: {
2991
get: function(b) {
2992
var c = j.find.attr(b, "value");
2993
return null != c ? c : oa(j.text(b))
2994
}
2995
},
2996
select: {
2997
get: function(b) {
2998
var c, d, g = b.options,
2999
e = b.selectedIndex,
3000
m = "select-one" === b.type,
3001
n = m ? null : [],
3002
p = m ? e + 1 : g.length;
3003
for (d = 0 > e ? p : m ? e : 0; d < p; d++)
3004
if (c = g[d], (c.selected || d === e) && !c.disabled && (!c.parentNode.disabled || !f(c.parentNode, "optgroup"))) {
3005
if (b = j(c).val(), m) return b;
3006
n.push(b)
3007
}
3008
return n
3009
},
3010
set: function(b, c) {
3011
for (var d, g, e = b.options, f = j.makeArray(c), m = e.length; m--;) g = e[m], (g.selected = -1 < j.inArray(j.valHooks.option.get(g), f)) && (d = !0);
3012
return d || (b.selectedIndex = -1), f
3013
}
3014
}
3015
}
3016
});
3017
j.each(["radio", "checkbox"], function() {
3018
j.valHooks[this] = {
3019
set: function(b, c) {
3020
if (Array.isArray(c)) return b.checked = -1 < j.inArray(j(b).val(), c)
3021
}
3022
};
3023
H.checkOn || (j.valHooks[this].get = function(b) {
3024
return null === b.getAttribute("value") ? "on" : b.value
3025
})
3026
});
3027
var uc = /^(?:focusinfocus|focusoutblur)$/;
3028
j.extend(j.event, {
3029
trigger: function(c, d, g, e) {
3030
var f, m, n, p, l, s, r, q = [g || A],
3031
u = Ra.call(c, "type") ? c.type : c;
3032
f = Ra.call(c, "namespace") ? c.namespace.split(".") : [];
3033
if (m = n = g = g || A, 3 !== g.nodeType && 8 !== g.nodeType && !uc.test(u + j.event.triggered) && (-1 < u.indexOf(".") && (f = u.split("."), u = f.shift(), f.sort()), l = 0 > u.indexOf(":") && "on" + u, c = c[j.expando] ? c : new j.Event(u, "object" == typeof c && c), c.isTrigger = e ? 2 : 3, c.namespace = f.join("."), c.rnamespace = c.namespace ? RegExp("(^|\\.)" + f.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, c.result = void 0, c.target || (c.target = g), d = null == d ? [c] : j.makeArray(d, [c]), r = j.event.special[u] || {}, e || !r.trigger || !1 !== r.trigger.apply(g, d))) {
3034
if (!e && !r.noBubble && !j.isWindow(g)) {
3035
p = r.delegateType || u;
3036
for (uc.test(p + u) || (m = m.parentNode); m; m = m.parentNode) q.push(m), n = m;
3037
n === (g.ownerDocument || A) && q.push(n.defaultView || n.parentWindow || b)
3038
}
3039
for (f = 0;
3040
(m = q[f++]) && !c.isPropagationStopped();) c.type = 1 < f ? p : r.bindType || u, (s = (D.get(m, "events") || {})[c.type] && D.get(m, "handle")) && s.apply(m, d), (s = l && m[l]) && s.apply && ab(m) && (c.result = s.apply(m, d), !1 === c.result && c.preventDefault());
3041
return c.type = u, e || c.isDefaultPrevented() || r._default && !1 !== r._default.apply(q.pop(), d) || !ab(g) || l && j.isFunction(g[u]) && !j.isWindow(g) && (n = g[l], n && (g[l] = null), j.event.triggered = u, g[u](), j.event.triggered = void 0, n && (g[l] = n)), c.result
3042
}
3043
},
3044
simulate: function(b, c, d) {
3045
b = j.extend(new j.Event, d, {
3046
type: b,
3047
isSimulated: !0
3048
});
3049
j.event.trigger(b, null, c)
3050
}
3051
});
3052
j.fn.extend({
3053
trigger: function(b, c) {
3054
return this.each(function() {
3055
j.event.trigger(b, c, this)
3056
})
3057
},
3058
triggerHandler: function(b, c) {
3059
var d = this[0];
3060
if (d) return j.event.trigger(b, c, d, !0)
3061
}
3062
});
3063
j.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "), function(b, c) {
3064
j.fn[c] = function(b, d) {
3065
return 0 < arguments.length ? this.on(c, null, b, d) : this.trigger(c)
3066
}
3067
});
3068
j.fn.extend({
3069
hover: function(b, c) {
3070
return this.mouseenter(b).mouseleave(c || b)
3071
}
3072
});
3073
H.focusin = "onfocusin" in b;
3074
H.focusin || j.each({
3075
focus: "focusin",
3076
blur: "focusout"
3077
}, function(b, c) {
3078
var d = function(b) {
3079
j.event.simulate(c, b.target, j.event.fix(b))
3080
};
3081
j.event.special[c] = {
3082
setup: function() {
3083
var g = this.ownerDocument || this,
3084
e = D.access(g, c);
3085
e || g.addEventListener(b, d, !0);
3086
D.access(g, c, (e || 0) + 1)
3087
},
3088
teardown: function() {
3089
var g = this.ownerDocument || this,
3090
e = D.access(g, c) - 1;
3091
e ? D.access(g, c, e) : (g.removeEventListener(b, d, !0), D.remove(g, c))
3092
}
3093
}
3094
});
3095
var Ka = b.location,
3096
vc = j.now(),
3097
xb = /\?/;
3098
j.parseXML = function(c) {
3099
var d;
3100
if (!c || "string" != typeof c) return null;
3101
try {
3102
d = (new b.DOMParser).parseFromString(c, "text/xml")
3103
} catch (g) {
3104
d = void 0
3105
}
3106
return d && !d.getElementsByTagName("parsererror").length || j.error("Invalid XML: " + c), d
3107
};
3108
var Mc = /\[\]$/,
3109
wc = /\r?\n/g,
3110
yd = /^(?:submit|button|image|reset|file)$/i,
3111
zd = /^(?:input|select|textarea|keygen)/i;
3112
j.param = function(b, c) {
3113
var d, g = [],
3114
e = function(b, c) {
3115
var d = j.isFunction(c) ? c() : c;
3116
g[g.length] = encodeURIComponent(b) + "=" + encodeURIComponent(null == d ? "" : d)
3117
};
3118
if (Array.isArray(b) || b.jquery && !j.isPlainObject(b)) j.each(b, function() {
3119
e(this.name, this.value)
3120
});
3121
else
3122
for (d in b) ib(d, b[d], c, e);
3123
return g.join("&")
3124
};
3125
j.fn.extend({
3126
serialize: function() {
3127
return j.param(this.serializeArray())
3128
},
3129
serializeArray: function() {
3130
return this.map(function() {
3131
var b = j.prop(this, "elements");
3132
return b ? j.makeArray(b) : this
3133
}).filter(function() {
3134
var b = this.type;
3135
return this.name && !j(this).is(":disabled") && zd.test(this.nodeName) && !yd.test(b) && (this.checked || !lc.test(b))
3136
}).map(function(b, c) {
3137
var d = j(this).val();
3138
return null == d ? null : Array.isArray(d) ? j.map(d, function(b) {
3139
return {
3140
name: c.name,
3141
value: b.replace(wc, "\r\n")
3142
}
3143
}) : {
3144
name: c.name,
3145
value: d.replace(wc, "\r\n")
3146
}
3147
}).get()
3148
}
3149
});
3150
var Ad = /%20/g,
3151
Bd = /#.*$/,
3152
Cd = /([?&])_=[^&]*/,
3153
Dd = /^(.*?):[ \t]*([^\r\n]*)$/gm,
3154
Ed = /^(?:GET|HEAD)$/,
3155
Fd = /^\/\//,
3156
xc = {},
3157
jb = {},
3158
yc = "*/".concat("*"),
3159
yb = A.createElement("a");
3160
yb.href = Ka.href;
3161
j.extend({
3162
active: 0,
3163
lastModified: {},
3164
etag: {},
3165
ajaxSettings: {
3166
url: Ka.href,
3167
type: "GET",
3168
isLocal: /^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Ka.protocol),
3169
global: !0,
3170
processData: !0,
3171
async: !0,
3172
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
3173
accepts: {
3174
"*": yc,
3175
text: "text/plain",
3176
html: "text/html",
3177
xml: "application/xml, text/xml",
3178
json: "application/json, text/javascript"
3179
},
3180
contents: {
3181
xml: /\bxml\b/,
3182
html: /\bhtml/,
3183
json: /\bjson\b/
3184
},
3185
responseFields: {
3186
xml: "responseXML",
3187
text: "responseText",
3188
json: "responseJSON"
3189
},
3190
converters: {
3191
"* text": String,
3192
"text html": !0,
3193
"text json": JSON.parse,
3194
"text xml": j.parseXML
3195
},
3196
flatOptions: {
3197
url: !0,
3198
context: !0
3199
}
3200
},
3201
ajaxSetup: function(b, c) {
3202
return c ? kb(kb(b, j.ajaxSettings), c) : kb(j.ajaxSettings, b)
3203
},
3204
ajaxPrefilter: Rb(xc),
3205
ajaxTransport: Rb(jb),
3206
ajax: function(c, d) {
3207
function g(c, d, n, p) {
3208
var u, q, x, v, z = d;
3209
if (!s) {
3210
s = !0;
3211
l && b.clearTimeout(l);
3212
e = void 0;
3213
m = p || "";
3214
L.readyState = 0 < c ? 4 : 0;
3215
p = 200 <= c && 300 > c || 304 === c;
3216
if (n) {
3217
x = t;
3218
for (var wa = L, A, G, F, E, N = x.contents, H = x.dataTypes;
3219
"*" === H[0];) H.shift(), void 0 === A && (A = x.mimeType || wa.getResponseHeader("Content-Type"));
3220
if (A)
3221
for (G in N)
3222
if (N[G] && N[G].test(A)) {
3223
H.unshift(G);
3224
break
3225
}
3226
if (H[0] in n) F = H[0];
3227
else {
3228
for (G in n) {
3229
if (!H[0] || x.converters[G + " " + H[0]]) {
3230
F = G;
3231
break
3232
}
3233
E || (E = G)
3234
}
3235
F = F || E
3236
}
3237
n = F ? (F !== H[0] && H.unshift(F), n[F]) : void 0;
3238
x = n
3239
}
3240
var M;
3241
a: {
3242
n = t;
3243
A = x;
3244
G = L;
3245
F = p;
3246
var S, P, O;
3247
x = {};
3248
wa = n.dataTypes.slice();
3249
if (wa[1])
3250
for (S in n.converters) x[S.toLowerCase()] = n.converters[S];
3251
for (E = wa.shift(); E;)
3252
if (n.responseFields[E] && (G[n.responseFields[E]] = A), !O && F && n.dataFilter && (A = n.dataFilter(A, n.dataType)), O = E, E = wa.shift())
3253
if ("*" === E) E = O;
3254
else if ("*" !== O && O !== E) {
3255
if (S = x[O + " " + E] || x["* " + E], !S)
3256
for (M in x)
3257
if (P = M.split(" "), P[1] === E && (S = x[O + " " + P[0]] || x["* " + P[0]])) {
3258
!0 === S ? S = x[M] : !0 !== x[M] && (E = P[0], wa.unshift(P[1]));
3259
break
3260
}
3261
if (!0 !== S)
3262
if (S && n["throws"]) A = S(A);
3263
else try {
3264
A = S(A)
3265
} catch (Q) {
3266
M = {
3267
state: "parsererror",
3268
error: S ? Q : "No conversion from " + O + " to " + E
3269
};
3270
break a
3271
}
3272
}
3273
M = {
3274
state: "success",
3275
data: A
3276
}
3277
}
3278
x = M;
3279
p ? (t.ifModified && (v = L.getResponseHeader("Last-Modified"), v && (j.lastModified[f] = v), v = L.getResponseHeader("etag"), v && (j.etag[f] = v)), 204 === c || "HEAD" === t.type ? z = "nocontent" : 304 === c ? z = "notmodified" : (z = x.state, u = x.data, q = x.error, p = !q)) : (q = z, !c && z || (z = "error", 0 > c && (c = 0)));
3280
L.status = c;
3281
L.statusText = (d || z) + "";
3282
p ? D.resolveWith(y, [u, z, L]) : D.rejectWith(y, [L, z, q]);
3283
L.statusCode(J);
3284
J = void 0;
3285
r && C.trigger(p ? "ajaxSuccess" : "ajaxError", [L, t, p ? u : q]);
3286
I.fireWith(y, [L, z]);
3287
r && (C.trigger("ajaxComplete", [L, t]), --j.active || j.event.trigger("ajaxStop"))
3288
}
3289
}
3290
"object" == typeof c && (d = c, c = void 0);
3291
d = d || {};
3292
var e, f, m, n, l, p, s, r, u, q, t = j.ajaxSetup({}, d),
3293
y = t.context || t,
3294
C = t.context && (y.nodeType || y.jquery) ? j(y) : j.event,
3295
D = j.Deferred(),
3296
I = j.Callbacks("once memory"),
3297
J = t.statusCode || {},
3298
G = {},
3299
F = {},
3300
E = "canceled",
3301
L = {
3302
readyState: 0,
3303
getResponseHeader: function(b) {
3304
var c;
3305
if (s) {
3306
if (!n)
3307
for (n = {}; c = Dd.exec(m);) n[c[1].toLowerCase()] = c[2];
3308
c = n[b.toLowerCase()]
3309
}
3310
return null == c ? null : c
3311
},
3312
getAllResponseHeaders: function() {
3313
return s ? m : null
3314
},
3315
setRequestHeader: function(b, c) {
3316
return null == s && (b = F[b.toLowerCase()] = F[b.toLowerCase()] || b, G[b] = c), this
3317
},
3318
overrideMimeType: function(b) {
3319
return null == s && (t.mimeType = b), this
3320
},
3321
statusCode: function(b) {
3322
var c;
3323
if (b)
3324
if (s) L.always(b[L.status]);
3325
else
3326
for (c in b) J[c] = [J[c], b[c]];
3327
return this
3328
},
3329
abort: function(b) {
3330
b = b || E;
3331
return e && e.abort(b), g(0, b), this
3332
}
3333
};
3334
if (D.promise(L), t.url = ((c || t.url || Ka.href) + "").replace(Fd, Ka.protocol + "//"), t.type = d.method || d.type || t.method || t.type, t.dataTypes = (t.dataType || "*").toLowerCase().match(V) || [""], null == t.crossDomain) {
3335
p = A.createElement("a");
3336
try {
3337
p.href = t.url, p.href = p.href, t.crossDomain = yb.protocol + "//" + yb.host != p.protocol + "//" + p.host
3338
} catch (H) {
3339
t.crossDomain = !0
3340
}
3341
}
3342
if (t.data && t.processData && "string" != typeof t.data && (t.data = j.param(t.data, t.traditional)), Sb(xc, t, d, L), s) return L;
3343
(r = j.event && t.global) && 0 === j.active++ && j.event.trigger("ajaxStart");
3344
t.type = t.type.toUpperCase();
3345
t.hasContent = !Ed.test(t.type);
3346
f = t.url.replace(Bd, "");
3347
t.hasContent ? t.data && t.processData && 0 === (t.contentType || "").indexOf("application/x-www-form-urlencoded") && (t.data = t.data.replace(Ad, "+")) : (q = t.url.slice(f.length), t.data && (f += (xb.test(f) ? "&" : "?") + t.data, delete t.data), !1 === t.cache && (f = f.replace(Cd, "$1"), q = (xb.test(f) ? "&" : "?") + "_=" + vc+++q), t.url = f + q);
3348
t.ifModified && (j.lastModified[f] && L.setRequestHeader("If-Modified-Since", j.lastModified[f]), j.etag[f] && L.setRequestHeader("If-None-Match", j.etag[f]));
3349
(t.data && t.hasContent && !1 !== t.contentType || d.contentType) && L.setRequestHeader("Content-Type", t.contentType);
3350
L.setRequestHeader("Accept", t.dataTypes[0] && t.accepts[t.dataTypes[0]] ? t.accepts[t.dataTypes[0]] + ("*" !== t.dataTypes[0] ? ", " + yc + "; q=0.01" : "") : t.accepts["*"]);
3351
for (u in t.headers) L.setRequestHeader(u, t.headers[u]);
3352
if (t.beforeSend && (!1 === t.beforeSend.call(y, L, t) || s)) return L.abort();
3353
if (E = "abort", I.add(t.complete), L.done(t.success), L.fail(t.error), e = Sb(jb, t, d, L)) {
3354
if (L.readyState = 1, r && C.trigger("ajaxSend", [L, t]), s) return L;
3355
t.async && 0 < t.timeout && (l = b.setTimeout(function() {
3356
L.abort("timeout")
3357
}, t.timeout));
3358
try {
3359
s = !1, e.send(G, g)
3360
} catch (N) {
3361
if (s) throw N;
3362
g(-1, N)
3363
}
3364
} else g(-1, "No Transport");
3365
return L
3366
},
3367
getJSON: function(b, c, d) {
3368
return j.get(b, c, d, "json")
3369
},
3370
getScript: function(b, c) {
3371
return j.get(b, void 0, c, "script")
3372
}
3373
});
3374
j.each(["get", "post"], function(b, c) {
3375
j[c] = function(b, d, g, e) {
3376
return j.isFunction(d) && (e = e || g, g = d, d = void 0), j.ajax(j.extend({
3377
url: b,
3378
type: c,
3379
dataType: e,
3380
data: d,
3381
success: g
3382
}, j.isPlainObject(b) && b))
3383
}
3384
});
3385
j._evalUrl = function(b) {
3386
return j.ajax({
3387
url: b,
3388
type: "GET",
3389
dataType: "script",
3390
cache: !0,
3391
async: !1,
3392
global: !1,
3393
"throws": !0
3394
})
3395
};
3396
j.fn.extend({
3397
wrapAll: function(b) {
3398
var c;
3399
return this[0] && (j.isFunction(b) && (b = b.call(this[0])), c = j(b, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && c.insertBefore(this[0]), c.map(function() {
3400
for (var b = this; b.firstElementChild;) b = b.firstElementChild;
3401
return b
3402
}).append(this)), this
3403
},
3404
wrapInner: function(b) {
3405
return j.isFunction(b) ? this.each(function(c) {
3406
j(this).wrapInner(b.call(this, c))
3407
}) : this.each(function() {
3408
var c = j(this),
3409
d = c.contents();
3410
d.length ? d.wrapAll(b) : c.append(b)
3411
})
3412
},
3413
wrap: function(b) {
3414
var c = j.isFunction(b);
3415
return this.each(function(d) {
3416
j(this).wrapAll(c ? b.call(this, d) : b)
3417
})
3418
},
3419
unwrap: function(b) {
3420
return this.parent(b).not("body").each(function() {
3421
j(this).replaceWith(this.childNodes)
3422
}), this
3423
}
3424
});
3425
j.expr.pseudos.hidden = function(b) {
3426
return !j.expr.pseudos.visible(b)
3427
};
3428
j.expr.pseudos.visible = function(b) {
3429
return !(!b.offsetWidth && !b.offsetHeight && !b.getClientRects().length)
3430
};
3431
j.ajaxSettings.xhr = function() {
3432
try {
3433
return new b.XMLHttpRequest
3434
} catch (c) {}
3435
};
3436
var Gd = {
3437
"0": 200,
3438
1223: 204
3439
},
3440
La = j.ajaxSettings.xhr();
3441
H.cors = !!La && "withCredentials" in La;
3442
H.ajax = La = !!La;
3443
j.ajaxTransport(function(c) {
3444
var d, g;
3445
if (H.cors || La && !c.crossDomain) return {
3446
send: function(e, f) {
3447
var j, m = c.xhr();
3448
if (m.open(c.type, c.url, c.async, c.username, c.password), c.xhrFields)
3449
for (j in c.xhrFields) m[j] = c.xhrFields[j];
3450
c.mimeType && m.overrideMimeType && m.overrideMimeType(c.mimeType);
3451
c.crossDomain || e["X-Requested-With"] || (e["X-Requested-With"] = "XMLHttpRequest");
3452
for (j in e) m.setRequestHeader(j, e[j]);
3453
d = function(b) {
3454
return function() {
3455
d && (d = g = m.onload = m.onerror = m.onabort = m.onreadystatechange = null, "abort" === b ? m.abort() : "error" === b ? "number" != typeof m.status ? f(0, "error") : f(m.status, m.statusText) : f(Gd[m.status] || m.status, m.statusText, "text" !== (m.responseType || "text") || "string" != typeof m.responseText ? {
3456
binary: m.response
3457
} : {
3458
text: m.responseText
3459
}, m.getAllResponseHeaders()))
3460
}
3461
};
3462
m.onload = d();
3463
g = m.onerror = d("error");
3464
void 0 !== m.onabort ? m.onabort = g : m.onreadystatechange = function() {
3465
4 === m.readyState && b.setTimeout(function() {
3466
d && g()
3467
})
3468
};
3469
d = d("abort");
3470
try {
3471
m.send(c.hasContent && c.data || null)
3472
} catch (n) {
3473
if (d) throw n;
3474
}
3475
},
3476
abort: function() {
3477
d && d()
3478
}
3479
}
3480
});
3481
j.ajaxPrefilter(function(b) {
3482
b.crossDomain && (b.contents.script = !1)
3483
});
3484
j.ajaxSetup({
3485
accepts: {
3486
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
3487
},
3488
contents: {
3489
script: /\b(?:java|ecma)script\b/
3490
},
3491
converters: {
3492
"text script": function(b) {
3493
return j.globalEval(b), b
3494
}
3495
}
3496
});
3497
j.ajaxPrefilter("script", function(b) {
3498
void 0 === b.cache && (b.cache = !1);
3499
b.crossDomain && (b.type = "GET")
3500
});
3501
j.ajaxTransport("script", function(b) {
3502
if (b.crossDomain) {
3503
var c, d;
3504
return {
3505
send: function(g, e) {
3506
c = j("<script>").prop({
3507
charset: b.scriptCharset,
3508
src: b.url
3509
}).on("load error", d = function(b) {
3510
c.remove();
3511
d = null;
3512
b && e("error" === b.type ? 404 : 200, b.type)
3513
});
3514
A.head.appendChild(c[0])
3515
},
3516
abort: function() {
3517
d && d()
3518
}
3519
}
3520
}
3521
});
3522
var zc = [],
3523
zb = /(=)\?(?=&|$)|\?\?/;
3524
j.ajaxSetup({
3525
jsonp: "callback",
3526
jsonpCallback: function() {
3527
var b = zc.pop() || j.expando + "_" + vc++;
3528
return this[b] = !0, b
3529
}
3530
});
3531
j.ajaxPrefilter("json jsonp", function(c, d, g) {
3532
var e, f, m, n = !1 !== c.jsonp && (zb.test(c.url) ? "url" : "string" == typeof c.data && 0 === (c.contentType || "").indexOf("application/x-www-form-urlencoded") && zb.test(c.data) && "data");
3533
if (n || "jsonp" === c.dataTypes[0]) return e = c.jsonpCallback = j.isFunction(c.jsonpCallback) ? c.jsonpCallback() : c.jsonpCallback, n ? c[n] = c[n].replace(zb, "$1" + e) : !1 !== c.jsonp && (c.url += (xb.test(c.url) ? "&" : "?") + c.jsonp +
3534
"=" + e), c.converters["script json"] = function() {
3535
return m || j.error(e + " was not called"), m[0]
3536
}, c.dataTypes[0] = "json", f = b[e], b[e] = function() {
3537
m = arguments
3538
}, g.always(function() {
3539
void 0 === f ? j(b).removeProp(e) : b[e] = f;
3540
c[e] && (c.jsonpCallback = d.jsonpCallback, zc.push(e));
3541
m && j.isFunction(f) && f(m[0]);
3542
m = f = void 0
3543
}), "script"
3544
});
3545
var Hd = H,
3546
Ac, Bc = A.implementation.createHTMLDocument("").body;
3547
Ac = (Bc.innerHTML = "<form></form><form></form>", 2 === Bc.childNodes.length);
3548
Hd.createHTMLDocument = Ac;
3549
j.parseHTML = function(b, c, d) {
3550
if ("string" != typeof b) return [];
3551
"boolean" == typeof c && (d = c, c = !1);
3552
var g, e, f;
3553
return c || (H.createHTMLDocument ? (c = A.implementation.createHTMLDocument(""), g = c.createElement("base"), g.href = A.location.href, c.head.appendChild(g)) : c = A), e = hc.exec(b), f = !d && [], e ? [c.createElement(e[1])] : (e = F([b], c, f), f && f.length && j(f).remove(), j.merge([], e.childNodes))
3554
};
3555
j.fn.load = function(b, c, d) {
3556
var g, e, f, m = this,
3557
n = b.indexOf(" ");
3558
return -1 < n && (g = oa(b.slice(n)), b = b.slice(0, n)), j.isFunction(c) ? (d = c, c = void 0) : c && "object" == typeof c && (e = "POST"), 0 < m.length && j.ajax({
3559
url: b,
3560
type: e || "GET",
3561
dataType: "html",
3562
data: c
3563
}).done(function(b) {
3564
f = arguments;
3565
m.html(g ? j("<div>").append(j.parseHTML(b)).find(g) : b)
3566
}).always(d && function(b, c) {
3567
m.each(function() {
3568
d.apply(this, f || [b.responseText, c, b])
3569
})
3570
}), this
3571
};
3572
j.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function(b, c) {
3573
j.fn[c] = function(b) {
3574
return this.on(c, b)
3575
}
3576
});
3577
j.expr.pseudos.animated = function(b) {
3578
return j.grep(j.timers, function(c) {
3579
return b === c.elem
3580
}).length
3581
};
3582
j.offset = {
3583
setOffset: function(b, c, d) {
3584
var g, e, f, m, n, p, l = j.css(b, "position"),
3585
s = j(b),
3586
r = {};
3587
"static" === l && (b.style.position = "relative");
3588
n = s.offset();
3589
f = j.css(b, "top");
3590
p = j.css(b, "left");
3591
("absolute" === l || "fixed" === l) && -1 < (f + p).indexOf("auto") ? (g = s.position(), m = g.top, e = g.left) : (m = parseFloat(f) || 0, e = parseFloat(p) || 0);
3592
j.isFunction(c) && (c = c.call(b, d, j.extend({}, n)));
3593
null != c.top && (r.top = c.top - n.top + m);
3594
null != c.left && (r.left = c.left - n.left + e);
3595
"using" in c ? c.using.call(b, r) : s.css(r)
3596
}
3597
};
3598
j.fn.extend({
3599
offset: function(b) {
3600
if (arguments.length) return void 0 === b ? this : this.each(function(c) {
3601
j.offset.setOffset(this, b, c)
3602
});
3603
var c, d, g, e, f = this[0];
3604
if (f) return f.getClientRects().length ? (g = f.getBoundingClientRect(), c = f.ownerDocument, d = c.documentElement, e = c.defaultView, {
3605
top: g.top + e.pageYOffset - d.clientTop,
3606
left: g.left + e.pageXOffset - d.clientLeft
3607
}) : {
3608
top: 0,
3609
left: 0
3610
}
3611
},
3612
position: function() {
3613
if (this[0]) {
3614
var b, c, d = this[0],
3615
g = {
3616
top: 0,
3617
left: 0
3618
};
3619
return "fixed" === j.css(d, "position") ? c = d.getBoundingClientRect() : (b = this.offsetParent(), c = this.offset(), f(b[0], "html") || (g = b.offset()), g = {
3620
top: g.top +
3621
j.css(b[0], "borderTopWidth", !0),
3622
left: g.left + j.css(b[0], "borderLeftWidth", !0)
3623
}), {
3624
top: c.top - g.top - j.css(d, "marginTop", !0),
3625
left: c.left - g.left - j.css(d, "marginLeft", !0)
3626
}
3627
}
3628
},
3629
offsetParent: function() {
3630
return this.map(function() {
3631
for (var b = this.offsetParent; b && "static" === j.css(b, "position");) b = b.offsetParent;
3632
return b || db
3633
})
3634
}
3635
});
3636
j.each({
3637
scrollLeft: "pageXOffset",
3638
scrollTop: "pageYOffset"
3639
}, function(b, c) {
3640
var d = "pageYOffset" === c;
3641
j.fn[b] = function(g) {
3642
return ha(this, function(b, g, e) {
3643
var f;
3644
return j.isWindow(b) ? f = b : 9 === b.nodeType && (f = b.defaultView), void 0 === e ? f ? f[c] : b[g] : void(f ? f.scrollTo(d ? f.pageXOffset : e, d ? e : f.pageYOffset) : b[g] = e)
3645
}, b, g, arguments.length)
3646
}
3647
});
3648
j.each(["top", "left"], function(b, c) {
3649
j.cssHooks[c] = Ib(H.pixelPosition, function(b, d) {
3650
if (d) return d = Fa(b, c), gb.test(d) ? j(b).position()[c] + "px" : d
3651
})
3652
});
3653
j.each({
3654
Height: "height",
3655
Width: "width"
3656
}, function(b, c) {
3657
j.each({
3658
padding: "inner" + b,
3659
content: c,
3660
"": "outer" + b
3661
}, function(d, g) {
3662
j.fn[g] = function(e, f) {
3663
var m = arguments.length && (d || "boolean" != typeof e),
3664
n = d || (!0 === e || !0 === f ? "margin" : "border");
3665
return ha(this, function(c, d, e) {
3666
var f;
3667
return j.isWindow(c) ? 0 === g.indexOf("outer") ? c["inner" + b] : c.document.documentElement["client" + b] : 9 === c.nodeType ? (f = c.documentElement, Math.max(c.body["scroll" + b], f["scroll" + b], c.body["offset" + b], f["offset" + b], f["client" + b])) : void 0 === e ? j.css(c, d, n) : j.style(c, d, e, n)
3668
}, c, m ? e : void 0, m)
3669
}
3670
})
3671
});
3672
j.fn.extend({
3673
bind: function(b, c, d) {
3674
return this.on(b, null, c, d)
3675
},
3676
unbind: function(b, c) {
3677
return this.off(b, null, c)
3678
},
3679
delegate: function(b, c, d, g) {
3680
return this.on(c, b, d, g)
3681
},
3682
undelegate: function(b, c, d) {
3683
return 1 === arguments.length ? this.off(b, "**") : this.off(c, b || "**", d)
3684
}
3685
});
3686
j.holdReady = function(b) {
3687
b ? j.readyWait++ : j.ready(!0)
3688
};
3689
j.isArray = Array.isArray;
3690
j.parseJSON = JSON.parse;
3691
j.nodeName = f;
3692
"function" == typeof define && define.amd && define("jquery", [], function() {
3693
return j
3694
});
3695
var Id = b.jQuery,
3696
Jd = b.$;
3697
return j.noConflict = function(c) {
3698
return b.$ === j && (b.$ = Jd), c && b.jQuery === j && (b.jQuery = Id), j
3699
}, c || (b.jQuery = b.$ = j), j
3700
});
3701
var portraitMode = !0,
3702
mobilePortraitWidth = 480,
3703
mobilePortraitHeight = 640,
3704
mobileLandscapeWidth = 640,
3705
mobileLandscapeHeight = 480,
3706
mobileWidth = portraitMode ? mobilePortraitWidth : mobileLandscapeWidth,
3707
mobileHeight = portraitMode ? mobilePortraitHeight : mobileLandscapeHeight,
3708
desktopWidth = portraitMode ? 480 : 640,
3709
desktopHeight = portraitMode ? 640 : 480,
3710
w, h, multiplier, destW, destH, dynamicClickableEntityDivs = {},
3711
coreDivsToResize = ["game", "play", "orientate"],
3712
advancedDivsToResize = {
3713
};
3714
3715
function adjustLayers(b) {
3716
for (i = 0; i < coreDivsToResize.length; i++) ig.ua.mobile ? ($("#" + coreDivsToResize[i]).width(w), $("#" + coreDivsToResize[i]).height(h)) : ($("#" + coreDivsToResize[i]).width(destW), $("#" + coreDivsToResize[i]).height(destH), $("#" + coreDivsToResize[i]).css("left", b ? 0 : w / 2 - destW / 2));
3717
for (key in advancedDivsToResize) try {
3718
$("#" + key).width(w), $("#" + key).height(h), $("#" + key + "-Box").css("left", (w - advancedDivsToResize[key]["box-width"]) / 2), $("#" + key + "-Box").css("top", (h - advancedDivsToResize[key]["box-height"]) / 2)
3719
} catch (c) {
3720
console.log(c)
3721
}
3722
$("#ajaxbar").width(w);
3723
$("#ajaxbar").height(h)
3724
}
3725
3726
function sizeHandler() {
3727
$("#game") && (w = window.innerWidth, h = window.innerHeight, ig.ua.mobile ? (multiplier = Math.min(h / mobileHeight, w / mobileWidth), destW = mobileWidth * multiplier, destH = mobileHeight * multiplier) : (multiplier = Math.min(h / desktopHeight, w / desktopWidth), destW = desktopWidth * multiplier, destH = desktopHeight * multiplier), widthRatio = window.innerWidth / mobileWidth, heightRatio = window.innerHeight / mobileHeight, adjustLayers(), window.scrollTo(0, 1))
3728
}
3729
3730
function orientationHandler() {
3731
console.log("changing orientation ...");
3732
ig.ua.mobile && ((portraitMode ? window.innerHeight < window.innerWidth : window.innerHeight > window.innerWidth) ? ($("#orientate").show(), $("#game").hide()) : ($("#orientate").hide(), $("#game").show()));
3733
sizeHandler()
3734
}
3735
orientationTimeout = orientationInterval = null;
3736
3737
function orientationDelayHandler() {
3738
ig.ua.iOS ? (null == orientationInterval && (orientationInterval = window.setInterval(orientationHandler, 100)), null == orientationTimeout && (orientationTimeout = window.setTimeout(function() {
3739
clearAllIntervals()
3740
}, 2E3))) : orientationHandler()
3741
}
3742
3743
function clearAllIntervals() {
3744
window.clearInterval(orientationInterval);
3745
orientationInterval = null;
3746
window.clearTimeout(orientationTimeout);
3747
orientationTimeout = null
3748
}
3749
window.addEventListener("orientationchange", orientationDelayHandler);
3750
window.addEventListener("resize", orientationDelayHandler);
3751
3752
function fixSamsungHandler() {
3753
ig.ua.android && (!(4.2 > parseFloat(navigator.userAgent.slice(navigator.userAgent.indexOf("Android") + 8, navigator.userAgent.indexOf("Android") + 11))) && !(0 > navigator.userAgent.indexOf("GT")) && !(0 < navigator.userAgent.indexOf("Chrome")) && !(0 < navigator.userAgent.indexOf("Firefox"))) && (document.addEventListener("touchstart", function(b) {
3754
b.preventDefault();
3755
return !1
3756
}, !1), document.addEventListener("touchmove", function(b) {
3757
b.preventDefault();
3758
return !1
3759
}, !1), document.addEventListener("touchend", function(b) {
3760
b.preventDefault();
3761
return !1
3762
}, !1))
3763
}
3764
document.ontouchmove = function(b) {
3765
window.scrollTo(0, 1);
3766
b.preventDefault()
3767
};
3768
3769
function getInternetExplorerVersion() {
3770
var b = -1;
3771
"Microsoft Internet Explorer" == navigator.appName && null != /MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent) && (b = parseFloat(RegExp.$1));
3772
return b
3773
}
3774
var ie = getInternetExplorerVersion();
3775
3776
function getQueryVariable(b) {
3777
for (var c = window.location.search.substring(1).split("&"), d = 0; d < c.length; d++) {
3778
var e = c[d].split("=");
3779
if (decodeURIComponent(e[0]) == b) return decodeURIComponent(e[1])
3780
}
3781
};
3782
this.jukebox = {};
3783
jukebox.Player = function(b, c) {
3784
this.id = ++jukebox.__jukeboxId;
3785
this.origin = c || null;
3786
this.settings = {};
3787
for (var d in this.defaults) this.settings[d] = this.defaults[d];
3788
if ("[object Object]" === Object.prototype.toString.call(b))
3789
for (var e in b) this.settings[e] = b[e];
3790
"[object Function]" === Object.prototype.toString.call(jukebox.Manager) && (jukebox.Manager = new jukebox.Manager);
3791
this.resource = this.isPlaying = null;
3792
this.resource = "[object Object]" === Object.prototype.toString.call(jukebox.Manager) ? jukebox.Manager.getPlayableResource(this.settings.resources) : this.settings.resources[0] || null;
3793
if (null === this.resource) throw "Your browser can't playback the given resources - or you have missed to include jukebox.Manager";
3794
this.__init();
3795
return this
3796
};
3797
jukebox.__jukeboxId = 0;
3798
jukebox.Player.prototype = {
3799
defaults: {
3800
resources: [],
3801
autoplay: !1,
3802
spritemap: {},
3803
flashMediaElement: "./swf/FlashMediaElement.swf",
3804
timeout: 1E3
3805
},
3806
__addToManager: function() {
3807
!0 !== this.__wasAddedToManager && (jukebox.Manager.add(this), this.__wasAddedToManager = !0)
3808
},
3809
__init: function() {
3810
var b = this,
3811
c = this.settings,
3812
d = {},
3813
e;
3814
jukebox.Manager && void 0 !== jukebox.Manager.features && (d = jukebox.Manager.features);
3815
if (!0 === d.html5audio) {
3816
this.context = new Audio;
3817
this.context.src = this.resource;
3818
if (null === this.origin) {
3819
var f = function(c) {
3820
b.__addToManager(c)
3821
};
3822
this.context.addEventListener("canplaythrough", f, !0);
3823
window.setTimeout(function() {
3824
b.context.removeEventListener("canplaythrough", f, !0);
3825
f("timeout")
3826
}, c.timeout)
3827
}
3828
this.context.autobuffer = !0;
3829
this.context.preload = !0;
3830
for (e in this.HTML5API) this[e] = this.HTML5API[e];
3831
1 < d.channels ? !0 === c.autoplay ? this.context.autoplay = !0 : void 0 !== c.spritemap[c.autoplay] && this.play(c.autoplay) : 1 === d.channels && void 0 !== c.spritemap[c.autoplay] && (this.backgroundMusic = c.spritemap[c.autoplay], this.backgroundMusic.started = Date.now ? Date.now() : +new Date, this.play(c.autoplay));
3832
1 == d.channels && !0 !== c.canPlayBackground && (window.addEventListener("pagehide", function() {
3833
null !== b.isPlaying && (b.pause(), b.__wasAutoPaused = !0)
3834
}), window.addEventListener("pageshow", function() {
3835
b.__wasAutoPaused && (b.resume(), delete b._wasAutoPaused)
3836
}))
3837
} else if (!0 === d.flashaudio) {
3838
for (e in this.FLASHAPI) this[e] = this.FLASHAPI[e];
3839
d = ["id=jukebox-flashstream-" + this.id, "autoplay=" + c.autoplay, "file=" + window.encodeURIComponent(this.resource)];
3840
this.__initFlashContext(d);
3841
!0 === c.autoplay ? this.play(0) : c.spritemap[c.autoplay] && this.play(c.autoplay)
3842
} else throw "Your Browser does not support Flash Audio or HTML5 Audio.";
3843
},
3844
__initFlashContext: function(b) {
3845
var c, d = this.settings.flashMediaElement,
3846
e, f = {
3847
flashvars: b.join("&"),
3848
quality: "high",
3849
bgcolor: "#000000",
3850
wmode: "transparent",
3851
allowscriptaccess: "always",
3852
allowfullscreen: "true"
3853
};
3854
if (navigator.userAgent.match(/MSIE/)) {
3855
c = document.createElement("div");
3856
document.getElementsByTagName("body")[0].appendChild(c);
3857
var l = document.createElement("object");
3858
l.id = "jukebox-flashstream-" + this.id;
3859
l.setAttribute("type", "application/x-shockwave-flash");
3860
l.setAttribute("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
3861
l.setAttribute("width", "0");
3862
l.setAttribute("height", "0");
3863
f.movie = d + "?x=" + (Date.now ? Date.now() : +new Date);
3864
f.flashvars = b.join("&amp;");
3865
for (e in f) b = document.createElement("param"), b.setAttribute("name", e), b.setAttribute("value", f[e]), l.appendChild(b);
3866
c.outerHTML = l.outerHTML;
3867
this.context = document.getElementById("jukebox-flashstream-" + this.id)
3868
} else {
3869
c = document.createElement("embed");
3870
c.id = "jukebox-flashstream-" + this.id;
3871
c.setAttribute("type", "application/x-shockwave-flash");
3872
c.setAttribute("width", "100");
3873
c.setAttribute("height", "100");
3874
f.play = !1;
3875
f.loop = !1;
3876
f.src = d + "?x=" + (Date.now ? Date.now() : +new Date);
3877
for (e in f) c.setAttribute(e, f[e]);
3878
document.getElementsByTagName("body")[0].appendChild(c);
3879
this.context = c
3880
}
3881
},
3882
backgroundHackForiOS: function() {
3883
if (void 0 !== this.backgroundMusic) {
3884
var b = Date.now ? Date.now() : +new Date;
3885
void 0 === this.backgroundMusic.started ? (this.backgroundMusic.started = b, this.setCurrentTime(this.backgroundMusic.start)) : (this.backgroundMusic.lastPointer = (b - this.backgroundMusic.started) / 1E3 % (this.backgroundMusic.end - this.backgroundMusic.start) + this.backgroundMusic.start, this.play(this.backgroundMusic.lastPointer))
3886
}
3887
},
3888
play: function(b, c) {
3889
if (null !== this.isPlaying && !0 !== c) void 0 !== jukebox.Manager && jukebox.Manager.addToQueue(b, this.id);
3890
else {
3891
var d = this.settings.spritemap,
3892
e;
3893
if (void 0 !== d[b]) e = d[b].start;
3894
else if ("number" === typeof b) {
3895
e = b;
3896
for (var f in d)
3897
if (e >= d[f].start && e <= d[f].end) {
3898
b = f;
3899
break
3900
}
3901
}
3902
void 0 !== e && "[object Object]" === Object.prototype.toString.call(d[b]) && (this.isPlaying = this.settings.spritemap[b], this.context.play && this.context.play(), this.wasReady = this.setCurrentTime(e))
3903
}
3904
},
3905
stop: function() {
3906
this.__lastPosition = 0;
3907
this.isPlaying = null;
3908
this.backgroundMusic ? this.backgroundHackForiOS() : this.context.pause();
3909
return !0
3910
},
3911
pause: function() {
3912
this.isPlaying = null;
3913
this.__lastPosition = this.getCurrentTime();
3914
this.context.pause();
3915
return this.__lastPosition
3916
},
3917
resume: function(b) {
3918
b = "number" === typeof b ? b : this.__lastPosition;
3919
if (null !== b) return this.play(b), this.__lastPosition = null, !0;
3920
this.context.play();
3921
return !1
3922
},
3923
HTML5API: {
3924
getVolume: function() {
3925
return this.context.volume || 1
3926
},
3927
setVolume: function(b) {
3928
this.context.volume = b;
3929
return 1E-4 > Math.abs(this.context.volume - b) ? !0 : !1
3930
},
3931
getCurrentTime: function() {
3932
return this.context.currentTime || 0
3933
},
3934
setCurrentTime: function(b) {
3935
try {
3936
return this.context.currentTime = b, !0
3937
} catch (c) {
3938
return !1
3939
}
3940
}
3941
},
3942
FLASHAPI: {
3943
getVolume: function() {
3944
return this.context && "function" === typeof this.context.getVolume ? this.context.getVolume() : 1
3945
},
3946
setVolume: function(b) {
3947
return this.context && "function" === typeof this.context.setVolume ? (this.context.setVolume(b), !0) : !1
3948
},
3949
getCurrentTime: function() {
3950
return this.context && "function" === typeof this.context.getCurrentTime ? this.context.getCurrentTime() : 0
3951
},
3952
setCurrentTime: function(b) {
3953
return this.context && "function" === typeof this.context.setCurrentTime ? this.context.setCurrentTime(b) : !1
3954
}
3955
}
3956
};
3957
if (void 0 === this.jukebox) throw "jukebox.Manager requires jukebox.Player (Player.js) to run properly.";
3958
jukebox.Manager = function(b) {
3959
this.features = {};
3960
this.codecs = {};
3961
this.__players = {};
3962
this.__playersLength = 0;
3963
this.__clones = {};
3964
this.__queue = [];
3965
this.settings = {};
3966
for (var c in this.defaults) this.settings[c] = this.defaults[c];
3967
if ("[object Object]" === Object.prototype.toString.call(b))
3968
for (var d in b) this.settings[d] = b[d];
3969
this.__detectFeatures();
3970
jukebox.Manager.__initialized = !1 === this.settings.useGameLoop ? window.setInterval(function() {
3971
jukebox.Manager.loop()
3972
}, 20) : !0
3973
};
3974
jukebox.Manager.prototype = {
3975
defaults: {
3976
useFlash: !1,
3977
useGameLoop: !1
3978
},
3979
__detectFeatures: function() {
3980
var b = window.Audio && new Audio;
3981
if (b && b.canPlayType && !1 === this.settings.useFlash) {
3982
for (var c = [{
3983
e: "3gp",
3984
m: ["audio/3gpp", "audio/amr"]
3985
}, {
3986
e: "aac",
3987
m: ["audio/aac", "audio/aacp"]
3988
}, {
3989
e: "amr",
3990
m: ["audio/amr", "audio/3gpp"]
3991
}, {
3992
e: "caf",
3993
m: ["audio/IMA-ADPCM", "audio/x-adpcm", 'audio/x-aiff; codecs="IMA-ADPCM, ADPCM"']
3994
}, {
3995
e: "m4a",
3996
m: 'audio/mp4{audio/mp4; codecs="mp4a.40.2,avc1.42E01E"{audio/mpeg4{audio/mpeg4-generic{audio/mp4a-latm{audio/MP4A-LATM{audio/x-m4a'.split("{")
3997
}, {
3998
e: "mp3",
3999
m: ["audio/mp3", "audio/mpeg", 'audio/mpeg; codecs="mp3"', "audio/MPA", "audio/mpa-robust"]
4000
}, {
4001
e: "mpga",
4002
m: ["audio/MPA", "audio/mpa-robust", "audio/mpeg", "video/mpeg"]
4003
}, {
4004
e: "mp4",
4005
m: ["audio/mp4", "video/mp4"]
4006
}, {
4007
e: "ogg",
4008
m: ["application/ogg", "audio/ogg", 'audio/ogg; codecs="theora, vorbis"', "video/ogg", 'video/ogg; codecs="theora, vorbis"']
4009
}, {
4010
e: "wav",
4011
m: ["audio/wave", "audio/wav", 'audio/wav; codecs="1"', "audio/x-wav", "audio/x-pn-wav"]
4012
}, {
4013
e: "webm",
4014
m: ["audio/webm", 'audio/webm; codecs="vorbis"', "video/webm"]
4015
}], d, e, f = 0, l = c.length; f < l; f++)
4016
if (e = c[f].e, c[f].m.length && "object" === typeof c[f].m)
4017
for (var q = 0, r = c[f].m.length; q < r; q++)
4018
if (d = c[f].m[q], "" !== b.canPlayType(d)) {
4019
this.codecs[e] = d;
4020
break
4021
} else this.codecs[e] || (this.codecs[e] = !1);
4022
this.features.html5audio = !(!this.codecs.mp3 && !this.codecs.ogg && !this.codecs.webm && !this.codecs.wav);
4023
this.features.channels = 8;
4024
b.volume = 0.1337;
4025
this.features.volume = !!(1E-4 > Math.abs(b.volume - 0.1337));
4026
navigator.userAgent.match(/iPhone|iPod|iPad/i) && (this.features.channels = 1)
4027
}
4028
this.features.flashaudio = !!navigator.mimeTypes["application/x-shockwave-flash"] || !!navigator.plugins["Shockwave Flash"] || !1;
4029
if (window.ActiveXObject) try {
4030
new ActiveXObject("ShockwaveFlash.ShockwaveFlash.10"), this.features.flashaudio = !0
4031
} catch (g) {}!0 === this.settings.useFlash && (this.features.flashaudio = !0);
4032
!0 === this.features.flashaudio && !this.features.html5audio && (this.codecs.mp3 = "audio/mp3", this.codecs.mpga = "audio/mpeg", this.codecs.mp4 = "audio/mp4", this.codecs.m4a = "audio/mp4", this.codecs["3gp"] = "audio/3gpp", this.codecs.amr = "audio/amr", this.features.volume = !0, this.features.channels = 1)
4033
},
4034
__getPlayerById: function(b) {
4035
return this.__players && void 0 !== this.__players[b] ? this.__players[b] : null
4036
},
4037
__getClone: function(b, c) {
4038
for (var d in this.__clones) {
4039
var e = this.__clones[d];
4040
if (null === e.isPlaying && e.origin === b) return e
4041
}
4042
if ("[object Object]" === Object.prototype.toString.call(c)) {
4043
d = {};
4044
for (var f in c) d[f] = c[f];
4045
d.autoplay = !1;
4046
f = new jukebox.Player(d, b);
4047
f.isClone = !0;
4048
f.wasReady = !1;
4049
return this.__clones[f.id] = f
4050
}
4051
return null
4052
},
4053
loop: function() {
4054
if (0 !== this.__playersLength)
4055
if (this.__queue.length && this.__playersLength < this.features.channels) {
4056
var b = this.__queue[0],
4057
c = this.__getPlayerById(b.origin);
4058
if (null !== c) {
4059
var d = this.__getClone(b.origin, c.settings);
4060
null !== d && (!0 === this.features.volume && (c = this.__players[b.origin]) && d.setVolume(c.getVolume()), this.add(d), d.play(b.pointer, !0))
4061
}
4062
this.__queue.splice(0, 1)
4063
} else
4064
for (d in this.__queue.length && 1 === this.features.channels && (b = this.__queue[0], c = this.__getPlayerById(b.origin), null !== c && c.play(b.pointer, !0), this.__queue.splice(0, 1)), this.__players) b = this.__players[d], c = b.getCurrentTime() || 0, b.isPlaying && !1 === b.wasReady ? b.wasReady = b.setCurrentTime(b.isPlaying.start) : b.isPlaying && !0 === b.wasReady ? c > b.isPlaying.end && (!0 === b.isPlaying.loop ? b.play(b.isPlaying.start, !0) : b.stop()) : b.isClone && null === b.isPlaying ? this.remove(b) : void 0 !== b.backgroundMusic && null === b.isPlaying && c > b.backgroundMusic.end && b.backgroundHackForiOS()
4065
},
4066
getPlayableResource: function(b) {
4067
"[object Array]" !== Object.prototype.toString.call(b) && (b = [b]);
4068
for (var c = 0, d = b.length; c < d; c++) {
4069
var e = b[c],
4070
f = e.match(/\.([^\.]*)$/)[1];
4071
if (f && this.codecs[f]) return e
4072
}
4073
return null
4074
},
4075
add: function(b) {
4076
return b instanceof jukebox.Player && void 0 === this.__players[b.id] ? (this.__playersLength++, this.__players[b.id] = b, !0) : !1
4077
},
4078
remove: function(b) {
4079
return b instanceof jukebox.Player && void 0 !== this.__players[b.id] ? (this.__playersLength--, delete this.__players[b.id], !0) : !1
4080
},
4081
addToQueue: function(b, c) {
4082
return ("string" === typeof b || "number" === typeof b) && void 0 !== this.__players[c] ? (this.__queue.push({
4083
pointer: b,
4084
origin: c
4085
}), !0) : !1
4086
}
4087
};
4088
(function() {
4089
var b = function() {
4090
this.init()
4091
};
4092
b.prototype = {
4093
init: function() {
4094
var b = this || c;
4095
b._codecs = {};
4096
b._howls = [];
4097
b._muted = !1;
4098
b._volume = 1;
4099
b._canPlayEvent = "canplaythrough";
4100
b._navigator = "undefined" !== typeof window && window.navigator ? window.navigator : null;
4101
b.masterGain = null;
4102
b.noAudio = !1;
4103
b.usingWebAudio = !0;
4104
b.autoSuspend = !0;
4105
b.ctx = null;
4106
b.mobileAutoEnable = !0;
4107
b._setup();
4108
return b
4109
},
4110
volume: function(b) {
4111
var d = this || c;
4112
b = parseFloat(b);
4113
d.ctx || r();
4114
if ("undefined" !== typeof b && 0 <= b && 1 >= b) {
4115
d._volume = b;
4116
if (d._muted) return d;
4117
d.usingWebAudio && (d.masterGain.gain.value = b);
4118
for (var e = 0; e < d._howls.length; e++)
4119
if (!d._howls[e]._webAudio)
4120
for (var f = d._howls[e]._getSoundIds(), l = 0; l < f.length; l++) {
4121
var u = d._howls[e]._soundById(f[l]);
4122
u && u._node && (u._node.volume = u._volume * b)
4123
}
4124
return d
4125
}
4126
return d._volume
4127
},
4128
mute: function(b) {
4129
var d = this || c;
4130
d.ctx || r();
4131
d._muted = b;
4132
d.usingWebAudio && (d.masterGain.gain.value = b ? 0 : d._volume);
4133
for (var e = 0; e < d._howls.length; e++)
4134
if (!d._howls[e]._webAudio)
4135
for (var f = d._howls[e]._getSoundIds(), l = 0; l < f.length; l++) {
4136
var u = d._howls[e]._soundById(f[l]);
4137
u && u._node && (u._node.muted = b ? !0 : u._muted)
4138
}
4139
return d
4140
},
4141
unload: function() {
4142
for (var b = this || c, d = b._howls.length - 1; 0 <= d; d--) b._howls[d].unload();
4143
b.usingWebAudio && (b.ctx && "undefined" !== typeof b.ctx.close) && (b.ctx.close(), b.ctx = null, r());
4144
return b
4145
},
4146
codecs: function(b) {
4147
return (this || c)._codecs[b.replace(/^x-/, "")]
4148
},
4149
_setup: function() {
4150
var b = this || c;
4151
b.state = b.ctx ? b.ctx.state || "running" : "running";
4152
b._autoSuspend();
4153
if (!b.usingWebAudio)
4154
if ("undefined" !== typeof Audio) try {
4155
var d = new Audio;
4156
"undefined" === typeof d.oncanplaythrough && (b._canPlayEvent = "canplay")
4157
} catch (e) {
4158
b.noAudio = !0
4159
} else b.noAudio = !0;
4160
try {
4161
d = new Audio, d.muted && (b.noAudio = !0)
4162
} catch (f) {}
4163
b.noAudio || b._setupCodecs();
4164
return b
4165
},
4166
_setupCodecs: function() {
4167
var b = this || c,
4168
d = null;
4169
try {
4170
d = "undefined" !== typeof Audio ? new Audio : null
4171
} catch (e) {
4172
return b
4173
}
4174
if (!d || "function" !== typeof d.canPlayType) return b;
4175
var f = d.canPlayType("audio/mpeg;").replace(/^no$/, ""),
4176
l = b._navigator && b._navigator.userAgent.match(/OPR\/([0-6].)/g),
4177
l = l && 33 > parseInt(l[0].split("/")[1], 10);
4178
b._codecs = {
4179
mp3: !(l || !f && !d.canPlayType("audio/mp3;").replace(/^no$/, "")),
4180
mpeg: !!f,
4181
opus: !!d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""),
4182
ogg: !!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
4183
oga: !!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
4184
wav: !!d.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""),
4185
aac: !!d.canPlayType("audio/aac;").replace(/^no$/, ""),
4186
caf: !!d.canPlayType("audio/x-caf;").replace(/^no$/, ""),
4187
m4a: !!(d.canPlayType("audio/x-m4a;") || d.canPlayType("audio/m4a;") || d.canPlayType("audio/aac;")).replace(/^no$/, ""),
4188
mp4: !!(d.canPlayType("audio/x-mp4;") || d.canPlayType("audio/mp4;") || d.canPlayType("audio/aac;")).replace(/^no$/, ""),
4189
weba: !!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""),
4190
webm: !!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""),
4191
dolby: !!d.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""),
4192
flac: !!(d.canPlayType("audio/x-flac;") || d.canPlayType("audio/flac;")).replace(/^no$/, "")
4193
};
4194
return b
4195
},
4196
_enableMobileAudio: function() {
4197
var b = this || c,
4198
d = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi/i.test(b._navigator && b._navigator.userAgent),
4199
e = !!("ontouchend" in window || b._navigator && 0 < b._navigator.maxTouchPoints || b._navigator && 0 < b._navigator.msMaxTouchPoints);
4200
if (!b._mobileEnabled && b.ctx && (d || e)) {
4201
b._mobileEnabled = !1;
4202
!b._mobileUnloaded && 44100 !== b.ctx.sampleRate && (b._mobileUnloaded = !0, b.unload());
4203
b._scratchBuffer = b.ctx.createBuffer(1, 1, 22050);
4204
var f = function() {
4205
var c = b.ctx.createBufferSource();
4206
c.buffer = b._scratchBuffer;
4207
c.connect(b.ctx.destination);
4208
"undefined" === typeof c.start ? c.noteOn(0) : c.start(0);
4209
c.onended = function() {
4210
c.disconnect(0);
4211
b._mobileEnabled = !0;
4212
b.mobileAutoEnable = !1;
4213
document.removeEventListener("touchend", f, !0)
4214
}
4215
};
4216
document.addEventListener("touchend", f, !0);
4217
return b
4218
}
4219
},
4220
_autoSuspend: function() {
4221
var b = this;
4222
if (b.autoSuspend && b.ctx && "undefined" !== typeof b.ctx.suspend && c.usingWebAudio) {
4223
for (var d = 0; d < b._howls.length; d++)
4224
if (b._howls[d]._webAudio)
4225
for (var e = 0; e < b._howls[d]._sounds.length; e++)
4226
if (!b._howls[d]._sounds[e]._paused) return b;
4227
b._suspendTimer && clearTimeout(b._suspendTimer);
4228
b._suspendTimer = setTimeout(function() {
4229
b.autoSuspend && (b._suspendTimer = null, b.state = "suspending", b.ctx.suspend().then(function() {
4230
b.state = "suspended";
4231
b._resumeAfterSuspend && (delete b._resumeAfterSuspend, b._autoResume())
4232
}))
4233
}, 3E4);
4234
return b
4235
}
4236
},
4237
_autoResume: function() {
4238
var b = this;
4239
if (b.ctx && "undefined" !== typeof b.ctx.resume && c.usingWebAudio) return "running" === b.state && b._suspendTimer ? (clearTimeout(b._suspendTimer), b._suspendTimer = null) : "suspended" === b.state ? (b.state = "resuming", b.ctx.resume().then(function() {
4240
b.state = "running";
4241
for (var c = 0; c < b._howls.length; c++) b._howls[c]._emit("resume")
4242
}), b._suspendTimer && (clearTimeout(b._suspendTimer), b._suspendTimer = null)) : "suspending" === b.state && (b._resumeAfterSuspend = !0), b
4243
}
4244
};
4245
var c = new b,
4246
d = function(b) {
4247
!b.src || 0 === b.src.length ? console.error("An array of source files must be passed with any new Howl.") : this.init(b)
4248
};
4249
d.prototype = {
4250
init: function(b) {
4251
var d = this;
4252
c.ctx || r();
4253
d._autoplay = b.autoplay || !1;
4254
d._format = "string" !== typeof b.format ? b.format : [b.format];
4255
d._html5 = b.html5 || !1;
4256
d._muted = b.mute || !1;
4257
d._loop = b.loop || !1;
4258
d._pool = b.pool || 5;
4259
d._preload = "boolean" === typeof b.preload ? b.preload : !0;
4260
d._rate = b.rate || 1;
4261
d._sprite = b.sprite || {};
4262
d._src = "string" !== typeof b.src ? b.src : [b.src];
4263
d._volume = void 0 !== b.volume ? b.volume : 1;
4264
d._duration = 0;
4265
d._state = "unloaded";
4266
d._sounds = [];
4267
d._endTimers = {};
4268
d._queue = [];
4269
d._onend = b.onend ? [{
4270
fn: b.onend
4271
}] : [];
4272
d._onfade = b.onfade ? [{
4273
fn: b.onfade
4274
}] : [];
4275
d._onload = b.onload ? [{
4276
fn: b.onload
4277
}] : [];
4278
d._onloaderror = b.onloaderror ? [{
4279
fn: b.onloaderror
4280
}] : [];
4281
d._onpause = b.onpause ? [{
4282
fn: b.onpause
4283
}] : [];
4284
d._onplay = b.onplay ? [{
4285
fn: b.onplay
4286
}] : [];
4287
d._onstop = b.onstop ? [{
4288
fn: b.onstop
4289
}] : [];
4290
d._onmute = b.onmute ? [{
4291
fn: b.onmute
4292
}] : [];
4293
d._onvolume = b.onvolume ? [{
4294
fn: b.onvolume
4295
}] : [];
4296
d._onrate = b.onrate ? [{
4297
fn: b.onrate
4298
}] : [];
4299
d._onseek = b.onseek ? [{
4300
fn: b.onseek
4301
}] : [];
4302
d._onresume = [];
4303
d._webAudio = c.usingWebAudio && !d._html5;
4304
"undefined" !== typeof c.ctx && (c.ctx && c.mobileAutoEnable) && c._enableMobileAudio();
4305
c._howls.push(d);
4306
d._autoplay && d._queue.push({
4307
event: "play",
4308
action: function() {
4309
d.play()
4310
}
4311
});
4312
d._preload && d.load();
4313
return d
4314
},
4315
load: function() {
4316
var b = null;
4317
if (c.noAudio) this._emit("loaderror", null, "No audio support.");
4318
else {
4319
"string" === typeof this._src && (this._src = [this._src]);
4320
for (var d = 0; d < this._src.length; d++) {
4321
var n, p;
4322
if (this._format && this._format[d]) n = this._format[d];
4323
else {
4324
p = this._src[d];
4325
if ("string" !== typeof p) {
4326
this._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
4327
continue
4328
}(n = /^data:audio\/([^;,]+);/i.exec(p)) || (n = /\.([^.]+)$/.exec(p.split("?", 1)[0]));
4329
n && (n = n[1].toLowerCase())
4330
} if (c.codecs(n)) {
4331
b = this._src[d];
4332
break
4333
}
4334
}
4335
if (b) {
4336
this._src = b;
4337
this._state = "loading";
4338
"https:" === window.location.protocol && "http:" === b.slice(0, 5) && (this._html5 = !0, this._webAudio = !1);
4339
new e(this);
4340
if (this._webAudio) {
4341
var s = this,
4342
r = s._src;
4343
if (f[r]) s._duration = f[r].duration, q(s);
4344
else if (/^data:[^;]+;base64,/.test(r)) {
4345
b = atob(r.split(",")[1]);
4346
d = new Uint8Array(b.length);
4347
for (n = 0; n < b.length; ++n) d[n] = b.charCodeAt(n);
4348
l(d.buffer, s)
4349
} else {
4350
var t = new XMLHttpRequest;
4351
t.open("GET", r, !0);
4352
t.responseType = "arraybuffer";
4353
t.onload = function() {
4354
var b = (t.status + "")[0];
4355
"0" !== b && "2" !== b && "3" !== b ? s._emit("loaderror", null, "Failed loading audio file with status: " +
4356
t.status + ".") : l(t.response, s)
4357
};
4358
t.onerror = function() {
4359
s._webAudio && (s._html5 = !0, s._webAudio = !1, s._sounds = [], delete f[r], s.load())
4360
};
4361
try {
4362
t.send()
4363
} catch (y) {
4364
t.onerror()
4365
}
4366
}
4367
}
4368
return this
4369
}
4370
this._emit("loaderror", null, "No codec support for selected audio sources.")
4371
}
4372
},
4373
play: function(b, d) {
4374
var e = this,
4375
f = null;
4376
if ("number" === typeof b) f = b, b = null;
4377
else {
4378
if ("string" === typeof b && "loaded" === e._state && !e._sprite[b]) return null;
4379
if ("undefined" === typeof b) {
4380
b = "__default";
4381
for (var l = 0, r = 0; r < e._sounds.length; r++) e._sounds[r]._paused && !e._sounds[r]._ended && (l++, f = e._sounds[r]._id);
4382
1 === l ? b = null : f = null
4383
}
4384
}
4385
var q = f ? e._soundById(f) : e._inactiveSound();
4386
if (!q) return null;
4387
f && !b && (b = q._sprite || "__default");
4388
if ("loaded" !== e._state && !e._sprite[b]) return e._queue.push({
4389
event: "play",
4390
action: function() {
4391
e.play(e._soundById(q._id) ? q._id : void 0)
4392
}
4393
}), q._id;
4394
if (f && !q._paused) return d || setTimeout(function() {
4395
e._emit("play", q._id)
4396
}, 0), q._id;
4397
e._webAudio && c._autoResume();
4398
var y = Math.max(0, 0 < q._seek ? q._seek : e._sprite[b][0] / 1E3),
4399
G = Math.max(0, (e._sprite[b][0] + e._sprite[b][1]) / 1E3 - y),
4400
F = 1E3 * G / Math.abs(q._rate);
4401
q._paused = !1;
4402
q._ended = !1;
4403
q._sprite = b;
4404
q._seek = y;
4405
q._start = e._sprite[b][0] / 1E3;
4406
q._stop = (e._sprite[b][0] + e._sprite[b][1]) / 1E3;
4407
q._loop = !(!q._loop && !e._sprite[b][2]);
4408
var J = q._node;
4409
if (e._webAudio) f = function() {
4410
e._refreshBuffer(q);
4411
J.gain.setValueAtTime(q._muted || e._muted ? 0 : q._volume, c.ctx.currentTime);
4412
q._playStart = c.ctx.currentTime;
4413
"undefined" === typeof J.bufferSource.start ? q._loop ? J.bufferSource.noteGrainOn(0, y, 86400) : J.bufferSource.noteGrainOn(0, y, G) : q._loop ? J.bufferSource.start(0, y, 86400) : J.bufferSource.start(0, y, G);
4414
Infinity !== F && (e._endTimers[q._id] = setTimeout(e._ended.bind(e, q), F));
4415
d || setTimeout(function() {
4416
e._emit("play", q._id)
4417
}, 0)
4418
}, l = "running" === c.state, "loaded" === e._state && l ? f() : (e.once(l ? "load" : "resume", f, l ? q._id : null), e._clearTimer(q._id));
4419
else {
4420
var U = function() {
4421
J.currentTime = y;
4422
J.muted = q._muted || e._muted || c._muted || J.muted;
4423
J.volume = q._volume * c.volume();
4424
J.playbackRate = q._rate;
4425
setTimeout(function() {
4426
J.play();
4427
Infinity !== F && (e._endTimers[q._id] = setTimeout(e._ended.bind(e, q), F));
4428
d || e._emit("play", q._id)
4429
}, 0)
4430
},
4431
f = "loaded" === e._state && (window && window.ejecta || !J.readyState && c._navigator.isCocoonJS);
4432
if (4 === J.readyState || f) U();
4433
else {
4434
var ma = function() {
4435
U();
4436
J.removeEventListener(c._canPlayEvent, ma, !1)
4437
};
4438
J.addEventListener(c._canPlayEvent, ma, !1);
4439
e._clearTimer(q._id)
4440
}
4441
}
4442
return q._id
4443
},
4444
pause: function(b, c) {
4445
var d = this;
4446
if ("loaded" !== d._state) return d._queue.push({
4447
event: "pause",
4448
action: function() {
4449
d.pause(b)
4450
}
4451
}), d;
4452
for (var e = d._getSoundIds(b), f = 0; f < e.length; f++) {
4453
d._clearTimer(e[f]);
4454
var l = d._soundById(e[f]);
4455
if (l && !l._paused && (l._seek = d.seek(e[f]), l._rateSeek = 0, l._paused = !0, d._stopFade(e[f]), l._node))
4456
if (d._webAudio) {
4457
if (!l._node.bufferSource) break;
4458
"undefined" === typeof l._node.bufferSource.stop ? l._node.bufferSource.noteOff(0) : l._node.bufferSource.stop(0);
4459
d._cleanBuffer(l._node)
4460
} else(!isNaN(l._node.duration) || Infinity === l._node.duration) && l._node.pause();
4461
c || d._emit("pause", l ? l._id : null)
4462
}
4463
return d
4464
},
4465
stop: function(b, c) {
4466
var d = this;
4467
if ("loaded" !== d._state) return d._queue.push({
4468
event: "stop",
4469
action: function() {
4470
d.stop(b)
4471
}
4472
}), d;
4473
for (var e = d._getSoundIds(b), f = 0; f < e.length; f++) {
4474
d._clearTimer(e[f]);
4475
var l = d._soundById(e[f]);
4476
if (l && (l._seek = l._start || 0, l._rateSeek = 0, l._paused = !0, l._ended = !0, d._stopFade(e[f]), l._node))
4477
if (d._webAudio) {
4478
if (!l._node.bufferSource) {
4479
c || d._emit("stop", l._id);
4480
break
4481
}
4482
"undefined" === typeof l._node.bufferSource.stop ? l._node.bufferSource.noteOff(0) : l._node.bufferSource.stop(0);
4483
d._cleanBuffer(l._node)
4484
} else if (!isNaN(l._node.duration) || Infinity === l._node.duration) l._node.currentTime = l._start || 0, l._node.pause();
4485
l && !c && d._emit("stop", l._id)
4486
}
4487
return d
4488
},
4489
mute: function(b, d) {
4490
var e = this;
4491
if ("loaded" !== e._state) return e._queue.push({
4492
event: "mute",
4493
action: function() {
4494
e.mute(b, d)
4495
}
4496
}), e;
4497
if ("undefined" === typeof d)
4498
if ("boolean" === typeof b) e._muted = b;
4499
else return e._muted;
4500
for (var f = e._getSoundIds(d), l = 0; l < f.length; l++) {
4501
var r = e._soundById(f[l]);
4502
r && (r._muted = b, e._webAudio && r._node ? r._node.gain.setValueAtTime(b ? 0 : r._volume, c.ctx.currentTime) : r._node && (r._node.muted = c._muted ? !0 : b), e._emit("mute", r._id))
4503
}
4504
return e
4505
},
4506
volume: function() {
4507
var b = this,
4508
d = arguments,
4509
e, f;
4510
if (0 === d.length) return b._volume;
4511
1 === d.length || 2 === d.length && "undefined" === typeof d[1] ? 0 <= b._getSoundIds().indexOf(d[0]) ? f = parseInt(d[0], 10) : e = parseFloat(d[0]) : 2 <= d.length && (e = parseFloat(d[0]), f = parseInt(d[1], 10));
4512
var l;
4513
if ("undefined" !== typeof e && 0 <= e && 1 >= e) {
4514
if ("loaded" !== b._state) return b._queue.push({
4515
event: "volume",
4516
action: function() {
4517
b.volume.apply(b, d)
4518
}
4519
}), b;
4520
"undefined" === typeof f && (b._volume = e);
4521
f = b._getSoundIds(f);
4522
for (var r = 0; r < f.length; r++)
4523
if (l = b._soundById(f[r])) l._volume = e, d[2] || b._stopFade(f[r]), b._webAudio && l._node && !l._muted ? l._node.gain.setValueAtTime(e, c.ctx.currentTime) : l._node && !l._muted && (l._node.volume = e * c.volume()), b._emit("volume", l._id)
4524
} else return (l = f ? b._soundById(f) : b._sounds[0]) ? l._volume : 0;
4525
return b
4526
},
4527
fade: function(b, d, e, f) {
4528
var l = this,
4529
r = Math.abs(b - d),
4530
q = b > d ? "out" : "in",
4531
y = r / 0.01,
4532
r = 0 < y ? e / y : e;
4533
4 > r && (y = Math.ceil(y / (4 / r)), r = 4);
4534
if ("loaded" !== l._state) return l._queue.push({
4535
event: "fade",
4536
action: function() {
4537
l.fade(b, d, e, f)
4538
}
4539
}), l;
4540
l.volume(b, f);
4541
for (var G = l._getSoundIds(f), F = 0; F < G.length; F++) {
4542
var J = l._soundById(G[F]);
4543
if (J) {
4544
f || l._stopFade(G[F]);
4545
if (l._webAudio && !J._muted) {
4546
var U = c.ctx.currentTime,
4547
ma = U + e / 1E3;
4548
J._volume = b;
4549
J._node.gain.setValueAtTime(b, U);
4550
J._node.gain.linearRampToValueAtTime(d, ma)
4551
}
4552
var P = b;
4553
J._interval = setInterval(function(b, c) {
4554
0 < y && (P += "in" === q ? 0.01 : -0.01);
4555
P = Math.max(0, P);
4556
P = Math.min(1, P);
4557
P = Math.round(100 * P) / 100;
4558
l._webAudio ? ("undefined" === typeof f && (l._volume = P), c._volume = P) : l.volume(P, b, !0);
4559
P === d && (clearInterval(c._interval), c._interval = null, l.volume(P, b), l._emit("fade", b))
4560
}.bind(l, G[F], J), r)
4561
}
4562
}
4563
return l
4564
},
4565
_stopFade: function(b) {
4566
var d = this._soundById(b);
4567
d && d._interval && (this._webAudio && d._node.gain.cancelScheduledValues(c.ctx.currentTime), clearInterval(d._interval), d._interval = null, this._emit("fade", b));
4568
return this
4569
},
4570
loop: function() {
4571
var b = arguments,
4572
c, d;
4573
if (0 === b.length) return this._loop;
4574
if (1 === b.length)
4575
if ("boolean" === typeof b[0]) this._loop = c = b[0];
4576
else return (b = this._soundById(parseInt(b[0], 10))) ? b._loop : !1;
4577
else 2 === b.length && (c = b[0], d = parseInt(b[1], 10));
4578
d = this._getSoundIds(d);
4579
for (var e = 0; e < d.length; e++)
4580
if (b = this._soundById(d[e]))
4581
if (b._loop = c, this._webAudio && (b._node && b._node.bufferSource) && (b._node.bufferSource.loop = c)) b._node.bufferSource.loopStart = b._start || 0, b._node.bufferSource.loopEnd = b._stop;
4582
return this
4583
},
4584
rate: function() {
4585
var b = this,
4586
d = arguments,
4587
e, f;
4588
0 === d.length ? f = b._sounds[0]._id : 1 === d.length ? 0 <= b._getSoundIds().indexOf(d[0]) ? f = parseInt(d[0], 10) : e = parseFloat(d[0]) : 2 === d.length && (e = parseFloat(d[0]), f = parseInt(d[1], 10));
4589
var l;
4590
if ("number" === typeof e) {
4591
if ("loaded" !== b._state) return b._queue.push({
4592
event: "rate",
4593
action: function() {
4594
b.rate.apply(b, d)
4595
}
4596
}), b;
4597
"undefined" === typeof f && (b._rate = e);
4598
f = b._getSoundIds(f);
4599
for (var r = 0; r < f.length; r++)
4600
if (l = b._soundById(f[r])) {
4601
l._rateSeek = b.seek(f[r]);
4602
l._playStart = b._webAudio ? c.ctx.currentTime : l._playStart;
4603
l._rate = e;
4604
b._webAudio && l._node && l._node.bufferSource ? l._node.bufferSource.playbackRate.value = e : l._node && (l._node.playbackRate = e);
4605
var q = b.seek(f[r]),
4606
q = 1E3 * ((b._sprite[l._sprite][0] + b._sprite[l._sprite][1]) / 1E3 - q) / Math.abs(l._rate);
4607
if (b._endTimers[f[r]] || !l._paused) b._clearTimer(f[r]), b._endTimers[f[r]] = setTimeout(b._ended.bind(b, l), q);
4608
b._emit("rate", l._id)
4609
}
4610
} else return (l = b._soundById(f)) ? l._rate : b._rate;
4611
return b
4612
},
4613
seek: function() {
4614
var b = this,
4615
d = arguments,
4616
e, f;
4617
0 === d.length ? f = b._sounds[0]._id : 1 === d.length ? 0 <= b._getSoundIds().indexOf(d[0]) ? f = parseInt(d[0], 10) : (f = b._sounds[0]._id, e = parseFloat(d[0])) : 2 === d.length && (e = parseFloat(d[0]), f = parseInt(d[1], 10));
4618
if ("undefined" === typeof f) return b;
4619
if ("loaded" !== b._state) return b._queue.push({
4620
event: "seek",
4621
action: function() {
4622
b.seek.apply(b, d)
4623
}
4624
}), b;
4625
var l = b._soundById(f);
4626
if (l)
4627
if ("number" === typeof e && 0 <= e) {
4628
var r = b.playing(f);
4629
r && b.pause(f, !0);
4630
l._seek = e;
4631
l._ended = !1;
4632
b._clearTimer(f);
4633
r && b.play(f, !0);
4634
!b._webAudio && l._node && (l._node.currentTime = e);
4635
b._emit("seek", f)
4636
} else return b._webAudio ? (e = b.playing(f) ? c.ctx.currentTime - l._playStart : 0, l._seek + ((l._rateSeek ? l._rateSeek - l._seek : 0) + e * Math.abs(l._rate))) : l._node.currentTime;
4637
return b
4638
},
4639
playing: function(b) {
4640
if ("number" === typeof b) return (b = this._soundById(b)) ? !b._paused : !1;
4641
for (b = 0; b < this._sounds.length; b++)
4642
if (!this._sounds[b]._paused) return !0;
4643
return !1
4644
},
4645
duration: function(b) {
4646
var c = this._duration;
4647
(b = this._soundById(b)) && (c = this._sprite[b._sprite][1] / 1E3);
4648
return c
4649
},
4650
state: function() {
4651
return this._state
4652
},
4653
unload: function() {
4654
for (var b = this._sounds, d = 0; d < b.length; d++) {
4655
b[d]._paused || (this.stop(b[d]._id), this._emit("end", b[d]._id));
4656
this._webAudio || (b[d]._node.src = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=", b[d]._node.removeEventListener("error", b[d]._errorFn, !1), b[d]._node.removeEventListener(c._canPlayEvent, b[d]._loadFn, !1));
4657
delete b[d]._node;
4658
this._clearTimer(b[d]._id);
4659
var e = c._howls.indexOf(this);
4660
0 <= e && c._howls.splice(e, 1)
4661
}
4662
b = !0;
4663
for (d = 0; d < c._howls.length; d++)
4664
if (c._howls[d]._src === this._src) {
4665
b = !1;
4666
break
4667
}
4668
f && b && delete f[this._src];
4669
c.noAudio = !1;
4670
this._state = "unloaded";
4671
this._sounds = [];
4672
return null
4673
},
4674
on: function(b, c, d, e) {
4675
b = this["_on" + b];
4676
"function" === typeof c && b.push(e ? {
4677
id: d,
4678
fn: c,
4679
once: e
4680
} : {
4681
id: d,
4682
fn: c
4683
});
4684
return this
4685
},
4686
off: function(b, c, d) {
4687
var e = this["_on" +
4688
b],
4689
f = 0;
4690
if (c)
4691
for (f = 0; f < e.length; f++) {
4692
if (c === e[f].fn && d === e[f].id) {
4693
e.splice(f, 1);
4694
break
4695
}
4696
} else if (b) this["_on" + b] = [];
4697
else {
4698
b = Object.keys(this);
4699
for (f = 0; f < b.length; f++) 0 === b[f].indexOf("_on") && Array.isArray(this[b[f]]) && (this[b[f]] = [])
4700
}
4701
return this
4702
},
4703
once: function(b, c, d) {
4704
this.on(b, c, d, 1);
4705
return this
4706
},
4707
_emit: function(b, c, d) {
4708
for (var e = this["_on" + b], f = e.length - 1; 0 <= f; f--)
4709
if (!e[f].id || e[f].id === c || "load" === b) setTimeout(function(b) {
4710
b.call(this, c, d)
4711
}.bind(this, e[f].fn), 0), e[f].once && this.off(b, e[f].fn, e[f].id);
4712
return this
4713
},
4714
_loadQueue: function() {
4715
var b = this;
4716
if (0 < b._queue.length) {
4717
var c = b._queue[0];
4718
b.once(c.event, function() {
4719
b._queue.shift();
4720
b._loadQueue()
4721
});
4722
c.action()
4723
}
4724
return b
4725
},
4726
_ended: function(b) {
4727
var d = b._sprite,
4728
d = !(!b._loop && !this._sprite[d][2]);
4729
this._emit("end", b._id);
4730
!this._webAudio && d && this.stop(b._id, !0).play(b._id);
4731
if (this._webAudio && d) {
4732
this._emit("play", b._id);
4733
b._seek = b._start || 0;
4734
b._rateSeek = 0;
4735
b._playStart = c.ctx.currentTime;
4736
var e = 1E3 * (b._stop - b._start) / Math.abs(b._rate);
4737
this._endTimers[b._id] = setTimeout(this._ended.bind(this, b), e)
4738
}
4739
this._webAudio && !d && (b._paused = !0, b._ended = !0, b._seek = b._start || 0, b._rateSeek = 0, this._clearTimer(b._id), this._cleanBuffer(b._node), c._autoSuspend());
4740
!this._webAudio && !d && this.stop(b._id);
4741
return this
4742
},
4743
_clearTimer: function(b) {
4744
this._endTimers[b] && (clearTimeout(this._endTimers[b]), delete this._endTimers[b]);
4745
return this
4746
},
4747
_soundById: function(b) {
4748
for (var c = 0; c < this._sounds.length; c++)
4749
if (b === this._sounds[c]._id) return this._sounds[c];
4750
return null
4751
},
4752
_inactiveSound: function() {
4753
this._drain();
4754
for (var b = 0; b < this._sounds.length; b++)
4755
if (this._sounds[b]._ended) return this._sounds[b].reset();
4756
return new e(this)
4757
},
4758
_drain: function() {
4759
var b = this._pool,
4760
c = 0,
4761
d = 0;
4762
if (!(this._sounds.length < b)) {
4763
for (d = 0; d < this._sounds.length; d++) this._sounds[d]._ended && c++;
4764
for (d = this._sounds.length - 1; 0 <= d && !(c <= b); d--) this._sounds[d]._ended && (this._webAudio && this._sounds[d]._node && this._sounds[d]._node.disconnect(0), this._sounds.splice(d, 1), c--)
4765
}
4766
},
4767
_getSoundIds: function(b) {
4768
if ("undefined" === typeof b) {
4769
b = [];
4770
for (var c = 0; c < this._sounds.length; c++) b.push(this._sounds[c]._id);
4771
return b
4772
}
4773
return [b]
4774
},
4775
_refreshBuffer: function(b) {
4776
b._node.bufferSource = c.ctx.createBufferSource();
4777
b._node.bufferSource.buffer = f[this._src];
4778
b._panner ? b._node.bufferSource.connect(b._panner) : b._node.bufferSource.connect(b._node);
4779
if (b._node.bufferSource.loop = b._loop) b._node.bufferSource.loopStart = b._start || 0, b._node.bufferSource.loopEnd = b._stop;
4780
b._node.bufferSource.playbackRate.value = b._rate;
4781
return this
4782
},
4783
_cleanBuffer: function(b) {
4784
if (this._scratchBuffer) {
4785
b.bufferSource.onended = null;
4786
b.bufferSource.disconnect(0);
4787
try {
4788
b.bufferSource.buffer = this._scratchBuffer
4789
} catch (c) {}
4790
}
4791
b.bufferSource = null;
4792
return this
4793
}
4794
};
4795
var e = function(b) {
4796
this._parent = b;
4797
this.init()
4798
};
4799
e.prototype = {
4800
init: function() {
4801
var b = this._parent;
4802
this._muted = b._muted;
4803
this._loop = b._loop;
4804
this._volume = b._volume;
4805
this._muted = b._muted;
4806
this._rate = b._rate;
4807
this._seek = 0;
4808
this._ended = this._paused = !0;
4809
this._sprite = "__default";
4810
this._id = Math.round(Date.now() * Math.random());
4811
b._sounds.push(this);
4812
this.create();
4813
return this
4814
},
4815
create: function() {
4816
var b = this._parent,
4817
d = c._muted || this._muted || this._parent._muted ? 0 : this._volume;
4818
b._webAudio ? (this._node = "undefined" === typeof c.ctx.createGain ? c.ctx.createGainNode() : c.ctx.createGain(), this._node.gain.setValueAtTime(d, c.ctx.currentTime), this._node.paused = !0, this._node.connect(c.masterGain)) : (this._node = new Audio, this._errorFn = this._errorListener.bind(this), this._node.addEventListener("error", this._errorFn, !1), this._loadFn = this._loadListener.bind(this), this._node.addEventListener(c._canPlayEvent, this._loadFn, !1), this._node.src = b._src, this._node.preload = "auto", this._node.volume = d * c.volume(), this._node.load());
4819
return this
4820
},
4821
reset: function() {
4822
var b = this._parent;
4823
this._muted = b._muted;
4824
this._loop = b._loop;
4825
this._volume = b._volume;
4826
this._muted = b._muted;
4827
this._rate = b._rate;
4828
this._rateSeek = this._seek = 0;
4829
this._ended = this._paused = !0;
4830
this._sprite = "__default";
4831
this._id = Math.round(Date.now() * Math.random());
4832
return this
4833
},
4834
_errorListener: function() {
4835
this._parent._emit("loaderror", this._id, this._node.error ? this._node.error.code : 0);
4836
this._node.removeEventListener("error", this._errorListener, !1)
4837
},
4838
_loadListener: function() {
4839
var b = this._parent;
4840
b._duration = Math.ceil(10 * this._node.duration) / 10;
4841
0 === Object.keys(b._sprite).length && (b._sprite = {
4842
__default: [0, 1E3 * b._duration]
4843
});
4844
"loaded" !== b._state && (b._state = "loaded", b._emit("load"), b._loadQueue());
4845
this._node.removeEventListener(c._canPlayEvent, this._loadFn, !1)
4846
}
4847
};
4848
var f = {},
4849
l = function(b, d) {
4850
c.ctx.decodeAudioData(b, function(b) {
4851
b && 0 < d._sounds.length && (f[d._src] = b, q(d, b))
4852
}, function() {
4853
d._emit("loaderror", null, "Decoding audio data failed.")
4854
})
4855
},
4856
q = function(b, c) {
4857
c && !b._duration && (b._duration = c.duration);
4858
0 === Object.keys(b._sprite).length && (b._sprite = {
4859
__default: [0, 1E3 * b._duration]
4860
});
4861
"loaded" !== b._state && (b._state = "loaded", b._emit("load"), b._loadQueue())
4862
},
4863
r = function() {
4864
try {
4865
"undefined" !== typeof AudioContext ? c.ctx = new AudioContext : "undefined" !== typeof webkitAudioContext ? c.ctx = new webkitAudioContext : c.usingWebAudio = !1
4866
} catch (b) {
4867
c.usingWebAudio = !1
4868
}
4869
var d = /iP(hone|od|ad)/.test(c._navigator && c._navigator.platform),
4870
e = c._navigator && c._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),
4871
e = e ? parseInt(e[1], 10) : null;
4872
if (d && (e && 9 > e) && (d = /safari/.test(c._navigator && c._navigator.userAgent.toLowerCase()), c._navigator && c._navigator.standalone && !d || c._navigator && !c._navigator.standalone && !d)) c.usingWebAudio = !1;
4873
c.usingWebAudio && (c.masterGain = "undefined" === typeof c.ctx.createGain ? c.ctx.createGainNode() : c.ctx.createGain(), c.masterGain.gain.value = 1, c.masterGain.connect(c.ctx.destination));
4874
c._setup()
4875
};
4876
"function" === typeof define && define.amd && define([], function() {
4877
return {
4878
Howler: c,
4879
Howl: d
4880
}
4881
});
4882
"undefined" !== typeof exports && (exports.Howler = c, exports.Howl = d);
4883
"undefined" !== typeof window ? (window.HowlerGlobal = b, window.Howler = c, window.Howl = d, window.Sound = e) : "undefined" !== typeof global && (global.HowlerGlobal = b, global.Howler = c, global.Howl = d, global.Sound = e)
4884
})();
4885
(function() {
4886
HowlerGlobal.prototype._pos = [0, 0, 0];
4887
HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0];
4888
HowlerGlobal.prototype.stereo = function(b) {
4889
if (!this.ctx || !this.ctx.listener) return this;
4890
for (var c = this._howls.length - 1; 0 <= c; c--) this._howls[c].stereo(b);
4891
return this
4892
};
4893
HowlerGlobal.prototype.pos = function(b, c, d) {
4894
if (!this.ctx || !this.ctx.listener) return this;
4895
c = "number" !== typeof c ? this._pos[1] : c;
4896
d = "number" !== typeof d ? this._pos[2] : d;
4897
if ("number" === typeof b) this._pos = [b, c, d], this.ctx.listener.setPosition(this._pos[0], this._pos[1], this._pos[2]);
4898
else return this._pos;
4899
return this
4900
};
4901
HowlerGlobal.prototype.orientation = function(b, c, d, e, g, m) {
4902
if (!this.ctx || !this.ctx.listener) return this;
4903
var n = this._orientation;
4904
c = "number" !== typeof c ? n[1] : c;
4905
d = "number" !== typeof d ? n[2] : d;
4906
e = "number" !== typeof e ? n[3] : e;
4907
g = "number" !== typeof g ? n[4] : g;
4908
m = "number" !== typeof m ? n[5] : m;
4909
if ("number" === typeof b) this._orientation = [b, c, d, e, g, m], this.ctx.listener.setOrientation(b, c, d, e, g, m);
4910
else return n;
4911
return this
4912
};
4913
var b = Howl.prototype.init;
4914
Howl.prototype.init = function(c) {
4915
this._orientation = c.orientation || [1, 0, 0];
4916
this._stereo = c.stereo || null;
4917
this._pos = c.pos || null;
4918
this._pannerAttr = {
4919
coneInnerAngle: "undefined" !== typeof c.coneInnerAngle ? c.coneInnerAngle : 360,
4920
coneOuterAngle: "undefined" !== typeof c.coneOuterAngle ? c.coneOuterAngle : 360,
4921
coneOuterGain: "undefined" !== typeof c.coneOuterGain ? c.coneOuterGain : 0,
4922
distanceModel: "undefined" !== typeof c.distanceModel ? c.distanceModel : "inverse",
4923
maxDistance: "undefined" !== typeof c.maxDistance ? c.maxDistance : 1E4,
4924
panningModel: "undefined" !== typeof c.panningModel ? c.panningModel : "HRTF",
4925
refDistance: "undefined" !== typeof c.refDistance ? c.refDistance : 1,
4926
rolloffFactor: "undefined" !== typeof c.rolloffFactor ? c.rolloffFactor : 1
4927
};
4928
this._onstereo = c.onstereo ? [{
4929
fn: c.onstereo
4930
}] : [];
4931
this._onpos = c.onpos ? [{
4932
fn: c.onpos
4933
}] : [];
4934
this._onorientation = c.onorientation ? [{
4935
fn: c.onorientation
4936
}] : [];
4937
return b.call(this, c)
4938
};
4939
Howl.prototype.stereo = function(b, c) {
4940
var d = this;
4941
if (!d._webAudio) return d;
4942
if ("loaded" !== d._state) return d._queue.push({
4943
event: "stereo",
4944
action: function() {
4945
d.stereo(b, c)
4946
}
4947
}), d;
4948
var r = "undefined" === typeof Howler.ctx.createStereoPanner ? "spatial" : "stereo";
4949
if ("undefined" === typeof c)
4950
if ("number" === typeof b) d._stereo = b, d._pos = [b, 0, 0];
4951
else return d._stereo;
4952
for (var g = d._getSoundIds(c), m = 0; m < g.length; m++) {
4953
var n = d._soundById(g[m]);
4954
if (n)
4955
if ("number" === typeof b) n._stereo = b, n._pos = [b, 0, 0], n._node && (n._pannerAttr.panningModel = "equalpower", (!n._panner || !n._panner.pan) && e(n, r), "spatial" === r ? n._panner.setPosition(b, 0, 0) : n._panner.pan.value = b), d._emit("stereo", n._id);
4956
else return n._stereo
4957
}
4958
return d
4959
};
4960
Howl.prototype.pos = function(b, c, d, r) {
4961
var g = this;
4962
if (!g._webAudio) return g;
4963
if ("loaded" !== g._state) return g._queue.push({
4964
event: "pos",
4965
action: function() {
4966
g.pos(b, c, d, r)
4967
}
4968
}), g;
4969
c = "number" !== typeof c ? 0 : c;
4970
d = "number" !== typeof d ? -0.5 : d;
4971
if ("undefined" === typeof r)
4972
if ("number" === typeof b) g._pos = [b, c, d];
4973
else return g._pos;
4974
for (var m = g._getSoundIds(r), n = 0; n < m.length; n++) {
4975
var p = g._soundById(m[n]);
4976
if (p)
4977
if ("number" === typeof b) p._pos = [b, c, d], p._node && ((!p._panner || p._panner.pan) && e(p, "spatial"), p._panner.setPosition(b, c, d)), g._emit("pos", p._id);
4978
else return p._pos
4979
}
4980
return g
4981
};
4982
Howl.prototype.orientation = function(b, c, d, r) {
4983
var g = this;
4984
if (!g._webAudio) return g;
4985
if ("loaded" !== g._state) return g._queue.push({
4986
event: "orientation",
4987
action: function() {
4988
g.orientation(b, c, d, r)
4989
}
4990
}), g;
4991
c = "number" !== typeof c ? g._orientation[1] : c;
4992
d = "number" !== typeof d ? g._orientation[2] : d;
4993
if ("undefined" === typeof r)
4994
if ("number" === typeof b) g._orientation = [b, c, d];
4995
else return g._orientation;
4996
for (var m = g._getSoundIds(r), n = 0; n < m.length; n++) {
4997
var p = g._soundById(m[n]);
4998
if (p)
4999
if ("number" === typeof b) p._orientation = [b, c, d], p._node && (p._panner || (p._pos || (p._pos = g._pos || [0, 0, -0.5]), e(p, "spatial")), p._panner.setOrientation(b, c, d)), g._emit("orientation", p._id);
5000
else return p._orientation
5001
}
5002
return g
5003
};
5004
Howl.prototype.pannerAttr = function() {
5005
var b = arguments,
5006
c, d;
5007
if (!this._webAudio) return this;
5008
if (0 === b.length) return this._pannerAttr;
5009
if (1 === b.length)
5010
if ("object" === typeof b[0]) c = b[0], "undefined" === typeof d && (this._pannerAttr = {
5011
coneInnerAngle: "undefined" !== typeof c.coneInnerAngle ? c.coneInnerAngle : this._coneInnerAngle,
5012
coneOuterAngle: "undefined" !== typeof c.coneOuterAngle ? c.coneOuterAngle : this._coneOuterAngle,
5013
coneOuterGain: "undefined" !== typeof c.coneOuterGain ? c.coneOuterGain : this._coneOuterGain,
5014
distanceModel: "undefined" !== typeof c.distanceModel ? c.distanceModel : this._distanceModel,
5015
maxDistance: "undefined" !== typeof c.maxDistance ? c.maxDistance : this._maxDistance,
5016
panningModel: "undefined" !== typeof c.panningModel ? c.panningModel : this._panningModel,
5017
refDistance: "undefined" !== typeof c.refDistance ? c.refDistance : this._refDistance,
5018
rolloffFactor: "undefined" !== typeof c.rolloffFactor ? c.rolloffFactor : this._rolloffFactor
5019
});
5020
else return (b = this._soundById(parseInt(b[0], 10))) ? b._pannerAttr : this._pannerAttr;
5021
else 2 === b.length && (c = b[0], d = parseInt(b[1], 10));
5022
d = this._getSoundIds(d);
5023
for (var r = 0; r < d.length; r++)
5024
if (b = this._soundById(d[r])) {
5025
var g = b._pannerAttr,
5026
g = {
5027
coneInnerAngle: "undefined" !== typeof c.coneInnerAngle ? c.coneInnerAngle : g.coneInnerAngle,
5028
coneOuterAngle: "undefined" !== typeof c.coneOuterAngle ? c.coneOuterAngle : g.coneOuterAngle,
5029
coneOuterGain: "undefined" !== typeof c.coneOuterGain ? c.coneOuterGain : g.coneOuterGain,
5030
distanceModel: "undefined" !== typeof c.distanceModel ? c.distanceModel : g.distanceModel,
5031
maxDistance: "undefined" !== typeof c.maxDistance ? c.maxDistance : g.maxDistance,
5032
panningModel: "undefined" !== typeof c.panningModel ? c.panningModel : g.panningModel,
5033
refDistance: "undefined" !== typeof c.refDistance ? c.refDistance : g.refDistance,
5034
rolloffFactor: "undefined" !== typeof c.rolloffFactor ? c.rolloffFactor : g.rolloffFactor
5035
},
5036
m = b._panner;
5037
m ? (m.coneInnerAngle = g.coneInnerAngle, m.coneOuterAngle = g.coneOuterAngle, m.coneOuterGain = g.coneOuterGain, m.distanceModel = g.distanceModel, m.maxDistance = g.maxDistance, m.panningModel = g.panningModel, m.refDistance = g.refDistance, m.rolloffFactor = g.rolloffFactor) : (b._pos || (b._pos = this._pos || [0, 0, -0.5]), e(b, "spatial"))
5038
}
5039
return this
5040
};
5041
var c = Sound.prototype.init;
5042
Sound.prototype.init = function() {
5043
var b = this._parent;
5044
this._orientation = b._orientation;
5045
this._stereo = b._stereo;
5046
this._pos = b._pos;
5047
this._pannerAttr = b._pannerAttr;
5048
c.call(this);
5049
this._stereo ? b.stereo(this._stereo) : this._pos && b.pos(this._pos[0], this._pos[1], this._pos[2], this._id)
5050
};
5051
var d = Sound.prototype.reset;
5052
Sound.prototype.reset = function() {
5053
var b = this._parent;
5054
this._orientation = b._orientation;
5055
this._pos = b._pos;
5056
this._pannerAttr = b._pannerAttr;
5057
return d.call(this)
5058
};
5059
var e = function(b, c) {
5060
"spatial" === (c || "spatial") ? (b._panner = Howler.ctx.createPanner(), b._panner.coneInnerAngle = b._pannerAttr.coneInnerAngle, b._panner.coneOuterAngle = b._pannerAttr.coneOuterAngle, b._panner.coneOuterGain = b._pannerAttr.coneOuterGain, b._panner.distanceModel = b._pannerAttr.distanceModel, b._panner.maxDistance = b._pannerAttr.maxDistance, b._panner.panningModel = b._pannerAttr.panningModel, b._panner.refDistance = b._pannerAttr.refDistance, b._panner.rolloffFactor = b._pannerAttr.rolloffFactor, b._panner.setPosition(b._pos[0], b._pos[1], b._pos[2]), b._panner.setOrientation(b._orientation[0], b._orientation[1], b._orientation[2])) : (b._panner = Howler.ctx.createStereoPanner(), b._panner.pan.value = b._stereo);
5061
b._panner.connect(b._node);
5062
b._paused || b._parent.pause(b._id, !0).play(b._id)
5063
}
5064
})();
5065
5066
(function(b) {
5067
Number.prototype.map = function(b, c, d, e) {
5068
return d + (e - d) * ((this - b) / (c - b))
5069
};
5070
Number.prototype.limit = function(b, c) {
5071
return Math.min(c, Math.max(b, this))
5072
};
5073
Number.prototype.round = function(b) {
5074
b = Math.pow(10, b || 0);
5075
return Math.round(this * b) / b
5076
};
5077
Number.prototype.floor = function() {
5078
return Math.floor(this)
5079
};
5080
Number.prototype.ceil = function() {
5081
return Math.ceil(this)
5082
};
5083
Number.prototype.toInt = function() {
5084
return this | 0
5085
};
5086
Number.prototype.toRad = function() {
5087
return this / 180 * Math.PI
5088
};
5089
Number.prototype.toDeg = function() {
5090
return 180 * this / Math.PI
5091
};
5092
Array.prototype.erase = function(b) {
5093
for (var c = this.length; c--;) this[c] === b && this.splice(c, 1);
5094
return this
5095
};
5096
Array.prototype.random = function() {
5097
return this[Math.floor(Math.random() * this.length)]
5098
};
5099
Function.prototype.bind = Function.prototype.bind || function(b) {
5100
if ("function" !== typeof this) throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
5101
var c = Array.prototype.slice.call(arguments, 1),
5102
d = this,
5103
e = function() {},
5104
f = function() {
5105
return d.apply(this instanceof e && b ? this : b, c.concat(Array.prototype.slice.call(arguments)))
5106
};
5107
e.prototype = this.prototype;
5108
f.prototype = new e;
5109
return f
5110
};
5111
b.ig = {
5112
game: null,
5113
debug: null,
5114
version: "1.23",
5115
global: b,
5116
modules: {},
5117
resources: [],
5118
ready: !1,
5119
baked: !1,
5120
nocache: "",
5121
ua: {},
5122
prefix: b.ImpactPrefix || "",
5123
lib: "lib/",
5124
_current: null,
5125
_loadQueue: [],
5126
_waitForOnload: 0,
5127
$: function(b) {
5128
return "#" == b.charAt(0) ? document.getElementById(b.substr(1)) : document.getElementsByTagName(b)
5129
},
5130
$new: function(b) {
5131
return document.createElement(b)
5132
},
5133
copy: function(b) {
5134
if (!b || "object" != typeof b || b instanceof HTMLElement || b instanceof ig.Class) return b;
5135
if (b instanceof Array)
5136
for (var c = [], d = 0, e = b.length; d < e; d++) c[d] = ig.copy(b[d]);
5137
else
5138
for (d in c = {}, b) c[d] = ig.copy(b[d]);
5139
return c
5140
},
5141
merge: function(b, c) {
5142
for (var d in c) {
5143
var e = c[d];
5144
if ("object" != typeof e || e instanceof HTMLElement || e instanceof ig.Class || null === e) b[d] = e;
5145
else {
5146
if (!b[d] || "object" != typeof b[d]) b[d] = e instanceof Array ? [] : {};
5147
ig.merge(b[d], e)
5148
}
5149
}
5150
return b
5151
},
5152
ksort: function(b) {
5153
if (!b || "object" != typeof b) return [];
5154
var c = [],
5155
d = [],
5156
e;
5157
for (e in b) c.push(e);
5158
c.sort();
5159
for (e = 0; e < c.length; e++) d.push(b[c[e]]);
5160
return d
5161
},
5162
setVendorAttribute: function(b, c, d) {
5163
var e = c.charAt(0).toUpperCase() + c.substr(1);
5164
b[c] = b["ms" + e] = b["moz" + e] = b["webkit" + e] = b["o" + e] = d
5165
},
5166
getVendorAttribute: function(b, c) {
5167
var d = c.charAt(0).toUpperCase() + c.substr(1);
5168
return b[c] || b["ms" + d] || b["moz" + d] || b["webkit" + d] || b["o" + d]
5169
},
5170
normalizeVendorAttribute: function(b, c) {
5171
var d = ig.getVendorAttribute(b, c);
5172
!b[c] && d && (b[c] = d)
5173
},
5174
getImagePixels: function(b, c, d, e, f) {
5175
var l = ig.$new("canvas");
5176
l.width = b.width;
5177
l.height = b.height;
5178
var q = l.getContext("2d");
5179
ig.System.SCALE.CRISP(l, q);
5180
var t = ig.getVendorAttribute(q, "backingStorePixelRatio") || 1;
5181
ig.normalizeVendorAttribute(q, "getImageDataHD");
5182
var y = b.width / t,
5183
G = b.height / t;
5184
l.width = Math.ceil(y);
5185
l.height = Math.ceil(G);
5186
q.drawImage(b, 0, 0, y, G);
5187
return 1 === t ? q.getImageData(c, d, e, f) : q.getImageDataHD(c, d, e, f)
5188
},
5189
module: function(b) {
5190
if (ig._current) throw "Module '" + ig._current.name + "' defines nothing";
5191
if (ig.modules[b] && ig.modules[b].body) throw "Module '" + b + "' is already defined";
5192
ig._current = {
5193
name: b,
5194
requires: [],
5195
loaded: !1,
5196
body: null
5197
};
5198
ig.modules[b] = ig._current;
5199
ig._loadQueue.push(ig._current);
5200
return ig
5201
},
5202
requires: function() {
5203
ig._current.requires = Array.prototype.slice.call(arguments);
5204
return ig
5205
},
5206
defines: function(b) {
5207
ig._current.body = b;
5208
ig._current = null;
5209
ig._initDOMReady()
5210
},
5211
addResource: function(b) {
5212
ig.resources.push(b)
5213
},
5214
setNocache: function(b) {
5215
ig.nocache = b ? "?" + Date.now() : ""
5216
},
5217
log: function() {},
5218
assert: function() {},
5219
show: function() {},
5220
mark: function() {},
5221
_loadScript: function(b, c) {
5222
ig.modules[b] = {
5223
name: b,
5224
requires: [],
5225
loaded: !1,
5226
body: null
5227
};
5228
ig._waitForOnload++;
5229
var d = ig.prefix + ig.lib + b.replace(/\./g, "/") + ".js" + ig.nocache,
5230
e = ig.$new("script");
5231
e.type = "text/javascript";
5232
e.src = d;
5233
e.onload = function() {
5234
ig._waitForOnload--;
5235
ig._execModules()
5236
};
5237
e.onerror = function() {
5238
throw "Failed to load module " + b + " at " + d + " required from " + c;
5239
};
5240
ig.$("head")[0].appendChild(e)
5241
},
5242
_execModules: function() {
5243
for (var b = !1, c = 0; c < ig._loadQueue.length; c++) {
5244
for (var d = ig._loadQueue[c], e = !0, f = 0; f < d.requires.length; f++) {
5245
var l = d.requires[f];
5246
ig.modules[l] ? ig.modules[l].loaded || (e = !1) : (e = !1, ig._loadScript(l, d.name))
5247
}
5248
e && d.body && (ig._loadQueue.splice(c, 1), d.loaded = !0, d.body(), b = !0, c--)
5249
}
5250
if (b) ig._execModules();
5251
else if (!ig.baked && 0 == ig._waitForOnload && 0 != ig._loadQueue.length) {
5252
b = [];
5253
for (c = 0; c < ig._loadQueue.length; c++) {
5254
e = [];
5255
l = ig._loadQueue[c].requires;
5256
for (f = 0; f < l.length; f++) d = ig.modules[l[f]], (!d || !d.loaded) && e.push(l[f]);
5257
b.push(ig._loadQueue[c].name + " (requires: " + e.join(", ") + ")")
5258
}
5259
throw "Unresolved (or circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules or a previous syntax error prevents a module from loading:\n" +
5260
b.join("\n");
5261
}
5262
},
5263
_DOMReady: function() {
5264
if (!ig.modules["dom.ready"].loaded) {
5265
if (!document.body) return setTimeout(ig._DOMReady, 13);
5266
ig.modules["dom.ready"].loaded = !0;
5267
ig._waitForOnload--;
5268
ig._execModules()
5269
}
5270
return 0
5271
},
5272
_boot: function() {
5273
document.location.href.match(/\?nocache/) && ig.setNocache(!0);
5274
ig.ua.pixelRatio = b.devicePixelRatio || 1;
5275
ig.ua.viewport = {
5276
width: b.innerWidth,
5277
height: b.innerHeight
5278
};
5279
ig.ua.screen = {
5280
width: b.screen.availWidth * ig.ua.pixelRatio,
5281
height: b.screen.availHeight * ig.ua.pixelRatio
5282
};
5283
ig.ua.iPhone = /iPhone/i.test(navigator.userAgent);
5284
ig.ua.iPhone4 = ig.ua.iPhone && 2 == ig.ua.pixelRatio;
5285
ig.ua.iPad = /iPad/i.test(navigator.userAgent);
5286
ig.ua.android = /android/i.test(navigator.userAgent);
5287
ig.ua.winPhone = /Windows Phone/i.test(navigator.userAgent);
5288
ig.ua.iOS = ig.ua.iPhone || ig.ua.iPad;
5289
ig.ua.mobile = ig.ua.iOS || ig.ua.android || ig.ua.winPhone || /mobile/i.test(navigator.userAgent);
5290
ig.ua.touchDevice = "ontouchstart" in b || b.navigator.msMaxTouchPoints;
5291
ig.ua.is_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent);
5292
ig.ua.is_safari_or_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
5293
ig.ua.iOS = ig.ua.iPhone || ig.ua.iPad;
5294
ig.ua.iOS6_tag = /OS 6_/i.test(navigator.userAgent);
5295
ig.ua.iOS6 = (ig.ua.iPhone || ig.ua.iPad) && ig.ua.iOS6_tag;
5296
ig.ua.winPhone = /Windows Phone/i.test(navigator.userAgent);
5297
ig.ua.touchDevice = "ontouchstart" in b || b.navigator.msMaxTouchPoints;
5298
ig.ua.mobile = ig.ua.iOS || ig.ua.android || ig.ua.iOS6 || ig.ua.winPhone || /mobile/i.test(navigator.userAgent)
5299
},
5300
_initDOMReady: function() {
5301
ig.modules["dom.ready"] ? ig._execModules() : (ig._boot(), ig.modules["dom.ready"] = {
5302
requires: [],
5303
loaded: !1,
5304
body: null
5305
}, ig._waitForOnload++, "complete" === document.readyState ? ig._DOMReady() : (document.addEventListener("DOMContentLoaded", ig._DOMReady, !1), b.addEventListener("load", ig._DOMReady, !1)))
5306
}
5307
};
5308
ig.normalizeVendorAttribute(b, "requestAnimationFrame");
5309
if (b.requestAnimationFrame) {
5310
var c = 1,
5311
d = {};
5312
b.ig.setAnimation = function(e, f) {
5313
var l = c++;
5314
d[l] = !0;
5315
var n = function() {
5316
d[l] && (b.requestAnimationFrame(n, f), e())
5317
};
5318
b.requestAnimationFrame(n, f);
5319
return l
5320
};
5321
b.ig.clearAnimation = function(b) {
5322
delete d[b]
5323
}
5324
} else b.ig.setAnimation = function(c) {
5325
return b.setInterval(c, 1E3 / 60)
5326
}, b.ig.clearAnimation = function(c) {
5327
b.clearInterval(c)
5328
};
5329
var e = !1,
5330
f = /xyz/.test(function() {
5331
xyz
5332
}) ? /\bparent\b/ : /.*/,
5333
l = 0;
5334
b.ig.Class = function() {};
5335
var q = function(b) {
5336
var c = this.prototype,
5337
d = {},
5338
e;
5339
for (e in b) "function" == typeof b[e] && "function" == typeof c[e] && f.test(b[e]) ? (d[e] = c[e], c[e] = function(b, c) {
5340
return function() {
5341
var e = this.parent;
5342
this.parent = d[b];
5343
var f = c.apply(this, arguments);
5344
this.parent = e;
5345
return f
5346
}
5347
}(e, b[e])) : c[e] = b[e]
5348
};
5349
b.ig.Class.extend = function(c) {
5350
function d() {
5351
if (!e) {
5352
if (this.staticInstantiate) {
5353
var b = this.staticInstantiate.apply(this, arguments);
5354
if (b) return b
5355
}
5356
for (var c in this) "object" == typeof this[c] && (this[c] = ig.copy(this[c]));
5357
this.init && this.init.apply(this, arguments)
5358
}
5359
return this
5360
}
5361
var m = this.prototype;
5362
e = !0;
5363
var n = new this;
5364
e = !1;
5365
for (var p in c) n[p] = "function" == typeof c[p] && "function" == typeof m[p] && f.test(c[p]) ? function(b, c) {
5366
return function() {
5367
var d = this.parent;
5368
this.parent = m[b];
5369
var e = c.apply(this, arguments);
5370
this.parent = d;
5371
return e
5372
}
5373
}(p, c[p]) : c[p];
5374
d.prototype = n;
5375
d.prototype.constructor = d;
5376
d.extend = b.ig.Class.extend;
5377
d.inject = q;
5378
d.classId = n.classId = ++l;
5379
return d
5380
};
5381
b.ImpactMixin && ig.merge(ig, b.ImpactMixin)
5382
})(window);
5383
ig.baked = !0;
5384
ig.module("impact.image").defines(function() {
5385
ig.Image = ig.Class.extend({
5386
data: null,
5387
width: 0,
5388
height: 0,
5389
loaded: !1,
5390
failed: !1,
5391
loadCallback: null,
5392
path: "",
5393
staticInstantiate: function(b) {
5394
return ig.Image.cache[b] || null
5395
},
5396
init: function(b) {
5397
this.path = b;
5398
this.load()
5399
},
5400
load: function(b) {
5401
this.loaded ? b && b(this.path, !0) : (!this.loaded && ig.ready ? (this.loadCallback = b || null, this.data = new Image, this.data.onload = this.onload.bind(this), this.data.onerror = this.onerror.bind(this), this.data.src = ig.prefix + this.path + ig.nocache) : ig.addResource(this), ig.Image.cache[this.path] = this)
5402
},
5403
reload: function() {
5404
this.loaded = !1;
5405
this.data = new Image;
5406
this.data.onload = this.onload.bind(this);
5407
this.data.src = this.path + "?" + Date.now()
5408
},
5409
onload: function() {
5410
this.width = this.data.width;
5411
this.height = this.data.height;
5412
this.loaded = !0;
5413
1 != ig.system.scale && this.resize(ig.system.scale);
5414
this.loadCallback && this.loadCallback(this.path, !0)
5415
},
5416
onerror: function() {
5417
this.failed = !0;
5418
this.loadCallback && this.loadCallback(this.path, !1)
5419
},
5420
resize: function(b) {
5421
var c = this.width * b,
5422
d = this.height * b,
5423
e = ig.$new("canvas");
5424
e.width = this.width;
5425
e.height = this.height;
5426
e = e.getContext("2d");
5427
e.drawImage(this.data, 0, 0, this.width, this.height, 0, 0, this.width, this.height);
5428
var e = e.getImageData(0, 0, this.width, this.height),
5429
f = ig.$new("canvas");
5430
f.width = c;
5431
f.height = d;
5432
for (var l = f.getContext("2d"), q = l.getImageData(0, 0, c, d), r = 0; r < d; r++)
5433
for (var g = 0; g < c; g++) {
5434
var m = 4 * (Math.floor(r / b) * this.width + Math.floor(g / b)),
5435
n = 4 * (r * c + g);
5436
q.data[n] = e.data[m];
5437
q.data[n + 1] = e.data[m + 1];
5438
q.data[n + 2] = e.data[m + 2];
5439
q.data[n + 3] = e.data[m + 3]
5440
}
5441
l.putImageData(q, 0, 0);
5442
this.data = f
5443
},
5444
draw: function(b, c, d, e, f, l) {
5445
if (this.loaded) {
5446
var q = ig.system.scale;
5447
f = (f ? f : this.width) * q;
5448
l = (l ? l : this.height) * q;
5449
ig.system.context.drawImage(this.data, d ? d * q : 0, e ? e * q : 0, f, l, ig.system.getDrawPos(b), ig.system.getDrawPos(c), f, l);
5450
ig.Image.drawCount++
5451
}
5452
},
5453
drawTile: function(b, c, d, e, f, l, q) {
5454
f = f ? f : e;
5455
if (this.loaded && !(e > this.width || f > this.height)) {
5456
var r = ig.system.scale,
5457
g = Math.floor(e * r),
5458
m = Math.floor(f * r),
5459
n = l ? -1 : 1,
5460
p = q ? -1 : 1;
5461
if (l || q) ig.system.context.save(), ig.system.context.scale(n, p);
5462
ig.system.context.drawImage(this.data, Math.floor(d * e) % this.width * r, Math.floor(d * e / this.width) * f * r, g, m, ig.system.getDrawPos(b) * n - (l ? g : 0), ig.system.getDrawPos(c) * p - (q ? m : 0), g, m);
5463
(l || q) && ig.system.context.restore();
5464
ig.Image.drawCount++
5465
}
5466
}
5467
});
5468
ig.Image.drawCount = 0;
5469
ig.Image.cache = {};
5470
ig.Image.reloadCache = function() {
5471
for (var b in ig.Image.cache) ig.Image.cache[b].reload()
5472
}
5473
});
5474
ig.baked = !0;
5475
ig.module("impact.font").requires("impact.image").defines(function() {
5476
ig.Font = ig.Image.extend({
5477
widthMap: [],
5478
indices: [],
5479
firstChar: 32,
5480
alpha: 1,
5481
letterSpacing: 1,
5482
lineSpacing: 0,
5483
onload: function(b) {
5484
this._loadMetrics(this.data);
5485
this.parent(b)
5486
},
5487
widthForString: function(b) {
5488
if (-1 !== b.indexOf("\n")) {
5489
b = b.split("\n");
5490
for (var c = 0, d = 0; d < b.length; d++) c = Math.max(c, this._widthForLine(b[d]));
5491
return c
5492
}
5493
return this._widthForLine(b)
5494
},
5495
_widthForLine: function(b) {
5496
for (var c = 0, d = 0; d < b.length; d++) c += this.widthMap[b.charCodeAt(d) - this.firstChar] +
5497
this.letterSpacing;
5498
return c
5499
},
5500
heightForString: function(b) {
5501
return b.split("\n").length * (this.height + this.lineSpacing)
5502
},
5503
draw: function(b, c, d, e) {
5504
"string" != typeof b && (b = b.toString());
5505
if (-1 !== b.indexOf("\n")) {
5506
b = b.split("\n");
5507
for (var f = this.height + this.lineSpacing, l = 0; l < b.length; l++) this.draw(b[l], c, d + l * f, e)
5508
} else {
5509
if (e == ig.Font.ALIGN.RIGHT || e == ig.Font.ALIGN.CENTER) l = this._widthForLine(b), c -= e == ig.Font.ALIGN.CENTER ? l / 2 : l;
5510
1 !== this.alpha && (ig.system.context.globalAlpha = this.alpha);
5511
for (l = 0; l < b.length; l++) e = b.charCodeAt(l), c += this._drawChar(e - this.firstChar, c, d);
5512
1 !== this.alpha && (ig.system.context.globalAlpha = 1);
5513
ig.Image.drawCount += b.length
5514
}
5515
},
5516
_drawChar: function(b, c, d) {
5517
if (!this.loaded || 0 > b || b >= this.indices.length) return 0;
5518
var e = ig.system.scale,
5519
f = this.widthMap[b] * e,
5520
l = (this.height - 2) * e;
5521
ig.system.context.drawImage(this.data, this.indices[b] * e, 0, f, l, ig.system.getDrawPos(c), ig.system.getDrawPos(d), f, l);
5522
return this.widthMap[b] + this.letterSpacing
5523
},
5524
_loadMetrics: function(b) {
5525
this.height = b.height - 1;
5526
this.widthMap = [];
5527
this.indices = [];
5528
var c = ig.$new("canvas");
5529
c.width = b.width;
5530
c.height = b.height;
5531
c = c.getContext("2d");
5532
c.drawImage(b, 0, 0);
5533
for (var c = c.getImageData(0, b.height - 1, b.width, 1), d = 0, e = 0, f = 0; f < b.width; f++) {
5534
var l = 4 * f + 3;
5535
0 != c.data[l] ? e++ : 0 == c.data[l] && e && (this.widthMap.push(e), this.indices.push(f - e), d++, e = 0)
5536
}
5537
this.widthMap.push(e);
5538
this.indices.push(f - e)
5539
}
5540
});
5541
ig.Font.ALIGN = {
5542
LEFT: 0,
5543
RIGHT: 1,
5544
CENTER: 2
5545
}
5546
});
5547
ig.baked = !0;
5548
ig.module("impact.sound").defines(function() {
5549
ig.SoundManager = ig.Class.extend({
5550
clips: {},
5551
volume: 1,
5552
format: null,
5553
init: function() {
5554
for (var b = new Audio, c = 0; c < ig.Sound.use.length; c++) {
5555
var d = ig.Sound.use[c];
5556
if (b.canPlayType(d.mime)) {
5557
this.format = d;
5558
break
5559
}
5560
}
5561
this.format || (ig.Sound.enabled = !1)
5562
},
5563
load: function(b, c, d) {
5564
var e = ig.prefix + b.replace(/[^\.]+$/, this.format.ext) + ig.nocache;
5565
if (this.clips[b]) {
5566
if (c && this.clips[b].length < ig.Sound.channels)
5567
for (c = this.clips[b].length; c < ig.Sound.channels; c++) {
5568
var f = new Audio(e);
5569
f.load();
5570
this.clips[b].push(f)
5571
}
5572
return this.clips[b][0]
5573
}
5574
var l = new Audio(e);
5575
d && (l.addEventListener("canplaythrough", function r(c) {
5576
l.removeEventListener("canplaythrough", r, !1);
5577
d(b, !0, c)
5578
}, !1), l.addEventListener("error", function(c) {
5579
d(b, !0, c)
5580
}, !1));
5581
l.preload = "auto";
5582
l.load();
5583
this.clips[b] = [l];
5584
if (c)
5585
for (c = 1; c < ig.Sound.channels; c++) f = new Audio(e), f.load(), this.clips[b].push(f);
5586
return l
5587
},
5588
get: function(b) {
5589
b = this.clips[b];
5590
for (var c = 0, d; d = b[c++];)
5591
if (d.paused || d.ended) return d.ended && (d.currentTime = 0), d;
5592
b[0].pause();
5593
b[0].currentTime = 0;
5594
return b[0]
5595
}
5596
});
5597
ig.Music = ig.Class.extend({
5598
tracks: [],
5599
namedTracks: {},
5600
currentTrack: null,
5601
currentIndex: 0,
5602
random: !1,
5603
_volume: 1,
5604
_loop: !1,
5605
_fadeInterval: 0,
5606
_fadeTimer: null,
5607
_endedCallbackBound: null,
5608
init: function() {
5609
this._endedCallbackBound = this._endedCallback.bind(this);
5610
Object.defineProperty ? (Object.defineProperty(this, "volume", {
5611
get: this.getVolume.bind(this),
5612
set: this.setVolume.bind(this)
5613
}), Object.defineProperty(this, "loop", {
5614
get: this.getLooping.bind(this),
5615
set: this.setLooping.bind(this)
5616
})) : this.__defineGetter__ && (this.__defineGetter__("volume", this.getVolume.bind(this)), this.__defineSetter__("volume", this.setVolume.bind(this)), this.__defineGetter__("loop", this.getLooping.bind(this)), this.__defineSetter__("loop", this.setLooping.bind(this)))
5617
},
5618
add: function(b, c) {
5619
if (ig.Sound.enabled) {
5620
var d = ig.soundManager.load(b instanceof ig.Sound ? b.path : b, !1);
5621
d.loop = this._loop;
5622
d.volume = this._volume;
5623
d.addEventListener("ended", this._endedCallbackBound, !1);
5624
this.tracks.push(d);
5625
c && (this.namedTracks[c] = d);
5626
this.currentTrack || (this.currentTrack = d)
5627
}
5628
},
5629
next: function() {
5630
this.tracks.length && (this.stop(), this.currentIndex = this.random ? Math.floor(Math.random() * this.tracks.length) : (this.currentIndex + 1) % this.tracks.length, this.currentTrack = this.tracks[this.currentIndex], this.play())
5631
},
5632
pause: function() {
5633
this.currentTrack && this.currentTrack.pause()
5634
},
5635
stop: function() {
5636
if (this.currentTrack) {
5637
this.currentTrack.pause();
5638
try {
5639
this.currentTrack.currentTime = 0
5640
} catch (b) {
5641
console.log(b)
5642
}
5643
}
5644
},
5645
play: function(b) {
5646
if (b && this.namedTracks[b]) b = this.namedTracks[b], b != this.currentTrack && (this.stop(), this.currentTrack = b);
5647
else if (!this.currentTrack) return;
5648
this.currentTrack.play()
5649
},
5650
getLooping: function() {
5651
return this._loop
5652
},
5653
setLooping: function(b) {
5654
this._loop = b;
5655
for (var c in this.tracks) this.tracks[c].loop = b
5656
},
5657
getVolume: function() {
5658
return this._volume
5659
},
5660
setVolume: function(b) {
5661
this._volume = b.limit(0, 1);
5662
for (var c in this.tracks) this.tracks[c].volume = this._volume
5663
},
5664
fadeOut: function(b) {
5665
this.currentTrack && (clearInterval(this._fadeInterval), this.fadeTimer = new ig.Timer(b), this._fadeInterval = setInterval(this._fadeStep.bind(this), 50))
5666
},
5667
_fadeStep: function() {
5668
var b = this.fadeTimer.delta().map(-this.fadeTimer.target, 0, 1, 0).limit(0, 1) * this._volume;
5669
0.01 >= b ? (this.stop(), this.currentTrack.volume = this._volume, clearInterval(this._fadeInterval)) : this.currentTrack.volume = b
5670
},
5671
_endedCallback: function() {
5672
this._loop ? this.play() : this.next()
5673
}
5674
});
5675
ig.Sound = ig.Class.extend({
5676
path: "",
5677
volume: 1,
5678
currentClip: null,
5679
multiChannel: !0,
5680
init: function(b, c) {
5681
this.path = b;
5682
this.multiChannel = !1 !== c;
5683
this.load()
5684
},
5685
load: function(b) {
5686
ig.Sound.enabled ? ig.ready ? ig.soundManager.load(this.path, this.multiChannel, b) : ig.addResource(this) : b && b(this.path, !0)
5687
},
5688
play: function() {
5689
ig.Sound.enabled && (this.currentClip = ig.soundManager.get(this.path), this.currentClip.volume = ig.soundManager.volume * this.volume, this.currentClip.play())
5690
},
5691
stop: function() {
5692
this.currentClip && (this.currentClip.pause(), this.currentClip.currentTime = 0)
5693
}
5694
});
5695
ig.Sound.FORMAT = {
5696
MP3: {
5697
ext: "mp3",
5698
mime: "audio/mpeg"
5699
},
5700
M4A: {
5701
ext: "m4a",
5702
mime: "audio/mp4; codecs=mp4a"
5703
},
5704
OGG: {
5705
ext: "ogg",
5706
mime: "audio/ogg; codecs=vorbis"
5707
},
5708
WEBM: {
5709
ext: "webm",
5710
mime: "audio/webm; codecs=vorbis"
5711
},
5712
CAF: {
5713
ext: "caf",
5714
mime: "audio/x-caf"
5715
}
5716
};
5717
ig.Sound.use = [ig.Sound.FORMAT.MP3, ig.Sound.FORMAT.OGG];
5718
ig.Sound.channels = 4;
5719
ig.Sound.enabled = !0
5720
});
5721
ig.baked = !0;
5722
ig.module("impact.loader").requires("impact.image", "impact.font", "impact.sound").defines(function() {
5723
ig.Loader = ig.Class.extend({
5724
resources: [],
5725
gameClass: null,
5726
status: 0,
5727
done: !1,
5728
_unloaded: [],
5729
_drawStatus: 0,
5730
_intervalId: 0,
5731
_loadCallbackBound: null,
5732
init: function(b, c) {
5733
this.gameClass = b;
5734
this.resources = c;
5735
this._loadCallbackBound = this._loadCallback.bind(this);
5736
for (var d = 0; d < this.resources.length; d++) this._unloaded.push(this.resources[d].path)
5737
},
5738
load: function() {
5739
ig.system.clear("#000");
5740
if (this.resources.length) {
5741
for (var b = 0; b < this.resources.length; b++) this.loadResource(this.resources[b]);
5742
this._intervalId = setInterval(this.draw.bind(this), 16)
5743
} else this.end()
5744
},
5745
loadResource: function(b) {
5746
b.load(this._loadCallbackBound)
5747
},
5748
end: function() {
5749
this.done || (this.done = !0, clearInterval(this._intervalId))
5750
},
5751
draw: function() {},
5752
_loadCallback: function(b, c) {
5753
if (c) this._unloaded.erase(b);
5754
else throw "Failed to load resource: " + b;
5755
this.status = 1 - this._unloaded.length / this.resources.length;
5756
0 == this._unloaded.length && setTimeout(this.end.bind(this), 250)
5757
}
5758
})
5759
});
5760
ig.baked = !0;
5761
ig.module("impact.timer").defines(function() {
5762
ig.Timer = ig.Class.extend({
5763
target: 0,
5764
base: 0,
5765
last: 0,
5766
pausedAt: 0,
5767
init: function(b) {
5768
this.last = this.base = ig.Timer.time;
5769
this.target = b || 0
5770
},
5771
set: function(b) {
5772
this.target = b || 0;
5773
this.base = ig.Timer.time;
5774
this.pausedAt = 0
5775
},
5776
reset: function() {
5777
this.base = ig.Timer.time;
5778
this.pausedAt = 0
5779
},
5780
tick: function() {
5781
var b = ig.Timer.time - this.last;
5782
this.last = ig.Timer.time;
5783
return this.pausedAt ? 0 : b
5784
},
5785
delta: function() {
5786
return (this.pausedAt || ig.Timer.time) - this.base - this.target
5787
},
5788
pause: function() {
5789
this.pausedAt || (this.pausedAt = ig.Timer.time)
5790
},
5791
unpause: function() {
5792
this.pausedAt && (this.base += ig.Timer.time - this.pausedAt, this.pausedAt = 0)
5793
}
5794
});
5795
ig.Timer._last = 0;
5796
ig.Timer.time = Number.MIN_VALUE;
5797
ig.Timer.timeScale = 1;
5798
ig.Timer.maxStep = 0.05;
5799
ig.Timer.step = function() {
5800
var b = Date.now();
5801
ig.Timer.time += Math.min((b - ig.Timer._last) / 1E3, ig.Timer.maxStep) * ig.Timer.timeScale;
5802
ig.Timer._last = b
5803
}
5804
});
5805
ig.baked = !0;
5806
ig.module("impact.system").requires("impact.timer", "impact.image").defines(function() {
5807
ig.System = ig.Class.extend({
5808
fps: 30,
5809
width: 320,
5810
height: 240,
5811
realWidth: 320,
5812
realHeight: 240,
5813
scale: 1,
5814
tick: 0,
5815
animationId: 0,
5816
newGameClass: null,
5817
running: !1,
5818
delegate: null,
5819
clock: null,
5820
canvas: null,
5821
context: null,
5822
init: function(b, c, d, e, f) {
5823
this.fps = c;
5824
this.clock = new ig.Timer;
5825
this.canvas = ig.$(b);
5826
this.resize(d, e, f);
5827
this.context = this.canvas.getContext("2d");
5828
this.getDrawPos = ig.System.drawMode
5829
},
5830
resize: function(b, c, d) {
5831
this.width = b;
5832
this.height = c;
5833
this.scale = d || this.scale;
5834
this.realWidth = this.width * this.scale;
5835
this.realHeight = this.height * this.scale;
5836
this.canvas.width = this.realWidth;
5837
this.canvas.height = this.realHeight
5838
},
5839
setGame: function(b) {
5840
this.running ? this.newGameClass = b : this.setGameNow(b)
5841
},
5842
setGameNow: function(b) {
5843
ig.game = new b;
5844
ig.system.setDelegate(ig.game)
5845
},
5846
setDelegate: function(b) {
5847
if ("function" == typeof b.run) this.delegate = b, this.startRunLoop();
5848
else throw "System.setDelegate: No run() function in object";
5849
},
5850
stopRunLoop: function() {
5851
ig.clearAnimation(this.animationId);
5852
this.running = !1
5853
},
5854
startRunLoop: function() {
5855
this.stopRunLoop();
5856
this.animationId = ig.setAnimation(this.run.bind(this), this.canvas);
5857
this.running = !0
5858
},
5859
clear: function(b) {
5860
this.context.fillStyle = b;
5861
this.context.fillRect(0, 0, this.realWidth, this.realHeight)
5862
},
5863
run: function() {
5864
ig.Timer.step();
5865
this.tick = this.clock.tick();
5866
this.delegate.run();
5867
ig.input.clearPressed();
5868
this.newGameClass && (this.setGameNow(this.newGameClass), this.newGameClass = null)
5869
},
5870
getDrawPos: null
5871
});
5872
ig.System.DRAW = {
5873
AUTHENTIC: function(b) {
5874
return Math.round(b) * this.scale
5875
},
5876
SMOOTH: function(b) {
5877
return Math.round(b * this.scale)
5878
},
5879
SUBPIXEL: function(b) {
5880
return b * this.scale
5881
}
5882
};
5883
ig.System.drawMode = ig.System.DRAW.SMOOTH
5884
});
5885
ig.baked = !0;
5886
ig.module("impact.input").defines(function() {
5887
ig.KEY = {
5888
MOUSE1: -1,
5889
MOUSE2: -3,
5890
MWHEEL_UP: -4,
5891
MWHEEL_DOWN: -5,
5892
BACKSPACE: 8,
5893
TAB: 9,
5894
ENTER: 13,
5895
PAUSE: 19,
5896
CAPS: 20,
5897
ESC: 27,
5898
SPACE: 32,
5899
PAGE_UP: 33,
5900
PAGE_DOWN: 34,
5901
END: 35,
5902
HOME: 36,
5903
LEFT_ARROW: 37,
5904
UP_ARROW: 38,
5905
RIGHT_ARROW: 39,
5906
DOWN_ARROW: 40,
5907
INSERT: 45,
5908
DELETE: 46,
5909
_0: 48,
5910
_1: 49,
5911
_2: 50,
5912
_3: 51,
5913
_4: 52,
5914
_5: 53,
5915
_6: 54,
5916
_7: 55,
5917
_8: 56,
5918
_9: 57,
5919
A: 65,
5920
B: 66,
5921
C: 67,
5922
D: 68,
5923
E: 69,
5924
F: 70,
5925
G: 71,
5926
H: 72,
5927
I: 73,
5928
J: 74,
5929
K: 75,
5930
L: 76,
5931
M: 77,
5932
N: 78,
5933
O: 79,
5934
P: 80,
5935
Q: 81,
5936
R: 82,
5937
S: 83,
5938
T: 84,
5939
U: 85,
5940
V: 86,
5941
W: 87,
5942
X: 88,
5943
Y: 89,
5944
Z: 90,
5945
NUMPAD_0: 96,
5946
NUMPAD_1: 97,
5947
NUMPAD_2: 98,
5948
NUMPAD_3: 99,
5949
NUMPAD_4: 100,
5950
NUMPAD_5: 101,
5951
NUMPAD_6: 102,
5952
NUMPAD_7: 103,
5953
NUMPAD_8: 104,
5954
NUMPAD_9: 105,
5955
MULTIPLY: 106,
5956
ADD: 107,
5957
SUBSTRACT: 109,
5958
DECIMAL: 110,
5959
DIVIDE: 111,
5960
F1: 112,
5961
F2: 113,
5962
F3: 114,
5963
F4: 115,
5964
F5: 116,
5965
F6: 117,
5966
F7: 118,
5967
F8: 119,
5968
F9: 120,
5969
F10: 121,
5970
F11: 122,
5971
F12: 123,
5972
SHIFT: 16,
5973
CTRL: 17,
5974
ALT: 18,
5975
PLUS: 187,
5976
COMMA: 188,
5977
MINUS: 189,
5978
PERIOD: 190
5979
};
5980
ig.Input = ig.Class.extend({
5981
bindings: {},
5982
actions: {},
5983
presses: {},
5984
locks: {},
5985
delayedKeyup: {},
5986
isUsingMouse: !1,
5987
isUsingKeyboard: !1,
5988
isUsingAccelerometer: !1,
5989
mouse: {
5990
x: 0,
5991
y: 0
5992
},
5993
accel: {
5994
x: 0,
5995
y: 0,
5996
z: 0
5997
},
5998
initMouse: function() {
5999
if (!this.isUsingMouse) {
6000
this.isUsingMouse = !0;
6001
var b = this.mousewheel.bind(this);
6002
ig.system.canvas.addEventListener("mousewheel", b, !1);
6003
ig.system.canvas.addEventListener("DOMMouseScroll", b, !1);
6004
ig.system.canvas.addEventListener("contextmenu", this.contextmenu.bind(this), !1);
6005
ig.system.canvas.addEventListener("mousedown", this.keydown.bind(this), !1);
6006
ig.system.canvas.addEventListener("mouseup", this.keyup.bind(this), !1);
6007
ig.system.canvas.addEventListener("mousemove", this.mousemove.bind(this), !1);
6008
ig.ua.touchDevice && (ig.system.canvas.addEventListener("touchstart", this.keydown.bind(this), !1), ig.system.canvas.addEventListener("touchend", this.keyup.bind(this), !1), ig.system.canvas.addEventListener("touchmove", this.mousemove.bind(this), !1), ig.system.canvas.addEventListener("MSPointerDown", this.keydown.bind(this), !1), ig.system.canvas.addEventListener("MSPointerUp", this.keyup.bind(this), !1), ig.system.canvas.addEventListener("MSPointerMove", this.mousemove.bind(this), !1), ig.system.canvas.style.msTouchAction = "none")
6009
}
6010
},
6011
initKeyboard: function() {
6012
this.isUsingKeyboard || (this.isUsingKeyboard = !0, window.addEventListener("keydown", this.keydown.bind(this), !1), window.addEventListener("keyup", this.keyup.bind(this), !1))
6013
},
6014
initAccelerometer: function() {
6015
this.isUsingAccelerometer || window.addEventListener("devicemotion", this.devicemotion.bind(this), !1)
6016
},
6017
mousewheel: function(b) {
6018
var c = this.bindings[0 < (b.wheelDelta ? b.wheelDelta : -1 * b.detail) ? ig.KEY.MWHEEL_UP : ig.KEY.MWHEEL_DOWN];
6019
c && (this.actions[c] = !0, this.presses[c] = !0, this.delayedKeyup[c] = !0, b.stopPropagation(), b.preventDefault())
6020
},
6021
mousemove: function(b) {
6022
var c = parseInt(ig.system.canvas.offsetWidth) || ig.system.realWidth,
6023
c = ig.system.scale * (c / ig.system.realWidth),
6024
d = {
6025
left: 0,
6026
top: 0
6027
};
6028
ig.system.canvas.getBoundingClientRect && (d = ig.system.canvas.getBoundingClientRect());
6029
b = b.touches ? b.touches[0] : b;
6030
this.mouse.x = (b.clientX - d.left) / c;
6031
this.mouse.y = (b.clientY - d.top) / c
6032
},
6033
contextmenu: function(b) {
6034
this.bindings[ig.KEY.MOUSE2] && (b.stopPropagation(), b.preventDefault())
6035
},
6036
keydown: function(b) {
6037
var c = b.target.tagName;
6038
if (!("INPUT" == c || "TEXTAREA" == c))
6039
if (c = "keydown" == b.type ? b.keyCode : 2 == b.button ? ig.KEY.MOUSE2 : ig.KEY.MOUSE1, ("touchstart" == b.type || "mousedown" == b.type) && this.mousemove(b), c = this.bindings[c]) this.actions[c] = !0, this.locks[c] || (this.presses[c] = !0, this.locks[c] = !0), b.stopPropagation(), b.preventDefault()
6040
},
6041
keyup: function(b) {
6042
var c = b.target.tagName;
6043
if (!("INPUT" == c || "TEXTAREA" == c))
6044
if (c = this.bindings["keyup" == b.type ? b.keyCode : 2 == b.button ? ig.KEY.MOUSE2 : ig.KEY.MOUSE1]) this.delayedKeyup[c] = !0, b.stopPropagation(), b.preventDefault()
6045
},
6046
devicemotion: function(b) {
6047
this.accel = b.accelerationIncludingGravity
6048
},
6049
bind: function(b, c) {
6050
0 > b ? this.initMouse() : 0 < b && this.initKeyboard();
6051
this.bindings[b] = c
6052
},
6053
bindTouch: function(b, c) {
6054
var d = ig.$(b),
6055
e = this;
6056
d.addEventListener("touchstart", function(b) {
6057
e.touchStart(b, c)
6058
}, !1);
6059
d.addEventListener("touchend", function(b) {
6060
e.touchEnd(b, c)
6061
}, !1);
6062
d.addEventListener("MSPointerDown", function(b) {
6063
e.touchStart(b, c)
6064
}, !1);
6065
d.addEventListener("MSPointerUp", function(b) {
6066
e.touchEnd(b, c)
6067
}, !1)
6068
},
6069
unbind: function(b) {
6070
this.delayedKeyup[this.bindings[b]] = !0;
6071
this.bindings[b] = null
6072
},
6073
unbindAll: function() {
6074
this.bindings = {};
6075
this.actions = {};
6076
this.presses = {};
6077
this.locks = {};
6078
this.delayedKeyup = {}
6079
},
6080
state: function(b) {
6081
return this.actions[b]
6082
},
6083
pressed: function(b) {
6084
return this.presses[b]
6085
},
6086
released: function(b) {
6087
return !!this.delayedKeyup[b]
6088
},
6089
clearPressed: function() {
6090
for (var b in this.delayedKeyup) this.actions[b] = !1, this.locks[b] = !1;
6091
this.delayedKeyup = {};
6092
this.presses = {}
6093
},
6094
touchStart: function(b, c) {
6095
this.actions[c] = !0;
6096
this.presses[c] = !0;
6097
b.stopPropagation();
6098
b.preventDefault();
6099
return !1
6100
},
6101
touchEnd: function(b, c) {
6102
this.delayedKeyup[c] = !0;
6103
b.stopPropagation();
6104
b.preventDefault();
6105
return !1
6106
}
6107
})
6108
});
6109
ig.baked = !0;
6110
ig.module("plugins.webaudio-music-player").defines(function() {
6111
WebaudioMusicPlayer = ig.Class.extend({
6112
bgmPlaying: !1,
6113
isSupported: !1,
6114
muteFlag: !1,
6115
pausedTime: 0,
6116
webaudio: null,
6117
useHTML5Audio: !1,
6118
audio: null,
6119
inactiveAudio: null,
6120
codecs: null,
6121
_volume: 1,
6122
soundList: {},
6123
init: function(b) {
6124
this.webaudio = {
6125
compatibility: {},
6126
gainNode: null,
6127
buffer: null,
6128
source_loop: {},
6129
source_once: {}
6130
};
6131
try {
6132
this.AudioContext = window.AudioContext || window.webkitAudioContext, this.webaudio.context = new this.AudioContext, this.isSupported = !0
6133
} catch (c) {
6134
console.log("Web Audio API not supported in this browser."), this.webaudio = null, this.useHTML5Audio = !0
6135
}
6136
if (this.useHTML5Audio)
6137
if ("undefined" !== typeof Audio) try {
6138
new Audio
6139
} catch (d) {
6140
this.useHTML5Audio = !1
6141
} else this.useHTML5Audio = !1;
6142
this.useHTML5Audio && (this.audio = new Audio, this.isSupported = !0, this.initHTML5Audio(b));
6143
if (!this.isSupported) return null;
6144
this.webaudio && this.initWebAudio(b)
6145
},
6146
initWebAudio: function(b) {
6147
ig.ua.iOS && this.initIOSWebAudioUnlock();
6148
this.webaudio.gainNode = this.webaudio.context.createGain();
6149
this.webaudio.gainNode.connect(this.webaudio.context.destination);
6150
this.webaudio.gainNode.gain.value = this._volume;
6151
var c = "start",
6152
d = "stop",
6153
e = this.webaudio.context.createBufferSource();
6154
"function" !== typeof e.start && (c = "noteOn");
6155
this.webaudio.compatibility.start = c;
6156
"function" !== typeof e.stop && (d = "noteOff");
6157
this.webaudio.compatibility.stop = d;
6158
for (var f in b) {
6159
this.soundList[f] = f;
6160
c = b[f].path;
6161
b = c + "." + ig.Sound.FORMAT.MP3.ext;
6162
var l = c + "." + ig.Sound.FORMAT.OGG.ext;
6163
ig.ua.mobile ? ig.ua.iOS && (l = b) : (c = navigator.userAgent.toLowerCase(), -1 != c.indexOf("safari") && -1 >= c.indexOf("chrome") && (l = b));
6164
var q = new XMLHttpRequest;
6165
q.open("GET", l, !0);
6166
q.responseType = "arraybuffer";
6167
q.onload = function() {
6168
this.webaudio.context.decodeAudioData(q.response, function(b) {
6169
this.webaudio.buffer = b;
6170
this.webaudio.source_loop = {};
6171
this.bgmPlaying ? this.play() : this.stop()
6172
}.bind(this), function() {
6173
console.log('Error decoding audio "' + l + '".')
6174
})
6175
}.bind(this);
6176
q.send();
6177
break
6178
}
6179
},
6180
initIOSWebAudioUnlock: function() {
6181
if (this.webaudio) {
6182
webaudio = this.webaudio;
6183
var b = function() {
6184
var c = webaudio.context,
6185
d = c.createBuffer(1, 1, 22050),
6186
e = c.createBufferSource();
6187
e.buffer = d;
6188
e.connect(c.destination);
6189
"undefined" === typeof e.start ? e.noteOn(0) : e.start(0);
6190
setTimeout(function() {
6191
(e.playbackState === e.PLAYING_STATE || e.playbackState === e.FINISHED_STATE) && window.removeEventListener("touchend", b, !1)
6192
}, 0)
6193
};
6194
window.addEventListener("touchend", b, !1)
6195
}
6196
},
6197
initHTML5Audio: function(b) {
6198
if (this.useHTML5Audio && this.audio) {
6199
var c = this.audio;
6200
this.codecs = {};
6201
this.codecs = {
6202
mp3: !!c.canPlayType("audio/mpeg;").replace(/^no$/, ""),
6203
opus: !!c.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""),
6204
ogg: !!c.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
6205
wav: !!c.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""),
6206
aac: !!c.canPlayType("audio/aac;").replace(/^no$/, ""),
6207
m4a: !!(c.canPlayType("audio/x-m4a;") || c.canPlayType("audio/m4a;") || c.canPlayType("audio/aac;")).replace(/^no$/, ""),
6208
mp4: !!(c.canPlayType("audio/x-mp4;") || c.canPlayType("audio/mp4;") || c.canPlayType("audio/aac;")).replace(/^no$/, ""),
6209
weba: !!c.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")
6210
};
6211
this.is = {
6212
ff: Boolean(null != window.mozInnerScreenX && /firefox/.test(navigator.userAgent.toLowerCase())),
6213
ie: Boolean(document.all && !window.opera),
6214
opera: Boolean(window.opera),
6215
chrome: Boolean(window.chrome),
6216
safari: Boolean(!window.chrome && /safari/.test(navigator.userAgent.toLowerCase()) && window.getComputedStyle && !window.globalStorage && !window.opera)
6217
};
6218
this.playDelay = -60;
6219
this.stopDelay = 30;
6220
this.is.chrome && (this.playDelay = -25);
6221
this.is.chrome && (this.stopDelay = 25);
6222
this.is.ff && (this.playDelay = -25);
6223
this.is.ff && (this.stopDelay = 85);
6224
this.is.opera && (this.playDelay = 5);
6225
this.is.opera && (this.stopDelay = 0);
6226
for (var d in b) {
6227
this.soundList[d] = d;
6228
var e = b[d].path,
6229
c = e + "." + ig.Sound.FORMAT.OGG.ext,
6230
e = e + "." + ig.Sound.FORMAT.MP3.ext,
6231
f = null;
6232
this.codecs[ig.Sound.FORMAT.OGG.ext.toLowerCase()] ? f = c : this.codecs[ig.Sound.FORMAT.MP3.ext.toLowerCase()] && (f = e);
6233
if (f) {
6234
ig.ua.mobile ? ig.ua.iOS && (f = e) : (b = navigator.userAgent.toLowerCase(), -1 != b.indexOf("safari") && -1 >= b.indexOf("chrome") && (f = e));
6235
this.audio.addEventListener("error", function() {
6236
this.audio.error && 4 === this.audio.error.code && (this.isSupported = !1)
6237
}, !1);
6238
this.audio.src = f;
6239
this.audio._pos = 0;
6240
this.audio.preload = "auto";
6241
this.audio.volume = this._volume;
6242
this.inactiveAudio = new Audio;
6243
this.inactiveAudio.src = f;
6244
this.inactiveAudio._pos = 0;
6245
this.inactiveAudio.preload = "auto";
6246
this.inactiveAudio.volume = this._volume;
6247
this.inactiveAudio.load();
6248
var l = function() {
6249
this._duration = this.audio.duration;
6250
this._loaded || (this._loaded = !0);
6251
this.bgmPlaying ? this.play() : this.stop();
6252
this.audio.removeEventListener("canplaythrough", l, !1)
6253
}.bind(this);
6254
this.audio.addEventListener("canplaythrough", l, !1);
6255
this.audio.load();
6256
break
6257
}
6258
}
6259
}
6260
},
6261
play: function(b) {
6262
if (this.isSupported)
6263
if (this.bgmPlaying = !0, this.webaudio)
6264
if (this.webaudio.buffer) {
6265
if (!this.muteFlag && (this.bgmPlaying = !0, !this.webaudio.source_loop._playing)) {
6266
this.webaudio.source_loop = this.webaudio.context.createBufferSource();
6267
this.webaudio.source_loop.buffer = this.webaudio.buffer;
6268
this.webaudio.source_loop.loop = !0;
6269
this.webaudio.source_loop.connect(this.webaudio.gainNode);
6270
isNaN(b) && (b = 0, this.pausedTime && (b = this.pausedTime));
6271
this.webaudio.source_loop._startTime = this.webaudio.context.currentTime;
6272
if ("noteOn" === this.webaudio.compatibility.start) this.webaudio.source_once = this.webaudio.context.createBufferSource(), this.webaudio.source_once.buffer = this.webaudio.buffer, this.webaudio.source_once.connect(this.webaudio.gainNode), this.webaudio.source_once.noteGrainOn(0, b, this.webaudio.buffer.duration - b), this.webaudio.source_loop[this.webaudio.compatibility.start](this.webaudio.context.currentTime + (this.webaudio.buffer.duration - b));
6273
else this.webaudio.source_loop[this.webaudio.compatibility.start](0, b);
6274
this.webaudio.source_loop._playing = !0
6275
}
6276
} else this.bgmPlaying = !0;
6277
else if (this.audio) {
6278
var c = this.audio;
6279
if (!this.muteFlag) {
6280
this.bgmPlaying = !0;
6281
isNaN(b) && (b = 0, this.pausedTime && (b = this.pausedTime));
6282
var d = this._duration - b;
6283
this._onEndTimer && (clearTimeout(this._onEndTimer), this._onEndTimer = null);
6284
this._onEndTimer = setTimeout(function() {
6285
this.audio.currentTime = 0;
6286
this.audio.pause();
6287
this.pausedTime = 0;
6288
if (this.inactiveAudio) {
6289
var b = this.audio;
6290
this.audio = this.inactiveAudio;
6291
this.inactiveAudio = b
6292
}
6293
this.play()
6294
}.bind(this), 1E3 * d + this.playDelay);
6295
4 === c.readyState || !c.readyState && navigator.isCocoonJS ? (c.readyState = 4, c.currentTime = b, c.muted = this.muteFlag || c.muted, c.volume = this._volume, setTimeout(function() {
6296
c.play()
6297
}, 0)) : (clearTimeout(this._onEndTimer), this._onEndTimer = null, function() {
6298
var b = function() {
6299
this.play();
6300
c.removeEventListener("canplaythrough", b, !1)
6301
}.bind(this);
6302
c.addEventListener("canplaythrough", b, !1)
6303
}())
6304
}
6305
}
6306
},
6307
stop: function() {
6308
this.bgmPlaying = !1;
6309
if (this.isSupported)
6310
if (this.webaudio) {
6311
if (this.webaudio.source_loop._playing && (this.webaudio.source_loop[this.webaudio.compatibility.stop](0), this.webaudio.source_loop._playing = !1, this.pausedTime += this.webaudio.context.currentTime - this.webaudio.source_loop._startTime, this.pausedTime %= this.webaudio.source_loop.buffer.duration, this.webaudio.source_loop._startTime = 0, "noteOn" === this.webaudio.compatibility.start)) this.webaudio.source_once[this.webaudio.compatibility.stop](0)
6312
} else if (this.audio) {
6313
var b = this.audio;
6314
b.currentTime && (this.pausedTime = b.currentTime, b.currentTime = 0, b.pause(), clearTimeout(this._onEndTimer), this._onEndTimer = null)
6315
}
6316
},
6317
volume: function(b) {
6318
this.isSupported && (this._volume = b, 0 > this._volume ? this._volume = 0 : 1 < this._volume && (this._volume = 1), this.webaudio ? this.webaudio.gainNode && (this.webaudio.gainNode.gain.value = this._volume) : this.audio && (this.audio.volume = this._volume, this.inactiveAudio && (this.inactiveAudio.volume = this._volume)))
6319
},
6320
getVolume: function() {
6321
return !this.isSupported ? 0 : this._volume
6322
},
6323
mute: function() {
6324
!1 == this.muteFlag && (this.muteFlag = !0, this.bgmPlaying && (this.stop(), this.bgmPlaying = !0))
6325
},
6326
unmute: function() {
6327
!0 == this.muteFlag && (this.muteFlag = !1, this.bgmPlaying && this.play())
6328
}
6329
})
6330
});
6331
ig.baked = !0;
6332
ig.module("impact.sound-handler").requires("plugins.webaudio-music-player").defines(function() {
6333
ig.SoundHandler = ig.Class.extend({
6334
formats: {
6335
ogg: ".ogg",
6336
mp3: ".mp3"
6337
},
6338
jukebox: null,
6339
pausePosition: null,
6340
globalMute: !1,
6341
forceMuted: !1,
6342
muted: !1,
6343
bgmStarted: !1,
6344
bgmPlaying: !1,
6345
soundPlaying: !1,
6346
currentSoundPlaying: null,
6347
soundBuffer: [],
6348
voSoundLoaded: [],
6349
sfxSoundLoaded: [],
6350
SOUNDID: {},
6351
voSoundsToLoad: [],
6352
sfxSoundsToLoad: [{
6353
name: "static",
6354
path: "media/audio/play/static"
6355
}, {
6356
name: "kittyopeningSound",
6357
path: "media/audio/opening/kittyopening"
6358
}, {
6359
name: "bosscannon",
6360
path: "media/audio/bosscannon"
6361
}, {
6362
name: "cannon",
6363
path: "media/audio/cannon"
6364
}, {
6365
name: "click",
6366
path: "media/audio/click"
6367
}, {
6368
name: "coins",
6369
path: "media/audio/coins"
6370
}, {
6371
name: "death",
6372
path: "media/audio/death"
6373
}, {
6374
name: "hit",
6375
path: "media/audio/hit"
6376
}, {
6377
name: "laser_beam",
6378
path: "media/audio/laser_beam"
6379
}, {
6380
name: "machinegun",
6381
path: "media/audio/machinegun"
6382
}, {
6383
name: "projectileshoot",
6384
path: "media/audio/projectileshoot"
6385
}, {
6386
name: "reload",
6387
path: "media/audio/reload"
6388
}, {
6389
name: "repair",
6390
path: "media/audio/repair"
6391
}, {
6392
name: "screenshake",
6393
path: "media/audio/screenshake"
6394
}, {
6395
name: "shot",
6396
path: "media/audio/shot"
6397
}, {
6398
name: "shotgun",
6399
path: "media/audio/shotgun"
6400
}, {
6401
name: "softexplosion",
6402
path: "media/audio/softexplosion"
6403
}, {
6404
name: "tankshoot",
6405
path: "media/audio/tankshoot"
6406
}],
6407
debug: !1,
6408
init: function() {
6409
this.initSfx();
6410
ig.ua.mobile ? this.setupJukebox() : this.setupDesktopMusic();
6411
this.setupWindowHandler()
6412
},
6413
fnSetupMusic: function() {
6414
ig.game.webaudioPlugin = new WebaudioMusicPlayer({
6415
bgm: {
6416
path: "media/audio/bgm"
6417
}
6418
});
6419
this.playBackgroundMusic()
6420
},
6421
visChangeSoundCheck: function() {
6422
this.soundMute ? this.fnMute() : this.fnUnmute();
6423
this.bgmMute ? this.fnMute("bgm") : this.fnUnmute("bgm")
6424
},
6425
fnMuteAll: function() {
6426
this.fnMute();
6427
this.fnMute("bgm")
6428
},
6429
fnUnmuteAll: function() {
6430
this.fnUnmute();
6431
this.fnUnmute("bgm")
6432
},
6433
fnMute: function(b) {
6434
switch (b || "sound") {
6435
case "sound":
6436
this.soundMute || (this.soundMute = !0);
6437
ig.soundHandler._muteSounds();
6438
break;
6439
case "bgm":
6440
this.bgmMute || (this.bgmMute = !0), ig.soundHandler._muteBackgroundMusic()
6441
}
6442
},
6443
fnUnmute: function(b) {
6444
switch (b || "sound") {
6445
case "sound":
6446
this.soundMute && (this.soundMute = !1);
6447
ig.soundHandler._unMuteSounds();
6448
break;
6449
case "bgm":
6450
this.bgmMute && (this.bgmMute = !1), ig.soundHandler._unMuteBackgroundMusic()
6451
}
6452
},
6453
allVoSoundLoaded: function() {
6454
if (this.voSoundLoaded.length >= this.voSoundsToLoad.length) {
6455
this.debug && console.log("Vo ready");
6456
for (index = 0; index < this.voSoundLoaded.length; index++) this.voSoundLoaded[index].on("end", function(b) {
6457
b.isPlaying = !1;
6458
this.soundBuffer.pop()
6459
}.bind(this, this.voSoundLoaded[index])), this.voSoundLoaded[index].on("play", function(b) {
6460
b.isPlaying = !0
6461
}.bind(this, this.voSoundLoaded[index]));
6462
return !0
6463
}
6464
return !1
6465
},
6466
allSfxSoundLoaded: function() {
6467
return this.sfxSoundLoaded.length >= this.sfxSoundsToLoad.length ? !0 : !1
6468
},
6469
stopBackgroundMusic: function() {
6470
ig.game && ig.game.webaudioPlugin && ig.game.webaudioPlugin.stop();
6471
this.bgmPlaying = !1
6472
},
6473
playBackgroundMusic: function() {
6474
this.bgmPlaying || (this.bgmStarted = !0, ig.game && ig.game.webaudioPlugin && ig.game.webaudioPlugin.play(), this._unMuteBackgroundMusic(), this.bgmPlaying = !0)
6475
},
6476
playSound: function(b) {
6477
if ((b = this[b]) && (!this.forceMuted || !this.muted) && !b.isPlaying) this.soundBuffer.push(b), b.play()
6478
},
6479
stopAllAndPlaySound: function(b) {
6480
this.stopAllSounds();
6481
this.playSound(b)
6482
},
6483
stopAllSounds: function() {
6484
for (index = 0; index < this.soundBuffer.length; index++) this.soundBuffer[index].isPlaying = !1, this.soundBuffer.splice(0, 1)[0].stop()
6485
},
6486
addSound: function(b, c, d, e) {
6487
e = e || !1;
6488
var f = c + this.formats.ogg;
6489
c += this.formats.mp3;
6490
this.SOUNDID[b] = b;
6491
this[b] = d ? new Howl({
6492
src: [f, c],
6493
onload: d,
6494
loop: e
6495
}) : new Howl({
6496
src: [f, c],
6497
loop: e
6498
})
6499
},
6500
_muteSounds: function() {
6501
for (i = 0; i < ig.resources.length; i++) ig.resources[i].multiChannel && ig.resources[i].stop();
6502
Howler.mute(!0);
6503
this.debug && console.log("Sounds muted")
6504
},
6505
_unMuteSounds: function() {
6506
Howler.mute(!1);
6507
ig.Sound.enabled = !0;
6508
this.debug && console.log("Sounds can play")
6509
},
6510
_muteBackgroundMusic: function() {
6511
ig.game && ig.game.webaudioPlugin.mute();
6512
this.debug && console.log("BGM muted")
6513
},
6514
_unMuteBackgroundMusic: function() {
6515
this.bgmStarted && (ig.game && ig.game.webaudioPlugin.unmute(), this.debug && console.log("BGM can play"))
6516
},
6517
focusBlurMute: function() {
6518
this.forceMuted || this.mute()
6519
},
6520
focusBlurUnmute: function() {
6521
this.forceMuted || this.unmute()
6522
},
6523
supports_local_storage: function() {
6524
try {
6525
return localStorage.setItem("test", "test"), localStorage.removeItem("test"), "localStorage" in window && null !== window.localStorage
6526
} catch (b) {
6527
return !1
6528
}
6529
},
6530
setForceMuted: function(b) {
6531
this.forceMuted = b
6532
},
6533
mute: function() {
6534
this.muted || (this._muteSounds(), this._muteBackgroundMusic(), this.muted = !0, this.bgmPlaying = !1)
6535
},
6536
unmute: function() {
6537
this.muted && (this._unMuteSounds(), this._unMuteBackgroundMusic(), this.muted = !1, this.bgmPlaying = !0)
6538
},
6539
setupWindowHandler: function() {
6540
"true" === getQueryVariable("webview") ? ($(window).focus(function() {
6541
ig.ua.mobile && ig.game && ig.game.resumeGame();
6542
ig.soundHandler && ig.soundHandler.focusBlurUnmute();
6543
ig.soundHandler && ig.soundHandler.visChangeSoundCheck()
6544
}), $(window).blur(function() {
6545
ig.soundHandler && ig.soundHandler.focusBlurMute()
6546
})) : (window.onfocus = function() {
6547
ig.ua.mobile && ig.game && ig.game.resumeGame();
6548
ig.soundHandler && ig.soundHandler.focusBlurUnmute();
6549
ig.soundHandler && ig.soundHandler.visChangeSoundCheck()
6550
}, window.onblur = function() {
6551
ig.soundHandler && ig.soundHandler.focusBlurMute()
6552
})
6553
},
6554
initSfx: function() {
6555
for (index = 0; index < this.sfxSoundsToLoad.length; index++) {
6556
var b = function(b) {
6557
this.sfxSoundLoaded.push(this[b])
6558
}.bind(this, this.sfxSoundsToLoad[index].name);
6559
this.addSound(this.sfxSoundsToLoad[index].name, this.sfxSoundsToLoad[index].path, b, this.sfxSoundsToLoad[index].loop || !1)
6560
}
6561
},
6562
initVoSfx: function() {
6563
for (index = 0; index < this.voSoundsToLoad.length; index++) {
6564
var b = function(b) {
6565
this.voSoundLoaded.push(this[b])
6566
}.bind(this, this.voSoundsToLoad[index].name);
6567
this.addSound(this.voSoundsToLoad[index].name, this.voSoundsToLoad[index].path, b, this.sfxSoundsToLoad[index].loop || !1)
6568
}
6569
},
6570
setupDesktopMusic: function() {},
6571
setupJukebox: function() {
6572
ig.ua.mobile && (this.jukebox = new ig.Jukebox, this.pausePosition = this.jukebox.player.settings.spritemap.music.start)
6573
},
6574
forceLoopBGM: function() {
6575
this.bgmStarted && this.bgmPlaying && !this.muted && !this.forceMuted && this.jukebox && this.jukebox.player && (0 <= this.jukebox.player.getCurrentTime() ? this.jukebox.player.settings.spritemap.music && this.jukebox.player.settings.spritemap.music.loop ? this.jukebox.player.getCurrentTime() > this.jukebox.player.settings.spritemap.music.end && this.jukebox.player.resume(this.jukebox.player.settings.spritemap.music.start) : this.jukebox.player.isPlaying && this.jukebox.player.isPlaying.loop ? this.jukebox.player.getCurrentTime() > this.jukebox.player.isPlaying.end && this.jukebox.player.resume(this.jukebox.player.isPlaying.start) : this.jukebox.player.backgroundMusic && this.jukebox.player.backgroundMusic.loop && this.jukebox.player.getCurrentTime() > this.jukebox.player.backgroundMusic.end && this.jukebox.player.resume(this.jukebox.player.backgroundMusic.start) : this.pausePosition ? this.jukebox.player.setCurrentTime(this.pausePosition) : this.jukebox.player.setCurrentTime(this.jukebox.player.settings.spritemap.music.start))
6576
},
6577
setSfxVolume: function(b) {
6578
this.sfxVolume = b;
6579
Howler.volume(this.sfxVolume)
6580
},
6581
setMusicVolume: function(b) {
6582
this.musicVolume = b;
6583
ig.game.webaudioPlugin.volume(this.musicVolume)
6584
}
6585
})
6586
});
6587
6588
function getHiddenProp() {
6589
var b = ["webkit", "moz", "ms", "o"];
6590
if ("hidden" in document) return "hidden";
6591
for (var c = 0; c < b.length; c++)
6592
if (b[c] + "Hidden" in document) return b[c] + "Hidden";
6593
return null
6594
}
6595
6596
function isHidden() {
6597
var b = getHiddenProp();
6598
return !b ? !1 : document[b]
6599
}
6600
var visProp = getHiddenProp();
6601
if (visProp) {
6602
var evtname = visProp.replace(/[H|h]idden/, "") + "visibilitychange";
6603
document.addEventListener(evtname, visChange)
6604
}
6605
window.addEventListener("pagehide", function() {
6606
ig.soundHandler && ig.soundHandler.focusBlurMute()
6607
}, !1);
6608
window.addEventListener("pageshow", function() {
6609
ig.ua.mobile && ig.game && ig.game.resumeGame();
6610
ig.soundHandler && ig.soundHandler.focusBlurUnmute();
6611
ig.soundHandler && ig.soundHandler.visChangeSoundCheck()
6612
}, !1);
6613
6614
function visChange() {
6615
isHidden() ? ig.soundHandler && ig.soundHandler.focusBlurMute() : (ig.ua.mobile && ig.game && ig.game.resumeGame(), ig.soundHandler && ig.soundHandler.focusBlurUnmute(), ig.soundHandler && ig.soundHandler.visChangeSoundCheck())
6616
}
6617
ig.baked = !0;
6618
ig.module("impact.impact").requires("dom.ready", "impact.loader", "impact.system", "impact.input", "impact.sound", "impact.sound-handler").defines(function() {
6619
ig.main = function(b, c, d, e, f, l, q) {
6620
ig.system = new ig.System(b, d, e, f, l || 1);
6621
ig.input = new ig.Input;
6622
ig.soundManager = new ig.SoundManager;
6623
ig.music = new ig.Music;
6624
ig.ready = !0;
6625
ig.soundHandler = new ig.SoundHandler;
6626
(new(q || ig.Loader)(c, ig.resources)).load()
6627
}
6628
});
6629
ig.baked = !0;
6630
ig.module("impact.animation").requires("impact.timer", "impact.image").defines(function() {
6631
ig.AnimationSheet = ig.Class.extend({
6632
width: 8,
6633
height: 8,
6634
image: null,
6635
init: function(b, c, d) {
6636
this.width = c;
6637
this.height = d;
6638
this.image = new ig.Image(b)
6639
}
6640
});
6641
ig.Animation = ig.Class.extend({
6642
sheet: null,
6643
timer: null,
6644
sequence: [],
6645
flip: {
6646
x: !1,
6647
y: !1
6648
},
6649
pivot: {
6650
x: 0,
6651
y: 0
6652
},
6653
frame: 0,
6654
tile: 0,
6655
loopCount: 0,
6656
alpha: 1,
6657
angle: 0,
6658
init: function(b, c, d, e) {
6659
this.sheet = b;
6660
this.pivot = {
6661
x: b.width / 2,
6662
y: b.height / 2
6663
};
6664
this.timer = new ig.Timer;
6665
this.frameTime = c;
6666
this.sequence = d;
6667
this.stop = !!e;
6668
this.tile = this.sequence[0]
6669
},
6670
rewind: function() {
6671
this.timer.set();
6672
this.frame = this.loopCount = 0;
6673
this.tile = this.sequence[0];
6674
return this
6675
},
6676
gotoFrame: function(b) {
6677
this.timer.set(this.frameTime * -b - 1E-4);
6678
this.update()
6679
},
6680
gotoRandomFrame: function() {
6681
this.gotoFrame(Math.floor(Math.random() * this.sequence.length))
6682
},
6683
update: function() {
6684
var b = Math.floor(this.timer.delta() / this.frameTime);
6685
this.loopCount = Math.floor(b / this.sequence.length);
6686
this.frame = this.stop && 0 < this.loopCount ? this.sequence.length - 1 : b % this.sequence.length;
6687
if (this.frame == this.sequence.length - 1 && "function" == typeof this.onEnd) this.onEnd();
6688
this.tile = this.sequence[this.frame]
6689
},
6690
draw: function(b, c) {
6691
var d = Math.max(this.sheet.width, this.sheet.height);
6692
b > ig.system.width || (c > ig.system.height || 0 > b + d || 0 > c + d) || (1 != this.alpha && (ig.system.context.globalAlpha = this.alpha), 0 == this.angle ? this.sheet.image.drawTile(b, c, this.tile, this.sheet.width, this.sheet.height, this.flip.x, this.flip.y) : (ig.system.context.save(), ig.system.context.translate(ig.system.getDrawPos(b + this.pivot.x), ig.system.getDrawPos(c + this.pivot.y)), ig.system.context.rotate(this.angle), this.sheet.image.drawTile(-this.pivot.x, -this.pivot.y, this.tile, this.sheet.width, this.sheet.height, this.flip.x, this.flip.y), ig.system.context.restore()), 1 != this.alpha && (ig.system.context.globalAlpha = 1))
6693
}
6694
})
6695
});
6696
ig.baked = !0;
6697
ig.module("impact.entity").requires("impact.animation", "impact.impact").defines(function() {
6698
ig.Entity = ig.Class.extend({
6699
id: 0,
6700
settings: {},
6701
size: {
6702
x: 16,
6703
y: 16
6704
},
6705
offset: {
6706
x: 0,
6707
y: 0
6708
},
6709
pos: {
6710
x: 0,
6711
y: 0
6712
},
6713
last: {
6714
x: 0,
6715
y: 0
6716
},
6717
vel: {
6718
x: 0,
6719
y: 0
6720
},
6721
accel: {
6722
x: 0,
6723
y: 0
6724
},
6725
friction: {
6726
x: 0,
6727
y: 0
6728
},
6729
maxVel: {
6730
x: 100,
6731
y: 100
6732
},
6733
zIndex: 0,
6734
gravityFactor: 1,
6735
standing: !1,
6736
bounciness: 0,
6737
minBounceVelocity: 40,
6738
anims: {},
6739
animSheet: null,
6740
currentAnim: null,
6741
health: 10,
6742
type: 0,
6743
checkAgainst: 0,
6744
collides: 0,
6745
_killed: !1,
6746
slopeStanding: {
6747
min: (44).toRad(),
6748
max: (136).toRad()
6749
},
6750
init: function(b, c, d) {
6751
this.id = ++ig.Entity._lastId;
6752
this.pos.x = this.last.x = b;
6753
this.pos.y = this.last.y = c;
6754
ig.merge(this, d)
6755
},
6756
reset: function(b, c, d) {
6757
var e = this.constructor.prototype;
6758
this.pos.x = b;
6759
this.pos.y = c;
6760
this.last.x = b;
6761
this.last.y = c;
6762
this.vel.x = e.vel.x;
6763
this.vel.y = e.vel.y;
6764
this.accel.x = e.accel.x;
6765
this.accel.y = e.accel.y;
6766
this.health = e.health;
6767
this._killed = e._killed;
6768
this.standing = e.standing;
6769
this.type = e.type;
6770
this.checkAgainst = e.checkAgainst;
6771
this.collides = e.collides;
6772
ig.merge(this, d)
6773
},
6774
addAnim: function(b, c, d, e) {
6775
if (!this.animSheet) throw "No animSheet to add the animation " +
6776
b + " to.";
6777
c = new ig.Animation(this.animSheet, c, d, e);
6778
this.anims[b] = c;
6779
this.currentAnim || (this.currentAnim = c);
6780
return c
6781
},
6782
update: function() {
6783
this.last.x = this.pos.x;
6784
this.last.y = this.pos.y;
6785
this.vel.y += ig.game.gravity * ig.system.tick * this.gravityFactor;
6786
this.vel.x = this.getNewVelocity(this.vel.x, this.accel.x, this.friction.x, this.maxVel.x);
6787
this.vel.y = this.getNewVelocity(this.vel.y, this.accel.y, this.friction.y, this.maxVel.y);
6788
var b = ig.game.collisionMap.trace(this.pos.x, this.pos.y, this.vel.x * ig.system.tick, this.vel.y * ig.system.tick, this.size.x, this.size.y);
6789
this.handleMovementTrace(b);
6790
this.currentAnim && this.currentAnim.update()
6791
},
6792
getNewVelocity: function(b, c, d, e) {
6793
return c ? (b + c * ig.system.tick).limit(-e, e) : d ? (c = d * ig.system.tick, 0 < b - c ? b - c : 0 > b + c ? b + c : 0) : b.limit(-e, e)
6794
},
6795
handleMovementTrace: function(b) {
6796
this.standing = !1;
6797
b.collision.y && (0 < this.bounciness && Math.abs(this.vel.y) > this.minBounceVelocity ? this.vel.y *= -this.bounciness : (0 < this.vel.y && (this.standing = !0), this.vel.y = 0));
6798
b.collision.x && (this.vel.x = 0 < this.bounciness && Math.abs(this.vel.x) > this.minBounceVelocity ? this.vel.x * -this.bounciness : 0);
6799
if (b.collision.slope) {
6800
var c = b.collision.slope;
6801
if (0 < this.bounciness) {
6802
var d = this.vel.x * c.nx + this.vel.y * c.ny;
6803
this.vel.x = (this.vel.x - 2 * c.nx * d) * this.bounciness;
6804
this.vel.y = (this.vel.y - 2 * c.ny * d) * this.bounciness
6805
} else d = (this.vel.x * c.x + this.vel.y * c.y) / (c.x * c.x + c.y * c.y), this.vel.x = c.x * d, this.vel.y = c.y * d, c = Math.atan2(c.x, c.y), c > this.slopeStanding.min && c < this.slopeStanding.max && (this.standing = !0)
6806
}
6807
this.pos = b.pos
6808
},
6809
draw: function() {
6810
this.currentAnim && this.currentAnim.draw(this.pos.x -
6811
this.offset.x - ig.game._rscreen.x, this.pos.y - this.offset.y - ig.game._rscreen.y)
6812
},
6813
kill: function() {
6814
ig.game.removeEntity(this)
6815
},
6816
receiveDamage: function(b) {
6817
this.health -= b;
6818
0 >= this.health && this.kill()
6819
},
6820
touches: function(b) {
6821
return !(this.pos.x >= b.pos.x + b.size.x || this.pos.x + this.size.x <= b.pos.x || this.pos.y >= b.pos.y + b.size.y || this.pos.y + this.size.y <= b.pos.y)
6822
},
6823
distanceTo: function(b) {
6824
var c = this.pos.x + this.size.x / 2 - (b.pos.x + b.size.x / 2);
6825
b = this.pos.y + this.size.y / 2 - (b.pos.y + b.size.y / 2);
6826
return Math.sqrt(c * c + b * b)
6827
},
6828
angleTo: function(b) {
6829
return Math.atan2(b.pos.y +
6830
b.size.y / 2 - (this.pos.y + this.size.y / 2), b.pos.x + b.size.x / 2 - (this.pos.x + this.size.x / 2))
6831
},
6832
check: function() {},
6833
collideWith: function() {},
6834
ready: function() {},
6835
erase: function() {}
6836
});
6837
ig.Entity._lastId = 0;
6838
ig.Entity.COLLIDES = {
6839
NEVER: 0,
6840
LITE: 1,
6841
PASSIVE: 2,
6842
ACTIVE: 4,
6843
FIXED: 8
6844
};
6845
ig.Entity.TYPE = {
6846
NONE: 0,
6847
A: 1,
6848
B: 2,
6849
BOTH: 3
6850
};
6851
ig.Entity.checkPair = function(b, c) {
6852
b.checkAgainst & c.type && b.check(c);
6853
c.checkAgainst & b.type && c.check(b);
6854
b.collides && (c.collides && b.collides + c.collides > ig.Entity.COLLIDES.ACTIVE) && ig.Entity.solveCollision(b, c)
6855
};
6856
ig.Entity.solveCollision = function(b, c) {
6857
var d = null;
6858
if (b.collides == ig.Entity.COLLIDES.LITE || c.collides == ig.Entity.COLLIDES.FIXED) d = b;
6859
else if (c.collides == ig.Entity.COLLIDES.LITE || b.collides == ig.Entity.COLLIDES.FIXED) d = c;
6860
b.last.x + b.size.x > c.last.x && b.last.x < c.last.x + c.size.x ? (b.last.y < c.last.y ? ig.Entity.seperateOnYAxis(b, c, d) : ig.Entity.seperateOnYAxis(c, b, d), b.collideWith(c, "y"), c.collideWith(b, "y")) : b.last.y + b.size.y > c.last.y && b.last.y < c.last.y + c.size.y && (b.last.x < c.last.x ? ig.Entity.seperateOnXAxis(b, c, d) : ig.Entity.seperateOnXAxis(c, b, d), b.collideWith(c, "x"), c.collideWith(b, "x"))
6861
};
6862
ig.Entity.seperateOnXAxis = function(b, c, d) {
6863
var e = b.pos.x + b.size.x - c.pos.x;
6864
d ? (d.vel.x = -d.vel.x * d.bounciness + (b === d ? c : b).vel.x, c = ig.game.collisionMap.trace(d.pos.x, d.pos.y, d == b ? -e : e, 0, d.size.x, d.size.y), d.pos.x = c.pos.x) : (d = (b.vel.x - c.vel.x) / 2, b.vel.x = -d, c.vel.x = d, d = ig.game.collisionMap.trace(b.pos.x, b.pos.y, -e / 2, 0, b.size.x, b.size.y), b.pos.x = Math.floor(d.pos.x), b = ig.game.collisionMap.trace(c.pos.x, c.pos.y, e / 2, 0, c.size.x, c.size.y), c.pos.x = Math.ceil(b.pos.x))
6865
};
6866
ig.Entity.seperateOnYAxis = function(b, c, d) {
6867
var e = b.pos.y + b.size.y - c.pos.y;
6868
if (d) {
6869
c = b === d ? c : b;
6870
d.vel.y = -d.vel.y * d.bounciness + c.vel.y;
6871
var f = 0;
6872
d == b && Math.abs(d.vel.y - c.vel.y) < d.minBounceVelocity && (d.standing = !0, f = c.vel.x * ig.system.tick);
6873
b = ig.game.collisionMap.trace(d.pos.x, d.pos.y, f, d == b ? -e : e, d.size.x, d.size.y);
6874
d.pos.y = b.pos.y;
6875
d.pos.x = b.pos.x
6876
} else ig.game.gravity && (c.standing || 0 < b.vel.y) ? (d = ig.game.collisionMap.trace(b.pos.x, b.pos.y, 0, -(b.pos.y + b.size.y - c.pos.y), b.size.x, b.size.y), b.pos.y = d.pos.y, 0 < b.bounciness && b.vel.y > b.minBounceVelocity ? b.vel.y *= -b.bounciness : (b.standing = !0, b.vel.y = 0)) : (d = (b.vel.y - c.vel.y) / 2, b.vel.y = -d, c.vel.y = d, f = c.vel.x * ig.system.tick, d = ig.game.collisionMap.trace(b.pos.x, b.pos.y, f, -e / 2, b.size.x, b.size.y), b.pos.y = d.pos.y, b = ig.game.collisionMap.trace(c.pos.x, c.pos.y, 0, e / 2, c.size.x, c.size.y), c.pos.y = b.pos.y)
6877
}
6878
});
6879
ig.baked = !0;
6880
ig.module("impact.map").defines(function() {
6881
ig.Map = ig.Class.extend({
6882
tilesize: 8,
6883
width: 1,
6884
height: 1,
6885
data: [
6886
[]
6887
],
6888
name: null,
6889
init: function(b, c) {
6890
this.tilesize = b;
6891
this.data = c;
6892
this.height = c.length;
6893
this.width = c[0].length
6894
},
6895
getTile: function(b, c) {
6896
var d = Math.floor(b / this.tilesize),
6897
e = Math.floor(c / this.tilesize);
6898
return 0 <= d && d < this.width && 0 <= e && e < this.height ? this.data[e][d] : 0
6899
},
6900
setTile: function(b, c, d) {
6901
b = Math.floor(b / this.tilesize);
6902
c = Math.floor(c / this.tilesize);
6903
0 <= b && b < this.width && (0 <= c && c < this.height) && (this.data[c][b] = d)
6904
}
6905
})
6906
});
6907
ig.baked = !0;
6908
ig.module("impact.collision-map").requires("impact.map").defines(function() {
6909
ig.CollisionMap = ig.Map.extend({
6910
lastSlope: 1,
6911
tiledef: null,
6912
init: function(b, c, f) {
6913
this.parent(b, c);
6914
this.tiledef = f || ig.CollisionMap.defaultTileDef;
6915
for (var l in this.tiledef) l | 0 > this.lastSlope && (this.lastSlope = l | 0)
6916
},
6917
trace: function(b, c, f, l, q, r) {
6918
var g = {
6919
collision: {
6920
x: !1,
6921
y: !1,
6922
slope: !1
6923
},
6924
pos: {
6925
x: b,
6926
y: c
6927
},
6928
tile: {
6929
x: 0,
6930
y: 0
6931
}
6932
},
6933
m = Math.ceil(Math.max(Math.abs(f), Math.abs(l)) / this.tilesize);
6934
if (1 < m)
6935
for (var n = f / m, p = l / m, s = 0; s < m && (n || p) && !(this._traceStep(g, b, c, n, p, q, r, f, l, s), b = g.pos.x, c = g.pos.y, g.collision.x && (f = n = 0), g.collision.y && (l = p = 0), g.collision.slope); s++);
6936
else this._traceStep(g, b, c, f, l, q, r, f, l, 0);
6937
return g
6938
},
6939
_traceStep: function(b, c, f, l, q, r, g, m, n, p) {
6940
b.pos.x += l;
6941
b.pos.y += q;
6942
var s = 0;
6943
if (l) {
6944
var u = 0 < l ? r : 0,
6945
t = 0 > l ? this.tilesize : 0,
6946
s = Math.max(Math.floor(f / this.tilesize), 0),
6947
y = Math.min(Math.ceil((f + g) / this.tilesize), this.height);
6948
l = Math.floor((b.pos.x + u) / this.tilesize);
6949
var G = Math.floor((c + u) / this.tilesize);
6950
if (0 < p || l == G || 0 > G || G >= this.width) G = -1;
6951
if (0 <= l && l < this.width)
6952
for (var F = s; F < y && !(-1 != G && (s = this.data[F][G], 1 < s && s <= this.lastSlope && this._checkTileDef(b, s, c, f, m, n, r, g, G, F))); F++)
6953
if (s = this.data[F][l], 1 == s || s > this.lastSlope || 1 < s && this._checkTileDef(b, s, c, f, m, n, r, g, l, F)) {
6954
if (1 < s && s <= this.lastSlope && b.collision.slope) break;
6955
b.collision.x = !0;
6956
b.tile.x = s;
6957
c = b.pos.x = l * this.tilesize - u + t;
6958
m = 0;
6959
break
6960
}
6961
}
6962
if (q) {
6963
u = 0 < q ? g : 0;
6964
q = 0 > q ? this.tilesize : 0;
6965
s = Math.max(Math.floor(b.pos.x / this.tilesize), 0);
6966
t = Math.min(Math.ceil((b.pos.x + r) / this.tilesize), this.width);
6967
F = Math.floor((b.pos.y + u) / this.tilesize);
6968
y = Math.floor((f + u) / this.tilesize);
6969
if (0 < p || F == y || 0 > y || y >= this.height) y = -1;
6970
if (0 <= F && F < this.height)
6971
for (l = s; l < t && !(-1 != y && (s = this.data[y][l], 1 < s && s <= this.lastSlope && this._checkTileDef(b, s, c, f, m, n, r, g, l, y))); l++)
6972
if (s = this.data[F][l], 1 == s || s > this.lastSlope || 1 < s && this._checkTileDef(b, s, c, f, m, n, r, g, l, F)) {
6973
if (1 < s && s <= this.lastSlope && b.collision.slope) break;
6974
b.collision.y = !0;
6975
b.tile.y = s;
6976
b.pos.y = F * this.tilesize - u + q;
6977
break
6978
}
6979
}
6980
},
6981
_checkTileDef: function(b, c, f, l, q, r, g, m, n, p) {
6982
var s = this.tiledef[c];
6983
if (!s) return !1;
6984
c = (s[2] -
6985
s[0]) * this.tilesize;
6986
var u = (s[3] - s[1]) * this.tilesize,
6987
t = s[4];
6988
g = f + q + (0 > u ? g : 0) - (n + s[0]) * this.tilesize;
6989
m = l + r + (0 < c ? m : 0) - (p + s[1]) * this.tilesize;
6990
if (0 < c * m - u * g) {
6991
if (0 > q * -u + r * c) return t;
6992
n = Math.sqrt(c * c + u * u);
6993
p = u / n;
6994
n = -c / n;
6995
var y = g * p + m * n,
6996
s = p * y,
6997
y = n * y;
6998
if (s * s + y * y >= q * q + r * r) return t || 0.5 > c * (m - r) - u * (g - q);
6999
b.pos.x = f + q - s;
7000
b.pos.y = l + r - y;
7001
b.collision.slope = {
7002
x: c,
7003
y: u,
7004
nx: p,
7005
ny: n
7006
};
7007
return !0
7008
}
7009
return !1
7010
}
7011
});
7012
var b = 1 / 3,
7013
c = 2 / 3;
7014
ig.CollisionMap.defaultTileDef = {
7015
5: [0, 1, 1, c, !0],
7016
6: [0, c, 1, b, !0],
7017
7: [0, b, 1, 0, !0],
7018
3: [0, 1, 1, 0.5, !0],
7019
4: [0, 0.5, 1, 0, !0],
7020
2: [0, 1, 1, 0, !0],
7021
10: [0.5, 1, 1, 0, !0],
7022
21: [0, 1, 0.5, 0, !0],
7023
32: [c, 1, 1, 0, !0],
7024
43: [b, 1, c, 0, !0],
7025
54: [0, 1, b, 0, !0],
7026
27: [0, 0, 1, b, !0],
7027
28: [0, b, 1, c, !0],
7028
29: [0, c, 1, 1, !0],
7029
25: [0, 0, 1, 0.5, !0],
7030
26: [0, 0.5, 1, 1, !0],
7031
24: [0, 0, 1, 1, !0],
7032
11: [0, 0, 0.5, 1, !0],
7033
22: [0.5, 0, 1, 1, !0],
7034
33: [0, 0, b, 1, !0],
7035
44: [b, 0, c, 1, !0],
7036
55: [c, 0, 1, 1, !0],
7037
16: [1, b, 0, 0, !0],
7038
17: [1, c, 0, b, !0],
7039
18: [1, 1, 0, c, !0],
7040
14: [1, 0.5, 0, 0, !0],
7041
15: [1, 1, 0, 0.5, !0],
7042
13: [1, 1, 0, 0, !0],
7043
8: [0.5, 1, 0, 0, !0],
7044
19: [1, 1, 0.5, 0, !0],
7045
30: [b, 1, 0, 0, !0],
7046
41: [c, 1, b, 0, !0],
7047
52: [1, 1, c, 0, !0],
7048
38: [1, c, 0, 1, !0],
7049
39: [1, b, 0, c, !0],
7050
40: [1, 0, 0, b, !0],
7051
36: [1, 0.5, 0, 1, !0],
7052
37: [1, 0, 0, 0.5, !0],
7053
35: [1, 0, 0, 1, !0],
7054
9: [1, 0, 0.5, 1, !0],
7055
20: [0.5, 0, 0, 1, !0],
7056
31: [1, 0, c, 1, !0],
7057
42: [c, 0, b, 1, !0],
7058
53: [b, 0, 0, 1, !0],
7059
12: [0, 0, 1, 0, !1],
7060
23: [1, 1, 0, 1, !1],
7061
34: [1, 0, 1, 1, !1],
7062
45: [0, 1, 0, 0, !1]
7063
};
7064
ig.CollisionMap.staticNoCollision = {
7065
trace: function(b, c, f, l) {
7066
return {
7067
collision: {
7068
x: !1,
7069
y: !1,
7070
slope: !1
7071
},
7072
pos: {
7073
x: b + f,
7074
y: c + l
7075
},
7076
tile: {
7077
x: 0,
7078
y: 0
7079
}
7080
}
7081
}
7082
}
7083
});
7084
ig.baked = !0;
7085
ig.module("impact.background-map").requires("impact.map", "impact.image").defines(function() {
7086
ig.BackgroundMap = ig.Map.extend({
7087
tiles: null,
7088
scroll: {
7089
x: 0,
7090
y: 0
7091
},
7092
distance: 1,
7093
repeat: !1,
7094
tilesetName: "",
7095
foreground: !1,
7096
enabled: !0,
7097
preRender: !1,
7098
preRenderedChunks: null,
7099
chunkSize: 512,
7100
debugChunks: !1,
7101
anims: {},
7102
init: function(b, c, d) {
7103
this.parent(b, c);
7104
this.setTileset(d)
7105
},
7106
setTileset: function(b) {
7107
this.tilesetName = b instanceof ig.Image ? b.path : b;
7108
this.tiles = new ig.Image(this.tilesetName);
7109
this.preRenderedChunks = null
7110
},
7111
setScreenPos: function(b, c) {
7112
this.scroll.x = b / this.distance;
7113
this.scroll.y = c / this.distance
7114
},
7115
preRenderMapToChunks: function() {
7116
var b = this.width * this.tilesize * ig.system.scale,
7117
c = this.height * this.tilesize * ig.system.scale,
7118
d = Math.ceil(b / this.chunkSize),
7119
e = Math.ceil(c / this.chunkSize);
7120
this.preRenderedChunks = [];
7121
for (var f = 0; f < e; f++) {
7122
this.preRenderedChunks[f] = [];
7123
for (var l = 0; l < d; l++) this.preRenderedChunks[f][l] = this.preRenderChunk(l, f, l == d - 1 ? b - l * this.chunkSize : this.chunkSize, f == e - 1 ? c - f * this.chunkSize : this.chunkSize)
7124
}
7125
},
7126
preRenderChunk: function(b, c, d, e) {
7127
var f = d / this.tilesize / ig.system.scale + 1,
7128
l = e / this.tilesize / ig.system.scale + 1,
7129
q = b * this.chunkSize / ig.system.scale % this.tilesize,
7130
r = c * this.chunkSize / ig.system.scale % this.tilesize;
7131
b = Math.floor(b * this.chunkSize / this.tilesize / ig.system.scale);
7132
c = Math.floor(c * this.chunkSize / this.tilesize / ig.system.scale);
7133
var g = ig.$new("canvas");
7134
g.width = d;
7135
g.height = e;
7136
d = ig.system.context;
7137
ig.system.context = g.getContext("2d");
7138
for (e = 0; e < f; e++)
7139
for (var m = 0; m < l; m++)
7140
if (e + b < this.width && m + c < this.height) {
7141
var n = this.data[m + c][e + b];
7142
n && this.tiles.drawTile(e * this.tilesize - q, m * this.tilesize - r, n - 1, this.tilesize)
7143
}
7144
ig.system.context = d;
7145
return g
7146
},
7147
draw: function() {
7148
this.tiles.loaded && this.enabled && (this.preRender ? this.drawPreRendered() : this.drawTiled())
7149
},
7150
drawPreRendered: function() {
7151
this.preRenderedChunks || this.preRenderMapToChunks();
7152
var b = ig.system.getDrawPos(this.scroll.x),
7153
c = ig.system.getDrawPos(this.scroll.y);
7154
this.repeat && (b %= this.width * this.tilesize * ig.system.scale, c %= this.height * this.tilesize * ig.system.scale);
7155
var d = Math.max(Math.floor(b / this.chunkSize), 0),
7156
e = Math.max(Math.floor(c / this.chunkSize), 0),
7157
f = Math.ceil((b + ig.system.realWidth) / this.chunkSize),
7158
l = Math.ceil((c + ig.system.realHeight) / this.chunkSize),
7159
q = this.preRenderedChunks[0].length,
7160
r = this.preRenderedChunks.length;
7161
this.repeat || (f = Math.min(f, q), l = Math.min(l, r));
7162
for (var g = 0; e < l; e++) {
7163
for (var m = 0, n = d; n < f; n++) {
7164
var p = this.preRenderedChunks[e % r][n % q],
7165
s = -b + n * this.chunkSize - m,
7166
u = -c + e * this.chunkSize - g;
7167
ig.system.context.drawImage(p, s, u);
7168
ig.Image.drawCount++;
7169
this.debugChunks && (ig.system.context.strokeStyle = "#f0f", ig.system.context.strokeRect(s, u, this.chunkSize, this.chunkSize));
7170
this.repeat && (p.width < this.chunkSize && s + p.width < ig.system.realWidth) && (m = this.chunkSize - p.width, f++)
7171
}
7172
this.repeat && (p.height < this.chunkSize && u + p.height < ig.system.realHeight) && (g = this.chunkSize - p.height, l++)
7173
}
7174
},
7175
drawTiled: function() {
7176
for (var b = 0, c = null, d = (this.scroll.x / this.tilesize).toInt(), e = (this.scroll.y / this.tilesize).toInt(), f = this.scroll.x % this.tilesize, l = this.scroll.y % this.tilesize, q = -f - this.tilesize, f = ig.system.width + this.tilesize -
7177
f, r = ig.system.height + this.tilesize - l, g = -1, l = -l - this.tilesize; l < r; g++, l += this.tilesize) {
7178
var m = g + e;
7179
if (m >= this.height || 0 > m) {
7180
if (!this.repeat) continue;
7181
m = 0 < m ? m % this.height : (m + 1) % this.height + this.height - 1
7182
}
7183
for (var n = -1, p = q; p < f; n++, p += this.tilesize) {
7184
b = n + d;
7185
if (b >= this.width || 0 > b) {
7186
if (!this.repeat) continue;
7187
b = 0 < b ? b % this.width : (b + 1) % this.width + this.width - 1
7188
}
7189
if (b = this.data[m][b])(c = this.anims[b - 1]) ? c.draw(p, l) : this.tiles.drawTile(p, l, b - 1, this.tilesize)
7190
}
7191
}
7192
}
7193
})
7194
});
7195
ig.baked = !0;
7196
ig.module("impact.game").requires("impact.impact", "impact.entity", "impact.collision-map", "impact.background-map").defines(function() {
7197
ig.Game = ig.Class.extend({
7198
clearColor: "#000000",
7199
gravity: 0,
7200
screen: {
7201
x: 0,
7202
y: 0
7203
},
7204
_rscreen: {
7205
x: 0,
7206
y: 0
7207
},
7208
entities: [],
7209
namedEntities: {},
7210
collisionMap: ig.CollisionMap.staticNoCollision,
7211
backgroundMaps: [],
7212
backgroundAnims: {},
7213
autoSort: !0,
7214
sortBy: null,
7215
cellSize: 64,
7216
_deferredKill: [],
7217
_levelToLoad: null,
7218
_doSortEntities: !1,
7219
staticInstantiate: function() {
7220
this.sortBy = this.sortBy || ig.Game.SORT.Z_INDEX;
7221
ig.game = this;
7222
return null
7223
},
7224
loadLevel: function(b) {
7225
this.screen = {
7226
x: 0,
7227
y: 0
7228
};
7229
this.entities = [];
7230
this.namedEntities = {};
7231
for (var c = 0; c < b.entities.length; c++) {
7232
var d = b.entities[c];
7233
this.spawnEntity(d.type, d.x, d.y, d.settings)
7234
}
7235
this.sortEntities();
7236
this.collisionMap = ig.CollisionMap.staticNoCollision;
7237
this.backgroundMaps = [];
7238
for (c = 0; c < b.layer.length; c++)
7239
if (d = b.layer[c], "collision" == d.name) this.collisionMap = new ig.CollisionMap(d.tilesize, d.data);
7240
else {
7241
var e = new ig.BackgroundMap(d.tilesize, d.data, d.tilesetName);
7242
e.anims = this.backgroundAnims[d.tilesetName] || {};
7243
e.repeat = d.repeat;
7244
e.distance = d.distance;
7245
e.foreground = !!d.foreground;
7246
e.preRender = !!d.preRender;
7247
e.name = d.name;
7248
this.backgroundMaps.push(e)
7249
}
7250
for (c = 0; c < this.entities.length; c++) this.entities[c].ready()
7251
},
7252
loadLevelDeferred: function(b) {
7253
this._levelToLoad = b
7254
},
7255
getMapByName: function(b) {
7256
if ("collision" == b) return this.collisionMap;
7257
for (var c = 0; c < this.backgroundMaps.length; c++)
7258
if (this.backgroundMaps[c].name == b) return this.backgroundMaps[c];
7259
return null
7260
},
7261
getEntityByName: function(b) {
7262
return this.namedEntities[b]
7263
},
7264
getEntitiesByType: function(b) {
7265
b = "string" === typeof b ? ig.global[b] : b;
7266
for (var c = [], d = 0; d < this.entities.length; d++) {
7267
var e = this.entities[d];
7268
e instanceof b && !e._killed && c.push(e)
7269
}
7270
return c
7271
},
7272
spawnEntity: function(b, c, d, e) {
7273
var f = "string" === typeof b ? ig.global[b] : b;
7274
if (!f) throw "Can't spawn entity of type " + b;
7275
b = new f(c, d, e || {});
7276
this.entities.push(b);
7277
b.name && (this.namedEntities[b.name] = b);
7278
return b
7279
},
7280
sortEntities: function() {
7281
this.entities.sort(this.sortBy)
7282
},
7283
sortEntitiesDeferred: function() {
7284
this._doSortEntities = !0
7285
},
7286
removeEntity: function(b) {
7287
b.name && delete this.namedEntities[b.name];
7288
b._killed = !0;
7289
b.type = ig.Entity.TYPE.NONE;
7290
b.checkAgainst = ig.Entity.TYPE.NONE;
7291
b.collides = ig.Entity.COLLIDES.NEVER;
7292
this._deferredKill.push(b)
7293
},
7294
run: function() {
7295
this.update();
7296
this.draw()
7297
},
7298
update: function() {
7299
this._levelToLoad && (this.loadLevel(this._levelToLoad), this._levelToLoad = null);
7300
this.updateEntities();
7301
this.checkEntities();
7302
for (var b = 0; b < this._deferredKill.length; b++) this._deferredKill[b].erase(), this.entities.erase(this._deferredKill[b]);
7303
this._deferredKill = [];
7304
if (this._doSortEntities || this.autoSort) this.sortEntities(), this._doSortEntities = !1;
7305
for (var c in this.backgroundAnims) {
7306
var b = this.backgroundAnims[c],
7307
d;
7308
for (d in b) b[d].update()
7309
}
7310
},
7311
updateEntities: function() {
7312
for (var b = 0; b < this.entities.length; b++) {
7313
var c = this.entities[b];
7314
c._killed || c.update()
7315
}
7316
},
7317
draw: function() {
7318
this.clearColor && ig.system.clear(this.clearColor);
7319
this._rscreen.x = ig.system.getDrawPos(this.screen.x) / ig.system.scale;
7320
this._rscreen.y = ig.system.getDrawPos(this.screen.y) / ig.system.scale;
7321
var b;
7322
for (b = 0; b < this.backgroundMaps.length; b++) {
7323
var c = this.backgroundMaps[b];
7324
if (c.foreground) break;
7325
c.setScreenPos(this.screen.x, this.screen.y);
7326
c.draw()
7327
}
7328
this.drawEntities();
7329
for (b; b < this.backgroundMaps.length; b++) c = this.backgroundMaps[b], c.setScreenPos(this.screen.x, this.screen.y), c.draw()
7330
},
7331
drawEntities: function() {
7332
for (var b = 0; b < this.entities.length; b++) this.entities[b].draw()
7333
},
7334
checkEntities: function() {
7335
for (var b = {}, c = 0; c < this.entities.length; c++) {
7336
var d = this.entities[c];
7337
if (!(d.type == ig.Entity.TYPE.NONE && d.checkAgainst == ig.Entity.TYPE.NONE && d.collides == ig.Entity.COLLIDES.NEVER))
7338
for (var e = {}, f = Math.floor(d.pos.y / this.cellSize), l = Math.floor((d.pos.x + d.size.x) / this.cellSize) + 1, q = Math.floor((d.pos.y + d.size.y) / this.cellSize) + 1, r = Math.floor(d.pos.x / this.cellSize); r < l; r++)
7339
for (var g = f; g < q; g++)
7340
if (b[r])
7341
if (b[r][g]) {
7342
for (var m = b[r][g], n = 0; n < m.length; n++) d.touches(m[n]) && !e[m[n].id] && (e[m[n].id] = !0, ig.Entity.checkPair(d, m[n]));
7343
m.push(d)
7344
} else b[r][g] = [d];
7345
else b[r] = {}, b[r][g] = [d]
7346
}
7347
}
7348
});
7349
ig.Game.SORT = {
7350
Z_INDEX: function(b, c) {
7351
return b.zIndex - c.zIndex
7352
},
7353
POS_X: function(b, c) {
7354
return b.pos.x + b.size.x - (c.pos.x +
7355
c.size.x)
7356
},
7357
POS_Y: function(b, c) {
7358
return b.pos.y + b.size.y - (c.pos.y + c.size.y)
7359
}
7360
}
7361
});
7362
ig.baked = !0;
7363
ig.module("plugins.splash-loader").requires("impact.loader", "impact.animation").defines(function() {
7364
ig.SplashLoader = ig.Loader.extend({
7365
loadingImage: new ig.Image("media/graphics/splash/loading.png"),
7366
loadingBarImage: new ig.Image("media/graphics/splash/loading-bar.png"),
7367
loadingTextImage: new ig.Image("media/graphics/splash/loading-text.png"),
7368
splashPortrait: new ig.Image("media/graphics/splash/portrait.jpg"),
7369
init: function(b, c) {
7370
this.parent(b, c);
7371
},
7372
end: function() {
7373
this.parent();
7374
var b = 0 <= document.URL.indexOf("localhost") ? 500 : 3E3;
7375
window.setTimeout("ig.system.setGame(MyGame)", b)
7376
},
7377
setupCustomAnimation: function() {
7378
this.customAnim = new ig.Animation(this.customAnim, 0.05, [0, 1, 2, 3, 4, 5]);
7379
this.customAnim.currentFrame = 0;
7380
ig.loadingScreen = this;
7381
ig.loadingScreen.animationTimer = window.setInterval("ig.loadingScreen.animate()", 100)
7382
},
7383
animate: function() {
7384
this.customAnim.currentFrame < this.customAnim.sequence.length ? this.customAnim.currentFrame++ : this.customAnim.currentFrame = 0;
7385
this.customAnim.gotoFrame(this.customAnim.currentFrame)
7386
},
7387
draw: function() {
7388
if (this.splashPortrait.loaded && (this._drawStatus += (this.status - this._drawStatus) / 5, ig.system.context.fillStyle = "#000", ig.system.context.fillRect(0, 0, ig.system.width, ig.system.height), this.splashPortrait.draw(0, 0), this.loadingImage.loaded && this.loadingBarImage.loaded && this.loadingTextImage.loaded)) {
7389
var b;
7390
b = 0.5 * ig.system.width - 191.5;
7391
this.loadingImage.draw(b, 581);
7392
this.loadingBarImage.draw(b, 581, 0, 0, 383 * this._drawStatus, 56);
7393
this.loadingTextImage.draw(b, 581)
7394
}
7395
}
7396
})
7397
});
7398
ig.baked = !0;
7399
ig.module("plugins.tween").requires("impact.entity").defines(function() {
7400
Array.prototype.indexOf || (Array.prototype.indexOf = function(b) {
7401
for (var c = 0; c < this.length; ++c)
7402
if (this[c] === b) return c;
7403
return -1
7404
});
7405
ig.Entity.prototype.tweens = [];
7406
ig.Entity.prototype._preTweenUpdate = ig.Entity.prototype.update;
7407
ig.Entity.prototype.update = function() {
7408
this._preTweenUpdate();
7409
if (0 < this.tweens.length) {
7410
for (var b = [], c = 0; c < this.tweens.length; c++) this.tweens[c].update(), this.tweens[c].complete || b.push(this.tweens[c]);
7411
this.tweens = b
7412
}
7413
};
7414
ig.Entity.prototype.tween = function(b, c, d) {
7415
b = new ig.Tween(this, b, c, d);
7416
this.tweens.push(b);
7417
return b
7418
};
7419
ig.Entity.prototype.pauseTweens = function() {
7420
for (var b = 0; b < this.tweens.length; b++) this.tweens[b].pause()
7421
};
7422
ig.Entity.prototype.resumeTweens = function() {
7423
for (var b = 0; b < this.tweens.length; b++) this.tweens[b].resume()
7424
};
7425
ig.Entity.prototype.stopTweens = function(b) {
7426
for (var c = 0; c < this.tweens.length; c++) this.tweens[c].stop(b)
7427
};
7428
ig.Tween = function(b, c, d, e) {
7429
var f = {},
7430
l = {},
7431
q = {},
7432
r = 0,
7433
g = !1,
7434
m = !1,
7435
n = !1;
7436
this.duration = d;
7437
this.paused = this.complete = !1;
7438
this.easing = ig.Tween.Easing.Linear.EaseNone;
7439
this.onComplete = !1;
7440
this.loop = this.delay = 0;
7441
this.loopCount = -1;
7442
ig.merge(this, e);
7443
this.loopNum = this.loopCount;
7444
this.chain = function(b) {
7445
n = b
7446
};
7447
this.initEnd = function(b, c, d) {
7448
if ("object" !== typeof c[b]) d[b] = c[b];
7449
else
7450
for (subprop in c[b]) d[b] || (d[b] = {}), this.initEnd(subprop, c[b], d[b])
7451
};
7452
this.initStart = function(b, c, d, e) {
7453
if ("object" !== typeof d[b]) "undefined" !== typeof c[b] && (e[b] = d[b]);
7454
else
7455
for (subprop in d[b]) e[b] || (e[b] = {}), "undefined" !== typeof c[b] && this.initStart(subprop, c[b], d[b], e[b])
7456
};
7457
this.start = function() {
7458
this.paused = this.complete = !1;
7459
this.loopNum = this.loopCount;
7460
r = 0; - 1 == b.tweens.indexOf(this) && b.tweens.push(this);
7461
m = !0;
7462
g = new ig.Timer;
7463
for (var d in c) this.initEnd(d, c, l);
7464
for (d in l) this.initStart(d, l, b, f), this.initDelta(d, q, b, l)
7465
};
7466
this.initDelta = function(b, c, d, e) {
7467
if ("object" !== typeof e[b]) c[b] = e[b] - d[b];
7468
else
7469
for (subprop in e[b]) c[b] || (c[b] = {}), this.initDelta(subprop, c[b], d[b], e[b])
7470
};
7471
this.propUpdate = function(b, c, d, e, f) {
7472
if ("object" !== typeof d[b]) c[b] = "undefined" != typeof d[b] ? d[b] + e[b] * f : c[b];
7473
else
7474
for (subprop in d[b]) this.propUpdate(subprop, c[b], d[b], e[b], f)
7475
};
7476
this.propSet = function(b, c, d) {
7477
if ("object" !== typeof c[b]) d[b] = c[b];
7478
else
7479
for (subprop in c[b]) d[b] || (d[b] = {}), this.propSet(subprop, c[b], d[b])
7480
};
7481
this.update = function() {
7482
if (!m) return !1;
7483
if (this.delay) {
7484
if (g.delta() < this.delay) return;
7485
this.delay = 0;
7486
g.reset()
7487
}
7488
if (this.paused || this.complete) return !1;
7489
var c = (g.delta() + r) / this.duration,
7490
c = 1 < c ? 1 : c,
7491
d = this.easing(c);
7492
for (property in q) this.propUpdate(property, b, f, q, d);
7493
if (1 <= c) {
7494
if (0 == this.loopNum || !this.loop) {
7495
this.complete = !0;
7496
if (this.onComplete) this.onComplete();
7497
n && n.start();
7498
return !1
7499
}
7500
if (this.loop == ig.Tween.Loop.Revert) {
7501
for (property in f) this.propSet(property, f, b);
7502
r = 0;
7503
g.reset(); - 1 != this.loopNum && this.loopNum--
7504
} else if (this.loop == ig.Tween.Loop.Reverse) {
7505
c = {};
7506
d = {};
7507
ig.merge(c, l);
7508
ig.merge(d, f);
7509
ig.merge(f, c);
7510
ig.merge(l, d);
7511
for (property in l) this.initDelta(property, q, b, l);
7512
r = 0;
7513
g.reset(); - 1 != this.loopNum && this.loopNum--
7514
}
7515
}
7516
};
7517
this.pause = function() {
7518
this.paused = !0;
7519
r += g.delta()
7520
};
7521
this.resume = function() {
7522
this.paused = !1;
7523
g.reset()
7524
};
7525
this.stop = function(b) {
7526
b && (this.loop = this.complete = this.paused = !1, r += d, this.update());
7527
this.complete = !0
7528
}
7529
};
7530
ig.Tween.Loop = {
7531
Revert: 1,
7532
Reverse: 2
7533
};
7534
ig.Tween.Easing = {
7535
Linear: {},
7536
Quadratic: {},
7537
Cubic: {},
7538
Quartic: {},
7539
Quintic: {},
7540
Sinusoidal: {},
7541
Exponential: {},
7542
Circular: {},
7543
Elastic: {},
7544
Back: {},
7545
Bounce: {}
7546
};
7547
ig.Tween.Easing.Linear.EaseNone = function(b) {
7548
return b
7549
};
7550
ig.Tween.Easing.Quadratic.EaseIn = function(b) {
7551
return b * b
7552
};
7553
ig.Tween.Easing.Quadratic.EaseOut = function(b) {
7554
return -b * (b - 2)
7555
};
7556
ig.Tween.Easing.Quadratic.EaseInOut = function(b) {
7557
return 1 > (b *= 2) ? 0.5 * b * b : -0.5 * (--b * (b - 2) - 1)
7558
};
7559
ig.Tween.Easing.Cubic.EaseIn = function(b) {
7560
return b * b * b
7561
};
7562
ig.Tween.Easing.Cubic.EaseOut = function(b) {
7563
return --b * b * b + 1
7564
};
7565
ig.Tween.Easing.Cubic.EaseInOut = function(b) {
7566
return 1 > (b *= 2) ? 0.5 * b * b * b : 0.5 * ((b -= 2) * b * b + 2)
7567
};
7568
ig.Tween.Easing.Quartic.EaseIn = function(b) {
7569
return b * b * b * b
7570
};
7571
ig.Tween.Easing.Quartic.EaseOut = function(b) {
7572
return -(--b * b * b * b - 1)
7573
};
7574
ig.Tween.Easing.Quartic.EaseInOut = function(b) {
7575
return 1 > (b *= 2) ? 0.5 * b * b * b * b : -0.5 * ((b -= 2) * b * b * b - 2)
7576
};
7577
ig.Tween.Easing.Quintic.EaseIn = function(b) {
7578
return b * b * b * b * b
7579
};
7580
ig.Tween.Easing.Quintic.EaseOut = function(b) {
7581
return (b -= 1) * b * b * b * b + 1
7582
};
7583
ig.Tween.Easing.Quintic.EaseInOut = function(b) {
7584
return 1 > (b *= 2) ? 0.5 * b * b * b * b * b : 0.5 * ((b -= 2) * b * b * b * b + 2)
7585
};
7586
ig.Tween.Easing.Sinusoidal.EaseIn = function(b) {
7587
return -Math.cos(b * Math.PI / 2) + 1
7588
};
7589
ig.Tween.Easing.Sinusoidal.EaseOut = function(b) {
7590
return Math.sin(b * Math.PI / 2)
7591
};
7592
ig.Tween.Easing.Sinusoidal.EaseInOut = function(b) {
7593
return -0.5 * (Math.cos(Math.PI * b) - 1)
7594
};
7595
ig.Tween.Easing.Exponential.EaseIn = function(b) {
7596
return 0 == b ? 0 : Math.pow(2, 10 * (b - 1))
7597
};
7598
ig.Tween.Easing.Exponential.EaseOut = function(b) {
7599
return 1 == b ? 1 : -Math.pow(2, -10 * b) + 1
7600
};
7601
ig.Tween.Easing.Exponential.EaseInOut = function(b) {
7602
return 0 == b ? 0 : 1 == b ? 1 : 1 > (b *= 2) ? 0.5 * Math.pow(2, 10 * (b - 1)) : 0.5 * (-Math.pow(2, -10 * (b - 1)) + 2)
7603
};
7604
ig.Tween.Easing.Circular.EaseIn = function(b) {
7605
return -(Math.sqrt(1 - b * b) - 1)
7606
};
7607
ig.Tween.Easing.Circular.EaseOut = function(b) {
7608
return Math.sqrt(1 - --b * b)
7609
};
7610
ig.Tween.Easing.Circular.EaseInOut = function(b) {
7611
return 1 > (b /= 0.5) ? -0.5 * (Math.sqrt(1 - b * b) - 1) : 0.5 * (Math.sqrt(1 - (b -= 2) * b) + 1)
7612
};
7613
ig.Tween.Easing.Elastic.EaseIn = function(b) {
7614
var c, d = 0.1,
7615
e = 0.4;
7616
if (0 == b) return 0;
7617
if (1 == b) return 1;
7618
e || (e = 0.3);
7619
!d || 1 > d ? (d = 1, c = e / 4) : c = e / (2 * Math.PI) * Math.asin(1 / d);
7620
return -(d * Math.pow(2, 10 * (b -= 1)) * Math.sin((b - c) * 2 * Math.PI / e))
7621
};
7622
ig.Tween.Easing.Elastic.EaseOut = function(b) {
7623
var c, d = 0.1,
7624
e = 0.4;
7625
if (0 == b) return 0;
7626
if (1 == b) return 1;
7627
e || (e = 0.3);
7628
!d || 1 > d ? (d = 1, c = e / 4) : c = e / (2 * Math.PI) * Math.asin(1 / d);
7629
return d * Math.pow(2, -10 * b) * Math.sin((b - c) * 2 * Math.PI / e) + 1
7630
};
7631
ig.Tween.Easing.Elastic.EaseInOut = function(b) {
7632
var c, d = 0.1,
7633
e = 0.4;
7634
if (0 == b) return 0;
7635
if (1 == b) return 1;
7636
e || (e = 0.3);
7637
!d || 1 > d ? (d = 1, c = e / 4) : c = e / (2 * Math.PI) * Math.asin(1 / d);
7638
return 1 > (b *= 2) ? -0.5 * d * Math.pow(2, 10 * (b -= 1)) * Math.sin((b - c) * 2 * Math.PI / e) : 0.5 * d * Math.pow(2, -10 * (b -= 1)) * Math.sin((b - c) * 2 * Math.PI / e) + 1
7639
};
7640
ig.Tween.Easing.Back.EaseIn = function(b) {
7641
return b * b * (2.70158 * b - 1.70158)
7642
};
7643
ig.Tween.Easing.Back.EaseOut = function(b) {
7644
return (b -= 1) * b * (2.70158 * b + 1.70158) + 1
7645
};
7646
ig.Tween.Easing.Back.EaseInOut = function(b) {
7647
return 1 > (b *= 2) ? 0.5 * b * b * (3.5949095 * b - 2.5949095) : 0.5 * ((b -= 2) * b * (3.5949095 * b + 2.5949095) + 2)
7648
};
7649
ig.Tween.Easing.Bounce.EaseIn = function(b) {
7650
return 1 - ig.Tween.Easing.Bounce.EaseOut(1 - b)
7651
};
7652
ig.Tween.Easing.Bounce.EaseOut = function(b) {
7653
return (b /= 1) < 1 / 2.75 ? 7.5625 * b * b : b < 2 / 2.75 ? 7.5625 * (b -= 1.5 / 2.75) * b + 0.75 : b < 2.5 / 2.75 ? 7.5625 * (b -= 2.25 / 2.75) * b + 0.9375 : 7.5625 * (b -= 2.625 / 2.75) * b + 0.984375
7654
};
7655
ig.Tween.Easing.Bounce.EaseInOut = function(b) {
7656
return 0.5 > b ? 0.5 * ig.Tween.Easing.Bounce.EaseIn(2 * b) : 0.5 * ig.Tween.Easing.Bounce.EaseOut(2 * b - 1) + 0.5
7657
}
7658
});
7659
ig.baked = !0;
7660
ig.module("plugins.url-parameters").defines(function() {
7661
ig.UrlParameters = ig.Class.extend({
7662
init: function() {
7663
switch (getQueryVariable("iphone")) {
7664
case "true":
7665
ig.ua.iPhone = !0, console.log("iPhone mode")
7666
}
7667
var b = getQueryVariable("webview");
7668
if (b) switch (b) {
7669
case "true":
7670
ig.ua.is_uiwebview = !0, console.log("webview mode")
7671
}
7672
if (b = getQueryVariable("debug")) switch (b) {
7673
case "true":
7674
ig.game.debug = !0, ig.game.showDebugMenu(), console.log("debug mode")
7675
}
7676
switch (getQueryVariable("view")) {
7677
case "stats":
7678
ig.game.resetPlayerStats(), ig.game.endGame()
7679
}
7680
getQueryVariable("ad")
7681
}
7682
})
7683
});
7684
ig.baked = !0;
7685
ig.module("plugins.jukebox").defines(function() {
7686
ig.Jukebox = ig.Class.extend({
7687
init: function() {
7688
this.player = new jukebox.Player({
7689
resources: ["media/audio/bgm.mp3", "media/sounds/bgm.ogg"],
7690
autoplay: !1,
7691
spritemap: {
7692
music: {
7693
start: 0,
7694
end: 18.108,
7695
loop: !0
7696
}
7697
}
7698
})
7699
}
7700
})
7701
});
7702
ig.baked = !0;
7703
ig.module("plugins.director").requires("impact.impact").defines(function() {
7704
ig.Director = ig.Class.extend({
7705
init: function(b, c) {
7706
this.game = b;
7707
this.levels = [];
7708
this.currentLevel = 0;
7709
this.append(c)
7710
},
7711
loadLevel: function(b) {
7712
for (key in dynamicClickableEntityDivs) ig.game.hideOverlay([key]);
7713
this.currentLevel = b;
7714
this.game.loadLevel(this.levels[b]);
7715
return !0
7716
},
7717
loadLevelWithoutEntities: function(b) {
7718
this.currentLevel = b;
7719
this.game.loadLevelWithoutEntities(this.levels[b]);
7720
return !0
7721
},
7722
append: function(b) {
7723
newLevels = [];
7724
return "object" === typeof b ? (b.constructor === [].constructor ? newLevels = b : newLevels[0] = b, this.levels = this.levels.concat(newLevels), !0) : !1
7725
},
7726
nextLevel: function() {
7727
return this.currentLevel + 1 < this.levels.length ? this.loadLevel(this.currentLevel + 1) : !1
7728
},
7729
previousLevel: function() {
7730
return 0 <= this.currentLevel - 1 ? this.loadLevel(this.currentLevel - 1) : !1
7731
},
7732
jumpTo: function(b) {
7733
var c = null;
7734
for (i = 0; i < this.levels.length; i++) this.levels[i] == b && (c = i);
7735
return 0 <= c ? this.loadLevel(c) : !1
7736
},
7737
firstLevel: function() {
7738
return this.loadLevel(0)
7739
},
7740
lastLevel: function() {
7741
return this.loadLevel(this.levels.length -
7742
1)
7743
},
7744
reloadLevel: function() {
7745
return this.loadLevel(this.currentLevel)
7746
}
7747
})
7748
});
7749
ig.baked = !0;
7750
ig.module("plugins.impact-storage").requires("impact.game").defines(function() {
7751
ig.Storage = ig.Class.extend({
7752
staticInstantiate: function() {
7753
return !ig.Storage.instance ? null : ig.Storage.instance
7754
},
7755
init: function() {
7756
ig.Storage.instance = this
7757
},
7758
isCapable: function() {
7759
return "undefined" !== typeof window.localStorage
7760
},
7761
isSet: function(b) {
7762
return null !== this.get(b)
7763
},
7764
initUnset: function(b, c) {
7765
null === this.get(b) && this.set(b, c)
7766
},
7767
get: function(b) {
7768
if (!this.isCapable()) return null;
7769
try {
7770
return JSON.parse(localStorage.getItem(b))
7771
} catch (c) {
7772
return window.localStorage.getItem(b)
7773
}
7774
},
7775
getInt: function(b) {
7776
return ~~this.get(b)
7777
},
7778
getFloat: function(b) {
7779
return parseFloat(this.get(b))
7780
},
7781
getBool: function(b) {
7782
return !!this.get(b)
7783
},
7784
key: function(b) {
7785
return this.isCapable() ? window.localStorage.key(b) : null
7786
},
7787
set: function(b, c) {
7788
if (!this.isCapable()) return null;
7789
try {
7790
window.localStorage.setItem(b, JSON.stringify(c))
7791
} catch (d) {
7792
d == QUOTA_EXCEEDED_ERR && console.log("localStorage quota exceeded")
7793
}
7794
},
7795
setHighest: function(b, c) {
7796
c > this.getFloat(b) && this.set(b, c)
7797
},
7798
remove: function(b) {
7799
if (!this.isCapable()) return null;
7800
window.localStorage.removeItem(b)
7801
},
7802
clear: function() {
7803
if (!this.isCapable()) return null;
7804
window.localStorage.clear()
7805
}
7806
})
7807
});
7808
ig.baked = !0;
7809
ig.module("plugins.storage-manager").requires("impact.game").defines(function() {
7810
ig.Game.prototype.name = "MJS-Game";
7811
ig.Game.prototype.version = "1.0";
7812
ig.Game.prototype.sessionData = {};
7813
ig.Game.prototype.initData = function() {
7814
return this.sessionData = {
7815
sound: 0.5,
7816
music: 0.5,
7817
level: 1,
7818
score: 0
7819
}
7820
};
7821
ig.Game.prototype.setupStorageManager = function() {
7822
if ("undefined" === typeof this.name) console.error("Cannot found Game Name, Storage Manager Cancelled.");
7823
else if ("undefined" === typeof this.version) console.error("Cannot found Game Version, Storage Manager Cancelled.");
7824
else {
7825
console.log("Plug in Storage Manager");
7826
try {
7827
window.localStorage.setItem("test", "test"), this.storage = new ig.Storage
7828
} catch (b) {
7829
console.log("using fake storage"), this.storage = new ig.FakeStorage
7830
} finally {
7831
window.localStorage.removeItem("test")
7832
}
7833
this.storageName = this.name + "-v" + this.version
7834
}
7835
};
7836
ig.Game.prototype.loadAll = function() {
7837
var b = this.storage.get(this.storageName);
7838
if (null === b || "undefined" === typeof b) b = this.initData();
7839
for (var c in b) this.sessionData[c] = b[c];
7840
this.storage.set(this.storageName, b)
7841
};
7842
ig.Game.prototype.saveAll = function() {
7843
var b = this.storage.get(this.storageName),
7844
c;
7845
for (c in b) b[c] = this.sessionData[c];
7846
this.storage.set(this.storageName, b)
7847
};
7848
ig.Game.prototype.load = function(b) {
7849
return this.storage.get(this.storageName)[b]
7850
};
7851
ig.Game.prototype.save = function(b, c) {
7852
var d = this.storage.get(this.storageName);
7853
d[b] = c;
7854
this.storage.set(this.storageName, d)
7855
}
7856
});
7857
this.START_BRANDING_SPLASH;
7858
ig.baked = !0;
7859
ig.module("plugins.branding.splash").requires("impact.impact", "impact.entity").defines(function() {
7860
ig.BrandingSplash = ig.Class.extend({
7861
init: function() {
7862
ig.game.spawnEntity(EntityBranding, 0, 0)
7863
}
7864
});
7865
EntityBranding = ig.Entity.extend({
7866
gravityFactor: 0,
7867
size: {
7868
x: 32,
7869
y: 32
7870
},
7871
splashlogo: new ig.Image("branding/logo.png"),
7872
init: function(b, c, d) {
7873
this.parent(b, c, d);
7874
this.pos.x = ig.system.width / 2;
7875
this.pos.y = ig.system.height / 2 - ig.system.height;
7876
b = this.tween({
7877
pos: {
7878
y: ig.system.height / 2
7879
}
7880
}, 0.5, {
7881
easing: ig.Tween.Easing.Bounce.EaseIn
7882
});
7883
c = this.tween({}, 2.5, {
7884
onComplete: function() {
7885
ig.game.director.loadLevel(ig.game.director.currentLevel)
7886
}
7887
});
7888
b.chain(c);
7889
b.start()
7890
},
7891
createClickableLayer: function() {
7892
console.log("Build clickable layer");
7893
this.checkClickableLayer("branding-splash", _SETTINGS.Branding.Logo.Link, !0)
7894
},
7895
doesClickableLayerExist: function(b) {
7896
for (k in dynamicClickableEntityDivs)
7897
if (k == b) return !0;
7898
return !1
7899
},
7900
checkClickableLayer: function(b, c, d) {
7901
"undefined" == typeof wm && (this.doesClickableLayerExist(b) ? (ig.game.showOverlay([b]), $("#" + b).find("[href]").attr("href", c)) : this.createClickableOutboundLayer(b, c, "media/graphics/misc/invisible.png", d))
7902
},
7903
createClickableOutboundLayer: function(b, c, d, e) {
7904
var f = ig.$new("div");
7905
f.id = b;
7906
document.body.appendChild(f);
7907
$("#" + f.id).css("float", "left");
7908
$("#" + f.id).css("position", "absolute");
7909
if (ig.ua.mobile) {
7910
var l = window.innerHeight / mobileHeight,
7911
q = window.innerWidth / mobileWidth;
7912
$("#" + f.id).css("left", this.pos.x * q);
7913
$("#" + f.id).css("top", this.pos.y * l);
7914
$("#" + f.id).css("width", this.size.x * q);
7915
$("#" + f.id).css("height", this.size.y * l)
7916
} else l = w / 2 - destW / 2, q = h / 2 - destH / 2, console.log(l, q), $("#" + f.id).css("left", l + this.pos.x * multiplier), $("#" + f.id).css("top", q + this.pos.y * multiplier), $("#" + f.id).css("width", this.size.x * multiplier), $("#" + f.id).css("height", this.size.y * multiplier);
7917
e ? $("#" + f.id).html("<a target='_blank' href='" + c + "'><img style='width:100%;height:100%' src='" + d + "'></a>") : $("#" + f.id).html("<a href='" + c + "'><img style='width:100%;height:100%' src='" + d + "'></a>");
7918
dynamicClickableEntityDivs[b] = {};
7919
dynamicClickableEntityDivs[b].width = this.size.x * multiplier;
7920
dynamicClickableEntityDivs[b].height = this.size.y * multiplier;
7921
dynamicClickableEntityDivs[b].entity_pos_x = this.pos.x;
7922
dynamicClickableEntityDivs[b].entity_pos_y = this.pos.y
7923
},
7924
draw: function() {
7925
ig.system.context.fillStyle = "#e1ebf1";
7926
ig.system.context.fillRect(0, 0, ig.system.width, ig.system.height);
7927
this.splashlogo.draw(this.pos.x - this.splashlogo.width / 2, this.pos.y - this.splashlogo.height / 2);
7928
this.parent()
7929
}
7930
})
7931
});
7932
this.END_BRANDING_SPLASH;
7933
ig.baked = !0;
7934
ig.module("plugins.lagged-api").requires("impact.game", "impact.timer").defines(function() {
7935
ig.Game.inject({
7936
laggedAdShown: !1,
7937
laggedTimer: !1,
7938
laggedNomoreTimer: !1,
7939
laggedNomoreTimerDuration: 0,
7940
initLagged: function(b, c) {
7941
// LaggedAPI.init(b, c)
7942
},
7943
saveLaggedAward: function(b) {
7944
var c = [];
7945
c.push(b);
7946
// LaggedAPI.Achievements.save(c, function(b) {
7947
// b.success ? console.log("achievement saved") : console.log(b.errormsg)
7948
// })
7949
},
7950
saveLaggedHighscore: function(b, c) {
7951
console.log(c);
7952
var d = {};
7953
d.score = c;
7954
d.board = b;
7955
// LaggedAPI.Scores.save(d, function(b) {
7956
// b.success ? console.log("high score saved") : console.log(b.errormsg)
7957
// })
7958
},
7959
initLaggedAdTimer: function(b, c, d, e) {
7960
b && (this.laggedTimerDuration = b, this.laggedTimerId = c, this.laggedTimerIdImage = d);
7961
e && (this.laggedTimerAdOnComplete = e);
7962
this.laggedTimer = new ig.Timer(this.laggedTimerDuration)
7963
},
7964
update: function() {
7965
this.parent();
7966
this.laggedTimer && 0 < this.laggedTimer.delta()
7967
// && (this.fnShowLaggedAd(this.laggedTimerId, this.laggedTimerIdImage, this.laggedTimerAdOnComplete || !1),
7968
// this.initLaggedAdTimer())
7969
},
7970
initLaggedNomoreTimer: function() {
7971
this.laggedNomoreTimer = new ig.Timer(this.laggedNomoreTimerDuration)
7972
},
7973
fnShowLaggedAd: function(b, c, d) {
7974
// if (!this.laggedAdShown) {
7975
// if (this.laggedNomoreTimerDuration) {
7976
// if (this.laggedNomoreTimer && 0 > this.laggedNomoreTimer.delta()) return;
7977
// this.initLaggedNomoreTimer()
7978
// }
7979
// this.laggedAdShown = !0;
7980
// "undefined" === typeof prerollStart ? console.log("skip ad, prerollStart not found") : LaggedAPI.APIAds.show("interstitial", b, c, function(b) {
7981
// b.success ? (this.laggedAdShown = !1, console.log("ad done")) : (this.laggedAdShown = !1, console.log("ad error, continue"));
7982
// d && "function" === typeof d && d()
7983
// }.bind(this))
7984
// }
7985
}
7986
})
7987
});
7988
ig.baked = !0;
7989
ig.module("game.entities.branding-logo-placeholder").requires("impact.entity").defines(function() {
7990
EntityBrandingLogoPlaceholder = ig.Entity.extend({
7991
gravityFactor: 0,
7992
size: {
7993
x: 32,
7994
y: 32
7995
},
7996
_wmDrawBox: !0,
7997
_wmBoxColor: "rgba(0, 0, 255, 0.7)",
7998
init: function(b, c, d) {
7999
this.parent(b, c, d);
8000
if (d) switch (console.log("settings found ... using that div layer name"), b = d.div_layer_name, console.log("settings.centralize:", d.centralize), d.centralize) {
8001
case "true":
8002
console.log("centralize true");
8003
centralize = !0;
8004
break;
8005
case "false":
8006
console.log("centralize false");
8007
centralize = !1;
8008
break;
8009
default:
8010
console.log("default ... centralize false"), centralize = !1
8011
} else b = "branding-logo", centralize = !1;
8012
if ("undefined" == typeof wm) {
8013
if (_SETTINGS.Branding.Logo.Enabled) try {
8014
ig.game.spawnEntity(EntityBrandingLogo, this.pos.x, this.pos.y, {
8015
div_layer_name: b,
8016
centralize: centralize
8017
})
8018
} catch (e) {
8019
console.log(e)
8020
}
8021
this.kill()
8022
}
8023
}
8024
})
8025
});
8026
this.START_BRANDING_LOGO;
8027
ig.baked = !0;
8028
ig.module("game.entities.branding-logo").requires("impact.entity").defines(function() {
8029
EntityBrandingLogo = ig.Entity.extend({
8030
gravityFactor: 0,
8031
logo: new ig.AnimationSheet("branding/logo.png", _SETTINGS.Branding.Logo.Width, _SETTINGS.Branding.Logo.Height),
8032
size: {
8033
x: 141,
8034
y: 20
8035
},
8036
zIndex: 1099,
8037
init: function(b, c, d) {
8038
this.parent(b, c, d);
8039
"undefined" == typeof wm && (_SETTINGS.Branding.Logo.Enabled ? (this.size.x = _SETTINGS.Branding.Logo.Width, this.size.y = _SETTINGS.Branding.Logo.Height, d && d.centralize && (this.pos.x = ig.system.width / 2 - this.size.x / 2, console.log("centralize true ... centering branded logo ..."))) : this.kill());
8040
this.anims.idle = new ig.Animation(this.logo, 0, [0], !0);
8041
this.currentAnim = this.anims.idle;
8042
d ? (console.log("branding settings found ... using that div layer name"), b = d.div_layer_name) : b = "branding-logo";
8043
_SETTINGS.Branding.Logo.LinkEnabled && (console.log("logo link enabled"), this.checkClickableLayer(b, _SETTINGS.Branding.Logo.Link, _SETTINGS.Branding.Logo.NewWindow));
8044
console.log("branding logo spawed ...")
8045
},
8046
doesClickableLayerExist: function(b) {
8047
for (k in dynamicClickableEntityDivs)
8048
if (k == b) return !0;
8049
return !1
8050
},
8051
checkClickableLayer: function(b, c, d) {
8052
"undefined" == typeof wm && (this.doesClickableLayerExist(b) ? (ig.game.showOverlay([b]), $("#" + b).find("[href]").attr("href", c)) : this.createClickableOutboundLayer(b, c, "media/graphics/misc/invisible.png", d))
8053
},
8054
createClickableOutboundLayer: function(b, c, d, e) {
8055
var f = ig.$new("div");
8056
f.id = b;
8057
document.body.appendChild(f);
8058
$("#" + f.id).css("float", "left");
8059
$("#" + f.id).css("position", "absolute");
8060
if (ig.ua.mobile) {
8061
var l = window.innerHeight / mobileHeight,
8062
q = window.innerWidth / mobileWidth;
8063
$("#" + f.id).css("left", this.pos.x * q);
8064
$("#" + f.id).css("top", this.pos.y * l);
8065
$("#" + f.id).css("width", this.size.x * q);
8066
$("#" + f.id).css("height", this.size.y * l)
8067
} else l = w / 2 - destW / 2, q = h / 2 - destH / 2, console.log(l, q), $("#" + f.id).css("left", l + this.pos.x * multiplier), $("#" + f.id).css("top", q + this.pos.y * multiplier), $("#" + f.id).css("width", this.size.x * multiplier), $("#" + f.id).css("height", this.size.y * multiplier);
8068
e ? $("#" + f.id).html("<a target='_blank' href='" + c + "'><img style='width:100%;height:100%' src='" +
8069
d + "'></a>") : $("#" + f.id).html("<a href='" + c + "'><img style='width:100%;height:100%' src='" + d + "'></a>");
8070
dynamicClickableEntityDivs[b] = {};
8071
dynamicClickableEntityDivs[b].width = this.size.x * multiplier;
8072
dynamicClickableEntityDivs[b].height = this.size.y * multiplier;
8073
dynamicClickableEntityDivs[b].entity_pos_x = this.pos.x;
8074
dynamicClickableEntityDivs[b].entity_pos_y = this.pos.y
8075
}
8076
})
8077
});
8078
this.END_BRANDING_LOGO;
8079
ig.baked = !0;
8080
ig.module("game.entities.button-more-games").requires("impact.entity").defines(function() {
8081
EntityButtonMoreGames = ig.Entity.extend({
8082
size: {
8083
x: 220,
8084
y: 52
8085
},
8086
zIndex: 1750,
8087
hidden: !1,
8088
image: new ig.Image("media/graphics/game/ui/mainmenu/moregames.png"),
8089
init: function(b, c, d) {
8090
this.parent(b, c, d);
8091
this.offset.y = -(ig.system.height - c + 54);
8092
this.tween({
8093
offset: {
8094
y: 0
8095
}
8096
}, 1, {
8097
easing: ig.Tween.Easing.Elastic.EaseOut
8098
}).start()
8099
},
8100
ready: function() {
8101
setTimeout(this.spawnDiv(), 5)
8102
},
8103
spawnDiv: function() {
8104
this.canSpawnDiv || (this.canSpawnDiv = !0, _SETTINGS.MoreGames.Enabled ? this.checkClickableLayer(this.divLayerName ? this.divLayerName : "more-games", _SETTINGS.MoreGames.Link, _SETTINGS.MoreGames.NewWindow) : this.kill())
8105
},
8106
doesClickableLayerExist: function(b) {
8107
for (k in dynamicClickableEntityDivs)
8108
if (k == b) return !0;
8109
return !1
8110
},
8111
checkClickableLayer: function(b, c, d) {
8112
"undefined" == typeof wm && (this.doesClickableLayerExist(b) ? (ig.game.showOverlay([b]), $("#" + b).find("[href]").attr("href", c), ig.ua.mobile ? (c = window.innerHeight / mobileHeight, d = window.innerWidth / mobileWidth, $("#" + b).css("left", this.pos.x * d), $("#" + b).css("top", this.pos.y * c), $("#" + b).css("width", this.size.x * d), $("#" + b).css("height", this.size.y * c)) : (c = document.getElementById("game").offsetLeft, d = document.getElementById("game").offsetTop, $("#" + b).css("left", c + this.pos.x * multiplier), $("#" + b).css("top", d + this.pos.y * multiplier), $("#" + b).css("width", this.size.x * multiplier), $("#" + b).css("height", this.size.y * multiplier))) : this.createClickableOutboundLayer(b, c, "media/graphics/misc/invisible.png", d))
8113
},
8114
createClickableOutboundLayer: function(b, c, d, e) {
8115
var f = ig.$new("div");
8116
f.id = b;
8117
document.body.appendChild(f);
8118
$("#" + f.id).css("float", "left");
8119
$("#" + f.id).css("position", "absolute");
8120
if (ig.ua.mobile) {
8121
var l = window.innerHeight / mobileHeight,
8122
q = window.innerWidth / mobileWidth;
8123
$("#" + f.id).css("left", this.pos.x * q);
8124
$("#" + f.id).css("top", this.pos.y * l);
8125
$("#" + f.id).css("width", this.size.x * q);
8126
$("#" + f.id).css("height", this.size.y * l)
8127
} else l = document.getElementById("game").offsetLeft, q = document.getElementById("game").offsetTop, $("#" + f.id).css("left", l + this.pos.x * multiplier), $("#" + f.id).css("top", q + this.pos.y * multiplier), $("#" + f.id).css("width", this.size.x * multiplier), $("#" + f.id).css("height", this.size.y * multiplier);
8128
e ? $("#" + f.id).html("<a target='_blank' href='" + c + "'><img style='width:100%;height:100%' src='" + d + "'></a>") : $("#" + f.id).html("<a href='" + c + "'><img style='width:100%;height:100%' src='" + d + "'></a>");
8129
dynamicClickableEntityDivs[b] = {};
8130
dynamicClickableEntityDivs[b].width = this.size.x * multiplier;
8131
dynamicClickableEntityDivs[b].height = this.size.y * multiplier;
8132
dynamicClickableEntityDivs[b].entity_pos_x = this.pos.x;
8133
dynamicClickableEntityDivs[b].entity_pos_y = this.pos.y
8134
},
8135
hide: function() {
8136
var b = "more-games";
8137
this.divLayerName && (b = this.divLayerName);
8138
var c = document.getElementById(b);
8139
c && (c.style.visibility = "hidden");
8140
$("#" + b) && $("#" + b).hide();
8141
this.hidden = !0
8142
},
8143
show: function() {
8144
var b = "more-games";
8145
this.divLayerName && (b = this.divLayerName);
8146
var c = document.getElementById(b);
8147
c && (c.style.visibility = "visible");
8148
$("#" + b) && $("#" + b).show();
8149
this.hidden = !1
8150
},
8151
draw: function() {},
8152
hideLink: function() {
8153
var b = "more-games";
8154
this.divLayerName && (b = this.divLayerName);
8155
var c = document.getElementById(b);
8156
c && (c.style.visibility = "hidden");
8157
$("#" + b) && $("#" + b).hide()
8158
},
8159
showLink: function() {
8160
var b = "more-games";
8161
this.divLayerName && (b = this.divLayerName);
8162
var c = document.getElementById(b);
8163
c && (c.style.visibility = "visible");
8164
$("#" + b) && $("#" + b).show()
8165
}
8166
})
8167
});
8168
ig.baked = !0;
8169
ig.module("game.entities.opening-kitty").requires("impact.entity").defines(function() {
8170
EntityOpeningKitty = ig.Entity.extend({
8171
size: {
8172
x: 48,
8173
y: 48
8174
},
8175
kittyAnim: -1,
8176
kittyImage: new ig.Image("media/graphics/opening/kitty.png"),
8177
kittyTitleImage: new ig.Image("media/graphics/opening/kittytitle.png"),
8178
init: function(b, c, d) {
8179
this.parent(b, c, d)
8180
},
8181
ready: function() {
8182
if (!ig.wm)
8183
if (_SETTINGS.DeveloperBranding.Splash.Enabled) {
8184
this.initTimer = new ig.Timer(0.1);
8185
try {
8186
ig.soundHandler.playSound("kittyopeningSound")
8187
} catch (b) {
8188
console.log(b)
8189
}
8190
} else ig.game.director.nextLevel(), ig.system.context.globalAlpha = 1, this.kill()
8191
},
8192
update: function() {
8193
this.parent();
8194
this.updateKittyOpening()
8195
},
8196
draw: function() {
8197
this.parent();
8198
ig.global.wm || (this.nextLevelTimer && 0 > this.nextLevelTimer.delta() && (ig.system.context.globalAlpha = -this.nextLevelTimer.delta()), this.drawKittyOpening())
8199
},
8200
updateKittyOpening: function() {
8201
this.initTimer && 0 < this.initTimer.delta() && (this.initTimer = null, this.kittyTimer = new ig.Timer(0.15));
8202
this.kittyTimer && 0 < this.kittyTimer.delta() && (7 > this.kittyAnim ? (this.kittyAnim++, this.kittyTimer.reset()) : (this.kittyTimer = null, this.nextLevelTimer = new ig.Timer(2)));
8203
this.nextLevelTimer && 0 < this.nextLevelTimer.delta() && (this.nextLevelTimer = null, ig.game.director.nextLevel(), ig.system.context.globalAlpha = 1)
8204
},
8205
drawKittyOpening: function() {
8206
var b = ig.system.context.createLinearGradient(0, 0, 0, ig.system.height);
8207
b.addColorStop(0, "#ffed94");
8208
b.addColorStop(1, "#ffcd85");
8209
ig.system.context.fillStyle = b;
8210
ig.system.context.fillRect(0, 0, ig.system.width, ig.system.height);
8211
this.kittyImage.drawTile(ig.system.width / 2 - this.kittyImage.width / 8, ig.system.height / 2 - this.kittyImage.height / 4, this.kittyAnim, 218, 325);
8212
this.kittyTitleImage.drawTile(ig.system.width / 2 - this.kittyTitleImage.width / 2, ig.system.height / 2 + this.kittyImage.height / 4 + 10, this.kittyAnim, 380, 37);
8213
ig.system.context.globalAlpha = 1
8214
}
8215
})
8216
});
8217
ig.baked = !0;
8218
ig.module("game.entities.pointer").requires("impact.entity").defines(function() {
8219
EntityPointer = ig.Entity.extend({
8220
type: ig.Entity.TYPE.A,
8221
checkAgainst: ig.Entity.TYPE.B,
8222
isClicking: !1,
8223
selectedItem: null,
8224
firstClick: !1,
8225
isReleased: !1,
8226
hoveringItem: null,
8227
objectArray: [],
8228
ignorePause: !0,
8229
zIndex: 2E4,
8230
firstClickObject: null,
8231
check: function(b) {
8232
this.objectArray.push(b)
8233
},
8234
clickObject: function(b) {
8235
this.firstClick && !this.isReleased && (b == this.firstClickObject ? "function" == typeof b.clicking && b.clicking(this) : this.touches(this.firstClickObject) ? "function" == typeof this.firstClickObject.clicking && this.firstClickObject.clicking(this) : ("function" == typeof this.firstClickObject.lostPointer && this.firstClickObject.lostPointer(this), this.firstClickObject = null, this.firstClick = !1));
8236
this.isClicking && !this.firstClick && ("function" == typeof b.clicked && b.clicked(this), this.firstClick = !0, this.firstClickObject = b);
8237
this.isReleased && ("function" == typeof b.released && b.released(this), this.firstClickObject = null, this.firstClick = !1)
8238
},
8239
reset: function() {
8240
this.firstClickObject = null;
8241
this.firstClick = !1
8242
},
8243
refreshPos: function() {
8244
if (ig.ua.mobile) {
8245
var b = window.innerHeight / mobileHeight,
8246
c = window.innerWidth / mobileWidth;
8247
portraitMode ? (b /= c, c = 1) : (c /= b, b = 1);
8248
this.pos.x = ig.input.mouse.x / c - this.size.x / 2;
8249
this.pos.y = ig.input.mouse.y / b - this.size.y / 2
8250
} else this.pos.x = ig.input.mouse.x - this.size.x / 2, this.pos.y = ig.input.mouse.y - this.size.y / 2
8251
},
8252
update: function() {
8253
this.refreshPos();
8254
var b = null,
8255
c = -1;
8256
for (a = this.objectArray.length - 1; - 1 < a; a--) this.objectArray[a].zIndex > c && (c = this.objectArray[a].zIndex, b = this.objectArray[a]);
8257
null != b ? (null != this.hoveringItem && "function" == typeof this.hoveringItem.idle && this.hoveringItem != b && this.hoveringItem.idle(this), this.hoveringItem = b, this.clickObject(b), this.objectArray = []) : (null != this.hoveringItem && "function" == typeof this.hoveringItem.idle && (this.hoveringItem.idle(this), this.hoveringItem = null), this.firstClick && !this.isReleased && null != this.firstClickObject && ("function" == typeof this.firstClickObject.lostPointer && this.firstClickObject.lostPointer(this), this.firstClickObject = null, this.firstClick = !1));
8258
this.isClicking = ig.input.pressed("click");
8259
this.isReleased = ig.input.released("click")
8260
}
8261
})
8262
});
8263
ig.baked = !0;
8264
ig.module("game.entities.pointer-selector").requires("game.entities.pointer").defines(function() {
8265
EntityPointerSelector = EntityPointer.extend({
8266
zIndex: 1E3,
8267
_wmDrawBox: !0,
8268
_wmBoxColor: "rgba(0, 0, 255, 0.7)",
8269
size: {
8270
x: 10,
8271
y: 10
8272
},
8273
init: function(b, c, d) {
8274
this.parent(b, c, d)
8275
},
8276
draw: function() {
8277
this.parent();
8278
ig.game.debug && (ig.system.context.fillStyle = "black", ig.system.context.font = "18px Arial", ig.system.context.textAlign = "left", ig.system.context.fillText(Math.round(this.pos.x) + ", " + Math.round(this.pos.y), this.pos.x, this.pos.y))
8279
}
8280
})
8281
});
8282
ig.baked = !0;
8283
ig.module("game.entities.select").requires("impact.entity").defines(function() {
8284
EntitySelect = ig.Entity.extend({
8285
type: ig.Entity.TYPE.B,
8286
checkAgainst: ig.Entity.TYPE.A,
8287
collides: ig.Entity.COLLIDES.NEVER,
8288
canSelect: !1,
8289
canSelectTimerDuration: 0.35,
8290
zIndex: 99999,
8291
isHovering: !1,
8292
isSelected: !1,
8293
init: function(b, c, d) {
8294
this.parent(b, c, d);
8295
this.canSelectTimer = new ig.Timer(this.canSelectTimerDuration)
8296
},
8297
doesClickableLayerExist: function(b) {
8298
for (k in dynamicClickableEntityDivs)
8299
if (k == b) return !0;
8300
return !1
8301
},
8302
checkClickableLayer: function(b, c, d) {
8303
"undefined" == typeof wm && (this.doesClickableLayerExist(b) ? (ig.game.showOverlay([b]), $("#" + b).find("[href]").attr("href", c)) : this.createClickableOutboundLayer(b, c, "media/misc/invisible.png", d))
8304
},
8305
createClickableOutboundLayer: function(b, c, d, e) {
8306
var f = ig.$new("div");
8307
f.id = b;
8308
document.body.appendChild(f);
8309
$("#" + f.id).css("float", "left");
8310
$("#" + f.id).css("width", this.size.x * multiplier);
8311
$("#" + f.id).css("height", this.size.y * multiplier);
8312
$("#" + f.id).css("position", "absolute");
8313
var l = w / 2 - destW / 2,
8314
q = h / 2 - destH / 2;
8315
w == mobileWidth ? ($("#" + f.id).css("left", this.pos.x), $("#" + f.id).css("top", this.pos.y)) : ($("#" + f.id).css("left", l + this.pos.x * multiplier), $("#" + f.id).css("top", q + this.pos.y * multiplier));
8316
e ? $("#" + f.id).html("<a target='_blank' href='" + c + "'><img style='width:100%;height:100%' src='" + d + "'></a>") : $("#" + f.id).html("<a href='" + c + "'><img style='width:100%;height:100%' src='" + d + "'></a>");
8317
dynamicClickableEntityDivs[b] = {};
8318
dynamicClickableEntityDivs[b].width = $("#" + f.id).width();
8319
dynamicClickableEntityDivs[b].height = $("#" + f.id).height();
8320
dynamicClickableEntityDivs[b].entity_pos_x = this.pos.x;
8321
dynamicClickableEntityDivs[b].entity_pos_y = this.pos.y
8322
},
8323
hovered: function() {
8324
this.isHovering = !0;
8325
this.dehoverOthers()
8326
},
8327
dehoverOthers: function() {
8328
var b = ig.game.getEntitiesByType(EntitySelect);
8329
for (i = 0; i < b.length; i++) b[i] != this && (b[i].isHovering = !1)
8330
},
8331
deselectOthers: function() {
8332
var b = ig.game.getEntitiesByType(EntitySelect);
8333
for (i = 0; i < b.length; i++) b[i] != this && (b[i].isSelected = !1)
8334
},
8335
update: function() {
8336
this.parent();
8337
this.canSelectTimer && 0 < this.canSelectTimer.delta() && (this.canSelect = !0, this.canSelectTimer = null)
8338
}
8339
})
8340
});
8341
ig.baked = !0;
8342
ig.module("game.levels.opening").requires("impact.image", "game.entities.opening-kitty").defines(function() {
8343
LevelOpening = {
8344
entities: [{
8345
type: "EntityOpeningKitty",
8346
x: 436,
8347
y: 204
8348
}],
8349
layer: []
8350
}
8351
});
8352
ig.baked = !0;
8353
ig.module("game.entities.howtoplay").requires("impact.entity").defines(function() {
8354
EntityHowtoplay = ig.Entity.extend({
8355
zIndex: 1100,
8356
type: ig.Entity.TYPE.B,
8357
size: {
8358
x: 0,
8359
y: 0
8360
},
8361
control: null,
8362
pointer: null,
8363
bgImage: new ig.Image("media/graphics/game/ui/howtoplay.jpg"),
8364
closeBox: {
8365
x: 281,
8366
y: 4,
8367
w: 194,
8368
h: 70
8369
},
8370
init: function(b, c, d) {
8371
this.parent(b, c, d);
8372
1 < ig.game.getEntitiesByType(EntityHowtoplay).length && this.kill();
8373
this.size.x = ig.system.width;
8374
this.size.y = ig.system.height
8375
},
8376
ready: function() {
8377
var b = ig.game.getEntitiesByType(EntityPointer);
8378
0 < b.length && (this.pointer = b[0])
8379
},
8380
draw: function() {
8381
this.parent();
8382
this.bgImage.draw(0, 0)
8383
},
8384
update: function() {
8385
this.parent()
8386
},
8387
released: function() {
8388
if (this.aabbCheck({
8389
x1: this.pointer.pos.x,
8390
y1: this.pointer.pos.y,
8391
x2: this.pointer.pos.x + this.pointer.size.x,
8392
y2: this.pointer.pos.y + this.pointer.size.y
8393
}, {
8394
x1: this.closeBox.x,
8395
y1: this.closeBox.y,
8396
x2: this.closeBox.x + this.closeBox.w,
8397
y2: this.closeBox.y + this.closeBox.h
8398
})) {
8399
this.kill();
8400
this.control.moregames && this.control.moregames.show();
8401
this.control.howtoplay = null;
8402
try {
8403
ig.soundHandler.playSound("click")
8404
} catch (b) {
8405
console.log(b)
8406
}
8407
}
8408
},
8409
aabbCheck: function(b, c) {
8410
return b.x1 < c.x2 && b.x2 > c.x1 && b.y1 < c.y2 && b.y2 > c.y1 ? !0 : !1
8411
}
8412
})
8413
});
8414
ig.baked = !0;
8415
ig.module("game.entities.home-control").requires("impact.entity", "game.entities.button-more-games", "game.entities.howtoplay").defines(function() {
8416
EntityHomeControl = ig.Entity.extend({
8417
zIndex: 1E3,
8418
pointer: null,
8419
howtoplay: null,
8420
showEditTeam: !1,
8421
showUpgrade: !1,
8422
selectedUnitPos: 0,
8423
selectedTankType: 0,
8424
unitAnims: [new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/friend/cat/idle.png", 160, 160), 0.2, [0, 1, 2]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/friend/panda/idle.png", 160, 160), 0.2, [0, 1, 2]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/friend/repair/idle.png", 160, 160), 0.2, [0, 1, 2]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/idle.png", 160, 160), 0.2, [0, 1, 2])],
8425
tankAnims: [new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank1/idle.png", 438, 375), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank2/idle.png", 438, 375), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank3/idle.png", 438, 375), 0.2, [0])],
8426
seatPos: [{
8427
x: 127,
8428
y: 98
8429
}, {
8430
x: 209,
8431
y: 163
8432
}, {
8433
x: 117,
8434
y: 221
8435
}],
8436
tankPrice: [0, -2500, -5E3],
8437
tankReqLevel: [0, 0, 0],
8438
seatImage: new ig.Image("media/graphics/game/tank/seat.png"),
8439
seatRedImage: new ig.Image("media/graphics/game/tank/seat-red.png"),
8440
tankStatsImage: new ig.Image("media/graphics/game/ui/mainmenu/tankstats.png"),
8441
lockImage: new ig.Image("media/graphics/game/ui/mainmenu/lock.png"),
8442
unitSelectImage: new ig.Image("media/graphics/game/ui/mainmenu/unitselect.png"),
8443
coinImage: new ig.Image("media/graphics/game/ui/mainmenu/coin.png"),
8444
bgImage: new ig.Image("media/graphics/game/ui/mainmenu/mainbg.jpg"),
8445
playImage: new ig.Image("media/graphics/game/ui/mainmenu/play.png"),
8446
howtoplayImage: new ig.Image("media/graphics/game/ui/mainmenu/howtoplay.png"),
8447
moregamesImage: new ig.Image("media/graphics/game/ui/mainmenu/moregames.png"),
8448
playBox: {
8449
x: 256,
8450
y: 574,
8451
w: 213,
8452
h: 51
8453
},
8454
howtoplayBox: {
8455
x: 163,
8456
y: 524,
8457
w: 152,
8458
h: 36
8459
},
8460
moregamesBox: {
8461
x: 14,
8462
y: 573,
8463
w: 220,
8464
h: 52
8465
},
8466
medalImage: new ig.Image("media/graphics/game/ui/mainmenu/medal.png"),
8467
editTeamImage: new ig.Image("media/graphics/game/ui/mainmenu/editteam.png"),
8468
upgradeImage: new ig.Image("media/graphics/game/ui/mainmenu/upgrade.png"),
8469
editTeamBox: {
8470
x: 320,
8471
y: 524,
8472
w: 149,
8473
h: 36
8474
},
8475
upgradeBox: {
8476
x: 11,
8477
y: 525,
8478
w: 149,
8479
h: 35
8480
},
8481
editBgImage: new ig.Image("media/graphics/game/ui/mainmenu/editbg.png"),
8482
okImage: new ig.Image("media/graphics/game/ui/mainmenu/ok.png"),
8483
frameBigImage: new ig.Image("media/graphics/game/ui/mainmenu/frame-big.png"),
8484
frameSmallImage: new ig.Image("media/graphics/game/ui/mainmenu/frame-small.png"),
8485
unitSelectImage: new ig.Image("media/graphics/game/ui/mainmenu/unitselect.png"),
8486
okBox: {
8487
x: 140,
8488
y: 501,
8489
w: 195,
8490
h: 47
8491
},
8492
unitSelectBox: [{
8493
x: 68,
8494
y: 210,
8495
w: 103,
8496
h: 102
8497
}, {
8498
x: 189,
8499
y: 210,
8500
w: 103,
8501
h: 102
8502
}, {
8503
x: 313,
8504
y: 210,
8505
w: 103,
8506
h: 102
8507
}],
8508
availableUnitSelectBox: [{
8509
x: 33,
8510
y: 366,
8511
w: 91,
8512
h: 90
8513
}, {
8514
x: 138,
8515
y: 366,
8516
w: 91,
8517
h: 90
8518
}, {
8519
x: 246,
8520
y: 366,
8521
w: 91,
8522
h: 90
8523
}, {
8524
x: 354,
8525
y: 366,
8526
w: 91,
8527
h: 90
8528
}],
8529
tankBox: [{
8530
x: -130,
8531
y: 170,
8532
w: 230,
8533
h: 190
8534
}, {
8535
x: 370,
8536
y: 170,
8537
w: 230,
8538
h: 190
8539
}, {
8540
x: 120,
8541
y: 170,
8542
w: 230,
8543
h: 190
8544
}],
8545
tankScrollOffsetX: 0,
8546
init: function(b, c, d) {
8547
this.parent(b, c, d)
8548
},
8549
ready: function() {
8550
this.muteButton = ig.game.spawnEntity(EntityButtonMute, 420, 14);
8551
this.muteButton.zIndex = 1100;
8552
var b = ig.game.getEntitiesByType(EntityPointer);
8553
0 < b.length && (this.pointer = b[0]);
8554
b = this.playBox.y;
8555
this.playBox.y = ig.system.height + 54;
8556
this.tween({
8557
playBox: {
8558
y: b
8559
}
8560
}, 1, {
8561
easing: ig.Tween.Easing.Elastic.EaseOut
8562
}).start();
8563
b = this.howtoplayBox.y;
8564
this.howtoplayBox.y = ig.system.height + 54;
8565
this.tween({
8566
howtoplayBox: {
8567
y: b
8568
}
8569
}, 1, {
8570
easing: ig.Tween.Easing.Elastic.EaseOut
8571
}).start();
8572
b = this.editTeamBox.y;
8573
this.editTeamBox.y = ig.system.height + 54;
8574
this.tween({
8575
editTeamBox: {
8576
y: b
8577
}
8578
}, 1, {
8579
easing: ig.Tween.Easing.Elastic.EaseOut
8580
}).start();
8581
b = this.upgradeBox.y;
8582
this.upgradeBox.y = ig.system.height + 54;
8583
this.tween({
8584
upgradeBox: {
8585
y: b
8586
}
8587
}, 1, {
8588
easing: ig.Tween.Easing.Elastic.EaseOut
8589
}).start();
8590
_SETTINGS.MoreGames.Enabled && (this.moregames = ig.game.spawnEntity(EntityButtonMoreGames, this.moregamesBox.x, this.moregamesBox.y), this.moregames.ready());
8591
ig.game.sortEntitiesDeferred()
8592
},
8593
draw: function() {
8594
this.parent();
8595
this.bgImage.draw(0, 0);
8596
ig.system.context.globalAlpha = 0.4;
8597
ig.system.context.fillStyle = "#000000";
8598
ig.system.context.fillRect(0, 0, ig.system.width, 50);
8599
ig.system.context.globalAlpha = 1;
8600
this.playImage.draw(this.playBox.x, this.playBox.y);
8601
this.howtoplayImage.draw(this.howtoplayBox.x, this.howtoplayBox.y);
8602
this.medalImage.draw(21, 0);
8603
this.coinImage.draw(130, 3);
8604
ig.system.context.fillStyle = "#FFFFFF";
8605
ig.system.context.font = "20px avenger";
8606
str = ig.game.totalCoins;
8607
var b = ig.system.context.measureText(str).width,
8608
c = ig.system.context.measureText("m").width;
8609
ig.system.context.fillText(str, 170, 10 + c);
8610
ig.global.wm || (ig.game.currentPlayerLevel < ig.game.requiredXP.length && (ig.system.context.fillStyle = "#FFFFFF", ig.system.context.font = "12px ariel", str = "/", b = ig.system.context.measureText(str).width, c = ig.system.context.measureText("m").width, ig.system.context.fillText(str, 64 - b / 2, 6 + c), ig.system.context.fillStyle = "#FFFFFF", ig.system.context.font = "10px avenger", str = ig.game.currentXP, b = ig.system.context.measureText(str).width, c = ig.system.context.measureText("m").width, ig.system.context.fillText(str, 58 - b, 6 + c), str = ig.game.requiredXP[ig.game.currentPlayerLevel], ig.system.context.measureText(str), c = ig.system.context.measureText("m").width, ig.system.context.fillText(str, 68, 6 + c)), ig.system.context.fillStyle = "#FFFFFF", ig.system.context.font = "20px avenger", str = "LV", b = ig.system.context.measureText(str).width, c = ig.system.context.measureText("m").width, ig.system.context.fillText(str, 63 - b / 2, 28 + c), ig.system.context.font = "40px avenger", str = ig.game.currentPlayerLevel, b = ig.system.context.measureText(str).width, c = ig.system.context.measureText("m").width, ig.system.context.fillText(str, 60 - b / 2, 55 + c), this.editTeamImage.draw(this.editTeamBox.x, this.editTeamBox.y), this.upgradeImage.draw(this.upgradeBox.x, this.upgradeBox.y), this.moregames && this.moregamesImage.draw(this.moregames.pos.x - this.moregames.offset.x, this.moregames.pos.y - this.moregames.offset.y), this.showUpgrade && this.drawUpgrade(), this.showEditTeam && this.drawEditTeam())
8611
},
8612
drawEditTeam: function() {
8613
ig.system.context.globalAlpha = 0.4;
8614
ig.system.context.fillStyle = "#000000";
8615
ig.system.context.fillRect(0, 0, ig.system.width, ig.system.height);
8616
ig.system.context.globalAlpha = 1;
8617
this.editBgImage.draw(0, 0);
8618
this.okImage.draw(this.okBox.x, this.okBox.y);
8619
ig.system.context.fillStyle = "#FFFFFF";
8620
ig.system.context.font = "24px avenger";
8621
str = "CHOOSE YOUR TEAM";
8622
var b = ig.system.context.measureText(str).width;
8623
ig.system.context.measureText("m");
8624
var c;
8625
ig.system.context.fillText(str, 240 - b / 2, 195);
8626
0 == this.selectedUnitPos ? this.unitSelectImage.draw(58, 210) : 1 == this.selectedUnitPos ? this.unitSelectImage.draw(179, 210) : 2 == this.selectedUnitPos && this.unitSelectImage.draw(301, 210);
8627
this.frameBigImage.draw(68, 220);
8628
this.frameBigImage.draw(189, 220);
8629
this.frameBigImage.draw(313, 220);
8630
if (ig.game.currentTeam) {
8631
var d = this.unitAnims[ig.game.currentTeam[0]];
8632
d.sheet.image.draw(80, 232, 0 * d.sheet.width + 37, 37, 79, 78);
8633
d = this.unitAnims[ig.game.currentTeam[1]];
8634
d.sheet.image.draw(201, 232, 0 * d.sheet.width + 37, 37, 79, 78);
8635
d = this.unitAnims[ig.game.currentTeam[2]];
8636
d.sheet.image.draw(325, 232, 0 * d.sheet.width + 37, 37, 79, 78)
8637
}
8638
this.frameSmallImage.draw(33, 366);
8639
this.frameSmallImage.draw(138, 366);
8640
this.frameSmallImage.draw(246, 366);
8641
this.frameSmallImage.draw(354, 366);
8642
d = this.unitAnims[0];
8643
d.sheet.image.draw(45, 378, 0 * d.sheet.width + 42, 42, 67, 66);
8644
d = this.unitAnims[1];
8645
d.sheet.image.draw(150, 378, 0 * d.sheet.width + 42, 42, 67, 66);
8646
d = this.unitAnims[2];
8647
d.sheet.image.draw(258, 378, 0 * d.sheet.width + 42, 42, 67, 66);
8648
d = this.unitAnims[3];
8649
d.sheet.image.draw(366, 378, 0 * d.sheet.width + 42, 42, 67, 66);
8650
ig.system.context.globalAlpha = 0.6;
8651
ig.system.context.fillStyle = "#000000";
8652
for (b = 0; b < ig.game.currentTeam.length; b++) 0 == ig.game.currentTeam[b] ? ig.system.context.fillRect(44, 377, 73, 72) : 1 == ig.game.currentTeam[b] ? ig.system.context.fillRect(149, 377, 73, 72) : 2 == ig.game.currentTeam[b] ? ig.system.context.fillRect(257, 377, 73, 72) : 3 == ig.game.currentTeam[b] && ig.system.context.fillRect(365, 377, 73, 72);
8653
ig.system.context.globalAlpha = 1;
8654
ig.system.context.fillStyle = "#FFFFFF";
8655
ig.system.context.font = "16px avenger";
8656
for (d = 0; d < this.unitAnims.length; d++) {
8657
c = !1;
8658
for (b = 0; b < ig.game.currentTeam.length; b++)
8659
if (ig.game.currentTeam[b] == d) {
8660
c = !0;
8661
break
8662
}!1 == c && (0 == d ? (str = "Shotgun", b = ig.system.context.measureText(str).width, ig.system.context.measureText("m"), b = 81 - b / 2, c = 362, ig.system.context.fillText(str, b, c)) : 1 == d ? (str = "Bazooka", b = ig.system.context.measureText(str).width, ig.system.context.measureText("m"), b = 186 - b / 2, c = 362, ig.system.context.fillText(str, b, c)) : 2 == d ? (str = "Repair", b = ig.system.context.measureText(str).width, ig.system.context.measureText("m"), b = 294 - b / 2, c = 362, ig.system.context.fillText(str, b, c)) : 3 == d && (str = "Machine Gun", b = ig.system.context.measureText(str).width, ig.system.context.measureText("m"), b = 402 - b / 2, c = 362, ig.system.context.fillText(str, b, c)))
8663
}
8664
},
8665
drawUpgrade: function() {
8666
ig.system.context.globalAlpha = 0.4;
8667
ig.system.context.fillStyle = "#000000";
8668
ig.system.context.fillRect(0, 0, ig.system.width, ig.system.height);
8669
ig.system.context.globalAlpha = 1;
8670
this.editBgImage.draw(0, 0);
8671
this.okImage.draw(this.okBox.x, this.okBox.y);
8672
this.tankStatsImage.draw(118, 371);
8673
ig.system.context.fillStyle = "#FFFF00";
8674
0 == this.selectedTankType ? (ig.system.context.fillRect(215, 394, 43.2, 9), ig.system.context.fillRect(215, 417, 10.8, 9), ig.system.context.fillRect(215, 440, 32.4, 9)) : 1 == this.selectedTankType ? (ig.system.context.fillRect(215, 394, 64.8, 9), ig.system.context.fillRect(215, 417, 43.2, 9), ig.system.context.fillRect(215, 440, 64.8, 9)) : 2 == this.selectedTankType && (ig.system.context.fillRect(215, 394, 108, 9), ig.system.context.fillRect(215, 417, 108, 9), ig.system.context.fillRect(215, 440, 108, 9));
8675
var b = this.selectedTankType,
8676
c = this.tankAnims[b];
8677
ig.system.context.save();
8678
var d = this.tankBox[2].x - 50,
8679
e = this.tankBox[2].y - 60;
8680
ig.system.context.translate(d, e);
8681
ig.system.context.scale(0.75, 0.75);
8682
c.draw(0, 0);
8683
d = this.seatImage;
8684
2 == b && (d = this.seatRedImage);
8685
for (c = 0; c < this.seatPos.length; c++) {
8686
var e = this.seatPos[c].x,
8687
f = this.seatPos[c].y,
8688
l = e + 19,
8689
q = f + 7,
8690
r = d.data.width - 36,
8691
g = d.data.height - 14;
8692
ig.system.context.fillStyle = "#999999";
8693
ig.system.context.fillRect(l, q, r, g);
8694
d.draw(e, f)
8695
}
8696
ig.system.context.restore();
8697
d = !1;
8698
for (c = 0; c < ig.game.unlockedTanks.length; c++)
8699
if (ig.game.unlockedTanks[c] == b) {
8700
d = !0;
8701
break
8702
}
8703
d || (c = this.tankBox[2].x + 49, d = this.tankBox[2].y + 7, this.lockImage.draw(c, d), this.coinImage.draw(c + 47, d + 97), ig.system.context.fillStyle = "#FFFFFF", ig.system.context.font = "16px avenger", str = "lv " + this.tankReqLevel[b], e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 75 + f), ig.system.context.font = "16px avenger", str = this.tankPrice[b], e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 125 + f), ig.system.context.font = "12px avenger", str = "to unlock", e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 148 + f));
8704
b = this.selectedTankType + 1;
8705
b >= this.tankAnims.length && (b = 0);
8706
c = this.tankAnims[b];
8707
ig.system.context.save();
8708
d = this.tankBox[1].x - 50;
8709
e = this.tankBox[1].y - 60;
8710
ig.system.context.translate(d, e);
8711
ig.system.context.scale(0.75, 0.75);
8712
c.draw(0, 0);
8713
d = this.seatImage;
8714
2 == b && (d = this.seatRedImage);
8715
for (c = 0; c < this.seatPos.length; c++) e = this.seatPos[c].x, f = this.seatPos[c].y, l = e + 19, q = f + 7, r = d.data.width - 36, g = d.data.height - 14, ig.system.context.fillStyle = "#999999", ig.system.context.fillRect(l, q, r, g), d.draw(e, f);
8716
ig.system.context.restore();
8717
d = !1;
8718
for (c = 0; c < ig.game.unlockedTanks.length; c++)
8719
if (ig.game.unlockedTanks[c] == b) {
8720
d = !0;
8721
break
8722
}
8723
d || (c = this.tankBox[1].x + 49, d = this.tankBox[1].y + 7, this.lockImage.draw(c, d), this.coinImage.draw(c + 47, d + 97), ig.system.context.fillStyle = "#FFFFFF", ig.system.context.font = "16px avenger", str = "lv " + this.tankReqLevel[b], e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 75 + f), ig.system.context.font = "16px avenger", str = this.tankPrice[b], e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 125 + f), ig.system.context.font = "12px avenger", str = "to unlock", e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 148 + f));
8724
b = this.selectedTankType - 1;
8725
0 > b && (b = this.tankAnims.length - 1);
8726
c = this.tankAnims[b];
8727
ig.system.context.save();
8728
d = this.tankBox[0].x - 50;
8729
e = this.tankBox[0].y - 60;
8730
ig.system.context.translate(d, e);
8731
ig.system.context.scale(0.75, 0.75);
8732
c.draw(0, 0);
8733
d = this.seatImage;
8734
2 == b && (d = this.seatRedImage);
8735
for (c = 0; c < this.seatPos.length; c++) e = this.seatPos[c].x, f = this.seatPos[c].y, l = e + 19, q = f + 7, r = d.data.width - 36, g = d.data.height - 14, ig.system.context.fillStyle = "#999999", ig.system.context.fillRect(l, q, r, g), d.draw(e, f);
8736
ig.system.context.restore();
8737
d = !1;
8738
for (c = 0; c < ig.game.unlockedTanks.length; c++)
8739
if (ig.game.unlockedTanks[c] == b) {
8740
d = !0;
8741
break
8742
}
8743
d || (c = this.tankBox[0].x + 49, d = this.tankBox[0].y + 7, this.lockImage.draw(c, d), this.coinImage.draw(c +
8744
47, d + 97), ig.system.context.fillStyle = "#FFFFFF", ig.system.context.font = "16px avenger", str = "lv " + this.tankReqLevel[b], e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 75 + f), ig.system.context.font = "16px avenger", str = this.tankPrice[b], e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 125 + f), ig.system.context.font = "12px avenger", str = "to unlock", e = ig.system.context.measureText(str).width, f = ig.system.context.measureText("m").width, ig.system.context.fillText(str, c + 65 - e / 2, d + 148 + f))
8745
},
8746
update: function() {
8747
this.parent();
8748
for (var b = 0; b < this.unitAnims.length; b++) this.unitAnims[b].update();
8749
for (b = 0; b < this.tankAnims.length; b++) this.tankAnims[b].update();
8750
!this.howtoplay && ig.input.released("click") && (this.showEditTeam ? this.editTeamReleased() : this.showUpgrade ? this.upgradeReleased() : this.released())
8751
},
8752
released: function() {
8753
var b = {
8754
x1: this.pointer.pos.x,
8755
y1: this.pointer.pos.y,
8756
x2: this.pointer.pos.x + this.pointer.size.x,
8757
y2: this.pointer.pos.y + this.pointer.size.y
8758
},
8759
c = {
8760
x1: this.playBox.x,
8761
y1: this.playBox.y,
8762
x2: this.playBox.x + this.playBox.w,
8763
y2: this.playBox.y + this.playBox.h
8764
};
8765
if (this.aabbCheck(b, c)) {
8766
ig.game.director.loadLevel(2);
8767
try {
8768
ig.soundHandler.playSound("click")
8769
} catch (d) {
8770
console.log(d)
8771
}
8772
} else if (c = {
8773
x1: this.howtoplayBox.x,
8774
y1: this.howtoplayBox.y,
8775
x2: this.howtoplayBox.x + this.howtoplayBox.w,
8776
y2: this.howtoplayBox.y + this.howtoplayBox.h
8777
}, this.aabbCheck(b, c)) {
8778
this.howtoplay = ig.game.spawnEntity(EntityHowtoplay, 0, 0, {
8779
control: this
8780
});
8781
this.howtoplay.ready();
8782
try {
8783
ig.soundHandler.playSound("click")
8784
} catch (e) {
8785
console.log(e)
8786
}
8787
this.moregames && this.moregames.hide()
8788
} else if (c = {
8789
x1: this.upgradeBox.x,
8790
y1: this.upgradeBox.y,
8791
x2: this.upgradeBox.x + this.upgradeBox.w,
8792
y2: this.upgradeBox.y + this.upgradeBox.h
8793
}, this.aabbCheck(b, c)) {
8794
this.showUpgrade = !0;
8795
this.selectedTankType = ig.game.tankType;
8796
try {
8797
ig.soundHandler.playSound("click")
8798
} catch (f) {
8799
console.log(f)
8800
}
8801
this.moregames && this.moregames.hideLink()
8802
} else if (c = {
8803
x1: this.editTeamBox.x,
8804
y1: this.editTeamBox.y,
8805
x2: this.editTeamBox.x + this.editTeamBox.w,
8806
y2: this.editTeamBox.y + this.editTeamBox.h
8807
}, this.aabbCheck(b, c)) {
8808
this.showEditTeam = !0;
8809
this.selectedUnitPos = 0;
8810
try {
8811
ig.soundHandler.playSound("click")
8812
} catch (l) {
8813
console.log(l)
8814
}
8815
this.moregames && this.moregames.hideLink()
8816
}
8817
},
8818
editTeamReleased: function() {
8819
var b = {
8820
x1: this.pointer.pos.x,
8821
y1: this.pointer.pos.y,
8822
x2: this.pointer.pos.x + this.pointer.size.x,
8823
y2: this.pointer.pos.y + this.pointer.size.y
8824
},
8825
c = {
8826
x1: this.okBox.x,
8827
y1: this.okBox.y,
8828
x2: this.okBox.x + this.okBox.w,
8829
y2: this.okBox.y + this.okBox.h
8830
};
8831
if (this.aabbCheck(b, c)) {
8832
this.showEditTeam = !1;
8833
try {
8834
ig.soundHandler.playSound("click")
8835
} catch (d) {
8836
console.log(d)
8837
}
8838
this.moregames && this.moregames.showLink()
8839
} else {
8840
for (var e = 0; e < this.unitSelectBox.length; e++)
8841
if (c = this.unitSelectBox[e], c = {
8842
x1: c.x,
8843
y1: c.y,
8844
x2: c.x + c.w,
8845
y2: c.y + c.h
8846
}, this.aabbCheck(b, c)) {
8847
this.selectedUnitPos = e;
8848
try {
8849
ig.soundHandler.playSound("click")
8850
} catch (f) {
8851
console.log(f)
8852
}
8853
return
8854
}
8855
for (e = 0; e < this.availableUnitSelectBox.length; e++)
8856
if (c = this.availableUnitSelectBox[e], c = {
8857
x1: c.x,
8858
y1: c.y,
8859
x2: c.x + c.w,
8860
y2: c.y + c.h
8861
}, this.aabbCheck(b, c)) {
8862
b = !1;
8863
for (c = 0; c < ig.game.currentTeam.length; c++)
8864
if (ig.game.currentTeam[c] == e) {
8865
b = !0;
8866
break
8867
}
8868
if (b) break;
8869
ig.game.currentTeam[this.selectedUnitPos] = e;
8870
ig.game.setLocalStorage();
8871
try {
8872
ig.soundHandler.playSound("click")
8873
} catch (l) {
8874
console.log(l)
8875
}
8876
break
8877
}
8878
}
8879
},
8880
upgradeReleased: function() {
8881
var b = {
8882
x1: this.pointer.pos.x,
8883
y1: this.pointer.pos.y,
8884
x2: this.pointer.pos.x + this.pointer.size.x,
8885
y2: this.pointer.pos.y + this.pointer.size.y
8886
},
8887
c = {
8888
x1: this.okBox.x,
8889
y1: this.okBox.y,
8890
x2: this.okBox.x + this.okBox.w,
8891
y2: this.okBox.y +
8892
this.okBox.h
8893
};
8894
if (this.aabbCheck(b, c)) {
8895
this.showUpgrade = !1;
8896
try {
8897
ig.soundHandler.playSound("click")
8898
} catch (d) {
8899
console.log(d)
8900
}
8901
this.moregames && this.moregames.showLink()
8902
} else
8903
for (var e = 0; e < this.tankBox.length; e++)
8904
if (c = this.tankBox[e], c = {
8905
x1: c.x,
8906
y1: c.y,
8907
x2: c.x + c.w,
8908
y2: c.y + c.h
8909
}, this.aabbCheck(b, c)) {
8910
if (2 == e) {
8911
b = !1;
8912
for (e = 0; e < ig.game.unlockedTanks.length; e++)
8913
if (ig.game.unlockedTanks[e] == this.selectedTankType) {
8914
b = !0;
8915
break
8916
}
8917
if (!b && ig.game.currentPlayerLevel >= this.tankReqLevel[this.selectedTankType] && ig.game.totalCoins >= this.tankPrice[this.selectedTankType]) {
8918
ig.game.unlockedTanks.push(this.selectedTankType);
8919
ig.game.totalCoins -= this.tankPrice[this.selectedTankType];
8920
ig.game.tankType = this.selectedTankType;
8921
ig.game.setLocalStorage();
8922
try {
8923
ig.soundHandler.playSound("click")
8924
} catch (f) {
8925
console.log(f)
8926
}
8927
try {
8928
ig.soundHandler.playSound("coins")
8929
} catch (l) {
8930
console.log(l)
8931
}
8932
}
8933
} else {
8934
0 == e ? (this.selectedTankType -= 1, 0 > this.selectedTankType && (this.selectedTankType = this.tankAnims.length - 1)) : 1 == e && (this.selectedTankType += 1, this.selectedTankType >= this.tankAnims.length && (this.selectedTankType = 0));
8935
b = !1;
8936
for (e = 0; e < ig.game.unlockedTanks.length; e++)
8937
if (ig.game.unlockedTanks[e] == this.selectedTankType) {
8938
b = !0;
8939
break
8940
}
8941
if (b) {
8942
ig.game.tankType = this.selectedTankType;
8943
ig.game.setLocalStorage();
8944
try {
8945
ig.soundHandler.playSound("click")
8946
} catch (q) {
8947
console.log(q)
8948
}
8949
}
8950
}
8951
break
8952
}
8953
},
8954
aabbCheck: function(b, c) {
8955
return b.x1 < c.x2 && b.x2 > c.x1 && b.y1 < c.y2 && b.y2 > c.y1 ? !0 : !1
8956
}
8957
})
8958
});
8959
ig.baked = !0;
8960
ig.module("game.levels.mainmenu").requires("impact.image", "game.entities.home-control", "game.entities.pointer-selector", "game.entities.branding-logo").defines(function() {
8961
LevelMainmenu = {
8962
entities: [{
8963
type: "EntityHomeControl",
8964
x: -4,
8965
y: -28
8966
}, {
8967
type: "EntityPointerSelector",
8968
x: -4,
8969
y: -48
8970
}, {
8971
type: "EntityBrandingLogo",
8972
x: 265,
8973
y: 15
8974
}],
8975
layer: []
8976
}
8977
});
8978
ig.baked = !0;
8979
ig.module("game.entities.results-control").requires("impact.entity").defines(function() {
8980
EntityResultsControl = ig.Entity.extend({
8981
zIndex: 1E3,
8982
pointer: null,
8983
bgImage: new ig.Image("media/graphics/game/ui/menubg.jpg"),
8984
bg2Image: new ig.Image("media/graphics/game/ui/menubg2.png"),
8985
titleImage: new ig.Image("media/graphics/game/ui/resultstitle.png"),
8986
coinImage: new ig.Image("media/graphics/game/ui/bigcoin.png"),
8987
flagImage: new ig.Image("media/graphics/game/ui/flag.png"),
8988
replayImage: new ig.Image("media/graphics/game/ui/replay.png"),
8989
homeImage: new ig.Image("media/graphics/game/ui/home.png"),
8990
replayBox: {
8991
x: 94,
8992
y: 396,
8993
w: 314,
8994
h: 75
8995
},
8996
homeBox: {
8997
x: 94,
8998
y: 474,
8999
w: 314,
9000
h: 75
9001
},
9002
init: function(b, c, d) {
9003
this.parent(b, c, d);
9004
console.log('oogl', ig.game.lastGameCoins);
9005
var iScore = ig.game.lastGameCoins;
9006
var ach = false;
9007
var ach_numb = [];
9008
if (iScore > 299) {
9009
ach = true;
9010
ach_numb.push("defend_dattankr_gba005");
9011
}
9012
if (iScore > 249) {
9013
ach = true;
9014
ach_numb.push("defend_dattankr_gba004");
9015
}
9016
if (iScore > 199) {
9017
ach = true;
9018
ach_numb.push("defend_dattankr_gba003");
9019
}
9020
if (iScore > 149) {
9021
ach = true;
9022
ach_numb.push("defend_dattankr_gba002");
9023
}
9024
if (iScore > 99) {
9025
ach = true;
9026
ach_numb.push("defend_dattankr_gba001");
9027
}
9028
if (ach) {
9029
// LaggedAPI.Achievements.save(ach_numb, function(response) {
9030
// if (response.success) {
9031
// console.log('achievement saved')
9032
// } else {
9033
// console.log(response.errormsg);
9034
// }
9035
// });
9036
};
9037
ig.game.lastGameCoins > ig.game.highScore && (ig.game.highScore = ig.game.lastGameCoins, b = {}, b.score = ig.game.highScore, b.board = "defend_datankr_hsbdds"
9038
// LaggedAPI.Scores.save(b, function(b) {
9039
// b.success ? console.log("high score saved") : console.log(b.errormsg)
9040
// })
9041
);
9042
// ig.game.fnShowLaggedAd("defend-the-tank", "defend-the-tank-game.jpg")
9043
},
9044
ready: function() {
9045
var b = ig.game.getEntitiesByType(EntityPointer);
9046
0 < b.length && (this.pointer = b[0]);
9047
this.pos.x = 0;
9048
this.pos.y = 0;
9049
b = this.pos.x;
9050
this.pos.x = ig.system.width + b;
9051
this.tween({
9052
pos: {
9053
x: b
9054
}
9055
}, 0.5, {
9056
easing: ig.Tween.Easing.Elastic.EaseOut
9057
}).start()
9058
},
9059
draw: function() {
9060
this.parent();
9061
this.bgImage.draw(0, 0);
9062
this.bg2Image.draw(this.pos.x + 0, this.pos.y + 0);
9063
this.titleImage.draw(this.pos.x + 143, this.pos.y + 60);
9064
this.coinImage.draw(this.pos.x + 98, this.pos.y + 169);
9065
this.flagImage.draw(this.pos.x + 103, this.pos.y + 269);
9066
ig.system.context.fillStyle = "#cd1515";
9067
ig.system.context.font = "46px avenger_bold";
9068
str = ig.game.lastGameCoins;
9069
var b = ig.system.context.measureText(str).width,
9070
c = ig.system.context.measureText("m").width,
9071
d = this.pos.x + 244 - b / 2,
9072
c = this.pos.y + 180 + c;
9073
ig.system.context.fillText(str, d, c);
9074
ig.system.context.fillStyle = "#cd1515";
9075
ig.system.context.font = "46px avenger_bold";
9076
str = ig.game.lastGameDistance;
9077
b = ig.system.context.measureText(str).width;
9078
c = ig.system.context.measureText("m").width;
9079
d = this.pos.x + 244 - b / 2;
9080
c = this.pos.y + 276 + c;
9081
ig.system.context.fillText(str, d, c);
9082
ig.system.context.fillText(" km", d + b, c);
9083
this.replayImage.draw(this.pos.x + this.replayBox.x, this.pos.y + this.replayBox.y);
9084
this.homeImage.draw(this.pos.x + this.homeBox.x, this.pos.y + this.homeBox.y)
9085
},
9086
update: function() {
9087
this.parent();
9088
ig.input.released("click") && this.released()
9089
},
9090
released: function() {
9091
var b = {
9092
x1: this.pointer.pos.x,
9093
y1: this.pointer.pos.y,
9094
x2: this.pointer.pos.x + this.pointer.size.x,
9095
y2: this.pointer.pos.y + this.pointer.size.y
9096
},
9097
c = {
9098
x1: this.replayBox.x,
9099
y1: this.replayBox.y,
9100
x2: this.replayBox.x + this.replayBox.w,
9101
y2: this.replayBox.y + this.replayBox.h
9102
};
9103
if (this.aabbCheck(b, c)) {
9104
b = ig.system.width;
9105
this.tween({
9106
pos: {
9107
x: b
9108
}
9109
}, 0.5, {
9110
easing: ig.Tween.Easing.Elastic.EaseIn,
9111
entity: this,
9112
onComplete: function() {
9113
ig.game.director.loadLevel(2)
9114
}
9115
}).start();
9116
try {
9117
ig.soundHandler.playSound("click")
9118
} catch (d) {
9119
console.log(d)
9120
}
9121
} else if (c = {
9122
x1: this.homeBox.x,
9123
y1: this.homeBox.y,
9124
x2: this.homeBox.x + this.homeBox.w,
9125
y2: this.homeBox.y + this.homeBox.h
9126
}, this.aabbCheck(b, c)) {
9127
b = ig.system.width;
9128
this.tween({
9129
pos: {
9130
x: b
9131
}
9132
}, 0.5, {
9133
easing: ig.Tween.Easing.Elastic.EaseIn,
9134
entity: this,
9135
onComplete: function() {
9136
ig.game.director.loadLevel(1)
9137
}
9138
}).start();
9139
try {
9140
ig.soundHandler.playSound("click")
9141
} catch (e) {
9142
console.log(e)
9143
}
9144
}
9145
},
9146
aabbCheck: function(b, c) {
9147
return b.x1 < c.x2 && b.x2 > c.x1 && b.y1 < c.y2 && b.y2 > c.y1 ? !0 : !1
9148
}
9149
})
9150
});
9151
ig.baked = !0;
9152
ig.module("game.levels.results").requires("impact.image", "game.entities.results-control", "game.entities.pointer-selector").defines(function() {
9153
LevelResults = {
9154
entities: [{
9155
type: "EntityResultsControl",
9156
x: -4,
9157
y: -28
9158
}, {
9159
type: "EntityPointerSelector",
9160
x: -4,
9161
y: -48
9162
}],
9163
layer: []
9164
}
9165
});
9166
ig.baked = !0;
9167
ig.module("game.entities.game-bg").requires("impact.entity").defines(function() {
9168
EntityGameBg = ig.Entity.extend({
9169
zIndex: 0,
9170
skyImage: new ig.Image("media/graphics/game/bg/sky.jpg"),
9171
farBuildingImage: new ig.Image("media/graphics/game/bg/far_building.png"),
9172
buildingImage: new ig.Image("media/graphics/game/bg/building.png"),
9173
ground: null,
9174
farBuildingScrollSpeed: -5,
9175
buildingScrollSpeed: -10,
9176
curFarBuildingOffset: 0,
9177
curBuildingOffset: 0,
9178
farBuildingRepeats: 1,
9179
buildingRepeats: 1,
9180
farBuildingRepeatSpacing: 0,
9181
buildingRepeatSpacing: -18,
9182
farBuildingWidth: 0,
9183
buildingWidth: 0,
9184
control: null,
9185
init: function(b, c, d) {
9186
this.parent(b, c, d);
9187
ig.global.wm || (this.ground = ig.game.spawnEntity(EntityGameGround, 0, 438, {
9188
bg: this
9189
}), ig.game.sortEntitiesDeferred(), this.farBuildingWidth = this.farBuildingImage.data.width + this.farBuildingRepeatSpacing, this.buildingWidth = this.buildingImage.data.width + this.buildingRepeatSpacing, this.ground.repeatWidth = this.ground.groundImage.data.width + this.ground.repeatSpacing, this.farBuildingRepeats = 2 + Math.ceil(ig.system.width / this.farBuildingWidth), this.buildingRepeats = 2 + Math.ceil(ig.system.width / this.buildingWidth), this.ground.repeats = 2 + Math.ceil(ig.system.width / this.ground.repeatWidth))
9190
},
9191
update: function() {
9192
this.parent();
9193
this.control.isPaused || (this.curFarBuildingOffset += this.farBuildingScrollSpeed * ig.system.tick, this.curBuildingOffset += this.buildingScrollSpeed * ig.system.tick, this.ground.curOffset += this.ground.scrollSpeed * ig.system.tick, Math.abs(this.curFarBuildingOffset) > this.farBuildingWidth && (this.curFarBuildingOffset = 0 > this.curFarBuildingOffset ? this.curFarBuildingOffset + this.farBuildingWidth : this.curFarBuildingOffset - this.farBuildingWidth), Math.abs(this.curBuildingOffset) > this.buildingWidth && (this.curBuildingOffset = 0 > this.curBuildingOffset ? this.curBuildingOffset + this.buildingWidth : this.curBuildingOffset - this.buildingWidth), Math.abs(this.ground.curOffset) > this.ground.repeatWidth && (this.ground.curOffset = 0 > this.ground.curOffset ? this.ground.curOffset + this.ground.repeatWidth : this.ground.curOffset - this.ground.repeatWidth))
9194
},
9195
draw: function() {
9196
this.parent();
9197
this.skyImage.draw(0, 0);
9198
for (var b = 0; b < this.farBuildingRepeats; b++) {
9199
var c = (b - 1) * this.farBuildingWidth,
9200
c = c + this.curFarBuildingOffset;
9201
this.farBuildingImage.draw(-ig.game.screen.x + c, -ig.game.screen.y + 347)
9202
}
9203
for (b = 0; b < this.buildingRepeats; b++) c = (b - 1) * this.buildingWidth, c += this.curBuildingOffset, this.buildingImage.draw(-ig.game.screen.x + c, -ig.game.screen.y + 341)
9204
}
9205
});
9206
EntityGameGround = ig.Entity.extend({
9207
zIndex: 200,
9208
groundImage: new ig.Image("media/graphics/game/bg/ground.png"),
9209
bg: null,
9210
scrollSpeed: -15,
9211
curOffset: 0,
9212
repeats: 1,
9213
repeatSpacing: 0,
9214
repeatWidth: 0,
9215
init: function(b, c, d) {
9216
this.parent(b, c, d)
9217
},
9218
draw: function() {
9219
this.parent();
9220
this.size.y = this.groundImage.data.height;
9221
this.size.x = ig.system.width;
9222
for (var b = 0; b < this.repeats; b++) {
9223
var c = (b - 1) * this.repeatWidth,
9224
c = c + this.curOffset;
9225
this.groundImage.draw(-ig.game.screen.x + c, -ig.game.screen.y + this.pos.y)
9226
}
9227
}
9228
})
9229
});
9230
ig.baked = !0;
9231
ig.module("game.entities.button-mute").requires("impact.entity").defines(function() {
9232
EntityButtonMute = ig.Entity.extend({
9233
zIndex: 550,
9234
size: {
9235
x: 25,
9236
y: 25
9237
},
9238
offset: {
9239
x: 0,
9240
y: 0
9241
},
9242
type: ig.Entity.TYPE.B,
9243
animSheet: new ig.AnimationSheet("media/graphics/game/ui/muteoff.png", 25, 25),
9244
offSheet: new ig.AnimationSheet("media/graphics/game/ui/muteon.png", 25, 25),
9245
init: function(b, c, d) {
9246
this.parent(b, c, d);
9247
this.addAnim("idle", 1, [0]);
9248
"undefined" == typeof wm && Howler._muted && (this.currentAnim = new ig.Animation(this.offSheet, 1, [0]))
9249
},
9250
clicked: function() {
9251
if (ig.soundHandler.bgmMute) {
9252
ig.soundHandler.fnUnmuteAll();
9253
this.currentAnim = new ig.Animation(this.animSheet, 1, [0]);
9254
try {
9255
ig.soundHandler.playSound("click")
9256
} catch (b) {
9257
console.log(b)
9258
}
9259
} else ig.soundHandler.fnMuteAll(), this.currentAnim = new ig.Animation(this.offSheet, 1, [0])
9260
}
9261
})
9262
});
9263
ig.baked = !0;
9264
ig.module("game.entities.button-pause").requires("impact.entity").defines(function() {
9265
EntityButtonPause = ig.Entity.extend({
9266
zIndex: 550,
9267
size: {
9268
x: 25,
9269
y: 25
9270
},
9271
offset: {
9272
x: 0,
9273
y: 0
9274
},
9275
type: ig.Entity.TYPE.B,
9276
animSheet: new ig.AnimationSheet("media/graphics/game/ui/pause.png", 25, 25),
9277
control: null,
9278
init: function(b, c, d) {
9279
this.parent(b, c, d);
9280
this.addAnim("idle", 1, [0])
9281
},
9282
clicked: function() {
9283
if (this.control) {
9284
try {
9285
ig.soundHandler.playSound("click")
9286
} catch (b) {
9287
console.log(b)
9288
}
9289
this.control.isPaused ? this.control.unpauseGame() : this.control.pauseGame()
9290
}
9291
}
9292
})
9293
});
9294
ig.baked = !0;
9295
ig.module("game.entities.game-button-mainweapon").requires("impact.entity").defines(function() {
9296
EntityGameButtonMainweapon = ig.Entity.extend({
9297
zIndex: 550,
9298
size: {
9299
x: 80,
9300
y: 80
9301
},
9302
type: ig.Entity.TYPE.B,
9303
drawRelPos: {
9304
x: 0,
9305
y: 0
9306
},
9307
control: null,
9308
mainWeaponIconImages: [new ig.Image("media/graphics/game/ui/icons/rocket.png"), new ig.Image("media/graphics/game/ui/icons/fireball.png"), new ig.Image("media/graphics/game/ui/icons/laser.png")],
9309
mainWeaponType: 0,
9310
isWaiting: !1,
9311
timeWaited: 0,
9312
waitTime: [5, 5, 10],
9313
init: function(b, c, d) {
9314
this.parent(b, c, d);
9315
this.mainWeaponType = this.control.tank.tankType;
9316
this.refreshDrawRelPos()
9317
},
9318
update: function() {
9319
this.parent();
9320
!ig.game.gamePaused && this.isWaiting && (this.timeWaited += ig.system.tick, this.timeWaited >= this.waitTime[this.mainWeaponType] && this.stopWaiting())
9321
},
9322
draw: function() {
9323
this.parent();
9324
if (this.isWaiting) {
9325
var b = this.timeWaited / this.waitTime[this.mainWeaponType],
9326
c = this.size.x,
9327
d = this.size.y * b,
9328
e = -ig.game.screen.x + this.pos.x,
9329
b = -ig.game.screen.y + this.pos.y + this.size.y * (1 - b);
9330
ig.system.context.globalAlpha = 0.5;
9331
ig.system.context.fillStyle = "#00FF00";
9332
ig.system.context.fillRect(e, b, c, d);
9333
ig.system.context.globalAlpha = 1
9334
} else this.mainWeaponIconImages[this.mainWeaponType].draw(-ig.game.screen.x + this.pos.x + this.drawRelPos.x, -ig.game.screen.y + this.pos.y + this.drawRelPos.y)
9335
},
9336
refreshDrawRelPos: function() {
9337
var b = this.mainWeaponIconImages[this.mainWeaponType];
9338
this.drawRelPos.x = 0.5 * this.size.x - 0.5 * b.data.width;
9339
this.drawRelPos.y = 0.5 * this.size.y - 0.5 * b.data.height
9340
},
9341
clicked: function() {
9342
if (!this.isWaiting)
9343
if (this.control.tank.fireMainWeapon(), this.startWaiting(), 0 == this.mainWeaponType) try {
9344
ig.soundHandler.playSound("tankshoot")
9345
} catch (b) {
9346
console.log(b)
9347
} else if (1 == this.mainWeaponType) try {
9348
ig.soundHandler.playSound("tankshoot")
9349
} catch (c) {
9350
console.log(c)
9351
} else if (2 == this.mainWeaponType) try {
9352
ig.soundHandler.playSound("laser_beam")
9353
} catch (d) {
9354
console.log(d)
9355
}
9356
},
9357
startWaiting: function() {
9358
this.isWaiting = !0;
9359
this.timeWaited = 0
9360
},
9361
stopWaiting: function() {
9362
this.isWaiting = !1;
9363
try {
9364
ig.soundHandler.playSound("reload")
9365
} catch (b) {
9366
console.log(b)
9367
}
9368
}
9369
})
9370
});
9371
ig.baked = !0;
9372
ig.module("game.entities.game-unit-friendly").requires("impact.entity").defines(function() {
9373
EntityGameUnitFriendly = ig.Entity.extend({
9374
zIndex: 200,
9375
size: {
9376
x: 60,
9377
y: 60
9378
},
9379
type: ig.Entity.TYPE.B,
9380
control: null,
9381
pointer: null,
9382
seat: null,
9383
unitAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/friend/cat/idle.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/panda/idle.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/repair/idle.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/idle.png", 160, 160)],
9384
unitAnims: [],
9385
unitDragAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/friend/cat/drag.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/panda/drag.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/repair/drag.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/drag.png", 160, 160)],
9386
unitDragAnims: [],
9387
unitFireAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/friend/cat/fire.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/panda/fire.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/repair/fire.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/fire.png", 160, 160)],
9388
unitFireAnims: [],
9389
unitFireLowAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/friend/cat/fire-low.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/panda/fire.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/repair/fire.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/fire.png", 160, 160)],
9390
unitFireLowAnims: [],
9391
unitFireHighAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/friend/cat/fire-high.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/panda/fire.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/repair/fire.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/fire.png", 160, 160)],
9392
unitFireHighAnims: [],
9393
unitFireAnim: null,
9394
barrelPos: [{
9395
x: 106,
9396
y: 89
9397
}, {
9398
x: 111,
9399
y: 55
9400
}, {
9401
x: 0,
9402
y: 0
9403
}, {
9404
x: 109,
9405
y: 91
9406
}],
9407
barrelLowPos: [{
9408
x: 102,
9409
y: 96
9410
}, {
9411
x: 111,
9412
y: 55
9413
}, {
9414
x: 0,
9415
y: 0
9416
}, {
9417
x: 109,
9418
y: 91
9419
}],
9420
barrelHighPos: [{
9421
x: 107,
9422
y: 79
9423
}, {
9424
x: 111,
9425
y: 55
9426
}, {
9427
x: 0,
9428
y: 0
9429
}, {
9430
x: 109,
9431
y: 91
9432
}],
9433
refireRate: [1, 0.5, 4, 6],
9434
refireDelay: [],
9435
fireDamage: [13, 60, 5, 5],
9436
fireRange: 0,
9437
superMode: !1,
9438
superRefireRate: [1.2, 0.6, 5, 6],
9439
superRefireDelay: [],
9440
superHpDrain: 100,
9441
superUnitFireAnims: [],
9442
superUnitFireLowAnims: [],
9443
superUnitFireHighAnims: [],
9444
moveVel: {
9445
x: 0,
9446
y: 0
9447
},
9448
hp: 1E3,
9449
maxHp: 1E3,
9450
baseHpDrain: 50,
9451
unitType: 0,
9452
relDrawPos: {
9453
x: 0,
9454
y: 0
9455
},
9456
pointerRelPos: {
9457
x: 0,
9458
y: 0
9459
},
9460
preDragPos: {
9461
x: 0,
9462
y: 0
9463
},
9464
isDragging: !1,
9465
isDying: !1,
9466
isFiring: !1,
9467
hasShot: !1,
9468
lastShotTime: -10,
9469
dieTime: 0,
9470
spawnTime: 0,
9471
alpha: 1,
9472
init: function(b, c, d) {
9473
this.parent(b, c, d);
9474
for (b = 0; b < this.unitAnimSheets.length; b++) this.unitAnims.push(new ig.Animation(this.unitAnimSheets[b], 0.2, [0, 1, 2]));
9475
for (b = 0; b < this.unitDragAnimSheets.length; b++) this.unitDragAnims.push(new ig.Animation(this.unitDragAnimSheets[b], 1, [0]));
9476
for (b = 0; b < this.unitFireAnimSheets.length; b++) this.unitFireAnims.push(new ig.Animation(this.unitFireAnimSheets[b], 0.1, [0, 1, 2]));
9477
this.unitFireAnims[3].frameTime = 0.05;
9478
for (b = 0; b < this.unitFireLowAnimSheets.length; b++) this.unitFireLowAnims.push(new ig.Animation(this.unitFireLowAnimSheets[b], 0.1, [0, 1, 2]));
9479
this.unitFireLowAnims[3].frameTime = 0.05;
9480
for (b = 0; b < this.unitFireHighAnimSheets.length; b++) this.unitFireHighAnims.push(new ig.Animation(this.unitFireHighAnimSheets[b], 0.1, [0, 1, 2]));
9481
this.unitFireHighAnims[3].frameTime = 0.05;
9482
for (b = 0; b < this.refireRate.length; b++) this.refireDelay.push(1 / this.refireRate[b]);
9483
this.superUnitFireAnims.push(new ig.Animation(this.unitFireAnimSheets[0], 0.1, [0, 1, 2]));
9484
this.superUnitFireAnims.push(new ig.Animation(this.unitFireAnimSheets[1], 0.1, [0, 1, 2]));
9485
this.superUnitFireAnims.push(new ig.Animation(this.unitFireAnimSheets[2], 0.05, [0, 1, 2]));
9486
this.superUnitFireAnims.push(new ig.Animation(this.unitFireAnimSheets[3], 0.0375, [0, 1, 2]));
9487
this.superUnitFireLowAnims.push(new ig.Animation(this.unitFireLowAnimSheets[0], 0.1, [0, 1, 2]));
9488
this.superUnitFireLowAnims.push(new ig.Animation(this.unitFireLowAnimSheets[1], 0.1, [0, 1, 2]));
9489
this.superUnitFireLowAnims.push(new ig.Animation(this.unitFireLowAnimSheets[2], 0.05, [0, 1, 2]));
9490
this.superUnitFireLowAnims.push(new ig.Animation(this.unitFireLowAnimSheets[3], 0.0375, [0, 1, 2]));
9491
this.superUnitFireHighAnims.push(new ig.Animation(this.unitFireHighAnimSheets[0], 0.1, [0, 1, 2]));
9492
this.superUnitFireHighAnims.push(new ig.Animation(this.unitFireHighAnimSheets[1], 0.1, [0, 1, 2]));
9493
this.superUnitFireHighAnims.push(new ig.Animation(this.unitFireHighAnimSheets[2], 0.05, [0, 1, 2]));
9494
this.superUnitFireHighAnims.push(new ig.Animation(this.unitFireHighAnimSheets[3], 0.0375, [0, 1, 2]));
9495
for (b = 0; b < this.superRefireRate.length; b++) this.superRefireDelay.push(1 / this.superRefireRate[b]);
9496
this.pos.x -= 0.5 * this.size.x;
9497
this.pos.y -= 0.5 * this.size.y;
9498
this.relDrawPos.x = 0.5 * -(this.unitAnims[this.unitType].sheet.width -
9499
this.size.x);
9500
this.relDrawPos.y = 0.5 * -(this.unitAnims[this.unitType].sheet.height - this.size.y)
9501
},
9502
update: function() {
9503
this.parent();
9504
if (!ig.game.gamePaused) {
9505
if (this.isDying) this.alpha -= 0.5 * ig.system.tick, 0 > this.alpha && (this.alpha = 0), this.pos.x += this.moveVel.x * ig.system.tick, this.pos.y += this.moveVel.y * ig.system.tick, 2 < this.control.gameTime - this.dieTime && this.kill();
9506
else if (this.isDragging) this.unitDragAnims[this.unitType].update();
9507
else if (this.isFiring) {
9508
this.unitFireAnim && this.unitFireAnim.update();
9509
this.hp -= this.baseHpDrain * ig.system.tick;
9510
if (0 >= this.hp) {
9511
this.hp = 0;
9512
this.seat.unit = null;
9513
this.seat.drawTarget = !0;
9514
this.die();
9515
return
9516
}
9517
if (1 <= this.unitFireAnim.loopCount) {
9518
var b = this.refireDelay[this.unitType];
9519
this.superMode && (b = this.superRefireDelay[this.unitType]);
9520
this.control.gameTime - this.lastShotTime > b ? this.shoot() : (this.isFiring = !1, this.unitAnims[this.unitType].rewind())
9521
}
9522
} else {
9523
this.unitAnims[this.unitType].update();
9524
this.hp = this.superMode ? this.hp - this.superHpDrain * ig.system.tick : this.hp - this.baseHpDrain * ig.system.tick;
9525
if (0 >= this.hp) {
9526
this.hp = 0;
9527
this.seat.unit = null;
9528
this.seat.drawTarget = !0;
9529
this.die();
9530
return
9531
}
9532
b = this.refireDelay[this.unitType];
9533
this.superMode && (b = this.superRefireDelay[this.unitType]);
9534
this.control.gameTime - this.lastShotTime > b && this.shoot()
9535
}
9536
this.isDragging && (this.pos.x = this.pointer.pos.x + this.pointerRelPos.x, this.pos.y = this.pointer.pos.y + this.pointerRelPos.y)
9537
}
9538
},
9539
draw: function() {
9540
this.parent();
9541
var b = -ig.game.screen.x + this.pos.x + this.relDrawPos.x,
9542
c = -ig.game.screen.y + this.pos.y + this.relDrawPos.y;
9543
this.isDragging ? this.unitDragAnims[this.unitType].draw(b, c) : this.isFiring ? this.unitFireAnim && this.unitFireAnim.draw(b, c) : (this.isDying && (ig.system.context.globalAlpha = this.alpha), this.unitAnims[this.unitType].draw(b, c), this.isDying && (ig.system.context.globalAlpha = 1))
9544
},
9545
clicked: function(b) {
9546
!ig.game.gamePaused && (!this.isDying && this.touches(b)) && (this.isDragging = !0, this.pointer = b, this.preDragPos.x = this.pos.x, this.preDragPos.y = this.pos.y, this.pointerRelPos.x = this.pos.x - this.pointer.pos.x, this.pointerRelPos.y = this.pos.y -
9547
this.pointer.pos.y, this.control.tank.showTargets(), this.zIndex += 1E3, ig.game.sortEntitiesDeferred())
9548
},
9549
released: function() {
9550
if (this.isDragging) {
9551
this.pos.x = this.pointer.pos.x + this.pointerRelPos.x;
9552
this.pos.y = this.pointer.pos.y + this.pointerRelPos.y;
9553
for (var b = !0, c = null, d = null, e = this.pos.x, f = this.pos.y, l = this.pos.x + this.size.x, q = this.pos.y + this.size.y, r = 0; r < this.control.tank.seats.length; r++) {
9554
var g = this.control.tank.seats[r],
9555
m = g.pos.x,
9556
n = g.pos.y,
9557
p = g.pos.x + g.size.x,
9558
s = g.pos.y + g.size.y;
9559
if (e < p && (l > m && f < s && q > n) && (b = p - e, l < p && (b = l - m), m = s - f, q < s && (m = q - n), n = b * m, b = !1, !c || n > c.area)) c = {
9560
seat: g,
9561
area: n
9562
}
9563
}
9564
if (b) {
9565
if (this.pos.x >= this.preDragPos.x + this.size.x || this.pos.x + this.size.x <= this.preDragPos.x || this.pos.y >= this.preDragPos.y + this.size.y || this.pos.y + this.size.y <= this.preDragPos.y) {
9566
this.seat.unit = null;
9567
this.die();
9568
this.control.tank.hideTargets();
9569
return
9570
}
9571
} else c && c.seat != this.seat && (d = c.seat);
9572
this.isDragging = !1;
9573
this.pos.x = this.preDragPos.x;
9574
this.pos.y = this.preDragPos.y;
9575
this.zIndex -= 1E3;
9576
ig.game.sortEntitiesDeferred();
9577
d && (c = d.unit, this.seat.unit = c, null != c && (c.seat = this.seat, c.snapPosToSeat()), d.unit = this, this.seat = d, this.snapPosToSeat());
9578
this.control.tank.hideTargets()
9579
}
9580
},
9581
snapPosToSeat: function() {
9582
this.pos.x = this.seat.pos.x + this.seat.size.x / 2 - this.size.x / 2;
9583
this.pos.y = this.seat.pos.y + this.seat.size.y / 2 - this.size.y / 2
9584
},
9585
die: function() {
9586
if (!this.isDying) {
9587
this.isDying = !0;
9588
this.isDragging = this.isFiring = !1;
9589
this.alpha = 0.5;
9590
this.moveVel.x = -15;
9591
this.moveVel.y = -100;
9592
this.dieTime = this.control.gameTime;
9593
this.unitAnims[this.unitType].rewind();
9594
this.seat && (this.seat = this.seat.unit = null);
9595
try {
9596
ig.soundHandler.playSound("death")
9597
} catch (b) {
9598
console.log(b)
9599
}
9600
}
9601
},
9602
kill: function() {
9603
this.parent();
9604
this.seat && (this.seat.unit = null)
9605
},
9606
shoot: function() {
9607
if (2 == this.unitType)
9608
if (this.control.tank.hp >= this.control.tank.maxHp[this.control.tank.tankType]) this.isFiring = !1;
9609
else {
9610
this.control.tank.deferredHealAmt += this.fireDamage[this.unitType];
9611
this.unitFireAnim = this.superMode ? this.superUnitFireAnims[this.unitType] : this.unitFireAnims[this.unitType];
9612
this.unitFireAnim.rewind();
9613
this.isFiring = !0;
9614
this.lastShotTime = this.control.gameTime;
9615
try {
9616
ig.soundHandler.playSound("repair")
9617
} catch (b) {
9618
console.log(b)
9619
}
9620
} else {
9621
var c = null,
9622
d = this.control.enemies,
9623
e = 9E5;
9624
0 < this.fireRange && (e = this.fireRange);
9625
for (var f = 0, l = 0, f = this.pos.x + this.size.x / 2, l = this.pos.y + this.size.y / 2, q = this.pos.x + this.relDrawPos.x + this.barrelPos[this.unitType].x, r = this.pos.y + this.relDrawPos.y + this.barrelPos[this.unitType].y, g = 0; g < d.length; g++) {
9626
var m = d[g],
9627
n = m.pos.x + m.size.x / 2,
9628
p = m.pos.y + m.size.y / 2;
9629
n <= q || (n = (f - n) * (f - n) + (l - p) * (l -
9630
p), n < e && (c = m, e = n))
9631
}
9632
if (null == c) this.isFiring = !1;
9633
else {
9634
f = c.pos.x + c.size.x / 2;
9635
l = c.pos.y + c.size.y / 2;
9636
c = 0;
9637
1 == this.unitType && (c = 1);
9638
d = ig.game.spawnEntity(EntityGameBullet, q, r, {
9639
control: this.control,
9640
bulletType: c
9641
});
9642
d.sourceType = 1;
9643
d.targetType = 2;
9644
d.startVel = 500;
9645
d.zIndex = this.zIndex - 1;
9646
d.damage = this.fireDamage[this.unitType];
9647
if (1 == this.unitType) {
9648
if (!1 == d.setTargetArc(f, l)) {
9649
d.kill();
9650
return
9651
}
9652
} else d.setTarget(f, l);
9653
0 == this.unitType && (d = ig.game.spawnEntity(EntityGameBullet, q, r - 1, {
9654
control: this.control,
9655
bulletType: c
9656
}), d.sourceType = 1, d.targetType = 2, d.startVel = 500, d.zIndex = this.zIndex - 1, d.damage = this.fireDamage[this.unitType], d.setTarget(f, l - 1), d.angle -= Math.PI / (45 - 25 * Math.random()), e = Math.cos(d.angle), g = Math.sin(d.angle), d.moveVel.x = e * d.startVel, d.moveVel.y = g * d.startVel, d = ig.game.spawnEntity(EntityGameBullet, q, r + 1, {
9657
control: this.control,
9658
bulletType: c
9659
}), d.sourceType = 1, d.targetType = 2, d.startVel = 500, d.zIndex = this.zIndex - 1, d.damage = this.fireDamage[this.unitType], d.setTarget(f, l + 1), d.angle += Math.PI / (45 - 25 * Math.random()), e = Math.cos(d.angle), g = Math.sin(d.angle), d.moveVel.x = e * d.startVel, d.moveVel.y = g * d.startVel);
9660
q = d.angle;
9661
this.unitFireAnim = this.superMode ? this.superUnitFireAnims[this.unitType] : this.unitFireAnims[this.unitType];
9662
q > Math.PI / 6 && q < Math.PI ? this.unitFireAnim = this.superMode ? this.superUnitFireLowAnims[this.unitType] : this.unitFireLowAnims[this.unitType] : q > Math.PI && q < Math.PI + 5 * Math.PI / 6 && (this.unitFireAnim = this.superMode ? this.superUnitFireHighAnims[this.unitType] : this.unitFireHighAnims[this.unitType]);
9663
this.unitFireAnim.rewind();
9664
this.isFiring = !0;
9665
if (0 == this.unitType) try {
9666
ig.soundHandler.playSound("shotgun")
9667
} catch (s) {
9668
console.log(s)
9669
} else if (1 == this.unitType) try {
9670
ig.soundHandler.playSound("cannon")
9671
} catch (u) {
9672
console.log(u)
9673
} else if (2 == this.unitType) try {
9674
ig.soundHandler.playSound("repair")
9675
} catch (t) {
9676
console.log(t)
9677
} else if (3 == this.unitType) try {
9678
ig.soundHandler.playSound("machinegun")
9679
} catch (y) {
9680
console.log(y)
9681
}
9682
this.lastShotTime = this.control.gameTime;
9683
ig.game.sortEntitiesDeferred()
9684
}
9685
}
9686
}
9687
})
9688
});
9689
ig.baked = !0;
9690
ig.module("game.entities.game-unit-queue").requires("impact.entity", "game.entities.game-unit-friendly").defines(function() {
9691
EntityGameUnitQueue = ig.Entity.extend({
9692
zIndex: 550,
9693
size: {
9694
x: 60,
9695
y: 60
9696
},
9697
type: ig.Entity.TYPE.B,
9698
control: null,
9699
pointer: null,
9700
unitAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/friend/cat/idle.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/panda/idle.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/repair/idle.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/idle.png", 160, 160)],
9701
unitAnims: [],
9702
unitDragAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/friend/cat/drag.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/panda/drag.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/repair/drag.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/friend/wolf/drag.png", 160, 160)],
9703
unitDragAnims: [],
9704
unitType: 0,
9705
relDrawPos: {
9706
x: 0,
9707
y: 0
9708
},
9709
pointerRelPos: {
9710
x: 0,
9711
y: 0
9712
},
9713
preDragPos: {
9714
x: 0,
9715
y: 0
9716
},
9717
isDragging: !1,
9718
isWaiting: !1,
9719
timeWaited: 0,
9720
waitTime: 3,
9721
init: function(b, c, d) {
9722
this.parent(b, c, d);
9723
for (b = 0; b < this.unitAnimSheets.length; b++) this.unitAnims.push(new ig.Animation(this.unitAnimSheets[b], 0.2, [0, 1, 2]));
9724
for (b = 0; b < this.unitDragAnimSheets.length; b++) this.unitDragAnims.push(new ig.Animation(this.unitDragAnimSheets[b], 1, [0]));
9725
this.relDrawPos.x = 3 - 0.5 * (this.unitAnims[this.unitType].sheet.width - this.size.x);
9726
this.relDrawPos.y = 8 - 0.5 * (this.unitAnims[this.unitType].sheet.height - this.size.y);
9727
if (b = ig.game.currentTeam) c = Math.floor(Math.random() * b.length), this.unitType = b[c];
9728
this.preDragPos.x = this.pos.x;
9729
this.preDragPos.y = this.pos.y
9730
},
9731
update: function() {
9732
this.parent();
9733
ig.game.gamePaused || (this.isDragging ? this.unitDragAnims[this.unitType].update() : this.isWaiting ? (this.timeWaited += ig.system.tick, this.timeWaited >= this.waitTime && this.stopWaiting()) : this.unitAnims[this.unitType].update());
9734
this.isDragging && (this.pos.x = this.pointer.pos.x + this.pointerRelPos.x, this.pos.y = this.pointer.pos.y + this.pointerRelPos.y)
9735
},
9736
draw: function() {
9737
this.parent();
9738
if (this.isDragging) this.unitDragAnims[this.unitType].draw(this.pos.x +
9739
this.relDrawPos.x, this.pos.y + this.relDrawPos.y);
9740
else if (this.isWaiting) {
9741
var b = this.timeWaited / this.waitTime,
9742
c = this.size.x,
9743
d = this.size.y * b,
9744
e = -ig.game.screen.x + this.pos.x,
9745
b = -ig.game.screen.y + this.pos.y + this.size.y * (1 - b);
9746
ig.system.context.globalAlpha = 0.5;
9747
ig.system.context.fillStyle = "#00FF00";
9748
ig.system.context.fillRect(e, b, c, d);
9749
ig.system.context.globalAlpha = 1
9750
} else this.unitAnims[this.unitType].draw(-ig.game.screen.x + this.pos.x + this.relDrawPos.x, -ig.game.screen.y + this.pos.y + this.relDrawPos.y)
9751
},
9752
clicked: function(b) {
9753
!ig.game.gamePaused && (!this.isWaiting && this.touches(b)) && (this.isDragging = !0, this.pointer = b, this.pointerRelPos.x = this.pos.x - this.pointer.pos.x, this.pointerRelPos.y = this.pos.y - this.pointer.pos.y, this.control.tank.showTargets(), this.zIndex = 1550, ig.game.sortEntitiesDeferred())
9754
},
9755
released: function() {
9756
if (this.isDragging) {
9757
this.pos.x = this.pointer.pos.x + this.pointerRelPos.x;
9758
this.pos.y = this.pointer.pos.y + this.pointerRelPos.y;
9759
for (var b = !0, c = null, d = this.pos.x, e = this.pos.y, f = this.pos.x + this.size.x, l = this.pos.y + this.size.y, q = 0; q < this.control.tank.seats.length; q++) {
9760
var r = this.control.tank.seats[q],
9761
g = r.pos.x,
9762
m = r.pos.y,
9763
n = r.pos.x + r.size.x,
9764
p = r.pos.y + r.size.y;
9765
if (d < n && (f > g && e < p && l > m) && (b = n - d, f < n && (b = f - g), g = p - e, l < p && (g = l - m), m = b * g, b = !1, !c || m > c.area)) c = {
9766
seat: r,
9767
area: m
9768
}
9769
}
9770
if (b) {
9771
if (this.pos.x >= this.preDragPos.x + this.size.x || this.pos.x + this.size.x <= this.preDragPos.x || this.pos.y >= this.preDragPos.y + this.size.y || this.pos.y + this.size.y <= this.preDragPos.y) c = ig.game.spawnEntity(EntityGameUnitFriendly, this.pos.x + this.size.x / 2, this.pos.y + this.size.y / 2, {
9772
control: this.control,
9773
unitType: this.unitType
9774
}), c.zIndex = this.zIndex, c.die(), this.startWaiting()
9775
} else c && (r = c.seat, r.spawnUnit(this.unitType), this.startWaiting(), this.control.tank.checkUnitMatches(), this.control.hideGuide());
9776
this.isDragging = !1;
9777
this.pos.x = this.preDragPos.x;
9778
this.pos.y = this.preDragPos.y;
9779
this.control.tank.hideTargets();
9780
this.zIndex = 550;
9781
ig.game.sortEntitiesDeferred()
9782
}
9783
},
9784
startWaiting: function() {
9785
this.isWaiting = !0;
9786
this.timeWaited = 0
9787
},
9788
stopWaiting: function() {
9789
this.isWaiting = !1;
9790
var b = ig.game.currentTeam;
9791
if (b) {
9792
var c = Math.floor(Math.random() * b.length);
9793
this.unitType = b[c]
9794
}
9795
try {
9796
ig.soundHandler.playSound("reload")
9797
} catch (d) {
9798
console.log(d)
9799
}
9800
}
9801
})
9802
});
9803
ig.baked = !0;
9804
ig.module("game.entities.game-ui").requires("impact.entity", "game.entities.button-mute", "game.entities.button-pause", "game.entities.game-button-mainweapon", "game.entities.game-unit-queue", "game.entities.howtoplay").defines(function() {
9805
EntityGameUi = ig.Entity.extend({
9806
zIndex: 500,
9807
control: null,
9808
front: null,
9809
topBarImage: new ig.Image("media/graphics/game/ui/topbar.png"),
9810
bottomBarBackImage: new ig.Image("media/graphics/game/ui/bottombarback.png"),
9811
muteButton: null,
9812
pauseButton: null,
9813
mainweaponButton: null,
9814
unitQueues: [],
9815
distanceText: "0",
9816
coinText: "0",
9817
init: function(b, c, d) {
9818
this.parent(b, c, d);
9819
ig.global.wm || (this.front = ig.game.spawnEntity(EntityGameUiFront, 0, 0, {
9820
back: this
9821
}), this.muteButton = ig.game.spawnEntity(EntityButtonMute, 420, 8), this.pauseButton = ig.game.spawnEntity(EntityButtonPause, 450, 8, {
9822
control: this.control
9823
}), this.mainweaponButton = ig.game.spawnEntity(EntityGameButtonMainweapon, 369, 531, {
9824
control: this.control
9825
}), this.unitQueues.push(ig.game.spawnEntity(EntityGameUnitQueue, 30, 550, {
9826
control: this.control
9827
})), this.unitQueues.push(ig.game.spawnEntity(EntityGameUnitQueue, 132, 550, {
9828
control: this.control
9829
})), this.unitQueues.push(ig.game.spawnEntity(EntityGameUnitQueue, 230, 550, {
9830
control: this.control
9831
})), ig.game.sortEntitiesDeferred())
9832
},
9833
update: function() {
9834
this.parent();
9835
this.distanceText = Math.floor(this.control.distanceTravelled).toString();
9836
this.coinText = Math.floor(this.control.coinsCollected).toString()
9837
},
9838
draw: function() {
9839
this.parent();
9840
this.topBarImage.draw(-ig.game.screen.x + 0, -ig.game.screen.y + 0);
9841
ig.system.context.fillStyle = "#FFFFFF";
9842
ig.system.context.font = "10px avenger";
9843
str = "km";
9844
var b = ig.system.context.measureText(str).width,
9845
c = ig.system.context.measureText("m").width,
9846
b = -ig.game.screen.x + 378,
9847
c = -ig.game.screen.y + 18 + c;
9848
ig.system.context.fillText(str, b, c);
9849
ig.system.context.font = "16px avenger_bold";
9850
str = this.distanceText;
9851
b = ig.system.context.measureText(str).width;
9852
c = ig.system.context.measureText("m").width;
9853
b = -ig.game.screen.x + 377 - b;
9854
c = -ig.game.screen.y + 13 + c;
9855
ig.system.context.fillText(str, b, c);
9856
ig.system.context.font = "16px avenger_bold";
9857
str = this.coinText;
9858
b = ig.system.context.measureText(str).width;
9859
c = ig.system.context.measureText("m").width;
9860
b = -ig.game.screen.x + 292 - b;
9861
c = -ig.game.screen.y + 13 + c;
9862
ig.system.context.fillText(str, b, c);
9863
this.bottomBarBackImage.draw(-ig.game.screen.x + 0, -ig.game.screen.y + 515);
9864
var d = this.control.tank.hp / this.control.tank.maxHp[this.control.tank.tankType],
9865
b = -ig.game.screen.x + 40,
9866
c = -ig.game.screen.y + 16;
9867
ig.system.context.fillStyle = 0.25 > d ? "#FF0000" : 0.5 > d ? "#FFFF00" : "#00FF00";
9868
ig.system.context.fillRect(b, c, 158 * d, 10)
9869
}
9870
});
9871
EntityGameUiFront = ig.Entity.extend({
9872
zIndex: 600,
9873
back: null,
9874
control: null,
9875
bottomBarFrontImage: new ig.Image("media/graphics/game/ui/bottombarfront.png"),
9876
guideImage: new ig.Image("media/graphics/game/ui/guide1.png"),
9877
handImage: new ig.Image("media/graphics/game/ui/finger.png"),
9878
showGuide: !0,
9879
guideStartTime: 0,
9880
handOffsetY: 0,
9881
init: function(b, c, d) {
9882
this.parent(b, c, d);
9883
this.control = this.back.control
9884
},
9885
draw: function() {
9886
this.parent();
9887
this.bottomBarFrontImage.draw(-ig.game.screen.x + 0, -ig.game.screen.y + 515);
9888
var b = 200,
9889
c = ig.system.height,
9890
d = -ig.game.screen.x + ig.system.width,
9891
e = -ig.game.screen.y;
9892
ig.system.context.fillStyle = "#000000";
9893
ig.system.context.fillRect(d, e, b, c);
9894
d = -ig.game.screen.x - 200;
9895
ig.system.context.fillStyle = "#000000";
9896
ig.system.context.fillRect(d, e, b, c);
9897
b = ig.system.width + 400;
9898
c = 200;
9899
e = -ig.game.screen.y - 200;
9900
ig.system.context.fillStyle = "#000000";
9901
ig.system.context.fillRect(d, e, b, c);
9902
e = -ig.game.screen.y + ig.system.height + 200;
9903
ig.system.context.fillStyle = "#000000";
9904
ig.system.context.fillRect(d, e, b, c);
9905
this.showGuide && (this.guideImage.draw(-ig.game.screen.x + 118, -ig.game.screen.y + 282), d = -ig.game.screen.x +
9906
138, e = -ig.game.screen.y + 577 + this.handOffsetY, this.handImage.draw(-ig.game.screen.x + d, -ig.game.screen.y + e))
9907
},
9908
update: function() {
9909
this.parent();
9910
if (this.showGuide) {
9911
var b = this.control.gameTime - this.guideStartTime;
9912
1 >= b ? this.handOffsetY = -300 * b : 2 <= b && (this.guideStartTime = this.control.gameTime)
9913
}
9914
}
9915
});
9916
EntityGameUIPause = ig.Entity.extend({
9917
zIndex: 700,
9918
control: null,
9919
pointer: null,
9920
bgImage: new ig.Image("media/graphics/game/ui/menubg.jpg"),
9921
bg2Image: new ig.Image("media/graphics/game/ui/menubg2.png"),
9922
titleImage: new ig.Image("media/graphics/game/ui/pausetitle.png"),
9923
replayImage: new ig.Image("media/graphics/game/ui/replay.png"),
9924
homeImage: new ig.Image("media/graphics/game/ui/home.png"),
9925
howtoplayImage: new ig.Image("media/graphics/game/ui/howtoplay.png"),
9926
backImage: new ig.Image("media/graphics/game/ui/back.png"),
9927
bgPos: {
9928
x: 0,
9929
y: 0
9930
},
9931
bg2Pos: {
9932
x: 0,
9933
y: 0
9934
},
9935
titlePos: {
9936
x: 153,
9937
y: 60
9938
},
9939
replayBox: {
9940
x: 94,
9941
y: 172,
9942
w: 314,
9943
h: 75
9944
},
9945
homeBox: {
9946
x: 94,
9947
y: 250,
9948
w: 314,
9949
h: 75
9950
},
9951
howtoplayBox: {
9952
x: 94,
9953
y: 329,
9954
w: 314,
9955
h: 75
9956
},
9957
backBox: {
9958
x: 94,
9959
y: 407,
9960
w: 314,
9961
h: 75
9962
},
9963
init: function(b, c, d) {
9964
this.parent(b, c, d);
9965
1 < ig.game.getEntitiesByType(EntityGameUIPause).length && this.kill()
9966
},
9967
ready: function() {
9968
var b = ig.game.getEntitiesByType(EntityPointer);
9969
0 < b.length && (this.pointer = b[0]);
9970
b = this.pos.x;
9971
this.pos.x = ig.system.width + b;
9972
this.tween({
9973
pos: {
9974
x: b
9975
}
9976
}, 0.5, {
9977
easing: ig.Tween.Easing.Elastic.EaseOut
9978
}).start()
9979
},
9980
draw: function() {
9981
this.parent();
9982
this.bgImage.draw(this.bgPos.x, this.bgPos.y);
9983
this.bg2Image.draw(this.pos.x + this.bg2Pos.x, this.pos.y + this.bg2Pos.y);
9984
this.titleImage.draw(this.pos.x + this.titlePos.x, this.pos.y + this.titlePos.y);
9985
this.replayImage.draw(this.pos.x + this.replayBox.x, this.pos.y +
9986
this.replayBox.y);
9987
this.homeImage.draw(this.pos.x + this.homeBox.x, this.pos.y + this.homeBox.y);
9988
this.howtoplayImage.draw(this.pos.x + this.howtoplayBox.x, this.pos.y + this.howtoplayBox.y);
9989
this.backImage.draw(this.pos.x + this.backBox.x, this.pos.y + this.backBox.y)
9990
},
9991
update: function() {
9992
this.parent();
9993
ig.input.released("click") && this.released()
9994
},
9995
released: function() {
9996
var b = {
9997
x1: this.pointer.pos.x,
9998
y1: this.pointer.pos.y,
9999
x2: this.pointer.pos.x + this.pointer.size.x,
10000
y2: this.pointer.pos.y + this.pointer.size.y
10001
},
10002
c = {
10003
x1: this.backBox.x,
10004
y1: this.backBox.y,
10005
x2: this.backBox.x + this.backBox.w,
10006
y2: this.backBox.y + this.backBox.h
10007
};
10008
if (this.aabbCheck(b, c)) {
10009
this.tween({
10010
pos: {
10011
x: ig.system.width
10012
}
10013
}, 0.5, {
10014
easing: ig.Tween.Easing.Elastic.EaseIn,
10015
entity: this,
10016
onComplete: function() {
10017
this.entity.control.unpauseGame()
10018
}
10019
}).start();
10020
try {
10021
ig.soundHandler.playSound("click")
10022
} catch (d) {
10023
console.log(d)
10024
}
10025
} else if (c = {
10026
x1: this.replayBox.x,
10027
y1: this.replayBox.y,
10028
x2: this.replayBox.x + this.replayBox.w,
10029
y2: this.replayBox.y + this.replayBox.h
10030
}, this.aabbCheck(b, c)) {
10031
this.control.unpauseGame();
10032
ig.game.director.loadLevel(ig.game.director.currentLevel);
10033
try {
10034
ig.soundHandler.playSound("click")
10035
} catch (e) {
10036
console.log(e)
10037
}
10038
} else if (c = {
10039
x1: this.homeBox.x,
10040
y1: this.homeBox.y,
10041
x2: this.homeBox.x + this.homeBox.w,
10042
y2: this.homeBox.y + this.homeBox.h
10043
}, this.aabbCheck(b, c)) {
10044
this.control.unpauseGame();
10045
ig.game.director.loadLevel(1);
10046
try {
10047
ig.soundHandler.playSound("click")
10048
} catch (f) {
10049
console.log(f)
10050
}
10051
} else if (c = {
10052
x1: this.howtoplayBox.x,
10053
y1: this.howtoplayBox.y,
10054
x2: this.howtoplayBox.x + this.howtoplayBox.w,
10055
y2: this.howtoplayBox.y +
10056
this.howtoplayBox.h
10057
}, this.aabbCheck(b, c)) {
10058
ig.game.spawnEntity(EntityHowtoplay, 0, 0, {
10059
control: this.control
10060
}).ready();
10061
try {
10062
ig.soundHandler.playSound("click")
10063
} catch (l) {
10064
console.log(l)
10065
}
10066
}
10067
},
10068
aabbCheck: function(b, c) {
10069
return b.x1 < c.x2 && b.x2 > c.x1 && b.y1 < c.y2 && b.y2 > c.y1 ? !0 : !1
10070
}
10071
})
10072
});
10073
ig.baked = !0;
10074
ig.module("game.entities.game-tank-seat").requires("impact.entity").defines(function() {
10075
EntityGameTankSeat = ig.Entity.extend({
10076
zIndex: 150,
10077
size: {
10078
x: 60,
10079
y: 60
10080
},
10081
type: ig.Entity.TYPE.B,
10082
control: null,
10083
seatImage: new ig.Image("media/graphics/game/tank/seat.png"),
10084
seatRedImage: new ig.Image("media/graphics/game/tank/seat-red.png"),
10085
targetImage: new ig.Image("media/graphics/game/ui/target.png"),
10086
unit: null,
10087
posOffsetX: 0,
10088
posOffsetY: 0,
10089
isBumped: !1,
10090
drawTarget: !0,
10091
init: function(b, c, d) {
10092
this.parent(b, c, d);
10093
this.pos.x -= 0.5 * this.size.x;
10094
this.pos.y -= 0.5 * this.size.y
10095
},
10096
update: function() {
10097
this.parent()
10098
},
10099
draw: function() {
10100
this.parent();
10101
var b = -ig.game.screen.x + this.pos.x + 0.5 * (this.size.x - this.seatImage.data.width),
10102
c = -ig.game.screen.y + this.pos.y + this.size.y - 2;
10103
this.drawBar(b + 19, c + 7, this.seatImage.data.width - 36, this.seatImage.data.height - 14);
10104
2 != this.control.tank.tankType ? this.seatImage.draw(b, c) : this.seatRedImage.draw(b, c);
10105
this.drawTarget && (b = -ig.game.screen.x + this.pos.x + 0.5 * (this.size.x - this.targetImage.data.width), c = -ig.game.screen.y + this.pos.y +
10106
0.5 * (this.size.y - this.targetImage.data.height), this.targetImage.draw(b, c))
10107
},
10108
drawBar: function(b, c, d, e) {
10109
ig.system.context.fillStyle = "#999999";
10110
ig.system.context.fillRect(b, c, d, e);
10111
if (this.unit) {
10112
var f = this.unit.hp / this.unit.maxHp;
10113
0 < f && (ig.system.context.fillStyle = 0.5 < f ? "#00FF00" : 0.2 < f ? "#FFFF00" : "#FF0000", ig.system.context.fillRect(b, c, d * f, e))
10114
}
10115
},
10116
bump: function(b, c) {
10117
this.isBumped || (this.isBumped = !0, this.posOffsetX = b, this.posOffsetY = c, this.pos.x += b, this.pos.y += c, this.unit && (this.unit.pos.x = this.pos.x + this.size.x / 2 - this.unit.size.x / 2, this.unit.pos.y = this.pos.y + this.size.y / 2 - this.unit.size.y / 2))
10118
},
10119
unbump: function() {
10120
this.isBumped && (this.isBumped = !1, this.pos.y -= this.posOffsetY, this.pos.x -= this.posOffsetX, this.unit && (this.unit.pos.x = this.pos.x + this.size.x / 2 - this.unit.size.x / 2, this.unit.pos.y = this.pos.y + this.size.y / 2 - this.unit.size.y / 2))
10121
},
10122
movePos: function(b, c) {
10123
this.pos.x += b;
10124
this.pos.y += c;
10125
this.unit && (this.unit.pos.x += b, this.unit.pos.y += c)
10126
},
10127
spawnUnit: function(b) {
10128
this.unit && this.unit.die();
10129
this.unit = ig.game.spawnEntity(EntityGameUnitFriendly, this.pos.x + this.size.x / 2, this.pos.y + this.size.y / 2, {
10130
control: this.control,
10131
seat: this,
10132
unitType: b
10133
});
10134
this.unit.spawnTime = this.control.gameTime;
10135
this.control.tank.rearrangeSeatUnitZIndex()
10136
}
10137
})
10138
});
10139
ig.baked = !0;
10140
ig.module("game.entities.game-tank").requires("impact.entity", "game.entities.game-tank-seat").defines(function() {
10141
EntityGameTank = ig.Entity.extend({
10142
zIndex: 100,
10143
size: {
10144
x: 240,
10145
y: 120
10146
},
10147
relDrawPos: {
10148
x: 0,
10149
y: 0
10150
},
10151
control: null,
10152
tankIdleAnim: [new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank1/idle.png", 438, 375), 0.2, [0, 1]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank2/idle.png", 438, 375), 0.2, [0, 1]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank3/idle.png", 438, 375), 0.2, [0, 1])],
10153
tankShootAnim: [new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank1/fire.png", 438, 375), 0.2, [0, 1, 2, 3]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank2/fire.png", 438, 375), 0.2, [0, 1, 2, 3]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/tank/tank3/fire.png", 438, 375), 0.2, [0, 1, 2, 3])],
10154
barrelPos: [{
10155
x: 349,
10156
y: 175
10157
}, {
10158
x: 391,
10159
y: 105
10160
}, {
10161
x: 294,
10162
y: 154
10163
}],
10164
fireDamage: [500, 500, 600, 500],
10165
bulletType: [1, 5, 6],
10166
bulletStartVel: [250, 250, 0],
10167
tankType: 0,
10168
hp: 1E3,
10169
maxHp: [1E3, 1200, 1500],
10170
defence: [0, 1, 2],
10171
seats: [],
10172
seatPos: [{
10173
x: 160,
10174
y: 70
10175
}, {
10176
x: 242,
10177
y: 135
10178
}, {
10179
x: 150,
10180
y: 193
10181
}],
10182
isFiring: !1,
10183
hoverOffset: {
10184
x: 0,
10185
y: 0
10186
},
10187
minHover: {
10188
x: -5,
10189
y: 0
10190
},
10191
maxHover: {
10192
x: 5,
10193
y: 0
10194
},
10195
hoverDirection: {
10196
x: 2,
10197
y: 0
10198
},
10199
deferredHealAmt: 0,
10200
init: function(b, c, d) {
10201
this.parent(b, c, d);
10202
this.relDrawPos.x = 0.5 * -(this.tankIdleAnim[this.tankType].sheet.width - this.size.x);
10203
this.relDrawPos.y = -75 - 0.5 * (this.tankIdleAnim[this.tankType].sheet.height - this.size.y);
10204
if (!ig.global.wm) {
10205
for (d = 0; d < this.seatPos.length; d++) b = this.pos.x + this.seatPos[d].x + this.relDrawPos.x, c = this.pos.y + this.seatPos[d].y + this.relDrawPos.y, this.seats.push(ig.game.spawnEntity(EntityGameTankSeat, b, c, {
10206
control: this.control
10207
}));
10208
ig.game.sortEntitiesDeferred()
10209
}
10210
this.minHover.x = -5 * Math.random();
10211
this.maxHover.x = 5 * Math.random();
10212
0.5 <= Math.random() && (this.hoverDirection.x *= -1);
10213
this.hp = this.maxHp[this.tankType]
10214
},
10215
update: function() {
10216
this.parent();
10217
if (!this.control.isPaused) {
10218
if (this.isFiring)
10219
if (this.tankShootAnim[this.tankType].update(), 1 <= this.tankShootAnim[this.tankType].loopCount) this.isFiring = !1;
10220
else {
10221
for (var b = 0; b < this.seats.length; b++) this.seats[b].unbump();
10222
0 != this.tankShootAnim[this.tankType].frame && (1 == this.tankShootAnim[this.tankType].frame ? 0 == this.tankType ? (this.seats[0].bump(-24, 6), this.seats[1].bump(-24, 6), this.seats[2].bump(0, 6)) : 1 == this.tankType ? (this.seats[0].bump(-19, 6), this.seats[1].bump(-19, 6), this.seats[2].bump(0, 6)) : 2 == this.tankType && (this.seats[0].bump(-20, 0), this.seats[1].bump(-20, 0), this.seats[2].bump(0, 3)) : 2 == this.tankShootAnim[this.tankType].frame ? 0 == this.tankType ? (this.seats[0].bump(-11, 6), this.seats[1].bump(-11, 6)) : 1 == this.tankType ? (this.seats[0].bump(-10, 0), this.seats[1].bump(-10, 0)) : 2 == this.tankType && (this.seats[0].bump(-12, 0), this.seats[1].bump(-12, 0)) : 3 == this.tankShootAnim[this.tankType].frame && (0 == this.tankType ? this.seats[2].bump(0, 6) : 1 == this.tankType ? (this.seats[0].bump(-5, 5), this.seats[1].bump(-5, 5), this.seats[2].bump(0, 6)) : 2 == this.tankType && (this.seats[0].bump(-5, 0), this.seats[1].bump(-5, 0), this.seats[2].bump(0, 3))))
10223
}
10224
if (!this.isFiring) {
10225
this.tankIdleAnim[this.tankType].update();
10226
for (b = 0; b < this.seats.length; b++) this.seats[b].unbump();
10227
if (1 == this.tankIdleAnim[this.tankType].frame)
10228
for (b = 0; b < this.seats.length; b++) 2 == b && 2 == this.tankType ? this.seats[b].bump(0, 3) : this.seats[b].bump(0, 6);
10229
this.hoverOffset.x += this.hoverDirection.x * ig.system.tick;
10230
for (b = 0; b < this.seats.length; b++) this.seats[b].movePos(this.hoverDirection.x * ig.system.tick, 0);
10231
this.hoverOffset.x >= this.maxHover.x ? (this.hoverOffset.x = this.maxHover.x, this.hoverDirection.x *= -1, this.minHover.x = -5 * Math.random()) : this.hoverOffset.x <= this.minHover.x && (this.hoverOffset.x = this.minHover.x, this.hoverDirection.x *= -1, this.maxHover.x = 5 * Math.random())
10232
}
10233
}
10234
},
10235
draw: function() {
10236
this.parent();
10237
var b = -ig.game.screen.x + this.pos.x + this.relDrawPos.x + this.hoverOffset.x,
10238
c = -ig.game.screen.y + this.pos.y + this.relDrawPos.y + this.hoverOffset.y;
10239
this.isFiring ? this.tankShootAnim[this.tankType].draw(b, c) : this.tankIdleAnim[this.tankType].draw(b, c)
10240
},
10241
showTargets: function() {
10242
for (var b = 0; b < this.seats.length; b++) this.seats[b].drawTarget = !0
10243
},
10244
hideTargets: function() {
10245
for (var b = 0; b < this.seats.length; b++) null != this.seats[b].unit && (this.seats[b].drawTarget = !1)
10246
},
10247
rearrangeSeatUnitZIndex: function() {
10248
for (var b = 200, c = 0; c < this.seats.length; c++) null != this.seats[c].unit && (this.seats[c].unit.zIndex = b, b += 10);
10249
ig.game.sortEntitiesDeferred()
10250
},
10251
fireMainWeapon: function() {
10252
this.isFiring = !0;
10253
this.tankShootAnim[this.tankType].rewind();
10254
this.tankIdleAnim[this.tankType].rewind();
10255
for (var b = 0; b < this.seats.length; b++) this.seats[b].unbump();
10256
var b = this.bulletType[this.tankType],
10257
c = ig.game.spawnEntity(EntityGameBullet, this.pos.x + this.relDrawPos.x + this.barrelPos[this.tankType].x, this.pos.y + this.relDrawPos.y + this.barrelPos[this.tankType].y, {
10258
control: this.control,
10259
bulletType: b
10260
});
10261
c.sourceType = 0;
10262
c.targetType = 2;
10263
c.startVel = this.bulletStartVel[this.tankType];
10264
c.zIndex = 99;
10265
c.damage = this.fireDamage[this.tankType];
10266
6 != b && !1 == c.setTargetArc(460, 450) ? c.kill() : ig.game.sortEntitiesDeferred()
10267
},
10268
takeDamage: function(b) {
10269
b -= this.defence[this.tankType];
10270
0 > b || (this.hp -= b, 0 > this.hp && (this.hp = 0, this.control.endGame()))
10271
},
10272
healDamage: function(b) {
10273
this.hp += b;
10274
this.hp > this.maxHp[this.tankType] && (this.hp = this.maxHp[this.tankType])
10275
},
10276
checkUnitMatches: function() {
10277
for (var b = -1, c = 0; c < this.seats.length; c++) {
10278
var d = this.seats[c];
10279
if (null != d.unit)
10280
if (d = d.unit.unitType, -1 == b) b = d;
10281
else {
10282
if (b != d) {
10283
b = -1;
10284
break
10285
}
10286
} else {
10287
b = -1;
10288
break
10289
}
10290
}
10291
if (-1 == b)
10292
for (c = 0; c < this.seats.length; c++) d = this.seats[c], null != d.unit && (d.unit.superMode = !1);
10293
else
10294
for (c = 0; c < this.seats.length; c++) d = this.seats[c], d.unit.hp = d.unit.maxHp, d.unit.superMode = !0
10295
}
10296
})
10297
});
10298
ig.baked = !0;
10299
ig.module("game.entities.game-effect").requires("impact.entity").defines(function() {
10300
EntityGameEffect = ig.Entity.extend({
10301
zIndex: 210,
10302
size: {
10303
x: 1,
10304
y: 1
10305
},
10306
control: null,
10307
effectAnimSheets: [new ig.AnimationSheet("media/graphics/game/effects/bullethit.png", 150, 150), new ig.AnimationSheet("media/graphics/game/effects/fire.png", 120, 120), new ig.AnimationSheet("media/graphics/game/effects/smoke.png", 80, 80), new ig.AnimationSheet("media/graphics/game/effects/smokered.png", 80, 80), new ig.AnimationSheet("media/graphics/game/effects/smokewhite.png", 80, 80)],
10308
effectAnims: [],
10309
effectType: 0,
10310
relDrawPos: {
10311
x: 0,
10312
y: 0
10313
},
10314
moveVel: {
10315
x: 0,
10316
y: 0
10317
},
10318
startVel: 0,
10319
angle: 0,
10320
alpha: 1,
10321
init: function(b, c, d) {
10322
this.parent(b, c, d);
10323
this.effectAnims.push(new ig.Animation(this.effectAnimSheets[0], 0.1, [0, 1, 2, 3]));
10324
this.effectAnims.push(new ig.Animation(this.effectAnimSheets[1], 0.1, [0, 1]));
10325
this.setPos(b, c);
10326
this.relDrawPos.x = 0.5 * -this.effectAnims[this.effectType].sheet.width;
10327
this.relDrawPos.y = 0.5 * -this.effectAnims[this.effectType].sheet.height;
10328
this.effectAnims[this.effectType].rewind()
10329
},
10330
update: function() {
10331
this.parent();
10332
if (!ig.game.gamePaused)
10333
if (this.pos.x += this.moveVel.x * ig.system.tick, this.pos.y += this.moveVel.y * ig.system.tick, this.effectAnims[this.effectType].update(), 1 <= this.effectAnims[this.effectType].loopCount) this.kill();
10334
else {
10335
var b = Math.max(this.effectAnims[this.effectType].sheet.width, this.effectAnims[this.effectType].sheet.height);
10336
(this.pos.x - b > ig.system.width + 100 || this.pos.y - b > ig.system.height + 100 || -100 > this.pos.x + b || -100 > this.pos.y + b) && this.kill()
10337
}
10338
},
10339
draw: function() {
10340
this.parent();
10341
var b = -ig.game.screen.x +
10342
this.pos.x + this.relDrawPos.x,
10343
c = -ig.game.screen.y + this.pos.y + this.relDrawPos.y;
10344
this.effectAnims[this.effectType].angle = this.angle;
10345
this.effectAnims[this.effectType].draw(b, c)
10346
},
10347
kill: function() {
10348
this.parent()
10349
},
10350
setPos: function(b, c) {
10351
this.pos.x = b - 0.5 * this.size.x;
10352
this.pos.y = c - 0.5 * this.size.y
10353
}
10354
})
10355
});
10356
ig.baked = !0;
10357
ig.module("game.entities.game-bullet").requires("impact.entity", "game.entities.game-effect").defines(function() {
10358
EntityGameBullet = ig.Entity.extend({
10359
zIndex: 170,
10360
size: {
10361
x: 1,
10362
y: 1
10363
},
10364
control: null,
10365
bulletAnims: [new ig.Animation(new ig.AnimationSheet("media/graphics/game/bullets/bullet.png", 20, 6), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/bullets/rocket.png", 35, 21), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/bullets/bulletpig.png", 22, 6), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/bullets/bulletpighead.png", 39, 40), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/bullets/bomb.png", 119, 45), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/bullets/fireball.png", 106, 72), 0.2, [0]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/bullets/laser.png", 1, 53), 0.2, [0])],
10366
bulletSpread: [0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0],
10367
bulletLifetime: [0, 0, 0, 0, 0, 0, 1],
10368
shotTime: 0,
10369
bulletType: 0,
10370
relDrawPos: {
10371
x: 0,
10372
y: 0
10373
},
10374
moveVel: {
10375
x: 0,
10376
y: 0
10377
},
10378
startVel: 1E3,
10379
sourceType: 0,
10380
targetType: 1,
10381
targetPos: {
10382
x: 0,
10383
y: 0
10384
},
10385
angle: 0,
10386
hit: !1,
10387
damage: 5,
10388
hasGravity: !1,
10389
gravity: 500,
10390
init: function(b, c, d) {
10391
this.parent(b, c, d);
10392
this.setPos(b, c);
10393
this.relDrawPos.x = -this.bulletAnims[this.bulletType].sheet.width;
10394
this.relDrawPos.y = 0.5 * -this.bulletAnims[this.bulletType].sheet.height;
10395
for (b = 0; b < this.bulletAnims.length; b++) this.bulletAnims[b].pivot.x = this.bulletAnims[b].sheet.width;
10396
1 == this.bulletType ? (this.size.x = 20, this.size.y = 20, this.relDrawPos.x += 10, this.relDrawPos.y += 10, this.x -= 10, this.y -= 10) : 5 == this.bulletType && (this.size.x = 40, this.size.y = 40, this.relDrawPos.x += 20, this.relDrawPos.y += 20, this.x -= 30, this.y -= 30);
10397
this.shotTime = this.control.gameTime
10398
},
10399
update: function() {
10400
this.parent();
10401
if (!ig.game.gamePaused && !this.hit) {
10402
this.hasGravity && (this.moveVel.y += this.gravity * ig.system.tick, this.bulletAnims[this.bulletType].flip.y = !1, this.angle = this.getAngleFromVector(), this.angle > 0.5 * Math.PI && this.angle < 1.5 * Math.PI && 3 != this.bulletType && (this.bulletAnims[this.bulletType].flip.y = !0));
10403
this.pos.x += this.moveVel.x * ig.system.tick;
10404
this.pos.y += this.moveVel.y * ig.system.tick;
10405
this.bulletAnims[this.bulletType].update();
10406
var b = Math.max(this.bulletAnims[this.bulletType].sheet.width, this.bulletAnims[this.bulletType].sheet.height);
10407
this.pos.x - b > ig.system.width + 100 || this.pos.y - b > ig.system.height + 100 || -100 > this.pos.x + b || -100 > this.pos.y + b ? this.kill() : (this.checkCollisions(), 0 < this.bulletLifetime[this.bulletType] && this.control.gameTime - this.shotTime > this.bulletLifetime[this.bulletType] && this.kill())
10408
}
10409
},
10410
draw: function() {
10411
this.parent();
10412
if (6 != this.bulletType) {
10413
if (!this.hit) {
10414
var b = -ig.game.screen.x + this.pos.x + this.relDrawPos.x,
10415
c = -ig.game.screen.y + this.pos.y + this.relDrawPos.y;
10416
this.bulletAnims[this.bulletType].angle = this.angle;
10417
this.bulletAnims[this.bulletType].draw(b, c)
10418
}
10419
} else b = this.bulletAnims[this.bulletType].sheet.image.data, ig.system.context.drawImage(b, 0, 0, b.width, b.height, -ig.game.screen.x + this.pos.x, -ig.game.screen.y + this.pos.y - 30, ig.system.width - this.pos.x, 60)
10420
},
10421
kill: function() {
10422
this.parent()
10423
},
10424
setPos: function(b, c) {
10425
this.pos.x = b - 0.5 * this.size.x;
10426
this.pos.y = c - 0.5 * this.size.y
10427
},
10428
setTarget: function(b, c) {
10429
this.targetPos.x = b;
10430
this.targetPos.y = c;
10431
this.bulletAnims[this.bulletType].flip.y = !1;
10432
this.angle = this.getAngleToTarget();
10433
if (0 < this.bulletSpread[this.bulletType]) {
10434
var d = this.bulletSpread[this.bulletType];
10435
this.angle = this.angle - d + Math.random() * 2 * d
10436
}
10437
this.angle > 0.5 * Math.PI && this.angle < 1.5 * Math.PI && 3 != this.bulletType && (this.bulletAnims[this.bulletType].flip.y = !0);
10438
var d = this.targetPos.x - this.pos.x,
10439
e = this.targetPos.y - this.pos.y,
10440
f = Math.sqrt(d * d + e * e);
10441
this.moveVel.x = d / f * this.startVel;
10442
this.moveVel.y = e / f * this.startVel
10443
},
10444
setTargetArc: function(b, c, d) {
10445
this.targetPos.x = b;
10446
this.targetPos.y = c;
10447
this.bulletAnims[this.bulletType].flip.y = !1;
10448
c = this.targetPos.x - this.pos.x;
10449
var e = -this.gravity,
10450
f = this.startVel,
10451
l = Math.sqrt(f * f * f * f - e * (e * c * c + 2 * (this.targetPos.y - this.pos.y) * f * f));
10452
if (isNaN(l)) return !1;
10453
b = Math.atan((f * f + l) / (e * c));
10454
c = Math.atan((f * f - l) / (e * c));
10455
this.angle = b;
10456
c > b && (this.angle = c);
10457
d && b < c && (this.angle = b);
10458
0 < this.bulletSpread[this.bulletType] && (d = this.bulletSpread[this.bulletType], this.angle = this.angle - d + Math.random() * 2 * d);
10459
this.angle > 0.5 * Math.PI && this.angle < 1.5 * Math.PI && 3 != this.bulletType && (this.bulletAnims[this.bulletType].flip.y = !0);
10460
this.hasGravity = !0;
10461
d = Math.cos(this.angle);
10462
b = Math.sin(this.angle);
10463
this.moveVel.x = d * this.startVel;
10464
this.moveVel.y = b * this.startVel;
10465
return !0
10466
},
10467
getAngleToTarget: function() {
10468
var b = this.targetPos.y - this.pos.y,
10469
c = this.targetPos.x - this.pos.x;
10470
if (0 == b) {
10471
if (0 == c || 0 < c) return 0;
10472
if (0 > c) return Math.PI
10473
}
10474
if (0 == c) {
10475
if (0 < b) return Math.PI / 2;
10476
if (0 > b) return 3 * (Math.PI / 2)
10477
}
10478
var d = Math.atan(Math.abs(b / c));
10479
0 > c && 0 < b && (d = Math.PI - d);
10480
0 > c && 0 > b && (d = Math.PI + d);
10481
0 < c && 0 > b && (d = 2 * Math.PI - d);
10482
return d
10483
},
10484
getAngleFromVector: function() {
10485
var b = this.moveVel.y,
10486
c = this.moveVel.x;
10487
if (0 == b) {
10488
if (0 == c || 0 < c) return 0;
10489
if (0 > c) return Math.PI
10490
}
10491
if (0 == c) {
10492
if (0 < b) return Math.PI / 2;
10493
if (0 > b) return 3 * (Math.PI / 2)
10494
}
10495
var d = Math.atan(Math.abs(b / c));
10496
0 > c && 0 < b && (d = Math.PI - d);
10497
0 > c && 0 > b && (d = Math.PI + d);
10498
0 < c && 0 > b && (d = 2 * Math.PI - d);
10499
return d
10500
},
10501
checkCollisions: function() {
10502
if ((2 == this.sourceType || 3 == this.sourceType) && 0 == this.targetType) {
10503
var b = this.control.tank;
10504
if (1 == this.bulletType || 3 == this.bulletType || 5 == this.bulletType) {
10505
if (this.boxBoxCollision(this.pos.x, this.pos.y, this.size.x, this.size.y, b.pos.x, b.pos.y, b.size.x, b.size.y)) {
10506
this.hit = !0;
10507
b.takeDamage(this.damage);
10508
ig.game.spawnEntity(EntityGameEffect, this.pos.x, this.pos.y, {
10509
control: this.control,
10510
effectType: 1
10511
});
10512
this.kill();
10513
try {
10514
ig.soundHandler.playSound("softexplosion")
10515
} catch (c) {
10516
console.log(c)
10517
}
10518
}
10519
} else if (this.pointBoxCollision(this.pos.x, this.pos.y, b.pos.x, b.pos.y, b.size.x, b.size.y)) {
10520
this.hit = !0;
10521
b.takeDamage(this.damage);
10522
var d = 0;
10523
try {
10524
ig.soundHandler.playSound("hit")
10525
} catch (e) {
10526
console.log(e)
10527
}
10528
ig.game.spawnEntity(EntityGameEffect, this.pos.x, this.pos.y, {
10529
control: this.control,
10530
effectType: d
10531
});
10532
this.kill()
10533
}
10534
} else if ((0 == this.sourceType || 1 == this.sourceType) && (2 == this.targetType || 3 == this.targetType)) {
10535
for (var b = this.control.enemies, f = 0; f < b.length; f++) {
10536
var l = b[f];
10537
if (!l.isDying) {
10538
d = 0;
10539
if (1 == this.bulletType || 3 == this.bulletType || 5 == this.bulletType) d = 1;
10540
if (1 == this.bulletType || 5 == this.bulletType) {
10541
if (this.boxBoxCollision(this.pos.x, this.pos.y, this.size.x, this.size.y, l.pos.x, l.pos.y, l.size.x, l.size.y)) {
10542
this.hit = !0;
10543
l.takeDamage(this.damage);
10544
ig.game.spawnEntity(EntityGameEffect, this.pos.x, this.pos.y, {
10545
control: this.control,
10546
effectType: d
10547
});
10548
try {
10549
ig.soundHandler.playSound("softexplosion")
10550
} catch (q) {
10551
console.log(q)
10552
}
10553
if (5 == this.bulletType) {
10554
for (d = 0; d < b.length; d++) l = b[d], d != f && this.boxBoxCollision(this.pos.x - 2 * this.size.x, this.pos.y, 5 * this.size.x, this.size.y, l.pos.x, l.pos.y, l.size.x, l.size.y) && l.takeDamage(this.damage);
10555
this.kill();
10556
return
10557
}
10558
this.kill()
10559
}
10560
} else if (6 == this.bulletType) l.takeDamage(this.damage * ig.system.tick);
10561
else if (this.pointBoxCollision(this.pos.x, this.pos.y, l.pos.x, l.pos.y, l.size.x, l.size.y)) {
10562
this.hit = !0;
10563
l.takeDamage(this.damage);
10564
try {
10565
ig.soundHandler.playSound("hit")
10566
} catch (r) {
10567
console.log(r)
10568
}
10569
ig.game.spawnEntity(EntityGameEffect, this.pos.x, this.pos.y, {
10570
control: this.control,
10571
effectType: d
10572
});
10573
this.kill();
10574
return
10575
}
10576
}
10577
}
10578
f = this.control.background.ground;
10579
if (this.pos.y > f.pos.y + 10)
10580
if (1 == this.bulletType || 3 == this.bulletType || 5 == this.bulletType) {
10581
ig.game.spawnEntity(EntityGameEffect, this.pos.x, this.pos.y, {
10582
control: this.control,
10583
effectType: 1
10584
}).zIndex = f.zIndex - 1;
10585
if (5 == this.bulletType)
10586
for (d = 0; d < b.length; d++) l = b[d], this.boxBoxCollision(this.pos.x - 2 * this.size.x, this.pos.y, 5 * this.size.x, this.size.y, l.pos.x, l.pos.y, l.size.x, l.size.y) && l.takeDamage(this.damage);
10587
this.kill();
10588
try {
10589
ig.soundHandler.playSound("softexplosion")
10590
} catch (g) {
10591
console.log(g)
10592
}
10593
ig.game.sortEntitiesDeferred()
10594
} else this.kill()
10595
}
10596
},
10597
pointBoxCollision: function(b, c, d, e, f, l) {
10598
return b > d && b < d + f && c > e && c < e + l ? !0 : !1
10599
},
10600
boxBoxCollision: function(b, c, d, e, f, l, q, r) {
10601
return b + d > f && b < f + q && c + e > l && c < l + r ? !0 : !1
10602
}
10603
})
10604
});
10605
ig.baked = !0;
10606
ig.module("game.entities.game-screenshake").requires("impact.entity").defines(function() {
10607
EntityGameScreenshake = ig.Entity.extend({
10608
duration: 0.5,
10609
strength: 5,
10610
init: function(b, c, d) {
10611
this.parent(b, c, d);
10612
this.initShock();
10613
1 < ig.game.getEntitiesByType(EntityGameScreenshake).length && this.kill()
10614
},
10615
initShock: function() {
10616
this.shockTimer = new ig.Timer;
10617
this.shockTimer.set(this.duration)
10618
},
10619
resetShock: function() {
10620
this.shockTimer = null;
10621
ig.game.screen.x = 0;
10622
ig.game.screen.y = 0;
10623
this.kill()
10624
},
10625
shock: function() {
10626
var b = this.shockTimer.delta();
10627
if (-0.2 > b) {
10628
var c = this.strength * Math.pow(-b / this.duration, 2);
10629
0.5 < c && (ig.game.screen.x += Math.random().map(0, 1, -c, c), ig.game.screen.y += Math.random().map(0, 1, -c, c))
10630
}
10631
0 < b && this.resetShock()
10632
},
10633
update: function() {
10634
this.parent();
10635
this.shock()
10636
},
10637
draw: function() {
10638
this.parent()
10639
}
10640
})
10641
});
10642
ig.baked = !0;
10643
ig.module("game.entities.game-unit-enemy").requires("impact.entity", "game.entities.game-bullet", "game.entities.game-screenshake").defines(function() {
10644
EntityGameUnitEnemy = ig.Entity.extend({
10645
zIndex: 190,
10646
size: {
10647
x: 60,
10648
y: 60
10649
},
10650
type: ig.Entity.TYPE.B,
10651
control: null,
10652
unitAnimSheets: [new ig.AnimationSheet("media/graphics/game/unit/foe/pig/fire-run.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/foe/cow/fire-run.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/foe/monkey/fire-run.png", 160, 160), new ig.AnimationSheet("media/graphics/game/unit/foe/plane/idle.png", 190, 118), new ig.AnimationSheet("media/graphics/game/bullets/bomb.png", 119, 45)],
10653
unitAnims: [],
10654
barrelPos: [{
10655
x: 45,
10656
y: 86
10657
}, {
10658
x: 33,
10659
y: 14
10660
}, {
10661
x: 27,
10662
y: 81
10663
}, {
10664
x: 99,
10665
y: 89
10666
}, {
10667
x: 0,
10668
y: 0
10669
}],
10670
fireDamage: [5, 5, 5, 10, 0],
10671
ramDamage: [20, 20, 20, 20, 50],
10672
fireRange: 0,
10673
hp: 150,
10674
maxHp: 150,
10675
unitType: 0,
10676
relDrawPos: {
10677
x: 0,
10678
y: 0
10679
},
10680
moveVel: {
10681
x: 0,
10682
y: 0
10683
},
10684
hasShot: !1,
10685
isDead: !1,
10686
isDying: !1,
10687
dieTime: 0,
10688
hoverOffset: {
10689
x: 0,
10690
y: 0
10691
},
10692
minHover: {
10693
x: 0,
10694
y: 0
10695
},
10696
maxHover: {
10697
x: 0,
10698
y: 0
10699
},
10700
hoverDirection: {
10701
x: 0,
10702
y: 0
10703
},
10704
alpha: 1,
10705
spawnTime: 0,
10706
difficulty: 0,
10707
init: function(b, c, d) {
10708
this.parent(b, c, d);
10709
this.unitAnims.push(new ig.Animation(this.unitAnimSheets[0], 0.2, [0, 1, 2, 3]));
10710
this.unitAnims.push(new ig.Animation(this.unitAnimSheets[1], 0.2, [0, 1, 2, 3]));
10711
this.unitAnims.push(new ig.Animation(this.unitAnimSheets[2], 0.2, [0, 1, 2, 3]));
10712
this.unitAnims.push(new ig.Animation(this.unitAnimSheets[3], 1, [0, 1]));
10713
this.unitAnims.push(new ig.Animation(this.unitAnimSheets[4], 1, [0]));
10714
this.setPos(b, c);
10715
this.relDrawPos.x = 0.5 * -(this.unitAnims[this.unitType].sheet.width -
10716
this.size.x);
10717
this.relDrawPos.y = 0.5 * -(this.unitAnims[this.unitType].sheet.height - this.size.y);
10718
3 == this.unitType && (this.maxHp = this.hp = 120);
10719
4 == this.unitType ? (this.maxHp = this.hp = 20, this.zIndex = 170) : 3 == this.unitType && (this.zIndex = 170)
10720
},
10721
update: function() {
10722
this.parent();
10723
if (!ig.game.gamePaused)
10724
if (this.isDying) this.alpha -= 0.5 * ig.system.tick, 0 > this.alpha && (this.alpha = 0), this.pos.x += this.moveVel.x * ig.system.tick, this.pos.y += this.moveVel.y * ig.system.tick, 2 < this.control.gameTime - this.dieTime && this.kill();
10725
else if (this.pos.x += this.moveVel.x * ig.system.tick, this.pos.y += this.moveVel.y * ig.system.tick, 4 == this.unitType && (this.moveVel.y += 100 * ig.system.tick), 3 != this.unitType && this.unitAnims[this.unitType].update(), 0 >= this.hp) this.hp = 0, this.die();
10726
else if (0 > this.pos.x + this.relDrawPos.x + this.unitAnims[this.unitType].sheet.image.width) this.kill();
10727
else if (3 == this.unitType) {
10728
if (0 == this.unitAnims[this.unitType].frame && 300 >= this.pos.x) {
10729
this.unitAnims[this.unitType].gotoFrame(1);
10730
var b = this.pos.x + this.relDrawPos.x + this.barrelPos[this.unitType].x,
10731
c = this.pos.y + this.relDrawPos.y + this.barrelPos[this.unitType].y,
10732
d = ig.game.spawnEntity(EntityGameUnitEnemy, 0, 0, {
10733
control: this.control,
10734
unitType: 4
10735
});
10736
d.setPos(b, c);
10737
d.unitAnims[4].flip.x = !0;
10738
d.moveVel.x = -50;
10739
d.moveVel.y = 0;
10740
this.control.enemies.push(d)
10741
}
10742
} else if (this.touches(this.control.tank)) {
10743
this.die();
10744
b = this.ramDamage[this.unitType];
10745
0 < this.difficulty && (b += 0.25 * this.difficulty * this.ramDamage[this.unitType]);
10746
this.control.tank.takeDamage(b);
10747
ig.game.spawnEntity(EntityGameEffect, this.pos.x + this.size.x / 2, this.pos.y +
10748
this.size.y / 2, {
10749
control: this.control,
10750
effectType: 1
10751
});
10752
ig.game.spawnEntity(EntityGameScreenshake, 0, 0);
10753
try {
10754
ig.soundHandler.playSound("screenshake")
10755
} catch (e) {
10756
console.log(e)
10757
}
10758
} else this.hasShot ? 0 != this.unitAnims[this.unitType].frame && (this.hasShot = !1) : 0 == this.unitAnims[this.unitType].frame && (this.shoot(), this.hasShot = !0)
10759
},
10760
draw: function() {
10761
this.parent();
10762
var b = -ig.game.screen.x + this.pos.x + this.relDrawPos.x,
10763
c = -ig.game.screen.y + this.pos.y + this.relDrawPos.y;
10764
this.isDying && (ig.system.context.globalAlpha = this.alpha);
10765
this.unitAnims[this.unitType].draw(b, c);
10766
if (this.isDying) ig.system.context.globalAlpha = 1;
10767
else {
10768
var d = this.hp / this.maxHp,
10769
e = this.size.x,
10770
b = this.pos.x,
10771
c = this.pos.y - 8 - 40;
10772
3 == this.unitType && (c += 23);
10773
4 == this.unitType && (c += 40);
10774
ig.system.context.fillStyle = "#000000";
10775
ig.system.context.fillRect(b, c, e, 6);
10776
e = (this.size.x - 2) * d;
10777
ig.system.context.fillStyle = 0.25 > d ? "#FF0000" : 0.5 > d ? "#FFFF00" : "#00FF00";
10778
ig.system.context.fillRect(b + 1, c + 1, e, 4)
10779
}
10780
},
10781
clicked: function() {},
10782
kill: function() {
10783
this.parent();
10784
this.isDead = !0;
10785
this.control.refreshEnemyListDeferred()
10786
},
10787
die: function() {
10788
this.isDying || (this.isDying = !0, 0 <= this.unitType && 2 >= this.unitType ? (this.alpha = 0.5, this.moveVel.x = -15, this.moveVel.y = -100, this.dieTime = this.control.gameTime, this.unitAnims[this.unitType].gotoFrame(3)) : (ig.game.spawnEntity(EntityGameEffect, this.pos.x + this.size.x / 2, this.pos.y + this.size.y / 2, {
10789
control: this.control,
10790
effectType: 1
10791
}), this.kill()), this.isDead = !0, this.control.refreshEnemyListDeferred())
10792
},
10793
setPos: function(b, c) {
10794
this.pos.x = b - 0.5 * this.size.x;
10795
this.pos.y = c - 0.5 * this.size.y
10796
},
10797
shoot: function() {
10798
if (!(this.pos.x +
10799
this.relDrawPos.x + this.barrelPos[this.unitType].x - 20 > ig.system.width) && 0 != this.fireDamage[this.unitType]) {
10800
var b = this.control.tank.pos.x + this.control.tank.size.x / 2 - 10 + 20 * Math.random(),
10801
c = this.control.tank.pos.y + this.control.tank.size.y / 2 - 10 + 20 * Math.random();
10802
if (!(0 < this.fireRange && Math.abs(this.pos.x - b) > this.fireRange)) {
10803
var d = this.pos.x + this.relDrawPos.x + this.barrelPos[this.unitType].x,
10804
e = this.pos.y + this.relDrawPos.y + this.barrelPos[this.unitType].y,
10805
f = 2;
10806
1 == this.unitType && (f = 1);
10807
d = ig.game.spawnEntity(EntityGameBullet, d, e, {
10808
control: this.control,
10809
bulletType: f
10810
});
10811
d.sourceType = 2;
10812
d.targetType = 0;
10813
d.startVel = 500;
10814
d.damage = this.fireDamage[this.unitType];
10815
0 < this.difficulty && (d.damage += 0.25 * this.difficulty * this.fireDamage[this.unitType]);
10816
d.setTarget(b, c);
10817
d.zIndex = this.zIndex - 1;
10818
1 == this.unitType && (d.pos.x = 0 > d.moveVel.x ? d.pos.x - 13 : d.pos.x + 13);
10819
if (0 == this.unitType) try {
10820
ig.soundHandler.playSound("shot")
10821
} catch (l) {
10822
console.log(l)
10823
} else if (1 == this.unitType) try {
10824
ig.soundHandler.playSound("projectileshoot")
10825
} catch (q) {
10826
console.log(q)
10827
} else if (2 == this.unitType) try {
10828
ig.soundHandler.playSound("shot")
10829
} catch (r) {
10830
console.log(r)
10831
}
10832
ig.game.sortEntitiesDeferred()
10833
}
10834
}
10835
},
10836
takeDamage: function(b) {
10837
if (!(0 >= this.hp) && (this.hp -= b, 0 >= this.hp && (this.hp = 0, 4 != this.unitType))) {
10838
this.control.coinsCollected += 3;
10839
try {
10840
ig.soundHandler.playSound("coins")
10841
} catch (c) {
10842
console.log(c)
10843
}
10844
}
10845
}
10846
})
10847
});
10848
ig.baked = !0;
10849
ig.module("game.entities.game-unit-enemy-boss").requires("impact.entity", "game.entities.game-bullet").defines(function() {
10850
EntityGameUnitEnemyBoss = ig.Entity.extend({
10851
zIndex: 180,
10852
size: {
10853
x: 150,
10854
y: 150
10855
},
10856
type: ig.Entity.TYPE.B,
10857
control: null,
10858
bossAnims: [new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/foe/pig-boss/idle.png", 320, 320), 0.2, [0, 1, 2]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/foe/cow-boss/idle.png", 320, 320), 0.2, [0, 1, 2]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/foe/monkey-boss/idle.png", 320, 320), 0.2, [0, 1, 2])],
10859
bossFireAnims: [new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/foe/pig-boss/fire.png", 320, 320), 0.2, [0, 1, 2, 3, 4, 5, 6, 7]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/foe/cow-boss/fire.png", 320, 320), 0.2, [0, 1, 2]), new ig.Animation(new ig.AnimationSheet("media/graphics/game/unit/foe/monkey-boss/fire.png", 320, 320), 0.2, [0, 1, 2])],
10860
barrelPos: [
10861
[{
10862
x: 116,
10863
y: 212
10864
}, {
10865
x: 98,
10866
y: 212
10867
}, {
10868
x: 77,
10869
y: 212
10870
}], {
10871
x: 98,
10872
y: 244
10873
}, {
10874
x: 99,
10875
y: 203
10876
}
10877
],
10878
fireRange: 0,
10879
refireRate: [0.2, 0.5, 1],
10880
fireDamage: [30, 40, 20],
10881
refireDelay: [],
10882
fireSequence: 0,
10883
hp: 2E3,
10884
maxHp: 2E3,
10885
bossType: 0,
10886
relDrawPos: {
10887
x: 0,
10888
y: 0
10889
},
10890
hoverOffset: {
10891
x: 0,
10892
y: 0
10893
},
10894
minHover: {
10895
x: -10,
10896
y: -10
10897
},
10898
maxHover: {
10899
x: 10,
10900
y: 10
10901
},
10902
hoverDirection: {
10903
x: 5,
10904
y: 5
10905
},
10906
moveVel: {
10907
x: 0,
10908
y: 0
10909
},
10910
lastShotTime: 0,
10911
isBoss: !0,
10912
isFiring: !1,
10913
isDead: !1,
10914
isDying: !1,
10915
alpha: 1,
10916
spawnTime: 0,
10917
difficulty: 0,
10918
init: function(b, c, d) {
10919
this.parent(b, c, d);
10920
this.setPos(b, c);
10921
this.relDrawPos.x = 0.5 * -(this.bossAnims[this.bossType].sheet.width - this.size.x);
10922
this.relDrawPos.y = 0.5 * -(this.bossAnims[this.bossType].sheet.height - this.size.y);
10923
for (b = 0; b < this.refireRate.length; b++) this.refireDelay.push(1 / this.refireRate[b]);
10924
this.minHover.x = -10 * Math.random();
10925
this.minHover.y = -10 * Math.random();
10926
this.maxHover.x = 10 * Math.random();
10927
this.maxHover.y = 10 * Math.random();
10928
0.5 <= Math.random() && (this.hoverDirection.x *= -1);
10929
0.5 <= Math.random() && (this.hoverDirection.y *= -1)
10930
},
10931
update: function() {
10932
this.parent();
10933
ig.game.gamePaused || (this.pos.x += this.moveVel.x * ig.system.tick, this.pos.y += this.moveVel.y * ig.system.tick, 380 >= this.pos.x + this.size.x / 2 && (this.pos.x = 380 - this.size.x / 2, this.moveVel.x = 0), this.hoverOffset.x += this.hoverDirection.x * ig.system.tick, this.hoverOffset.y += this.hoverDirection.y * ig.system.tick, this.hoverOffset.x >= this.maxHover.x ? (this.hoverOffset.x = this.maxHover.x, this.hoverDirection.x *= -1, this.minHover.x = -10 * Math.random()) : this.hoverOffset.x <= this.minHover.x && (this.hoverOffset.x = this.minHover.x, this.hoverDirection.x *= -1, this.maxHover.x = 10 * Math.random()), this.hoverOffset.y >= this.maxHover.y ? (this.hoverOffset.y = this.maxHover.y, this.hoverDirection.y *= -1, this.minHover.y = -10 * Math.random()) : this.hoverOffset.y <= this.minHover.y && (this.hoverOffset.y = this.minHover.y, this.hoverDirection.y *= -1, this.maxHover.y = 10 * Math.random()), this.bossAnims[this.bossType].update(), 0 >= this.hp ? (this.hp = 0, this.kill(), ig.game.spawnEntity(EntityGameEffect, this.pos.x + this.size.x / 2, this.pos.y + this.size.y / 2, {
10934
control: this.control,
10935
effectType: 1
10936
})) : this.isFiring ? (this.bossFireAnims[this.bossType].update(), 1 <= this.bossFireAnims[this.bossType].loopCount ? this.control.gameTime - this.lastShotTime > this.refireDelay[this.bossType] ? this.shoot() : (this.isFiring = !1, this.bossAnims[this.bossType].rewind()) : 0 == this.bossType && (1 == this.fireSequence && 3 == this.bossFireAnims[0].frame && this.shoot(), 2 == this.fireSequence && 6 == this.bossFireAnims[0].frame && this.shoot())) : this.control.gameTime - this.lastShotTime > this.refireDelay[this.bossType] && (this.fireSequence = 0, this.bossFireAnims[this.bossType].rewind(), this.shoot()))
10937
},
10938
draw: function() {
10939
this.parent();
10940
var b = -ig.game.screen.x + this.pos.x + this.relDrawPos.x + this.hoverOffset.x,
10941
c = -ig.game.screen.y +
10942
this.pos.y + this.relDrawPos.y + this.hoverOffset.y;
10943
this.isFiring ? this.bossFireAnims[this.bossType].draw(b, c) : this.bossAnims[this.bossType].draw(b, c);
10944
var d = this.hp / this.maxHp,
10945
e = this.size.x,
10946
b = this.pos.x + this.hoverOffset.x,
10947
c = this.pos.y + this.hoverOffset.y - 8 - 40;
10948
ig.system.context.fillStyle = "#000000";
10949
ig.system.context.fillRect(b, c, e, 6);
10950
e = (this.size.x - 2) * d;
10951
ig.system.context.fillStyle = 0.25 > d ? "#FF0000" : 0.5 > d ? "#FFFF00" : "#00FF00";
10952
ig.system.context.fillRect(b + 1, c + 1, e, 4)
10953
},
10954
clicked: function() {},
10955
kill: function() {
10956
this.parent();
10957
this.isDead = !0;
10958
this.control.refreshEnemyListDeferred()
10959
},
10960
setPos: function(b, c) {
10961
this.pos.x = b - 0.5 * this.size.x;
10962
this.pos.y = c - 0.5 * this.size.y
10963
},
10964
shoot: function() {
10965
var b = this.control.tank.pos.x + this.control.tank.size.x / 2 - 10 + 20 * Math.random(),
10966
c = this.control.tank.pos.y + this.control.tank.size.y / 2 - 10 + 20 * Math.random();
10967
if (!(0 < this.fireRange && Math.abs(this.pos.x - b) > this.fireRange)) {
10968
var d = 0,
10969
e = 0;
10970
if (0 == this.bossType) {
10971
d = this.pos.x + this.relDrawPos.x + this.barrelPos[0][this.fireSequence].x + this.hoverOffset.x;
10972
e = this.pos.y +
10973
this.relDrawPos.y + this.barrelPos[0][this.fireSequence].y + this.hoverOffset.y;
10974
d = ig.game.spawnEntity(EntityGameBullet, d, e, {
10975
control: this.control,
10976
bulletType: 3
10977
});
10978
d.sourceType = 3;
10979
d.targetType = 0;
10980
d.startVel = 500;
10981
d.setTarget(b, c);
10982
d.damage = this.fireDamage[this.bossType];
10983
0 < this.difficulty && (d.damage += 0.25 * this.difficulty * this.fireDamage[this.bossType]);
10984
this.isFiring = !0;
10985
this.lastShotTime = this.control.gameTime;
10986
ig.game.sortEntitiesDeferred();
10987
this.fireSequence += 1;
10988
try {
10989
ig.soundHandler.playSound("bosscannon")
10990
} catch (f) {
10991
console.log(f)
10992
}
10993
} else {
10994
d = this.pos.x + this.relDrawPos.x + this.barrelPos[this.bossType].x + this.hoverOffset.x;
10995
e = this.pos.y + this.relDrawPos.y + this.barrelPos[this.bossType].y + this.hoverOffset.y;
10996
d = ig.game.spawnEntity(EntityGameBullet, d, e, {
10997
control: this.control,
10998
bulletType: 3
10999
});
11000
d.sourceType = 3;
11001
d.targetType = 0;
11002
d.startVel = 500;
11003
d.setTarget(b, c);
11004
d.damage = this.fireDamage[this.bossType];
11005
0 < this.difficulty && (d.damage += 0.25 * this.difficulty * this.fireDamage[this.bossType]);
11006
this.isFiring = !0;
11007
this.lastShotTime = this.control.gameTime;
11008
ig.game.sortEntitiesDeferred();
11009
try {
11010
ig.soundHandler.playSound("bosscannon")
11011
} catch (l) {
11012
console.log(l)
11013
}
11014
}
11015
}
11016
},
11017
takeDamage: function(b) {
11018
if (!(0 >= this.hp) && (this.hp -= b, 0 >= this.hp)) {
11019
this.hp = 0;
11020
this.control.coinsCollected += 10;
11021
try {
11022
ig.soundHandler.playSound("coins")
11023
} catch (c) {
11024
console.log(c)
11025
}
11026
}
11027
}
11028
})
11029
});
11030
ig.baked = !0;
11031
ig.module("game.entities.game-control").requires("impact.entity", "game.entities.game-bg", "game.entities.game-ui", "game.entities.game-tank", "game.entities.game-unit-enemy", "game.entities.game-unit-enemy-boss").defines(function() {
11032
EntityGameControl = ig.Entity.extend({
11033
zIndex: 1E3,
11034
background: null,
11035
ui: null,
11036
tank: null,
11037
pauseScreen: null,
11038
isPaused: !1,
11039
distanceTravelled: 0,
11040
coinsCollected: 0,
11041
enemies: [],
11042
gameTime: 0,
11043
waveSet: null,
11044
easyWaves: [],
11045
easyBossWaves: [],
11046
mediumWaves: [],
11047
mediumBossWaves: [],
11048
hardWaves: [],
11049
hardBossWaves: [],
11050
impossibleWaves: [],
11051
impossibleBossWaves: [],
11052
init: function(b, c, d) {
11053
this.parent(b, c, d);
11054
ig.global.wm || (this.background = ig.game.spawnEntity(EntityGameBg, 0, 0, {
11055
control: this
11056
}), this.tank = ig.game.spawnEntity(EntityGameTank, -10, 345, {
11057
tankType: ig.game.tankType,
11058
control: this
11059
}), this.ui = ig.game.spawnEntity(EntityGameUi, 0, 0, {
11060
control: this
11061
}), ig.game.sortEntitiesDeferred());
11062
this.initWaves();
11063
this.waveSet = this.generateEnemyWaveSet();
11064
this.waveSet.startSpawn();
11065
ig.game.lastGameDistance = 0;
11066
ig.game.lastGameCoins = 0;
11067
ig.game.lastGameXP = 0
11068
},
11069
update: function() {
11070
this.parent();
11071
if (!this.isPaused && (this.distanceTravelled += 0.5 * ig.system.tick, this.gameTime += ig.system.tick, this.waveSet.update(), 0 >= this.enemies.length && (!1 == this.waveSet.isSpawning && this.waveSet.waves[this.waveSet.currentWave].isBossWave) && (this.waveSet = this.generateEnemyWaveSet(), this.waveSet.waves[0].delay = 2, this.waveSet.startSpawn()), !1 == this.waveSet.isSpawning && 1 == this.enemies.length && this.enemies[0].isBoss))
11072
if (30 > this.distanceTravelled) {
11073
if (30 < this.gameTime - this.enemies[0].spawnTime) {
11074
this.waveSet.waves = [];
11075
var b = Math.floor(Math.random() * this.easyWaves.length);
11076
this.waveSet.addWave(this.easyWaves[b]);
11077
this.waveSet.waves[0].isBossWave = !0;
11078
this.waveSet.waves[0].endDelay *= 2;
11079
this.waveSet.startSpawn()
11080
}
11081
} else 150 > this.distanceTravelled ? 20 < this.gameTime - this.enemies[0].spawnTime && (this.waveSet.waves = [], b = Math.floor(Math.random() * this.mediumWaves.length), this.waveSet.addWave(this.mediumWaves[b]), this.waveSet.waves[0].isBossWave = !0, this.waveSet.waves[0].endDelay *= 2, this.waveSet.startSpawn()) : 300 > this.distanceTravelled ? 10 < this.gameTime - this.enemies[0].spawnTime && (this.waveSet.waves = [], b = Math.floor(Math.random() * this.hardWaves.length), this.waveSet.addWave(this.hardWaves[b]), this.waveSet.waves[0].isBossWave = !0, this.waveSet.waves[0].endDelay *= 2, this.waveSet.startSpawn()) : 5 < this.gameTime - this.enemies[0].spawnTime && (this.waveSet.waves = [], b = Math.floor(Math.random() * this.impossibleWaves.length), this.waveSet.addWave(this.impossibleWaves[b]), this.waveSet.waves[0].isBossWave = !0, this.waveSet.waves[0].endDelay *= 2, this.waveSet.startSpawn());
11082
0 < this.tank.deferredHealAmt && (this.tank.healDamage(this.tank.deferredHealAmt), this.tank.deferredHealAmt = 0);
11083
this.deferEnemyListRefresh && (this.refreshEnemyList(), this.deferEnemyListRefresh = !1)
11084
},
11085
pauseGame: function() {
11086
this.isPaused = !0;
11087
ig.game.gamePaused = !0;
11088
this.pauseScreen = ig.game.spawnEntity(EntityGameUIPause, 0, 0, {
11089
control: this
11090
});
11091
this.pauseScreen.ready()
11092
},
11093
unpauseGame: function() {
11094
this.isPaused = !1;
11095
ig.game.gamePaused = !1;
11096
this.pauseScreen && (this.pauseScreen.kill(), this.pauseScreen = null)
11097
},
11098
endGame: function() {
11099
ig.game.lastGameDistance = Math.floor(this.distanceTravelled);
11100
ig.game.lastGameCoins = Math.floor(this.coinsCollected);
11101
ig.game.lastGameXP = Math.floor(this.coinsCollected / 10);
11102
ig.game.totalCoins += ig.game.lastGameCoins;
11103
ig.game.addXP(ig.game.lastGameXP);
11104
ig.game.setLocalStorage();
11105
this.unpauseGame();
11106
ig.game.director.loadLevel(3)
11107
},
11108
hideGuide: function() {
11109
this.ui.front.showGuide = !1
11110
},
11111
spawnEnemyUnitWave: function() {},
11112
refreshEnemyList: function() {
11113
for (var b = [], c = 0; c < this.enemies.length; c++)(null == this.enemies[c] || this.enemies[c].isDead) && b.push(c);
11114
for (c = b.length - 1; 0 <= c; c--) this.enemies.splice(b[c], 1)
11115
},
11116
refreshEnemyListDeferred: function() {
11117
this.deferEnemyListRefresh = !0
11118
},
11119
generateEnemyWaveSet: function() {
11120
var b = new EnemyWaveSet(this);
11121
if (30 > this.distanceTravelled) {
11122
for (var c = [], d = 0; d < this.easyWaves.length; d++) c.push(d);
11123
for (d = 0; 5 > d; d++) {
11124
var e = Math.floor(Math.random() * c.length);
11125
b.addWave(this.easyWaves[c[e]]);
11126
c.splice(e, 1)
11127
}
11128
e = Math.floor(Math.random() * this.easyBossWaves.length);
11129
b.addWave(this.easyBossWaves[e])
11130
} else if (150 > this.distanceTravelled) {
11131
c = [];
11132
for (d = 0; d < this.mediumWaves.length; d++) c.push(d);
11133
for (d = 0; 6 > d; d++) e = Math.floor(Math.random() * c.length), b.addWave(this.mediumWaves[c[e]]), c.splice(e, 1);
11134
e = Math.floor(Math.random() * this.mediumBossWaves.length);
11135
b.addWave(this.mediumBossWaves[e])
11136
} else if (300 > this.distanceTravelled) {
11137
c = [];
11138
for (d = 0; d < this.hardWaves.length; d++) c.push(d);
11139
for (d = 0; 6 > d; d++) e = Math.floor(Math.random() * c.length), b.addWave(this.hardWaves[c[e]]), c.splice(e, 1);
11140
e = Math.floor(Math.random() * this.hardBossWaves.length);
11141
b.addWave(this.hardBossWaves[e])
11142
} else {
11143
c = [];
11144
for (d = 0; d < this.impossibleWaves.length; d++) c.push(d);
11145
for (d = 0; 6 > d; d++) e = Math.floor(Math.random() * c.length), b.addWave(this.impossibleWaves[c[e]]), c.splice(e, 1);
11146
e = Math.floor(Math.random() * this.impossibleBossWaves.length);
11147
b.addWave(this.impossibleBossWaves[e])
11148
}
11149
return b
11150
},
11151
initWaves: function() {
11152
var b = null,
11153
b = new EnemyWave(this);
11154
b.addSpawn(new EnemySpawn(this, 0, 0, 0, {
11155
x: 540,
11156
y: 428
11157
}, {
11158
x: -25,
11159
y: 0
11160
}, 0));
11161
b.addSpawn(new EnemySpawn(this, 3, 0, 0, {
11162
x: 540,
11163
y: 428
11164
}, {
11165
x: -25,
11166
y: 0
11167
}, 0));
11168
b.endDelay = 6;
11169
this.easyWaves.push(b);
11170
this.easyWaves.push(b);
11171
b = new EnemyWave(this);
11172
b.addSpawn(new EnemySpawn(this, 0, 0, 1, {
11173
x: 540,
11174
y: 428
11175
}, {
11176
x: -25,
11177
y: 0
11178
}, 0));
11179
b.addSpawn(new EnemySpawn(this, 3, 0, 1, {
11180
x: 540,
11181
y: 428
11182
}, {
11183
x: -25,
11184
y: 0
11185
}, 0));
11186
b.endDelay = 6;
11187
this.easyWaves.push(b);
11188
this.easyWaves.push(b);
11189
b = new EnemyWave(this);
11190
b.addSpawn(new EnemySpawn(this, 0, 0, 2, {
11191
x: 540,
11192
y: 428
11193
}, {
11194
x: -25,
11195
y: 0
11196
}, 0));
11197
b.addSpawn(new EnemySpawn(this, 3, 0, 2, {
11198
x: 540,
11199
y: 428
11200
}, {
11201
x: -25,
11202
y: 0
11203
}, 0));
11204
b.endDelay = 6;
11205
this.easyWaves.push(b);
11206
this.easyWaves.push(b);
11207
b = new EnemyWave(this);
11208
b.delay = 4;
11209
b.addSpawn(new EnemySpawn(this, 0, 1, 0, {
11210
x: 620,
11211
y: 225
11212
}, {
11213
x: -40,
11214
y: 0
11215
}, 4, 0));
11216
b.endDelay = 6;
11217
this.easyBossWaves.push(b);
11218
b = new EnemyWave(this);
11219
b.delay = 4;
11220
b.addSpawn(new EnemySpawn(this, 0, 1, 1, {
11221
x: 620,
11222
y: 225
11223
}, {
11224
x: -40,
11225
y: 0
11226
}, 4, 0));
11227
b.endDelay = 6;
11228
this.easyBossWaves.push(b);
11229
b = new EnemyWave(this);
11230
b.delay = 4;
11231
b.addSpawn(new EnemySpawn(this, 0, 1, 2, {
11232
x: 620,
11233
y: 225
11234
}, {
11235
x: -40,
11236
y: 0
11237
}, 4, 0));
11238
b.endDelay = 6;
11239
this.easyBossWaves.push(b);
11240
b = new EnemyWave(this);
11241
b.addSpawn(new EnemySpawn(this, 0, 0, 0, {
11242
x: 540,
11243
y: 428
11244
}, {
11245
x: -30,
11246
y: 0
11247
}, 0, 1));
11248
b.addSpawn(new EnemySpawn(this, 3, 0, 0, {
11249
x: 540,
11250
y: 428
11251
}, {
11252
x: -30,
11253
y: 0
11254
}, 0, 1));
11255
b.addSpawn(new EnemySpawn(this, 6, 0, 0, {
11256
x: 540,
11257
y: 428
11258
}, {
11259
x: -30,
11260
y: 0
11261
}, 0, 1));
11262
b.endDelay = 6;
11263
this.mediumWaves.push(b);
11264
this.mediumWaves.push(b);
11265
b = new EnemyWave(this);
11266
b.addSpawn(new EnemySpawn(this, 0, 0, 1, {
11267
x: 540,
11268
y: 428
11269
}, {
11270
x: -30,
11271
y: 0
11272
}, 0, 1));
11273
b.addSpawn(new EnemySpawn(this, 3, 0, 1, {
11274
x: 540,
11275
y: 428
11276
}, {
11277
x: -30,
11278
y: 0
11279
}, 0, 1));
11280
b.addSpawn(new EnemySpawn(this, 6, 0, 1, {
11281
x: 540,
11282
y: 428
11283
}, {
11284
x: -30,
11285
y: 0
11286
}, 0, 1));
11287
b.endDelay = 6;
11288
this.mediumWaves.push(b);
11289
this.mediumWaves.push(b);
11290
b = new EnemyWave(this);
11291
b.addSpawn(new EnemySpawn(this, 0, 0, 2, {
11292
x: 540,
11293
y: 428
11294
}, {
11295
x: -30,
11296
y: 0
11297
}, 0, 1));
11298
b.addSpawn(new EnemySpawn(this, 3, 0, 2, {
11299
x: 540,
11300
y: 428
11301
}, {
11302
x: -30,
11303
y: 0
11304
}, 0, 1));
11305
b.addSpawn(new EnemySpawn(this, 6, 0, 2, {
11306
x: 540,
11307
y: 428
11308
}, {
11309
x: -30,
11310
y: 0
11311
}, 0, 1));
11312
b.endDelay = 6;
11313
this.mediumWaves.push(b);
11314
this.mediumWaves.push(b);
11315
b = new EnemyWave(this);
11316
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11317
x: 560,
11318
y: 120
11319
}, {
11320
x: -50,
11321
y: 0
11322
}, 0, 1));
11323
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11324
x: 560,
11325
y: 120
11326
}, {
11327
x: -50,
11328
y: 0
11329
}, 0, 1));
11330
b.endDelay = 6;
11331
this.mediumWaves.push(b);
11332
this.mediumWaves.push(b);
11333
b = new EnemyWave(this);
11334
b.delay = 4;
11335
b.addSpawn(new EnemySpawn(this, 0, 1, 0, {
11336
x: 620,
11337
y: 225
11338
}, {
11339
x: -40,
11340
y: 0
11341
}, 4, 1));
11342
b.endDelay = 6;
11343
this.mediumBossWaves.push(b);
11344
b = new EnemyWave(this);
11345
b.delay = 4;
11346
b.addSpawn(new EnemySpawn(this, 0, 1, 1, {
11347
x: 620,
11348
y: 225
11349
}, {
11350
x: -40,
11351
y: 0
11352
}, 4, 1));
11353
b.endDelay = 6;
11354
this.mediumBossWaves.push(b);
11355
b = new EnemyWave(this);
11356
b.delay = 4;
11357
b.addSpawn(new EnemySpawn(this, 0, 1, 2, {
11358
x: 620,
11359
y: 225
11360
}, {
11361
x: -40,
11362
y: 0
11363
}, 4, 1));
11364
b.endDelay = 6;
11365
this.mediumBossWaves.push(b);
11366
b = new EnemyWave(this);
11367
b.addSpawn(new EnemySpawn(this, 0, 0, 0, {
11368
x: 540,
11369
y: 428
11370
}, {
11371
x: -35,
11372
y: 0
11373
}, 0, 2));
11374
b.addSpawn(new EnemySpawn(this, 3, 0, 0, {
11375
x: 540,
11376
y: 428
11377
}, {
11378
x: -35,
11379
y: 0
11380
}, 0, 2));
11381
b.addSpawn(new EnemySpawn(this, 6, 0, 0, {
11382
x: 540,
11383
y: 428
11384
}, {
11385
x: -35,
11386
y: 0
11387
}, 0, 2));
11388
b.addSpawn(new EnemySpawn(this, 9, 0, 0, {
11389
x: 540,
11390
y: 428
11391
}, {
11392
x: -35,
11393
y: 0
11394
}, 0, 2));
11395
b.endDelay = 6;
11396
this.hardWaves.push(b);
11397
this.hardWaves.push(b);
11398
b = new EnemyWave(this);
11399
b.addSpawn(new EnemySpawn(this, 0, 0, 1, {
11400
x: 540,
11401
y: 428
11402
}, {
11403
x: -35,
11404
y: 0
11405
}, 0, 2));
11406
b.addSpawn(new EnemySpawn(this, 3, 0, 1, {
11407
x: 540,
11408
y: 428
11409
}, {
11410
x: -35,
11411
y: 0
11412
}, 0, 2));
11413
b.addSpawn(new EnemySpawn(this, 6, 0, 1, {
11414
x: 540,
11415
y: 428
11416
}, {
11417
x: -35,
11418
y: 0
11419
}, 0, 2));
11420
b.addSpawn(new EnemySpawn(this, 9, 0, 1, {
11421
x: 540,
11422
y: 428
11423
}, {
11424
x: -35,
11425
y: 0
11426
}, 0, 2));
11427
b.endDelay = 6;
11428
this.hardWaves.push(b);
11429
this.hardWaves.push(b);
11430
b = new EnemyWave(this);
11431
b.addSpawn(new EnemySpawn(this, 0, 0, 2, {
11432
x: 540,
11433
y: 428
11434
}, {
11435
x: -35,
11436
y: 0
11437
}, 0, 2));
11438
b.addSpawn(new EnemySpawn(this, 3, 0, 2, {
11439
x: 540,
11440
y: 428
11441
}, {
11442
x: -35,
11443
y: 0
11444
}, 0, 2));
11445
b.addSpawn(new EnemySpawn(this, 6, 0, 2, {
11446
x: 540,
11447
y: 428
11448
}, {
11449
x: -35,
11450
y: 0
11451
}, 0, 2));
11452
b.addSpawn(new EnemySpawn(this, 9, 0, 2, {
11453
x: 540,
11454
y: 428
11455
}, {
11456
x: -35,
11457
y: 0
11458
}, 0, 2));
11459
b.endDelay = 6;
11460
this.hardWaves.push(b);
11461
this.hardWaves.push(b);
11462
b = new EnemyWave(this);
11463
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11464
x: 560,
11465
y: 120
11466
}, {
11467
x: -50,
11468
y: 0
11469
}, 0, 2));
11470
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11471
x: 560,
11472
y: 120
11473
}, {
11474
x: -50,
11475
y: 0
11476
}, 0, 2));
11477
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11478
x: 560,
11479
y: 120
11480
}, {
11481
x: -50,
11482
y: 0
11483
}, 0, 2));
11484
b.endDelay = 6;
11485
this.hardWaves.push(b);
11486
this.hardWaves.push(b);
11487
b = new EnemyWave(this);
11488
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11489
x: 560,
11490
y: 120
11491
}, {
11492
x: -50,
11493
y: 0
11494
}, 0, 2));
11495
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11496
x: 560,
11497
y: 120
11498
}, {
11499
x: -50,
11500
y: 0
11501
}, 0, 2));
11502
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11503
x: 560,
11504
y: 120
11505
}, {
11506
x: -50,
11507
y: 0
11508
}, 0, 2));
11509
b.addSpawn(new EnemySpawn(this, 0, 0, 2, {
11510
x: 540,
11511
y: 428
11512
}, {
11513
x: -35,
11514
y: 0
11515
}, 0, 2));
11516
b.addSpawn(new EnemySpawn(this, 3, 0, 2, {
11517
x: 540,
11518
y: 428
11519
}, {
11520
x: -35,
11521
y: 0
11522
}, 0, 2));
11523
b.addSpawn(new EnemySpawn(this, 6, 0, 2, {
11524
x: 540,
11525
y: 428
11526
}, {
11527
x: -35,
11528
y: 0
11529
}, 0, 2));
11530
b.endDelay = 6;
11531
this.hardWaves.push(b);
11532
b = new EnemyWave(this);
11533
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11534
x: 560,
11535
y: 120
11536
}, {
11537
x: -50,
11538
y: 0
11539
}, 0, 2));
11540
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11541
x: 560,
11542
y: 120
11543
}, {
11544
x: -50,
11545
y: 0
11546
}, 0, 2));
11547
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11548
x: 560,
11549
y: 120
11550
}, {
11551
x: -50,
11552
y: 0
11553
}, 0, 2));
11554
b.addSpawn(new EnemySpawn(this, 0, 0, 1, {
11555
x: 540,
11556
y: 428
11557
}, {
11558
x: -35,
11559
y: 0
11560
}, 0, 2));
11561
b.addSpawn(new EnemySpawn(this, 3, 0, 1, {
11562
x: 540,
11563
y: 428
11564
}, {
11565
x: -35,
11566
y: 0
11567
}, 0, 2));
11568
b.addSpawn(new EnemySpawn(this, 6, 0, 1, {
11569
x: 540,
11570
y: 428
11571
}, {
11572
x: -35,
11573
y: 0
11574
}, 0, 2));
11575
b.endDelay = 6;
11576
this.hardWaves.push(b);
11577
b = new EnemyWave(this);
11578
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11579
x: 560,
11580
y: 120
11581
}, {
11582
x: -50,
11583
y: 0
11584
}, 0, 2));
11585
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11586
x: 560,
11587
y: 120
11588
}, {
11589
x: -50,
11590
y: 0
11591
}, 0, 2));
11592
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11593
x: 560,
11594
y: 120
11595
}, {
11596
x: -50,
11597
y: 0
11598
}, 0, 2));
11599
b.addSpawn(new EnemySpawn(this, 0, 0, 0, {
11600
x: 540,
11601
y: 428
11602
}, {
11603
x: -35,
11604
y: 0
11605
}, 0, 2));
11606
b.addSpawn(new EnemySpawn(this, 3, 0, 0, {
11607
x: 540,
11608
y: 428
11609
}, {
11610
x: -35,
11611
y: 0
11612
}, 0, 2));
11613
b.addSpawn(new EnemySpawn(this, 6, 0, 0, {
11614
x: 540,
11615
y: 428
11616
}, {
11617
x: -35,
11618
y: 0
11619
}, 0, 2));
11620
b.endDelay = 6;
11621
this.hardWaves.push(b);
11622
b = new EnemyWave(this);
11623
b.delay = 4;
11624
b.addSpawn(new EnemySpawn(this, 0, 1, 0, {
11625
x: 620,
11626
y: 225
11627
}, {
11628
x: -40,
11629
y: 0
11630
}, 4, 2));
11631
b.endDelay = 6;
11632
this.hardBossWaves.push(b);
11633
b = new EnemyWave(this);
11634
b.delay = 4;
11635
b.addSpawn(new EnemySpawn(this, 0, 1, 1, {
11636
x: 620,
11637
y: 225
11638
}, {
11639
x: -40,
11640
y: 0
11641
}, 4, 2));
11642
b.endDelay = 6;
11643
this.hardBossWaves.push(b);
11644
b = new EnemyWave(this);
11645
b.delay = 4;
11646
b.addSpawn(new EnemySpawn(this, 0, 1, 2, {
11647
x: 620,
11648
y: 225
11649
}, {
11650
x: -40,
11651
y: 0
11652
}, 4, 2));
11653
b.endDelay = 6;
11654
this.hardBossWaves.push(b);
11655
b = new EnemyWave(this);
11656
b.addSpawn(new EnemySpawn(this, 0, 0, 0, {
11657
x: 540,
11658
y: 428
11659
}, {
11660
x: -35,
11661
y: 0
11662
}, 0, 3));
11663
b.addSpawn(new EnemySpawn(this, 2, 0, 0, {
11664
x: 540,
11665
y: 428
11666
}, {
11667
x: -35,
11668
y: 0
11669
}, 0, 3));
11670
b.addSpawn(new EnemySpawn(this, 4, 0, 0, {
11671
x: 540,
11672
y: 428
11673
}, {
11674
x: -35,
11675
y: 0
11676
}, 0, 3));
11677
b.addSpawn(new EnemySpawn(this, 6, 0, 0, {
11678
x: 540,
11679
y: 428
11680
}, {
11681
x: -35,
11682
y: 0
11683
}, 0, 3));
11684
b.addSpawn(new EnemySpawn(this, 8, 0, 0, {
11685
x: 540,
11686
y: 428
11687
}, {
11688
x: -35,
11689
y: 0
11690
}, 0, 3));
11691
b.endDelay = 4;
11692
this.impossibleWaves.push(b);
11693
this.impossibleWaves.push(b);
11694
b = new EnemyWave(this);
11695
b.addSpawn(new EnemySpawn(this, 0, 0, 1, {
11696
x: 540,
11697
y: 428
11698
}, {
11699
x: -35,
11700
y: 0
11701
}, 0, 3));
11702
b.addSpawn(new EnemySpawn(this, 2, 0, 1, {
11703
x: 540,
11704
y: 428
11705
}, {
11706
x: -35,
11707
y: 0
11708
}, 0, 3));
11709
b.addSpawn(new EnemySpawn(this, 4, 0, 1, {
11710
x: 540,
11711
y: 428
11712
}, {
11713
x: -35,
11714
y: 0
11715
}, 0, 3));
11716
b.addSpawn(new EnemySpawn(this, 6, 0, 1, {
11717
x: 540,
11718
y: 428
11719
}, {
11720
x: -35,
11721
y: 0
11722
}, 0, 3));
11723
b.addSpawn(new EnemySpawn(this, 8, 0, 1, {
11724
x: 540,
11725
y: 428
11726
}, {
11727
x: -35,
11728
y: 0
11729
}, 0, 3));
11730
b.endDelay = 4;
11731
this.impossibleWaves.push(b);
11732
this.impossibleWaves.push(b);
11733
b = new EnemyWave(this);
11734
b.addSpawn(new EnemySpawn(this, 0, 0, 2, {
11735
x: 540,
11736
y: 428
11737
}, {
11738
x: -35,
11739
y: 0
11740
}, 0, 3));
11741
b.addSpawn(new EnemySpawn(this, 2, 0, 2, {
11742
x: 540,
11743
y: 428
11744
}, {
11745
x: -35,
11746
y: 0
11747
}, 0, 3));
11748
b.addSpawn(new EnemySpawn(this, 4, 0, 2, {
11749
x: 540,
11750
y: 428
11751
}, {
11752
x: -35,
11753
y: 0
11754
}, 0, 3));
11755
b.addSpawn(new EnemySpawn(this, 6, 0, 2, {
11756
x: 540,
11757
y: 428
11758
}, {
11759
x: -35,
11760
y: 0
11761
}, 0, 3));
11762
b.addSpawn(new EnemySpawn(this, 8, 0, 2, {
11763
x: 540,
11764
y: 428
11765
}, {
11766
x: -35,
11767
y: 0
11768
}, 0, 3));
11769
b.endDelay = 4;
11770
this.impossibleWaves.push(b);
11771
this.impossibleWaves.push(b);
11772
b = new EnemyWave(this);
11773
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11774
x: 560,
11775
y: 120
11776
}, {
11777
x: -50,
11778
y: 0
11779
}, 0, 3));
11780
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11781
x: 560,
11782
y: 120
11783
}, {
11784
x: -50,
11785
y: 0
11786
}, 0, 3));
11787
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11788
x: 560,
11789
y: 120
11790
}, {
11791
x: -50,
11792
y: 0
11793
}, 0, 3));
11794
b.addSpawn(new EnemySpawn(this, 9, 0, 3, {
11795
x: 560,
11796
y: 120
11797
}, {
11798
x: -50,
11799
y: 0
11800
}, 0, 3));
11801
b.endDelay = 4;
11802
this.impossibleWaves.push(b);
11803
this.impossibleWaves.push(b);
11804
b = new EnemyWave(this);
11805
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11806
x: 560,
11807
y: 120
11808
}, {
11809
x: -50,
11810
y: 0
11811
}, 0, 3));
11812
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11813
x: 560,
11814
y: 120
11815
}, {
11816
x: -50,
11817
y: 0
11818
}, 0, 3));
11819
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11820
x: 560,
11821
y: 120
11822
}, {
11823
x: -50,
11824
y: 0
11825
}, 0, 3));
11826
b.addSpawn(new EnemySpawn(this, 0, 0, 2, {
11827
x: 540,
11828
y: 428
11829
}, {
11830
x: -35,
11831
y: 0
11832
}, 0, 3));
11833
b.addSpawn(new EnemySpawn(this, 2, 0, 2, {
11834
x: 540,
11835
y: 428
11836
}, {
11837
x: -35,
11838
y: 0
11839
}, 0, 3));
11840
b.addSpawn(new EnemySpawn(this, 4, 0, 2, {
11841
x: 540,
11842
y: 428
11843
}, {
11844
x: -35,
11845
y: 0
11846
}, 0, 3));
11847
b.addSpawn(new EnemySpawn(this, 6, 0, 2, {
11848
x: 540,
11849
y: 428
11850
}, {
11851
x: -35,
11852
y: 0
11853
}, 0, 3));
11854
b.endDelay = 4;
11855
this.impossibleWaves.push(b);
11856
b = new EnemyWave(this);
11857
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11858
x: 560,
11859
y: 120
11860
}, {
11861
x: -50,
11862
y: 0
11863
}, 0, 3));
11864
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11865
x: 560,
11866
y: 120
11867
}, {
11868
x: -50,
11869
y: 0
11870
}, 0, 3));
11871
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11872
x: 560,
11873
y: 120
11874
}, {
11875
x: -50,
11876
y: 0
11877
}, 0, 3));
11878
b.addSpawn(new EnemySpawn(this, 0, 0, 1, {
11879
x: 540,
11880
y: 428
11881
}, {
11882
x: -35,
11883
y: 0
11884
}, 0, 3));
11885
b.addSpawn(new EnemySpawn(this, 2, 0, 1, {
11886
x: 540,
11887
y: 428
11888
}, {
11889
x: -35,
11890
y: 0
11891
}, 0, 3));
11892
b.addSpawn(new EnemySpawn(this, 4, 0, 1, {
11893
x: 540,
11894
y: 428
11895
}, {
11896
x: -35,
11897
y: 0
11898
}, 0, 3));
11899
b.addSpawn(new EnemySpawn(this, 6, 0, 1, {
11900
x: 540,
11901
y: 428
11902
}, {
11903
x: -35,
11904
y: 0
11905
}, 0, 3));
11906
b.endDelay = 4;
11907
this.impossibleWaves.push(b);
11908
b = new EnemyWave(this);
11909
b.addSpawn(new EnemySpawn(this, 0, 0, 3, {
11910
x: 560,
11911
y: 120
11912
}, {
11913
x: -50,
11914
y: 0
11915
}, 0, 3));
11916
b.addSpawn(new EnemySpawn(this, 3, 0, 3, {
11917
x: 560,
11918
y: 120
11919
}, {
11920
x: -50,
11921
y: 0
11922
}, 0, 3));
11923
b.addSpawn(new EnemySpawn(this, 6, 0, 3, {
11924
x: 560,
11925
y: 120
11926
}, {
11927
x: -50,
11928
y: 0
11929
}, 0, 3));
11930
b.addSpawn(new EnemySpawn(this, 0, 0, 0, {
11931
x: 540,
11932
y: 428
11933
}, {
11934
x: -35,
11935
y: 0
11936
}, 0, 3));
11937
b.addSpawn(new EnemySpawn(this, 2, 0, 0, {
11938
x: 540,
11939
y: 428
11940
}, {
11941
x: -35,
11942
y: 0
11943
}, 0, 3));
11944
b.addSpawn(new EnemySpawn(this, 4, 0, 0, {
11945
x: 540,
11946
y: 428
11947
}, {
11948
x: -35,
11949
y: 0
11950
}, 0, 3));
11951
b.addSpawn(new EnemySpawn(this, 6, 0, 0, {
11952
x: 540,
11953
y: 428
11954
}, {
11955
x: -35,
11956
y: 0
11957
}, 0, 3));
11958
b.endDelay = 4;
11959
this.impossibleWaves.push(b);
11960
b = new EnemyWave(this);
11961
b.delay = 4;
11962
b.addSpawn(new EnemySpawn(this, 0, 1, 0, {
11963
x: 620,
11964
y: 225
11965
}, {
11966
x: -40,
11967
y: 0
11968
}, 4, 3));
11969
b.endDelay = 4;
11970
this.impossibleBossWaves.push(b);
11971
b = new EnemyWave(this);
11972
b.delay = 4;
11973
b.addSpawn(new EnemySpawn(this, 0, 1, 1, {
11974
x: 620,
11975
y: 225
11976
}, {
11977
x: -40,
11978
y: 0
11979
}, 4, 3));
11980
b.endDelay = 4;
11981
this.impossibleBossWaves.push(b);
11982
b = new EnemyWave(this);
11983
b.delay = 4;
11984
b.addSpawn(new EnemySpawn(this, 0, 1, 2, {
11985
x: 620,
11986
y: 225
11987
}, {
11988
x: -40,
11989
y: 0
11990
}, 4, 3));
11991
b.endDelay = 4;
11992
this.impossibleBossWaves.push(b)
11993
}
11994
});
11995
EnemySpawn = ig.Class.extend({
11996
control: null,
11997
time: 0,
11998
enemyType: 0,
11999
unitType: 0,
12000
pos: {
12001
x: 0,
12002
y: 0
12003
},
12004
move: {
12005
x: 0,
12006
y: 0
12007
},
12008
shootDelay: 0,
12009
difficulty: 0,
12010
zIndexOffset: 0,
12011
init: function(b, c, d, e, f, l, q, r) {
12012
this.control = b;
12013
this.time = c;
12014
this.enemyType = d;
12015
this.unitType = e;
12016
this.pos.x = f.x;
12017
this.pos.y = f.y;
12018
this.move.x = l.x;
12019
this.move.y = l.y;
12020
q && (this.shootDelay = q);
12021
r && (this.difficulty = r)
12022
},
12023
spawn: function() {
12024
if (0 == this.enemyType) {
12025
var b = ig.game.spawnEntity(EntityGameUnitEnemy, 0, 0, {
12026
control: this.control,
12027
unitType: this.unitType
12028
});
12029
b.setPos(this.pos.x, this.pos.y);
12030
b.moveVel.x = this.move.x;
12031
b.moveVel.y = this.move.y;
12032
b.lastShotTime = this.control.gameTime + this.shootDelay;
12033
b.zIndex += this.zIndexOffset;
12034
b.spawnTime = this.control.gameTime;
12035
b.difficulty = this.difficulty;
12036
b.maxHp += 0.5 * b.maxHp * this.difficulty;
12037
b.hp = b.maxHp;
12038
this.control.enemies.push(b)
12039
} else 1 == this.enemyType && (b = ig.game.spawnEntity(EntityGameUnitEnemyBoss, 0, 0, {
12040
control: this.control,
12041
bossType: this.unitType
12042
}), b.setPos(this.pos.x, this.pos.y), b.moveVel.x = this.move.x, b.moveVel.y = this.move.y, b.lastShotTime = this.control.gameTime + this.shootDelay, b.zIndex += this.zIndexOffset, b.spawnTime = this.control.gameTime, b.difficulty = this.difficulty, b.maxHp += 0.5 * b.maxHp * this.difficulty, b.hp = b.maxHp, this.control.enemies.push(b))
12043
}
12044
});
12045
EnemyWave = ig.Class.extend({
12046
control: null,
12047
startSpawnTime: 0,
12048
isSpawning: !1,
12049
isBossWave: !1,
12050
delay: 0,
12051
maxTime: 0,
12052
endDelay: 0,
12053
spawns: [],
12054
zIndexOffset: 0,
12055
init: function(b) {
12056
this.control = b
12057
},
12058
addSpawn: function(b) {
12059
b && (this.spawns.push(b), 1 == b.enemyType && (this.isBossWave = !0), b.time > this.maxTime && (this.maxTime = b.time))
12060
},
12061
update: function() {
12062
if (this.isSpawning) {
12063
var b = this.control.gameTime - this.spawnStartTime;
12064
if (!(b < this.delay)) {
12065
for (var b = b - this.delay, c = [], d = 0; d < this.spawns.length; d++) {
12066
var e = this.spawns[d];
12067
e.time <= b && (e.zIndexOffset = this.zIndexOffset, this.zIndexOffset += 2, e.spawn(), c.push(d))
12068
}
12069
for (b = c.length -
12070
1; 0 <= b; b--) this.spawns.splice(c[b], 1)
12071
}
12072
}
12073
},
12074
startSpawn: function() {
12075
this.spawnStartTime = this.control.gameTime;
12076
this.isSpawning = !0
12077
}
12078
});
12079
EnemyWaveSet = ig.Class.extend({
12080
control: null,
12081
startSpawnTime: 0,
12082
isSpawning: !1,
12083
delay: 0,
12084
waves: [],
12085
currentWave: 0,
12086
init: function(b) {
12087
this.control = b
12088
},
12089
addWave: function(b) {
12090
if (b) {
12091
var c = new EnemyWave(this.control);
12092
c.delay = b.delay;
12093
for (var d = 0; d < b.spawns.length; d++) c.addSpawn(b.spawns[d]);
12094
c.endDelay = b.endDelay;
12095
this.waves.push(c)
12096
}
12097
},
12098
update: function() {
12099
this.isSpawning && (this.currentWave >= this.waves.length ? this.isSpawning = !1 : (this.waves[this.currentWave].update(), this.control.gameTime - this.spawnStartTime > this.waves[this.currentWave].delay + this.waves[this.currentWave].maxTime + this.waves[this.currentWave].endDelay && (this.currentWave + 1 >= this.waves.length ? this.isSpawning = !1 : (this.currentWave += 1, this.spawnStartTime = this.control.gameTime, this.waves[this.currentWave].startSpawn()))))
12100
},
12101
startSpawn: function() {
12102
0 == this.waves.length ? this.isSpawning = !1 : (this.currentWave = 0, this.spawnStartTime = this.control.gameTime, this.isSpawning = !0, this.waves[this.currentWave].startSpawn())
12103
}
12104
})
12105
});
12106
ig.baked = !0;
12107
ig.module("game.levels.game").requires("impact.image", "game.entities.game-control", "game.entities.pointer-selector").defines(function() {
12108
LevelGame = {
12109
entities: [{
12110
type: "EntityGameControl",
12111
x: -4,
12112
y: -28
12113
}, {
12114
type: "EntityPointerSelector",
12115
x: -4,
12116
y: -48
12117
}],
12118
layer: []
12119
}
12120
});
12121
ig.baked = !0;
12122
ig.module("game.main").requires("impact.game", "plugins.splash-loader", "plugins.tween", "plugins.url-parameters", "plugins.jukebox", "plugins.director", "plugins.impact-storage", "plugins.storage-manager", "plugins.branding.splash", "plugins.lagged-api", "game.entities.branding-logo-placeholder", "game.entities.branding-logo", "game.entities.button-more-games", "game.entities.opening-kitty", "game.entities.pointer", "game.entities.pointer-selector", "game.entities.select", "game.levels.opening", "game.levels.mainmenu", "game.levels.results", "game.levels.game").defines(function() {
12123
this.START_OBFUSCATION;
12124
this.FRAMEBREAKER;
12125
MyGame = ig.Game.extend({
12126
gamePaused: !1,
12127
musicVolume: 0.4,
12128
lastGameDistance: 0,
12129
lastGameCoins: 0,
12130
lastGameXP: 0,
12131
highScore: 0,
12132
totalCoins: 0,
12133
currentPlayerLevel: 1,
12134
currentXP: 0,
12135
currentTeam: [0, 1, 2],
12136
tankType: 0,
12137
unlockedTanks: [0],
12138
requiredXP: [0, 16, 38, 66, 100, 140],
12139
name: "MJS-Defend the Tank",
12140
version: "1.0",
12141
init: function() {
12142
this.setupControls();
12143
this.setupStorageManager();
12144
this.getLocalStorage();
12145
// LaggedAPI.init("defend_datank_vints", "lagdevaF3001");
12146
this.removeLoadingWheel();
12147
this.injectMobileLink();
12148
this.setupURLParameters();
12149
this.finalize();
12150
ig.soundHandler.fnSetupMusic();
12151
ig.soundHandler.setMusicVolume(0.5)
12152
},
12153
finalize: function() {
12154
ig.ua.mobile ? ig.game.showOverlay(["play"]) : ig.game.startGame();
12155
sizeHandler()
12156
},
12157
initData: function() {
12158
return this.sessionData = {
12159
totalCoins: 0,
12160
currentPlayerLevel: 1,
12161
currentXP: 0,
12162
currentTeam: [0, 1, 2],
12163
tankType: 0,
12164
unlockedTanks: [0]
12165
}
12166
},
12167
injectMobileLink: function() {
12168
ig.ua.mobile ? $("#play").attr("onclick", "ig.game.setupJukebox();ig.game.pressPlay();") : $("#play").attr("onclick", "ig.game.silence.play();ig.game.pressPlay();")
12169
},
12170
removeLoadingWheel: function() {
12171
try {
12172
$("#ajaxbar").css("background", "none")
12173
} catch (b) {
12174
console.log(b)
12175
}
12176
},
12177
showDebugMenu: function() {
12178
console.log("showing debug menu ...");
12179
ig.Entity._debugShowBoxes = !0;
12180
$(".ig_debug").show()
12181
},
12182
setupLocalStorage: function() {
12183
this.storage = new ig.Storage;
12184
this.getLocalStorage()
12185
},
12186
getLocalStorage: function() {
12187
this.storage && (this.loadAll(), this.totalCoins = this.sessionData.totalCoins, this.currentPlayerLevel = this.sessionData.currentPlayerLevel, this.currentXP = this.sessionData.currentXP, this.currentTeam = this.sessionData.currentTeam, this.tankType = this.sessionData.tankType, this.unlockedTanks = this.sessionData.unlockedTanks)
12188
},
12189
setLocalStorage: function() {
12190
this.storage && (this.save("totalCoins", this.totalCoins), this.save("currentPlayerLevel", this.currentPlayerLevel), this.save("currentXP", this.currentXP), this.save("currentTeam", this.currentTeam), this.save("tankType", this.tankType), this.save("unlockedTanks", this.unlockedTanks))
12191
},
12192
addXP: function(b) {
12193
this.currentPlayerLevel >= this.requiredXP.length ? this.currentPlayerLevel = this.requiredXP.length : (this.currentXP += b, this.requiredXP[this.currentPlayerLevel] < this.currentXP && (b = this.currentXP - this.requiredXP[this.currentPlayerLevel], this.currentPlayerLevel += 1, this.currentXP = 0, this.addXP(b)))
12194
},
12195
playSFX: function() {},
12196
startGame: function() {
12197
this.resetPlayerStats();
12198
this.director = new ig.Director(this, [LevelOpening, LevelMainmenu, LevelGame, LevelResults]);
12199
if (_SETTINGS.Branding.Splash.Enabled) try {
12200
this.branding = new ig.BrandingSplash
12201
} catch (b) {
12202
console.log(b), console.log("Loading original levels ..."), this.director.loadLevel(this.director.currentLevel)
12203
} else this.director.loadLevel(this.director.currentLevel)
12204
},
12205
fpsCount: function() {
12206
this.fpsTimer || (this.fpsTimer = new ig.Timer(1));
12207
this.fpsTimer && 0 > this.fpsTimer.delta() ? null != this.fpsCounter ? this.fpsCounter++ : this.fpsCounter = 0 : (ig.game.fps = this.fpsCounter, this.fpsCounter = 0, this.fpsTimer.reset())
12208
},
12209
endGame: function() {
12210
console.log("End game");
12211
this.stopBackgroundMusic();
12212
ig.ua.mobile && _SETTINGS.Ad.Mobile.End.Enabled && MobileAdInGameEnd.Initialize()
12213
},
12214
resetPlayerStats: function() {
12215
ig.log("resetting player stats ...");
12216
this.playerStats = {
12217
id: this.playerStats ? this.playerStats.id : null
12218
}
12219
},
12220
setupControls: function() {
12221
ig.input.unbindAll();
12222
ig.input.initMouse();
12223
ig.input.bind(ig.KEY.MOUSE1, "click")
12224
},
12225
setupJukebox: function() {
12226
ig.ua.mobile && (this.jukeboxPlayer = new ig.Jukebox, this.jukeboxPlayer.player.setVolume(this.musicVolume))
12227
},
12228
setupURLParameters: function() {
12229
this.setupURLParameters = new ig.UrlParameters
12230
},
12231
msToTime: function(b) {
12232
b = (b - b % 1E3) / 1E3;
12233
var d = b % 60;
12234
b = (b - d) / 60;
12235
var e = b % 60;
12236
b = (b - e) / 60;
12237
return (10 > b ? "0" : "") + b + ":" + ((10 > e ? "0" : "") + e) + ":" + ((10 > d ? "0" : "") + d)
12238
},
12239
pressPlay: function() {
12240
this.hideOverlay(["play"]);
12241
this.startGame();
12242
ig.ua.mobile && _SETTINGS.Ad.Mobile.Footer.Enabled && MobileAdInGameFooter.Initialize();
12243
ig.ua.mobile && _SETTINGS.Ad.Mobile.Header.Enabled && MobileAdInGameHeader.Initialize()
12244
},
12245
pauseGame: function() {
12246
ig.system.stopRunLoop.call(ig.system);
12247
console.log("Game Paused")
12248
},
12249
resumeGame: function() {
12250
ig.system.startRunLoop.call(ig.system);
12251
console.log("Game Resumed")
12252
},
12253
pressMute: function() {
12254
try {
12255
ig.game.muted ? this.unmute() : this.mute()
12256
} catch (b) {
12257
console.log("pressMute() error: " + b)
12258
}
12259
},
12260
showOverlay: function(b) {
12261
for (i = 0; i < b.length; i++) $("#" + b[i]) && $("#" + b[i]).show(), document.getElementById(b[i]) && (document.getElementById(b[i]).style.visibility = "visible")
12262
},
12263
hideOverlay: function(b) {
12264
for (i = 0; i < b.length; i++) $("#" + b[i]) && $("#" + b[i]).hide(), document.getElementById(b[i]) && (document.getElementById(b[i]).style.visibility = "hidden")
12265
},
12266
stopAllSounds: function() {
12267
for (i = 0; i < ig.resources.length; i++) ig.resources[i].multiChannel && ig.resources[i].stop();
12268
console.log("all sounds stopped")
12269
},
12270
loadLevel: function(b) {
12271
this.parent(b)
12272
},
12273
update: function() {
12274
if (this.paused)
12275
for (var b = 0; b < this.entities.length; b++) this.entities[b].ignorePause && this.entities[b].update();
12276
else this.parent(); if (ig.game.jukebox && ig.ua.mobile)
12277
for (var d in ig.game.jukebox.player.settings.spritemap) ig.game.jukebox.player.getCurrentTime() < ig.game.jukebox.player.settings.spritemap[d].end + ig.game.jukebox.player.settings.timeout / 1E3 || (ig.game.jukebox.player.pause(), this.setupJukebox())
12278
},
12279
draw: function() {
12280
this.parent();
12281
this.dctf()
12282
},
12283
dctf: function() {
12284
this.COPYRIGHT
12285
},
12286
drawDebug: function() {
12287
if (!ig.global.wm && (this.debugEnable(), this.viewDebug && (ig.system.context.fillStyle = "#000000", ig.system.context.globalAlpha = 0.35, ig.system.context.fillRect(0, 0, ig.system.width / 4, ig.system.height), ig.system.context.globalAlpha = 1, this.debug && 0 < this.debug.length)))
12288
for (i = 0; i < this.debug.length; i++) ig.system.context.font = "10px Arial", ig.system.context.fillStyle = "#ffffff", ig.system.context.fillText(this.debugLine -
12289
this.debug.length + i + ": " + this.debug[i], 10, 50 + 10 * i)
12290
},
12291
debugCL: function(b) {
12292
this.debug ? (50 > this.debug.length || this.debug.splice(0, 1), this.debug.push(b), this.debugLine++) : (this.debug = [], this.debugLine = 1, this.debug.push(b));
12293
console.log(b)
12294
},
12295
debugEnable: function() {
12296
ig.input.pressed("click") && (this.debugEnableTimer = new ig.Timer(2));
12297
this.debugEnableTimer && 0 > this.debugEnableTimer.delta() ? ig.input.released("click") && (this.debugEnableTimer = null) : this.debugEnableTimer && 0 < this.debugEnableTimer.delta() && (this.debugEnableTimer = null, this.viewDebug = this.viewDebug ? !1 : !0)
12298
}
12299
});
12300
var b = getQueryVariable("device");
12301
if (b) switch (b) {
12302
case "mobile":
12303
console.log("serving mobile version ...");
12304
ig.ua.mobile = !0;
12305
break;
12306
case "desktop":
12307
console.log("serving desktop version ...");
12308
ig.ua.mobile = !1;
12309
break;
12310
default:
12311
console.log("serving universal version ...")
12312
} else console.log("serving universal version ...");
12313
if (b = getQueryVariable("force-rotate")) switch (b) {
12314
case "portrait":
12315
console.log("force rotate to portrait");
12316
window.orientation = 0;
12317
break;
12318
case "landscape":
12319
console.log("force rotate to horizontal");
12320
window.orientation = 90;
12321
break;
12322
default:
12323
alert("wrong command/type in param force-rotate. Defaulting value to portrait"), window.orientation = 0
12324
}
12325
ig.ua.mobile ? ig.main("#canvas", MyGame, 60, mobileWidth, mobileHeight, 1, ig.SplashLoader) : ig.main("#canvas", MyGame, 60, desktopWidth, desktopHeight, 1, ig.SplashLoader);
12326
ig.ua.mobile && orientationHandler();
12327
sizeHandler();
12328
fixSamsungHandler();
12329
this.DOMAINLOCK_BREAKOUT_ATTEMPT;
12330
this.END_OBFUSCATION
12331
});
12332