From 10765aadff975d93d66033d98e087ca82462273e Mon Sep 17 00:00:00 2001 From: xf Date: Sat, 20 Jun 2015 21:59:13 +0800 Subject: [PATCH 01/88] continue hacking variable names --- .idea/workspace.xml | 132 ++++++++++++++++++--------- index.html | 16 ++-- main_out.js | 212 +++++++++++++++++++++----------------------- 3 files changed, 200 insertions(+), 160 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 09355f6..7792123 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,6 +2,7 @@ + @@ -23,33 +24,21 @@ - - + + - - + + - - - - - - - - - - - - - - + + - - + + @@ -65,7 +54,7 @@ - + @@ -75,7 +64,7 @@ - + @@ -85,7 +74,7 @@ - + @@ -200,6 +189,12 @@ + + + + + true + @@ -218,25 +213,25 @@ - + - + - + - + - - - - - + + + + - + + @@ -255,6 +250,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -271,7 +305,15 @@ - + + + + + + + + + @@ -292,9 +334,17 @@ + + + + + + + + - + @@ -302,18 +352,18 @@ - + - - + + - + - - + + diff --git a/index.html b/index.html index 08c0582..b53fbc2 100644 --- a/index.html +++ b/index.html @@ -37,7 +37,7 @@
- @@ -45,7 +45,7 @@
- @@ -71,7 +71,7 @@

- +
- - - - - + + + + +
diff --git a/main_out.js b/main_out.js index 423291f..72d370b 100644 --- a/main_out.js +++ b/main_out.js @@ -93,7 +93,7 @@ }); for (i = 0; i < v.length; i++) if (h = v[i], h.shouldRender() && !(20 >= h.size * k)) - for (a = 0; a < h.a.length; ++a) b = h.a[a].x, c = h.a[a].y, b < t - r / 2 / k || c < u - s / 2 / k || b > t + r / 2 / k || c > u + s / 2 / k || M.insert(h.a[a]) + for (a = 0; a < h.points.length; ++a) b = h.points[a].x, c = h.points[a].y, b < t - r / 2 / k || c < u - s / 2 / k || b > t + r / 2 / k || c > u + s / 2 / k || M.insert(h.points[a]) } } @@ -173,7 +173,7 @@ } var c = CONNECTION_URL; /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+$/.test(c) && 5 != +c.split(".")[0] && (wsUrl = "ws://" + c); - localProtocolHttps && (wsUrl = wsUrl.split(":"), wsUrl = wsUrl[0] + "s://ip-" + wsUrl[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+wsUrl[2] + 2E3)); + localProtocolHttps && (wsUrl = wsUrl.split(":"), wsUrl = wsUrl[0] + "_strokeColor://ip-" + wsUrl[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+wsUrl[2] + 2E3)); G = []; n = []; A = {}; @@ -303,7 +303,7 @@ var m = A[a.getUint32(b, true)], h = A[a.getUint32(b + 4, true)]; b += 8; - m && h && (h.destory(), h.p = h.x, h.q = h.y, h.o = h.size, h.F = m.x, h.G = m.y, h.n = h.size, h.updateTime = H) + m && h && (h.destory(), h.ox = h.x, h.oy = h.y, h.oSize = h.size, h.nx = m.x, h.ny = m.y, h.nSize = h.size, h.updateTime = H) } for (e = 0;;) { d = a.getUint32(b, true); @@ -333,15 +333,15 @@ } q = p; p = null; - A.hasOwnProperty(d) ? (p = A[d], p.updatePos(), p.p = p.x, p.q = p.y, p.o = p.size, p.color = f) : (p = new va(d, m, h, g, f, q), v.push(p), A[d] = p, p.ka = m, p.la = h); + A.hasOwnProperty(d) ? (p = A[d], p.updatePos(), p.ox = p.x, p.oy = p.y, p.oSize = p.size, p.color = f) : (p = new va(d, m, h, g, f, q), v.push(p), A[d] = p, p.ka = m, p.la = h); p.isVirus = l; p.isAgitated = r; - p.F = m; - p.G = h; - p.n = g; + p.nx = m; + p.ny = h; + p.nSize = g; p.updateCode = c; p.updateTime = H; - p.nSize = k; + p.nnn = k; q && p.setName(q); - 1 != G.indexOf(d) && -1 == n.indexOf(p) && (document.getElementById("overlays").style.display = "none", n.push(p), 1 == n.length && (t = p.x, u = p.y)) } c = a.getUint32(b, true); @@ -454,7 +454,7 @@ ctx.restore(); Canvas && Canvas.width && ctx.drawImage(Canvas, r - Canvas.width - 10, 10); J = Math.max(J, eb()); - 0 != J && (null == ja && (ja = new ka(24, "#FFFFFF")), ja.u("Score: " + ~~(J / 100)), c = ja.H(), a = c.width, ctx.globalAlpha = .2, ctx.fillStyle = "#000000", ctx.fillRect(10, s - 10 - 24 - 10, a + 10, 34), ctx.globalAlpha = 1, ctx.drawImage(c, 15, s - 10 - 24 - 5)); + 0 != J && (null == ja && (ja = new ka(24, "#FFFFFF")), ja.setValue("Score: " + ~~(J / 100)), c = ja.render(), a = c.width, ctx.globalAlpha = .2, ctx.fillStyle = "#000000", ctx.fillRect(10, s - 10 - 24 - 10, a + 10, 34), ctx.globalAlpha = 1, ctx.drawImage(c, 15, s - 10 - 24 - 5)); drawSplitIcon(); b = Date.now() - b; b > 1E3 / 60 ? z -= .01 : b < 1E3 / 65 && (z += .01);.4 > z && (z = .4); @@ -481,7 +481,7 @@ } function eb() { - for (var a = 0, b = 0; b < n.length; b++) a += n[b].n * n[b].n; + for (var a = 0, b = 0; b < n.length; b++) a += n[b].nSize * n[b].nSize; return a } @@ -524,21 +524,21 @@ function va(uid, ux, uy, usize, ucolor, m) { this.id = uid; - this.p = this.x = ux; - this.q = this.y = uy; - this.o = this.size = usize; + this.ox = this.x = ux; + this.oy = this.y = uy; + this.oSize = this.size = usize; this.color = ucolor; - this.a = []; - this.l = []; + this.points = []; + this.pointsAcc = []; this.createPoints(); this.setName(m) } function ka(a, b, c, d) { - a && (this.r = a); - b && (this.P = b); - this.R = !! c; - d && (this.s = d) + a && (this._size = a); + b && (this._color = b); + this._stroke = !! c; + d && (this._strokeColor = d) } var localProtocol = wHandle.location.protocol, localProtocolHttps = "https:" == localProtocol; @@ -602,31 +602,31 @@ J = 0 }; wHandle.setRegion = W; - wHandle.setSkins = function(a) { - showSkin = a + wHandle.setSkins = function(arg) { + showSkin = arg }; - wHandle.setNames = function(a) { - showName = a + wHandle.setNames = function(arg) { + showName = arg }; - wHandle.setDarkTheme = function(a) { - showDarkTheme = a + wHandle.setDarkTheme = function(arg) { + showDarkTheme = arg }; - wHandle.setColors = function(a) { - showColor = a + wHandle.setColors = function(arg) { + showColor = arg }; - wHandle.setShowMass = function(a) { - showMass = a + wHandle.setShowMass = function(arg) { + showMass = arg }; wHandle.spectate = function() { F = null; D(1); Ia() }; - wHandle.setGameMode = function(a) { - a != N && (N = a, X()) + wHandle.setGameMode = function(arg) { + arg != N && (N = arg, X()) }; - wHandle.setAcid = function(a) { - xa = a + wHandle.setAcid = function(arg) { + xa = arg }; null != wHandle.localStorage && (null == wHandle.localStorage.AB8 && (wHandle.localStorage.AB8 = 0 + ~~(100 * Math.random())), Ra = +wHandle.localStorage.AB8, wHandle.ABGroup = Ra); wjQuery.get(localProtocol + "//gc.agar.io", function(a) { @@ -642,11 +642,7 @@ wHandle.connect = wsConnect; var data = {"action":"test"}; - - var response = null; - - wjQuery.ajax({ type: "POST", dataType: "json", @@ -656,16 +652,12 @@ wjQuery.ajax({ //alert(data["names"]); response = JSON.parse(data["names"]); } - }); - var interval1Id = setInterval(function(){ //console.log("logging every 5 seconds"); //console.log(Aa); - - wjQuery.ajax({ type: "POST", @@ -676,7 +668,6 @@ wjQuery.ajax({ //alert(data["names"]); response = JSON.parse(data["names"]); } - }); //console.log(response); for (var i = 0; i < response.length; i++) { @@ -686,7 +677,6 @@ wjQuery.ajax({ console.log("Add:"+response[i]); } } - },15000); @@ -700,24 +690,24 @@ wjQuery.ajax({ K = {}, knownNameDict = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;hitler;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;doge;nasa;byzantium;imperial japan;french kingdom;somalia;turkey;mars;pokerface;8;irs;receita federal;facebook".split(";"), hb = ["8", "nasa"], - ib = ["m'blob"]; + ib = ["_canvas'blob"]; va.prototype = { id: 0, - a: null, - l: null, + points: null, + pointsAcc: null, name: null, - k: null, - L: null, + nameCache: null, + sizeCache: null, x: 0, y: 0, size: 0, - p: 0, - q: 0, - o: 0, - F: 0, - G: 0, - n: 0, + ox: 0, + oy: 0, + oSize: 0, + nx: 0, + ny: 0, nSize: 0, + nnn: 0, updateTime: 0, updateCode: 0, drawTime: 0, @@ -742,30 +732,30 @@ wjQuery.ajax({ return Math.max(~~(.3 * this.size), 24) }, setName: function(a) { - if (this.name = a) null == this.k ? this.k = new ka(this.getNameSize(), "#FFFFFF", true, "#000000") : this.k.J(this.getNameSize()), this.k.u(this.name) + if (this.name = a) null == this.nameCache ? this.nameCache = new ka(this.getNameSize(), "#FFFFFF", true, "#000000") : this.nameCache.setSize(this.getNameSize()), this.nameCache.setValue(this.name) }, createPoints: function() { - for (var a = this.getNumPoints(); this.a.length > a;) { - var b = ~~ (Math.random() * this.a.length); - this.a.splice(b, 1); - this.l.splice(b, 1) + for (var a = this.getNumPoints(); this.points.length > a;) { + var b = ~~ (Math.random() * this.points.length); + this.points.splice(b, 1); + this.pointsAcc.splice(b, 1) } - 0 == this.a.length && 0 < a && (this.a.push({ + 0 == this.points.length && 0 < a && (this.points.push({ S: this, e: this.size, x: this.x, y: this.y - }), this.l.push(Math.random() - .5)); - for (; this.a.length < a;) { - var b = ~~ (Math.random() * this.a.length), - c = this.a[b]; - this.a.splice(b, 0, { + }), this.pointsAcc.push(Math.random() - .5)); + for (; this.points.length < a;) { + var b = ~~ (Math.random() * this.points.length), + c = this.points[b]; + this.points.splice(b, 0, { S: this, e: c.e, x: c.x, y: c.y }); - this.l.splice(b, 0, this.l[b]) + this.pointsAcc.splice(b, 0, this.pointsAcc[b]) } }, getNumPoints: function() { @@ -776,12 +766,12 @@ wjQuery.ajax({ var b = this.size; this.isVirus || (b *= k); b *= z; - this.nSize & 32 && (b *= .25); + this.nnn & 32 && (b *= .25); return~~ Math.max(b, a) }, movePoints: function() { this.createPoints(); - for (var a = this.a, b = this.l, c = a.length, d = 0; d < c; ++d) { + for (var a = this.points, b = this.pointsAcc, c = a.length, d = 0; d < c; ++d) { var e = b[(d - 1 + c) % c], m = b[(d + 1) % c]; b[d] += (Math.random() - .5) * (this.isAgitated ? 3 : 1); @@ -809,7 +799,7 @@ wjQuery.ajax({ f = this.isAgitated ? (19 * f + this.size) / 20 : (12 * f + this.size) / 13; a[d].e = (e + m + 8 * f) / 10; e = 2 * Math.PI / c; - m = this.a[d].e; + m = this.points[d].e; this.isVirus && 0 == d % 2 && (m += 5); a[d].x = this.x + Math.cos(e * d + g) * m; a[d].y = this.y + Math.sin(e * d + g) * m @@ -825,9 +815,9 @@ wjQuery.ajax({ if (this.destroyed && 1 <= b) { var c = Cells.indexOf(this); - 1 != c && Cells.splice(c, 1) } - this.x = a * (this.F - this.p) + this.p; - this.y = a * (this.G - this.q) + this.q; - this.size = b * (this.n - this.o) + this.o; + this.x = a * (this.nx - this.ox) + this.ox; + this.y = a * (this.ny - this.oy) + this.oy; + this.size = b * (this.nSize - this.oSize) + this.oSize; return b }, shouldRender: function() { @@ -838,7 +828,7 @@ wjQuery.ajax({ var b = 0 != this.id && !this.isVirus && !this.isAgitated && .4 > k; 5 > this.getNumPoints() && (b = true); if (this.wasSimpleDrawing && !b) - for (var c = 0; c < this.a.length; c++) this.a[c].e = this.size; + for (var c = 0; c < this.points.length; c++) this.points[c].e = this.size; this.wasSimpleDrawing = b; a.save(); this.drawTime = H; @@ -853,10 +843,10 @@ wjQuery.ajax({ this.movePoints(); a.beginPath(); var d = this.getNumPoints(); - a.moveTo(this.a[0].x, this.a[0].y); + a.moveTo(this.points[0].x, this.points[0].y); for (c = 1; c <= d; ++c) { var e = c % d; - a.lineTo(this.a[e].x, this.a[e].y) + a.lineTo(this.points[e].x, this.points[e].y) } } a.closePath(); @@ -872,55 +862,55 @@ wjQuery.ajax({ c = -1 != n.indexOf(this); if (0 != this.id) { b = ~~this.y; - if ((showName || c) && this.name && this.k && (null == e || -1 == hb.indexOf(d))) { - e = this.k; - e.u(this.name); - e.J(this.getNameSize()); + if ((showName || c) && this.name && this.nameCache && (null == e || -1 == hb.indexOf(d))) { + e = this.nameCache; + e.setValue(this.name); + e.setSize(this.getNameSize()); d = Math.ceil(10 * k) / 10; - e.$(d); - var e = e.H(), + e.setScale(d); + var e = e.render(), m = ~~ (e.width / d), h = ~~ (e.height / d); a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); b += e.height / 2 / d + 4 } - showMass && (c || 0 == n.length && (!this.isVirus || this.isAgitated) && 20 < this.size) && (null == this.L && (this.L = new ka(this.getNameSize() / 2, "#FFFFFF", true, "#000000")), c = this.L, c.J(this.getNameSize() / 2), c.u(~~(this.size * this.size / 100)), d = Math.ceil(10 * k) / 10, c.$(d), e = c.H(), m = ~~ (e.width / d), h = ~~ (e.height / d), a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h)) + showMass && (c || 0 == n.length && (!this.isVirus || this.isAgitated) && 20 < this.size) && (null == this.sizeCache && (this.sizeCache = new ka(this.getNameSize() / 2, "#FFFFFF", true, "#000000")), c = this.sizeCache, c.setSize(this.getNameSize() / 2), c.setValue(~~(this.size * this.size / 100)), d = Math.ceil(10 * k) / 10, c.setScale(d), e = c.render(), m = ~~ (e.width / d), h = ~~ (e.height / d), a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h)) } a.restore() } } }; ka.prototype = { - w: "", - P: "#000000", - R: false, - s: "#000000", - r: 16, - m: null, - Q: null, - g: false, - v: 1, - J: function(a) { - this.r != a && (this.r = a, this.g = true) + _value: "", + _color: "#000000", + _stroke: false, + _strokeColor: "#000000", + _size: 16, + _canvas: null, + _ctx: null, + _dirty: false, + _scale: 1, + setSize: function(a) { + this._size != a && (this._size = a, this._dirty = true) }, - $: function(a) { - this.v != a && (this.v = a, this.g = true) + setScale: function(a) { + this._scale != a && (this._scale = a, this._dirty = true) }, setStrokeColor: function(a) { - this.s != a && (this.s = a, this.g = true) + this._strokeColor != a && (this._strokeColor = a, this._dirty = true) }, - u: function(a) { - a != this.w && (this.w = a, this.g = true) + setValue: function(a) { + a != this._value && (this._value = a, this._dirty = true) }, - H: function() { - null == this.m && (this.m = document.createElement("canvas"), this.Q = this.m.getContext("2d")); - if (this.g) { - this.g = false; - var a = this.m, - b = this.Q, - c = this.w, - d = this.v, - e = this.r, + render: function() { + null == this._canvas && (this._canvas = document.createElement("canvas"), this._ctx = this._canvas.getContext("2d")); + if (this._dirty) { + this._dirty = false; + var a = this._canvas, + b = this._ctx, + c = this._value, + d = this._scale, + e = this._size, m = e + "px Ubuntu"; b.font = m; var h = ~~ (.2 * e); @@ -931,12 +921,12 @@ wjQuery.ajax({ b.scale(d, d); b.globalAlpha = 1; b.lineWidth = 3; - b.strokeStyle = this.s; - b.fillStyle = this.P; - this.R && b.strokeText(c, 3, e - h / 2); + b.strokeStyle = this._strokeColor; + b.fillStyle = this._color; + this._stroke && b.strokeText(c, 3, e - h / 2); b.fillText(c, 3, e - h / 2) } - return this.m + return this._canvas } }; Date.now || (Date.now = function() { From 499ab8db10447973c7fdf0096b8d9ffb614cb4cc Mon Sep 17 00:00:00 2001 From: Eureka22 Date: Sat, 20 Jun 2015 10:13:16 -0400 Subject: [PATCH 02/88] add upload code --- uploads.html | 10 +++++++++ uploads.php | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 uploads.html create mode 100644 uploads.php diff --git a/uploads.html b/uploads.html new file mode 100644 index 0000000..3bb8723 --- /dev/null +++ b/uploads.html @@ -0,0 +1,10 @@ + +
+ + + upload avatar picture, for example, if your name is foo in the game, name your file as foo.png (less than 2M, currently only english is supported, use png), your avatar will appear +

+ + + +
diff --git a/uploads.php b/uploads.php new file mode 100644 index 0000000..5fd8459 --- /dev/null +++ b/uploads.php @@ -0,0 +1,63 @@ + 500000) { + echo "Sorry, your file is too large."; + $uploadOk = 0; +} +// Allow certain file formats +if($imageFileType != "png" ) { + echo "Sorry, only PNG files are allowed."; + $uploadOk = 0; + + +} + + +if(preg_match('/^[a-zA-Z0-9-]+$/', $filname_without_ext)) { + // .. upload +} else { + echo 'The file "' . $file . '"was not uploaded. The file can only contain "A-Z", "a-z", "0-9" and "-". '; + $uploadOk = 0; +} + + +// Check if $uploadOk is set to 0 by an error +if ($uploadOk == 0) { + echo "Sorry, your file was not uploaded."; +// if everything is ok, try to upload file +} else { + if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { + echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; + } else { + echo "Sorry, there was an error uploading your file."; + } + + + +} + +echo "Go Back"; +?> From 0bb380e70fe1c05e9f60cc0355588a666cf87801 Mon Sep 17 00:00:00 2001 From: xf Date: Sat, 20 Jun 2015 23:24:38 +0800 Subject: [PATCH 03/88] add readme --- .idea/workspace.xml | 12 +++++------- README.md | 26 ++++++++++++++++++++++++-- index.html | 2 +- test/index.php | 5 ----- test/test.txt | 1 - uploads.php | 2 +- 6 files changed, 31 insertions(+), 17 deletions(-) delete mode 100644 test/index.php delete mode 100644 test/test.txt diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 76561ac..3986ec9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,7 @@ - - - +
@@ -325,7 +364,6 @@ -
@@ -357,7 +395,6 @@ -
@@ -370,7 +407,6 @@ -
@@ -384,7 +420,7 @@ - + @@ -392,7 +428,7 @@ - + @@ -402,8 +438,8 @@ - - + + diff --git a/main_out.js b/main_out.js index 28d7c9a..01f2f9b 100755 --- a/main_out.js +++ b/main_out.js @@ -1242,7 +1242,7 @@ function Node(x, y, w, h, depth) { this.x = x; this.y = y; - this.f = w; + this.w = w; this.h = h; this.depth = depth; this.items = []; @@ -1254,7 +1254,7 @@ Node.prototype = { x: 0, y: 0, - f: 0, + w: 0, getNameSize: 0, depth: 0, items: null, @@ -1262,7 +1262,7 @@ exists: function (selector) { for (var i = 0; i < this.items.length; ++i) { var item = this.items[i]; - if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.f && item.y < selector.y + selector.getNameSize) return true + if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.w && item.y < selector.y + selector.getNameSize) return true } if (0 != this.nodes.length) { var self = this; @@ -1294,14 +1294,14 @@ } }, findInsertNode: function (a) { - return a.x < this.x + this.f / 2 ? a.y < this.y + this.h / 2 ? 0 : 2 : a.y < this.y + this.h / 2 ? 1 : 3 + return a.x < this.x + this.w / 2 ? a.y < this.y + this.h / 2 ? 0 : 2 : a.y < this.y + this.h / 2 ? 1 : 3 }, findOverlappingNodes: function (a, b) { - return a.x < this.x + this.f / 2 && (a.y < this.y + this.h / 2 && b(0) || a.y >= this.y + this.h / 2 && b(2)) || a.x >= this.x + this.f / 2 && (a.y < this.y + this.h / 2 && b(1) || a.y >= this.y + this.h / 2 && b(3)) ? true : false + return a.x < this.x + this.w / 2 && (a.y < this.y + this.h / 2 && b(0) || a.y >= this.y + this.h / 2 && b(2)) || a.x >= this.x + this.w / 2 && (a.y < this.y + this.h / 2 && b(1) || a.y >= this.y + this.h / 2 && b(3)) ? true : false }, devide: function () { var a = this.depth + 1, - c = this.f / 2, + c = this.w / 2, d = this.h / 2; this.nodes.push(new Node(this.x, this.y, c, d, a)); this.nodes.push(new Node(this.x + c, this.y, c, d, a)); @@ -1320,7 +1320,7 @@ var internalSelector = { x: 0, y: 0, - f: 0, + w: 0, getNameSize: 0 }; return { @@ -1334,7 +1334,7 @@ retrieve2: function (a, b, c, d, callback) { internalSelector.x = a; internalSelector.y = b; - internalSelector.f = c; + internalSelector.w = c; internalSelector.getNameSize = d; this.root.retrieve(internalSelector, callback) }, From 05bab5488e941f64c7da0b796068d7e5fe107eeb Mon Sep 17 00:00:00 2001 From: xf Date: Sun, 21 Jun 2015 16:39:01 +0800 Subject: [PATCH 23/88] var --- .idea/workspace.xml | 44 ++--- main_out.js | 391 ++++++++++++++++++++++---------------------- 2 files changed, 209 insertions(+), 226 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4cfc27f..a50289a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -58,8 +58,8 @@ - - + + @@ -111,7 +111,7 @@
- + @@ -122,30 +122,7 @@ - - - - - - - - - - - - - - - - - - + @@ -211,21 +188,21 @@ + + + - - - @@ -290,6 +267,7 @@ + @@ -333,6 +311,7 @@ + @@ -394,6 +373,7 @@ + @@ -437,8 +417,8 @@ - - + + diff --git a/main_out.js b/main_out.js index 3bd24fd..a7a9bbc 100755 --- a/main_out.js +++ b/main_out.js @@ -106,21 +106,21 @@ if (w) { wjQuery("#region").val(w); } - Ha(); + updateRegion(); setRegion(wjQuery("#region").val()); null == ws && w && showConnecting(); - wjQuery("#overlays").show() + wjQuery("#overlays").show(); } function handleWheel(event) { zoom *= Math.pow(.9, event.wheelDelta / -120 || event.detail || 0); - 1 > zoom && (zoom = 1); - zoom > 4 / viewZoom && (zoom = 4 / viewZoom) + if (zoom < 1) zoom = 1; + if (zoom > 4 / viewZoom) zoom = 4 / viewZoom; } function buildQTree() { - if (.4 > viewZoom) qTree = null; + if (viewZoom < .4) qTree = null; else { var a = Number.POSITIVE_INFINITY, b = Number.POSITIVE_INFINITY, @@ -151,7 +151,7 @@ for (a = 0; a < node.points.length; ++a) { b = node.points[a].x; c = node.points[a].y; - b < t - canvasWidth / 2 / viewZoom || c < u - canvasHeight / 2 / viewZoom || b > t + canvasWidth / 2 / viewZoom || c > u + canvasHeight / 2 / viewZoom || qTree.insert(node.points[a]); + b < nodex - canvasWidth / 2 / viewZoom || c < nodey - canvasHeight / 2 / viewZoom || b > nodex + canvasWidth / 2 / viewZoom || c > nodey + canvasHeight / 2 / viewZoom || qTree.insert(node.points[a]); } } } @@ -159,8 +159,8 @@ } function mouseCoordinateChange() { - X = (rawMouseX - canvasWidth / 2) / viewZoom + t; - Y = (rawMouseY - canvasHeight / 2) / viewZoom + u + X = (rawMouseX - canvasWidth / 2) / viewZoom + nodex; + Y = (rawMouseY - canvasHeight / 2) / viewZoom + nodey } function getServerList() { @@ -173,20 +173,20 @@ }); } wjQuery.get("info.php", function (a) { - var b = {}, c; - for (c in a.regions) { - var d = c.split(":")[0]; + var b = {}, region; + for (region in a.regions) { + var d = region.split(":")[0]; b[d] = b[d] || 0; - b[d] += a.regions[c].numPlayers + b[d] += a.regions[region].numPlayers } - for (c in b) wjQuery('#region option[value="' + c + '"]').text($[c] + " (" + b[c] + " players)") + for (region in b) wjQuery('#region option[value="' + region + '"]').text($[region] + " (" + b[region] + " players)") }, "json") } function hideOverlays() { wjQuery("#adsBottom").hide(); wjQuery("#overlays").hide(); - Ha() + updateRegion() } function setRegion(a) { @@ -203,12 +203,12 @@ } function showOverlays(a) { - F = null; + userNickName = null; wjQuery("#overlays").fadeIn(a ? 200 : 3E3); a || wjQuery("#adsBottom").fadeIn(3E3) } - function Ha() { + function updateRegion() { wjQuery("#region").val() ? wHandle.localStorage.location = wjQuery("#region").val() : wHandle.localStorage.location && wjQuery("#region").val(wHandle.localStorage.location); wjQuery("#region").val() ? wjQuery("#locationKnown").append(wjQuery("#region")) : wjQuery("#locationUnknown").append(wjQuery("#region")) } @@ -219,7 +219,7 @@ error: function () { setTimeout(attemptConnection, 1E3) }, - success: function (a) { + success: function (args) { wsConnect("ws://" + CONNECTION_URL) }, dataType: "text", @@ -256,14 +256,14 @@ wsUrl = wsUrl.split(":"); wsUrl = wsUrl[0] + "_strokeColor://ip-" + wsUrl[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+wsUrl[2] + 2E3); } - G = []; - n = []; + nodesOnScreen = []; + playerCells = []; A = {}; nodelist = []; Cells = []; leaderBoard = []; - Canvas = y = null; - J = 0; + Canvas = teamScores = null; + userScore = 0; console.log("Connecting to " + wsUrl); ws = new WebSocket(wsUrl); ws.binaryType = "arraybuffer"; @@ -271,7 +271,7 @@ ws.onmessage = onWsMessage; ws.onclose = onWsClose; ws.onerror = function () { - console.log("socket error") + console.log("socket error"); } } @@ -296,7 +296,7 @@ msg.setUint8(0, 255); msg.setUint32(1, 673720361, true); wsSend(msg); - Ka() + sendNickName() } function onWsClose() { @@ -337,22 +337,22 @@ offset += 4; break; case 20: // clear nodes - n = []; - G = []; + playerCells = []; + nodesOnScreen = []; break; case 21: // draw line lineX = msg.getInt16(offset, true); offset += 2; lineY = msg.getInt16(offset, true); offset += 2; - if (!ta) { - ta = true; - ca = lineX; - da = lineY; + if (!showLine) { + showLine = true; + showLineX = lineX; + showLineY = lineY; } break; case 32: // add node - G.push(msg.getUint32(offset, true)); + nodesOnScreen.push(msg.getUint32(offset, true)); offset += 4; break; case 48: // update leaderboard (custom text) @@ -362,7 +362,7 @@ if (!setCustomLB) { noRanking = false; } - y = null; + teamScores = null; var validElements = msg.getUint32(offset, true); offset += 4; leaderBoard = []; @@ -377,32 +377,31 @@ drawLeaderBoard(); break; case 50: // update leaderboard (teams) - y = []; - var validElements = msg.getUint32(offset, true); + teamScores = []; + var teamNum = msg.getUint32(offset, true); offset += 4; - for (var i = 0; i < validElements; ++i) { - y.push(msg.getFloat32(offset, true)); + for (var i = 0; i < teamNum; ++i) { + teamScores.push(msg.getFloat32(offset, true)); offset += 4; } drawLeaderBoard(); break; case 64: // set border - ea = msg.getFloat64(offset, true); + leftPos = msg.getFloat64(offset, true); offset += 8; - fa = msg.getFloat64(offset, true) - ; + topPos = msg.getFloat64(offset, true); offset += 8; - ga = msg.getFloat64(offset, true); + rightPos = msg.getFloat64(offset, true); offset += 8; - ha = msg.getFloat64(offset, true); + bottomPos = msg.getFloat64(offset, true); offset += 8; - posX = (ga + ea) / 2; - posY = (ha + fa) / 2; + posX = (rightPos + leftPos) / 2; + posY = (bottomPos + topPos) / 2; posSize = 1; - if (0 == n.length) { - t = posX; - u = posY; - viewZoom = posSize + if (0 == playerCells.length) { + nodex = posX; + nodey = posY; + viewZoom = posSize; } break; } @@ -479,12 +478,12 @@ node.updateTime = timestamp; node.nnn = flags; name && node.setName(name); - if (-1 != G.indexOf(nodeId) && -1 == n.indexOf(node)) { + if (-1 != nodesOnScreen.indexOf(nodeId) && -1 == playerCells.indexOf(node)) { document.getElementById("overlays").style.display = "none"; - n.push(node); - if (1 == n.length) { - t = node.x; - u = node.y; + playerCells.push(node); + if (1 == playerCells.length) { + nodex = node.x; + nodey = node.y; } } } @@ -496,7 +495,7 @@ node = A[nodeId]; null != node && node.destroy(); } - ua && 0 == n.length && showOverlays(false) + ua && 0 == playerCells.length && showOverlays(false) } function sendMouseMove() { @@ -504,9 +503,9 @@ if (wsIsOpen()) { msg = rawMouseX - canvasWidth / 2; var b = rawMouseY - canvasHeight / 2; - if (64 <= msg * msg + b * b && !(.01 > Math.abs(Ma - X) && .01 > Math.abs(Na - Y))) { - Ma = X; - Na = Y; + if (64 <= msg * msg + b * b && !(.01 > Math.abs(oldX - X) && .01 > Math.abs(oldY - Y))) { + oldX = X; + oldY = Y; msg = prepareData(21); msg.setUint8(0, 16); msg.setFloat64(1, X, true); @@ -517,11 +516,11 @@ } } - function Ka() { - if (wsIsOpen() && null != F) { - var msg = prepareData(1 + 2 * F.length); + function sendNickName() { + if (wsIsOpen() && null != userNickName) { + var msg = prepareData(1 + 2 * userNickName.length); msg.setUint8(0, 0); - for (var b = 0; b < F.length; ++b) msg.setUint16(1 + 2 * b, F.charCodeAt(b), true); + for (var b = 0; b < userNickName.length; ++b) msg.setUint16(1 + 2 * b, userNickName.charCodeAt(b), true); wsSend(msg) } } @@ -538,6 +537,8 @@ } } + + function redrawGameScene() { drawGameScene(); wHandle.requestAnimationFrame(redrawGameScene) @@ -554,37 +555,38 @@ function viewRange() { var a; a = Math.max(canvasHeight / 1080, canvasWidth / 1920); - return a *= zoom + return a *= zoom; } - function bb() { - if (0 != n.length) { - for (var a = 0, b = 0; b < n.length; b++) a += n[b].size; + function calcViewZoom() { + if (0 != playerCells.length) { + for (var a = 0, b = 0; b < playerCells.length; b++) a += playerCells[b].size; a = Math.pow(Math.min(64 / a, 1), .4) * viewRange(); viewZoom = (9 * viewZoom + a) / 10 } } function drawGameScene() { - var a, b = Date.now(); + var a; + var b = Date.now(); ++cb; timestamp = b; - if (0 < n.length) { - bb(); - var c = a = 0; - for (var d = 0; d < n.length; d++) { - n[d].updatePos(); - a += n[d].x / n.length; - c += n[d].y / n.length; + if (0 < playerCells.length) { + calcViewZoom(); + var scoreTextImage = a = 0; + for (var d = 0; d < playerCells.length; d++) { + playerCells[d].updatePos(); + a += playerCells[d].x / playerCells.length; + scoreTextImage += playerCells[d].y / playerCells.length; } posX = a; - posY = c; + posY = scoreTextImage; posSize = viewZoom; - t = (t + a) / 2; - u = (u + c) / 2 + nodex = (nodex + a) / 2; + nodey = (nodey + scoreTextImage) / 2 } else { - t = (29 * t + posX) / 30; - u = (29 * u + posY) / 30; + nodex = (29 * nodex + posX) / 30; + nodey = (29 * nodey + posY) / 30; viewZoom = (9 * viewZoom + posSize * viewRange()) / 10; } buildQTree(); @@ -611,15 +613,14 @@ ctx.save(); ctx.translate(canvasWidth / 2, canvasHeight / 2); ctx.scale(viewZoom, viewZoom); - ctx.translate(-t, -u); + ctx.translate(-nodex, -nodey); for (d = 0; d < Cells.length; d++) Cells[d].drawOneCell(ctx); for (d = 0; d < nodelist.length; d++) nodelist[d].drawOneCell(ctx); //console.log(Cells.length); - if (ta) { - ca = (3 * ca + lineX) / - 4; - da = (3 * da + lineY) / 4; + if (showLine) { + showLineX = (3 * showLineX + lineX) / 4; + showLineY = (3 * showLineY + lineY) / 4; ctx.save(); ctx.strokeStyle = "#FFAAAA"; ctx.lineWidth = 10; @@ -627,28 +628,29 @@ ctx.lineJoin = "round"; ctx.globalAlpha = .5; ctx.beginPath(); - for (d = 0; d < n.length; d++) { - ctx.moveTo(n[d].x, n[d].y); - ctx.lineTo(ca, da); + for (d = 0; d < playerCells.length; d++) { + ctx.moveTo(playerCells[d].x, playerCells[d].y); + ctx.lineTo(showLineX, showLineY); } ctx.stroke(); ctx.restore() } ctx.restore(); Canvas && Canvas.width && ctx.drawImage(Canvas, canvasWidth - Canvas.width - 10, 10); - J = Math.max(J, eb()); - if (0 != J) { - if (null == ja) { - ja = new ka(24, '#FFFFFF'); + userScore = Math.max(userScore, calcScore()); + //draw score + if (0 != userScore) { + if (scoreText == null) { + scoreText = new utext(24, '#FFFFFF'); } - ja.setValue('Score: ' + ~~(J / 100)); - c = ja.render(); - a = c.width; + scoreText.setValue('Score: ' + ~~(userScore / 100)); + scoreTextImage = scoreText.render(); + a = scoreTextImage.width; ctx.globalAlpha = .2; ctx.fillStyle = '#000000'; ctx.fillRect(10, canvasHeight - 10 - 24 - 10, a + 10, 34); ctx.globalAlpha = 1; - ctx.drawImage(c, 15, canvasHeight - 10 - 24 - 5); + ctx.drawImage(scoreTextImage, 15, canvasHeight - 10 - 24 - 5); } drawSplitIcon(); b = Date.now() - b; @@ -666,13 +668,13 @@ ctx.scale(viewZoom, viewZoom); var a = canvasWidth / viewZoom, b = canvasHeight / viewZoom; - for (var c = -.5 + (-t + a / 2) % 50; c < a; c += 50) { + for (var c = -.5 + (-nodex + a / 2) % 50; c < a; c += 50) { ctx.beginPath(); ctx.moveTo(c, 0); ctx.lineTo(c, b); ctx.stroke(); } - for (c = -.5 + (-u + b / 2) % 50; c < b; c += 50) { + for (c = -.5 + (-nodey + b / 2) % 50; c < b; c += 50) { ctx.beginPath(); ctx.moveTo(0, c); ctx.lineTo(a, c); @@ -683,68 +685,68 @@ function drawSplitIcon() { if (isTouchStart && splitIcon.width) { - var a = canvasWidth / 5; - ctx.drawImage(splitIcon, 5, 5, a, a) + var size = canvasWidth / 5; + ctx.drawImage(splitIcon, 5, 5, size, size) } } - function eb() { - for (var a = 0, b = 0; b < n.length; b++) a += n[b].nSize * n[b].nSize; - return a + function calcScore() { + for (var score = 0, i = 0; i < playerCells.length; i++) score += playerCells[i].nSize * playerCells[i].nSize; + return score; } function drawLeaderBoard() { Canvas = null; - if (null != y || 0 != leaderBoard.length) - if (null != y || showName) { + if (null != teamScores || 0 != leaderBoard.length) + if (null != teamScores || showName) { Canvas = document.createElement("canvas"); var ctx = Canvas.getContext("2d"), b = 60, - b = null == y ? b + 24 * leaderBoard.length : b + 180, - c = Math.min(200, .3 * canvasWidth) / 200; - Canvas.width = 200 * c; - Canvas.height = b * c; - ctx.scale(c, c); + b = null == teamScores ? b + 24 * leaderBoard.length : b + 180, + tmpString = Math.min(200, .3 * canvasWidth) / 200; + Canvas.width = 200 * tmpString; + Canvas.height = b * tmpString; + ctx.scale(tmpString, tmpString); ctx.globalAlpha = .4; ctx.fillStyle = "#000000"; ctx.fillRect(0, 0, 200, b); ctx.globalAlpha = 1; ctx.fillStyle = "#FFFFFF"; - c = null; - c = "Leaderboard"; + tmpString = null; + tmpString = "Leaderboard"; ctx.font = "30px Ubuntu"; - ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 40); - if (null == y) { + ctx.fillText(tmpString, 100 - ctx.measureText(tmpString).width / 2, 40); + if (null == teamScores) { for (ctx.font = "20px Ubuntu", b = 0; b < leaderBoard.length; ++b) { - c = leaderBoard[b].name || "An unnamed cell"; + tmpString = leaderBoard[b].name || "An unnamed cell"; if (!showName) { - (c = "An unnamed cell"); + (tmpString = "An unnamed cell"); } - if (-1 != G.indexOf(leaderBoard[b].id)) { - n[0].name && (c = n[0].name); + if (-1 != nodesOnScreen.indexOf(leaderBoard[b].id)) { + playerCells[0].name && (tmpString = playerCells[0].name); ctx.fillStyle = "#FFAAAA"; if (!noRanking) { - c = b + 1 + ". " + c; + tmpString = b + 1 + ". " + tmpString; } - ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b); + ctx.fillText(tmpString, 100 - ctx.measureText(tmpString).width / 2, 70 + 24 * b); } else { ctx.fillStyle = "#FFFFFF"; if (!noRanking) { - c = b + 1 + ". " + c; + tmpString = b + 1 + ". " + tmpString; } - ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b); + ctx.fillText(tmpString, 100 - ctx.measureText(tmpString).width / 2, 70 + 24 * b); } } } else { - for (b = c = 0; b < y.length; ++b) { - var d = c + y[b] * Math.PI * 2; + for (b = tmpString = 0; b < teamScores.length; ++b) { + var d = tmpString + teamScores[b] * Math.PI * 2; ctx.fillStyle = teamColor[b + 1]; ctx.beginPath(); ctx.moveTo(100, 140); - ctx.arc(100, 140, 80, c, d, false); + ctx.arc(100, 140, 80, tmpString, d, false); ctx.fill(); - c = d + tmpString = d } } } @@ -762,7 +764,7 @@ this.setName(uname) } - function ka(usize, ucolor, ustroke, ustrokecolor) { + function utext(usize, ucolor, ustroke, ustrokecolor) { usize && (this._size = usize); ucolor && (this._color = ucolor); this._stroke = !!ustroke; @@ -776,11 +778,12 @@ else { var nCanvas, ctx, Canvas, canvasWidth, canvasHeight, qTree = null, ws = null, - t = 0, - u = 0, - G = [], - n = [], - A = {}, nodelist = [], + nodex = 0, + nodey = 0, + nodesOnScreen = [], + playerCells = [], + A = {}, + nodelist = [], Cells = [], leaderBoard = [], rawMouseX = 0, @@ -789,31 +792,31 @@ Y = -1, cb = 0, timestamp = 0, - F = null, - ea = 0, - fa = 0, - ga = 1E4, - ha = 1E4, + userNickName = null, + leftPos = 0, + topPos = 0, + rightPos = 1E4, + bottomPos = 1E4, viewZoom = 1, w = null, showSkin = true, showName = true, showColor = false, ua = false, - J = 0, + userScore = 0, showDarkTheme = false, showMass = false, - posX = t = ~~((ea + ga) / 2), - posY = u = ~~((fa + ha) / 2), + posX = nodex = ~~((leftPos + rightPos) / 2), + posY = nodey = ~~((topPos + bottomPos) / 2), posSize = 1, N = "", - y = null, + teamScores = null, ma = false, - ta = false, + showLine = false, lineX = 0, lineY = 0, - ca = 0, - da = 0, + showLineX = 0, + showLineY = 0, Ra = 0, teamColor = ["#333333", "#FF3333", "#33FF33", "#3333FF"], xa = false, @@ -828,9 +831,9 @@ var $ = null; wHandle.setNick = function (arg) { hideOverlays(); - F = arg; - Ka(); - J = 0 + userNickName = arg; + sendNickName(); + userScore = 0 }; wHandle.setRegion = setRegion; wHandle.setSkins = function (arg) { @@ -849,7 +852,7 @@ showMass = arg }; wHandle.spectate = function () { - F = null; + userNickName = null; sendUint8(1); hideOverlays() }; @@ -925,11 +928,11 @@ var delay = 500, - Ma = -1, - Na = -1, + oldX = -1, + oldY = -1, Canvas = null, z = 1, - ja = null, + scoreText = null, K = {}, knownNameDict = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;hitler;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;doge;nasa;byzantium;imperial japan;french kingdom;somalia;turkey;mars;pokerface;8;irs;receita federal;facebook".split(";"), hb = ["8", "nasa"], @@ -959,21 +962,21 @@ isAgitated: false, wasSimpleDrawing: true, destroy: function () { - var a; - for (a = 0; a < nodelist.length; a++) - if (nodelist[a] == this) { - nodelist.splice(a, 1); - break + var i; + for (i = 0; i < nodelist.length; i++) + if (nodelist[i] == this) { + nodelist.splice(i, 1); + break; } delete A[this.id]; - a = n.indexOf(this); - if (-1 != a) { + i = playerCells.indexOf(this); + if (i != -1) { ua = true; - n.splice(a, 1); + playerCells.splice(i, 1); } - a = G.indexOf(this.id); - if (-1 != a) { - G.splice(a, 1); + i = nodesOnScreen.indexOf(this.id); + if (i != -1) { + nodesOnScreen.splice(i, 1); } this.destroyed = true; Cells.push(this) @@ -981,10 +984,10 @@ getNameSize: function () { return Math.max(~~(.3 * this.size), 24) }, - setName: function (a) { - if (this.name = a) { + setName: function (name) { + if (this.name = name) { if (null == this.nameCache) { - this.nameCache = new ka(this.getNameSize(), "#FFFFFF", true, "#000000"); + this.nameCache = new utext(this.getNameSize(), "#FFFFFF", true, "#000000"); this.nameCache.setValue(this.name); } else { this.nameCache.setSize(this.getNameSize()); @@ -993,33 +996,33 @@ } }, createPoints: function () { - for (var a = this.getNumPoints(); this.points.length > a;) { + for (var i = this.getSamplePointsNum(); this.points.length > i;) { var b = ~~(Math.random() * this.points.length); this.points.splice(b, 1); this.pointsAcc.splice(b, 1) } - if (0 == this.points.length && 0 < a) { + if (0 == this.points.length && 0 < i) { this.points.push({ S: this, - e: this.size, + size: this.size, x: this.x, y: this.y }); this.pointsAcc.push(Math.random() - .5); } - while (this.points.length < a) { + while (this.points.length < i) { var b = ~~(Math.random() * this.points.length), c = this.points[b]; this.points.splice(b, 0, { S: this, - e: c.e, + size: c.size, x: c.x, y: c.y }); this.pointsAcc.splice(b, 0, this.pointsAcc[b]) } }, - getNumPoints: function () { + getSamplePointsNum: function () { if (0 == this.id) return 16; var a = 10; 20 > this.size && (a = 0); @@ -1028,7 +1031,7 @@ this.isVirus || (b *= viewZoom); b *= z; this.nnn & 32 && (b *= .25); - return ~~Math.max(b, a) + return Math.max(b, a); }, movePoints: function () { this.createPoints(); @@ -1042,9 +1045,9 @@ b[d] = (e + m + 8 * b[d]) / 10 } for (var h = this, g = this.isVirus ? 0 : (this.id / 1E3 + timestamp / 1E4) % (2 * Math.PI), d = 0; d < c; ++d) { - var f = a[d].e, - e = a[(d - 1 + c) % c].e, - m = a[(d + 1) % c].e; + var f = a[d].size, + e = a[(d - 1 + c) % c].size, + m = a[(d + 1) % c].size; if (15 < this.size && null != qTree && 20 < this.size * viewZoom && 0 != this.id) { var l = false, n = a[d].x, @@ -1054,7 +1057,7 @@ l = true; } }); - if (!l && a[d].x < ea || a[d].y < fa || a[d].x > ga || a[d].y > ha) { + if (!l && a[d].x < leftPos || a[d].y < topPos || a[d].x > rightPos || a[d].y > bottomPos) { l = true; } if (l) { @@ -1067,9 +1070,9 @@ f += b[d]; 0 > f && (f = 0); f = this.isAgitated ? (19 * f + this.size) / 20 : (12 * f + this.size) / 13; - a[d].e = (e + m + 8 * f) / 10; + a[d].size = (e + m + 8 * f) / 10; e = 2 * Math.PI / c; - m = this.points[d].e; + m = this.points[d].size; this.isVirus && 0 == d % 2 && (m += 5); a[d].x = this.x + Math.cos(e * d + g) * m; a[d].y = this.y + Math.sin(e * d + g) * m @@ -1095,15 +1098,15 @@ if (0 == this.id) { return true } else { - return this.x + this.size + 40 < t - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < u - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > t + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > u + canvasHeight / 2 / viewZoom ? false : true + return this.x + this.size + 40 < nodex - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < nodey - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > nodex + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > nodey + canvasHeight / 2 / viewZoom ? false : true } }, drawOneCell: function (a) { if (this.shouldRender()) { var b = 0 != this.id && !this.isVirus && !this.isAgitated && .4 > viewZoom; - 5 > this.getNumPoints() && (b = true); + 5 > this.getSamplePointsNum() && (b = true); if (this.wasSimpleDrawing && !b) - for (var c = 0; c < this.points.length; c++) this.points[c].e = this.size; + for (var c = 0; c < this.points.length; c++) this.points[c].size = this.size; this.wasSimpleDrawing = b; a.save(); this.drawTime = timestamp; @@ -1126,7 +1129,7 @@ else { this.movePoints(); a.beginPath(); - var d = this.getNumPoints(); + var d = this.getSamplePointsNum(); a.moveTo(this.points[0].x, this.points[0].y); for (c = 1; c <= d; ++c) { var e = c % d; @@ -1170,7 +1173,7 @@ if (null != e && c) { a.drawImage(e, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); } - c = -1 != n.indexOf(this); + c = -1 != playerCells.indexOf(this); if (0 != this.id) { b = ~~this.y; if ((showName || c) && this.name && this.nameCache && (null == e || -1 == hb.indexOf(d))) { @@ -1185,9 +1188,9 @@ a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); b += e.height / 2 / d + 4 } - if (showMass && (c || 0 == n.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { + if (showMass && (c || 0 == playerCells.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { if (null == this.sizeCache) { - this.sizeCache = new ka(this.getNameSize() / 2, "#FFFFFF", true, "#000000") + this.sizeCache = new utext(this.getNameSize() / 2, "#FFFFFF", true, "#000000") } c = this.sizeCache; c.setSize(this.getNameSize() / 2); @@ -1204,7 +1207,7 @@ } } }; - ka.prototype = { + utext.prototype = { _value: "", _color: "#000000", _stroke: false, @@ -1265,7 +1268,7 @@ this._stroke && b.strokeText(c, 3, e - h / 2); b.fillText(c, 3, e - h / 2) } - return this._canvas + return this._canvas; } }; Date.now || (Date.now = function () { @@ -1289,14 +1292,14 @@ x: 0, y: 0, w: 0, - getNameSize: 0, + h: 0, depth: 0, items: null, nodes: null, exists: function (selector) { for (var i = 0; i < this.items.length; ++i) { var item = this.items[i]; - if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.w && item.y < selector.y + selector.getNameSize) return true + if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.w && item.y < selector.y + selector.h) return true } if (0 != this.nodes.length) { var self = this; @@ -1355,7 +1358,7 @@ x: 0, y: 0, w: 0, - getNameSize: 0 + h: 0 }; return { root: new Node(args.minX, args.minY, args.maxX - args.minX, args.maxY - args.minY, 0), @@ -1365,11 +1368,11 @@ retrieve: function (a, b) { this.root.retrieve(a, b) }, - retrieve2: function (a, b, c, d, callback) { - internalSelector.x = a; - internalSelector.y = b; - internalSelector.w = c; - internalSelector.getNameSize = d; + retrieve2: function (x, y, w, h, callback) { + internalSelector.x = x; + internalSelector.y = y; + internalSelector.w = w; + internalSelector.h = h; this.root.retrieve(internalSelector, callback) }, exists: function (a) { @@ -1383,9 +1386,9 @@ }; wjQuery(function () { function renderFavicon() { - if (0 < n.length) { - redCell.color = n[0].color; - redCell.setName(n[0].name); + if (0 < playerCells.length) { + redCell.color = playerCells[0].color; + redCell.setName(playerCells[0].name); } ctx.clearRect(0, 0, 32, 32); ctx.save(); From b72a23d7c0f97103a4fa26b19a2405fbd83325fe Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Sun, 21 Jun 2015 16:40:37 +0800 Subject: [PATCH 24/88] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f181dbd..c189590 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Introduction This is a clone of agar.io. In this project we aim to acheive the following. -- [ ] Hack main_out.js and make the variables and function names readable. +- [x] Hack main_out.js and make the variables and function names readable. Now most of the variable and function name should make sense. - [x] Add uploading custom skins features (Done) - [ ] Add in-game chat feature. (On-going) - [ ] Support multi-server feature (On-going) From 6f4801cfc1d853d45cfb55a4170c87e39afee42e Mon Sep 17 00:00:00 2001 From: xf Date: Sun, 21 Jun 2015 21:45:35 +0800 Subject: [PATCH 25/88] revert to 05bab54 due to a bug --- .idea/workspace.xml | 44 +++-- main_out.js | 391 ++++++++++++++++++++++---------------------- 2 files changed, 226 insertions(+), 209 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a50289a..4cfc27f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -58,8 +58,8 @@ - - + + @@ -111,7 +111,7 @@ - + @@ -122,7 +122,30 @@ - + + + + + + + + + + + + + + + + + + @@ -188,21 +211,21 @@ - - - + + + @@ -267,7 +290,6 @@ - @@ -311,7 +333,6 @@ - @@ -373,7 +394,6 @@ - @@ -417,8 +437,8 @@ - - + + diff --git a/main_out.js b/main_out.js index a7a9bbc..3bd24fd 100755 --- a/main_out.js +++ b/main_out.js @@ -106,21 +106,21 @@ if (w) { wjQuery("#region").val(w); } - updateRegion(); + Ha(); setRegion(wjQuery("#region").val()); null == ws && w && showConnecting(); - wjQuery("#overlays").show(); + wjQuery("#overlays").show() } function handleWheel(event) { zoom *= Math.pow(.9, event.wheelDelta / -120 || event.detail || 0); - if (zoom < 1) zoom = 1; - if (zoom > 4 / viewZoom) zoom = 4 / viewZoom; + 1 > zoom && (zoom = 1); + zoom > 4 / viewZoom && (zoom = 4 / viewZoom) } function buildQTree() { - if (viewZoom < .4) qTree = null; + if (.4 > viewZoom) qTree = null; else { var a = Number.POSITIVE_INFINITY, b = Number.POSITIVE_INFINITY, @@ -151,7 +151,7 @@ for (a = 0; a < node.points.length; ++a) { b = node.points[a].x; c = node.points[a].y; - b < nodex - canvasWidth / 2 / viewZoom || c < nodey - canvasHeight / 2 / viewZoom || b > nodex + canvasWidth / 2 / viewZoom || c > nodey + canvasHeight / 2 / viewZoom || qTree.insert(node.points[a]); + b < t - canvasWidth / 2 / viewZoom || c < u - canvasHeight / 2 / viewZoom || b > t + canvasWidth / 2 / viewZoom || c > u + canvasHeight / 2 / viewZoom || qTree.insert(node.points[a]); } } } @@ -159,8 +159,8 @@ } function mouseCoordinateChange() { - X = (rawMouseX - canvasWidth / 2) / viewZoom + nodex; - Y = (rawMouseY - canvasHeight / 2) / viewZoom + nodey + X = (rawMouseX - canvasWidth / 2) / viewZoom + t; + Y = (rawMouseY - canvasHeight / 2) / viewZoom + u } function getServerList() { @@ -173,20 +173,20 @@ }); } wjQuery.get("info.php", function (a) { - var b = {}, region; - for (region in a.regions) { - var d = region.split(":")[0]; + var b = {}, c; + for (c in a.regions) { + var d = c.split(":")[0]; b[d] = b[d] || 0; - b[d] += a.regions[region].numPlayers + b[d] += a.regions[c].numPlayers } - for (region in b) wjQuery('#region option[value="' + region + '"]').text($[region] + " (" + b[region] + " players)") + for (c in b) wjQuery('#region option[value="' + c + '"]').text($[c] + " (" + b[c] + " players)") }, "json") } function hideOverlays() { wjQuery("#adsBottom").hide(); wjQuery("#overlays").hide(); - updateRegion() + Ha() } function setRegion(a) { @@ -203,12 +203,12 @@ } function showOverlays(a) { - userNickName = null; + F = null; wjQuery("#overlays").fadeIn(a ? 200 : 3E3); a || wjQuery("#adsBottom").fadeIn(3E3) } - function updateRegion() { + function Ha() { wjQuery("#region").val() ? wHandle.localStorage.location = wjQuery("#region").val() : wHandle.localStorage.location && wjQuery("#region").val(wHandle.localStorage.location); wjQuery("#region").val() ? wjQuery("#locationKnown").append(wjQuery("#region")) : wjQuery("#locationUnknown").append(wjQuery("#region")) } @@ -219,7 +219,7 @@ error: function () { setTimeout(attemptConnection, 1E3) }, - success: function (args) { + success: function (a) { wsConnect("ws://" + CONNECTION_URL) }, dataType: "text", @@ -256,14 +256,14 @@ wsUrl = wsUrl.split(":"); wsUrl = wsUrl[0] + "_strokeColor://ip-" + wsUrl[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+wsUrl[2] + 2E3); } - nodesOnScreen = []; - playerCells = []; + G = []; + n = []; A = {}; nodelist = []; Cells = []; leaderBoard = []; - Canvas = teamScores = null; - userScore = 0; + Canvas = y = null; + J = 0; console.log("Connecting to " + wsUrl); ws = new WebSocket(wsUrl); ws.binaryType = "arraybuffer"; @@ -271,7 +271,7 @@ ws.onmessage = onWsMessage; ws.onclose = onWsClose; ws.onerror = function () { - console.log("socket error"); + console.log("socket error") } } @@ -296,7 +296,7 @@ msg.setUint8(0, 255); msg.setUint32(1, 673720361, true); wsSend(msg); - sendNickName() + Ka() } function onWsClose() { @@ -337,22 +337,22 @@ offset += 4; break; case 20: // clear nodes - playerCells = []; - nodesOnScreen = []; + n = []; + G = []; break; case 21: // draw line lineX = msg.getInt16(offset, true); offset += 2; lineY = msg.getInt16(offset, true); offset += 2; - if (!showLine) { - showLine = true; - showLineX = lineX; - showLineY = lineY; + if (!ta) { + ta = true; + ca = lineX; + da = lineY; } break; case 32: // add node - nodesOnScreen.push(msg.getUint32(offset, true)); + G.push(msg.getUint32(offset, true)); offset += 4; break; case 48: // update leaderboard (custom text) @@ -362,7 +362,7 @@ if (!setCustomLB) { noRanking = false; } - teamScores = null; + y = null; var validElements = msg.getUint32(offset, true); offset += 4; leaderBoard = []; @@ -377,31 +377,32 @@ drawLeaderBoard(); break; case 50: // update leaderboard (teams) - teamScores = []; - var teamNum = msg.getUint32(offset, true); + y = []; + var validElements = msg.getUint32(offset, true); offset += 4; - for (var i = 0; i < teamNum; ++i) { - teamScores.push(msg.getFloat32(offset, true)); + for (var i = 0; i < validElements; ++i) { + y.push(msg.getFloat32(offset, true)); offset += 4; } drawLeaderBoard(); break; case 64: // set border - leftPos = msg.getFloat64(offset, true); + ea = msg.getFloat64(offset, true); offset += 8; - topPos = msg.getFloat64(offset, true); + fa = msg.getFloat64(offset, true) + ; offset += 8; - rightPos = msg.getFloat64(offset, true); + ga = msg.getFloat64(offset, true); offset += 8; - bottomPos = msg.getFloat64(offset, true); + ha = msg.getFloat64(offset, true); offset += 8; - posX = (rightPos + leftPos) / 2; - posY = (bottomPos + topPos) / 2; + posX = (ga + ea) / 2; + posY = (ha + fa) / 2; posSize = 1; - if (0 == playerCells.length) { - nodex = posX; - nodey = posY; - viewZoom = posSize; + if (0 == n.length) { + t = posX; + u = posY; + viewZoom = posSize } break; } @@ -478,12 +479,12 @@ node.updateTime = timestamp; node.nnn = flags; name && node.setName(name); - if (-1 != nodesOnScreen.indexOf(nodeId) && -1 == playerCells.indexOf(node)) { + if (-1 != G.indexOf(nodeId) && -1 == n.indexOf(node)) { document.getElementById("overlays").style.display = "none"; - playerCells.push(node); - if (1 == playerCells.length) { - nodex = node.x; - nodey = node.y; + n.push(node); + if (1 == n.length) { + t = node.x; + u = node.y; } } } @@ -495,7 +496,7 @@ node = A[nodeId]; null != node && node.destroy(); } - ua && 0 == playerCells.length && showOverlays(false) + ua && 0 == n.length && showOverlays(false) } function sendMouseMove() { @@ -503,9 +504,9 @@ if (wsIsOpen()) { msg = rawMouseX - canvasWidth / 2; var b = rawMouseY - canvasHeight / 2; - if (64 <= msg * msg + b * b && !(.01 > Math.abs(oldX - X) && .01 > Math.abs(oldY - Y))) { - oldX = X; - oldY = Y; + if (64 <= msg * msg + b * b && !(.01 > Math.abs(Ma - X) && .01 > Math.abs(Na - Y))) { + Ma = X; + Na = Y; msg = prepareData(21); msg.setUint8(0, 16); msg.setFloat64(1, X, true); @@ -516,11 +517,11 @@ } } - function sendNickName() { - if (wsIsOpen() && null != userNickName) { - var msg = prepareData(1 + 2 * userNickName.length); + function Ka() { + if (wsIsOpen() && null != F) { + var msg = prepareData(1 + 2 * F.length); msg.setUint8(0, 0); - for (var b = 0; b < userNickName.length; ++b) msg.setUint16(1 + 2 * b, userNickName.charCodeAt(b), true); + for (var b = 0; b < F.length; ++b) msg.setUint16(1 + 2 * b, F.charCodeAt(b), true); wsSend(msg) } } @@ -537,8 +538,6 @@ } } - - function redrawGameScene() { drawGameScene(); wHandle.requestAnimationFrame(redrawGameScene) @@ -555,38 +554,37 @@ function viewRange() { var a; a = Math.max(canvasHeight / 1080, canvasWidth / 1920); - return a *= zoom; + return a *= zoom } - function calcViewZoom() { - if (0 != playerCells.length) { - for (var a = 0, b = 0; b < playerCells.length; b++) a += playerCells[b].size; + function bb() { + if (0 != n.length) { + for (var a = 0, b = 0; b < n.length; b++) a += n[b].size; a = Math.pow(Math.min(64 / a, 1), .4) * viewRange(); viewZoom = (9 * viewZoom + a) / 10 } } function drawGameScene() { - var a; - var b = Date.now(); + var a, b = Date.now(); ++cb; timestamp = b; - if (0 < playerCells.length) { - calcViewZoom(); - var scoreTextImage = a = 0; - for (var d = 0; d < playerCells.length; d++) { - playerCells[d].updatePos(); - a += playerCells[d].x / playerCells.length; - scoreTextImage += playerCells[d].y / playerCells.length; + if (0 < n.length) { + bb(); + var c = a = 0; + for (var d = 0; d < n.length; d++) { + n[d].updatePos(); + a += n[d].x / n.length; + c += n[d].y / n.length; } posX = a; - posY = scoreTextImage; + posY = c; posSize = viewZoom; - nodex = (nodex + a) / 2; - nodey = (nodey + scoreTextImage) / 2 + t = (t + a) / 2; + u = (u + c) / 2 } else { - nodex = (29 * nodex + posX) / 30; - nodey = (29 * nodey + posY) / 30; + t = (29 * t + posX) / 30; + u = (29 * u + posY) / 30; viewZoom = (9 * viewZoom + posSize * viewRange()) / 10; } buildQTree(); @@ -613,14 +611,15 @@ ctx.save(); ctx.translate(canvasWidth / 2, canvasHeight / 2); ctx.scale(viewZoom, viewZoom); - ctx.translate(-nodex, -nodey); + ctx.translate(-t, -u); for (d = 0; d < Cells.length; d++) Cells[d].drawOneCell(ctx); for (d = 0; d < nodelist.length; d++) nodelist[d].drawOneCell(ctx); //console.log(Cells.length); - if (showLine) { - showLineX = (3 * showLineX + lineX) / 4; - showLineY = (3 * showLineY + lineY) / 4; + if (ta) { + ca = (3 * ca + lineX) / + 4; + da = (3 * da + lineY) / 4; ctx.save(); ctx.strokeStyle = "#FFAAAA"; ctx.lineWidth = 10; @@ -628,29 +627,28 @@ ctx.lineJoin = "round"; ctx.globalAlpha = .5; ctx.beginPath(); - for (d = 0; d < playerCells.length; d++) { - ctx.moveTo(playerCells[d].x, playerCells[d].y); - ctx.lineTo(showLineX, showLineY); + for (d = 0; d < n.length; d++) { + ctx.moveTo(n[d].x, n[d].y); + ctx.lineTo(ca, da); } ctx.stroke(); ctx.restore() } ctx.restore(); Canvas && Canvas.width && ctx.drawImage(Canvas, canvasWidth - Canvas.width - 10, 10); - userScore = Math.max(userScore, calcScore()); - //draw score - if (0 != userScore) { - if (scoreText == null) { - scoreText = new utext(24, '#FFFFFF'); + J = Math.max(J, eb()); + if (0 != J) { + if (null == ja) { + ja = new ka(24, '#FFFFFF'); } - scoreText.setValue('Score: ' + ~~(userScore / 100)); - scoreTextImage = scoreText.render(); - a = scoreTextImage.width; + ja.setValue('Score: ' + ~~(J / 100)); + c = ja.render(); + a = c.width; ctx.globalAlpha = .2; ctx.fillStyle = '#000000'; ctx.fillRect(10, canvasHeight - 10 - 24 - 10, a + 10, 34); ctx.globalAlpha = 1; - ctx.drawImage(scoreTextImage, 15, canvasHeight - 10 - 24 - 5); + ctx.drawImage(c, 15, canvasHeight - 10 - 24 - 5); } drawSplitIcon(); b = Date.now() - b; @@ -668,13 +666,13 @@ ctx.scale(viewZoom, viewZoom); var a = canvasWidth / viewZoom, b = canvasHeight / viewZoom; - for (var c = -.5 + (-nodex + a / 2) % 50; c < a; c += 50) { + for (var c = -.5 + (-t + a / 2) % 50; c < a; c += 50) { ctx.beginPath(); ctx.moveTo(c, 0); ctx.lineTo(c, b); ctx.stroke(); } - for (c = -.5 + (-nodey + b / 2) % 50; c < b; c += 50) { + for (c = -.5 + (-u + b / 2) % 50; c < b; c += 50) { ctx.beginPath(); ctx.moveTo(0, c); ctx.lineTo(a, c); @@ -685,68 +683,68 @@ function drawSplitIcon() { if (isTouchStart && splitIcon.width) { - var size = canvasWidth / 5; - ctx.drawImage(splitIcon, 5, 5, size, size) + var a = canvasWidth / 5; + ctx.drawImage(splitIcon, 5, 5, a, a) } } - function calcScore() { - for (var score = 0, i = 0; i < playerCells.length; i++) score += playerCells[i].nSize * playerCells[i].nSize; - return score; + function eb() { + for (var a = 0, b = 0; b < n.length; b++) a += n[b].nSize * n[b].nSize; + return a } function drawLeaderBoard() { Canvas = null; - if (null != teamScores || 0 != leaderBoard.length) - if (null != teamScores || showName) { + if (null != y || 0 != leaderBoard.length) + if (null != y || showName) { Canvas = document.createElement("canvas"); var ctx = Canvas.getContext("2d"), b = 60, - b = null == teamScores ? b + 24 * leaderBoard.length : b + 180, - tmpString = Math.min(200, .3 * canvasWidth) / 200; - Canvas.width = 200 * tmpString; - Canvas.height = b * tmpString; - ctx.scale(tmpString, tmpString); + b = null == y ? b + 24 * leaderBoard.length : b + 180, + c = Math.min(200, .3 * canvasWidth) / 200; + Canvas.width = 200 * c; + Canvas.height = b * c; + ctx.scale(c, c); ctx.globalAlpha = .4; ctx.fillStyle = "#000000"; ctx.fillRect(0, 0, 200, b); ctx.globalAlpha = 1; ctx.fillStyle = "#FFFFFF"; - tmpString = null; - tmpString = "Leaderboard"; + c = null; + c = "Leaderboard"; ctx.font = "30px Ubuntu"; - ctx.fillText(tmpString, 100 - ctx.measureText(tmpString).width / 2, 40); - if (null == teamScores) { + ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 40); + if (null == y) { for (ctx.font = "20px Ubuntu", b = 0; b < leaderBoard.length; ++b) { - tmpString = leaderBoard[b].name || "An unnamed cell"; + c = leaderBoard[b].name || "An unnamed cell"; if (!showName) { - (tmpString = "An unnamed cell"); + (c = "An unnamed cell"); } - if (-1 != nodesOnScreen.indexOf(leaderBoard[b].id)) { - playerCells[0].name && (tmpString = playerCells[0].name); + if (-1 != G.indexOf(leaderBoard[b].id)) { + n[0].name && (c = n[0].name); ctx.fillStyle = "#FFAAAA"; if (!noRanking) { - tmpString = b + 1 + ". " + tmpString; + c = b + 1 + ". " + c; } - ctx.fillText(tmpString, 100 - ctx.measureText(tmpString).width / 2, 70 + 24 * b); + ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b); } else { ctx.fillStyle = "#FFFFFF"; if (!noRanking) { - tmpString = b + 1 + ". " + tmpString; + c = b + 1 + ". " + c; } - ctx.fillText(tmpString, 100 - ctx.measureText(tmpString).width / 2, 70 + 24 * b); + ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 70 + 24 * b); } } } else { - for (b = tmpString = 0; b < teamScores.length; ++b) { - var d = tmpString + teamScores[b] * Math.PI * 2; + for (b = c = 0; b < y.length; ++b) { + var d = c + y[b] * Math.PI * 2; ctx.fillStyle = teamColor[b + 1]; ctx.beginPath(); ctx.moveTo(100, 140); - ctx.arc(100, 140, 80, tmpString, d, false); + ctx.arc(100, 140, 80, c, d, false); ctx.fill(); - tmpString = d + c = d } } } @@ -764,7 +762,7 @@ this.setName(uname) } - function utext(usize, ucolor, ustroke, ustrokecolor) { + function ka(usize, ucolor, ustroke, ustrokecolor) { usize && (this._size = usize); ucolor && (this._color = ucolor); this._stroke = !!ustroke; @@ -778,12 +776,11 @@ else { var nCanvas, ctx, Canvas, canvasWidth, canvasHeight, qTree = null, ws = null, - nodex = 0, - nodey = 0, - nodesOnScreen = [], - playerCells = [], - A = {}, - nodelist = [], + t = 0, + u = 0, + G = [], + n = [], + A = {}, nodelist = [], Cells = [], leaderBoard = [], rawMouseX = 0, @@ -792,31 +789,31 @@ Y = -1, cb = 0, timestamp = 0, - userNickName = null, - leftPos = 0, - topPos = 0, - rightPos = 1E4, - bottomPos = 1E4, + F = null, + ea = 0, + fa = 0, + ga = 1E4, + ha = 1E4, viewZoom = 1, w = null, showSkin = true, showName = true, showColor = false, ua = false, - userScore = 0, + J = 0, showDarkTheme = false, showMass = false, - posX = nodex = ~~((leftPos + rightPos) / 2), - posY = nodey = ~~((topPos + bottomPos) / 2), + posX = t = ~~((ea + ga) / 2), + posY = u = ~~((fa + ha) / 2), posSize = 1, N = "", - teamScores = null, + y = null, ma = false, - showLine = false, + ta = false, lineX = 0, lineY = 0, - showLineX = 0, - showLineY = 0, + ca = 0, + da = 0, Ra = 0, teamColor = ["#333333", "#FF3333", "#33FF33", "#3333FF"], xa = false, @@ -831,9 +828,9 @@ var $ = null; wHandle.setNick = function (arg) { hideOverlays(); - userNickName = arg; - sendNickName(); - userScore = 0 + F = arg; + Ka(); + J = 0 }; wHandle.setRegion = setRegion; wHandle.setSkins = function (arg) { @@ -852,7 +849,7 @@ showMass = arg }; wHandle.spectate = function () { - userNickName = null; + F = null; sendUint8(1); hideOverlays() }; @@ -928,11 +925,11 @@ var delay = 500, - oldX = -1, - oldY = -1, + Ma = -1, + Na = -1, Canvas = null, z = 1, - scoreText = null, + ja = null, K = {}, knownNameDict = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;hitler;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;doge;nasa;byzantium;imperial japan;french kingdom;somalia;turkey;mars;pokerface;8;irs;receita federal;facebook".split(";"), hb = ["8", "nasa"], @@ -962,21 +959,21 @@ isAgitated: false, wasSimpleDrawing: true, destroy: function () { - var i; - for (i = 0; i < nodelist.length; i++) - if (nodelist[i] == this) { - nodelist.splice(i, 1); - break; + var a; + for (a = 0; a < nodelist.length; a++) + if (nodelist[a] == this) { + nodelist.splice(a, 1); + break } delete A[this.id]; - i = playerCells.indexOf(this); - if (i != -1) { + a = n.indexOf(this); + if (-1 != a) { ua = true; - playerCells.splice(i, 1); + n.splice(a, 1); } - i = nodesOnScreen.indexOf(this.id); - if (i != -1) { - nodesOnScreen.splice(i, 1); + a = G.indexOf(this.id); + if (-1 != a) { + G.splice(a, 1); } this.destroyed = true; Cells.push(this) @@ -984,10 +981,10 @@ getNameSize: function () { return Math.max(~~(.3 * this.size), 24) }, - setName: function (name) { - if (this.name = name) { + setName: function (a) { + if (this.name = a) { if (null == this.nameCache) { - this.nameCache = new utext(this.getNameSize(), "#FFFFFF", true, "#000000"); + this.nameCache = new ka(this.getNameSize(), "#FFFFFF", true, "#000000"); this.nameCache.setValue(this.name); } else { this.nameCache.setSize(this.getNameSize()); @@ -996,33 +993,33 @@ } }, createPoints: function () { - for (var i = this.getSamplePointsNum(); this.points.length > i;) { + for (var a = this.getNumPoints(); this.points.length > a;) { var b = ~~(Math.random() * this.points.length); this.points.splice(b, 1); this.pointsAcc.splice(b, 1) } - if (0 == this.points.length && 0 < i) { + if (0 == this.points.length && 0 < a) { this.points.push({ S: this, - size: this.size, + e: this.size, x: this.x, y: this.y }); this.pointsAcc.push(Math.random() - .5); } - while (this.points.length < i) { + while (this.points.length < a) { var b = ~~(Math.random() * this.points.length), c = this.points[b]; this.points.splice(b, 0, { S: this, - size: c.size, + e: c.e, x: c.x, y: c.y }); this.pointsAcc.splice(b, 0, this.pointsAcc[b]) } }, - getSamplePointsNum: function () { + getNumPoints: function () { if (0 == this.id) return 16; var a = 10; 20 > this.size && (a = 0); @@ -1031,7 +1028,7 @@ this.isVirus || (b *= viewZoom); b *= z; this.nnn & 32 && (b *= .25); - return Math.max(b, a); + return ~~Math.max(b, a) }, movePoints: function () { this.createPoints(); @@ -1045,9 +1042,9 @@ b[d] = (e + m + 8 * b[d]) / 10 } for (var h = this, g = this.isVirus ? 0 : (this.id / 1E3 + timestamp / 1E4) % (2 * Math.PI), d = 0; d < c; ++d) { - var f = a[d].size, - e = a[(d - 1 + c) % c].size, - m = a[(d + 1) % c].size; + var f = a[d].e, + e = a[(d - 1 + c) % c].e, + m = a[(d + 1) % c].e; if (15 < this.size && null != qTree && 20 < this.size * viewZoom && 0 != this.id) { var l = false, n = a[d].x, @@ -1057,7 +1054,7 @@ l = true; } }); - if (!l && a[d].x < leftPos || a[d].y < topPos || a[d].x > rightPos || a[d].y > bottomPos) { + if (!l && a[d].x < ea || a[d].y < fa || a[d].x > ga || a[d].y > ha) { l = true; } if (l) { @@ -1070,9 +1067,9 @@ f += b[d]; 0 > f && (f = 0); f = this.isAgitated ? (19 * f + this.size) / 20 : (12 * f + this.size) / 13; - a[d].size = (e + m + 8 * f) / 10; + a[d].e = (e + m + 8 * f) / 10; e = 2 * Math.PI / c; - m = this.points[d].size; + m = this.points[d].e; this.isVirus && 0 == d % 2 && (m += 5); a[d].x = this.x + Math.cos(e * d + g) * m; a[d].y = this.y + Math.sin(e * d + g) * m @@ -1098,15 +1095,15 @@ if (0 == this.id) { return true } else { - return this.x + this.size + 40 < nodex - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < nodey - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > nodex + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > nodey + canvasHeight / 2 / viewZoom ? false : true + return this.x + this.size + 40 < t - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < u - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > t + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > u + canvasHeight / 2 / viewZoom ? false : true } }, drawOneCell: function (a) { if (this.shouldRender()) { var b = 0 != this.id && !this.isVirus && !this.isAgitated && .4 > viewZoom; - 5 > this.getSamplePointsNum() && (b = true); + 5 > this.getNumPoints() && (b = true); if (this.wasSimpleDrawing && !b) - for (var c = 0; c < this.points.length; c++) this.points[c].size = this.size; + for (var c = 0; c < this.points.length; c++) this.points[c].e = this.size; this.wasSimpleDrawing = b; a.save(); this.drawTime = timestamp; @@ -1129,7 +1126,7 @@ else { this.movePoints(); a.beginPath(); - var d = this.getSamplePointsNum(); + var d = this.getNumPoints(); a.moveTo(this.points[0].x, this.points[0].y); for (c = 1; c <= d; ++c) { var e = c % d; @@ -1173,7 +1170,7 @@ if (null != e && c) { a.drawImage(e, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); } - c = -1 != playerCells.indexOf(this); + c = -1 != n.indexOf(this); if (0 != this.id) { b = ~~this.y; if ((showName || c) && this.name && this.nameCache && (null == e || -1 == hb.indexOf(d))) { @@ -1188,9 +1185,9 @@ a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); b += e.height / 2 / d + 4 } - if (showMass && (c || 0 == playerCells.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { + if (showMass && (c || 0 == n.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { if (null == this.sizeCache) { - this.sizeCache = new utext(this.getNameSize() / 2, "#FFFFFF", true, "#000000") + this.sizeCache = new ka(this.getNameSize() / 2, "#FFFFFF", true, "#000000") } c = this.sizeCache; c.setSize(this.getNameSize() / 2); @@ -1207,7 +1204,7 @@ } } }; - utext.prototype = { + ka.prototype = { _value: "", _color: "#000000", _stroke: false, @@ -1268,7 +1265,7 @@ this._stroke && b.strokeText(c, 3, e - h / 2); b.fillText(c, 3, e - h / 2) } - return this._canvas; + return this._canvas } }; Date.now || (Date.now = function () { @@ -1292,14 +1289,14 @@ x: 0, y: 0, w: 0, - h: 0, + getNameSize: 0, depth: 0, items: null, nodes: null, exists: function (selector) { for (var i = 0; i < this.items.length; ++i) { var item = this.items[i]; - if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.w && item.y < selector.y + selector.h) return true + if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.w && item.y < selector.y + selector.getNameSize) return true } if (0 != this.nodes.length) { var self = this; @@ -1358,7 +1355,7 @@ x: 0, y: 0, w: 0, - h: 0 + getNameSize: 0 }; return { root: new Node(args.minX, args.minY, args.maxX - args.minX, args.maxY - args.minY, 0), @@ -1368,11 +1365,11 @@ retrieve: function (a, b) { this.root.retrieve(a, b) }, - retrieve2: function (x, y, w, h, callback) { - internalSelector.x = x; - internalSelector.y = y; - internalSelector.w = w; - internalSelector.h = h; + retrieve2: function (a, b, c, d, callback) { + internalSelector.x = a; + internalSelector.y = b; + internalSelector.w = c; + internalSelector.getNameSize = d; this.root.retrieve(internalSelector, callback) }, exists: function (a) { @@ -1386,9 +1383,9 @@ }; wjQuery(function () { function renderFavicon() { - if (0 < playerCells.length) { - redCell.color = playerCells[0].color; - redCell.setName(playerCells[0].name); + if (0 < n.length) { + redCell.color = n[0].color; + redCell.setName(n[0].name); } ctx.clearRect(0, 0, 32, 32); ctx.save(); From dfea9912717cb3704717c482e796f105ee9b6c35 Mon Sep 17 00:00:00 2001 From: m-byte Date: Sun, 21 Jun 2015 18:39:25 +0200 Subject: [PATCH 26/88] Changed the value of package 255 to 1332175218 (ASCII for "Ogar") and the value of package 254 to 1 (Version number) --- .idea/workspace.xml | 287 +++++++++++++++++++++++++++----------------- main_out.js | 4 +- 2 files changed, 181 insertions(+), 110 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2debb5f..547cef9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,14 @@ + + - - + + @@ -24,53 +29,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -79,13 +42,18 @@ + @@ -97,9 +65,10 @@ - @@ -112,7 +81,7 @@ - + @@ -123,30 +92,7 @@ - - - - - - - - - - - - - - - - - - + @@ -204,29 +150,97 @@ - + - + - + - - - - - + + + + - - - + + + + + @@ -240,16 +254,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -270,7 +358,6 @@ - @@ -278,7 +365,6 @@ - @@ -286,7 +372,6 @@ - @@ -294,7 +379,6 @@ - @@ -302,9 +386,6 @@ - - - @@ -325,7 +406,6 @@ - @@ -333,7 +413,6 @@ - @@ -341,7 +420,6 @@ - @@ -349,7 +427,6 @@ - @@ -357,7 +434,6 @@ - @@ -370,7 +446,6 @@ - @@ -378,13 +453,12 @@ - - + @@ -392,18 +466,15 @@ - + - - - - - + + diff --git a/main_out.js b/main_out.js index eb636fe..013399d 100755 --- a/main_out.js +++ b/main_out.js @@ -290,11 +290,11 @@ console.log("socket open"); msg = prepareData(5); msg.setUint8(0, 254); - msg.setUint32(1, 4, true); + msg.setUint32(1, 1, true); wsSend(msg); msg = prepareData(5); msg.setUint8(0, 255); - msg.setUint32(1, 673720361, true); + msg.setUint32(1, 1332175218, true); wsSend(msg); Ka() } From 2cc9f84b01a0fded0f3303ac145724375d25ce29 Mon Sep 17 00:00:00 2001 From: xf Date: Mon, 22 Jun 2015 00:57:16 +0800 Subject: [PATCH 27/88] fix bug --- .idea/workspace.xml | 92 ++++++++++++++++- main_out.js | 245 ++++++++++++++++++++++---------------------- 2 files changed, 210 insertions(+), 127 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1a26eb7..8ad246b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -59,8 +59,8 @@ - - + + @@ -245,6 +245,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -480,8 +564,8 @@ - - + + diff --git a/main_out.js b/main_out.js index 3bd24fd..f3c29c0 100755 --- a/main_out.js +++ b/main_out.js @@ -151,7 +151,7 @@ for (a = 0; a < node.points.length; ++a) { b = node.points[a].x; c = node.points[a].y; - b < t - canvasWidth / 2 / viewZoom || c < u - canvasHeight / 2 / viewZoom || b > t + canvasWidth / 2 / viewZoom || c > u + canvasHeight / 2 / viewZoom || qTree.insert(node.points[a]); + b < nodeX - canvasWidth / 2 / viewZoom || c < nodeY - canvasHeight / 2 / viewZoom || b > nodeX + canvasWidth / 2 / viewZoom || c > nodeY + canvasHeight / 2 / viewZoom || qTree.insert(node.points[a]); } } } @@ -159,8 +159,8 @@ } function mouseCoordinateChange() { - X = (rawMouseX - canvasWidth / 2) / viewZoom + t; - Y = (rawMouseY - canvasHeight / 2) / viewZoom + u + X = (rawMouseX - canvasWidth / 2) / viewZoom + nodeX; + Y = (rawMouseY - canvasHeight / 2) / viewZoom + nodeY } function getServerList() { @@ -202,10 +202,10 @@ } } - function showOverlays(a) { - F = null; - wjQuery("#overlays").fadeIn(a ? 200 : 3E3); - a || wjQuery("#adsBottom").fadeIn(3E3) + function showOverlays(arg) { + userNickName = null; + wjQuery("#overlays").fadeIn(arg ? 200 : 3E3); + arg || wjQuery("#adsBottom").fadeIn(3E3) } function Ha() { @@ -256,14 +256,14 @@ wsUrl = wsUrl.split(":"); wsUrl = wsUrl[0] + "_strokeColor://ip-" + wsUrl[1].replace(/\./g, "-").replace(/\//g, "") + ".tech.agar.io:" + (+wsUrl[2] + 2E3); } - G = []; - n = []; + nodesOnScreen = []; + playerCells = []; A = {}; nodelist = []; Cells = []; leaderBoard = []; - Canvas = y = null; - J = 0; + Canvas = teamScores = null; + userScore = 0; console.log("Connecting to " + wsUrl); ws = new WebSocket(wsUrl); ws.binaryType = "arraybuffer"; @@ -296,7 +296,7 @@ msg.setUint8(0, 255); msg.setUint32(1, 673720361, true); wsSend(msg); - Ka() + sendNickName() } function onWsClose() { @@ -337,8 +337,8 @@ offset += 4; break; case 20: // clear nodes - n = []; - G = []; + playerCells = []; + nodesOnScreen = []; break; case 21: // draw line lineX = msg.getInt16(offset, true); @@ -352,7 +352,7 @@ } break; case 32: // add node - G.push(msg.getUint32(offset, true)); + nodesOnScreen.push(msg.getUint32(offset, true)); offset += 4; break; case 48: // update leaderboard (custom text) @@ -362,7 +362,7 @@ if (!setCustomLB) { noRanking = false; } - y = null; + teamScores = null; var validElements = msg.getUint32(offset, true); offset += 4; leaderBoard = []; @@ -377,32 +377,31 @@ drawLeaderBoard(); break; case 50: // update leaderboard (teams) - y = []; + teamScores = []; var validElements = msg.getUint32(offset, true); offset += 4; for (var i = 0; i < validElements; ++i) { - y.push(msg.getFloat32(offset, true)); + teamScores.push(msg.getFloat32(offset, true)); offset += 4; } drawLeaderBoard(); break; case 64: // set border - ea = msg.getFloat64(offset, true); + leftPos = msg.getFloat64(offset, true); offset += 8; - fa = msg.getFloat64(offset, true) - ; + topPos = msg.getFloat64(offset, true); offset += 8; - ga = msg.getFloat64(offset, true); + rightPos = msg.getFloat64(offset, true); offset += 8; - ha = msg.getFloat64(offset, true); + bottomPos = msg.getFloat64(offset, true); offset += 8; - posX = (ga + ea) / 2; - posY = (ha + fa) / 2; + posX = (rightPos + leftPos) / 2; + posY = (bottomPos + topPos) / 2; posSize = 1; - if (0 == n.length) { - t = posX; - u = posY; - viewZoom = posSize + if (0 == playerCells.length) { + nodeX = posX; + nodeY = posY; + viewZoom = posSize; } break; } @@ -479,12 +478,12 @@ node.updateTime = timestamp; node.nnn = flags; name && node.setName(name); - if (-1 != G.indexOf(nodeId) && -1 == n.indexOf(node)) { + if (-1 != nodesOnScreen.indexOf(nodeId) && -1 == playerCells.indexOf(node)) { document.getElementById("overlays").style.display = "none"; - n.push(node); - if (1 == n.length) { - t = node.x; - u = node.y; + playerCells.push(node); + if (1 == playerCells.length) { + nodeX = node.x; + nodeY = node.y; } } } @@ -496,7 +495,7 @@ node = A[nodeId]; null != node && node.destroy(); } - ua && 0 == n.length && showOverlays(false) + ua && 0 == playerCells.length && showOverlays(false) } function sendMouseMove() { @@ -504,9 +503,9 @@ if (wsIsOpen()) { msg = rawMouseX - canvasWidth / 2; var b = rawMouseY - canvasHeight / 2; - if (64 <= msg * msg + b * b && !(.01 > Math.abs(Ma - X) && .01 > Math.abs(Na - Y))) { - Ma = X; - Na = Y; + if (64 <= msg * msg + b * b && !(.01 > Math.abs(oldX - X) && .01 > Math.abs(oldY - Y))) { + oldX = X; + oldY = Y; msg = prepareData(21); msg.setUint8(0, 16); msg.setFloat64(1, X, true); @@ -517,11 +516,11 @@ } } - function Ka() { - if (wsIsOpen() && null != F) { - var msg = prepareData(1 + 2 * F.length); + function sendNickName() { + if (wsIsOpen() && null != userNickName) { + var msg = prepareData(1 + 2 * userNickName.length); msg.setUint8(0, 0); - for (var b = 0; b < F.length; ++b) msg.setUint16(1 + 2 * b, F.charCodeAt(b), true); + for (var i = 0; i < userNickName.length; ++i) msg.setUint16(1 + 2 * i, userNickName.charCodeAt(i), true); wsSend(msg) } } @@ -557,9 +556,9 @@ return a *= zoom } - function bb() { - if (0 != n.length) { - for (var a = 0, b = 0; b < n.length; b++) a += n[b].size; + function calcViewZoom() { + if (0 != playerCells.length) { + for (var a = 0, b = 0; b < playerCells.length; b++) a += playerCells[b].size; a = Math.pow(Math.min(64 / a, 1), .4) * viewRange(); viewZoom = (9 * viewZoom + a) / 10 } @@ -569,22 +568,22 @@ var a, b = Date.now(); ++cb; timestamp = b; - if (0 < n.length) { - bb(); + if (0 < playerCells.length) { + calcViewZoom(); var c = a = 0; - for (var d = 0; d < n.length; d++) { - n[d].updatePos(); - a += n[d].x / n.length; - c += n[d].y / n.length; + for (var d = 0; d < playerCells.length; d++) { + playerCells[d].updatePos(); + a += playerCells[d].x / playerCells.length; + c += playerCells[d].y / playerCells.length; } posX = a; posY = c; posSize = viewZoom; - t = (t + a) / 2; - u = (u + c) / 2 + nodeX = (nodeX + a) / 2; + nodeY = (nodeY + c) / 2 } else { - t = (29 * t + posX) / 30; - u = (29 * u + posY) / 30; + nodeX = (29 * nodeX + posX) / 30; + nodeY = (29 * nodeY + posY) / 30; viewZoom = (9 * viewZoom + posSize * viewRange()) / 10; } buildQTree(); @@ -611,7 +610,7 @@ ctx.save(); ctx.translate(canvasWidth / 2, canvasHeight / 2); ctx.scale(viewZoom, viewZoom); - ctx.translate(-t, -u); + ctx.translate(-nodeX, -nodeY); for (d = 0; d < Cells.length; d++) Cells[d].drawOneCell(ctx); for (d = 0; d < nodelist.length; d++) nodelist[d].drawOneCell(ctx); @@ -627,8 +626,8 @@ ctx.lineJoin = "round"; ctx.globalAlpha = .5; ctx.beginPath(); - for (d = 0; d < n.length; d++) { - ctx.moveTo(n[d].x, n[d].y); + for (d = 0; d < playerCells.length; d++) { + ctx.moveTo(playerCells[d].x, playerCells[d].y); ctx.lineTo(ca, da); } ctx.stroke(); @@ -636,13 +635,13 @@ } ctx.restore(); Canvas && Canvas.width && ctx.drawImage(Canvas, canvasWidth - Canvas.width - 10, 10); - J = Math.max(J, eb()); - if (0 != J) { - if (null == ja) { - ja = new ka(24, '#FFFFFF'); + userScore = Math.max(userScore, calcUserScore()); + if (0 != userScore) { + if (null == scoreText) { + scoreText = new uText(24, '#FFFFFF'); } - ja.setValue('Score: ' + ~~(J / 100)); - c = ja.render(); + scoreText.setValue('Score: ' + ~~(userScore / 100)); + c = scoreText.render(); a = c.width; ctx.globalAlpha = .2; ctx.fillStyle = '#000000'; @@ -666,13 +665,13 @@ ctx.scale(viewZoom, viewZoom); var a = canvasWidth / viewZoom, b = canvasHeight / viewZoom; - for (var c = -.5 + (-t + a / 2) % 50; c < a; c += 50) { + for (var c = -.5 + (-nodeX + a / 2) % 50; c < a; c += 50) { ctx.beginPath(); ctx.moveTo(c, 0); ctx.lineTo(c, b); ctx.stroke(); } - for (c = -.5 + (-u + b / 2) % 50; c < b; c += 50) { + for (c = -.5 + (-nodeY + b / 2) % 50; c < b; c += 50) { ctx.beginPath(); ctx.moveTo(0, c); ctx.lineTo(a, c); @@ -683,24 +682,24 @@ function drawSplitIcon() { if (isTouchStart && splitIcon.width) { - var a = canvasWidth / 5; - ctx.drawImage(splitIcon, 5, 5, a, a) + var size = canvasWidth / 5; + ctx.drawImage(splitIcon, 5, 5, size, size) } } - function eb() { - for (var a = 0, b = 0; b < n.length; b++) a += n[b].nSize * n[b].nSize; - return a + function calcUserScore() { + for (var score = 0, i = 0; i < playerCells.length; i++) score += playerCells[i].nSize * playerCells[i].nSize; + return score } function drawLeaderBoard() { Canvas = null; - if (null != y || 0 != leaderBoard.length) - if (null != y || showName) { + if (null != teamScores || 0 != leaderBoard.length) + if (null != teamScores || showName) { Canvas = document.createElement("canvas"); var ctx = Canvas.getContext("2d"), b = 60, - b = null == y ? b + 24 * leaderBoard.length : b + 180, + b = null == teamScores ? b + 24 * leaderBoard.length : b + 180, c = Math.min(200, .3 * canvasWidth) / 200; Canvas.width = 200 * c; Canvas.height = b * c; @@ -714,14 +713,14 @@ c = "Leaderboard"; ctx.font = "30px Ubuntu"; ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 40); - if (null == y) { + if (null == teamScores) { for (ctx.font = "20px Ubuntu", b = 0; b < leaderBoard.length; ++b) { c = leaderBoard[b].name || "An unnamed cell"; if (!showName) { (c = "An unnamed cell"); } - if (-1 != G.indexOf(leaderBoard[b].id)) { - n[0].name && (c = n[0].name); + if (-1 != nodesOnScreen.indexOf(leaderBoard[b].id)) { + playerCells[0].name && (c = playerCells[0].name); ctx.fillStyle = "#FFAAAA"; if (!noRanking) { c = b + 1 + ". " + c; @@ -737,8 +736,8 @@ } } else { - for (b = c = 0; b < y.length; ++b) { - var d = c + y[b] * Math.PI * 2; + for (b = c = 0; b < teamScores.length; ++b) { + var d = c + teamScores[b] * Math.PI * 2; ctx.fillStyle = teamColor[b + 1]; ctx.beginPath(); ctx.moveTo(100, 140); @@ -762,7 +761,7 @@ this.setName(uname) } - function ka(usize, ucolor, ustroke, ustrokecolor) { + function uText(usize, ucolor, ustroke, ustrokecolor) { usize && (this._size = usize); ucolor && (this._color = ucolor); this._stroke = !!ustroke; @@ -776,10 +775,10 @@ else { var nCanvas, ctx, Canvas, canvasWidth, canvasHeight, qTree = null, ws = null, - t = 0, - u = 0, - G = [], - n = [], + nodeX = 0, + nodeY = 0, + nodesOnScreen = [], + playerCells = [], A = {}, nodelist = [], Cells = [], leaderBoard = [], @@ -789,25 +788,25 @@ Y = -1, cb = 0, timestamp = 0, - F = null, - ea = 0, - fa = 0, - ga = 1E4, - ha = 1E4, + userNickName = null, + leftPos = 0, + topPos = 0, + rightPos = 1E4, + bottomPos = 1E4, viewZoom = 1, w = null, showSkin = true, showName = true, showColor = false, ua = false, - J = 0, + userScore = 0, showDarkTheme = false, showMass = false, - posX = t = ~~((ea + ga) / 2), - posY = u = ~~((fa + ha) / 2), + posX = nodeX = ~~((leftPos + rightPos) / 2), + posY = nodeY = ~~((topPos + bottomPos) / 2), posSize = 1, N = "", - y = null, + teamScores = null, ma = false, ta = false, lineX = 0, @@ -828,9 +827,9 @@ var $ = null; wHandle.setNick = function (arg) { hideOverlays(); - F = arg; - Ka(); - J = 0 + userNickName = arg; + sendNickName(); + userScore = 0 }; wHandle.setRegion = setRegion; wHandle.setSkins = function (arg) { @@ -849,7 +848,7 @@ showMass = arg }; wHandle.spectate = function () { - F = null; + userNickName = null; sendUint8(1); hideOverlays() }; @@ -925,11 +924,11 @@ var delay = 500, - Ma = -1, - Na = -1, + oldX = -1, + oldY = -1, Canvas = null, z = 1, - ja = null, + scoreText = null, K = {}, knownNameDict = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;hitler;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;doge;nasa;byzantium;imperial japan;french kingdom;somalia;turkey;mars;pokerface;8;irs;receita federal;facebook".split(";"), hb = ["8", "nasa"], @@ -966,14 +965,14 @@ break } delete A[this.id]; - a = n.indexOf(this); + a = playerCells.indexOf(this); if (-1 != a) { ua = true; - n.splice(a, 1); + playerCells.splice(a, 1); } - a = G.indexOf(this.id); + a = nodesOnScreen.indexOf(this.id); if (-1 != a) { - G.splice(a, 1); + nodesOnScreen.splice(a, 1); } this.destroyed = true; Cells.push(this) @@ -984,7 +983,7 @@ setName: function (a) { if (this.name = a) { if (null == this.nameCache) { - this.nameCache = new ka(this.getNameSize(), "#FFFFFF", true, "#000000"); + this.nameCache = new uText(this.getNameSize(), "#FFFFFF", true, "#000000"); this.nameCache.setValue(this.name); } else { this.nameCache.setSize(this.getNameSize()); @@ -1001,7 +1000,7 @@ if (0 == this.points.length && 0 < a) { this.points.push({ S: this, - e: this.size, + size: this.size, x: this.x, y: this.y }); @@ -1012,7 +1011,7 @@ c = this.points[b]; this.points.splice(b, 0, { S: this, - e: c.e, + size: c.size, x: c.x, y: c.y }); @@ -1028,7 +1027,7 @@ this.isVirus || (b *= viewZoom); b *= z; this.nnn & 32 && (b *= .25); - return ~~Math.max(b, a) + return ~~Math.max(b, a); }, movePoints: function () { this.createPoints(); @@ -1042,9 +1041,9 @@ b[d] = (e + m + 8 * b[d]) / 10 } for (var h = this, g = this.isVirus ? 0 : (this.id / 1E3 + timestamp / 1E4) % (2 * Math.PI), d = 0; d < c; ++d) { - var f = a[d].e, - e = a[(d - 1 + c) % c].e, - m = a[(d + 1) % c].e; + var f = a[d].size, + e = a[(d - 1 + c) % c].size, + m = a[(d + 1) % c].size; if (15 < this.size && null != qTree && 20 < this.size * viewZoom && 0 != this.id) { var l = false, n = a[d].x, @@ -1054,7 +1053,7 @@ l = true; } }); - if (!l && a[d].x < ea || a[d].y < fa || a[d].x > ga || a[d].y > ha) { + if (!l && a[d].x < leftPos || a[d].y < topPos || a[d].x > rightPos || a[d].y > bottomPos) { l = true; } if (l) { @@ -1067,9 +1066,9 @@ f += b[d]; 0 > f && (f = 0); f = this.isAgitated ? (19 * f + this.size) / 20 : (12 * f + this.size) / 13; - a[d].e = (e + m + 8 * f) / 10; + a[d].size = (e + m + 8 * f) / 10; e = 2 * Math.PI / c; - m = this.points[d].e; + m = this.points[d].size; this.isVirus && 0 == d % 2 && (m += 5); a[d].x = this.x + Math.cos(e * d + g) * m; a[d].y = this.y + Math.sin(e * d + g) * m @@ -1095,7 +1094,7 @@ if (0 == this.id) { return true } else { - return this.x + this.size + 40 < t - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < u - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > t + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > u + canvasHeight / 2 / viewZoom ? false : true + return this.x + this.size + 40 < nodeX - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < nodeY - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > nodeX + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > nodeY + canvasHeight / 2 / viewZoom ? false : true } }, drawOneCell: function (a) { @@ -1103,7 +1102,7 @@ var b = 0 != this.id && !this.isVirus && !this.isAgitated && .4 > viewZoom; 5 > this.getNumPoints() && (b = true); if (this.wasSimpleDrawing && !b) - for (var c = 0; c < this.points.length; c++) this.points[c].e = this.size; + for (var c = 0; c < this.points.length; c++) this.points[c].size = this.size; this.wasSimpleDrawing = b; a.save(); this.drawTime = timestamp; @@ -1170,7 +1169,7 @@ if (null != e && c) { a.drawImage(e, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); } - c = -1 != n.indexOf(this); + c = -1 != playerCells.indexOf(this); if (0 != this.id) { b = ~~this.y; if ((showName || c) && this.name && this.nameCache && (null == e || -1 == hb.indexOf(d))) { @@ -1185,9 +1184,9 @@ a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); b += e.height / 2 / d + 4 } - if (showMass && (c || 0 == n.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { + if (showMass && (c || 0 == playerCells.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { if (null == this.sizeCache) { - this.sizeCache = new ka(this.getNameSize() / 2, "#FFFFFF", true, "#000000") + this.sizeCache = new uText(this.getNameSize() / 2, "#FFFFFF", true, "#000000") } c = this.sizeCache; c.setSize(this.getNameSize() / 2); @@ -1204,7 +1203,7 @@ } } }; - ka.prototype = { + uText.prototype = { _value: "", _color: "#000000", _stroke: false, @@ -1383,9 +1382,9 @@ }; wjQuery(function () { function renderFavicon() { - if (0 < n.length) { - redCell.color = n[0].color; - redCell.setName(n[0].name); + if (0 < playerCells.length) { + redCell.color = playerCells[0].color; + redCell.setName(playerCells[0].name); } ctx.clearRect(0, 0, 32, 32); ctx.save(); From bb15d79736192dd0d4afce3cbfe218e279c3fa68 Mon Sep 17 00:00:00 2001 From: m-byte Date: Sun, 21 Jun 2015 19:03:12 +0200 Subject: [PATCH 28/88] Documented protocol extensions --- PROTOCOL.md | 19 +++++++++++++++++++ README.md | 7 +++++++ 2 files changed, 26 insertions(+) create mode 100755 PROTOCOL.md mode change 100644 => 100755 README.md diff --git a/PROTOCOL.md b/PROTOCOL.md new file mode 100755 index 0000000..0e1567b --- /dev/null +++ b/PROTOCOL.md @@ -0,0 +1,19 @@ +# PROTOCOL + +## Protocol extensions +As the server has to tell whether the client supports protocol extensions, the values of package 254 and 255 have been adjusted. +Package 255 now contains "Ogar" in ASCII (1332175218) while package 254 contains the version number. When modifying the protocol, +only new features can be implemented. Also, the client must be compatible with older versions of the server. + +## Changes +Please document any changes introduced here. Direction has to be either `S2C` (server to client) or `C2S`. + +### Version 1 +Direction | ID | Value | Description +------------------------------------------------------------------------------------------------------- +C2S | 254 | 1 | Version number +C2S | 255 | 1332175218 | String "Ogar" - Tells the server how to use the modified protocol +S2C | 48 | behaves like #49 | Leaderboard without numbers + +### Version 2 +TODO: We could add chat functionality in this version. That way, only one websocket server would be needed. \ No newline at end of file diff --git a/README.md b/README.md old mode 100644 new mode 100755 index f181dbd..3779459 --- a/README.md +++ b/README.md @@ -35,5 +35,12 @@ This client has been tested on LEMP stack on OS X 10.10 and Ubuntu 14.04 with se It is known that some of the variables and function names still make no sense, we are working on that. +## Protocol extensions +As the server has to tell whether the client supports protocol extensions, the values of package 254 and 255 have been adjusted. +Package 255 now contains "Ogar" in ASCII (1332175218) while package 254 contains the version number. When modifying the protocol, +only new features can be implemented. Also, the client must remain compatible with older versions of the server. + +Changes to the protocol have to be [documented](PROTOCOL.md). + ## Contribution Pull Request are welcome. From 0ab57f6df42fd18588dd96604914d0eab2db2ed8 Mon Sep 17 00:00:00 2001 From: xf Date: Mon, 22 Jun 2015 01:03:25 +0800 Subject: [PATCH 29/88] var --- .idea/workspace.xml | 9 +++---- main_out.js | 60 ++++++++++++++++++++++----------------------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8ad246b..4b75829 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,6 @@ - @@ -59,8 +58,8 @@ - - + + @@ -564,8 +563,8 @@ - - + + diff --git a/main_out.js b/main_out.js index f3c29c0..b87f149 100755 --- a/main_out.js +++ b/main_out.js @@ -1097,42 +1097,42 @@ return this.x + this.size + 40 < nodeX - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < nodeY - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > nodeX + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > nodeY + canvasHeight / 2 / viewZoom ? false : true } }, - drawOneCell: function (a) { + drawOneCell: function (ctx) { if (this.shouldRender()) { var b = 0 != this.id && !this.isVirus && !this.isAgitated && .4 > viewZoom; 5 > this.getNumPoints() && (b = true); if (this.wasSimpleDrawing && !b) for (var c = 0; c < this.points.length; c++) this.points[c].size = this.size; this.wasSimpleDrawing = b; - a.save(); + ctx.save(); this.drawTime = timestamp; c = this.updatePos(); - this.destroyed && (a.globalAlpha *= 1 - c); - a.lineWidth = 10; - a.lineCap = "round"; - a.lineJoin = this.isVirus ? "miter" : "round"; + this.destroyed && (ctx.globalAlpha *= 1 - c); + ctx.lineWidth = 10; + ctx.lineCap = "round"; + ctx.lineJoin = this.isVirus ? "miter" : "round"; if (showColor) { - a.fillStyle = "#FFFFFF"; - a.strokeStyle = "#AAAAAA"; + ctx.fillStyle = "#FFFFFF"; + ctx.strokeStyle = "#AAAAAA"; } else { - a.fillStyle = this.color; - a.strokeStyle = this.color; + ctx.fillStyle = this.color; + ctx.strokeStyle = this.color; } if (b) { - a.beginPath(); - a.arc(this.x, this.y, this.size, 0, 2 * Math.PI, false); + ctx.beginPath(); + ctx.arc(this.x, this.y, this.size, 0, 2 * Math.PI, false); } else { this.movePoints(); - a.beginPath(); + ctx.beginPath(); var d = this.getNumPoints(); - a.moveTo(this.points[0].x, this.points[0].y); + ctx.moveTo(this.points[0].x, this.points[0].y); for (c = 1; c <= d; ++c) { var e = c % d; - a.lineTo(this.points[e].x, this.points[e].y) + ctx.lineTo(this.points[e].x, this.points[e].y) } } - a.closePath(); + ctx.closePath(); d = this.name.toLowerCase(); if (!this.isAgitated && showSkin && ':teams' != N) { if (-1 != knownNameDict.indexOf(d)) { @@ -1152,22 +1152,22 @@ c = null; } c = (e = c) ? -1 != ib.indexOf(d) : false; - b || a.stroke(); - a.fill(); + b || ctx.stroke(); + ctx.fill(); if (!(null == e || c)) { - a.save(); - a.clip(); - a.drawImage(e, this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size); - a.restore(); + ctx.save(); + ctx.clip(); + ctx.drawImage(e, this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size); + ctx.restore(); } if ((showColor || 15 < this.size) && !b) { - a.strokeStyle = '#000000'; - a.globalAlpha *= .1; - a.stroke(); + ctx.strokeStyle = '#000000'; + ctx.globalAlpha *= .1; + ctx.stroke(); } - a.globalAlpha = 1; + ctx.globalAlpha = 1; if (null != e && c) { - a.drawImage(e, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); + ctx.drawImage(e, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); } c = -1 != playerCells.indexOf(this); if (0 != this.id) { @@ -1181,7 +1181,7 @@ var e = e.render(), m = ~~(e.width / d), h = ~~(e.height / d); - a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); + ctx.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); b += e.height / 2 / d + 4 } if (showMass && (c || 0 == playerCells.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { @@ -1196,10 +1196,10 @@ e = c.render(); m = ~~(e.width / d); h = ~~(e.height / d); - a.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); + ctx.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); } } - a.restore() + ctx.restore() } } }; From 0fd807f4afe8b29df88ff8a9854b12e9b986daa7 Mon Sep 17 00:00:00 2001 From: xf Date: Mon, 22 Jun 2015 01:34:53 +0800 Subject: [PATCH 30/88] ignore ide files --- .gitignore | 1 + .idea/.name | 1 - .idea/agar-clone.iml | 8 - .idea/misc.xml | 14 -- .idea/modules.xml | 8 - .idea/vcs.xml | 6 - .idea/workspace.xml | 573 ------------------------------------------- 7 files changed, 1 insertion(+), 610 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/agar-clone.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml diff --git a/.gitignore b/.gitignore index e33609d..fb36ae3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.png +.idea/* diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 0dcb32c..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -agar-clone \ No newline at end of file diff --git a/.idea/agar-clone.iml b/.idea/agar-clone.iml deleted file mode 100644 index c956989..0000000 --- a/.idea/agar-clone.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 19f74da..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8f37d95..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 4b75829..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,573 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - 1434787332226 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From a1df150c00807ba7575a025a9eb8280c812b2f82 Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Mon, 22 Jun 2015 13:08:06 +0800 Subject: [PATCH 31/88] Update PROTOCOL.md We can use another packet id to send and get chat message, without modifying original one. I will write the chat rendering part next week. And I plan to do some mobile device compatibility (I mean joystick control on iOS) using my previous work https://github.com/Eureka22/TinkerControllerWebApp . --- PROTOCOL.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/PROTOCOL.md b/PROTOCOL.md index 0e1567b..5bd7a41 100755 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -9,11 +9,19 @@ only new features can be implemented. Also, the client must be compatible with o Please document any changes introduced here. Direction has to be either `S2C` (server to client) or `C2S`. ### Version 1 -Direction | ID | Value | Description -------------------------------------------------------------------------------------------------------- -C2S | 254 | 1 | Version number -C2S | 255 | 1332175218 | String "Ogar" - Tells the server how to use the modified protocol -S2C | 48 | behaves like #49 | Leaderboard without numbers + + +| Direction | ID | Value | Description| +| :------------ |:---------------| :-----|:----| +|C2S | 254 | 1 | Version number| +|C2S | 255 | 1332175218 | String "Ogar" - Tells the server how to use the modified protocol| +|S2C | 48 | behaves like #49 | Leaderboard without numbers| + +Hint : to use Packet 48, make sure the packet ID in case 48 of Ogar/src/packet/UpdateLeaderboard.js is adjusted like this: + +``` +view.setUint8(0, this.packetLB, true); +``` ### Version 2 -TODO: We could add chat functionality in this version. That way, only one websocket server would be needed. \ No newline at end of file +TODO: We could add chat functionality in this version. That way, only one websocket server would be needed. From a7d727c3d1765edf73457f9ad49cee2136d8f824 Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Mon, 22 Jun 2015 13:23:01 +0800 Subject: [PATCH 32/88] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dff2d20..07cf4e3 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This is a clone of agar.io. In this project we aim to acheive the following. - [x] Hack main_out.js and make the variables and function names readable. Now most of the variable and function name should make sense. - [x] Add uploading custom skins features (Done) +- [ ] Add mobile device support (On-going) - [ ] Add in-game chat feature. (On-going) - [ ] Support multi-server feature (On-going) @@ -31,7 +32,7 @@ will make it work. ## Test and known issues -This client has been tested on LEMP stack on OS X 10.10 and Ubuntu 14.04 with server side https://github.com/vram4/Ogar. +This client has been tested on LEMP stack on OS X 10.10 and Ubuntu 14.04 with server side [Ogar](https://github.com/vram4/Ogar). It is known that some of the variables and function names still make no sense, we are working on that. @@ -40,7 +41,7 @@ As the server has to tell whether the client supports protocol extensions, the v Package 255 now contains "Ogar" in ASCII (1332175218) while package 254 contains the version number. When modifying the protocol, only new features can be implemented. Also, the client must remain compatible with older versions of the server. -Changes to the protocol have to be [documented](PROTOCOL.md). +Original protocol can be found [here](https://github.com/vram4/Agar.io-Protocol). Changes to the protocol have to be [documented](PROTOCOL.md). ## Contribution Pull Request are welcome. From 0838b688b14b4aa3e6bb218b498a93f6ac910c7b Mon Sep 17 00:00:00 2001 From: xf Date: Mon, 22 Jun 2015 16:28:32 +0800 Subject: [PATCH 33/88] refactor --- main_out.js | 160 +++++++++++++++++++++++++++------------------------- 1 file changed, 82 insertions(+), 78 deletions(-) diff --git a/main_out.js b/main_out.js index 7f5ed97..bd4d633 100755 --- a/main_out.js +++ b/main_out.js @@ -24,7 +24,7 @@ yOffset = event.clientY - (5 + canvasWidth / 5 / 2); if (Math.sqrt(xOffset * xOffset + yOffset * yOffset) <= canvasWidth / 5 / 2) { sendMouseMove(); - sendUint8(17); + sendUint8(17); //split return } } @@ -214,7 +214,7 @@ } function attemptConnection() { - console.log("Find " + w + N); + console.log("Find " + w + gameMode); wjQuery.ajax("main.php", { error: function () { setTimeout(attemptConnection, 1E3) @@ -226,7 +226,7 @@ method: "POST", cache: false, crossDomain: true, - data: w + N || "?" + data: w + gameMode || "?" }) } @@ -258,7 +258,7 @@ } nodesOnScreen = []; playerCells = []; - A = {}; + nodes = {}; nodelist = []; Cells = []; leaderBoard = []; @@ -271,7 +271,7 @@ ws.onmessage = onWsMessage; ws.onclose = onWsClose; ws.onerror = function () { - console.log("socket error") + console.log("socket error"); } } @@ -414,8 +414,8 @@ var queueLength = view.getUint16(offset, true); offset += 2; for (var i = 0; i < queueLength; ++i) { - var killer = A[view.getUint32(offset, true)], - killedNode = A[view.getUint32(offset + 4, true)]; + var killer = nodes[view.getUint32(offset, true)], + killedNode = nodes[view.getUint32(offset + 4, true)]; offset += 8; if (killer && killedNode) { killedNode.destroy(); @@ -455,8 +455,8 @@ name += String.fromCharCode(char) } var node = null; - if (A.hasOwnProperty(nodeId)) { - node = A[nodeId]; + if (nodes.hasOwnProperty(nodeId)) { + node = nodes[nodeId]; node.updatePos(); node.ox = node.x; node.oy = node.y; @@ -465,7 +465,7 @@ } else { node = new Cell(nodeId, posX, posY, size, color, name); nodelist.push(node); - A[nodeId] = node; + nodes[nodeId] = node; node.ka = posX; node.la = posY; } @@ -476,7 +476,7 @@ node.nSize = size; node.updateCode = code; node.updateTime = timestamp; - node.nnn = flags; + node.flag = flags; name && node.setName(name); if (-1 != nodesOnScreen.indexOf(nodeId) && -1 == playerCells.indexOf(node)) { document.getElementById("overlays").style.display = "none"; @@ -492,7 +492,7 @@ for (var i = 0; i < queueLength; i++) { var nodeId = view.getUint32(offset, true); offset += 4; - node = A[nodeId]; + node = nodes[nodeId]; null != node && node.destroy(); } ua && 0 == playerCells.length && showOverlays(false) @@ -779,7 +779,7 @@ nodeY = 0, nodesOnScreen = [], playerCells = [], - A = {}, nodelist = [], + nodes = {}, nodelist = [], Cells = [], leaderBoard = [], rawMouseX = 0, @@ -805,7 +805,7 @@ posX = nodeX = ~~((leftPos + rightPos) / 2), posY = nodeY = ~~((topPos + bottomPos) / 2), posSize = 1, - N = "", + gameMode = "", teamScores = null, ma = false, ta = false, @@ -821,8 +821,8 @@ splitIcon = new Image, noRanking = false; splitIcon.src = "http://agar.io/img/split.png"; - var Sa = document.createElement("canvas"); - if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == Sa || null == Sa.getContext || null == wHandle.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this"); + var wCanvas = document.createElement("canvas"); + if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == wCanvas || null == wCanvas.getContext || null == wHandle.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this"); else { var $ = null; wHandle.setNick = function (arg) { @@ -853,8 +853,8 @@ hideOverlays() }; wHandle.setGameMode = function (arg) { - if (arg != N) { - N = arg; + if (arg != gameMode) { + gameMode = arg; showConnecting(); } }; @@ -929,9 +929,9 @@ Canvas = null, z = 1, scoreText = null, - K = {}, + skins = {}, knownNameDict = "poland;usa;china;russia;canada;australia;spain;brazil;germany;ukraine;france;sweden;hitler;north korea;south korea;japan;united kingdom;earth;greece;latvia;lithuania;estonia;finland;norway;cia;maldivas;austria;nigeria;reddit;yaranaika;confederate;9gag;indiana;4chan;italy;bulgaria;tumblr;2ch.hk;hong kong;portugal;jamaica;german empire;mexico;sanik;switzerland;croatia;chile;indonesia;bangladesh;thailand;iran;iraq;peru;moon;botswana;bosnia;netherlands;european union;taiwan;pakistan;hungary;satanist;qing dynasty;matriarchy;patriarchy;feminism;ireland;texas;facepunch;prodota;cambodia;steam;piccolo;india;kc;denmark;quebec;ayy lmao;sealand;bait;tsarist russia;origin;vinesauce;stalin;belgium;luxembourg;stussy;prussia;8ch;argentina;scotland;sir;romania;belarus;wojak;doge;nasa;byzantium;imperial japan;french kingdom;somalia;turkey;mars;pokerface;8;irs;receita federal;facebook".split(";"), - hb = ["8", "nasa"], + knownNameDict_noDisp = ["8", "nasa"], ib = ["_canvas'blob"]; Cell.prototype = { id: 0, @@ -949,7 +949,7 @@ nx: 0, ny: 0, nSize: 0, - nnn: 0, + flag: 0, //what does this mean updateTime: 0, updateCode: 0, drawTime: 0, @@ -958,21 +958,21 @@ isAgitated: false, wasSimpleDrawing: true, destroy: function () { - var a; - for (a = 0; a < nodelist.length; a++) - if (nodelist[a] == this) { - nodelist.splice(a, 1); + var tmp; + for (tmp = 0; tmp < nodelist.length; tmp++) + if (nodelist[tmp] == this) { + nodelist.splice(tmp, 1); break } - delete A[this.id]; - a = playerCells.indexOf(this); - if (-1 != a) { + delete nodes[this.id]; + tmp = playerCells.indexOf(this); + if (-1 != tmp) { ua = true; - playerCells.splice(a, 1); + playerCells.splice(tmp, 1); } - a = nodesOnScreen.indexOf(this.id); - if (-1 != a) { - nodesOnScreen.splice(a, 1); + tmp = nodesOnScreen.indexOf(this.id); + if (-1 != tmp) { + nodesOnScreen.splice(tmp, 1); } this.destroyed = true; Cells.push(this) @@ -999,7 +999,7 @@ } if (0 == this.points.length && 0 < a) { this.points.push({ - S: this, + ref: this, size: this.size, x: this.x, y: this.y @@ -1010,7 +1010,7 @@ var b = ~~(Math.random() * this.points.length), c = this.points[b]; this.points.splice(b, 0, { - S: this, + ref: this, size: c.size, x: c.x, y: c.y @@ -1026,7 +1026,7 @@ var b = this.size; this.isVirus || (b *= viewZoom); b *= z; - this.nnn & 32 && (b *= .25); + this.flag & 32 && (b *= .25); return ~~Math.max(b, a); }, movePoints: function () { @@ -1049,7 +1049,7 @@ n = a[d].x, q = a[d].y; qTree.retrieve2(n - 5, q - 5, 10, 10, function (a) { - if (a.S != h && 25 > (n - a.x) * (n - a.x) + (q - a.y) * (q - a.y)) { + if (a.ref != h && 25 > (n - a.x) * (n - a.x) + (q - a.y) * (q - a.y)) { l = true; } }); @@ -1133,15 +1133,15 @@ } } ctx.closePath(); - d = this.name.toLowerCase(); - if (!this.isAgitated && showSkin && ':teams' != N) { - if (-1 != knownNameDict.indexOf(d)) { - if (!K.hasOwnProperty(d)) { - K[d] = new Image; - K[d].src = SKIN_URL + d + '.png'; + var skinName = this.name.toLowerCase(); + if (!this.isAgitated && showSkin && ':teams' != gameMode) { + if (-1 != knownNameDict.indexOf(skinName)) { + if (!skins.hasOwnProperty(skinName)) { + skins[skinName] = new Image; + skins[skinName].src = SKIN_URL + skinName + '.png'; } - if (0 != K[d].width && K[d].complete) { - c = K[d]; + if (0 != skins[skinName].width && skins[skinName].complete) { + c = skins[skinName]; } else { c = null; } @@ -1151,7 +1151,7 @@ } else { c = null; } - c = (e = c) ? -1 != ib.indexOf(d) : false; + c = (e = c) ? -1 != ib.indexOf(skinName) : false; b || ctx.stroke(); ctx.fill(); if (!(null == e || c)) { @@ -1170,20 +1170,24 @@ ctx.drawImage(e, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); } c = -1 != playerCells.indexOf(this); + + //draw name if (0 != this.id) { b = ~~this.y; - if ((showName || c) && this.name && this.nameCache && (null == e || -1 == hb.indexOf(d))) { + if ((showName || c) && this.name && this.nameCache && (null == e || -1 == knownNameDict_noDisp.indexOf(skinName))) { e = this.nameCache; e.setValue(this.name); e.setSize(this.getNameSize()); - d = Math.ceil(10 * viewZoom) / 10; - e.setScale(d); + var ratio = Math.ceil(10 * viewZoom) / 10; + e.setScale(ratio); var e = e.render(), - m = ~~(e.width / d), - h = ~~(e.height / d); + m = ~~(e.width / ratio), + h = ~~(e.height / ratio); ctx.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); - b += e.height / 2 / d + 4 + b += e.height / 2 / ratio + 4 } + + //draw mass if (showMass && (c || 0 == playerCells.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { if (null == this.sizeCache) { this.sizeCache = new uText(this.getNameSize() / 2, "#FFFFFF", true, "#000000") @@ -1191,11 +1195,11 @@ c = this.sizeCache; c.setSize(this.getNameSize() / 2); c.setValue(~~(this.size * this.size / 100)); - d = Math.ceil(10 * viewZoom) / 10; - c.setScale(d); + var ratio = Math.ceil(10 * viewZoom) / 10; + c.setScale(ratio); e = c.render(); - m = ~~(e.width / d); - h = ~~(e.height / d); + m = ~~(e.width / ratio); + h = ~~(e.height / ratio); ctx.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); } } @@ -1244,25 +1248,25 @@ } if (this._dirty) { this._dirty = false; - var a = this._canvas, - b = this._ctx, - c = this._value, - d = this._scale, - e = this._size, - m = e + 'px Ubuntu'; - b.font = m; - var h = ~~(.2 * e); - a.width = (b.measureText(c).width + - 6) * d; - a.height = (e + h) * d; - b.font = m; - b.scale(d, d); - b.globalAlpha = 1; - b.lineWidth = 3; - b.strokeStyle = this._strokeColor; - b.fillStyle = this._color; - this._stroke && b.strokeText(c, 3, e - h / 2); - b.fillText(c, 3, e - h / 2) + var canvas = this._canvas, + ctx = this._ctx, + value = this._value, + scale = this._scale, + fontsize = this._size, + font = fontsize + 'px Ubuntu'; + ctx.font = font; + var h = ~~(.2 * fontsize); + canvas.width = (ctx.measureText(value).width + + 6) * scale; + canvas.height = (fontsize + h) * scale; + ctx.font = font; + ctx.scale(scale, scale); + ctx.globalAlpha = 1; + ctx.lineWidth = 3; + ctx.strokeStyle = this._strokeColor; + ctx.fillStyle = this._color; + this._stroke && ctx.strokeText(value, 3, fontsize - h / 2); + ctx.fillText(value, 3, fontsize - h / 2) } return this._canvas } @@ -1288,14 +1292,14 @@ x: 0, y: 0, w: 0, - getNameSize: 0, + h: 0, depth: 0, items: null, nodes: null, exists: function (selector) { for (var i = 0; i < this.items.length; ++i) { var item = this.items[i]; - if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.w && item.y < selector.y + selector.getNameSize) return true + if (item.x >= selector.x && item.y >= selector.y && item.x < selector.x + selector.w && item.y < selector.y + selector.h) return true } if (0 != this.nodes.length) { var self = this; @@ -1354,7 +1358,7 @@ x: 0, y: 0, w: 0, - getNameSize: 0 + h: 0 }; return { root: new Node(args.minX, args.minY, args.maxX - args.minX, args.maxY - args.minY, 0), @@ -1368,7 +1372,7 @@ internalSelector.x = a; internalSelector.y = b; internalSelector.w = c; - internalSelector.getNameSize = d; + internalSelector.h = d; this.root.retrieve(internalSelector, callback) }, exists: function (a) { From 50d2b83f8e7e21931eb19f46a3630d65169818ab Mon Sep 17 00:00:00 2001 From: xf Date: Mon, 22 Jun 2015 16:45:55 +0800 Subject: [PATCH 34/88] refactor --- main_out.js | 105 ++++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/main_out.js b/main_out.js index bd4d633..9d11894 100755 --- a/main_out.js +++ b/main_out.js @@ -345,10 +345,10 @@ offset += 2; lineY = msg.getInt16(offset, true); offset += 2; - if (!ta) { - ta = true; - ca = lineX; - da = lineY; + if (!drawLine) { + drawLine = true; + drawLineX = lineX; + drawLineY = lineY; } break; case 32: // add node @@ -358,15 +358,16 @@ case 48: // update leaderboard (custom text) setCustomLB = true; noRanking = true; + break; case 49: // update leaderboard (ffa) if (!setCustomLB) { noRanking = false; } teamScores = null; - var validElements = msg.getUint32(offset, true); + var LBplayerNum = msg.getUint32(offset, true); offset += 4; leaderBoard = []; - for (var i = 0; i < validElements; ++i) { + for (var i = 0; i < LBplayerNum; ++i) { var nodeId = msg.getUint32(offset, true); offset += 4; leaderBoard.push({ @@ -378,9 +379,9 @@ break; case 50: // update leaderboard (teams) teamScores = []; - var validElements = msg.getUint32(offset, true); + var LBteamNum = msg.getUint32(offset, true); offset += 4; - for (var i = 0; i < validElements; ++i) { + for (var i = 0; i < LBteamNum; ++i) { teamScores.push(msg.getFloat32(offset, true)); offset += 4; } @@ -551,23 +552,23 @@ } function viewRange() { - var a; - a = Math.max(canvasHeight / 1080, canvasWidth / 1920); - return a *= zoom + var ratio; + ratio = Math.max(canvasHeight / 1080, canvasWidth / 1920); + return ratio *= zoom } function calcViewZoom() { if (0 != playerCells.length) { - for (var a = 0, b = 0; b < playerCells.length; b++) a += playerCells[b].size; - a = Math.pow(Math.min(64 / a, 1), .4) * viewRange(); - viewZoom = (9 * viewZoom + a) / 10 + for (var newViewZoom = 0, i = 0; i < playerCells.length; i++) newViewZoom += playerCells[i].size; + newViewZoom = Math.pow(Math.min(64 / newViewZoom, 1), .4) * viewRange(); + viewZoom = (9 * viewZoom + newViewZoom) / 10 } } function drawGameScene() { - var a, b = Date.now(); + var a,oldtime = Date.now(); ++cb; - timestamp = b; + timestamp = oldtime; if (0 < playerCells.length) { calcViewZoom(); var c = a = 0; @@ -615,10 +616,10 @@ for (d = 0; d < nodelist.length; d++) nodelist[d].drawOneCell(ctx); //console.log(Cells.length); - if (ta) { - ca = (3 * ca + lineX) / + if (drawLine) { + drawLineX = (3 * drawLineX + lineX) / 4; - da = (3 * da + lineY) / 4; + drawLineY = (3 * drawLineY + lineY) / 4; ctx.save(); ctx.strokeStyle = "#FFAAAA"; ctx.lineWidth = 10; @@ -628,7 +629,7 @@ ctx.beginPath(); for (d = 0; d < playerCells.length; d++) { ctx.moveTo(playerCells[d].x, playerCells[d].y); - ctx.lineTo(ca, da); + ctx.lineTo(drawLineX, drawLineY); } ctx.stroke(); ctx.restore() @@ -650,8 +651,8 @@ ctx.drawImage(c, 15, canvasHeight - 10 - 24 - 5); } drawSplitIcon(); - b = Date.now() - b; - b > 1E3 / 60 ? z -= .01 : b < 1E3 / 65 && (z += .01); + var deltatime = Date.now() - oldtime; + deltatime > 1E3 / 60 ? z -= .01 : deltatime < 1E3 / 65 && (z += .01); .4 > z && (z = .4); 1 < z && (z = 1) } @@ -808,11 +809,11 @@ gameMode = "", teamScores = null, ma = false, - ta = false, + drawLine = false, lineX = 0, lineY = 0, - ca = 0, - da = 0, + drawLineX = 0, + drawLineY = 0, Ra = 0, teamColor = ["#333333", "#FF3333", "#33FF33", "#3333FF"], xa = false, @@ -1031,47 +1032,47 @@ }, movePoints: function () { this.createPoints(); - for (var a = this.points, b = this.pointsAcc, c = a.length, d = 0; d < c; ++d) { - var e = b[(d - 1 + c) % c], - m = b[(d + 1) % c]; - b[d] += (Math.random() - .5) * (this.isAgitated ? 3 : 1); - b[d] *= .7; - 10 < b[d] && (b[d] = 10); - -10 > b[d] && (b[d] = -10); - b[d] = (e + m + 8 * b[d]) / 10 + for (var points = this.points, pointsacc = this.pointsAcc, numpoints = points.length, i = 0; i < numpoints; ++i) { + var pos1 = pointsacc[(i - 1 + numpoints) % numpoints], + pos2 = pointsacc[(i + 1) % numpoints]; + pointsacc[i] += (Math.random() - .5) * (this.isAgitated ? 3 : 1); + pointsacc[i] *= .7; + 10 < pointsacc[i] && (pointsacc[i] = 10); + -10 > pointsacc[i] && (pointsacc[i] = -10); + pointsacc[i] = (pos1 + pos2 + 8 * pointsacc[i]) / 10 } - for (var h = this, g = this.isVirus ? 0 : (this.id / 1E3 + timestamp / 1E4) % (2 * Math.PI), d = 0; d < c; ++d) { - var f = a[d].size, - e = a[(d - 1 + c) % c].size, - m = a[(d + 1) % c].size; + for (var ref = this, isvirus = this.isVirus ? 0 : (this.id / 1E3 + timestamp / 1E4) % (2 * Math.PI), i = 0; i < numpoints; ++i) { + var f = points[i].size, + e = points[(i - 1 + numpoints) % numpoints].size, + m = points[(i + 1) % numpoints].size; if (15 < this.size && null != qTree && 20 < this.size * viewZoom && 0 != this.id) { var l = false, - n = a[d].x, - q = a[d].y; + n = points[i].x, + q = points[i].y; qTree.retrieve2(n - 5, q - 5, 10, 10, function (a) { - if (a.ref != h && 25 > (n - a.x) * (n - a.x) + (q - a.y) * (q - a.y)) { + if (a.ref != ref && 25 > (n - a.x) * (n - a.x) + (q - a.y) * (q - a.y)) { l = true; } }); - if (!l && a[d].x < leftPos || a[d].y < topPos || a[d].x > rightPos || a[d].y > bottomPos) { + if (!l && points[i].x < leftPos || points[i].y < topPos || points[i].x > rightPos || points[i].y > bottomPos) { l = true; } if (l) { - if (0 < b[d]) { - (b[d] = 0); + if (0 < pointsacc[i]) { + (pointsacc[i] = 0); } - b[d] -= 1; + pointsacc[i] -= 1; } } - f += b[d]; + f += pointsacc[i]; 0 > f && (f = 0); f = this.isAgitated ? (19 * f + this.size) / 20 : (12 * f + this.size) / 13; - a[d].size = (e + m + 8 * f) / 10; - e = 2 * Math.PI / c; - m = this.points[d].size; - this.isVirus && 0 == d % 2 && (m += 5); - a[d].x = this.x + Math.cos(e * d + g) * m; - a[d].y = this.y + Math.sin(e * d + g) * m + points[i].size = (e + m + 8 * f) / 10; + e = 2 * Math.PI / numpoints; + m = this.points[i].size; + this.isVirus && 0 == i % 2 && (m += 5); + points[i].x = this.x + Math.cos(e * i + isvirus) * m; + points[i].y = this.y + Math.sin(e * i + isvirus) * m } }, updatePos: function () { @@ -1088,7 +1089,7 @@ this.x = a * (this.nx - this.ox) + this.ox; this.y = a * (this.ny - this.oy) + this.oy; this.size = b * (this.nSize - this.oSize) + this.oSize; - return b + return b; }, shouldRender: function () { if (0 == this.id) { From a96177cd03c364ef6b0a956dd54cdd2f1fddb2ec Mon Sep 17 00:00:00 2001 From: xf Date: Mon, 22 Jun 2015 20:14:53 +0800 Subject: [PATCH 35/88] clan support --- main_out.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main_out.js b/main_out.js index 9d11894..f07d9f5 100755 --- a/main_out.js +++ b/main_out.js @@ -1135,6 +1135,14 @@ } ctx.closePath(); var skinName = this.name.toLowerCase(); + if (skinName.indexOf('[')!=-1) + { + var clanStart = skinName.indexOf('['); + var clanEnd = skinName.indexOf(']'); + skinName = skinName.slice(clanStart+1,clanEnd); + console.log(skinName); + } + if (!this.isAgitated && showSkin && ':teams' != gameMode) { if (-1 != knownNameDict.indexOf(skinName)) { if (!skins.hasOwnProperty(skinName)) { From 991987c124c32390f308b6da35e72ea36889c743 Mon Sep 17 00:00:00 2001 From: xf Date: Mon, 22 Jun 2015 20:15:17 +0800 Subject: [PATCH 36/88] remove console log --- main_out.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main_out.js b/main_out.js index f07d9f5..6ba3fa3 100755 --- a/main_out.js +++ b/main_out.js @@ -1140,7 +1140,7 @@ var clanStart = skinName.indexOf('['); var clanEnd = skinName.indexOf(']'); skinName = skinName.slice(clanStart+1,clanEnd); - console.log(skinName); + //console.log(skinName); } if (!this.isAgitated && showSkin && ':teams' != gameMode) { From b32ebef2ee68e01fd9f84b73c8554ace02e55f0a Mon Sep 17 00:00:00 2001 From: Eureka22 Date: Mon, 22 Jun 2015 08:15:43 -0400 Subject: [PATCH 37/88] index --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 08c0582..b658e17 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@ -Agar.io +eureland.me @@ -31,7 +31,7 @@
-

Agar.io

+

Agar Tsinghua (Experimental)

Feedbacks and Suggestions are welcome

From 0d536499e337e3c9796bb63572e74c1a59cc3854 Mon Sep 17 00:00:00 2001 From: Eureka22 Date: Mon, 22 Jun 2015 08:35:05 -0400 Subject: [PATCH 38/88] update index --- index.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index f7a137f..0605adf 100644 --- a/index.html +++ b/index.html @@ -31,7 +31,7 @@
-

Agar Tsinghua (Experimental)

Feedbacks and Suggestions are welcome
+

Agar Tsinghua (测试)

Feedbacks and Suggestions are welcome

@@ -99,8 +99,17 @@

-
- + +
+ + 日常更新(June 22):
+ 1. 更新了客户端,请大家帮忙测试,如果有问题请告诉我。考完试增加更多特性请期待。
+ 2. 更新了"部落模式", 如果使用[部落名]用户名 例如"[526a]李小花","[ee]Richard Song" 之类的id, 会使用中括号里的名字作为皮肤, 玩家可以上传皮肤。
+
+
+
+
+
From 6e933906f3d81540a684318870147ccb761274db Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Tue, 23 Jun 2015 12:49:01 +0800 Subject: [PATCH 39/88] Update readme Add disclaimer. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 07cf4e3..c272c0f 100755 --- a/README.md +++ b/README.md @@ -45,3 +45,7 @@ Original protocol can be found [here](https://github.com/vram4/Agar.io-Protocol) ## Contribution Pull Request are welcome. + +## Disclaimer + +Note that the aim of this repo is to study agar.io client, understand the mechaism and find possible improvemtns. It is worth pointing out that hosting a third-party client is against the [Terms](http://agar.io/terms.txt) and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :) From 2ff7e1e69b3d295b25aebd0f76b6465f7c8d21f7 Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Tue, 23 Jun 2015 12:49:58 +0800 Subject: [PATCH 40/88] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c272c0f..04bbe47 100755 --- a/README.md +++ b/README.md @@ -48,4 +48,4 @@ Pull Request are welcome. ## Disclaimer -Note that the aim of this repo is to study agar.io client, understand the mechaism and find possible improvemtns. It is worth pointing out that hosting a third-party client is against the [Terms](http://agar.io/terms.txt) and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :) +Note that the aim of this repo is to study agar.io client, understand the mechaism and find possible improvements. It is worth pointing out that hosting a third-party agar client is against the [Terms](http://agar.io/terms.txt) and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :) From 5588f3600e2694b6975626cf7cf27e2ad4bf04dc Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Tue, 23 Jun 2015 12:58:08 +0800 Subject: [PATCH 41/88] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04bbe47..6da34a0 100755 --- a/README.md +++ b/README.md @@ -48,4 +48,4 @@ Pull Request are welcome. ## Disclaimer -Note that the aim of this repo is to study agar.io client, understand the mechaism and find possible improvements. It is worth pointing out that hosting a third-party agar client is against the [Terms](http://agar.io/terms.txt) and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :) +Note that the aim of this repo is to study agar.io client, understand the mechaism and find possible improvements. It is worth pointing out that hosting a third-party agar client is against the [Terms](http://agar.io/terms.txt) of Agario and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :) From ae0dad1b31dd56f27a2ee820e5fdca5ae969e865 Mon Sep 17 00:00:00 2001 From: Eureka22 Date: Tue, 23 Jun 2015 22:57:27 -0400 Subject: [PATCH 42/88] add branch --- changelog.html | 21 +++++++++++++++++++++ index.html | 7 ++++--- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 changelog.html diff --git a/changelog.html b/changelog.html new file mode 100644 index 0000000..a205cb5 --- /dev/null +++ b/changelog.html @@ -0,0 +1,21 @@ + +changes are recorded in this document + + + + + +
+日常更新(June 22): + +
+1. +更新了客户端,请大家帮忙测试,如果有问题请告诉我。考完试增加更多特性请期待。 +
+ +2. 更新了"部落模式", 如果使用[部落名]用户名 例如"[526a]李小花","[ee]Richard +Song" 之类的id, 会使用中括号里的名字作为皮肤, 玩家可以上传皮肤。 +预告: 近期将开启皮肤图片库功能,另外上传和背景色相同的图片将会被禁止。 +
+ + diff --git a/index.html b/index.html index 0605adf..c2e61f6 100644 --- a/index.html +++ b/index.html @@ -31,7 +31,7 @@
-

Agar Tsinghua (测试)

Feedbacks and Suggestions are welcome
+

Agar Tsinghua (测试)

期待你们的反馈和建议

@@ -66,7 +66,7 @@
@@ -105,7 +105,8 @@ 日常更新(June 22):
1. 更新了客户端,请大家帮忙测试,如果有问题请告诉我。考完试增加更多特性请期待。
2. 更新了"部落模式", 如果使用[部落名]用户名 例如"[526a]李小花","[ee]Richard Song" 之类的id, 会使用中括号里的名字作为皮肤, 玩家可以上传皮肤。
-
+ 预告: 近期将开启皮肤图片库功能,另外上传和背景色相同的图片将会被禁止。 +
From f9337d67df84a3c54f418f8bab35474c40defd69 Mon Sep 17 00:00:00 2001 From: xf Date: Wed, 24 Jun 2015 17:51:18 +0800 Subject: [PATCH 43/88] add --- gallery/COPYING | 19 + gallery/README.md | 185 +++ gallery/index.php | 25 + gallery/resources/UberGallery.css | 139 ++ gallery/resources/UberGallery.php | 1323 +++++++++++++++++ gallery/resources/colorbox/1/colorbox.css | 70 + .../resources/colorbox/1/images/loading.gif | Bin 0 -> 8685 bytes gallery/resources/colorbox/2/colorbox.css | 50 + .../resources/colorbox/2/images/loading.gif | Bin 0 -> 6244 bytes gallery/resources/colorbox/3/colorbox.css | 45 + .../resources/colorbox/3/images/loading.gif | Bin 0 -> 6244 bytes gallery/resources/colorbox/4/colorbox.css | 66 + .../resources/colorbox/4/images/loading.gif | Bin 0 -> 6244 bytes gallery/resources/colorbox/5/colorbox.css | 58 + .../resources/colorbox/5/images/loading.gif | Bin 0 -> 8685 bytes gallery/resources/colorbox/jquery.colorbox.js | 6 + gallery/resources/sample.galleryConfig.ini | 36 + .../resources/templates/colorboxScripts.php | 7 + .../resources/templates/defaultGallery.php | 50 + gallery/resources/themes/uber-blue/index.php | 70 + .../resources/themes/uber-blue/rebase-min.css | 1 + gallery/resources/themes/uber-blue/style.css | 233 +++ gallery/resources/themes/uber-naked/index.php | 28 + gallery/resources/themes/uber-naked/style.css | 139 ++ .../resources/themes/uber-orange/index.php | 68 + .../themes/uber-orange/rebase-min.css | 1 + .../resources/themes/uber-orange/style.css | 211 +++ .../css/bootstrap-responsive.min.css | 9 + .../uber-responsive/css/bootstrap.min.css | 9 + .../themes/uber-responsive/css/style.css | 25 + .../themes/uber-responsive/index.php | 109 ++ .../uber-responsive/js/bootstrap.min.js | 6 + index.html | 133 +- main_out.js | 149 +- untitled.html | 5 + 35 files changed, 3259 insertions(+), 16 deletions(-) create mode 100644 gallery/COPYING create mode 100644 gallery/README.md create mode 100644 gallery/index.php create mode 100644 gallery/resources/UberGallery.css create mode 100644 gallery/resources/UberGallery.php create mode 100644 gallery/resources/colorbox/1/colorbox.css create mode 100644 gallery/resources/colorbox/1/images/loading.gif create mode 100644 gallery/resources/colorbox/2/colorbox.css create mode 100644 gallery/resources/colorbox/2/images/loading.gif create mode 100644 gallery/resources/colorbox/3/colorbox.css create mode 100644 gallery/resources/colorbox/3/images/loading.gif create mode 100644 gallery/resources/colorbox/4/colorbox.css create mode 100644 gallery/resources/colorbox/4/images/loading.gif create mode 100644 gallery/resources/colorbox/5/colorbox.css create mode 100644 gallery/resources/colorbox/5/images/loading.gif create mode 100644 gallery/resources/colorbox/jquery.colorbox.js create mode 100644 gallery/resources/sample.galleryConfig.ini create mode 100644 gallery/resources/templates/colorboxScripts.php create mode 100644 gallery/resources/templates/defaultGallery.php create mode 100644 gallery/resources/themes/uber-blue/index.php create mode 100644 gallery/resources/themes/uber-blue/rebase-min.css create mode 100644 gallery/resources/themes/uber-blue/style.css create mode 100644 gallery/resources/themes/uber-naked/index.php create mode 100644 gallery/resources/themes/uber-naked/style.css create mode 100644 gallery/resources/themes/uber-orange/index.php create mode 100644 gallery/resources/themes/uber-orange/rebase-min.css create mode 100644 gallery/resources/themes/uber-orange/style.css create mode 100644 gallery/resources/themes/uber-responsive/css/bootstrap-responsive.min.css create mode 100644 gallery/resources/themes/uber-responsive/css/bootstrap.min.css create mode 100644 gallery/resources/themes/uber-responsive/css/style.css create mode 100644 gallery/resources/themes/uber-responsive/index.php create mode 100644 gallery/resources/themes/uber-responsive/js/bootstrap.min.js create mode 100644 untitled.html diff --git a/gallery/COPYING b/gallery/COPYING new file mode 100644 index 0000000..397a074 --- /dev/null +++ b/gallery/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2013 Chris Kankiewicz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/gallery/README.md b/gallery/README.md new file mode 100644 index 0000000..caf766f --- /dev/null +++ b/gallery/README.md @@ -0,0 +1,185 @@ +UberGallery - The simple PHP photo gallery +========================================== +Created by, [Chris Kankiewicz](http://www.ChrisKankiewicz.com) + + +Introduction +------------ +UberGallery is an easy to use, simple to manage, web photo gallery written in PHP and distributed +under the [MIT License](http://www.opensource.org/licenses/mit-license.php). UberGallery +**does not** require a database and supports JPEG, GIF and PNG file types. Simply upload your images +and UberGallery will automatically generate thumbnails and output standards compliant XHTML markup +on the fly. + + +Features +-------- + * Simple first time installation + * Database-less configuration + * Include galleries within pre-existing sites + * Create multiple galleries with a single installation + * Easily customize your gallery styles via CSS + * Install and update the gallery easily wth Git (optional) + + +Requirements +------------ +UberGallery requires PHP 5.2+ and the PHP-GD image library to work properly. For more information on +PHP and the PHP-GD image library, please visit [http://php.net](http://php.net). + + +Simple Installation +------------------- + 1. Copy `resources/sample.galleryConfig.ini` to `resources/galleryConfig.ini` and modify the settings +to your liking. + + 2. Upload `index.php`, `resources/` and `gallery-images/` to your web server. + + 3. Upload images to the `gallery-images/` directory. + + 4. Make the `resources/cache/` directory writable by the web server: + + ``` + chmod 777 /path/to/resources/cache + ``` + + 5. Open your web browser and load the page where you installed UberGallery. + + +Custom Installation +------------------- + 1. Copy `resources/sample.galleryConfig.ini` to `resources/galleryConfig.ini` and modify the settings +to your liking. + + 2. Upload the `resources/` folder to your web server. + + 3. Insert the following code into the PHP page where you would like the gallery to be displayed +(be sure to change the include and image folder path to match your configuration): + + ```php + createGallery('path/to/images-folder'); ?> + ``` + + 4. Include the UberGallery and desired ColorBox style sheet in your page header: + + ```html + + + ``` + + **NOTE:** You can replace the `1` with a value between 1 and 5 for different ColorBox themes. + + 5. Include the jQuery and ColorBox javascript files in your page header: + + ```html + + + ``` + + 6. Include the ColorBox jquery call in your header: + + ```html + + ``` + + 7. Upload images to your images directory. + + 8. Make the `resources/cache/` directory writable by the web server. + + ``` + chmod 777 /path/to/resources/cache + ``` + + 9. Open your web browser and load the page where you installed UberGallery. + + +Install with Git +---------------- + 1. SSH into the your server and clone the UberGallery repository and submodules: + + ``` + git clone --recursive git://github.com/UberGallery/UberGallery.git /path/to/ubergallery + ``` + + 2. Copy `resources/sample.galleryConfig.ini` to `resources/galleryConfig.ini` and modify the settings + + ``` + cp resource/sample.galleryConfig.ini resources/galleryConfig.ini + nano resources/galleryConfig.ini + ``` + + 3. Upload images to the `gallery-images/` folder within your gallery directory. + + 4. Make the `resources/cache/` directory writable by the web server. + + ``` + chmod 777 /path/to/resources/cache + ``` + + 5. Open your web browser and load the page where you installed UberGallery. + +When using this method to install UberGallery, you may update your installation by running +the following commands: + + cd /path/to/gallery-directory + git pull origin master + git submodule update + +**NOTE:** If you are installing UberGallery via git into an existing git repository, you will need +to add it as a submodule. + + git submodule add git://github.com/UberGallery/UberGallery.git path/to/ubergallery + git submodule update --init --recursive path/to/ubergallery + + +Troubleshooting +--------------- +If you're having issues with UberGallery here are a few troubleshooting tips: + + * Verify that you have PHP 5.2 or later installed. You can verify your PHP version by running: + + ``` + php --version + ``` + + * Make sure you have the latest version of UberGallery installed. You can always find the latest + version at + + * Replace your `galleryConfig.ini` with `sample.galleryConfig.ini` to ensure proper configuration: + + ``` + rm resources/galleryConfig.ini + cp resource/sample.galleryConfig.ini resources/galleryConfig.ini + ``` + + * Clear your cache and make sure the directory is writable by the web server: + + ``` + rm -f resources/cache/* + chmod 777 resources/cache + ``` + + * Enable debugging by setting the `enable_debugging` option in `resources/galleryConfig.ini` to + `true`, try loading your gallery in a web browser then inspect the debug.log file in your cache + directory for any errors. + +If you continue to have issues, please email me at: + + +News & Updates +-------------- +UberGallery updates and news can be found on our [blog](http://news.ubergallery.net) or by +following [@UberGallery](http://twitter.com/ubergallery) on Twitter. + +Please report bugs to the [Github issue tracker](http://github.com/UberGallery/ubergallery/issues). + + +License +------- +UberGallery is distributed under the terms of the +[MIT License](http://www.opensource.org/licenses/mit-license.php). +Copyright © 2013 [Chris Kankiewicz](http://www.chriskankiewicz.com) diff --git a/gallery/index.php b/gallery/index.php new file mode 100644 index 0000000..23aca30 --- /dev/null +++ b/gallery/index.php @@ -0,0 +1,25 @@ +readImageDirectory('gallery-images'); + + // Define theme path + if (!defined('THEMEPATH')) { + define('THEMEPATH', $gallery->getThemePath()); + } + + // Set path to theme index + $themeIndex = $gallery->getThemePath(true) . '/index.php'; + + // Initialize the theme + if (file_exists($themeIndex)) { + include($themeIndex); + } else { + die('ERROR: Failed to initialize theme'); + } diff --git a/gallery/resources/UberGallery.css b/gallery/resources/UberGallery.css new file mode 100644 index 0000000..d7906ca --- /dev/null +++ b/gallery/resources/UberGallery.css @@ -0,0 +1,139 @@ +/* -------------------------------------------------------------------------- */ +/* -----| GALLERY LIST |----------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +#galleryList { + margin: 0; + padding: 0 4px; +} + +#galleryList li { + display: inline-block; + float: left; + list-style: none; + margin: 5px 6px; + padding: 0; +} + +#galleryList li a { + background-color: #FFF; + border: 1px solid #CCC; + display: block; + padding: 4px; +} + +#galleryList li a:hover { + border-color: #999; +} + +#galleryList li a img { + border: none; +} + +/* -------------------------------------------------------------------------- */ +/* -----| GALLERY FOOTER |--------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +#galleryFooter { + border-top: 1px solid #CCC; + margin-top: 10px; + padding: 3px; +} + +#credit { + float: right; + font-size: 0.9em; + margin: 4px 0; +} + +#galleryFooter #credit a { + color: #369; +} + + +/* -------------------------------------------------------------------------- */ +/* ----| PAGINATION |------------------------------------------------------ */ +/* -------------------------------------------------------------------------- */ + +#galleryPagination { + color: #369; + float: left; + font-size: .9em; + margin: 0 !important; + padding: 0 !important; + text-align: center; +} + +#galleryPagination li { + border: 1px solid transparent; + border-radius: 3px; + display: block; + float: left; + list-style: none; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +#galleryPagination li:hover { + background-color: #EFEFEF; + border: 1px solid #CCC; +} + +#galleryPagination li.title { + background: transparent url(page_white_stack.png) no-repeat left center; + border: 1px solid transparent; + font-weight: normal; + padding: 3px 6px 3px 22px; +} + +#galleryPagination li a, #galleryPagination li a:visited { + color: #369; + display: block; + padding: 3px 6px; + text-decoration: none; +} + +#galleryPagination li.current { + background-color: transparent; + border: 1px solid transparent; + color: #333; + font-weight: bold; + padding: 3px 6px; +} + +#galleryPagination li.inactive { + background-color: transparent; + color: #ACACAC; + border: 1px solid transparent; + display: block; + padding: 3px 6px; +} + + +/* -------------------------------------------------------------------------- */ +/* ----| MISCELLANEOUS |--------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + +/* --- CLEAR FIX --- */ + +.clearfix:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; +} + +* html .clearfix { + zoom: 1; /* IE6 */ +} + +*:first-child+html .clearfix { + zoom: 1; /* IE7 */ +} + +/** + * UberGallery.css created and implimented by, + * Chris Kankiewicz -- http://www.ChrisKankiewicz.com + */ \ No newline at end of file diff --git a/gallery/resources/UberGallery.php b/gallery/resources/UberGallery.php new file mode 100644 index 0000000..21c377d --- /dev/null +++ b/gallery/resources/UberGallery.php @@ -0,0 +1,1323 @@ + + * @copyright Copyright (c) 2013 Chris Kankiewicz (http://www.chriskankiewicz.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT License + * @link https://github.com/UberGallery/UberGallery Cannonical source URL + */ +class UberGallery { + + // Define application version + const VERSION = '2.4.8'; + + // Reserve some variables + protected $_config = array(); + protected $_imgDir = NULL; + protected $_appDir = NULL; + protected $_index = NULL; + protected $_rThumbsDir = NULL; + protected $_rImgDir = NULL; + protected $_now = NULL; + + /** + * UberGallery construct function. Runs on object creation. + */ + public function __construct() { + + // Get timestamp for the current time + $this->_now = time(); + + // Sanitize input and set current page + if (isset($_GET['page'])) { + $this->_page = (integer) $_GET['page']; + } else { + $this->_page = 1; + } + + // Set class directory constant + if(!defined('__DIR__')) { + define('__DIR__', dirname(__FILE__)); + } + + // Set application directory + $this->_appDir = __DIR__; + + // Set configuration file path + $configPath = $this->_appDir . '/galleryConfig.ini'; + + // Read and apply gallery config or throw error on fail + if (file_exists($configPath)) { + // Parse gallery configuration + $config = parse_ini_file($configPath, true); + + // Apply configuration + $this->setCacheExpiration($config['basic_settings']['cache_expiration']); + $this->setPaginatorThreshold($config['basic_settings']['paginator_threshold']); + $this->setThumbSize($config['basic_settings']['thumbnail_width'], $config['basic_settings']['thumbnail_height']); + $this->setThumbQuality($config['basic_settings']['thumbnail_quality']); + $this->setThemeName($config['basic_settings']['theme_name']); + $this->setSortMethod($config['advanced_settings']['images_sort_by'], $config['advanced_settings']['reverse_sort']); + $this->setDebugging($config['advanced_settings']['enable_debugging']); + $this->setCacheDirectory($this->_appDir . '/cache'); + + if ($config['basic_settings']['enable_pagination']) { + $this->setImagesPerPage($config['advanced_settings']['images_per_page']); + } else { + $this->setImagesPerPage(0); + } + + } else { + die("Unable to read galleryConfig.ini, please make sure the file exists at:
{$configPath}
"); + } + + // Get the relative thumbs directory path + $this->_rThumbsDir = $this->_getRelativePath(getcwd(), $this->_config['cache_dir']); + + // Check if cache directory exists and create it if it doesn't + if (!file_exists($this->_config['cache_dir'])) { + $this->setSystemMessage('error', "Cache directory does not exist, please manually create it."); + } + + // Check if cache directory is writeable and warn if it isn't + if (!is_writable($this->_config['cache_dir'])) { + $this->setSystemMessage('error', "Cache directory needs write permissions. If all else fails, try running:
chmod 777 {$this->_config['cache_dir']}
"); + } + + // Set debug log path + $this->_debugLog = $this->_config['cache_dir'] . '/debug.log'; + + // Set up debugging if enabled + if ($this->_config['debugging']) { + + // Initialize log if it doesn't exist + if (!file_exists($this->_debugLog)) { + + // Get libgd info + $gd = gd_info(); + + // Get system and package info + $timestamp = date('Y-m-d H:i:s'); + $ugVersion = 'UberGallery v' . UberGallery::VERSION; + $phpVersion = 'PHP: ' . phpversion(); + $gdVersion = 'GD: ' . $gd['GD Version']; + $osVersion = 'OS: ' . PHP_OS; + + // Combine all the things! + $initText = $timestamp . ' / ' . $ugVersion . ' / ' . $phpVersion . ' / ' . $gdVersion . ' / ' . $osVersion . PHP_EOL; + + // Create file with initilization text + file_put_contents($this->_debugLog, $initText, FILE_APPEND); + } + + // Set new error handler + set_error_handler("UberGallery::_errorHandler"); + + } + + } + + + /** + * Special init method for simple one-line interface + * + * @return reflection + * @access public + */ + public static function init() { + $reflection = new ReflectionClass(__CLASS__); + return $reflection->newInstanceArgs(func_get_args()); + } + + + /** + * Returns pre-formatted XHTML of a gallery + * + * @param string $directory Relative path to images directory + * @param string $relText Text to use as the rel value + * @return object Self + * @access public + */ + public function createGallery($directory, $relText = 'colorbox') { + + // Get the gallery data array and set the template path + $galleryArray = $this->readImageDirectory($directory); + $templatePath = $this->_appDir . '/templates/defaultGallery.php'; + + // Set the relative text attribute + $galleryArray['relText'] = $relText; + + // Echo the template contents + echo $this->readTemplate($templatePath, $galleryArray); + + return $this; + + } + + + /** + * Returns an array of files and stats of the specified directory + * + * @param string $directory Relative path to images directory + * @return array File listing and statistics for specified directory + * @access public + */ + public function readImageDirectory($directory) { + + // Set relative image directory + $this->setRelativeImageDirectory($directory); + + // Instantiate gallery array + $galleryArray = array(); + + // Get the cached array + $galleryArray = $this->_readIndex($this->_index); + + // If cached array is false, read the directory + if (!$galleryArray) { + + // Get array of directory + $dirArray = $this->_readDirectory($directory); + + // Loop through array and add additional info + foreach ($dirArray as $key => $image) { + + // Get files relative path + $relativePath = $this->_rImgDir . '/' . $key; + + $galleryArray['images'][htmlentities(pathinfo($image['real_path'], PATHINFO_BASENAME))] = array( + 'file_title' => str_replace('_', ' ', pathinfo($image['real_path'], PATHINFO_FILENAME)), + 'file_path' => htmlentities($relativePath), + 'thumb_path' => $this->_createThumbnail($image['real_path']) + ); + + } + + // Add statistics to gallery array + $galleryArray['stats'] = $this->_readGalleryStats($this->_readDirectory($directory, false)); + + // Add gallery paginator to the gallery array + $galleryArray['paginator'] = $this->_getPaginatorArray($galleryArray['stats']['current_page'], $galleryArray['stats']['total_pages']); + + // Save the sorted array + if ($this->isCachingEnabled()) { + $this->_createIndex($galleryArray, $this->_index); + } + } + + // Return the array + return $galleryArray; + } + + /** + * Returns a template string with custom data injected into it + * + * @param string $templatePath Path to template file + * @param array $data Array of data to be injected into the template + * @return string Processed template string + * @access private + */ + public function readTemplate($templatePath, $data) { + + // Extract array to variables + extract($data); + + // Start the output buffer + ob_start(); + + // Include the template + include $templatePath; + + // Set buffer output to a variable + $output = ob_get_clean(); + + // Return the output + return $output; + + } + + + /** + * Returns the theme name + * + * @return string Theme name as set in user config + * @access public + */ + public function getThemeName() { + // Return the theme name + return $this->_config['theme_name']; + } + + + /** + * Returns the path to the chosen theme directory + * + * @param bool $absolute true = return absolute path / false = return relative path (default) + * @return string Path to theme + * @access public + */ + public function getThemePath($absolute = false) { + if ($absolute) { + // Set the theme path + $themePath = $this->_appDir . '/themes/' . $this->_config['theme_name']; + } else { + // Get relative path to application dir + $realtivePath = $this->_getRelativePath(getcwd(), $this->_appDir); + + // Set the theme path + $themePath = $realtivePath . '/themes/' . $this->_config['theme_name']; + } + + return $themePath; + } + + + /** + * Get an array of error messages or false when empty + * + * @return array|boolean Array of error messages or boolean false if none + * @access public + */ + public function getSystemMessages() { + if (isset($this->_systemMessage) && is_array($this->_systemMessage)) { + return $this->_systemMessage; + } else { + return false; + } + } + + + /** + * Returns valid XHTML link tag for chosen ColorBox stylesheet + * + * @param int $themeNum Integer (1-5) representing the ColorBox theme number + * @return string Valid XHTML link tag for chosen ColorBox stylesheet + * @access public + */ + public function getColorboxStyles($themeNum) { + + // Get relative path to application dir + $realtivePath = $this->_getRelativePath(getcwd(), $this->_appDir); + + // Set ColorBox path + $colorboxPath = $realtivePath . '/colorbox/' . $themeNum . '/colorbox.css'; + + return ''; + } + + + /** + * Returns valid XHTML tags for ColorBox JavaScript include + * + * @return string Valid XHTML tags for ColorBox JavaScript include + * @access public + */ + public function getColorboxScripts() { + + // Set some path variables + $templatePath = $this->_appDir . '/templates/colorboxScripts.php'; + $colorboxPath = $this->_getRelativePath(getcwd(), $this->_appDir) . '/colorbox/jquery.colorbox.js'; + + // Get the template contents + $template = $this->readTemplate($templatePath, array('path' => $colorboxPath)); + + // Return the include text + return $template; + + } + + /** + * Set cache expiration time in minutes + * + * @param int $time Cache expiration time in minutes (default = 0) + * @return object Self + * @access public + */ + public function setCacheExpiration($time = 0) { + $this->_config['cache_expire'] = $time; + + return $this; + } + + /** + * Check if caching is enabled + * + * @return boolean to indiciate whether caching is enabled or not + * @access public + */ + public function isCachingEnabled() { + return $this->_config['cache_expire'] != 0; + } + + + /** + * Set the number of images to be displayed per page + * + * @param int $imgPerPage Number of images to display per page (default = 0) + * @return object Self + * @access public + */ + public function setImagesPerPage($imgPerPage = 0) { + $this->_config['img_per_page'] = $imgPerPage; + + return $this; + } + + + /** + * Set thumbnail width and height in pixels + * + * @param int $width Thumbnail width in pixels (default = 100) + * @param int $height Thumbnail height in pixels (default = 100) + * @return object Self + * @access public + */ + public function setThumbSize($width = 100, $height = 100) { + $this->_config['thumbnail']['width'] = $width; + $this->_config['thumbnail']['height'] = $height; + + return $this; + } + + + /** + * Set thumbnail quality as a value from 1 - 100 + * This only affects JPEGs and has no effect on GIF or PNGs + * + * @param int $quality Thumbnail size in pixels (default = 75) + * @return object Self + * @access public + */ + public function setThumbQuality($quality = 75) { + $this->_config['thumbnail']['quality'] = $quality; + + return $this; + } + + + /** + * Set theme name + * + * @param string $name Theme name (default = uber-blue) + * @return object Self + * @access public + */ + public function setThemeName($name = 'uber-blue') { + $this->_config['theme_name'] = $name; + + return $this; + } + + + /** + * Set the sortting method + * + * @param string $method Sorting method (default = natcasesort) + * @param boolean $reverse true = reverse sort order (default = false) + * @return object Self + * @access public + */ + public function setSortMethod($method = 'natcasesort', $reverse = false) { + $this->_config['sort_method'] = $method; + $this->_config['reverse_sort'] = $reverse; + + return $this; + } + + + /** + * Enable or disable debugging + * + * @param boolean $bool true = on / false = off (default = false) + * @return object Self + * @access public + */ + public function setDebugging($bool = false) { + $this->_config['debugging'] = $bool; + + return $this; + } + + + /** + * Set the cache directory name + * + * @param string $directory Cache directory name + * @return object Self + * @access public + */ + public function setCacheDirectory($directory) { + $this->_config['cache_dir'] = realpath($directory); + + return $this; + } + + + /** + * Set the paginator threshold + * + * @param int $threshold Paginator threshold value (default = 10) + * @return object Self + * @access public + */ + public function setPaginatorThreshold($threshold = 10) { + $this->_config['threshold'] = $threshold; + + return $this; + } + + + + /** + * Sets the relative path to the image directory + * + * @param string $directory Relative path to image directory + * @return object Self + * @access public + */ + public function setRelativeImageDirectory($directory) { + + // Set real path to $directory + $this->_imgDir = realpath($directory); + + // Set relative path to $directory + $this->_rImgDir = $directory; + + // Set index name + if ($this->_config['img_per_page'] < 1) { + $this->_index = $this->_config['cache_dir'] . '/' . $this->_hash($directory) . '-' . 'all.index'; + } else { + $this->_index = $this->_config['cache_dir'] . '/' . $this->_hash($directory) . '-' . $this->_page . '.index'; + } + + return $this; + } + + + /** + * Add a message to the system message array + * + * @param string $type The type of message (ie - error, success, notice, etc.) + * @param string $message The message to be displayed to the user + * @return boolean Returns true on success + * @access public + */ + public function setSystemMessage($type, $text) { + + // Create empty message array if it doesn't already exist + if (isset($this->_systemMessage) && !is_array($this->_systemMessage)) { + $this->_systemMessage = array(); + } + + // Generate unique message key + $key = $this->_hash(trim($type . $text)); + + // Set the error message + $this->_systemMessage[$key] = array( + 'type' => $type, + 'text' => $text + ); + + return true; + } + + /** + * Generate a hash value (message digest) for specific algorithm. + * Default is SHA-256. + * + * @param string $message the message to generate hash for + * @param string $algo hasing algorithm to be used (default: sha256). + * @return string hash value (message digest) + * @access private + */ + private function _hash($message, $algo = "sha256") { + return hash($algo, $message); + } + + + /** + * Reads files in a directory and returns only images + * + * @param string $directory Path to directory + * @param boolean $paginate Whether or not paginate the array (default = true) + * @return array Array of images in the specified directory + * @access private + */ + private function _readDirectory($directory, $paginate = true) { + + // Set index path + $index = $this->_config['cache_dir'] . '/' . $this->_hash($directory) . '-' . 'files' . '.index'; + + // Read directory array + $dirArray = $this->_readIndex($index); + + // Serve from cache if file exists and caching is enabled + if (!$dirArray) { + + // Initialize the array + $dirArray = array(); + + // Loop through directory and add information to array + if ($handle = opendir($directory)) { + while (false !== ($file = readdir($handle))) { + if ($file != "." && $file != "..") { + + // Get files real path + $realPath = realpath($directory . '/' . $file); + + // If file is an image, add info to array + if ($this->_isImage($realPath)) { + $dirArray[htmlentities(pathinfo($realPath, PATHINFO_BASENAME))] = array( + 'real_path' => $realPath + ); + } + } + } + + // Close open file handle + closedir($handle); + } + + // Create directory array + if ($this->isCachingEnabled()) { + $this->_createIndex($dirArray, $index); + } + } + + // Set error message if there are no images + if (empty($dirArray)) { + $this->setSystemMessage('error', "No images found, please upload images to your gallery's image directory."); + } + + // Sort the array + $dirArray = $this->_arraySort($dirArray, $this->_config['sort_method'], $this->_config['reverse_sort']); + + // Paginate the array and return current page if enabled + if ($paginate == true && $this->_config['img_per_page'] > 0) { + $dirArray = $this->_arrayPaginate($dirArray, $this->_config['img_per_page'], $this->_page); + } + + // Return the array + return $dirArray; + } + + + /** + * Creates a cropped, square thumbnail of given dimensions from a source image + * + * @param string $source Path to source image + * @param int $thumbWidth Desired thumbnail width size in pixels (default = null) + * @param int $thumbHeight Desired thumbnail height size in pixels (default = null) + * @param int $quality Thumbnail quality, from 1 to 100, applies to JPG and JPEGs only (default = null) + * @return string Relative path to thumbnail + * @access private + */ + private function _createThumbnail($source, $thumbWidth = NULL, $thumbHeight = NULL, $quality = NULL) { + + // Set defaults thumbnail width if not specified + if ($thumbWidth === NULL) { + $thumbWidth = $this->_config['thumbnail']['width']; + } + + // Set defaults thumbnail height if not specified + if ($thumbHeight === NULL) { + $thumbHeight = $this->_config['thumbnail']['height']; + } + + // Set defaults thumbnail height if not specified + if ($quality === NULL) { + $quality = $this->_config['thumbnail']['quality']; + } + + // MD5 hash of source image path + $fileHash = $this->_hash($source); + + // Get file extension from source image + $fileExtension = pathinfo($source, PATHINFO_EXTENSION); + + // Build file name + $fileName = $thumbWidth . 'x' . $thumbHeight . '-' . $quality . '-' . $fileHash . '.' . $fileExtension; + + // Build thumbnail destination path + $destination = $this->_config['cache_dir'] . '/' . $fileName; + + // If file is cached return relative path to thumbnail + if ($this->_isFileCached($destination)) { + $relativePath = $this->_rThumbsDir . '/' . $fileName; + return $relativePath; + } + + // Get needed image information + $imgInfo = getimagesize($source); + $width = $imgInfo[0]; + $height = $imgInfo[1]; + $x = 0; + $y = 0; + + // Calculate ratios + $srcRatio = $width / $height; + $thumbRatio = $thumbWidth / $thumbHeight; + + if ($srcRatio > $thumbRatio) { + + // Preserver original width + $originalWidth = $width; + + // Crop image width to proper ratio + $width = $height * $thumbRatio; + + // Set thumbnail x offset + $x = ceil(($originalWidth - $width) / 2); + + } elseif ($srcRatio < $thumbRatio) { + + // Preserver original height + $originalHeight = $height; + + // Crop image height to proper ratio + $height = ($width / $thumbRatio); + + // Set thumbnail y offset + $y = ceil(($originalHeight - $height) / 2); + + } + + // Create new empty image of proper dimensions + $newImage = imagecreatetruecolor($thumbWidth, $thumbHeight); + + // Create new thumbnail + if ($imgInfo[2] == IMAGETYPE_JPEG) { + $image = imagecreatefromjpeg($source); + imagecopyresampled($newImage, $image, 0, 0, $x, $y, $thumbWidth, $thumbHeight, $width, $height); + imagejpeg($newImage, $destination, $quality); + } elseif ($imgInfo[2] == IMAGETYPE_GIF) { + $image = imagecreatefromgif($source); + imagecopyresampled($newImage, $image, 0, 0, $x, $y, $thumbWidth, $thumbHeight, $width, $height); + imagegif($newImage, $destination); + } elseif ($imgInfo[2] == IMAGETYPE_PNG) { + $image = imagecreatefrompng($source); + imagecopyresampled($newImage, $image, 0, 0, $x, $y, $thumbWidth, $thumbHeight, $width, $height); + imagepng($newImage, $destination); + } + + // Return relative path to thumbnail + $relativePath = $this->_rThumbsDir . '/' . $fileName; + return $relativePath; + } + + /** + * Return array from the cached index + * + * @param string $filePath Path to stored index + * @return array|boolean Decoded cached array or false when no valid index is found + * @access private + */ + private function _readIndex($filePath) { + + // Return false if file doesn't exist or the cache has expired + if (!$this->_isFileCached($filePath)) { + return false; + } + + // Read file index + $indexString = file_get_contents($filePath); + + // Unsearialize the array + $indexArray = unserialize($indexString); + + // Decode the array + $decodedArray = $this->_arrayDecode($indexArray); + + // Return the array + return $decodedArray; + } + + + /** + * Create serialized index from file array + * + * @param string $array Array to be indexed + * @param string $filePath Path where index will be stored + * @return boolean Returns true on success, false on failure + * @access private + */ + private function _createIndex($array, $filePath) { + + // Encode the array + $encodedArray = $this->_arrayEncode($array); + + // Serialize array + $serializedArray = serialize($encodedArray); + + // Write serialized array to index + if (file_put_contents($filePath, $serializedArray)) { + return true; + } + + return false; + + } + + /** + * Runs all array strings through base64_encode to help + * prevent errors with non-English languages + * + * @param array $array Array to be encoded + * @return array The encoded array + * @access private + */ + private function _arrayEncode($array) { + + $encodedArray = array(); + + foreach ($array as $key => $item) { + + // Base64 encode the array keys + $key = base64_encode($key); + + // Base64 encode the array values + if (is_array($item)) { + + // Recursively call _arrayEncode() + $encodedArray[$key] = $this->_arrayEncode($item); + + } elseif (is_string($item)) { + + // Base64 encode the string + $encodedArray[$key] = base64_encode($item); + + } else { + + // Pass value unaltered to new array + $encodedArray[$key] = $item; + + } + } + + // Return the encoded array + return $encodedArray; + + } + + + /** + * Decodes an encoded array + * + * @param array $array Array to be decoded + * @return array The decoded array + * @access private + */ + private function _arrayDecode($array) { + + $decodedArray = array(); + + foreach ($array as $key => $item) { + + // Base64 decode the array keys + $key = base64_decode($key); + + // Base64 decode the array values + if (is_array($item)) { + + // Recursively call _arrayDecode() + $decodedArray[$key] = $this->_arrayDecode($item); + + } elseif (is_string($item)) { + + // Base64 decode the string + $decodedArray[$key] = base64_decode($item); + + } else { + + // Pass value unaltered to new array + $decodedArray[$key] = $item; + + } + } + + // Return the decoded array + return $decodedArray; + + } + + + /** + * Returns an array of gallery statistics + * + * @param array $array Array to gather stats from + * @return array Array of gallery statistics + * @access private + */ + private function _readGalleryStats($array) { + // Caclulate total array elements + $totalElements = count($array); + + // Calculate total pages + if ($this->_config['img_per_page'] > 0) { + $totalPages = ceil($totalElements / $this->_config['img_per_page']); + } else { + $totalPages = 1; + } + + // Set current page + if ($this->_page < 1) { + $currentPage = 1; + } elseif ($this->_page > $totalPages) { + $currentPage = $totalPages; + } else { + $currentPage = (integer) $this->_page; + } + + // Add stats to array + $statsArray = array( + 'current_page' => $currentPage, + 'total_images' => $totalElements, + 'total_pages' => $totalPages + ); + + // Return array + return $statsArray; + } + + + /** + * Returns a formatted array for the gallery paginator + * + * @param int $currentPage The current page being viewed + * @param int $totalPages Total number of pages in the gallery + * @return array Array for building the paginator + * @access private + */ + private function _getPaginatorArray($currentPage, $totalPages) { + + // Set some variables + $range = ceil($this->_config['threshold'] / 2) - 1; + $firstPage = $currentPage - $range; + $lastPage = $currentPage + $range; + $firstDiff = NULL; + $lastDiff = NULL; + + // Ensure first page is within the bounds of available pages + if ($firstPage <= 1) { + $firstDiff = 1 - $firstPage; + $firstPage = 1; + } + + // Ensure last page is within the bounds of available pages + if ($lastPage >= $totalPages) { + $lastDiff = $lastPage - $totalPages; + $lastPage = $totalPages; + } + + // Apply page differences + $lastPage = $lastPage + $firstDiff; + $firstPage = $firstPage - $lastDiff; + + // Recheck first and last page to ensure they're within proper bounds + if ($firstPage <= 1 && $lastPage >= $totalPages) { + $firstPage = 1; + $lastPage = $totalPages; + } + + // Create title element + $paginatorArray[] = array( + 'text' => 'Page ' . $currentPage . ' of ' . $totalPages, + 'class' => 'title' + ); + + // Create previous page element + if ($currentPage == 1) { + + $paginatorArray[] = array( + 'text' => '<', + 'class' => 'inactive' + ); + + } else { + + $paginatorArray[] = array( + 'text' => '<', + 'class' => 'active', + 'href' => '?page=' . ($currentPage - 1) + ); + + } + + // Set previous overflow + if ($firstPage > 1) { + $paginatorArray[] = array( + 'text' => '...', + 'class' => 'more', + 'href' => '?page=' . ($currentPage - $range - 1) + ); + } + + // Generate the page elelments + for ($i = $firstPage; $i <= $lastPage; $i++) { + + if ($i == $currentPage) { + + $paginatorArray[] = array( + 'text' => $i, + 'class' => 'current' + ); + + } else { + + $paginatorArray[] = array( + 'text' => $i, + 'class' => 'active', + 'href' => '?page=' . $i + ); + + } + + } + + // Set next overflow + if ($lastPage < $totalPages) { + $paginatorArray[] = array( + 'text' => '...', + 'class' => 'more', + 'href' => '?page=' . ($currentPage + $range + 1) + ); + } + + // Create next page element + if ($currentPage == $totalPages) { + + $paginatorArray[] = array( + 'text' => '>', + 'class' => 'inactive' + ); + + } else { + + $paginatorArray[] = array( + 'text' => '>', + 'class' => 'active', + 'href' => '?page=' . ($currentPage + 1) + ); + + } + + // Return the paginator array + return $paginatorArray; + + } + + + /** + * Sorts an array by the provided sort method + * + * @param array $array Array to be sorted + * @param string $sort Sorting method (acceptable inputs: natsort, natcasesort, etc.) + * @param reverse Reverses the sorted array on true (default = false) + * @return array Sorted array + * @access private + */ + private function _arraySort($array, $sortMethod, $reverse = false) { + // Create empty array + $sortedArray = array(); + + // Create new array of just the keys and sort it + $keys = array_keys($array); + + switch ($sortMethod) { + case 'asort': + asort($keys); + break; + case 'arsort': + arsort($keys); + break; + case 'ksort': + ksort($keys); + break; + case 'krsort': + krsort($keys); + break; + case 'natcasesort': + natcasesort($keys); + break; + case 'natsort': + natsort($keys); + break; + case 'shuffle': + shuffle($keys); + break; + } + + // Loop through the sorted values and move over the data + foreach ($keys as $key) { + $sortedArray[$key] = $array[$key]; + } + + // Reverse array if set + if ($reverse) { + $sortedArray = array_reverse($sortedArray, true); + } + + // Return sorted array + return $sortedArray; + + } + + + /** + * Paginates array and returns partial array of the current page + * + * @param string $array Array to be paginated + * @param int $resultsPerPage Number of desired results per page + * @param int $currentPage Current page number + * @return array A parial array representing the current page + * @access private + */ + private function _arrayPaginate($array, $resultsPerPage, $currentPage) { + // Page varriables + $totalElements = count($array); + + if ($totalElements == 0) { + + $paginatedArray = array(); + + } else { + + if ($resultsPerPage <= 0 || $resultsPerPage >= $totalElements) { + $firstElement = 0; + $lastElement = $totalElements; + $totalPages = 1; + } else { + // Calculate total pages + $totalPages = ceil($totalElements / $resultsPerPage); + + // Set current page + if ($currentPage < 1) { + $currentPage = 1; + } elseif ($currentPage > $totalPages) { + $currentPage = $totalPages; + } else { + $currentPage = (integer) $currentPage; + } + + // Calculate starting image + $firstElement = ($currentPage - 1) * $resultsPerPage; + + // Calculate last image + if($currentPage * $resultsPerPage > $totalElements) { + $lastElement = $totalElements; + } else { + $lastElement = $currentPage * $resultsPerPage; + } + } + + // Initiate counter + $x = 1; + + // Run loop to paginate images and add them to array + foreach ($array as $key => $element) { + + // Add image to array if within current page + if ($x > $firstElement && $x <= $lastElement) { + $paginatedArray[$key] = $array[$key]; + } + + // Increment counter + $x++; + } + + } + + // Return paginated array + return $paginatedArray; + } + + + /** + * Verifies whether or not a file is an image + * + * @param string $filePath Path to file for testing + * @return boolean Returns true if file is an image or false if file is not an image + * @access private + */ + private function _isImage($filePath) { + // Get file type + if (function_exists('exif_imagetype')) { + $imgType = @exif_imagetype($filePath); + } else { + $imgArray = @getimagesize($filePath); + $imgType = $imgArray[2]; + } + + // Array of accepted image types + $allowedTypes = array(1, 2, 3); + + // Determine if the file type is an acceptable image type + if (in_array($imgType, $allowedTypes)) { + return true; + } else { + return false; + } + } + + + /** + * Compares two paths and returns the relative path from one to the other + * + * @param string $fromPath Starting path + * @param string $toPath Ending path + * @return string $relativePath Relative path from $fromPath to $toPath + * @access private + */ + private function _getRelativePath($fromPath, $toPath) { + + // Define the OS specific directory separator + if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR); + + // Remove double slashes from path strings + $fromPath = str_replace(DS . DS, DS, $fromPath); + $toPath = str_replace(DS . DS, DS, $toPath); + + // Explode working dir and cache dir into arrays + $fromPathArray = explode(DS, $fromPath); + $toPathArray = explode(DS, $toPath); + + // Remove last fromPath array element if it's empty + $x = count($fromPathArray) - 1; + + if(!trim($fromPathArray[$x])) { + array_pop($fromPathArray); + } + + // Remove last toPath array element if it's empty + $x = count($toPathArray) - 1; + + if(!trim($toPathArray[$x])) { + array_pop($toPathArray); + } + + // Get largest array count + $arrayMax = max(count($fromPathArray), count($toPathArray)); + + // Set some default variables + $diffArray = array(); + $samePath = true; + $key = 1; + + // Generate array of the path differences + while ($key <= $arrayMax) { + + // Get to path variable + $toPath = isset($toPathArray[$key]) ? $toPathArray[$key] : NULL; + + // Get from path variable + $fromPath = isset($fromPathArray[$key]) ? $fromPathArray[$key] : NULL; + + if ($toPath !== $fromPath || $samePath !== true) { + + // Prepend '..' for every level up that must be traversed + if (isset($fromPathArray[$key])) { + array_unshift($diffArray, '..'); + } + + // Append directory name for every directory that must be traversed + if (isset($toPathArray[$key])) { + $diffArray[] = $toPathArray[$key]; + } + + // Directory paths have diverged + $samePath = false; + } + + // Increment key + $key++; + } + + // Set the relative thumbnail directory path + $relativePath = implode('/', $diffArray); + + // Return the relative path + return $relativePath; + + } + + + /** + * Determines if a file is cached or not + * + * @param string $filePath Path to file to check + * @return bool Returns true if file is cached and available or false if file is not cached + * @access private + */ + private function _isFileCached($filePath) { + + if (file_exists($filePath) && (($this->_now - filemtime($filePath)) / 60 <= $this->_config['cache_expire'] || $this->_config['cache_expire'] < 0 )) { + return true; + } + + return false; + + } + + + /** + * Custom error handler for logging errors to the debug log + * + * @param int $errorNum Level of the error raised + * @param string $errorMsg The error message + * @param string $fileName Filename that the error was raised in + * @param int $lineNum Line number the error was raised at + * @param array $vars Array pointing to the active symbol table at the point the error occurred + * @return void + * @access private + */ + private function _errorHandler($errorNum, $errorMsg, $fileName, $lineNum, $vars) { + + // Set current timestamp + $time = date('Y-m-d H:i:s'); + + // Build error type array + $errorType = array ( + 1 => "Error", + 2 => "Warning", + 4 => "Parsing Error", + 8 => "Notice", + 16 => "Core Error", + 32 => "Core Warning", + 64 => "Compile Error", + 128 => "Compile Warning", + 256 => "User Error", + 512 => "User Warning", + 1024 => "User Notice" + ); + + // Set error type + $errorLevel = $errorType[$errorNum]; + + // Build the log message text + $logMessage = $time . ' : ' . $fileName . ' on line '. $lineNum . ' [' . $errorLevel . '] ' . $errorMsg . PHP_EOL; + + // Append the message to the log + if ($errorNum != 8) { + error_log($logMessage, 3, $this->_debugLog, FILE_APPEND); + } + + // Terminate on fatal error + if ($errorNum != 2 && $errorNum != 8) { + die("A fatal error has occurred, script execution aborted. See debug.log for more info."); + } + + } + +} + +?> diff --git a/gallery/resources/colorbox/1/colorbox.css b/gallery/resources/colorbox/1/colorbox.css new file mode 100644 index 0000000..a7fff10 --- /dev/null +++ b/gallery/resources/colorbox/1/colorbox.css @@ -0,0 +1,70 @@ +/* + Colorbox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxWrapper {max-width:none;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} +#cboxTitle{margin:0;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} +.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} + +/* + User Style: + Change the following styles to modify the appearance of Colorbox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:url(images/overlay.png) repeat 0 0; opacity: 0.9; filter: alpha(opacity = 90);} +#colorbox{outline:0;} + #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px 0;} + #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px 0;} + #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px -29px;} + #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px -29px;} + #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;} + #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;} + #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;} + #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;} + #cboxContent{background:#fff; overflow:hidden;} + .cboxIframe{background:#fff;} + #cboxError{padding:50px; border:1px solid #ccc;} + #cboxLoadedContent{margin-bottom:28px;} + #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;} + #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;} + #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;} + #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} + + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } + + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} + + #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;} + #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;} + #cboxPrevious:hover{background-position:-75px -25px;} + #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;} + #cboxNext:hover{background-position:-50px -25px;} + #cboxClose{position:absolute; bottom:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;} + #cboxClose:hover{background-position:-25px -25px;} + +/* + The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill + when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9. + See: http://jacklmoore.com/notes/ie-transparency-problems/ +*/ +.cboxIE #cboxTopLeft, +.cboxIE #cboxTopCenter, +.cboxIE #cboxTopRight, +.cboxIE #cboxBottomLeft, +.cboxIE #cboxBottomCenter, +.cboxIE #cboxBottomRight, +.cboxIE #cboxMiddleLeft, +.cboxIE #cboxMiddleRight { + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); +} \ No newline at end of file diff --git a/gallery/resources/colorbox/1/images/loading.gif b/gallery/resources/colorbox/1/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..0325c8dbfd962e2e21d50493eb04b110f29ce36f GIT binary patch literal 8685 zcma*sdt4KDx`?hJAelTgt?~9mk$L#J<0a{qzXC_Ydshx7h8g*w0U}_bu47XV@Vl_Vg$0 z(F5$kZLE-i-Mx<8x`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zuWxK@jX!lzj=am2zBa6?Y(B6kR#f|$7Xcx=r!BMcJ(PUNi7#nOpmBhhe-Jjb#fN?h z8yqPQ?0k_Tv$sn*ckzu2V)SgdaV5y6X>pXZVhXrK3}B?tZqJ0k-%9Yfk zeeC#>l6KRn8v=qs}c0z(e{q};4z*ulH$lNE`ZeH1}dcwywXMYKO z-mAI5c#>Gayj4$>5Fpx$FK_#6T)(v)tqXimU$^I{Sb^QBh*+$62K>;{jmn0zYLXdt zJ6BD#^;E5-xKTkHSdoiHSFI@-L!_%}TZ&Cc@U&qM5+7V!2*Pl@?n2QK-13dG96~b)* literal 0 HcmV?d00001 diff --git a/gallery/resources/colorbox/3/colorbox.css b/gallery/resources/colorbox/3/colorbox.css new file mode 100644 index 0000000..1cebdff --- /dev/null +++ b/gallery/resources/colorbox/3/colorbox.css @@ -0,0 +1,45 @@ +/* + Colorbox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxWrapper {max-width:none;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} +#cboxTitle{margin:0;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} +.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} + +/* + User Style: + Change the following styles to modify the appearance of Colorbox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:#000; opacity: 0.9; filter: alpha(opacity = 90);} +#colorbox{outline:0;} + #cboxContent{margin-top:20px;background:#000;} + .cboxIframe{background:#fff;} + #cboxError{padding:50px; border:1px solid #ccc;} + #cboxLoadedContent{border:5px solid #000; background:#fff;} + #cboxTitle{position:absolute; top:-20px; left:0; color:#ccc;} + #cboxCurrent{position:absolute; top:-20px; right:0px; color:#ccc;} + #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} + + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } + + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} + + #cboxSlideshow{position:absolute; top:-20px; right:90px; color:#fff;} + #cboxPrevious{position:absolute; top:50%; left:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top left; width:28px; height:65px; text-indent:-9999px;} + #cboxPrevious:hover{background-position:bottom left;} + #cboxNext{position:absolute; top:50%; right:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top right; width:28px; height:65px; text-indent:-9999px;} + #cboxNext:hover{background-position:bottom right;} + #cboxClose{position:absolute; top:5px; right:5px; display:block; background:url(images/controls.png) no-repeat top center; width:38px; height:19px; text-indent:-9999px;} + #cboxClose:hover{background-position:bottom center;} diff --git a/gallery/resources/colorbox/3/images/loading.gif b/gallery/resources/colorbox/3/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..a32df5c0881b563e18f3660758009a4aec47a5a0 GIT binary patch literal 6244 zcmZu#d010-y8dMkfrNxW2!|wugzaR5ummJ52>}uU1cX4?466u;EaFmUdgsA&63D`m zfXJdEB6X`;(Q4Ie9j$wB+fmyhZS9P;w%5_=OzX5Www-x;57@=dbMx=XAMgAA-tYU~ z@6+eyrmUzJ0wMT^7R=AjCnY6mG#VO>78e&6930H$avK{PGcq!CI$cFYMOj%{dwaW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}rahQm*QtgT6i}wx~;d6v)d9|2roq^r&9GzV`BE(@_gB zuWxK@jX!lzj=am2zBa6?Y(B6kR#f|$7Xcx=r!BMcJ(PUNi7#nOpmBhhe-Jjb#fN?h z8yqPQ?0k_Tv$sn*ckzu2V)SgdaV5y6X>pXZVhXrK3}B?tZqJ0k-%9Yfk zeeC#>l6KRn8v=qs}c0z(e{q};4z*ulH$lNE`ZeH1}dcwywXMYKO z-mAI5c#>Gayj4$>5Fpx$FK_#6T)(v)tqXimU$^I{Sb^QBh*+$62K>;{jmn0zYLXdt zJ6BD#^;E5-xKTkHSdoiHSFI@-L!_%}TZ&Cc@U&qM5+7V!2*Pl@?n2QK-13dG96~b)* literal 0 HcmV?d00001 diff --git a/gallery/resources/colorbox/4/colorbox.css b/gallery/resources/colorbox/4/colorbox.css new file mode 100644 index 0000000..d475a34 --- /dev/null +++ b/gallery/resources/colorbox/4/colorbox.css @@ -0,0 +1,66 @@ +/* + Colorbox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxWrapper {max-width:none;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} +#cboxTitle{margin:0;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} +.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} + +/* + User Style: + Change the following styles to modify the appearance of Colorbox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);} +#colorbox{outline:0;} + #cboxTopLeft{width:25px; height:25px; background:url(images/border1.png) no-repeat 0 0;} + #cboxTopCenter{height:25px; background:url(images/border1.png) repeat-x 0 -50px;} + #cboxTopRight{width:25px; height:25px; background:url(images/border1.png) no-repeat -25px 0;} + #cboxBottomLeft{width:25px; height:25px; background:url(images/border1.png) no-repeat 0 -25px;} + #cboxBottomCenter{height:25px; background:url(images/border1.png) repeat-x 0 -75px;} + #cboxBottomRight{width:25px; height:25px; background:url(images/border1.png) no-repeat -25px -25px;} + #cboxMiddleLeft{width:25px; background:url(images/border2.png) repeat-y 0 0;} + #cboxMiddleRight{width:25px; background:url(images/border2.png) repeat-y -25px 0;} + #cboxContent{background:#fff; overflow:hidden;} + .cboxIframe{background:#fff;} + #cboxError{padding:50px; border:1px solid #ccc;} + #cboxLoadedContent{margin-bottom:20px;} + #cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;} + #cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;} + #cboxLoadingOverlay{background:#fff url(images/loading.gif) no-repeat 5px 5px;} + + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } + + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} + + #cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;} + #cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;} + #cboxNext{position:absolute; bottom:0px; left:63px; color:#444;} + #cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;} + +/* + The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill + when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9. + See: http://jacklmoore.com/notes/ie-transparency-problems/ +*/ +.cboxIE #cboxTopLeft, +.cboxIE #cboxTopCenter, +.cboxIE #cboxTopRight, +.cboxIE #cboxBottomLeft, +.cboxIE #cboxBottomCenter, +.cboxIE #cboxBottomRight, +.cboxIE #cboxMiddleLeft, +.cboxIE #cboxMiddleRight { + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); +} \ No newline at end of file diff --git a/gallery/resources/colorbox/4/images/loading.gif b/gallery/resources/colorbox/4/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..1f3a2c0ab0f497e24318a2dad9abbfc990ccde24 GIT binary patch literal 6244 zcmZWtd0bOx+I{c6$;}QSmnAGwmKY!eBqGQn5Fii;J3?3lA%MuDEQ;24I^WRu2FL=E zu!G1ZgQ(StRV!9oaIJ0asI?SZJ5_5pt)14^sa?LG-wjsB`F;2A`^P!wInVQ)_faJ! zgobI|fjjs&0cK}s=jZ1iK79DcAAj7tckkz)fByB?Uw`@Km;3kcH#Ifgy?ghIFTOZ_ z{P@kAH?Lp6J~cJ<U1SJ9fPL?z?4W zWmm3T>F@9F=;#<27^tbKsi>%!n3ymcjhi-Y+OT0mWo4yStF5lCE+{C-$;ko#@AG)f zNsG^36Bm;azak(IL#Q7-ex=dq;4zR{f3}uM!Fb$6KvLJ-(yAw2ixuk>Vge0vbLT== zj!0@C9qnUB?IlBe<)mz=8C8>m~HpI;nj#CShO7wMUcx-ZV=$8ge6z_O{NUg>{9&()Iy>&jGL8u2j zx24h%)+2$m@SQ`KTm1cAmaoY=_nv(aq@|4Ak<2f5NUi|Rx0apPIn;l}XNB%4@ps%< zkn+BZY5x`g24QZEqi9smKVR;0alAajX(MY zler==XD;-$y?kceqf6O`S^d1g@2V?$nV+_7|4G87SrwwwDRE?UfB}0T1b}g%2~Y|F zCau|E&}@hfHk#GNMa$P?X4fhS$w=uAQycMyW&Q!=@b)m=C`j^8$=jp$E!v*jN6ugc zt5{(v*}!>geU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4(| zvAsC_kWYW3LzU<=wIHx_u$3$T)H%j8J@FdJ-e-vN_O$16fPlA`aPo{z{eqy%c;pq4 zCog@pGH_+doPtZ9@EBBpIa&r*M-7UG#?7MoKX1IeE8a!d3V|z&(ho!5E^IHzohJ^(M6*?V| z#<1q*0uCUh-dgQOzoX|=D)d|j-G*}&sw&dC^XKsL0%xGSs|Dyrnmk|E$x(NM*b6{)8Zqh*Lt6%FU|=glBaMsnf0F4MN8xs zOF{j%qP6{I+S2;Qz!6JU-=rQ@?K75omQ-$9+q_RL4WTmes#ThUBB`y%xpSEZTjFEA zy&J^GE=o~4gZy~m`T~O|A}+R~RasHYn+Q<@0<+ou=ygG4V2#felj^!EN^bL&nG-m5 zd45cqsVAsn&OPC;g6+za&~u>Ey}b8Jh+sb(h7NY4-qI(mlW6*%PN z*nNPcmua;nNl|C8)U?~TUppgnwzs#_T$*Q~>Uo2j&3}O45s5yk2fS<_{SPja<*Hfy z0dDVcRe?(B7~A*y<>j-wzv#kC>?cY~#-7FsD!kFCSn&k-K5KZ>v0O6()XmL&O@uDS zZDoOplzOgPQ$ZHGxqJ6O`g(=e1~Cj8b{d1RL5k>ga+Y6xwDJIJ@yttY59SFd+ZePa z;GBuN48KoBQpOeP>a~_S`l45e%!ZKseDB21t77loMdnpeV(J?E(L6z&f#-Xqs)xU0 tdHkwF>3qaIP9@!b~ecoltuO85T6Mm{tv&#^XUKp literal 0 HcmV?d00001 diff --git a/gallery/resources/colorbox/5/colorbox.css b/gallery/resources/colorbox/5/colorbox.css new file mode 100644 index 0000000..889f20f --- /dev/null +++ b/gallery/resources/colorbox/5/colorbox.css @@ -0,0 +1,58 @@ +/* + Colorbox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxWrapper {max-width:none;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} +#cboxTitle{margin:0;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} +.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} + +/* + User Style: + Change the following styles to modify the appearance of Colorbox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:#000; opacity: 0.9; filter: alpha(opacity = 90);} +#colorbox{outline:0;} + #cboxTopLeft{width:14px; height:14px; background:url(images/controls.png) no-repeat 0 0;} + #cboxTopCenter{height:14px; background:url(images/border.png) repeat-x top left;} + #cboxTopRight{width:14px; height:14px; background:url(images/controls.png) no-repeat -36px 0;} + #cboxBottomLeft{width:14px; height:43px; background:url(images/controls.png) no-repeat 0 -32px;} + #cboxBottomCenter{height:43px; background:url(images/border.png) repeat-x bottom left;} + #cboxBottomRight{width:14px; height:43px; background:url(images/controls.png) no-repeat -36px -32px;} + #cboxMiddleLeft{width:14px; background:url(images/controls.png) repeat-y -175px 0;} + #cboxMiddleRight{width:14px; background:url(images/controls.png) repeat-y -211px 0;} + #cboxContent{background:#fff; overflow:visible;} + .cboxIframe{background:#fff;} + #cboxError{padding:50px; border:1px solid #ccc;} + #cboxLoadedContent{margin-bottom:5px;} + #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;} + #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} + #cboxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-weight:bold; color:#7C7C7C;} + #cboxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C;} + + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; position:absolute; bottom:-29px; background:url(images/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;} + + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} + + #cboxPrevious{left:0px; background-position: -51px -25px;} + #cboxPrevious:hover{background-position:-51px 0px;} + #cboxNext{left:27px; background-position:-75px -25px;} + #cboxNext:hover{background-position:-75px 0px;} + #cboxClose{right:0; background-position:-100px -25px;} + #cboxClose:hover{background-position:-100px 0px;} + + .cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;} + .cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;} + .cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;} + .cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0px;} \ No newline at end of file diff --git a/gallery/resources/colorbox/5/images/loading.gif b/gallery/resources/colorbox/5/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..dba33c8167bfd0bfd0abd5ad0733c901e5cd227e GIT binary patch literal 8685 zcmb8!c|a5A-Y@XUWU`UT3Rxx~gb*NLz_1v>1rw663qb`DQ3E2PQbkG7U7Oaf$~ zm;_YBrGRMBE=F96w#Tw*ky-_{R$F@x;!@h$zEo{%mot4QL9L$q-uK?i-~97@@_l~G zGpXq*35msGKn(n(2C!QfvHPE6zdpgn|AD=hfPFrQeKU$Z`X0O1gT1*8`|C{X;R9^+ z3ikbd?C}Kl(?jg;4Q%Wh_MhX}SGTbKL)g!cu_r%a-;QCw{fhnmJNDo%wn>29o!Egb*!4c_<1XxNGiJ%gOexrVO<0v2Ypue%>al-Z z!Wx%hwHcT(8QWEg{c{*=$j44Nu=Y(@a~alBj-6@7c9vk3k=VL0tS$>%FT?seu+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ofM8ZFxKdqIXI6U%laMQx^S8J3mCz;a~60O}V z44xJnfwEE*fzx-Gm}(y}6auh<-q1{f1O)k{P74F3&PauEkUo~p`@uX4B`{D?A3R|5 zjSPwnw|go^JN~U*xC8(0$!GD7x0}DEM@+%LrC)9Lk|f8_LPMvs-9$r33qcUT4ci-| zXjTv@wtAtuI;Ex>i5}pJ2T@W3QB#sodF+bmHCt?!fqlD2;(rTXh=ygE#02p)t>!{j z0klz(TeL~`ij%NY`C6=lrUIe$_Sk?lDHU}SOxJ6m)<*S}cWjFICx!S(J?p;!sZ>^A literal 0 HcmV?d00001 diff --git a/gallery/resources/colorbox/jquery.colorbox.js b/gallery/resources/colorbox/jquery.colorbox.js new file mode 100644 index 0000000..0b43bf1 --- /dev/null +++ b/gallery/resources/colorbox/jquery.colorbox.js @@ -0,0 +1,6 @@ +/*! + Colorbox 1.6.1 + license: MIT + http://www.jacklmoore.com/colorbox +*/ +(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),y.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=(l!==!1?Math.min(h,a(l,"x")):h)-z-D,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-N-j,I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(S).hide(),y.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
"),w()}}function p(){y||(V=!1,E=t(i),y=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),M=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),x=n(se,"Wrapper"),b=n(se,"Content").append(S=n(se,"Title"),F=n(se,"Current"),P=t('
@@ -134,6 +260,9 @@

Connecting

+
 
+ + diff --git a/main_out.js b/main_out.js index 6ba3fa3..7c5d725 100755 --- a/main_out.js +++ b/main_out.js @@ -14,6 +14,9 @@ function gameLoop() { ma = true; + document.getElementById("canvas").focus(); + var isTyping = false; + var chattxt; getServerList(); setInterval(getServerList, 18E4); Canvas = nCanvas = document.getElementById("canvas"); @@ -28,6 +31,7 @@ return } } + rawMouseX = event.clientX; rawMouseY = event.clientY; mouseCoordinateChange(); @@ -88,6 +92,21 @@ sendUint8(19); qPressed = false; } + break; + case 13: + if (isTyping) { + isTyping = false; + document.getElementById("chat_textbox").blur(); + chattxt = document.getElementById("chat_textbox").value; + if (chattxt.length>0) sendChat(chattxt); + document.getElementById("chat_textbox").value = ""; + + } + else + { + document.getElementById("chat_textbox").focus(); + isTyping = true; + } } }; wHandle.onblur = function () { @@ -296,7 +315,7 @@ msg.setUint8(0, 255); msg.setUint32(1, 1332175218, true); wsSend(msg); - sendNickName() + sendNickName(); } function onWsClose() { @@ -405,9 +424,72 @@ viewZoom = posSize; } break; + case 99: + //alert("get message"); + + addChat(msg, offset); + + break; + + } + } + + + function addChat(view, offset) { + //console.log(offset); + var lenname = view.getUint8(offset,true); + var lencolor = view.getUint8(offset+1,true); + var lenstr = view.getUint8(offset+2,true); + console.log(lenname); + console.log(lencolor); + console.log(lenstr); + var char; + var text=''; + + for (var i = offset+3; i < offset+3+2*(lenname+lencolor+lenstr); i+=2 ) + { + char = view.getUint16(i, true); + text += String.fromCharCode(char); + } + //console.log(text); + var name = text.slice(0,lenname); + var color = text.slice(lenname,lenname+lencolor); + var msg = text.slice(lenname+lencolor,lenname+lencolor+lenstr); + //console.log(name); + //console.log(color); + //console.log(msg); + + chatBoard.push({"name":name, "color":color, "message":msg, "time":Date.now()}); + console.log(chatBoard); + drawChatBoard(); + //drawChatBoardLine(); + }; + + function drawChatBoard() + { + ctx.save(); + ctx.globalAlpha = 0.6; + var len = chatBoard.length; + var from = len-15; + if (from < 0) from = 0; + for (var i = 0; i < (len-from); i++ ) + { + var chatName = new uText(18,chatBoard[i+from].color); + chatName.setValue(chatBoard[i+from].name); + var width = chatName.getWidth(); + var a = chatName.render(); + ctx.drawImage(a, 15, canvasHeight - 50 - 24*(len-i-from) ); + + var chatText = new uText(18,'#666666'); + chatText.setValue(':'+chatBoard[i+from].message); + a = chatText.render(); + ctx.drawImage(a, 15+width*1.8 , canvasHeight - 50 - 24*(len-from-i)); } + ctx.restore(); + } + function updateNodes(view, offset) { timestamp = +new Date; var code = Math.random(); @@ -526,6 +608,36 @@ } } + function sendChat(str) { + if (wsIsOpen() && (str.length<250) && (str.length>0)) { + var name,color; + if (playerCells.length == 0) { + name = "Observer"; + color = "#999999"; + } + else { + name = userNickName; + if (name.length == 0) name = "An unnamed cell"; + color = playerCells[0].color; + } + + //console.log(name); + //console.log(color); + //console.log(str); + var msgstr = name+color+str; + var msg = prepareData(4 + 2 * msgstr.length); + msg.setUint8(0, 99); + msg.setUint8(1, name.length); + msg.setUint8(2, color.length); + msg.setUint8(3, str.length); + for (var i = 0; i < msgstr.length; ++i) + msg.setUint16(4 + 2 * i, msgstr.charCodeAt(i), true); + + wsSend(msg); + //console.log(msgstr); + } + } + function wsIsOpen() { return null != ws && ws.readyState == ws.OPEN } @@ -646,11 +758,12 @@ a = c.width; ctx.globalAlpha = .2; ctx.fillStyle = '#000000'; - ctx.fillRect(10, canvasHeight - 10 - 24 - 10, a + 10, 34); + ctx.fillRect(10, 10, a + 10, 34);//canvasHeight - 10 - 24 - 10 ctx.globalAlpha = 1; - ctx.drawImage(c, 15, canvasHeight - 10 - 24 - 5); + ctx.drawImage(c, 15, 15 );//canvasHeight - 10 - 24 - 5 } drawSplitIcon(); + drawChatBoard(); var deltatime = Date.now() - oldtime; deltatime > 1E3 / 60 ? z -= .01 : deltatime < 1E3 / 65 && (z += .01); .4 > z && (z = .4); @@ -682,10 +795,10 @@ } function drawSplitIcon() { - if (isTouchStart && splitIcon.width) { + /*if (isTouchStart && splitIcon.width) { var size = canvasWidth / 5; ctx.drawImage(splitIcon, 5, 5, size, size) - } + }*/ } function calcUserScore() { @@ -699,21 +812,24 @@ if (null != teamScores || showName) { Canvas = document.createElement("canvas"); var ctx = Canvas.getContext("2d"), - b = 60, - b = null == teamScores ? b + 24 * leaderBoard.length : b + 180, - c = Math.min(200, .3 * canvasWidth) / 200; - Canvas.width = 200 * c; - Canvas.height = b * c; - ctx.scale(c, c); + boardLength = 60; + boardLength = null == teamScores ? boardLength + 24 * leaderBoard.length : boardLength + 180; + var scaleFactor = Math.min(200, .3 * canvasWidth) / 200; + Canvas.width = 200 * scaleFactor; + Canvas.height = boardLength * scaleFactor; + + ctx.scale(scaleFactor, scaleFactor); ctx.globalAlpha = .4; ctx.fillStyle = "#000000"; - ctx.fillRect(0, 0, 200, b); + ctx.fillRect(0, 0, 200, boardLength); + ctx.globalAlpha = 1; ctx.fillStyle = "#FFFFFF"; - c = null; + var c = null; c = "Leaderboard"; ctx.font = "30px Ubuntu"; ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 40); + var b; if (null == teamScores) { for (ctx.font = "20px Ubuntu", b = 0; b < leaderBoard.length; ++b) { c = leaderBoard[b].name || "An unnamed cell"; @@ -783,6 +899,7 @@ nodes = {}, nodelist = [], Cells = [], leaderBoard = [], + chatBoard = [], rawMouseX = 0, rawMouseY = 0, X = -1, @@ -1278,7 +1395,11 @@ ctx.fillText(value, 3, fontsize - h / 2) } return this._canvas - } + }, + getWidth: function() { + return (ctx.measureText(this._value).width + + 6); + } }; Date.now || (Date.now = function () { return (new Date).getTime() diff --git a/untitled.html b/untitled.html new file mode 100644 index 0000000..67fe991 --- /dev/null +++ b/untitled.html @@ -0,0 +1,5 @@ + +
Comment Form is loading comments...
+ + + \ No newline at end of file From 238931eddd36ec9c6558e0654cdd0994a6b1b1e9 Mon Sep 17 00:00:00 2001 From: xf Date: Wed, 24 Jun 2015 17:52:11 +0800 Subject: [PATCH 44/88] fix --- main_out.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main_out.js b/main_out.js index 7c5d725..b74f57c 100755 --- a/main_out.js +++ b/main_out.js @@ -460,7 +460,7 @@ //console.log(msg); chatBoard.push({"name":name, "color":color, "message":msg, "time":Date.now()}); - console.log(chatBoard); + //console.log(chatBoard); drawChatBoard(); //drawChatBoardLine(); }; From 5d5bb6c0de162df21a5fd67c1eea53c3ed5aafc5 Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Wed, 24 Jun 2015 18:15:31 +0800 Subject: [PATCH 45/88] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6da34a0..24f2951 100755 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is a clone of agar.io. In this project we aim to acheive the following. - [x] Hack main_out.js and make the variables and function names readable. Now most of the variable and function name should make sense. - [x] Add uploading custom skins features (Done) - [ ] Add mobile device support (On-going) -- [ ] Add in-game chat feature. (On-going) +- [x] Add in-game chat feature. (On-going) - [ ] Support multi-server feature (On-going) From 28365e685cac944fcb430dd77325038389e104d8 Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Wed, 24 Jun 2015 18:15:56 +0800 Subject: [PATCH 46/88] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 24f2951..4ebb0f3 100755 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ This is a clone of agar.io. In this project we aim to acheive the following. - [x] Hack main_out.js and make the variables and function names readable. Now most of the variable and function name should make sense. - [x] Add uploading custom skins features (Done) +- [x] Add in-game chat feature. (Done) - [ ] Add mobile device support (On-going) -- [x] Add in-game chat feature. (On-going) - [ ] Support multi-server feature (On-going) From 12fbaa6e3a9c9118fe9ca8a33259c26456e63917 Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Wed, 24 Jun 2015 18:16:45 +0800 Subject: [PATCH 47/88] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 07cf4e3..99f83be 100755 --- a/README.md +++ b/README.md @@ -5,11 +5,10 @@ This is a clone of agar.io. In this project we aim to acheive the following. - [x] Hack main_out.js and make the variables and function names readable. Now most of the variable and function name should make sense. - [x] Add uploading custom skins features (Done) +- [x] Add in-game chat feature. (Done) - [ ] Add mobile device support (On-going) -- [ ] Add in-game chat feature. (On-going) - [ ] Support multi-server feature (On-going) - ##Setup You can use nginx that support PHP to deploy it on your server. From 77a1916f6190b2df2154e80c18665a60d2c4c522 Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Wed, 24 Jun 2015 18:23:56 +0800 Subject: [PATCH 48/88] Update PROTOCOL.md --- PROTOCOL.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PROTOCOL.md b/PROTOCOL.md index 5bd7a41..dda1a90 100755 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -16,9 +16,10 @@ Please document any changes introduced here. Direction has to be either `S2C` (s |C2S | 254 | 1 | Version number| |C2S | 255 | 1332175218 | String "Ogar" - Tells the server how to use the modified protocol| |S2C | 48 | behaves like #49 | Leaderboard without numbers| +|C2S | 99 | Packet ID , len(name) , len(color) , len(message) followed with a string consisting name,color and message | For in-game chat, number is in Uint8, each char is in Uint16| +|S2C | 99 | same as above | same as above | Hint : to use Packet 48, make sure the packet ID in case 48 of Ogar/src/packet/UpdateLeaderboard.js is adjusted like this: - ``` view.setUint8(0, this.packetLB, true); ``` From c33591bce3fe2e52d01218a923af6b104f88191e Mon Sep 17 00:00:00 2001 From: xf Date: Wed, 24 Jun 2015 20:54:53 +0800 Subject: [PATCH 49/88] fix a bug --- main_out.js | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/main_out.js b/main_out.js index b74f57c..15ff8fe 100755 --- a/main_out.js +++ b/main_out.js @@ -467,8 +467,14 @@ function drawChatBoard() { - ctx.save(); - ctx.globalAlpha = 0.6; + //chatCanvas = null; + + chatCanvas = document.createElement("canvas"); + var ctx = chatCanvas.getContext("2d"); + chatCanvas.width = 700; + chatCanvas.height = 550; + + ctx.globalAlpha = 0.7; var len = chatBoard.length; var from = len-15; if (from < 0) from = 0; @@ -478,15 +484,14 @@ chatName.setValue(chatBoard[i+from].name); var width = chatName.getWidth(); var a = chatName.render(); - ctx.drawImage(a, 15, canvasHeight - 50 - 24*(len-i-from) ); - + ctx.drawImage(a, 15, chatCanvas.height - 50 - 24*(len-i-from) ); + var chatText = new uText(18,'#666666'); chatText.setValue(':'+chatBoard[i+from].message); a = chatText.render(); - ctx.drawImage(a, 15+width*1.8 , canvasHeight - 50 - 24*(len-from-i)); + ctx.drawImage(a, 15+width*1.8 , chatCanvas.height - 50 - 24*(len-from-i)); } - ctx.restore(); - + //ctx.restore(); } @@ -747,7 +752,9 @@ ctx.restore() } ctx.restore(); - Canvas && Canvas.width && ctx.drawImage(Canvas, canvasWidth - Canvas.width - 10, 10); + lbCanvas && lbCanvas.width && ctx.drawImage(lbCanvas, canvasWidth - lbCanvas.width - 10, 10); // draw Leader Board + if (chatCanvas!=null) ctx.drawImage(chatCanvas, 0, canvasHeight-chatCanvas.height); // draw Leader Board + userScore = Math.max(userScore, calcUserScore()); if (0 != userScore) { if (null == scoreText) { @@ -763,7 +770,7 @@ ctx.drawImage(c, 15, 15 );//canvasHeight - 10 - 24 - 5 } drawSplitIcon(); - drawChatBoard(); + //drawChatBoard(); var deltatime = Date.now() - oldtime; deltatime > 1E3 / 60 ? z -= .01 : deltatime < 1E3 / 65 && (z += .01); .4 > z && (z = .4); @@ -807,16 +814,16 @@ } function drawLeaderBoard() { - Canvas = null; + lbCanvas = null; if (null != teamScores || 0 != leaderBoard.length) if (null != teamScores || showName) { - Canvas = document.createElement("canvas"); - var ctx = Canvas.getContext("2d"), + lbCanvas = document.createElement("canvas"); + var ctx = lbCanvas.getContext("2d"), boardLength = 60; boardLength = null == teamScores ? boardLength + 24 * leaderBoard.length : boardLength + 180; var scaleFactor = Math.min(200, .3 * canvasWidth) / 200; - Canvas.width = 200 * scaleFactor; - Canvas.height = boardLength * scaleFactor; + lbCanvas.width = 200 * scaleFactor; + lbCanvas.height = boardLength * scaleFactor; ctx.scale(scaleFactor, scaleFactor); ctx.globalAlpha = .4; @@ -890,7 +897,7 @@ localProtocolHttps = "https:" == localProtocol; if (wHandle.location.ancestorOrigins && wHandle.location.ancestorOrigins.length && "https://apps.facebook.com" != wHandle.location.ancestorOrigins[0]) wHandle.top.location = "http://agar.io/"; else { - var nCanvas, ctx, Canvas, canvasWidth, canvasHeight, qTree = null, + var nCanvas, ctx, Canvas, lbCanvas, chatCanvas , canvasWidth, canvasHeight, qTree = null, ws = null, nodeX = 0, nodeY = 0, From 059f306ada744167dc3dfa050a6224f6c765d385 Mon Sep 17 00:00:00 2001 From: xf Date: Wed, 24 Jun 2015 21:50:21 +0800 Subject: [PATCH 50/88] refactor --- main_out.js | 201 ++++++++++++++++++++++++++-------------------------- 1 file changed, 100 insertions(+), 101 deletions(-) diff --git a/main_out.js b/main_out.js index 15ff8fe..f1c5e7f 100755 --- a/main_out.js +++ b/main_out.js @@ -19,9 +19,9 @@ var chattxt; getServerList(); setInterval(getServerList, 18E4); - Canvas = nCanvas = document.getElementById("canvas"); - ctx = Canvas.getContext("2d"); - Canvas.onmousedown = function (event) { + mainCanvas = nCanvas = document.getElementById("canvas"); + ctx = mainCanvas.getContext("2d"); + mainCanvas.onmousedown = function (event) { if (isTouchStart) { var xOffset = event.clientX - (5 + canvasWidth / 5 / 2), yOffset = event.clientY - (5 + canvasWidth / 5 / 2); @@ -37,12 +37,12 @@ mouseCoordinateChange(); sendMouseMove() }; - Canvas.onmousemove = function (event) { + mainCanvas.onmousemove = function (event) { rawMouseX = event.clientX; rawMouseY = event.clientY; mouseCoordinateChange() }; - Canvas.onmouseup = function () { + mainCanvas.onmouseup = function () { }; if (/firefox/i.test(navigator.userAgent)) { document.addEventListener("DOMMouseScroll", handleWheel, false); @@ -183,22 +183,22 @@ } function getServerList() { - if (null == $) { - $ = {}; + if (null == playerStat) { + playerStat = {}; wjQuery("#region").children().each(function () { var a = wjQuery(this), b = a.val(); - b && ($[b] = a.text()) + b && (playerStat[b] = a.text()) }); } wjQuery.get("info.php", function (a) { - var b = {}, c; - for (c in a.regions) { - var d = c.split(":")[0]; - b[d] = b[d] || 0; - b[d] += a.regions[c].numPlayers + var numPlayers = {}; + for (var region in a.regions) { + var d = region.split(":")[0]; + numPlayers[d] = numPlayers[d] || 0; + numPlayers[d] += a.regions[region].numPlayers } - for (c in b) wjQuery('#region option[value="' + c + '"]').text($[c] + " (" + b[c] + " players)") + for (var numplayer in numPlayers) wjQuery('#region option[value="' + numplayer + '"]').text(playerStat[numplayer] + " (" + numPlayers[numplayer] + " players)") }, "json") } @@ -238,7 +238,7 @@ error: function () { setTimeout(attemptConnection, 1E3) }, - success: function (a) { + success: function () { wsConnect("ws://" + CONNECTION_URL) }, dataType: "text", @@ -281,7 +281,7 @@ nodelist = []; Cells = []; leaderBoard = []; - Canvas = teamScores = null; + mainCanvas = teamScores = null; userScore = 0; console.log("Connecting to " + wsUrl); ws = new WebSocket(wsUrl); @@ -331,7 +331,7 @@ function handleWsMessage(msg) { function getString() { var text = '', - char = 0; + char; while ((char = msg.getUint16(offset, true)) != 0) { offset += 2; text += String.fromCharCode(char); @@ -386,7 +386,7 @@ var LBplayerNum = msg.getUint32(offset, true); offset += 4; leaderBoard = []; - for (var i = 0; i < LBplayerNum; ++i) { + for (i = 0; i < LBplayerNum; ++i) { var nodeId = msg.getUint32(offset, true); offset += 4; leaderBoard.push({ @@ -437,9 +437,9 @@ function addChat(view, offset) { //console.log(offset); - var lenname = view.getUint8(offset,true); - var lencolor = view.getUint8(offset+1,true); - var lenstr = view.getUint8(offset+2,true); + var lenname = view.getUint8(offset); + var lencolor = view.getUint8(offset+1); + var lenstr = view.getUint8(offset+2); console.log(lenname); console.log(lencolor); console.log(lenstr); @@ -463,7 +463,7 @@ //console.log(chatBoard); drawChatBoard(); //drawChatBoardLine(); - }; + } function drawChatBoard() { @@ -480,13 +480,13 @@ if (from < 0) from = 0; for (var i = 0; i < (len-from); i++ ) { - var chatName = new uText(18,chatBoard[i+from].color); + var chatName = new UText(18,chatBoard[i+from].color); chatName.setValue(chatBoard[i+from].name); var width = chatName.getWidth(); var a = chatName.render(); ctx.drawImage(a, 15, chatCanvas.height - 50 - 24*(len-i-from) ); - var chatText = new uText(18,'#666666'); + var chatText = new UText(18,'#666666'); chatText.setValue(':'+chatBoard[i+from].message); a = chatText.render(); ctx.drawImage(a, 15+width*1.8 , chatCanvas.height - 50 - 24*(len-from-i)); @@ -501,7 +501,7 @@ ua = false; var queueLength = view.getUint16(offset, true); offset += 2; - for (var i = 0; i < queueLength; ++i) { + for (i = 0; i < queueLength; ++i) { var killer = nodes[view.getUint32(offset, true)], killedNode = nodes[view.getUint32(offset + 4, true)]; offset += 8; @@ -517,9 +517,9 @@ } } for (var i = 0; ;) { - var nodeId = view.getUint32(offset, true); + var nodeid = view.getUint32(offset, true); offset += 4; - if (0 == nodeId) break; + if (0 == nodeid) break; ++i; var size, posY, posX = view.getInt16(offset, true); offset += 2; @@ -529,7 +529,7 @@ offset += 2; for (var r = view.getUint8(offset++), g = view.getUint8(offset++), b = view.getUint8(offset++), color = (r << 16 | g << 8 | b).toString(16); 6 > color.length;) color = "0" + color; - var color = "#" + color, + var colorstr = "#" + color, flags = view.getUint8(offset++), flagVirus = !!(flags & 1), flagAgitated = !!(flags & 16); @@ -543,17 +543,17 @@ name += String.fromCharCode(char) } var node = null; - if (nodes.hasOwnProperty(nodeId)) { - node = nodes[nodeId]; + if (nodes.hasOwnProperty(nodeid)) { + node = nodes[nodeid]; node.updatePos(); node.ox = node.x; node.oy = node.y; node.oSize = node.size; - node.color = color; + node.color = colorstr; } else { - node = new Cell(nodeId, posX, posY, size, color, name); + node = new Cell(nodeid, posX, posY, size, colorstr, name); nodelist.push(node); - nodes[nodeId] = node; + nodes[nodeid] = node; node.ka = posX; node.la = posY; } @@ -566,7 +566,7 @@ node.updateTime = timestamp; node.flag = flags; name && node.setName(name); - if (-1 != nodesOnScreen.indexOf(nodeId) && -1 == playerCells.indexOf(node)) { + if (-1 != nodesOnScreen.indexOf(nodeid) && -1 == playerCells.indexOf(node)) { document.getElementById("overlays").style.display = "none"; playerCells.push(node); if (1 == playerCells.length) { @@ -575,9 +575,9 @@ } } } - var queueLength = view.getUint32(offset, true); + queueLength = view.getUint32(offset, true); offset += 4; - for (var i = 0; i < queueLength; i++) { + for (i = 0; i < queueLength; i++) { var nodeId = view.getUint32(offset, true); offset += 4; node = nodes[nodeId]; @@ -663,15 +663,15 @@ function canvasResize() { canvasWidth = wHandle.innerWidth; canvasHeight = wHandle.innerHeight; - nCanvas.width = Canvas.width = canvasWidth; - nCanvas.height = Canvas.height = canvasHeight; + nCanvas.width = mainCanvas.width = canvasWidth; + nCanvas.height = mainCanvas.height = canvasHeight; drawGameScene() } function viewRange() { var ratio; ratio = Math.max(canvasHeight / 1080, canvasWidth / 1920); - return ratio *= zoom + return ratio * zoom; } function calcViewZoom() { @@ -758,16 +758,16 @@ userScore = Math.max(userScore, calcUserScore()); if (0 != userScore) { if (null == scoreText) { - scoreText = new uText(24, '#FFFFFF'); + scoreText = new UText(24, '#FFFFFF'); } scoreText.setValue('Score: ' + ~~(userScore / 100)); - c = scoreText.render(); - a = c.width; + var img = scoreText.render(); + var w = img.width; ctx.globalAlpha = .2; ctx.fillStyle = '#000000'; - ctx.fillRect(10, 10, a + 10, 34);//canvasHeight - 10 - 24 - 10 + ctx.fillRect(10, 10, w + 10, 34);//canvasHeight - 10 - 24 - 10 ctx.globalAlpha = 1; - ctx.drawImage(c, 15, 15 );//canvasHeight - 10 - 24 - 5 + ctx.drawImage(img, 15, 15 );//canvasHeight - 10 - 24 - 5 } drawSplitIcon(); //drawChatBoard(); @@ -832,8 +832,7 @@ ctx.globalAlpha = 1; ctx.fillStyle = "#FFFFFF"; - var c = null; - c = "Leaderboard"; + var c = "Leaderboard"; ctx.font = "30px Ubuntu"; ctx.fillText(c, 100 - ctx.measureText(c).width / 2, 40); var b; @@ -885,7 +884,7 @@ this.setName(uname) } - function uText(usize, ucolor, ustroke, ustrokecolor) { + function UText(usize, ucolor, ustroke, ustrokecolor) { usize && (this._size = usize); ucolor && (this._color = ucolor); this._stroke = !!ustroke; @@ -897,7 +896,7 @@ localProtocolHttps = "https:" == localProtocol; if (wHandle.location.ancestorOrigins && wHandle.location.ancestorOrigins.length && "https://apps.facebook.com" != wHandle.location.ancestorOrigins[0]) wHandle.top.location = "http://agar.io/"; else { - var nCanvas, ctx, Canvas, lbCanvas, chatCanvas , canvasWidth, canvasHeight, qTree = null, + var nCanvas, ctx, mainCanvas, lbCanvas, chatCanvas , canvasWidth, canvasHeight, qTree = null, ws = null, nodeX = 0, nodeY = 0, @@ -949,7 +948,7 @@ var wCanvas = document.createElement("canvas"); if ("undefined" == typeof console || "undefined" == typeof DataView || "undefined" == typeof WebSocket || null == wCanvas || null == wCanvas.getContext || null == wHandle.localStorage) alert("You browser does not support this game, we recommend you to use Firefox to play this"); else { - var $ = null; + var playerStat = null; wHandle.setNick = function (arg) { hideOverlays(); userNickName = arg; @@ -1108,7 +1107,7 @@ setName: function (a) { if (this.name = a) { if (null == this.nameCache) { - this.nameCache = new uText(this.getNameSize(), "#FFFFFF", true, "#000000"); + this.nameCache = new UText(this.getNameSize(), "#FFFFFF", true, "#000000"); this.nameCache.setValue(this.name); } else { this.nameCache.setSize(this.getNameSize()); @@ -1117,12 +1116,12 @@ } }, createPoints: function () { - for (var a = this.getNumPoints(); this.points.length > a;) { - var b = ~~(Math.random() * this.points.length); - this.points.splice(b, 1); - this.pointsAcc.splice(b, 1) + for (var samplenum = this.getNumPoints(); this.points.length > samplenum;) { + var rand = ~~(Math.random() * this.points.length); + this.points.splice(rand, 1); + this.pointsAcc.splice(rand, 1) } - if (0 == this.points.length && 0 < a) { + if (0 == this.points.length && 0 < samplenum) { this.points.push({ ref: this, size: this.size, @@ -1131,23 +1130,23 @@ }); this.pointsAcc.push(Math.random() - .5); } - while (this.points.length < a) { - var b = ~~(Math.random() * this.points.length), - c = this.points[b]; - this.points.splice(b, 0, { + while (this.points.length < samplenum) { + var rand2 = ~~(Math.random() * this.points.length), + point = this.points[rand2]; + this.points.splice(rand2, 0, { ref: this, - size: c.size, - x: c.x, - y: c.y + size: point.size, + x: point.x, + y: point.y }); - this.pointsAcc.splice(b, 0, this.pointsAcc[b]) + this.pointsAcc.splice(rand2, 0, this.pointsAcc[rand2]) } }, getNumPoints: function () { if (0 == this.id) return 16; - var a = 10; - 20 > this.size && (a = 0); - this.isVirus && (a = 30); + var a; + if (20 > this.size) a = 0; + if (this.isVirus) a = 30; var b = this.size; this.isVirus || (b *= viewZoom); b *= z; @@ -1165,38 +1164,38 @@ -10 > pointsacc[i] && (pointsacc[i] = -10); pointsacc[i] = (pos1 + pos2 + 8 * pointsacc[i]) / 10 } - for (var ref = this, isvirus = this.isVirus ? 0 : (this.id / 1E3 + timestamp / 1E4) % (2 * Math.PI), i = 0; i < numpoints; ++i) { - var f = points[i].size, - e = points[(i - 1 + numpoints) % numpoints].size, - m = points[(i + 1) % numpoints].size; + for (var ref = this, isvirus = this.isVirus ? 0 : (this.id / 1E3 + timestamp / 1E4) % (2 * Math.PI), j = 0; j < numpoints; ++j) { + var f = points[j].size, + e = points[(j - 1 + numpoints) % numpoints].size, + m = points[(j + 1) % numpoints].size; if (15 < this.size && null != qTree && 20 < this.size * viewZoom && 0 != this.id) { var l = false, - n = points[i].x, - q = points[i].y; + n = points[j].x, + q = points[j].y; qTree.retrieve2(n - 5, q - 5, 10, 10, function (a) { if (a.ref != ref && 25 > (n - a.x) * (n - a.x) + (q - a.y) * (q - a.y)) { l = true; } }); - if (!l && points[i].x < leftPos || points[i].y < topPos || points[i].x > rightPos || points[i].y > bottomPos) { + if (!l && points[j].x < leftPos || points[j].y < topPos || points[j].x > rightPos || points[j].y > bottomPos) { l = true; } if (l) { - if (0 < pointsacc[i]) { - (pointsacc[i] = 0); + if (0 < pointsacc[j]) { + (pointsacc[j] = 0); } - pointsacc[i] -= 1; + pointsacc[j] -= 1; } } - f += pointsacc[i]; + f += pointsacc[j]; 0 > f && (f = 0); f = this.isAgitated ? (19 * f + this.size) / 20 : (12 * f + this.size) / 13; - points[i].size = (e + m + 8 * f) / 10; + points[j].size = (e + m + 8 * f) / 10; e = 2 * Math.PI / numpoints; - m = this.points[i].size; - this.isVirus && 0 == i % 2 && (m += 5); - points[i].x = this.x + Math.cos(e * i + isvirus) * m; - points[i].y = this.y + Math.sin(e * i + isvirus) * m + m = this.points[j].size; + this.isVirus && 0 == j % 2 && (m += 5); + points[j].x = this.x + Math.cos(e * j + isvirus) * m; + points[j].y = this.y + Math.sin(e * j + isvirus) * m } }, updatePos: function () { @@ -1219,7 +1218,7 @@ if (0 == this.id) { return true } else { - return this.x + this.size + 40 < nodeX - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < nodeY - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > nodeX + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > nodeY + canvasHeight / 2 / viewZoom ? false : true + return !(this.x + this.size + 40 < nodeX - canvasWidth / 2 / viewZoom || this.y + this.size + 40 < nodeY - canvasHeight / 2 / viewZoom || this.x - this.size - 40 > nodeX + canvasWidth / 2 / viewZoom || this.y - this.size - 40 > nodeY + canvasHeight / 2 / viewZoom); } }, drawOneCell: function (ctx) { @@ -1303,32 +1302,32 @@ ctx.drawImage(e, this.x - 2 * this.size, this.y - 2 * this.size, 4 * this.size, 4 * this.size); } c = -1 != playerCells.indexOf(this); - + var ncache; //draw name if (0 != this.id) { b = ~~this.y; if ((showName || c) && this.name && this.nameCache && (null == e || -1 == knownNameDict_noDisp.indexOf(skinName))) { - e = this.nameCache; - e.setValue(this.name); - e.setSize(this.getNameSize()); + ncache = this.nameCache; + ncache.setValue(this.name); + ncache.setSize(this.getNameSize()); var ratio = Math.ceil(10 * viewZoom) / 10; - e.setScale(ratio); - var e = e.render(), - m = ~~(e.width / ratio), - h = ~~(e.height / ratio); - ctx.drawImage(e, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); - b += e.height / 2 / ratio + 4 + ncache.setScale(ratio); + var rnchache = ncache.render(), + m = ~~(rnchache.width / ratio), + h = ~~(rnchache.height / ratio); + ctx.drawImage(rnchache, ~~this.x - ~~(m / 2), b - ~~(h / 2), m, h); + b += rnchache.height / 2 / ratio + 4 } //draw mass if (showMass && (c || 0 == playerCells.length && (!this.isVirus || this.isAgitated) && 20 < this.size)) { if (null == this.sizeCache) { - this.sizeCache = new uText(this.getNameSize() / 2, "#FFFFFF", true, "#000000") + this.sizeCache = new UText(this.getNameSize() / 2, "#FFFFFF", true, "#000000") } c = this.sizeCache; c.setSize(this.getNameSize() / 2); c.setValue(~~(this.size * this.size / 100)); - var ratio = Math.ceil(10 * viewZoom) / 10; + ratio = Math.ceil(10 * viewZoom) / 10; c.setScale(ratio); e = c.render(); m = ~~(e.width / ratio); @@ -1340,7 +1339,7 @@ } } }; - uText.prototype = { + UText.prototype = { _value: "", _color: "#000000", _stroke: false, @@ -1535,15 +1534,15 @@ ctx.restore(); var favicon = document.getElementById("favicon"), oldfavicon = favicon.cloneNode(true); - oldfavicon.setAttribute("href", Canvas.toDataURL("image/png")); + oldfavicon.setAttribute("href", favCanvas.toDataURL("image/png")); favicon.parentNode.replaceChild(oldfavicon, favicon) } var redCell = new Cell(0, 0, 0, 32, "#ED1C24", ""), - Canvas = document.createElement("canvas"); - Canvas.width = 32; - Canvas.height = 32; - var ctx = Canvas.getContext("2d"); + favCanvas = document.createElement("canvas"); + favCanvas.width = 32; + favCanvas.height = 32; + var ctx = favCanvas.getContext("2d"); renderFavicon(); setInterval(renderFavicon, 1E3) }); From 68836e93e772bc1221d7ff6124537383f366f548 Mon Sep 17 00:00:00 2001 From: xf Date: Wed, 24 Jun 2015 21:52:38 +0800 Subject: [PATCH 51/88] fix bug --- main_out.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main_out.js b/main_out.js index f1c5e7f..52bdd73 100755 --- a/main_out.js +++ b/main_out.js @@ -761,13 +761,13 @@ scoreText = new UText(24, '#FFFFFF'); } scoreText.setValue('Score: ' + ~~(userScore / 100)); - var img = scoreText.render(); - var w = img.width; + c = scoreText.render(); + a = c.width; ctx.globalAlpha = .2; ctx.fillStyle = '#000000'; - ctx.fillRect(10, 10, w + 10, 34);//canvasHeight - 10 - 24 - 10 + ctx.fillRect(10, 10, a + 10, 34);//canvasHeight - 10 - 24 - 10 ctx.globalAlpha = 1; - ctx.drawImage(img, 15, 15 );//canvasHeight - 10 - 24 - 5 + ctx.drawImage(c, 15, 15 );//canvasHeight - 10 - 24 - 5 } drawSplitIcon(); //drawChatBoard(); @@ -1144,9 +1144,9 @@ }, getNumPoints: function () { if (0 == this.id) return 16; - var a; - if (20 > this.size) a = 0; - if (this.isVirus) a = 30; + var a = 10; + 20 > this.size && (a = 0); + this.isVirus && (a = 30); var b = this.size; this.isVirus || (b *= viewZoom); b *= z; From 03eae12145fd6d566f1ebe53da095d3aac9d047b Mon Sep 17 00:00:00 2001 From: Fei Xia Date: Wed, 24 Jun 2015 22:11:07 +0800 Subject: [PATCH 52/88] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d040b0a..fa9e064 100755 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ # agar-clone ## Introduction + This is a clone of agar.io. In this project we aim to acheive the following. - [x] Hack main_out.js and make the variables and function names readable. Now most of the variable and function name should make sense. - [x] Add uploading custom skins features (Done) -- [x] Add in-game chat feature. (Done) +- [x] Add [in-game chat](https://cloud.githubusercontent.com/assets/5158896/8327532/c41e94fa-1a9b-11e5-87cc-f42b5f6ef2df.png) feature. (Done) - [ ] Add mobile device support (On-going) - [ ] Support multi-server feature (On-going) + ##Setup You can use nginx that support PHP to deploy it on your server. @@ -42,9 +44,10 @@ only new features can be implemented. Also, the client must remain compatible wi Original protocol can be found [here](https://github.com/vram4/Agar.io-Protocol). Changes to the protocol have to be [documented](PROTOCOL.md). -## Contribution +## Contributions + Pull Request are welcome. ## Disclaimer -Note that the aim of this repo is to study agar.io client, understand the mechaism and find possible improvements. It is worth pointing out that hosting a third-party agar client is against the [Terms](http://agar.io/terms.txt) of Agario and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :) +Note that the aim of this repo is to study agar.io client, understand the mechanism and find potential improvements. It is worth pointing out that hosting a third-party agar client is against the [Terms](http://agar.io/terms.txt) of Agario and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :) From 01f3e7f19d4edf1ec0db869285d4c80ef9ff427d Mon Sep 17 00:00:00 2001 From: xf Date: Wed, 24 Jun 2015 22:54:21 +0800 Subject: [PATCH 53/88] fix bug --- main_out.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/main_out.js b/main_out.js index 52bdd73..5000424 100755 --- a/main_out.js +++ b/main_out.js @@ -55,20 +55,20 @@ wHandle.onkeydown = function (event) { switch (event.keyCode) { case 32: // split - if (!spacePressed) { + if ((!spacePressed)&&(!isTyping)) { sendMouseMove(); sendUint8(17); spacePressed = true; } break; case 81: // key q pressed - if (!qPressed) { + if ((!qPressed)&&(!isTyping)) { sendUint8(18); qPressed = true; } break; case 87: // eject mass - if (!wPressed) { + if ((!wPressed)&&(!isTyping)) { sendMouseMove(); sendUint8(21); wPressed = true; @@ -77,6 +77,21 @@ case 27: // quit showOverlays(true); break; + + case 13: + if (isTyping) { + isTyping = false; + document.getElementById("chat_textbox").blur(); + chattxt = document.getElementById("chat_textbox").value; + if (chattxt.length>0) sendChat(chattxt); + document.getElementById("chat_textbox").value = ""; + + } + else + { + document.getElementById("chat_textbox").focus(); + isTyping = true; + } } }; wHandle.onkeyup = function (event) { @@ -93,20 +108,6 @@ qPressed = false; } break; - case 13: - if (isTyping) { - isTyping = false; - document.getElementById("chat_textbox").blur(); - chattxt = document.getElementById("chat_textbox").value; - if (chattxt.length>0) sendChat(chattxt); - document.getElementById("chat_textbox").value = ""; - - } - else - { - document.getElementById("chat_textbox").focus(); - isTyping = true; - } } }; wHandle.onblur = function () { @@ -471,7 +472,7 @@ chatCanvas = document.createElement("canvas"); var ctx = chatCanvas.getContext("2d"); - chatCanvas.width = 700; + chatCanvas.width = 1000; chatCanvas.height = 550; ctx.globalAlpha = 0.7; From fac3e1ecedee2c40c2a3c45ed0feda4c2f6d229d Mon Sep 17 00:00:00 2001 From: xf Date: Wed, 24 Jun 2015 23:44:21 +0800 Subject: [PATCH 54/88] fade --- main_out.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/main_out.js b/main_out.js index 5000424..25111b8 100755 --- a/main_out.js +++ b/main_out.js @@ -460,7 +460,7 @@ //console.log(color); //console.log(msg); - chatBoard.push({"name":name, "color":color, "message":msg, "time":Date.now()}); + chatBoard.push({"name":name, "color":color, "message":msg, "time": Date.now()}); //console.log(chatBoard); drawChatBoard(); //drawChatBoardLine(); @@ -475,7 +475,17 @@ chatCanvas.width = 1000; chatCanvas.height = 550; - ctx.globalAlpha = 0.7; + var nowtime = Date.now(); + var lasttime = 0; + if (chatBoard.length>=1) + lasttime = chatBoard[chatBoard.length-1].time; + else return; + var deltat = nowtime - lasttime; + + ctx.globalAlpha = 0.8*Math.exp(-deltat/25000); + //console.log(deltat); + + var len = chatBoard.length; var from = len-15; if (from < 0) from = 0; @@ -1545,7 +1555,8 @@ favCanvas.height = 32; var ctx = favCanvas.getContext("2d"); renderFavicon(); - setInterval(renderFavicon, 1E3) + setInterval(renderFavicon, 1E3); + setInterval(drawChatBoard, 1E3); }); wHandle.onload = gameLoop } From 0cd469f26b20894ba9e1c9b79553cd0d961ed3fe Mon Sep 17 00:00:00 2001 From: xf Date: Thu, 25 Jun 2015 00:06:30 +0800 Subject: [PATCH 55/88] resize problem --- main_out.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main_out.js b/main_out.js index 25111b8..dd32b19 100755 --- a/main_out.js +++ b/main_out.js @@ -674,8 +674,8 @@ function canvasResize() { canvasWidth = wHandle.innerWidth; canvasHeight = wHandle.innerHeight; - nCanvas.width = mainCanvas.width = canvasWidth; - nCanvas.height = mainCanvas.height = canvasHeight; + nCanvas.width = canvasWidth; + nCanvas.height = canvasHeight; drawGameScene() } From bbe25f38748244377e763b7cbe79357889732749 Mon Sep 17 00:00:00 2001 From: xf Date: Thu, 25 Jun 2015 23:10:08 +0800 Subject: [PATCH 56/88] fix bug --- main_out.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/main_out.js b/main_out.js index dd32b19..ffd4f61 100755 --- a/main_out.js +++ b/main_out.js @@ -49,6 +49,20 @@ } else { document.body.onmousewheel = handleWheel; } + + mainCanvas.onfocus = function() { + isTyping = false; + }; + + document.getElementById("chat_textbox").onblur = function () { + isTyping = false; + }; + + + document.getElementById("chat_textbox").onfocus = function () { + isTyping = true; + }; + var spacePressed = false, qPressed = false, wPressed = false; @@ -129,7 +143,7 @@ Ha(); setRegion(wjQuery("#region").val()); null == ws && w && showConnecting(); - wjQuery("#overlays").show() + wjQuery("#overlays").show(); } @@ -1156,12 +1170,12 @@ getNumPoints: function () { if (0 == this.id) return 16; var a = 10; - 20 > this.size && (a = 0); - this.isVirus && (a = 30); + if (20 > this.size) a = 0; + if (this.isVirus) a = 30; var b = this.size; - this.isVirus || (b *= viewZoom); + if (!this.isVirus) (b *= viewZoom); b *= z; - this.flag & 32 && (b *= .25); + if (this.flag & 32) (b *= .25); return ~~Math.max(b, a); }, movePoints: function () { @@ -1234,8 +1248,8 @@ }, drawOneCell: function (ctx) { if (this.shouldRender()) { - var b = 0 != this.id && !this.isVirus && !this.isAgitated && .4 > viewZoom; - 5 > this.getNumPoints() && (b = true); + var b = (0 != this.id && !this.isVirus && !this.isAgitated && .4 > viewZoom); + if (5 > this.getNumPoints()) b = true; if (this.wasSimpleDrawing && !b) for (var c = 0; c < this.points.length; c++) this.points[c].size = this.size; this.wasSimpleDrawing = b; @@ -1316,7 +1330,7 @@ var ncache; //draw name if (0 != this.id) { - b = ~~this.y; + var b = ~~this.y; if ((showName || c) && this.name && this.nameCache && (null == e || -1 == knownNameDict_noDisp.indexOf(skinName))) { ncache = this.nameCache; ncache.setValue(this.name); From 76ac364ce849425434cd13cb9cd69a9170ed4076 Mon Sep 17 00:00:00 2001 From: m-byte Date: Thu, 25 Jun 2015 22:36:10 +0200 Subject: [PATCH 57/88] addChat changed to new protocol --- main_out.js | 135 ++++++++++++++++++++++++++++------------------------ 1 file changed, 72 insertions(+), 63 deletions(-) diff --git a/main_out.js b/main_out.js index ffd4f61..809aa84 100755 --- a/main_out.js +++ b/main_out.js @@ -50,7 +50,7 @@ document.body.onmousewheel = handleWheel; } - mainCanvas.onfocus = function() { + mainCanvas.onfocus = function () { isTyping = false; }; @@ -69,20 +69,20 @@ wHandle.onkeydown = function (event) { switch (event.keyCode) { case 32: // split - if ((!spacePressed)&&(!isTyping)) { + if ((!spacePressed) && (!isTyping)) { sendMouseMove(); sendUint8(17); spacePressed = true; } break; case 81: // key q pressed - if ((!qPressed)&&(!isTyping)) { + if ((!qPressed) && (!isTyping)) { sendUint8(18); qPressed = true; } break; case 87: // eject mass - if ((!wPressed)&&(!isTyping)) { + if ((!wPressed) && (!isTyping)) { sendMouseMove(); sendUint8(21); wPressed = true; @@ -97,12 +97,11 @@ isTyping = false; document.getElementById("chat_textbox").blur(); chattxt = document.getElementById("chat_textbox").value; - if (chattxt.length>0) sendChat(chattxt); + if (chattxt.length > 0) sendChat(chattxt); document.getElementById("chat_textbox").value = ""; } - else - { + else { document.getElementById("chat_textbox").focus(); isTyping = true; } @@ -451,37 +450,49 @@ function addChat(view, offset) { - //console.log(offset); - var lenname = view.getUint8(offset); - var lencolor = view.getUint8(offset+1); - var lenstr = view.getUint8(offset+2); - console.log(lenname); - console.log(lencolor); - console.log(lenstr); - var char; - var text=''; - - for (var i = offset+3; i < offset+3+2*(lenname+lencolor+lenstr); i+=2 ) - { - char = view.getUint16(i, true); - text += String.fromCharCode(char); + function getString() { + var text = '', + char; + while ((char = view.getUint16(offset, true)) != 0) { + offset += 2; + text += String.fromCharCode(char); + } + offset += 2; + return text; } - //console.log(text); - var name = text.slice(0,lenname); - var color = text.slice(lenname,lenname+lencolor); - var msg = text.slice(lenname+lencolor,lenname+lencolor+lenstr); - //console.log(name); - //console.log(color); - //console.log(msg); - - chatBoard.push({"name":name, "color":color, "message":msg, "time": Date.now()}); + + var flags = view.getUint8(offset++); + // for future expansions + if (flags & 2) { + offset += 4; + } + if (flags & 4) { + offset += 8; + } + if (flags & 8) { + offset += 16; + } + + var r = view.getUint8(offset++), + g = view.getUint8(offset++), + b = view.getUint8(offset++), + color = (r << 16 | g << 8 | b).toString(16); + while(color.length > 6){ + color = '0' + color; + } + color = '#' + color; + chatBoard.push({ + "name": getString(), + "color": color, + "message": getString(), + "time": Date.now() + }); //console.log(chatBoard); drawChatBoard(); //drawChatBoardLine(); } - function drawChatBoard() - { + function drawChatBoard() { //chatCanvas = null; chatCanvas = document.createElement("canvas"); @@ -491,30 +502,29 @@ var nowtime = Date.now(); var lasttime = 0; - if (chatBoard.length>=1) - lasttime = chatBoard[chatBoard.length-1].time; + if (chatBoard.length >= 1) + lasttime = chatBoard[chatBoard.length - 1].time; else return; var deltat = nowtime - lasttime; - ctx.globalAlpha = 0.8*Math.exp(-deltat/25000); + ctx.globalAlpha = 0.8 * Math.exp(-deltat / 25000); //console.log(deltat); var len = chatBoard.length; - var from = len-15; + var from = len - 15; if (from < 0) from = 0; - for (var i = 0; i < (len-from); i++ ) - { - var chatName = new UText(18,chatBoard[i+from].color); - chatName.setValue(chatBoard[i+from].name); + for (var i = 0; i < (len - from); i++) { + var chatName = new UText(18, chatBoard[i + from].color); + chatName.setValue(chatBoard[i + from].name); var width = chatName.getWidth(); var a = chatName.render(); - ctx.drawImage(a, 15, chatCanvas.height - 50 - 24*(len-i-from) ); + ctx.drawImage(a, 15, chatCanvas.height - 50 - 24 * (len - i - from)); - var chatText = new UText(18,'#666666'); - chatText.setValue(':'+chatBoard[i+from].message); + var chatText = new UText(18, '#666666'); + chatText.setValue(':' + chatBoard[i + from].message); a = chatText.render(); - ctx.drawImage(a, 15+width*1.8 , chatCanvas.height - 50 - 24*(len-from-i)); + ctx.drawImage(a, 15 + width * 1.8, chatCanvas.height - 50 - 24 * (len - from - i)); } //ctx.restore(); } @@ -639,11 +649,11 @@ } function sendChat(str) { - if (wsIsOpen() && (str.length<250) && (str.length>0)) { - var name,color; + if (wsIsOpen() && (str.length < 250) && (str.length > 0)) { + var name, color; if (playerCells.length == 0) { - name = "Observer"; - color = "#999999"; + name = "Observer"; + color = "#999999"; } else { name = userNickName; @@ -654,7 +664,7 @@ //console.log(name); //console.log(color); //console.log(str); - var msgstr = name+color+str; + var msgstr = name + color + str; var msg = prepareData(4 + 2 * msgstr.length); msg.setUint8(0, 99); msg.setUint8(1, name.length); @@ -688,7 +698,7 @@ function canvasResize() { canvasWidth = wHandle.innerWidth; canvasHeight = wHandle.innerHeight; - nCanvas.width = canvasWidth; + nCanvas.width = canvasWidth; nCanvas.height = canvasHeight; drawGameScene() } @@ -708,7 +718,7 @@ } function drawGameScene() { - var a,oldtime = Date.now(); + var a, oldtime = Date.now(); ++cb; timestamp = oldtime; if (0 < playerCells.length) { @@ -778,7 +788,7 @@ } ctx.restore(); lbCanvas && lbCanvas.width && ctx.drawImage(lbCanvas, canvasWidth - lbCanvas.width - 10, 10); // draw Leader Board - if (chatCanvas!=null) ctx.drawImage(chatCanvas, 0, canvasHeight-chatCanvas.height); // draw Leader Board + if (chatCanvas != null) ctx.drawImage(chatCanvas, 0, canvasHeight - chatCanvas.height); // draw Leader Board userScore = Math.max(userScore, calcUserScore()); if (0 != userScore) { @@ -792,7 +802,7 @@ ctx.fillStyle = '#000000'; ctx.fillRect(10, 10, a + 10, 34);//canvasHeight - 10 - 24 - 10 ctx.globalAlpha = 1; - ctx.drawImage(c, 15, 15 );//canvasHeight - 10 - 24 - 5 + ctx.drawImage(c, 15, 15);//canvasHeight - 10 - 24 - 5 } drawSplitIcon(); //drawChatBoard(); @@ -828,9 +838,9 @@ function drawSplitIcon() { /*if (isTouchStart && splitIcon.width) { - var size = canvasWidth / 5; - ctx.drawImage(splitIcon, 5, 5, size, size) - }*/ + var size = canvasWidth / 5; + ctx.drawImage(splitIcon, 5, 5, size, size) + }*/ } function calcUserScore() { @@ -921,7 +931,7 @@ localProtocolHttps = "https:" == localProtocol; if (wHandle.location.ancestorOrigins && wHandle.location.ancestorOrigins.length && "https://apps.facebook.com" != wHandle.location.ancestorOrigins[0]) wHandle.top.location = "http://agar.io/"; else { - var nCanvas, ctx, mainCanvas, lbCanvas, chatCanvas , canvasWidth, canvasHeight, qTree = null, + var nCanvas, ctx, mainCanvas, lbCanvas, chatCanvas, canvasWidth, canvasHeight, qTree = null, ws = null, nodeX = 0, nodeY = 0, @@ -1283,11 +1293,10 @@ } ctx.closePath(); var skinName = this.name.toLowerCase(); - if (skinName.indexOf('[')!=-1) - { + if (skinName.indexOf('[') != -1) { var clanStart = skinName.indexOf('['); var clanEnd = skinName.indexOf(']'); - skinName = skinName.slice(clanStart+1,clanEnd); + skinName = skinName.slice(clanStart + 1, clanEnd); //console.log(skinName); } @@ -1427,10 +1436,10 @@ } return this._canvas }, - getWidth: function() { + getWidth: function () { return (ctx.measureText(this._value).width + - 6); - } + 6); + } }; Date.now || (Date.now = function () { return (new Date).getTime() From c893480585f2f92051b36414c5598d40568b278c Mon Sep 17 00:00:00 2001 From: m-byte Date: Thu, 25 Jun 2015 22:40:17 +0200 Subject: [PATCH 58/88] sendChat changed to new protocol --- main_out.js | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/main_out.js b/main_out.js index 809aa84..ec3115a 100755 --- a/main_out.js +++ b/main_out.js @@ -649,32 +649,18 @@ } function sendChat(str) { - if (wsIsOpen() && (str.length < 250) && (str.length > 0)) { - var name, color; - if (playerCells.length == 0) { - name = "Observer"; - color = "#999999"; - } - else { - name = userNickName; - if (name.length == 0) name = "An unnamed cell"; - color = playerCells[0].color; + if (wsIsOpen() && (str.length < 200) && (str.length > 0)) { + var msg = prepareData(2 + 2 * str.length); + var offset = 0; + msg.setUint8(offset++, 99); + msg.setUint8(offset++, 0); // flags (0 for now) + for (var i = 0; i < str.length; ++i) { + msg.setUint16(offset, str.charCodeAt(i), true); + offset += 2; } - //console.log(name); - //console.log(color); - //console.log(str); - var msgstr = name + color + str; - var msg = prepareData(4 + 2 * msgstr.length); - msg.setUint8(0, 99); - msg.setUint8(1, name.length); - msg.setUint8(2, color.length); - msg.setUint8(3, str.length); - for (var i = 0; i < msgstr.length; ++i) - msg.setUint16(4 + 2 * i, msgstr.charCodeAt(i), true); - wsSend(msg); - //console.log(msgstr); + //console.log(msg); } } From 33ede0dde19a84574011f1a9d3c7937904f5419d Mon Sep 17 00:00:00 2001 From: m-byte Date: Thu, 25 Jun 2015 22:55:57 +0200 Subject: [PATCH 59/88] PROTOCOL.md changed to new protocol --- PROTOCOL.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PROTOCOL.md b/PROTOCOL.md index dda1a90..f6878aa 100755 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -16,8 +16,11 @@ Please document any changes introduced here. Direction has to be either `S2C` (s |C2S | 254 | 1 | Version number| |C2S | 255 | 1332175218 | String "Ogar" - Tells the server how to use the modified protocol| |S2C | 48 | behaves like #49 | Leaderboard without numbers| -|C2S | 99 | Packet ID , len(name) , len(color) , len(message) followed with a string consisting name,color and message | For in-game chat, number is in Uint8, each char is in Uint16| -|S2C | 99 | same as above | same as above | +|C2S | 99 | flags (uint8) [1], message, '\0' | For in-game chat, each char is in Uint16 | +|S2C | 99 | flags (uint8) [1], r (uint8), g (uint8), b (uint8), nick, '\0', message, '\0' | same as above | + + [1] If flags has the 2, 4, or 8 bit set, an offset of 4, 8, or 16 bytes follows before any other data. Until these additional + bytes are used, just skip them. Hint : to use Packet 48, make sure the packet ID in case 48 of Ogar/src/packet/UpdateLeaderboard.js is adjusted like this: ``` From 0ee8a73cda9d8c986d92c059803a127aa2447434 Mon Sep 17 00:00:00 2001 From: m-byte Date: Thu, 25 Jun 2015 23:01:53 +0200 Subject: [PATCH 60/88] Added note regarding packet 48 --- PROTOCOL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/PROTOCOL.md b/PROTOCOL.md index f6878aa..2b60c21 100755 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -26,6 +26,7 @@ Hint : to use Packet 48, make sure the packet ID in case 48 of Ogar/src/packet/U ``` view.setUint8(0, this.packetLB, true); ``` +You can also use https://github.com/m-byte/Ogar, which already has this feature enabled. ### Version 2 TODO: We could add chat functionality in this version. That way, only one websocket server would be needed. From d58c34fac06ba6006690690845f0ced74c5a09fe Mon Sep 17 00:00:00 2001 From: m-byte Date: Thu, 25 Jun 2015 23:25:32 +0200 Subject: [PATCH 61/88] Fixed protocol documentation --- PROTOCOL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PROTOCOL.md b/PROTOCOL.md index 2b60c21..38411be 100755 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -16,7 +16,7 @@ Please document any changes introduced here. Direction has to be either `S2C` (s |C2S | 254 | 1 | Version number| |C2S | 255 | 1332175218 | String "Ogar" - Tells the server how to use the modified protocol| |S2C | 48 | behaves like #49 | Leaderboard without numbers| -|C2S | 99 | flags (uint8) [1], message, '\0' | For in-game chat, each char is in Uint16 | +|C2S | 99 | flags (uint8) [1], message | For in-game chat, each char is in Uint16 | |S2C | 99 | flags (uint8) [1], r (uint8), g (uint8), b (uint8), nick, '\0', message, '\0' | same as above | [1] If flags has the 2, 4, or 8 bit set, an offset of 4, 8, or 16 bytes follows before any other data. Until these additional From a8457d139ab2027488c615409cc0b11d943b5d63 Mon Sep 17 00:00:00 2001 From: xf Date: Fri, 26 Jun 2015 19:28:37 +0800 Subject: [PATCH 62/88] gallery --- gallery/COPYING | 19 - gallery/README.md | 185 --- gallery/img.php | 814 ++++++++++ gallery/index.php | 97 +- gallery/resources/UberGallery.css | 139 -- gallery/resources/UberGallery.php | 1323 ----------------- gallery/resources/colorbox/1/colorbox.css | 70 - .../resources/colorbox/1/images/loading.gif | Bin 8685 -> 0 bytes gallery/resources/colorbox/2/colorbox.css | 50 - .../resources/colorbox/2/images/loading.gif | Bin 6244 -> 0 bytes gallery/resources/colorbox/3/colorbox.css | 45 - .../resources/colorbox/3/images/loading.gif | Bin 6244 -> 0 bytes gallery/resources/colorbox/4/colorbox.css | 66 - .../resources/colorbox/4/images/loading.gif | Bin 6244 -> 0 bytes gallery/resources/colorbox/5/colorbox.css | 58 - .../resources/colorbox/5/images/loading.gif | Bin 8685 -> 0 bytes gallery/resources/colorbox/jquery.colorbox.js | 6 - gallery/resources/sample.galleryConfig.ini | 36 - .../resources/templates/colorboxScripts.php | 7 - .../resources/templates/defaultGallery.php | 50 - gallery/resources/themes/uber-blue/index.php | 70 - .../resources/themes/uber-blue/rebase-min.css | 1 - gallery/resources/themes/uber-blue/style.css | 233 --- gallery/resources/themes/uber-naked/index.php | 28 - gallery/resources/themes/uber-naked/style.css | 139 -- .../resources/themes/uber-orange/index.php | 68 - .../themes/uber-orange/rebase-min.css | 1 - .../resources/themes/uber-orange/style.css | 211 --- .../css/bootstrap-responsive.min.css | 9 - .../uber-responsive/css/bootstrap.min.css | 9 - .../themes/uber-responsive/css/style.css | 25 - .../themes/uber-responsive/index.php | 109 -- .../uber-responsive/js/bootstrap.min.js | 6 - 33 files changed, 886 insertions(+), 2988 deletions(-) delete mode 100644 gallery/COPYING delete mode 100644 gallery/README.md create mode 100755 gallery/img.php mode change 100644 => 100755 gallery/index.php delete mode 100644 gallery/resources/UberGallery.css delete mode 100644 gallery/resources/UberGallery.php delete mode 100644 gallery/resources/colorbox/1/colorbox.css delete mode 100644 gallery/resources/colorbox/1/images/loading.gif delete mode 100644 gallery/resources/colorbox/2/colorbox.css delete mode 100644 gallery/resources/colorbox/2/images/loading.gif delete mode 100644 gallery/resources/colorbox/3/colorbox.css delete mode 100644 gallery/resources/colorbox/3/images/loading.gif delete mode 100644 gallery/resources/colorbox/4/colorbox.css delete mode 100644 gallery/resources/colorbox/4/images/loading.gif delete mode 100644 gallery/resources/colorbox/5/colorbox.css delete mode 100644 gallery/resources/colorbox/5/images/loading.gif delete mode 100644 gallery/resources/colorbox/jquery.colorbox.js delete mode 100644 gallery/resources/sample.galleryConfig.ini delete mode 100644 gallery/resources/templates/colorboxScripts.php delete mode 100644 gallery/resources/templates/defaultGallery.php delete mode 100644 gallery/resources/themes/uber-blue/index.php delete mode 100644 gallery/resources/themes/uber-blue/rebase-min.css delete mode 100644 gallery/resources/themes/uber-blue/style.css delete mode 100644 gallery/resources/themes/uber-naked/index.php delete mode 100644 gallery/resources/themes/uber-naked/style.css delete mode 100644 gallery/resources/themes/uber-orange/index.php delete mode 100644 gallery/resources/themes/uber-orange/rebase-min.css delete mode 100644 gallery/resources/themes/uber-orange/style.css delete mode 100644 gallery/resources/themes/uber-responsive/css/bootstrap-responsive.min.css delete mode 100644 gallery/resources/themes/uber-responsive/css/bootstrap.min.css delete mode 100644 gallery/resources/themes/uber-responsive/css/style.css delete mode 100644 gallery/resources/themes/uber-responsive/index.php delete mode 100644 gallery/resources/themes/uber-responsive/js/bootstrap.min.js diff --git a/gallery/COPYING b/gallery/COPYING deleted file mode 100644 index 397a074..0000000 --- a/gallery/COPYING +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Chris Kankiewicz - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/gallery/README.md b/gallery/README.md deleted file mode 100644 index caf766f..0000000 --- a/gallery/README.md +++ /dev/null @@ -1,185 +0,0 @@ -UberGallery - The simple PHP photo gallery -========================================== -Created by, [Chris Kankiewicz](http://www.ChrisKankiewicz.com) - - -Introduction ------------- -UberGallery is an easy to use, simple to manage, web photo gallery written in PHP and distributed -under the [MIT License](http://www.opensource.org/licenses/mit-license.php). UberGallery -**does not** require a database and supports JPEG, GIF and PNG file types. Simply upload your images -and UberGallery will automatically generate thumbnails and output standards compliant XHTML markup -on the fly. - - -Features --------- - * Simple first time installation - * Database-less configuration - * Include galleries within pre-existing sites - * Create multiple galleries with a single installation - * Easily customize your gallery styles via CSS - * Install and update the gallery easily wth Git (optional) - - -Requirements ------------- -UberGallery requires PHP 5.2+ and the PHP-GD image library to work properly. For more information on -PHP and the PHP-GD image library, please visit [http://php.net](http://php.net). - - -Simple Installation -------------------- - 1. Copy `resources/sample.galleryConfig.ini` to `resources/galleryConfig.ini` and modify the settings -to your liking. - - 2. Upload `index.php`, `resources/` and `gallery-images/` to your web server. - - 3. Upload images to the `gallery-images/` directory. - - 4. Make the `resources/cache/` directory writable by the web server: - - ``` - chmod 777 /path/to/resources/cache - ``` - - 5. Open your web browser and load the page where you installed UberGallery. - - -Custom Installation -------------------- - 1. Copy `resources/sample.galleryConfig.ini` to `resources/galleryConfig.ini` and modify the settings -to your liking. - - 2. Upload the `resources/` folder to your web server. - - 3. Insert the following code into the PHP page where you would like the gallery to be displayed -(be sure to change the include and image folder path to match your configuration): - - ```php - createGallery('path/to/images-folder'); ?> - ``` - - 4. Include the UberGallery and desired ColorBox style sheet in your page header: - - ```html - - - ``` - - **NOTE:** You can replace the `1` with a value between 1 and 5 for different ColorBox themes. - - 5. Include the jQuery and ColorBox javascript files in your page header: - - ```html - - - ``` - - 6. Include the ColorBox jquery call in your header: - - ```html - - ``` - - 7. Upload images to your images directory. - - 8. Make the `resources/cache/` directory writable by the web server. - - ``` - chmod 777 /path/to/resources/cache - ``` - - 9. Open your web browser and load the page where you installed UberGallery. - - -Install with Git ----------------- - 1. SSH into the your server and clone the UberGallery repository and submodules: - - ``` - git clone --recursive git://github.com/UberGallery/UberGallery.git /path/to/ubergallery - ``` - - 2. Copy `resources/sample.galleryConfig.ini` to `resources/galleryConfig.ini` and modify the settings - - ``` - cp resource/sample.galleryConfig.ini resources/galleryConfig.ini - nano resources/galleryConfig.ini - ``` - - 3. Upload images to the `gallery-images/` folder within your gallery directory. - - 4. Make the `resources/cache/` directory writable by the web server. - - ``` - chmod 777 /path/to/resources/cache - ``` - - 5. Open your web browser and load the page where you installed UberGallery. - -When using this method to install UberGallery, you may update your installation by running -the following commands: - - cd /path/to/gallery-directory - git pull origin master - git submodule update - -**NOTE:** If you are installing UberGallery via git into an existing git repository, you will need -to add it as a submodule. - - git submodule add git://github.com/UberGallery/UberGallery.git path/to/ubergallery - git submodule update --init --recursive path/to/ubergallery - - -Troubleshooting ---------------- -If you're having issues with UberGallery here are a few troubleshooting tips: - - * Verify that you have PHP 5.2 or later installed. You can verify your PHP version by running: - - ``` - php --version - ``` - - * Make sure you have the latest version of UberGallery installed. You can always find the latest - version at - - * Replace your `galleryConfig.ini` with `sample.galleryConfig.ini` to ensure proper configuration: - - ``` - rm resources/galleryConfig.ini - cp resource/sample.galleryConfig.ini resources/galleryConfig.ini - ``` - - * Clear your cache and make sure the directory is writable by the web server: - - ``` - rm -f resources/cache/* - chmod 777 resources/cache - ``` - - * Enable debugging by setting the `enable_debugging` option in `resources/galleryConfig.ini` to - `true`, try loading your gallery in a web browser then inspect the debug.log file in your cache - directory for any errors. - -If you continue to have issues, please email me at: - - -News & Updates --------------- -UberGallery updates and news can be found on our [blog](http://news.ubergallery.net) or by -following [@UberGallery](http://twitter.com/ubergallery) on Twitter. - -Please report bugs to the [Github issue tracker](http://github.com/UberGallery/ubergallery/issues). - - -License -------- -UberGallery is distributed under the terms of the -[MIT License](http://www.opensource.org/licenses/mit-license.php). -Copyright © 2013 [Chris Kankiewicz](http://www.chriskankiewicz.com) diff --git a/gallery/img.php b/gallery/img.php new file mode 100755 index 0000000..8947946 --- /dev/null +++ b/gallery/img.php @@ -0,0 +1,814 @@ + +*/ + +/* +$sizeLimits = array( + "100x100", + "150x150", +); + +error_reporting(E_ALL); +ini_set("display_errors", 1); +*/ + +// check to see if GD function exist +if(!function_exists('imagecreatetruecolor')) { + displayError('GD Library Error: imagecreatetruecolor does not exist - please contact your webhost and ask them to install the GD library'); +} + +define ('CACHE_SIZE', 250); // number of files to store before clearing cache +define ('CACHE_CLEAR', 5); // maximum number of files to delete on each cache clear +define ('VERSION', '1.14'); // version number (to force a cache refresh) +define ('DIRECTORY_CACHE', './cache'); // cache directory +define ('DIRECTORY_TEMP', './temp'); // temp directory + +if (function_exists('imagefilter') && defined('IMG_FILTER_NEGATE')) { + $imageFilters = array( + "1" => array(IMG_FILTER_NEGATE, 0), + "2" => array(IMG_FILTER_GRAYSCALE, 0), + "3" => array(IMG_FILTER_BRIGHTNESS, 1), + "4" => array(IMG_FILTER_CONTRAST, 1), + "5" => array(IMG_FILTER_COLORIZE, 4), + "6" => array(IMG_FILTER_EDGEDETECT, 0), + "7" => array(IMG_FILTER_EMBOSS, 0), + "8" => array(IMG_FILTER_GAUSSIAN_BLUR, 0), + "9" => array(IMG_FILTER_SELECTIVE_BLUR, 0), + "10" => array(IMG_FILTER_MEAN_REMOVAL, 0), + "11" => array(IMG_FILTER_SMOOTH, 0), + ); +} + +// sort out image source +$src = get_request("src", ""); +if($src == '' || strlen($src) <= 3) { + displayError ('no image specified'); +} + +// clean params before use +$src = cleanSource($src); +// last modified time (for caching) +$lastModified = filemtime($src); + +// get properties +$new_width = preg_replace("/[^0-9]+/", '', get_request('w', 0)); +$new_height = preg_replace("/[^0-9]+/", '', get_request('h', 0)); +$zoom_crop = preg_replace("/[^0-9]+/", '', get_request('zc', 1)); +$quality = preg_replace("/[^0-9]+/", '', get_request('q', 80)); +$filters = get_request('f', ''); +$align = get_request ('a', 'c'); +$sharpen = get_request('s', 0); + +if ($new_width == 0 && $new_height == 0) { + $new_width = 100; + $new_height = 100; +} + +// get mime type of src +$mime_type = mime_type($src); + +// check to see if this image is in the cache already +check_cache ($mime_type); + +// if not in cache then clear some space and generate a new file +cleanCache(); + +ini_set('memory_limit', '50M'); + +// make sure that the src is gif/jpg/png +if(!valid_src_mime_type($mime_type)) { + displayError('Invalid src mime type: ' . $mime_type); +} + +if(strlen($src) && file_exists($src)) { + + // open the existing image + $image = open_image($mime_type, $src); + if($image === false) { + displayError('Unable to open image : ' . $src); + } + + // Get original width and height + $width = imagesx($image); + $height = imagesy($image); + + // generate new w/h if not provided + if( $new_width && !$new_height ) { + + $new_height = $height * ( $new_width / $width ); + + } elseif($new_height && !$new_width) { + + $new_width = $width * ( $new_height / $height ); + + } elseif(!$new_width && !$new_height) { + + $new_width = $width; + $new_height = $height; + + } + + + + // create a new true color image + $canvas = imagecreatetruecolor( $new_width, $new_height ); + imagealphablending($canvas, false); + // Create a new transparent color for image + $color = imagecolorallocatealpha($canvas, 0, 0, 0, 127); + // Completely fill the background of the new image with allocated color. + imagefill($canvas, 0, 0, $color); + // Restore transparency blending + imagesavealpha($canvas, true); + + if( $zoom_crop ) { + + $src_x = $src_y = 0; + $src_w = $width; + $src_h = $height; + + $cmp_x = $width / $new_width; + $cmp_y = $height / $new_height; + + // calculate x or y coordinate and width or height of source + + if ( $cmp_x > $cmp_y ) { + + $src_w = round( ( $width / $cmp_x * $cmp_y ) ); + $src_x = round( ( $width - ( $width / $cmp_x * $cmp_y ) ) / 2 ); + + } elseif ( $cmp_y > $cmp_x ) { + + $src_h = round( ( $height / $cmp_y * $cmp_x ) ); + $src_y = round( ( $height - ( $height / $cmp_y * $cmp_x ) ) / 2 ); + + } + + // positional cropping! + + switch ($align) { + + case 't': + + case 'tl': + + case 'lr': + + case 'tr': + + case 'rt': + + $src_y = 0; + break; + + + + case 'b': + + case 'bl': + + case 'lb': + + case 'br': + + case 'rb': + + $src_y = $height - $src_h; + break; + + + + case 'l': + + case 'tl': + + case 'lt': + + case 'bl': + + case 'lb': + + $src_x = 0; + break; + + case 'r': + + case 'tr': + + case 'rt': + + case 'br': + + case 'rb': + + $src_x = $width - $new_width; + $src_x = $width - $src_w; + + break; + + default: + break; + } + + + imagecopyresampled( $canvas, $image, 0, 0, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h ); + + } else { + + // copy and resize part of an image with resampling + imagecopyresampled( $canvas, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); + + } + + if ($filters != '' && function_exists('imagefilter') && defined('IMG_FILTER_NEGATE')) { + // apply filters to image + $filterList = explode("|", $filters); + foreach($filterList as $fl) { + $filterSettings = explode(",", $fl); + if(isset($imageFilters[$filterSettings[0]])) { + + for($i = 0; $i < 4; $i ++) { + if(!isset($filterSettings[$i])) { + $filterSettings[$i] = null; + } + } + + switch($imageFilters[$filterSettings[0]][1]) { + + case 1: + + imagefilter($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1]); + break; + + case 2: + + imagefilter($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2]); + break; + + case 3: + + imagefilter($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3]); + break; + + default: + + imagefilter($canvas, $imageFilters[$filterSettings[0]][0]); + break; + + } + } + } + } + + if ($sharpen > 0 && function_exists('imageconvolution')) { + + $sharpenMatrix = array( + array(-1,-1,-1), + array(-1,16,-1), + array(-1,-1,-1), + ); + $divisor = 8; + $offset = 0; + + imageconvolution($canvas, $sharpenMatrix, $divisor, $offset); + + } + + // output image to browser based on mime type + show_image($mime_type, $canvas); + + // remove image from memory + imagedestroy($canvas); + +} else { + + if (strlen($src)) { + displayError ('image ' . $src . ' not found'); + } else { + displayError ('no source specified'); + } + +} + +/** + * + */ +function show_image($mime_type, $image_resized) { + + global $quality; + + // check to see if we can write to the cache directory + $is_writable = 0; + $cache_file_name = DIRECTORY_CACHE . '/' . get_cache_file(); + + if (touch($cache_file_name)) { + + // give 666 permissions so that the developer + // can overwrite web server user + chmod ($cache_file_name, 0666); + $is_writable = 1; + + } else { + + $cache_file_name = NULL; + header ('Content-type: ' . $mime_type); + + } + + switch ($mime_type) { + + case 'image/jpeg': + imagejpeg($image_resized, $cache_file_name, $quality); + break; + + default : + $quality = floor ($quality * 0.09); + imagepng($image_resized, $cache_file_name, $quality); + + } + + if ($is_writable) { + show_cache_file ($mime_type); + } + + imagedestroy ($image_resized); + + displayError ('error showing image'); + +} + +/** + * + */ +function get_request( $property, $default = 0 ) { + + if( isset($_REQUEST[$property]) ) { + + return $_REQUEST[$property]; + + } else { + + return $default; + + } + +} + +/** + * + */ +function open_image($mime_type, $src) { + + $mime_type = strtolower($mime_type); + + if (stristr ($mime_type, 'gif')) { + + $image = imagecreatefromgif($src); + + } elseif (stristr($mime_type, 'jpeg')) { + + @ini_set ('gd.jpeg_ignore_warning', 1); + $image = imagecreatefromjpeg($src); + + } elseif (stristr ($mime_type, 'png')) { + + $image = imagecreatefrompng($src); + + } + + return $image; + +} + +/** + * clean out old files from the cache + * you can change the number of files to store and to delete per loop in the defines at the top of the code + */ +function cleanCache() { + + $files = glob("cache/*", GLOB_BRACE); + + if (count($files) > 0) { + + $yesterday = time() - (24 * 60 * 60); + + usort($files, 'filemtime_compare'); + $i = 0; + + if (count($files) > CACHE_SIZE) { + + foreach ($files as $file) { + + $i ++; + + if ($i >= CACHE_CLEAR) { + return; + } + + if (@filemtime($file) > $yesterday) { + return; + } + + if (file_exists($file)) { + unlink($file); + } + + } + + } + + } + +} + + +/** + * compare the file time of two files + */ +function filemtime_compare($a, $b) { + + return filemtime($a) - filemtime($b); + +} + + +/** + * determine the file mime type + */ +function mime_type($file) { + + if (stristr(PHP_OS, 'WIN')) { + $os = 'WIN'; + } else { + $os = PHP_OS; + } + + $mime_type = ''; + + if (function_exists('mime_content_type') && $os != 'WIN') { + $mime_type = mime_content_type($file); + } + + // use PECL fileinfo to determine mime type + if (!valid_src_mime_type($mime_type)) { + if (function_exists('finfo_open')) { + $finfo = @finfo_open(FILEINFO_MIME); + if ($finfo != '') { + $mime_type = finfo_file($finfo, $file); + finfo_close($finfo); + } + } + } + + // try to determine mime type by using unix file command + // this should not be executed on windows + if (!valid_src_mime_type($mime_type) && $os != "WIN") { + if (preg_match("/FreeBSD|FREEBSD|LINUX/", $os)) { + $mime_type = trim(@shell_exec('file -bi ' . escapeshellarg($file))); + } + } + + // use file's extension to determine mime type + if (!valid_src_mime_type($mime_type)) { + + // set defaults + $mime_type = 'image/png'; + // file details + $fileDetails = pathinfo($file); + $ext = strtolower($fileDetails["extension"]); + // mime types + $types = array( + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'png' => 'image/png', + 'gif' => 'image/gif' + ); + + if (strlen($ext) && strlen($types[$ext])) { + $mime_type = $types[$ext]; + } + + } + + return $mime_type; + +} + + +/** + * + */ +function valid_src_mime_type($mime_type) { + + if (preg_match("/jpg|jpeg|gif|png/i", $mime_type)) { + return true; + } + + return false; + +} + + +/** + * + */ +function check_cache ($mime_type) { + + // make sure cache dir exists + if (!file_exists(DIRECTORY_CACHE)) { + // give 777 permissions so that developer can overwrite + // files created by web server user + mkdir(DIRECTORY_CACHE); + chmod(DIRECTORY_CACHE, 0777); + } + + show_cache_file ($mime_type); + +} + + +/** + * + */ +function show_cache_file ($mime_type) { + + $cache_file = DIRECTORY_CACHE . '/' . get_cache_file(); + + if (file_exists($cache_file)) { + + $gmdate_mod = gmdate("D, d M Y H:i:s", filemtime($cache_file)); + + if(! strstr($gmdate_mod, "GMT")) { + $gmdate_mod .= " GMT"; + } + + if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) { + + // check for updates + $if_modified_since = preg_replace ("/;.*$/", "", $_SERVER["HTTP_IF_MODIFIED_SINCE"]); + + if ($if_modified_since == $gmdate_mod) { + header("HTTP/1.1 304 Not Modified"); + die(); + } + + + + + } + + $fileSize = filesize ($cache_file); + + $buffer = file_get_contents($cache_file); + + ob_get_clean(); + ob_start(); + + + + header ('Last-Modified: ' . $gmdate_mod); + header ('Cache-Control: max-age=9999, must-revalidate'); + header ('Expires: ' . $gmdate_mod); + header ('Accept-Ranges: bytes'); + header ('Content-Type: ' . $mime_type); + header ('Content-Length: ' . $fileSize); + + echo $buffer; + $sContents = ob_get_contents(); + ob_end_clean(); + echo $sContents; + } + +} + + +/** + * + */ +function get_cache_file() { + + global $lastModified; + static $cache_file; + + if (!$cache_file) { + $cachename = $_SERVER['QUERY_STRING'] . VERSION . $lastModified; + $cache_file = md5($cachename) . '.png'; + } + + return $cache_file; + +} + + +/** + * check to if the url is valid or not + */ +function valid_extension ($ext) { + + if (preg_match("/jpg|jpeg|png|gif/i", $ext)) { + return TRUE; + } else { + return FALSE; + } + +} + + +/** + * + */ +function checkExternal ($src) { + + $allowedSites = array( + 'flickr.com', + 'picasa.com', + 'blogger.com', + 'wordpress.com', + 'img.youtube.com', + ); + + if (preg_match('/http:\/\//', $src) == true) { + + $url_info = parse_url ($src); + + $isAllowedSite = false; + foreach ($allowedSites as $site) { + $site = '/' . addslashes($site) . '/'; + if (preg_match($site, $url_info['host']) == true) { + $isAllowedSite = true; + } + } + + if ($isAllowedSite) { + + $fileDetails = pathinfo($src); + $ext = strtolower($fileDetails['extension']); + + $filename = md5($src); + $local_filepath = DIRECTORY_TEMP . '/' . $filename . '.' . $ext; + + if (!file_exists($local_filepath)) { + + if (function_exists('curl_init')) { + + $fh = fopen($local_filepath, 'w'); + $ch = curl_init($src); + + curl_setopt($ch, CURLOPT_URL, $src); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); + curl_setopt($ch, CURLOPT_FILE, $fh); + + if (curl_exec($ch) === FALSE) { + if (file_exists($local_filepath)) { + unlink($local_filepath); + } + displayError('error reading file ' . $src . ' from remote host: ' . curl_error($ch)); + } + + curl_close($ch); + fclose($fh); + + } else { + + if (!$img = file_get_contents($src)) { + displayError('remote file for ' . $src . ' can not be accessed. It is likely that the file permissions are restricted'); + } + + if (file_put_contents($local_filepath, $img) == FALSE) { + displayError('error writing temporary file'); + } + + } + + if (!file_exists($local_filepath)) { + displayError('local file for ' . $src . ' can not be created'); + } + + } + + $src = $local_filepath; + + } else { + + displayError('remote host "' . $url_info['host'] . '" not allowed'); + + } + + } + + return $src; + +} + + +/** + * tidy up the image source url + */ +function cleanSource($src) { + + $host = str_replace('www.', '', $_SERVER['HTTP_HOST']); + $regex = "/^((ht|f)tp(s|):\/\/)(www\.|)" . $host . "/i"; + + $src = preg_replace ($regex, '', $src); + $src = strip_tags ($src); + $src = checkExternal ($src); + + // remove slash from start of string + if (strpos($src, '/') === 0) { + $src = substr ($src, -(strlen($src) - 1)); + } + + // don't allow users the ability to use '../' + // in order to gain access to files below document root + $src = preg_replace("/\.\.+\//", "", $src); + + // get path to image on file system + $src = get_document_root($src) . '/' . $src; + + return $src; + +} + + +/** + * + */ +function get_document_root ($src) { + + // check for unix servers + if(file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $src)) { + return $_SERVER['DOCUMENT_ROOT']; + } + + // check from script filename (to get all directories to timthumb location) + $parts = array_diff(explode('/', $_SERVER['SCRIPT_FILENAME']), explode('/', $_SERVER['DOCUMENT_ROOT'])); + $path = $_SERVER['DOCUMENT_ROOT']; + foreach ($parts as $part) { + $path .= '/' . $part; + if (file_exists($path . '/' . $src)) { + return $path; + } + } + + // the relative paths below are useful if timthumb is moved outside of document root + // specifically if installed in wordpress themes like mimbo pro: + // /wp-content/themes/mimbopro/scripts/timthumb.php + $paths = array( + ".", + "..", + "../..", + "../../..", + "../../../..", + "../../../../.." + ); + + foreach ($paths as $path) { + if(file_exists($path . '/' . $src)) { + return $path; + } + } + + // special check for microsoft servers + if (!isset($_SERVER['DOCUMENT_ROOT'])) { + $path = str_replace("/", "\\", $_SERVER['ORIG_PATH_INFO']); + $path = str_replace($path, "", $_SERVER['SCRIPT_FILENAME']); + + if (file_exists($path . '/' . $src)) { + return $path; + } + } + + displayError('file not found ' . $src); + +} + + +/** + * generic error message + */ +function displayError ($errorString = '') { + + header('HTTP/1.1 400 Bad Request'); + echo '
' . $errorString . '
TimThumb version : ' . VERSION . '
'; + die(); + +} +?> +?> \ No newline at end of file diff --git a/gallery/index.php b/gallery/index.php old mode 100644 new mode 100755 index 23aca30..3c182e3 --- a/gallery/index.php +++ b/gallery/index.php @@ -1,25 +1,72 @@ -readImageDirectory('gallery-images'); - - // Define theme path - if (!defined('THEMEPATH')) { - define('THEMEPATH', $gallery->getThemePath()); - } - - // Set path to theme index - $themeIndex = $gallery->getThemePath(true) . '/index.php'; - - // Initialize the theme - if (file_exists($themeIndex)) { - include($themeIndex); - } else { - die('ERROR: Failed to initialize theme'); - } + + + + +Gallery from Folder Demo + + + + +
    +

    $name

    \n "; + } + } + ?> +
+ + + diff --git a/gallery/resources/UberGallery.css b/gallery/resources/UberGallery.css deleted file mode 100644 index d7906ca..0000000 --- a/gallery/resources/UberGallery.css +++ /dev/null @@ -1,139 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* -----| GALLERY LIST |----------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - -#galleryList { - margin: 0; - padding: 0 4px; -} - -#galleryList li { - display: inline-block; - float: left; - list-style: none; - margin: 5px 6px; - padding: 0; -} - -#galleryList li a { - background-color: #FFF; - border: 1px solid #CCC; - display: block; - padding: 4px; -} - -#galleryList li a:hover { - border-color: #999; -} - -#galleryList li a img { - border: none; -} - -/* -------------------------------------------------------------------------- */ -/* -----| GALLERY FOOTER |--------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - -#galleryFooter { - border-top: 1px solid #CCC; - margin-top: 10px; - padding: 3px; -} - -#credit { - float: right; - font-size: 0.9em; - margin: 4px 0; -} - -#galleryFooter #credit a { - color: #369; -} - - -/* -------------------------------------------------------------------------- */ -/* ----| PAGINATION |------------------------------------------------------ */ -/* -------------------------------------------------------------------------- */ - -#galleryPagination { - color: #369; - float: left; - font-size: .9em; - margin: 0 !important; - padding: 0 !important; - text-align: center; -} - -#galleryPagination li { - border: 1px solid transparent; - border-radius: 3px; - display: block; - float: left; - list-style: none; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; -} - -#galleryPagination li:hover { - background-color: #EFEFEF; - border: 1px solid #CCC; -} - -#galleryPagination li.title { - background: transparent url(page_white_stack.png) no-repeat left center; - border: 1px solid transparent; - font-weight: normal; - padding: 3px 6px 3px 22px; -} - -#galleryPagination li a, #galleryPagination li a:visited { - color: #369; - display: block; - padding: 3px 6px; - text-decoration: none; -} - -#galleryPagination li.current { - background-color: transparent; - border: 1px solid transparent; - color: #333; - font-weight: bold; - padding: 3px 6px; -} - -#galleryPagination li.inactive { - background-color: transparent; - color: #ACACAC; - border: 1px solid transparent; - display: block; - padding: 3px 6px; -} - - -/* -------------------------------------------------------------------------- */ -/* ----| MISCELLANEOUS |--------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - -/* --- CLEAR FIX --- */ - -.clearfix:after { - visibility: hidden; - display: block; - font-size: 0; - content: " "; - clear: both; - height: 0; -} - -* html .clearfix { - zoom: 1; /* IE6 */ -} - -*:first-child+html .clearfix { - zoom: 1; /* IE7 */ -} - -/** - * UberGallery.css created and implimented by, - * Chris Kankiewicz -- http://www.ChrisKankiewicz.com - */ \ No newline at end of file diff --git a/gallery/resources/UberGallery.php b/gallery/resources/UberGallery.php deleted file mode 100644 index 21c377d..0000000 --- a/gallery/resources/UberGallery.php +++ /dev/null @@ -1,1323 +0,0 @@ - - * @copyright Copyright (c) 2013 Chris Kankiewicz (http://www.chriskankiewicz.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT License - * @link https://github.com/UberGallery/UberGallery Cannonical source URL - */ -class UberGallery { - - // Define application version - const VERSION = '2.4.8'; - - // Reserve some variables - protected $_config = array(); - protected $_imgDir = NULL; - protected $_appDir = NULL; - protected $_index = NULL; - protected $_rThumbsDir = NULL; - protected $_rImgDir = NULL; - protected $_now = NULL; - - /** - * UberGallery construct function. Runs on object creation. - */ - public function __construct() { - - // Get timestamp for the current time - $this->_now = time(); - - // Sanitize input and set current page - if (isset($_GET['page'])) { - $this->_page = (integer) $_GET['page']; - } else { - $this->_page = 1; - } - - // Set class directory constant - if(!defined('__DIR__')) { - define('__DIR__', dirname(__FILE__)); - } - - // Set application directory - $this->_appDir = __DIR__; - - // Set configuration file path - $configPath = $this->_appDir . '/galleryConfig.ini'; - - // Read and apply gallery config or throw error on fail - if (file_exists($configPath)) { - // Parse gallery configuration - $config = parse_ini_file($configPath, true); - - // Apply configuration - $this->setCacheExpiration($config['basic_settings']['cache_expiration']); - $this->setPaginatorThreshold($config['basic_settings']['paginator_threshold']); - $this->setThumbSize($config['basic_settings']['thumbnail_width'], $config['basic_settings']['thumbnail_height']); - $this->setThumbQuality($config['basic_settings']['thumbnail_quality']); - $this->setThemeName($config['basic_settings']['theme_name']); - $this->setSortMethod($config['advanced_settings']['images_sort_by'], $config['advanced_settings']['reverse_sort']); - $this->setDebugging($config['advanced_settings']['enable_debugging']); - $this->setCacheDirectory($this->_appDir . '/cache'); - - if ($config['basic_settings']['enable_pagination']) { - $this->setImagesPerPage($config['advanced_settings']['images_per_page']); - } else { - $this->setImagesPerPage(0); - } - - } else { - die("Unable to read galleryConfig.ini, please make sure the file exists at:
{$configPath}
"); - } - - // Get the relative thumbs directory path - $this->_rThumbsDir = $this->_getRelativePath(getcwd(), $this->_config['cache_dir']); - - // Check if cache directory exists and create it if it doesn't - if (!file_exists($this->_config['cache_dir'])) { - $this->setSystemMessage('error', "Cache directory does not exist, please manually create it."); - } - - // Check if cache directory is writeable and warn if it isn't - if (!is_writable($this->_config['cache_dir'])) { - $this->setSystemMessage('error', "Cache directory needs write permissions. If all else fails, try running:
chmod 777 {$this->_config['cache_dir']}
"); - } - - // Set debug log path - $this->_debugLog = $this->_config['cache_dir'] . '/debug.log'; - - // Set up debugging if enabled - if ($this->_config['debugging']) { - - // Initialize log if it doesn't exist - if (!file_exists($this->_debugLog)) { - - // Get libgd info - $gd = gd_info(); - - // Get system and package info - $timestamp = date('Y-m-d H:i:s'); - $ugVersion = 'UberGallery v' . UberGallery::VERSION; - $phpVersion = 'PHP: ' . phpversion(); - $gdVersion = 'GD: ' . $gd['GD Version']; - $osVersion = 'OS: ' . PHP_OS; - - // Combine all the things! - $initText = $timestamp . ' / ' . $ugVersion . ' / ' . $phpVersion . ' / ' . $gdVersion . ' / ' . $osVersion . PHP_EOL; - - // Create file with initilization text - file_put_contents($this->_debugLog, $initText, FILE_APPEND); - } - - // Set new error handler - set_error_handler("UberGallery::_errorHandler"); - - } - - } - - - /** - * Special init method for simple one-line interface - * - * @return reflection - * @access public - */ - public static function init() { - $reflection = new ReflectionClass(__CLASS__); - return $reflection->newInstanceArgs(func_get_args()); - } - - - /** - * Returns pre-formatted XHTML of a gallery - * - * @param string $directory Relative path to images directory - * @param string $relText Text to use as the rel value - * @return object Self - * @access public - */ - public function createGallery($directory, $relText = 'colorbox') { - - // Get the gallery data array and set the template path - $galleryArray = $this->readImageDirectory($directory); - $templatePath = $this->_appDir . '/templates/defaultGallery.php'; - - // Set the relative text attribute - $galleryArray['relText'] = $relText; - - // Echo the template contents - echo $this->readTemplate($templatePath, $galleryArray); - - return $this; - - } - - - /** - * Returns an array of files and stats of the specified directory - * - * @param string $directory Relative path to images directory - * @return array File listing and statistics for specified directory - * @access public - */ - public function readImageDirectory($directory) { - - // Set relative image directory - $this->setRelativeImageDirectory($directory); - - // Instantiate gallery array - $galleryArray = array(); - - // Get the cached array - $galleryArray = $this->_readIndex($this->_index); - - // If cached array is false, read the directory - if (!$galleryArray) { - - // Get array of directory - $dirArray = $this->_readDirectory($directory); - - // Loop through array and add additional info - foreach ($dirArray as $key => $image) { - - // Get files relative path - $relativePath = $this->_rImgDir . '/' . $key; - - $galleryArray['images'][htmlentities(pathinfo($image['real_path'], PATHINFO_BASENAME))] = array( - 'file_title' => str_replace('_', ' ', pathinfo($image['real_path'], PATHINFO_FILENAME)), - 'file_path' => htmlentities($relativePath), - 'thumb_path' => $this->_createThumbnail($image['real_path']) - ); - - } - - // Add statistics to gallery array - $galleryArray['stats'] = $this->_readGalleryStats($this->_readDirectory($directory, false)); - - // Add gallery paginator to the gallery array - $galleryArray['paginator'] = $this->_getPaginatorArray($galleryArray['stats']['current_page'], $galleryArray['stats']['total_pages']); - - // Save the sorted array - if ($this->isCachingEnabled()) { - $this->_createIndex($galleryArray, $this->_index); - } - } - - // Return the array - return $galleryArray; - } - - /** - * Returns a template string with custom data injected into it - * - * @param string $templatePath Path to template file - * @param array $data Array of data to be injected into the template - * @return string Processed template string - * @access private - */ - public function readTemplate($templatePath, $data) { - - // Extract array to variables - extract($data); - - // Start the output buffer - ob_start(); - - // Include the template - include $templatePath; - - // Set buffer output to a variable - $output = ob_get_clean(); - - // Return the output - return $output; - - } - - - /** - * Returns the theme name - * - * @return string Theme name as set in user config - * @access public - */ - public function getThemeName() { - // Return the theme name - return $this->_config['theme_name']; - } - - - /** - * Returns the path to the chosen theme directory - * - * @param bool $absolute true = return absolute path / false = return relative path (default) - * @return string Path to theme - * @access public - */ - public function getThemePath($absolute = false) { - if ($absolute) { - // Set the theme path - $themePath = $this->_appDir . '/themes/' . $this->_config['theme_name']; - } else { - // Get relative path to application dir - $realtivePath = $this->_getRelativePath(getcwd(), $this->_appDir); - - // Set the theme path - $themePath = $realtivePath . '/themes/' . $this->_config['theme_name']; - } - - return $themePath; - } - - - /** - * Get an array of error messages or false when empty - * - * @return array|boolean Array of error messages or boolean false if none - * @access public - */ - public function getSystemMessages() { - if (isset($this->_systemMessage) && is_array($this->_systemMessage)) { - return $this->_systemMessage; - } else { - return false; - } - } - - - /** - * Returns valid XHTML link tag for chosen ColorBox stylesheet - * - * @param int $themeNum Integer (1-5) representing the ColorBox theme number - * @return string Valid XHTML link tag for chosen ColorBox stylesheet - * @access public - */ - public function getColorboxStyles($themeNum) { - - // Get relative path to application dir - $realtivePath = $this->_getRelativePath(getcwd(), $this->_appDir); - - // Set ColorBox path - $colorboxPath = $realtivePath . '/colorbox/' . $themeNum . '/colorbox.css'; - - return ''; - } - - - /** - * Returns valid XHTML tags for ColorBox JavaScript include - * - * @return string Valid XHTML tags for ColorBox JavaScript include - * @access public - */ - public function getColorboxScripts() { - - // Set some path variables - $templatePath = $this->_appDir . '/templates/colorboxScripts.php'; - $colorboxPath = $this->_getRelativePath(getcwd(), $this->_appDir) . '/colorbox/jquery.colorbox.js'; - - // Get the template contents - $template = $this->readTemplate($templatePath, array('path' => $colorboxPath)); - - // Return the include text - return $template; - - } - - /** - * Set cache expiration time in minutes - * - * @param int $time Cache expiration time in minutes (default = 0) - * @return object Self - * @access public - */ - public function setCacheExpiration($time = 0) { - $this->_config['cache_expire'] = $time; - - return $this; - } - - /** - * Check if caching is enabled - * - * @return boolean to indiciate whether caching is enabled or not - * @access public - */ - public function isCachingEnabled() { - return $this->_config['cache_expire'] != 0; - } - - - /** - * Set the number of images to be displayed per page - * - * @param int $imgPerPage Number of images to display per page (default = 0) - * @return object Self - * @access public - */ - public function setImagesPerPage($imgPerPage = 0) { - $this->_config['img_per_page'] = $imgPerPage; - - return $this; - } - - - /** - * Set thumbnail width and height in pixels - * - * @param int $width Thumbnail width in pixels (default = 100) - * @param int $height Thumbnail height in pixels (default = 100) - * @return object Self - * @access public - */ - public function setThumbSize($width = 100, $height = 100) { - $this->_config['thumbnail']['width'] = $width; - $this->_config['thumbnail']['height'] = $height; - - return $this; - } - - - /** - * Set thumbnail quality as a value from 1 - 100 - * This only affects JPEGs and has no effect on GIF or PNGs - * - * @param int $quality Thumbnail size in pixels (default = 75) - * @return object Self - * @access public - */ - public function setThumbQuality($quality = 75) { - $this->_config['thumbnail']['quality'] = $quality; - - return $this; - } - - - /** - * Set theme name - * - * @param string $name Theme name (default = uber-blue) - * @return object Self - * @access public - */ - public function setThemeName($name = 'uber-blue') { - $this->_config['theme_name'] = $name; - - return $this; - } - - - /** - * Set the sortting method - * - * @param string $method Sorting method (default = natcasesort) - * @param boolean $reverse true = reverse sort order (default = false) - * @return object Self - * @access public - */ - public function setSortMethod($method = 'natcasesort', $reverse = false) { - $this->_config['sort_method'] = $method; - $this->_config['reverse_sort'] = $reverse; - - return $this; - } - - - /** - * Enable or disable debugging - * - * @param boolean $bool true = on / false = off (default = false) - * @return object Self - * @access public - */ - public function setDebugging($bool = false) { - $this->_config['debugging'] = $bool; - - return $this; - } - - - /** - * Set the cache directory name - * - * @param string $directory Cache directory name - * @return object Self - * @access public - */ - public function setCacheDirectory($directory) { - $this->_config['cache_dir'] = realpath($directory); - - return $this; - } - - - /** - * Set the paginator threshold - * - * @param int $threshold Paginator threshold value (default = 10) - * @return object Self - * @access public - */ - public function setPaginatorThreshold($threshold = 10) { - $this->_config['threshold'] = $threshold; - - return $this; - } - - - - /** - * Sets the relative path to the image directory - * - * @param string $directory Relative path to image directory - * @return object Self - * @access public - */ - public function setRelativeImageDirectory($directory) { - - // Set real path to $directory - $this->_imgDir = realpath($directory); - - // Set relative path to $directory - $this->_rImgDir = $directory; - - // Set index name - if ($this->_config['img_per_page'] < 1) { - $this->_index = $this->_config['cache_dir'] . '/' . $this->_hash($directory) . '-' . 'all.index'; - } else { - $this->_index = $this->_config['cache_dir'] . '/' . $this->_hash($directory) . '-' . $this->_page . '.index'; - } - - return $this; - } - - - /** - * Add a message to the system message array - * - * @param string $type The type of message (ie - error, success, notice, etc.) - * @param string $message The message to be displayed to the user - * @return boolean Returns true on success - * @access public - */ - public function setSystemMessage($type, $text) { - - // Create empty message array if it doesn't already exist - if (isset($this->_systemMessage) && !is_array($this->_systemMessage)) { - $this->_systemMessage = array(); - } - - // Generate unique message key - $key = $this->_hash(trim($type . $text)); - - // Set the error message - $this->_systemMessage[$key] = array( - 'type' => $type, - 'text' => $text - ); - - return true; - } - - /** - * Generate a hash value (message digest) for specific algorithm. - * Default is SHA-256. - * - * @param string $message the message to generate hash for - * @param string $algo hasing algorithm to be used (default: sha256). - * @return string hash value (message digest) - * @access private - */ - private function _hash($message, $algo = "sha256") { - return hash($algo, $message); - } - - - /** - * Reads files in a directory and returns only images - * - * @param string $directory Path to directory - * @param boolean $paginate Whether or not paginate the array (default = true) - * @return array Array of images in the specified directory - * @access private - */ - private function _readDirectory($directory, $paginate = true) { - - // Set index path - $index = $this->_config['cache_dir'] . '/' . $this->_hash($directory) . '-' . 'files' . '.index'; - - // Read directory array - $dirArray = $this->_readIndex($index); - - // Serve from cache if file exists and caching is enabled - if (!$dirArray) { - - // Initialize the array - $dirArray = array(); - - // Loop through directory and add information to array - if ($handle = opendir($directory)) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != "..") { - - // Get files real path - $realPath = realpath($directory . '/' . $file); - - // If file is an image, add info to array - if ($this->_isImage($realPath)) { - $dirArray[htmlentities(pathinfo($realPath, PATHINFO_BASENAME))] = array( - 'real_path' => $realPath - ); - } - } - } - - // Close open file handle - closedir($handle); - } - - // Create directory array - if ($this->isCachingEnabled()) { - $this->_createIndex($dirArray, $index); - } - } - - // Set error message if there are no images - if (empty($dirArray)) { - $this->setSystemMessage('error', "No images found, please upload images to your gallery's image directory."); - } - - // Sort the array - $dirArray = $this->_arraySort($dirArray, $this->_config['sort_method'], $this->_config['reverse_sort']); - - // Paginate the array and return current page if enabled - if ($paginate == true && $this->_config['img_per_page'] > 0) { - $dirArray = $this->_arrayPaginate($dirArray, $this->_config['img_per_page'], $this->_page); - } - - // Return the array - return $dirArray; - } - - - /** - * Creates a cropped, square thumbnail of given dimensions from a source image - * - * @param string $source Path to source image - * @param int $thumbWidth Desired thumbnail width size in pixels (default = null) - * @param int $thumbHeight Desired thumbnail height size in pixels (default = null) - * @param int $quality Thumbnail quality, from 1 to 100, applies to JPG and JPEGs only (default = null) - * @return string Relative path to thumbnail - * @access private - */ - private function _createThumbnail($source, $thumbWidth = NULL, $thumbHeight = NULL, $quality = NULL) { - - // Set defaults thumbnail width if not specified - if ($thumbWidth === NULL) { - $thumbWidth = $this->_config['thumbnail']['width']; - } - - // Set defaults thumbnail height if not specified - if ($thumbHeight === NULL) { - $thumbHeight = $this->_config['thumbnail']['height']; - } - - // Set defaults thumbnail height if not specified - if ($quality === NULL) { - $quality = $this->_config['thumbnail']['quality']; - } - - // MD5 hash of source image path - $fileHash = $this->_hash($source); - - // Get file extension from source image - $fileExtension = pathinfo($source, PATHINFO_EXTENSION); - - // Build file name - $fileName = $thumbWidth . 'x' . $thumbHeight . '-' . $quality . '-' . $fileHash . '.' . $fileExtension; - - // Build thumbnail destination path - $destination = $this->_config['cache_dir'] . '/' . $fileName; - - // If file is cached return relative path to thumbnail - if ($this->_isFileCached($destination)) { - $relativePath = $this->_rThumbsDir . '/' . $fileName; - return $relativePath; - } - - // Get needed image information - $imgInfo = getimagesize($source); - $width = $imgInfo[0]; - $height = $imgInfo[1]; - $x = 0; - $y = 0; - - // Calculate ratios - $srcRatio = $width / $height; - $thumbRatio = $thumbWidth / $thumbHeight; - - if ($srcRatio > $thumbRatio) { - - // Preserver original width - $originalWidth = $width; - - // Crop image width to proper ratio - $width = $height * $thumbRatio; - - // Set thumbnail x offset - $x = ceil(($originalWidth - $width) / 2); - - } elseif ($srcRatio < $thumbRatio) { - - // Preserver original height - $originalHeight = $height; - - // Crop image height to proper ratio - $height = ($width / $thumbRatio); - - // Set thumbnail y offset - $y = ceil(($originalHeight - $height) / 2); - - } - - // Create new empty image of proper dimensions - $newImage = imagecreatetruecolor($thumbWidth, $thumbHeight); - - // Create new thumbnail - if ($imgInfo[2] == IMAGETYPE_JPEG) { - $image = imagecreatefromjpeg($source); - imagecopyresampled($newImage, $image, 0, 0, $x, $y, $thumbWidth, $thumbHeight, $width, $height); - imagejpeg($newImage, $destination, $quality); - } elseif ($imgInfo[2] == IMAGETYPE_GIF) { - $image = imagecreatefromgif($source); - imagecopyresampled($newImage, $image, 0, 0, $x, $y, $thumbWidth, $thumbHeight, $width, $height); - imagegif($newImage, $destination); - } elseif ($imgInfo[2] == IMAGETYPE_PNG) { - $image = imagecreatefrompng($source); - imagecopyresampled($newImage, $image, 0, 0, $x, $y, $thumbWidth, $thumbHeight, $width, $height); - imagepng($newImage, $destination); - } - - // Return relative path to thumbnail - $relativePath = $this->_rThumbsDir . '/' . $fileName; - return $relativePath; - } - - /** - * Return array from the cached index - * - * @param string $filePath Path to stored index - * @return array|boolean Decoded cached array or false when no valid index is found - * @access private - */ - private function _readIndex($filePath) { - - // Return false if file doesn't exist or the cache has expired - if (!$this->_isFileCached($filePath)) { - return false; - } - - // Read file index - $indexString = file_get_contents($filePath); - - // Unsearialize the array - $indexArray = unserialize($indexString); - - // Decode the array - $decodedArray = $this->_arrayDecode($indexArray); - - // Return the array - return $decodedArray; - } - - - /** - * Create serialized index from file array - * - * @param string $array Array to be indexed - * @param string $filePath Path where index will be stored - * @return boolean Returns true on success, false on failure - * @access private - */ - private function _createIndex($array, $filePath) { - - // Encode the array - $encodedArray = $this->_arrayEncode($array); - - // Serialize array - $serializedArray = serialize($encodedArray); - - // Write serialized array to index - if (file_put_contents($filePath, $serializedArray)) { - return true; - } - - return false; - - } - - /** - * Runs all array strings through base64_encode to help - * prevent errors with non-English languages - * - * @param array $array Array to be encoded - * @return array The encoded array - * @access private - */ - private function _arrayEncode($array) { - - $encodedArray = array(); - - foreach ($array as $key => $item) { - - // Base64 encode the array keys - $key = base64_encode($key); - - // Base64 encode the array values - if (is_array($item)) { - - // Recursively call _arrayEncode() - $encodedArray[$key] = $this->_arrayEncode($item); - - } elseif (is_string($item)) { - - // Base64 encode the string - $encodedArray[$key] = base64_encode($item); - - } else { - - // Pass value unaltered to new array - $encodedArray[$key] = $item; - - } - } - - // Return the encoded array - return $encodedArray; - - } - - - /** - * Decodes an encoded array - * - * @param array $array Array to be decoded - * @return array The decoded array - * @access private - */ - private function _arrayDecode($array) { - - $decodedArray = array(); - - foreach ($array as $key => $item) { - - // Base64 decode the array keys - $key = base64_decode($key); - - // Base64 decode the array values - if (is_array($item)) { - - // Recursively call _arrayDecode() - $decodedArray[$key] = $this->_arrayDecode($item); - - } elseif (is_string($item)) { - - // Base64 decode the string - $decodedArray[$key] = base64_decode($item); - - } else { - - // Pass value unaltered to new array - $decodedArray[$key] = $item; - - } - } - - // Return the decoded array - return $decodedArray; - - } - - - /** - * Returns an array of gallery statistics - * - * @param array $array Array to gather stats from - * @return array Array of gallery statistics - * @access private - */ - private function _readGalleryStats($array) { - // Caclulate total array elements - $totalElements = count($array); - - // Calculate total pages - if ($this->_config['img_per_page'] > 0) { - $totalPages = ceil($totalElements / $this->_config['img_per_page']); - } else { - $totalPages = 1; - } - - // Set current page - if ($this->_page < 1) { - $currentPage = 1; - } elseif ($this->_page > $totalPages) { - $currentPage = $totalPages; - } else { - $currentPage = (integer) $this->_page; - } - - // Add stats to array - $statsArray = array( - 'current_page' => $currentPage, - 'total_images' => $totalElements, - 'total_pages' => $totalPages - ); - - // Return array - return $statsArray; - } - - - /** - * Returns a formatted array for the gallery paginator - * - * @param int $currentPage The current page being viewed - * @param int $totalPages Total number of pages in the gallery - * @return array Array for building the paginator - * @access private - */ - private function _getPaginatorArray($currentPage, $totalPages) { - - // Set some variables - $range = ceil($this->_config['threshold'] / 2) - 1; - $firstPage = $currentPage - $range; - $lastPage = $currentPage + $range; - $firstDiff = NULL; - $lastDiff = NULL; - - // Ensure first page is within the bounds of available pages - if ($firstPage <= 1) { - $firstDiff = 1 - $firstPage; - $firstPage = 1; - } - - // Ensure last page is within the bounds of available pages - if ($lastPage >= $totalPages) { - $lastDiff = $lastPage - $totalPages; - $lastPage = $totalPages; - } - - // Apply page differences - $lastPage = $lastPage + $firstDiff; - $firstPage = $firstPage - $lastDiff; - - // Recheck first and last page to ensure they're within proper bounds - if ($firstPage <= 1 && $lastPage >= $totalPages) { - $firstPage = 1; - $lastPage = $totalPages; - } - - // Create title element - $paginatorArray[] = array( - 'text' => 'Page ' . $currentPage . ' of ' . $totalPages, - 'class' => 'title' - ); - - // Create previous page element - if ($currentPage == 1) { - - $paginatorArray[] = array( - 'text' => '<', - 'class' => 'inactive' - ); - - } else { - - $paginatorArray[] = array( - 'text' => '<', - 'class' => 'active', - 'href' => '?page=' . ($currentPage - 1) - ); - - } - - // Set previous overflow - if ($firstPage > 1) { - $paginatorArray[] = array( - 'text' => '...', - 'class' => 'more', - 'href' => '?page=' . ($currentPage - $range - 1) - ); - } - - // Generate the page elelments - for ($i = $firstPage; $i <= $lastPage; $i++) { - - if ($i == $currentPage) { - - $paginatorArray[] = array( - 'text' => $i, - 'class' => 'current' - ); - - } else { - - $paginatorArray[] = array( - 'text' => $i, - 'class' => 'active', - 'href' => '?page=' . $i - ); - - } - - } - - // Set next overflow - if ($lastPage < $totalPages) { - $paginatorArray[] = array( - 'text' => '...', - 'class' => 'more', - 'href' => '?page=' . ($currentPage + $range + 1) - ); - } - - // Create next page element - if ($currentPage == $totalPages) { - - $paginatorArray[] = array( - 'text' => '>', - 'class' => 'inactive' - ); - - } else { - - $paginatorArray[] = array( - 'text' => '>', - 'class' => 'active', - 'href' => '?page=' . ($currentPage + 1) - ); - - } - - // Return the paginator array - return $paginatorArray; - - } - - - /** - * Sorts an array by the provided sort method - * - * @param array $array Array to be sorted - * @param string $sort Sorting method (acceptable inputs: natsort, natcasesort, etc.) - * @param reverse Reverses the sorted array on true (default = false) - * @return array Sorted array - * @access private - */ - private function _arraySort($array, $sortMethod, $reverse = false) { - // Create empty array - $sortedArray = array(); - - // Create new array of just the keys and sort it - $keys = array_keys($array); - - switch ($sortMethod) { - case 'asort': - asort($keys); - break; - case 'arsort': - arsort($keys); - break; - case 'ksort': - ksort($keys); - break; - case 'krsort': - krsort($keys); - break; - case 'natcasesort': - natcasesort($keys); - break; - case 'natsort': - natsort($keys); - break; - case 'shuffle': - shuffle($keys); - break; - } - - // Loop through the sorted values and move over the data - foreach ($keys as $key) { - $sortedArray[$key] = $array[$key]; - } - - // Reverse array if set - if ($reverse) { - $sortedArray = array_reverse($sortedArray, true); - } - - // Return sorted array - return $sortedArray; - - } - - - /** - * Paginates array and returns partial array of the current page - * - * @param string $array Array to be paginated - * @param int $resultsPerPage Number of desired results per page - * @param int $currentPage Current page number - * @return array A parial array representing the current page - * @access private - */ - private function _arrayPaginate($array, $resultsPerPage, $currentPage) { - // Page varriables - $totalElements = count($array); - - if ($totalElements == 0) { - - $paginatedArray = array(); - - } else { - - if ($resultsPerPage <= 0 || $resultsPerPage >= $totalElements) { - $firstElement = 0; - $lastElement = $totalElements; - $totalPages = 1; - } else { - // Calculate total pages - $totalPages = ceil($totalElements / $resultsPerPage); - - // Set current page - if ($currentPage < 1) { - $currentPage = 1; - } elseif ($currentPage > $totalPages) { - $currentPage = $totalPages; - } else { - $currentPage = (integer) $currentPage; - } - - // Calculate starting image - $firstElement = ($currentPage - 1) * $resultsPerPage; - - // Calculate last image - if($currentPage * $resultsPerPage > $totalElements) { - $lastElement = $totalElements; - } else { - $lastElement = $currentPage * $resultsPerPage; - } - } - - // Initiate counter - $x = 1; - - // Run loop to paginate images and add them to array - foreach ($array as $key => $element) { - - // Add image to array if within current page - if ($x > $firstElement && $x <= $lastElement) { - $paginatedArray[$key] = $array[$key]; - } - - // Increment counter - $x++; - } - - } - - // Return paginated array - return $paginatedArray; - } - - - /** - * Verifies whether or not a file is an image - * - * @param string $filePath Path to file for testing - * @return boolean Returns true if file is an image or false if file is not an image - * @access private - */ - private function _isImage($filePath) { - // Get file type - if (function_exists('exif_imagetype')) { - $imgType = @exif_imagetype($filePath); - } else { - $imgArray = @getimagesize($filePath); - $imgType = $imgArray[2]; - } - - // Array of accepted image types - $allowedTypes = array(1, 2, 3); - - // Determine if the file type is an acceptable image type - if (in_array($imgType, $allowedTypes)) { - return true; - } else { - return false; - } - } - - - /** - * Compares two paths and returns the relative path from one to the other - * - * @param string $fromPath Starting path - * @param string $toPath Ending path - * @return string $relativePath Relative path from $fromPath to $toPath - * @access private - */ - private function _getRelativePath($fromPath, $toPath) { - - // Define the OS specific directory separator - if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR); - - // Remove double slashes from path strings - $fromPath = str_replace(DS . DS, DS, $fromPath); - $toPath = str_replace(DS . DS, DS, $toPath); - - // Explode working dir and cache dir into arrays - $fromPathArray = explode(DS, $fromPath); - $toPathArray = explode(DS, $toPath); - - // Remove last fromPath array element if it's empty - $x = count($fromPathArray) - 1; - - if(!trim($fromPathArray[$x])) { - array_pop($fromPathArray); - } - - // Remove last toPath array element if it's empty - $x = count($toPathArray) - 1; - - if(!trim($toPathArray[$x])) { - array_pop($toPathArray); - } - - // Get largest array count - $arrayMax = max(count($fromPathArray), count($toPathArray)); - - // Set some default variables - $diffArray = array(); - $samePath = true; - $key = 1; - - // Generate array of the path differences - while ($key <= $arrayMax) { - - // Get to path variable - $toPath = isset($toPathArray[$key]) ? $toPathArray[$key] : NULL; - - // Get from path variable - $fromPath = isset($fromPathArray[$key]) ? $fromPathArray[$key] : NULL; - - if ($toPath !== $fromPath || $samePath !== true) { - - // Prepend '..' for every level up that must be traversed - if (isset($fromPathArray[$key])) { - array_unshift($diffArray, '..'); - } - - // Append directory name for every directory that must be traversed - if (isset($toPathArray[$key])) { - $diffArray[] = $toPathArray[$key]; - } - - // Directory paths have diverged - $samePath = false; - } - - // Increment key - $key++; - } - - // Set the relative thumbnail directory path - $relativePath = implode('/', $diffArray); - - // Return the relative path - return $relativePath; - - } - - - /** - * Determines if a file is cached or not - * - * @param string $filePath Path to file to check - * @return bool Returns true if file is cached and available or false if file is not cached - * @access private - */ - private function _isFileCached($filePath) { - - if (file_exists($filePath) && (($this->_now - filemtime($filePath)) / 60 <= $this->_config['cache_expire'] || $this->_config['cache_expire'] < 0 )) { - return true; - } - - return false; - - } - - - /** - * Custom error handler for logging errors to the debug log - * - * @param int $errorNum Level of the error raised - * @param string $errorMsg The error message - * @param string $fileName Filename that the error was raised in - * @param int $lineNum Line number the error was raised at - * @param array $vars Array pointing to the active symbol table at the point the error occurred - * @return void - * @access private - */ - private function _errorHandler($errorNum, $errorMsg, $fileName, $lineNum, $vars) { - - // Set current timestamp - $time = date('Y-m-d H:i:s'); - - // Build error type array - $errorType = array ( - 1 => "Error", - 2 => "Warning", - 4 => "Parsing Error", - 8 => "Notice", - 16 => "Core Error", - 32 => "Core Warning", - 64 => "Compile Error", - 128 => "Compile Warning", - 256 => "User Error", - 512 => "User Warning", - 1024 => "User Notice" - ); - - // Set error type - $errorLevel = $errorType[$errorNum]; - - // Build the log message text - $logMessage = $time . ' : ' . $fileName . ' on line '. $lineNum . ' [' . $errorLevel . '] ' . $errorMsg . PHP_EOL; - - // Append the message to the log - if ($errorNum != 8) { - error_log($logMessage, 3, $this->_debugLog, FILE_APPEND); - } - - // Terminate on fatal error - if ($errorNum != 2 && $errorNum != 8) { - die("A fatal error has occurred, script execution aborted. See debug.log for more info."); - } - - } - -} - -?> diff --git a/gallery/resources/colorbox/1/colorbox.css b/gallery/resources/colorbox/1/colorbox.css deleted file mode 100644 index a7fff10..0000000 --- a/gallery/resources/colorbox/1/colorbox.css +++ /dev/null @@ -1,70 +0,0 @@ -/* - Colorbox Core Style: - The following CSS is consistent between example themes and should not be altered. -*/ -#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} -#cboxWrapper {max-width:none;} -#cboxOverlay{position:fixed; width:100%; height:100%;} -#cboxMiddleLeft, #cboxBottomLeft{clear:left;} -#cboxContent{position:relative;} -#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} -#cboxTitle{margin:0;} -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} -#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} -.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} -.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} -#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} - -/* - User Style: - Change the following styles to modify the appearance of Colorbox. They are - ordered & tabbed in a way that represents the nesting of the generated HTML. -*/ -#cboxOverlay{background:url(images/overlay.png) repeat 0 0; opacity: 0.9; filter: alpha(opacity = 90);} -#colorbox{outline:0;} - #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px 0;} - #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px 0;} - #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px -29px;} - #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px -29px;} - #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;} - #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;} - #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;} - #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;} - #cboxContent{background:#fff; overflow:hidden;} - .cboxIframe{background:#fff;} - #cboxError{padding:50px; border:1px solid #ccc;} - #cboxLoadedContent{margin-bottom:28px;} - #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;} - #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;} - #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;} - #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} - - /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ - #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } - - /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ - #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} - - #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;} - #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxPrevious:hover{background-position:-75px -25px;} - #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxNext:hover{background-position:-50px -25px;} - #cboxClose{position:absolute; bottom:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxClose:hover{background-position:-25px -25px;} - -/* - The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill - when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9. - See: http://jacklmoore.com/notes/ie-transparency-problems/ -*/ -.cboxIE #cboxTopLeft, -.cboxIE #cboxTopCenter, -.cboxIE #cboxTopRight, -.cboxIE #cboxBottomLeft, -.cboxIE #cboxBottomCenter, -.cboxIE #cboxBottomRight, -.cboxIE #cboxMiddleLeft, -.cboxIE #cboxMiddleRight { - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); -} \ No newline at end of file diff --git a/gallery/resources/colorbox/1/images/loading.gif b/gallery/resources/colorbox/1/images/loading.gif deleted file mode 100644 index 0325c8dbfd962e2e21d50493eb04b110f29ce36f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8685 zcma*sdt4KDx`?hJAelTgt?~9mk$L#J<0a{qzXC_Ydshx7h8g*w0U}_b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gT6i}wx~;d6v)d9|2roq^r&9GzV`BE(@_gB zuWxK@jX!lzj=am2zBa6?Y(B6kR#f|$7Xcx=r!BMcJ(PUNi7#nOpmBhhe-Jjb#fN?h z8yqPQ?0k_Tv$sn*ckzu2V)SgdaV5y6X>pXZVhXrK3}B?tZqJ0k-%9Yfk zeeC#>l6KRn8v=qs}c0z(e{q};4z*ulH$lNE`ZeH1}dcwywXMYKO z-mAI5c#>Gayj4$>5Fpx$FK_#6T)(v)tqXimU$^I{Sb^QBh*+$62K>;{jmn0zYLXdt zJ6BD#^;E5-xKTkHSdoiHSFI@-L!_%}TZ&Cc@U&qM5+7V!2*Pl@?n2QK-13dG96~b)* diff --git a/gallery/resources/colorbox/3/colorbox.css b/gallery/resources/colorbox/3/colorbox.css deleted file mode 100644 index 1cebdff..0000000 --- a/gallery/resources/colorbox/3/colorbox.css +++ /dev/null @@ -1,45 +0,0 @@ -/* - Colorbox Core Style: - The following CSS is consistent between example themes and should not be altered. -*/ -#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} -#cboxWrapper {max-width:none;} -#cboxOverlay{position:fixed; width:100%; height:100%;} -#cboxMiddleLeft, #cboxBottomLeft{clear:left;} -#cboxContent{position:relative;} -#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} -#cboxTitle{margin:0;} -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} -#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} -.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} -.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} -#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} - -/* - User Style: - Change the following styles to modify the appearance of Colorbox. They are - ordered & tabbed in a way that represents the nesting of the generated HTML. -*/ -#cboxOverlay{background:#000; opacity: 0.9; filter: alpha(opacity = 90);} -#colorbox{outline:0;} - #cboxContent{margin-top:20px;background:#000;} - .cboxIframe{background:#fff;} - #cboxError{padding:50px; border:1px solid #ccc;} - #cboxLoadedContent{border:5px solid #000; background:#fff;} - #cboxTitle{position:absolute; top:-20px; left:0; color:#ccc;} - #cboxCurrent{position:absolute; top:-20px; right:0px; color:#ccc;} - #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} - - /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ - #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } - - /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ - #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} - - #cboxSlideshow{position:absolute; top:-20px; right:90px; color:#fff;} - #cboxPrevious{position:absolute; top:50%; left:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top left; width:28px; height:65px; text-indent:-9999px;} - #cboxPrevious:hover{background-position:bottom left;} - #cboxNext{position:absolute; top:50%; right:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top right; width:28px; height:65px; text-indent:-9999px;} - #cboxNext:hover{background-position:bottom right;} - #cboxClose{position:absolute; top:5px; right:5px; display:block; background:url(images/controls.png) no-repeat top center; width:38px; height:19px; text-indent:-9999px;} - #cboxClose:hover{background-position:bottom center;} diff --git a/gallery/resources/colorbox/3/images/loading.gif b/gallery/resources/colorbox/3/images/loading.gif deleted file mode 100644 index a32df5c0881b563e18f3660758009a4aec47a5a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6244 zcmZu#d010-y8dMkfrNxW2!|wugzaR5ummJ52>}uU1cX4?466u;EaFmUdgsA&63D`m zfXJdEB6X`;(Q4Ie9j$wB+fmyhZS9P;w%5_=OzX5Www-x;57@=dbMx=XAMgAA-tYU~ z@6+eyrmUzJ0wMT^7R=AjCn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hW_xKnrqlmy{0A0 zvt3!Wrd+svm|RrV)V#|>!}rahQm*QtgT6i}wx~;d6v)d9|2roq^r&9GzV`BE(@_gB zuWxK@jX!lzj=am2zBa6?Y(B6kR#f|$7Xcx=r!BMcJ(PUNi7#nOpmBhhe-Jjb#fN?h z8yqPQ?0k_Tv$sn*ckzu2V)SgdaV5y6X>pXZVhXrK3}B?tZqJ0k-%9Yfk zeeC#>l6KRn8v=qs}c0z(e{q};4z*ulH$lNE`ZeH1}dcwywXMYKO z-mAI5c#>Gayj4$>5Fpx$FK_#6T)(v)tqXimU$^I{Sb^QBh*+$62K>;{jmn0zYLXdt zJ6BD#^;E5-xKTkHSdoiHSFI@-L!_%}TZ&Cc@U&qM5+7V!2*Pl@?n2QK-13dG96~b)* diff --git a/gallery/resources/colorbox/4/colorbox.css b/gallery/resources/colorbox/4/colorbox.css deleted file mode 100644 index d475a34..0000000 --- a/gallery/resources/colorbox/4/colorbox.css +++ /dev/null @@ -1,66 +0,0 @@ -/* - Colorbox Core Style: - The following CSS is consistent between example themes and should not be altered. -*/ -#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} -#cboxWrapper {max-width:none;} -#cboxOverlay{position:fixed; width:100%; height:100%;} -#cboxMiddleLeft, #cboxBottomLeft{clear:left;} -#cboxContent{position:relative;} -#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} -#cboxTitle{margin:0;} -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} -#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} -.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} -.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} -#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} - -/* - User Style: - Change the following styles to modify the appearance of Colorbox. They are - ordered & tabbed in a way that represents the nesting of the generated HTML. -*/ -#cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);} -#colorbox{outline:0;} - #cboxTopLeft{width:25px; height:25px; background:url(images/border1.png) no-repeat 0 0;} - #cboxTopCenter{height:25px; background:url(images/border1.png) repeat-x 0 -50px;} - #cboxTopRight{width:25px; height:25px; background:url(images/border1.png) no-repeat -25px 0;} - #cboxBottomLeft{width:25px; height:25px; background:url(images/border1.png) no-repeat 0 -25px;} - #cboxBottomCenter{height:25px; background:url(images/border1.png) repeat-x 0 -75px;} - #cboxBottomRight{width:25px; height:25px; background:url(images/border1.png) no-repeat -25px -25px;} - #cboxMiddleLeft{width:25px; background:url(images/border2.png) repeat-y 0 0;} - #cboxMiddleRight{width:25px; background:url(images/border2.png) repeat-y -25px 0;} - #cboxContent{background:#fff; overflow:hidden;} - .cboxIframe{background:#fff;} - #cboxError{padding:50px; border:1px solid #ccc;} - #cboxLoadedContent{margin-bottom:20px;} - #cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;} - #cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;} - #cboxLoadingOverlay{background:#fff url(images/loading.gif) no-repeat 5px 5px;} - - /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ - #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } - - /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ - #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} - - #cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;} - #cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;} - #cboxNext{position:absolute; bottom:0px; left:63px; color:#444;} - #cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;} - -/* - The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill - when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9. - See: http://jacklmoore.com/notes/ie-transparency-problems/ -*/ -.cboxIE #cboxTopLeft, -.cboxIE #cboxTopCenter, -.cboxIE #cboxTopRight, -.cboxIE #cboxBottomLeft, -.cboxIE #cboxBottomCenter, -.cboxIE #cboxBottomRight, -.cboxIE #cboxMiddleLeft, -.cboxIE #cboxMiddleRight { - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); -} \ No newline at end of file diff --git a/gallery/resources/colorbox/4/images/loading.gif b/gallery/resources/colorbox/4/images/loading.gif deleted file mode 100644 index 1f3a2c0ab0f497e24318a2dad9abbfc990ccde24..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6244 zcmZWtd0bOx+I{c6$;}QSmnAGwmKY!eBqGQn5Fii;J3?3lA%MuDEQ;24I^WRu2FL=E zu!G1ZgQ(StRV!9oaIJ0asI?SZJ5_5pt)14^sa?LG-wjsB`F;2A`^P!wInVQ)_faJ! zgobI|fjjs&0cK}s=jZ1iK79DcAAj7tckkz)fByB?Uw`@Km;3kcH#Ifgy?ghIFTOZ_ z{P@kAH?Lp6J~cJ<U1SJ9fPL?z?4W zWmm3T>F@9F=;#<27^tbKsi>%!n3ymcjhi-Y+OT0mWo4yStF5lCE+{C-$;ko#@AG)f zNsG^36Bm;azak(IL#Q7-ex=dq;4zR{f3}uM!Fb$6KvLJ-(yAw2ixuk>Vge0vbLT== zj!0@C9qnUB?IlBe<)mz=8C8>m~HpI;nj#CShO7wMUcx-ZV=$8ge6z_O{NUg>{9&()Iy>&jGL8u2j zx24h%)+2$m@SQ`KTm1cAmaoY=_nv(aq@|4Ak<2f5NUi|Rx0apPIn;l}XNB%4@ps%< zkn+BZY5x`g24QZEqi9smKVR;0alAajX(MY zler==XD;-$y?kceqf6O`S^d1g@2V?$nV+_7|4G87SrwwwDRE?UfB}0T1b}g%2~Y|F zCau|E&}@hfHk#GNMa$P?X4fhS$w=uAQycMyW&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qfOPfTRGauA z-F{O-OdwR_J%`6ygbrvuDKzML?3Ubg4(| zvAsC_kWYW3LzU<=wIHx_u$3$T)H%j8J@FdJ-e-vN_O$16fPlA`aPo{z{eqy%c;pq4 zCog@pGH_+doPtZ9@EBBpIa&r*M-7UG#?7MoKX1IeE8a!d3V|z&(ho!5E^IHzohJ^(M6*?V| z#<1q*0uCUh-dgQOzoX|=D)d|j-G*}&sw&dC^XKsL0%xGSs|Dyrnmk|E$x(NM*b6{)8Zqh*Lt6%FU|=glBaMsnf0F4MN8xs zOF{j%qP6{I+S2;Qz!6JU-=rQ@?K75omQ-$9+q_RL4WTmes#ThUBB`y%xpSEZTjFEA zy&J^GE=o~4gZy~m`T~O|A}+R~RasHYn+Q<@0<+ou=ygG4V2#felj^!EN^bL&nG-m5 zd45cqsVAsn&OPC;g6+za&~u>Ey}b8Jh+sb(h7NY4-qI(mlW6*%PN z*nNPcmua;nNl|C8)U?~TUppgnwzs#_T$*Q~>Uo2j&3}O45s5yk2fS<_{SPja<*Hfy z0dDVcRe?(B7~A*y<>j-wzv#kC>?cY~#-7FsD!kFCSn&k-K5KZ>v0O6()XmL&O@uDS zZDoOplzOgPQ$ZHGxqJ6O`g(=e1~Cj8b{d1RL5k>ga+Y6xwDJIJ@yttY59SFd+ZePa z;GBuN48KoBQpOeP>a~_S`l45e%!ZKseDB21t77loMdnpeV(J?E(L6z&f#-Xqs)xU0 tdHkwF>3qaIP9@!b~ecoltuO85T6Mm{tv&#^XUKp diff --git a/gallery/resources/colorbox/5/colorbox.css b/gallery/resources/colorbox/5/colorbox.css deleted file mode 100644 index 889f20f..0000000 --- a/gallery/resources/colorbox/5/colorbox.css +++ /dev/null @@ -1,58 +0,0 @@ -/* - Colorbox Core Style: - The following CSS is consistent between example themes and should not be altered. -*/ -#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} -#cboxWrapper {max-width:none;} -#cboxOverlay{position:fixed; width:100%; height:100%;} -#cboxMiddleLeft, #cboxBottomLeft{clear:left;} -#cboxContent{position:relative;} -#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} -#cboxTitle{margin:0;} -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} -#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} -.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} -.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} -#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} - -/* - User Style: - Change the following styles to modify the appearance of Colorbox. They are - ordered & tabbed in a way that represents the nesting of the generated HTML. -*/ -#cboxOverlay{background:#000; opacity: 0.9; filter: alpha(opacity = 90);} -#colorbox{outline:0;} - #cboxTopLeft{width:14px; height:14px; background:url(images/controls.png) no-repeat 0 0;} - #cboxTopCenter{height:14px; background:url(images/border.png) repeat-x top left;} - #cboxTopRight{width:14px; height:14px; background:url(images/controls.png) no-repeat -36px 0;} - #cboxBottomLeft{width:14px; height:43px; background:url(images/controls.png) no-repeat 0 -32px;} - #cboxBottomCenter{height:43px; background:url(images/border.png) repeat-x bottom left;} - #cboxBottomRight{width:14px; height:43px; background:url(images/controls.png) no-repeat -36px -32px;} - #cboxMiddleLeft{width:14px; background:url(images/controls.png) repeat-y -175px 0;} - #cboxMiddleRight{width:14px; background:url(images/controls.png) repeat-y -211px 0;} - #cboxContent{background:#fff; overflow:visible;} - .cboxIframe{background:#fff;} - #cboxError{padding:50px; border:1px solid #ccc;} - #cboxLoadedContent{margin-bottom:5px;} - #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;} - #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} - #cboxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-weight:bold; color:#7C7C7C;} - #cboxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C;} - - /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ - #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; position:absolute; bottom:-29px; background:url(images/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;} - - /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ - #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} - - #cboxPrevious{left:0px; background-position: -51px -25px;} - #cboxPrevious:hover{background-position:-51px 0px;} - #cboxNext{left:27px; background-position:-75px -25px;} - #cboxNext:hover{background-position:-75px 0px;} - #cboxClose{right:0; background-position:-100px -25px;} - #cboxClose:hover{background-position:-100px 0px;} - - .cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;} - .cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;} - .cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;} - .cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0px;} \ No newline at end of file diff --git a/gallery/resources/colorbox/5/images/loading.gif b/gallery/resources/colorbox/5/images/loading.gif deleted file mode 100644 index dba33c8167bfd0bfd0abd5ad0733c901e5cd227e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8685 zcmb8!c|a5A-Y@XUWU`UT3Rxx~gb*NLz_1v>1rw663qb`DQ3E2PQbkG7U7Oaf$~ zm;_YBrGRMBE=F96w#Tw*ky-_{R$F@x;!@h$zEo{%mot4QL9L$q-uK?i-~97@@_l~G zGpXq*35msGKn(n(2C!QfvHPE6zdpgn|AD=hfPFrQeKU$Z`X0O1gT1*8`|C{X;R9^+ z3ikbd?C}Kl(?jg;4Q%Wh_MhX}SGTbKL)g!cu_r%a-;QCw{fhnmJNDo%wn>29o!Egb*!4c_<1XxNGiJ%gOexrVO<0v2Ypue%>al-Z z!Wx%hwHcT(8QWEg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J~GbO4n5NeO*5 z8_n`Gy$?b7)+R9p0m6dcmcXK&xs#ofM8ZFxKdqIXI6U%laMQx^S8J3mCz;a~60O}V z44xJnfwEE*fzx-Gm}(y}6auh<-q1{f1O)k{P74F3&PauEkUo~p`@uX4B`{D?A3R|5 zjSPwnw|go^JN~U*xC8(0$!GD7x0}DEM@+%LrC)9Lk|f8_LPMvs-9$r33qcUT4ci-| zXjTv@wtAtuI;Ex>i5}pJ2T@W3QB#sodF+bmHCt?!fqlD2;(rTXh=ygE#02p)t>!{j z0klz(TeL~`ij%NY`C6=lrUIe$_Sk?lDHU}SOxJ6m)<*S}cWjFICx!S(J?p;!sZ>^A diff --git a/gallery/resources/colorbox/jquery.colorbox.js b/gallery/resources/colorbox/jquery.colorbox.js deleted file mode 100644 index 0b43bf1..0000000 --- a/gallery/resources/colorbox/jquery.colorbox.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! - Colorbox 1.6.1 - license: MIT - http://www.jacklmoore.com/colorbox -*/ -(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),y.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=(l!==!1?Math.min(h,a(l,"x")):h)-z-D,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-N-j,I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(S).hide(),y.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
"),w()}}function p(){y||(V=!1,E=t(i),y=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),M=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),x=n(se,"Wrapper"),b=n(se,"Content").append(S=n(se,"Title"),F=n(se,"Current"),P=t('