Merge branch 'gh-pages' into scoreboard

This commit is contained in:
vita10gy
2013-02-26 20:39:25 -06:00
34 changed files with 1390 additions and 337 deletions

View File

@ -12,10 +12,12 @@ Available Plugins
- [**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.
- [**Draw Tools**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/draw-tools.user.js) allows to draw circles and lines on the map to aid you with planning your next big field. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_draw_tools.png)
- [**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.
- [**Highlight Weakened Portals**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-portal-weakness.user.js) fill portals with red to indicate portal's state of disrepair. The brighter the color the more attention needed (recharge, shields, resonators). A dashed portal means a resonator is missing.
- [**Highlight Weakened Portals**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-portal-weakness.user.js) fill portals with red to indicate portal's state of disrepair. The brighter the color the more attention needed (recharge, shields, resonators). A dashed portal means a resonator is missing. Red, needs energy and shields. Orange, only needs energy (either recharge or resonators). Yellow, only needs shields.
- [**Max-Links**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/max-links.user.js) Calculates how to link the portals to create the maximum number of fields. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_max_links.png)
- [**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 theres a tooltip that shows the data in a table. [View screenshot](http://breunigs.github.com/ingress-intel-total-conversion/screenshots/plugin_player_tracker.png).
- [**Render Limit Increase**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/render-limit-increase.user.js) increases render limits. Good for high density areas (e.g. London, UK) and faster PCs.
- [**Resonator Display Zoom Level Decrease**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/resonator-display-zoom-level-decrease.user.js) Resonator start displaying earlier.
- [**Resonator Energy in Portal Detail**](https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/reso-energy-pct-in-portal-detail.user.js) Resonator energy in percent is displayed in the portal detals.
- [**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.
### available only with the development version

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-compute-ap-stats@Hollow011
// @name iitc: Compute AP statistics
// @version 0.2
// @version 0.2.1
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/compute-ap-stats.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/compute-ap-stats.user.js
// @description Tries to determine overal AP stats for the current zoom
// @include http://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-draw-tools@breunigs
// @name iitc: draw tools
// @version 0.2
// @version 0.2.2
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/draw-tools.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/draw-tools.user.js
// @description Allows you to draw things into the current map so you may plan your next move
// @include http://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
@ -29,12 +29,15 @@ var DRAW_TOOLS_SHAPE_OPTIONS = {
window.plugin.drawTools = function() {};
window.plugin.drawTools.loadExternals = function() {
var base = 'http://breunigs.github.com/ingress-intel-total-conversion/dist';
var base = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist';
//~ var base = 'http://0.0.0.0:8000/dist';
$('head').append('<link rel="stylesheet" href="'+base+'/leaflet.draw.0.1.6.css" />');
load(base+'/leaflet.draw.0.1.6.js').thenRun(window.plugin.drawTools.boot);
// overwrite default Leaflet Marker icon.
L.Icon.Default.imagePath = base + '/images';
// FIXME: this is currently manually included from
// external/leaflet.draw.0.1.6.css. It should either be loaded remotely
// automatically or the buildscript should include it here, similar to
// how it works for the main script.
$('head').append('<style>.leaflet-container .leaflet-control-draw {margin-left: 13px;margin-top: 12px;}.leaflet-control-draw a {background-position: 50% 50%;background-repeat: no-repeat;display: block;width: 22px;height: 22px;}.leaflet-control-draw a:hover {background-color: #fff;}.leaflet-touch .leaflet-control-draw a {width: 27px;height: 27px;}.leaflet-control-draw-polyline {background-image: url(https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/images/draw-polyline.png);}.leaflet-control-draw-polygon {background-image: url(https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/images/draw-polygon.png);}.leaflet-control-draw-rectangle {background-image: url(https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/images/draw-rectangle.png);}.leaflet-control-draw-circle {background-image: url(https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/images/draw-circle.png);}.leaflet-control-draw-marker {background-image: url(https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/images/draw-marker-icon.png);}.leaflet-mouse-marker {background-color: #fff;cursor: crosshair;}.leaflet-draw-label {background-color: #fff;border: 1px solid #ccc;color: #222;font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif;margin-left: 20px;margin-top: -21px;padding: 2px 4px;position: absolute;white-space: nowrap;z-index: 6;}.leaflet-error-draw-label {background-color: #F2DEDE;border-color: #E6B6BD;color: #B94A48;}.leaflet-draw-label-single {margin-top: -12px}.leaflet-draw-label-subtext {color: #999;}.leaflet-draw-guide-dash {font-size: 1%;opacity: 0.6;position: absolute;width: 5px;height: 5px;}.leaflet-flash-anim {-webkit-animation-duration: 0.66s; -moz-animation-duration: 0.66s; -o-animation-duration: 0.66s; animation-duration: 0.66s;-webkit-animation-fill-mode: both; -moz-animation-fill-mode: both; -o-animation-fill-mode: both; animation-fill-mode: both;-webkit-animation-name: leaflet-flash; -moz-animation-name: leaflet-flash; -o-animation-name: leaflet-flash; animation-name: leaflet-flash;}@-webkit-keyframes leaflet-flash {0%, 50%, 100% { opacity: 1; }25%, 75% { opacity: 0.3; }}@-moz-keyframes leaflet-flash {0%, 50%, 100% { opacity: 1; }25%, 75% { opacity: 0.3; }}@-o-keyframes leaflet-flash {0%, 50%, 100% { opacity: 1; }25%, 75% { opacity: 0.3; }}@keyframes leaflet-flash {0%, 50%, 100% { opacity: 1; }25%, 75% { opacity: 0; }}</style>');
}

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-guess-player-levels@breunigs
// @name iitc: guess player level
// @version 0.2
// @version 0.2.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*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
@ -88,7 +88,7 @@ window.plugin.guessPlayerLevels.guess = function() {
});
var s = 'the players have at least the following level:\n\n';
s += 'Resistance:\t&nbsp;&nbsp;&nbsp;\tEnlightenment:\t\n';
s += 'Resistance:\t&nbsp;&nbsp;&nbsp;\tEnlightened:\t\n';
var namesR = plugin.guessPlayerLevels.sort(playersRes);
var namesE = plugin.guessPlayerLevels.sort(playersEnl);

137
plugins/max-links.user.js Normal file
View File

@ -0,0 +1,137 @@
// ==UserScript==
// @id max-links@boombuler
// @name iitc: Max-Links-Plugin
// @version 0.2
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/max-links.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/max-links.user.js
// @description Calculates how to link the portals to create the maximum number of fields.
// @include https://www.ingress.com/intel*
// @match https://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.maxLinks = function() {};
// const values
window.plugin.maxLinks.MAX_DRAWN_LINKS = 400;
window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT = 1000;
window.plugin.maxLinks.STROKE_STYLE = {
color: '#FF0000',
opacity: 1,
weight:2,
clickable: false,
smoothFactor: 10
};
window.plugin.maxLinks._delaunayScriptLocation = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/delaunay.js';
window.plugin.maxLinks.layer = null;
window.plugin.maxLinks._updating = false;
window.plugin.maxLinks._renderLimitReached = false;
window.plugin.maxLinks.updateLayer = function() {
if (window.plugin.maxLinks._updating ||
window.plugin.maxLinks.layer === null ||
!window.map.hasLayer(window.plugin.maxLinks.layer))
return;
window.plugin.maxLinks._updating = true;
window.plugin.maxLinks.layer.clearLayers();
var locations = [];
var minX = 0;
var minY = 0;
$.each(window.portals, function(guid, portal) {
var loc = portal.options.details.locationE6;
var nloc = { x: loc.lngE6, y: loc.latE6 };
if (nloc.x < minX)
minX = nloc.x;
if (nloc.y < minY)
minY = nloc.y;
locations.push(nloc);
});
$.each(locations, function(idx, nloc) {
nloc.x += Math.abs(minX);
nloc.y += Math.abs(minY);
});
var triangles = window.delaunay.triangulate(locations);
var drawnLinks = 0;
window.plugin.maxLinks._renderLimitReached = false;
var renderlimit = window.USE_INCREASED_RENDER_LIMIT ?
window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT :
window.plugin.maxLinks.MAX_DRAWN_LINKS;
$.each(triangles, function(idx, triangle) {
if (drawnLinks <= renderlimit) {
triangle.draw(window.plugin.maxLinks.layer, minX, minY)
drawnLinks += 3;
} else {
window.plugin.maxLinks._renderLimitReached = true;
}
});
window.plugin.maxLinks._updating = false;
window.renderUpdateStatus();
}
window.plugin.maxLinks.setup = function() {
load(window.plugin.maxLinks._delaunayScriptLocation).thenRun(function() {
window.delaunay.Triangle.prototype.draw = function(layer, divX, divY) {
var drawLine = function(src, dest) {
var poly = L.polyline([[(src.y + divY)/1E6, (src.x + divX)/1E6], [(dest.y + divY)/1E6, (dest.x + divX)/1E6]], window.plugin.maxLinks.STROKE_STYLE);
poly.addTo(layer);
};
drawLine(this.a, this.b);
drawLine(this.b, this.c);
drawLine(this.c, this.a);
}
window.plugin.maxLinks.layer = L.layerGroup([]);
window.addHook('checkRenderLimit', function(e) {
if (window.map.hasLayer(window.plugin.maxLinks.layer) &&
window.plugin.maxLinks._renderLimitReached)
e.reached = true;
});
window.addHook('portalDataLoaded', function(e) {
if (window.map.hasLayer(window.plugin.maxLinks.layer))
window.plugin.maxLinks.updateLayer();
});
window.map.on('layeradd', function(e) {
if (e.layer === window.plugin.maxLinks.layer)
window.plugin.maxLinks.updateLayer();
});
window.map.on('zoomend moveend', window.plugin.maxLinks.updateLayer);
window.layerChooser.addOverlay(window.plugin.maxLinks.layer, 'Maximum Links');
});
}
var setup = window.plugin.maxLinks.setup;
// 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);

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-player-tracker@breunigs
// @name iitc: player tracker
// @version 0.5
// @version 0.6.1
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/player-tracker.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/player-tracker.user.js
// @description draws trails for the path a user went onto the map. Only draws the last hour. Does not request chat data on its own, even if that would be useful.
// @include http://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
@ -163,13 +163,14 @@ window.plugin.playerTracker.processNewData = function(data) {
}
window.plugin.playerTracker.getLatLngFromEvent = function(ev) {
var lats = $.map(ev.latlngs, function(ll) { return [ll[0]] });
var lngs = $.map(ev.latlngs, function(ll) { return [ll[1]] });
var latmax = Math.max.apply(null, lats);
var latmin = Math.min.apply(null, lats);
var lngmax = Math.max.apply(null, lngs);
var lngmin = Math.min.apply(null, lngs);
return L.latLng((latmax + latmin) / 2, (lngmax + lngmin) / 2);
var lats = 0;
var lngs = 0;
$.each(ev.latlngs, function() {
lats += this[0];
lngs += this[1];
});
return L.latLng(lats / ev.latlngs.length, lngs / ev.latlngs.length);
}
window.plugin.playerTracker.ago = function(time, now) {

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-render-limit-increase@jonatkins
// @name iitc: render limit increase
// @version 0.1
// @version 0.1.1
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/render-limit-increase.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/render-limit-increase.user.js
// @description Increase the render limits, so less likely to be hit in higher density areas
// @include http://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
@ -29,7 +29,7 @@ window.plugin.renderLimitIncrease.setHigherLimits = function() {
// thing like that, Leaflet doc isnt too specific). Setting it too low
// makes the missing data on move/zoom out more obvious. Setting it too
// high causes too many items to be drawn, making drag&drop sluggish.
// default for iitc is 0.3. a lower value reduces overdraw
// default for iitc is 0.3. a lower value reduces overdraw
window.VIEWPORT_PAD_RATIO = 0.1;
@ -39,7 +39,7 @@ window.plugin.renderLimitIncrease.setHigherLimits = function() {
window.MAX_DRAWN_PORTALS = 3000;
window.MAX_DRAWN_LINKS = 1000;
window.MAX_DRAWN_FIELDS = 500;
window.USE_INCREASED_RENDER_LIMIT = true; // Used for other plugins
};
var setup = window.plugin.renderLimitIncrease.setHigherLimits;

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-reso-energy-pct-in-portal-detail@xelio
// @name iitc: reso energy pct in portal detail
// @version 0.1
// @version 0.1.1
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/reso-energy-pct-in-portal-detail.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/reso-energy-pct-in-portal-detail.user.js
// @description Show resonator energy percentage on resonator energy bar in portal detail panel.
// @include http://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-resonator-display-zoom-level-decrease@xelio
// @name iitc: resonator display zoom level decrease
// @version 1.0
// @version 1.0.1
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/resonator-display-zoom-level-decrease.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/resonator-display-zoom-level-decrease.user.js
// @description Resonator start display earlier
// @include http://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-show-address@vita10gy
// @name iitc: show portal address in sidebar
// @version 0.2
// @version 0.2.1
// @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*
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {

View File

@ -1,13 +1,13 @@
// ==UserScript==
// @id iitc-plugin-show-portal-weakness@vita10gy
// @name iitc: show portal weakness
// @version 0.2
// @version 0.3.1
// @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-portal-weakness.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/show-portal-weakness.user.js
// @description Uses the fill color of the portals to denote if the portal is weak (Needs recharging, missing a resonator, needs shields)
// @include http://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @description Uses the fill color of the portals to denote if the portal is weak (Needs recharging, missing a resonator, needs shields) Red, needs energy and shields. Orange, only needs energy (either recharge or resonators). Yellow, only needs shields.
// @include https://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
@ -21,49 +21,54 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
window.plugin.portalWeakness = function() {};
window.plugin.portalWeakness.portalAdded = function(data) {
var d = data.portal.options.details;
var portal_weakness = 0;
if(getTeam(d) != 0)
{
if(window.getTotalPortalEnergy(d)> 0 && window.getCurrentPortalEnergy(d) < window.getTotalPortalEnergy(d))
{
if(getTeam(d) !== 0) {
var only_shields = true;
var missing_shields = 0;
if(window.getTotalPortalEnergy(d) > 0 && window.getCurrentPortalEnergy(d) < window.getTotalPortalEnergy(d)) {
portal_weakness = 1 - (window.getCurrentPortalEnergy(d)/window.getTotalPortalEnergy(d));
only_shields = false;
}
//Ding the portal for every missing sheild.
$.each(d.portalV2.linkedModArray, function(ind, mod)
{
if(mod == null)
{
portal_weakness += .03;
//Ding the portal for every missing sheild.
$.each(d.portalV2.linkedModArray, function(ind, mod) {
if(mod === null) {
missing_shields++;
portal_weakness += .08;
}
});
//Ding the portal for every missing resonator.
var resCount = 0;
$.each(d.resonatorArray.resonators, function(ind, reso)
{
if(reso == null) {
$.each(d.resonatorArray.resonators, function(ind, reso) {
if(reso === null) {
portal_weakness += .125;
}
else {
only_shields = false;
} else {
resCount++;
}
});
if(portal_weakness<0) {
if(portal_weakness < 0) {
portal_weakness = 0;
}
if(portal_weakness>1)
{
if(portal_weakness > 1) {
portal_weakness = 1;
}
if(portal_weakness>0)
{
var color = 'red';
var fill_opacity = Math.round((portal_weakness*.8 + .2)*100)/100;
var params = {fillColor: color, fillOpacity: fill_opacity, radius: data.portal.options.radius+1};
if(resCount<8)
{
}
if(portal_weakness > 0) {
var fill_opacity = portal_weakness*.7 + .3;
var color = 'orange';
if(only_shields) {
color = 'yellow';
//If only shields are missing, make portal yellow
// but fill more than usual since pale yellow is basically invisible
fill_opacity = missing_shields*.15 + .1;
} else if(missing_shields > 0) {
color = 'red';
}
fill_opacity = Math.round(fill_opacity*100)/100;
var params = {fillColor: color, fillOpacity: fill_opacity};
if(resCount < 8) {
// Hole per missing resonator
var dash = new Array(8-resCount + 1).join("1,4,") + "100,0"
params["dashArray"] = dash;