From 7d8e583273823cace077f2a6d2c2592d044e65c8 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 16 Aug 2013 17:34:59 +0100 Subject: [PATCH 1/8] increase refresh delays after a move, and repeated refresh limit, to reduce unnecessary requests to the servers --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 1bdbda5c..199a8db8 100644 --- a/main.js +++ b/main.js @@ -117,8 +117,8 @@ L_PREFER_CANVAS = false; // CONFIG OPTIONS //////////////////////////////////////////////////// window.REFRESH = 60; // refresh view every 30s (base time) window.ZOOM_LEVEL_ADJ = 5; // add 5 seconds per zoom level -window.ON_MOVE_REFRESH = 1.25; //refresh time to use after a movement event -window.MINIMUM_OVERRIDE_REFRESH = 5; //limit on refresh time since previous refresh, limiting repeated move refresh rate +window.ON_MOVE_REFRESH = 2.5; //refresh time to use after a movement event +window.MINIMUM_OVERRIDE_REFRESH = 10; //limit on refresh time since previous refresh, limiting repeated move refresh rate window.REFRESH_GAME_SCORE = 15*60; // refresh game score every 15 minutes window.MAX_IDLE_TIME = 4*60; // stop updating map after 4min idling window.PRECACHE_PLAYER_NAMES_ZOOM = 17; // zoom level to start pre-resolving player names From 92433c5d4ba29060b4318b209712cf036132a344 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 16 Aug 2013 17:36:17 +0100 Subject: [PATCH 2/8] merge patch from #491, that updates things to getThinnedEntitiesV4 also a couple of plugins that were missed --- code/map_data.js | 6 +++--- code/map_data_calc_tools.js | 8 ++++---- code/portal_render_limit.js | 2 +- plugins/ap-list.user.js | 4 ++-- plugins/show-linked-portals.user.js | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index b2a60a47..1216dae0 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -216,12 +216,12 @@ window.requestData = function() { return 0; }); - data = { zoom: z }; + data = { }; data.boundsParamsList = tls; // keep a list of tile_ids with each request. in the case of a server error, we can try and use cached tiles if available var tile_ids = [] $.each(tls,function(i,req) { tile_ids.push(req.qk); }); - window.requests.add(window.postAjax('getThinnedEntitiesV3', data, function(data, textStatus, jqXHR) { window.handleDataResponse(data,false,tile_ids); }, function() { window.handleFailedRequest(tile_ids); })); + window.requests.add(window.postAjax('getThinnedEntitiesV4', data, function(data, textStatus, jqXHR) { window.handleDataResponse(data,false,tile_ids); }, function() { window.handleFailedRequest(tile_ids); })); }); // process the requests from the cache @@ -255,7 +255,7 @@ window.handleFailedRequest = function(tile_ids) { handleDataResponse(cachedData, true); } - if(requests.isLastRequest('getThinnedEntitiesV3')) { + if(requests.isLastRequest('getThinnedEntitiesV4')) { var leftOverPortals = portalRenderLimit.mergeLowLevelPortals(null); handlePortalsRender(leftOverPortals); } diff --git a/code/map_data_calc_tools.js b/code/map_data_calc_tools.js index 33e444cb..8f845c5e 100644 --- a/code/map_data_calc_tools.js +++ b/code/map_data_calc_tools.js @@ -10,20 +10,20 @@ // http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames window.lngToTile = function(lng, zoom) { - return Math.floor((lng + 180) / 360 * Math.pow(2, zoom)); + return Math.floor((lng + 180) / 360 * Math.pow(2, (zoom>12)?zoom:(zoom+2))); } window.latToTile = function(lat, zoom) { 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)); + 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, (zoom>12)?zoom:(zoom+2))); } window.tileToLng = function(x, zoom) { - return x / Math.pow(2, zoom) * 360 - 180; + return x / Math.pow(2, (zoom>12)?zoom:(zoom+2)) * 360 - 180; } window.tileToLat = function(y, zoom) { - var n = Math.PI - 2 * Math.PI * y / Math.pow(2, zoom); + var n = Math.PI - 2 * Math.PI * y / Math.pow(2, (zoom>12)?zoom:(zoom+2)); return 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n))); } diff --git a/code/portal_render_limit.js b/code/portal_render_limit.js index 299f28cf..cd1f4cb5 100644 --- a/code/portal_render_limit.js +++ b/code/portal_render_limit.js @@ -98,7 +98,7 @@ window.portalRenderLimit.splitOrMergeLowLevelPortals = function(originPortals) { portalRenderLimit.resetCounting(); portalRenderLimit.countingPortals(originPortals); - var resultPortals = requests.isLastRequest('getThinnedEntitiesV3') + var resultPortals = requests.isLastRequest('getThinnedEntitiesV4') ? portalRenderLimit.mergeLowLevelPortals(originPortals) : portalRenderLimit.splitLowLevelPortals(originPortals); diff --git a/plugins/ap-list.user.js b/plugins/ap-list.user.js index a3b44411..c10fe9fb 100644 --- a/plugins/ap-list.user.js +++ b/plugins/ap-list.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-ap-list@xelio // @name IITC plugin: AP List // @category Info -// @version 0.5.4.@@DATETIMEVERSION@@ +// @version 0.5.5.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -54,7 +54,7 @@ window.plugin.apList.animTimeout; // ENTRY POINT /////////////////////////////////////////////////////////////////// window.plugin.apList.handleUpdate = function() { - if(!requests.isLastRequest('getThinnedEntitiesV3')) return; + if(!requests.isLastRequest('getThinnedEntitiesV4')) return; plugin.apList.updateSortedPortals(); plugin.apList.updatePortalTable(plugin.apList.displaySide); } diff --git a/plugins/show-linked-portals.user.js b/plugins/show-linked-portals.user.js index a69f7a90..75ef6ba8 100644 --- a/plugins/show-linked-portals.user.js +++ b/plugins/show-linked-portals.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-show-linked-portals@fstopienski // @name IITC plugin: Show linked portals // @category Portal Info -// @version 0.0.6.@@DATETIMEVERSION@@ +// @version 0.0.7.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -29,7 +29,7 @@ window.plugin.showLinkedPortal = function () { }; window.plugin.showLinkedPortal.handleUpdate = function () { - if (!requests.isLastRequest('getThinnedEntitiesV3')) { + if (!requests.isLastRequest('getThinnedEntitiesV4')) { return; } } From 3f1b8ba47f1a138b514c36202eed26d424019e96 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 16 Aug 2013 17:41:25 +0100 Subject: [PATCH 3/8] increase refresh timeout considerably when zoomed out. this will reduce requests to the servers when lots of data is visible also, with the new higher tile count when zoomed out (#491) it reduces the odds of a new refresh starting before the old ones have finished --- code/request_handling.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/request_handling.js b/code/request_handling.js index 90368909..722333b2 100644 --- a/code/request_handling.js +++ b/code/request_handling.js @@ -121,7 +121,14 @@ window.startRefreshTimeout = function(override) { } else { window.requests._quickRefreshPending = false; t = REFRESH*1000; - var adj = ZOOM_LEVEL_ADJ * (18 - window.map.getZoom()); + + // new getThinnedEntitiesV4 involves a LOT more requests when zoomed out above a data level of 13 + // so, to give the refresh a chance to complete (and also reduce load on niantic servers), boost the refresh interval + // in this case + // (TODO: complete rewrite of refresh+request handling. don't start timer until complete, and retry error=TIMEOUT requests) + if (getPortalDataZoom() <=12 ) t = t*4; + + var adj = ZOOM_LEVEL_ADJ * (18 - getPortalDataZoom()); if(adj > 0) t += adj*1000; } var next = new Date(new Date().getTime() + t).toLocaleTimeString(); From 532d8aaa2639bc7bac1e53522ca5775cd1a163e1 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 16 Aug 2013 18:25:53 +0100 Subject: [PATCH 4/8] bump version number, as another IITC release is required... --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 199a8db8..d8149c34 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.13.2.@@DATETIMEVERSION@@ +// @version 0.13.3.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ From 9f077dd6a2bfaad9159d2871b97edcbfd1a7ec6c Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 16 Aug 2013 18:37:22 +0100 Subject: [PATCH 5/8] show more portals plugin: don't boost zoom level when zoomed out - gets silly with the new getThinnedEntitiesV4 changes --- plugins/show-more-portals.user.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/show-more-portals.user.js b/plugins/show-more-portals.user.js index 8006ff2e..26b3a6d6 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.1.@@DATETIMEVERSION@@ +// @version 0.1.2.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -35,7 +35,9 @@ window.plugin.showMorePortals.setup = function() { // yes, it is possible to increase this beyond "+1" - however, that will end up producing a rediculous number // of requests to the Niantic servers, giving many request failed errors/tile timeouts // (every increase by one requests four times as many data tiles) - var z = mapZoom + 1; + // UPDATE: due to the new smaller tiles used when zoomed out further (getThinnedEntitiesV4), it gets silly + // doing this when zoomed out. so only boost when zoomed in + var z = mapZoom > 12 ? mapZoom + 1 : mapZoom; // 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?) From 56af2b887d7899156040e534f2fa11e244401660 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 16 Aug 2013 18:50:40 +0100 Subject: [PATCH 6/8] bump android version number - required for f-droid build, and to reduce user confusion --- mobile/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index a5af95cf..3b4838a1 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="37" + android:versionName="0.5.4.2"> Date: Fri, 16 Aug 2013 18:55:16 +0100 Subject: [PATCH 7/8] update website for new 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 3a5c897b..de020dce 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

+

16th August 2013

+

+IITC 0.13.3 and IITC Mobile 0.5.4.2 have been released. This is another critical update required to work +with another change Niantic have made to the standard intel site. +

+

14th August 2013

IITC 0.13.2 and IITC Mobile 0.5.4.1 have been released. This is a critical release required to work with diff --git a/website/page/news.php b/website/page/news.php index 6ffd5252..77edbe72 100644 --- a/website/page/news.php +++ b/website/page/news.php @@ -1,5 +1,11 @@

News

+

16th August 2013

+

+IITC 0.13.3 and IITC Mobile 0.5.4.2 have been released. This is another critical update required to work +with another change Niantic have made to the standard intel site. +

+

14th August 2013

IITC 0.13.2 and IITC Mobile 0.5.4.1 have been released. This is a critical release required to work with From 17167a592d96abfe50249b9d9d7c26ec859aa42f Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sat, 17 Aug 2013 18:56:51 +0100 Subject: [PATCH 8/8] update descriptions for keys + keys-on-map plugins - hopefully will reduce user confusion --- plugins/keys-on-map.user.js | 2 +- plugins/keys.user.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/keys-on-map.user.js b/plugins/keys-on-map.user.js index fb495552..094b806c 100644 --- a/plugins/keys-on-map.user.js +++ b/plugins/keys-on-map.user.js @@ -6,7 +6,7 @@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ -// @description [@@BUILDNAME@@-@@BUILDDATE@@] Show keys in keys plugin on map. +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Show the manually entered key counts from keys plugin on the map. // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* diff --git a/plugins/keys.user.js b/plugins/keys.user.js index 22f4d1d2..bd9984a7 100644 --- a/plugins/keys.user.js +++ b/plugins/keys.user.js @@ -6,7 +6,7 @@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ -// @description [@@BUILDNAME@@-@@BUILDDATE@@] Store portal keys. Install the 'Sync' plugin to sync the keys between clients. +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Allow manual entry of key counts for each portal. Use 'keys-on-map' to show the numbers on the map, and 'sync' to share between multiple browsers or desktop/mobile. // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel*