From b9ec6328f86c82e557ed7771a83d15af6d9db7a4 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sat, 9 Feb 2013 11:42:17 +0100 Subject: [PATCH 01/63] color portal mods by their rare-ness. Patch by @OshiHidra. Fixes #28. --- code/portal_detail_display_tools.js | 12 ++++++++---- main.js | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index b02d40be..c3443d72 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -29,10 +29,12 @@ window.getPortalDescriptionFromDetails = function(details) { window.getModDetails = function(d) { var mods = []; var modsTitle = []; + var modsColor = []; $.each(d.portalV2.linkedModArray, function(ind, mod) { if(!mod) { mods.push(''); modsTitle.push(''); + modsColor.push('#000'); } else if(mod.type === 'RES_SHIELD') { var title = mod.rarity.capitalize() + ' ' + mod.displayName + '\n'; @@ -46,16 +48,18 @@ window.getModDetails = function(d) { mods.push(mod.rarity.capitalize().replace('_', ' ') + ' ' + mod.displayName); modsTitle.push(title); + modsColor.push(COLORS_MOD[mod.rarity]); } else { mods.push(mod.type); modsTitle.push('Unknown mod. No further details available.'); + modsColor.push('#FFF'); } }); - var t = ''+mods[0]+'' - + ''+mods[1]+'' - + ''+mods[2]+'' - + ''+mods[3]+'' + var t = ''+mods[0]+'' + + ''+mods[1]+'' + + ''+mods[2]+'' + + ''+mods[3]+'' return t; } diff --git a/main.js b/main.js index f34165eb..fa09fa8e 100644 --- a/main.js +++ b/main.js @@ -114,6 +114,9 @@ var MAX_DRAWN_FIELDS = 200; var COLOR_SELECTED_PORTAL = '#f00'; var COLORS = ['#FFCE00', '#0088FF', '#03FE03']; // none, res, enl var COLORS_LVL = ['#000', '#FECE5A', '#FFA630', '#FF7315', '#E40000', '#FD2992', '#EB26CD', '#C124E0', '#9627F4']; +var COLORS_MOD = {VERY_RARE: '#F78AF6', RARE: '#AD8AFF', COMMON: '#84FBBD'}; + + // circles around a selected portal that show from where you can hack // it and how far the portal reaches (i.e. how far links may be made // from this portal) From 6b19e79e07759ce9838acbc737baccf3910c74a9 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sat, 9 Feb 2013 13:52:10 +0100 Subject: [PATCH 02/63] add plugin basics and fix #31 by providing it as plugin --- code/boot.js | 5 +++ main.js | 5 +++ plugins/README.md | 22 +++++++++++ plugins/guess-player-levels.user.js | 57 +++++++++++++++++++++++++++++ style.css | 17 ++++++--- 5 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 plugins/README.md create mode 100644 plugins/guess-player-levels.user.js diff --git a/code/boot.js b/code/boot.js index 8ebce5b0..abcd1ec6 100644 --- a/code/boot.js +++ b/code/boot.js @@ -176,6 +176,11 @@ function boot() { window.PLAYER['nickMatcher'] = new RegExp('\\b('+n+')\\b', 'ig'); $('#sidebar').show(); + + if(window.bootPlugins) + $.each(window.bootPlugins, function(ind, ref) { ref(); }); + + window.iitcLoaded = true; } // this is the minified load.js script that allows us to easily load diff --git a/main.js b/main.js index fa09fa8e..91b5ecde 100644 --- a/main.js +++ b/main.js @@ -65,6 +65,8 @@ document.getElementsByTagName('body')[0].innerHTML = '' + ' ' + '
' + ' ' + + '
' + + '
' + '
' + ' '; + ''; @@ -162,6 +164,9 @@ window.portals = {}; window.links = {}; window.fields = {}; +// plugin framework. Plugins may load earlier than iitc, so don’t +// overwrite data +if(typeof window.plugin !== 'function') window.plugin = function() {}; @@INJECTHERE@@ diff --git a/plugins/README.md b/plugins/README.md new file mode 100644 index 00000000..1b872227 --- /dev/null +++ b/plugins/README.md @@ -0,0 +1,22 @@ +Plugins +======= + +Install +------- +Plugins are installed the same way the total conversion script is. Please see there for specific instructions for your browser. + + +Available Plugins +----------------- + +- [**Guess Player Level**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js) looks for the highest placed resonator per player in the current view to guess the player level. + + +Hacking +------- + +Plugins may be developed in the same way as the total conversion script. Plugins may provide features tailored to specific needs and are allowed to change things as they see fit. You can provide them separately oder submit a pull request to have them managed in this repository. There are currently no hooks that allow integration with the main script, but I will add those if the need arises. Simply open a bug report. + +You can use the guess player level script as an example to get you started. Just update the names and the part between `// PLUGIN START` and `// PLUGIN END` and you should be able to develop your plugin. The other code ensures your plugin is executed after the main script. + +If you happen the write general purpose functions for your plugin, consider adding them to the main script instead. For example, if you write a `getResoCountFromPortal(details)` function it may be very well added to `code/portal_info.js`. diff --git a/plugins/guess-player-levels.user.js b/plugins/guess-player-levels.user.js new file mode 100644 index 00000000..898621f5 --- /dev/null +++ b/plugins/guess-player-levels.user.js @@ -0,0 +1,57 @@ +// ==UserScript== +// @id iitc-plugin-guess-player-levels@breunigs +// @name iitc: guess player level +// @version 0.1 +// @namespace https://github.com/breunigs/ingress-intel-total-conversion +// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js +// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/guess-player-levels.user.js +// @description Tries to determine player levels from the data available in the current view +// @include http://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// ==/UserScript== + +function wrapper() { +console.log('hello from plugin'); + +if(typeof window.plugin !== 'function') window.plugin = function() {}; + +console.log('window.plugin now is:'); +console.log(window.plugin); + + + +window.plugin.guessPlayerLevels = function() { + var players = {}; + $.each(window.portals, function(ind, portal) { + var r = portal.options.details.resonatorArray.resonators; + $.each(r, function(ind, reso) { + if(!reso) return true; + var p = reso.ownerGuid; + var l = reso.level; + if(!players[p] || players[p] < l) players[p] = l; + }); + }); + + var playersNamed = {}; + $.each(players, function(guid, level) { + playersNamed[getPlayerName(guid)] = level; + }); + + var s = ''; + $.each(Object.keys(playersNamed).sort, function(ind, playerName) { + s += playerName + ': ' + level; + }); + + alert(s); +} + + +console.log('window.plugin.guessPlayerLevels now is:'); +console.log(window.plugin.guessPlayerLevels); + + +} // wrapper end +// inject code into site context +var script = document.createElement('script'); +script.appendChild(document.createTextNode('('+ wrapper +')();')); +(document.body || document.head || document.documentElement).appendChild(script); diff --git a/style.css b/style.css index f0432e50..683c2963 100644 --- a/style.css +++ b/style.css @@ -35,12 +35,6 @@ body { overflow-x:hidden; } -#redeem { - /* cheap hack to prevent sidebar content being overlayed by the map - * status box */ - margin-bottom: 55px; -} - .enl { color: #03fe03 !important; @@ -489,6 +483,17 @@ aside:nth-child(odd) span { width: 140px; } +#toolbox { + padding: 4px; + font-size:90%; +} + +#spacer { + /* cheap hack to prevent sidebar content being overlayed by the map + * status box */ + height: 55px; +} + /* a common portal display takes this much space (prevents moving * content when first selecting a portal) */ From c6b99c1e7bd961f51433fb39cd8a148a7d9753e9 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sat, 9 Feb 2013 14:12:20 +0100 Subject: [PATCH 03/63] release 0.4. See NEWS.md for what changed. --- NEWS.md | 22 ++++- README.md | 27 +++--- main.js | 2 +- total-conversion-build.user.js | 164 +++++++++++++++++++++++---------- 4 files changed, 150 insertions(+), 65 deletions(-) diff --git a/NEWS.md b/NEWS.md index 8c8b8f99..38f289be 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,26 @@ -CHANGES IN 0.3 +CHANGES in 0.4 ============== +- Feature: display resonator charge percentage in tooltip (by Xelio) +- Feature: display resonator level in reso bar (by JasonMillward) +- Feature: portals may be filtered by level (using the layer switcher) +- Feature: build script in Python (by epf) +- Feature: plugins +- Change: Portal mods are colored according to their rare-ness (by OshiHidra) +- Change: nick highlight in chat now case-insensitive +- Change: +/- zoom buttons visible by default now +- Bugfix: title bar text broken +- Bugfix: rename cardinal to octant (by mledoze) +- Bugfix: Chat display broken in Opera +- Bugfix: Chat tab completion in Chrome +- Bugfix: wrong timestamps displayed in chat input bar +- Bugfix: don’t autobuild when git meta info changes (by ZauberNerd) +- Bugfix: resistance owned portals had wrong border when viewing the full image + + +CHANGES IN 0.3 +-------------- + - Feature: more info for shields in tooltip (by JasonMillward) - Feature: pretty display for redeemed codes (by integ3r) - Change: Portal details are now scrollable when height is too small diff --git a/README.md b/README.md index 156d85d0..62752ef5 100644 --- a/README.md +++ b/README.md @@ -31,20 +31,14 @@ Features - may toggle portals/links/fields - hack range (yellow circle) and link range (large red circle) for portals. Click on the range link in the sidebar to zoom to link range. - double clicking a portal zooms in and focuses it -- display of XM and AP rewards for redeemed passcodes by [Dovahkiin](http://bit.ly/mjcode) - - -Missing -------- - -(and probably not going to implement it) - -- logout link (but you wouldn’t want to *quit*, would you?), privacy link, etc. +- display of XM and AP rewards for redeemed passcodes Install ------- +Current version is 0.4. See [NEWS.md](https://github.com/breunigs/ingress-intel-total-conversion/blob/gh-pages/NEWS.md) for details. + [**INSTALL**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js) @@ -69,11 +63,10 @@ Install [**INSTALL**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js) - Contributing ------------ -Please do! +Please do! (Obviously, Resistance folks must send in complete patches while Enlightenment gals and guys may just open feature request ☺) @@ -81,10 +74,14 @@ Please do! Contributors ------------ -- [integ3r](https://github.com/integ3r) -- [Bananeweizen](https://github.com/Bananeweizen) -- [epf](https://github.com/epf) -- [JasonMillward](https://github.com/JasonMillward) +[Bananeweizen](https://github.com/Bananeweizen), +[epf](https://github.com/epf), +[integ3r](https://github.com/integ3r), +[JasonMillward](https://github.com/JasonMillward), +[mledoze](https://github.com/mledoze), +[OshiHidra](https://github.com/OshiHidra), +[Xelio](https://github.com/Xelio), +[ZauberNerd](https://github.com/ZauberNerd) Hacking diff --git a/main.js b/main.js index 91b5ecde..8b911bc6 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@breunigs // @name intel map total conversion -// @version 0.3-@@BUILDDATE@@ +// @version 0.4-@@BUILDDATE@@ // @namespace https://github.com/breunigs/ingress-intel-total-conversion // @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js diff --git a/total-conversion-build.user.js b/total-conversion-build.user.js index ef2c7391..63de15b3 100644 --- a/total-conversion-build.user.js +++ b/total-conversion-build.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@breunigs // @name intel map total conversion -// @version 0.3-2013-02-08-030330 +// @version 0.4-2013-02-09-141136 // @namespace https://github.com/breunigs/ingress-intel-total-conversion // @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js @@ -42,7 +42,8 @@ for(var i = 0; i < d.length; i++) { // possible without requiring scripts. document.getElementsByTagName('head')[0].innerHTML = '' //~ + '' - + '' + + 'Ingress Intel Map' + + '' + '' + ''; @@ -64,6 +65,8 @@ document.getElementsByTagName('body')[0].innerHTML = '' + ' ' + '
' + ' ' + + '
' + + '
' + '
' + ' '; + ''; @@ -113,6 +116,9 @@ var MAX_DRAWN_FIELDS = 200; var COLOR_SELECTED_PORTAL = '#f00'; var COLORS = ['#FFCE00', '#0088FF', '#03FE03']; // none, res, enl var COLORS_LVL = ['#000', '#FECE5A', '#FFA630', '#FF7315', '#E40000', '#FD2992', '#EB26CD', '#C124E0', '#9627F4']; +var COLORS_MOD = {VERY_RARE: '#F78AF6', RARE: '#AD8AFF', COMMON: '#84FBBD'}; + + // circles around a selected portal that show from where you can hack // it and how far the portal reaches (i.e. how far links may be made // from this portal) @@ -125,7 +131,7 @@ var RESO_NRG = [0, 1000, 1500, 2000, 2500, 3000, 4000, 5000, 6000]; var MAX_XM_PER_LEVEL = [0, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]; var MIN_AP_FOR_LEVEL = [0, 10000, 30000, 70000, 150000, 300000, 600000, 1200000]; var HACK_RANGE = 35; // in meters, max. distance from portal to be able to access it -var SLOT_TO_CARDINAL = ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE']; +var OCTANTS = ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE']; var DEFAULT_PORTAL_IMG = 'http://commondatastorage.googleapis.com/ingress/img/default-portal-image.png'; // OTHER MORE-OR-LESS CONSTANTS ////////////////////////////////////// @@ -149,7 +155,7 @@ window.selectedPortal = null; window.portalRangeIndicator = null; window.portalAccessIndicator = null; window.mapRunsUserAction = false; -var portalsLayer, linksLayer, fieldsLayer; +var portalsLayers, linksLayer, fieldsLayer; // contain references to all entities shown on the map. These are // automatically kept in sync with the items on *sLayer, so never ever @@ -158,6 +164,9 @@ window.portals = {}; window.links = {}; window.fields = {}; +// plugin framework. Plugins may load earlier than iitc, so don’t +// overwrite data +if(typeof window.plugin !== 'function') window.plugin = function() {}; @@ -283,14 +292,17 @@ window.cleanUp = function() { var cnt = [0,0,0]; var b = getPaddedBounds(); var minlvl = getMinPortalLevel(); - portalsLayer.eachLayer(function(portal) { - // portal must be in bounds and have a high enough level. Also don’t - // remove if it is selected. - if(portal.options.guid == window.selectedPortal || - (b.contains(portal.getLatLng()) && portal.options.level >= minlvl)) return; - cnt[0]++; - portalsLayer.removeLayer(portal); - }); + for(var i = 0; i < portalsLayers.length; i++) { + // i is also the portal level + portalsLayers[i].eachLayer(function(portal) { + // portal must be in bounds and have a high enough level. Also don’t + // remove if it is selected. + if(portal.options.guid == window.selectedPortal || + (b.contains(portal.getLatLng()) && i >= minlvl)) return; + cnt[0]++; + portalsLayers[i].removeLayer(portal); + }); + } linksLayer.eachLayer(function(link) { if(b.intersects(link.getBounds())) return; cnt[1]++; @@ -317,7 +329,9 @@ window.removeByGuid = function(guid) { case '11': case '12': if(!window.portals[guid]) return; - portalsLayer.removeLayer(window.portals[guid]); + var p = window.portals[guid]; + for(var i = 0; i < portalsLayers.length; i++) + portalsLayers[i].removeLayer(p); break; case '9': if(!window.links[guid]) return; @@ -376,13 +390,24 @@ window.renderPortal = function(ent) { guid: ent[0]}); p.on('remove', function() { delete window.portals[this.options.guid]; }); - p.on('add', function() { window.portals[this.options.guid] = this; }); + p.on('add', function() { + window.portals[this.options.guid] = this; + // handles the case where a selected portal gets removed from the + // map by hiding all portals with said level + if(window.selectedPortal != this.options.guid) + window.portalResetColor(this); + }); p.on('click', function() { window.renderPortalDetails(ent[0]); }); p.on('dblclick', function() { window.renderPortalDetails(ent[0]); window.map.setView(latlng, 17); }); - p.addTo(portalsLayer); + // portalLevel contains a float, need to round down + p.addTo(portalsLayers[parseInt(portalLevel)]); +} + +window.portalResetColor = function(portal) { + portal.setStyle({color: portal.options.fillColor}); } // renders a link on the map from the given entity @@ -476,7 +501,7 @@ window.requests.abort = function() { } // gives user feedback about pending operations. Draws current status -// to website. +// to website. Updates info in layer chooser. window.renderUpdateStatus = function() { var t = 'map status: '; if(mapRunsUserAction) @@ -492,15 +517,20 @@ window.renderUpdateStatus = function() { t += ' RENDER LIMIT ' if(window.failedRequestCount > 0) - t += ' ' + window.failedRequestCount + ' requests failed.' + t += ' ' + window.failedRequestCount + ' requests failed.' t += '
('; var minlvl = getMinPortalLevel(); if(minlvl === 0) - t += 'showing all portals'; + t += 'loading all portals'; else - t+= 'only showing portals with level '+minlvl+' and up'; - t += ')'; + t+= 'only loading portals with level '+minlvl+' and up'; + t += ')'; + + var portalSelection = $('.leaflet-control-layers-overlays label'); + portalSelection.slice(0, minlvl+1).addClass('disabled').attr('title', 'Zoom in to show those.'); + portalSelection.slice(minlvl, 8).removeClass('disabled').attr('title', ''); + $('#updatestatus').html(t); } @@ -696,6 +726,13 @@ String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); } +// http://stackoverflow.com/a/646643/1684530 by Bergi and CMS +if (typeof String.prototype.startsWith !== 'function') { + String.prototype.startsWith = function (str){ + return this.slice(0, str.length) === str; + }; +} + @@ -728,13 +765,14 @@ window.setupStyles = function() { $('head').append(''); } @@ -752,16 +790,33 @@ window.setupMap = function() { var views = [cmMid, cmMin, osm, new L.Google('INGRESS'), new L.Google('ROADMAP'), new L.Google('SATELLITE'), new L.Google('HYBRID')]; - portalsLayer = L.layerGroup([]); - linksLayer = L.layerGroup([]); - fieldsLayer = L.layerGroup([]); - window.map = new L.Map('map', $.extend(getPosition(), {zoomControl: false})); + + window.map = new L.Map('map', $.extend(getPosition(), + {zoomControl: !(localStorage['iitc.zoom.buttons'] === 'false')} + )); + try { map.addLayer(views[readCookie('ingress.intelmap.type')]); } catch(e) { map.addLayer(views[0]); } - map.addLayer(portalsLayer); + + var addLayers = {}; + + portalsLayers = []; + for(var i = 0; i <= 8; i++) { + portalsLayers[i] = L.layerGroup([]); + map.addLayer(portalsLayers[i]); + var t = (i === 0 ? 'Unclaimed' : 'Level ' + i) + ' Portals'; + addLayers[t] = portalsLayers[i]; + } + + fieldsLayer = L.layerGroup([]); map.addLayer(fieldsLayer, true); + addLayers['Fields'] = fieldsLayer; + + linksLayer = L.layerGroup([]); map.addLayer(linksLayer, true); + addLayers['Links'] = linksLayer; + map.addControl(new L.Control.Layers({ 'OSM Cloudmade Midnight': views[0], 'OSM Cloudmade Minimal': views[1], @@ -770,11 +825,7 @@ window.setupMap = function() { 'Google Roads': views[4], 'Google Satellite': views[5], 'Google Hybrid': views[6] - }, { - 'Portals': portalsLayer, - 'Links': linksLayer, - 'Fields': fieldsLayer - })); + }, addLayers)); map.attributionControl.setPrefix(''); // listen for changes and store them in cookies map.on('moveend', window.storeMapPosition); @@ -858,9 +909,14 @@ function boot() { // load only once var n = window.PLAYER['nickname']; - window.PLAYER['nickMatcher'] = new RegExp('\\b('+n+')\\b'); + window.PLAYER['nickMatcher'] = new RegExp('\\b('+n+')\\b', 'ig'); $('#sidebar').show(); + + if(window.bootPlugins) + $.each(window.bootPlugins, function(ind, ref) { ref(); }); + + window.iitcLoaded = true; } // this is the minified load.js script that allows us to easily load @@ -875,7 +931,7 @@ function asyncLoadScript(a){return function(b,c){var d=document.createElement("s var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/leaflet_google.js'; var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'; var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js'; -var AUTOLINK = 'https://raw.github.com/bryanwoods/autolink-js/master/autolink.js'; +var AUTOLINK = 'http://raw.github.com/bryanwoods/autolink-js/master/autolink.js'; // after all scripts have loaded, boot the actual app load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).thenRun(boot); @@ -1406,7 +1462,7 @@ window.chat.chooser = function(event) { case 'public': span.css('cssText', 'color: red !important'); - span.text('tell public:'); + span.text('broadcast:'); elm = $('#chatpublic'); break; @@ -1499,7 +1555,9 @@ window.chat.setupTime = function() { var updateTime = function() { if(window.isIdle()) return; var d = new Date(); - inputTime.text(d.toLocaleTimeString().slice(0, 5)); + var h = d.getHours() + ''; if(h.length === 1) h = '0' + h; + var m = d.getMinutes() + ''; if(m.length === 1) m = '0' + m; + inputTime.text(h+':'+m); // update ON the minute (1ms after) setTimeout(updateTime, (60 - d.getSeconds()) * 1000 + 1); }; @@ -1514,7 +1572,7 @@ window.chat.setupTime = function() { window.chat.setupPosting = function() { - $('#chatinput input').keypress(function(event) { + $('#chatinput input').keydown(function(event) { try{ var kc = (event.keyCode ? event.keyCode : event.which); @@ -1598,10 +1656,12 @@ window.getPortalDescriptionFromDetails = function(details) { window.getModDetails = function(d) { var mods = []; var modsTitle = []; + var modsColor = []; $.each(d.portalV2.linkedModArray, function(ind, mod) { if(!mod) { mods.push(''); modsTitle.push(''); + modsColor.push('#000'); } else if(mod.type === 'RES_SHIELD') { var title = mod.rarity.capitalize() + ' ' + mod.displayName + '\n'; @@ -1615,16 +1675,18 @@ window.getModDetails = function(d) { mods.push(mod.rarity.capitalize().replace('_', ' ') + ' ' + mod.displayName); modsTitle.push(title); + modsColor.push(COLORS_MOD[mod.rarity]); } else { mods.push(mod.type); modsTitle.push('Unknown mod. No further details available.'); + modsColor.push('#FFF'); } }); - var t = ''+mods[0]+'' - + ''+mods[1]+'' - + ''+mods[2]+'' - + ''+mods[3]+'' + var t = ''+mods[0]+'' + + ''+mods[1]+'' + + ''+mods[2]+'' + + ''+mods[3]+'' return t; } @@ -1679,16 +1741,22 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) { var max = RESO_NRG[level]; var fillGrade = nrg/max*100; - var inf = 'energy:\t\t' + nrg + ' / ' + max + '\n' + var inf = 'energy:\t\t' + nrg + ' / ' + max + ' (' + Math.round(fillGrade) + '%)' + '\n' + 'level:\t\t' + level +'\n' + 'distance:\t' + dist + 'm\n' + 'owner:\t\t' + nick + '\n' - + 'cardinal:\t' + SLOT_TO_CARDINAL[slot]; + + 'octant:\t' + OCTANTS[slot]; + + var style = 'width:'+fillGrade+'%; background:'+COLORS_LVL[level]+';'; + + var color = (level < 3 ? "#9900FF" : "#FFFFFF"); + + var lbar = ' ' + level + ' '; - var style = 'width:'+fillGrade+'%; background:'+COLORS_LVL[level]+'; color:'+COLORS_LVL[level]; var fill = ''; - var meter = '' - + fill + ''; + + var meter = '' + + fill + lbar + ''; } var cls = slot <= 3 ? 'left' : 'right'; var text = ''+(nick||'')+''; @@ -1992,8 +2060,7 @@ window.setPortalIndicators = function(d) { window.selectPortal = function(guid) { var update = selectedPortal === guid; var oldPortal = portals[selectedPortal]; - if(!update && oldPortal) - oldPortal.setStyle({color: oldPortal.options.fillColor}); + if(!update && oldPortal) portalResetColor(oldPortal); selectedPortal = guid; @@ -2137,7 +2204,8 @@ window.debug.printStackTrace = function() { } window.debug.clearPortals = function() { - portalsLayer.clearLayers(); + for(var i = 0; i < portalsLayers.length; i++) + portalsLayers[i].clearLayers(); } window.debug.clearLinks = function() { From db5747fb73798fbdd1a177c97e14f1bf8218e7f7 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sat, 9 Feb 2013 15:06:48 +0100 Subject: [PATCH 04/63] only pull in data from GitHub pages to reduce risk of being down. --- code/boot.js | 4 +- external/autolink.js | 33 +++++++ external/leaflet_google.js | 152 +++++++++++++++++++++++++++++++++ total-conversion-build.user.js | 8 +- 4 files changed, 191 insertions(+), 6 deletions(-) create mode 100644 external/autolink.js create mode 100644 external/leaflet_google.js diff --git a/code/boot.js b/code/boot.js index abcd1ec6..9b5ef951 100644 --- a/code/boot.js +++ b/code/boot.js @@ -192,10 +192,10 @@ function asyncLoadScript(a){return function(b,c){var d=document.createElement("s // modified version of https://github.com/shramov/leaflet-plugins. Also // contains the default Ingress map style. -var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/leaflet_google.js'; +var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/external/leaflet_google.js'; var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'; var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js'; -var AUTOLINK = 'http://raw.github.com/bryanwoods/autolink-js/master/autolink.js'; +var AUTOLINK = 'http://breunigs.github.com/ingress-intel-total-conversion/external/autolink.js'; // after all scripts have loaded, boot the actual app load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).thenRun(boot); diff --git a/external/autolink.js b/external/autolink.js new file mode 100644 index 00000000..013025a7 --- /dev/null +++ b/external/autolink.js @@ -0,0 +1,33 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var autoLink, + __slice = [].slice; + + autoLink = function() { + var callbackThunk, key, link_attributes, option, options, url_pattern, value; + options = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + link_attributes = ''; + option = options[0]; + url_pattern = /(^|\s)(\b(https?|ftp):\/\/[\-A-Z0-9+\u0026@#\/%?=~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~_|])/gi; + if (!(options.length > 0)) { + return this.replace(url_pattern, "$1$2"); + } + if ((option['callback'] != null) && typeof option['callback'] === 'function') { + callbackThunk = option['callback']; + delete option['callback']; + } + for (key in option) { + value = option[key]; + link_attributes += " " + key + "='" + value + "'"; + } + return this.replace(url_pattern, function(match, space, url) { + var link, returnCallback; + returnCallback = callbackThunk && callbackThunk(url); + link = returnCallback || ("" + url + ""); + return "" + space + link; + }); + }; + + String.prototype['autoLink'] = autoLink; + +}).call(this); diff --git a/external/leaflet_google.js b/external/leaflet_google.js new file mode 100644 index 00000000..37d6dd8c --- /dev/null +++ b/external/leaflet_google.js @@ -0,0 +1,152 @@ +/* + * L.TileLayer is used for standard xyz-numbered tile layers. + */ +L.Google = L.Class.extend({ + includes: L.Mixin.Events, + + options: { + minZoom: 0, + maxZoom: 18, + tileSize: 256, + subdomains: 'abc', + errorTileUrl: '', + attribution: '', + opacity: 1, + continuousWorld: false, + noWrap: false, + }, + + // Possible types: SATELLITE, ROADMAP, HYBRID, INGRESS + initialize: function(type, options, styles) { + L.Util.setOptions(this, options); + if(type === 'INGRESS') { + type = 'ROADMAP'; + this._styles = [{featureType:"all", elementType:"all", stylers:[{visibility:"on"}, {hue:"#0091ff"}, {invert_lightness:true}]}, {featureType:"water", elementType:"all", stylers:[{visibility:"on"}, {hue:"#005eff"}, {invert_lightness:true}]}, {featureType:"poi", stylers:[{visibility:"off"}]}, {featureType:"transit", elementType:"all", stylers:[{visibility:"off"}]}]; + } else { + this._styles = null; + } + this._type = google.maps.MapTypeId[type || 'SATELLITE']; + }, + + onAdd: function(map, insertAtTheBottom) { + this._map = map; + this._insertAtTheBottom = insertAtTheBottom; + + // create a container div for tiles + this._initContainer(); + this._initMapObject(); + + // set up events + map.on('viewreset', this._resetCallback, this); + + this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this); + map.on('move', this._update, this); + //map.on('moveend', this._update, this); + + this._reset(); + this._update(); + }, + + onRemove: function(map) { + this._map._container.removeChild(this._container); + //this._container = null; + + this._map.off('viewreset', this._resetCallback, this); + + this._map.off('move', this._update, this); + //this._map.off('moveend', this._update, this); + }, + + getAttribution: function() { + return this.options.attribution; + }, + + setOpacity: function(opacity) { + this.options.opacity = opacity; + if (opacity < 1) { + L.DomUtil.setOpacity(this._container, opacity); + } + }, + + _initContainer: function() { + var tilePane = this._map._container + first = tilePane.firstChild; + + if (!this._container) { + this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left'); + this._container.id = "_GMapContainer"; + } + + if (true) { + tilePane.insertBefore(this._container, first); + + this.setOpacity(this.options.opacity); + var size = this._map.getSize(); + this._container.style.width = size.x + 'px'; + this._container.style.height = size.y + 'px'; + } + }, + + _initMapObject: function() { + this._google_center = new google.maps.LatLng(0, 0); + var map = new google.maps.Map(this._container, { + center: this._google_center, + zoom: 0, + styles: this._styles, + mapTypeId: this._type, + disableDefaultUI: true, + keyboardShortcuts: false, + draggable: false, + disableDoubleClickZoom: true, + scrollwheel: false, + streetViewControl: false + }); + + var _this = this; + this._reposition = google.maps.event.addListenerOnce(map, "center_changed", + function() { _this.onReposition(); }); + + map.backgroundColor = '#ff0000'; + this._google = map; + }, + + _resetCallback: function(e) { + this._reset(e.hard); + }, + + _reset: function(clearOldContainer) { + this._initContainer(); + }, + + _update: function() { + this._resize(); + + var bounds = this._map.getBounds(); + var ne = bounds.getNorthEast(); + var sw = bounds.getSouthWest(); + var google_bounds = new google.maps.LatLngBounds( + new google.maps.LatLng(sw.lat, sw.lng), + new google.maps.LatLng(ne.lat, ne.lng) + ); + var center = this._map.getCenter(); + var _center = new google.maps.LatLng(center.lat, center.lng); + + this._google.setCenter(_center); + this._google.setZoom(this._map.getZoom()); + //this._google.fitBounds(google_bounds); + }, + + _resize: function() { + var size = this._map.getSize(); + if (this._container.style.width == size.x && + this._container.style.height == size.y) + return; + this._container.style.width = size.x + 'px'; + this._container.style.height = size.y + 'px'; + google.maps.event.trigger(this._google, "resize"); + }, + + onReposition: function() { + //google.maps.event.trigger(this._google, "resize"); + } +}); diff --git a/total-conversion-build.user.js b/total-conversion-build.user.js index 63de15b3..22e9bc34 100644 --- a/total-conversion-build.user.js +++ b/total-conversion-build.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@breunigs // @name intel map total conversion -// @version 0.4-2013-02-09-141136 +// @version 0.4-2013-02-09-150641 // @namespace https://github.com/breunigs/ingress-intel-total-conversion // @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js @@ -43,7 +43,7 @@ for(var i = 0; i < d.length; i++) { document.getElementsByTagName('head')[0].innerHTML = '' //~ + '' + 'Ingress Intel Map' - + '' + + '' + '' + ''; @@ -928,10 +928,10 @@ function asyncLoadScript(a){return function(b,c){var d=document.createElement("s // modified version of https://github.com/shramov/leaflet-plugins. Also // contains the default Ingress map style. -var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/leaflet_google.js'; +var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/external/leaflet_google.js'; var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'; var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js'; -var AUTOLINK = 'http://raw.github.com/bryanwoods/autolink-js/master/autolink.js'; +var AUTOLINK = 'http://breunigs.github.com/ingress-intel-total-conversion/external/autolink.js'; // after all scripts have loaded, boot the actual app load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).thenRun(boot); From c9045aa9881e9362ab423706d4e5643fd58d1ae3 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sat, 9 Feb 2013 15:19:41 +0100 Subject: [PATCH 05/63] handle load fails better --- code/boot.js | 4 +++- total-conversion-build.user.js | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/boot.js b/code/boot.js index 9b5ef951..5c735d9a 100644 --- a/code/boot.js +++ b/code/boot.js @@ -198,4 +198,6 @@ var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js'; var AUTOLINK = 'http://breunigs.github.com/ingress-intel-total-conversion/external/autolink.js'; // after all scripts have loaded, boot the actual app -load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).thenRun(boot); +load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).onError(function (err) { + alert('Could not all resources, the script likely won’t work.\n\nIf this happend the first time for you, it’s probably a temporary issue. Just wait a bit and try again.\n\nIf you installed the script for the first time and this happens:\n– try disabling NoScript if you have it installed\n– press CTRL+SHIFT+K in Firefox or CTRL+SHIFT+I in Chrome/Opera and reload the page. Additional info may be available in the console.\n– Open an issue at https://github.com/breunigs/ingress-intel-total-conversion/issues'); +}).thenRun(boot); diff --git a/total-conversion-build.user.js b/total-conversion-build.user.js index 22e9bc34..06e4f2e3 100644 --- a/total-conversion-build.user.js +++ b/total-conversion-build.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@breunigs // @name intel map total conversion -// @version 0.4-2013-02-09-150641 +// @version 0.4-2013-02-09-151927 // @namespace https://github.com/breunigs/ingress-intel-total-conversion // @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js @@ -43,7 +43,7 @@ for(var i = 0; i < d.length; i++) { document.getElementsByTagName('head')[0].innerHTML = '' //~ + '' + 'Ingress Intel Map' - + '' + + '' + '' + ''; @@ -934,7 +934,9 @@ var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js'; var AUTOLINK = 'http://breunigs.github.com/ingress-intel-total-conversion/external/autolink.js'; // after all scripts have loaded, boot the actual app -load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).thenRun(boot); +load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).onError(function (err) { + alert('Could not all resources, the script likely won’t work.\n\nIf this happend the first time for you, it’s probably a temporary issue. Just wait a bit and try again.\n\nIf you installed the script for the first time and this happens:\n– try disabling NoScript if you have it installed\n– press CTRL+SHIFT+K in Firefox or CTRL+SHIFT+I in Chrome/Opera and reload the page. Additional info may be available in the console.\n– Open an issue at https://github.com/breunigs/ingress-intel-total-conversion/issues'); +}).thenRun(boot); window.chat = function() {}; From 904be9b5b123074d889ea1f99c826362ea5d56b6 Mon Sep 17 00:00:00 2001 From: Pavol Babincak Date: Sat, 9 Feb 2013 17:30:32 +0100 Subject: [PATCH 06/63] Display current energy for whole portal --- README.md | 1 + code/portal_detail_display_tools.js | 8 ++++++-- code/portal_info.js | 16 +++++++++++++++- code/utils_misc.js | 4 ++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 62752ef5..023e8b99 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ Contributors [OshiHidra](https://github.com/OshiHidra), [Xelio](https://github.com/Xelio), [ZauberNerd](https://github.com/ZauberNerd) +[Scrool](https://github.com/Scrool) Hacking diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index c3443d72..1c9df052 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -65,8 +65,12 @@ window.getModDetails = function(d) { } window.getEnergyText = function(d) { - var nrg = getPortalEnergy(d); - return 'energy: ' + (nrg > 1000 ? Math.round(nrg/1000) +' k': nrg); + var currentNrg = getCurrentPortalEnergy(d); + var totalNrg = getTotalPortalEnergy(d); + var inf = currentNrg + ' / ' + totalNrg; + var fill = prettyEnergy(currentNrg) + ' / ' + prettyEnergy(totalNrg) + var meter = 'energy: ' + fill + ''; + return meter; } window.getAvgResoDistText = function(d) { diff --git a/code/portal_info.js b/code/portal_info.js index c75d748d..edf8298d 100644 --- a/code/portal_info.js +++ b/code/portal_info.js @@ -17,7 +17,21 @@ window.getPortalLevel = function(d) { return hasReso ? Math.max(1, lvl/8) : 0; } -window.getPortalEnergy = function(d) { +window.getTotalPortalEnergy = function(d) { + var nrg = 0; + $.each(d.resonatorArray.resonators, function(ind, reso) { + if(!reso) return true; + var level = parseInt(reso.level); + var max = RESO_NRG[level]; + nrg += max; + }); + return nrg; +} + +// For backwards compatibility +window.getPortalEnergy = window.getTotalPortalEnergy; + +window.getCurrentPortalEnergy = function(d) { var nrg = 0; $.each(d.resonatorArray.resonators, function(ind, reso) { if(!reso) return true; diff --git a/code/utils_misc.js b/code/utils_misc.js index 3fca9f17..d74d3bdd 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -148,3 +148,7 @@ if (typeof String.prototype.startsWith !== 'function') { return this.slice(0, str.length) === str; }; } + +window.prettyEnergy = function(nrg) { + return nrg> 1000 ? Math.round(nrg/1000) + ' k': nrg; +} From dcb7075dda367998670beadc63672165c7998446 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sat, 9 Feb 2013 18:01:11 +0100 Subject: [PATCH 07/63] =?UTF-8?q?remove=20ruby=20build=20script.=20Python?= =?UTF-8?q?=20is=20used=20for=20the=20local=20web=20server=20anyway,=20so?= =?UTF-8?q?=20don=E2=80=99t=20introduce=20further=20dependencies=20for=20s?= =?UTF-8?q?uch=20a=20trivial=20taask=20as=20concatenating=20files.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- autobuild.sh | 4 ++-- build.py | 0 build.rb | 9 --------- 4 files changed, 3 insertions(+), 12 deletions(-) mode change 100644 => 100755 build.py delete mode 100755 build.rb diff --git a/README.md b/README.md index 62752ef5..9d463ae2 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Contributors Hacking ------- -Execute `./build.rb` or `./build.py` to effectively concatenate `main.js` with all the files in `code/`. It generates the user script which may be installed into your browser. Do not modify `total-conversion-build.user.js` manually, because it is automatically generated. Please don’t include it in patches either, because it makes merging harder. Instead, modify the files in `code/` and have that file built for you. +Execute `./build.py` to effectively concatenate `main.js` with all the files in `code/`. It generates the user script which may be installed into your browser. Do not modify `total-conversion-build.user.js` manually, because it is automatically generated. Please don’t include it in patches either, because it makes merging harder. Instead, modify the files in `code/` and have that file built for you. `style.css` contains most styles required for the user-script. The extra ones can be found in `code/boot.js#window.setupStyles`. Only CSS rules that depend on config variables should be defined there. diff --git a/autobuild.sh b/autobuild.sh index df151d1a..1730aadd 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -1,8 +1,8 @@ #!/bin/sh -./build.rb +./build.py FORMAT=$(echo "\033[1;33m%w%f\033[0m written") while inotifywait -qre close_write --exclude "total-conversion-build.user.js|.git*" --format "$FORMAT" . do - ./build.rb + ./build.py done diff --git a/build.py b/build.py old mode 100644 new mode 100755 diff --git a/build.rb b/build.rb deleted file mode 100755 index 81789aea..00000000 --- a/build.rb +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env ruby -# encoding: utf-8 - -c = Dir.glob('code/*').map { |f| File.read(f) } -n = Time.now.strftime('%Y-%m-%d-%H%M%S') -m = File.read('main.js').gsub('@@BUILDDATE@@', n) -m = m.split('@@INJECTHERE@@') -t = m.insert(1, c).flatten.join("\n\n") -File.open('total-conversion-build.user.js', 'w') {|f| f.write(t) } From 6fabe5c5b08c84bfd5826f5a05bcd2ee18150a26 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sat, 9 Feb 2013 18:03:56 +0100 Subject: [PATCH 08/63] =?UTF-8?q?accidentally=20commited=20old=20version?= =?UTF-8?q?=20of=20guess-player=20script.=20Likely=20it=20didn=E2=80=99t?= =?UTF-8?q?=20work=20at=20all.=20Fixes=20#65?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/guess-player-levels.user.js | 37 ++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/plugins/guess-player-levels.user.js b/plugins/guess-player-levels.user.js index 898621f5..ce69f05d 100644 --- a/plugins/guess-player-levels.user.js +++ b/plugins/guess-player-levels.user.js @@ -11,16 +11,20 @@ // ==/UserScript== function wrapper() { -console.log('hello from plugin'); - +// ensure plugin framework is there, even if iitc is not yet loaded if(typeof window.plugin !== 'function') window.plugin = function() {}; -console.log('window.plugin now is:'); -console.log(window.plugin); +// PLUGIN START //////////////////////////////////////////////////////// +// use own namespace for plugin +window.plugin.guessPlayerLevels = function() {}; -window.plugin.guessPlayerLevels = function() { +window.plugin.guessPlayerLevels.setupCallback = function() { + $('#toolbox').append('guess player levels '); +} + +window.plugin.guessPlayerLevels.guess = function() { var players = {}; $.each(window.portals, function(ind, portal) { var r = portal.options.details.resonatorArray.resonators; @@ -37,19 +41,30 @@ window.plugin.guessPlayerLevels = function() { playersNamed[getPlayerName(guid)] = level; }); - var s = ''; - $.each(Object.keys(playersNamed).sort, function(ind, playerName) { - s += playerName + ': ' + level; + var s = 'the players have at least the following level:\n\n'; + $.each(Object.keys(playersNamed).sort(), function(ind, playerName) { + var level = playersNamed[playerName]; + var nick = (playerName + ': ').slice(0, 20); + s += nick + '\t' + level + '\n'; }); + s += '\n\nIf there are some unresolved names, simply try again.' + alert(s); } +var setup = window.plugin.guessPlayerLevels.setupCallback; -console.log('window.plugin.guessPlayerLevels now is:'); -console.log(window.plugin.guessPlayerLevels); - +// PLUGIN END ////////////////////////////////////////////////////////// +if(window.iitcLoaded && typeof setup === 'function') { + setup(); +} else { + if(window.bootPlugins) + window.bootPlugins.push(setup); + else + window.bootPlugins = [setup]; +} } // wrapper end // inject code into site context var script = document.createElement('script'); From a7449b9c559244892f68cb0f8d41624a85316a08 Mon Sep 17 00:00:00 2001 From: Pavol Babincak Date: Sat, 9 Feb 2013 19:25:58 +0100 Subject: [PATCH 09/63] Moved my name in contributors to be in alphabetical order --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 023e8b99..87d4def6 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,9 @@ Contributors [JasonMillward](https://github.com/JasonMillward), [mledoze](https://github.com/mledoze), [OshiHidra](https://github.com/OshiHidra), +[Scrool](https://github.com/Scrool) [Xelio](https://github.com/Xelio), [ZauberNerd](https://github.com/ZauberNerd) -[Scrool](https://github.com/Scrool) Hacking From 0bbf6c46a27039ced329fdfb59aa4942bfcfc0f6 Mon Sep 17 00:00:00 2001 From: Pavol Babincak Date: Sat, 9 Feb 2013 19:36:49 +0100 Subject: [PATCH 10/63] Display players level on mouse hover in chat --- plugins/guess-player-levels.user.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/plugins/guess-player-levels.user.js b/plugins/guess-player-levels.user.js index ce69f05d..6dab2c91 100644 --- a/plugins/guess-player-levels.user.js +++ b/plugins/guess-player-levels.user.js @@ -24,7 +24,22 @@ window.plugin.guessPlayerLevels.setupCallback = function() { $('#toolbox').append('guess player levels '); } -window.plugin.guessPlayerLevels.guess = function() { +window.plugin.guessPlayerLevels.setupChatNickHelper = function() { + $('#chat').delegate('mark', 'mouseenter', function() { + var playersNamed = window.plugin.guessPlayerLevels.prepareGuess(); + var nick = $(this).text(); + var text; + if (nick in playersNamed) { + text = 'Player level: ' + playersNamed[nick] + ' (guessed)'; + } else { + text = 'Player level unknown'; + } + $(this).attr('title', text); + $(this).addClass('help'); + }); +} + +window.plugin.guessPlayerLevels.prepareGuess = function() { var players = {}; $.each(window.portals, function(ind, portal) { var r = portal.options.details.resonatorArray.resonators; @@ -40,6 +55,11 @@ window.plugin.guessPlayerLevels.guess = function() { $.each(players, function(guid, level) { playersNamed[getPlayerName(guid)] = level; }); + return playersNamed; +} + +window.plugin.guessPlayerLevels.guess = function() { + var playersNamed = window.plugin.guessPlayerLevels.prepareGuess(); var s = 'the players have at least the following level:\n\n'; $.each(Object.keys(playersNamed).sort(), function(ind, playerName) { @@ -53,7 +73,10 @@ window.plugin.guessPlayerLevels.guess = function() { alert(s); } -var setup = window.plugin.guessPlayerLevels.setupCallback; +var setup = function() { + window.plugin.guessPlayerLevels.setupCallback(); + window.plugin.guessPlayerLevels.setupChatNickHelper(); +} // PLUGIN END ////////////////////////////////////////////////////////// From 423106f8d04bc1a6cf5aeb71415374a608b8a953 Mon Sep 17 00:00:00 2001 From: Pavol Babincak Date: Sat, 9 Feb 2013 20:04:22 +0100 Subject: [PATCH 11/63] Set title with player's level for owner of resonator --- plugins/guess-player-levels.user.js | 31 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/plugins/guess-player-levels.user.js b/plugins/guess-player-levels.user.js index 6dab2c91..7342616d 100644 --- a/plugins/guess-player-levels.user.js +++ b/plugins/guess-player-levels.user.js @@ -24,18 +24,29 @@ window.plugin.guessPlayerLevels.setupCallback = function() { $('#toolbox').append('guess player levels '); } + +window.plugin.guessPlayerLevels.setLevelTitle = function(dom) { + //expects dom node with nick in its child text node + var playersNamed = window.plugin.guessPlayerLevels.prepareGuess(); + var el = $(dom); + var nick = el.text(); + var text; + if (nick in playersNamed) { + text = 'Player level: ' + playersNamed[nick] + ' (guessed)'; + } else { + text = 'Player level unknown'; + } + el.attr('title', text); + el.addClass('help'); +} + window.plugin.guessPlayerLevels.setupChatNickHelper = function() { + $('#portaldetails').delegate('#resodetails .meter-text', 'mouseenter', function() { + window.plugin.guessPlayerLevels.setLevelTitle(this); + }); + $('#chat').delegate('mark', 'mouseenter', function() { - var playersNamed = window.plugin.guessPlayerLevels.prepareGuess(); - var nick = $(this).text(); - var text; - if (nick in playersNamed) { - text = 'Player level: ' + playersNamed[nick] + ' (guessed)'; - } else { - text = 'Player level unknown'; - } - $(this).attr('title', text); - $(this).addClass('help'); + window.plugin.guessPlayerLevels.setLevelTitle(this); }); } From dc4cea2ed7ebce2222a28f79a8c7b78d3b28e29b Mon Sep 17 00:00:00 2001 From: Eashwar Ranganathan Date: Fri, 8 Feb 2013 03:11:30 -0800 Subject: [PATCH 12/63] Display control field count --- code/map_data.js | 60 +++++++++++++++++++++++++++++++---- code/portal_detail_display.js | 4 ++- main.js | 1 + 3 files changed, 57 insertions(+), 8 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 03739be4..c78d38de 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -69,8 +69,17 @@ window.handleDataResponse = function(data, textStatus, jqXHR) { // to be in the foreground, or they cannot be clicked. See // https://github.com/Leaflet/Leaflet/issues/185 var ppp = []; + var p2f = {}; $.each(m, function(qk, val) { $.each(val.deletedGameEntityGuids, function(ind, guid) { + if(getTypeByGuid(guid) === TYPE_FIELD) { + if(window.fields[guid] === undefined) return true; + $.each(window.fields[guid].options.vertices, function(ind, vertex) { + if(window.portals[vertex.guid] === undefined) return true; + fieldArray = window.portals[vertex.guid].options.portalV2.linkedFields; + fieldArray.splice($.inArray(guid, fieldArray), 1); + }); + } window.removeByGuid(guid); }); @@ -92,15 +101,28 @@ window.handleDataResponse = function(data, textStatus, jqXHR) { ppp.push(ent); // delay portal render - } else if(ent[2].edge !== undefined) + } else if(ent[2].edge !== undefined) { renderLink(ent); - else if(ent[2].capturedRegion !== undefined) + } else if(ent[2].capturedRegion !== undefined) { + $.each(ent[2].capturedRegion, function(ind, vertex) { + if(p2f[vertex.guid] === undefined) + p2f[vertex.guid] = new Array(); + p2f[vertex.guid].push(ent[0]); + }); renderField(ent); - else + } else { throw('Unknown entity: ' + JSON.stringify(ent)); + } }); }); + $.each(ppp, function(ind, portal) { + if(p2f[portal[0]] === undefined) + portal[2].portalV2['linkedFields'] = []; + else + portal[2].portalV2['linkedFields'] = $.unique(p2f[portal[0]]); + }); + $.each(ppp, function(ind, portal) { renderPortal(portal); }); if(portals[selectedPortal]) portals[selectedPortal].bringToFront(); @@ -143,8 +165,8 @@ window.cleanUp = function() { console.log('removed out-of-bounds: '+cnt[0]+' portals, '+cnt[1]+' links, '+cnt[2]+' fields'); } -// removes given entity from map -window.removeByGuid = function(guid) { +// translates guids to entity types +window.getTypeByGuid = function(guid) { // portals end in “.11” or “.12“, links in “.9", fields in “.b” // .11 == portals // .12 == portals @@ -155,16 +177,39 @@ window.removeByGuid = function(guid) { switch(guid.slice(33)) { case '11': case '12': + return TYPE_PORTAL; + break; + case '9': + return TYPE_LINK; + break; + case 'b': + return TYPE_FIELD; + break; + case 'c': + return TYPE_PLAYER; + break; + case 'd': + return TYPE_CHAT; + break; + default: + return TYPE_UNKNOWN; + } +} + +// removes given entity from map +window.removeByGuid = function(guid) { + switch(getTypeByGuid(guid)) { + case TYPE_PORTAL: if(!window.portals[guid]) return; var p = window.portals[guid]; for(var i = 0; i < portalsLayers.length; i++) portalsLayers[i].removeLayer(p); break; - case '9': + case TYPE_LINK: if(!window.links[guid]) return; linksLayer.removeLayer(window.links[guid]); break; - case 'b': + case TYPE_FIELD: if(!window.fields[guid]) return; fieldsLayer.removeLayer(window.fields[guid]); break; @@ -282,6 +327,7 @@ window.renderField = function(ent) { stroke: false, clickable: false, smoothFactor: 10, + vertices: ent[2].capturedRegion, guid: ent[0]}); if(!getPaddedBounds().intersects(poly.getBounds())) return; diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 2187b34b..4f84fb9a 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -29,8 +29,10 @@ window.renderPortalDetails = function(guid) { var time = d.captured ? unixTimeToString(d.captured.capturedTime) : null; var sinceText = time ? 'since: ' + time : null; + var linkedFields = 'fields: ' + d.portalV2.linkedFields.length; + // collect and html-ify random data - var randDetails = [playerText, sinceText, getRangeText(d), getEnergyText(d), linksText, getAvgResoDistText(d)]; + var randDetails = [playerText, sinceText, linkedFields, getRangeText(d), getEnergyText(d), linksText, getAvgResoDistText(d)]; randDetails = randDetails.map(function(detail) { if(!detail) return ''; detail = detail.split(':'); diff --git a/main.js b/main.js index f34165eb..c7866f9f 100644 --- a/main.js +++ b/main.js @@ -134,6 +134,7 @@ var NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q var DEG2RAD = Math.PI / 180; var TEAM_NONE = 0, TEAM_RES = 1, TEAM_ENL = 2; var TEAM_TO_CSS = ['none', 'res', 'enl']; +var TYPE_UNKNOWN = 0, TYPE_PORTAL = 1, TYPE_LINK = 2, TYPE_FIELD = 3, TYPE_PLAYER = 4, TYPE_CHAT = 5; // make PLAYER variable available in site context var PLAYER = window.PLAYER; var CHAT_SHRINKED = 60; From 5bbb76413374b675b87c163d12fc848e341020aa Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 10 Feb 2013 00:20:45 +0100 Subject: [PATCH 13/63] resonators are now roughly ordered by their octant (fixes #35) N NE NW E W SE SW S --- code/portal_detail_display_tools.js | 36 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index c3443d72..38c5257e 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -85,10 +85,17 @@ window.getReportIssueInfoText = function(d) { window.getResonatorDetails = function(d) { console.log('rendering reso details'); var resoDetails = ''; - var slotsFilled = 0; - $.each(d.resonatorArray.resonators, function(ind, reso) { + // octant=slot: 0=E, 1=NE, 2=N, 3=NW, 4=W, 5=SW, 6=S, SE=7 + // resos in the display should be ordered like this: + // N NE Since the view is displayed in columns, they + // NW E need to be ordered like this: N, NW, W, SW, NE, + // W SE E, SE, S, i.e. 2 3 4 5 1 0 7 6 + // SW S + $.each([2, 3, 4, 5, 1, 0, 7, 6], function(ind, slot) { + var isLeft = slot >= 2 && slot <= 5; + var reso = d.resonatorArray.resonators[slot]; if(!reso) { - resoDetails += renderResonatorDetails(slotsFilled++, 0); + resoDetails += renderResonatorDetails(slot, 0, 0, null, null, isLeft); return true; } @@ -96,9 +103,11 @@ window.getResonatorDetails = function(d) { var v = parseInt(reso.energyTotal); var nick = window.getPlayerName(reso.ownerGuid); var dist = reso.distanceToPortal; + // if array order and slot order drift apart, at least the octant + // naming will still be correct. + slot = parseInt(reso.slot); - slotsFilled++; - resoDetails += renderResonatorDetails(parseInt(reso.slot), l, v, dist, nick); + resoDetails += renderResonatorDetails(slot, l, v, dist, nick, isLeft); }); return resoDetails; } @@ -107,15 +116,15 @@ window.getResonatorDetails = function(d) { // not work with raw details-hash. Needs digested infos instead: // slot: which slot this resonator occupies. Starts with 0 (east) and // rotates clockwise. So, last one is 7 (southeast). -window.renderResonatorDetails = function(slot, level, nrg, dist, nick) { - if(level == 0) { - var meter = ''; +window.renderResonatorDetails = function(slot, level, nrg, dist, nick, isLeft) { + if(level === 0) { + var meter = ''; } else { var max = RESO_NRG[level]; var fillGrade = nrg/max*100; - var inf = 'energy:\t\t' + nrg + ' / ' + max + ' (' + Math.round(fillGrade) + '%)' + '\n' - + 'level:\t\t' + level +'\n' + var inf = 'energy:\t\t' + nrg + ' / ' + max + ' (' + Math.round(fillGrade) + '%)\n' + + 'level:\t\t' + level + '\n' + 'distance:\t' + dist + 'm\n' + 'owner:\t\t' + nick + '\n' + 'octant:\t' + OCTANTS[slot]; @@ -128,10 +137,9 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) { var fill = ''; - var meter = '' - + fill + lbar + ''; + var meter = '' + fill + lbar + ''; } - var cls = slot <= 3 ? 'left' : 'right'; + var cls = isLeft ? 'left' : 'right'; var text = ''+(nick||'')+''; - return (slot <= 3 ? text+meter : meter+text) + '
'; + return (isLeft ? text+meter : meter+text) + '
'; } From 6b8c454af3a531168fca1af19dda55535d2e2042 Mon Sep 17 00:00:00 2001 From: Pavol Babincak Date: Sun, 10 Feb 2013 00:22:24 +0100 Subject: [PATCH 14/63] Player level label renamed to minimal player level --- plugins/guess-player-levels.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/guess-player-levels.user.js b/plugins/guess-player-levels.user.js index 7342616d..5b679510 100644 --- a/plugins/guess-player-levels.user.js +++ b/plugins/guess-player-levels.user.js @@ -32,9 +32,9 @@ window.plugin.guessPlayerLevels.setLevelTitle = function(dom) { var nick = el.text(); var text; if (nick in playersNamed) { - text = 'Player level: ' + playersNamed[nick] + ' (guessed)'; + text = 'Min player level: ' + playersNamed[nick] + ' (guessed)'; } else { - text = 'Player level unknown'; + text = 'Min player level unknown'; } el.attr('title', text); el.addClass('help'); From 53ff334fe12ada11729ba43e35b1849cf607eab7 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 10 Feb 2013 00:26:27 +0100 Subject: [PATCH 15/63] move getTypeByGuid to utils_misc.js and clean it up a little --- code/map_data.js | 30 ------------------------------ code/utils_misc.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index c78d38de..6d12e7a7 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -165,36 +165,6 @@ window.cleanUp = function() { console.log('removed out-of-bounds: '+cnt[0]+' portals, '+cnt[1]+' links, '+cnt[2]+' fields'); } -// translates guids to entity types -window.getTypeByGuid = function(guid) { - // portals end in “.11” or “.12“, links in “.9", fields in “.b” - // .11 == portals - // .12 == portals - // .9 == links - // .b == fields - // .c == player/creator - // .d == chat messages - switch(guid.slice(33)) { - case '11': - case '12': - return TYPE_PORTAL; - break; - case '9': - return TYPE_LINK; - break; - case 'b': - return TYPE_FIELD; - break; - case 'c': - return TYPE_PLAYER; - break; - case 'd': - return TYPE_CHAT; - break; - default: - return TYPE_UNKNOWN; - } -} // removes given entity from map window.removeByGuid = function(guid) { diff --git a/code/utils_misc.js b/code/utils_misc.js index d74d3bdd..02a202b8 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -138,6 +138,37 @@ window.zoomToAndShowPortal = function(guid, latlng) { map.setView(latlng, 17); } +// translates guids to entity types +window.getTypeByGuid = function(guid) { + // portals end in “.11” or “.12“, links in “.9", fields in “.b” + // .11 == portals + // .12 == portals + // .9 == links + // .b == fields + // .c == player/creator + // .d == chat messages + switch(guid.slice(33)) { + case '11': + case '12': + return TYPE_PORTAL; + + case '9': + return TYPE_LINK; + + case 'b': + return TYPE_FIELD; + + case 'c': + return TYPE_PLAYER; + + case 'd': + return TYPE_CHAT; + + default: + return TYPE_UNKNOWN; + } +} + String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); } From fc58676b7f218695f5b9d406dd2cbceab5e15838 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 10 Feb 2013 00:29:47 +0100 Subject: [PATCH 16/63] =?UTF-8?q?place=20fields=20counter=20somewhere=20el?= =?UTF-8?q?se=20so=20it=20doesn=E2=80=99t=20reorder=20the=20whole=20detail?= =?UTF-8?q?=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/portal_detail_display.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 4f84fb9a..0a7fd8a5 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -32,7 +32,7 @@ window.renderPortalDetails = function(guid) { var linkedFields = 'fields: ' + d.portalV2.linkedFields.length; // collect and html-ify random data - var randDetails = [playerText, sinceText, linkedFields, getRangeText(d), getEnergyText(d), linksText, getAvgResoDistText(d)]; + var randDetails = [playerText, sinceText, getRangeText(d), getEnergyText(d), linksText, getAvgResoDistText(d), linkedFields]; randDetails = randDetails.map(function(detail) { if(!detail) return ''; detail = detail.split(':'); From 6fdfac2923bb089ec91ddb8f974f4557a2d88b5d Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 10 Feb 2013 00:31:24 +0100 Subject: [PATCH 17/63] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3c35346..b5a6486d 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Contributors [JasonMillward](https://github.com/JasonMillward), [mledoze](https://github.com/mledoze), [OshiHidra](https://github.com/OshiHidra), -[Scrool](https://github.com/Scrool) +[Scrool](https://github.com/Scrool), [Xelio](https://github.com/Xelio), [ZauberNerd](https://github.com/ZauberNerd) From c34d7ee3a267ada2b66374498a201cb95c93addb Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 13:25:39 +0800 Subject: [PATCH 18/63] Resonator on map Change: Add "RESONATOR_DISPLAY_ZOOM_LEVEL" to control minimum zoom level resonator will display Add layerGroup "resonatorsLayers" to draw resonators on it. Add "window.resonators" to store references to resonators on map Resonator will have guid of portal with ".11" or ".12" replaced with ".r0"~".r7" Add function "window.renderResontor" to draw resonators (use sorgo's code [sorgo](https://github.com/sorgo)) "window.renderPortal" will call "window.renderResontor" before add portal to portalsLayers Change "window.removeByGuid" to handle resonators Change "window.cleanUp" to handle resonators cleanup --- code/boot.js | 9 +++++ code/map_data.js | 83 +++++++++++++++++++++++++++++++++++++++++++++- code/utils_misc.js | 12 +++++++ main.js | 8 +++-- 4 files changed, 109 insertions(+), 3 deletions(-) diff --git a/code/boot.js b/code/boot.js index 5c735d9a..531c5c60 100644 --- a/code/boot.js +++ b/code/boot.js @@ -81,6 +81,15 @@ window.setupMap = function() { map.addLayer(linksLayer, true); addLayers['Links'] = linksLayer; + resonatorsLayers = []; + for(var i = 1; i <= 8; i++) { + resonatorsLayers[i] = L.layerGroup([]); + map.addLayer(resonatorsLayers[i]); + var t = 'Level ' + i + ' Portal resonators'; + addLayers[t] = resonatorsLayers[i]; + } + + map.addControl(new L.Control.Layers({ 'OSM Cloudmade Midnight': views[0], 'OSM Cloudmade Minimal': views[1], diff --git a/code/map_data.js b/code/map_data.js index 6d12e7a7..f4c580fc 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -146,9 +146,15 @@ window.cleanUp = function() { portalsLayers[i].eachLayer(function(portal) { // portal must be in bounds and have a high enough level. Also don’t // remove if it is selected. - if(portal.options.guid == window.selectedPortal || + var portalGuid = portal.options.guid; + if(portalGuid == window.selectedPortal || (b.contains(portal.getLatLng()) && i >= minlvl)) return; + cnt[0]++; + + //remove attached resonators + for(var j = 0; j <= 7; j++) removeByGuid( portalResonatorGuid(portalGuid,j) ); + portalsLayers[i].removeLayer(portal); }); } @@ -162,6 +168,14 @@ window.cleanUp = function() { cnt[2]++; fieldsLayer.removeLayer(field); }); + // remove all resonator if zoom level become + // lower than RESONATOR_DISPLAY_ZOOM_LEVEL + if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL){ + for(var i = 1; i < resonatorsLayers.length; i++){ + resonatorsLayers[i].clearLayers(); + } + console.log('removed all resonators'); + } console.log('removed out-of-bounds: '+cnt[0]+' portals, '+cnt[1]+' links, '+cnt[2]+' fields'); } @@ -183,6 +197,10 @@ window.removeByGuid = function(guid) { if(!window.fields[guid]) return; fieldsLayer.removeLayer(window.fields[guid]); break; + case TYPE_RESONATOR: + if(!window.resonators[guid]) return; + resonatorsLayers[window.resonators[guid].options.pLevel].removeLayer(window.resonators[guid]); + break; default: console.warn('unknown GUID type: ' + guid); //window.debug.printStackTrace(); @@ -244,10 +262,73 @@ window.renderPortal = function(ent) { window.renderPortalDetails(ent[0]); window.map.setView(latlng, 17); }); + + window.renderResonator(ent); + // portalLevel contains a float, need to round down p.addTo(portalsLayers[parseInt(portalLevel)]); } +window.renderResonator = function(ent) { + + var portalLevel = getPortalLevel(ent[2]); + if(portalLevel < getMinPortalLevel() && ent[0] != selectedPortal) return; + + if(map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) return; + + for(var i=0; i Date: Sun, 10 Feb 2013 09:02:08 +0100 Subject: [PATCH 19/63] fix #79 and part of #39 --- code/chat.js | 6 ++++-- style.css | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/code/chat.js b/code/chat.js index 0ece265f..eb4b2b81 100644 --- a/code/chat.js +++ b/code/chat.js @@ -469,14 +469,16 @@ window.chat.getActive = function() { window.chat.toggle = function() { var c = $('#chat, #chatcontrols'); if(c.hasClass('expand')) { - $('#chatcontrols a:first').text('expand'); + $('#chatcontrols a:first').text('◢◣'); c.removeClass('expand'); var div = $('#chat > div:visible'); div.data('ignoreNextScroll', true); div.scrollTop(99999999); // scroll to bottom + $('.leaflet-control').css('margin-left', '0'); } else { - $('#chatcontrols a:first').text('shrink'); + $('#chatcontrols a:first').text('◥◤'); c.addClass('expand'); + $('.leaflet-control').css('margin-left', '720px'); chat.needMoreMessages(); } } diff --git a/style.css b/style.css index 683c2963..eebbc734 100644 --- a/style.css +++ b/style.css @@ -100,6 +100,11 @@ a:hover { border: 1px solid #20A8B1; } +#chatcontrols a:first-child { + letter-spacing:-1px; + text-decoration: none !important; +} + #chatcontrols a.active { border-color: #FFCE00; border-bottom-width:0px; From eecec0b4a4c261519537b554a76d5c5e70bbce9e Mon Sep 17 00:00:00 2001 From: Xelio Date: Sun, 10 Feb 2013 16:06:13 +0800 Subject: [PATCH 20/63] Move resonator layer back to layerGroup "portalsLayers", to make it work with portal level filter. And modify cleanup code to work with this change. --- code/boot.js | 9 --------- code/map_data.js | 40 ++++++++++++++++++++++------------------ main.js | 2 +- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/code/boot.js b/code/boot.js index 531c5c60..5c735d9a 100644 --- a/code/boot.js +++ b/code/boot.js @@ -81,15 +81,6 @@ window.setupMap = function() { map.addLayer(linksLayer, true); addLayers['Links'] = linksLayer; - resonatorsLayers = []; - for(var i = 1; i <= 8; i++) { - resonatorsLayers[i] = L.layerGroup([]); - map.addLayer(resonatorsLayers[i]); - var t = 'Level ' + i + ' Portal resonators'; - addLayers[t] = resonatorsLayers[i]; - } - - map.addControl(new L.Control.Layers({ 'OSM Cloudmade Midnight': views[0], 'OSM Cloudmade Minimal': views[1], diff --git a/code/map_data.js b/code/map_data.js index f4c580fc..4bf24c50 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -143,19 +143,31 @@ window.cleanUp = function() { var minlvl = getMinPortalLevel(); for(var i = 0; i < portalsLayers.length; i++) { // i is also the portal level - portalsLayers[i].eachLayer(function(portal) { + portalsLayers[i].eachLayer(function(item) { // portal must be in bounds and have a high enough level. Also don’t // remove if it is selected. - var portalGuid = portal.options.guid; - if(portalGuid == window.selectedPortal || - (b.contains(portal.getLatLng()) && i >= minlvl)) return; + var itemGuid = item.options.guid; + switch(getTypeByGuid(itemGuid)){ - cnt[0]++; + case TYPE_PORTAL: + if(itemGuid == window.selectedPortal || + (b.contains(item.getLatLng()) && i >= minlvl)) return; + + cnt[0]++; - //remove attached resonators - for(var j = 0; j <= 7; j++) removeByGuid( portalResonatorGuid(portalGuid,j) ); + //remove attached resonators + for(var j = 0; j <= 7; j++) removeByGuid( portalResonatorGuid(itemGuid,j) ); - portalsLayers[i].removeLayer(portal); + portalsLayers[i].removeLayer(item); + break; + + case TYPE_RESONATOR: + // remove all resonator if zoom level become + // lower than RESONATOR_DISPLAY_ZOOM_LEVEL + if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL) + portalsLayers[i].removeLayer(item); + break; + } }); } linksLayer.eachLayer(function(link) { @@ -168,14 +180,6 @@ window.cleanUp = function() { cnt[2]++; fieldsLayer.removeLayer(field); }); - // remove all resonator if zoom level become - // lower than RESONATOR_DISPLAY_ZOOM_LEVEL - if (map.getZoom() < RESONATOR_DISPLAY_ZOOM_LEVEL){ - for(var i = 1; i < resonatorsLayers.length; i++){ - resonatorsLayers[i].clearLayers(); - } - console.log('removed all resonators'); - } console.log('removed out-of-bounds: '+cnt[0]+' portals, '+cnt[1]+' links, '+cnt[2]+' fields'); } @@ -199,7 +203,7 @@ window.removeByGuid = function(guid) { break; case TYPE_RESONATOR: if(!window.resonators[guid]) return; - resonatorsLayers[window.resonators[guid].options.pLevel].removeLayer(window.resonators[guid]); + portalsLayers[window.resonators[guid].options.pLevel].removeLayer(window.resonators[guid]); break; default: console.warn('unknown GUID type: ' + guid); @@ -319,7 +323,7 @@ window.renderResonator = function(ent) { r.on('remove', function() { delete window.resonators[this.options.guid]; }); r.on('add', function() { window.resonators[this.options.guid] = this; }); - r.addTo(resonatorsLayers[parseInt(portalLevel)]); + r.addTo(portalsLayers[parseInt(portalLevel)]); } } diff --git a/main.js b/main.js index 4b61babe..6e2a1262 100644 --- a/main.js +++ b/main.js @@ -159,7 +159,7 @@ window.selectedPortal = null; window.portalRangeIndicator = null; window.portalAccessIndicator = null; window.mapRunsUserAction = false; -var portalsLayers, linksLayer, fieldsLayer, resonatorsLayers; +var portalsLayers, linksLayer, fieldsLayer; // contain references to all entities shown on the map. These are // automatically kept in sync with the items on *sLayer, so never ever From d5285ca26cc60ab61c80fa8e6a1fe5467bf3241b Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 10 Feb 2013 09:51:02 +0100 Subject: [PATCH 21/63] =?UTF-8?q?fix=20fields=20not=20being=20cleared=20fr?= =?UTF-8?q?om=20the=20map=20if=20they=20weren=E2=80=99t=20used=20for=20fie?= =?UTF-8?q?ld=20counting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/map_data.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 6d12e7a7..cc747a76 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -72,8 +72,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) { var p2f = {}; $.each(m, function(qk, val) { $.each(val.deletedGameEntityGuids, function(ind, guid) { - if(getTypeByGuid(guid) === TYPE_FIELD) { - if(window.fields[guid] === undefined) return true; + if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) { $.each(window.fields[guid].options.vertices, function(ind, vertex) { if(window.portals[vertex.guid] === undefined) return true; fieldArray = window.portals[vertex.guid].options.portalV2.linkedFields; From 9440e432de91816b5c7d72ea4e12038f88e87bed Mon Sep 17 00:00:00 2001 From: Cameron Moon Date: Sun, 10 Feb 2013 22:51:54 +1100 Subject: [PATCH 22/63] Added toggle to collapse sidebar --- code/boot.js | 36 +++++++++++++++++++++++++----------- main.js | 12 ++---------- style.css | 39 ++++++++++++++++++++++----------------- 3 files changed, 49 insertions(+), 38 deletions(-) diff --git a/code/boot.js b/code/boot.js index 5c735d9a..37d617fa 100644 --- a/code/boot.js +++ b/code/boot.js @@ -154,6 +154,27 @@ window.setupPlayerStat = function() { ); } +window.setupSidebarToggle = function() { + var toggle = $('#sidebartoggle'); + var sidebar = $('#sidebar'); + toggle.text('▶'); + toggle.css('right', SIDEBAR_WIDTH+2+'px'); + toggle.on('click', function() { + if(sidebar.is(':visible')) { + sidebar.hide(); + $('#map').css('margin-right','0'); + toggle.text('◀'); + toggle.css('right', '0'); + } else { + sidebar.show(); + $('#map').css('margin-right', SIDEBAR_WIDTH+2+'px'); + toggle.text('▶'); + toggle.css('right', SIDEBAR_WIDTH+2+'px'); + } + window.map.invalidateSize(false); + }); +} + // BOOTING /////////////////////////////////////////////////////////// @@ -164,6 +185,7 @@ function boot() { window.setupGeosearch(); window.setupRedeem(); window.setupLargeImagePreview(); + window.setupSidebarToggle(); window.updateGameScore(); window.setupPlayerStat(); window.chat.setup(); @@ -174,13 +196,7 @@ function boot() { // load only once var n = window.PLAYER['nickname']; window.PLAYER['nickMatcher'] = new RegExp('\\b('+n+')\\b', 'ig'); - $('#sidebar').show(); - - if(window.bootPlugins) - $.each(window.bootPlugins, function(ind, ref) { ref(); }); - - window.iitcLoaded = true; } // this is the minified load.js script that allows us to easily load @@ -192,12 +208,10 @@ function asyncLoadScript(a){return function(b,c){var d=document.createElement("s // modified version of https://github.com/shramov/leaflet-plugins. Also // contains the default Ingress map style. -var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/external/leaflet_google.js'; +var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/leaflet_google.js'; var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'; var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js'; -var AUTOLINK = 'http://breunigs.github.com/ingress-intel-total-conversion/external/autolink.js'; +var AUTOLINK = 'http://raw.github.com/bryanwoods/autolink-js/master/autolink.js'; // after all scripts have loaded, boot the actual app -load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).onError(function (err) { - alert('Could not all resources, the script likely won’t work.\n\nIf this happend the first time for you, it’s probably a temporary issue. Just wait a bit and try again.\n\nIf you installed the script for the first time and this happens:\n– try disabling NoScript if you have it installed\n– press CTRL+SHIFT+K in Firefox or CTRL+SHIFT+I in Chrome/Opera and reload the page. Additional info may be available in the console.\n– Open an issue at https://github.com/breunigs/ingress-intel-total-conversion/issues'); -}).thenRun(boot); +load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).thenRun(boot); diff --git a/main.js b/main.js index 1d188f08..7460538a 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@breunigs // @name intel map total conversion -// @version 0.4-@@BUILDDATE@@ +// @version 0.3-@@BUILDDATE@@ // @namespace https://github.com/breunigs/ingress-intel-total-conversion // @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js @@ -58,6 +58,7 @@ document.getElementsByTagName('body')[0].innerHTML = '' + '
' + '' + '' + + '' + '
' // enable scrolling for small screens + ' '; + '
'; @@ -116,9 +115,6 @@ var MAX_DRAWN_FIELDS = 200; var COLOR_SELECTED_PORTAL = '#f00'; var COLORS = ['#FFCE00', '#0088FF', '#03FE03']; // none, res, enl var COLORS_LVL = ['#000', '#FECE5A', '#FFA630', '#FF7315', '#E40000', '#FD2992', '#EB26CD', '#C124E0', '#9627F4']; -var COLORS_MOD = {VERY_RARE: '#F78AF6', RARE: '#AD8AFF', COMMON: '#84FBBD'}; - - // circles around a selected portal that show from where you can hack // it and how far the portal reaches (i.e. how far links may be made // from this portal) @@ -139,7 +135,6 @@ var NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q var DEG2RAD = Math.PI / 180; var TEAM_NONE = 0, TEAM_RES = 1, TEAM_ENL = 2; var TEAM_TO_CSS = ['none', 'res', 'enl']; -var TYPE_UNKNOWN = 0, TYPE_PORTAL = 1, TYPE_LINK = 2, TYPE_FIELD = 3, TYPE_PLAYER = 4, TYPE_CHAT = 5; // make PLAYER variable available in site context var PLAYER = window.PLAYER; var CHAT_SHRINKED = 60; @@ -165,9 +160,6 @@ window.portals = {}; window.links = {}; window.fields = {}; -// plugin framework. Plugins may load earlier than iitc, so don’t -// overwrite data -if(typeof window.plugin !== 'function') window.plugin = function() {}; @@INJECTHERE@@ diff --git a/style.css b/style.css index eebbc734..f1542177 100644 --- a/style.css +++ b/style.css @@ -35,6 +35,26 @@ body { overflow-x:hidden; } +#sidebartoggle { + display: block; + padding: 5px; + position: absolute; + top: 50%; + z-index: 3000; + background-color: rgba(8, 48, 78, 0.9); + color: #FFCE00; + border: 1px solid #20A8B1; + border-right: none; + border-radius: 5px 0 0 5px; + text-decoration: none; +} + +#redeem { + /* cheap hack to prevent sidebar content being overlayed by the map + * status box */ + margin-bottom: 55px; +} + .enl { color: #03fe03 !important; @@ -100,11 +120,6 @@ a:hover { border: 1px solid #20A8B1; } -#chatcontrols a:first-child { - letter-spacing:-1px; - text-decoration: none !important; -} - #chatcontrols a.active { border-color: #FFCE00; border-bottom-width:0px; @@ -182,6 +197,7 @@ mark { overflow:hidden; vertical-align: top; background: transparent; + text-align: right; } summary { @@ -229,7 +245,7 @@ summary { font-size: 12.6px; font-family: Verdana,sans-serif; color: #EEEEEE; - width: 558px + width: 558px !important; } @@ -488,17 +504,6 @@ aside:nth-child(odd) span { width: 140px; } -#toolbox { - padding: 4px; - font-size:90%; -} - -#spacer { - /* cheap hack to prevent sidebar content being overlayed by the map - * status box */ - height: 55px; -} - /* a common portal display takes this much space (prevents moving * content when first selecting a portal) */ From 79b1f2b84069d1b936399727f6f42aa8a26da1e1 Mon Sep 17 00:00:00 2001 From: Cameron Moon Date: Sun, 10 Feb 2013 22:56:53 +1100 Subject: [PATCH 23/63] Revert "Added toggle to collapse sidebar" due to old code in commit This reverts commit 9440e432de91816b5c7d72ea4e12038f88e87bed. --- code/boot.js | 36 +++++++++++------------------------- main.js | 12 ++++++++++-- style.css | 39 +++++++++++++++++---------------------- 3 files changed, 38 insertions(+), 49 deletions(-) diff --git a/code/boot.js b/code/boot.js index 37d617fa..5c735d9a 100644 --- a/code/boot.js +++ b/code/boot.js @@ -154,27 +154,6 @@ window.setupPlayerStat = function() { ); } -window.setupSidebarToggle = function() { - var toggle = $('#sidebartoggle'); - var sidebar = $('#sidebar'); - toggle.text('▶'); - toggle.css('right', SIDEBAR_WIDTH+2+'px'); - toggle.on('click', function() { - if(sidebar.is(':visible')) { - sidebar.hide(); - $('#map').css('margin-right','0'); - toggle.text('◀'); - toggle.css('right', '0'); - } else { - sidebar.show(); - $('#map').css('margin-right', SIDEBAR_WIDTH+2+'px'); - toggle.text('▶'); - toggle.css('right', SIDEBAR_WIDTH+2+'px'); - } - window.map.invalidateSize(false); - }); -} - // BOOTING /////////////////////////////////////////////////////////// @@ -185,7 +164,6 @@ function boot() { window.setupGeosearch(); window.setupRedeem(); window.setupLargeImagePreview(); - window.setupSidebarToggle(); window.updateGameScore(); window.setupPlayerStat(); window.chat.setup(); @@ -196,7 +174,13 @@ function boot() { // load only once var n = window.PLAYER['nickname']; window.PLAYER['nickMatcher'] = new RegExp('\\b('+n+')\\b', 'ig'); + $('#sidebar').show(); + + if(window.bootPlugins) + $.each(window.bootPlugins, function(ind, ref) { ref(); }); + + window.iitcLoaded = true; } // this is the minified load.js script that allows us to easily load @@ -208,10 +192,12 @@ function asyncLoadScript(a){return function(b,c){var d=document.createElement("s // modified version of https://github.com/shramov/leaflet-plugins. Also // contains the default Ingress map style. -var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/leaflet_google.js'; +var LLGMAPS = 'http://breunigs.github.com/ingress-intel-total-conversion/external/leaflet_google.js'; var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'; var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js'; -var AUTOLINK = 'http://raw.github.com/bryanwoods/autolink-js/master/autolink.js'; +var AUTOLINK = 'http://breunigs.github.com/ingress-intel-total-conversion/external/autolink.js'; // after all scripts have loaded, boot the actual app -load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).thenRun(boot); +load(JQUERY, LEAFLET, AUTOLINK).then(LLGMAPS).onError(function (err) { + alert('Could not all resources, the script likely won’t work.\n\nIf this happend the first time for you, it’s probably a temporary issue. Just wait a bit and try again.\n\nIf you installed the script for the first time and this happens:\n– try disabling NoScript if you have it installed\n– press CTRL+SHIFT+K in Firefox or CTRL+SHIFT+I in Chrome/Opera and reload the page. Additional info may be available in the console.\n– Open an issue at https://github.com/breunigs/ingress-intel-total-conversion/issues'); +}).thenRun(boot); diff --git a/main.js b/main.js index 7460538a..1d188f08 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@breunigs // @name intel map total conversion -// @version 0.3-@@BUILDDATE@@ +// @version 0.4-@@BUILDDATE@@ // @namespace https://github.com/breunigs/ingress-intel-total-conversion // @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js @@ -58,7 +58,6 @@ document.getElementsByTagName('body')[0].innerHTML = '' + '
' + '' + '' - + '' + '
' // enable scrolling for small screens + ' '; + '
'; @@ -115,6 +116,9 @@ var MAX_DRAWN_FIELDS = 200; var COLOR_SELECTED_PORTAL = '#f00'; var COLORS = ['#FFCE00', '#0088FF', '#03FE03']; // none, res, enl var COLORS_LVL = ['#000', '#FECE5A', '#FFA630', '#FF7315', '#E40000', '#FD2992', '#EB26CD', '#C124E0', '#9627F4']; +var COLORS_MOD = {VERY_RARE: '#F78AF6', RARE: '#AD8AFF', COMMON: '#84FBBD'}; + + // circles around a selected portal that show from where you can hack // it and how far the portal reaches (i.e. how far links may be made // from this portal) @@ -135,6 +139,7 @@ var NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q var DEG2RAD = Math.PI / 180; var TEAM_NONE = 0, TEAM_RES = 1, TEAM_ENL = 2; var TEAM_TO_CSS = ['none', 'res', 'enl']; +var TYPE_UNKNOWN = 0, TYPE_PORTAL = 1, TYPE_LINK = 2, TYPE_FIELD = 3, TYPE_PLAYER = 4, TYPE_CHAT = 5; // make PLAYER variable available in site context var PLAYER = window.PLAYER; var CHAT_SHRINKED = 60; @@ -160,6 +165,9 @@ window.portals = {}; window.links = {}; window.fields = {}; +// plugin framework. Plugins may load earlier than iitc, so don’t +// overwrite data +if(typeof window.plugin !== 'function') window.plugin = function() {}; @@INJECTHERE@@ diff --git a/style.css b/style.css index f1542177..eebbc734 100644 --- a/style.css +++ b/style.css @@ -35,26 +35,6 @@ body { overflow-x:hidden; } -#sidebartoggle { - display: block; - padding: 5px; - position: absolute; - top: 50%; - z-index: 3000; - background-color: rgba(8, 48, 78, 0.9); - color: #FFCE00; - border: 1px solid #20A8B1; - border-right: none; - border-radius: 5px 0 0 5px; - text-decoration: none; -} - -#redeem { - /* cheap hack to prevent sidebar content being overlayed by the map - * status box */ - margin-bottom: 55px; -} - .enl { color: #03fe03 !important; @@ -120,6 +100,11 @@ a:hover { border: 1px solid #20A8B1; } +#chatcontrols a:first-child { + letter-spacing:-1px; + text-decoration: none !important; +} + #chatcontrols a.active { border-color: #FFCE00; border-bottom-width:0px; @@ -197,7 +182,6 @@ mark { overflow:hidden; vertical-align: top; background: transparent; - text-align: right; } summary { @@ -245,7 +229,7 @@ summary { font-size: 12.6px; font-family: Verdana,sans-serif; color: #EEEEEE; - width: 558px !important; + width: 558px } @@ -504,6 +488,17 @@ aside:nth-child(odd) span { width: 140px; } +#toolbox { + padding: 4px; + font-size:90%; +} + +#spacer { + /* cheap hack to prevent sidebar content being overlayed by the map + * status box */ + height: 55px; +} + /* a common portal display takes this much space (prevents moving * content when first selecting a portal) */ From 2647d58e60de300e4c6f3b688c0d14ff830a0427 Mon Sep 17 00:00:00 2001 From: Cameron Moon Date: Sun, 10 Feb 2013 23:03:10 +1100 Subject: [PATCH 24/63] Added toggle to collapse sidebar (without old code this time) --- code/boot.js | 22 ++++++++++++++++++++++ main.js | 1 + style.css | 13 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/code/boot.js b/code/boot.js index 5c735d9a..692f5b79 100644 --- a/code/boot.js +++ b/code/boot.js @@ -154,6 +154,27 @@ window.setupPlayerStat = function() { ); } +window.setupSidebarToggle = function() { + var toggle = $('#sidebartoggle'); + var sidebar = $('#sidebar'); + toggle.text('▶'); + toggle.css('right', SIDEBAR_WIDTH+2+'px'); + toggle.on('click', function() { + if(sidebar.is(':visible')) { + sidebar.hide(); + $('#map').css('margin-right','0'); + toggle.text('◀'); + toggle.css('right', '0'); + } else { + sidebar.show(); + $('#map').css('margin-right', SIDEBAR_WIDTH+2+'px'); + toggle.text('▶'); + toggle.css('right', SIDEBAR_WIDTH+2+'px'); + } + window.map.invalidateSize(false); + }); +} + // BOOTING /////////////////////////////////////////////////////////// @@ -164,6 +185,7 @@ function boot() { window.setupGeosearch(); window.setupRedeem(); window.setupLargeImagePreview(); + window.setupSidebarToggle(); window.updateGameScore(); window.setupPlayerStat(); window.chat.setup(); diff --git a/main.js b/main.js index 1d188f08..bcce7121 100644 --- a/main.js +++ b/main.js @@ -58,6 +58,7 @@ document.getElementsByTagName('body')[0].innerHTML = '' + '
' + '' + '' + + '' + '
' // enable scrolling for small screens + ' '; + + '
' + + '' + + '
'; // 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 diff --git a/style.css b/style.css index 3f79011c..f23b7799 100644 --- a/style.css +++ b/style.css @@ -11,22 +11,22 @@ body { } #scrollwrapper { - height: 100%; overflow: hidden; position: fixed; right: -38px; top: 0; width: 340px; + bottom: 45px; } #sidebar { background-color: rgba(8, 48, 78, 0.9); border-left: 1px solid #20A8B1; color: #888; - height: 100%; position: relative; left: 0; top: 0; + max-height: 100%; overflow-y:scroll; overflow-x:hidden; z-index: 3000; @@ -523,16 +523,14 @@ aside:nth-child(odd) span { } #spacer { - /* cheap hack to prevent sidebar content being overlayed by the map - * status box */ - height: 55px; + height: 10px; } /* a common portal display takes this much space (prevents moving * content when first selecting a portal) */ #portaldetails { - min-height: 532px; + min-height: 553px; } @@ -541,12 +539,14 @@ aside:nth-child(odd) span { background-color: rgba(8, 48, 78, 1); border-bottom: 0; border-top: 1px solid #20A8B1; + border-left: 1px solid #20A8B1; bottom: 0; color: #ffce00; font-size:13px; padding: 4px; position: fixed; right: 0; + z-index:3002; } From c170995da704b0804bbe15d6d07e025824a84fc1 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Mon, 11 Feb 2013 12:36:14 +0100 Subject: [PATCH 61/63] fix style sheet link (thanks cmrn) --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index a9242ec3..0a229350 100644 --- a/main.js +++ b/main.js @@ -53,9 +53,9 @@ for(var i = 0; i < d.length; i++) { // security context so we can access the API easily. Setup as much as // possible without requiring scripts. document.getElementsByTagName('head')[0].innerHTML = '' - + '' + //~ + '' + 'Ingress Intel Map' - //~ + '' + + '' + '' + ''; From 63083407ed3704f3e77ea6a06efcd22b331400b3 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Mon, 11 Feb 2013 13:14:03 +0100 Subject: [PATCH 62/63] add info about other types --- code/utils_misc.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/utils_misc.js b/code/utils_misc.js index 2f982f7e..75cd1d72 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -160,6 +160,10 @@ window.getTypeByGuid = function(guid) { // .c == player/creator // .d == chat messages // + // others, not used in web: + // .5 == resources (burster/resonator) + // .6 == XM + // .4 == media items, maybe all droppped resources (?) // resonator guid is [portal guid]-resonator-[slot] switch(guid.slice(33)) { case '11': From 8b94121bb25aa1a974a9b6efbd9ba7fce4258d1e Mon Sep 17 00:00:00 2001 From: Peter Sorger Date: Mon, 11 Feb 2013 13:48:05 +0100 Subject: [PATCH 63/63] z-index for #scrollwallpaper had problem with sidebar not showing in Chrome 25, the sidebar got under the map layer. Added z-index 1001; --- style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/style.css b/style.css index f23b7799..ebe3d41d 100644 --- a/style.css +++ b/style.css @@ -17,6 +17,7 @@ body { top: 0; width: 340px; bottom: 45px; + z-index: 1001; } #sidebar {