diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index ae166c0..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -# Changelog - -## 0.9.3 (02/09/2018) -* Empire view is handled back in AGR -* Fix Solar plants produced energy -* Tooltip of planets/moons appear again in the galaxy view - -## 0.9.2 (08/05/2018) -* Added new credentials and new donate button -* Added Mmorp-Stat tool in menu -* Fixed Mines name that was showing officiers names -* Galaxy view : Removed shadows images -* Galaxy view : Moved Player rank from alliance column to player name column -* Galaxy view : Fixed direction on space bar key press event -* Fleet 3 view : Fixed deuterium computation that can be transportable diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 848f2ec..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,25 +0,0 @@ -const gulp = require('gulp'); -const watch = require('gulp-watch'); -const uglify = require('gulp-uglify'); - -const SRC = 'src/*.js'; -const DEST = 'js'; - -gulp.task('stream', function () { - // Endless stream mode - return watch(SRC, { ignoreInitial: false }) - .pipe(uglify()).pipe(gulp.dest(DEST)); -}); - -gulp.task('callback', function () { - // Callback mode, useful if any plugin in the pipeline depends on the `end`/`flush` event - return watch(SRC, function () { - gulp.src(SRC) - .pipe(uglify()).pipe(gulp.dest(DEST)); - }); -}); - -gulp.task('uglify-js', function () { - // Callback mode, useful if any plugin in the pipeline depends on the `end`/`flush` event - return gulp.src(SRC).pipe(uglify()).pipe(gulp.dest(DEST)); -}); \ No newline at end of file diff --git a/js/agb_basic.js b/js/agb_basic.js index cc5d1c7..abebcb4 100644 --- a/js/agb_basic.js +++ b/js/agb_basic.js @@ -1,23 +1,25 @@ -if (!AGB) var AGB = {}; +if (!AGB){ + var AGB = {}; +} AGB.Time = { timestamp: function() { return Math.floor(Date.now() / 1e3); }, timestampMinute: function() { - return Math.floor((Date.now() - 1381e9) / 6e4); + return Math.floor((Date.now() - 1381000000000) / 60000); }, timestampMinuteConvert: function(a) { - return 1e3 < a ? 60 * (+a || 0) + 1381e6 : 0; + return 1000 < a ? 60 * (+a || 0) + 1381000000 : 0; } }; var VAL = { - choose: function(a) { - return 0 < a ? arguments[a] : ""; + choose: function(value) { + return 0 < value ? arguments[value] : ""; }, check: function(a) { for (var b = 1; b < arguments.length; b++) - if (a === arguments[b]) return !0; - return !1; + if (a === arguments[b]) return true; + return false; }, status: function(a, b, c, d) { return 0 > a ? b : 0 < a ? d : c; @@ -134,7 +136,7 @@ var VAL = { compare: function(a, b) { return "string" === typeof a && "string" === typeof a ? a.length === b.length && a === b - : !1; + : false; }, getAttribute: function(a, b) { return "string" === typeof a diff --git a/js/agb_chrome.js b/js/agb_chrome.js index c7135e3..d85907b 100644 --- a/js/agb_chrome.js +++ b/js/agb_chrome.js @@ -28,7 +28,7 @@ AGB.Manager = { " DataBase: " + AGB.DataBase.status + (a || ""), - !0 + true ); }); }, @@ -102,7 +102,7 @@ chrome.runtime.onMessage.addListener(function(a, c, b) { AGB[a.page].Messages(a.role, a.para, b, c), b) ) - return !0; + return true; }); AGB.Storage = { status: 0, @@ -148,7 +148,7 @@ AGB.Storage = { OBJ.is(a) && a.key && ((c = a.sync ? "sync" : "local"), - AGB.Core.Log("Delete - storage - " + a.key, !0), + AGB.Core.Log("Delete - storage - " + a.key, true), chrome.storage[c].remove(a.key)); }, List: function(a) { @@ -156,13 +156,13 @@ AGB.Storage = { (chrome.storage.local.get(null, function(c) { OBJ.iterate(c, function(b) { (a.filter && 0 !== STR.check(b).indexOf(a.filter)) || - AGB.Core.Log("List - storage - " + b, !0); + AGB.Core.Log("List - storage - " + b, true); }); }), chrome.storage.sync.get(null, function(c) { OBJ.iterate(c, function(b) { (a.filter && 0 !== STR.check(b).indexOf(a.filter)) || - AGB.Core.Log("List - sync - " + b, !0); + AGB.Core.Log("List - sync - " + b, true); }); })); }, @@ -171,14 +171,14 @@ AGB.Storage = { (chrome.storage.local.get(null, function(c) { OBJ.iterate(c, function(b) { (a.filter && 0 !== STR.check(b).indexOf(a.filter)) || - (AGB.Core.Log("Delete - storage - " + b, !0), + (AGB.Core.Log("Delete - storage - " + b, true), chrome.storage.local.remove(b)); }); }), chrome.storage.sync.get(null, function(c) { OBJ.iterate(c, function(b) { (a.filter && 0 !== STR.check(b).indexOf(a.filter)) || - (AGB.Core.Log("Delete - sync - " + b, !0), + (AGB.Core.Log("Delete - sync - " + b, true), chrome.storage.sync.remove(b)); }); })); diff --git a/js/agb_common.js b/js/agb_common.js index f5b474d..f7b7142 100644 --- a/js/agb_common.js +++ b/js/agb_common.js @@ -83,14 +83,14 @@ AGB.Option = { b = AGB.Data.get("Option", "Data", "version"); a.version && 12 > a.version && - (AGB.Core.Log("Option - Upgrade version 12 ", !0), + (AGB.Core.Log("Option - Upgrade version 12 ", true), (a.F01 = 0), (a.F13 = a.FH0 = 1), (a.F70 = 2), (a.FA0 = 3), (a.F80 = a.F90 = a.FL0 = 4), (a.F63 = "")); - a.version !== b && ((a.version = b), (a.changed = !0), AGB.Data.Change()); + a.version !== b && ((a.version = b), (a.changed = true), AGB.Data.Change()); }, Save: function(a) { var b, c, d, e, f, g; @@ -137,7 +137,7 @@ AGB.Option = { }), (c.status = 1)), (a.data = null), - (c.changed = !0), + (c.changed = true), AGB.Data.Change(d), AGB.Token.InitInfo(a), AGB.Data.Sync(a), @@ -155,7 +155,7 @@ AGB.Option = { id: e, value: AGB.Option.set(c, e, a.value) }), - d !== e.value && ((c.changed = !0), AGB.Data.Change()), + d !== e.value && ((c.changed = true), AGB.Data.Change()), b && b(e)) : e && (c[e] = a.value)); }, @@ -266,7 +266,7 @@ AGB.Label = { b.open( "GET", a.urlUni + "/api/localization.xml?nocache=" + AGB.Time.timestamp(), - !0 + true ), b.overrideMimeType("text/html"), b.setRequestHeader("Cache-Control", "no-cache"), @@ -301,7 +301,7 @@ AGB.Label = { a.urlUni + "/api/localization.xml" + ((c.status = 1), ""), - !0 + true ); } }), @@ -359,7 +359,7 @@ AGB.Label = { b.KD0M + ":" + b.KD0S, - !0 + true ), AGB.Data.setStorage(c, "Label", "Loca", b), OBJ.copy(b, AGB.Label.Data[c]), @@ -1185,7 +1185,7 @@ AGB.Units = { a && c(a.planet, a.tabs, a.action, a.data); }), a.planets && (d(a.planets), AGB.Units.SummarizePlanets(a)), - (e.changed = !0), + (e.changed = true), AGB.Data.Change()); b && b(); }, @@ -1529,7 +1529,7 @@ AGB.Construction = { Upgrade: function(a) { var b; b = AGB.Data.get("Construction", "Data", "version"); - a.version !== b && ((a.changed = !0), (a.version = b), AGB.Data.Change()); + a.version !== b && ((a.changed = true), (a.version = b), AGB.Data.Change()); }, Save: function(a) { var b, c, d; @@ -1565,7 +1565,7 @@ AGB.Construction = { (g = AGB.Task.getCoordsType(f))) && (AGB.Construction.update(d, f), OBJ.is(c[g]) ? c[g].unshift(f) : (c[g] = [f]), - (c.changed = !0), + (c.changed = true), AGB.Data.Change(), b({ tab: "Construction", @@ -1577,7 +1577,7 @@ AGB.Construction = { OBJ.is(c[g]) && c[g][h] && (c[g].splice(h, 1), - (c.changed = !0), + (c.changed = true), AGB.Data.Change(), b({ tab: "Construction", @@ -1598,7 +1598,7 @@ AGB.Construction = { (g = f.coordstype), OBJ.is(c[g]) ? c[g].push(f) : (c[g] = [f]), (h = c[g].length - 1), - (c.changed = !0), + (c.changed = true), AGB.Data.Change(), b({ tab: "Construction", @@ -1635,7 +1635,7 @@ AGB.Construction = { f.level += l; AGB.Construction.update(d, f); c[g][h] = f; - c.changed = !0; + c.changed = true; AGB.Data.Change(); b({ tab: "Construction", data: g + ":" + h }); } @@ -1915,7 +1915,7 @@ AGB.Token = { c = AGB.Token.Data[a]; OBJ.is(c[b]) || (c[b] = {}); c[b].version !== d && - ((c[b].changed = !0), (c[b].version = d), AGB.Data.Change()); + ((c[b].changed = true), (c[b].version = d), AGB.Data.Change()); }, Save: function(a) { var b, c; @@ -1970,16 +1970,16 @@ AGB.Token = { ((h += "|" + STR.check(a.coords)), a.time && (h += "|" + a.time))), 80 > f ? "set" === a.action - ? ((p.changed = !0), (c[e].changed = !0), (c[e][g] = h)) + ? ((p.changed = true), (c[e].changed = true), (c[e][g] = h)) : "remove" === a.action && g in c[e] && - ((p.changed = !0), (c[e].changed = !0), delete c[e][g]) + ((p.changed = true), (c[e].changed = true), delete c[e][g]) : 81 === f && OBJ.is(c.Current) && ((g = e[0] + g), "set" === a.action - ? ((p.changed = !0), - (c.Current.changed = !0), + ? ((p.changed = true), + (c.Current.changed = true), (c.Current[g] = h), (l = 0), OBJ.iterate(c.Current, function(a) { @@ -1991,8 +1991,8 @@ AGB.Token = { })) : "remove" === a.action && g in c.Current && - ((p.changed = !0), - (c.Current.changed = !0), + ((p.changed = true), + (c.Current.changed = true), delete c.Current[g])), p.changed && (OBJ.is(AGB.Token.Sort[d]) && (AGB.Token.Sort[d][e] = null), @@ -2175,7 +2175,7 @@ AGB.Fleet = { ? (c[b] = OBJ.is(d[b]) && !f ? d[b] : 3 === a.tab ? [] : {}) : a.tab && (c[b] = {}); }), - f && ((c.changed = !0), AGB.Data.Change()); + f && ((c.changed = true), AGB.Data.Change()); c = d = e = f = null; }, Save: function(a) { @@ -2201,9 +2201,9 @@ AGB.Fleet = { b && (OBJ.is(b[d]) || (b[d] = {}), OBJ.iterate(a.data, function(c) { - b[d][c] !== a.data[c] && ((b[d][c] = a.data[c]), (e = !0)); + b[d][c] !== a.data[c] && ((b[d][c] = a.data[c]), (e = true)); }), - e && ((b.changed = !0), AGB.Data.Change())); + e && ((b.changed = true), AGB.Data.Change())); b = c = d = e = null; }, Action: function(a) { @@ -2246,7 +2246,7 @@ AGB.Fleet = { c < e.length && !(e[c] && b.Last.push(e[c]), 8 < b.Last.length); c++ ); - b.changed = !0; + b.changed = true; AGB.Data.Change(); } else 5 === e @@ -2367,11 +2367,11 @@ AGB.DataBase = { var c; AGB.App.getUni({ keyUni: a }) && AGB.DataBase.Info[b] && - (AGB.Core.Log("DataBase - Remove : " + a + "_" + b, !0), - (c = !0), + (AGB.Core.Log("DataBase - Remove : " + a + "_" + b, true), + (c = true), AGB.DataBase.set(a + "_" + b, "status", 0), OBJ.iterate(AGB.DataBase.Info, function(b) { - -3 === AGB.DataBase.get(a + "_" + b, "status") && (c = !1); + -3 === AGB.DataBase.get(a + "_" + b, "status") && (c = false); }), c && AGB.DataBase.set(a, "status", 0)); } @@ -2404,7 +2404,7 @@ AGB.DataBase = { (d = AGB.DataBase.get(c, "status")), 1 === d || 2 === d ? c : "" ); - a.error = !0; + a.error = true; } return ""; }, @@ -2701,8 +2701,8 @@ AGB.DataBase = { l.objectStoreNames.contains(f) || ((f = l.createObjectStore(f, { keyPath: f })), "Universe" === b && - (f.createIndex("I", "I", { unique: !1 }), - f.createIndex("c", "c", { unique: !1 }))); + (f.createIndex("I", "I", { unique: false }), + f.createIndex("c", "c", { unique: false }))); c(d, 2); }), (e.onsuccess = function(a) { @@ -2748,7 +2748,7 @@ AGB.DataBase = { AGB.Time.timestamp() - b.timestampRead > AGB.DataBase.readLimit) ? ((c = new XMLHttpRequest()), (c.timeout = 2e3), - c.open("HEAD", a.urlUni + AGB.DataBase.Info[a.tab].url, !0), + c.open("HEAD", a.urlUni + AGB.DataBase.Info[a.tab].url, true), (c.onerror = c.onload = function() { AGB.DataBase.isRead(a) && ((b.timestampRead = AGB.Time.timestamp()), @@ -2762,7 +2762,7 @@ AGB.DataBase = { AGB.Core.Log( "DataBase - ########## Problem: These OGame API is not available - " + a.tab, - !0 + true ))); AGB.DataBase.Read(a); }), @@ -2772,7 +2772,7 @@ AGB.DataBase = { -1 === d && AGB.Core.Log( "DataBase - Problem: Please restart your browser (" + a.key + ")", - !0 + true ), -2 === d && AGB.Core.Log( @@ -2780,7 +2780,7 @@ AGB.DataBase = { a.tab + " for the universe " + a.keyUni, - !0 + true ), AGB.DataBase.Read(a)); }, @@ -2887,7 +2887,7 @@ AGB.DataBase = { " (" + b + ")", - !0 + true ); d(a); } @@ -2909,7 +2909,7 @@ AGB.DataBase = { var e, f, g; 3 === AGB.DataBase.isRead(a) - ? (AGB.Core.Log("DataBase - Read : " + a.key, !0), + ? (AGB.Core.Log("DataBase - Read : " + a.key, true), (f = AGB.DataBase.Info[a.tab]), (e = AGB.DataBase.Data[a.key]), (e.loading = 0), @@ -2918,7 +2918,7 @@ AGB.DataBase = { loading: e.loading }), (g = new XMLHttpRequest()), - g.open("GET", a.urlUni + f.url, !0), + g.open("GET", a.urlUni + f.url, true), g.overrideMimeType("text/html"), (g.onerror = g.onload = function() { var d, e; @@ -2935,7 +2935,7 @@ AGB.DataBase = { : (AGB.Core.Log( "DataBase - ########## Problem: These OGame API is not available - " + f.url, - !0 + true ), c())); g = null; @@ -3184,7 +3184,7 @@ AGB.Tools = { c += encodeURI(OBJ.get(a.Planets[d], "name")) + "." + - ((+OBJ.get(a.Planets[d], "temp") || 0) + 40).toString(36) + + ((+OBJ.get(a.Planets[d], "tempMin") || 0) + 40).toString(36) + "." + AGB.Units.Get(b, d, "1").toString(36) + "." + diff --git a/js/agb_firefox.js b/js/agb_firefox.js index 21a01b5..32a07ab 100644 --- a/js/agb_firefox.js +++ b/js/agb_firefox.js @@ -16,7 +16,7 @@ AGB.Manager = { : AGB[a].Messages(b, JSON.parse(c || "{}"), null, e)); }, Start: function() { - AGB.Core.Log("Manager - Start", !0); + AGB.Core.Log("Manager - Start", true); var a; AGB.status = 1; AGB.Config.pathSkin = "chrome://skin/content/"; @@ -45,27 +45,27 @@ AGB.Manager = { " DataBase: " + AGB.DataBase.status + (1 < AGB.Config.beta ? " - Development mode" : ""), - !0 + true ); }); AGB.Core.Services.obs.addObserver( AGB.Manager.Check, "content-document-global-created", - !1 + false ); - AGB.Core.Services.obs.addObserver(AGB.Manager.Stop, "quit-application", !1); + AGB.Core.Services.obs.addObserver(AGB.Manager.Stop, "quit-application", false); }, Stop: function(a) { var b; AGB.Core.Services.obs.removeObserver( AGB.Manager.Check, "content-document-global-created", - !1 + false ); AGB.Core.Services.obs.removeObserver( AGB.Manager.Stop, "quit-application", - !1 + false ); AGB.App.Stop(); AGB.status = 0; @@ -83,11 +83,11 @@ AGB.Manager = { }, WindowListener: { setupBrowserUI: function(a) { - AGB.Core.Log("AntiGameOrigin: New Window", !0); + AGB.Core.Log("AntiGameOrigin: New Window", true); }, tearDownBrowserUI: function(a) {}, onOpenWindow: function(a) { - AGB.Core.Log("AntiGameOrigin: New Window", !0); + AGB.Core.Log("AntiGameOrigin: New Window", true); }, onCloseWindow: function(a) {}, onWindowTitleChange: function(a, b) {} @@ -103,13 +103,13 @@ AGB.Manager = { ? a.addEventListener( "DOMContentLoaded", function f() { - a.removeEventListener("DOMContentLoaded", f, !1); + a.removeEventListener("DOMContentLoaded", f, false); "about:blank" === a.location.href || a.AGO_started || ((d = AGB.App.Check(a.location.href)), OBJ.is(d) && d.mode && AGB.Manager.Load(d, a)); }, - !1 + false ) : ((d = AGB.App.Check(a.location.href)), OBJ.is(d) && d.mode && AGB.Manager.Load(d, a))); @@ -266,7 +266,7 @@ AGB.Storage = { }, Remove: function(a) { if (OBJ.is(a) && a.key) { - AGB.Core.Log("Delete - storage - " + a.key, !0); + AGB.Core.Log("Delete - storage - " + a.key, true); try { AGB.Storage.local.prefHasUserValue(a.key) && AGB.Storage.local.clearUserPref(a.key); @@ -280,13 +280,13 @@ AGB.Storage = { OBJ.iterateArray(b, function(b) { b && ((a.filter && 0 !== STR.check(b).indexOf(a.filter)) || - AGB.Core.Log("List - storage - " + b, !0)); + AGB.Core.Log("List - storage - " + b, true)); }), (b = AGB.Storage.sync.getChildList("", {})), OBJ.iterateArray(b, function(b) { b && ((a.filter && 0 !== STR.check(b).indexOf(a.filter)) || - AGB.Core.Log("List - syncflag - " + b, !0)); + AGB.Core.Log("List - syncflag - " + b, true)); })); }, RemoveFilter: function(a) { @@ -295,7 +295,7 @@ AGB.Storage = { ((b = AGB.Storage.local.getChildList("", {})), OBJ.iterateArray(b, function(b) { if (b && (!a.filter || 0 === STR.check(b).indexOf(a.filter))) { - AGB.Core.Log("Delete - storage - " + b, !0); + AGB.Core.Log("Delete - storage - " + b, true); try { AGB.Storage.local.clearUserPref(b); } catch (d) {} @@ -304,7 +304,7 @@ AGB.Storage = { (b = AGB.Storage.sync.getChildList("", {})), OBJ.iterateArray(b, function(b) { if (b && (!a.filter || 0 === STR.check(b).indexOf(a.filter))) { - AGB.Core.Log("Delete - syncflag - " + b, !0); + AGB.Core.Log("Delete - syncflag - " + b, true); try { AGB.Storage.sync.clearUserPref(b); } catch (d) {} @@ -317,7 +317,7 @@ AGB.Storage = { a.key[b] ? 0 === AGB.Storage.sync.getPrefType(b) && (AGB.Core.Log("AntiGame: Sync - Set Sync flag " + b), - AGB.Storage.sync.setBoolPref(b, !0)) + AGB.Storage.sync.setBoolPref(b, true)) : AGB.Storage.sync.getPrefType(b) && (AGB.Core.Log("AntiGame: Sync - Remove flag " + b), AGB.Storage.sync.clearUserPref(b)); diff --git a/js/agb_init.js b/js/agb_init.js index 87017ad..b2e5c69 100644 --- a/js/agb_init.js +++ b/js/agb_init.js @@ -191,7 +191,7 @@ AGB.App = { var b, c; if ((c = AGB.App.getPlayer(a, "copy"))) (b = new XMLHttpRequest()), - b.open("POST", "http://antigame.de/antigame/ago_appdata.php", !0), + b.open("POST", "http://antigame.de/antigame/ago_appdata.php", true), b.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), (b.onerror = b.onload = function() { var c, g, e; @@ -216,7 +216,7 @@ AGB.App = { c.versionUpdate + "http://antigame.de/antigame/ago_appdata.php" + (e.versionFinal ? "" : " - failed !"), - !0 + true )); }), b.send( @@ -368,9 +368,9 @@ AGB.Data = { AGB.Construction.Init(a, d); AGB.Item.Init(a); AGB.Data.Status[c] = 1; - b && b(!0); + b && b(true); })) - : b && b(!1); + : b && b(false); }, Change: function() { AGB.Core.clearTimeout(AGB.Data.changeTimeout); @@ -412,7 +412,7 @@ AGB.Data = { (c[b + "_SYNC_" + a + "_" + e] = d); }), AGB.Storage.Sync({ - sync: !0, + sync: true, mode: d, key: c })); @@ -434,7 +434,7 @@ AGB.Data = { "&header=" + encodeURIComponent(JSON.stringify(a.data.Sync_Data)); c = new XMLHttpRequest(); - c.open("POST", "http://antigame.de/antigame/usave/ago_sync.php", !0); + c.open("POST", "http://antigame.de/antigame/usave/ago_sync.php", true); c.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); c.onerror = c.onload = function() { b && @@ -451,7 +451,7 @@ AGB.Data = { OBJ.iterate(a.data, function(b) { c[a.keyPlayer + "_SYNC_" + b] = JSON.stringify(a.data[b]); }); - AGB.Storage.Set({ sync: !0, data: c }, function(c) { + AGB.Storage.Set({ sync: true, data: c }, function(c) { b && ((a.status = c), (a.error = -1 === c), @@ -595,7 +595,7 @@ AGB.Data = { e.open( "POST", "http://antigame.de/antigame/usave/ago_sync.php", - !0 + true ), e.setRequestHeader( "Content-type", @@ -606,7 +606,7 @@ AGB.Data = { b = 200 === +e.status && e.responseText ? OBJ.parse(e.responseText) - : { error: !0 }; + : { error: true }; "restore" === a.action ? d(b) : c(b); }), e.send(f)) @@ -617,7 +617,7 @@ AGB.Data = { 2 <= AGB.Data.get(a, b, "storage") && (f[g + "_SYNC_" + a + "_" + b] = a + "_" + b); }), - AGB.Storage.Get({ sync: !0, key: f }, function(b) { + AGB.Storage.Get({ sync: true, key: f }, function(b) { var e = {}; OBJ.iterate(b, function(a) { var c = STR.check(a).split("_SYNC_")[1]; @@ -634,21 +634,21 @@ AGB.Data = { c = AGB.App.getPlayer(a, "copy"); if (AGB.Data.isStatus(c)) { d = a.mode; - e = (g = VAL.check(d, "acc", "ago")) || !1; + e = (g = VAL.check(d, "acc", "ago")) || false; if (g || "Account" === d) - (e = !0), + (e = true), AGB.Data.removeStorageGroup(a, "App"), AGB.Data.removeStorageGroup(a, "Label"), AGB.Data.removeStorageGroup(a, "Units"), AGB.Data.removeStorageGroup(a, "Fleet"), AGB.Data.removeStorageGroup(a, "Messages"); - if (g || "Token" === d) (e = !0), AGB.Data.removeStorageGroup(a, "Token"); + if (g || "Token" === d) (e = true), AGB.Data.removeStorageGroup(a, "Token"); if (g || "Panel" === d) - (e = !0), + (e = true), AGB.Data.removeStorageGroup(a, "Panel"), AGB.Data.removeStorageGroup(a, "Construction"); if (g || "Option" === d) - (e = !0), AGB.Data.removeStorageGroup(a, "Option"); + (e = true), AGB.Data.removeStorageGroup(a, "Option"); (g || "DataBase" === d) && AGB.DataBase.Remove(a); "acc" === d && AGB.Storage.RemoveFilter({ filter: c }); "ago" === d && AGB.Storage.RemoveFilter({ filter: "" }); @@ -1082,7 +1082,7 @@ AGB.Uni = { b.open( "GET", a.urlUni + "/api/serverData.xml?nocache=" + AGB.Time.timestamp(), - !0 + true ), b.overrideMimeType("text/html"), b.setRequestHeader("Cache-Control", "no-cache"), @@ -1110,7 +1110,7 @@ AGB.Uni = { a.urlUni + "/api/serverData.xml" + ((g = 1), ""), - !0 + true )); }), b.send(null)); diff --git a/js/agb_main.js b/js/agb_main.js index a14b38b..93f2e0b 100644 --- a/js/agb_main.js +++ b/js/agb_main.js @@ -86,7 +86,7 @@ AGB.Panel = { b = AGB.Panel.Data[c]; if (c && b && (c = AGB.Panel.getTab(a)) && a.key) { if (OBJ.is(a.value) || b[c][a.key] !== a.value) - (b.changed = !0), AGB.Data.Change(); + (b.changed = true), AGB.Data.Change(); b[c][a.key] = a.value; } }, diff --git a/js/agb_para.js b/js/agb_para.js index bb00d0b..0a9b7dd 100644 --- a/js/agb_para.js +++ b/js/agb_para.js @@ -74,7 +74,7 @@ AGB.Para = { U32: [1, 1, 1, 0, 1, 1], U33: [1, 1, 0, 0, 0, 1], U34: [1, 1, 1, 0, 1, 1], - U41: [1, 1, 1], + disable_auto_complete: [1, 1, 1], U51: [2, 1, 1], U52: [2, 1, 1], U60: [1, 1, 1, 0, 1, 1], diff --git a/js/basics.js b/js/basics.js index 5f8c416..5f43dcd 100644 --- a/js/basics.js +++ b/js/basics.js @@ -1,105 +1,112 @@ var DOM = { - query: function(a, b) { - return "string" === typeof a - ? b - ? "object" === typeof b - ? b.querySelector(a) - : "id" === b - ? document.getElementById(a) - : document.getElementById(b) - ? document.getElementById(b).querySelector(a) - : null - : document.querySelector(a) - : a; - }, - queryAll: function(a, b) { - return "string" === typeof a - ? (b || document).querySelectorAll(a) - : a && "object" === typeof a && "length" in a - ? a + query: function(selector, type) { + if("string" === typeof selector){ + if(type){ + if("object" === typeof type){ + return type.querySelector(selector) + }else if(type === 'id'){ + return document.getElementById(selector) + }else if(document.getElementById(type)){ + return document.getElementById(type).querySelector(selector) + }else{ + return null + } + }else{ + return document.querySelector(selector) + } + }else{ + return selector + } + }, + queryAll: function(selector, parentSelector) { + return "string" === typeof selector + ? (parentSelector || document).querySelectorAll(selector) + : selector && "object" === typeof selector && "length" in selector + ? selector : []; }, - findParent: function(a, b, c, d) { - if ((a = DOM.query(a, b)) && c) - for (d = d || 0; a && 0 <= d; ) { - if (a.id === c) return a; - d--; - a = a.parentNode; + findParent: function(selector, selectorType, idName, nbParentNode) { + if ((selector = DOM.query(selector, selectorType)) && idName) + for (nbParentNode = nbParentNode || 0; selector && 0 <= nbParentNode; ) { + if (selector.id === idName) return selector; + nbParentNode--; + selector = selector.parentNode; } return null; }, - iterate: function(a, b) { + iterate: function(objectToIterate, callback) { var c; - if (a && "object" === typeof a && "length" in a) - for (c = 0; c < a.length; c++) a[c] && b(a[c]); + if (objectToIterate && "object" === typeof objectToIterate && "length" in objectToIterate) + for (c = 0; c < objectToIterate.length; c++) objectToIterate[c] && callback(objectToIterate[c]); }, - iterateChildren: function(a, b) { - if (a) - for (var c = a.firstChild; c; c = c.nextSibling) - 1 === c.nodeType && b(c); + iterateChildren: function(parentElement, callback) { + if (parentElement) + for (var c = parentElement.firstChild; c; c = c.nextSibling) + 1 === c.nodeType && callback(c); }, - hasChildren: function(a) { - return a && a.children ? a.children.length : 0; + hasChildren: function(element) { + return element && element.children ? element.children.length : 0; }, - getChildren: function(a, b) { - return a && a.children ? a.children[b] : null; + getChildren: function(element, callback) { + return element && element.children ? element.children[callback] : null; }, - getSelectedNode: function(a) { - return a && a.options && "selectedIndex" in a - ? a.options[a.selectedIndex] + getSelectedNode: function(element) { + return element && element.options && "selectedIndex" in element + ? element.options[element.selectedIndex] : null; }, - getChildnodeByName: function(a, b) { - if (a && a.children) - for (var c = 0; c < a.children.length; c++) - if (a.children[c].tagName === b) return a.children[c]; + getChildnodeByName: function(element, callback) { + if (element && element.children) + for (var c = 0; c < element.children.length; c++) + if (element.children[c].tagName === callback) return element.children[c]; return null; }, - prependChild: function(a, b) { - a && - b && - (a.childNodes.length - ? a.insertBefore(b, a.childNodes[0]) - : a.appendChild(b)); - }, - appendChild: function(a, b) { - a && b && a.appendChild(b); - }, - before: function(a, b) { - a && b && a.parentNode.insertBefore(b, a); - }, - after: function(a, b) { - a && - b && - (a.nextElementSibling - ? a.parentNode.insertBefore(b, a.nextElementSibling) - : a.parentNode.appendChild(b)); - }, - replaceChildren: function(a, b) { - if (a) { - for (; a.firstChild; ) a.removeChild(a.firstChild); - b && a.appendChild(b); + prependChild: function(element, child) { + element && + child && + (element.childNodes.length + ? element.insertBefore(child, element.childNodes[0]) + : element.appendChild(child)); + }, + appendChild: function(element, child) { + element && child && element.appendChild(child); + }, + before: function(element, child) { + element && child && element.parentNode.insertBefore(child, element); + }, + after: function(element, child) { + element && + child && + (element.nextElementSibling + ? element.parentNode.insertBefore(child, element.nextElementSibling) + : element.parentNode.appendChild(child)); + }, + replaceChildren: function(element, children) { + if (element) { + for (; element.firstChild; ) element.removeChild(element.firstChild); + children && element.appendChild(children); } }, - removeChildren: function(a, b) { - var c; - if (a) - for (c = 0; c < a.childNodes.length; c++) - (b && a.childNodes[c].nodeType !== b) || - a.removeChild(a.childNodes[c]); - }, - create: function(a, b, c, d, e) { - var f; - a = document.createElement(a); - if (b) - if ("string" === typeof b) a.className = b; - else for (f in b) b.hasOwnProperty(f) && a.setAttribute(f, b[f]); - if (c) for (f in c) c.hasOwnProperty(f) && (a.style[f] = c[f]); - if (d) - for (f in d) d.hasOwnProperty(f) && a.addEventListener(f, d[f], !1); - if (e) for (f in e) e.hasOwnProperty(f) && (a[f] = e[f]); - return a; - }, parse: function (html) { + removeChildren: function(element, child) { + var tmp; + if (element) + for (tmp = 0; tmp < element.childNodes.length; tmp++) + (child && element.childNodes[tmp].nodeType !== child) || + element.removeChild(element.childNodes[tmp]); + }, + create: function(tagName, attributes, styles, eventListener, otherProperty) { + var tmpProperty, element; + element = document.createElement(tagName); + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmpProperty in attributes) attributes.hasOwnProperty(tmpProperty) && element.setAttribute(tmpProperty, attributes[tmpProperty]); + if (styles) for (tmpProperty in styles) styles.hasOwnProperty(tmpProperty) && (element.style[tmpProperty] = styles[tmpProperty]); + if (eventListener) + for (tmpProperty in eventListener) eventListener.hasOwnProperty(tmpProperty) && element.addEventListener(tmpProperty, eventListener[tmpProperty], false); + if (otherProperty) for (tmpProperty in otherProperty) otherProperty.hasOwnProperty(tmpProperty) && (element[tmpProperty] = otherProperty[tmpProperty]); + return element; + }, + parse: function (html) { // based on jQuery.buildFragment() // // jQuery JavaScript Library v1.11.3 @@ -148,436 +155,399 @@ var DOM = { return tmp; } }, - append: function(a, b, c, d, e, f, g) { - var h; - a = a - ? a.appendChild(document.createElement(b)) - : document.createElement(b); - if (c) - if ("string" === typeof c) a.className = c; - else for (h in c) c.hasOwnProperty(h) && a.setAttribute(h, c[h]); - if (d) for (h in d) d.hasOwnProperty(h) && (a.style[h] = d[h]); - if (e) - for (h in e) e.hasOwnProperty(h) && a.addEventListener(h, e[h], !1); - if (f) for (h in f) f.hasOwnProperty(h) && (a[h] = f[h]); - g && a.setAttribute("ago-data", JSON.stringify(g)); - return a; - }, - appendDIV: function(a, b, c) { - var d; - a = a - ? a.appendChild(document.createElement("div")) + append: function(element, tagName, attributes, styles, eventListener, otherProperty, agrData) { + var tmp; + element = element + ? element.appendChild(document.createElement(tagName)) + : document.createElement(tagName); + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + if (styles) for (tmp in styles) styles.hasOwnProperty(tmp) && (element.style[tmp] = styles[tmp]); + if (eventListener) + for (tmp in eventListener) eventListener.hasOwnProperty(tmp) && element.addEventListener(tmp, eventListener[tmp], false); + if (otherProperty) for (tmp in otherProperty) otherProperty.hasOwnProperty(tmp) && (element[tmp] = otherProperty[tmp]); + agrData && element.setAttribute("ago-data", JSON.stringify(agrData)); + return element; + }, + appendDIV: function(element, attributes, styles) { + var tmp; + element = element + ? element.appendChild(document.createElement("div")) : document.createElement("div"); - if (b) - if ("string" === typeof b) a.className = b; - else for (d in b) b.hasOwnProperty(d) && a.setAttribute(d, b[d]); - if (c) for (d in c) c.hasOwnProperty(d) && (a.style[d] = c[d]); - return a; - }, - appendTABLE: function(a, b, c, d) { - var e; - a = a - ? a.appendChild(document.createElement("table")) + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + if (styles) for (tmp in styles) styles.hasOwnProperty(tmp) && (element.style[tmp] = styles[tmp]); + return element; + }, + appendTABLE: function(element, attributes, styles, pixelsPerColumn) { + var tmp; + element = element + ? element.appendChild(document.createElement("table")) : document.createElement("table"); - a.style.tableLayout = "fixed"; - if (b) - if ("string" === typeof b) a.className = b; - else for (e in b) b.hasOwnProperty(e) && a.setAttribute(e, b[e]); - if (c) for (e in c) c.hasOwnProperty(e) && (a.style[e] = c[e]); - if (d) + element.style.tableLayout = "fixed"; + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + if (styles) for (tmp in styles) styles.hasOwnProperty(tmp) && (element.style[tmp] = styles[tmp]); + if (pixelsPerColumn) for ( - b = a.appendChild(document.createElement("colgroup")), e = 0; - e < d.length; - e++ + attributes = element.appendChild(document.createElement("colgroup")), tmp = 0; + tmp < pixelsPerColumn.length; + tmp++ ) - b.appendChild(document.createElement("col")).style.width = - d[e] + "px"; - return a; - }, - appendTR: function(a, b, c) { - var d; - a = a - ? a.appendChild(document.createElement("tr")) + attributes.appendChild(document.createElement("col")).style.width = + pixelsPerColumn[tmp] + "px"; + return element; + }, + appendTR: function(element, attributes, agrData) { + var tmp; + element = element + ? element.appendChild(document.createElement("tr")) : document.createElement("tr"); - if (b) - if ("string" === typeof b) a.className = b; - else for (d in b) b.hasOwnProperty(d) && a.setAttribute(d, b[d]); - c && - a.setAttribute( + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + agrData && + element.setAttribute( "ago-data", - "string" === typeof c ? c : JSON.stringify(c) + "string" === typeof agrData ? agrData : JSON.stringify(agrData) ); - return a; + return element; }, - appendTD: function(a, b, c, d, e) { - var f; - a = a - ? a.appendChild(document.createElement("td")) + appendTD: function(element, attributes, textContent, textType, date) { + var tmp; + element = element + ? element.appendChild(document.createElement("td")) : document.createElement("td"); - if (b) - if ("string" === typeof b) a.className = b; - else for (f in b) b.hasOwnProperty(f) && a.setAttribute(f, b[f]); - if ((c = HTML.setText(c, d, e))) a.textContent = c; - return a; - }, - appendLI: function(a, b, c, d, e) { - var f; - a = a - ? a.appendChild(document.createElement("li")) + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + if ((textContent = HTML.setText(textContent, textType, date))) element.textContent = textContent; + return element; + }, + appendLI: function(element, attributes, textContent, textType, date) { + var tmp; + element = element + ? element.appendChild(document.createElement("li")) : document.createElement("li"); - if (b) - if ("string" === typeof b) a.className = b; - else for (f in b) b.hasOwnProperty(f) && a.setAttribute(f, b[f]); - if ((c = HTML.setText(c, d, e))) a.textContent = c; - return a; - }, - appendSPAN: function(a, b, c, d, e) { - var f; - a = a - ? a.appendChild(document.createElement("span")) + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + if ((textContent = HTML.setText(textContent, textType, date))) element.textContent = textContent; + return element; + }, + appendSPAN: function(element, attributes, textContent, textType, date) { + var tmp; + element = element + ? element.appendChild(document.createElement("span")) : document.createElement("span"); - if (b) - if ("string" === typeof b) a.className = b; - else for (f in b) b.hasOwnProperty(f) && a.setAttribute(f, b[f]); - if ((c = HTML.setText(c, d, e))) a.textContent = c; - return a; - }, - appendTEXT: function(a, b, c, d) { - (b = HTML.setText(b, c, d)) && a.appendChild(document.createTextNode(b)); - }, - appendIMG: function(a, b, c) { - var d; - a = a - ? a.appendChild(document.createElement("img")) + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + if ((textContent = HTML.setText(textContent, textType, date))) element.textContent = textContent; + return element; + }, + appendTEXT: function(element, textContent, textType, date) { + (textContent = HTML.setText(textContent, textType, date)) && element.appendChild(document.createTextNode(textContent)); + }, + appendIMG: function(element, attribute, styles) { + var tmp; + element = element + ? element.appendChild(document.createElement("img")) : document.createElement("img"); - if (b) - if ("string" === typeof b) a.src = b; - else for (d in b) b.hasOwnProperty(d) && a.setAttribute(d, b[d]); - if (c) - if ("string" === typeof b) a.style.width = a.style.height = c; - else for (d in c) c.hasOwnProperty(d) && (a.style[d] = c[d]); - return a; - }, - appendA: function(a, b, c, d, e) { - var f; - a = a - ? a.appendChild(document.createElement("a")) + if (attribute) + if ("string" === typeof attribute) element.src = attribute; + else for (tmp in attribute) attribute.hasOwnProperty(tmp) && element.setAttribute(tmp, attribute[tmp]); + if (styles) + if ("string" === typeof attribute) element.style.width = element.style.height = styles; + else for (tmp in styles) styles.hasOwnProperty(tmp) && (element.style[tmp] = styles[tmp]); + return element; + }, + appendA: function(element, attributes, eventListeners, agrData, disabled) { + var tmp; + element = element + ? element.appendChild(document.createElement("a")) : document.createElement("a"); - if (b) - if ("string" === typeof b) - (a.className = b), (a.href = "javascript:void(0)"); + if (attributes) + if ("string" === typeof attributes) + (element.className = attributes), (element.href = "javascript:void(0)"); else - for (f in (b.href || (b.href = "javascript:void(0)"), b)) - b.hasOwnProperty(f) && a.setAttribute(f, b[f]); - else a.href = "javascript:void(0)"; - d && - a.setAttribute( + for (tmp in (attributes.href || (attributes.href = "javascript:void(0)"), attributes)) + attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + else element.href = "javascript:void(0)"; + agrData && + element.setAttribute( "ago-data", - "string" === typeof d ? d : JSON.stringify(d) + "string" === typeof agrData ? agrData : JSON.stringify(agrData) ); - if (c) - for (f in c) c.hasOwnProperty(f) && a.addEventListener(f, c[f], !1); - e && a.setAttribute("disabled", "disabled"); - return a; - }, - appendSELECT: function(a, b, c, d, e) { - var f; - a = a - ? a.appendChild(document.createElement("select")) + if (eventListeners) + for (tmp in eventListeners) eventListeners.hasOwnProperty(tmp) && element.addEventListener(tmp, eventListeners[tmp], false); + disabled && element.setAttribute("disabled", "disabled"); + return element; + }, + appendSELECT: function(element, attributes, options, selectedValue, eventListeners) { + var tmp; + element = element + ? element.appendChild(document.createElement("select")) : document.createElement("select"); - if (b) - if ("string" === typeof b) a.className = b; - else for (f in b) b.hasOwnProperty(f) && a.setAttribute(f, b[f]); - if (e) - for (f in e) e.hasOwnProperty(f) && a.addEventListener(f, e[f], !1); - for (f in c) - c.hasOwnProperty(f) && - ((b = a.appendChild(document.createElement("option"))), - (b.value = f), - (b.textContent = AGO.Label.get(c[f]).replace(/</g, "<")), - d === f && (a.selectedIndex = a.options.length - 1)); - return a; - }, - appendSCRIPT: function(a, b) { - var c; - a && - ((c = document.createElement("script")), - c.setAttribute("type", "text/javascript"), - (c.textContent = - "string" === typeof a ? a : "(" + a.toString() + ")();"), - document.head.appendChild(c), - b && document.head.removeChild(c)); - }, - set: function(a, b, c, d, e, f) { + if (attributes) + if ("string" === typeof attributes) element.className = attributes; + else for (tmp in attributes) attributes.hasOwnProperty(tmp) && element.setAttribute(tmp, attributes[tmp]); + if (eventListeners) + for (tmp in eventListeners) eventListeners.hasOwnProperty(tmp) && element.addEventListener(tmp, eventListeners[tmp], false); + for (tmp in options) + options.hasOwnProperty(tmp) && + ((attributes = element.appendChild(document.createElement("option"))), + (attributes.value = tmp), + (attributes.textContent = AGO.Label.get(options[tmp]).replace(/</g, "<")), + selectedValue === tmp && (element.selectedIndex = element.options.length - 1)); + return element; + }, + set: function(selector, selectorType, attributes, styles, eventListeners, otherProperty) { var g; - if ((a = DOM.query(a, b))) { - if (c) for (g in c) c.hasOwnProperty(g) && a.setAttribute(g, c[g]); - if (d) for (g in d) d.hasOwnProperty(g) && (a.style[g] = d[g]); - if (e) - for (g in e) e.hasOwnProperty(g) && a.addEventListener(g, e[g], !1); - if (f) for (g in f) f.hasOwnProperty(g) && (a[g] = f[g]); + if ((selector = DOM.query(selector, selectorType))) { + if (attributes) for (g in attributes) attributes.hasOwnProperty(g) && selector.setAttribute(g, attributes[g]); + if (styles) for (g in styles) styles.hasOwnProperty(g) && (selector.style[g] = styles[g]); + if (eventListeners) + for (g in eventListeners) eventListeners.hasOwnProperty(g) && selector.addEventListener(g, eventListeners[g], false); + if (otherProperty) for (g in otherProperty) otherProperty.hasOwnProperty(g) && (selector[g] = otherProperty[g]); } }, - setAll: function(a, b, c, d, e, f) { - b = DOM.queryAll(a, b); - for (a = 0; a < b.length; a++) DOM.set(b[a], null, c, d, e, f); + setAll: function(selector, selectorType, attributes, styles, eventListeners, otherProperty) { + selectorType = DOM.queryAll(selector, selectorType); + for (selector = 0; selector < selectorType.length; selector++) DOM.set(selectorType[selector], null, attributes, styles, eventListeners, otherProperty); }, - getText: function(a, b, c) { - a = DOM.query(a, b); - return HTML.getText(a ? a.textContent : "", c); + getText: function(selector, selectorType, textType) { + selector = DOM.query(selector, selectorType); + return HTML.getText(selector ? selector.textContent : "", textType); }, - getTextChild: function(a, b, c) { + getTextChild: function(selector, selectorType, textType) { var d; - if ((b = DOM.query(a, b)) && b.childNodes) + if ((selectorType = DOM.query(selector, selectorType)) && selectorType.childNodes) for ( - a = 0; - a < b.childNodes.length && - (3 !== +b.childNodes[a].nodeType || - !(d = (b.childNodes[a].nodeValue || "").trim())); - a++ + selector = 0; + selector < selectorType.childNodes.length && + (3 !== +selectorType.childNodes[selector].nodeType || + !(d = (selectorType.childNodes[selector].nodeValue || "").trim())); + selector++ ); - return HTML.getText(d, c); - }, - setText: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - 9 === d - ? (a.innerHTML = c || "") - : (a.textContent = HTML.setText(c, d, e)); - }, - updateText: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - if (((c = HTML.setText(c, d, e)), c !== a.textContent)) - return (a.textContent = c), a; + return HTML.getText(d, textType); + }, + setText: function(selector, selectorType, textContent, textType, date) { + if ((selector = DOM.query(selector, selectorType))) + 9 === textType + ? (selector.innerHTML = textContent || "") + : (selector.textContent = HTML.setText(textContent, textType, date)); + }, + updateText: function(selector, selectorType, textContent, textType, date) { + if ((selector = DOM.query(selector, selectorType))) + if (((textContent = HTML.setText(textContent, textType, date)), textContent !== selector.textContent)) + return (selector.textContent = textContent), selector; return null; }, - updateTextChild: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - if (((c = HTML.setText(c, d, e)), 3 === +a.firstChild.nodeType)) { - if (c !== a.firstChild.textContent) - return (a.firstChild.textContent = c), a; - } else return DOM.prependChild(a, document.createTextNode(c)), a; + updateTextChild: function(selector, selectorType, textContent, textType, date) { + if ((selector = DOM.query(selector, selectorType))) + if (((textContent = HTML.setText(textContent, textType, date)), 3 === +selector.firstChild.nodeType)) { + if (textContent !== selector.firstChild.textContent) + return (selector.firstChild.textContent = textContent), selector; + } else return DOM.prependChild(selector, document.createTextNode(textContent)), selector; return null; }, - getAttribute: function(a, b, c, d) { - a = DOM.query(a, b); - return HTML.getText(a ? a.getAttribute(c) : "", d); + getAttribute: function(selector, selectorType, attribute, textType) { + selector = DOM.query(selector, selectorType); + return HTML.getText(selector ? selector.getAttribute(attribute) : "", textType); }, - setAttribute: function(a, b, c, d, e) { - (a = DOM.query(a, b)) && a.setAttribute(c, HTML.setValue(d, e)); + setAttribute: function(selector, selectorType, attribute, value, valueType) { + (selector = DOM.query(selector, selectorType)) && selector.setAttribute(attribute, HTML.setValue(value, valueType)); }, - removeAttribute: function(a, b, c) { - (a = DOM.query(a, b)) && a.removeAttribute(c); + removeAttribute: function(selector, selectorType, attribute) { + (selector = DOM.query(selector, selectorType)) && selector.removeAttribute(attribute); }, - updateAttribute: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - if (((d = HTML.setValue(d, e)), a.getAttribute(c) !== d)) - return a.setAttribute(c, d), a; + updateAttribute: function(selector, selectorType, attribute, attributeValue, valueType) { + if ((selector = DOM.query(selector, selectorType))) + if (((attributeValue = HTML.setValue(attributeValue, valueType)), selector.getAttribute(attribute) !== attributeValue)) + return selector.setAttribute(attribute, attributeValue), selector; return null; }, - setData: function(a, b, c) { - (a = DOM.query(a, b)) && - c && - a.setAttribute( + setData: function(selector, selectorType, agrData) { + (selector = DOM.query(selector, selectorType)) && + agrData && + selector.setAttribute( "ago-data", - "string" === typeof c ? c : JSON.stringify(c) + "string" === typeof agrData ? agrData : JSON.stringify(agrData) ); }, - getData: function(a, b, c) { - return DOM.getAttributeParent(a, b, "ago-data", -2, c); + getData: function(selector, selectorType, parentIndex) { + return DOM.getAttributeParent(selector, selectorType, "ago-data", -2, parentIndex); }, - getAttributeParent: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - for (e = e || 0; a && 0 <= e; ) { - if (a.hasAttribute(c)) return DOM.getAttribute(a, null, c, d); - e--; - a = a.parentNode; + getAttributeParent: function(selector, selectorType, attributeName, textType, parentIndex) { + if ((selector = DOM.query(selector, selectorType))) + for (parentIndex = parentIndex || 0; selector && 0 <= parentIndex; ) { + if (selector.hasAttribute(attributeName)) return DOM.getAttribute(selector, null, attributeName, textType); + parentIndex--; + selector = selector.parentNode; } - return HTML.getText("", d); + return HTML.getText("", textType); }, - getProperty: function(a, b, c, d) { - a = DOM.query(a, b); - return HTML.getText(a ? a[c] : "", d); + getProperty: function(selector, selectorType, property, propertyType) { + selector = DOM.query(selector, selectorType); + return HTML.getText(selector ? selector[property] : "", propertyType); }, - setProperty: function(a, b, c, d, e) { - (a = DOM.query(a, b)) && (a[c] = HTML.setValue(d, e)); + setProperty: function(selector, selectorType, property, value, valueType) { + (selector = DOM.query(selector, selectorType)) && (selector[property] = HTML.setValue(value, valueType)); }, - updateProperty: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - if (((d = HTML.setValue(d, e)), a[c] !== d)) return (a[c] = d), a; + updateProperty: function(selector, selectorType, property, value, valueType) { + if ((selector = DOM.query(selector, selectorType))) + if (((value = HTML.setValue(value, valueType)), selector[property] !== value)) return (selector[property] = value), selector; }, - updatePropertyAll: function(a, b, c, d, e) { - b = DOM.queryAll(a, b); - for (a = 0; a < b.length; a++) DOM.updateProperty(b[a], null, c, d, e); + updatePropertyAll: function(selector, selectorType, property, value, valuetype) { + selectorType = DOM.queryAll(selector, selectorType); + for (selector = 0; selector < selectorType.length; selector++) DOM.updateProperty(selectorType[selector], null, property, value, valuetype); }, - getValue: function(a, b, c) { - a = DOM.query(a, b); - return HTML.getText(a ? a.value : "", c); + getValue: function(selector, selectorType, valueType) { + selector = DOM.query(selector, selectorType); + return HTML.getText(selector ? selector.value : "", valueType); }, - setValue: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - (a.value = HTML.setValue(c, d)), e && DOM.trigger(a, null, e); + setValue: function(selector, selectorType, value, valueType, eventName) { + if ((selector = DOM.query(selector, selectorType))) + (selector.value = HTML.setValue(value, valueType)), eventName && DOM.trigger(selector, null, eventName); }, - updateValue: function(a, b, c, d, e) { - if ((a = DOM.query(a, b))) - if (((c = HTML.setValue(c, d)), c !== a.value)) - return (a.value = c), e && DOM.trigger(a, null, e), a; + updateValue: function(selector, selectorType, value, valueType, eventName) { + if ((selector = DOM.query(selector, selectorType))) + if (((value = HTML.setValue(value, valueType)), value !== selector.value)) + return (selector.value = value), eventName && DOM.trigger(selector, null, eventName), selector; return null; }, - hasClass: function(a, b, c) { - return (a = DOM.query(a, b)) ? HTML.hasClass(a.className, c) : !1; + hasClass: function(selector, selectorType, className) { + return (selector = DOM.query(selector, selectorType)) ? HTML.hasClass(selector.className, className) : false; }, - updateClass: function(a, b, c) { - return (a = DOM.query(a, b)) && a.className !== (c || "") - ? ((a.className = c || ""), a) + updateClass: function(selector, selectorType, className) { + return (selector = DOM.query(selector, selectorType)) && selector.className !== (className || "") + ? ((selector.className = className || ""), selector) : null; }, - addClass: function(a, b, c) { - (b = DOM.query(a, b)) && - c && - ((a = (" " + (b.className || "").toLowerCase() + " ").indexOf( - " " + c.toLowerCase().trim() + " " + addClass: function(selector, selectorType, className) { + (selectorType = DOM.query(selector, selectorType)) && + className && + ((selector = (" " + (selectorType.className || "").toLowerCase() + " ").indexOf( + " " + className.toLowerCase().trim() + " " )), - -1 === a && (b.className = (b.className ? b.className + " " : "") + c)); + -1 === selector && (selectorType.className = (selectorType.className ? selectorType.className + " " : "") + className)); }, - extendClass: function(a, b, c) { - (a = DOM.query(a, b)) && - c && - (a.className = ((a.className || "") + " " + c).trim()); + extendClass: function(selector, selectorType, className) { + (selector = DOM.query(selector, selectorType)) && + className && + (selector.className = ((selector.className || "") + " " + className).trim()); }, - removeClass: function(a, b, c) { + removeClass: function(selector, selectorType, className) { var d; - (b = DOM.query(a, b)) && - c && - ((d = (" " + (b.className || "").toLowerCase() + " ").indexOf( - " " + c.toLowerCase().trim() + " " + (selectorType = DOM.query(selector, selectorType)) && + className && + ((d = (" " + (selectorType.className || "").toLowerCase() + " ").indexOf( + " " + className.toLowerCase().trim() + " " )), -1 < d && - ((a = 0 < d ? b.className.slice(0, d).trim() : ""), - (c = b.className.slice(d + c.length).trim()), - (b.className = a + (a && c ? " " : "") + c))); - }, - removeClassGroup: function(a, b, c) { - (a = DOM.query(a, b)) && - c && - ((c = (a.className || "") - .replace(new RegExp("(^|\\s)" + c + "(\\w|_)*", "g"), " ") + ((selector = 0 < d ? selectorType.className.slice(0, d).trim() : ""), + (className = selectorType.className.slice(d + className.length).trim()), + (selectorType.className = selector + (selector && className ? " " : "") + className))); + }, + removeClassGroup: function(selector, selectorType, className) { + (selector = DOM.query(selector, selectorType)) && + className && + ((className = (selector.className || "") + .replace(new RegExp("(^|\\s)" + className + "(\\w|_)*", "g"), " ") .trim()), - c !== a.className && (a.className = c)); - }, - setClassGroup: function(a, b, c, d) { - (a = DOM.query(a, b)) && - c && - ((c = - (a.className || "") - .replace(new RegExp("(^|\\s)" + c + "(\\w|_)*", "g"), " ") - .trim() + (d ? " " + d : "")), - c !== a.className && (a.className = c)); - }, - setStyleColor: function(a, b, c) { - if ((a = DOM.query(a, b))) a.style.color = c || ""; - }, - setStyleDisplay: function(a, b, c) { - if ((a = DOM.query(a, b))) a.style.display = c || "none"; - }, - updateStyle: function(a, b, c, d) { - return (a = DOM.query(a, b)) && a.style[c] !== (d || "") - ? ((a.style[c] = d || ""), a) + className !== selector.className && (selector.className = className)); + }, + setClassGroup: function(selector, selectorType, searchClassName, replaceClassName) { + (selector = DOM.query(selector, selectorType)) && + searchClassName && + ((searchClassName = + (selector.className || "") + .replace(new RegExp("(^|\\s)" + searchClassName + "(\\w|_)*", "g"), " ") + .trim() + (replaceClassName ? " " + replaceClassName : "")), + searchClassName !== selector.className && (selector.className = searchClassName)); + }, + setStyleColor: function(selector, selectorType, colorValue) { + if ((selector = DOM.query(selector, selectorType))) selector.style.color = colorValue || ""; + }, + setStyleDisplay: function(selector, selectorType, displayValue) { + if ((selector = DOM.query(selector, selectorType))) selector.style.display = displayValue || "none"; + }, + updateStyle: function(selector, selectorType, styleKey, styleValue) { + return (selector = DOM.query(selector, selectorType)) && selector.style[styleKey] !== (styleValue || "") + ? ((selector.style[styleKey] = styleValue || ""), selector) : null; }, - addObserver: function(a, b, c) { - var d; - a && - c && - (d = new window.MutationObserver(c)) && - d.observe( - a, - b || { - childList: !0 + addObserver: function(nodeElement, config, mutationCallback) { + var observer; + nodeElement && + mutationCallback && + (observer = new window.MutationObserver(mutationCallback)) && + observer.observe( + nodeElement, + config || { + childList: true } ); - return d; + return observer; }, - removeObserver: function(a) { + removeObserver: function(observer) { try { - a && a.disconnect && a.disconnect(); + observer && observer.disconnect && observer.disconnect(); } catch (b) {} }, - click: function(a, b) { - DOM.trigger(a, b, "click"); - }, - trigger: function(a, b, c) { - (b = DOM.query(a, b)) && - c && - ("click" === c || - "mouseup" === c || - "mousedown" === c || - "mouseover" === c || - "mouseout" === c - ? ((a = document.createEvent("MouseEvents")), - a.initMouseEvent( - c, - !0, - !0, - window, - 0, - 0, - 0, - 0, - 0, - !1, - !1, - !1, - !1, - 0, - null - ), - b.dispatchEvent(a)) - : "change" === c || "focus" === c || "blur" === c - ? ((a = document.createEvent("HTMLEvents")), - a.initEvent(c, !0, !1), - b.dispatchEvent(a)) - : "keyup" === c && - ((a = document.createEvent("KeyboardEvent")), - "initKeyboardEvent" in a - ? a.initKeyboardEvent( - "keyup", - !0, - !0, - window, - !1, - !1, - !1, - !1, - 0, - 0 - ) - : a.initKeyEvent("keyup", !0, !0, window, !1, !1, !1, !1, 0, 0), - b.dispatchEvent(a))); - }, - addEvents: function(a, b, c) { - var d; - if ((a = DOM.query(a, b))) - for (d in c) c.hasOwnProperty(d) && a.addEventListener(d, c[d], !1); - }, - addEventsAll: function(a, b, c) { - var d; - b = DOM.queryAll(a, b); - for (a = 0; a < b.length; a++) - for (d in c) c.hasOwnProperty(d) && b[a].addEventListener(d, c[d], !1); - }, - setFocus: function(a, b) { - var c = DOM.query(a, b); + click: function(selector, selectorType) { + DOM.trigger(selector, selectorType, "click"); + }, + trigger: function(selector, selectorType, eventName) { + (selectorType = DOM.query(selector, selectorType)) && + eventName && + ("click" === eventName || + "mouseup" === eventName || + "mousedown" === eventName || + "mouseover" === eventName || + "mouseout" === eventName + ? ((selector = document.createEvent("MouseEvents")), + selector.initMouseEvent(eventName, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null), + selectorType.dispatchEvent(selector)) + : "change" === eventName || "focus" === eventName || "blur" === eventName + ? ((selector = document.createEvent("HTMLEvents")), + selector.initEvent(eventName, true, false), + selectorType.dispatchEvent(selector)) + : "keyup" === eventName && + ((selector = document.createEvent("KeyboardEvent")), + "initKeyboardEvent" in selector + ? selector.initKeyboardEvent("keyup", true, true, window, false, false, false, false, 0, 0) + : selector.initKeyEvent("keyup", true, true, window, false, false, false, false, 0, 0), + selectorType.dispatchEvent(selector))); + }, + addEvents: function(selector, selectorType, eventListeners) { + var event; + if ((selector = DOM.query(selector, selectorType))) + for (event in eventListeners) eventListeners.hasOwnProperty(event) && selector.addEventListener(event, eventListeners[event], false); + }, + addEventsAll: function(selector, selectorType, eventListeners) { + var event; + selectorType = DOM.queryAll(selector, selectorType); + for (selector = 0; selector < selectorType.length; selector++) + for (event in eventListeners) eventListeners.hasOwnProperty(event) && selectorType[selector].addEventListener(event, eventListeners[event], false); + }, + setFocus: function(selector, selectorType) { + var c = DOM.query(selector, selectorType); c && c.focus(); }, disableAutocomplete: function() { - AGO.Option.is("U41") && + AGO.Option.is("disable_auto_complete") && window.setTimeout(function() { DOM.setAll("form", null, { autocomplete: "off" }); }, 0); }, - disableActiveElement: function(a) { + disableActiveElement: function(enableTimeout) { if (AGO.Init.mobile && document.activeElement) if ( "TEXTAREA" === document.activeElement.tagName || @@ -591,221 +561,224 @@ var DOM = { try { document.activeElement.blur(); } catch (b) {} - else a || window.setTimeout(DOM.disableActiveElement, 30, !0); - }, - changeInput: function(a, b) { - var c, d; - return a && b && (!AGO.isFirefox || AGO.Option.is("U41")) - ? ((c = - a.shiftKey && a.ctrlKey - ? 1e3 - : a.ctrlKey + else enableTimeout || window.setTimeout(DOM.disableActiveElement, 30, true); + }, + changeInput: function(event, target) { + var tmpValue, value; + return event && target && (!AGO.isFirefox || AGO.Option.is("disable_auto_complete")) + ? ((tmpValue = + event.shiftKey && event.ctrlKey + ? 1000 + : event.ctrlKey ? 100 - : a.shiftKey + : event.shiftKey ? 10 : 1), - (d = DOM.getValue(b, null, 2)), - (d = 38 === a.keyCode ? d + c : d - c), - DOM.setValue(b, null, Math.max(d, 0)), - DOM.trigger(b, null, "keyup"), - !1) - : !0; + (value = DOM.getValue(target, null, 2)), + (value = 38 === event.keyCode ? value + tmpValue : value - tmpValue), + DOM.setValue(target, null, Math.max(value, 0)), + DOM.trigger(target, null, "keyup"), + false) + : true; } }, HTML = { - getText: function(a, b) { - if (1 === b) return Boolean(a); - if (2 === b) return NMR.parseIntFormat(a); - if (3 === b) return NMR.parseIntAbs(a); - if (7 === b) return (a || "").trim(); - if (-2 === b) + getText: function(text, textType) { + if (1 === textType) return Boolean(text); + if (2 === textType) return NMR.parseIntFormat(text); + if (3 === textType) return NMR.parseIntAbs(text); + if (7 === textType) return (text || "").trim(); + if (-2 === textType) try { - return JSON.parse(a || "{}"); + return JSON.parse(text || "{}"); } catch (c) { return {}; } - else return a || ""; - }, - setText: function(a, b, c) { - b && - (a = - 2 === b - ? STR.formatNumber(a) - : 4 === b - ? STR.formatNumber(a, !0) - : 5 === b - ? STR.shortNumber(a) - : 3 === b - ? a - ? STR.formatNumber(a) - : "0" - : 7 === b - ? STR.trim(a) - : 8 === b - ? STR.zero(a) - : 10 === b - ? AGO.Label.get(a) - : 11 === b - ? AGO.Label.get(a, 1) - : 12 === b - ? AGO.Label.get(a, 2) - : 15 === b - ? AGO.Time.format(a, c) - : 16 === b - ? AGO.Time.format(a, c, !0) - : 17 === b - ? AGO.Time.formatTimestamp(a, c) - : 18 === b - ? AGO.Time.formatTime(a) - : 19 === b - ? AGO.Time.formatTime(a, !0) - : a); - return a ? a + "" : ""; - }, - setValue: function(a, b) { - b && - (a = - 1 === b - ? Boolean(a) - : 7 === b - ? STR.trim(a) - : 8 === b - ? STR.zero(a) - : -2 === b - ? JSON.stringify(a || {}) - : a); - return a ? a + "" : ""; - }, - urlImage: function(a) { - return AGO.App.pathSkin + "ago/images/" + a; - }, - urlMissionIcon: function(a) { - return AGO.App.pathSkin + "ago/images/task/mission-" + (a || 0) + ".gif"; - }, - urlTypeIcon: function(a, b) { + else return text || ""; + }, + setText: function(text, type, date) { + if(type) { + if (2 === type) { + text = STR.formatNumber(text); + } else if (4 === type) { + text = STR.formatNumber(text, true) + } else if (5 === type) { + text = STR.shortNumber(text) + } else if (3 === type) { + if (text) { + text = STR.formatNumber(text) + } else { + text = "0"; + } + } else if (7 === type) { + text = STR.trim(text) + } else if (8 === type) { + text = STR.zero(text) + } else if (10 === type) { + text = AGO.Label.get(text) + } else if (11 === type) { + text = AGO.Label.get(text, 1) + } else if (12 === type) { + text = AGO.Label.get(text, 2) + } else if (15 === type) { + text = AGO.Time.format(text, date) + } else if (16 === type) { + text = AGO.Time.format(text, date, true) + } else if (17 === type) { + text = AGO.Time.formatTimestamp(text, date) + } else if (18 === type) { + text = AGO.Time.formatTime(text) + } else if (19 === type) { + text = AGO.Time.formatTime(text, true) + } + } + return text ? text + "" : ""; + }, + setValue: function(value, valueType) { + valueType && + (value = + 1 === valueType + ? Boolean(value) + : 7 === valueType + ? STR.trim(value) + : 8 === valueType + ? STR.zero(value) + : -2 === valueType + ? JSON.stringify(value || {}) + : value); + return value ? value + "" : ""; + }, + urlImage: function(image) { + return AGO.App.pathSkin + "ago/images/" + image; + }, + urlMissionIcon: function(mission) { + return AGO.App.pathSkin + "ago/images/task/mission-" + (mission || 0) + ".gif"; + }, + urlTypeIcon: function(type, activeState) { return ( AGO.App.pathSkin + "ago/images/task/type-" + - (a || 0) + - (b || "a") + + (type || 0) + + (activeState || "a") + ".gif" ); }, - hasClass: function(className, b) { - return className.indexOf(b) > -1 + hasClass: function(className, occurenceToFind) { + return className.indexOf(occurenceToFind) > -1 }, - classMission: function(a) { - return "ago_color_M" + STR.trimZero(a, 2); + classMission: function(missionId) { + return "ago_color_M" + STR.trimZero(missionId, 2); }, - classType: function(a) { - return AGO.Styles.classType[a] || ""; + classType: function(classType) { + return AGO.Styles.classType[classType] || ""; }, - classStatus: function(a) { - return 0 < a + classStatus: function(status) { + return 0 < status ? "ago_color_lightgreen" - : 0 > a + : 0 > status ? "ago_color_palered" : "ago_color_orange"; }, - classStatusData: function(a) { - return AGO.Styles.classStatusData[(a || 0) + 2] || ""; + classStatusData: function(classStatus) { + return AGO.Styles.classStatusData[(classStatus || 0) + 2] || ""; }, - colorStatusData: function(a) { - return AGO.Styles.colorStatusData[(a || 0) + 2] || ""; + colorStatusData: function(colorStatus) { + return AGO.Styles.colorStatusData[(colorStatus || 0) + 2] || ""; }, - color: function(a, b) { - return !a || (4 !== a.length && 7 !== a.length) + color: function(rgb, opacity) { + return !rgb || (4 !== rgb.length && 7 !== rgb.length) ? "" - : 0 < b && 100 > b - ? ((a = - 7 === a.length - ? parseInt(a.substring(1, 3), 16) + + : 0 < opacity && 100 > opacity + ? ((rgb = + 7 === rgb.length + ? parseInt(rgb.substring(1, 3), 16) + "," + - parseInt(a.substring(3, 5), 16) + + parseInt(rgb.substring(3, 5), 16) + "," + - parseInt(a.substring(5, 7), 16) - : parseInt(a.substring(1, 2), 16) + + parseInt(rgb.substring(5, 7), 16) + : parseInt(rgb.substring(1, 2), 16) + "," + - parseInt(a.substring(2, 3), 16) + + parseInt(rgb.substring(2, 3), 16) + "," + - parseInt(a.substring(3, 4), 16)), - "rgba(" + a + (10 > b ? ",0.0" : ",0.") + b + ")") - : a; + parseInt(rgb.substring(3, 4), 16)), + "rgba(" + rgb + (10 > opacity ? ",0.0" : ",0.") + opacity + ")") + : rgb; }, - getPlayer: function(a, b, c) { + getPlayer: function(playerName, playerStatus, playerHonor) { return ( - (c + (playerHonor ? ' ' : "") + '' + - (a || "") + + (playerName || "") + "" ); } }, OBJ = { - parse: function(a) { - if (a && "object" === typeof a) return a; + parse: function(json) { + if (json && "object" === typeof json) return json; try { - return JSON.parse(a || "{}"); + return JSON.parse(json || "{}"); } catch (b) { return {}; } }, - split: function(a, b) { + split: function(str, delimiter) { var c = {}, d, e, f; - d = STR.check(a).split(b || ";"); + d = STR.check(str).split(delimiter || ";"); for (f = 0; f < d.length; f++) (e = (d[f] || "").split("=")), e[0] && (c[e[0]] = e[1] || ""); return c; }, - create: function(a) { + create: function(obj) { var b = {}, c; - if (a && "object" === typeof a) - for (c in a) "object" !== typeof a[c] && (b[c] = a[c]); + if (obj && "object" === typeof obj) + for (c in obj) "object" !== typeof obj[c] && (b[c] = obj[c]); return b; }, - createKey: function(a, b) { + createKey: function(key, value) { var c = {}; - a && (c[a] = b); + key && (c[key] = value); return c; }, - copy: function(a, b) { - var c; - if (a && "object" === typeof a && b && "object" === typeof b) - for (c in a) "object" !== typeof a[c] && (b[c] = a[c]); + copy: function(toCopy, receiveCopy) { + var key; + if (toCopy && "object" === typeof toCopy && receiveCopy && "object" === typeof receiveCopy) + for (key in toCopy) "object" !== typeof toCopy[key] && (receiveCopy[key] = toCopy[key]); + }, + is: function(maybeObject) { + return maybeObject && "object" === typeof maybeObject; }, - is: function(a) { - return a && "object" === typeof a; + hasProperties: function(obj) { + return obj && "object" === typeof obj && Object.keys(obj).length; }, - hasProperties: function(a) { - return a && "object" === typeof a && Object.keys(a).length; + get: function(obj, key) { + return obj && "object" === typeof obj && key in obj ? obj[key] : ""; }, - get: function(a, b) { - return a && "object" === typeof a && b in a ? a[b] : ""; + set: function(obj, key, value) { + obj && "object" === typeof obj && (obj[key] = value); }, - set: function(a, b, c) { - a && "object" === typeof a && (a[b] = c); + iterate: function(obj, callback) { + if (obj && "object" === typeof obj) + for (var c in obj) obj.hasOwnProperty(c) && callback(c); }, - iterate: function(a, b) { - if (a && "object" === typeof a) - for (var c in a) a.hasOwnProperty(c) && b(c); + iterateFilter: function(obj, callback, filterArray) { + if (obj && "object" === typeof obj) + for (var d in obj) obj.hasOwnProperty(d) && -1 !== filterArray.indexOf(d) && callback(d); }, - iterateFilter: function(a, b, c) { - if (a && "object" === typeof a) - for (var d in a) a.hasOwnProperty(d) && -1 !== c.indexOf(d) && b(d); + iterateArray: function(array, callback) { + Array.isArray(array) && array.forEach(callback); }, - iterateArray: function(a, b) { - Array.isArray(a) && a.forEach(b); - }, isEmpty: function (object) { + isEmpty: function (object) { for(var key in object) { if(object.hasOwnProperty(key)){ return false; @@ -815,168 +788,168 @@ var DOM = { } }, VAL = { - choose: function(a) { - return 0 < a ? arguments[a] : ""; + choose: function(val) { + return 0 < val ? arguments[val] : ""; }, - select: function(a) { + select: function(val) { for (var b = 1; b < arguments.length; b++) - if (a === arguments[b]) return arguments[b]; + if (val === arguments[b]) return arguments[b]; }, - check: function(a) { + check: function(val) { for (var b = 1; b < arguments.length; b++) - if (a === arguments[b]) return !0; - return !1; + if (val === arguments[b]) return true; + return false; }, - status: function(a, b, c, d) { - return 0 > a ? b : 0 < a ? d : c; + status: function(val, infVal, equVal, supVal) { + return 0 > val ? infVal : 0 < val ? supVal : equVal; } }, NMR = { - minMax: function(a, b, c) { - return Math.max(Math.min(+a || 0, c), b); + minMax: function(val1, val2, val3) { + return Math.max(Math.min(+val1 || 0, val3), val2); }, - isMinMax: function(a, b, c) { - return +a >= b && +a <= c; + isMinMax: function(val, minVal, maxVal) { + return +val >= minVal && +val <= maxVal; }, - isGreater: function(a, b) { - return 0 < +b && +a >= +b; + isGreater: function(val, greaterThan) { + return 0 < +greaterThan && +val >= +greaterThan; }, - isLesser: function(a, b) { - return 0 < +a && +b >= +a; + isLesser: function(val, lessThan) { + return 0 < +val && +lessThan >= +val; }, - parseInt: function(a) { - return "string" === typeof a - ? parseInt(a, 10) - : "number" === typeof a - ? Math.floor(a) + parseInt: function(val) { + return "string" === typeof val + ? parseInt(val, 10) + : "number" === typeof val + ? Math.floor(val) : 0; }, - parseIntFormat: function(a) { - return "string" === typeof a - ? +a.replace(/[^\d\-]/g, "") || 0 - : "number" === typeof a - ? Math.floor(a) + parseIntFormat: function(val) { + return "string" === typeof val + ? +val.replace(/[^\d\-]/g, "") || 0 + : "number" === typeof val + ? Math.floor(val) : 0; }, - parseIntAbs: function(a) { - return "string" === typeof a - ? +a.replace(/[^\d]/g, "") || 0 - : "number" === typeof a - ? Math.floor(Math.abs(a)) + parseIntAbs: function(val) { + return "string" === typeof val + ? +val.replace(/[^\d]/g, "") || 0 + : "number" === typeof val + ? Math.floor(Math.abs(val)) : 0; }, - parseVersion: function(a) { - return (a = /(\d+)\D*(\d*)\D*(\d*)\D*(\d*)/.exec(a ? a.toString() : "")) + parseVersion: function(possibleVersion) { + return (possibleVersion = /(\d+)\D*(\d*)\D*(\d*)\D*(\d*)/.exec(possibleVersion ? possibleVersion.toString() : "")) ? parseInt( - ("00" + a[1]).slice(-2) + - ("00" + a[2]).slice(-2) + - ("00" + a[3]).slice(-2) + - ("00" + a[4]).slice(-2), + ("00" + possibleVersion[1]).slice(-2) + + ("00" + possibleVersion[2]).slice(-2) + + ("00" + possibleVersion[3]).slice(-2) + + ("00" + possibleVersion[4]).slice(-2), 10 ) : 0; }, - parseIntShortcut: function(a) { - a = STR.check(a).toLowerCase(); + parseIntShortcut: function(val) { + val = STR.check(val).toLowerCase(); return ( - (-1 < a.indexOf("k") ? 1e3 : 1) * parseInt(a.replace(/[^\d]/g, ""), 10) + (-1 < val.indexOf("k") ? 1e3 : 1) * parseInt(val.replace(/[^\d]/g, ""), 10) ); - }, parseIntRess: function (a) { + }, parseIntRess: function (val) { var r; - a = STR.trim((a.match(/: ([^<]+)*/) ? a.match(/: ([^<]+)*/)[1] : a)); - if (a.match(/^[0-9]{1,3}\.[0-9]{3}$/)) - a = a.replace('.', ''); - else if((r = new RegExp('^([0-9]{1,3}(\.|,))?[0-9]{1,3}(' + AGO.Label.is("KU0B") + ')')) && a.match(r)) - a = a.replace(/,/g,'.').replace(AGO.Label.is("KU0B"),'')*1000000000; - else if((r = new RegExp('^([0-9]{1,3}(\.|,))?[0-9]{1,3}(' + AGO.Label.is("KU0M") + ')')) && a.match(r)) - a = a.replace(/,/g,'.').replace(AGO.Label.is("KU0M"),'')*1000000; - return parseInt(a); + val = STR.trim((val.match(/: ([^<]+)*/) ? val.match(/: ([^<]+)*/)[1] : val)); + if (val.match(/^[0-9]{1,3}\.[0-9]{3}$/)) + val = val.replace('.', ''); + else if((r = new RegExp('^([0-9]{1,3}(\.|,))?[0-9]{1,3}(' + AGO.Label.is("KU0B") + ')')) && val.match(r)) + val = val.replace(/,/g,'.').replace(AGO.Label.is("KU0B"),'')*1000000000; + else if((r = new RegExp('^([0-9]{1,3}(\.|,))?[0-9]{1,3}(' + AGO.Label.is("KU0M") + ')')) && val.match(r)) + val = val.replace(/,/g,'.').replace(AGO.Label.is("KU0M"),'')*1000000; + return parseInt(val); } }, STR = { - check: function(a) { - return "string" === typeof a - ? a - : "number" === typeof a && a - ? a + "" + check: function(val) { + return "string" === typeof val + ? val + : "number" === typeof val && val + ? val + "" : ""; }, - trim: function(a) { - return "string" === typeof a - ? a.trim() - : "number" === typeof a && a - ? a + "" + trim: function(val) { + return "string" === typeof val + ? val.trim() + : "number" === typeof val && val + ? val + "" : ""; }, - zero: function(a) { - return a - ? "string" === typeof a - ? a - : "number" === typeof a - ? a + "" + zero: function(val) { + return val + ? "string" === typeof val + ? val + : "number" === typeof val + ? val + "" : "0" : "0"; }, - trimZero: function(a, b) { - a = "0000" + a; - return a.substr(a.length - b); + trimZero: function(val, nb) { + val = "0000" + val; + return val.substr(val.length - nb); }, - formatNumber: function(a, b) { + formatNumber: function(val, doFormat) { var c = ""; - if (a) { - b && - (1e9 <= Math.abs(a) - ? ((a = Math.floor(a / 1e6)), (c = "\u2009" + AGO.Label.is("KU0M"))) - : 1e6 <= Math.abs(a) && - ((a = Math.floor(a / 1e3)), + if (val) { + doFormat && + (1000000000 <= Math.abs(val) + ? ((val = Math.floor(val / 1e6)), (c = "\u2009" + AGO.Label.is("KU0M"))) + : 1e6 <= Math.abs(val) && + ((val = Math.floor(val / 1e3)), (c = "\u2009" + AGO.Label.is("KU0K")))); - for (var d = [], e = Math.abs(+a || 0) + ""; ; ) { + for (var d = [], e = Math.abs(+val || 0) + ""; ; ) { var f = e.slice(-3); if (f) d.unshift(f), (e = e.substr(0, e.length - f.length)); else break; } - return (0 > a ? "-" : "") + d.join(AGO.Label.is("KU0S")) + c; + return (0 > val ? "-" : "") + d.join(AGO.Label.is("KU0S")) + c; } return ""; }, - shortNumber: function(a, b) { + shortNumber: function(val, nb) { var c, d; - c = 2 === b ? 1 : 1 === b ? 10 : 100; - if (1e9 <= a) - (c = Math.ceil(a / 1e7 / c) + ""), (d = AGO.Label.is("KU0B")); - else if (1e6 <= a) - (c = Math.ceil(a / 1e4 / c) + ""), (d = AGO.Label.is("KU0M")); - else if (1e3 <= a) - (c = Math.ceil(a / 10 / c) + ""), (d = AGO.Label.is("KU0K")); - else return a ? a + "\u2009 " : "0\u2009 "; - return b - ? c.substr(0, c.length - b) + + c = 2 === nb ? 1 : 1 === nb ? 10 : 100; + if (1e9 <= val) + (c = Math.ceil(val / 1e7 / c) + ""), (d = AGO.Label.is("KU0B")); + else if (1e6 <= val) + (c = Math.ceil(val / 1e4 / c) + ""), (d = AGO.Label.is("KU0M")); + else if (1e3 <= val) + (c = Math.ceil(val / 10 / c) + ""), (d = AGO.Label.is("KU0K")); + else return val ? val + "\u2009 " : "0\u2009 "; + return nb + ? c.substr(0, c.length - nb) + AGO.Label.is("KU0S") + - c.substr(c.length - b) + + c.substr(c.length - nb) + "\u2009" + d : c + "\u2009" + d; }, - getParameter: function(a, b) { - var c = decodeURIComponent(b || "") + getParameter: function(val, href) { + var c = decodeURIComponent(href || "") .replace(/\?/g, "&") - .split("&" + a + "=")[1]; + .split("&" + val + "=")[1]; return c ? c.split("&")[0].split("#")[0] || "" : ""; }, - addParameter: function(a, b) { - b = STR.trim(b); - return a && b ? "&" + a + "=" + encodeURI(b) : ""; + addParameter: function(key, value) { + value = STR.trim(value); + return key && value ? "&" + key + "=" + encodeURI(value) : ""; }, - splitParameter: function(a) { - var b, c, d; + splitParameter: function(href) { + var params, param, i; if ( - (a = decodeURIComponent(a || "") + (href = decodeURIComponent(href || "") .replace(/\?/g, "&") .split("#")[0]) ) - for (b = {}, a = a.split("&"), d = 0; d < a.length; d++) - (c = (a[d] || "").split("=")), c[0] && (b[c[0]] = c[1] || ""); - return b; + for (params = {}, href = href.split("&"), i = 0; i < href.length; i++) + (param = (href[i] || "").split("=")), param[0] && (params[param[0]] = param[1] || ""); + return params; }, getMatches: function (string, regex, index) { index || (index = 1); // default to the first capturing group var matches = []; diff --git a/js/common.js b/js/common.js index b569d9f..1b13ccc 100644 --- a/js/common.js +++ b/js/common.js @@ -33,8 +33,8 @@ AGO.Notify = { b = 0; } 5 < AGO.Init.status && - ("Hide" === a && (AGO.Notify.loading = !1), - 3 === b && (AGO.Notify.loading = !0), + ("Hide" === a && (AGO.Notify.loading = false), + 3 === b && (AGO.Notify.loading = true), (e = HTML.colorStatusData(b)), 3 !== b && ((AGO.Notify.color = @@ -269,7 +269,7 @@ AGO.Styles = { Load: function(a) { AGO.App.Ogame && (1 !== AGO.Styles.status || AGO.App.reload || a) && - (AGB.Log("Update - Styles :", !0), + (AGB.Log("Update - Styles :", true), AGB.message( "Styles", "Init", @@ -915,11 +915,11 @@ AGO.Ogame = { AGO.Item[a].consumption * b / 35e3 * (c / 10 + 1) * (c / 10 + 1)) : 0; }, - getShipCapacity: function(a, b, c) { - c = AGO.Ogame.getFleetDuration(a, b, c); + getShipCapacity: function(shipId, distance, speed) { + duration = AGO.Ogame.getFleetDuration(shipId, distance, speed); return ( - AGO.Item[a].capacity - - Math.round(AGO.Ogame.getShipConsumption(a, b, c)) - + AGO.Item[shipId].capacity + + Math.round(AGO.Ogame.getShipConsumption(shipId, distance, duration)) + 1 ); }, @@ -990,16 +990,18 @@ AGO.Ogame = { c = "12" === a ? 10 * b * Math.pow(1.1, b) : 0; return Math.floor(c) * AGO.Uni.speed; }, - getConsumptionEnergy: function(a, b) { - var c; - "1" === a - ? Math.pow(1.1, b) - : "2" === a - ? Math.pow(1.1, b) - : "3" === a && Math.pow(1.1, b); - return (c = "1" === a || "2" === a ? 10 : "3" === a ? 20 : 0) && 0 <= b - ? Math.floor(c * b * Math.pow(1.1, b)) - : 0; + getConsumptionEnergy: function(idResource, level) { + var energy; + if(level == 0){ + return 0; + } + if("1" === idResource || "2" === idResource){ + energy = 10 * level * Math.pow(1.1, level) + }else if("3" === idResource){ + energy = 20 * level * Math.pow(1.1, level) + } + + return Math.ceil(energy) }, getProductionEnergy: function(a, b) { var energy = 0, multiplicator = 1; @@ -1008,7 +1010,7 @@ AGO.Ogame = { } else if("12" === a){ energy = 30 * b * Math.pow(1.05 + 0.01 * AGO.Units.get("113"), b) }else if("212" === a){ - energy = Math.floor((AGO.Planets.Get("active", "temp") + 40 + 140) / 6) * b + energy = Math.floor((AGO.Planets.Get("active", "tempMax") + 140) / 6) * b } if(AGO.Option.is("allofficers")){ @@ -1018,21 +1020,21 @@ AGO.Ogame = { } return Math.floor(energy * multiplicator); }, - getProductionResources: function(a, b) { + getProductionResources: function(idResource, level) { var resources = 0, multiplicator = 1; - if("1" === a){ - resources = 30 * b * Math.pow(1.1, b) - }else if("2" === a){ - resources = 20 * b * Math.pow(1.1, b) - } else if("3" === a){ - resources = 10 * b * Math.pow(1.1, b) * (1.28 - 0.004 * AGO.Planets.Get("active", "temp")) + if("1" === idResource){ + resources = 30 * level * Math.pow(1.1, level) + }else if("2" === idResource){ + resources = 20 * level * Math.pow(1.1, level) + } else if("3" === idResource){ + resources = 10 * level * Math.pow(1.1, level) * (1.36-0.004 * ((AGO.Planets.Get("active", "tempMin")+AGO.Planets.Get("active", "tempMax"))/2)) } - if(AGO.Option.is("geologist")){ - multiplicator = 1.1 - }else if(AGO.Option.is("allofficers")){ + if(AGO.Option.is("allofficers")){ multiplicator = 1.12 + }else if(AGO.Option.is("geologist")){ + multiplicator = 1.1 } return Math.floor(multiplicator * resources) * AGO.Uni.speed; }, @@ -1162,7 +1164,7 @@ AGO.Units = { Update: function(a) { var b; b = new XMLHttpRequest(); - b.open("GET", AGO.Uni.url + "/game/index.php?page=fetchTechs&ajax=1", !0); + b.open("GET", AGO.Uni.url + "/game/index.php?page=fetchTechs&ajax=1", true); b.setRequestHeader("Cache-Control", "no-cache"); b.setRequestHeader("Pragma", "no-cache"); b.overrideMimeType("text/html"); @@ -1267,7 +1269,7 @@ AGO.Time = { (d = AGO.Time.format( AGO.Time.ogameTime, "[d].[m].[Y] [H]:[i]:[s]", - !0 + true ))), (b.title = AGO.Label.get("A38")), DOM.addClass(b, null, "tooltip"), @@ -1310,7 +1312,7 @@ AGO.Time = { DOM.setText( "ago_clock_server", "id", - AGO.Time.format(a, "[d].[m].[Y] [H]:[i]:[s]", !0) + AGO.Time.format(a, "[d].[m].[Y] [H]:[i]:[s]", true) )); }, timestamp: function() { @@ -1366,7 +1368,7 @@ AGO.Time = { }, formatTimestamp: function(a, b) { return 1e6 < a - ? AGO.Time.format(1e3 * a, b || "[d].[m].[Y] [H]:[i]:[s]", !0) + ? AGO.Time.format(1e3 * a, b || "[d].[m].[Y] [H]:[i]:[s]", true) : ""; }, formatTime: function(a, b) { @@ -1835,7 +1837,7 @@ AGO.Task = { c[0] && (d || (d = a.split(c[0])[1]), AGO.Task.updateCoordsType(b, c[0].replace(/[^\d:]/g, ""))), - d && (b.time = AGO.Time.parseDateTime(d, !0)); + d && (b.time = AGO.Time.parseDateTime(d, true)); return b; }, trimCoords: function(a) { @@ -2000,7 +2002,7 @@ AGO.Fleet = { }; AGO.DataBase = { status: 0, - enabled: !1, + enabled: false, Data: {}, Info: { Player: "D36", @@ -2045,7 +2047,8 @@ AGO.Tools = { AGO.Planets.iterate(1, function(b, c) { a.Planets[c] = { name: b.name, - temp: b.temp + tempMin: b.tempMin, + tempMax: b.tempMax }; }), AGB.message("Tools", "Action", a, function(b) { diff --git a/js/coordinates.js b/js/coordinates.js index 69ec6fe..99b7b4c 100644 --- a/js/coordinates.js +++ b/js/coordinates.js @@ -79,5 +79,5 @@ document.addEventListener( function() { AGO.Select(); }, - !1 + false ); diff --git a/js/empire.js b/js/empire.js index 4045eeb..87ecb39 100644 --- a/js/empire.js +++ b/js/empire.js @@ -255,7 +255,7 @@ AGO.Empire = { 'you will have enough ressources
in your account in:

'), (a += '' + - AGO.Time.formatTime(Math.floor(3600 * c), !0) + + AGO.Time.formatTime(Math.floor(3600 * c), true) + "
"), (b = new Date(1e3 * (AGO.Acc.timestamp + Math.ceil(3600 * c)))), (a += diff --git a/js/fleet1.js b/js/fleet1.js index dc89ac0..4a33099 100644 --- a/js/fleet1.js +++ b/js/fleet1.js @@ -48,7 +48,7 @@ AGO.Fleet1 = { })); h && AGO.Option.is("F00") && - ((PAGE.enabled = !0), + ((PAGE.enabled = true), DOM.iterate( document.querySelectorAll( '#buttonz .content > form input[type="hidden"]' @@ -147,8 +147,8 @@ AGO.Fleet1 = { ["202", "203"][AGO.Option.get("F62", 2)] || b.thirdShip || "203"; b.preferCargo = "202" === b.preferShip ? "202" : "203"; b.secondCargo = "203" === b.preferCargo ? "202" : "203"; - b.need_smallCargo = Math.ceil(b.freight / 5e3); - b.need_largeCargo = Math.ceil(b.freight / 25e3); + b.need_smallCargo = Math.ceil(b.freight / AGO.Ogame.getShipCapacity(202, AGO.Ogame.getFleetDistance(AGO.Acc, b), b.speed)); + b.need_largeCargo = Math.ceil(b.freight / AGO.Ogame.getShipCapacity(203, AGO.Ogame.getFleetDistance(AGO.Acc, b), b.speed)); b.need_thirdShip = Math.ceil( b.freight / AGO.Item[b.thirdShip || "209"].capacity ); @@ -206,8 +206,9 @@ AGO.Fleet1 = { OBJ.iterate(AGO.Item.Resource, function(a) { g.freight += Math.max(c[a] - g[a], 1); }); - g.need_smallCargo = Math.ceil(g.freight / 5e3); - g.need_largeCargo = Math.ceil(g.freight / 25e3); + g.need_smallCargo = Math.ceil(g.freight / AGO.Ogame.getShipCapacity(202, AGO.Ogame.getFleetDistance(AGO.Acc, g), g.speed)); + g.need_largeCargo = Math.ceil(g.freight / AGO.Ogame.getShipCapacity(203, AGO.Ogame.getFleetDistance(AGO.Acc, g), g.speed)); + a = "203" === g.preferCargo ? g.need_largeCargo : g.need_smallCargo; g.status = c.ships ? 2 > g.owncoords || 4 <= g.owncoords @@ -229,7 +230,7 @@ AGO.Fleet1 = { : 0; break; case 6: - k = PAGE[6] = AGO.Task.splitActive(AGO.Option.get("F91", -1), 2, 3, !0); + k = PAGE[6] = AGO.Task.splitActive(AGO.Option.get("F91", -1), 2, 3, true); k.group = 2; k.mode = AGO.Option.get("F90"); k.label = AGO.Label.get("F90"); @@ -899,7 +900,7 @@ AGO.Fleet1 = { c(v, "crystal"), w ? DOM.appendTD(v) : c(v, "deuterium"); w - ? (b(s, "shipC", "209", !1), + ? (b(s, "shipC", "209", false), DOM.appendTD(s, "ago_calc_ships"), DOM.appendTD(s, "ago_calc_ships"), g(n, "ago_calc_consumption_shipC"), @@ -921,9 +922,9 @@ AGO.Fleet1 = { coords: " " }, null, - !0 + true ) - : h(l, PAGE[5], null, !0), + : h(l, PAGE[5], null, true), (DOM.appendA(l, "ago_target_reset btn_blue", null, { routine: 5, last: -1 @@ -986,7 +987,7 @@ AGO.Fleet1 = { : (b(s, "shipA", "202"), b(s, "shipB", "203"), r && PAGE[2].thirdShip - ? b(s, "shipC", PAGE[2].thirdShip, !1) + ? b(s, "shipC", PAGE[2].thirdShip, false) : DOM.appendTD(s, "ago_calc_ships"), g(n, "ago_calc_consumption_shipA"), g(n, "ago_calc_consumption_shipB"), @@ -1042,7 +1043,7 @@ AGO.Fleet1 = { ago_display_status: AGO.Option.is("F14") ? 1 : 2 }); f = DOM.appendDIV(h, "ago_shortcuts_header"); - f.addEventListener("click", PAGE.onShortcuts, !1); + f.addEventListener("click", PAGE.onShortcuts, false); DOM.appendA(f, "ago_display_arrow"); f = DOM.appendTABLE( h, @@ -1111,7 +1112,7 @@ AGO.Fleet1 = { 2 === b.type ? 8 === a && b["209"] : 8 === a - ? !1 + ? false : 15 === a ? 16 === b.position : b.owncoords && (3 > b.owncoords || c.stopActiveSelection) @@ -1124,7 +1125,7 @@ AGO.Fleet1 = { ? b["214"] && (3 <= b.owncoords || 3 === b.type) : 4 === a ? b.owncoords - : !0) + : true) ? a : 0 : 0; @@ -1281,16 +1282,16 @@ AGO.Fleet1 = { break; case 5: l = PAGE[5].freight; - c.ships ? a(c.capacity - c.consumption, l) : a(f.capacity, l); + c.ships ? a(c.capacity + c.consumption, l) : a(f.capacity, l); DOM.updateText("ago_info_freight", "id", l, 3); break; case 6: l = PAGE[6].freight; - c.ships ? a(c.capacity - c.consumption, l) : a(f.capacity, l); + c.ships ? a(c.capacity + c.consumption, l) : a(f.capacity, l); DOM.updateText("ago_info_freight", "id", l, 3); break; case 7: - c.ships ? a(c.capacity - c.consumption, -1) : a(c.capacity, -1); + c.ships ? a(c.capacity + c.consumption, -1) : a(c.capacity, -1); DOM.updateText("ago_info_expo", "id", c.expoints, 3); g = c.expoints >= PAGE[7].points @@ -1301,7 +1302,7 @@ AGO.Fleet1 = { case 3: case 10: c.ships - ? a(c.capacity - c.consumption, f.resources) + ? a(c.capacity + c.consumption, f.resources) : a(f.capacity, f.resources), DOM.updateText("ago_info_freight", "id", 0, 3); } @@ -1340,7 +1341,7 @@ AGO.Fleet1 = { type: b.typeActive }); } - PAGE.lockedDisplay = !1; + PAGE.lockedDisplay = false; f = c = b = g = k = d = l = g = null; }, displayCalculator: function() { @@ -1441,13 +1442,13 @@ AGO.Fleet1 = { DOM.setClassGroup(e, null, "ago_highlight", f), (f = c === a.coords - ? " " + AGO.Token.getClassSelected(a.typeActive, !0) + ? " " + AGO.Token.getClassSelected(a.typeActive, true) : ""), DOM.setClassGroup(e, null, "ago_selected", f)); }); e = null; }, - Action: function(a) { + Action: function(fleetParams) { function e(a) { var b; 28 === a.action @@ -1498,20 +1499,20 @@ AGO.Fleet1 = { function f() { function b(c) { - var f = AGO.Ogame.getShipCapacity(c, a.distance, d.speed); + var f = AGO.Ogame.getShipCapacity(c, fleetParams.distance, d.speed); g[c] && 0 < f && - ((a[c] = Math.min(Math.ceil(e / f), g[c])), (e -= a[c] * f)); + ((fleetParams[c] = Math.min(Math.ceil(e / f), g[c])), (e -= fleetParams[c] * f)); } var c, e; c = PAGE[2].preferShip; - 19 === a.action && a.id in AGO.Item.Ship && (c = a.id); - d.mission = a.mission || d.mission; + 19 === fleetParams.action && fleetParams.id in AGO.Item.Ship && (c = fleetParams.id); + d.mission = fleetParams.mission || d.mission; e = d.resources; - if (a.recalculate || 19 === a.action) - (a.speed = d.speed), - (a.distance = AGO.Ogame.getFleetDistance(AGO.Acc, d)), + if (fleetParams.recalculate || 19 === fleetParams.action) + (fleetParams.speed = d.speed), + (fleetParams.distance = AGO.Ogame.getFleetDistance(AGO.Acc, d)), b(c), 0 < e && "203" !== c && b("203"), 0 < e && "202" !== c && b("202"), @@ -1520,50 +1521,50 @@ AGO.Fleet1 = { PAGE[2].thirdShip && b(PAGE[2].thirdShip), 0 < e && - (a[c] += Math.ceil( - e / AGO.Ogame.getShipCapacity(c, a.distance, a.speed) + (fleetParams[c] += Math.ceil( + e / AGO.Ogame.getShipCapacity(c, fleetParams.distance, fleetParams.speed) )), - (VAL.check(a.action, 21, 22) || - (28 === a.action && "deuterium" === a.id)) && + (VAL.check(fleetParams.action, 21, 22) || + (28 === fleetParams.action && "deuterium" === fleetParams.id)) && d.deuterium && - (AGO.Task.updateShips(a, a.distance), - (d.deuterium -= a.consumption), + (AGO.Task.updateShips(fleetParams, fleetParams.distance), + (d.deuterium -= fleetParams.consumption), DOM.setValue("ago_calc_resource_deuterium", "id", d.deuterium, 8)), - (a.action = 10), - h(a); + (fleetParams.action = 10), + h(fleetParams); c = e = null; } function c() { var b; - AGO.Task.updateShips(a); - a.ships && - ((a.action = 10), - a["202"] - ? ((b = a["202"] - g["202"]), + AGO.Task.updateShips(fleetParams); + fleetParams.ships && + ((fleetParams.action = 10), + fleetParams["202"] + ? ((b = fleetParams["202"] - g["202"]), 0 < b && ((PAGE[3].status = 2), - (a["202"] = g["202"]), - (a["203"] = Math.ceil(b / 5)), - a["203"] > g["203"] && (PAGE[3].status = 1))) - : ((b = a["203"] - g["203"]), + (fleetParams["202"] = g["202"]), + (fleetParams["203"] = Math.ceil(b / 5)), + fleetParams["203"] > g["203"] && (PAGE[3].status = 1))) + : ((b = fleetParams["203"] - g["203"]), 0 < b && ((PAGE[3].status = 2), - (a["203"] = g["203"]), - (a["202"] = 5 * b), - a["202"] > g["202"] && (PAGE[3].status = 1))), - h(a)); + (fleetParams["203"] = g["203"]), + (fleetParams["202"] = 5 * b), + fleetParams["202"] > g["202"] && (PAGE[3].status = 1))), + h(fleetParams)); } function b() { var b, c; c = d.metal + d.crystal; - a.recalculate && + fleetParams.recalculate && ((b = AGO.Ogame.getFleetDistance(AGO.Acc, d)), (b = AGO.Ogame.getShipCapacity("209", b, d.speed)), - (a["209"] = Math.ceil(c / b)), - (a.action = 10), - h(a)); + (fleetParams["209"] = Math.ceil(c / b)), + (fleetParams.action = 10), + h(fleetParams)); } var g, k, d, l, m, q; @@ -1573,10 +1574,10 @@ AGO.Fleet1 = { if ( (l = document.getElementById("inhalt")) && AGO.Init.status && - OBJ.hasProperties(a) + OBJ.hasProperties(fleetParams) ) { - PAGE.lockedDisplay = !0; - if ((m = PAGE.getRoutine(a.routine) ? a.routine : 0)) + PAGE.lockedDisplay = true; + if ((m = PAGE.getRoutine(fleetParams.routine) ? fleetParams.routine : 0)) (d.routine = d.mission = d.stopActiveSelection = 0), 1 === PAGE.getRoutine(m) ? (m !== k.calculator && @@ -1587,58 +1588,58 @@ AGO.Fleet1 = { }), 2 === d.type && (d.type = 0)), 2 <= PAGE.getRoutine(k.calculator) && - ((a.speed = 10), + ((fleetParams.speed = 10), h({ action: 10 }), - AGO.Task.updateCoordsType(a, k.coordstype), - 4 <= a.owncoords && (d.type = a.type = 0))) + AGO.Task.updateCoordsType(fleetParams, k.coordstype), + 4 <= fleetParams.owncoords && (d.type = fleetParams.type = 0))) : 2 <= PAGE.getRoutine(m) && (d.resources && e({ action: 23 }), 10 === m - ? PAGE.getRoutine(m + (+a.last || 0), "status") && - ((PAGE[10].last = +a.last || 0), - (q = a.target ? 0 : 2), - (a = AGO.Task.create(PAGE[m + PAGE[10].last], q)), - AGO.Task.updateResources(a), - a.resources && ((a.action = 20), e(a)), - (a.action = 2 === q ? 10 : 0)) - : (PAGE.Init(m, a.last), - (a = AGO.Task.create(PAGE[m], 2)), - (a.action = 10)), - (a.speed = a.speed || 10), - 10 === a.action && h(a)), + ? PAGE.getRoutine(m + (+fleetParams.last || 0), "status") && + ((PAGE[10].last = +fleetParams.last || 0), + (q = fleetParams.target ? 0 : 2), + (fleetParams = AGO.Task.create(PAGE[m + PAGE[10].last], q)), + AGO.Task.updateResources(fleetParams), + fleetParams.resources && ((fleetParams.action = 20), e(fleetParams)), + (fleetParams.action = 2 === q ? 10 : 0)) + : (PAGE.Init(m, fleetParams.last), + (fleetParams = AGO.Task.create(PAGE[m], 2)), + (fleetParams.action = 10)), + (fleetParams.speed = fleetParams.speed || 10), + 10 === fleetParams.action && h(fleetParams)), (k.calculator = m), PAGE.showCalculator(); else { - VAL.check(a.action, 12, 10) && h(a); - a.mission = PAGE.Mission.check(a.mission); - if (VAL.check(a.action, 41, 42)) { - if (a.type || a.mission) d.stopAutoHarvest = 1; - a.type && (d.stopActiveSelection = 1); + VAL.check(fleetParams.action, 12, 10) && h(fleetParams); + fleetParams.mission = PAGE.Mission.check(fleetParams.mission); + if (VAL.check(fleetParams.action, 41, 42)) { + if (fleetParams.type || fleetParams.mission) d.stopAutoHarvest = 1; + fleetParams.type && (d.stopActiveSelection = 1); } - 3 <= a.owncoords && ((d.type = 0), 3 > d.owncoords && (a.type = 0)); - 4 === k.calculator && (a.type = 0); + 3 <= fleetParams.owncoords && ((d.type = 0), 3 > d.owncoords && (fleetParams.type = 0)); + 4 === k.calculator && (fleetParams.type = 0); } - a.type = PAGE.Type.check(a.type); - AGO.Task.updateCoords(a, 4); + fleetParams.type = PAGE.Type.check(fleetParams.type); + AGO.Task.updateCoords(fleetParams, 4); OBJ.iterate(AGO.Item.CoordinatesType, function(b) { - a[b] && - ((d[b] = a[b]), + fleetParams[b] && + ((d[b] = fleetParams[b]), "type" !== b && - (DOM.setValue('input[name="' + b + '"]', l, a[b], 8), - DOM.setValue("ago_" + b, "id", a[b]))); + (DOM.setValue('input[name="' + b + '"]', l, fleetParams[b], 8), + DOM.setValue("ago_" + b, "id", fleetParams[b]))); }); AGO.Task.updateCoords(d, 3); d.owncoords && (d.owncoords = AGO.Planets.owncoords(d.coords, d.type || AGO.Acc.type)); 3 > d.owncoords && (d.stopActiveSelection = 0); - a.arrival && - ((d.coordsMarked = a.coords || ""), - (d.arrivalMarked = +a.arrival || 0)); + fleetParams.arrival && + ((d.coordsMarked = fleetParams.coords || ""), + (d.arrivalMarked = +fleetParams.arrival || 0)); OBJ.iterateArray( [ "holdingtime", @@ -1648,16 +1649,16 @@ AGO.Fleet1 = { "preferResource" ], function(b) { - d[b] = +a[b] || 0; + d[b] = +fleetParams[b] || 0; } ); - VAL.check(a.plunder, 50, 75, 100) && (d.plunder = a.plunder); - NMR.isMinMax(a.speed, 1, 10) && - ((d.speed = a.speed), + VAL.check(fleetParams.plunder, 50, 75, 100) && (d.plunder = fleetParams.plunder); + NMR.isMinMax(fleetParams.speed, 1, 10) && + ((d.speed = fleetParams.speed), DOM.setValue('input[name="speed"]', l, d.speed, 8)); - VAL.check(a.action, 20, 21, 22, 23, 28) && e(a); + VAL.check(fleetParams.action, 20, 21, 22, 23, 28) && e(fleetParams); AGO.Task.updateResources(d); - a.recalculate = + fleetParams.recalculate = (d.coords + ":" + d.speed !== d.previousTarget && d.resources) || (d.metal + ":" + d.crystal + ":" + d.deuterium !== d.previousResources && @@ -1667,30 +1668,30 @@ AGO.Fleet1 = { f(); break; case 3: - a.stop = a.owncoords && 41 === a.action; + fleetParams.stop = fleetParams.owncoords && 41 === fleetParams.action; c(); break; case 4: - a.stop = 2 !== a.type && 42 === a.action; + fleetParams.stop = 2 !== fleetParams.type && 42 === fleetParams.action; b(); break; case 5: - a.stop = !d.owncoords || 2 === d.type; - d.mission = VAL.select(a.mission, 3, 4) || d.mission; - 2 <= a.owncoords && - 41 === a.action && - (PAGE.Init(5, 2, a.coordstype), PAGE.showCalculator()); + fleetParams.stop = !d.owncoords || 2 === d.type; + d.mission = VAL.select(fleetParams.mission, 3, 4) || d.mission; + 2 <= fleetParams.owncoords && + 41 === fleetParams.action && + (PAGE.Init(5, 2, fleetParams.coordstype), PAGE.showCalculator()); break; case 7: - a.stop = VAL.check(a.action, 11, 12); + fleetParams.stop = VAL.check(fleetParams.action, 11, 12); break; case 6: - d.mission = a.mission || d.mission; + d.mission = fleetParams.mission || d.mission; break; case 10: - d.mission = a.mission || d.mission; + d.mission = fleetParams.mission || d.mission; } - if (a.stop) { + if (fleetParams.stop) { PAGE.Action({ routine: 2, action: 13 @@ -1756,24 +1757,24 @@ AGO.Fleet1 = { 2 <= PAGE.getRoutine(PAGE.Para.calculator) && 2 <= PAGE.getRoutine(PAGE.Para.calculator, "status") && DOM.click("#continue.on")), - !1 + false ); if (12 !== a.inputType) { - if (65 === a.keyCode) return DOM.click("#sendall"), !1; - if (77 === a.keyCode) return DOM.click("span.send_most a"), !1; - if (81 === a.keyCode) return DOM.click("span.send_none a"), !1; - if (84 === a.keyCode) return DOM.click("#ago_routine_2"), !1; - if (82 === a.keyCode) return DOM.click("#ago_routine_4"), !1; - if (83 === a.keyCode) return DOM.click("#ago_routine_5"), !1; - if (70 === a.keyCode) return DOM.click("#ago_routine_6"), !1; - if (69 === a.keyCode) return DOM.click("#ago_routine_7"), !1; - if (76 === a.keyCode) return DOM.click("#ago_routine_10"), !1; + if (65 === a.keyCode) return DOM.click("#sendall"), false; + if (77 === a.keyCode) return DOM.click("span.send_most a"), false; + if (81 === a.keyCode) return DOM.click("span.send_none a"), false; + if (84 === a.keyCode) return DOM.click("#ago_routine_2"), false; + if (82 === a.keyCode) return DOM.click("#ago_routine_4"), false; + if (83 === a.keyCode) return DOM.click("#ago_routine_5"), false; + if (70 === a.keyCode) return DOM.click("#ago_routine_6"), false; + if (69 === a.keyCode) return DOM.click("#ago_routine_7"), false; + if (76 === a.keyCode) return DOM.click("#ago_routine_10"), false; } return 11 !== a.inputType || (38 !== a.keyCode && 40 !== a.keyCode) || (!AGO.Item.Ship[STR.check(NMR.parseIntAbs(a.target.id))] && !HTML.hasClass(a.target.className, "ago_keys_arrows")) - ? !0 + ? true : DOM.changeInput(a, a.target); }, onSwipe: function(a) { @@ -1813,7 +1814,7 @@ AGO.Fleet1 = { c = h.id; f = h.type || 19 === h.action; if (PAGE.timeoutCalculator) window.clearTimeout(PAGE.timeoutCalculator); - else if ("click" === e && f) return !0; + else if ("click" === e && f) return true; if ("mousedown" === e) { if (f) { var b = JSON.stringify(h); @@ -1959,31 +1960,32 @@ AGO.Fleet1 = { }, 150); } }; -AGO.Task.updateShips = function(a, e) { +AGO.Task.updateShips = function(fleetParams, distance) { + var h; - OBJ.is(a) && - ((a.consumption = 1), - (a["212"] = 0), - (a.ships = a.shipsCivil = a.shipsCombat = a.capacity = a.expoints = a.minspeed = 0), - OBJ.iterate(AGO.Item.Ship, function(e) { - var c; - if ((c = a[e])) + OBJ.is(fleetParams) && + ((fleetParams.consumption = 1), + (fleetParams["212"] = 0), + (fleetParams.ships = fleetParams.shipsCivil = fleetParams.shipsCombat = fleetParams.capacity = fleetParams.expoints = fleetParams.minspeed = 0), + OBJ.iterate(AGO.Item.Ship, function(shipId) { + var shipNumber; + if ((shipNumber = fleetParams[shipId])) if ( - (e in AGO.Item.ShipCivil ? (a.shipsCivil += c) : (a.shipsCombat += c), - (a.ships += c), - (a.capacity += c * AGO.Item[e].capacity), - (a.expoints += (AGO.Item[e].metal + AGO.Item[e].crystal) / 200 * c), - (c = AGO.Ogame.getShipSpeed(e)), - !a.minspeed || c < a.minspeed) + (shipId in AGO.Item.ShipCivil ? (fleetParams.shipsCivil += shipNumber) : (fleetParams.shipsCombat += shipNumber), + (fleetParams.ships += shipNumber), + (fleetParams.capacity += shipNumber * AGO.Ogame.getShipCapacity(shipId, distance, fleetParams.speed)), + (fleetParams.expoints += (AGO.Item[shipId].metal + AGO.Item[shipId].crystal) / 200 * shipNumber), + (shipNumber = AGO.Ogame.getShipSpeed(shipId)), + !fleetParams.minspeed || shipNumber < fleetParams.minspeed) ) - (a.minspeed = c), (h = e); + (fleetParams.minspeed = shipNumber), (h = shipId); }), - e && - ((a.duration = AGO.Ogame.getFleetDuration(h, e, a.speed)), + distance && + ((fleetParams.duration = AGO.Ogame.getFleetDuration(h, distance, fleetParams.speed)), OBJ.iterate(AGO.Item.Ship, function(f) { - a[f] && - (a.consumption += - a[f] * AGO.Ogame.getShipConsumption(f, e, a.duration)); + fleetParams[f] && + (fleetParams.consumption += + fleetParams[f] * AGO.Ogame.getShipConsumption(f, distance, fleetParams.duration)); }), - (a.consumption = Math.round(a.consumption)))); + (fleetParams.consumption = Math.round(fleetParams.consumption)))); }; diff --git a/js/fleet2.js b/js/fleet2.js index c8a0b4d..c5deaa0 100644 --- a/js/fleet2.js +++ b/js/fleet2.js @@ -26,7 +26,7 @@ AGO.Fleet2 = { Read: function() { var a, b, c; if ((b = document.getElementById("inhalt")) && AGO.Option.is("F00")) { - PAGE.enabled = !0; + PAGE.enabled = true; a = PAGE.Para = OBJ.parse(AGO.Fleet.Get("Current", "Task2", 6)); DOM.iterate( document.querySelectorAll("#contentWrapper > form input"), @@ -56,7 +56,7 @@ AGO.Fleet2 = { if (2 <= a.routine || AGO.Option.is("F51")) (a.type = PAGE.Type.check(a.type) || AGO.Acc.type), 6 === a.routine && - ((b = AGO.Task.splitActive(AGO.Option.get("F91", -1), 2, 3, !0)), + ((b = AGO.Task.splitActive(AGO.Option.get("F91", -1), 2, 3, true)), (a.type = PAGE.Type.check(b.type) || a.type)), a.routine ? ((a.mission = PAGE.Mission.check(a.mission)), @@ -345,7 +345,7 @@ AGO.Fleet2 = { ago_display_status: AGO.Option.is("F15") ? 1 : 2 }); f = DOM.appendDIV(d, "ago_shortcuts_header"); - f.addEventListener("click", PAGE.onShortcuts, !1); + f.addEventListener("click", PAGE.onShortcuts, false); DOM.appendA(f, "ago_display_arrow"); f = DOM.appendTABLE( d, @@ -427,7 +427,7 @@ AGO.Fleet2 = { 2 === c.type ? 8 === a : 8 === a - ? !1 + ? false : 15 === a ? 16 === c.position : 9 === a @@ -460,7 +460,7 @@ AGO.Fleet2 = { 18 ); if (!PAGE.updateDisplaySpeed) { - PAGE.lockedDisplay = !0; + PAGE.lockedDisplay = true; b.maxspeed = AGO.Option.is("F16") ? +AGO.Global.message( { @@ -603,7 +603,7 @@ AGO.Fleet2 = { } PAGE.displayUnion(); PAGE.displayMarked(); - PAGE.lockedDisplay = !1; + PAGE.lockedDisplay = false; d = f = f = e = null; } }, @@ -709,7 +709,7 @@ AGO.Fleet2 = { : ""), DOM.setClassGroup(b, null, "ago_highlight", d), (d = - f === a.coords ? " " + AGO.Token.getClassSelected(a.type, !0) : ""), + f === a.coords ? " " + AGO.Token.getClassSelected(a.type, true) : ""), DOM.setClassGroup(b, null, "ago_selected", d)); }), DOM.iterate(b.querySelectorAll(".ago_hover[ago-task-union]"), function( @@ -718,7 +718,7 @@ AGO.Fleet2 = { var d; d = +b.getAttribute("ago-task-union") === a.union - ? " " + AGO.Token.getClassSelected(a.type, !0) + ? " " + AGO.Token.getClassSelected(a.type, true) : ""; DOM.setClassGroup(b, null, "ago_selected", d); }); @@ -780,7 +780,7 @@ AGO.Fleet2 = { (c = document.querySelector("#contentWrapper > form")) && AGO.Init.status && a && - ((PAGE.lockedDisplay = !0), + ((PAGE.lockedDisplay = true), a.arrival && ((b.coordsMarked = a.coords || ""), (b.arrivalMarked = +a.arrival || 0)), @@ -875,8 +875,8 @@ AGO.Fleet2 = { }, onKeydown: function(a) { return 13 === a.keyCode - ? (DOM.hasClass("continue", "id", "on") && DOM.click("#continue.on"), !1) - : !0; + ? (DOM.hasClass("continue", "id", "on") && DOM.click("#continue.on"), false) + : true; }, onSwipe: function(a) { "left" === a && DOM.click("#back"); diff --git a/js/fleet3.js b/js/fleet3.js index ff4264a..cc11dc0 100644 --- a/js/fleet3.js +++ b/js/fleet3.js @@ -22,7 +22,7 @@ AGO.Fleet3 = { var a, b, c; (b = document.getElementById("inhalt")) && AGO.Option.is("F00") && - ((PAGE.enabled = !0), + ((PAGE.enabled = true), (a = PAGE.Para = OBJ.parse(AGO.Fleet.Get("Current", "Task3", 6))), DOM.iterate( document.querySelectorAll( @@ -62,7 +62,7 @@ AGO.Fleet3 = { var a, b, c; (c = document.getElementById("inhalt")) && PAGE.enabled && - ((PAGE.lockedDisplay = !0), + ((PAGE.lockedDisplay = true), (a = PAGE.Para), AGO.Option.is("F51") && OBJ.iterateArray([15, 7, 8, 6, 1, 4, 3], function(a) { @@ -407,7 +407,7 @@ AGO.Fleet3 = { a = PAGE.Next; (b = document.getElementById("inhalt")) && 7 <= AGO.Init.status && - ((d = PAGE.lockedDisplay = !0), + ((d = PAGE.lockedDisplay = true), PAGE.updateTask(a, 1), (a.arrivalUnion = 2 === a.mission ? PAGE.Para.arrivalUnion : 0), (a.resources = 0), @@ -416,7 +416,7 @@ AGO.Fleet3 = { c = AGO.Units.get(b); "deuterium" === b && (c -= document.querySelector('#consumption').textContent.split(' ')[0].replace('.', '')); a.resources += a[b]; - 1.01 * a[b] < c - PAGE.Mini[b] && (d = !1); + 1.01 * a[b] < c - PAGE.Mini[b] && (d = false); DOM.setText("ago_fleet_remaining_" + b, "id", Math.max(c - a[b], 0), 5); }), (e = a.resources @@ -485,7 +485,7 @@ AGO.Fleet3 = { ), PAGE.displayUnion(), PAGE.displayMarked()); - PAGE.lockedDisplay = !1; + PAGE.lockedDisplay = false; a = b = c = null; }, displayUnion: function() { @@ -612,7 +612,7 @@ AGO.Fleet3 = { (d = document.getElementById("inhalt")) && AGO.Init.status && a && - ((PAGE.lockedDisplay = !0), + ((PAGE.lockedDisplay = true), (g = a.action), a.arrival && ((f.coordsMarked = a.coords || ""), @@ -628,7 +628,7 @@ AGO.Fleet3 = { role: "updateHoldingOrExpTime" })), a.retreatAfterDefenderRetreat && - DOM.setProperty("#fightAfterRetreat input", d, "checked", !0), + DOM.setProperty("#fightAfterRetreat input", d, "checked", true), a.preferResource && (f = { metal: 1, @@ -746,13 +746,13 @@ AGO.Fleet3 = { "A" !== document.activeElement.nodeName && "INPUT" !== document.activeElement.nodeName ) - return DOM.hasClass("start", "id", "on") && DOM.click("#start.on"), !1; + return DOM.hasClass("start", "id", "on") && DOM.click("#start.on"), false; } else { - if (65 === a.keyCode) return DOM.click("#allresources"), !1; - if (77 === a.keyCode) return DOM.click("#mostresources"), !1; - if (81 === a.keyCode) return DOM.click("#noneresources"), !1; + if (65 === a.keyCode) return DOM.click("#allresources"), false; + if (77 === a.keyCode) return DOM.click("#mostresources"), false; + if (81 === a.keyCode) return DOM.click("#noneresources"), false; } - return !0; + return true; }, onSwipe: function(a) { "diagUp" === a && DOM.click("#noneresources"); diff --git a/js/galaxy.js b/js/galaxy.js index 6e4f569..58c24d1 100644 --- a/js/galaxy.js +++ b/js/galaxy.js @@ -1,7 +1,7 @@ AGO.Galaxy = { status: 0, - enabled: !1, - improve: !1, + enabled: false, + improve: false, direction: 1, Data: {}, Task: {}, @@ -14,7 +14,7 @@ AGO.Galaxy = { }, Run: function() { if(AGO.Option.is("G40") && !AGO.App.OgameMobile){ - AGO.Galaxy.enabled = !0; + AGO.Galaxy.enabled = true; AGO.Galaxy.improve = AGO.Option.is("G41"); AGO.Galaxy.shrink = AGO.Option.get("G42", 2); AGO.Galaxy.status = 5; @@ -30,7 +30,7 @@ AGO.Galaxy = { (AGO.Galaxy.direction = 0), 12 === a.inputType && document.activeElement.blur(), DOM.click("#galaxyHeader .btn_blue"), - !1 + false ); if (12 !== a.inputType && !a.cached) { if (32 === a.keyCode && AGO.Option.is("U33")) @@ -40,14 +40,14 @@ AGO.Galaxy = { : 1 === AGO.Galaxy.direction ? DOM.click("#galaxyHeader .galaxy_icons:nth-child(8)") : DOM.click("#galaxyHeader .btn_blue"), - !1 + false ); 37 === a.keyCode && (AGO.Galaxy.direction = -1); 39 === a.keyCode && (AGO.Galaxy.direction = 1); - if (65 === a.keyCode) return DOM.click("#galaxyHeader .galaxy_icons:nth-child(6)"), !1; - if (68 === a.keyCode) return DOM.click("#galaxyHeader .galaxy_icons:nth-child(8)"), !1; + if (65 === a.keyCode) return DOM.click("#galaxyHeader .galaxy_icons:nth-child(6)"), false; + if (68 === a.keyCode) return DOM.click("#galaxyHeader .galaxy_icons:nth-child(8)"), false; } - return !0; + return true; }, onSwipe: function(a) { AGO.App.OgameMobile || @@ -142,12 +142,12 @@ AGO.Galaxy = { if(head) { galaxyNb[0].style.width = "60px"; galaxyNb[1].style.width = "150px"; - galaxyNb[4].style.width = "160px"; + galaxyNb[4].style.width = "165px"; DOM.before(galaxyNb[0], galaxyNb[1]); } else { galaxyNb[1].style.width = "60px"; galaxyNb[2].style.width = "150px"; - galaxyNb[5].style.width = "160px"; + galaxyNb[5].style.width = "165px"; DOM.before(galaxyNb[1], galaxyNb[2]); } systemNb = galaxyNb[h]; @@ -564,8 +564,8 @@ AGO.Galaxy = { OBJ.is(a) && (AGO.Option.is("CE0") && (d = - b(a, 99, "", !0) || - b(a, 96, "", !0) || + b(a, 99, "", true) || + b(a, 96, "", true) || b(a, 98, "", !a.planetActivity && !a.moonActivity) || b(a, 97, "", !a.planetActivity && !a.moonActivity) || b(a, 95, "", !a.debrisResources) || @@ -600,7 +600,7 @@ AGO.Galaxy = { ) (b = DOM.getData(a, null, 1)), b.tab && - (a.addEventListener("click", AGO.Galaxy.click, !1), + (a.addEventListener("click", AGO.Galaxy.click, false), AGO.Galaxy.appendTooltipToken(a, b), AGO.Galaxy.appendTooltipSearch(a, b)); }, @@ -674,7 +674,7 @@ AGO.Galaxy = { p = void 0, m = void 0; AGO.Option.is(g) && - ((h = !0), + ((h = true), (p = { message: { page: "Tools", diff --git a/js/global.js b/js/global.js index ad4b804..66222fe 100644 --- a/js/global.js +++ b/js/global.js @@ -97,7 +97,7 @@ window.addEventListener( a.msgIds && window.executeAction(a.msgIds, a.actionMode); } }, - !1 + false ); var AGO = { Data: {}, @@ -234,13 +234,13 @@ var AGO = { elClassList = c[0].classList || ""; k = AGO.Data.U60; h = AGO.Data.U61; - l = !1; + l = false; m = +AGO.Data.U62 || 0; g = AGO.Data.page; elClassList.contains("ago_menu_help") - ? ((k = !0), + ? ((k = true), (m = Math.max(m, 5)), - (f.hideOthers = !0), + (f.hideOthers = true), (f.maxWidth = Math.max(Math.min(600, window.innerWidth - 30), 0)), elClassList.contains("ago_menu_help_label") ? (f.hook = { @@ -292,14 +292,14 @@ var AGO = { AGO.Data.U65 && ((f.hideAfter = Math.max(100 * (+AGO.Data.U65 || 0), 300)), (f.hideDelay = f.hideAfter), - (f.hideOthers = !0))) + (f.hideOthers = true))) : k && ("overview" === g ? elClassList.contains("tooltipLeft") && $(c) .parent() .hasClass("planetMoveStart") - ? (h = !0) + ? (h = true) : elClassList.contains("tooltipBottom") && ((c = $(c) .parent() @@ -318,7 +318,7 @@ var AGO = { $(c) .parent() .attr("id") - ? (h = !1) + ? (h = false) : "maxlink" === $(c).attr("id") && (l = h) : "fleet1" === g ? -1 < @@ -330,17 +330,17 @@ var AGO = { "movement" !== g && ("galaxy" === g ? elClassList.contains("activity ") - ? (h = !0) + ? (h = true) : $(c) .parent() - .hasClass("buildingimg") && (h = !1) + .hasClass("buildingimg") && (h = false) : "galaxy" === g - ? (h = !1) + ? (h = false) : "messages" === g - ? "button" === $(c).attr("type") && (h = !1) - : (h = !1)), + ? "button" === $(c).attr("type") && (h = false) + : (h = false)), elClassList.contains("tooltip") && (l = h)); - l ? (f.showOn = !1) : k && (f.showDelay = Math.max(100 * m, 100)); + l ? (f.showOn = false) : k && (f.showDelay = Math.max(100 * m, 100)); return f; }; }, diff --git a/js/init.js b/js/init.js index 6c17741..4d7d06d 100644 --- a/js/init.js +++ b/js/init.js @@ -1,12 +1,14 @@ -if (!AGO) var AGO = {}; +if (!AGO){ + var AGO = {}; +} AGO.versionOGameMax = "5.7.99"; -if (window.navigator.userAgent.indexOf("Firefox") > -1){ - AGO.isPhone = -1 < window.navigator.userAgent.indexOf("Mobile"); - AGO.isTablet = -1 < window.navigator.userAgent.indexOf("Tablet"); +if (window.navigator.userAgent.includes("Firefox")){ + AGO.isPhone = window.navigator.userAgent.includes("Mobile"); + AGO.isTablet = window.navigator.userAgent.includes("Tablet"); AGO.isMobile = AGO.isPhone || AGO.isTablet; - AGO.isFirefox = 0; + AGO.isFirefox = false; } -AGO.isChrome = -1 < window.navigator.userAgent.indexOf("Chrome"); +AGO.isChrome = window.navigator.userAgent.includes("Chrome"); AGO.context = AGO.isFirefox ? this : 0; AGO.Page = { Messages: function(a, b) { @@ -63,7 +65,7 @@ var PAGE = {}, try { return ( (b = new XMLHttpRequest()), - b.open("GET", chrome.extension.getURL(a), !1), + b.open("GET", chrome.extension.getURL(a), false), b.overrideMimeType("text/plain"), b.send(null), b.responseText || "" @@ -77,8 +79,16 @@ var PAGE = {}, } }; AGO.Init = { + // 0: App not started yet + // 1: App started + // 2: App initiatied + // 4: App readed + // 5: App is running + // 6: App interactive + // 7: App ready + // 8: App start completed status: 0, - active: !1, + active: true, KeydownCache: [], timing: Date.now(), loop: 0, @@ -101,30 +111,38 @@ AGO.Init = { }, Start: function() { AGO.Init.status = 0; - document.location && document.location.href && document.documentElement - ? ((AGB.message = AGO.isFirefox ? AGB.messageFirefox : AGB.messageChrome), - AGO.App.Start(), - 20 < AGO.Notify.problem - ? document.addEventListener("DOMContentLoaded", AGO.Main.Run, !1) - : AGO.App.mode && - ((AGO.Init.status = 1), - (AGO.Init.active = document.hasFocus()), - AGO.Observer.Start(), - AGO.App.reload - ? AGO.Observer.Head(function() { - AGO.App.Init(); - AGO.Init.Init(); - }) - : (AGO.Option.Start(), - AGO.Styles.Start(), - AGO.Option.is("O04") && (document.title = AGO.App.title), - AGO.Observer.Head(function() { - AGO.App.Init(); - AGO.Styles.Init(); - }), - AGO.Init.Init()))) - : 300 > ++AGO.Init.loop && - window.setTimeout(AGO.Init.Start, AGO.Init.loop); + if(document.location && document.location.href && document.documentElement) { + AGB.message = AGO.isFirefox ? AGB.messageFirefox : AGB.messageChrome; + AGO.App.Start(); + if(20 < AGO.Notify.problem) { + document.addEventListener("DOMContentLoaded", AGO.Main.Run, false); + }else if(AGO.App.mode) { + AGO.Init.status = 1; + AGO.Init.active = document.hasFocus(); + AGO.Observer.Start(); + if(AGO.App.reload) { + AGO.Observer.Head(function () { + AGO.App.Init(); + AGO.Init.Init(); + }) + }else { + AGO.Option.Start(); + AGO.Styles.Start(); + if(AGO.Option.is("O04")) { + document.title = AGO.App.title; + } + AGO.Observer.Head(function () { + AGO.App.Init(); + AGO.Styles.Init(); + }); + AGO.Init.Init(); + } + } + }else{ + if(300 > ++AGO.Init.loop){ + window.setTimeout(AGO.Init.Start, AGO.Init.loop); + } + } }, Init: function() { AGB.message( @@ -189,7 +207,7 @@ AGO.Init = { AGO.Planets.Read(), AGO.Planets.status && ((AGO.App.mode = 5), - (AGO.App.OgameMain = !0), + (AGO.App.OgameMain = true), AGO.Time.Read(), AGO.Units.Read(), AGO.Main.Read(), @@ -198,7 +216,7 @@ AGO.Init = { : 100 > ++AGO.Init.loop && (AGB.Log( "Init - Read - waiting for page script - loaded " + AGO.App.Page, - !0 + true ), window.setTimeout(AGO.Init.Read, AGO.Init.loop))); }, @@ -225,7 +243,7 @@ AGO.Init = { ? ((AGO.Observer.mutationObject = DOM.addObserver( document.body, { - childList: !0 + childList: true }, AGO.Observer.Mutation )), @@ -275,8 +293,8 @@ AGO.Init = { ((AGO.Background.Data = a.Background || {}), AGO.Option.Init(a.Option), AGO.Fleet.Init(a.Fleet), - AGO.Box.Init(a.Box, !0), - AGO.Panel.Init(a.Panel, !0)); + AGO.Box.Init(a.Box, true), + AGO.Panel.Init(a.Panel, true)); }); }, Content: function(a) { @@ -334,7 +352,7 @@ AGO.Init = { }, onKeydown: function(a) { var b, c, d, e; - e = !0; + e = true; AGO.App.Ogame && AGO.Init.activeOverlay && ((b = document.querySelectorAll("body > .ui-dialog .ui-dialog-content")), @@ -355,7 +373,7 @@ AGO.Init = { ? (e = AGO.Menu.onKeydown(a)) : "function" === typeof PAGE.onKeydown && (e = PAGE.onKeydown(a)), e && AGO.App.OgameMain && (e = AGO.Main.onKeydown(a))); - if (!1 === e && !a.cached) + if (false === e && !a.cached) try { a.preventDefault(); } catch (g) {} @@ -431,7 +449,7 @@ AGO.Init = { AGO.Init.status && "function" === typeof a && ((c = new XMLHttpRequest()), - c.open("GET", AGO.Uni.url + "/game/index.php?page=fetchTechs&ajax=1", !0), + c.open("GET", AGO.Uni.url + "/game/index.php?page=fetchTechs&ajax=1", true), c.overrideMimeType("text/html"), (c.onerror = c.onload = function() { AGO.Init.status && @@ -487,63 +505,49 @@ AGO.Observer = { interactive: [null], mousedown: null, Start: function() { - var a; - a = document.onreadystatechange; + var nativeOnReadyStateChange; + nativeOnReadyStateChange = document.onreadystatechange; document.onreadystatechange = function() { "interactive" === document.readyState && (AGO.Observer.Call(AGO.Observer.body), AGO.Observer.Call(AGO.Observer.interactive)); try { - a(); + nativeOnReadyStateChange(); } catch (b) {} }; - document.addEventListener( - "DOMContentLoaded", - function c() { - document.removeEventListener("DOMContentLoaded", c, !1); + document.addEventListener("DOMContentLoaded", function overrideDOMContentLoad() { + document.removeEventListener("DOMContentLoaded", overrideDOMContentLoad, false); AGO.Observer.Call(AGO.Observer.body); AGO.Observer.Call(AGO.Observer.interactive); - }, - !1 + }, false ); - window.addEventListener( - "blur", - function() { - AGO.Init.active = !1; - }, - !1 + window.addEventListener("blur", function() { + AGO.Init.active = false; + }, false ); - window.addEventListener( - "focus", - function() { + window.addEventListener("focus", function() { AGO.Init.active || - ((AGO.Init.active = !0), 7 <= AGO.Init.status && AGO.Init.Refresh()); - }, - !1 + ((AGO.Init.active = true), 7 <= AGO.Init.status && AGO.Init.Refresh()); + }, false ); - window.addEventListener( - "beforeunload", - function() { + window.addEventListener("beforeunload", function() { DOM.removeObserver(AGO.Observer.mutationObject); AGO.Init.status = 0; - }, - !1 + }, false ); - window.addEventListener("keydown", AGO.Observer.onKeydown, !0); - window.addEventListener( - "ago_global_send", - function(a) { + window.addEventListener("keydown", AGO.Observer.onKeydown, true); + window.addEventListener("ago_global_send", function(a) { a = OBJ.parse(a ? a.detail : ""); a.page && AGO.Init.Messages(a.page, a.role, a.data); - }, - !1 + }, false ); - AGO.isChrome && - chrome.runtime.onMessage.addListener(function(a) { - a && - a.player === AGO.App.keyPlayer && - AGO.Init.Messages(a.page, a.role, a.data); - }); + if(AGO.isChrome) { + chrome.runtime.onMessage.addListener(function (a) { + if(a && a.player === AGO.App.keyPlayer) { + AGO.Init.Messages(a.page, a.role, a.data); + } + }); + } document.addEventListener( "mousedown", function(a) { @@ -564,7 +568,7 @@ AGO.Observer = { "function" === typeof a && a()); } }, - !1 + false ); document.addEventListener( "mouseup", @@ -576,33 +580,33 @@ AGO.Observer = { a.metaKey || AGO.Init.Select(); }, - !1 + false ); document.addEventListener( "touchstart", function(a) { - var d, e; + var halfWidth, pageX; AGO.Observer.area = 0; a && a.target && 1 === a.touches.length && - ((AGO.Observer.startX = AGO.Observer.pageX = e = a.touches[0].pageX), + ((AGO.Observer.startX = AGO.Observer.pageX = pageX = a.touches[0].pageX), (AGO.Observer.startY = AGO.Observer.pageY = a.touches[0].pageY), - (d = Math.floor((+document.body.clientWidth || 1) / 2)), + (halfWidth = Math.floor((+document.body.clientWidth || 1) / 2)), 40 > a.touches[0].screenX || DOM.findParent(a.target, null, "ago_panel", 8) ? (AGO.Observer.area = 12) : (AGO.Observer.area = - e > d - 335 && e < d + 335 + pageX > halfWidth - 335 && pageX < halfWidth + 335 ? 950 > window.innerWidth ? 0 : DOM.findParent(a.target, null, "inhalt", 9) ? 1 : 0 - : e > d + 330 && + : pageX > halfWidth + 330 && DOM.findParent(a.target, null, "planetList", 9) ? 15 - : e < d - 280 && DOM.findParent(a.target, null, "links", 9) + : pageX < halfWidth - 280 && DOM.findParent(a.target, null, "links", 9) ? 11 : 0), AGO.Observer.area && @@ -616,53 +620,50 @@ AGO.Observer = { AGO.Observer.area = 0; }, 1e3)))); }, - !1 + false ); document.addEventListener( "touchmove", function(a) { - var d, e; + var pageDiffX, pageDiffY; AGO.Observer.area && ((AGO.Observer.pageX = a.touches[0].pageX), (AGO.Observer.pageY = a.touches[0].pageY), !window.scrollX || 0 < AGO.Observer.startX - AGO.Observer.pageX) && - ((d = Math.abs(AGO.Observer.startX - AGO.Observer.pageX) + 1), - (e = Math.abs(AGO.Observer.startY - AGO.Observer.pageY) + 1), - (d = 1 === AGO.Observer.area && (3 < d || 3 < e) && 0.35 > d / e) + ((pageDiffX = Math.abs(AGO.Observer.startX - AGO.Observer.pageX) + 1), + (pageDiffY = Math.abs(AGO.Observer.startY - AGO.Observer.pageY) + 1), + (pageDiffX = 1 === AGO.Observer.area && (3 < pageDiffX || 3 < pageDiffY) && 0.35 > pageDiffX / pageDiffY) ? (AGO.Observer.area = 0) : a.preventDefault()); }, - !1 + false ); - document.addEventListener("touchend", AGO.Observer.onSwipe, !1); - document.addEventListener("touchcancel", AGO.Observer.onSwipe, !1); + document.addEventListener("touchend", AGO.Observer.onSwipe, false); + document.addEventListener("touchcancel", AGO.Observer.onSwipe, false); }, - Head: function(a) { - function b(a) { - var b; - OBJ.iterate(a, function(e) { - "HTML" === a[e].target.nodeName && - a[e].addedNodes.length && - "BODY" === a[e].addedNodes[0].nodeName && - a[e].addedNodes[0].childNodes.length && - (b = !0) + Head: function(headCallback) { + function documentMutated(mutationsList) { + var pageHeadLoaded; + OBJ.iterate(mutationsList, function(e) { + if("HTML" === mutationsList[e].target.nodeName && mutationsList[e].addedNodes.length && "BODY" === mutationsList[e].addedNodes[0].nodeName && mutationsList[e].addedNodes[0].childNodes.length) { + pageHeadLoaded = true + } }); - b && AGO.Observer.Call(AGO.Observer.head); + if(pageHeadLoaded){ + AGO.Observer.Call(AGO.Observer.head) + }; } - AGO.Init.status && - (document.body || !0 === AGO.Observer.head[0] - ? a() - : (AGO.Observer.head[0] || - (AGO.Observer.head[0] = DOM.addObserver( - document, - { - childList: !0, - subtree: !0 - }, - b - )), - AGO.Observer.head.push(a))); + if(AGO.Init.status) { + if(document.body || AGO.Observer.head[0] === true) { + headCallback() + }else { + if(!AGO.Observer.head[0]) { + AGO.Observer.head[0] = DOM.addObserver(document, {childList: true, subtree: true}, documentMutated); + } + AGO.Observer.head.push(headCallback); + } + } }, Body: function(a, b) { function c(a) { @@ -676,7 +677,7 @@ AGO.Observer = { for (var f = 0; f < a[b].addedNodes.length; f++) "SCRIPT" === a[b].addedNodes[f].nodeName && document.getElementById("rechts") && - (c = !0); + (c = true); if (c) { AGO.Observer.Call(AGO.Observer.body); break; @@ -687,15 +688,15 @@ AGO.Observer = { AGO.Init.status && ("complete" === document.readyState || "interactive" === document.readyState || - !0 === AGO.Observer.body[0] + true === AGO.Observer.body[0] ? a() : (b && !AGO.Observer.body[0] && (AGO.Observer.body[0] = DOM.addObserver( document, { - childList: !0, - subtree: !0 + childList: true, + subtree: true }, c )), @@ -705,18 +706,24 @@ AGO.Observer = { AGO.Init.status && ("complete" === document.readyState || "interactive" === document.readyState || - !0 === AGO.Observer.interactive[0] + true === AGO.Observer.interactive[0] ? a() : AGO.Observer.interactive.push(a)); }, - Call: function(a) { - var b; - if (AGO.Init.status && a && "object" === typeof a && !0 !== a[0]) { - b = a[0]; - a[0] = !0; - b && DOM.removeObserver(b); - for (b = 1; b < a.length; b++) if ("function" === typeof a[b]) a[b](); - a.length = 1; + Call: function(callbacks) { + var firstCallback, i; + if (AGO.Init.status && callbacks && "object" === typeof callbacks && true !== callbacks[0]) { + firstCallback = callbacks[0]; + callbacks[0] = true; + if(firstCallback){ + DOM.removeObserver(firstCallback); + } + for (i = 1; i < callbacks.length; i++){ + if ("function" === typeof callbacks[i]){ + callbacks[i](); + } + } + callbacks.length = 1; } }, set: function(a, b, c) { @@ -745,12 +752,12 @@ AGO.Observer = { if (7 > AGO.Init.status) return ( AGO.Init.KeydownCache.push({ - cached: !0, + cached: true, keyCode: a.keyCode, shiftKey: a.shiftKey, ctrlKey: a.ctrlKey }), - !1 + false ); a.target && (a.inputType = @@ -761,7 +768,7 @@ AGO.Observer = { : 0); return AGO.Init.onKeydown(a); } - return !0; + return true; }, Mutation: function(a) { var b, c, d; @@ -886,163 +893,154 @@ AGO.App = { highscorecontent: "Highscore" }, Start: function() { - var a, b; - AGO.isFirefox - ? ((AGO.App.pathSkin = "chrome://skin/content/"), - OBJ.copy(OBJ.parse(API.App()), AGO.App)) - : ((AGO.App.pathSkin = chrome.extension.getURL("/skin/")), + var domain, subdomain; + if(AGO.isFirefox) { + AGO.App.pathSkin = "chrome://skin/content/"; + OBJ.copy(OBJ.parse(API.App()), AGO.App); + }else { + ((AGO.App.pathSkin = chrome.extension.getURL("/skin/")), (AGO.App.versionAGO = chrome.runtime.getManifest().version), - (AGO.App.name = STR.check(chrome.runtime.getManifest().name))); - AGO.App.beta = - -1 < AGO.App.name.indexOf("Alpha") - ? 3 - : -1 < AGO.App.name.indexOf("Beta") - ? 1 - : 0; + (AGO.App.name = STR.check(chrome.runtime.getManifest().name))) + } + if(AGO.App.name.includes("Alpha")){ + AGO.App.beta = 3; + }else if(AGO.App.name.includes("Beta")){ + AGO.App.beta = 1; + }else{ + AGO.App.beta = 0; + } AGO.Uni.domain = document.location.hostname.toLowerCase(); AGO.Uni.url = "https://" + AGO.Uni.domain; - a = AGO.Uni.domain.split("."); - document.location.href.match( - /https:\/\/.+\.ogame.gameforge.com\/game\/index\.php\?+.*page=*/i - ) - ? ((AGO.App.page = STR.getParameter( - "page", - document.location.href - ).toLowerCase()), - AGO.App.page = (AGO.App.page == 'standalone' ? 'empire' : AGO.App.page), - (AGO.App.page = - 0 === AGO.App.page.indexOf("fleet") && - STR.getParameter("cp", document.location.href) - ? "fleet1" - : AGO.App.page), - (AGO.Uni.path = document.location.href.split("?")[0] + "?page="), - (b = (a[0] || "").split("-")), - (AGO.Uni.lang = (b[1] || "EN").toUpperCase()), - (AGO.Uni.number = NMR.parseIntAbs(b[0])), - AGO.Uni.number && - ((AGO.App.mode = 3), - (AGO.Uni.abbr = "UNI" + AGO.Uni.number), - (AGO.App.keyCom = "AGO_" + AGO.Uni.lang), - (AGO.App.keyUni = AGO.App.keyCom + "_" + AGO.Uni.abbr), - OBJ.copy( - OBJ.parse(AGO.Data.getStorage(AGO.App.keyUni + "_App")), - AGO.App - ), - (AGO.App.title = - AGO.App.title || AGO.Uni.lang + " " + AGO.Uni.number), - !AGO.App.playerId || - STR.getParameter("phpsessid", document.location.href.toLowerCase()) - ? (AGO.App.login = AGO.App.reload = !0) - : (AGO.App.keyPlayer = AGO.App.keyUni + "_" + AGO.App.playerId)), - AGO.App.disabled && AGO.Notify.set("Problem", 21), - 4 !== a.length && AGO.Notify.set("Problem", 31)) - : ((AGO.App.page = - -1 < AGO.Uni.domain.indexOf("speedsim.net") - ? "websim" - : -1 < AGO.Uni.domain.indexOf("osimulate.com") - ? "osimulate" - : ""), - AGO.App.page && - ((AGO.Uni.lang = ( - STR.getParameter("uni", document.location.href).split("_")[0] || - "EN" - ).toUpperCase()), - (AGO.App.keyCom = "AGO_" + AGO.Uni.lang), - (AGO.App.mode = 2))); + domain = AGO.Uni.domain.split("."); + if(document.location.href.match(/https:\/\/.+\.ogame.gameforge.com\/game\/index\.php\?+.*page=*/i)){ + AGO.App.page = STR.getParameter("page", document.location.href).toLowerCase(); + if(AGO.App.page == 'standalone'){ + AGO.App.page = 'empire'; + } + if(0 === AGO.App.page.indexOf("fleet") && STR.getParameter("cp", document.location.href)){ + AGO.App.page = "fleet1"; + } + AGO.Uni.path = document.location.href.split("?")[0] + "?page="; + subdomain = (domain[0] || "").split("-"); + AGO.Uni.lang = (subdomain[1] || "EN").toUpperCase(); + AGO.Uni.number = NMR.parseIntAbs(subdomain[0]); + if(AGO.Uni.number ) { + AGO.App.mode = 3 + AGO.Uni.abbr = "UNI" + AGO.Uni.number + AGO.App.keyCom = "AGO_" + AGO.Uni.lang + AGO.App.keyUni = AGO.App.keyCom + "_" + AGO.Uni.abbr + OBJ.copy(OBJ.parse(AGO.Data.getStorage(AGO.App.keyUni + "_App")), AGO.App) + AGO.App.title = AGO.App.title || AGO.Uni.lang + " " + AGO.Uni.number + if(!AGO.App.playerId || STR.getParameter("phpsessid", document.location.href.toLowerCase())){ + AGO.App.login = AGO.App.reload = true + }else{ + AGO.App.keyPlayer = AGO.App.keyUni + "_" + AGO.App.playerId + } + } + if(AGO.App.disabled){ + AGO.Notify.set("Problem", 21) + } + if(4 !== domain.length){ + AGO.Notify.set("Problem", 31) + } + }else { + if(AGO.Uni.domain.includes("speedsim.net")) { + AGO.App.page = "websim" + }else if(AGO.Uni.domain.includes("osimulate.com")) { + AGO.App.page = "osimulate" + }else{ + AGO.App.page = "" + } + + if(AGO.App.page) { + AGO.Uni.lang = (STR.getParameter("uni", document.location.href).split("_")[0] || "EN").toUpperCase() + AGO.App.keyCom = "AGO_" + AGO.Uni.lang + AGO.App.mode = 2 + } + } }, Init: function() { - var a, b, c; - a = document.head.getElementsByTagName("meta"); - for (c = 0; c < a.length; c++) - if (a[c].name) - switch (((b = a[c].getAttribute("content")), a[c].name)) { + var metaList, metaContent, i; + metaList = document.head.getElementsByTagName("meta"); + for (i = 0; i < metaList.length; i++) { + if (metaList[i].name) { + metaContent = metaList[i].getAttribute("content") + switch (metaList[i].name) { case "ogame-player-name": - AGO.Acc.name = b; + AGO.Acc.name = metaContent; break; case "ogame-planet-coordinates": - AGO.Acc.coords = b; + AGO.Acc.coords = metaContent; break; case "ogame-planet-type": - AGO.Acc.type = "moon" === b ? 3 : 1; + AGO.Acc.type = "moon" === metaContent ? 3 : 1; break; case "ogame-planet-id": - AGO.Acc.planetId = b; + AGO.Acc.planetId = metaContent; break; case "ogame-planet-name": - AGO.Acc.planetName = b; + AGO.Acc.planetName = metaContent; break; case "ogame-player-id": - AGO.Acc.playerId = b; + AGO.Acc.playerId = metaContent; break; case "ogame-version": - AGO.App.versionOGame = b; + AGO.App.versionOGame = metaContent; break; case "ogame-session": - AGO.Acc.session = b; + AGO.Acc.session = metaContent; break; case "ogame-timestamp": - AGO.Acc.timestamp = +b || 0; + AGO.Acc.timestamp = +metaContent || 0; break; case "AntiGameOrigin": - AGO.App.twice = !0; + AGO.App.twice = true; } - AGO.App.init = !0; - AGO.App.mode = AGO.App.twice - ? 0 - : 2 === AGO.App.mode - ? 2 - : AGO.Acc.playerId && AGO.Acc.session - ? 4 - : 3; - if (4 <= AGO.App.mode) - if ( - !AGO.App.login && - AGO.App.playerId && - AGO.App.playerId !== AGO.Acc.playerId - ) - (AGO.Init.status = AGO.App.mode = 0), - AGO.Data.setStorage(AGO.App.keyUni + "_App", ""); - else { - AGO.App.Ogame = !0; + } + } + AGO.App.init = true; + AGO.App.mode = 3; + + if(AGO.App.twice){ + AGO.App.mode = 0; + }else if(AGO.App.mode === 2){ + AGO.App.mode = 2; + }else if(AGO.Acc.playerId && AGO.Acc.session){ + AGO.App.mode = 4; + } + + if (AGO.App.mode >= 4) + if (!AGO.App.login && AGO.App.playerId && AGO.App.playerId !== AGO.Acc.playerId) { + AGO.Init.status = AGO.App.mode = 0; + AGO.Data.setStorage(AGO.App.keyUni + "_App", ""); + }else { + AGO.App.Ogame = true; OBJ.copy(AGO.Task.splitCoords(AGO.Acc.coords), AGO.Acc); AGO.Acc.coordstype = AGO.Acc.coords + ":" + AGO.Acc.type; AGO.App.keyPlayer = AGO.App.keyUni + "_" + AGO.Acc.playerId; AGO.App.OgameMobile = !DOM.hasClass(document.body, null, "no-touch"); console.log(document.body); - if ( - AGO.App.login || - AGO.App.playerId !== AGO.Acc.playerId || - AGO.App.session !== AGO.Acc.session - ) - (AGO.App.reload = !0), - (AGO.App.playerId = AGO.Acc.playerId), - AGO.App.Save(), - AGB.Log( - "App - Login: Com: " + - AGO.Uni.lang + - " Uni: " + - AGO.Uni.number + - " Player: " + - AGO.Acc.playerId + - " Session: " + - AGO.Acc.session, - !0 - ); - a = document.createDocumentFragment(); - DOM.append(a, "meta", { + if (AGO.App.login || AGO.App.playerId !== AGO.Acc.playerId || AGO.App.session !== AGO.Acc.session) { + AGO.App.reload = true; + AGO.App.playerId = AGO.Acc.playerId; + AGO.App.Save(); + AGB.Log("App - Login: Com: " + AGO.Uni.lang + " Uni: " + AGO.Uni.number + " Player: " + AGO.Acc.playerId + " Session: " + AGO.Acc.session, true); + } + metaList = document.createDocumentFragment(); + DOM.append(metaList, "meta", { content: AGO.App.versionAGO, name: "AntiGameOrigin", id: "ago_global_data", "ago-data-key": AGO.App.keyPlayer }); - DOM.append(a, "script", { + DOM.append(metaList, "script", { type: "text/javascript" }).textContent = AGB.Resource("js/global.js"); - document.head.appendChild(a); + document.head.appendChild(metaList); } }, - Save: function(a) { - OBJ.copy(a, AGO.App); + Save: function(data) { + OBJ.copy(data, AGO.App); AGO.Data.setStorage(AGO.App.keyUni + "_App", { disabled: AGO.App.disabled, playerId: AGO.Acc.playerId, @@ -1085,29 +1083,24 @@ AGO.Acc = { }; AGO.Data = { Init: function() { - AGO.App.reload && - AGO.Data.removeStorage(AGO.App.keyPlayer + "_Fleet_Current"); + if(AGO.App.reload){ + AGO.Data.removeStorage(AGO.App.keyPlayer + "_Fleet_Current"); + } }, - Remove: function(a) { + Remove: function(data) { function b(a) { OBJ.iterate(window.localStorage, function(b) { b && 0 === b.indexOf(a || "AGO_") && (window.localStorage.removeItem(b), - AGB.Log("Delete - localstorage - " + b, !0)); + AGB.Log("Delete - localstorage - " + b, true)); }); } - AGB.Log("Delete - ############ - " + a, !0); - AGB.message( - "Data", - "Remove", - { - mode: a - }, - function(c) { + AGB.Log("Delete - ############ - " + data, true); + AGB.message("Data", "Remove", {mode: data}, function(c) { c && - (b("ago" === a ? "AGO_" : AGO.App.keyPlayer), + (b("ago" === data ? "AGO_" : AGO.App.keyPlayer), b(AGO.App.keyUni), AGO.Init.Location("", 600)); } @@ -1118,7 +1111,7 @@ AGO.Data = { try { window.localStorage[a] = OBJ.is(b) ? JSON.stringify(b) : b || ""; } catch (c) { - AGB.Log("Data - Error set localstorage", !0); + AGB.Log("Data - Error set localstorage", true); } }, getStorage: function(a, b) { diff --git a/js/jquery.js b/js/jquery.js index 2ad8245..ecd4357 100644 --- a/js/jquery.js +++ b/js/jquery.js @@ -1,179 +1,11008 @@ -(function(v,n){function xa(a){var b=a.length,d=c.type(a);return c.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===d||"function"!==d&&(0===b||"number"===typeof b&&0b;b+=2)"margin"=== -d&&(g+=c.css(a,d+E[b],!0,f)),e?("content"===d&&(g-=c.css(a,"padding"+E[b],!0,f)),"margin"!==d&&(g-=c.css(a,"border"+E[b]+"Width",!0,f))):(g+=c.css(a,"padding"+E[b],!0,f),"padding"!==d&&(g+=c.css(a,"border"+E[b]+"Width",!0,f)));return g}function lb(a,b,d){var e=!0,f="width"===b?a.offsetWidth:a.offsetHeight,g=P(a),h=c.support.boxSizing&&"border-box"===c.css(a,"boxSizing",!1,g);if(0>=f||null==f){f=W(a,b,g);if(0>f||null==f)f=a.style[b];if(aa.test(f))return f;e=h&&(c.support.boxSizingReliable||f===a.style[b]); -f=parseFloat(f)||0}return f+kb(a,b,d||(h?"border":"content"),e,g)+"px"}function ib(a){var b=q,d=mb[a];d||(d=nb(a,b),"none"!==d&&d||(ha=(ha||c("