Created
May 3, 2017 18:57
-
-
Save wihodges/ca3920ea8e9e7fe8804218d119ef5ebe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var m = void 0, | |
n = !0, | |
p = null, | |
q = !1, | |
s = {}; | |
window.nogic = s; | |
function t(a, c, d, b, e, f, g, h, y, k, u) { | |
this.n = f; | |
this.n == p && (this.n = {}); | |
this.i = g; | |
this.i == p && (this.i = {}); | |
this.i.forceCoversWholeBrowser && (a.style.position = "absolute", a.style.left = "0px", a.style.top = "0px", a.width = document.documentElement.clientWidth, a.height = document.documentElement.clientHeight); | |
this.canvas = a; | |
this.g = a.getContext("2d"); | |
a.setAttribute("tabIndex", 0); | |
a.focus(); | |
this.width = c; | |
this.height = d; | |
this.backgroundColor = v(b); | |
this.l = v(e); | |
this.v = a.width; | |
this.u = a.height; | |
this.t = a.clientWidth; | |
this.s = a.clientHeight; | |
w(this, c, d, a.width, a.height, a.clientWidth, a.clientHeight); | |
this.q = h; | |
this.z = y; | |
this.m = k; | |
this.o = u | |
} | |
function v(a) { | |
return "rgba(" + (a >>> 16 & 255) + "," + (a >>> 8 & 255) + "," + (a & 255) + "," + (a >>> 24 & 255) + ")" | |
} | |
function w(a, c, d, b, e, f, g) { | |
var h; | |
h = new x; | |
h.scale(f / b, g / e); | |
b = z(h); | |
e = Math.min(f / c, g / d); | |
a.h = new x; | |
a.h.translate((f - e * c) / 2, (g - e * d) / 2); | |
a.h.scale(e, e); | |
a.A = z(a.h); | |
a.j = new x(a.h.a, a.h.b, a.h.c, a.h.d, a.h.e, a.h.f); | |
c = a.j; | |
d = b.b * c.a + b.d * c.b; | |
f = b.a * c.c + b.c * c.d; | |
g = b.b * c.c + b.d * c.d; | |
e = b.a * c.e + b.c * c.f + b.e; | |
h = b.b * c.e + b.d * c.f + b.f; | |
c.a = b.a * c.a + b.c * c.b; | |
c.b = d; | |
c.c = f; | |
c.d = g; | |
c.e = e; | |
c.f = h; | |
a.B = z(a.j) | |
} | |
function A(a, c, d) { | |
var b, e, f, g, h; | |
if (c) { | |
c = function() { | |
B(a, n, g) | |
}; | |
h = function() { | |
B(a, q, g) | |
}; | |
b = document.createElement("canvas"); | |
b.width = d.width; | |
b.height = d.height; | |
b = b.getContext("2d"); | |
try { | |
b.webkitImageSmoothingEnabled = q | |
} catch (y) {} | |
b.drawImage(d, 0, 0); | |
b = b.getImageData(0, 0, d.width, d.height); | |
d = Array(3 * d.width * d.height); | |
for (e = f = 0; e < b.data.length; e += 4) d[f++] = b.data[e], d[f++] = b.data[e + 1], d[f++] = b.data[e + 2]; | |
for (b = 0; b < d.length;) { | |
e = d[b++]; | |
if (0 == e) break; | |
f = d[b++] << 24 | d[b++] << 16 | d[b++] << 8 | d[b++]; | |
e = d[b++] << 24 | d[b++] << 16 | | |
d[b++] << 8 | d[b++]; | |
b += f; | |
g = new Image; | |
g.onload = c; | |
g.onerror = h; | |
g.onabort = h; | |
f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); | |
for (var k = m, u = m, l = m, r = m, j = m, k = "", j = b; j < b + e; j += 3) u = d[j], l = j + 1 < b + e ? d[j + 1] : 0, r = j + 2 < b + e ? d[j + 2] : 0, k += f[u >> 2], k += f[(u & 3) << 4 | l >> 4], k += j + 1 < b + e ? f[(l & 15) << 2 | r >> 6] : "=", k += j + 2 < b + e ? f[r & 63] : "="; | |
g.src = "data:image/png;base64," + k; | |
b += e | |
} | |
} else B(a, q, d) | |
} | |
function B(a, c, d) { | |
c && (d != p && 0 < d.width && 0 < d.height) && (a.w = d, C(a), a.p = setInterval(function() { | |
if (a.i.forceCoversWholeBrowser && (a.canvas.width != document.documentElement.clientWidth || a.canvas.height != document.documentElement.clientHeight)) a.canvas.width = document.documentElement.clientWidth, a.canvas.height = document.documentElement.clientHeight; | |
a.canvas.width == a.v && a.canvas.height == a.u && a.canvas.clientWidth == a.t && a.canvas.clientHeight == a.s || (a.g.save(), a.g.fillStyle = a.l, a.g.fillRect(0, 0, a.canvas.width, a.canvas.height), | |
a.g.restore(), w(a, a.width, a.height, a.canvas.width, a.canvas.height, a.canvas.clientWidth, a.canvas.clientHeight), C(a), a.v = a.canvas.width, a.u = a.canvas.height, a.t = a.canvas.clientWidth, a.s = a.canvas.clientHeight) | |
}, 1)); | |
if (a.m != p) { | |
var b, e; | |
if (".js" == a.m.substr(a.m.length - 3)) { | |
try { | |
b = new XMLHttpRequest | |
} catch (f) { | |
b = new ActiveXObject("Msxml2.XMLHTTP") | |
} | |
b.onreadystatechange = function() { | |
4 == this.readyState && (a.k = window.eval(this.responseText), a.k.preloadAssets(a.q, a.canvas, a.width, a.height, a.backgroundColor, a.l, a.n, a.i, | |
a.r, | |
function() { | |
clearInterval(a.p) | |
})) | |
}; | |
b.open("GET", a.m, n); | |
b.send(p) | |
} else e = new Image, e.onload = function() { | |
var b, c, d, f; | |
b = document.createElement("canvas"); | |
b.width = e.width; | |
b.height = e.height; | |
b = b.getContext("2d"); | |
try { | |
b.webkitImageSmoothingEnabled = q | |
} catch (u) {} | |
b.drawImage(e, 0, 0); | |
c = b.getImageData(0, 0, e.width, e.height); | |
b = Array(3 * e.width * e.height); | |
for (d = f = 0; d < c.data.length && 0 != c.data[d]; d += 4) { | |
b[f++] = c.data[d]; | |
if (0 == c.data[d + 1]) break; | |
b[f++] = c.data[d + 1]; | |
if (0 == c.data[d + 2]) break; | |
b[f++] = c.data[d + 2] | |
} | |
c = ""; | |
var l, r, | |
j; | |
for (d = 0; d < 0 + f; d++) l = b[d], 224 <= l ? (r = b[++d], j = b[++d], l = (l & 15) << 12 | (r & 63) << 6 | j & 63) : 127 < l && (r = b[++d], l = (l & 31) << 6 | r & 63), c += String.fromCharCode(l); | |
a.k = window.eval(c); | |
a.k.preloadAssets(a.q, a.canvas, a.width, a.height, a.backgroundColor, a.l, a.n, a.i, a.r, function() { | |
clearInterval(a.p) | |
}) | |
}, e.src = a.m | |
} else a.k = _nogic_internal_Main, a.k.preloadAssets(a.q, a.canvas, a.width, a.height, a.backgroundColor, a.l, a.n, a.i, a.r, function() { | |
clearInterval(a.p) | |
}) | |
} | |
function C(a) { | |
a.g.save(); | |
a.g.transform(a.j.a, a.j.b, a.j.c, a.j.d, a.j.e, a.j.f); | |
a.g.drawImage(a.w, 0, 0); | |
a.g.restore() | |
} | |
t.prototype.sendMessage = function(a, c) { | |
this.k.sendMessage(a, c) | |
}; | |
function x(a, c, d, b, e, f) { | |
a == m && (a = 1); | |
c == m && (c = 0); | |
d == m && (d = 0); | |
b == m && (b = 1); | |
e == m && (e = 0); | |
f == m && (f = 0); | |
this.a = a; | |
this.b = c; | |
this.c = d; | |
this.d = b; | |
this.e = e; | |
this.f = f; | |
return this | |
} | |
function D(a, c) { | |
var d = a.b * c.a + a.d * c.b, | |
b = a.a * c.c + a.c * c.d, | |
e = a.b * c.c + a.d * c.d, | |
f = a.a * c.e + a.c * c.f + a.e, | |
g = a.b * c.e + a.d * c.f + a.f; | |
a.a = a.a * c.a + a.c * c.b; | |
a.b = d; | |
a.c = b; | |
a.d = e; | |
a.e = f; | |
a.f = g | |
} | |
x.prototype.translate = function(a, c) { | |
D(this, new x(1, 0, 0, 1, a, c)) | |
}; | |
x.prototype.scale = function(a, c) { | |
D(this, new x(a, 0, 0, c, 0, 0)) | |
}; | |
function z(a) { | |
var c = a.a * a.d - a.b * a.c, | |
d; | |
if (0 == c) return p; | |
d = new x; | |
d.a = a.d / c; | |
d.b = -a.b / c; | |
d.c = -a.c / c; | |
d.d = a.a / c; | |
d.e = (a.c * a.f - a.d * a.e) / c; | |
d.f = (a.b * a.e - a.a * a.f) / c; | |
return d | |
} | |
s.initialize = function(a, c, d) { | |
var b, e; | |
b = document.getElementsByTagName("script"); | |
b = /(.*)\/js\//.exec(b[b.length - 2].src)[1]; | |
e = new t(a, 600, 400, -1, -16777216, c, d, b, n, b + "/assets/__.png", b + "/assets/_.png"); | |
a = /\bMSIE\b\s*(\d+)\.\d+\b/.exec(navigator.userAgent); | |
if (a != p && 9 >= a[1]) alert("Internet Explorer 9 or below is not supported, please update to version 10 or above."), a = q; | |
else if (!e.i.allowRunInAndroidDefaultBrowser && /\bAndroid\b/.test(navigator.userAgent) && !/\bChrome\b/.test(navigator.userAgent) && !/\bFirefox\b/.test(navigator.userAgent)) alert("The default browser on Android is not supported, please download another browser such as Chrome, Firefox or Opera from Play Store."), | |
a = q; | |
else { | |
try { | |
new ArrayBuffer(0) | |
} catch (f) { | |
alert("This browser is not supported. Please use the latest version of Internet Explorer, Firefox, Chrome, Safari, or Opera.") | |
} | |
a = n | |
} | |
if (a) | |
if ("http" != document.location.href.substr(0, 4) && alert("Loading from the local computer may or may not work, depending on the browser you are using and the security settings. If there are any problems, try using another web browser or loading from a web server."), e.r = "_com_novelgames_spgames_tower_Main", e.g.save(), e.g.fillStyle = | |
e.l, e.g.fillRect(0, 0, e.canvas.width, e.canvas.height), e.g.restore(), e.z) { | |
var g; | |
e.o == p ? B(e, q, g) : (a = function() { | |
A(e, n, g) | |
}, c = function() { | |
A(e, q, g) | |
}, g = new Image, g.onload = a, g.onerror = c, g.onabort = c, g.src = e.o) | |
} else { | |
var h; | |
e.o == p ? B(e, q, h) : (a = function() { | |
B(e, n, h) | |
}, c = function() { | |
B(e, q, h) | |
}, h = new Image, h.onload = a, h.onerror = c, h.onabort = c, h.src = e.o) | |
} | |
return { | |
sendMessage: function(a, b) { | |
e.sendMessage(a, b) | |
} | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment