Merge git://github.com/jonatkins/ingress-intel-total-conversion into dialog

This commit is contained in:
Morgan Jones 2013-05-10 21:45:34 -06:00
commit 553ecdc61e
31 changed files with 1100 additions and 120 deletions

View File

@ -225,7 +225,7 @@ if buildMobile:
except:
pass
shutil.rmtree("mobile/assets/plugins")
shutil.copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins", ignore=shutil.ignore_patterns('*.meta.js', 'force-https*'))
shutil.copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins", ignore=shutil.ignore_patterns('*.meta.js', 'force-https*', 'privacy-view*'))
if buildMobile != 'copyonly':

View File

@ -139,10 +139,10 @@ window.setupMap = function() {
//their usage policy has no limits (except required notification above 4000 tiles/sec - we're perhaps at 50 tiles/sec based on CloudMade stats)
var mqSubdomains = [ 'otile1','otile2', 'otile3', 'otile4' ];
var mqTileUrlPrefix = window.location.protocol !== 'https:' ? 'http://{s}.mqcdn.com' : 'https://{s}-s.mqcdn.com';
var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', maxZoom: 18, detectRetena: true, subdomains: mqSubdomains};
var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', maxZoom: 18, subdomains: mqSubdomains};
var mqMap = new L.TileLayer(mqTileUrlPrefix+'/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt);
//MapQuest satellite coverage outside of the US is rather limited - so not really worth having as we have google as an option
//var mqSatOpt = {attribution: 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency', mazZoom: 18, detectRetena: true, subdomains: mqSubdomains};
//var mqSatOpt = {attribution: 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency', mazZoom: 18, subdomains: mqSubdomains};
//var mqSat = new L.TileLayer('http://{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg',mqSatOpt);
var views = [
@ -203,7 +203,8 @@ window.setupMap = function() {
// layers. This likely leads to broken layer selection because the
// views/cookie order does not match the layer chooser order.
try {
map.addLayer(views[readCookie('ingress.intelmap.type')]);
convertCookieToLocalStorage('ingress.intelmap.type');
map.addLayer(views[localStorage['ingress.intelmap.type']]);
} catch(e) { map.addLayer(views[0]); }
map.attributionControl.setPrefix('');
@ -228,7 +229,7 @@ window.setupMap = function() {
map.on('baselayerchange', function () {
var selInd = $('[name=leaflet-base-layers]:checked').parent().index();
writeCookie('ingress.intelmap.type', selInd);
localStorage['ingress.intelmap.type']=selInd;
});
// map update status handling
@ -405,7 +406,13 @@ function boot() {
$('#sidebar').show();
if(window.bootPlugins)
$.each(window.bootPlugins, function(ind, ref) { ref(); });
$.each(window.bootPlugins, function(ind, ref) {
try {
ref();
} catch(err) {
console.log("error starting plugin: index "+ind+", error: "+err);
}
});
window.runOnSmartphonesAfterBoot();
@ -413,6 +420,7 @@ function boot() {
setTimeout('window.map.invalidateSize(false);', 500);
window.iitcLoaded = true;
window.runHooks('iitcLoaded');
}
// this is the minified load.js script that allows us to easily load

View File

@ -24,6 +24,6 @@ window.setupGeosearch = function() {
e.preventDefault();
});
$('#geosearchwrapper img').click(function(){
map.locate({setView : true});;
map.locate({setView : true, maxZoom: 13});;
});
}

View File

@ -53,14 +53,14 @@
// set reached to true.
// requestFinished: called after each request finished. Argument is
// {success: boolean} indicated the request success or fail.
// iitcLoaded: called after IITC and all plugins loaded
window._hooks = {}
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
'publicChatDataAvailable', 'factionChatDataAvailable', 'portalDataLoaded',
'beforePortalReRender', 'checkRenderLimit', 'requestFinished', 'nicknameClicked',
'geoSearch'];
'geoSearch', 'iitcLoaded'];
window.runHooks = function(event, data) {
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);

View File

@ -173,16 +173,17 @@ window.handlePortalsRender = function(portals) {
// Preserve selectedPortal because it will get lost on re-rendering
// the portal
var oldSelectedPortal = selectedPortal;
runHooks('portalDataLoaded', {portals : portals});
$.each(portals, function(ind, portal) {
//~ if(selectedPortal === portal[0]) portalUpdateAvailable = true;
if(urlPortal && portal[0] === urlPortal) portalInUrlAvailable = true;
if(urlPortalLL && urlPortalLL[0] === portal[2].locationE6.latE6/1E6 && urlPortalLL[1] === portal[2].locationE6.lngE6/1E6) {
urlPortal = portal[0];
portalInUrlAvailable = true;
urlPortalLL = null;
}
if(window.portals[portal[0]]) {
highlightPortal(window.portals[portal[0]]);
}
renderPortal(portal);
});
@ -285,7 +286,7 @@ window.renderPortal = function(ent) {
// do nothing if portal did not change
var layerGroup = portalsLayers[parseInt(portalLevel)];
var old = findEntityInLeaflet(layerGroup, window.portals, ent[0]);
if(old) {
if(!changing_highlighters && old) {
var oo = old.options;
// Default checks to see if a portal needs to be re-rendered
@ -333,6 +334,7 @@ window.renderPortal = function(ent) {
clickable: true,
level: portalLevel,
team: team,
ent: ent,
details: ent[2],
guid: ent[0]});
@ -370,7 +372,7 @@ window.renderPortal = function(ent) {
});
window.renderResonators(ent, null);
highlightPortal(p);
window.runHooks('portalAdded', {portal: p});
p.addTo(layerGroup);
}

View File

@ -1,6 +1,7 @@
// created to start cleaning up "window" interaction
//
window.show = function(id) {
window.hideall();
switch(id) {
case 'full':
window.chat.show('full');
@ -19,6 +20,7 @@ window.show = function(id) {
break;
case 'map':
window.smartphone.mapButton.click();
$('#portal_highlight_select').show();
break;
case 'info':
window.smartphone.sideButton.click();
@ -28,3 +30,8 @@ window.show = function(id) {
break;
}
}
window.hideall = function() {
$('#chatcontrols, #chat, #chatinput, #sidebartoggle, #scrollwrapper, #updatestatus, #portal_highlight_select').hide();
$('#map').css('visibility', 'hidden');
}

View File

@ -49,7 +49,7 @@ window.renderPortalDetails = function(guid) {
var lng = d.locationE6.lngE6/1E6;
var perma = '/intel?ll='+lat+','+lng+'&z=17&pll='+lat+','+lng;
var imgTitle = 'title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."';
var poslinks = 'window.showPortalPosLinks('+lat+','+lng+',\'' + d.portalV2.descriptiveText.TITLE + '\')';
var poslinks = 'window.showPortalPosLinks('+lat+','+lng+',\''+escapeJavascriptString(d.portalV2.descriptiveText.TITLE)+'\')';
$('#portaldetails')
.attr('class', TEAM_TO_CSS[getTeam(d)])

View File

@ -0,0 +1,64 @@
// Portal Highlighter //////////////////////////////////////////////////////////
// these functions handle portal highlighters
window._highlighters = null;
window._current_highlighter = localStorage.portal_highlighter;
window.changing_highlighters = false;
window._no_highlighter = 'No Highlights';
window.addPortalHighlighter = function(name, callback) {
if(_highlighters === null) {
_highlighters = {};
}
_highlighters[name] = callback;
if(localStorage.portal_highlighter === undefined) {
_current_highlighter = name;
localStorage.portal_highlighter = name;
}
portalHighlighterControl();
}
window.portalHighlighterControl = function() {
if(_highlighters !== null) {
if($('#portal_highlight_select').length === 0) {
$("body").append("<select id='portal_highlight_select'></select>");
}
$("#portal_highlight_select").html('');
$("#portal_highlight_select").append($("<option>").attr('value',_no_highlighter).text(_no_highlighter));
var h_names = Object.keys(_highlighters).sort();
$.each(h_names, function(i, name) {
$("#portal_highlight_select").append($("<option>").attr('value',name).text(name));
});
$("#portal_highlight_select").val(_current_highlighter);
$("#portal_highlight_select").change(function(){ changePortalHighlights($(this).val());});
$(".leaflet-top.leaflet-left").css('padding-top', '20px');
$(".leaflet-control-scale-line").css('margin-top','25px');
}
}
window.changePortalHighlights = function(name) {
changing_highlighters = true;
_current_highlighter = name;
resetHighlightedPortals();
changing_highlighters = false;
localStorage.portal_highlighter = name;
}
window.highlightPortal = function(p) {
if(_highlighters !== null && _highlighters[_current_highlighter] !== undefined) {
p.options.highligher = _current_highlighter;
_highlighters[_current_highlighter]({portal: p});
}
}
window.resetHighlightedPortals = function() {
$.each(portals, function(ind, portal) {
try {
renderPortal(portal.options.ent);
}
catch(e) {}
});
}

View File

@ -117,3 +117,43 @@ window.getAttackApGain = function(d) {
captureAp: captureAp
};
}
//This function will return the potential level a player can upgrade it to
window.potentialPortalLevel = function(d) {
var current_level = getPortalLevel(d);
var potential_level = current_level;
if(PLAYER.team === d.controllingTeam.team) {
var resonators_on_portal = d.resonatorArray.resonators;
var resonator_levels = new Array();
// figure out how many of each of these resonators can be placed by the player
var player_resontators = new Array();
for(var i=1;i<=MAX_PORTAL_LEVEL; i++) {
player_resontators[i] = i > PLAYER.level ? 0 : MAX_RESO_PER_PLAYER[i];
}
$.each(resonators_on_portal, function(ind, reso) {
if(reso !== null && reso.ownerGuid === window.PLAYER.guid) {
player_resontators[reso.level]--;
}
resonator_levels.push(reso === null ? 0 : reso.level);
});
resonator_levels.sort(function(a, b) {
return(a - b);
});
// Max out portal
var install_index = 0;
for(var i=MAX_PORTAL_LEVEL;i>=1; i--) {
for(var install = player_resontators[i]; install>0; install--) {
if(resonator_levels[install_index] < i) {
resonator_levels[install_index] = i;
install_index++;
}
}
}
//console.log(resonator_levels);
potential_level = resonator_levels.reduce(function(a, b) {return a + b;}) / 8;
}
return(potential_level);
}

View File

@ -77,8 +77,6 @@ window.runOnSmartphonesAfterBoot = function() {
// disable img full view
$('#portaldetails').off('click', '**');
$('.leaflet-right').addClass('leaflet-left').removeClass('leaflet-right');
// make buttons in action bar flexible
var l = $('#chatcontrols a:visible');
l.css('width', 100/l.length + '%');

View File

@ -72,6 +72,22 @@ window.writeCookie = function(name, val) {
document.cookie = name + "=" + val + '; expires=Thu, 31 Dec 2020 23:59:59 GMT; path=/';
}
window.eraseCookie = function(name) {
document.cookie = name + '=; expires=Thu, 1 Jan 1970 00:00:00 GMT; path=/';
}
//certain values were stored in cookies, but we're better off using localStorage instead - make it easy to convert
window.convertCookieToLocalStorage = function(name) {
var cookie=readCookie(name);
if(cookie !== undefined) {
console.log('converting cookie '+name+' to localStorage');
if(localStorage[name] === undefined) {
localStorage[name] = cookie;
}
eraseCookie(name);
}
}
// add thousand separators to given number.
// http://stackoverflow.com/a/1990590/1684530 by Doug Neiner.
window.digits = function(d) {
@ -289,6 +305,12 @@ if (typeof String.prototype.startsWith !== 'function') {
};
}
// escape a javascript string, so quotes and backslashes are escaped with a backslash
// (for strings passed as parameters to html onclick="..." for example)
window.escapeJavascriptString = function(str) {
return (str+'').replace(/[\\"']/g,'\\$&');
}
window.prettyEnergy = function(nrg) {
return nrg> 1000 ? Math.round(nrg/1000) + ' k': nrg;
}
@ -358,10 +380,10 @@ window.calcTriArea = function(p) {
return Math.abs((p[0].lat*(p[1].lng-p[2].lng)+p[1].lat*(p[2].lng-p[0].lng)+p[2].lat*(p[0].lng-p[1].lng))/2);
}
// Update layerGroups display status to window.overlayStatus and cookie 'ingress.intelmap.layergroupdisplayed'
// Update layerGroups display status to window.overlayStatus and localStorage 'ingress.intelmap.layergroupdisplayed'
window.updateDisplayedLayerGroup = function(name, display) {
overlayStatus[name] = display;
writeCookie('ingress.intelmap.layergroupdisplayed', JSON.stringify(overlayStatus));
localStorage['ingress.intelmap.layergroupdisplayed'] = JSON.stringify(overlayStatus);
}
// Read layerGroup status from window.overlayStatus if it was added to map,
@ -370,7 +392,8 @@ window.updateDisplayedLayerGroup = function(name, display) {
window.isLayerGroupDisplayed = function(name, defaultDisplay) {
if(typeof(overlayStatus[name]) !== 'undefined') return overlayStatus[name];
var layersJSON = readCookie('ingress.intelmap.layergroupdisplayed');
convertCookieToLocalStorage('ingress.intelmap.layergroupdisplayed');
var layersJSON = localStorage['ingress.intelmap.layergroupdisplayed'];
if(!layersJSON) return defaultDisplay;
var layers = JSON.parse(layersJSON);

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id ingress-intel-total-conversion@jonatkins
// @name IITC: Ingress intel map total conversion
// @version 0.11.3.@@DATETIMEVERSION@@
// @version 0.12.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -114,7 +114,7 @@ L_PREFER_CANVAS = false;
// CONFIG OPTIONS ////////////////////////////////////////////////////
window.REFRESH = 60; // refresh view every 60s (base time)
window.ZOOM_LEVEL_ADJ = 5; // add 5 seconds per zoom level
window.ON_MOVE_REFRESH = 0.8; //refresh time to use after a movement event
window.ON_MOVE_REFRESH = 1.25; //refresh time to use after a movement event
window.MINIMUM_OVERRIDE_REFRESH = 5; //limit on refresh time since previous refresh, limiting repeated move refresh rate
window.REFRESH_GAME_SCORE = 5*60; // refresh game score every 5 minutes
window.MAX_IDLE_TIME = 4; // stop updating map after 4min idling
@ -153,7 +153,7 @@ window.FIELD_MU_DISPLAY_AREA_ZOOM_RATIO = 0.001;
window.FIELD_MU_DISPLAY_POINT_TOLERANCE = 60
window.COLOR_SELECTED_PORTAL = '#f00';
window.COLORS = ['#FFCE00', '#0088FF', '#03DC03']; // none, res, enl
window.COLORS = ['#a0a0a0', '#0088FF', '#03DC03']; // none, res, enl
window.COLORS_LVL = ['#000', '#FECE5A', '#FFA630', '#FF7315', '#E40000', '#FD2992', '#EB26CD', '#C124E0', '#9627F4'];
window.COLORS_MOD = {VERY_RARE: '#F78AF6', RARE: '#AD8AFF', COMMON: '#84FBBD'};

View File

@ -16,7 +16,8 @@
android:allowBackup="true"
android:icon="@drawable/ic_iitcm"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:uiOptions="splitActionBarWhenNarrow">
android:theme="@style/AppTheme"
android:uiOptions="splitActionBarWhenNarrow">
<activity
android:name="com.cradle.iitc_mobile.IITC_Mobile"
android:theme="@style/AppBaseTheme"

View File

@ -7,18 +7,16 @@ body {
background: #0B3351 !important
}
.leaflet-top .leaflet-control {
margin-top: 5px !important;
margin-left: 5px !important;
}
.leaflet-control-layers {
margin-left: 0 !important;
margin-top: 40px !important;
margin-top: 0 !important;
}
.leaflet-control-zoom {
margin-left: 5px !important;
margin-top: 80px !important;
}
#geosearch {
width: 100%;
}
@ -126,6 +124,11 @@ body {
display: none;
}
.leaflet-control-layers-toggle {
width: 50px !important;
height: 50px !important;
}
.leaflet-control-layers-list label {
padding: 6px 0;
}
@ -133,3 +136,8 @@ body {
.leaflet-control-attribution {
}
#portal_highlight_select{
top:0px !important;
left:0px !important;
}

View File

@ -20,11 +20,9 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.WindowManager;
import android.widget.Toast;
@ -37,7 +35,6 @@ public class IITC_Mobile extends Activity {
private boolean user_loc = false;
private LocationManager loc_mngr = null;
private LocationListener loc_listener = null;
private boolean keyboad_open = false;
private boolean fullscreen_mode = false;
private boolean fullscreen_actionbar = false;
private ActionBar actionBar;
@ -53,6 +50,7 @@ public class IITC_Mobile extends Activity {
setContentView(R.layout.activity_main);
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
// fetch actionbar, set display flags, title and enable home button
actionBar = this.getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
| ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
@ -80,30 +78,6 @@ public class IITC_Mobile extends Activity {
};
sharedPref.registerOnSharedPreferenceChangeListener(listener);
// we need this one to prevent location updates to javascript when
// keyboard is open
// it closes on updates
iitc_view.getViewTreeObserver().addOnGlobalLayoutListener(
new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect r = new Rect();
// r will be populated with the coordinates of your view
// that area still visible.
iitc_view.getWindowVisibleDisplayFrame(r);
int screenHeight = iitc_view.getRootView().getHeight();
int heightDiff = screenHeight - (r.bottom - r.top);
boolean visible = heightDiff > screenHeight / 3;
if (visible == true) {
Log.d("iitcm", "Open Keyboard...");
IITC_Mobile.this.keyboad_open = true;
} else {
Log.d("iitcm", "Close Keyboard...");
IITC_Mobile.this.keyboad_open = false;
}
}
});
// Acquire a reference to the system Location Manager
loc_mngr = (LocationManager) this
.getSystemService(Context.LOCATION_SERVICE);
@ -230,15 +204,9 @@ public class IITC_Mobile extends Activity {
// we want a self defined behavior for the back button
@Override
public void onBackPressed() {
// leave fullscreen mode if it is enabled
// exit fullscreen mode if it is enabled
if (fullscreen_mode) {
if (fullscreen_actionbar)
this.getActionBar().show();
// show notification bar again
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
this.getWindow().setAttributes(attrs);
this.fullscreen_mode = false;
this.toggleFullscreen();
return;
}
if (this.back_button_pressed) {
@ -289,37 +257,13 @@ public class IITC_Mobile extends Activity {
iitc_view.clearFormData();
iitc_view.clearCache(true);
return true;
// toggle fullscreen
case R.id.toggle_fullscreen :
if (!this.fullscreen_mode) {
if (fullscreen_actionbar)
this.getActionBar().hide();
// hide notification bar
WindowManager.LayoutParams attrs = getWindow()
.getAttributes();
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
this.getWindow().setAttributes(attrs);
this.fullscreen_mode = true;
// show a little toast for the user
Toast.makeText(this,
"Press back button to exit fullscreen",
Toast.LENGTH_SHORT).show();
} else {
if (fullscreen_actionbar)
this.getActionBar().show();
// show notification bar again
WindowManager.LayoutParams attrs = getWindow()
.getAttributes();
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
this.getWindow().setAttributes(attrs);
this.fullscreen_mode = false;
}
toggleFullscreen();
return true;
// get the users current location and focus it on map
case R.id.locate :
iitc_view.loadUrl("javascript: window.show('map');");
iitc_view
.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 15});");
actionBar.setTitle(getString(R.string.menu_map));
return true;
// start settings activity
@ -388,11 +332,28 @@ public class IITC_Mobile extends Activity {
// throw away all positions with accuracy > 100 meters
// should avoid gps glitches
if (loc.getAccuracy() < 100) {
if (keyboad_open == false) {
iitc_view.loadUrl("javascript: "
+ "window.plugin.userLocation.updateLocation( "
+ loc.getLatitude() + ", " + loc.getLongitude() + ");");
}
iitc_view.loadUrl("javascript: "
+ "window.plugin.userLocation.updateLocation( "
+ loc.getLatitude() + ", " + loc.getLongitude() + ");");
}
}
}
public void toggleFullscreen() {
if (fullscreen_mode) {
if (fullscreen_actionbar)
this.getActionBar().show();
this.fullscreen_mode = false;
} else {
if (fullscreen_actionbar)
this.getActionBar().hide();
this.fullscreen_mode = true;
// show a toast with instructions to exit the fc mode again
Toast.makeText(this, "Press back button to exit fullscreen",
Toast.LENGTH_SHORT).show();
}
// toggle notification bar
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
this.getWindow().setAttributes(attrs);
}
}

View File

@ -7,6 +7,7 @@ import java.util.Scanner;
import android.app.Activity;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.view.MenuItem;
public class IITC_Settings extends Activity {
@ -25,6 +26,10 @@ public class IITC_Settings extends Activity {
e.printStackTrace();
}
// set action bar title
this.getActionBar().setTitle("IITC Mobile Settings");
this.getActionBar().setHomeButtonEnabled(true);
ArrayList<String> asset_list = new ArrayList<String>();
ArrayList<String> asset_values = new ArrayList<String>();
@ -70,4 +75,16 @@ public class IITC_Settings extends Activity {
getFragmentManager().beginTransaction()
.replace(android.R.id.content, settings).commit();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// exit settings when home button (iitc icon) is pressed
case android.R.id.home :
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}

View File

@ -73,6 +73,18 @@ public class IITC_WebView extends WebView {
@Override
public void loadUrl(String url) {
// if in edit text mode, don't load javascript otherwise the keyboard closes.
HitTestResult testResult = this.getHitTestResult();
if (url.startsWith("javascript:") && testResult != null && testResult.getType() == HitTestResult.EDIT_TEXT_TYPE)
{
// let window.show(...) interupt input
// window.show(...) is called if one of the action bar buttons
// is clicked
if (!url.startsWith("javascript: window.show(")) {
Log.d("iitcm", "in insert mode. do not load script.");
return;
}
}
if (!url.startsWith("javascript:")) {
// force https if enabled in settings
SharedPreferences sharedPref = PreferenceManager

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-players-resonators@rbino
// @name IITC plugin: Player's Resonators
// @version 0.1.4.@@DATETIMEVERSION@@
// @version 0.1.5.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -15,6 +15,7 @@
/*********************************************************************************************************
* Changelog:
*
* 0.1.5 Added portal and reso counter and reso details (Thanks BJT)
* 0.1.4 Added focus link in the toolbox. Some renaming. Removed div to use sidebar style.
* 0.1.3 Effective player name (with wrong capitalization) if it finds some reso
* 0.1.2 Made nickname case insensitive
@ -36,20 +37,28 @@ window.plugin.playersResonators.findReso = function(playername) {
var s = "";
var portalSet = {};
var effectiveNick = "";
var portalCounter = 0;
var resoCounter = 0;
// Assuming there can be no agents with same nick with different lower/uppercase
var nickToFind = playername.toLowerCase();
$.each(window.portals, function(ind, portal){
var resoLevels = {};
var r = portal.options.details.resonatorArray.resonators;
$.each(r, function(ind, reso) {
if (!reso) return true;
var nick = getPlayerName(reso.ownerGuid);
if (nick.toLowerCase() === nickToFind){
resoCounter += 1;
if (!effectiveNick) {
effectiveNick = nick;
}
if (reso.level in resoLevels){
resoLevels[reso.level] += 1;
} else {
resoLevels[reso.level] = 1;
}
if (!portalSet.hasOwnProperty(portal.options.guid)){
portalSet[portal.options.guid] = true;
console.log(portalSet);
portalSet[portal.options.guid] = true;
var latlng = [portal.options.details.locationE6.latE6/1E6, portal.options.details.locationE6.lngE6/1E6].join();
var guid = portal.options.guid;
var zoomPortal = 'window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false';
@ -61,15 +70,23 @@ window.plugin.playersResonators.findReso = function(playername) {
href: perma,
onClick: zoomPortal
})[0].outerHTML;
s += a + "\n";
portalCounter += 1;
s += a + ": ";
}
}
});
if (portalSet.hasOwnProperty(portal.options.guid)){
for (var i = 8; i>0; i--){
if (i in resoLevels)
s += resoLevels[i] + "xL" + i + " ";
}
s += "\n";
}
});
if (s) {
// Showing the playername as a "fake" link to avoid the auto-mouseover effect on the first portal
fakeLinkPlayer = '<a href="#" onClick="return false;">' + effectiveNick + '</a>'
s = fakeLinkPlayer + " has resonators on these portals:\n\n" + s;
s = fakeLinkPlayer + " has " + resoCounter + " resonators on " + portalCounter + " portals:\n\n" + s;
} else {
s = playername + " has no resonators in this range\n";
}

View File

@ -0,0 +1,92 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-upgrade@vita10gy
// @name IITC plugin: highlight portals you can upgrade to a specific level
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to highlight portals you can upgrade to a specific level.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherPortalsCanMakeLevel = function() {};
window.plugin.portalHighligherPortalsCanMakeLevel.highlight = function(data,highlight_level) {
var d = data.portal.options.details;
var current_level = Math.floor(getPortalLevel(d));
var potential_level = Math.floor(window.potentialPortalLevel(d));
var opacity = .7;
if( potential_level > current_level && potential_level === highlight_level) {
color = 'red';
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
}
window.COLOR_SELECTED_PORTAL = '#f0f';
}
//determines the level of poral a user can make all on their own
window.plugin.portalHighligherPortalsCanMakeLevel.playerCanSoloLevel = function(lvl) {
var renators_total = 0;
var renators_placed = 0;
var resonator_level = PLAYER.level
while(renators_placed < 8) {
for(var i = 0; i<MAX_RESO_PER_PLAYER[resonator_level]; i++) {
if(renators_placed < 8) {
renators_total += resonator_level;
renators_placed++;
}
}
resonator_level--;
}
return(Math.floor(renators_total/8));
}
window.plugin.portalHighligherPortalsCanMakeLevel.getHighlighter = function(lvl) {
return(function(data){
window.plugin.portalHighligherPortalsCanMakeLevel.highlight(data,lvl);
});
}
var setup = function() {
// This is the maximum level of a portal a user can be the "last peice of"
// yes, even a level 1 can be the difference in bumping a portal up to level 7
var max_can_complete = 7;
if(PLAYER.level === 8) {
max_can_complete = 8;
}
// The rational behind the "minimum" level below is that showing a level 7 player, for example, all the portals they can make
// a level 5 would be silly, as they can make ANY portal a level 5.
for(var ptl_lvl = window.plugin.portalHighligherPortalsCanMakeLevel.playerCanSoloLevel()+1; ptl_lvl<=max_can_complete; ptl_lvl++) {
window.addPortalHighlighter('Can Make Level ' + ptl_lvl, window.plugin.portalHighligherPortalsCanMakeLevel.getHighlighter(ptl_lvl));
}
}
// 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

@ -0,0 +1,51 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-level-color@vita10gy
// @name IITC plugin: highlight portals by level color
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals level color.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherPortalsLevelColor = function() {};
window.plugin.portalHighligherPortalsLevelColor.colorLevel = function(data) {
var d = data.portal.options.details;
var portal_level = Math.floor(getPortalLevel(d));
var opacity = .6;
data.portal.setStyle({fillColor: COLORS_LVL[portal_level], fillOpacity: opacity});
window.COLOR_SELECTED_PORTAL = '#f0f';
}
var setup = function() {
window.addPortalHighlighter('Level Color', window.plugin.portalHighligherPortalsLevelColor.colorLevel);
}
// 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

@ -0,0 +1,77 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-missing-resonators@vita10gy
// @name IITC plugin: highlight portals missing resonators
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to denote if the portal is missing resonators.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalsMissingResonators = function() {};
window.plugin.portalsMissingResonators.highlight = function(data) {
var d = data.portal.options.details;
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 {
resCount++;
}
});
if(portal_weakness > 0) {
var fill_opacity = portal_weakness*.85 + .15;
var 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;
}
data.portal.setStyle(params);
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5,
dashArray: null});
}
}
window.COLOR_SELECTED_PORTAL = '#f0f';
}
var setup = function() {
window.addPortalHighlighter('Portals Missing Resonators', window.plugin.portalsMissingResonators.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);

View File

@ -0,0 +1,87 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-my-portals@vita10gy
// @name IITC plugin: highlight my portals
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to denote portals you have a hand in. Orange is just ownership. Yellow is sheilds. Red is Resonators. Red trumps both, yellow trumps orange.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherMyPortals = function() {};
window.plugin.portalHighligherMyPortals.highlight = function(data) {
var d = data.portal.options.details;
var portal_weakness = 0;
if(getTeam(d) !== 0) {
var color = '';
var opacity = .7;
if(PLAYER.guid === d.captured.capturingPlayerId) {
color = 'orange';
}
var modCount = 0;
$.each(d.portalV2.linkedModArray, function(ind, mod) {
if(mod !== null && mod.installingUser === PLAYER.guid) {
color = 'yellow';
modCount++;
}
});
if(modCount > 0) {
opacity = modCount*.25*.7 + .3;
}
var resCount = 0;
$.each(d.resonatorArray.resonators, function(ind, reso) {
if(reso !== null && reso.ownerGuid === PLAYER.guid) {
color = 'red';
resCount++;
}
});
if(resCount > 0) {
opacity = resCount*.125*.7 + .3;
}
if(color !== '') {
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
}
}
window.COLOR_SELECTED_PORTAL = '#f0f';
}
var setup = function() {
window.addPortalHighlighter('My Portals', window.plugin.portalHighligherMyPortals.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);

View File

@ -0,0 +1,118 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-by-ap-by-energy-relative@vita10gy
// @name IITC plugin: highlight portals by ap/energy (relative)
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to denote AP/Energy value relative to what's currently on the screen. Brighter is better. Orange means your standard 8 down 8 up swap.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherPortalAPPerEnergyRelative = function() {};
window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP = null;
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP = null;
//This is the AP for a run of the mill takedown/putback
window.plugin.portalHighligherPortalAPPerEnergyRelative.baseSwapAP = 2350;
window.plugin.portalHighligherPortalAPPerEnergyRelative.highlight = function(data) {
var d = data.portal.options.details;
var color = 'red';
if(window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP == null ||
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP == null) {
window.plugin.portalHighligherPortalAPPerEnergyRelative.calculateAPLevels();
}
var minApE = window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP;
var maxApE = window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP;
if(PLAYER.team !== d.controllingTeam.team) {
var ap = getAttackApGain(d);
var energy = getCurrentPortalEnergy(d);
if(energy < 1) {
energy = 1;
}
portal_ap = ap.enemyAp;
var opacity = 1;
if(minApE !== maxApE) {
opacity = ((ap.enemyAp / energy) - minApE) / (maxApE - minApE);
}
if(opacity < 0) {
opacity = 0;
}
if(opacity > 1) {
opacity = 1;
}
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
window.COLOR_SELECTED_PORTAL = '#f0f';
}
}
window.plugin.portalHighligherPortalAPPerEnergyRelative.resetAPLevels = function() {
window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP = null;
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP = null;
}
window.plugin.portalHighligherPortalAPPerEnergyRelative.calculateAPLevels = function() {
var displayBounds = map.getBounds();
$.each(window.portals, function(qk, portal) {
if(displayBounds.contains(portal.getLatLng())) {
if(PLAYER.team !== portal.options.details.controllingTeam.team) {
var ap = getAttackApGain(portal.options.details);
var energy = getCurrentPortalEnergy(portal.options.details);
if(energy < 1) {
energy = 1;
}
var portal_ap = ap.enemyAp / energy;
if(window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP === null ||
portal_ap < window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP) {
window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP = portal_ap;
}
if(window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP === null ||
portal_ap > window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP) {
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP = portal_ap;
}
}
}
});
}
var setup = function() {
window.addPortalHighlighter('AP/Energy (Relative)', window.plugin.portalHighligherPortalAPPerEnergyRelative.highlight);
window.addHook('requestFinished', window.plugin.portalHighligherPortalAPPerEnergyRelative.resetAPLevels);
}
// 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

@ -0,0 +1,113 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-by-ap-relative@vita10gy
// @name IITC plugin: highlight portals by ap relative
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to denote AP value relative to what's currently on the screen. Brighter is better. Orange means your standard 8 down 8 up swap.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherPortalAPRelative = function() {};
window.plugin.portalHighligherPortalAPRelative.minAP = null;
window.plugin.portalHighligherPortalAPRelative.maxAP = null;
//This is the AP for a run of the mill takedown/putback
window.plugin.portalHighligherPortalAPRelative.baseSwapAP = 2350;
window.plugin.portalHighligherPortalAPRelative.highlight = function(data) {
var d = data.portal.options.details;
var color = 'red';
if(window.plugin.portalHighligherPortalAPRelative.minAP == null ||
window.plugin.portalHighligherPortalAPRelative.maxAP == null) {
window.plugin.portalHighligherPortalAPRelative.calculateAPLevels();
}
var minAp = window.plugin.portalHighligherPortalAPRelative.minAP;
var maxAp = window.plugin.portalHighligherPortalAPRelative.maxAP;
var ap = getAttackApGain(d);
var portal_ap = ap.friendlyAp;
if(PLAYER.team !== d.controllingTeam.team) {
portal_ap = ap.enemyAp;
if(portal_ap === window.plugin.portalHighligherPortalAPRelative.baseSwapAP) {
color = 'orange';
}
}
var opacity = 1;
if(minAp !== maxAp) {
opacity = (portal_ap - minAp) / (maxAp - minAp);
}
if(opacity < 0) {
opacity = 0;
}
if(opacity > 1) {
opacity = 1;
}
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
window.COLOR_SELECTED_PORTAL = '#f0f';
}
window.plugin.portalHighligherPortalAPRelative.resetAPLevels = function() {
window.plugin.portalHighligherPortalAPRelative.minAP = null;
window.plugin.portalHighligherPortalAPRelative.maxAP = null;
}
window.plugin.portalHighligherPortalAPRelative.calculateAPLevels = function() {
var displayBounds = map.getBounds();
$.each(window.portals, function(qk, portal) {
if(displayBounds.contains(portal.getLatLng())) {
var ap = getAttackApGain(portal.options.details);
var portal_ap = ap.friendlyAp;
if(PLAYER.team !== portal.options.details.controllingTeam.team) {
portal_ap = ap.enemyAp;
}
if(window.plugin.portalHighligherPortalAPRelative.minAP === null ||
portal_ap < window.plugin.portalHighligherPortalAPRelative.minAP) {
window.plugin.portalHighligherPortalAPRelative.minAP = portal_ap;
}
if(window.plugin.portalHighligherPortalAPRelative.maxAP === null ||
portal_ap > window.plugin.portalHighligherPortalAPRelative.maxAP) {
window.plugin.portalHighligherPortalAPRelative.maxAP = portal_ap;
}
}
});
}
var setup = function() {
window.addPortalHighlighter('AP (Relative)', window.plugin.portalHighligherPortalAPRelative.highlight);
window.addHook('requestFinished', window.plugin.portalHighligherPortalAPRelative.resetAPLevels);
}
// 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

@ -0,0 +1,74 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-by-ap@vita10gy
// @name IITC plugin: highlight portals by ap
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to denote AP value. Brighter is better. Orange means your standard 8 down 8 up swap.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherPortalAP = function() {};
window.plugin.portalHighligherPortalAP.minAP = 65;
//Anything over max AP will be 100% opacity.
window.plugin.portalHighligherPortalAP.maxAP = 6000;
//This is the AP for a run of the mill takedown/putback
window.plugin.portalHighligherPortalAP.baseSwapAP = 2350;
window.plugin.portalHighligherPortalAP.highlight = function(data) {
var d = data.portal.options.details;
var color = 'red';
var ap = getAttackApGain(d);
var portal_ap = ap.friendlyAp;
if(PLAYER.team !== d.controllingTeam.team) {
portal_ap = ap.enemyAp;
if(portal_ap === window.plugin.portalHighligherPortalAP.baseSwapAP) {
color = 'orange';
}
}
var opacity = (portal_ap - window.plugin.portalHighligherPortalAP.minAP) / window.plugin.portalHighligherPortalAP.maxAP;
if(opacity < 0) {
opacity = 0;
}
if(opacity > 1) {
opacity = 1;
}
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
window.COLOR_SELECTED_PORTAL = '#f0f';
}
var setup = function() {
window.addPortalHighlighter('AP (Static)', window.plugin.portalHighligherPortalAP.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);

View File

@ -0,0 +1,68 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-my-level@vita10gy
// @name IITC plugin: highlight portals by my level
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals above or below your level
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherPortalsMyLevel = function() {};
window.plugin.portalHighligherPortalsMyLevel.belowLevel = function(data) {
window.plugin.portalHighligherPortalsMyLevel.colorLevel(true,data);
}
window.plugin.portalHighligherPortalsMyLevel.aboveLevel = function(data) {
window.plugin.portalHighligherPortalsMyLevel.colorLevel(false,data);
}
window.plugin.portalHighligherPortalsMyLevel.colorLevel = function(below,data) {
var d = data.portal.options.details;
var portal_level = Math.floor(getPortalLevel(d));
var player_level = PLAYER.level;
var opacity = .6;
if((below && portal_level <= player_level) ||
(!below && portal_level >= player_level)) {
data.portal.setStyle({fillColor: 'red', fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
}
window.COLOR_SELECTED_PORTAL = '#f0f';
}
var setup = function() {
window.addPortalHighlighter('Below My Level', window.plugin.portalHighligherPortalsMyLevel.belowLevel);
window.addPortalHighlighter('Above My Level', window.plugin.portalHighligherPortalsMyLevel.aboveLevel);
}
// 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

@ -0,0 +1,71 @@
// ==UserScript==
// @id iitc-plugin-highlight-portals-upgrade@vita10gy
// @name IITC plugin: highlight portals you can upgrade
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to highlight portals you can upgrade. Yellow means you can upgrade it at all. Orange means you can change the level. Red means you can make it your level or higher.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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.portalHighligherPortalsUpgrade = function() {};
window.plugin.portalHighligherPortalsUpgrade.highlight = function(data) {
var d = data.portal.options.details;
var current_level = getPortalLevel(d);
var potential_level = window.potentialPortalLevel(d);
var player_level = PLAYER.level;
var opacity = .7;
if( potential_level > current_level) {
potential_level = Math.floor(potential_level);
current_level = Math.floor(current_level);
//console.log(potential_level + '>' + current_level);
var color = 'yellow';
if(potential_level > current_level) {
color = 'orange';
if(potential_level >= player_level) {
color = 'red';
}
}
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
}
window.COLOR_SELECTED_PORTAL = '#f0f';
}
var setup = function() {
window.addPortalHighlighter('Upgradable', window.plugin.portalHighligherPortalsUpgrade.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);

View File

@ -24,11 +24,16 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
window.plugin.scaleBar = function() {};
window.plugin.scaleBar.setup = function() {
$('head').append('<style>.leaflet-control-scale { position: absolute; top: 2px; left: 40px; } </style>');
// Before you ask: yes, I explicitely turned off imperial units. Imperial units
// are worse than Internet Explorer 6 whirring fans combined. Upgrade to the metric
// system already.
window.map.addControl(new L.Control.Scale({position: 'topleft', imperial: false, maxWidth: 200}));
if (window.isSmartphone()) {
$('head').append('<style>.leaflet-control-scale { position: absolute; bottom: 15px; left: 0px; } </style>');
window.map.addControl(new L.Control.Scale({position: 'bottomleft', imperial: false, maxWidth: 200}));
} else {
$('head').append('<style>.leaflet-control-scale { position: absolute; top: 2px; left: 40px; } </style>');
window.map.addControl(new L.Control.Scale({position: 'topleft', imperial: false, maxWidth: 200}));
}
};
var setup = window.plugin.scaleBar.setup;

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-show-portal-weakness@vita10gy
// @name IITC plugin: show portal weakness
// @version 0.6.2.@@DATETIMEVERSION@@
// @version 0.7.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -22,8 +22,7 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
// use own namespace for plugin
window.plugin.portalWeakness = function() {};
window.plugin.portalWeakness.portalAdded = function(data) {
window.plugin.portalWeakness.highlightWeakness = function(data) {
var d = data.portal.options.details;
var portal_weakness = 0;
if(getTeam(d) !== 0) {
@ -82,20 +81,11 @@ window.plugin.portalWeakness.portalAdded = function(data) {
dashArray: null});
}
}
}
window.plugin.portalWeakness.portalDataLoaded = function(data) {
$.each(data.portals, function(ind, portal) {
if(window.portals[portal[0]]) {
window.plugin.portalWeakness.portalAdded({portal: window.portals[portal[0]]});
}
});
window.COLOR_SELECTED_PORTAL = '#f0f';
}
var setup = function() {
window.addHook('portalAdded', window.plugin.portalWeakness.portalAdded);
window.addHook('portalDataLoaded', window.plugin.portalWeakness.portalDataLoaded);
window.COLOR_SELECTED_PORTAL = '#f0f';
window.addPortalHighlighter('Portal Weakness', window.plugin.portalWeakness.highlightWeakness);
}
// PLUGIN END //////////////////////////////////////////////////////////

View File

@ -121,7 +121,7 @@ a:hover {
background: rgba(8, 48, 78, 0.9);
position: absolute;
left: 0;
z-index: 3001;
z-index: 99999;
height: 26px;
padding-left:1px;
}
@ -178,7 +178,7 @@ a:hover {
width: 708px;
bottom: 23px;
left: 0;
z-index: 3000;
z-index: 99999;
background: rgba(8, 48, 78, 0.9);
font-size: 12.6px;
color: #eee;
@ -888,3 +888,17 @@ td + td {
.ALIENS {
color: #28f428;
}
#portal_highlight_select{
position: absolute;
top:5px;
left:10px;
z-index: 9999;
font-size:11px;
font-family: "coda",arial,helvetica,sans-serif;
background-color:#0E3C46;
color:#ffce00;
}

View File

@ -0,0 +1,62 @@
// ==UserScript==
// @id iitc-plugin-cloudmade-maps
// @name IITC plugin: CloudMade.com maps
// @version 0.0.1
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description Adds back CloudMade.com map layers -
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://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 ////////////////////////////////////////////////////////
window.plugin.mapCloudMade = function() {};
window.plugin.mapCloudMade.setup = function() {
//**** CloudMade settings start ****
//set this to your API key - get an API key by registering at www.cloudmade.com
//e.g. var cmApiKey = '8ee2a50541944fb9bcedded5165f09d9';
var cmApiKey = 'YOUR_API_KEY';
//the list of styles you'd like to see
var cmStyles = {
'999': "Midnight",
'22677': "Minimal",
'78603': "Armageddon",
};
//**** CloudMade settings end ****
var osmAttribution = 'Map data © OpenStreetMap contributors';
var cmOpt = {attribution: osmAttribution+', Imagery © CloudMade', maxZoom: 18, apikey: cmApiKey};
$.each(cmStyles, function(key,value) {
cmOpt['style'] = key;
var cmMap = new L.TileLayer('http://{s}.tile.cloudmade.com/{apikey}/{style}/256/{z}/{x}/{y}.png', cmOpt);
layerChooser.addBaseLayer(cmMap, 'CloudMade '+value);
});
};
var setup = window.plugin.mapCloudMade.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);