diff --git a/README.md b/README.md
index 8bd6ebb4..0aa40d4b 100644
--- a/README.md
+++ b/README.md
@@ -40,9 +40,7 @@ Current version is 0.7.8. [See NEWS.md for details](https://github.com/breunigs/
- Confirm once again.
- Reload page.
-**NOTE: You still need to manually update IITC with Tampermonkey.** There is a bug in the current stable release. It has been fixed in Tampermonkey’s development version. Until it is released, you need to manually update IITC.
-
-*Note:* Tampermonkey is optional. However, it ~~offers auto-update~~, shows correct version numbers and installing user scripts is much easier. If you have installed the scripts directly into Chrome before, I recommend you switch to Tampermonkey. To do so, uninstall the IITC scripts and click each install link again. Follow the procedure explained above.
+*Note:* Tampermonkey is optional. However, it offers auto-update, shows correct version numbers and installing user scripts is much easier. If you have installed the scripts directly into Chrome before, I recommend you switch to Tampermonkey. To do so, uninstall the IITC scripts and click each install link again. Follow the procedure explained above.
### Opera
- Download the script: [download](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/total-conversion-build.user.js)
@@ -93,7 +91,8 @@ First of all, it’s very nice you want to help. There are several equally impor
[tpenner](https://github.com/tpenner),
[vita10gy](https://github.com/vita10gy),
[Xelio](https://github.com/Xelio),
-[ZauberNerd](https://github.com/ZauberNerd)
+[ZauberNerd](https://github.com/ZauberNerd),
+[waynn](https://github.com/waynn)
Attribution & License
diff --git a/USERGUIDE.md b/USERGUIDE.md
index 089d78b5..7810daec 100644
--- a/USERGUIDE.md
+++ b/USERGUIDE.md
@@ -21,8 +21,8 @@ General Usage
-------------
- many things have more information in tooltips. Let your cursor rest over stuff to show the tooltip. *Hint:* your cursor changes into a question mark / help cursor if there’s a tooltip available.
-- single left click on portals to show details
-- double left click on portals to zoom in to them
+- single left click on portals to show details.
+- double left click on portals to zoom in to them.
Chat
@@ -37,7 +37,7 @@ The chat is split up into several categories. It usually only shows messages for
- faction: shows messages for own faction (e.g. only Resistance can read Resistance messages)
**Posting messages:**
-- You can post in the faction and public categories only
+- You can post in the faction and public categories only.
- Your message will be tagged with the coordinates in the center of the map.
- Your zoom level does not matter. Zooming out will not show your messages to more users.
@@ -62,7 +62,7 @@ Resonators are shown at their actual positions if you zoom in close enough. They
They are handled the same way portals are, see above.
**Other:**
-When you select a portal its outer ring becomes red. There’s also a small yellow circle around it which depicts the hack range. You need to be in hack range to hack the portal or update its resonators or mods.
+When you select a portal its outer ring becomes red. There’s also a small yellow circle around it which depicts the hack range. You need to be in hack range to hack the portal or upgrade its resonators or mods.
If you are zoomed out quite a bit, there’s a larger red circle. This is the link range. Only portals within this link range can be linked while standing at the selected portal. [Click the range in the sidebar to zoom to link range for the selected portal](#random-details).
@@ -72,7 +72,7 @@ If you are zoomed out quite a bit, there’s a larger red circle. This is the li
Map Status / Updates
--------------------
-It shows if there are currently operations pending. This includes chat updates as well as map data requests. Updates happen every 45s to 90s, depending on how far zoomed in you are. Zoom in closer for faster updates.
+It shows if there are operations currently pending. This includes chat updates as well as map data requests. Updates happen every 45s to 90s, depending on how far zoomed in you are. Zoom in closer for faster updates.
It also shows which portals are being loaded/shown. Zoom in to see lower level portals. This is a limit of the server and not IITC. Portals levels that cannot be shown are also striked through in the layer chooser.
@@ -88,11 +88,11 @@ Sidebar
The sidebar is mainly used to show game stats and portal details. However, it also allows you to perform certain actions.
### General usage:
-- single click a portal to show details about it in the sidebar
+- single click a portal to show details about it in the sidebar.
- the portal information is updated automatically, as long as the selected portal is kept in view and you do not zoom out too much.
- the sidebar may be collapsed. Click the triangle button that stands out at the left hand side.
- the sidebar **can be scrolled** if your screen is too small. Use your scroll wheel.
-- almost anything has tooltips. See [General usage](#general-usage) above.
+- almost everything has tooltips. See [General usage](#general-usage) above.
### Details:
Starting from the top, the sidebar shows this information:
diff --git a/code/chat.js b/code/chat.js
index a95b56ad..6faea140 100644
--- a/code/chat.js
+++ b/code/chat.js
@@ -279,8 +279,14 @@ window.chat.writeDataToHash = function(newData, storageHash, skipSecureMsgs) {
case 'PORTAL':
var latlng = [markup[1].latE6/1E6, markup[1].lngE6/1E6];
- var js = 'window.zoomToAndShowPortal(\''+markup[1].guid+'\', ['+latlng[0]+', '+latlng[1]+'])';
- msg += ''+markup[1].name+'';
+ var perma = 'https://ingress.com/intel?latE6='+markup[1].latE6+'&lngE6='+markup[1].lngE6+'&z=17&pguid='+markup[1].guid;
+ var js = 'window.zoomToAndShowPortal(\''+markup[1].guid+'\', ['+latlng[0]+', '+latlng[1]+']);return false';
+
+ msg += ''
+ + markup[1].name
+ + '';
break;
case 'SECURE':
diff --git a/code/map_data.js b/code/map_data.js
index 196a975e..363240c4 100644
--- a/code/map_data.js
+++ b/code/map_data.js
@@ -43,6 +43,8 @@ window.requestData = function() {
}
}
+ // Reset previous result of Portal Render Limit handler
+ portalRenderLimit.init();
// finally send ajax requests
$.each(tiles, function(ind, tls) {
data = { minLevelOfDetail: -1 };
@@ -70,6 +72,8 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
// https://github.com/Leaflet/Leaflet/issues/185
var ppp = [];
var p2f = {};
+ // Reset new portals count of Portal Render Limit handler
+ portalRenderLimit.resetCounting();
$.each(m, function(qk, val) {
$.each(val.deletedGameEntityGuids, function(ind, guid) {
if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {
@@ -98,7 +102,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
) return;
-
+ portalRenderLimit.pushPortal(ent);
ppp.push(ent); // delay portal render
} else if(ent[2].edge !== undefined) {
renderLink(ent);
@@ -147,6 +151,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) {
if(portalUpdateAvailable) renderPortalDetails(selectedPortal);
resolvePlayerNames();
+ renderUpdateStatus();
}
// removes entities that are still handled by Leaflet, although they
diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js
index 7ef28a6b..e73a664a 100644
--- a/code/portal_detail_display.js
+++ b/code/portal_detail_display.js
@@ -50,7 +50,7 @@ window.renderPortalDetails = function(guid) {
var lat = d.locationE6.latE6;
var lng = d.locationE6.lngE6;
- var perma = 'http://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
+ var perma = 'https://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
var imgTitle = 'title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."';
var poslinks = 'window.showPortalPosLinks('+lat/1E6+','+lng/1E6+')';
var postcard = 'Send in a postcard. Will put it online after receiving. Address:\\n\\nStefan Breunig\\nINF 305 – R045\\n69120 Heidelberg\\nGermany';
diff --git a/code/portal_render_limit.js b/code/portal_render_limit.js
new file mode 100644
index 00000000..58961023
--- /dev/null
+++ b/code/portal_render_limit.js
@@ -0,0 +1,80 @@
+
+// PORTAL RENDER LIMIT HANDLER ///////////////////////////////////////
+// Functions to handle hiding low level portal when portal render
+// limit is reached.
+//
+// After initialized and reset in window.requestData(), portals in
+// response data will pass to function "pushPortal". Each new portal
+// not on the map will add 1 to newPortalsPerLevel[portal level].
+//
+// "getMinLevel" will be called by "getMinPortalLevel" in utils_misc.js
+// to determine min portal level to draw on map.
+//
+// "getMinLevel" will return minLevel and call "setMinLevel" if
+// minLevel hasn't set yet.
+//
+// In "setMinLevel", it will loop through all portal level from
+// high to low, and sum total portal count (old + new) to check
+// minLevel.
+//
+// In each call of window.handleDataResponse(), it will call
+// "resetCounting" to reset previous response data. But minLevel
+// is preserved and only replaced when render limit reached in
+// higher level, until next window.requestData() called and reset.
+//
+
+window.portalRenderLimit = function() {}
+
+window.portalRenderLimit.initialized = false;
+window.portalRenderLimit.minLevelSet = false;
+window.portalRenderLimit.minLevel = -1;
+window.portalRenderLimit.newPortalsPerLevel = new Array(MAX_PORTAL_LEVEL + 1);
+
+window.portalRenderLimit.init = function () {
+ portalRenderLimit.initialized = true;
+ portalRenderLimit.minLevel = -1;
+ portalRenderLimit.resetCounting();
+}
+
+window.portalRenderLimit.resetCounting = function() {
+ portalRenderLimit.minLevelSet = false;
+ for(var i = 0; i <= MAX_PORTAL_LEVEL; i++) {
+ portalRenderLimit.newPortalsPerLevel[i] = 0;
+ }
+}
+
+window.portalRenderLimit.pushPortal = function(ent) {
+ var portalGuid = ent[0];
+ var portalLevel = parseInt(getPortalLevel(ent[2]));
+ var layerGroup = portalsLayers[portalLevel];
+
+ if(findEntityInLeaflet(layerGroup, window.portals, ent[0])) return;
+ portalRenderLimit.newPortalsPerLevel[portalLevel]++;
+}
+
+window.portalRenderLimit.getMinLevel = function() {
+ if(!portalRenderLimit.initialized) return -1;
+ if(!portalRenderLimit.minLevelSet) portalRenderLimit.setMinLevel();
+ return portalRenderLimit.minLevel;
+}
+
+window.portalRenderLimit.setMinLevel = function() {
+ var totalPortalsCount = 0;
+ var newMinLevel = MAX_PORTAL_LEVEL + 1;
+
+ // Find the min portal level under render limit
+ while(newMinLevel > 0) {
+ var oldPortalCount = layerGroupLength(portalsLayers[newMinLevel - 1]);
+ var newPortalCount = portalRenderLimit.newPortalsPerLevel[newMinLevel - 1];
+ totalPortalsCount += oldPortalCount + newPortalCount;
+ if(totalPortalsCount >= MAX_DRAWN_PORTALS)
+ break;
+ newMinLevel--;
+ }
+
+ // If render limit reached at max portal level, still let portal at max level render
+ newMinLevel = Math.min(newMinLevel, MAX_PORTAL_LEVEL);
+
+ portalRenderLimit.minLevel = Math.max(newMinLevel, portalRenderLimit.minLevel);
+ portalRenderLimit.minLevelSet = true;
+}
diff --git a/code/utils_misc.js b/code/utils_misc.js
index efa688db..1e5e0a87 100644
--- a/code/utils_misc.js
+++ b/code/utils_misc.js
@@ -2,6 +2,14 @@
// UTILS + MISC ///////////////////////////////////////////////////////
+window.layerGroupLength = function(layerGroup) {
+ var layersCount = 0;
+ var layers = layerGroup._layers;
+ if (layers)
+ layersCount = Object.keys(layers).length;
+ return layersCount;
+}
+
// retrieves parameter from the URL?query=string.
window.getURLParam = function(param) {
var v = document.URL;
@@ -152,7 +160,11 @@ window.getMinPortalLevel = function() {
var z = map.getZoom();
if(z >= 16) return 0;
var conv = ['impossible', 8,7,7,6,6,5,5,4,4,3,3,2,2,1,1];
- return conv[z];
+ var minLevelByRenderLimit = portalRenderLimit.getMinLevel();
+ var result = minLevelByRenderLimit > conv[z]
+ ? minLevelByRenderLimit
+ : conv[z];
+ return result;
}
// returns number of pixels left to scroll down before reaching the
diff --git a/main.js b/main.js
index b81d601d..7553fd48 100644
--- a/main.js
+++ b/main.js
@@ -188,6 +188,7 @@ window.DESTROY_FIELD = 750; //AP for destroying field
window.CAPTURE_PORTAL = 500; //AP for capturing a portal
window.DEPLOY_RESONATOR = 125; //AP for deploying a resonator
window.COMPLETION_BONUS = 250; //AP for deploying all resonators on portal
+window.MAX_PORTAL_LEVEL = 8;
// OTHER MORE-OR-LESS CONSTANTS //////////////////////////////////////
window.TEAM_NONE = 0;