diff --git a/CONTRIBS.md b/CONTRIBS.md index 5e0e2a68..0cfccf65 100644 --- a/CONTRIBS.md +++ b/CONTRIBS.md @@ -4,6 +4,7 @@ So far, these people have contributed: [blakjakau](https://github.com/blakjakau), [boombuler](https://github.com/boombuler), [breunigs](https://github.com/breunigs), +[cathesaurus](https://github.com/cathesaurus), [ccjon](https://github.com/ccjon), [cmrn](https://github.com/cmrn), [epf](https://github.com/epf), @@ -25,4 +26,4 @@ So far, these people have contributed: [vita10gy](https://github.com/vita10gy), [Xelio](https://github.com/Xelio), [ZauberNerd](https://github.com/ZauberNerd), -[waynn](https://github.com/waynn) \ No newline at end of file +[waynn](https://github.com/waynn) diff --git a/README.md b/README.md index 9a2f5a51..509ecd94 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,41 @@ I've created this one to continue some development. Just want to download/install IITC? Go to http://iitc.jonatkins.com/ +For keeping up with the latest news, release announcements, etc, Follow IITC on G+ +https://plus.google.com/105383756361375410867/posts + +If you have questions, need help or advice with IITC, the Google+ community is a good place to start. +https://plus.google.com/communities/105647403088015055797 + +Want to report a bug? Post it to the issues page +https://github.com/jonatkins/ingress-intel-total-conversion/issues + ## Developers This Github page is for those interested in developing IITC further. -### Roadmap +### Quickstart -Assuming I don't get a takedown notice any time soon, the initial plans are: +To build the browser scripts from source you will need Python (either a late version 2.x, or 3.0+). It should +build correctly on Linux and Windows (and, probably, Macs, FreeBSD, etc) -1. **DONE** Make it easy to rebuild IITC for a new server - will make it easier for development, plus allow others to fork the project for their own use -2. **DONE** Clean up version number handling. Add fork/build info to both IITC and the plugins -3. **DONE** Add separate meta.js files for update checking - reduces load on the web server -4. Get IITC Mobile working, and easily rebuilt for custom development builds/forks +Fork this project, clone to your local machine. -Plus, of course, pulling in any patches/bugfixes. +Run the ```build.py local``` script to build the code. + +If all goes well, output of the build will end up in ```build/local``` subfolder. + +You can create a custom build settings file, ```localbuildsettings.py``` - look in the supplied +```buildsettings.py``` for details. + +#### Mobile + +To build the mobile app, along with python, you will need + +- The Java JDK (development kit - the runtime JRE is not enough) +- The Android SDK + +Run ``build.py mobile``` to build IITC Mobile in debug mode. + +Note that part of the build.py process includes copying the IITC script files into the ```mobile/res``` subfolder. +If this isn't done (e.g. you build IITC Mobile directly from Eclipse) you will end up with a broken build. diff --git a/plugins/portal-highlighter-imminent-decay.user.js b/plugins/portal-highlighter-imminent-decay.user.js new file mode 100644 index 00000000..7e7b55f2 --- /dev/null +++ b/plugins/portal-highlighter-imminent-decay.user.js @@ -0,0 +1,64 @@ +// ==UserScript== +// @id iitc-plugin-highlight-imminent-decay@cathesaurus +// @name IITC plugin: highlight portals with resonators about to decay +// @category Highlighter +// @version 0.1.0.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to show resonators due to decay within the next day. Red = portal will decay completely, orange = portal will drop all links, yellow = one or more resonators will decay completely. +// @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.portalHighlighterImminentDecay = function() {}; + +window.plugin.portalHighlighterImminentDecay.highlight = function(data) { + var d = data.portal.options.details; + if(getTeam(d) !== 0) { + //Check the energy of every resonator. + var resImminentDecayCount = 0; + var resCount = 0; + $.each(d.resonatorArray.resonators, function(ind, reso) { + if(reso !== null) { + var level = parseInt(reso.level); + var maxResonatorEnergy = window.RESO_NRG[level]; + var currentResonatorEnergy = parseInt(reso.energyTotal); + if((currentResonatorEnergy / maxResonatorEnergy) < 0.15) { + resImminentDecayCount++; + } + resCount++; + } + }); + + if(resImminentDecayCount > 0) { + if(resImminentDecayCount === resCount) { + var color = 'red'; + } else if((resCount - resImminentDecayCount) < 3) { + color = 'orange'; + } else { + color = 'yellow'; + } + // Apply colour to portal. + var params = {fillColor: color, fillOpacity: 1}; + data.portal.setStyle(params); + } + } + window.COLOR_SELECTED_PORTAL = '#f0f'; +} + +var setup = function() { + window.addPortalHighlighter('Imminent Decay', window.plugin.portalHighlighterImminentDecay.highlight); +} + +// PLUGIN END ////////////////////////////////////////////////////////// + +@@PLUGINEND@@ diff --git a/plugins/portal-highlighter-mods.user.js b/plugins/portal-highlighter-mods.user.js index ed01ccd1..5bac8085 100644 --- a/plugins/portal-highlighter-mods.user.js +++ b/plugins/portal-highlighter-mods.user.js @@ -57,19 +57,23 @@ window.plugin.portalHighligherMods.highlight = function(data, mod_type) { window.plugin.portalHighligherMods.highlightNoMods = function(data) { var d = data.portal.options.details; - var mods = false; + var mods = 0; $.each(d.portalV2.linkedModArray, function(ind, mod) { if(mod !== null) { - mods = true; - return; + mods += 1; } }); - if(!mods) { + if(mods == 0) { var fill_opacity = .6; var color = 'red'; var params = {fillColor: color, fillOpacity: fill_opacity}; data.portal.setStyle(params); + } else if(mods <4) { + var fill_opacity = .6; + var color = 'yellow'; + var params = {fillColor: color, fillOpacity: fill_opacity}; + data.portal.setStyle(params); } } diff --git a/plugins/scoreboard.user.js b/plugins/scoreboard.user.js index c449c28a..2a0d4b42 100644 --- a/plugins/scoreboard.user.js +++ b/plugins/scoreboard.user.js @@ -32,6 +32,7 @@ window.plugin.scoreboard.resetTeam = function(team) { scores[team]['count_links'] = 0; scores[team]['count_portals'] = 0; scores[team]['count_resonators'] = 0; + scores[team]['count_mods'] = 0; scores[team]['link_length'] = 0; scores[team]['field_area'] = 0; scores[team]['largest'] = {}; @@ -50,7 +51,7 @@ window.plugin.scoreboard.initPlayer = function(player, team) { scores[player]['link_length'] = 0; scores[player]['field_area'] = 0; - // scores[player]['count_shields'] = 0; + scores[player]['count_mods'] = 0; scores[player]['largest'] = {}; window.plugin.scoreboard.playerGuids.push(player); } @@ -67,8 +68,6 @@ window.plugin.scoreboard.compileStats = function() { $.each(window.fields, function(qk, val) { var team = getTeam(val.options.data); - var player = val.options.data.creator.creatorGuid; - window.plugin.scoreboard.initPlayer(player,team); // Google sends fields long since dead in the data. This makes sure it's still actually up. if(window.portals[val.options.vertices.vertexA.guid] !== undefined || @@ -77,25 +76,9 @@ window.plugin.scoreboard.compileStats = function() { var fieldArea = window.plugin.scoreboard.fieldArea(val); somethingInView = true; - scores['team'][team]['mu'] += parseInt(val.options.data.entityScore.entityScore); - scores['player'][player]['mu'] += parseInt(val.options.data.entityScore.entityScore); scores['team'][team]['count_fields']++; - scores['player'][player]['count_fields']++; scores['team'][team]['field_area'] += fieldArea; - scores['player'][player]['field_area'] += fieldArea; val.options.data.fieldArea = fieldArea; - var largestMu = scores['team'][team]['largest']['mu']; - if(largestMu === undefined || parseInt(largestMu.options.data.entityScore.entityScore) < parseInt(val.options.data.entityScore.entityScore)) { - largestMu = val; - } - scores['team'][team]['largest']['mu'] = largestMu; - - //var largestMu = scores['player'][player]['largest']['mu']; - //if(largestMu === undefined || parseInt(largestMu.options.data.entityScore.entityScore) < parseInt(val.options.data.entityScore.entityScore)) { - // largestMu = val; - //} - //scores['player'][player]['largest']['mu'] = largestMu; - var largestArea = scores['team'][team]['largest']['field_area']; if(largestArea === undefined || largestArea.options.data.fieldArea < val.options.data.fieldArea) { largestArea = val; @@ -107,30 +90,19 @@ window.plugin.scoreboard.compileStats = function() { $.each(window.links, function(qk, link) { somethingInView = true; var team = getTeam(link.options.data); - if(link.options.data.creator !== undefined) { - var player = link.options.data.creator.creatorGuid; - window.plugin.scoreboard.initPlayer(player, team); - scores['team'][team]['count_links']++; - scores['player'][player]['count_links']++; - - var linkLength = window.plugin.scoreboard.portalDistance(link.options.data.edge.destinationPortalLocation,link.options.data.edge.originPortalLocation); - scores['team'][team]['link_length'] += linkLength; - scores['player'][player]['link_length'] += linkLength; - - var largestLink = scores['team'][team]['largest']['link']; - if(largestLink === undefined || largestLink.distance < linkLength) { - largestLink = {}; - largestLink.distance = linkLength; - largestLink.player = player; - } - scores['team'][team]['largest']['link'] = largestLink; - - //var largestLink = scores['player'][player]['largest']['link']; - //if(largestLink === undefined || largestLink < linkLength) { - // largestLink = linkLength; - //} - //scores['player'][player]['largest']['link'] = largestLink; + + scores['team'][team]['count_links']++; + + var linkLength = window.plugin.scoreboard.portalDistance(link.options.data.edge.destinationPortalLocation,link.options.data.edge.originPortalLocation); + scores['team'][team]['link_length'] += linkLength; + + var largestLink = scores['team'][team]['largest']['link']; + if(largestLink === undefined || largestLink.distance < linkLength) { + largestLink = {}; + largestLink.distance = linkLength; } + scores['team'][team]['largest']['link'] = largestLink; + }); $.each(window.portals, function(qk, portal) { somethingInView = true; @@ -142,13 +114,14 @@ window.plugin.scoreboard.compileStats = function() { scores['team'][team]['count_portals']++; scores['player'][player]['count_portals']++; - //$.each(portal.options.details.portalV2.linkedModArray, function(ind, mod) { - // if(mod !== null) { - // somethingInView = true; - // scores['team'][team]['count_shields']++; - // scores['player'][mod.installingUser]['count_shields']++; - // } - //}); + $.each(portal.options.details.portalV2.linkedModArray, function(ind, mod) { + if(mod !== null) { + window.plugin.scoreboard.initPlayer(mod.installingUser, team); + somethingInView = true; + scores['team'][team]['count_mods']++; + scores['player'][mod.installingUser]['count_mods']++; + } + }); $.each(portal.options.details.resonatorArray.resonators, function(ind, reso) { if(reso !== null) { @@ -163,18 +136,6 @@ window.plugin.scoreboard.compileStats = function() { return somethingInView; }; -window.plugin.scoreboard.percentSpan = function(percent, cssClass) { - var retVal = ''; - if(percent > 0) { - retVal += '' + percent; - if(percent >= 7) { // anything less than this and the text doesnt fit in the span. - retVal += '%'; - } - retVal += ''; - } - return retVal; -}; - window.plugin.scoreboard.teamTableRow = function(field,title) { var scores = window.plugin.scoreboard.scores['team']; var retVal = '' @@ -189,27 +150,6 @@ window.plugin.scoreboard.teamTableRow = function(field,title) { return retVal; }; -window.plugin.scoreboard.fieldInfo = function(field) { - var title = ''; - var retVal = ''; - - if(field !== undefined) { - var portal = window.portals[field.options.vertices.vertexA.guid]; - if(portal !== undefined) { - title = ' @' + portal.options.details.portalV2.descriptiveText.TITLE; - } - - retVal = '
' - + window.digits(field.options.data.entityScore.entityScore) - + ' - ' + window.getPlayerName(field.options.data.creator.creatorGuid) - + '
'; - - } else { - retVal = 'N/A'; - } - return retVal; -}; - window.plugin.scoreboard.fieldInfoArea = function(field) { var title = ''; var retVal = ''; @@ -222,7 +162,6 @@ window.plugin.scoreboard.fieldInfoArea = function(field) { retVal = '
' + window.digits(Math.round(field.options.data.fieldArea)) - + ' - ' + window.getPlayerName(field.options.data.creator.creatorGuid) + '
'; } else { @@ -239,7 +178,7 @@ window.plugin.scoreboard.playerTableRow = function(playerGuid) { + window.getPlayerName(playerGuid); + ''; - $.each(['mu','count_fields','field_area','count_links','link_length','count_portals','count_resonators'], function(i, field) { + $.each(['count_portals','count_resonators','count_mods'], function(i, field) { retVal += '' + window.digits(Math.round(scores[playerGuid][field])) + ''; @@ -266,13 +205,9 @@ window.plugin.scoreboard.playerTable = function(sortBy) { var sort = window.plugin.scoreboard.playerTableSort; var scoreHtml = '' + '' - + '' - + '' - + '' - + '' - + '' + '' - + ''; + + '' + + ''; $.each(window.plugin.scoreboard.playerGuids, function(index, guid) { scoreHtml += window.plugin.scoreboard.playerTableRow(guid); }); @@ -294,43 +229,23 @@ window.plugin.scoreboard.display = function() { var somethingInView = window.plugin.scoreboard.compileStats(); var scores = window.plugin.scoreboard.scores; - var resMu = scores['team'][TEAM_RES]['mu']; - var enlMu = scores['team'][TEAM_ENL]['mu']; var scoreHtml = ''; var title = ''; if(somethingInView) { - - if(resMu + enlMu > 0) { - var resMuPercent = Math.round((resMu / (resMu + enlMu)) * 100); - scoreHtml += '
' - + window.plugin.scoreboard.percentSpan(resMuPercent, 'res') - + window.plugin.scoreboard.percentSpan(100-resMuPercent, 'enl') - + '
'; - title = window.digits(resMu) + ' R (' + resMuPercent + '%), ' + window.digits(enlMu) + ' E (' + (100-resMuPercent) + '%)'; - } - else { - title = 'no MU in view'; - } - - scoreHtml += '
PlayerMuField #Field (km²)Link #Link (m)PortalsResonators
ResonatorsMods
' + scoreHtml += '
' + '' - + window.plugin.scoreboard.teamTableRow('mu','Mu') + window.plugin.scoreboard.teamTableRow('count_fields','Field #') + window.plugin.scoreboard.teamTableRow('field_area','Field (km²)') + window.plugin.scoreboard.teamTableRow('count_links','Link #') + window.plugin.scoreboard.teamTableRow('link_length','Link (m)') + window.plugin.scoreboard.teamTableRow('count_portals','Portals') + window.plugin.scoreboard.teamTableRow('count_resonators','Resonators') + + window.plugin.scoreboard.teamTableRow('count_mods','Mods') + '
ResistanceEnlightenedTotal
'; scoreHtml += '' + '' - + '' + '' + '
ResistanceEnlightened
Largest Field (Mu)' - + window.plugin.scoreboard.fieldInfo(scores['team'][TEAM_RES]['largest']['mu']) - + '' - + window.plugin.scoreboard.fieldInfo(scores['team'][TEAM_ENL]['largest']['mu']) - + '
Largest Field (km²)' + window.plugin.scoreboard.fieldInfoArea(scores['team'][TEAM_RES]['largest']['field_area']) + '' @@ -341,9 +256,7 @@ window.plugin.scoreboard.display = function() { scoreHtml += 'N/A'; } else { - scoreHtml += window.digits(Math.round(scores['team'][TEAM_RES]['largest']['link']['distance'])) - + ' - ' - + window.getPlayerName(scores['team'][TEAM_RES]['largest']['link']['player']); + scoreHtml += window.digits(Math.round(scores['team'][TEAM_RES]['largest']['link']['distance'])); } scoreHtml += ''; @@ -351,14 +264,12 @@ window.plugin.scoreboard.display = function() { scoreHtml += 'N/A'; } else { - scoreHtml += window.digits(Math.round(scores['team'][TEAM_ENL]['largest']['link']['distance'])) - + ' - ' - + window.getPlayerName(scores['team'][TEAM_ENL]['largest']['link']['player']); + scoreHtml += window.digits(Math.round(scores['team'][TEAM_ENL]['largest']['link']['distance'])); } scoreHtml += '
' + '
' - + window.plugin.scoreboard.playerTable('mu') + + window.plugin.scoreboard.playerTable('count_portals') + '
'; scoreHtml += '
Click on player table headers to sort by that column. ' diff --git a/plugins/zaprange.user.js b/plugins/zaprange.user.js index e6bafaff..8f72383b 100644 --- a/plugins/zaprange.user.js +++ b/plugins/zaprange.user.js @@ -2,7 +2,7 @@ // @id iitc-plugin-zaprange@zaso // @name IITC plugin: Zaprange // @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@@ @@ -16,84 +16,101 @@ @@PLUGINSTART@@ -// PLUGIN START //////////////////////////////////////////////////////// +// PLUGIN START /////////////////////////////////////////////////////// -// use own namespace for plugin -window.plugin.zaprange = function() {}; + // use own namespace for plugin + window.plugin.zaprange = function() {}; + window.plugin.zaprange.zapLayers = {}; + window.plugin.zaprange.MIN_MAP_ZOOM = 16; -window.plugin.zaprange.zapLayers = {}; -window.plugin.zaprange.MIN_MAP_ZOOM = 15; + window.plugin.zaprange.portalAdded = function(data) { + data.portal.on('add', function() { + window.plugin.zaprange.draw(this.options.guid, this.options.details.controllingTeam.team); + }); - -window.plugin.zaprange.portalAdded = function(data) { - data.portal.on('add', function() { - window.plugin.zaprange.draw(this.options.guid); - }); - - data.portal.on('remove', function() { - window.plugin.zaprange.remove(this.options.guid); - }); -} - -window.plugin.zaprange.remove = function(guid) { - var previousLayer = window.plugin.zaprange.zapLayers[guid]; - if(previousLayer) { - window.plugin.zaprange.zapCircleHolderGroup.removeLayer(previousLayer); - delete window.plugin.zaprange.zapLayers[guid]; + data.portal.on('remove', function() { + window.plugin.zaprange.remove(this.options.guid, this.options.details.controllingTeam.team); + }); } -} -window.plugin.zaprange.draw = function(guid) { - var d = window.portals[guid]; - var dd = d.options.details; - - if(dd.controllingTeam.team !== "NEUTRAL") { - var coo = d._latlng; - var latlng = new L.LatLng(coo.lat,coo.lng); - var portalLevel = parseInt(getPortalLevel(dd)); - var optCircle = {color:'red',opacity:0.7,fill:true,fillColor:'red',fillOpacity:0.1,weight:1,clickable:false, dashArray: [10,6]}; - var range = (5*portalLevel)+35; - - var circle = new L.Circle(latlng, range, optCircle); - window.plugin.zaprange.zapLayers[guid] = circle; - circle.addTo(window.plugin.zaprange.zapCircleHolderGroup); - } -} - -window.plugin.zaprange.showOrHide = function() { - var ctrl = $('.leaflet-control-layers-selector + span:contains("Portal Attack Range")').parent(); - if (map.getZoom() >= window.plugin.zaprange.MIN_MAP_ZOOM) { - // show the layer - if(!window.plugin.zaprange.zapLayerHolderGroup.hasLayer(window.plugin.zaprange.zapCircleHolderGroup)) { - window.plugin.zaprange.zapLayerHolderGroup.addLayer(window.plugin.zaprange.zapCircleHolderGroup); + window.plugin.zaprange.remove = function(guid, faction) { + var previousLayer = window.plugin.zaprange.zapLayers[guid]; + if(previousLayer) { + if(faction === 'ENLIGHTENED') { + window.plugin.zaprange.zapCircleEnlHolderGroup.removeLayer(previousLayer); + } else { + window.plugin.zaprange.zapCircleResHolderGroup.removeLayer(previousLayer); + } + delete window.plugin.zaprange.zapLayers[guid]; } - ctrl.removeClass('disabled').attr('title', ''); - } else { - // hide the layer - if(window.plugin.zaprange.zapLayerHolderGroup.hasLayer(window.plugin.zaprange.zapCircleHolderGroup)) { - window.plugin.zaprange.zapLayerHolderGroup.removeLayer(window.plugin.zaprange.zapCircleHolderGroup); - } - ctrl.addClass('disabled').attr('title', 'Zoom in to show those.'); } -} -var setup = function() { - // this layer is added to tha layer chooser, to be toggled on/off - window.plugin.zaprange.zapLayerHolderGroup = new L.LayerGroup(); + window.plugin.zaprange.draw = function(guid, faction) { + var d = window.portals[guid]; - // this layer is added into the above layer, and removed from it when we zoom out too far - window.plugin.zaprange.zapCircleHolderGroup = new L.LayerGroup(); + if(faction !== "NEUTRAL") { + var coo = d._latlng; + var latlng = new L.LatLng(coo.lat,coo.lng); + var portalLevel = parseInt(getPortalLevel(d.options.details)); + var optCircle = {color:'red',opacity:0.7,fillColor:'red',fillOpacity:0.1,weight:1,clickable:false, dashArray: [10,6]}; + var range = (5*portalLevel)+35; - window.plugin.zaprange.zapLayerHolderGroup.addLayer(window.plugin.zaprange.zapCircleHolderGroup); + var circle = new L.Circle(latlng, range, optCircle); - window.addLayerGroup('Portal Attack Range', window.plugin.zaprange.zapLayerHolderGroup, true); - window.addHook('portalAdded', window.plugin.zaprange.portalAdded); + if(faction === 'ENLIGHTENED') { + circle.addTo(window.plugin.zaprange.zapCircleEnlHolderGroup); + } else { + circle.addTo(window.plugin.zaprange.zapCircleResHolderGroup); + } + window.plugin.zaprange.zapLayers[guid] = circle; + } + } - map.on('zoomend', window.plugin.zaprange.showOrHide); + window.plugin.zaprange.showOrHide = function() { + if(map.getZoom() >= window.plugin.zaprange.MIN_MAP_ZOOM) { + // show the layer + if(!window.plugin.zaprange.zapLayerEnlHolderGroup.hasLayer(window.plugin.zaprange.zapCircleEnlHolderGroup)) { + window.plugin.zaprange.zapLayerEnlHolderGroup.addLayer(window.plugin.zaprange.zapCircleEnlHolderGroup); + $('.leaflet-control-layers-list span:contains("Zaprange Enlightened")').parent('label').removeClass('disabled').attr('title', ''); + } + if(!window.plugin.zaprange.zapLayerResHolderGroup.hasLayer(window.plugin.zaprange.zapCircleResHolderGroup)) { + window.plugin.zaprange.zapLayerResHolderGroup.addLayer(window.plugin.zaprange.zapCircleResHolderGroup); + $('.leaflet-control-layers-list span:contains("Zaprange Resistance")').parent('label').removeClass('disabled').attr('title', ''); + } + } else { + // hide the layer + if(window.plugin.zaprange.zapLayerEnlHolderGroup.hasLayer(window.plugin.zaprange.zapCircleEnlHolderGroup)) { + window.plugin.zaprange.zapLayerEnlHolderGroup.removeLayer(window.plugin.zaprange.zapCircleEnlHolderGroup); + $('.leaflet-control-layers-list span:contains("Zaprange Enlightened")').parent('label').addClass('disabled').attr('title', 'Zoom in to show those.'); + } + if(window.plugin.zaprange.zapLayerResHolderGroup.hasLayer(window.plugin.zaprange.zapCircleResHolderGroup)) { + window.plugin.zaprange.zapLayerResHolderGroup.removeLayer(window.plugin.zaprange.zapCircleResHolderGroup); + $('.leaflet-control-layers-list span:contains("Zaprange Resistance")').parent('label').addClass('disabled').attr('title', 'Zoom in to show those.'); + } + } + } - window.plugin.zaprange.showOrHide(); + var setup = function() { + // this layer is added to the layer chooser, to be toggled on/off + window.plugin.zaprange.zapLayerEnlHolderGroup = new L.LayerGroup(); + window.plugin.zaprange.zapLayerResHolderGroup = new L.LayerGroup(); -} + // this layer is added into the above layer, and removed from it when we zoom out too far + window.plugin.zaprange.zapCircleEnlHolderGroup = new L.LayerGroup(); + window.plugin.zaprange.zapCircleResHolderGroup = new L.LayerGroup(); + + window.plugin.zaprange.zapLayerEnlHolderGroup.addLayer(window.plugin.zaprange.zapCircleEnlHolderGroup); + window.plugin.zaprange.zapLayerResHolderGroup.addLayer(window.plugin.zaprange.zapCircleResHolderGroup); + + window.addLayerGroup('Zaprange Enlightened', window.plugin.zaprange.zapLayerEnlHolderGroup, true); + window.addLayerGroup('Zaprange Resistance', window.plugin.zaprange.zapLayerResHolderGroup, true); + + window.addHook('portalAdded', window.plugin.zaprange.portalAdded); + + map.on('zoomend', window.plugin.zaprange.showOrHide); + + window.plugin.zaprange.showOrHide(); + } // PLUGIN END //////////////////////////////////////////////////////////