From 25f1b32285e9e8a5652f29aa280646035c4bdaa5 Mon Sep 17 00:00:00 2001 From: vita10gy Date: Thu, 21 Feb 2013 22:13:14 -0600 Subject: [PATCH 1/2] Plugin: Show address in Side Panel Adds address into the right hand column at the bottom of the picture. --- plugins/show-address.user.js | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 plugins/show-address.user.js diff --git a/plugins/show-address.user.js b/plugins/show-address.user.js new file mode 100644 index 00000000..77bf5323 --- /dev/null +++ b/plugins/show-address.user.js @@ -0,0 +1,54 @@ +// ==UserScript== +// @id iitc-plugin-show-address@vita10gy +// @name iitc: show portal address in sidebar +// @version 0.2 +// @namespace https://github.com/breunigs/ingress-intel-total-conversion +// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-address.user.js +// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-address.user.js +// @description Portal address will show in the sidebar. +// @include http://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// ==/UserScript== + +function wrapper() { +// ensure plugin framework is there, even if iitc is not yet loaded +if(typeof window.plugin !== 'function') window.plugin = function() {}; + + +// PLUGIN START //////////////////////////////////////////////////////// + +// use own namespace for plugin +window.plugin.portalAddress = function() {}; + +window.plugin.portalAddress.portalDetail = function(data) { + //If there's 4 sets of comma delimieted info the last one is the country, so get rid of it. If the country + //is in the [2] then it doesn't matter because address is usually short enough to fit. + var address = data.portalDetails.portalV2.descriptiveText.ADDRESS.split(",").splice(0,3).join(","); + $(".imgpreview").append("
"+address+"
"); +} + +var setup = function() { + window.addHook('portalDetailsUpdated', window.plugin.portalAddress.portalDetail); + var css = document.createElement("style"); + css.type = "text/css"; + css.innerHTML = ".res #address { border: 1px solid #0076b6; }" + + ".enl #address { border: 1px solid #017f01; }" + + "#address{ margin:5px; padding:3px; margin-top:120px; margin-right:8px; font-size:11px; background-color:rgba(0, 0, 0, 0.7); text-align:center; white-space:nowrap; overflow:hidden;}"; + document.body.appendChild(css); +} + +// 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'); +script.appendChild(document.createTextNode('('+ wrapper +')();')); +(document.body || document.head || document.documentElement).appendChild(script); From e8e683c5b5472834816d5a151a335888107b6a3b Mon Sep 17 00:00:00 2001 From: vita10gy Date: Fri, 22 Feb 2013 08:43:04 -0600 Subject: [PATCH 2/2] Nits and style redo Added to readme, but it doesn't seem to work with the public build. --- plugins/README.md | 3 ++- plugins/show-address.user.js | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/README.md b/plugins/README.md index 35eb5d86..ae93336a 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -19,8 +19,9 @@ Available Plugins The development version is not available publicly, you need to build it yourself. See [HACKING.md](https://github.com/breunigs/ingress-intel-total-conversion/blob/gh-pages/HACKING.md#hacking) for guides. -- [**Player Tracker**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/player-tracker.user.js) Draws trails for user actions in the last hour. At the last known location there’s a tooltip that shows the data in a table. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_player_tracker.png). **REQUIRES 2013-02-19+** - [**Compute AP Stats**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/compute-ap-stats.user.js) Shows the potential AP an agent could obtain by destroying and rebuilding all the portals in the current zoom area. **REQUIRES 2013-02-22+** +- [**Player Tracker**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/player-tracker.user.js) Draws trails for user actions in the last hour. At the last known location there’s a tooltip that shows the data in a table. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_player_tracker.png). **REQUIRES 2013-02-19+** +- [**Show Portal Address**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-address.user.js) Shows portal address in the side panel. Hacking ------- diff --git a/plugins/show-address.user.js b/plugins/show-address.user.js index 77bf5323..4f218ea2 100644 --- a/plugins/show-address.user.js +++ b/plugins/show-address.user.js @@ -23,18 +23,17 @@ window.plugin.portalAddress = function() {}; window.plugin.portalAddress.portalDetail = function(data) { //If there's 4 sets of comma delimieted info the last one is the country, so get rid of it. If the country //is in the [2] then it doesn't matter because address is usually short enough to fit. - var address = data.portalDetails.portalV2.descriptiveText.ADDRESS.split(",").splice(0,3).join(","); - $(".imgpreview").append("
"+address+"
"); + var address = data.portalDetails.portalV2.descriptiveText.ADDRESS.split(',').splice(0,3).join(','); + $('.imgpreview').append('
'+address+'
'); } var setup = function() { window.addHook('portalDetailsUpdated', window.plugin.portalAddress.portalDetail); - var css = document.createElement("style"); - css.type = "text/css"; - css.innerHTML = ".res #address { border: 1px solid #0076b6; }" + - ".enl #address { border: 1px solid #017f01; }" + - "#address{ margin:5px; padding:3px; margin-top:120px; margin-right:8px; font-size:11px; background-color:rgba(0, 0, 0, 0.7); text-align:center; white-space:nowrap; overflow:hidden;}"; - document.body.appendChild(css); + $('head').append(''); } // PLUGIN END //////////////////////////////////////////////////////////