';
From 1e3efd7d3b48c268bd6f4ec58d89a06ce0e044e5 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Sun, 29 Sep 2013 00:38:38 +0200
Subject: [PATCH 014/126] bugfix: run setLoadingState on UI thread in
CheckHttpResponse
---
.../com/cradle/iitc_mobile/async/CheckHttpResponse.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java
index 431dee3c..057b0c74 100644
--- a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java
+++ b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java
@@ -43,7 +43,13 @@ public class CheckHttpResponse extends AsyncTask {
int code = response.getStatusLine().getStatusCode();
if (code != HttpStatus.SC_OK) {
Log.d("iitcm", "received error code: " + code);
- ((IITC_Mobile) mContext).setLoadingState(false);
+ final IITC_Mobile iitc = (IITC_Mobile) mContext;
+ iitc.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ iitc.setLoadingState(false);
+ }
+ });
// TODO: remove when google login issue is fixed
if (urls[0].contains("uberauth=WILL_NOT_SIGN_IN")) {
return true;
From 3ac2490c0c84a576567309e7eb93e6b19da1ab73 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Sun, 29 Sep 2013 00:59:02 +0200
Subject: [PATCH 015/126] added status bar tap to the info-screen hint
---
mobile/res/values/strings.xml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index 8699ebec..6c810a6f 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -63,7 +63,9 @@
to evoke the Layer Drawer]]>
-
+
+ • tap and hold a portal for a second
+ • tap on the left half of the status bar]]>
UI
@@ -109,4 +111,4 @@
Base LayerOverlay Layers
-
\ No newline at end of file
+
From fe1d7fb3370f6d631c9edce00cc177893d39df61 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Sun, 29 Sep 2013 00:11:48 +0100
Subject: [PATCH 016/126] draw-tools: update edit colour to match that used
while drawing - with only dashed lines being used as in stock Leaflet.Draw
---
plugins/draw-tools.user.js | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/plugins/draw-tools.user.js b/plugins/draw-tools.user.js
index a9ee160d..335825f3 100644
--- a/plugins/draw-tools.user.js
+++ b/plugins/draw-tools.user.js
@@ -33,6 +33,7 @@ window.plugin.drawTools.loadExternals = function() {
}
window.plugin.drawTools.setOptions = function() {
+
window.plugin.drawTools.lineOptions = {
stroke: true,
color: '#a24ac3',
@@ -42,16 +43,15 @@ window.plugin.drawTools.setOptions = function() {
clickable: true
};
- window.plugin.drawTools.polygonOptions = {
- stroke: true,
- color: '#a24ac3',
- weight: 4,
- opacity: 0.5,
+ window.plugin.drawTools.polygonOptions = L.extend({}, window.plugin.drawTools.lineOptions, {
fill: true,
- fillColor: null,
- fillOpacity: 0.2,
- clickable: true
- };
+ fillColor: null, // to use the same as 'color' for fill
+ fillOpacity: 0.2
+ });
+
+ window.plugin.drawTools.editOptions = L.extend({}, window.plugin.drawTools.polygonOptions, {
+ dashArray: [10,10]
+ });
window.plugin.drawTools.markerOptions = {
icon: new L.Icon.Default(),
@@ -113,7 +113,8 @@ window.plugin.drawTools.addDrawControl = function() {
featureGroup: window.plugin.drawTools.drawnItems,
edit: {
- title: 'Edit drawn items'
+ title: 'Edit drawn items',
+ selectedPathOptions: window.plugin.drawTools.editOptions,
},
remove: {
From c82cd1464151c58ffe3c0474d9fd091e3ce983a9 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 30 Sep 2013 22:43:35 +0100
Subject: [PATCH 017/126] first attempt at updating munge parameters for new
niantic intel site update have commented out old munges for now - they don't
include parameters needed in some new requests, so are unlikely to be used
again for #589
---
code/utils_misc.js | 181 +++++++++++++++++++++++++++------------------
1 file changed, 108 insertions(+), 73 deletions(-)
diff --git a/code/utils_misc.js b/code/utils_misc.js
index e559a974..f2d7e4bd 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -96,82 +96,116 @@ window.digits = function(d) {
window.requestParameterMunges = [
+// set 0 and 1 were brought online at the same time - an attempt to confuse us, or others hacking on the web interface?
// set 0
- {
- method: '4kr3ofeptwgary2j',
- boundsParamsList: 'n27qzc8389kgakyv',
- id: '39031qie1i4aq563',
- minLatE6: 'pg98bwox95ly0ouu',
- minLngE6: 'eib1bkq8znpwr0g7',
- maxLatE6: 'ilfap961rwdybv63',
- maxLngE6: 'lpf7m1ifx0ieouzq',
- timestampMs: '2ewujgywmum1yp49',
- qk: 'bgxibcomzoto63sn',
- desiredNumItems: 'tmb0vgxgp5grsnhp',
- minTimestampMs: 'hljqffkpwlx0vtjt',
- maxTimestampMs: 'sw317giy6x2xj9zm',
- guids: 'pusjrhxxtyp5nois',
- inviteeEmailAddress: 'cltkepgqkepfsyaq',
- message: 'q0d6n7t1801bb6xu',
- latE6: '5ygbhpxfnt1u9e4t',
- lngE6: 'ak6twnljwwcgd7cj',
- factionOnly: '0dvtbatgzcfccchh',
- ascendingTimestampOrder: 'f6u1iqep9s2lc5y5'
- },
+// {
+// method: '4kr3ofeptwgary2j',
+// boundsParamsList: 'n27qzc8389kgakyv',
+// id: '39031qie1i4aq563',
+// minLatE6: 'pg98bwox95ly0ouu',
+// minLngE6: 'eib1bkq8znpwr0g7',
+// maxLatE6: 'ilfap961rwdybv63',
+// maxLngE6: 'lpf7m1ifx0ieouzq',
+// timestampMs: '2ewujgywmum1yp49',
+// qk: 'bgxibcomzoto63sn',
+// desiredNumItems: 'tmb0vgxgp5grsnhp',
+// minTimestampMs: 'hljqffkpwlx0vtjt',
+// maxTimestampMs: 'sw317giy6x2xj9zm',
+// guids: 'pusjrhxxtyp5nois',
+// inviteeEmailAddress: 'cltkepgqkepfsyaq',
+// message: 'q0d6n7t1801bb6xu',
+// latE6: '5ygbhpxfnt1u9e4t',
+// lngE6: 'ak6twnljwwcgd7cj',
+// factionOnly: '0dvtbatgzcfccchh',
+// ascendingTimestampOrder: 'f6u1iqep9s2lc5y5'
+// },
// set 1
- {
- method: 'uuo2zqhhy5bw80fu',
- boundsParamsList: '5rc0561uauf6x13u',
- id: 'bzeizowtguoyrrtt',
- minLatE6: '7qej3eqg4sefuaac',
- minLngE6: 'yqegc976egk5q9vo',
- maxLatE6: '2odsgh99ix9bbtsb',
- maxLngE6: 'g9jess8dwa2j8pwi',
- timestampMs: '604f34zcu9zna0a5',
- qk: 'y853tux9h7cb6xp3',
- desiredNumItems: 'sfv5i7l6ouljz8vf',
- minTimestampMs: 'y3g07dbnw6sklloj',
- maxTimestampMs: '3pdl28aa27xvyhke',
- guids: 'xp1pl2jm5hrh3bna',
- inviteeEmailAddress: '2pyrttrp3gh38mmu',
- message: 'zz54435vfc57nlg9',
- latE6: 'cyltxjod3jhxgj8q',
- lngE6: 'h9whcgcz6kpqkz80',
- factionOnly: '37okcr7gvd5yn2lj',
- ascendingTimestampOrder: 'iimftkq7flskwrx9'
- },
+// {
+// method: 'uuo2zqhhy5bw80fu',
+// boundsParamsList: '5rc0561uauf6x13u',
+// id: 'bzeizowtguoyrrtt',
+// minLatE6: '7qej3eqg4sefuaac',
+// minLngE6: 'yqegc976egk5q9vo',
+// maxLatE6: '2odsgh99ix9bbtsb',
+// maxLngE6: 'g9jess8dwa2j8pwi',
+// timestampMs: '604f34zcu9zna0a5',
+// qk: 'y853tux9h7cb6xp3',
+// desiredNumItems: 'sfv5i7l6ouljz8vf',
+// minTimestampMs: 'y3g07dbnw6sklloj',
+// maxTimestampMs: '3pdl28aa27xvyhke',
+// guids: 'xp1pl2jm5hrh3bna',
+// inviteeEmailAddress: '2pyrttrp3gh38mmu',
+// message: 'zz54435vfc57nlg9',
+// latE6: 'cyltxjod3jhxgj8q',
+// lngE6: 'h9whcgcz6kpqkz80',
+// factionOnly: '37okcr7gvd5yn2lj',
+// ascendingTimestampOrder: 'iimftkq7flskwrx9'
+// },
// set 2 - first seen 2013-09-12 21:30
- {
- method: '42suxeca8ttud7je',
- boundsParamsList: '5uwd21hkedg3zh2c',
- id: 'drtt302ebaj6ek2g',
- minLatE6: 'l933r0l8brrt1x5b',
- minLngE6: 'qg3xb340zed41jof',
- maxLatE6: 'sw485z1n3tusdkul',
- maxLngE6: '6meahm3f9xup9krb',
- timestampMs: '6meahm3f9xup9krb',
- qk: 'fpi9b1z0os0x9yjj',
- desiredNumItems: 'inr3js77cetyibi6',
- minTimestampMs: 'zfb2e5iqmggrxe98',
- maxTimestampMs: '8c4imy17gfpfrl9l',
- guids: '5d5hp2p3rkmanqn7',
- inviteeEmailAddress: 'i1a5yp6p1l6iqk08',
- message: 'xzhbk3ri04lx9xvj',
- latE6: 'njg0zny4fb39mf0a',
- lngE6: 'ti2rx4ltmg6d1zsr',
- factionOnly: 'jegpo8rwhtuuuuhh',
- ascendingTimestampOrder: '1ennke6gykwzziun',
- // in this set, also the request method names are obsfucated!
- 'dashboard.getThinnedEntitiesV4': 'ufxcmvve3eirsf2b',
- 'dashboard.getPaginatedPlextsV2': 'd9dgziiw8vzhyecv',
- 'dashboard.getPlayersByGuids': 's53izqpxedtd0hv8',
- 'dashboard.sendInviteEmail': 'kn9plnbree2aeuh9',
- 'dashboard.redeemReward': 'les8vribyxb899wd',
- 'dashboard.sendPlext': '9u1ukkkx1euxf02a'
- },
+ // (very briefly - and removed a few hours later)
+// {
+// method: '42suxeca8ttud7je',
+// boundsParamsList: '5uwd21hkedg3zh2c',
+// id: 'drtt302ebaj6ek2g',
+// minLatE6: 'l933r0l8brrt1x5b',
+// minLngE6: 'qg3xb340zed41jof',
+// maxLatE6: 'sw485z1n3tusdkul',
+// maxLngE6: '6meahm3f9xup9krb',
+// timestampMs: '6meahm3f9xup9krb',
+// qk: 'fpi9b1z0os0x9yjj',
+// desiredNumItems: 'inr3js77cetyibi6',
+// minTimestampMs: 'zfb2e5iqmggrxe98',
+// maxTimestampMs: '8c4imy17gfpfrl9l',
+// guids: '5d5hp2p3rkmanqn7',
+// inviteeEmailAddress: 'i1a5yp6p1l6iqk08',
+// message: 'xzhbk3ri04lx9xvj',
+// latE6: 'njg0zny4fb39mf0a',
+// lngE6: 'ti2rx4ltmg6d1zsr',
+// factionOnly: 'jegpo8rwhtuuuuhh',
+// ascendingTimestampOrder: '1ennke6gykwzziun',
+// // in this set, also the request method names are obsfucated!
+// 'dashboard.getThinnedEntitiesV4': 'ufxcmvve3eirsf2b',
+// 'dashboard.getPaginatedPlextsV2': 'd9dgziiw8vzhyecv',
+// 'dashboard.getPlayersByGuids': 's53izqpxedtd0hv8',
+// 'dashboard.sendInviteEmail': 'kn9plnbree2aeuh9',
+// 'dashboard.redeemReward': 'les8vribyxb899wd',
+// 'dashboard.sendPlext': '9u1ukkkx1euxf02a'
+// },
+ // set 3 - in the update of 2013-09-30 (addition of 'alerts' chat tab)
+ {
+ method: '22ux2z96jwq5zn78',
+ version: 'kf6hgl9yau03ws0o', //guessed parameter name - only seen munged
+ boundsParamsList: '29t16cmsn6l3r2xg',
+ id: '7rogqhp5pzcqobcw',
+ minLatE6: 'yzbnp7z9bd28p0yr',
+ minLngE6: '2pdhntvo85cd90bw',
+ maxLatE6: 'c4ivr013h4dr68pd',
+ maxLngE6: '4p8oorcrwalc1mzf',
+ timestampMs: 'vd2rsa9v6f8q606s',
+ qk: 'cblh9xe0bgwjy5ij',
+ desiredNumItems: '3ymaq7slb165porj',
+ minTimestampMs: 's9jf2seni33y3gyu',
+ maxTimestampMs: '2kh3vti98rhp3g29',
+ chatTab: '7n7ocqfq1p18352b', //guessed parameter name - only seen munged
+ guids: '5hyiwhwc0jyljvro',
+ inviteeEmailAddress: 's9z6zt03eymzxhkj',
+ message: 'e8qm0kptw2trrcrw',
+ latE6: 'fja1phtsqxm71dqm',
+ lngE6: 'iut1tb7c0x726hwn',
+ factionOnly: 'p88a2ztchtjhiazl',
+ ascendingTimestampOrder: 'p88a2ztchtjhiazl',
+ // in this set, also the request method names are obsfucated!
+ 'dashboard.getGameScore': 'fhlzntzkl5v7hcfh', // GET_GAME_SCORE
+ 'dashboard.getPaginatedPlextsV2': 'wzuitnswoda7w028', // GET_PAGINATED_PLEXTS
+ 'dashboard.getThinnedEntitiesV4': 'scgrm4lf2371esgw', // GET_THINNED_ENTITIES
+ 'dashboard.getPlayersByGuids': '81l6usczczoi3lfi', // LOOKUP_PLAYERS
+ 'dashboard.redeemReward': '8kop2koeld9b4c26', // REDEEM_REWARD
+ 'dashboard.sendInviteEmail': 't0ccodsm1nuo5uso', // SEND_INVITE_EMAIL
+ 'dashboard.sendPlext': 'k04cfjwwsg3h3827' // SEND_PLEXT
+ },
];
window.activeRequestMungeSet = undefined;
@@ -179,10 +213,10 @@ window.activeRequestMungeSet = undefined;
window.detectActiveMungeSet = function() {
for (var m in window) {
// try and find the stock page functions
- if (typeof window[m] == 'function' && m.length <= 3) {
+ if (typeof window[m] == 'function') {
var stockFunc = window[m].toString();
for (var i in window.requestParameterMunges) {
- if (stockFunc.indexOf (window.requestParameterMunges[i]['id']) >= 0) {
+ if (stockFunc.indexOf (window.requestParameterMunges[i]['method']) >= 0) {
console.log('IITC: found request munge set '+i+' in stock intel function "window.'+m+'()"');
window.activeRequestMungeSet = i;
}
@@ -248,9 +282,10 @@ window.postAjax = function(action, data, success, error) {
var activeMunge = window.requestParameterMunges[window.activeRequestMungeSet];
var methodName = 'dashboard.'+action;
+ var versionStr = "4608f4356a6f55690f127fb542f557f98de66169"; // unsure of parameter value meaning. appears to be a constant used as a 'version'. added to all requests along with the method name in the stock site
// optional munging of the method name - seen in Set 2 (onwards?)
if (methodName in activeMunge) methodName = activeMunge[methodName];
- var post_data = JSON.stringify(window.requestDataMunge($.extend({method: methodName}, data)));
+ var post_data = JSON.stringify(window.requestDataMunge($.extend({method: methodName, version: versionStr}, data)));
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
var result = $.ajax({
From 4c2bb5ecfab3ed829d2d814649087bacc2131514 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 30 Sep 2013 22:51:06 +0100
Subject: [PATCH 018/126] quick fix for chat, for protocol changes for #589
---
code/chat.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/code/chat.js b/code/chat.js
index 747e23b9..f6749a71 100644
--- a/code/chat.js
+++ b/code/chat.js
@@ -81,7 +81,8 @@ window.chat.genPostData = function(isFaction, storageHash, getOlderMsgs) {
maxLngE6: Math.round(ne.lng*1E6),
minTimestampMs: -1,
maxTimestampMs: -1,
- factionOnly: isFaction
+ factionOnly: isFaction,
+ chatTab: isFaction ? 'faction' : 'all'
}
if(getOlderMsgs) {
@@ -689,7 +690,8 @@ window.chat.postMsg = function() {
var data = {message: msg,
latE6: Math.round(latlng.lat*1E6),
lngE6: Math.round(latlng.lng*1E6),
- factionOnly: !publik};
+ factionOnly: !publik,
+ chatTab: publik ? 'all' : 'faction'};
var errMsg = 'Your message could not be delivered. You can copy&' +
'paste it here and try again if you want:\n\n' + msg;
From 8cc246c5f73ba9112ba8ff8888044dd0049440d5 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 30 Sep 2013 23:13:53 +0100
Subject: [PATCH 019/126] remove old factionOnly flag from chat requests.
although the stock site appears to send it still at first glance of the code,
this appears to be incorrect - and sending it causes old messages to come
first rather than new ones! (perhaps i've mis-identified the flag - and it's
the one for getting older messages first?) for #589
---
code/chat.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/code/chat.js b/code/chat.js
index f6749a71..ad1032ce 100644
--- a/code/chat.js
+++ b/code/chat.js
@@ -81,7 +81,6 @@ window.chat.genPostData = function(isFaction, storageHash, getOlderMsgs) {
maxLngE6: Math.round(ne.lng*1E6),
minTimestampMs: -1,
maxTimestampMs: -1,
- factionOnly: isFaction,
chatTab: isFaction ? 'faction' : 'all'
}
@@ -690,7 +689,6 @@ window.chat.postMsg = function() {
var data = {message: msg,
latE6: Math.round(latlng.lat*1E6),
lngE6: Math.round(latlng.lng*1E6),
- factionOnly: !publik,
chatTab: publik ? 'all' : 'faction'};
var errMsg = 'Your message could not be delivered. You can copy&' +
From 690b5d7e62283a58a11217dec7494bc38d39f828 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 30 Sep 2013 23:23:13 +0100
Subject: [PATCH 020/126] factionOnly was not correct - had mis-entered this
mapping (and was already there for ascendingTimestampOrder - it's real
meaning)
---
code/utils_misc.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/code/utils_misc.js b/code/utils_misc.js
index f2d7e4bd..d2a5a807 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -195,7 +195,6 @@ window.requestParameterMunges = [
message: 'e8qm0kptw2trrcrw',
latE6: 'fja1phtsqxm71dqm',
lngE6: 'iut1tb7c0x726hwn',
- factionOnly: 'p88a2ztchtjhiazl',
ascendingTimestampOrder: 'p88a2ztchtjhiazl',
// in this set, also the request method names are obsfucated!
'dashboard.getGameScore': 'fhlzntzkl5v7hcfh', // GET_GAME_SCORE
From 44dabe145d56d9c6e14db3908b4cc57e21fbc81e Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 30 Sep 2013 23:23:58 +0100
Subject: [PATCH 021/126] reduce faction messages to 50 at a time - as they're
no longer cluttered with user-specific alerts (these now appear in a separate
'alerts' tab on the stock site - yet to be implemented in IITC)
---
main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.js b/main.js
index 15169627..bf304d6d 100644
--- a/main.js
+++ b/main.js
@@ -137,7 +137,7 @@ window.VIEWPORT_PAD_RATIO = 0.3;
// how many items to request each query
window.CHAT_PUBLIC_ITEMS = 200;
-window.CHAT_FACTION_ITEMS = 100;
+window.CHAT_FACTION_ITEMS = 50;
// how many pixels to the top before requesting new data
window.CHAT_REQUEST_SCROLL_TOP = 200;
window.CHAT_SHRINKED = 60;
From 35e6921e1891327da0c73e819698c0d108bbf365 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 1 Oct 2013 00:25:56 +0100
Subject: [PATCH 022/126] website - remove old URL from commented out 'IITC
broken' section
---
website/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/index.php b/website/index.php
index 8ac2c4c9..2d01c87b 100644
--- a/website/index.php
+++ b/website/index.php
@@ -71,7 +71,7 @@ if ( file_exists ( 'tracking.php' ) )
From 80157b98759246c562ea6bfbad3355120b240d9c Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 1 Oct 2013 01:02:08 +0100
Subject: [PATCH 023/126] another mungs set was pushed live. update the code
also reordered munge list to match the order found in the stock page (makes
it easier to update) and tweaked the code that detects and auto-tries munge
sets
---
code/game_status.js | 4 +-
code/utils_misc.js | 167 ++++++++++++++++++--------------------------
2 files changed, 69 insertions(+), 102 deletions(-)
diff --git a/code/game_status.js b/code/game_status.js
index 87e17e5c..5ae4bfa1 100644
--- a/code/game_status.js
+++ b/code/game_status.js
@@ -15,9 +15,9 @@ window.updateGameScore = function(data) {
// detecting which munge set should be used is tricky - even the stock site gets it wrong sometimes
// to detect the problem and try a different set is easiest in a place where there's only a single request of that type
// sent at once, and it has no extra parameters. this method matches those requirements
- if (data == '{"error": "invalid method params"}' || data.error) {
+ if (data.error || (data.indexOf && data.indexOf('"error"') != -1)) {
window.window.updateGameScoreFailCount++;
- if (window.window.updateGameScoreFailCount < 5) {
+ if (window.window.updateGameScoreFailCount <= window.requestParameterMunges.length) {
window.activeRequestMungeSet = (window.activeRequestMungeSet+1) % window.requestParameterMunges.length;
console.warn('IITC munge issue - cycling to set '+window.activeRequestMungeSet);
diff --git a/code/utils_misc.js b/code/utils_misc.js
index d2a5a807..1da80f29 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -96,88 +96,22 @@ window.digits = function(d) {
window.requestParameterMunges = [
-// set 0 and 1 were brought online at the same time - an attempt to confuse us, or others hacking on the web interface?
- // set 0
-// {
-// method: '4kr3ofeptwgary2j',
-// boundsParamsList: 'n27qzc8389kgakyv',
-// id: '39031qie1i4aq563',
-// minLatE6: 'pg98bwox95ly0ouu',
-// minLngE6: 'eib1bkq8znpwr0g7',
-// maxLatE6: 'ilfap961rwdybv63',
-// maxLngE6: 'lpf7m1ifx0ieouzq',
-// timestampMs: '2ewujgywmum1yp49',
-// qk: 'bgxibcomzoto63sn',
-// desiredNumItems: 'tmb0vgxgp5grsnhp',
-// minTimestampMs: 'hljqffkpwlx0vtjt',
-// maxTimestampMs: 'sw317giy6x2xj9zm',
-// guids: 'pusjrhxxtyp5nois',
-// inviteeEmailAddress: 'cltkepgqkepfsyaq',
-// message: 'q0d6n7t1801bb6xu',
-// latE6: '5ygbhpxfnt1u9e4t',
-// lngE6: 'ak6twnljwwcgd7cj',
-// factionOnly: '0dvtbatgzcfccchh',
-// ascendingTimestampOrder: 'f6u1iqep9s2lc5y5'
-// },
+ // now obsolete (they don't have some of the new parameters) munge sets deleted
- // set 1
-// {
-// method: 'uuo2zqhhy5bw80fu',
-// boundsParamsList: '5rc0561uauf6x13u',
-// id: 'bzeizowtguoyrrtt',
-// minLatE6: '7qej3eqg4sefuaac',
-// minLngE6: 'yqegc976egk5q9vo',
-// maxLatE6: '2odsgh99ix9bbtsb',
-// maxLngE6: 'g9jess8dwa2j8pwi',
-// timestampMs: '604f34zcu9zna0a5',
-// qk: 'y853tux9h7cb6xp3',
-// desiredNumItems: 'sfv5i7l6ouljz8vf',
-// minTimestampMs: 'y3g07dbnw6sklloj',
-// maxTimestampMs: '3pdl28aa27xvyhke',
-// guids: 'xp1pl2jm5hrh3bna',
-// inviteeEmailAddress: '2pyrttrp3gh38mmu',
-// message: 'zz54435vfc57nlg9',
-// latE6: 'cyltxjod3jhxgj8q',
-// lngE6: 'h9whcgcz6kpqkz80',
-// factionOnly: '37okcr7gvd5yn2lj',
-// ascendingTimestampOrder: 'iimftkq7flskwrx9'
-// },
-
- // set 2 - first seen 2013-09-12 21:30
- // (very briefly - and removed a few hours later)
-// {
-// method: '42suxeca8ttud7je',
-// boundsParamsList: '5uwd21hkedg3zh2c',
-// id: 'drtt302ebaj6ek2g',
-// minLatE6: 'l933r0l8brrt1x5b',
-// minLngE6: 'qg3xb340zed41jof',
-// maxLatE6: 'sw485z1n3tusdkul',
-// maxLngE6: '6meahm3f9xup9krb',
-// timestampMs: '6meahm3f9xup9krb',
-// qk: 'fpi9b1z0os0x9yjj',
-// desiredNumItems: 'inr3js77cetyibi6',
-// minTimestampMs: 'zfb2e5iqmggrxe98',
-// maxTimestampMs: '8c4imy17gfpfrl9l',
-// guids: '5d5hp2p3rkmanqn7',
-// inviteeEmailAddress: 'i1a5yp6p1l6iqk08',
-// message: 'xzhbk3ri04lx9xvj',
-// latE6: 'njg0zny4fb39mf0a',
-// lngE6: 'ti2rx4ltmg6d1zsr',
-// factionOnly: 'jegpo8rwhtuuuuhh',
-// ascendingTimestampOrder: '1ennke6gykwzziun',
-// // in this set, also the request method names are obsfucated!
-// 'dashboard.getThinnedEntitiesV4': 'ufxcmvve3eirsf2b',
-// 'dashboard.getPaginatedPlextsV2': 'd9dgziiw8vzhyecv',
-// 'dashboard.getPlayersByGuids': 's53izqpxedtd0hv8',
-// 'dashboard.sendInviteEmail': 'kn9plnbree2aeuh9',
-// 'dashboard.redeemReward': 'les8vribyxb899wd',
-// 'dashboard.sendPlext': '9u1ukkkx1euxf02a'
-// },
// set 3 - in the update of 2013-09-30 (addition of 'alerts' chat tab)
{
+ 'dashboard.getGameScore': 'fhlzntzkl5v7hcfh', // GET_GAME_SCORE
+ 'dashboard.getPaginatedPlextsV2': 'wzuitnswoda7w028', // GET_PAGINATED_PLEXTS
+ 'dashboard.getThinnedEntitiesV4': 'scgrm4lf2371esgw', // GET_THINNED_ENTITIES
+ 'dashboard.getPlayersByGuids': '81l6usczczoi3lfi', // LOOKUP_PLAYERS
+ 'dashboard.redeemReward': '8kop2koeld9b4c26', // REDEEM_REWARD
+ 'dashboard.sendInviteEmail': 't0ccodsm1nuo5uso', // SEND_INVITE_EMAIL
+ 'dashboard.sendPlext': 'k04cfjwwsg3h3827', // SEND_PLEXT
+
method: '22ux2z96jwq5zn78',
version: 'kf6hgl9yau03ws0o', //guessed parameter name - only seen munged
+ version_parameter: '4608f4356a6f55690f127fb542f557f98de66169', // passed as the value to the above parameter
boundsParamsList: '29t16cmsn6l3r2xg',
id: '7rogqhp5pzcqobcw',
minLatE6: 'yzbnp7z9bd28p0yr',
@@ -190,36 +124,65 @@ window.requestParameterMunges = [
minTimestampMs: 's9jf2seni33y3gyu',
maxTimestampMs: '2kh3vti98rhp3g29',
chatTab: '7n7ocqfq1p18352b', //guessed parameter name - only seen munged
- guids: '5hyiwhwc0jyljvro',
- inviteeEmailAddress: 's9z6zt03eymzxhkj',
+ ascendingTimestampOrder: 'p88a2ztchtjhiazl',
message: 'e8qm0kptw2trrcrw',
latE6: 'fja1phtsqxm71dqm',
lngE6: 'iut1tb7c0x726hwn',
- ascendingTimestampOrder: 'p88a2ztchtjhiazl',
- // in this set, also the request method names are obsfucated!
- 'dashboard.getGameScore': 'fhlzntzkl5v7hcfh', // GET_GAME_SCORE
- 'dashboard.getPaginatedPlextsV2': 'wzuitnswoda7w028', // GET_PAGINATED_PLEXTS
- 'dashboard.getThinnedEntitiesV4': 'scgrm4lf2371esgw', // GET_THINNED_ENTITIES
- 'dashboard.getPlayersByGuids': '81l6usczczoi3lfi', // LOOKUP_PLAYERS
- 'dashboard.redeemReward': '8kop2koeld9b4c26', // REDEEM_REWARD
- 'dashboard.sendInviteEmail': 't0ccodsm1nuo5uso', // SEND_INVITE_EMAIL
- 'dashboard.sendPlext': 'k04cfjwwsg3h3827' // SEND_PLEXT
+ guids: '5hyiwhwc0jyljvro',
+ inviteeEmailAddress: 's9z6zt03eymzxhkj',
},
+
+ // set 4 - second update of 2013-09-30
+ {
+ 'dashboard.getGameScore': 'ija9jgrf5hj7wm9r', // GET_GAME_SCORE
+ 'dashboard.getPaginatedPlextsV2': '0elftx739mkbzi1b', // GET_PAGINATED_PLEXTS
+ 'dashboard.getThinnedEntitiesV4': 'prv0ez8cbsykh63g', // GET_THINNED_ENTITIES
+ 'dashboard.getPlayersByGuids': 'i0lxy6nc695z9ka3', // LOOKUP_PLAYERS
+ 'dashboard.redeemReward': '376oivna8rf8qbfj', // REDEEM_REWARD
+ 'dashboard.sendInviteEmail': '96y930v5q96nrcrw', // SEND_INVITE_EMAIL
+ 'dashboard.sendPlext': 'c04kceytofuqvyqg', // SEND_PLEXT
+
+ method: '9we4b31i48ui4sdm',
+ version: 'q402kn5zqisuo1ym', //guessed parameter name - only seen munged
+ version_parameter: 'dbad4485024d446ae946e3d287b5d640029ef3e3', // passed as the value to the above parameter
+ boundsParamsList: '3r5ctyvc2f653zjd',
+ id: 'izey8ciqg2dz2oqc',
+ minLatE6: 'cein0n4jrifa7ui2',
+ minLngE6: 'lbd1juids3johtdo',
+ maxLatE6: 'h4kyot9kmvd3g284',
+ maxLngE6: 'sbci6jjc2d5g9uy4',
+ timestampMs: '2wurn9giagbvv6bt',
+ qk: 'hq73mwpjqyvcp6ul',
+ desiredNumItems: 'kyo6vh5n58hmrnua',
+ minTimestampMs: 'hu4swdftcp7mvkdi',
+ maxTimestampMs: 'ly6ylae5lv1z9072',
+ chatTab: 'q5kxut5rmbtlqbf9', //guessed parameter name - only seen munged
+ ascendingTimestampOrder: 'hvfd0io35rahwjgr',
+ message: 'z4hf7tzl27o14455',
+ latE6: 'zyzh3bdxyd47vk1x',
+ lngE6: 'n5d1f8pql51t641x',
+ guids: 'gl16ehqoc3i3oi07',
+ inviteeEmailAddress: 'orc9ufg7rp7g1y9j',
+ },
+
];
window.activeRequestMungeSet = undefined;
// attempt to guess the munge set in use, by looking therough the functions of the stock intel page for one of the munged params
window.detectActiveMungeSet = function() {
- for (var m in window) {
- // try and find the stock page functions
- if (typeof window[m] == 'function') {
- var stockFunc = window[m].toString();
- for (var i in window.requestParameterMunges) {
- if (stockFunc.indexOf (window.requestParameterMunges[i]['method']) >= 0) {
- console.log('IITC: found request munge set '+i+' in stock intel function "window.'+m+'()"');
- window.activeRequestMungeSet = i;
- }
- }
+ if (window.requestParameterMunges.length == 1) {
+ // no point in searching through the code when there's only one set in use
+ window.activeRequestMungeSet = 0;
+ return;
+ }
+
+ // try and find the stock page functions
+ // FIXME? revert to searching through all the code? is that practical?
+ var stockFunc = nemesis.dashboard.network.DataFetcher.prototype.sendRequest_.toString()
+ for (var i in window.requestParameterMunges) {
+ if (stockFunc.indexOf (window.requestParameterMunges[i]['method']) >= 0) {
+ console.log('IITC: found request munge set index '+i+' in stock intel function nemesis.dashboard.network.DataFetcher.prototype.sendRequest_');
+ window.activeRequestMungeSet = i;
}
}
@@ -281,9 +244,13 @@ window.postAjax = function(action, data, success, error) {
var activeMunge = window.requestParameterMunges[window.activeRequestMungeSet];
var methodName = 'dashboard.'+action;
- var versionStr = "4608f4356a6f55690f127fb542f557f98de66169"; // unsure of parameter value meaning. appears to be a constant used as a 'version'. added to all requests along with the method name in the stock site
- // optional munging of the method name - seen in Set 2 (onwards?)
- if (methodName in activeMunge) methodName = activeMunge[methodName];
+ var versionStr = 'version_parameter';
+
+ // munging of the method name - seen in Set 2 (onwards?)
+ methodName = activeMunge[methodName];
+ // and of the 'version' parameter
+ versionStr = activeMunge[versionStr];
+
var post_data = JSON.stringify(window.requestDataMunge($.extend({method: methodName, version: versionStr}, data)));
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
From f1c1409859a856c835593c2eb21719db05be668a Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Tue, 1 Oct 2013 03:22:45 +0200
Subject: [PATCH 024/126] fixed typo
---
website/page/faq.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/page/faq.php b/website/page/faq.php
index f32d4843..c5d2572a 100644
--- a/website/page/faq.php
+++ b/website/page/faq.php
@@ -68,7 +68,7 @@ From here you can remove/disable individual plugins or IITC itself.
Is it possible to add external plugins to IITC Mobile?
Yes it is!
-
Create a folder named "IITC Mobile" in your home directory.
+
Create a folder named "IITC_Mobile" in your home directory.
Inside this folder, create a new folder named "plugins".
Copy all your additional plugins to this folder.
You should see your plugins listed above the official plugins.
From b1e654e354b624941e08f300952619e42a03be26 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 1 Oct 2013 02:24:06 +0100
Subject: [PATCH 025/126] website: fix faq entry
---
website/page/faq.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/page/faq.php b/website/page/faq.php
index f32d4843..c5d2572a 100644
--- a/website/page/faq.php
+++ b/website/page/faq.php
@@ -68,7 +68,7 @@ From here you can remove/disable individual plugins or IITC itself.
Is it possible to add external plugins to IITC Mobile?
Yes it is!
-
Create a folder named "IITC Mobile" in your home directory.
+
Create a folder named "IITC_Mobile" in your home directory.
Inside this folder, create a new folder named "plugins".
Copy all your additional plugins to this folder.
You should see your plugins listed above the official plugins.
From 278ecf67ee7951ce3d9cd22ed222734ab41af596 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 1 Oct 2013 04:43:18 +0100
Subject: [PATCH 026/126] tweak show-more-portals plugin - move switchoff point
one level out, as this seems to result in fewer requests to the niantic
servers
---
plugins/show-more-portals.user.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/show-more-portals.user.js b/plugins/show-more-portals.user.js
index 346d690a..0721cbbd 100644
--- a/plugins/show-more-portals.user.js
+++ b/plugins/show-more-portals.user.js
@@ -2,7 +2,7 @@
// @id iitc-plugin-show-more-portals@jonatkins
// @name IITC plugin: Show more portals
// @category Tweaks
-// @version 0.1.3.@@DATETIMEVERSION@@
+// @version 0.1.4.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@@ -32,9 +32,9 @@ window.plugin.showMorePortals.setup = function() {
window.getPortalDataZoom = function() {
var mapZoom = map.getZoom();
- // this plugin only cares about close in zoom levels (zoom 13 and higher) - run the original
+ // this plugin only cares about close in zoom levels (zoom 12 and higher) - run the original
// code when this isn't the case. (this way, multiple zoom-modifying plugins can exist at once - in theory)
- if (mapZoom < 13) {
+ if (mapZoom < 12) {
return origGetPortalDataZoom();
}
From 60d686d52b74f81a13b9f1ca3bbb8f6845874b73 Mon Sep 17 00:00:00 2001
From: Hexchain Tong
Date: Tue, 1 Oct 2013 11:56:51 +0800
Subject: [PATCH 027/126] Prevent Google Fonts not being loaded due to security
issue
Chrome refuses to load http resources if the page was loaded using https.
---
main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.js b/main.js
index bf304d6d..c7fdf7b8 100644
--- a/main.js
+++ b/main.js
@@ -63,7 +63,7 @@ document.getElementsByTagName('head')[0].innerHTML = ''
+ ''
+ ''
//note: smartphone.css injection moved into code/smartphone.js
- + '';
+ + '';
document.getElementsByTagName('body')[0].innerHTML = ''
+ '
Loading, please wait
'
From db9956be7e53777392307f88171facdfe856624d Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 1 Oct 2013 05:06:38 +0100
Subject: [PATCH 028/126] update website for 0.14.2 release
---
website/page/home.php | 11 +++++++++++
website/page/news.php | 11 +++++++++++
2 files changed, 22 insertions(+)
diff --git a/website/page/home.php b/website/page/home.php
index e8fd2093..768a5b5b 100644
--- a/website/page/home.php
+++ b/website/page/home.php
@@ -13,6 +13,17 @@ offers many more features. It is available for
Latest news
+
1st October 2013
+
+IITC 0.14.2 and IITC Mobile 0.7.1 have been released. This is a critical update required to work with changes made
+to the standard intel site. Additionally, a major update to the mobile app interface has been made, and a handful
+of tweaks and bugfixes to IITC and a few plugins.
+
+
+The standard intel site now includes an 'alerts' chat tab. This will be coming to IITC in the future, but it's
+better to get this working version released without it than hold things up just for that.
+
+
22nd September 2013
Update: IITC Mobile 0.6.5 replaces 0.6.4. This fixes a crash on entering plugin preferences on some tablets.
diff --git a/website/page/news.php b/website/page/news.php
index fea95b02..9cecae84 100644
--- a/website/page/news.php
+++ b/website/page/news.php
@@ -1,5 +1,16 @@
News
+
1st October 2013
+
+IITC 0.14.2 and IITC Mobile 0.7.1 have been released. This is a critical update required to work with changes made
+to the standard intel site. Additionally, a major update to the mobile app interface has been made, and a handful
+of tweaks and bugfixes to IITC and a few plugins.
+
+
+The standard intel site now includes an 'alerts' chat tab. This will be coming to IITC in the future, but it's
+better to get this working version released without it than hold things up just for that.
+
+
22nd September 2013
Update: IITC Mobile 0.6.5 replaces 0.6.4. This fixes a crash on entering plugin preferences on some tablets.
From b4ae95ce7391d81444897dab1cf299f25d5a4122 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 2 Oct 2013 05:00:08 +0100
Subject: [PATCH 029/126] bump version number
---
main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.js b/main.js
index bf304d6d..8a80cce5 100644
--- a/main.js
+++ b/main.js
@@ -1,7 +1,7 @@
// ==UserScript==
// @id ingress-intel-total-conversion@jonatkins
// @name IITC: Ingress intel map total conversion
-// @version 0.14.2.@@DATETIMEVERSION@@
+// @version 0.14.3.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
From 975db0ec7b56e33af046efc7aa7e59670fffceef Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 2 Oct 2013 05:00:27 +0100
Subject: [PATCH 030/126] add special case for name->guid lookup for our own
name IITC relies on this being available early, but the new sessionStorage
for player name cache means it often isn't (still, it's not perfect - as IITC
still requires a lookup from guid->name for us to store the reverse mapping -
this has always been a theoretical issue though) likely fix for #577
---
code/player_names.js | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/code/player_names.js b/code/player_names.js
index e79cf874..d2acee5a 100644
--- a/code/player_names.js
+++ b/code/player_names.js
@@ -39,6 +39,10 @@ window.playerNameToGuid = function(playerName) {
var cachedGuid = window._playerNameToGuidCache[playerName];
if (cachedGuid !== undefined) return cachedGuid;
+ // IITC needs our own player GUID, from a lookup by name. so we retrieve this from localstorage (if available)
+ cachedGuid = localStorage['PLAYER-'+PLAYER.nickname];
+ if (cachedGuid !== undefined) return cachedGuid;
+
var guid = null;
$.each(Object.keys(sessionStorage), function(ind,key) {
if(playerName === sessionStorage[key]) {
@@ -107,22 +111,17 @@ window.setPlayerName = function(guid, nick, uncertain) {
alert('You have run into bug #37. Please help me solve it!\nCopy and paste this text and post it here:\nhttps://github.com/breunigs/ingress-intel-total-conversion/issues/37\nIf copy & pasting doesn’t work, make a screenshot instead.\n\n\n' + window.debug.printStackTrace() + '\n\n\n' + JSON.stringify(nick));
}
sessionStorage[guid] = nick;
+
+ // IITC needs our own player ID early on in startup. the only way we can find this is by something else
+ // doing a guid->name lookup for our own name. as this doesn't always happen - and likely won't happen when needed
+ // we'll store our own name->guid lookup in localStorage
+ if (nick == PLAYER.nickname) {
+ localStorage['PLAYER-'+PLAYER.nickname] = guid;
+ PLAYER.guid = guid; // set it in PLAYER in case it wasn't already done
+ }
}
-window.loadPlayerNamesForPortal = function(portal_details) {
- if(map.getZoom() < PRECACHE_PLAYER_NAMES_ZOOM) return;
- var e = portal_details;
-
- if(e.captured && e.captured.capturingPlayerId)
- getPlayerName(e.captured.capturingPlayerId);
-
- if(!e.resonatorArray || !e.resonatorArray.resonators) return;
-
- $.each(e.resonatorArray.resonators, function(ind, reso) {
- if(reso) getPlayerName(reso.ownerGuid);
- });
-}
// test to see if a specific player GUID is a special system account (e.g. __JARVIS__, __ADA__) that shouldn't
From 7fd3cb7fd6265667c6fc30dd7e445315f0a8d490 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 2 Oct 2013 23:33:09 +0200
Subject: [PATCH 031/126] show a hint for the user that a tap leads to the info
screen in mobile status bar, when no portal is selected.
---
code/smartphone.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/code/smartphone.js b/code/smartphone.js
index 64142803..3efa7948 100644
--- a/code/smartphone.js
+++ b/code/smartphone.js
@@ -117,6 +117,8 @@ window.runOnSmartphonesAfterBoot = function() {
// add a div/hook for updating mobile info
$('#updatestatus').prepend('');
window.addHook('portalDetailsUpdated', window.smartphoneInfo);
+ // init msg of status bar. hint for the user that a tap leads to the info screen
+ $('#mobileinfo').html('
tap here for info screen
');
// disable img full view
$('#portaldetails').off('click', '**');
From 72620ed668afaba1afa353142962bb8b1f4e565f Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 2 Oct 2013 23:40:51 +0200
Subject: [PATCH 032/126] got rid of redundant code
---
code/chat.js | 1 -
code/debugging.js | 4 ----
code/geosearch.js | 2 +-
code/smartphone.js | 5 +----
code/utils_misc.js | 2 +-
5 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/code/chat.js b/code/chat.js
index ad1032ce..71d0196c 100644
--- a/code/chat.js
+++ b/code/chat.js
@@ -540,7 +540,6 @@ window.chat.show = function(name) {
? $('#updatestatus').hide()
: $('#updatestatus').show();
$('#chat, #chatinput').show();
- $('#map').css('visibility', 'hidden');
var t = $(''+name+'');
window.chat.chooseAnchor(t);
diff --git a/code/debugging.js b/code/debugging.js
index 14663184..b1d2bbe8 100644
--- a/code/debugging.js
+++ b/code/debugging.js
@@ -23,10 +23,6 @@ window.debug.console = function() {
}
window.debug.console.show = function() {
- if (window.isSmartphone()) {
- $('#scrollwrapper, #updatestatus').hide();
- $('#map').css('visibility', 'hidden');
- }
$('#chat, #chatinput').show();
window.debug.console.create();
$('#chatinput mark').css('cssText', 'color: #bbb !important').text('debug:');
diff --git a/code/geosearch.js b/code/geosearch.js
index ab67a56c..b926e9d8 100644
--- a/code/geosearch.js
+++ b/code/geosearch.js
@@ -29,6 +29,6 @@ window.search = function(search) {
northEast = new L.LatLng(b[1], b[3]),
bounds = new L.LatLngBounds(southWest, northEast);
window.map.fitBounds(bounds);
- if(window.isSmartphone()) window.smartphone.mapButton.click();
+ if(window.isSmartphone()) window.show('map');
});
}
diff --git a/code/smartphone.js b/code/smartphone.js
index 3efa7948..56e0c57c 100644
--- a/code/smartphone.js
+++ b/code/smartphone.js
@@ -35,7 +35,6 @@ window.runOnSmartphonesBeforeBoot = function() {
}
window.smartphone.mapButton = $('map').click(function() {
- $('#chat, #chatinput, #scrollwrapper').hide();
$('#map').css('visibility', 'visible');
$('#updatestatus').show();
$('#chatcontrols a .active').removeClass('active');
@@ -43,8 +42,6 @@ window.runOnSmartphonesBeforeBoot = function() {
});
window.smartphone.sideButton = $('info').click(function() {
- $('#chat, #chatinput, #updatestatus').hide();
- $('#map').css('visibility', 'hidden');
$('#scrollwrapper').show();
$('.active').removeClass('active');
$("#chatcontrols a:contains('info')").addClass('active');
@@ -112,7 +109,7 @@ window.runOnSmartphonesAfterBoot = function() {
if(!isSmartphone()) return;
console.warn('running smartphone post boot stuff');
- smartphone.mapButton.click();
+ window.show('map');
// add a div/hook for updating mobile info
$('#updatestatus').prepend('');
diff --git a/code/utils_misc.js b/code/utils_misc.js
index 1da80f29..c421bb52 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -328,7 +328,7 @@ window.rangeLinkClick = function() {
if(window.portalRangeIndicator)
window.map.fitBounds(window.portalRangeIndicator.getBounds());
if(window.isSmartphone())
- window.smartphone.mapButton.click();
+ window.show('map');
}
window.showPortalPosLinks = function(lat, lng, name) {
From 4b0ff58a7b2e300277ea4d64598b4555470a3e3a Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Thu, 3 Oct 2013 11:27:57 +0200
Subject: [PATCH 033/126] commented out weblogin for now since it confuses the
user
---
mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index b860ec17..e518aa0f 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -161,7 +161,7 @@ public class IITC_WebViewClient extends WebViewClient {
@Override
public void onReceivedLoginRequest(WebView view, String realm, String account, String args) {
Log.d("iitcm", "Login requested: " + realm + " " + account + " " + args);
- ((IITC_Mobile) mContext).onReceivedLoginRequest(this, view, realm, account, args);
+ //((IITC_Mobile) mContext).onReceivedLoginRequest(this, view, realm, account, args);
}
// parse all enabled iitc plugins
From eeb24315fb4ae0c9fe6600ea72f0e6b48969a3ef Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Thu, 3 Oct 2013 16:52:33 +0200
Subject: [PATCH 034/126] moved login caching mode setting to webviewclient
---
mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java | 2 --
mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
index af56d2c4..79439c65 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
@@ -572,8 +572,6 @@ public class IITC_Mobile extends Activity {
*/
public void onReceivedLoginRequest(IITC_WebViewClient client, WebView view,
String realm, String account, String args) {
- Log.d("iitcm", "logging in...set caching mode to default");
- mIitcWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
mLogin = new IITC_DeviceAccountLogin(this, view, client);
mLogin.startLogin(realm, account, args);
}
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index e518aa0f..ca67e9f5 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -161,6 +161,8 @@ public class IITC_WebViewClient extends WebViewClient {
@Override
public void onReceivedLoginRequest(WebView view, String realm, String account, String args) {
Log.d("iitcm", "Login requested: " + realm + " " + account + " " + args);
+ Log.d("iitcm", "logging in...set caching mode to default");
+ view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
//((IITC_Mobile) mContext).onReceivedLoginRequest(this, view, realm, account, args);
}
From 26754ac8c02b3d2faacfdede7c7d04be837fe919 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Fri, 4 Oct 2013 16:03:58 +0200
Subject: [PATCH 035/126] moved some listeners from field attribute to class
---
mobile/AndroidManifest.xml | 4 +-
.../com/cradle/iitc_mobile/IITC_Mobile.java | 125 +++++++++---------
2 files changed, 66 insertions(+), 63 deletions(-)
diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml
index 29831632..d8fa1712 100644
--- a/mobile/AndroidManifest.xml
+++ b/mobile/AndroidManifest.xml
@@ -1,8 +1,8 @@
+ android:versionCode="52"
+ android:versionName="0.7.2">
Date: Fri, 4 Oct 2013 16:15:58 +0200
Subject: [PATCH 036/126] some code formatting
---
.../cradle/iitc_mobile/IITC_JSInterface.java | 4 ++--
.../cradle/iitc_mobile/IITC_MapSettings.java | 24 ++++++++-----------
.../com/cradle/iitc_mobile/IITC_Mobile.java | 8 +++----
.../iitc_mobile/IITC_NavigationHelper.java | 20 +++++++---------
.../IITC_PluginPreferenceActivity.java | 8 +++----
.../com/cradle/iitc_mobile/IITC_WebView.java | 2 +-
.../iitc_mobile/IITC_WebViewClient.java | 2 +-
.../iitc_mobile/async/CheckHttpResponse.java | 6 ++---
.../share/IntentFragmentAdapter.java | 2 +-
.../iitc_mobile/share/IntentListView.java | 6 ++---
.../iitc_mobile/share/ShareActivity.java | 2 +-
11 files changed, 37 insertions(+), 47 deletions(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java
index c26c8e21..93873162 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java
@@ -18,7 +18,7 @@ import java.util.Locale;
// provide communication between IITC script and android app
public class IITC_JSInterface {
// context of main activity
- private IITC_Mobile mIitc;
+ private final IITC_Mobile mIitc;
IITC_JSInterface(IITC_Mobile iitc) {
mIitc = iitc;
@@ -111,7 +111,7 @@ public class IITC_JSInterface {
@Override
public void run() {
mIitc.setLoadingState(false);
-
+
mIitc.getMapSettings().onBootFinished();
}
});
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java
index c97c65a6..245aefd2 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java
@@ -22,7 +22,7 @@ import java.util.Comparator;
public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickListener, OnItemLongClickListener {
private class HighlighterAdapter extends ArrayAdapter {
- private HighlighterComparator mComparator = new HighlighterComparator();
+ private final HighlighterComparator mComparator = new HighlighterComparator();
private HighlighterAdapter(int resource) {
super(mIitc, resource);
@@ -67,8 +67,7 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
}
}
- private class LayerAdapter extends ArrayAdapter
- {
+ private class LayerAdapter extends ArrayAdapter {
public LayerAdapter(int resource) {
super(mIitc, resource);
}
@@ -84,15 +83,15 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
}
}
- private IITC_Mobile mIitc;
+ private final IITC_Mobile mIitc;
- private ArrayAdapter mHighlighters;
- private ArrayAdapter mBaseLayers;
- private ArrayAdapter mOverlayLayers;
+ private final ArrayAdapter mHighlighters;
+ private final ArrayAdapter mBaseLayers;
+ private final ArrayAdapter mOverlayLayers;
- private Spinner mSpinnerBaseMap;
- private Spinner mSpinnerHighlighter;
- private ListView mListViewOverlayLayers;
+ private final Spinner mSpinnerBaseMap;
+ private final Spinner mSpinnerHighlighter;
+ private final ListView mListViewOverlayLayers;
private String mActiveHighlighter;
private int mActiveLayer;
@@ -181,8 +180,7 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
if (parent.equals(mSpinnerHighlighter)) {
String name = mHighlighters.getItem(position);
mIitc.getWebView().loadUrl("javascript: window.changePortalHighlights('" + name + "')");
- }
- else if (parent.equals(mSpinnerBaseMap)) {
+ } else if (parent.equals(mSpinnerBaseMap)) {
mBaseLayers.getItem(mActiveLayer).active = false; // set old layer to hidden, but no need to really hide
Layer layer = mBaseLayers.getItem(position);
@@ -253,7 +251,6 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
mBaseLayers.add(layer);
} catch (JSONException e) {
e.printStackTrace();
- continue;
}
}
mBaseLayers.notifyDataSetChanged();
@@ -273,7 +270,6 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
mOverlayLayers.add(layer);
} catch (JSONException e) {
e.printStackTrace();
- continue;
}
}
mOverlayLayers.notifyDataSetChanged();
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
index 5ebbf450..25c4cb9c 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
@@ -283,8 +283,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
if (mReloadNeeded) {
Log.d("iitcm", "preference had changed...reload needed");
reloadIITC();
- }
- else {
+ } else {
// iitc is not fully booted...timer will be reset by the script itself
if (findViewById(R.id.imageLoading).getVisibility() == View.GONE) {
mIitcWebView.loadUrl("javascript: window.idleReset();");
@@ -353,7 +352,6 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
if (mBackButtonPressed || !mSharedPrefs.getBoolean("pref_press_twice_to_exit", false)) {
super.onBackPressed();
- return;
} else {
mBackButtonPressed = true;
Toast.makeText(this, "Press twice to exit", Toast.LENGTH_SHORT).show();
@@ -574,7 +572,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
* called by IITC_WebViewClient when the Google login form is opened.
*/
public void onReceivedLoginRequest(IITC_WebViewClient client, WebView view,
- String realm, String account, String args) {
+ String realm, String account, String args) {
mLogin = new IITC_DeviceAccountLogin(this, view, client);
mLogin.startLogin(realm, account, args);
}
@@ -621,8 +619,8 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
}
/**
- * @deprecated ActionBar related stuff should be handled by IITC_NavigationHelper
* @see getNavigationHelper()
+ * @deprecated ActionBar related stuff should be handled by IITC_NavigationHelper
*/
@Deprecated
@Override
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java
index b7b7f629..1c0af426 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java
@@ -60,8 +60,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
view.setText(getPaneTitle(item));
int icon = 0;
- switch (item)
- {
+ switch (item) {
case MAP:
icon = R.drawable.location_map;
break;
@@ -100,13 +99,13 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
public static final int NOTICE_INFO = 1 << 1;
// next one would be 1<<2; (this results in 1,2,4,8,...)
- private IITC_Mobile mIitc;
- private ActionBar mActionBar;
- private SharedPreferences mPrefs;
- private NavigationAdapter mNavigationAdapter;
- private DrawerLayout mDrawerLayout;
- private ListView mDrawerLeft;
- private View mDrawerRight;
+ private final IITC_Mobile mIitc;
+ private final ActionBar mActionBar;
+ private final SharedPreferences mPrefs;
+ private final NavigationAdapter mNavigationAdapter;
+ private final DrawerLayout mDrawerLayout;
+ private final ListView mDrawerLeft;
+ private final View mDrawerRight;
private boolean mDesktopMode = false;
private boolean mFullscreen = false;
@@ -236,8 +235,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
mDrawerLayout.closeDrawers();
}
- public String getPaneTitle(Pane pane)
- {
+ public String getPaneTitle(Pane pane) {
switch (pane) {
case INFO:
return "Info";
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
index 209db065..b8909fca 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
@@ -62,7 +62,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
- if(onIsMultiPane()) getIntent()
+ if (onIsMultiPane()) getIntent()
.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
super.onCreate(savedInstanceState);
}
@@ -76,7 +76,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
// Select the displayed fragment in the headers (when using a tablet) :
// This should be done by Android, it is a bug fix
// thx to http://stackoverflow.com/a/16793839
- if(mHeaders != null) {
+ if (mHeaders != null) {
final String displayedFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
if (displayedFragment != null) {
@@ -227,7 +227,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
// now we have all stuff together and can build the preference
// first check if we need a new category
- if (sPlugins.containsKey(plugin_cat) == false) {
+ if (!sPlugins.containsKey(plugin_cat)) {
sPlugins.put(plugin_cat, new ArrayList());
Log.d("iitcm", "create " + plugin_cat + " and add " + plugin_name);
}
@@ -288,7 +288,7 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
TextView summary;
}
- private LayoutInflater mInflater;
+ private final LayoutInflater mInflater;
static int getHeaderType(Header header) {
if (header.fragment == null && header.intent == null) {
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
index c0966c28..affa80c1 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
@@ -53,7 +53,7 @@ public class IITC_WebView extends WebView {
*/
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
- GeolocationPermissions.Callback callback) {
+ GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
}
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index ca67e9f5..3297447c 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -148,7 +148,7 @@ public class IITC_WebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
if (url.startsWith("http://www.ingress.com/intel")
- || url.startsWith("https://www.ingress.com/intel")) {
+ || url.startsWith("https://www.ingress.com/intel")) {
Log.d("iitcm", "injecting iitc..");
view.loadUrl("javascript: " + this.mIitcScript);
}
diff --git a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java
index 057b0c74..dde6e89c 100644
--- a/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java
+++ b/mobile/src/com/cradle/iitc_mobile/async/CheckHttpResponse.java
@@ -24,13 +24,13 @@ import java.io.IOException;
*/
public class CheckHttpResponse extends AsyncTask {
- private IITC_JSInterface mJsInterface;
- private Context mContext;
+ private final IITC_JSInterface mJsInterface;
+ private final Context mContext;
public CheckHttpResponse(IITC_JSInterface jsInterface, Context c) {
mContext = c;
mJsInterface = jsInterface;
- };
+ }
@Override
protected Boolean doInBackground(String... urls) {
diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java b/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java
index 68743a08..fd803345 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/IntentFragmentAdapter.java
@@ -8,7 +8,7 @@ import java.util.ArrayList;
import java.util.List;
public class IntentFragmentAdapter extends FragmentPagerAdapter {
- private List mTabs;
+ private final List mTabs;
public IntentFragmentAdapter(FragmentManager fm) {
super(fm);
diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java
index d0a72cc6..9c6b16c1 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java
@@ -74,7 +74,7 @@ public class IntentListView extends ListView {
private IntentAdapter mAdapter;
private PackageManager mPackageManager;
- HashMap mActivities = new HashMap();
+ private final HashMap mActivities = new HashMap();
public IntentListView(Context context) {
super(context);
@@ -155,7 +155,6 @@ public class IntentListView extends ListView {
if (hasCopyIntent || !activity.name.equals(SendToClipboard.class.getCanonicalName())) {
activityList.remove(i);
i--;
- continue;
}
}
}
@@ -172,8 +171,7 @@ public class IntentListView extends ListView {
if (resolveInfo.activityInfo.packageName.equals(defaultTarget.activityInfo.packageName)
&& resolveInfo.activityInfo.name.equals(defaultTarget.activityInfo.name)) {
allActivities.add(0, resolveInfo);
- }
- else {
+ } else {
allActivities.add(resolveInfo);
}
}
diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
index 71200af3..aeec04cc 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
@@ -108,7 +108,7 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
Intent intent = getIntent();
// from portallinks/permalinks we build 3 intents (share / geo / vanilla-intel-link)
- if (intent.getBooleanExtra("onlyShare", false) == false) {
+ if (!intent.getBooleanExtra("onlyShare", false)) {
mTitle = intent.getStringExtra("title");
mLl = intent.getDoubleExtra("lat", 0) + "," + intent.getDoubleExtra("lng", 0);
mZoom = intent.getIntExtra("zoom", 0);
From 7a6bf1eeef21b74a14b7c93adf7dd0dabc5f77ba Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 7 Oct 2013 20:18:09 +0100
Subject: [PATCH 037/126] only look to localStorage for our player guid WHEN
WE'RE LOOKING UP OUR OWN NAME daft error!
---
code/player_names.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/code/player_names.js b/code/player_names.js
index d2acee5a..86062520 100644
--- a/code/player_names.js
+++ b/code/player_names.js
@@ -40,8 +40,10 @@ window.playerNameToGuid = function(playerName) {
if (cachedGuid !== undefined) return cachedGuid;
// IITC needs our own player GUID, from a lookup by name. so we retrieve this from localstorage (if available)
- cachedGuid = localStorage['PLAYER-'+PLAYER.nickname];
- if (cachedGuid !== undefined) return cachedGuid;
+ if (playerName == PLAYER.nickname) {
+ cachedGuid = localStorage['PLAYER-'+PLAYER.nickname];
+ if (cachedGuid !== undefined) return cachedGuid;
+ }
var guid = null;
$.each(Object.keys(sessionStorage), function(ind,key) {
From d2661874c61d518324a6b05fa5155dd793dc00e3 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 7 Oct 2013 20:29:05 +0100
Subject: [PATCH 038/126] some work-in-progress. from a read of the
far-less-obfsucated code on the stock site it looks like map data can be
retrieved as an update to an earlier query i.e. pass the timestamp of the
last data request, and the server should only send the changed data rather
than everything
---
code/map_data_cache.js | 10 ++++--
code/map_data_debug.js | 3 +-
code/map_data_request.js | 74 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 81 insertions(+), 6 deletions(-)
diff --git a/code/map_data_cache.js b/code/map_data_cache.js
index c143e9c9..6dcda1a8 100644
--- a/code/map_data_cache.js
+++ b/code/map_data_cache.js
@@ -2,8 +2,14 @@
// cache for map data tiles.
window.DataCache = function() {
- this.REQUEST_CACHE_FRESH_AGE = 60; // if younger than this, use data in the cache rather than fetching from the server
- this.REQUEST_CACHE_MAX_AGE = 180; // maximum cache age. entries are deleted from the cache after this time
+ // stock site nemesis.dashboard.DataManager.CACHE_EXPIRY_MS_ = 18E4 - so should be 2 mins cache time
+ this.REQUEST_CACHE_FRESH_AGE = 120; // if younger than this, use data in the cache rather than fetching from the server
+
+ // stale cache entries can be updated (that's what the optional 'timestampMs' field in getThinnedEntnties is
+ // for, retrieving deltas) so use a long max age to take advantage of this
+ // however, ther must be an overall limit on the maximum age of data from the servers, otherwise the deletedEntity
+ // entries would grow indefinitely. an hour seems reasonable from experience with the data, so 55 mins max cache time
+ this.REQUEST_CACHE_MAX_AGE = 55*60; // maximum cache age. entries are deleted from the cache after this time
if (L.Browser.mobile) {
// on mobile devices, smaller cache size
diff --git a/code/map_data_debug.js b/code/map_data_debug.js
index 4ecc27a8..dcede257 100644
--- a/code/map_data_debug.js
+++ b/code/map_data_debug.js
@@ -37,7 +37,8 @@ window.RenderDebugTiles.prototype.setState = function(id,state) {
var col = '#f0f';
var fill = '#f0f';
switch(state) {
- case 'ok': col='#0f0'; fill='#0f0'; break;
+ case 'ok': col='#080'; fill='#080'; break;
+ case 'ok-delta': col='#0f0'; fill='#0f0'; break;
case 'error': col='#f00'; fill='#f00'; break;
case 'cache-fresh': col='#0f0'; fill='#ff0'; break;
case 'cache-stale': col='#f00'; fill='#ff0'; break;
diff --git a/code/map_data_request.js b/code/map_data_request.js
index e6fcb799..ff839663 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -11,6 +11,7 @@ window.MapDataRequest = function() {
this.activeRequestCount = 0;
this.requestedTiles = {};
+ this.staleTileData = {};
this.idle = false;
@@ -45,7 +46,7 @@ window.MapDataRequest = function() {
// additionally, a delay before processing the queue after requeueing tiles
// (this way, if multiple requeue delays finish within a short time of each other, they're all processed in one queue run)
- this.RERUN_QUEUE_DELAY = 2;
+ this.RERUN_QUEUE_DELAY = 1;
this.REFRESH_CLOSE = 120; // refresh time to use for close views z>12 when not idle and not moving
this.REFRESH_FAR = 600; // refresh time for far views z <= 12
@@ -172,6 +173,9 @@ window.MapDataRequest.prototype.refresh = function() {
// fill tileBounds with the data needed to request each tile
this.tileBounds = {};
+ // clear the stale tile data
+ this.staleTileData = {};
+
var bounds = clampLatLngBounds(map.getBounds());
var zoom = getPortalDataZoom();
@@ -238,6 +242,7 @@ window.MapDataRequest.prototype.refresh = function() {
this.render.processTileData (this.cache.get(tile_id));
this.cachedTileCount += 1;
} else {
+
// no fresh data - queue a request
var boundsParams = generateBoundsParams(
tile_id,
@@ -247,6 +252,30 @@ window.MapDataRequest.prototype.refresh = function() {
lngEast
);
+ // however, the server does support delta requests - only returning the entities changed since a particular timestamp
+ // retrieve the stale cache entry and use it, if possible
+ var stale = (this.cache && this.cache.get(tile_id));
+ var lastTimestamp = undefined;
+ if (stale) {
+ // find the timestamp of the latest entry in the stale records. the stock site appears to use the browser
+ // clock, but this isn't reliable. ideally the data set should include it's retrieval timestamp, set by the
+ // server, for use here. a good approximation is the highest timestamp of all entities
+
+ for (var i in stale.gameEntities) {
+ var ent = stale.gameEntities[i];
+ if (lastTimestamp===undefined || ent[1] > lastTimestamp) {
+ lastTimestamp = ent[1];
+ }
+ }
+
+console.log('stale tile '+tile_id+': newest mtime '+lastTimestamp+(lastTimestamp?' '+new Date(lastTimestamp).toString():''));
+ if (lastTimestamp) {
+ // we can issue a useful delta request - store the previous data, as we can't rely on the cache still having it later
+ this.staleTileData[tile_id] = stale;
+ boundsParams.timestampMs = lastTimestamp;
+ }
+ }
+
this.tileBounds[tile_id] = boundsParams;
this.requestedTileCount += 1;
}
@@ -358,7 +387,7 @@ window.MapDataRequest.prototype.sendTileRequest = function(tiles) {
this.debugTiles.setState (id, 'requested');
- this.requestedTiles[id] = true;
+ this.requestedTiles[id] = { staleData: this.staleTileData[id] };
var boundsParams = this.tileBounds[id];
if (boundsParams) {
@@ -473,13 +502,52 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
// no error for this data tile - process it
successTiles.push (id);
+ var stale = this.requestedTiles[id].staleData;
+ if (stale) {
+ // we have stale data. therefore, a delta request was made for this tile. we need to merge the results with
+ // the existing stale data before proceeding
+
+ var dataObj = {};
+ // copy all entities from the stale data...
+ for (var i in stale.gameEntities||[]) {
+ var ent = stale.gameEntities[i];
+ dataObj[ent[0]] = { timestamp: ent[1], data: ent[2] };
+ }
+var oldEntityCount = Object.keys(dataObj).length;
+ // and remove any entities in the deletedEntnties list
+ for (var i in val.deletedEntities||[]) {
+ var guid = val.deletedEntities[i];
+ delete dataObj[guid];
+ }
+var oldEntityCount2 = Object.keys(dataObj).length;
+ // then add all entities from the new data
+ for (var i in val.gameEntities||[]) {
+ var ent = val.gameEntities[i];
+ dataObj[ent[0]] = { timestamp: ent[1], data: ent[2] };
+ }
+var newEntityCount = Object.keys(dataObj).length;
+console.log('processed delta mapData request:'+id+': '+oldEntityCount+' original entities, '+oldEntityCount2+' after deletion, '+val.gameEntities.length+' entities in the response');
+
+ // now reconstruct a new gameEntities array in val, with the updated data
+ val.gameEntities = [];
+ for (var guid in dataObj) {
+ var ent = [guid, dataObj[guid].timestamp, dataObj[guid].data];
+ val.gameEntities.push(ent);
+ }
+
+ // we can leave the returned 'deletedEntities' data unmodified - it's not critial to how IITC works anyway
+
+ // also delete any staleTileData entries for this tile - no longer required
+ delete this.staleTileData[id];
+ }
+
// store the result in the cache
this.cache && this.cache.store (id, val);
// if this tile was in the render list, render it
// (requests aren't aborted when new requests are started, so it's entirely possible we don't want to render it!)
if (id in this.tileBounds) {
- this.debugTiles.setState (id, 'ok');
+ this.debugTiles.setState (id, stale?'ok-delta':'ok');
this.render.processTileData (val);
From 306de7e6dc47d461670550f78c45ceac7306ffc1 Mon Sep 17 00:00:00 2001
From: Morgan Jones
Date: Mon, 7 Oct 2013 18:29:43 -0500
Subject: [PATCH 039/126] Load different versions of Roboto web font Use Roboto
for COMM font rather than Verdana
---
main.js | 8 +++++---
style.css | 12 +++++++-----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/main.js b/main.js
index a651f80f..ff0fb77f 100644
--- a/main.js
+++ b/main.js
@@ -40,10 +40,10 @@ if(!d) {
if(document.getElementById('header_email')) {
// however, we are logged in.
setTimeout('location.reload();', 3*1000);
- throw('Page doesn’t have player data, but you are logged in. Reloading in 3s.');
+ throw("Page doesn't have player data, but you are logged in. Reloading in 3s.");
}
// FIXME: handle nia takedown in progress
- throw('Couldn’t retrieve player data. Are you logged in?');
+ throw("Couldn't retrieve player data. Are you logged in?");
}
@@ -63,7 +63,9 @@ document.getElementsByTagName('head')[0].innerHTML = ''
+ ''
+ ''
//note: smartphone.css injection moved into code/smartphone.js
- + '';
+ + ''
+ + ''
+ + '';
document.getElementsByTagName('body')[0].innerHTML = ''
+ '
Loading, please wait
'
diff --git a/style.css b/style.css
index 377d6577..f70714a2 100644
--- a/style.css
+++ b/style.css
@@ -9,11 +9,12 @@ html, body, #map {
body {
font-size: 14px;
- font-family: "roboto",arial,helvetica,sans-serif;
+ font-family: "Roboto",arial,helvetica,sans-serif;
margin: 0;
}
#scrollwrapper {
+ font-family: Coda, sans-serif;
overflow-x: hidden;
overflow-y: auto;
position: fixed;
@@ -255,7 +256,7 @@ em {
}
#chat td, #chatinput td {
- font-family: Verdana, sans-serif;
+ font-family: Roboto, sans-serif;
font-size: 12.6px;
vertical-align: top;
padding-bottom: 3px;
@@ -302,7 +303,7 @@ mark {
summary {
color: #bbb;
display: inline-block;
- font-family: Verdana,sans-serif;
+ font-family: Roboto,sans-serif;
height: 16px;
overflow: hidden;
padding: 0 2px;
@@ -333,7 +334,7 @@ summary {
#chatinput input {
background: transparent;
font-size: 12.6px;
- font-family: Verdana,sans-serif;
+ font-family: Roboto,sans-serif;
color: #EEEEEE;
width: 100%;
height: 100%;
@@ -697,7 +698,7 @@ h3 {
right: 2px;
cursor: pointer;
color: #FFCE00;
- font-family: "Arial", sans;
+ font-family: Roboto, sans-serif;
font-size: 16px;
}
@@ -783,6 +784,7 @@ h3 {
}
.ui-dialog-titlebar {
+ font: 13px/15px Roboto, Arial, Helvetica, sans-serif;
text-align: center;
padding: 4px;
background-color: rgba(8, 60, 78, 0.9);
From 0fde4e6ba4de6a6ac02bff070288dea23e7d34e8 Mon Sep 17 00:00:00 2001
From: Morgan Jones
Date: Tue, 8 Oct 2013 15:40:07 -0500
Subject: [PATCH 040/126] Remove api.js
---
main.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/main.js b/main.js
index ff0fb77f..80ec3b57 100644
--- a/main.js
+++ b/main.js
@@ -63,7 +63,6 @@ document.getElementsByTagName('head')[0].innerHTML = ''
+ ''
+ ''
//note: smartphone.css injection moved into code/smartphone.js
- + ''
+ ''
+ '';
From 06018278782d04112decee5fffe738ea3ef2e435 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Tue, 8 Oct 2013 23:04:23 +0200
Subject: [PATCH 041/126] reverted back to one-after-another plugin injection
---
build.py | 5 +-
mobile/AndroidManifest.xml | 4 +-
.../iitc_mobile/IITC_WebViewClient.java | 84 ++++---------------
website/page/faq.php | 2 -
4 files changed, 21 insertions(+), 74 deletions(-)
diff --git a/build.py b/build.py
index 96212c5c..252bed6a 100755
--- a/build.py
+++ b/build.py
@@ -247,8 +247,6 @@ if buildMobile:
except:
pass
shutil.copy(os.path.join(outDir,"total-conversion-build.user.js"), "mobile/assets/total-conversion-build.user.js")
- # copy the user location script into the mobile folder.
- shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/user-location.user.js")
# also copy plugins
try:
shutil.rmtree("mobile/assets/plugins")
@@ -260,6 +258,9 @@ if buildMobile:
'force-https*', 'privacy-view*', 'speech-search*',
'basemap-cloudmade*', 'scroll-wheel-zoom-disable*'))
+ # copy the user location script into the mobile folder.
+ shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/plugins/user-location.user.js")
+
if buildMobile != 'copyonly':
# now launch 'ant' to build the mobile project
diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml
index d8fa1712..0b7c9866 100644
--- a/mobile/AndroidManifest.xml
+++ b/mobile/AndroidManifest.xml
@@ -1,8 +1,8 @@
+ android:versionCode="53"
+ android:versionName="0.7.3">
all_prefs = sharedPref.getAll();
@@ -181,39 +178,32 @@ public class IITC_WebViewClient extends WebViewClient {
for (Map.Entry entry : all_prefs.entrySet()) {
String plugin = entry.getKey();
if (plugin.endsWith("user.js") && entry.getValue().toString().equals("true")) {
- // load default iitc plugins
if (!plugin.startsWith(mIitcPath)) {
+ // load default iitc plugins
Log.d("iitcm", "adding plugin " + plugin);
- if (dev_enabled)
- js += this.removePluginWrapper(mIitcPath + "dev/plugins/"
- + plugin, false);
- else
- js += this.removePluginWrapper("plugins/" + plugin, true);
- // load user iitc plugins
+ loadJS(path + plugin, !dev_enabled, view);
} else {
+ // load user iitc plugins
Log.d("iitcm", "adding user plugin " + plugin);
- js += this.removePluginWrapper(plugin, false);
+ loadJS(plugin, false, view);
}
}
}
// inject the user location script if enabled in settings
if (sharedPref.getBoolean("pref_user_loc", false))
- js += parseTrackingPlugin(dev_enabled);
-
- return js;
+ loadJS(path + "user-location.user.js", !dev_enabled, view);
}
- public String parseTrackingPlugin(boolean dev_enabled) {
- Log.d("iitcm", "enable tracking...");
- String js = "";
- // load plugin from external storage if dev mode are enabled
- if (dev_enabled)
- js = this.removePluginWrapper(mIitcPath + "dev/user-location.user.js", false);
+ // read a file into a string
+ // load it as javascript
+ public boolean loadJS(String file, boolean asset, WebView view) {
+ String js = fileToString(file, asset);
+ if (js.equals("false"))
+ return false;
else
- // load plugin from asset folder
- js = this.removePluginWrapper("user-location.user.js", true);
- return js;
+ view.loadUrl("javascript:" + js);
+ return true;
}
// read a file into a string
@@ -248,48 +238,6 @@ public class IITC_WebViewClient extends WebViewClient {
return src;
}
- // read a file into a string
- // load it as javascript
- // at the moment not needed, but not bad to have it in the IITC_WebViewClient API
- public boolean loadJS(String file, boolean asset, WebView view) {
- if (!file.endsWith("user.js"))
- return false;
- String js = fileToString(file, asset);
- if (js.equals("false"))
- return false;
- else
- view.loadUrl("javascript:" + js);
- return true;
- }
-
- // iitc and all plugins are loaded at the same time
- // so remove the wrapper functions and injection code
- // TODO: it only works if the plugin is coded with the iitc plugin template
- public String removePluginWrapper(String file, boolean asset) {
- if (!file.endsWith("user.js")) return "";
- String js = fileToString(file, asset);
- if (js.equals("false")) return "";
- js = js.replaceAll("\r\n", "\n"); //convert CR-LF pairs to LF - windows format text files
- js = js.replaceAll("\r", "\n"); //convert remaining CR to LF - Mac format files(?)
- String wrapper_start = "function wrapper() {";
- String wrapper_end = "} // wrapper end";
- String injection_code = "// inject code into site context\n" +
- "var script = document.createElement('script');\n" +
- "script.appendChild(document.createTextNode('('+ wrapper +')();'));\n" +
- "(document.body || document.head || document.documentElement).appendChild(script);";
- if (js.contains(wrapper_start) && js.contains(wrapper_end) && js.contains(injection_code)) {
- js = js.replace(wrapper_start, "");
- // remove the wrapper function
- js = js.replace(wrapper_end, "");
- // and the code injection
- js = js.replace(injection_code, "");
- } else {
- Log.d("iitcm", "Removal of wrapper/injection code failed for " + file);
- return "";
- }
- return js;
- }
-
// Check every external resource if it’s okay to load it and maybe replace
// it
// with our own content. This is used to block loading Niantic resources
diff --git a/website/page/faq.php b/website/page/faq.php
index c5d2572a..e88156ea 100644
--- a/website/page/faq.php
+++ b/website/page/faq.php
@@ -75,8 +75,6 @@ Yes it is!
Note:
-
The plugins wrapper function has to be identical to all other IITC plugins (IITCm removes it via search and replace).
- Alternatively, you can use the @@PLUGINSTART@@ / @@PLUGINEND@@ macros or remove the wrapper by hand.
The filename has to end with *.user.js.
If you don't know where to find your home directory: Enable dev-mode in the settings and follow the hint.
From 3c8c03e9e5471bc817a8dcc142a78d3f3d3fb54b Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 9 Oct 2013 05:30:09 +0100
Subject: [PATCH 042/126] portal-names plugin: - use RequestFinished hook to
update names while loading - use map.project to get coordinates - this is
floating point, so less likely to have two portals with different horizontal
but identical vertical position which causes neither to show a name
---
plugins/portal-names.user.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/plugins/portal-names.user.js b/plugins/portal-names.user.js
index 24ef4f57..635f0033 100644
--- a/plugins/portal-names.user.js
+++ b/plugins/portal-names.user.js
@@ -2,7 +2,7 @@
// @id iitc-plugin-portal-names@zaso
// @name IITC plugin: Portal Names
// @category Layer
-// @version 0.1.0.@@DATETIMEVERSION@@
+// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@@ -21,7 +21,7 @@
// use own namespace for plugin
window.plugin.portalNames = function() {};
-window.plugin.portalNames.MAX_PORTALS = 250;
+window.plugin.portalNames.MAX_PORTALS = 400;
window.plugin.portalNames.NAME_WIDTH = 80;
window.plugin.portalNames.NAME_HEIGHT = 23;
@@ -88,7 +88,7 @@ window.plugin.portalNames.updatePortalLabels = function() {
for (var guid in window.portals) {
var p = window.portals[guid];
if (p._map) { // only consider portals added to the map
- var point = map.latLngToLayerPoint(p.getLatLng());
+ var point = map.project(p.getLatLng());
portalPoints[guid] = point;
}
}
@@ -150,6 +150,7 @@ var setup = function() {
window.plugin.portalNames.labelLayerGroup = new L.LayerGroup();
window.addLayerGroup('Portal Names', window.plugin.portalNames.labelLayerGroup, true);
+ window.addHook('requestFinished', window.plugin.portalNames.updatePortalLabels);
window.addHook('mapDataRefreshEnd', window.plugin.portalNames.updatePortalLabels);
window.map.on('overlayadd overlayremove', window.plugin.portalNames.updatePortalLabels);
}
From 64d056bb8b29ffe147c79171980572d44efee8c4 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 9 Oct 2013 07:36:20 +0100
Subject: [PATCH 043/126] portals-list: move style for fixing width of portal
names to the rest of it cleans things up, and done to understand why mobile
is an issue
---
plugins/portals-list.user.js | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/plugins/portals-list.user.js b/plugins/portals-list.user.js
index 089e0966..ad9cc336 100644
--- a/plugins/portals-list.user.js
+++ b/plugins/portals-list.user.js
@@ -395,7 +395,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
onClick: jsSingleClick,
onDblClick: jsDoubleClick
})[0].outerHTML;
- var div = '
'+a+'
';
+ var div = '
'+a+'
';
return div;
}
@@ -416,13 +416,14 @@ var setup = function() {
$('#toolbox').append(' Portals list');
$('head').append('');
}
From e3002d420e27c1b310e30123979e8eff1ccb22a4 Mon Sep 17 00:00:00 2001
From: Morgan Jones
Date: Wed, 9 Oct 2013 08:27:20 -0500
Subject: [PATCH 044/126] * Remove Coda font * Add more variants of Roboto for
future typography tweaks * Tweak sidebar player name to look more attractive
* Simplify font selectors
---
main.js | 3 +--
style.css | 21 +++++++++------------
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/main.js b/main.js
index 80ec3b57..d231360a 100644
--- a/main.js
+++ b/main.js
@@ -63,8 +63,7 @@ document.getElementsByTagName('head')[0].innerHTML = ''
+ ''
+ ''
//note: smartphone.css injection moved into code/smartphone.js
- + ''
- + '';
+ + '';
document.getElementsByTagName('body')[0].innerHTML = ''
+ '
Loading, please wait
'
diff --git a/style.css b/style.css
index f70714a2..7b286c73 100644
--- a/style.css
+++ b/style.css
@@ -9,12 +9,11 @@ html, body, #map {
body {
font-size: 14px;
- font-family: "Roboto",arial,helvetica,sans-serif;
+ font-family: "Roboto", "Helvetica Neue", Helvetica, sans-serif;
margin: 0;
}
#scrollwrapper {
- font-family: Coda, sans-serif;
overflow-x: hidden;
overflow-y: auto;
position: fixed;
@@ -137,7 +136,7 @@ a:hover {
.fieldmu {
color: #FFCE00;
font-size: 13px;
- font-family: "roboto",arial,helvetica,sans-serif; /*override leaflet-container */
+ font-family: Roboto, "Helvetica Neue", Helvetica, sans-serif; /*override leaflet-container */
text-align: center;
text-shadow: 0 0 0.2em black, 0 0 0.2em black, 0 0 0.2em black;
pointer-events: none;
@@ -211,6 +210,7 @@ a:hover {
z-index: 3000;
background: rgba(8, 48, 78, 0.9);
font-size: 12.6px;
+ line-height: 14px;
color: #eee;
border: 1px solid #20A8B1;
border-bottom: 0;
@@ -256,7 +256,6 @@ em {
}
#chat td, #chatinput td {
- font-family: Roboto, sans-serif;
font-size: 12.6px;
vertical-align: top;
padding-bottom: 3px;
@@ -303,7 +302,6 @@ mark {
summary {
color: #bbb;
display: inline-block;
- font-family: Roboto,sans-serif;
height: 16px;
overflow: hidden;
padding: 0 2px;
@@ -334,7 +332,6 @@ summary {
#chatinput input {
background: transparent;
font-size: 12.6px;
- font-family: Roboto,sans-serif;
color: #EEEEEE;
width: 100%;
height: 100%;
@@ -385,6 +382,7 @@ h2 {
}
h2 #name {
+ font-weight: 300;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
@@ -698,7 +696,6 @@ h3 {
right: 2px;
cursor: pointer;
color: #FFCE00;
- font-family: Roboto, sans-serif;
font-size: 16px;
}
@@ -743,7 +740,8 @@ h3 {
background-color: rgba(8, 48, 78, 0.9);
border: 1px solid #20A8B1;
color: #eee;
- font: 13px/15px Roboto, Arial, Helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 15px;
padding: 2px 4px;
}
@@ -784,7 +782,8 @@ h3 {
}
.ui-dialog-titlebar {
- font: 13px/15px Roboto, Arial, Helvetica, sans-serif;
+ font-size: 13px;
+ line-height: 15px;
text-align: center;
padding: 4px;
background-color: rgba(8, 60, 78, 0.9);
@@ -894,7 +893,6 @@ td + td {
/* redeem results *****************************************************/
.redeem-result-table {
font-size: 14px;
- font-family: Roboto, Arial, Helvetica, sans-serif;
table-layout: fixed;
}
@@ -945,13 +943,12 @@ td + td {
color: #28f428;
}
-#portal_highlight_select{
+#portal_highlight_select {
position: absolute;
top:5px;
left:10px;
z-index: 2500;
font-size:11px;
- font-family: "roboto",arial,helvetica,sans-serif;
background-color:#0E3C46;
color:#ffce00;
From c92aaf604d299bd3946ba89e016d87864abc5d6f Mon Sep 17 00:00:00 2001
From: Morgan Jones
Date: Wed, 9 Oct 2013 08:36:12 -0500
Subject: [PATCH 045/126] Slight fixup
---
style.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/style.css b/style.css
index 7b286c73..9df26a17 100644
--- a/style.css
+++ b/style.css
@@ -210,7 +210,7 @@ a:hover {
z-index: 3000;
background: rgba(8, 48, 78, 0.9);
font-size: 12.6px;
- line-height: 14px;
+ line-height: 14.8px;
color: #eee;
border: 1px solid #20A8B1;
border-bottom: 0;
From 301a8564afc86524ebfb854e6ef662e2069f821b Mon Sep 17 00:00:00 2001
From: Morgan Jones
Date: Wed, 9 Oct 2013 15:54:49 -0500
Subject: [PATCH 046/126] Increase spacing slightly more in chat
---
style.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/style.css b/style.css
index 9df26a17..3b886151 100644
--- a/style.css
+++ b/style.css
@@ -210,7 +210,7 @@ a:hover {
z-index: 3000;
background: rgba(8, 48, 78, 0.9);
font-size: 12.6px;
- line-height: 14.8px;
+ line-height: 15px;
color: #eee;
border: 1px solid #20A8B1;
border-bottom: 0;
From 7d60f93472f83591b100c2ee69701a60d8f0a853 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Fri, 11 Oct 2013 11:29:55 +0200
Subject: [PATCH 047/126] moved user location plugin back to assets root so
that it's not displayed in the iitc plugins section
---
build.py | 5 ++---
mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java | 6 ++++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/build.py b/build.py
index 252bed6a..96212c5c 100755
--- a/build.py
+++ b/build.py
@@ -247,6 +247,8 @@ if buildMobile:
except:
pass
shutil.copy(os.path.join(outDir,"total-conversion-build.user.js"), "mobile/assets/total-conversion-build.user.js")
+ # copy the user location script into the mobile folder.
+ shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/user-location.user.js")
# also copy plugins
try:
shutil.rmtree("mobile/assets/plugins")
@@ -258,9 +260,6 @@ if buildMobile:
'force-https*', 'privacy-view*', 'speech-search*',
'basemap-cloudmade*', 'scroll-wheel-zoom-disable*'))
- # copy the user location script into the mobile folder.
- shutil.copy(os.path.join(outDir,"user-location.user.js"), "mobile/assets/plugins/user-location.user.js")
-
if buildMobile != 'copyonly':
# now launch 'ant' to build the mobile project
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index e8dbe488..83947756 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -191,8 +191,10 @@ public class IITC_WebViewClient extends WebViewClient {
}
// inject the user location script if enabled in settings
- if (sharedPref.getBoolean("pref_user_loc", false))
- loadJS(path + "user-location.user.js", !dev_enabled, view);
+ if (sharedPref.getBoolean("pref_user_loc", false)) {
+ path = path.replace("plugins/", "");
+ loadJS(path + "user-location.user.js", !dev_enabled, view);
+ }
}
// read a file into a string
From 33bdc2c5908f19893d047663d8912a4917f877a7 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Sat, 12 Oct 2013 20:41:01 +0100
Subject: [PATCH 048/126] make portal-names work however many portals are on
screen, by using buckets to group portals for more efficient overlap testing
---
plugins/portal-names.user.js | 60 +++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 25 deletions(-)
diff --git a/plugins/portal-names.user.js b/plugins/portal-names.user.js
index 635f0033..5e902f2c 100644
--- a/plugins/portal-names.user.js
+++ b/plugins/portal-names.user.js
@@ -2,7 +2,7 @@
// @id iitc-plugin-portal-names@zaso
// @name IITC plugin: Portal Names
// @category Layer
-// @version 0.1.1.@@DATETIMEVERSION@@
+// @version 0.1.2.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@@ -21,7 +21,6 @@
// use own namespace for plugin
window.plugin.portalNames = function() {};
-window.plugin.portalNames.MAX_PORTALS = 400;
window.plugin.portalNames.NAME_WIDTH = 80;
window.plugin.portalNames.NAME_HEIGHT = 23;
@@ -93,33 +92,44 @@ window.plugin.portalNames.updatePortalLabels = function() {
}
}
- if (Object.keys(portalPoints).length > window.plugin.portalNames.MAX_PORTALS) {
- // too manuy VISIBLE portals to handle quickly - clear all
- window.plugin.portalNames.labelLayerGroup.clearLayers();
- window.plugin.portalNames.labelLayers = {};
- return;
- }
+ // for efficient testing of intersection, group portals into buckets based on the label size
+ var buckets = {};
+ for (var guid in portalPoints) {
+ var point = portalPoints[guid];
+ var bucketId = L.point([Math.floor(point.x/(window.plugin.portalNames.NAME_WIDTH*2)),Math.floor(point.y/window.plugin.portalNames.NAME_HEIGHT)]);
+ // the guid is added to four buckets. this way, when testing for overlap we don't need to test
+ // all 8 buckets surrounding the one around the particular portal, only the bucket it is in itself
+ var bucketIds = [bucketId, bucketId.add([1,0]), bucketId.add([0,1]), bucketId.add([1,1])];
+ for (var i in bucketIds) {
+ var b = bucketIds[i].toString();
+ if (!buckets[b]) buckets[b] = {};
+ buckets[b][guid] = true;
+ }
+ }
var coveredPortals = {};
- for (var guid in portalPoints) {
- var point = portalPoints[guid];
- // the bounds used for testing are twice as wide as the portal name marker. this is so that there's no left/right
- // overlap between two different portals text
- var largeBounds = L.bounds (
- point.subtract([window.plugin.portalNames.NAME_WIDTH,0]),
- point.add([window.plugin.portalNames.NAME_WIDTH,window.plugin.portalNames.NAME_HEIGHT])
- );
-
- for (var otherGuid in portalPoints) {
- if (guid != otherGuid) {
- var otherPoint = portalPoints[otherGuid];
-
- if (largeBounds.contains(otherPoint)) {
- // another portal is within the rectangle for this one's name - so no name for this one
- coveredPortals[guid] = true;
- break;
+ for (var bucket in buckets) {
+ var bucketGuids = buckets[bucket];
+ for (var guid in bucketGuids) {
+ var point = portalPoints[guid];
+ // the bounds used for testing are twice as wide as the portal name marker. this is so that there's no left/right
+ // overlap between two different portals text
+ var largeBounds = L.bounds (
+ point.subtract([window.plugin.portalNames.NAME_WIDTH,0]),
+ point.add([window.plugin.portalNames.NAME_WIDTH,window.plugin.portalNames.NAME_HEIGHT])
+ );
+
+ for (var otherGuid in bucketGuids) {
+ if (guid != otherGuid) {
+ var otherPoint = portalPoints[otherGuid];
+
+ if (largeBounds.contains(otherPoint)) {
+ // another portal is within the rectangle for this one's name - so no name for this one
+ coveredPortals[guid] = true;
+ break;
+ }
}
}
}
From 56863aebac7d772541658939084a8f3d3116bf14 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Sun, 13 Oct 2013 11:10:17 +0200
Subject: [PATCH 049/126] * moved advanced settings to own preference screen *
added setting to fake user agent (see
https://plus.google.com/u/0/104992284359985480029/posts/9mPFLPKjgvL) * bumped
version number
---
mobile/AndroidManifest.xml | 4 +-
mobile/res/values/strings.xml | 6 +-
mobile/res/xml/preferences.xml | 47 ++++++++++-----
.../com/cradle/iitc_mobile/IITC_Mobile.java | 14 ++---
.../iitc_mobile/IITC_PreferenceActivity.java | 1 +
.../com/cradle/iitc_mobile/IITC_WebView.java | 42 ++++++++-----
.../iitc_mobile/fragments/MainSettings.java | 59 +++++++++++++++++++
7 files changed, 133 insertions(+), 40 deletions(-)
diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml
index 0b7c9866..9416f52f 100644
--- a/mobile/AndroidManifest.xml
+++ b/mobile/AndroidManifest.xml
@@ -1,8 +1,8 @@
+ android:versionCode="54"
+ android:versionName="0.7.4">
Disabling may improve performance
Press back button twice to exitAvoids accidental exits
- Developer options
+ Developer options
+ Advanced settingsEnable developer modeIf enabled, all IITC sources will be loaded from external storage of the Android device.
Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.
@@ -92,6 +93,9 @@
In addition to the default IITC buttons the advanced menu
contains a debug pane plus an option to clear cookiesDisable Splash Screen
+ Fake User Agent
+ Let IITCm appear as a desktop browser for the intel site.
+ Note: If just want to use the desktop mode use the \'force desktop mode\' settingIITC sourceLoad IITC main script from url or use local script. Currently used source:
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index 7fc502d4..10e8baf7 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -45,7 +45,8 @@
+ android:title="@string/pref_plugins"
+ android:persistent="false">
@@ -64,36 +65,52 @@
+ android:title="@string/pref_developer_options_cat">
-
+
-
+
-
+
+
+
+
+
+
+ android:selectable="false"
+ android:persistent="false" />
+ android:selectable="false"
+ android:persistent="false" />
+
\ No newline at end of file
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
index 25c4cb9c..2eaab3de 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
@@ -112,23 +112,21 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
if (key.equals("pref_force_desktop")) {
mDesktopMode = sharedPreferences.getBoolean("pref_force_desktop", false);
mNavigationHelper.onPrefChanged();
- }
- if (key.equals("pref_user_loc"))
+ } else if (key.equals("pref_user_loc")) {
mIsLocEnabled = sharedPreferences.getBoolean("pref_user_loc",
false);
- if (key.equals("pref_fullscreen_actionbar")) {
+ } else if (key.equals("pref_fullscreen_actionbar")) {
mNavigationHelper.onPrefChanged();
return;
- }
- if (key.equals("pref_advanced_menu")) {
+ } else if (key.equals("pref_advanced_menu")) {
mAdvancedMenu = sharedPreferences.getBoolean("pref_advanced_menu", false);
mNavigationHelper.setDebugMode(mAdvancedMenu);
invalidateOptionsMenu();
// no reload needed
return;
- }
-
- if (key.equals("pref_press_twice_to_exit")
+ } else if (key.equals("pref_fake_user_agent")) {
+ mIitcWebView.setUserAgent();
+ } else if (key.equals("pref_press_twice_to_exit")
|| key.equals("pref_share_selected_tab")
|| key.equals("pref_messages"))
// no reload needed
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java
index 2595d41b..a5521541 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_PreferenceActivity.java
@@ -15,6 +15,7 @@ public class IITC_PreferenceActivity extends Activity {
MainSettings settings = new MainSettings();
getActionBar().setHomeButtonEnabled(true);
+ getActionBar().setDisplayHomeAsUpEnabled(true);
// iitc version
Bundle bundle = getIntent().getExtras();
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
index affa80c1..94de1bf6 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
@@ -27,25 +27,32 @@ public class IITC_WebView extends WebView {
private IITC_JSInterface mJsInterface;
private Context mContext;
private boolean mDisableJs = false;
+ private String mDefaultUserAgent;
+ private final String mDesktopUserAgent = "Mozilla/5.0 (X11; Linux x86_64; rv:17.0)" +
+ " Gecko/20130810 Firefox/17.0 Iceweasel/17.0.8";
+
+
// init web view
private void iitc_init(Context c) {
- if (this.isInEditMode()) return;
+ if (isInEditMode()) return;
mContext = c;
- mSettings = this.getSettings();
+ mSettings = getSettings();
mSettings.setJavaScriptEnabled(true);
mSettings.setDomStorageEnabled(true);
mSettings.setAllowFileAccess(true);
mSettings.setGeolocationEnabled(true);
mSettings.setAppCacheEnabled(true);
- mSettings.setDatabasePath(this.getContext().getApplicationInfo().dataDir
+ mSettings.setDatabasePath(getContext().getApplicationInfo().dataDir
+ "/databases/");
- mSettings.setAppCachePath(this.getContext().getCacheDir()
+ mSettings.setAppCachePath(getContext().getCacheDir()
.getAbsolutePath());
- this.mJsInterface = new IITC_JSInterface((IITC_Mobile) mContext);
- this.addJavascriptInterface(mJsInterface, "android");
+ mJsInterface = new IITC_JSInterface((IITC_Mobile) mContext);
+ addJavascriptInterface(mJsInterface, "android");
+ mDefaultUserAgent = mSettings.getUserAgentString();
+ setUserAgent();
- this.setWebChromeClient(new WebChromeClient() {
+ setWebChromeClient(new WebChromeClient() {
/**
* our webchromeclient should share geolocation with the iitc script
*
@@ -83,7 +90,7 @@ public class IITC_WebView extends WebView {
});
mIitcWebViewClient = new IITC_WebViewClient(c);
- this.setWebViewClient(mIitcWebViewClient);
+ setWebViewClient(mIitcWebViewClient);
}
// constructors -------------------------------------------------
@@ -110,7 +117,7 @@ public class IITC_WebView extends WebView {
@Override
public void loadUrl(String url) {
// if in edit text mode, don't load javascript otherwise the keyboard closes.
- HitTestResult testResult = this.getHitTestResult();
+ HitTestResult testResult = getHitTestResult();
if (url.startsWith("javascript:") && testResult != null &&
testResult.getType() == HitTestResult.EDIT_TEXT_TYPE) {
// let window.show(...) interupt input
@@ -122,7 +129,7 @@ public class IITC_WebView extends WebView {
}
}
// do nothing if script is enabled;
- if (this.mDisableJs) {
+ if (mDisableJs) {
Log.d("iitcm", "javascript injection disabled...return");
return;
}
@@ -143,11 +150,11 @@ public class IITC_WebView extends WebView {
}
public IITC_WebViewClient getWebViewClient() {
- return this.mIitcWebViewClient;
+ return mIitcWebViewClient;
}
public IITC_JSInterface getJSInterface() {
- return this.mJsInterface;
+ return mJsInterface;
}
public void updateCaching() {
@@ -156,7 +163,7 @@ public class IITC_WebView extends WebView {
login = getUrl().contains("accounts.google.com");
}
// use cache if on mobile network...saves traffic
- if (!this.isConnectedToWifi() && !login) {
+ if (!isConnectedToWifi() && !login) {
Log.d("iitcm", "not connected to wifi...load tiles from cache");
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
} else {
@@ -184,7 +191,14 @@ public class IITC_WebView extends WebView {
}
public void disableJS(boolean val) {
- this.mDisableJs = val;
+ mDisableJs = val;
+ }
+
+ public void setUserAgent() {
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
+ String ua = sharedPrefs.getBoolean("pref_fake_user_agent", false) ? mDesktopUserAgent : mDefaultUserAgent;
+ Log.d("iitcm", "setting user agent to: " + ua);
+ mSettings.setUserAgentString(ua);
}
}
diff --git a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
index f26c18cc..49af96ea 100644
--- a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
+++ b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
@@ -1,5 +1,6 @@
package com.cradle.iitc_mobile.fragments;
+import android.app.Dialog;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -9,6 +10,13 @@ import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
+import android.preference.PreferenceScreen;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewParent;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import com.cradle.iitc_mobile.R;
@@ -60,4 +68,55 @@ public class MainSettings extends PreferenceFragment {
+ " " + pref_iitc_source.getText();
pref_iitc_source.setSummary(pref_iitc_source_sum);
}
+
+ // we want a home button + HomeAsUpEnabled in nested preferences
+ // for some odd reasons android is not able to do this by default
+ // so we need some additional hacks...
+ // thx to http://stackoverflow.com/a/16800527/2638486 !!
+ @Override
+ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options)))
+ initializeActionBar((PreferenceScreen) preference);
+ return super.onPreferenceTreeClick(preferenceScreen, preference);
+ }
+
+ // Apply custom home button area click listener to close the PreferenceScreen
+ // because PreferenceScreens are dialogs which swallow
+ // events instead of passing to the activity
+ // Related Issue: https://code.google.com/p/android/issues/detail?id=4611
+ public static void initializeActionBar(PreferenceScreen preferenceScreen) {
+ final Dialog dialog = preferenceScreen.getDialog();
+
+ if (dialog != null) {
+ dialog.getActionBar().setDisplayHomeAsUpEnabled(true);
+
+ View homeBtn = dialog.findViewById(android.R.id.home);
+
+ if (homeBtn != null) {
+ View.OnClickListener dismissDialogClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dialog.dismiss();
+ }
+ };
+
+ ViewParent homeBtnContainer = homeBtn.getParent();
+
+ // The home button is an ImageView inside a FrameLayout
+ if (homeBtnContainer instanceof FrameLayout) {
+ ViewGroup containerParent = (ViewGroup) homeBtnContainer.getParent();
+
+ if (containerParent instanceof LinearLayout) {
+ // This view also contains the title text, set the whole view as clickable
+ ((LinearLayout) containerParent).setOnClickListener(dismissDialogClickListener);
+ } else {
+ // Just set it on the home button
+ ((FrameLayout) homeBtnContainer).setOnClickListener(dismissDialogClickListener);
+ }
+ } else {
+ homeBtn.setOnClickListener(dismissDialogClickListener);
+ }
+ }
+ }
+ }
}
From 6589cd454f72df6bb24ed0e40c2086d67517eaaa Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Sun, 13 Oct 2013 13:44:44 +0200
Subject: [PATCH 050/126] added caching mode preference (fixes #495)
---
mobile/res/values/strings.xml | 14 +++++++
mobile/res/xml/preferences.xml | 8 ++++
.../com/cradle/iitc_mobile/IITC_Mobile.java | 2 +
.../com/cradle/iitc_mobile/IITC_WebView.java | 39 ++++++++++++-------
4 files changed, 49 insertions(+), 14 deletions(-)
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index 9814d31a..92de9b85 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -99,6 +99,20 @@
IITC sourceLoad IITC main script from url or use local script. Currently used source:
+ Aggressive Caching
+ Prefer cached values even if they are expired…saves traffic but
+ may result in login issues
+
+ Always
+ Mobile data only (default)
+ Never
+
+
+ 0
+ 1
+ 2
+
+
Clear CookiesSearchChoose account to login
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index 10e8baf7..77893007 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -72,6 +72,14 @@
android:title="@string/pref_advanced_options"
android:persistent="false">
+
+
Date: Sun, 13 Oct 2013 14:11:53 +0200
Subject: [PATCH 051/126] categories for advanced settings
---
mobile/res/values/strings.xml | 3 +-
mobile/res/xml/preferences.xml | 62 +++++++++++--------
.../com/cradle/iitc_mobile/IITC_Mobile.java | 4 +-
.../com/cradle/iitc_mobile/IITC_WebView.java | 3 +-
.../iitc_mobile/IITC_WebViewClient.java | 8 +--
5 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index 92de9b85..b1565352 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -70,6 +70,8 @@
UIMisc
+ Developer options
+ TweaksIITC PluginsAvailable pluginsDisplay user location
@@ -84,7 +86,6 @@
Disabling may improve performancePress back button twice to exitAvoids accidental exits
- Developer optionsAdvanced settingsEnable developer modeIf enabled, all IITC sources will be loaded from external storage of the Android device.
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index 77893007..4e743e35 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -10,7 +10,7 @@
android:dialogTitle="@string/pref_about_title"/>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
index ac7b6491..ec2ea46d 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
@@ -127,7 +127,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
} else if (key.equals("pref_fake_user_agent")) {
mIitcWebView.setUserAgent();
} else if (key.equals("pref_caching")) {
- mIitcWebView.updateCaching();
+ mIitcWebView.updateCaching(false);
} else if (key.equals("pref_press_twice_to_exit")
|| key.equals("pref_share_selected_tab")
|| key.equals("pref_messages"))
@@ -271,7 +271,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// enough idle...let's do some work
Log.d("iitcm", "resuming...reset idleTimer");
- mIitcWebView.updateCaching();
+ mIitcWebView.updateCaching(false);
if (mIsLocEnabled) {
// Register the mSharedPrefChangeListener with the Location Manager to receive
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
index 8f9f63b1..1941a116 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
@@ -159,7 +159,7 @@ public class IITC_WebView extends WebView {
return mJsInterface;
}
- public void updateCaching() {
+ public void updateCaching(boolean login) {
switch(Integer.parseInt(mSharedPrefs.getString("pref_caching", "1"))) {
case 0:
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
@@ -168,7 +168,6 @@ public class IITC_WebView extends WebView {
mSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
break;
default:
- boolean login = false;
if (getUrl() != null) {
login = getUrl().contains("accounts.google.com");
}
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index 83947756..a41835ae 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -160,8 +160,8 @@ public class IITC_WebViewClient extends WebViewClient {
@Override
public void onReceivedLoginRequest(WebView view, String realm, String account, String args) {
Log.d("iitcm", "Login requested: " + realm + " " + account + " " + args);
- Log.d("iitcm", "logging in...set caching mode to default");
- view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
+ Log.d("iitcm", "logging in...updating caching mode");
+ ((IITC_WebView) view).updateCaching(true);
//((IITC_Mobile) mContext).onReceivedLoginRequest(this, view, realm, account, args);
}
@@ -284,8 +284,8 @@ public class IITC_WebViewClient extends WebViewClient {
((IITC_Mobile) mContext).loadUrl(url);
}
if (url.contains("logout")) {
- Log.d("iitcm", "logging out...set caching mode to default");
- view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
+ Log.d("iitcm", "logging out...updating caching mode");
+ ((IITC_WebView) view).updateCaching(true);
}
return false;
} else {
From e7309000e008bba9cc29db74100d86a32a7deed7 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Sun, 13 Oct 2013 19:40:54 +0100
Subject: [PATCH 052/126] only remove links if they are in the layer
---
code/map_data_render.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/code/map_data_render.js b/code/map_data_render.js
index ec06f4e0..85b89b9c 100644
--- a/code/map_data_render.js
+++ b/code/map_data_render.js
@@ -192,7 +192,9 @@ window.Render.prototype.deletePortalEntity = function(guid) {
window.Render.prototype.deleteLinkEntity = function(guid) {
if (guid in window.links) {
var l = window.links[guid];
- linksFactionLayers[l.options.team].removeLayer(l);
+ if (linksFactionLayers[l.options.team].hasLayer(l)) {
+ linksFactionLayers[l.options.team].removeLayer(l);
+ }
delete window.links[guid];
}
}
From 51b24386e6296f04994a32b0f344173007619165 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 14 Oct 2013 17:59:53 +0100
Subject: [PATCH 053/126] disable 'timestampMs' map data requests. either i've
misunderstood what their code is doing, or it's an incomplete feature in the
stock site. extensive testing has never found an instance where it reduced
response size from the server
---
code/map_data_cache.js | 4 +++-
code/map_data_request.js | 5 +++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/code/map_data_cache.js b/code/map_data_cache.js
index 6dcda1a8..d6868557 100644
--- a/code/map_data_cache.js
+++ b/code/map_data_cache.js
@@ -9,7 +9,9 @@ window.DataCache = function() {
// for, retrieving deltas) so use a long max age to take advantage of this
// however, ther must be an overall limit on the maximum age of data from the servers, otherwise the deletedEntity
// entries would grow indefinitely. an hour seems reasonable from experience with the data, so 55 mins max cache time
- this.REQUEST_CACHE_MAX_AGE = 55*60; // maximum cache age. entries are deleted from the cache after this time
+// this.REQUEST_CACHE_MAX_AGE = 55*60; // maximum cache age. entries are deleted from the cache after this time
+//UPDATE: this timestampMs parameter doesn't work, so reduced max age to limit RAM usage
+ this.REQUEST_CACHE_MAX_AGE = 5*60; // maximum cache age. entries are deleted from the cache after this time
if (L.Browser.mobile) {
// on mobile devices, smaller cache size
diff --git a/code/map_data_request.js b/code/map_data_request.js
index ff839663..79ce5599 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -252,6 +252,9 @@ window.MapDataRequest.prototype.refresh = function() {
lngEast
);
+/* After some testing, this doesn't seem to actually work. The server returns the same data with and without the parameter
+ * Also, closer study of the stock site code shows the parameter isn't actually set anywhere.
+ * so, disabling for now...
// however, the server does support delta requests - only returning the entities changed since a particular timestamp
// retrieve the stale cache entry and use it, if possible
var stale = (this.cache && this.cache.get(tile_id));
@@ -275,6 +278,7 @@ console.log('stale tile '+tile_id+': newest mtime '+lastTimestamp+(lastTimestamp
boundsParams.timestampMs = lastTimestamp;
}
}
+*/
this.tileBounds[tile_id] = boundsParams;
this.requestedTileCount += 1;
@@ -504,6 +508,7 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
var stale = this.requestedTiles[id].staleData;
if (stale) {
+//NOTE: currently this code path won't be used, as we never set the staleData to anything other than 'undefined'
// we have stale data. therefore, a delta request was made for this tile. we need to merge the results with
// the existing stale data before proceeding
From c3b6461d4765b7b32fce8c074030ffb49d226e17 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 16 Oct 2013 02:17:13 +0100
Subject: [PATCH 054/126] draw-tools: convert circles to geodesic mode, to
match everything else perhaps could be a bit cleaner, but it'll do for now...
---
external/leaflet.draw.js | 54 ++++++++++++++++++++++++++------------
plugins/draw-tools.user.js | 4 +--
2 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/external/leaflet.draw.js b/external/leaflet.draw.js
index 1b96f6a9..d5343306 100644
--- a/external/leaflet.draw.js
+++ b/external/leaflet.draw.js
@@ -822,7 +822,7 @@ L.Draw.Circle = L.Draw.SimpleShape.extend({
_drawShape: function (latlng) {
if (!this._shape) {
- this._shape = new L.Circle(this._startLatLng, this._startLatLng.distanceTo(latlng), this.options.shapeOptions);
+ this._shape = new L.GeodesicCircle(this._startLatLng, this._startLatLng.distanceTo(latlng), this.options.shapeOptions);
this._map.addLayer(this._shape);
} else {
this._shape.setRadius(this._startLatLng.distanceTo(latlng));
@@ -830,7 +830,7 @@ L.Draw.Circle = L.Draw.SimpleShape.extend({
},
_fireCreatedEvent: function () {
- var circle = new L.Circle(this._startLatLng, this._shape.getRadius(), this.options.shapeOptions);
+ var circle = new L.GeodesicCircle(this._startLatLng, this._shape.getRadius(), this.options.shapeOptions);
L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, circle);
},
@@ -1502,10 +1502,8 @@ L.Edit.Circle = L.Edit.SimpleShape.extend({
},
_getResizeMarkerPoint: function (latlng) {
- // From L.shape.getBounds()
- var delta = this._shape._radius * Math.cos(Math.PI / 4),
- point = this._map.project(latlng);
- return this._map.unproject([point.x + delta, point.y - delta]);
+ var latRadius = (this._shape.getRadius() / 40075017) * 360;
+ return L.latLng(latlng.lat+latRadius,latlng.lng);
},
_move: function (latlng) {
@@ -1548,6 +1546,28 @@ L.Circle.addInitHook(function () {
});
});
+L.GeodesicCircle.addInitHook(function () {
+ if (L.Edit.Circle) {
+ this.editing = new L.Edit.Circle(this);
+
+ if (this.options.editable) {
+ this.editing.enable();
+ }
+ }
+
+ this.on('add', function () {
+ if (this.editing && this.editing.enabled()) {
+ this.editing.addHooks();
+ }
+ });
+
+ this.on('remove', function () {
+ if (this.editing && this.editing.enabled()) {
+ this.editing.removeHooks();
+ }
+ });
+});
+
/*
* L.LatLngUtil contains different utility functions for LatLngs.
*/
@@ -2432,16 +2452,16 @@ L.EditToolbar.Edit = L.Handler.extend({
var id = L.Util.stamp(layer);
if (!this._uneditedLayerProps[id]) {
- // Polyline, Polygon or Rectangle
- if (layer instanceof L.GeodesicPolyline || layer instanceof L.GeodesicPolygon || layer instanceof L.Rectangle) {
- this._uneditedLayerProps[id] = {
- latlngs: L.LatLngUtil.cloneLatLngs(layer.getLatLngs())
- };
- } else if (layer instanceof L.Circle) {
+ if (layer instanceof L.GeodesicCircle || layer instanceof L.Circle) {
this._uneditedLayerProps[id] = {
latlng: L.LatLngUtil.cloneLatLng(layer.getLatLng()),
radius: layer.getRadius()
};
+ } else if (layer instanceof L.GeodesicPolyline || layer instanceof L.GeodesicPolygon || layer instanceof L.Rectangle) {
+ // Polyline, Polygon or Rectangle
+ this._uneditedLayerProps[id] = {
+ latlngs: L.LatLngUtil.cloneLatLngs(layer.getLatLngs())
+ };
} else { // Marker
this._uneditedLayerProps[id] = {
latlng: L.LatLngUtil.cloneLatLng(layer.getLatLng())
@@ -2454,12 +2474,12 @@ L.EditToolbar.Edit = L.Handler.extend({
var id = L.Util.stamp(layer);
layer.edited = false;
if (this._uneditedLayerProps.hasOwnProperty(id)) {
- // Polyline, Polygon or Rectangle
- if (layer instanceof L.GeodesicPolyline || layer instanceof L.GeodesicPolygon || layer instanceof L.Rectangle) {
- layer.setLatLngs(this._uneditedLayerProps[id].latlngs);
- } else if (layer instanceof L.Circle) {
+ if (layer instanceof L.GeodesicCircle || layer instanceof L.Circle) {
layer.setLatLng(this._uneditedLayerProps[id].latlng);
layer.setRadius(this._uneditedLayerProps[id].radius);
+ } else if (layer instanceof L.GeodesicPolyline || layer instanceof L.GeodesicPolygon || layer instanceof L.Rectangle) {
+ // Polyline, Polygon or Rectangle
+ layer.setLatLngs(this._uneditedLayerProps[id].latlngs);
} else { // Marker
layer.setLatLng(this._uneditedLayerProps[id].latlng);
}
@@ -2522,7 +2542,7 @@ L.EditToolbar.Edit = L.Handler.extend({
layer.options.previousOptions = layer.options;
// Make sure that Polylines are not filled
- if (!(layer instanceof L.Circle) && !(layer instanceof L.GeodesicPolygon) && !(layer instanceof L.Rectangle)) {
+ if (!(layer instanceof L.Circle) && !(layer instanceof L.GeodrsicCircle) && !(layer instanceof L.GeodesicPolygon) && !(layer instanceof L.Rectangle)) {
pathOptions.fill = false;
}
diff --git a/plugins/draw-tools.user.js b/plugins/draw-tools.user.js
index 335825f3..2e14d70e 100644
--- a/plugins/draw-tools.user.js
+++ b/plugins/draw-tools.user.js
@@ -2,7 +2,7 @@
// @id iitc-plugin-draw-tools@breunigs
// @name IITC plugin: draw tools
// @category Layer
-// @version 0.5.1.@@DATETIMEVERSION@@
+// @version 0.5.2.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@@ -197,7 +197,7 @@ window.plugin.drawTools.load = function() {
layer = L.geodesicPolygon(item.latLngs,window.plugin.drawTools.polygonOptions);
break;
case 'circle':
- layer = L.circle(item.latLng,item.radius,window.plugin.drawTools.polygonOptions);
+ layer = L.geodesicCircle(item.latLng,item.radius,window.plugin.drawTools.polygonOptions);
break;
case 'marker':
layer = L.marker(item.latLng,window.plugin.drawTools.markerOptions)
From 1eea47ca99436370e02461333539a047e156c619 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 16 Oct 2013 03:11:19 +0100
Subject: [PATCH 055/126] update code to match stock site changes 2013-10-16 -
new munge set - modified map data tile ID/QK - now based on portal level
rather than map zoom
---
code/map_data_calc_tools.js | 27 +++++++++------
code/map_data_request.js | 24 +++++++-------
code/utils_misc.js | 65 ++++++++++++++++++++-----------------
3 files changed, 65 insertions(+), 51 deletions(-)
diff --git a/code/map_data_calc_tools.js b/code/map_data_calc_tools.js
index 8f845c5e..884acc40 100644
--- a/code/map_data_calc_tools.js
+++ b/code/map_data_calc_tools.js
@@ -9,26 +9,33 @@
// Convertion functions courtesy of
// http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
-window.lngToTile = function(lng, zoom) {
- return Math.floor((lng + 180) / 360 * Math.pow(2, (zoom>12)?zoom:(zoom+2)));
+
+window.levelToTilesPerEdge = function(level) {
+ var LEVEL_TO_TILES_PER_EDGE = [65536, 65536, 16384, 16384, 4096, 1536, 1024, 256, 32];
+ return LEVEL_TO_TILES_PER_EDGE[level];
}
-window.latToTile = function(lat, zoom) {
+
+window.lngToTile = function(lng, level) {
+ return Math.floor((lng + 180) / 360 * levelToTilesPerEdge(level));
+}
+
+window.latToTile = function(lat, level) {
return Math.floor((1 - Math.log(Math.tan(lat * Math.PI / 180) +
- 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, (zoom>12)?zoom:(zoom+2)));
+ 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * levelToTilesPerEdge(level));
}
-window.tileToLng = function(x, zoom) {
- return x / Math.pow(2, (zoom>12)?zoom:(zoom+2)) * 360 - 180;
+window.tileToLng = function(x, level) {
+ return x / levelToTilesPerEdge(level) * 360 - 180;
}
-window.tileToLat = function(y, zoom) {
- var n = Math.PI - 2 * Math.PI * y / Math.pow(2, (zoom>12)?zoom:(zoom+2));
+window.tileToLat = function(y, level) {
+ var n = Math.PI - 2 * Math.PI * y / levelToTilesPerEdge(level);
return 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
}
-window.pointToTileId = function(zoom, x, y) {
- return zoom + "_" + x + "_" + y;
+window.pointToTileId = function(level, x, y) {
+ return level + "_" + x + "_" + y;
}
// given tile id and bounds, returns the format as required by the
diff --git a/code/map_data_request.js b/code/map_data_request.js
index 79ce5599..dc63370e 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -187,21 +187,21 @@ window.MapDataRequest.prototype.refresh = function() {
//var debugrect = L.rectangle(bounds,{color: 'red', fill: false, weight: 4, opacity: 0.8}).addTo(map);
//setTimeout (function(){ map.removeLayer(debugrect); }, 10*1000);
- var x1 = lngToTile(bounds.getWest(), zoom);
- var x2 = lngToTile(bounds.getEast(), zoom);
- var y1 = latToTile(bounds.getNorth(), zoom);
- var y2 = latToTile(bounds.getSouth(), zoom);
+ var x1 = lngToTile(bounds.getWest(), minPortalLevel);
+ var x2 = lngToTile(bounds.getEast(), minPortalLevel);
+ var y1 = latToTile(bounds.getNorth(), minPortalLevel);
+ var y2 = latToTile(bounds.getSouth(), minPortalLevel);
// calculate the full bounds for the data - including the part of the tiles off the screen edge
var dataBounds = L.latLngBounds([
- [tileToLat(y2+1,zoom), tileToLng(x1,zoom)],
- [tileToLat(y1,zoom), tileToLng(x2+1,zoom)]
+ [tileToLat(y2+1,minPortalLevel), tileToLng(x1,minPortalLevel)],
+ [tileToLat(y1,minPortalLevel), tileToLng(x2+1,minPortalLevel)]
]);
//var debugrect2 = L.rectangle(dataBounds,{color: 'magenta', fill: false, weight: 4, opacity: 0.8}).addTo(map);
//setTimeout (function(){ map.removeLayer(debugrect2); }, 10*1000);
// store the parameters used for fetching the data. used to prevent unneeded refreshes after move/zoom
- this.fetchedDataParams = { bounds: dataBounds, zoom: zoom };
+ this.fetchedDataParams = { bounds: dataBounds, zoom: zoom, minPortalLevel: minPortalLevel };
window.runHooks ('mapDataRefreshStart', {bounds: bounds, zoom: zoom, tileBounds: dataBounds});
@@ -228,11 +228,11 @@ window.MapDataRequest.prototype.refresh = function() {
for (var y = y1; y <= y2; y++) {
// x goes from bottom to top(?)
for (var x = x1; x <= x2; x++) {
- var tile_id = pointToTileId(zoom, x, y);
- var latNorth = tileToLat(y,zoom);
- var latSouth = tileToLat(y+1,zoom);
- var lngWest = tileToLng(x,zoom);
- var lngEast = tileToLng(x+1,zoom);
+ var tile_id = pointToTileId(minPortalLevel, x, y);
+ var latNorth = tileToLat(y,minPortalLevel);
+ var latSouth = tileToLat(y+1,minPortalLevel);
+ var lngWest = tileToLng(x,minPortalLevel);
+ var lngEast = tileToLng(x+1,minPortalLevel);
this.debugTiles.create(tile_id,[[latSouth,lngWest],[latNorth,lngEast]]);
diff --git a/code/utils_misc.js b/code/utils_misc.js
index c421bb52..a8f2048f 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -165,6 +165,39 @@ window.requestParameterMunges = [
inviteeEmailAddress: 'orc9ufg7rp7g1y9j',
},
+ // set 5 - second update of 2013-10-16
+ {
+ 'dashboard.getGameScore': '3b48kl956b33brrl', // GET_GAME_SCORE
+ 'dashboard.getPaginatedPlextsV2': 'h785pmet6wrx6xoa', // GET_PAGINATED_PLEXTS
+ 'dashboard.getThinnedEntitiesV4': '4gux7b0n3euu7e8y', // GET_THINNED_ENTITIES
+ 'dashboard.getPlayersByGuids': 'nqm1kocgzspecpzv', // LOOKUP_PLAYERS
+ 'dashboard.redeemReward': 'g618n6peb74u2ae9', // REDEEM_REWARD
+ 'dashboard.sendInviteEmail': 'bsl4280bm39bkl3a', // SEND_INVITE_EMAIL
+ 'dashboard.sendPlext': 'jym2hbw15i6uru7g', // SEND_PLEXT
+
+ method: 'g9cmy5g6vpxpmcxz',
+ version: 'blq7574e6kkg0fig', //guessed parameter name - only seen munged
+ version_parameter: '465c62b22b3bc9ecae01e08b30703752186a1dc9', // passed as the value to the above parameter
+ boundsParamsList: '45k478vh10jt1ik7',
+ id: '3eh1ynwxjy8c8rd5',
+ minLatE6: 'krpywcgq1voq71z3',
+ minLngE6: 'yo6lte88zvoneqi6',
+ maxLatE6: 'dncli54tfafmtk6y',
+ maxLngE6: '76pq437r7vm3osx9',
+ timestampMs: '2zlgpsg1x6i9720s',
+ qk: 'pzejivoj28p6kkry',
+ desiredNumItems: 'u3uxpkqd4pn37ydn',
+ minTimestampMs: 'msw5gcxhuuk46rb2',
+ maxTimestampMs: 'bps0ekgdzakdfvr0',
+ chatTab: 'pm4fm8bjvotjm30h', //guessed parameter name - only seen munged
+ ascendingTimestampOrder: '7qp8gv50ogelh7cs',
+ message: 'y599irwyfs45adp4',
+ latE6: '19ko11fmx32sjfqk',
+ lngE6: 'i8yjq6v2mjhze29d',
+ guids: 'szebfshb9f3uo2h9',
+ inviteeEmailAddress: 'qq4t7lhqphq7wqvh',
+ },
+
];
window.activeRequestMungeSet = undefined;
@@ -393,35 +426,9 @@ window.getPortalDataZoom = function() {
window.getMinPortalLevelForZoom = function(z) {
//based on code from stock gen_dashboard.js
- switch(z) {
- case 0:
- case 1:
- case 2:
- case 3:
- return 8;
- case 4:
- case 5:
- return 7;
- case 6:
- case 7:
- return 6;
- case 8:
- return 5;
- case 9:
- case 10:
- return 4;
- case 11:
- case 12:
- return 3;
- case 13:
- case 14:
- return 2;
- case 15:
- case 16:
- return 1;
- default:
- return 0
- }
+ var ZOOM_TO_LEVEL = [8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 4, 3, 3, 2, 2, 1, 1];
+ var l = ZOOM_TO_LEVEL[z] || 0;
+ return l;
}
From a2064cc2fde4d11df64e3582756eac120a8c85fc Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 16 Oct 2013 04:46:51 +0100
Subject: [PATCH 056/126] website update for 0.14.3
---
website/page/home.php | 48 +++++--------------------------------------
website/page/news.php | 8 ++++++++
2 files changed, 13 insertions(+), 43 deletions(-)
diff --git a/website/page/home.php b/website/page/home.php
index 768a5b5b..452161e2 100644
--- a/website/page/home.php
+++ b/website/page/home.php
@@ -13,50 +13,12 @@ offers many more features. It is available for
Latest news
-
1st October 2013
+
16th October 2013
-IITC 0.14.2 and IITC Mobile 0.7.1 have been released. This is a critical update required to work with changes made
-to the standard intel site. Additionally, a major update to the mobile app interface has been made, and a handful
-of tweaks and bugfixes to IITC and a few plugins.
+IITC 0.14.3 and IITC MObile 0.7.4 have just been released. This is a critical update required to work with the latest
+changes Niantic have made to the standard intel site. Additionally, the draw-tools plugin now snaps points to portals
+when creating lines/polygons/markers (was actually in 0.14.2 release), a bugfix relating to IITC not realising who
+'you' are, causing some highlighters to break, and a handful of other tweaks/bugfixes.
-
-The standard intel site now includes an 'alerts' chat tab. This will be coming to IITC in the future, but it's
-better to get this working version released without it than hold things up just for that.
-
-
-
22nd September 2013
-
-Update: IITC Mobile 0.6.5 replaces 0.6.4. This fixes a crash on entering plugin preferences on some tablets.
-
-
-IITC 0.14.1 and IITC Mobile 0.6.4 have been released. Changes in this version include:
-
-
Better performance when a very large number of portals are within view (country/continent level)
-
Add layer chooser options to hide resistance/enlightened portals/links/fields
-
Chat tab now remembers which was active when reloading IITC
-
Fix some shorter links not showing on the map
-
Add details of hack information (number/cooldown time, taking account of mods) and mitigation (from shields and links)
-to the portal information panel
-
Mobile
-
-
increase the size of various links on the info page to make them easier to tap
-
move the highlight selection dropdown to the native android app bar at the top
-
-
-And plugins:
-
-
Major update to bookmarks-by-zaso, including sync support
-
New features added to the resonators plugin
-
max-links plugin - start of rename to 'tidy links' - as this is a better description of what it does
-
show-linked-portals - indicate which are incoming/outgoing links in the tooltip
-
New Plugins
-
-
show-link-direction, to indicate visually which portal a link was created from
-
highlighter for portal mitigation - to show strength of defence from shields and links at a glance
-
-
-And, as always, numerous other bug fixes, tweaks and improvements.
-
+IITC 0.14.3 and IITC MObile 0.7.4 have just been released. This is a critical update required to work with the latest
+changes Niantic have made to the standard intel site. Additionally, the draw-tools plugin now snaps points to portals
+when creating lines/polygons/markers (was actually in 0.14.2 release), a bugfix relating to IITC not realising who
+'you' are, causing some highlighters to break, and a handful of other tweaks/bugfixes.
+
+
1st October 2013
IITC 0.14.2 and IITC Mobile 0.7.1 have been released. This is a critical update required to work with changes made
From 7681bd10cd149ddf0c94009e7d65ead4c043274c Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 16 Oct 2013 04:47:13 +0100
Subject: [PATCH 057/126] bump version, ready for future release
---
main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.js b/main.js
index d231360a..72f96f7e 100644
--- a/main.js
+++ b/main.js
@@ -1,7 +1,7 @@
// ==UserScript==
// @id ingress-intel-total-conversion@jonatkins
// @name IITC: Ingress intel map total conversion
-// @version 0.14.3.@@DATETIMEVERSION@@
+// @version 0.14.4.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
From 34410bd047ac846925f7724ba3c5b661f184395a Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 16 Oct 2013 07:11:01 +0100
Subject: [PATCH 058/126] map data request handling - tweaks to the timers, and
immediate 'finished' processing when all data came from the cache
---
code/map_data_request.js | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/code/map_data_request.js b/code/map_data_request.js
index dc63370e..4355ef9e 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -37,16 +37,20 @@ window.MapDataRequest = function() {
// processing cache, etc) and actually sending the first network requests
this.DOWNLOAD_DELAY = 3; //delay after preparing the data download before tile requests are sent
- // a short delay between one request finishing and the queue being run for the next request
+
+ // a short delay between one request finishing and the queue being run for the next request.
+ // this gives a chance of other requests finishing, allowing better grouping of retries in new requests
this.RUN_QUEUE_DELAY = 0.5;
// delay before re-queueing tiles
- this.TILE_TIMEOUT_REQUEUE_DELAY = 0.5; // short delay before retrying a 'error==TIMEOUT' tile - as this is very common
- this.BAD_REQUEST_REQUEUE_DELAY = 4; // longer delay before retrying a completely failed request - as in this case the servers are struggling
+ this.TILE_TIMEOUT_REQUEUE_DELAY = 0.2; // short delay before retrying a 'error==TIMEOUT' tile. a common 'error', and the stock site has no delay in this case
+ this.BAD_REQUEST_REQUEUE_DELAY = 5; // longer delay before retrying a completely failed request - as in this case the servers are struggling
+
+ // a delay before processing the queue after requeueing tiles. this gives a chance for other requests to finish
+ // or other requeue actions to happen before the queue is processed, allowing better grouping of requests
+ // however, the queue may be processed sooner if a previous timeout was set
+ this.REQUEUE_DELAY = 1;
- // additionally, a delay before processing the queue after requeueing tiles
- // (this way, if multiple requeue delays finish within a short time of each other, they're all processed in one queue run)
- this.RERUN_QUEUE_DELAY = 1;
this.REFRESH_CLOSE = 120; // refresh time to use for close views z>12 when not idle and not moving
this.REFRESH_FAR = 600; // refresh time for far views z <= 12
@@ -90,8 +94,8 @@ window.MapDataRequest.prototype.mapMoveEnd = function() {
if (this.fetchedDataParams) {
// we have fetched (or are fetching) data...
- if (this.fetchedDataParams.zoom == zoom && this.fetchedDataParams.bounds.contains(bounds)) {
- // ... and the data zoom levels are the same, and the current bounds is inside the fetched bounds
+ if (this.fetchedDataParams.mapZoom == map.getZoom() && this.fetchedDataParams.bounds.contains(bounds)) {
+ // ... and the zoom level is the same and the current bounds is inside the fetched bounds
// so, no need to fetch data. if there's time left, restore the original timeout
var remainingTime = (this.timerExpectedTimeoutTime - new Date().getTime())/1000;
@@ -201,10 +205,10 @@ window.MapDataRequest.prototype.refresh = function() {
//setTimeout (function(){ map.removeLayer(debugrect2); }, 10*1000);
// store the parameters used for fetching the data. used to prevent unneeded refreshes after move/zoom
- this.fetchedDataParams = { bounds: dataBounds, zoom: zoom, minPortalLevel: minPortalLevel };
+ this.fetchedDataParams = { bounds: dataBounds, mapZoom: map.getZoom(), minPortalLevel: minPortalLevel };
- window.runHooks ('mapDataRefreshStart', {bounds: bounds, zoom: zoom, tileBounds: dataBounds});
+ window.runHooks ('mapDataRefreshStart', {bounds: bounds, zoom: zoom, minPortalLevel: minPortalLevel, tileBounds: dataBounds});
this.render.startRenderPass();
this.render.clearPortalsBelowLevel(minPortalLevel);
@@ -290,8 +294,13 @@ console.log('stale tile '+tile_id+': newest mtime '+lastTimestamp+(lastTimestamp
console.log ('done request preperation (cleared out-of-bounds and invalid for zoom, and rendered cached data)');
- // don't start processing the download queue immediately - start it after a short delay
- this.delayProcessRequestQueue (this.DOWNLOAD_DELAY,true);
+ if (Object.keys(this.tileBounds).length > 0) {
+ // queued requests - don't start processing the download queue immediately - start it after a short delay
+ this.delayProcessRequestQueue (this.DOWNLOAD_DELAY,true);
+ } else {
+ // all data was from the cache, nothing queued - run the queue 'immediately' so it handles the end request processing
+ this.delayProcessRequestQueue (0,true);
+ }
}
@@ -581,7 +590,7 @@ console.log('processed delta mapData request:'+id+': '+oldEntityCount+' original
delete savedContext.requestedTiles[id];
savedContext.requeueTile(id, false);
}
- savedContext.delayProcessRequestQueue(this.RERUN_QUEUE_DELAY);
+ savedContext.delayProcessRequestQueue(this.REQUEUE_DELAY);
}, this.TILE_TIMEOUT_REQUEUE_DELAY*1000);
}
@@ -592,7 +601,7 @@ console.log('processed delta mapData request:'+id+': '+oldEntityCount+' original
delete savedContext.requestedTiles[id];
savedContext.requeueTile(id, true);
}
- savedContext.delayProcessRequestQueue(this.RERUN_QUEUE_DELAY);
+ savedContext.delayProcessRequestQueue(this.REQUEUE_DELAY);
}, this.BAD_REQUEST_REQUEUE_DELAY*1000);
}
From 4883eb5a4e0c444c573a7a105df60662a27c22a0 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 16 Oct 2013 07:11:50 +0100
Subject: [PATCH 059/126] plugins: show-more/less portals updated to take
account of the new map data tile sizes - show-more-portals no longer causes
unfriendly request tile sizes. unclaimed are now visible one level further
out, but l1+ is no longer available one level further in (i.e. it jumps
directly from l2+ to all portals) - slow-less-portals-when-zoomed-out - major
reductions in portal visibility levels - works around the daft tile size/zoom
level combinations used in the current stock intel site
---
plugins/show-less-portals-zoomed-out.user.js | 30 +++++++-------
plugins/show-more-portals.user.js | 42 +++++++-------------
2 files changed, 28 insertions(+), 44 deletions(-)
diff --git a/plugins/show-less-portals-zoomed-out.user.js b/plugins/show-less-portals-zoomed-out.user.js
index c61f25bd..c701f7a7 100644
--- a/plugins/show-less-portals-zoomed-out.user.js
+++ b/plugins/show-less-portals-zoomed-out.user.js
@@ -2,11 +2,11 @@
// @id iitc-plugin-show-less-portals@jonatkins
// @name IITC plugin: Show less portals when zoomed out
// @category Tweaks
-// @version 0.1.3.@@DATETIMEVERSION@@
+// @version 0.1.4.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
-// @description [@@BUILDNAME@@-@@BUILDDATE@@] Decrease the portal detail level used when zoomed out. This can speed up map loading, decrease the amount of data used, and result in faster display. Only applies when zoomed out to show no closer than L3 portals. May stop display of the smaller links/fields.
+// @description [@@BUILDNAME@@-@@BUILDDATE@@] Decrease the portal detail level used when zoomed out. This can speed up map loading, decrease the amount of data used, and solve excessive request issues. Only applies when zoomed out to show no closer than L3 portals. May stop display of the smaller links/fields.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@@ -32,23 +32,21 @@ window.plugin.showLessPortals.setup = function() {
window.getPortalDataZoom = function() {
var mapZoom = map.getZoom();
- // this plugin only cares about close in zoom levels (zoom 13 and higher) - run the original
- // code when this isn't the case. (this way, multiple zoom-modifying plugins can exist at once - in theory)
- if (mapZoom >= 13) {
- return origGetPortalDataZoom();
+ // the latest intel site update, as of 2013-10-16, requests a silly number of map tiles at the larger zoom levels
+ // IITC matches the behaviour by default, but it makes sense to reduce the detail level sooner
+
+ // at the largest scale zooms - move back two levels
+ if (mapZoom <= 7) {
+ return Math.max(mapZoom-2,0);
}
- // make sure we're dealing with an integer here
- // (mobile: a float somehow gets through in some cases!)
- var z = parseInt(mapZoom);
+ // intermediate zoom levels - move back one
+ if (mapZoom <= 11) {
+ return Math.max(mapZoom-1,0);
+ }
- // reduce the portal zoom level by one
- z -= 1;
-
- // ensure we're not too far out
- if (z < 0) z=0;
-
- return z;
+ // otherwise revert to default behaviour
+ return origGetPortalDataZoom();
}
diff --git a/plugins/show-more-portals.user.js b/plugins/show-more-portals.user.js
index 0721cbbd..e119affb 100644
--- a/plugins/show-more-portals.user.js
+++ b/plugins/show-more-portals.user.js
@@ -2,11 +2,11 @@
// @id iitc-plugin-show-more-portals@jonatkins
// @name IITC plugin: Show more portals
// @category Tweaks
-// @version 0.1.4.@@DATETIMEVERSION@@
+// @version 0.1.5.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
-// @description [@@BUILDNAME@@-@@BUILDDATE@@] Boost the detail level of portals shown on the map by one zoom level when zoomed in close (L2+ portals or closer)
+// @description [@@BUILDNAME@@-@@BUILDDATE@@] Boost the detail level of portals shown so that unclaimed portals are visible when normally L1+ portals would be shown, and L2+ are visible when normally L3+ are shown
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@@ -32,36 +32,22 @@ window.plugin.showMorePortals.setup = function() {
window.getPortalDataZoom = function() {
var mapZoom = map.getZoom();
- // this plugin only cares about close in zoom levels (zoom 12 and higher) - run the original
- // code when this isn't the case. (this way, multiple zoom-modifying plugins can exist at once - in theory)
- if (mapZoom < 12) {
- return origGetPortalDataZoom();
+ // as of 2013-10-16...
+
+ // the stock site uses the same tile size for both L1+ portals and all portals
+ // therefore, changing the L1+ zoom levels into all portals zoom level is not unfriendly to the servers
+ // (in some ways it's nicer, as IITC caches better)
+ if (mapZoom >= 15) {
+ return 17;
}
- // make sure we're dealing with an integer here
- // (mobile: a float somehow gets through in some cases!)
- var z = parseInt(mapZoom);
-
- // boost data zoom level by one
- z += 1;
-
- // not recommended on anything other than the very smallest of screens
-// // show unclaimed portals at an additional zoom level further than by default
-// if (mapZoom >= 15) z += 1;
-
-
- // limiting the mazimum zoom level for data retrieval reduces the number of requests at high zoom levels
- // (as all portal data is retrieved at z=17, why retrieve multiple z=18 tiles when fewer z=17 would do?)
- // very effective along with the new cache code
- if (z > 17) z=17;
-
- // if the data zoom is above the map zoom we can step back if the detail level is the same
- // with the new cache code this works rather well
- while (z > mapZoom && getMinPortalLevelForZoom(z) == getMinPortalLevelForZoom(z-1)) {
- z = z-1;
+ // and, the same scale for L2+ and L3+ portals. again, forcing the level down isn't unfriendly to the servers
+ // (ditto on the cacheing)
+ if (mapZoom >= 12) {
+ return 13;
}
- return z;
+ return origGetPortalDataZoom();
}
From fa969561e28a5e7d7ae67c3e559212293002368f Mon Sep 17 00:00:00 2001
From: fkloft
Date: Wed, 16 Oct 2013 15:42:16 +0200
Subject: [PATCH 060/126] Hide tab(s) if only one tab visible
---
.../com/cradle/iitc_mobile/share/ShareActivity.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
index aeec04cc..9e23bb50 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
@@ -103,7 +103,6 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
mFragmentAdapter = new IntentFragmentAdapter(getSupportFragmentManager());
final ActionBar actionBar = getActionBar();
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayHomeAsUpEnabled(true);
Intent intent = getIntent();
@@ -126,7 +125,8 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
- actionBar.setSelectedNavigationItem(position);
+ if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
+ actionBar.setSelectedNavigationItem(position);
setSelected(position);
}
});
@@ -141,11 +141,15 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
.setTabListener(this));
}
+ if (mFragmentAdapter.getCount() > 1)
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
if (selected < mFragmentAdapter.getCount()) {
mViewPager.setCurrentItem(selected);
- actionBar.setSelectedNavigationItem(selected);
+ if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
+ actionBar.setSelectedNavigationItem(selected);
}
}
From 767275fdf5c364d20030ee6d9ba52e844f9acba4 Mon Sep 17 00:00:00 2001
From: fkloft
Date: Wed, 16 Oct 2013 17:24:20 +0200
Subject: [PATCH 061/126] Show detailed portal level in tooltip
---
code/portal_detail_display.js | 13 ++++++++++++-
style.css | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js
index 5004ce1c..b2771d3f 100644
--- a/code/portal_detail_display.js
+++ b/code/portal_detail_display.js
@@ -90,6 +90,17 @@ window.renderPortalDetails = function(guid) {
portalDetailedDescription += '';
}
+ var levelDetails = getPortalLevel(d);
+ if(levelDetails != 8) {
+ if(levelDetails==Math.ceil(levelDetails))
+ levelDetails += "\n8";
+ else
+ levelDetails += "\n" + (Math.ceil(levelDetails) - levelDetails)*8;
+ levelDetails += " resonator level(s) needed for next portal level";
+ } else {
+ levelDetails += "\nfully upgraded";
+ }
+ levelDetails = "Level " + levelDetails;
$('#portaldetails')
.attr('class', TEAM_TO_CSS[getTeam(d)])
@@ -98,7 +109,7 @@ window.renderPortalDetails = function(guid) {
+ 'X'
// help cursor via ".imgpreview img"
+ '
- IITC Mobile is an optimized mobile browser for the
+ IITCm Test is an optimized mobile browser for the
Ingress Intel Total Conversion (IITC) userscript by breunigs.
After Niantic asked the main developer to shut down his github project, development
is continued on a fork of jonatkins.
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index 11729aef..41baa5c0 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -48,7 +48,7 @@
android:title="@string/pref_plugins"
android:persistent="false">
Date: Tue, 22 Oct 2013 13:09:55 +0200
Subject: [PATCH 089/126] - removed test stuff from build.xml - added new
build-test.xml for test builds
---
mobile/build-test.xml | 205 ++++++++++++++++++++++++++++++++++++++++++
mobile/build.xml | 112 -----------------------
2 files changed, 205 insertions(+), 112 deletions(-)
create mode 100644 mobile/build-test.xml
diff --git a/mobile/build-test.xml b/mobile/build-test.xml
new file mode 100644
index 00000000..6584fcbd
--- /dev/null
+++ b/mobile/build-test.xml
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ git.commits: ${git.commits}
+
+
+
+
+
+ git.version: ${git.version}
+
+
+
+ Creating backup of AndroidManifest.xml
+
+
+
+
+
+
+
+
+ Restoring backup of AndroidManifest.xml
+
+
+
+
+ Creating backup of strings.xml and preferences.xml
+
+
+
+
+
+
+
+ Restoring backup of strings.xml and preferences.xml
+
+
+
+
+
+
+
+
diff --git a/mobile/build.xml b/mobile/build.xml
index 6584fcbd..b8f279b5 100644
--- a/mobile/build.xml
+++ b/mobile/build.xml
@@ -87,118 +87,6 @@
in order to avoid having your file be overridden by tools such as "android update project"
-->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- git.commits: ${git.commits}
-
-
-
-
-
- git.version: ${git.version}
-
-
-
- Creating backup of AndroidManifest.xml
-
-
-
-
-
-
-
-
- Restoring backup of AndroidManifest.xml
-
-
-
-
- Creating backup of strings.xml and preferences.xml
-
-
-
-
-
-
-
- Restoring backup of strings.xml and preferences.xml
-
-
-
-
From 6f159f6c71302aedbfe2eba2b565f7650e1dba5d Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Tue, 22 Oct 2013 13:18:41 +0200
Subject: [PATCH 090/126] reverted wrong commited files
---
mobile/res/values/strings.xml | 8 ++++----
mobile/res/xml/preferences.xml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index f7b2feaf..b7fc6d6c 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -1,8 +1,8 @@
- IITCm Test
- IITCm Test Settings
+ IITC Mobile
+ IITC Mobile SettingsIITC PluginsShare using…Copy to clipboard
@@ -20,13 +20,13 @@
IITC VersionAbout
- About IITCm Test
+ About IITC MobileIngress Intel Total Conversion Mobile
- IITCm Test is an optimized mobile browser for the
+ IITC Mobile is an optimized mobile browser for the
Ingress Intel Total Conversion (IITC) userscript by breunigs.
After Niantic asked the main developer to shut down his github project, development
is continued on a fork of jonatkins.
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index 41baa5c0..11729aef 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -48,7 +48,7 @@
android:title="@string/pref_plugins"
android:persistent="false">
Date: Tue, 22 Oct 2013 19:16:41 +0200
Subject: [PATCH 091/126] added fkloft and hastarin to contribs.md. both helped
me out on mobile side.
---
CONTRIBS.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CONTRIBS.md b/CONTRIBS.md
index 0cfccf65..5ab69b23 100644
--- a/CONTRIBS.md
+++ b/CONTRIBS.md
@@ -8,7 +8,9 @@ So far, these people have contributed:
[ccjon](https://github.com/ccjon),
[cmrn](https://github.com/cmrn),
[epf](https://github.com/epf),
+[fkloft](https://github.com/fkloft),
[Fragger](https://github.com/Fragger),
+[hastarin](https://github.com/hastarin),
[integ3r](https://github.com/integ3r),
[j16sdiz](https://github.com/j16sdiz),
[JasonMillward](https://github.com/JasonMillward),
From 3d7192ecd649797a78f34eb7b567c0b7e2d24777 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Tue, 22 Oct 2013 20:05:58 +0200
Subject: [PATCH 092/126] reformat code
---
build.py | 2 +-
.../iitc_mobile/IITC_DeviceAccountLogin.java | 6 ++-
.../cradle/iitc_mobile/IITC_MapSettings.java | 23 ++++++---
.../com/cradle/iitc_mobile/IITC_Mobile.java | 29 +++++++----
.../iitc_mobile/IITC_NavigationHelper.java | 49 ++++++++++++-------
.../IITC_PluginPreferenceActivity.java | 21 +++++---
.../com/cradle/iitc_mobile/IITC_WebView.java | 15 +++---
.../iitc_mobile/IITC_WebViewClient.java | 14 ++++--
.../iitc_mobile/fragments/MainSettings.java | 3 +-
.../iitc_mobile/share/IntentFragment.java | 3 +-
.../iitc_mobile/share/IntentListView.java | 6 ++-
.../iitc_mobile/share/ShareActivity.java | 15 ++++--
12 files changed, 120 insertions(+), 66 deletions(-)
diff --git a/build.py b/build.py
index 96212c5c..250e502f 100755
--- a/build.py
+++ b/build.py
@@ -263,7 +263,7 @@ if buildMobile:
if buildMobile != 'copyonly':
# now launch 'ant' to build the mobile project
- retcode = os.system("ant %s -buildfile mobile/build.xml %s" % (antOptions, buildMobile))
+ retcode = os.system("ant clean %s -buildfile mobile/build.xml %s" % (antOptions, buildMobile))
if retcode != 0:
print ("Error: mobile app failed to build. ant returned %d" % retcode)
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java b/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java
index 11cf1518..fb8e1890 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java
@@ -128,10 +128,12 @@ public class IITC_DeviceAccountLogin implements AccountManagerCallback {
*/
public void onActivityResult(int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK)
- // authentication activity succeeded, request token again
+ // authentication activity succeeded, request token again
+ {
startAuthentication();
- else
+ } else {
onLoginFailed();
+ }
}
/**
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java
index 245aefd2..c683dce9 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_MapSettings.java
@@ -47,12 +47,13 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
@Override
public int compare(String lhs, String rhs) {
// Move "No Highlights" on top. Sort the rest alphabetically
- if (lhs.equals("No Highlights"))
+ if (lhs.equals("No Highlights")) {
return -1000;
- else if (rhs.equals("No Highlights"))
+ } else if (rhs.equals("No Highlights")) {
return 1000;
- else
+ } else {
return lhs.compareTo(rhs);
+ }
}
}
@@ -77,8 +78,9 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
Layer item = getItem(position);
View view = (TextView) super.getView(position, convertView, parent);
- if (view instanceof CheckedTextView)
+ if (view instanceof CheckedTextView) {
((CheckedTextView) view).setChecked(item.active);
+ }
return view;
}
}
@@ -128,9 +130,10 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
}
private void setLayer(Layer layer) {
- if (!mLoading)
+ if (!mLoading) {
mIitc.getWebView().loadUrl(
"javascript: window.layerChooser.showLayer(" + layer.id + "," + layer.active + ");");
+ }
}
public void addPortalHighlighter(String name) {
@@ -208,8 +211,9 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
mActiveHighlighter = name;
int position = mHighlighters.getPosition(mActiveHighlighter);
- if (position >= 0 && position < mHighlighters.getCount())
+ if (position >= 0 && position < mHighlighters.getCount()) {
mSpinnerHighlighter.setSelection(position);
+ }
mIitc.getNavigationHelper().setHighlighter(name);
}
@@ -245,8 +249,10 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
layer.active = layerObj.getBoolean("active");
if (layer.active)
- // getCount() will be the index of the layer we are about to add
+ // getCount() will be the index of the layer we are about to add
+ {
mActiveLayer = mBaseLayers.getCount();
+ }
mBaseLayers.add(layer);
} catch (JSONException e) {
@@ -276,7 +282,8 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
}
public void updateLayers() {
- if (!mLoading)
+ if (!mLoading) {
mIitc.getWebView().loadUrl("javascript: window.layerChooser.getLayers()");
+ }
}
}
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
index 06122fbd..043be0ec 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
@@ -133,8 +133,10 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
|| key.equals("pref_share_selected_tab")
|| key.equals("pref_messages")
|| key.equals("pref_external_storage"))
- // no reload needed
+ // no reload needed
+ {
return;
+ }
mReloadNeeded = true;
}
@@ -233,8 +235,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// parts[0] may contain an 'uncertainty' parameter, delimited by a semicolon
String[] pos = parts[0].split(";", 2)[0].split(",", 2);
- if (pos.length != 2)
+ if (pos.length != 2) {
throw new URISyntaxException(uri.toString(), "URI does not contain a valid position");
+ }
try {
lat = Double.valueOf(pos[0]);
@@ -262,8 +265,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
}
String url = "http://www.ingress.com/intel?ll=" + lat + "," + lon;
- if (z != null)
+ if (z != null) {
url += "&z=" + z;
+ }
this.loadUrl(url);
}
@@ -298,8 +302,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
Log.d("iitcm", "stopping iitcm");
mIitcWebView.loadUrl("javascript: window.idleSet();");
- if (mIsLocEnabled)
+ if (mIsLocEnabled) {
mLocMngr.removeUpdates(this);
+ }
super.onStop();
}
@@ -383,10 +388,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// ensure no double adds
if (pane == mCurrentPane) return;
- if (mBackStackPush)
+ if (mBackStackPush) {
mBackStack.push(mCurrentPane);
- else
+ } else {
mBackStackPush = true;
+ }
mCurrentPane = pane;
mNavigationHelper.switchTo(pane);
@@ -433,8 +439,9 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- if (mNavigationHelper.onOptionsItemSelected(item))
+ if (mNavigationHelper.onOptionsItemSelected(item)) {
return true;
+ }
// Handle item selection
final int itemId = item.getItemId();
@@ -462,10 +469,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
"window.map.locate({setView : true, maxZoom: 15});");
// if gps location is displayed we can use a better location without any costs
} else {
- if (mLastLocation != null)
+ if (mLastLocation != null) {
mIitcWebView.loadUrl("javascript: window.map.setView(new L.LatLng(" +
mLastLocation.getLatitude() + "," +
mLastLocation.getLongitude() + "), 15);");
+ }
}
return true;
case R.id.action_settings: // start settings activity
@@ -511,10 +519,11 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// vp=f enables mDesktopMode mode...vp=m is the defaul mobile view
private String addUrlParam(String url) {
- if (mDesktopMode)
+ if (mDesktopMode) {
return (url + "?vp=f");
- else
+ } else {
return (url + "?vp=m");
+ }
}
// inject the iitc-script and load the intel url
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java
index 1c0af426..6e78db67 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java
@@ -46,18 +46,20 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
add(Pane.PUBLIC);
add(Pane.FACTION);
- if (mPrefs.getBoolean("pref_advanced_menu", false))
+ if (mPrefs.getBoolean("pref_advanced_menu", false)) {
add(Pane.DEBUG);
+ }
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView view = (TextView) super.getView(position, convertView, parent);
Pane item = getItem(position);
- if (item == Pane.MAP)
+ if (item == Pane.MAP) {
view.setText("Map");
- else
+ } else {
view.setText(getPaneTitle(item));
+ }
int icon = 0;
switch (item) {
@@ -84,8 +86,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
break;
}
- if (icon != 0)
+ if (icon != 0) {
view.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
+ }
return view;
}
@@ -140,8 +143,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
}
private void showNotice(final int which) {
- if ((mPrefs.getInt("pref_messages", 0) & which) != 0)
+ if ((mPrefs.getInt("pref_messages", 0) & which) != 0) {
return;
+ }
String text;
switch (which) {
@@ -186,8 +190,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
private void updateActionBar() {
int position = mNavigationAdapter.getPosition(mPane);
- if (position >= 0 && position < mNavigationAdapter.getCount())
+ if (position >= 0 && position < mNavigationAdapter.getCount()) {
mDrawerLeft.setItemChecked(position, true);
+ }
if (mDesktopMode) {
mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator
@@ -207,28 +212,32 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
mActionBar.setHomeButtonEnabled(true);// Make icon clickable
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
- if (mPane == Pane.MAP || mDrawerLayout.isDrawerOpen(mDrawerLeft))
+ if (mPane == Pane.MAP || mDrawerLayout.isDrawerOpen(mDrawerLeft)) {
setDrawerIndicatorEnabled(true);
- else
+ } else {
setDrawerIndicatorEnabled(false);
+ }
}
- if (mDrawerLayout.isDrawerOpen(mDrawerLeft))
+ if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) {
mActionBar.setTitle(mIitc.getString(R.string.app_name));
- else
+ } else {
mActionBar.setTitle(getPaneTitle(mPane));
+ }
}
boolean mapVisible = mDesktopMode || mPane == Pane.MAP;
- if ("No Highlights".equals(mHighlighter) || isDrawerOpened() || mIsLoading || !mapVisible)
+ if ("No Highlights".equals(mHighlighter) || isDrawerOpened() || mIsLoading || !mapVisible) {
mActionBar.setSubtitle(null);
- else
+ } else {
mActionBar.setSubtitle(mHighlighter);
+ }
- if (mFullscreen && mHideInFullscreen)
+ if (mFullscreen && mHideInFullscreen) {
mActionBar.hide();
- else
+ } else {
mActionBar.show();
+ }
}
public void closeDrawers() {
@@ -289,16 +298,18 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
Pane item = mNavigationAdapter.getItem(position);
mIitc.switchToPane(item);
- if (item == Pane.INFO)
+ if (item == Pane.INFO) {
showNotice(NOTICE_INFO);
+ }
mDrawerLayout.closeDrawer(mDrawerLeft);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == android.R.id.home)
+ if (item.getItemId() == android.R.id.home) {
mDrawerLayout.closeDrawer(mDrawerRight);
+ }
return super.onOptionsItemSelected(item);
}
@@ -315,8 +326,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
}
public void openRightDrawer() {
- if (mDrawerLayout.getDrawerLockMode(mDrawerRight) == DrawerLayout.LOCK_MODE_UNLOCKED)
+ if (mDrawerLayout.getDrawerLockMode(mDrawerRight) == DrawerLayout.LOCK_MODE_UNLOCKED) {
mDrawerLayout.openDrawer(mDrawerRight);
+ }
}
public void reset() {
@@ -326,8 +338,9 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
public void setDebugMode(boolean enabled) {
mNavigationAdapter.remove(Pane.DEBUG); // avoid duplicates
- if (enabled)
+ if (enabled) {
mNavigationAdapter.add(Pane.DEBUG);
+ }
}
public void setFullscreen(boolean fullscreen) {
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
index b8909fca..02ac8ddd 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
@@ -62,8 +62,10 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
- if (onIsMultiPane()) getIntent()
- .putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
+ if (onIsMultiPane()) {
+ getIntent()
+ .putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, PluginsFragment.class.getName());
+ }
super.onCreate(savedInstanceState);
}
@@ -162,8 +164,9 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
// TODO Auto-generated catch block
e2.printStackTrace();
}
- if (s != null)
+ if (s != null) {
src = s.hasNext() ? s.next() : "";
+ }
// now we have all stuff together and can build the pref screen
addPluginPreference(src, anAsset_array, false);
}
@@ -179,8 +182,9 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
e.printStackTrace();
Log.d("iitcm", "failed to parse file " + file);
}
- if (s != null)
+ if (s != null) {
src = s.hasNext() ? s.next() : "";
+ }
// now we have all stuff together and can build the pref screen
addPluginPreference(src, file.toString(), true);
@@ -202,12 +206,15 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
String plugin_cat = "Misc";
for (int j = 0; j < attributes.length; j++) {
// search for name and use the value
- if (attributes[j].equals("@name"))
+ if (attributes[j].equals("@name")) {
plugin_name = attributes[j + 1];
- if (attributes[j].equals("@description"))
+ }
+ if (attributes[j].equals("@description")) {
plugin_desc = attributes[j + 1];
- if (attributes[j].equals("@category"))
+ }
+ if (attributes[j].equals("@category")) {
plugin_cat = attributes[j + 1];
+ }
}
// remove IITC plugin prefix from plugin_name
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
index 3a9f29d9..f57069c7 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java
@@ -33,7 +33,6 @@ public class IITC_WebView extends WebView {
" Gecko/20130810 Firefox/17.0 Iceweasel/17.0.8";
-
// init web view
private void iitc_init(Context c) {
if (isInEditMode()) return;
@@ -136,10 +135,11 @@ public class IITC_WebView extends WebView {
// force https if enabled in settings
SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(getContext());
- if (sharedPref.getBoolean("pref_force_https", true))
+ if (sharedPref.getBoolean("pref_force_https", true)) {
url = url.replace("http://", "https://");
- else
+ } else {
url = url.replace("https://", "http://");
+ }
// disable splash screen if a http error code is responded
new CheckHttpResponse(mJsInterface, mContext).execute(url);
@@ -157,7 +157,7 @@ public class IITC_WebView extends WebView {
}
public void updateCaching(boolean login) {
- switch(Integer.parseInt(mSharedPrefs.getString("pref_caching", "1"))) {
+ switch (Integer.parseInt(mSharedPrefs.getString("pref_caching", "1"))) {
case 0:
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
break;
@@ -173,8 +173,11 @@ public class IITC_WebView extends WebView {
Log.d("iitcm", "not connected to wifi...load tiles from cache");
mSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
} else {
- if (login) Log.d("iitcm", "login...load tiles from network");
- else Log.d("iitcm", "connected to wifi...load tiles from network");
+ if (login) {
+ Log.d("iitcm", "login...load tiles from network");
+ } else {
+ Log.d("iitcm", "connected to wifi...load tiles from network");
+ }
mSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
}
break;
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index a41835ae..cd307a35 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -50,9 +50,10 @@ public class IITC_WebViewClient extends WebViewClient {
public String getIITCVersion() {
String header = "";
- if (mIitcScript != null)
+ if (mIitcScript != null) {
header = mIitcScript.substring(mIitcScript.indexOf("==UserScript=="),
mIitcScript.indexOf("==/UserScript=="));
+ }
// remove new line comments
header = header.replace("\n//", "");
// get a list of key-value
@@ -60,8 +61,9 @@ public class IITC_WebViewClient extends WebViewClient {
String iitc_version = "not found";
for (int i = 0; i < attributes.length; i++) {
// search for version and use the value
- if (attributes[i].equals("@version"))
+ if (attributes[i].equals("@version")) {
iitc_version = attributes[i + 1];
+ }
}
return iitc_version;
}
@@ -201,10 +203,11 @@ public class IITC_WebViewClient extends WebViewClient {
// load it as javascript
public boolean loadJS(String file, boolean asset, WebView view) {
String js = fileToString(file, asset);
- if (js.equals("false"))
+ if (js.equals("false")) {
return false;
- else
+ } else {
view.loadUrl("javascript:" + js);
+ }
return true;
}
@@ -235,8 +238,9 @@ public class IITC_WebViewClient extends WebViewClient {
}
}
- if (s != null)
+ if (s != null) {
src = s.hasNext() ? s.next() : "";
+ }
return src;
}
diff --git a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
index 49af96ea..c904385a 100644
--- a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
+++ b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
@@ -75,8 +75,9 @@ public class MainSettings extends PreferenceFragment {
// thx to http://stackoverflow.com/a/16800527/2638486 !!
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options)))
+ if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options))) {
initializeActionBar((PreferenceScreen) preference);
+ }
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java b/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java
index b1b15682..5a181099 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/IntentFragment.java
@@ -33,8 +33,9 @@ public class IntentFragment extends Fragment implements OnScrollListener, OnItem
mIntents = args.getParcelableArrayList("intents");
mListView = new IntentListView(getActivity());
mListView.setIntents(mIntents);
- if (mScrollIndex != -1 && mScrollTop != -1)
+ if (mScrollIndex != -1 && mScrollTop != -1) {
mListView.setSelectionFromTop(mScrollIndex, mScrollTop);
+ }
mListView.setOnScrollListener(this);
mListView.setOnItemClickListener(this);
diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java
index 9c6b16c1..621f023c 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java
@@ -60,8 +60,9 @@ public class IntentListView extends ListView {
private static final HashSet KNOWN_COPY_HANDLERS = new HashSet();
private static void setupKnownCopyHandlers() {
- if (!KNOWN_COPY_HANDLERS.isEmpty())
+ if (!KNOWN_COPY_HANDLERS.isEmpty()) {
return;
+ }
KNOWN_COPY_HANDLERS.add(new CopyHandler(
"com.google.android.apps.docs",
@@ -141,8 +142,9 @@ public class IntentListView extends ListView {
for (ResolveInfo resolveInfo : activityList) { // search for "Copy to clipboard" handler
CopyHandler handler = new CopyHandler(resolveInfo);
- if (KNOWN_COPY_HANDLERS.contains(handler))
+ if (KNOWN_COPY_HANDLERS.contains(handler)) {
hasCopyIntent = true;
+ }
}
// use traditional loop since list may change during iteration
diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
index 9e23bb50..fdb1d49f 100644
--- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
+++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java
@@ -45,15 +45,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
private String getUrl() {
String url = "http://www.ingress.com/intel?ll=" + mLl + "&z=" + mZoom;
- if (mIsPortal)
+ if (mIsPortal) {
url += "&pll=" + mLl;
+ }
return url;
}
private void setSelected(int position) {
// Activity not fully loaded yet (may occur during tab creation)
- if (mSharedPrefs == null)
+ if (mSharedPrefs == null) {
return;
+ }
mSharedPrefs
.edit()
@@ -125,8 +127,9 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
- if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
+ if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
actionBar.setSelectedNavigationItem(position);
+ }
setSelected(position);
}
});
@@ -141,15 +144,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
.setTabListener(this));
}
- if (mFragmentAdapter.getCount() > 1)
+ if (mFragmentAdapter.getCount() > 1) {
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+ }
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
int selected = mSharedPrefs.getInt("pref_share_selected_tab", 0);
if (selected < mFragmentAdapter.getCount()) {
mViewPager.setCurrentItem(selected);
- if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD)
+ if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
actionBar.setSelectedNavigationItem(selected);
+ }
}
}
From 5198858b6cc2b579f23bcab29ebacb21b77968b7 Mon Sep 17 00:00:00 2001
From: fkloft
Date: Tue, 22 Oct 2013 20:12:59 +0200
Subject: [PATCH 093/126] New about dialog for IITCm
---
mobile/res/values/strings.xml | 29 ++--
mobile/res/xml/preferences.xml | 127 ++++++++----------
.../IITC_AboutDialogPreference.java | 51 ++++---
.../iitc_mobile/IITC_WebViewClient.java | 1 -
.../iitc_mobile/fragments/MainSettings.java | 49 +++----
5 files changed, 110 insertions(+), 147 deletions(-)
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index b1565352..21e99338 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -16,29 +16,29 @@
Get LocationlocalClose
- Build Version
- IITC Version
- About
-
About IITC Mobile
-
- Ingress Intel Total Conversion Mobile
+
+ Ingress Intel Total Conversion Mobile
+ Build Version: %1$s
+ IITC Version: %2$s
+ by cradle and contributors
IITC Mobile is an optimized mobile browser for the
Ingress Intel Total Conversion (IITC) userscript by breunigs.
After Niantic asked the main developer to shut down his github project, development
- is continued on a fork of jonatkins.
- Community:
+ is continued on a fork of jonatkins.
+
Community:
• Visit the IITC website for new releases and the desktop version.
• Follow the IITC Google+ page
for release announcements.
• Join the IITC Google+ community
- - a place to ask for help and discuss with other users.
Permission to use, copy, modify, and/or distribute this software for
@@ -53,7 +53,8 @@
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.]]>
+ PERFORMANCE OF THIS SOFTWARE.
+ ]]>
@@ -67,7 +68,7 @@
• tap and hold a portal for a second
• tap on the left half of the status bar]]>
-
+
UIMiscDeveloper options
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index 4e743e35..289856d5 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -1,136 +1,115 @@
-
+
+
+
+ android:defaultValue="false"
+ android:key="pref_user_loc"
+ android:summary="@string/pref_user_loc_sum"
+ android:title="@string/pref_user_loc"/>
+ android:title="@string/pref_user_zoom"/>
+ android:title="@string/pref_fullscreen_actionbar"/>
+ android:title="@string/pref_force_desktop"/>
-
+
+ android:title="@string/pref_select_iitc"/>
+
+ android:persistent="false"
+ android:title="@string/pref_plugins">
+ android:targetClass="com.cradle.iitc_mobile.IITC_PluginPreferenceActivity"
+ android:targetPackage="com.cradle.iitc_mobile"/>
-
-
-
+
+
+
-
-
+ android:persistent="false"
+ android:title="@string/pref_advanced_options">
+ android:title="@string/pref_enable_dev_mode"/>
-
-
+ android:title="@string/pref_advanced_menu"/>
-
+ android:title="@string/pref_disable_splash"/>
-
-
+ android:entryValues="@array/pref_caching_array_vals"
+ android:key="pref_caching"
+ android:summary="@string/pref_caching_sum"
+ android:title="@string/pref_caching"/>
-
+ android:title="@string/pref_fake_user_agent"/>
-
-
-
-
-
-
\ No newline at end of file
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_AboutDialogPreference.java b/mobile/src/com/cradle/iitc_mobile/IITC_AboutDialogPreference.java
index 54600070..1bfd0fbe 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_AboutDialogPreference.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_AboutDialogPreference.java
@@ -1,44 +1,41 @@
package com.cradle.iitc_mobile;
-import android.app.AlertDialog.Builder;
import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.preference.DialogPreference;
+import android.preference.Preference;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
import android.widget.TextView;
-public class IITC_AboutDialogPreference extends DialogPreference {
-
- private final Context mContext;
+public class IITC_AboutDialogPreference extends Preference {
+ private String mBuildVersion = "";
+ private String mIitcVersion = "";
public IITC_AboutDialogPreference(Context context, AttributeSet attrs) {
super(context, attrs);
- this.mContext = context;
}
- /*
- * start an about-dialog...I found no better way for clickable
- * links in a TextView then using Html.fromHtml...Linkify is just broken and
- * does not understand html href tags...so let's tag the @string/about_msg
- * with CDATA and use Html.fromHtml(...) for clickable hrefs with tags.
- */
@Override
- protected void onPrepareDialogBuilder(Builder builder) {
- final TextView message = new TextView(mContext);
- String about_msg = mContext.getText(R.string.pref_about_msg).toString();
- message.setText(Html.fromHtml(about_msg));
- message.setMovementMethod(LinkMovementMethod.getInstance());
- builder.setView(message).setTitle(R.string.about)
- .setIcon(android.R.drawable.ic_dialog_info)
- .setNeutralButton(R.string.close, new OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
- super.onPrepareDialogBuilder(builder);
+ public View getView(View convertView, ViewGroup parent) {
+ /*
+ * I found no better way for clickable links in a TextView then using Html.fromHtml(). Linkify
+ * is just broken and does not understand html href tags, so let's tag the @string/about_msg
+ * with CDATA and use Html.fromHtml() for clickable hrefs with tags.
+ */
+ final TextView tv = new TextView(getContext());
+ String text = getContext().getText(R.string.pref_about_text).toString();
+ text = String.format(text, mBuildVersion, mIitcVersion);
+
+ tv.setText(Html.fromHtml(text));
+ tv.setMovementMethod(LinkMovementMethod.getInstance());
+
+ return tv;
}
+ public void setVersions(String iitcVersion, String buildVersion) {
+ mIitcVersion = iitcVersion;
+ mBuildVersion = buildVersion;
+ }
}
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index a41835ae..ef409706 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -12,7 +12,6 @@ import android.preference.PreferenceManager;
import android.util.Log;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceResponse;
-import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
diff --git a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
index 49af96ea..71d26ed4 100644
--- a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
+++ b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
@@ -6,66 +6,53 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.preference.EditTextPreference;
-import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
-import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
+import com.cradle.iitc_mobile.IITC_AboutDialogPreference;
import com.cradle.iitc_mobile.R;
public class MainSettings extends PreferenceFragment {
-
- private String mIitcVersion;
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mIitcVersion = getArguments().getString("iitc_version");
-
addPreferencesFromResource(R.xml.preferences);
- // set build version
- ListPreference pref_build_version = (ListPreference) findPreference("pref_build_version");
+ // set versions
+ String iitcVersion = getArguments().getString("iitc_version");
+ String buildVersion = "unknown";
+
PackageManager pm = getActivity().getPackageManager();
- String version = "unknown";
try {
- PackageInfo info = pm.getPackageInfo(
- getActivity().getPackageName(), 0);
- version = info.versionName;
+ PackageInfo info = pm.getPackageInfo(getActivity().getPackageName(), 0);
+ buildVersion = info.versionName;
} catch (NameNotFoundException e) {
e.printStackTrace();
}
- pref_build_version.setSummary(version);
- // set iitc version
- ListPreference pref_iitc_version = (ListPreference) findPreference("pref_iitc_version");
- pref_iitc_version.setSummary(mIitcVersion);
+ IITC_AboutDialogPreference pref_about = (IITC_AboutDialogPreference) findPreference("pref_about");
+ pref_about.setVersions(iitcVersion, buildVersion);
// set iitc source
EditTextPreference pref_iitc_source = (EditTextPreference) findPreference("pref_iitc_source");
- pref_iitc_source
- .setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference,
- Object newValue) {
- preference.setSummary(getString(R.string.pref_select_iitc_sum) +
- " " + newValue);
- // TODO: update mIitcVersion when iitc source has
- // changed
- return true;
- }
- });
+ pref_iitc_source.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ preference.setSummary(getString(R.string.pref_select_iitc_sum) + " " + newValue);
+ // TODO: update mIitcVersion when iitc source has changed
+ return true;
+ }
+ });
// first init of summary
- String pref_iitc_source_sum = getString(R.string.pref_select_iitc_sum)
- + " " + pref_iitc_source.getText();
+ String pref_iitc_source_sum = getString(R.string.pref_select_iitc_sum) + " " + pref_iitc_source.getText();
pref_iitc_source.setSummary(pref_iitc_source_sum);
}
From 22ba06512e1a210514ea2e8bba033ada898ca070 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Tue, 22 Oct 2013 20:39:43 +0200
Subject: [PATCH 094/126] enable home button for about preference
---
mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
index 71d26ed4..985a97dc 100644
--- a/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
+++ b/mobile/src/com/cradle/iitc_mobile/fragments/MainSettings.java
@@ -62,7 +62,8 @@ public class MainSettings extends PreferenceFragment {
// thx to http://stackoverflow.com/a/16800527/2638486 !!
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options)))
+ if (preference.getTitle().toString().equals(getString(R.string.pref_advanced_options))
+ || preference.getTitle().toString().equals(getString(R.string.pref_about_title)))
initializeActionBar((PreferenceScreen) preference);
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
From ffe437968477485ad21cfd884981fdfb97cd8614 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Tue, 22 Oct 2013 20:45:48 +0200
Subject: [PATCH 095/126] removed ant clean in build script
---
build.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.py b/build.py
index 250e502f..96212c5c 100755
--- a/build.py
+++ b/build.py
@@ -263,7 +263,7 @@ if buildMobile:
if buildMobile != 'copyonly':
# now launch 'ant' to build the mobile project
- retcode = os.system("ant clean %s -buildfile mobile/build.xml %s" % (antOptions, buildMobile))
+ retcode = os.system("ant %s -buildfile mobile/build.xml %s" % (antOptions, buildMobile))
if retcode != 0:
print ("Error: mobile app failed to build. ant returned %d" % retcode)
From 1b1c850532852704f47948f65c7ee8ae56d437f2 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 22 Oct 2013 19:59:18 +0100
Subject: [PATCH 096/126] update build.py to support an option to specify the
build.xml filename - needed for new test builds
---
build.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/build.py b/build.py
index 96212c5c..5bc94a70 100755
--- a/build.py
+++ b/build.py
@@ -60,6 +60,8 @@ resourceUrlBase = settings.get('resourceUrlBase')
distUrlBase = settings.get('distUrlBase')
buildMobile = settings.get('buildMobile')
antOptions = settings.get('antOptions','')
+antBuildFile = settings.get('antBuildFile', 'mobile/build.xml');
+
# plugin wrapper code snippets. handled as macros, to ensure that
# 1. indentation caused by the "function wrapper()" doesn't apply to the plugin code body
@@ -263,7 +265,7 @@ if buildMobile:
if buildMobile != 'copyonly':
# now launch 'ant' to build the mobile project
- retcode = os.system("ant %s -buildfile mobile/build.xml %s" % (antOptions, buildMobile))
+ retcode = os.system("ant %s -buildfile %s %s" % (antOptions, antBuildFile, buildMobile))
if retcode != 0:
print ("Error: mobile app failed to build. ant returned %d" % retcode)
From 499ff6f09dc3a54ef931c222eebad1f3fced546a Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 23 Oct 2013 09:05:35 +0200
Subject: [PATCH 097/126] xml formatting and comments for IITC_Application
---
mobile/build-test.xml | 87 +++++++++----------
.../cradle/iitc_mobile/IITC_Application.java | 6 ++
2 files changed, 49 insertions(+), 44 deletions(-)
diff --git a/mobile/build-test.xml b/mobile/build-test.xml
index 6584fcbd..94d78654 100644
--- a/mobile/build-test.xml
+++ b/mobile/build-test.xml
@@ -68,26 +68,7 @@
-->
-
-
-
+
-
-
-
-
- git.commits: ${git.commits}
-
-
-
-
-
- git.version: ${git.version}
+
+
+
+
+ git.commits: ${git.commits}
+
+
+
+
+
+ git.version: ${git.version}
- Creating backup of AndroidManifest.xml
-
+ Creating backup of AndroidManifest.xml
+
-
-
@@ -188,17 +169,35 @@
- Restoring backup of strings.xml and preferences.xml
-
-
+ Restoring backup of strings.xml and preferences.xml
+
+
+
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Application.java b/mobile/src/com/cradle/iitc_mobile/IITC_Application.java
index 312faab7..23327f58 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_Application.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_Application.java
@@ -5,6 +5,12 @@ import android.preference.PreferenceManager;
import java.io.File;
+/*
+ * To write the WebView cache to external storage we need to override the
+ * getCacheDir method of the main application. Some internal Android code seems
+ * to call getApplicationContext().getCacheDir(); instead of
+ * getContext().getCacheDir(); to decide where to store and read cached files.
+ */
public class IITC_Application extends Application {
@Override
public File getCacheDir() {
From c4990d31bd265d74b9f8ce57b12333528ea799fe Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 23 Oct 2013 10:31:43 +0200
Subject: [PATCH 098/126] some project cleanups - removed gradle and proguard
files, because they are not used, tested or updated at the moment
---
mobile/.gitignore | 3 ++
mobile/.idea/.name | 2 +-
mobile/.idea/libraries/android_support_v4.xml | 9 +++++
mobile/.idea/misc.xml | 23 ++++++++++++
mobile/.idea/modules.xml | 2 +-
mobile/.idea/vcs.xml | 1 -
mobile/IITC-Mobile.iml | 34 ------------------
mobile/{mobile.iml => IITC_Mobile.iml} | 12 ++-----
mobile/build.gradle | 35 -------------------
mobile/proguard-project.txt | 16 ---------
10 files changed, 40 insertions(+), 97 deletions(-)
create mode 100644 mobile/.idea/libraries/android_support_v4.xml
delete mode 100644 mobile/IITC-Mobile.iml
rename mobile/{mobile.iml => IITC_Mobile.iml} (66%)
delete mode 100644 mobile/build.gradle
delete mode 100644 mobile/proguard-project.txt
diff --git a/mobile/.gitignore b/mobile/.gitignore
index 2f94c701..20b44cb9 100644
--- a/mobile/.gitignore
+++ b/mobile/.gitignore
@@ -18,6 +18,9 @@ bin/
gen/
out/
+# private ant configs
+ant.properties
+
# Local configuration file (sdk path, etc)
local.properties
diff --git a/mobile/.idea/.name b/mobile/.idea/.name
index d884b924..b4e0055b 100644
--- a/mobile/.idea/.name
+++ b/mobile/.idea/.name
@@ -1 +1 @@
-IITC-Mobile
\ No newline at end of file
+IITC_Mobile
\ No newline at end of file
diff --git a/mobile/.idea/libraries/android_support_v4.xml b/mobile/.idea/libraries/android_support_v4.xml
new file mode 100644
index 00000000..90805f27
--- /dev/null
+++ b/mobile/.idea/libraries/android_support_v4.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mobile/.idea/misc.xml b/mobile/.idea/misc.xml
index 3b54f562..31e23495 100644
--- a/mobile/.idea/misc.xml
+++ b/mobile/.idea/misc.xml
@@ -3,8 +3,31 @@
+
+
+
+
+
+
+
+ Android 4.3 Platform
+
+
+
+
+
+
+
diff --git a/mobile/.idea/modules.xml b/mobile/.idea/modules.xml
index c7429177..cbb8eea5 100644
--- a/mobile/.idea/modules.xml
+++ b/mobile/.idea/modules.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/mobile/.idea/vcs.xml b/mobile/.idea/vcs.xml
index 2e0588cc..21cbaa60 100644
--- a/mobile/.idea/vcs.xml
+++ b/mobile/.idea/vcs.xml
@@ -1,7 +1,6 @@
-
diff --git a/mobile/IITC-Mobile.iml b/mobile/IITC-Mobile.iml
deleted file mode 100644
index 3da809e3..00000000
--- a/mobile/IITC-Mobile.iml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
- MANIFEST_FILE_PATH
- RESOURCES_DIR_PATH
- ASSETS_DIR_PATH
- NATIVE_LIBS_DIR_PATH
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mobile/mobile.iml b/mobile/IITC_Mobile.iml
similarity index 66%
rename from mobile/mobile.iml
rename to mobile/IITC_Mobile.iml
index 25a68b77..7647439e 100644
--- a/mobile/mobile.iml
+++ b/mobile/IITC_Mobile.iml
@@ -2,24 +2,18 @@
-
-
- MANIFEST_FILE_PATH
- RESOURCES_DIR_PATH
- ASSETS_DIR_PATH
- NATIVE_LIBS_DIR_PATH
-
-
+
-
+
+
diff --git a/mobile/build.gradle b/mobile/build.gradle
deleted file mode 100644
index 2fa22689..00000000
--- a/mobile/build.gradle
+++ /dev/null
@@ -1,35 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.4'
- }
-}
-apply plugin: 'android'
-
-dependencies {
-}
-
-android {
- compileSdkVersion 17
- buildToolsVersion "17"
-
- defaultConfig {
- minSdkVersion 14
- targetSdkVersion 17
- }
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- resources.srcDirs = ['src']
- aidl.srcDirs = ['src']
- renderscript.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
-
- instrumentTest.setRoot('tests')
- }
-}
diff --git a/mobile/proguard-project.txt b/mobile/proguard-project.txt
deleted file mode 100644
index ff7f7030..00000000
--- a/mobile/proguard-project.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# view res/xml/preferences.xml #generated:4
--keep class com.cradle.iitc_mobile.IITC_AboutDialogPreference { (...); }
-
-# view AndroidManifest.xml #generated:23
--keep class com.cradle.iitc_mobile.IITC_Mobile { (...); }
-
-# view AndroidManifest.xml #generated:56
--keep class com.cradle.iitc_mobile.IITC_SearchableActivity { (...); }
-
-# view AndroidManifest.xml #generated:50
--keep class com.cradle.iitc_mobile.IITC_PreferenceActivity { (...); }
-
-# view res/layout/activity_main.xml #generated:6
--keep class com.cradle.iitc_mobile.IITC_WebView { (...); }
-
--keep class com.cradle.iitc_mobile.IITC_JSInterface { (...); }
\ No newline at end of file
From 82708124068218cd51069891afba4f56d535433c Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Fri, 25 Oct 2013 07:10:35 +0100
Subject: [PATCH 099/126] experimental change: render stale map data tiles
before downloading fresh data - should give a more responsive appearance of
data also increase cache expiry time to 15 mins
---
code/map_data_cache.js | 2 +-
code/map_data_request.js | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/code/map_data_cache.js b/code/map_data_cache.js
index bdd18228..a04070fc 100644
--- a/code/map_data_cache.js
+++ b/code/map_data_cache.js
@@ -11,7 +11,7 @@ window.DataCache = function() {
// entries would grow indefinitely. an hour seems reasonable from experience with the data, so 55 mins max cache time
// this.REQUEST_CACHE_MAX_AGE = 55*60; // maximum cache age. entries are deleted from the cache after this time
//UPDATE: this timestampMs parameter doesn't work, so reduced max age to limit RAM usage
- this.REQUEST_CACHE_MAX_AGE = 5*60; // maximum cache age. entries are deleted from the cache after this time
+ this.REQUEST_CACHE_MAX_AGE = 15*60; // maximum cache age. entries are deleted from the cache after this time
if (L.Browser.mobile) {
// on mobile devices, smaller cache size
diff --git a/code/map_data_request.js b/code/map_data_request.js
index c118d23f..5e49a3f8 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -247,7 +247,15 @@ window.MapDataRequest.prototype.refresh = function() {
this.cachedTileCount += 1;
} else {
- // no fresh data - queue a request
+ // no fresh data
+
+ // render the cached stale data, if we have it. this ensures *something* appears quickly when possible
+ var old_data = this.cache && this.cache.get(tile_id);
+ if (old_data) {
+ this.render.processTileData (old_data);
+ }
+
+ // queue a request
var boundsParams = generateBoundsParams(
tile_id,
latSouth,
From d268b0a79f8cf61db4f81affda474c8c8f7d1e7e Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Fri, 25 Oct 2013 08:01:45 +0100
Subject: [PATCH 100/126] remove the delay before requeueing 'error==TIMEOUT'
tiles. it's not needed (stock site has no delay), and the other delay (before
processing the queue again) has more than enough effect to batch multiple
retries together when it's useful
---
code/map_data_request.js | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/code/map_data_request.js b/code/map_data_request.js
index 5e49a3f8..84795404 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -42,8 +42,7 @@ window.MapDataRequest = function() {
// this gives a chance of other requests finishing, allowing better grouping of retries in new requests
this.RUN_QUEUE_DELAY = 0.5;
- // delay before re-queueing tiles
- this.TILE_TIMEOUT_REQUEUE_DELAY = 0.2; // short delay before retrying a 'error==TIMEOUT' tile. a common 'error', and the stock site has no delay in this case
+ // delay before re-queueing tiles in failed requests
this.BAD_REQUEST_REQUEUE_DELAY = 5; // longer delay before retrying a completely failed request - as in this case the servers are struggling
// a delay before processing the queue after requeueing tiles. this gives a chance for other requests to finish
@@ -513,7 +512,6 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
if (val.error == "TIMEOUT") {
// TIMEOUT errors for individual tiles are 'expected'(!) - and result in a silent unlimited retries
timeoutTiles.push (id);
- this.debugTiles.setState (id, 'tile-timeout');
} else {
console.warn('map data tile '+id+' failed: error=='+val.error);
errorTiles.push (id);
@@ -588,21 +586,20 @@ console.log('processed delta mapData request:'+id+': '+oldEntityCount+' original
console.log ('getThinnedEntities status: '+tiles.length+' tiles: '+successTiles.length+' successful, '+timeoutTiles.length+' timed out, '+errorTiles.length+' failed');
- //setTimeout has no way of passing the 'context' (aka 'this') to it's function
- var savedContext = this;
-
+ // requeue any 'timeout' tiles immediately
if (timeoutTiles.length > 0) {
- setTimeout (function() {
- for (var i in timeoutTiles) {
- var id = timeoutTiles[i];
- delete savedContext.requestedTiles[id];
- savedContext.requeueTile(id, false);
- }
- savedContext.delayProcessRequestQueue(this.REQUEUE_DELAY);
- }, this.TILE_TIMEOUT_REQUEUE_DELAY*1000);
+ for (var i in timeoutTiles) {
+ var id = timeoutTiles[i];
+ delete this.requestedTiles[id];
+ this.requeueTile(id, false);
+ }
}
+ // but for other errors, delay before retrying (as the server is having issues)
if (errorTiles.length > 0) {
+ //setTimeout has no way of passing the 'context' (aka 'this') to it's function
+ var savedContext = this;
+
setTimeout (function() {
for (var i in errorTiles) {
var id = errorTiles[i];
From 51bb866dc6250479aa4c0f9c4090445ab64e4916 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Sun, 27 Oct 2013 16:06:35 +0000
Subject: [PATCH 101/126] geodesic lines - improved handling of lines that
cross the antimeridian works fine as long as the longitude difference is
under 180 degrees
---
external/L.Geodesic.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/external/L.Geodesic.js b/external/L.Geodesic.js
index b2bf8339..9d25b3b1 100644
--- a/external/L.Geodesic.js
+++ b/external/L.Geodesic.js
@@ -44,7 +44,7 @@ Modified by qnstie 2013-07-17 to maintain compatibility with Leaflet.draw
lat1, lat2, lng1, lng2, dLng, d, segments,
f, A, B, x, y, z, fLat, fLng;
- dLng = Math.abs(endLatlng.lng - startLatlng.lng) * d2r;
+ dLng = (endLatlng.lng - startLatlng.lng) * d2r;
lat1 = startLatlng.lat * d2r;
lat2 = endLatlng.lat * d2r;
lng1 = startLatlng.lng * d2r;
@@ -60,14 +60,15 @@ Modified by qnstie 2013-07-17 to maintain compatibility with Leaflet.draw
// rounding errors? maths bug? not sure - but it solves the issue! and is a slight optimisation)
for (i = 1; i < segments; i++) {
// http://williams.best.vwh.net/avform.htm#Intermediate
+ // modified to handle longitude above +-180 degrees
f = i / segments;
A = Math.sin((1-f)*d) / Math.sin(d);
B = Math.sin(f*d) / Math.sin(d);
- x = A * Math.cos(lat1) * Math.cos(lng1) + B * Math.cos(lat2) * Math.cos(lng2);
- y = A * Math.cos(lat1) * Math.sin(lng1) + B * Math.cos(lat2) * Math.sin(lng2);
- z = A * Math.sin(lat1) + B * Math.sin(lat2);
+ x = A * Math.cos(lat1) * Math.cos(0) + B * Math.cos(lat2) * Math.cos(dLng);
+ y = A * Math.cos(lat1) * Math.sin(0) + B * Math.cos(lat2) * Math.sin(dLng);
+ z = A * Math.sin(lat1) + B * Math.sin(lat2);
fLat = r2d * Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
- fLng = r2d * Math.atan2(y, x);
+ fLng = r2d * (Math.atan2(y, x)+lng1);
convertedPoints.push(L.latLng([fLat, fLng]));
}
From 7230e2f44a83400ffe0ce5701f8d2dc80e495973 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Sun, 27 Oct 2013 16:33:42 +0000
Subject: [PATCH 102/126] run the requestFinished callback after updating
visibility/render of cached data technically, not a finished request, but
makes sense from the point of view of plugins
---
code/map_data_request.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/code/map_data_request.js b/code/map_data_request.js
index 84795404..07ee7e32 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -299,6 +299,10 @@ console.log('stale tile '+tile_id+': newest mtime '+lastTimestamp+(lastTimestamp
this.setStatus ('loading');
+ // technically a request hasn't actually finished - however, displayed portal data has been refreshed
+ // so as far as plugins are concerned, it should be treated as a finished request
+ window.runHooks('requestFinished', {success: true});
+
console.log ('done request preperation (cleared out-of-bounds and invalid for zoom, and rendered cached data)');
if (Object.keys(this.tileBounds).length > 0) {
From b6eebccca9383b283005c744d838f6029827afd2 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Mon, 28 Oct 2013 21:56:36 +0000
Subject: [PATCH 103/126] extract script version and other data from the
tampermonkey/greasemonkey GM_info and pass it through the wrapper function
modify the plugin template code to do the same for plugins - also include the
plugin base filename
this is the required data to allow version checks to be performed. it will also allow IITC to know which plugins are installed and active
---
build.py | 34 +++++++++++++++++++---------------
main.js | 10 ++++++++--
2 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/build.py b/build.py
index 5bc94a70..abde15f2 100755
--- a/build.py
+++ b/build.py
@@ -67,24 +67,24 @@ antBuildFile = settings.get('antBuildFile', 'mobile/build.xml');
# 1. indentation caused by the "function wrapper()" doesn't apply to the plugin code body
# 2. the wrapper is formatted correctly for removal by the IITC Mobile android app
pluginWrapperStart = """
-function wrapper() {
+function wrapper(plugin_info) {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function') window.plugin = function() {};
"""
+
pluginWrapperEnd = """
-if(window.iitcLoaded && typeof setup === 'function') {
- setup();
-} else {
- if(window.bootPlugins)
- window.bootPlugins.push(setup);
- else
- window.bootPlugins = [setup];
-}
+setup.info = plugin_info; //add the script info data to the function as a property
+if(!window.bootPlugins) window.bootPlugins = [];
+window.bootPlugins.push(setup);
+// if IITC has already booted, immediately run the 'setup' function
+if(window.iitcLoaded && typeof setup === 'function') setup();
} // wrapper end
// inject code into site context
var script = document.createElement('script');
-script.appendChild(document.createTextNode('('+ wrapper +')();'));
+var info = { buildName: '@@BUILDNAME@@', dateTimeVersion: '@@DATETIMEVERSION@@', pluginId: '@@PLUGINNAME@@' };
+if (this.GM_info && this.GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description };
+script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');'));
(document.body || document.head || document.documentElement).appendChild(script);
"""
@@ -143,10 +143,13 @@ def extractUserScriptMeta(var):
-def doReplacements(script,updateUrl,downloadUrl):
+def doReplacements(script,updateUrl,downloadUrl,pluginName=None):
script = re.sub('@@INJECTCODE@@',loadCode,script)
+ script = script.replace('@@PLUGINSTART@@', pluginWrapperStart)
+ script = script.replace('@@PLUGINEND@@', pluginWrapperEnd)
+
script = re.sub('@@INCLUDERAW:([0-9a-zA-Z_./-]+)@@', loaderRaw, script)
script = re.sub('@@INCLUDESTRING:([0-9a-zA-Z_./-]+)@@', loaderString, script)
script = re.sub('@@INCLUDEMD:([0-9a-zA-Z_./-]+)@@', loaderMD, script)
@@ -166,8 +169,8 @@ def doReplacements(script,updateUrl,downloadUrl):
script = script.replace('@@UPDATEURL@@', updateUrl)
script = script.replace('@@DOWNLOADURL@@', downloadUrl)
- script = script.replace('@@PLUGINSTART@@', pluginWrapperStart)
- script = script.replace('@@PLUGINEND@@', pluginWrapperEnd)
+ if (pluginName):
+ script = script.replace('@@PLUGINNAME@@', pluginName);
return script
@@ -223,7 +226,8 @@ for fn in glob.glob("plugins/*.user.js"):
downloadUrl = distUrlBase and distUrlBase + '/' + fn.replace("\\","/") or 'none'
updateUrl = distUrlBase and downloadUrl.replace('.user.js', '.meta.js') or 'none'
- script = doReplacements(script, downloadUrl=downloadUrl, updateUrl=updateUrl)
+ pluginName = os.path.splitext(os.path.splitext(os.path.basename(fn))[0])[0]
+ script = doReplacements(script, downloadUrl=downloadUrl, updateUrl=updateUrl, pluginName=pluginName)
metafn = fn.replace('.user.js', '.meta.js')
saveScriptAndMeta(script, os.path.join(outDir,fn), os.path.join(outDir,metafn))
@@ -238,7 +242,7 @@ if buildMobile:
script = readfile("mobile/plugins/" + fn)
downloadUrl = distUrlBase and distUrlBase + '/' + fn.replace("\\","/") or 'none'
updateUrl = distUrlBase and downloadUrl.replace('.user.js', '.meta.js') or 'none'
- script = doReplacements(script, downloadUrl=downloadUrl, updateUrl=updateUrl)
+ script = doReplacements(script, downloadUrl=downloadUrl, updateUrl=updateUrl, pluginName='user-location')
metafn = fn.replace('.user.js', '.meta.js')
saveScriptAndMeta(script, os.path.join(outDir,fn), os.path.join(outDir,metafn))
diff --git a/main.js b/main.js
index 4e5a6ebf..c51ff443 100644
--- a/main.js
+++ b/main.js
@@ -107,7 +107,11 @@ document.getElementsByTagName('body')[0].innerHTML = ''
// putting everything in a wrapper function that in turn is placed in a
// script tag on the website allows us to execute in the site’s context
// instead of in the Greasemonkey/Extension/etc. context.
-function wrapper() {
+function wrapper(info) {
+// a cut-down version of GM_info is passed as a parameter to the script
+// (not the full GM_info - it contains the ENTIRE script source!)
+window.script_info = info;
+
// LEAFLET PREFER CANVAS ///////////////////////////////////////////////
// Set to true if Leaflet should draw things using Canvas instead of SVG
@@ -240,5 +244,7 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
// inject code into site context
var script = document.createElement('script');
-script.appendChild(document.createTextNode('('+ wrapper +')();'));
+var info = { buildName: '@@BUILDNAME@@', dateTimeVersion: '@@DATETIMEVERSION@@' };
+if (this.GM_info && this.GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description };
+script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');'));
(document.body || document.head || document.documentElement).appendChild(script);
From 8d1eb6e0b77fd8ee4687ad27beeaa69801a8b1a3 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Mon, 28 Oct 2013 20:14:25 +0100
Subject: [PATCH 104/126] first version of custom fullscreen preference (fix
for #594)
---
mobile/res/values/strings.xml | 22 +++-
mobile/res/xml/preferences.xml | 11 +-
.../com/cradle/iitc_mobile/IITC_Mobile.java | 38 +++---
.../iitc_mobile/IITC_NavigationHelper.java | 34 ++----
.../com/cradle/iitc_mobile/IITC_WebView.java | 111 ++++++++++++++++--
5 files changed, 153 insertions(+), 63 deletions(-)
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index 5980c01b..1babb023 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -79,14 +79,16 @@
Show users position on mapShow zoom controlShows +/- buttons even on multitouch capable devices.
- Hide Action Bar in fullscreen mode
- Nice for screenshots. Note: IITCm can still be controlled via the Navigation Drawers
+ Hide in fullscreen mode
+ Which elements should be hidden in fullscreen mode.
+ Note: IITCm can still be controlled via the Navigation DrawersForce desktop modeNice for tablets, looks awful on smartphonesForce httpsDisabling may improve performanceMove cache to external storage
- Restart required! Write cache to sdCard. Saves internal storage. External storage has to be mounted.
+ Restart required! Write cache to sdCard. Saves internal storage.
+ External storage has to be mounted.Press back button twice to exitAvoids accidental exitsAdvanced settings
@@ -106,6 +108,20 @@
Aggressive CachingPrefer cached values even if they are expired…saves traffic but
may result in login issues
+
+
+ System Bar
+ Action Bar
+ IITC Status Bar
+ Navigation Bar
+
+
+ 2
+ 4
+ 8
+ 16
+
+
AlwaysMobile data only (default)
diff --git a/mobile/res/xml/preferences.xml b/mobile/res/xml/preferences.xml
index 8a137c51..ab91e41b 100644
--- a/mobile/res/xml/preferences.xml
+++ b/mobile/res/xml/preferences.xml
@@ -24,11 +24,12 @@
android:key="pref_user_zoom"
android:summary="@string/pref_user_zoom_sum"
android:title="@string/pref_user_zoom"/>
-
+ entries = mSharedPrefs.getStringSet("pref_fullscreen", new HashSet());
+ mFullscreenStatus &= FS_ENABLED;
+
+ // default values...android has no nice way to add default values to multiSelectListPreferences
+ if (entries.isEmpty()) {
+ mFullscreenStatus += FS_ACTIONBAR | FS_SYSBAR;
+ }
+ for (String entry : entries) {
+ mFullscreenStatus += Integer.parseInt(entry);
+ }
+ }
+
+ int getFullscreenStatus() {
+ return mFullscreenStatus;
+ }
+
+ public boolean isInFullscreen() {
+ return (mFullscreenStatus & FS_ENABLED) != 0;
+ }
+
public IITC_WebViewClient getWebViewClient() {
return mIitcWebViewClient;
}
@@ -210,5 +306,4 @@ public class IITC_WebView extends WebView {
Log.d("iitcm", "setting user agent to: " + ua);
mSettings.setUserAgentString(ua);
}
-
}
From 318cea2e9a03d8e8fea14ec9b8122aff5c8749fc Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 29 Oct 2013 02:09:41 +0000
Subject: [PATCH 105/126] add a list of the active plugins to the about dialog,
listing the version, etc from the new plugin interface changes also use the
new versin data supplied by grease/tampermonkey for the main script version
display
---
code/utils_misc.js | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/code/utils_misc.js b/code/utils_misc.js
index fa34ee5e..762e5fa1 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -1,9 +1,38 @@
// UTILS + MISC ///////////////////////////////////////////////////////
-window.aboutIITC = function(){
- var v = '@@BUILDNAME@@-@@BUILDDATE@@';
+window.aboutIITC = function() {
+ var v = (script_info.script && script_info.script.version || script_info.dateTimeVersion) + ' ['+script_info.buildName+']';
+ if (typeof android !== 'undefined' && android && android.getVersionCode) {
+ v += '[IITC Mobile '+android.getVersionCode()+']';
+ }
+
+ var plugins = '
';
+ for (var i in bootPlugins) {
+ var info = bootPlugins[i].info;
+ if (info) {
+ var pname = info.script && info.script.name || info.pluginId;
+ if (pname.substr(0,13) == 'IITC plugin: ' || pname.substr(0,13) == 'IITC Plugin: ') {
+ pname = pname.substr(13);
+ }
+ var pvers = info.script && info.script.version || info.dateTimeVersion;
+
+ var ptext = pname + ' - ' + pvers;
+ if (info.buildName != script_info.buildName) {
+ ptext += ' ['+info.buildName+']';
+ }
+
+ plugins += '
'+ptext+'
';
+ } else {
+ // no 'info' property of the plugin setup function - old plugin wrapper code
+ // could attempt to find the "window.plugin.NAME = function() {};" line it's likely to have..?
+ plugins += '
(unknown plugin: index '+i+')
';
+ }
+ }
+ plugins += '
';
+
var attrib = '@@INCLUDEMD:ATTRIBUTION.md@@';
var contrib = '@@INCLUDEMD:CONTRIBS.md@@'
+
var a = ''
+ '
';
+
dialog({
title: 'IITC ' + v,
html: a,
From 9dabc33770d6d85629c85fbf271186be1e341efd Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 29 Oct 2013 02:43:56 +0000
Subject: [PATCH 106/126] modify plugin wrapper, so build-script injected
macros in the wrapper are in a more obvious place, so 3rd party plugin
authors are less likely to make mistakes here when working outside the
build.py environment tweak the about screen to display non-standard plugins
using the new interface better
---
build.py | 11 +++++++++--
code/utils_misc.js | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/build.py b/build.py
index abde15f2..f81f6245 100755
--- a/build.py
+++ b/build.py
@@ -71,6 +71,13 @@ function wrapper(plugin_info) {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function') window.plugin = function() {};
+//PLUGIN AUTHORS: writing a plugin outside of the IITC build environment? if so, delete these lines!!
+//(leaving them in place might break the 'About IITC' page or break update checks)
+plugin_info.buildName = '@@BUILDNAME@@';
+plugin_info.dateTimeVersion: '@@DATETIMEVERSION@@';
+plugin_info.pluginId = '@@PLUGINNAME@@';
+//END PLUGIN AUTHORS NOTE
+
"""
pluginWrapperEnd = """
@@ -82,8 +89,8 @@ if(window.iitcLoaded && typeof setup === 'function') setup();
} // wrapper end
// inject code into site context
var script = document.createElement('script');
-var info = { buildName: '@@BUILDNAME@@', dateTimeVersion: '@@DATETIMEVERSION@@', pluginId: '@@PLUGINNAME@@' };
-if (this.GM_info && this.GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description };
+var info = {};
+if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description };
script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');'));
(document.body || document.head || document.documentElement).appendChild(script);
diff --git a/code/utils_misc.js b/code/utils_misc.js
index 762e5fa1..f41755e5 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -18,7 +18,7 @@ window.aboutIITC = function() {
var ptext = pname + ' - ' + pvers;
if (info.buildName != script_info.buildName) {
- ptext += ' ['+info.buildName+']';
+ ptext += ' ['+(info.buildName||'non-standard plugin')+']';
}
plugins += '
'+ptext+'
';
From c52d657864977c1ad915c9bea565a18aed423787 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 29 Oct 2013 02:48:03 +0000
Subject: [PATCH 107/126] fix syntax error in
9dabc33770d6d85629c85fbf271186be1e341efd - it broke all plugins (oops!)
---
build.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.py b/build.py
index f81f6245..921f0d0a 100755
--- a/build.py
+++ b/build.py
@@ -74,7 +74,7 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
//PLUGIN AUTHORS: writing a plugin outside of the IITC build environment? if so, delete these lines!!
//(leaving them in place might break the 'About IITC' page or break update checks)
plugin_info.buildName = '@@BUILDNAME@@';
-plugin_info.dateTimeVersion: '@@DATETIMEVERSION@@';
+plugin_info.dateTimeVersion = '@@DATETIMEVERSION@@';
plugin_info.pluginId = '@@PLUGINNAME@@';
//END PLUGIN AUTHORS NOTE
From a8f3a281e738ce1f621f7f2f3de7000f33600e11 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 29 Oct 2013 18:35:08 +0000
Subject: [PATCH 108/126] work in progress on version check server side script
---
website/versioncheck/index.php | 135 +++++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
create mode 100644 website/versioncheck/index.php
diff --git a/website/versioncheck/index.php b/website/versioncheck/index.php
new file mode 100644
index 00000000..831e199f
--- /dev/null
+++ b/website/versioncheck/index.php
@@ -0,0 +1,135 @@
+ Array ( # live release
+ 'path' => 'release',
+ 'name' => 'Stable release build',
+ ),
+ 'jonatkins-test' => Array ( # public test builds
+ 'path' => 'test',
+ 'name' => 'Test build',
+ ),
+
+ 'jonatkins-experimental' => Array ( # rarely used, for features not quite ready for 'test'
+ 'path' => 'experimental',
+ 'name' => 'Experimental build',
+ ),
+
+ 'jonatkins-dev' => Array ( # personal
+ 'path' => 'dev',
+ 'name' => 'Development builds - not for public use',
+ ),
+
+ 'local' => Array ( # not a real build, but often the default for local development
+ 'path' => NULL,
+ 'name' => 'Local build - no update check available',
+ ),
+);
+
+if ( array_key_exists ( $build, $details ) )
+{
+ $info = $details[$build];
+
+ $response['buildPath'] = $info['path'];
+ $response['name'] = $info['name'];
+
+
+}
+else
+{
+ $response['error'] = 'Unsupported build for version check';
+}
+
+
+$data = json_encode ( $response );
+$data = indent($data);
+
+
+# send the response - allow either jsonp (using a 'callback' parameter), or regular json
+if ( array_key_exists ( 'callback', $_GET ) )
+{
+ header('Content-Type: text/javascript; charset=utf8');
+ header('Access-Control-Allow-Origin: *');
+ header('Access-Control-Max-Age: 3628800');
+ header('Access-Control-Allow-Methods: GET, POST');
+
+ $callback = $_GET['callback'];
+ echo $callback.'('.$data.');';
+
+}
+else
+{
+ // normal JSON string
+ header('Content-Type: application/json; charset=utf8');
+
+ echo $data;
+}
+
+
+// http://www.daveperrett.com/articles/2008/03/11/format-json-with-php/
+/**
+ * Indents a flat JSON string to make it more human-readable.
+ *
+ * @param string $json The original JSON string to process.
+ *
+ * @return string Indented version of the original JSON string.
+ */
+function indent($json) {
+
+ $result = '';
+ $pos = 0;
+ $strLen = strlen($json);
+ $indentStr = ' ';
+ $newLine = "\n";
+ $prevChar = '';
+ $outOfQuotes = true;
+
+ for ($i=0; $i<=$strLen; $i++) {
+
+ // Grab the next character in the string.
+ $char = substr($json, $i, 1);
+
+ // Are we inside a quoted string?
+ if ($char == '"' && $prevChar != '\\') {
+ $outOfQuotes = !$outOfQuotes;
+
+ // If this character is the end of an element,
+ // output a new line and indent the next line.
+ } else if(($char == '}' || $char == ']') && $outOfQuotes) {
+ $result .= $newLine;
+ $pos --;
+ for ($j=0; $j<$pos; $j++) {
+ $result .= $indentStr;
+ }
+ }
+
+ // Add the character to the result string.
+ $result .= $char;
+
+ // If the last character was the beginning of an element,
+ // output a new line and indent the next line.
+ if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
+ $result .= $newLine;
+ if ($char == '{' || $char == '[') {
+ $pos ++;
+ }
+
+ for ($j = 0; $j < $pos; $j++) {
+ $result .= $indentStr;
+ }
+ }
+
+ $prevChar = $char;
+ }
+
+ return $result;
+}
+
+?>
From e7fe4bb1dddc7fefc4b197642afcda31193787e9 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 29 Oct 2013 20:29:08 +0000
Subject: [PATCH 109/126] first pass at a fix for protocol changes - #618
---
code/map_data_debug.js | 3 +-
code/map_data_request.js | 120 +++++-------------------------
code/utils_misc.js | 154 +++++++++++++--------------------------
3 files changed, 72 insertions(+), 205 deletions(-)
diff --git a/code/map_data_debug.js b/code/map_data_debug.js
index dcede257..4ecc27a8 100644
--- a/code/map_data_debug.js
+++ b/code/map_data_debug.js
@@ -37,8 +37,7 @@ window.RenderDebugTiles.prototype.setState = function(id,state) {
var col = '#f0f';
var fill = '#f0f';
switch(state) {
- case 'ok': col='#080'; fill='#080'; break;
- case 'ok-delta': col='#0f0'; fill='#0f0'; break;
+ case 'ok': col='#0f0'; fill='#0f0'; break;
case 'error': col='#f00'; fill='#f00'; break;
case 'cache-fresh': col='#0f0'; fill='#ff0'; break;
case 'cache-stale': col='#f00'; fill='#ff0'; break;
diff --git a/code/map_data_request.js b/code/map_data_request.js
index 07ee7e32..1c112a88 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -11,7 +11,6 @@ window.MapDataRequest = function() {
this.activeRequestCount = 0;
this.requestedTiles = {};
- this.staleTileData = {};
this.idle = false;
@@ -173,11 +172,8 @@ window.MapDataRequest.prototype.refresh = function() {
// a 'set' to keep track of hard failures for tiles
this.tileErrorCount = {};
- // fill tileBounds with the data needed to request each tile
- this.tileBounds = {};
-
- // clear the stale tile data
- this.staleTileData = {};
+ // the 'set' of requested tile QKs
+ this.queuedTiles = {};
var bounds = clampLatLngBounds(map.getBounds());
@@ -255,43 +251,7 @@ window.MapDataRequest.prototype.refresh = function() {
}
// queue a request
- var boundsParams = generateBoundsParams(
- tile_id,
- latSouth,
- lngWest,
- latNorth,
- lngEast
- );
-
-/* After some testing, this doesn't seem to actually work. The server returns the same data with and without the parameter
- * Also, closer study of the stock site code shows the parameter isn't actually set anywhere.
- * so, disabling for now...
- // however, the server does support delta requests - only returning the entities changed since a particular timestamp
- // retrieve the stale cache entry and use it, if possible
- var stale = (this.cache && this.cache.get(tile_id));
- var lastTimestamp = undefined;
- if (stale) {
- // find the timestamp of the latest entry in the stale records. the stock site appears to use the browser
- // clock, but this isn't reliable. ideally the data set should include it's retrieval timestamp, set by the
- // server, for use here. a good approximation is the highest timestamp of all entities
-
- for (var i in stale.gameEntities) {
- var ent = stale.gameEntities[i];
- if (lastTimestamp===undefined || ent[1] > lastTimestamp) {
- lastTimestamp = ent[1];
- }
- }
-
-console.log('stale tile '+tile_id+': newest mtime '+lastTimestamp+(lastTimestamp?' '+new Date(lastTimestamp).toString():''));
- if (lastTimestamp) {
- // we can issue a useful delta request - store the previous data, as we can't rely on the cache still having it later
- this.staleTileData[tile_id] = stale;
- boundsParams.timestampMs = lastTimestamp;
- }
- }
-*/
-
- this.tileBounds[tile_id] = boundsParams;
+ this.queuedTiles[tile_id] = tile_id;
this.requestedTileCount += 1;
}
}
@@ -305,7 +265,7 @@ console.log('stale tile '+tile_id+': newest mtime '+lastTimestamp+(lastTimestamp
console.log ('done request preperation (cleared out-of-bounds and invalid for zoom, and rendered cached data)');
- if (Object.keys(this.tileBounds).length > 0) {
+ if (Object.keys(this.queuedTiles).length > 0) {
// queued requests - don't start processing the download queue immediately - start it after a short delay
this.delayProcessRequestQueue (this.DOWNLOAD_DELAY,true);
} else {
@@ -326,7 +286,7 @@ window.MapDataRequest.prototype.delayProcessRequestQueue = function(seconds,isFi
window.MapDataRequest.prototype.processRequestQueue = function(isFirstPass) {
// if nothing left in the queue, end the render. otherwise, send network requests
- if (Object.keys(this.tileBounds).length == 0) {
+ if (Object.keys(this.queuedTiles).length == 0) {
this.render.endRenderPass();
@@ -354,7 +314,7 @@ window.MapDataRequest.prototype.processRequestQueue = function(isFirstPass) {
// create a list of tiles that aren't requested over the network
var pendingTiles = [];
- for (var id in this.tileBounds) {
+ for (var id in this.queuedTiles) {
if (!(id in this.requestedTiles) ) {
pendingTiles.push(id);
}
@@ -404,24 +364,23 @@ window.MapDataRequest.prototype.processRequestQueue = function(isFirstPass) {
window.MapDataRequest.prototype.sendTileRequest = function(tiles) {
- var boundsParamsList = [];
+ var tilesList = [];
for (var i in tiles) {
var id = tiles[i];
this.debugTiles.setState (id, 'requested');
- this.requestedTiles[id] = { staleData: this.staleTileData[id] };
+ this.requestedTiles[id] = true;
- var boundsParams = this.tileBounds[id];
- if (boundsParams) {
- boundsParamsList.push (boundsParams);
+ if (id in this.queuedTiles) {
+ tilesList.push (id);
} else {
- console.warn('failed to find bounds for tile id '+id);
+ console.warn('no queue entry for tile id '+id);
}
}
- var data = { boundsParamsList: boundsParamsList };
+ var data = { quadKeys: tilesList };
this.activeRequestCount += 1;
@@ -435,7 +394,7 @@ window.MapDataRequest.prototype.sendTileRequest = function(tiles) {
}
window.MapDataRequest.prototype.requeueTile = function(id, error) {
- if (id in this.tileBounds) {
+ if (id in this.queuedTiles) {
// tile is currently wanted...
// first, see if the error can be ignored due to retry counts
@@ -461,7 +420,7 @@ window.MapDataRequest.prototype.requeueTile = function(id, error) {
this.failedTileCount += 1;
}
// and delete from the pending requests...
- delete this.tileBounds[id];
+ delete this.queuedTiles[id];
} else {
// if false, was a 'timeout' or we're retrying, so unlimited retries (as the stock site does)
@@ -471,9 +430,8 @@ window.MapDataRequest.prototype.requeueTile = function(id, error) {
// proper queue, just an object with guid as properties. Javascript standards don't guarantee the order of properties
// within an object. however, all current browsers do keep property order, and new properties are added at the end.
// therefore, delete and re-add the requeued tile and it will be added to the end of the queue
- var boundsData = this.tileBounds[id];
- delete this.tileBounds[id];
- this.tileBounds[id] = boundsData;
+ delete this.queuedTiles[id];
+ this.queuedTiles[id] = id;
}
} // else the tile wasn't currently wanted (an old non-cancelled request) - ignore
@@ -525,57 +483,17 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
// no error for this data tile - process it
successTiles.push (id);
- var stale = this.requestedTiles[id].staleData;
- if (stale) {
-//NOTE: currently this code path won't be used, as we never set the staleData to anything other than 'undefined'
- // we have stale data. therefore, a delta request was made for this tile. we need to merge the results with
- // the existing stale data before proceeding
-
- var dataObj = {};
- // copy all entities from the stale data...
- for (var i in stale.gameEntities||[]) {
- var ent = stale.gameEntities[i];
- dataObj[ent[0]] = { timestamp: ent[1], data: ent[2] };
- }
-var oldEntityCount = Object.keys(dataObj).length;
- // and remove any entities in the deletedEntnties list
- for (var i in val.deletedEntities||[]) {
- var guid = val.deletedEntities[i];
- delete dataObj[guid];
- }
-var oldEntityCount2 = Object.keys(dataObj).length;
- // then add all entities from the new data
- for (var i in val.gameEntities||[]) {
- var ent = val.gameEntities[i];
- dataObj[ent[0]] = { timestamp: ent[1], data: ent[2] };
- }
-var newEntityCount = Object.keys(dataObj).length;
-console.log('processed delta mapData request:'+id+': '+oldEntityCount+' original entities, '+oldEntityCount2+' after deletion, '+val.gameEntities.length+' entities in the response');
-
- // now reconstruct a new gameEntities array in val, with the updated data
- val.gameEntities = [];
- for (var guid in dataObj) {
- var ent = [guid, dataObj[guid].timestamp, dataObj[guid].data];
- val.gameEntities.push(ent);
- }
-
- // we can leave the returned 'deletedEntities' data unmodified - it's not critial to how IITC works anyway
-
- // also delete any staleTileData entries for this tile - no longer required
- delete this.staleTileData[id];
- }
-
// store the result in the cache
this.cache && this.cache.store (id, val);
// if this tile was in the render list, render it
// (requests aren't aborted when new requests are started, so it's entirely possible we don't want to render it!)
- if (id in this.tileBounds) {
- this.debugTiles.setState (id, stale?'ok-delta':'ok');
+ if (id in this.queuedTiles) {
+ this.debugTiles.setState (id, 'ok');
this.render.processTileData (val);
- delete this.tileBounds[id];
+ delete this.queuedTiles[id];
this.successTileCount += 1;
} // else we don't want this tile (from an old non-cancelled request) - ignore
diff --git a/code/utils_misc.js b/code/utils_misc.js
index f41755e5..5ca68549 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -129,104 +129,46 @@ window.digits = function(d) {
window.requestParameterMunges = [
// now obsolete (they don't have some of the new parameters) munge sets deleted
-
- // set 3 - in the update of 2013-09-30 (addition of 'alerts' chat tab)
+ // set 6 - 2013-10-29
{
- 'dashboard.getGameScore': 'fhlzntzkl5v7hcfh', // GET_GAME_SCORE
- 'dashboard.getPaginatedPlextsV2': 'wzuitnswoda7w028', // GET_PAGINATED_PLEXTS
- 'dashboard.getThinnedEntitiesV4': 'scgrm4lf2371esgw', // GET_THINNED_ENTITIES
- 'dashboard.getPlayersByGuids': '81l6usczczoi3lfi', // LOOKUP_PLAYERS
- 'dashboard.redeemReward': '8kop2koeld9b4c26', // REDEEM_REWARD
- 'dashboard.sendInviteEmail': 't0ccodsm1nuo5uso', // SEND_INVITE_EMAIL
- 'dashboard.sendPlext': 'k04cfjwwsg3h3827', // SEND_PLEXT
+ 'dashboard.getGameScore': 'vzjhib746rvkre04', // GET_GAME_SCORE
+ 'dashboard.getPaginatedPlextsV2': 'gqa96zhqpddtfmkl', // GET_PAGINATED_PLEXTS
+ 'dashboard.getThinnedEntitiesV4': '18lmw7lytgxji0dk', // GET_THINNED_ENTITIES
+ 'dashboard.getPlayersByGuids': 'emb5xrj8rav1i0be', // LOOKUP_PLAYERS
+ 'dashboard.redeemReward': '4xqof5pldqab63rb', // REDEEM_REWARD
+ 'dashboard.sendInviteEmail': 'yq5wxjlnud0tj6hu', // SEND_INVITE_EMAIL
+ 'dashboard.sendPlext': 'e1ipqdxjlwd3l7zb', // SEND_PLEXT
- method: '22ux2z96jwq5zn78',
- version: 'kf6hgl9yau03ws0o', //guessed parameter name - only seen munged
- version_parameter: '4608f4356a6f55690f127fb542f557f98de66169', // passed as the value to the above parameter
- boundsParamsList: '29t16cmsn6l3r2xg',
- id: '7rogqhp5pzcqobcw',
- minLatE6: 'yzbnp7z9bd28p0yr',
- minLngE6: '2pdhntvo85cd90bw',
- maxLatE6: 'c4ivr013h4dr68pd',
- maxLngE6: '4p8oorcrwalc1mzf',
- timestampMs: 'vd2rsa9v6f8q606s',
- qk: 'cblh9xe0bgwjy5ij',
- desiredNumItems: '3ymaq7slb165porj',
- minTimestampMs: 's9jf2seni33y3gyu',
- maxTimestampMs: '2kh3vti98rhp3g29',
- chatTab: '7n7ocqfq1p18352b', //guessed parameter name - only seen munged
- ascendingTimestampOrder: 'p88a2ztchtjhiazl',
- message: 'e8qm0kptw2trrcrw',
- latE6: 'fja1phtsqxm71dqm',
- lngE6: 'iut1tb7c0x726hwn',
- guids: '5hyiwhwc0jyljvro',
- inviteeEmailAddress: 's9z6zt03eymzxhkj',
- },
+ // common parameters
+ method: 'wg7gyxoanqc1si5r',
+ version: 'adlo9o4kjvho5q94', //guessed parameter name - only seen munged
+ version_parameter: '56036a6497ea344a9fffa38b171a77c092c1f220', // passed as the value to the above parameter
- // set 4 - second update of 2013-09-30
- {
- 'dashboard.getGameScore': 'ija9jgrf5hj7wm9r', // GET_GAME_SCORE
- 'dashboard.getPaginatedPlextsV2': '0elftx739mkbzi1b', // GET_PAGINATED_PLEXTS
- 'dashboard.getThinnedEntitiesV4': 'prv0ez8cbsykh63g', // GET_THINNED_ENTITIES
- 'dashboard.getPlayersByGuids': 'i0lxy6nc695z9ka3', // LOOKUP_PLAYERS
- 'dashboard.redeemReward': '376oivna8rf8qbfj', // REDEEM_REWARD
- 'dashboard.sendInviteEmail': '96y930v5q96nrcrw', // SEND_INVITE_EMAIL
- 'dashboard.sendPlext': 'c04kceytofuqvyqg', // SEND_PLEXT
+ // GET_THINNED_ENTITIES
+ quadKeys: '6vcl0ivqz4aj5sfu', //guessed parameter name - only seen munged
- method: '9we4b31i48ui4sdm',
- version: 'q402kn5zqisuo1ym', //guessed parameter name - only seen munged
- version_parameter: 'dbad4485024d446ae946e3d287b5d640029ef3e3', // passed as the value to the above parameter
- boundsParamsList: '3r5ctyvc2f653zjd',
- id: 'izey8ciqg2dz2oqc',
- minLatE6: 'cein0n4jrifa7ui2',
- minLngE6: 'lbd1juids3johtdo',
- maxLatE6: 'h4kyot9kmvd3g284',
- maxLngE6: 'sbci6jjc2d5g9uy4',
- timestampMs: '2wurn9giagbvv6bt',
- qk: 'hq73mwpjqyvcp6ul',
- desiredNumItems: 'kyo6vh5n58hmrnua',
- minTimestampMs: 'hu4swdftcp7mvkdi',
- maxTimestampMs: 'ly6ylae5lv1z9072',
- chatTab: 'q5kxut5rmbtlqbf9', //guessed parameter name - only seen munged
- ascendingTimestampOrder: 'hvfd0io35rahwjgr',
- message: 'z4hf7tzl27o14455',
- latE6: 'zyzh3bdxyd47vk1x',
- lngE6: 'n5d1f8pql51t641x',
- guids: 'gl16ehqoc3i3oi07',
- inviteeEmailAddress: 'orc9ufg7rp7g1y9j',
- },
+ // GET_PAGINATED_PLEXTS
+ desiredNumItems: '6jd5b49wn748diye',
+ minLatE6: '891ebsryg45b8cxb',
+ minLngE6: 'mvepdcx1k6noya15',
+ maxLatE6: 's3rh3fhji5mcjlof',
+ maxLngE6: 'yqdgfuukrxj8byzj',
+ minTimestampMs: 'btf0kpztxrkt6sl6',
+ maxTimestampMs: 'hg8vhtehxf53n5cu',
+ chatTab: '6bk9rmebtk1ux6da', //guessed parameter name - only seen munged
+ ascendingTimestampOrder: '4zw3v6xwp117r47w',
- // set 5 - second update of 2013-10-16
- {
- 'dashboard.getGameScore': '3b48kl956b33brrl', // GET_GAME_SCORE
- 'dashboard.getPaginatedPlextsV2': 'h785pmet6wrx6xoa', // GET_PAGINATED_PLEXTS
- 'dashboard.getThinnedEntitiesV4': '4gux7b0n3euu7e8y', // GET_THINNED_ENTITIES
- 'dashboard.getPlayersByGuids': 'nqm1kocgzspecpzv', // LOOKUP_PLAYERS
- 'dashboard.redeemReward': 'g618n6peb74u2ae9', // REDEEM_REWARD
- 'dashboard.sendInviteEmail': 'bsl4280bm39bkl3a', // SEND_INVITE_EMAIL
- 'dashboard.sendPlext': 'jym2hbw15i6uru7g', // SEND_PLEXT
+ // SEND_PLEXT
+ message: '55vpsci0hji0ai5x',
+ latE6: 'lyhrt4miuwc7w29d',
+ lngE6: 'c1yl2qmzfu5j23ao',
+// chatTab: '6bk9rmebtk1ux6da', //guessed parameter name - only seen munged
- method: 'g9cmy5g6vpxpmcxz',
- version: 'blq7574e6kkg0fig', //guessed parameter name - only seen munged
- version_parameter: '465c62b22b3bc9ecae01e08b30703752186a1dc9', // passed as the value to the above parameter
- boundsParamsList: '45k478vh10jt1ik7',
- id: '3eh1ynwxjy8c8rd5',
- minLatE6: 'krpywcgq1voq71z3',
- minLngE6: 'yo6lte88zvoneqi6',
- maxLatE6: 'dncli54tfafmtk6y',
- maxLngE6: '76pq437r7vm3osx9',
- timestampMs: '2zlgpsg1x6i9720s',
- qk: 'pzejivoj28p6kkry',
- desiredNumItems: 'u3uxpkqd4pn37ydn',
- minTimestampMs: 'msw5gcxhuuk46rb2',
- maxTimestampMs: 'bps0ekgdzakdfvr0',
- chatTab: 'pm4fm8bjvotjm30h', //guessed parameter name - only seen munged
- ascendingTimestampOrder: '7qp8gv50ogelh7cs',
- message: 'y599irwyfs45adp4',
- latE6: '19ko11fmx32sjfqk',
- lngE6: 'i8yjq6v2mjhze29d',
- guids: 'szebfshb9f3uo2h9',
- inviteeEmailAddress: 'qq4t7lhqphq7wqvh',
+ // LOOKUP_PLAYERS
+ guids: 'k76phw8ey9z21z7c',
+
+ // SEND_INVITE_EMAIL
+ inviteeEmailAddress: 'x16pe9u4i8bidbi2',
},
];
@@ -234,22 +176,30 @@ window.activeRequestMungeSet = undefined;
// attempt to guess the munge set in use, by looking therough the functions of the stock intel page for one of the munged params
window.detectActiveMungeSet = function() {
- if (window.requestParameterMunges.length == 1) {
- // no point in searching through the code when there's only one set in use
- window.activeRequestMungeSet = 0;
- return;
- }
// try and find the stock page functions
// FIXME? revert to searching through all the code? is that practical?
- var stockFunc = nemesis.dashboard.network.DataFetcher.prototype.sendRequest_.toString()
- for (var i in window.requestParameterMunges) {
- if (stockFunc.indexOf (window.requestParameterMunges[i]['method']) >= 0) {
- console.log('IITC: found request munge set index '+i+' in stock intel function nemesis.dashboard.network.DataFetcher.prototype.sendRequest_');
- window.activeRequestMungeSet = i;
+ var stockFunc;
+ try {
+ stockFunc = nemesis.dashboard.network.XhrController.prototype.sendRequest.toString();
+ } catch(e) {
+ try {
+ stockFunc = nemesis.dashboard.network.DataFetcher.prototype.sendRequest_.toString();
+ } catch(e) {
}
}
+ if(stockFunc) {
+ for (var i in window.requestParameterMunges) {
+ if (stockFunc.indexOf (window.requestParameterMunges[i]['method']) >= 0) {
+ console.log('IITC: found request munge set index '+i+' in stock intel site');
+ window.activeRequestMungeSet = i;
+ }
+ }
+ } else {
+ console.error('IITC: failed to find the stock site function for detecting munge set');
+ }
+
if (window.activeRequestMungeSet===undefined) {
console.error('IITC: failed to find request munge set - IITC will likely fail');
window.activeRequestMungeSet = 0;
From a428dcf54d72e9c51d5fd54d5e85831ff52aa8e4 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 29 Oct 2013 20:41:36 +0000
Subject: [PATCH 110/126] add comment about potential improvement to request
handling
---
code/map_data_request.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/code/map_data_request.js b/code/map_data_request.js
index 1c112a88..ae53421e 100644
--- a/code/map_data_request.js
+++ b/code/map_data_request.js
@@ -501,6 +501,9 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
}
+ // TODO? check for any requested tiles in 'tiles' not being mentioned in the response - and handle as if it's a 'timeout'?
+
+
window.runHooks('requestFinished', {success: true});
}
From 33dcbe8514556e0f6fca2813e680e7831327c277 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Tue, 29 Oct 2013 21:19:40 +0000
Subject: [PATCH 111/126] website updatew fir release
---
website/page/home.php | 6 ++++++
website/page/news.php | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/website/page/home.php b/website/page/home.php
index 452161e2..dbe5518d 100644
--- a/website/page/home.php
+++ b/website/page/home.php
@@ -13,6 +13,12 @@ offers many more features. It is available for
Latest news
+
29th October 2013
+
+IITC 0.14.4 and IITC Mobile 0.7.7 have just been released. A critical update required to work with changes made to the
+standard intel site.
+
+
16th October 2013
IITC 0.14.3 and IITC MObile 0.7.4 have just been released. This is a critical update required to work with the latest
diff --git a/website/page/news.php b/website/page/news.php
index 2a827ee9..569be174 100644
--- a/website/page/news.php
+++ b/website/page/news.php
@@ -1,5 +1,11 @@
News
+
29th October 2013
+
+IITC 0.14.4 and IITC Mobile 0.7.7 have just been released. A critical update required to work with changes made to the
+standard intel site.
+
+
16th October 2013
IITC 0.14.3 and IITC MObile 0.7.4 have just been released. This is a critical update required to work with the latest
From 5101e9fd5783f9321835ef7b9b80623d948b3f79 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 02:04:54 +0000
Subject: [PATCH 112/126] website: add changelog for 0.14.4 release
---
website/page/home.php | 21 ++++++++++++++++++++-
website/page/news.php | 21 ++++++++++++++++++++-
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/website/page/home.php b/website/page/home.php
index dbe5518d..1eda08fc 100644
--- a/website/page/home.php
+++ b/website/page/home.php
@@ -16,7 +16,26 @@ offers many more features. It is available for
29th October 2013
IITC 0.14.4 and IITC Mobile 0.7.7 have just been released. A critical update required to work with changes made to the
-standard intel site.
+standard intel site. Changes include
+
+
Fix to geodesic circle drawing. They were not correctly distorted, leading to incorrect link ranges drawn on the map.
+
Bookmarks plugin: add layer and highlighter to indicate bookmarked portals
+
Player tracker plugin: markers fade for older activity, and separate layers for each faction
+
The 'About IITC' dialog now lists which plugins are installed. This may not work correctly for 3rd party plugins at this time
+
Mobile:
+
+
Custom fullscreen preferences
+
Install to SD Card
+
Cache move to SD card option (hence the new permissions)
+
+
+
... and, as always, various bugfixes and improvements.
+
+
+
+3RD PARTY PLUGIN AUTHORS: The plugin wrapper code has been modified to pass through the additioal version
+information. While existing plugins should continue to work, I highly recommend updating the wrapper code in your
+scripts to match.
IITC 0.14.4 and IITC Mobile 0.7.7 have just been released. A critical update required to work with changes made to the
-standard intel site.
+standard intel site. Changes include
+
+
Fix to geodesic circle drawing. They were not correctly distorted, leading to incorrect link ranges drawn on the map.
+
Bookmarks plugin: add layer and highlighter to indicate bookmarked portals
+
Player tracker plugin: markers fade for older activity, and separate layers for each faction
+
The 'About IITC' dialog now lists which plugins are installed. This may not work correctly for 3rd party plugins at this time
+
Mobile:
+
+
Custom fullscreen preferences
+
Install to SD Card
+
Cache move to SD card option (hence the new permissions)
+
+
+
... and, as always, various bugfixes and improvements.
+
+
+
+3RD PARTY PLUGIN AUTHORS: The plugin wrapper code has been modified to pass through the additioal version
+information. While existing plugins should continue to work, I highly recommend updating the wrapper code in your
+scripts to match.
16th October 2013
From c9f81807784e6daa09fa2ed05418eff47b26fc24 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 03:35:14 +0000
Subject: [PATCH 113/126] website: fix warnings when no popularity for an
entry, and whitespace removal
---
website/page/code/desktop-download.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/website/page/code/desktop-download.php b/website/page/code/desktop-download.php
index 7b18901d..6dab80da 100644
--- a/website/page/code/desktop-download.php
+++ b/website/page/code/desktop-download.php
@@ -25,7 +25,7 @@ function loadPopularity()
{
$items = explode ( ' ', $line );
$popularity[$items[0]] = (int)$items[1];
- }
+ }
}
return $popularity;
@@ -33,7 +33,7 @@ function loadPopularity()
function popularity_cmp ( $a, $b )
{
- if ( $a['popularity'] == $b['popularity'] )
+ if ( @$a['popularity'] == @$b['popularity'] )
return 0;
// sort from highest to lowest
return ($a['popularity'] > $b['popularity']) ? -1 : 1;
From 932cdcd842f619ec53897ac407ba9c1fc422a0bf Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 03:44:35 +0000
Subject: [PATCH 114/126] website: move page/code folder up a level
---
website/{page => }/code/apk/ApkParser.php | 0
website/{page => }/code/apk/lib/ApkAndroidPlatform.php | 0
website/{page => }/code/apk/lib/ApkArchive.php | 0
website/{page => }/code/apk/lib/ApkManifest.php | 0
website/{page => }/code/apk/lib/ApkManifestXmlElement.php | 0
website/{page => }/code/apk/lib/ApkStream.php | 0
website/{page => }/code/apk/lib/ApkXml.php | 0
website/{page => }/code/apk/lib/ApkXmlParser.php | 0
website/{page => }/code/desktop-download.php | 0
website/{page => }/code/mobile-download.php | 0
website/{page => }/code/url/CHANGELOG.txt | 0
website/{page => }/code/url/README.txt | 0
website/{page => }/code/url/url_to_absolute.php | 0
website/{page => }/code/userscript.php | 0
14 files changed, 0 insertions(+), 0 deletions(-)
rename website/{page => }/code/apk/ApkParser.php (100%)
rename website/{page => }/code/apk/lib/ApkAndroidPlatform.php (100%)
rename website/{page => }/code/apk/lib/ApkArchive.php (100%)
rename website/{page => }/code/apk/lib/ApkManifest.php (100%)
rename website/{page => }/code/apk/lib/ApkManifestXmlElement.php (100%)
rename website/{page => }/code/apk/lib/ApkStream.php (100%)
rename website/{page => }/code/apk/lib/ApkXml.php (100%)
rename website/{page => }/code/apk/lib/ApkXmlParser.php (100%)
rename website/{page => }/code/desktop-download.php (100%)
rename website/{page => }/code/mobile-download.php (100%)
rename website/{page => }/code/url/CHANGELOG.txt (100%)
rename website/{page => }/code/url/README.txt (100%)
rename website/{page => }/code/url/url_to_absolute.php (100%)
rename website/{page => }/code/userscript.php (100%)
diff --git a/website/page/code/apk/ApkParser.php b/website/code/apk/ApkParser.php
similarity index 100%
rename from website/page/code/apk/ApkParser.php
rename to website/code/apk/ApkParser.php
diff --git a/website/page/code/apk/lib/ApkAndroidPlatform.php b/website/code/apk/lib/ApkAndroidPlatform.php
similarity index 100%
rename from website/page/code/apk/lib/ApkAndroidPlatform.php
rename to website/code/apk/lib/ApkAndroidPlatform.php
diff --git a/website/page/code/apk/lib/ApkArchive.php b/website/code/apk/lib/ApkArchive.php
similarity index 100%
rename from website/page/code/apk/lib/ApkArchive.php
rename to website/code/apk/lib/ApkArchive.php
diff --git a/website/page/code/apk/lib/ApkManifest.php b/website/code/apk/lib/ApkManifest.php
similarity index 100%
rename from website/page/code/apk/lib/ApkManifest.php
rename to website/code/apk/lib/ApkManifest.php
diff --git a/website/page/code/apk/lib/ApkManifestXmlElement.php b/website/code/apk/lib/ApkManifestXmlElement.php
similarity index 100%
rename from website/page/code/apk/lib/ApkManifestXmlElement.php
rename to website/code/apk/lib/ApkManifestXmlElement.php
diff --git a/website/page/code/apk/lib/ApkStream.php b/website/code/apk/lib/ApkStream.php
similarity index 100%
rename from website/page/code/apk/lib/ApkStream.php
rename to website/code/apk/lib/ApkStream.php
diff --git a/website/page/code/apk/lib/ApkXml.php b/website/code/apk/lib/ApkXml.php
similarity index 100%
rename from website/page/code/apk/lib/ApkXml.php
rename to website/code/apk/lib/ApkXml.php
diff --git a/website/page/code/apk/lib/ApkXmlParser.php b/website/code/apk/lib/ApkXmlParser.php
similarity index 100%
rename from website/page/code/apk/lib/ApkXmlParser.php
rename to website/code/apk/lib/ApkXmlParser.php
diff --git a/website/page/code/desktop-download.php b/website/code/desktop-download.php
similarity index 100%
rename from website/page/code/desktop-download.php
rename to website/code/desktop-download.php
diff --git a/website/page/code/mobile-download.php b/website/code/mobile-download.php
similarity index 100%
rename from website/page/code/mobile-download.php
rename to website/code/mobile-download.php
diff --git a/website/page/code/url/CHANGELOG.txt b/website/code/url/CHANGELOG.txt
similarity index 100%
rename from website/page/code/url/CHANGELOG.txt
rename to website/code/url/CHANGELOG.txt
diff --git a/website/page/code/url/README.txt b/website/code/url/README.txt
similarity index 100%
rename from website/page/code/url/README.txt
rename to website/code/url/README.txt
diff --git a/website/page/code/url/url_to_absolute.php b/website/code/url/url_to_absolute.php
similarity index 100%
rename from website/page/code/url/url_to_absolute.php
rename to website/code/url/url_to_absolute.php
diff --git a/website/page/code/userscript.php b/website/code/userscript.php
similarity index 100%
rename from website/page/code/userscript.php
rename to website/code/userscript.php
From 2303ab193ef90d717f1dd08586b6636f337b663f Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 04:16:13 +0000
Subject: [PATCH 115/126] website: 1st pass at backend for version check plugin
---
.../index.php => versioncheck.php} | 37 ++++++++++++++++++-
1 file changed, 35 insertions(+), 2 deletions(-)
rename website/{versioncheck/index.php => versioncheck.php} (70%)
diff --git a/website/versioncheck/index.php b/website/versioncheck.php
similarity index 70%
rename from website/versioncheck/index.php
rename to website/versioncheck.php
index 831e199f..479d371c 100644
--- a/website/versioncheck/index.php
+++ b/website/versioncheck.php
@@ -1,8 +1,11 @@
Array ( # live release
'path' => 'release',
'name' => 'Stable release build',
+ 'web' => 'http://iitc.jonatkins.com/?page=download',
),
'jonatkins-test' => Array ( # public test builds
'path' => 'test',
'name' => 'Test build',
+ 'web' => 'http://iitc.jonatkins.com/?page=test',
),
'jonatkins-experimental' => Array ( # rarely used, for features not quite ready for 'test'
'path' => 'experimental',
'name' => 'Experimental build',
+ 'web' => 'http://iitc.jonatkins.com/?page=test&build=experimental',
),
'jonatkins-dev' => Array ( # personal
'path' => 'dev',
'name' => 'Development builds - not for public use',
+ 'web' => 'http://iitc.jonatkins.com/?page=test&build=dev',
),
'local' => Array ( # not a real build, but often the default for local development
@@ -37,9 +44,35 @@ if ( array_key_exists ( $build, $details ) )
{
$info = $details[$build];
- $response['buildPath'] = $info['path'];
+ $pageurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
+
$response['name'] = $info['name'];
+ $dir = $info['path'];
+
+ // load main script version
+ $iitc_details = loadUserScriptHeader ( "$dir/total-conversion-build.user.js" );
+ $response['iitc'] = Array (
+ 'version' => $iitc_details['@version'],
+ 'downloadUrl' => url_to_absolute ( $pageurl, "$dir/total-conversion-build.user.js" ),
+ 'pageUrl' => url_to_absolute ( $pageurl, $info['web'] ),
+ );
+
+ // and now the plugins
+
+ $response['plugins'] = Array();
+
+ foreach ( glob ( "$dir/plugins/*.user.js" ) as $path )
+ {
+ $basename = basename ( $path, ".user.js" );
+ $details = loadUserScriptHeader ( $path );
+
+ $response['plugins'][$basename] = Array (
+ 'version' => $details['@version'],
+ 'downloadUrl' => url_to_absolute ( $pageurl, "$dir/plugins/$basename.user.js" ),
+ 'pageUrl' => url_to_absolute ( $pageurl, $info['web']."#plugin-$basename" ),
+ );
+ }
}
else
From cc259b2da2d747956bd8e917930160357f3f8503 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 04:34:39 +0000
Subject: [PATCH 116/126] website: fix another warning that clutters the logs
---
website/code/desktop-download.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/website/code/desktop-download.php b/website/code/desktop-download.php
index 6dab80da..5f1046e1 100644
--- a/website/code/desktop-download.php
+++ b/website/code/desktop-download.php
@@ -36,7 +36,7 @@ function popularity_cmp ( $a, $b )
if ( @$a['popularity'] == @$b['popularity'] )
return 0;
// sort from highest to lowest
- return ($a['popularity'] > $b['popularity']) ? -1 : 1;
+ return (@$a['popularity'] > @$b['popularity']) ? -1 : 1;
}
From 0401d5dcc8957cb6680696a2cc209af134e64a2b Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 06:43:12 +0000
Subject: [PATCH 117/126] work in progress - update-check plugin data retrieved
- work on comparing with local version info started
---
plugins/update-check.user.js | 167 +++++++++++++++++++++++++++++++++++
1 file changed, 167 insertions(+)
create mode 100644 plugins/update-check.user.js
diff --git a/plugins/update-check.user.js b/plugins/update-check.user.js
new file mode 100644
index 00000000..29ea1a3a
--- /dev/null
+++ b/plugins/update-check.user.js
@@ -0,0 +1,167 @@
+// ==UserScript==
+// @id iitc-plugin-update-check@jonatkins
+// @name IITC plugin: Check for updates
+// @category Tweaks
+// @version 0.1.0.@@DATETIMEVERSION@@
+// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
+// @updateURL @@UPDATEURL@@
+// @downloadURL @@DOWNLOADURL@@
+// @description [@@BUILDNAME@@-@@BUILDDATE@@] Check for updates for IITC and plugins against http://iitc.jonatkins.com/. Can also report status messages for known IITC issues.
+// @include https://www.ingress.com/intel*
+// @include http://www.ingress.com/intel*
+// @match https://www.ingress.com/intel*
+// @match http://www.ingress.com/intel*
+// @grant none
+// ==/UserScript==
+
+@@PLUGINSTART@@
+
+// PLUGIN START ////////////////////////////////////////////////////////
+
+
+// use own namespace for plugin
+window.plugin.updateCheck = function() {};
+
+window.plugin.updateCheck.url = 'http://iitc.jonatkins.com/versioncheck.php?build=@@BUILDNAME@@';
+window.plugin.updateCheck.versionDataLoading = false;
+
+
+window.plugin.updateCheck.versionCompare = function(a,b) {
+ a = a.split('.');
+ b = b.split('.');
+
+ // adding dummy -1 entries to both split arrays simplifies comparisons
+ a.push(-1);
+ b.push(-1);
+
+ var minlen = Math.min(a.length, b.length);
+
+ for (var i=0; i0;
+ result.upToDate = result.comp==0;
+ result.localNewer = result.comp<0;
+
+
+ }
+
+ if (!result.localVersion) {
+
+ } else if (!result.webVersion) {
+ }
+
+ return result;
+}
+
+
+window.plugin.updateCheck.showReport = function(data) {
+ var result = 'WORK IN PROGRESS - NOT YET FUNCTIONAL';
+
+ if (data.error) {
+ result += '
Error checking for updates '+data.error+'
';
+ } else {
+ if (data.name) {
+ result += '
IITC update check: '+data.name+'
';
+ }
+
+ if (data.iitc && window.script_info) {
+
+ var compare = window.plugin.updateCheck.compareDetails(data.iitc, window.script_info);
+
+ result += '
IITC Main script: '+JSON.stringify(compare)+'
';
+
+ } else {
+ if (!data.iitc) {
+ result += '
Warning: no version information for main IITC script found in response
';
+ }
+ if (!window.script_info) {
+ result += '
Warning: your IITC script does not contain version data
';
+ }
+ }
+
+
+ }
+
+ dialog({
+ width: 500,
+ title: 'Update check',
+ html: result
+ });
+}
+
+
+window.plugin.updateCheck.open = function() {
+
+ // TODO? open a dialog/show a message indicating that the update check is in progress, before the data is loaded?
+ // TODO? prevent loading the version data every time - cache it, with a user option to force fresh data
+
+ window.plugin.updateCheck.loadVersionData();
+}
+
+
+
+window.plugin.updateCheck.setup = function() {
+ $('#toolbox').append(' Update check');
+};
+
+var setup = window.plugin.updateCheck.setup;
+
+// PLUGIN END //////////////////////////////////////////////////////////
+
+@@PLUGINEND@@
From 6ddbaf49591a2b53615ac7873cca8b9a0aa9a1dd Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 21:11:25 +0000
Subject: [PATCH 118/126] update check plugin - basic functionality now done
---
plugins/update-check.user.js | 71 ++++++++++++++++++++++++++++++------
1 file changed, 59 insertions(+), 12 deletions(-)
diff --git a/plugins/update-check.user.js b/plugins/update-check.user.js
index 29ea1a3a..f58cc1f3 100644
--- a/plugins/update-check.user.js
+++ b/plugins/update-check.user.js
@@ -71,15 +71,19 @@ window.plugin.updateCheck.versionDataCallback = function(data) {
s.parentNode.removeChild(s);
}
- dialog({
- text: JSON.stringify(data,null,2),
- title: 'debug version check',
- width: 700
- });
-
window.plugin.updateCheck.showReport(data);
}
+window.plugin.updateCheck.versionHTML = function(ver) {
+ var re = new RegExp ('^([0-9]+\\.[0-9]+\\.[0-9]+)(\\.2[0-9][0-9][0-9][01][0-9][0123][0-9]\\.[0-9]+)$');
+ var match = ver.match(re);
+ if (match) {
+ return match[1]+''+match[2]+'';
+ } else {
+ return ver;
+ }
+}
+
window.plugin.updateCheck.compareDetails = function(web_version, script_version) {
// compare the local script version data with the website version data
// and return an object with the results
@@ -101,9 +105,27 @@ window.plugin.updateCheck.compareDetails = function(web_version, script_version)
}
+ var webVerHTML = result.webVersion && window.plugin.updateCheck.versionHTML(result.webVersion);
+ var localVerHTML = result.localVersion && window.plugin.updateCheck.versionHTML(result.localVersion);
+ var webLinkInstallHTML = '';
+ if (result.downloadUrl && result.webUrl) {
+ webLinkInstallHTML = 'web '
+ + 'install';
+ }
+
if (!result.localVersion) {
-
+ result.html = 'version check failed '+webLinkInstallHTML;
} else if (!result.webVersion) {
+ result.html = 'version check failed';
+ } else if (result.upToDate) {
+ result.html = 'up to date';
+ } else if (result.outOfDate) {
+ result.html = 'out of date '+webLinkInstallHTML;
+ } else if (result.localNewer) {
+ result.html = localVerHTML+' is newer than '+webVerHTML+'(?!)';
+ } else {
+ console.warn ('Unknown case of version combinations!');
+ result.html = 'version check failed(!?)';
}
return result;
@@ -111,7 +133,7 @@ window.plugin.updateCheck.compareDetails = function(web_version, script_version)
window.plugin.updateCheck.showReport = function(data) {
- var result = 'WORK IN PROGRESS - NOT YET FUNCTIONAL';
+ var result = 'WORK IN PROGRESS';
if (data.error) {
result += '
Error checking for updates '+data.error+'
';
@@ -121,10 +143,8 @@ window.plugin.updateCheck.showReport = function(data) {
}
if (data.iitc && window.script_info) {
-
var compare = window.plugin.updateCheck.compareDetails(data.iitc, window.script_info);
-
- result += '
IITC Main script: '+JSON.stringify(compare)+'
';
+ result += '
IITC Main script: '+compare.html+'
';
} else {
if (!data.iitc) {
@@ -135,11 +155,38 @@ window.plugin.updateCheck.showReport = function(data) {
}
}
+ if (data.plugins && window.bootPlugins) {
+ result += '
Plugins:
';
+
+ if (window.bootPlugins.length == 0) {
+ result += '
No plugins installed
';
+ } else {
+ for (var i=0; i'+name+': '+compare.html+'';
+ } else {
+ result += '
'+name+': no version data on server(!?)
';
+ }
+ } else {
+ result += '
'+name+': non-standard plugin - cannot check version
';
+ }
+ }
+ }
+
+ result += '
';
+ }
}
dialog({
- width: 500,
+ width: 700,
title: 'Update check',
html: result
});
From f074085f22ec15e00e2496b44e53d35c9d2b1ff9 Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Wed, 30 Oct 2013 21:22:04 +0000
Subject: [PATCH 119/126] website: version check backend: remove json
formatting - was only used for debugging
---
website/versioncheck.php | 61 ----------------------------------------
1 file changed, 61 deletions(-)
diff --git a/website/versioncheck.php b/website/versioncheck.php
index 479d371c..35e24574 100644
--- a/website/versioncheck.php
+++ b/website/versioncheck.php
@@ -82,7 +82,6 @@ else
$data = json_encode ( $response );
-$data = indent($data);
# send the response - allow either jsonp (using a 'callback' parameter), or regular json
@@ -106,63 +105,3 @@ else
}
-// http://www.daveperrett.com/articles/2008/03/11/format-json-with-php/
-/**
- * Indents a flat JSON string to make it more human-readable.
- *
- * @param string $json The original JSON string to process.
- *
- * @return string Indented version of the original JSON string.
- */
-function indent($json) {
-
- $result = '';
- $pos = 0;
- $strLen = strlen($json);
- $indentStr = ' ';
- $newLine = "\n";
- $prevChar = '';
- $outOfQuotes = true;
-
- for ($i=0; $i<=$strLen; $i++) {
-
- // Grab the next character in the string.
- $char = substr($json, $i, 1);
-
- // Are we inside a quoted string?
- if ($char == '"' && $prevChar != '\\') {
- $outOfQuotes = !$outOfQuotes;
-
- // If this character is the end of an element,
- // output a new line and indent the next line.
- } else if(($char == '}' || $char == ']') && $outOfQuotes) {
- $result .= $newLine;
- $pos --;
- for ($j=0; $j<$pos; $j++) {
- $result .= $indentStr;
- }
- }
-
- // Add the character to the result string.
- $result .= $char;
-
- // If the last character was the beginning of an element,
- // output a new line and indent the next line.
- if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
- $result .= $newLine;
- if ($char == '{' || $char == '[') {
- $pos ++;
- }
-
- for ($j = 0; $j < $pos; $j++) {
- $result .= $indentStr;
- }
- }
-
- $prevChar = $char;
- }
-
- return $result;
-}
-
-?>
From c349991f53a49a939acacd1d33a1f34019e1ada1 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 30 Oct 2013 23:18:56 +0100
Subject: [PATCH 120/126] fake GM_info object
---
.../iitc_mobile/IITC_WebViewClient.java | 45 ++++++++++++++-----
1 file changed, 33 insertions(+), 12 deletions(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index 69a361d1..38f3e5ba 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -18,11 +18,15 @@ import android.widget.Toast;
import com.cradle.iitc_mobile.async.UrlContentToString;
+import org.json.JSONObject;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.ExecutionException;
@@ -48,23 +52,40 @@ public class IITC_WebViewClient extends WebViewClient {
}
public String getIITCVersion() {
+ HashMap map = getScriptInfo(mIitcScript);
+ return map.get("version");
+ }
+
+ public HashMap getScriptInfo(String js) {
+ HashMap map = new HashMap();
String header = "";
- if (mIitcScript != null) {
- header = mIitcScript.substring(mIitcScript.indexOf("==UserScript=="),
- mIitcScript.indexOf("==/UserScript=="));
+ if (js != null) {
+ header = js.substring(js.indexOf("==UserScript=="),
+ js.indexOf("==/UserScript=="));
}
// remove new line comments
- header = header.replace("\n//", "");
+ header = header.replace("\n//", " ");
// get a list of key-value
- String[] attributes = header.split(" +");
+ String[] attributes = header.split(" +");
String iitc_version = "not found";
for (int i = 0; i < attributes.length; i++) {
- // search for version and use the value
+ // search for attributes and use the value
if (attributes[i].equals("@version")) {
- iitc_version = attributes[i + 1];
+ map.put("version", attributes[i + 1]);
+ }
+ if (attributes[i].equals("@name")) {
+ map.put("name", attributes[i + 1]);
+ }
+ if (attributes[i].equals("@description")) {
+ map.put("description", attributes[i + 1]);
}
}
- return iitc_version;
+ return map;
+ }
+
+ public String getGmInfoJson(HashMap map) {
+ JSONObject jObject = new JSONObject(map);
+ return "{\"script\":" + jObject.toString() + "}";
}
public void loadIITC_JS(Context c) throws java.io.IOException {
@@ -131,9 +152,8 @@ public class IITC_WebViewClient extends WebViewClient {
"window.showLayerChooser = false");
}
- // IITC expects to be injected after the DOM has been loaded completely.
- // since it is injected with the onPageFinished() event, no further delay is necessary.
- this.mIitcScript = js;
+ String gmInfo = "GM_info=" + getGmInfoJson(getScriptInfo(js)).toString() + "\n";
+ this.mIitcScript = gmInfo + js;
}
@@ -205,7 +225,8 @@ public class IITC_WebViewClient extends WebViewClient {
if (js.equals("false")) {
return false;
} else {
- view.loadUrl("javascript:" + js);
+ String gmInfo = "GM_info=" + getGmInfoJson(getScriptInfo(js)) + "\n";
+ view.loadUrl("javascript:" + gmInfo + js);
}
return true;
}
From bb4d57acad77ac409ecaedb908a569ea407e15e1 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 30 Oct 2013 23:21:27 +0100
Subject: [PATCH 121/126] - added getVersionName() to JSInterface - use
versionName in IITC About dialog
---
code/utils_misc.js | 2 +-
.../com/cradle/iitc_mobile/IITC_JSInterface.java | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/code/utils_misc.js b/code/utils_misc.js
index 5ca68549..996580c1 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -3,7 +3,7 @@
window.aboutIITC = function() {
var v = (script_info.script && script_info.script.version || script_info.dateTimeVersion) + ' ['+script_info.buildName+']';
if (typeof android !== 'undefined' && android && android.getVersionCode) {
- v += '[IITC Mobile '+android.getVersionCode()+']';
+ v += '[IITC Mobile '+android.getVersionName()+']';
}
var plugins = '
';
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java
index 93873162..9c385881 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java
@@ -76,6 +76,19 @@ public class IITC_JSInterface {
return versionCode;
}
+ @JavascriptInterface
+ public String getVersionName() {
+ String buildVersion = "unknown";
+ PackageManager pm = mIitc.getPackageManager();
+ try {
+ PackageInfo info = pm.getPackageInfo(mIitc.getPackageName(), 0);
+ buildVersion = info.versionName;
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ return buildVersion;
+ }
+
@JavascriptInterface
public void switchToPane(final String id) {
mIitc.runOnUiThread(new Runnable() {
From 3f901a588a5cae7070e5a18df59c241922dec4f4 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 30 Oct 2013 23:45:59 +0100
Subject: [PATCH 122/126] made getScriptInfo static and use it in
pluginpreferenceactivity
---
.../IITC_PluginPreferenceActivity.java | 30 +++++--------------
.../iitc_mobile/IITC_WebViewClient.java | 13 ++++++--
2 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
index 02ac8ddd..78736a9e 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_PluginPreferenceActivity.java
@@ -21,6 +21,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
@@ -193,29 +194,12 @@ public class IITC_PluginPreferenceActivity extends PreferenceActivity {
void addPluginPreference(String src, String plugin_key, boolean user) {
- // now parse plugin name, description and category
- String header = src.substring(src.indexOf("==UserScript=="),
- src.indexOf("==/UserScript=="));
- // remove new line comments and replace with space
- // this way we get double spaces instead of newline + double slash
- header = header.replace("\n//", " ");
- // get a list of key-value...split on multiple spaces
- String[] attributes = header.split(" +");
- String plugin_name = "not found";
- String plugin_desc = "not found";
- String plugin_cat = "Misc";
- for (int j = 0; j < attributes.length; j++) {
- // search for name and use the value
- if (attributes[j].equals("@name")) {
- plugin_name = attributes[j + 1];
- }
- if (attributes[j].equals("@description")) {
- plugin_desc = attributes[j + 1];
- }
- if (attributes[j].equals("@category")) {
- plugin_cat = attributes[j + 1];
- }
- }
+ // parse plugin name, description and category
+ // we need default versions here otherwise iitcm may crash
+ HashMap info = IITC_WebViewClient.getScriptInfo(src);
+ String plugin_name = info.get("name");
+ String plugin_cat = info.get("category");
+ String plugin_desc = info.get("description");
// remove IITC plugin prefix from plugin_name
plugin_name = plugin_name.replace("IITC Plugin: ", "");
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
index 38f3e5ba..1749b3a9 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java
@@ -56,7 +56,8 @@ public class IITC_WebViewClient extends WebViewClient {
return map.get("version");
}
- public HashMap getScriptInfo(String js) {
+ // static method because we use it in IITC_PluginPreferenceActivity too
+ public static HashMap getScriptInfo(String js) {
HashMap map = new HashMap();
String header = "";
if (js != null) {
@@ -67,7 +68,12 @@ public class IITC_WebViewClient extends WebViewClient {
header = header.replace("\n//", " ");
// get a list of key-value
String[] attributes = header.split(" +");
- String iitc_version = "not found";
+ // add default values
+ map.put("version", "not found");
+ map.put("name", "unknown");
+ map.put("description", "");
+ map.put("category", "Misc");
+ // add parsed values
for (int i = 0; i < attributes.length; i++) {
// search for attributes and use the value
if (attributes[i].equals("@version")) {
@@ -79,6 +85,9 @@ public class IITC_WebViewClient extends WebViewClient {
if (attributes[i].equals("@description")) {
map.put("description", attributes[i + 1]);
}
+ if (attributes[i].equals("@category")) {
+ map.put("category", attributes[i + 1]);
+ }
}
return map;
}
From 3fba33b1ff6ec0dd351067e9f5e88aa19e6820b3 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Wed, 30 Oct 2013 23:56:07 +0100
Subject: [PATCH 123/126] bumped version number
---
mobile/AndroidManifest.xml | 4 ++--
mobile/build-test.xml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml
index e09e2f20..10f69ab0 100644
--- a/mobile/AndroidManifest.xml
+++ b/mobile/AndroidManifest.xml
@@ -2,8 +2,8 @@
+ android:versionCode="58"
+ android:versionName="0.8">
From 1d838568a0ed759a20e43aa660334fdbe00af6a6 Mon Sep 17 00:00:00 2001
From: Philipp Schaefer
Date: Thu, 31 Oct 2013 00:11:26 +0100
Subject: [PATCH 124/126] use correct function name in if statement
---
code/utils_misc.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/utils_misc.js b/code/utils_misc.js
index 996580c1..0a99019e 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -2,7 +2,7 @@
window.aboutIITC = function() {
var v = (script_info.script && script_info.script.version || script_info.dateTimeVersion) + ' ['+script_info.buildName+']';
- if (typeof android !== 'undefined' && android && android.getVersionCode) {
+ if (typeof android !== 'undefined' && android && android.getVersionName) {
v += '[IITC Mobile '+android.getVersionName()+']';
}
From 0e4efe49ed1667c42cbe31c064fb0ca11162d05d Mon Sep 17 00:00:00 2001
From: Jon Atkins
Date: Thu, 31 Oct 2013 06:47:04 +0000
Subject: [PATCH 125/126] update check plugin: change to table layout, change
category - still not finished...
---
plugins/update-check.user.js | 80 +++++++++++++++++++++++++++---------
1 file changed, 61 insertions(+), 19 deletions(-)
diff --git a/plugins/update-check.user.js b/plugins/update-check.user.js
index f58cc1f3..e144332d 100644
--- a/plugins/update-check.user.js
+++ b/plugins/update-check.user.js
@@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-update-check@jonatkins
// @name IITC plugin: Check for updates
-// @category Tweaks
+// @category Misc
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
@@ -107,20 +107,21 @@ window.plugin.updateCheck.compareDetails = function(web_version, script_version)
var webVerHTML = result.webVersion && window.plugin.updateCheck.versionHTML(result.webVersion);
var localVerHTML = result.localVersion && window.plugin.updateCheck.versionHTML(result.localVersion);
- var webLinkInstallHTML = '';
- if (result.downloadUrl && result.webUrl) {
- webLinkInstallHTML = 'web '
- + 'install';
- }
+
+// var webLinkInstallHTML = '';
+// if (result.downloadUrl && result.webUrl) {
+// webLinkInstallHTML = 'web '
+// + 'install';
+// }
if (!result.localVersion) {
- result.html = 'version check failed '+webLinkInstallHTML;
+ result.html = 'version check failed';
} else if (!result.webVersion) {
result.html = 'version check failed';
} else if (result.upToDate) {
result.html = 'up to date';
} else if (result.outOfDate) {
- result.html = 'out of date '+webLinkInstallHTML;
+ result.html = 'out of date';
} else if (result.localNewer) {
result.html = localVerHTML+' is newer than '+webVerHTML+'(?!)';
} else {
@@ -156,31 +157,72 @@ window.plugin.updateCheck.showReport = function(data) {
}
if (data.plugins && window.bootPlugins) {
- result += '
Plugins:
';
+
+ var plugins = { upToDate: [], outOfDate: [], other: [] };
if (window.bootPlugins.length == 0) {
result += '
No plugins installed
';
} else {
for (var i=0; i'+name+': '+compare.html+'';
- } else {
- result += '