From 5c805f7a4e8e01a840b93c868e973f84840a2805 Mon Sep 17 00:00:00 2001 From: superdhuang Date: Tue, 28 May 2013 13:54:10 +0800 Subject: [PATCH 1/3] Create portal-highlighter-with-L8-resonators.js initial --- .../portal-highlighter-with-L8-resonators.js | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 plugins/portal-highlighter-with-L8-resonators.js diff --git a/plugins/portal-highlighter-with-L8-resonators.js b/plugins/portal-highlighter-with-L8-resonators.js new file mode 100644 index 00000000..48397898 --- /dev/null +++ b/plugins/portal-highlighter-with-L8-resonators.js @@ -0,0 +1,82 @@ +// ==UserScript== +// @id iitc-plugin-highlight-portals-with-L8-resonators@superd +// @name IITC plugin: highlight portals with L8 resonators +// @version 0.1.0.20130522.175822 +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL https://secure.jonatkins.com/iitc/release/plugins/portal-highlighter-with-L8-resonators.meta.js +// @downloadURL https://secure.jonatkins.com/iitc/release/plugins/portal-highlighter-missing-resonators.user.js +// @description [superd-2013-05-28-175822] Uses the fill red of the portals, if portal has L8 res +// @include https://www.ingress.com/intel* +// @include http://www.ingress.com/intel* +// @match https://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// @grant none +// ==/UserScript== + +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.portalsWithL8Resonators = function() {}; + +window.plugin.portalsWithL8Resonators.highlight = function(data) { + var d = data.portal.options.details; + var has_L8 = 0; + var portal_weakness = 0; + if(getTeam(d) !== 0) { + //Ding the portal for every missing resonator. + var resCount = 0; + $.each(d.resonatorArray.resonators, function(ind, reso) { + if(reso === null) { + portal_weakness += .125; + } else { + var level = parseInt(reso.level); + if(level == 8) + { + has_L8+=1; + } + resCount++; + } + }); + + //alert("has L8 res"+has_L8); + + if(has_L8 > 0) + { + var color = 'red'; + var params = {fillColor: color, fillOpacity: 0.5}; + data.portal.setStyle(params); + }else + { + /* var color = 'blue'; + var params = {fillColor: color, fillOpacity: 0.5}; + data.portal.setStyle(params); + */ + } + } + window.COLOR_SELECTED_PORTAL = '#f0f'; +} + +var setup = function() { + window.addPortalHighlighter('Portals with L8 Resonators', window.plugin.portalsWithL8Resonators.highlight); +} + +// 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 1e2a1cf4ce3c02bf43bca97e4c07c65eb223678a Mon Sep 17 00:00:00 2001 From: superdhuang Date: Tue, 28 May 2013 23:11:50 +0800 Subject: [PATCH 2/3] Update and rename portal-highlighter-with-L8-resonators.js to portal-highlighter-with-lvl8-resonators.user.js 1. update userscript block with @@...@@ 2. rename to portal-highlighter-with-lvl8-resonators.user.js --- ...js => portal-highlighter-with-lvl8-resonators.user.js} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename plugins/{portal-highlighter-with-L8-resonators.js => portal-highlighter-with-lvl8-resonators.user.js} (86%) diff --git a/plugins/portal-highlighter-with-L8-resonators.js b/plugins/portal-highlighter-with-lvl8-resonators.user.js similarity index 86% rename from plugins/portal-highlighter-with-L8-resonators.js rename to plugins/portal-highlighter-with-lvl8-resonators.user.js index 48397898..d037c577 100644 --- a/plugins/portal-highlighter-with-L8-resonators.js +++ b/plugins/portal-highlighter-with-lvl8-resonators.user.js @@ -1,11 +1,11 @@ // ==UserScript== // @id iitc-plugin-highlight-portals-with-L8-resonators@superd // @name IITC plugin: highlight portals with L8 resonators -// @version 0.1.0.20130522.175822 +// @version 0.1.0.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion -// @updateURL https://secure.jonatkins.com/iitc/release/plugins/portal-highlighter-with-L8-resonators.meta.js -// @downloadURL https://secure.jonatkins.com/iitc/release/plugins/portal-highlighter-missing-resonators.user.js -// @description [superd-2013-05-28-175822] Uses the fill red of the portals, if portal has L8 res +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill red of the portals, if portal has L8 res // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* From 1334bbac6ba3721d753fd6073ba9dbdddc4395db Mon Sep 17 00:00:00 2001 From: superdhuang Date: Wed, 29 May 2013 03:36:29 +0800 Subject: [PATCH 3/3] Update portal-highlighter-with-lvl8-resonators.user.js 1. clean unused code. 2. more L8 resos, portals get brighter. --- ...l-highlighter-with-lvl8-resonators.user.js | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/plugins/portal-highlighter-with-lvl8-resonators.user.js b/plugins/portal-highlighter-with-lvl8-resonators.user.js index d037c577..7b29a018 100644 --- a/plugins/portal-highlighter-with-lvl8-resonators.user.js +++ b/plugins/portal-highlighter-with-lvl8-resonators.user.js @@ -26,38 +26,25 @@ window.plugin.portalsWithL8Resonators = function() {}; window.plugin.portalsWithL8Resonators.highlight = function(data) { var d = data.portal.options.details; var has_L8 = 0; - var portal_weakness = 0; if(getTeam(d) !== 0) { - //Ding the portal for every missing resonator. - var resCount = 0; $.each(d.resonatorArray.resonators, function(ind, reso) { - if(reso === null) { - portal_weakness += .125; - } else { + if(reso) { var level = parseInt(reso.level); if(level == 8) { has_L8+=1; } - resCount++; } }); + } - //alert("has L8 res"+has_L8); - - if(has_L8 > 0) - { - var color = 'red'; - var params = {fillColor: color, fillOpacity: 0.5}; - data.portal.setStyle(params); - }else - { - /* var color = 'blue'; - var params = {fillColor: color, fillOpacity: 0.5}; - data.portal.setStyle(params); - */ - } - } + if(has_L8 > 0) + { + var color = 'red'; + var opa = has_L8 * 0.125; + var params = {fillColor: color, fillOpacity: opa}; + data.portal.setStyle(params); + } window.COLOR_SELECTED_PORTAL = '#f0f'; }