Merge latest for clean apply in pull

This commit is contained in:
Kevin 2013-03-27 16:55:01 -07:00
commit f9300ba801
25 changed files with 1092 additions and 139 deletions

View File

@ -52,7 +52,7 @@ window.renderPortalDetails = function(guid) {
var lng = d.locationE6.lngE6;
var perma = 'https://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
var imgTitle = 'title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."';
var poslinks = 'window.showPortalPosLinks('+lat/1E6+','+lng/1E6+')';
var poslinks = 'window.showPortalPosLinks('+lat/1E6+','+lng/1E6+',\'' + d.portalV2.descriptiveText.TITLE + '\')';
var postcard = 'Send in a postcard. Will put it online after receiving. Address:\\n\\nStefan Breunig\\nINF 305 R045\\n69120 Heidelberg\\nGermany';
$('#portaldetails')

View File

@ -2,6 +2,15 @@ window.isSmartphone = function() {
// this check is also used in main.js. Note it should not detect
// tablets because their display is large enough to use the desktop
// version.
// The stock intel site allows forcing mobile/full sites with a vp=m or vp=f
// parameter - let's support the same. (stock only allows this for some
// browsers - e.g. android phone/tablet. let's allow it for all, but
// no promises it'll work right)
var viewParam = getURLParam('vp');
if (viewParam == 'm') return true;
if (viewParam == 'f') return false;
return navigator.userAgent.match(/Android.*Mobile/);
}

View File

@ -106,13 +106,17 @@ window.rangeLinkClick = function() {
window.smartphone.mapButton.click();
}
window.showPortalPosLinks = function(lat, lng) {
window.showPortalPosLinks = function(lat, lng, name) {
var portal_name = '';
if(name !== undefined) {
portal_name = encodeURIComponent(' (' + name + ')');
}
if (typeof android !== 'undefined' && android && android.intentPosLink) {
android.intentPosLink(window.location.protocol + '//maps.google.com/?q='+lat+','+lng);
} else {
var qrcode = '<div id="qrcode"></div>';
var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>';
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+'">gmaps</a>';
var gmaps = '<a href="https://maps.google.com/?q='+lat+','+lng+portal_name+'">gmaps</a>';
var osm = '<a href="http://www.openstreetmap.org/?mlat='+lat+'&mlon='+lng+'&zoom=16">OSM</a>';
alert('<div style="text-align: center;">' + qrcode + script + gmaps + ' ' + osm + '</div>');
}

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id ingress-intel-total-conversion@jonatkins
// @name IITC: Ingress intel map total conversion
// @version 0.9.1.@@DATETIMEVERSION@@
// @version 0.10.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@

View File

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cradle.iitc_mobile"
android:versionCode="1"
android:versionName="0.2.2" >
android:versionName="0.2.3" >
<uses-sdk
android:minSdkVersion="14"

View File

@ -1 +1 @@
../../iitc-debug.user.js
../../build/local8000/total-conversion-build.user.js

View File

@ -4,9 +4,10 @@ set -e
cd `dirname "$0"`
cd ..
./build.py
compressed="$(uglifyjs iitc-debug.user.js)"
echo "${compressed}" > "iitc-debug.user.js"
./build.py local8000
cd build/local8000
compressed="$(uglifyjs total-conversion-build.user.js)"
echo "${compressed}" > "total-conversion-build.user.js"
cd mobile
cd ../../mobile
ant release

View File

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<com.cradle.iitc_mobile.IITC_WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
android:orientation="vertical" >
<com.cradle.iitc_mobile.IITC_WebView
android:id="@+id/iitc_webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>

View File

@ -25,15 +25,15 @@ public class IITC_Mobile extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
// we do not want to reload our page every time we switch orientations...
// so restore state if activity was already created
if(savedInstanceState != null) {
((IITC_WebView)findViewById(R.id.webview)).restoreState(savedInstanceState);
iitc_view.restoreState(savedInstanceState);
}
else {
// load new iitc web view with ingress intel page
iitc_view= (IITC_WebView) findViewById(R.id.webview);
Intent intent = getIntent();
String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action)) {
@ -99,6 +99,8 @@ public class IITC_Mobile extends Activity {
iitc_view.getWebViewClient().loadIITC_JS(this);
} catch (IOException e1) {
e1.printStackTrace();
} catch (NullPointerException e2) {
e2.printStackTrace();
}
return true;
// print version number

View File

@ -91,3 +91,68 @@
.ap-list-link-selected {
font-style:italic;
}
.ap-list-center-div {
width: 55%;
margin: 0px auto;
}
.ap-list-page-control {
float:left;
padding: 0 5px;
}
.ap-list-page-text {
float:left;
text-align: center;
color: rgb(32, 168, 177);
}
#ap-list-current-p {
width: 20px;
}
#ap-list-total-p {
width: 20px;
}
.ap-list-triangle {
float:left;
clear:none;
border-style:solid;
}
.ap-list-triangle-left {
border-color: transparent rgb(32, 168, 177) transparent transparent;
}
.ap-list-triangle-left-half {
border-width: 7.5px 7.5px 7.5px 0px;
}
.ap-list-triangle-left-full {
border-width: 7.5px 13px 7.5px 0px;
}
.ap-list-triangle-right {
border-color: transparent transparent transparent rgb(32, 168, 177);
}
.ap-list-triangle-right-half {
border-width: 7.5px 0px 7.5px 7.5px;
}
.ap-list-triangle-right-full {
border-width: 7.5px 0px 7.5px 13px;
}
#ap-list-pagination {
display: inline-block;
width: 90%;
vertical-align: bottom;
}
#ap-list-misc-info {
display: inline-block;
vertical-align: bottom;
padding: 0px 6px;
}

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-ap-list@xelio
// @name IITC plugin: AP List
// @version 0.4.5.@@DATETIMEVERSION@@
// @version 0.5.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -31,7 +31,16 @@ window.plugin.apList.sides = new Array(2);
window.plugin.apList.sortedPortals = new Array(2);
window.plugin.apList.playerApGainFunc = new Array(2);
window.plugin.apList.topMaxCount = 10;
window.plugin.apList.SORT_BY_AP = 'AP';
window.plugin.apList.SORT_BY_EL = 'EL';
window.plugin.apList.sortBy = window.plugin.apList.SORT_BY_AP;
window.plugin.apList.SORT_ASC = 1;
window.plugin.apList.SORT_DESC = -1;
window.plugin.apList.sortOptions = {};
window.plugin.apList.currentPage = [1,1];
window.plugin.apList.totalPage = [1,1];
window.plugin.apList.portalPerPage = 10;
window.plugin.apList.sideLabelClass = {};
window.plugin.apList.tableColumns = new Array(2);
@ -60,13 +69,17 @@ window.plugin.apList.updatePortalTable = function(side) {
+ plugin.apList.tableHeaderBuilder(side)
+ '</thead>';
table += '<tbody>'
for(var i = 0; i < plugin.apList.topMaxCount; i++) {
table += '<tbody>';
var startingPortal = (plugin.apList.currentPage[side] - 1) * plugin.apList.portalPerPage;
for(var i = startingPortal; i < startingPortal + plugin.apList.portalPerPage; i++) {
var portal = plugin.apList.sortedPortals[side][i];
table += plugin.apList.tableRowBuilder(side, portal);
}
table += '</tbody></table>';
$('div#ap-list-table').html(table);
plugin.apList.updatePaginationControl();
plugin.apList.updateStats();
}
window.plugin.apList.tableHeaderBuilder = function(side) {
@ -75,8 +88,10 @@ window.plugin.apList.tableHeaderBuilder = function(side) {
$.each(plugin.apList.tableColumns[side], function(ind, column) {
var cssClass = column.headerTooltip ? (column.cssClass + ' help') : column.cssClass;
var title = column.headerTooltip ? column.headerTooltip : '';
var onclick = column.headerOnClick ? column.headerOnClick: '';
headerRow += '<td class="' + cssClass + '" '
+ 'title="' + title + '" '
+ 'onclick="' + onclick + '" '
+ '>'
+ column.header
+ '</td>';
@ -155,7 +170,7 @@ window.plugin.apList.getPortalApTitle = function(portal) {
window.plugin.apList.getPortalEffectiveLvText = function(portal) {
var title = plugin.apList.getPortalEffectiveLvTitle(portal);
return '<div class="help" title="' + title + '">' + portal.effectiveLevel.effectiveLevel + '</div>';
return '<div class="help" title="' + title + '">' + portal.effectiveLevel.effectiveLevel.toFixed(1) + '</div>';
}
window.plugin.apList.getPortalEffectiveLvTitle = function(portal) {
@ -192,6 +207,33 @@ window.plugin.apList.getPortalLink = function(portal) {
return div;
}
window.plugin.apList.updatePaginationControl = function() {
$('#ap-list-current-p').html(plugin.apList.currentPage[plugin.apList.displaySide]);
$('#ap-list-total-p').html(plugin.apList.totalPage[plugin.apList.displaySide]);
}
window.plugin.apList.updateStats = function() {
var destroyPortals = plugin.apList.destroyPortalsGuid.length;
if(destroyPortals === 0) {
title = 'Stats';
} else {
var destroyAP = 0;
var averageEL = 0;
$.each(plugin.apList.destroyPortalsGuid, function(ind,guid) {
destroyAP += plugin.apList.cachedPortals[guid].playerApGain.totalAp;
averageEL += plugin.apList.cachedPortals[guid].effectiveLevel.effectiveLevel;
});
averageEL = Math.round(averageEL / destroyPortals * 10) / 10;
var title = 'Stats\n'
+ 'Selected portal(s)\t=\t' + destroyPortals + '\n'
+ 'Total AP\t=\t' + destroyAP + '\n'
+ 'Average EL\t=\t' + averageEL;
}
$('#ap-list-misc-info').attr('title', title);
}
// MAIN LOGIC FUNCTIONS //////////////////////////////////////////////////////////
// Loop through portals and get playerApGain, then put in sortedPortals by side and sort them by AP.
@ -234,20 +276,20 @@ window.plugin.apList.updateSortedPortals = function() {
plugin.apList.sortedPortals[side].push(portal);
});
$.each(plugin.apList.sides, function(ind, side) {
plugin.apList.sortedPortals[side].sort(function(a, b) {
return b.playerApGain.totalAp - a.playerApGain.totalAp;
});
plugin.apList.sortedPortals[side].sort(plugin.apList.comparePortal);
});
// Modify sortedPortals if any portal selected for destroy
if(plugin.apList.destroyPortalsGuid.length > 0) {
plugin.apList.handleDestroyPortal()
}
plugin.apList.handleDestroyPortal();
// Update pagination control data
plugin.apList.updateTotalPages();
}
// This function will make AP gain of field and link only count once if
// one of the connected portal is selected for destroy
window.plugin.apList.handleDestroyPortal = function() {
if(plugin.apList.destroyPortalsGuid.length === 0) return;
var enemy = window.plugin.apList.SIDE_ENEMY;
var destroyedLinks = {};
var destroyedFields = {};
@ -310,8 +352,13 @@ window.plugin.apList.handleDestroyPortal = function() {
});
// Sorting portals with updated AP
plugin.apList.sortedPortals[enemy].sort(function(a, b) {
return b.playerApGain.totalAp - a.playerApGain.totalAp;
plugin.apList.sortedPortals[enemy].sort(plugin.apList.comparePortal);
}
window.plugin.apList.updateTotalPages = function() {
$.each(plugin.apList.sortedPortals, function(side, portals) {
plugin.apList.totalPage[side] = Math.max(Math.ceil(portals.length / plugin.apList.portalPerPage), 1);
plugin.apList.currentPage[side] = Math.min(plugin.apList.totalPage[side], plugin.apList.currentPage[side]);
});
}
@ -350,22 +397,16 @@ window.plugin.apList.getDeployOrUpgradeApGain = function(d) {
// by others(only level lower than player level) or by player.
for(var i = 0; i < 8; i++) {
var reso = d.resonatorArray.resonators[i];
if(!reso) {
// Empty reso
reso = {slot: i, level: 0};
otherReso.push(reso);
if(!reso) {
otherReso.push({slot: i, level: 0});
continue;
}
// By player
if(reso.ownerGuid === window.PLAYER.guid) {
if(!playerResoCount[reso.level])
playerResoCount[reso.level] = 0;
playerResoCount[reso.level]++;
playerResoCount[reso.level] = (playerResoCount[reso.level] || 0) + 1;
continue;
}
// By others and level lower than player
if(reso.level < window.PLAYER.level) {
otherReso.push(reso);
@ -389,9 +430,6 @@ window.plugin.apList.getDeployOrUpgradeApGain = function(d) {
upgradedReso.push(targetReso);
// Counting upgrade or deploy
(targetReso.level === 0) ? deployCount++ : upgradedCount++;
totalAp += (targetReso.level === 0)
? DEPLOY_RESONATOR
: UPGRADE_ANOTHERS_RESONATOR;
availableCount--;
}
@ -483,10 +521,10 @@ window.plugin.apList.getEffectiveLevel = function(portal) {
}
return {
effectiveLevel: effectiveLevel.toFixed(1),
effectiveLevel: Math.round(effectiveLevel * 10) / 10,
effectiveEnergy: parseInt(effectiveEnergy),
effectOfShields: effectOfShields.toFixed(2),
effectOfResoDistance: effectOfResoDistance.toFixed(2),
effectOfShields: Math.round(effectOfShields * 100) / 100,
effectOfResoDistance: Math.round(effectOfResoDistance * 100) / 100,
originLevel: portalLevel
};
}
@ -519,6 +557,36 @@ window.plugin.apList.getShieldsMitigation = function(portal) {
return shieldsMitigation;
}
// For using in .sort(func) of sortedPortals
// Use options in plugin.apList.sortOptions. Each type of sortBy has
// array of options. Option consist of an ordering and a property chain.
//
// Sorting done by loop through the options, get the property by
// property chain of each option, compare the property of two object
// with the ordering of option and return the result when the first
// differece is found.
window.plugin.apList.comparePortal = function(a,b) {
var result = 0;
var options = plugin.apList.sortOptions[plugin.apList.sortBy];
$.each(options, function(indO, option) {
var aProperty = a;
var bProperty = b;
// Walking down the chain
$.each(option.chain, function(indPN, propertyName) {
aProperty = aProperty[propertyName];
bProperty = bProperty[propertyName];
});
// compare next porperty if equal
if(aProperty === bProperty) return true;
result = (aProperty > bProperty ? 1 : -1) * option.order;
return false;
});
return result;
}
// FEATURE TOGGLES AND INTERACTION HANDLER ///////////////////////////////////////
window.plugin.apList.enableCache = function() {
@ -535,7 +603,15 @@ window.plugin.apList.disableCache = function() {
}
window.plugin.apList.selectPortal = function(guid) {
// Add error catching to avoid following link of portal if error
// occured in renderPortalDetails or hooked plugin
try {
renderPortalDetails(guid);
} catch(e) {
console.error(e.message);
console.log(e.stack);
console.log('Skipping error in renderPortalDetails or hooked plugin')
}
plugin.apList.setPortalLocationIndicator(guid);
}
@ -578,6 +654,34 @@ window.plugin.apList.animPortalLocationIndicator = function() {
}
}
window.plugin.apList.changePage = function(step, toEnd) {
var side = plugin.apList.displaySide;
var oldPage = plugin.apList.currentPage[side];
if(toEnd) {
if(step < 0) plugin.apList.currentPage[side] = 1;
if(step > 0) plugin.apList.currentPage[side] = plugin.apList.totalPage[side]
} else {
plugin.apList.currentPage[side] += step;
if(plugin.apList.currentPage[side] < 1)
plugin.apList.currentPage[side] = 1;
if(plugin.apList.currentPage[side] > plugin.apList.totalPage[side])
plugin.apList.currentPage[side] = plugin.apList.totalPage[side];
}
if(plugin.apList.currentPage[side] !== oldPage)
plugin.apList.updatePortalTable(side);
}
window.plugin.apList.changeSorting = function(sortBy) {
var oldSortBy = plugin.apList.sortBy;
plugin.apList.sortBy = sortBy;
if(plugin.apList.sortBy !== oldSortBy) {
plugin.apList.updateSortedPortals();
plugin.apList.updatePortalTable(plugin.apList.displaySide);
}
}
window.plugin.apList.destroyPortal = function(guid) {
// Add to destroyPortalsGuid if not yet added, remove if already added
var portalIndex = plugin.apList.destroyPortalIndex(guid);
@ -648,6 +752,25 @@ window.plugin.apList.setupVar = function() {
= "#ap-list-frd";
plugin.apList.sideLabelClass[plugin.apList.SIDE_ENEMY]
= "#ap-list-eny";
plugin.apList.sortedPortals[plugin.apList.SIDE_FRIENDLY] = new Array();
plugin.apList.sortedPortals[plugin.apList.SIDE_ENEMY] = new Array();
}
window.plugin.apList.setupSorting = function() {
var optionELAsc = {
order: plugin.apList.SORT_ASC,
chain: ['effectiveLevel','effectiveLevel']};
var optionAPDesc = {
order: plugin.apList.SORT_DESC,
chain: ['playerApGain','totalAp']};
var optionGuidDesc = {
order: plugin.apList.SORT_DESC,
chain: ['guid']};
// order by EL -> AP -> guid
plugin.apList.sortOptions[plugin.apList.SORT_BY_EL] = [optionELAsc, optionAPDesc, optionGuidDesc];
// order by AP -> EL -> guid
plugin.apList.sortOptions[plugin.apList.SORT_BY_AP] = [optionAPDesc, optionELAsc, optionGuidDesc];
}
// Setup table columns for header builder and row builder
@ -658,12 +781,15 @@ window.plugin.apList.setupTableColumns = function() {
// AP and Eff. LV columns are same in enemy and friendly table
var apColumn = {
header: 'AP',
headerOnClick: 'plugin.apList.changeSorting(plugin.apList.SORT_BY_AP);',
headerTooltip: 'Click to sort by AP',
cssClass: 'ap-list-td-ap',
contentFunction: plugin.apList.getPortalApText
};
var effectiveLevelColumn = {
header: 'EL',
headerTooltip: 'Effective Level',
headerOnClick: 'plugin.apList.changeSorting(plugin.apList.SORT_BY_EL);',
headerTooltip: 'Effective Level\nClick to sort by EL',
cssClass: 'ap-list-td-eff-lv',
contentFunction: plugin.apList.getPortalEffectiveLvText
};
@ -718,12 +844,38 @@ window.plugin.apList.setupList = function() {
+ 'plugin.apList.hideReloadLabel();return false;">↻ R</a>'
+ '</span>'
+ '<div id="ap-list-table"></div>'
+ '<span id="ap-list-misc-info" title="Stats">...</span>'
+ '<span id="ap-list-pagination"></span>'
+ '</div>';
$('#sidebar').append(content);
$('#ap-list-reload').hide();
}
window.plugin.apList.setupPagination = function() {
var content = '<div class="ap-list-center-div">'
+ '<div id="ap-list-first-p" class="ap-list-page-control" onclick="plugin.apList.changePage(-1, true);">'
+ '<div class="ap-list-triangle ap-list-triangle-left ap-list-triangle-left-half"/>'
+ '<div class="ap-list-triangle ap-list-triangle-left ap-list-triangle-left-half"/>'
+ '</div>'
+ '<div id="ap-list-next-p" class="ap-list-page-control" onclick="plugin.apList.changePage(-1);">'
+ '<div class="ap-list-triangle ap-list-triangle-left ap-list-triangle-left-full"/>'
+ '</div>'
+ '<div id="ap-list-current-p" class="ap-list-page-text">1</div>'
+ '<div id="ap-list-page-slash" class="ap-list-page-text">/</div>'
+ '<div id="ap-list-total-p" class="ap-list-page-text">1</div>'
+ '<div id="ap-list-prev-p" class="ap-list-page-control" onclick="plugin.apList.changePage(1);">'
+ '<div class="ap-list-triangle ap-list-triangle-right ap-list-triangle-right-full"/>'
+ '</div>'
+ '<div id="ap-list-last-p" class="ap-list-page-control" onclick="plugin.apList.changePage(1, true);">'
+ '<div class="ap-list-triangle ap-list-triangle-right ap-list-triangle-right-half"/>'
+ '<div class="ap-list-triangle ap-list-triangle-right ap-list-triangle-right-half"/>'
+ '</div>'
+ '<div class="spacer" style="clear: both;"></div>'// fix collapsion of parent caused by inner div's float:left
+ '</div>';
$('#ap-list-pagination').html(content);
}
window.plugin.apList.setupMapEvent = function() {
map.on('zoomstart', function() {
plugin.apList.setupMapEvent.zoomLevelBefore = map.getZoom();
@ -755,9 +907,11 @@ window.plugin.apList.setupMapEvent = function() {
var setup = function() {
window.plugin.apList.setupVar();
window.plugin.apList.setupSorting();
window.plugin.apList.setupTableColumns();
window.plugin.apList.setupCSS();
window.plugin.apList.setupList();
window.plugin.apList.setupPagination();
window.plugin.apList.setupMapEvent();
window.addHook('requestFinished', window.plugin.apList.handleUpdate);
}

132
plugins/keys-on-map.user.js Normal file
View File

@ -0,0 +1,132 @@
// ==UserScript==
// @id iitc-plugin-keys-on-map@xelio
// @name IITC plugin: Keys on map
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Show keys in keys plugin on map.
// @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.keysOnMap = function() {};
window.plugin.keysOnMap.keyLayers = {};
window.plugin.keysOnMap.keyLayerGroup = new L.LayerGroup();
// Use portal add and remove event to control render of keys
window.plugin.keysOnMap.portalAdded = function(data) {
// Disable if Plugin Keys is not there
if(!plugin.keys) {
plugin.keysOnMap.disableMessage();
return;
}
data.portal.on('add', function() {
plugin.keysOnMap.renderKey(this.options.guid, this.getLatLng());
});
data.portal.on('remove', function() {
plugin.keysOnMap.removeKey(this.options.guid);
});
}
window.plugin.keysOnMap.keyUpdate = function(data) {
// Disable if Plugin Keys is not there
if(!plugin.keys) {
plugin.keysOnMap.disableMessage();
return;
}
var portal = window.portals[data.guid];
if(!portal) return;
var latLng = portal.getLatLng();
plugin.keysOnMap.renderKey(data.guid, latLng)
}
window.plugin.keysOnMap.renderKey = function(guid,latLng) {
plugin.keysOnMap.removeKey(guid);
var keyCount = plugin.keys.keys[guid];
if (keyCount > 0) {
var key = L.marker(latLng, {
icon: L.divIcon({
className: 'plugin-keys-on-map-key',
iconAnchor: [6,7],
iconSize: [12,10],
html: keyCount
}),
guid: guid
});
plugin.keysOnMap.keyLayers[guid] = key;
key.addTo(plugin.keysOnMap.keyLayerGroup);
}
}
window.plugin.keysOnMap.removeKey = function(guid) {
var previousLayer = plugin.keysOnMap.keyLayers[guid];
if(previousLayer) {
plugin.keysOnMap.keyLayerGroup.removeLayer(previousLayer);
delete plugin.keysOnMap.keyLayers[guid];
}
}
window.plugin.keysOnMap.disableMessage = function() {
if(!plugin.keysOnMap.messageShown) {
alert('Plugin "Keys On Map" need plugin "Keys" to run!');
plugin.keysOnMap.messageShown = true;
}
}
var setup = function() {
$("<style>")
.prop("type", "text/css")
.html(".plugin-keys-on-map-key {\
font-size: 10px;\
color: #FFFFBB;\
font-family: monospace;\
text-align: center;\
text-shadow: 0 0 0.5em black, 0 0 0.5em black, 0 0 0.5em black;\
pointer-events: none;\
-webkit-text-size-adjust:none;\
}")
.appendTo("head");
window.layerChooser.addOverlay(window.plugin.keysOnMap.keyLayerGroup, 'Keys');
map.addLayer(window.plugin.keysOnMap.keyLayerGroup);
// Avoid error if this plugin load first
if($.inArray('pluginKeysUpdateKey', window.VALID_HOOKS) < 0)
window.VALID_HOOKS.push('pluginKeysUpdateKey');
window.addHook('portalAdded', window.plugin.keysOnMap.portalAdded);
window.addHook('pluginKeysUpdateKey', window.plugin.keysOnMap.keyUpdate);
}
// 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);

66
plugins/keys.css Normal file
View File

@ -0,0 +1,66 @@
#keys-content-outer {
display: table;
width: 100%;
height: 26px;
text-align: center;
}
#keys-content-outer > div{
display: inline-block;
vertical-align: middle;
margin: 6px 3px 1px 3px;
}
#keys-label {
padding: 0 4px;
cursor: help;
}
#keys-add {
}
#keys-count {
width: 26px;
height: 18px !important;
border: 1px solid;
text-align: center;
cursor: help;
}
#keys-subtract {
}
.keys-button {
position:relative;
width: 16px;
height: 16px !important;
}
.keys-button > div {
background-color: rgb(32, 168, 177);
position: absolute;
}
.keys-button-minus {
width: 100%;
height: 4px;
top: 6px;
}
.keys-button-plus-h {
width: 100%;
height: 4px;
top: 6px;
}
.keys-button-plus-v {
width: 4px;
height: 100%;
left: 6px;
}
#keys-help {
font-weight: 900;
margin: 6px 3px 1px 20px !important;
cursor: help;
}

126
plugins/keys.user.js Normal file
View File

@ -0,0 +1,126 @@
// ==UserScript==
// @id iitc-plugin-keys@xelio
// @name IITC plugin: Keys
// @version 0.1.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Store portal keys
// @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.keys = function() {};
window.plugin.keys.LOCAL_STORAGE_KEY = 'plugin-keys-data';
window.plugin.keys.keys = {};
window.plugin.keys.disabledMessage;
window.plugin.keys.contentHTML;
window.plugin.keys.addToSidebar = function() {
if(typeof(Storage) === "undefined") {
$('#portaldetails > .imgpreview').after(plugin.keys.disabledMessage);
return;
}
$('#portaldetails > .imgpreview').after(plugin.keys.contentHTML);
plugin.keys.updateDisplayCount();
}
window.plugin.keys.updateDisplayCount = function() {
var guid = window.selectedPortal;
var count = plugin.keys.keys[guid] || 0;
$('#keys-count').html(count);
}
window.plugin.keys.addKey = function(addCount) {
var guid = window.selectedPortal;
var oldCount = plugin.keys.keys[guid];
var newCount = Math.max((oldCount || 0) + addCount, 0);
if(oldCount !== newCount) {
if(newCount === 0) {
delete plugin.keys.keys[guid];
} else {
plugin.keys.keys[guid] = newCount;
}
plugin.keys.storeKeys();
plugin.keys.updateDisplayCount();
window.runHooks('pluginKeysUpdateKey', {guid: guid, count: newCount});
}
}
window.plugin.keys.storeKeys = function() {
var keysObject = {keys: plugin.keys.keys};
var keysObjectJSON = JSON.stringify(keysObject);
localStorage[plugin.keys.LOCAL_STORAGE_KEY] = keysObjectJSON;
}
window.plugin.keys.loadKeys = function() {
var keysObjectJSON = localStorage[plugin.keys.LOCAL_STORAGE_KEY];
if(!keysObjectJSON) return;
var keysObject = JSON.parse(keysObjectJSON);
plugin.keys.keys = keysObject.keys;
}
window.plugin.keys.setupCSS = function() {
$("<style>")
.prop("type", "text/css")
.html("@@INCLUDESTRING:plugins/keys.css@@")
.appendTo("head");
}
window.plugin.keys.setupContent = function() {
plugin.keys.contentHTML = '<div id="keys-content-outer">'
+ '<div id="keys-label" title="Problem? Point to the question mark!">Key(s):</div>'
+ '<div id="keys-add" class="keys-button" '
+ 'onclick="window.plugin.keys.addKey(-1);">'
+ '<div class="keys-button-minus"></div>'
+ '</div>'
+ '<div id="keys-count" title="Problem? Point to the question mark!"></div>'
+ '<div id="keys-subtract" class="keys-button" '
+ 'onclick="window.plugin.keys.addKey(1);">'
+ '<div class="keys-button-plus-v"></div>'
+ '<div class="keys-button-plus-h"></div>'
+ '</div>'
+ '<div id="keys-help" title="You MUST manually input your count of keys!\n'
+ 'This plugin CANNOT automatically get the keys from Ingress!">?</div>'
+ '</div>';
plugin.keys.disabledMessage = '<div id="keys-content-outer" title="Your browser do not support localStorage">Plugin Keys disabled</div>';
}
var setup = function() {
if($.inArray('pluginKeysUpdateKey', window.VALID_HOOKS) < 0)
window.VALID_HOOKS.push('pluginKeysUpdateKey');
window.plugin.keys.setupCSS();
window.plugin.keys.setupContent();
window.plugin.keys.loadKeys();
window.addHook('portalDetailsUpdated', window.plugin.keys.addToSidebar);
}
// 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,7 +1,7 @@
// ==UserScript==
// @id max-links@boombuler
// @name IITC plugin: Max Links
// @version 0.2.1.@@DATETIMEVERSION@@
// @version 0.3.0.@@DATETIMEVERSION@@
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Calculates how to link the portals to create the maximum number of fields.
@ -32,8 +32,6 @@ window.plugin.maxLinks.STROKE_STYLE = {
clickable: false,
smoothFactor: 10
};
window.plugin.maxLinks._delaunayScriptLocation = '@@RESOURCEURLBASE@@/delaunay.js';
window.plugin.maxLinks.layer = null;
window.plugin.maxLinks._updating = false;
@ -85,7 +83,9 @@ window.plugin.maxLinks.updateLayer = function() {
}
window.plugin.maxLinks.setup = function() {
load(window.plugin.maxLinks._delaunayScriptLocation).thenRun(function() {
try { console.log('Loading delaunay JS now'); } catch(e) {}
@@INCLUDERAW:dist/delaunay.js@@
try { console.log('done loading delaunay JS'); } catch(e) {}
window.delaunay.Triangle.prototype.draw = function(layer, divX, divY) {
var drawLine = function(src, dest) {
@ -117,7 +117,6 @@ window.plugin.maxLinks.setup = function() {
});
window.map.on('zoomend moveend', window.plugin.maxLinks.updateLayer);
window.layerChooser.addOverlay(window.plugin.maxLinks.layer, 'Maximum Links');
});
}
var setup = window.plugin.maxLinks.setup;

View File

@ -219,7 +219,14 @@ window.plugin.playerTracker.getLatLngFromEvent = function(ev) {
}
window.plugin.playerTracker.ago = function(time, now) {
return parseInt((now-time)/(1000*60));
var s = (now-time) / 1000;
var h = Math.floor(s / 3600);
var m = Math.floor((s % 3600) / 60);
var returnVal = m + 'm';
if(h > 0) {
returnVal = h + 'h' + returnVal;
}
return returnVal;
}
window.plugin.playerTracker.drawData = function() {
@ -252,10 +259,10 @@ window.plugin.playerTracker.drawData = function() {
var cssClass = playerData.team === 'ALIENS' ? 'enl' : 'res';
var title =
'<span class="nickname '+ cssClass+'" style="font-weight:bold;">' + playerData.nick + '</span>\n'
+ ago(last.time, now) + ' minutes ago\n'
+ ago(last.time, now) + ' ago\n'
+ last.name;
// show previous data in tooltip
var minsAgo = '\t<span style="white-space: nowrap;">mins ago</span>\t';
var minsAgo = '\t<span style="white-space: nowrap;"> ago</span>\t';
if(evtsLength >= 2)
title += '\n&nbsp;\nprevious locations:\n';
for(var i = evtsLength - 2; i >= 0 && i >= evtsLength - 10; i--) {

View File

@ -0,0 +1,139 @@
// ==UserScript==
// @id iitc-plugin-portals-count@yenky
// @name IITC plugin: Show total counts of portals
// @version 0.0.6.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Display a list of all localized portals by level and faction
// @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==
/* whatsnew
* 0.0.6 : ignoring outside bounds portals (even if close to)
* 0.0.5 : changed table layout, added some colors
* 0.0.4 : reverse show order of portals, using MAX_PORTAL_LEVEL now for array, changed table layout to be more compact, cleaned up code
* 0.0.3 : fixed incorrect rounded portal levels, adjusted viewport
* 0.0.2 : fixed counts to be reset after scrolling
* 0.0.1 : initial release, show count of portals
* todo :
*/
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.portalcounts = function() {};
//count portals for each level avalaible on the map
window.plugin.portalcounts.getPortals = function(){
//console.log('** getPortals');
var retval=false;
var displayBounds = map.getBounds();
window.plugin.portalcounts.enlP = 0;
window.plugin.portalcounts.resP = 0;
window.plugin.portalcounts.neuP = 0;
window.plugin.portalcounts.PortalsEnl = new Array();
window.plugin.portalcounts.PortalsRes = new Array();
for(var level = window.MAX_PORTAL_LEVEL; level > 0; level--){
window.plugin.portalcounts.PortalsEnl[level] = 0;
window.plugin.portalcounts.PortalsRes[level] = 0;
}
$.each(window.portals, function(i, portal) {
retval=true;
var d = portal.options.details;
var team = portal.options.team;
var level = Math.floor(getPortalLevel(d));
// just count portals in viewport
if(!displayBounds.contains(portal.getLatLng())) return true;
switch (team){
case 1 :
window.plugin.portalcounts.resP++;
window.plugin.portalcounts.PortalsRes[level]++;
break;
case 2 :
window.plugin.portalcounts.enlP++;
window.plugin.portalcounts.PortalsEnl[level]++;
break;
default:
window.plugin.portalcounts.neuP++;
break;
}
});
//get portals informations from IITC
var minlvl = getMinPortalLevel();
var counts = '<table>';
if(retval) {
counts += '<tr><th></th><th class="enl">Enlightment</th><th class="res">Resistance</th></tr>'; //'+window.plugin.portalcounts.enlP+' Portal(s)</th></tr>';
for(var level = window.MAX_PORTAL_LEVEL; level > 0; level--){
counts += '<tr><td class="L'+level+'">Level '+level+'</td>';
if(minlvl > level)
counts += '<td colspan="2">zoom in to see portals in this level</td>';
else
counts += '<td class="enl">'+window.plugin.portalcounts.PortalsEnl[level]+'</td><td class="res">'+window.plugin.portalcounts.PortalsRes[level]+'</td>';
counts += '</tr>';
}
counts += '<tr><td colspan="3">&nbsp</td></tr>';
counts += '<tr><td>Neutral:</td><td colspan="2">';
if(minlvl > 0)
counts += 'zoom in to see unclaimed';
else
counts += window.plugin.portalcounts.neuP;
counts += ' Portal(s)</td></tr>';
counts += '<tr class="enl"><th colspan="2">Enlightment:</th><td>'+window.plugin.portalcounts.enlP+' Portal(s)</td></tr>';
counts += '<tr class="res"><th colspan="2">Resistance:</th><td>'+window.plugin.portalcounts.resP+' Portal(s)</td></tr>';
} else
counts += '<tr><td>No Portals in range !</td></tr>';
counts += '</table>';
alert('<div id="portalcounts">'+counts+'</div>');
}
var setup = function() {
$('body').append('<div id="portalcounts" style="display:none;"></div>');
$('#toolbox').append('<a onclick="window.plugin.portalcounts.getPortals()">Portalcounts</a>');
$('head').append('<style>' +
'#portalcounts table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
'#portalcounts table td, #portalcounts table th {border-bottom: 1px solid #0b314e; padding:3px; color:white; background-color:#1b415e}' +
'#portalcounts table tr.res th { background-color: #005684; }' +
'#portalcounts table tr.enl th { background-color: #017f01; }' +
'#portalcounts table th { text-align: center;}' +
'#portalcounts table td { text-align: center;}' +
'#portalcounts table td.L0 { background-color: #000000 !important;}' +
'#portalcounts table td.L1 { background-color: #FECE5A !important;}' +
'#portalcounts table td.L2 { background-color: #FFA630 !important;}' +
'#portalcounts table td.L3 { background-color: #FF7315 !important;}' +
'#portalcounts table td.L4 { background-color: #E40000 !important;}' +
'#portalcounts table td.L5 { background-color: #FD2992 !important;}' +
'#portalcounts table td.L6 { background-color: #EB26CD !important;}' +
'#portalcounts table td.L7 { background-color: #C124E0 !important;}' +
'#portalcounts table td.L8 { background-color: #9627F4 !important;}' +
'#portalcounts table td:nth-child(1) { text-align: left;}' +
'#portalcounts table th:nth-child(1) { text-align: left;}' +
'</style>');
}
// 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,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-portals-list@teo96
// @name IITC plugin: show list of portals
// @version 0.0.6.@@DATETIMEVERSION@@
// @version 0.0.9.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -13,16 +13,20 @@
// ==/UserScript==
/* whatsnew
* 0.0.9 : bugs hunt
* 0.0.8 : Aborted to avoid problems with Niantic (export portals informations as csv or kml file)
* 0.0.7 : more informations avalaible via tooltips (who deployed, energy, ...), new E/AP column
* 0.0.6 : Add power charge information into a new column + bugfix
* 0.0.5 : Filter portals by clicking on 'All portals', 'Res Portals' or 'Enl Portals'
* 0.0.4 : Add link to portals name, one click to display full information in portal panel, double click to zoom on portal, hover to show address
* 0.0.3 : sorting ascending/descending and add numbers of portals by faction on top on table
* 0.0.2 : add sorting feature when click on header column
* 0.0.1 : initial release, show list of portals with level, team, resonators and shield information
*
* Display code inspired from @vita10gy's scoreboard plugin : iitc-plugin-scoreboard@vita10gy - https://github.com/breunigs/ingress-intel-total-conversion
* Portal link code from xelio - iitc: AP List - https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/ap-list.user.js
*
* todo :
* todo : export as GPX, Open in Google Maps, more statistics in the header, what else ?
*/
function wrapper() {
@ -53,7 +57,8 @@ window.plugin.portalslist.getPortals = function(){
retval=true;
var d = portal.options.details;
var name = d.portalV2.descriptiveText.TITLE;
var address = d.portalV2.descriptiveText.ADDRESS;
var img = d.imageByUrl && d.imageByUrl.imageUrl ? d.imageByUrl.imageUrl : DEFAULT_PORTAL_IMG;
var team = portal.options.team;
switch (team){
case 1 :
@ -85,22 +90,25 @@ window.plugin.portalslist.getPortals = function(){
var shields = [];
$.each(d.portalV2.linkedModArray, function(ind, mod) {
if (mod)
shields[ind] = mod.rarity.capitalize().replace('_', ' ');
//shields[ind] = mod.rarity.capitalize().replace('_', ' ');
shields[ind] = [mod.rarity.substr(0,1).capitalize(), getPlayerName(mod.installingUser)] ;
else
shields[ind] = '';
shields[ind] = ['', ''];
});
var APgain= getAttackApGain(d).enemyAp;
var thisPortal = {'portal':d,'name':name,'team':team,'level':level,'guid':guid, 'resonators':resonators,'energy' : Math.floor(energy/maxenergy*100), 'shields':shields,'APgain':APgain};
var thisPortal = {'portal':d,'name':name,'team':team,'level':level,'guid':guid, 'resonators':resonators,'energyratio' : Math.floor(energy/maxenergy*100), 'shields':shields, 'APgain':APgain, 'EAP' : (energy/APgain).toFixed(2), 'energy': energy, 'maxenergy':maxenergy, 'lat':portal._latlng.lat, 'lng':portal._latlng.lng, 'address': address, 'img' : img};
window.plugin.portalslist.listPortals.push(thisPortal);
});
return retval;
}
window.plugin.portalslist.displayPL = function() {
//console.log('** displayPL');
// debug tools
//var start = new Date().getTime();
//console.log('***** Start ' + start);
var html = '';
window.plugin.portalslist.sortOrder=-1;
window.plugin.portalslist.enlP = 0;
@ -127,13 +135,16 @@ window.plugin.portalslist.displayPL = function() {
$(document).on('click', '#portalslist .filterEnl', function() {
$('#portalslist').html(window.plugin.portalslist.portalTable($(this).data('sort'),window.plugin.portalslist.sortOrder,2));
});
//debug tools
//end = new Date().getTime();
//console.log('***** end : ' + end + ' and Elapse : ' + (end - start));
}
window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) {
// sortOrder <0 ==> desc, >0 ==> asc, i use sortOrder * -1 to change the state
window.plugin.portalslist.filter=filter;
var portals=window.plugin.portalslist.listPortals;
// console.log('********************* Sort by ' + sortBy + ' order : ' + sortOrder + ' filter : ' + filter);
//Array sort
window.plugin.portalslist.listPortals.sort(function(a, b) {
@ -191,7 +202,7 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) {
html += '<table>'
+ '<tr><th ' + sort('names', sortBy, -1) + '>Portal</th>'
+ '<th ' + sort('level', sortBy, -1) + '>Level</th>'
+ '<th ' + sort('team', sortBy, -1) + '>Team</th>'
+ '<th title="Team" ' + sort('team', sortBy, -1) + '>T</th>'
+ '<th ' + sort('r1', sortBy, -1) + '>R1</th>'
+ '<th ' + sort('r2', sortBy, -1) + '>R2</th>'
+ '<th ' + sort('r3', sortBy, -1) + '>R3</th>'
@ -200,63 +211,164 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) {
+ '<th ' + sort('r6', sortBy, -1) + '>R6</th>'
+ '<th ' + sort('r7', sortBy, -1) + '>R7</th>'
+ '<th ' + sort('r8', sortBy, -1) + '>R8</th>'
+ '<th ' + sort('energy', sortBy, -1) + '>Energy</th>'
+ '<th ' + sort('s1', sortBy, -1) + '>Shield 1</th>'
+ '<th ' + sort('s2', sortBy, -1) + '>Shield 2</th>'
+ '<th ' + sort('s3', sortBy, -1) + '>Shield 3</th>'
+ '<th ' + sort('s4', sortBy, -1) + '>Shield 4</th>'
+ '<th ' + sort('APgain', sortBy, -1) + '>AP Gain</th></tr>';
+ '<th ' + sort('energyratio', sortBy, -1) + '>Energy</th>'
+ '<th ' + sort('s1', sortBy, -1) + '>S1</th>'
+ '<th ' + sort('s2', sortBy, -1) + '>S2</th>'
+ '<th ' + sort('s3', sortBy, -1) + '>S3</th>'
+ '<th ' + sort('s4', sortBy, -1) + '>S4</th>'
+ '<th ' + sort('APgain', sortBy, -1) + '>AP Gain</th>'
+ '<th title="Energy / AP Gain ratio" ' + sort('EAP', sortBy, -1) + '>E/AP</th></tr>';
$.each(portals, function(ind, portal) {
if (filter === 0 || filter === portal.team){
html += '<tr class="' + (portal.team === 1 ? 'res' : (portal.team === 2 ? 'enl' : 'neutral')) + '">'
+ '<td style="min-width:145px !important">' + window.plugin.portalslist.getPortalLink(portal.portal, portal.guid) + '</td>'
//+ '<td>' + portal.name + '</td>'
+ '<td style="">' + window.plugin.portalslist.getPortalLink(portal.portal, portal.guid) + '</td>'
+ '<td class="L' + Math.floor(portal.level) +'">' + portal.level + '</td>'
+ '<td style="text-align:center;">' + portal.team + '</td>'
+ '<td class="L' + portal.resonators[0][0] +'">' + portal.resonators[0][0] + '</td>'
//+ '<td><span class="meter"><span style="width:72.35%; background:#EB26CD;"></span><span class="meter-level" style="color: #FFFFFF;">6</span></span>'
+ '<td class="L' + portal.resonators[1][0] +'">' + portal.resonators[1][0] + '</td>'
+ '<td class="L' + portal.resonators[2][0] +'">' + portal.resonators[2][0] + '</td>'
+ '<td class="L' + portal.resonators[3][0] +'">' + portal.resonators[3][0] + '</td>'
+ '<td class="L' + portal.resonators[4][0] +'">' + portal.resonators[4][0] + '</td>'
+ '<td class="L' + portal.resonators[5][0] +'">' + portal.resonators[5][0] + '</td>'
+ '<td class="L' + portal.resonators[6][0] +'">' + portal.resonators[6][0] + '</td>'
+ '<td class="L' + portal.resonators[7][0] +'">' + portal.resonators[7][0] + '</td>'
+ '<td style="text-align:center;">' + portal.energy + '%</td>'
+ '<td style="font-size:10px">' + portal.shields[0] + '</td>'
+ '<td style="font-size:10px">' + portal.shields[1] + '</td>'
+ '<td style="font-size:10px">' + portal.shields[2] + '</td>'
+ '<td style="font-size:10px">' + portal.shields[3] + '</td>'
+ '<td>' + portal.APgain + '</td>';
+ '<td style="text-align:center;">' + portal.team + '</td>';
$.each([0, 1, 2, 3 ,4 ,5 ,6 ,7], function(ind, slot) {
var title = 'title="owner: <b>' + portal.resonators[slot][1] + '</b><br>'
+ 'energy: ' + portal.resonators[slot][3] + ' / ' + portal.resonators[slot][4] + ' (' + Math.floor(portal.resonators[slot][3]/portal.resonators[slot][4]*100) + '%)<br>'
+ 'distance: ' + portal.resonators[slot][2] + 'm';
html += '<td class="L' + portal.resonators[slot][0] +'" ' + title + '">' + portal.resonators[slot][0] + '</td>';
});
html += '<td style="cursor:help" title="' + portal.energy + ' / ' + portal.maxenergy +'">' + portal.energyratio + '%</td>'
+ '<td style="cursor:help" title="'+ portal.shields[0][1] +'">' + portal.shields[0][0] + '</td>'
+ '<td style="cursor:help" title="'+ portal.shields[1][1] +'">' + portal.shields[1][0] + '</td>'
+ '<td style="cursor:help" title="'+ portal.shields[2][1] +'">' + portal.shields[2][0] + '</td>'
+ '<td style="cursor:help" title="'+ portal.shields[3][1] +'">' + portal.shields[3][0] + '</td>'
+ '<td>' + portal.APgain + '</td>'
+ '<td>' + portal.EAP + '</td>';
html+= '</tr>';
}
});
html+='</table>';
html+= '<div class="disclaimer">Click on portals table headers to sort by that column.<br> '
+ 'Click on All Portals, Resistant Portals, Enlightened Portals to filter<br>'
html += '</table>';
//html += window.plugin.portalslist.exportLinks();
html += '<div class="disclaimer">Click on portals table headers to sort by that column. '
+ 'Click on <b>All Portals, Resistant Portals, Enlightened Portals</b> to filter<br>'
+ 'Thanks to @vita10gy & @xelio for their IITC plugins who inspired me. A <a href="https://plus.google.com/113965246471577467739">@teo96</a> production. Vive la Résistance !</div>';
window.plugin.portalslist.sortOrder = window.plugin.portalslist.sortOrder*-1;
return html;
}
window.plugin.portalslist.stats = function(sortBy) {
//console.log('** stats');
var html = '<table><tr>'
+ '<td class="filterAll" style="cursor:pointer" onclick="window.plugin.portalslist.portalTable(\'level\',-1,0)"><a href=""></a>All Portals : (click to filter)</td><td class="filterAll">' + window.plugin.portalslist.listPortals.length +'</td>'
+ '<td class="filterRes" style="cursor:pointer" class="sorted" onclick="window.plugin.portalslist.portalTable(\'level\',-1,1)">Resistant Portals : </td><td class="filterRes">' + window.plugin.portalslist.resP + '</td>'
+ '<td class="filterEnl" style="cursor:pointer" class="sorted" onclick="window.plugin.portalslist.portalTable(\'level\',-1,2)">Enlightened Portals : </td><td class="filterEnl">'+ window.plugin.portalslist.enlP + '</td>'
+ '<td class="filterAll" style="cursor:pointer" onclick="window.plugin.portalslist.portalTable(\'level\',-1,0)"><a href=""></a>All Portals : (click to filter)</td><td class="filterAll">' + window.plugin.portalslist.listPortals.length + '</td>'
+ '<td class="filterRes" style="cursor:pointer" class="sorted" onclick="window.plugin.portalslist.portalTable(\'level\',-1,1)">Resistant Portals : </td><td class="filterRes">' + window.plugin.portalslist.resP +' (' + Math.floor(window.plugin.portalslist.resP/window.plugin.portalslist.listPortals.length*100) + '%)</td>'
+ '<td class="filterEnl" style="cursor:pointer" class="sorted" onclick="window.plugin.portalslist.portalTable(\'level\',-1,2)">Enlightened Portals : </td><td class="filterEnl">'+ window.plugin.portalslist.enlP +' (' + Math.floor(window.plugin.portalslist.enlP/window.plugin.portalslist.listPortals.length*100) + '%)</td>'
+ '</tr>'
+ '</table>';
return html;
}
//return Html generated to export links
window.plugin.portalslist.exportLinks = function(){
var html='';
var stamp = new Date().getTime();
html+='<div><aside><a download="Ingress Export.csv" href="' + window.plugin.portalslist.export('csv') + '">Export as .csv</a></aside>'
+ '<aside><a download="Ingress Export.kml" href="' + window.plugin.portalslist.export('kml') + '">Export as .kml</a></aside>'
+ '</div>';
return html;
}
window.plugin.portalslist.export = function(fileformat){
//alert('format :' + fileformat);
var file = '';
var uri = '';
switch (fileformat) {
case 'csv':
file = window.plugin.portalslist.exportCSV();
break;
case 'kml':
file = window.plugin.portalslist.exportKML();
break;
}
if (file !== '') {
//http://stackoverflow.com/questions/4639372/export-to-csv-in-jquery
var uri = 'data:application/' + fileformat + 'csv;charset=UTF-8,' + encodeURIComponent(file);
//window.open(uri);
}
return uri;
}
window.plugin.portalslist.exportCSV = function(){
var csv = '';
var filter = window.plugin.portalslist.filter;
var portals = window.plugin.portalslist.listPortals;
//headers
csv += 'Portal\tLevel\tTeam\tR1\tR2\tR3\tR4\tR5\tR6\tR7\tR8\tEnergy\tS1\tS2\tS3\tS4\tAP Gain\tE/AP\tlat\tlong\n';
$.each(portals, function(ind, portal) {
if (filter === 0 || filter === portal.team){
csv += portal.name + '\t'
+ portal.level + '\t'
+ portal.team + '\t';
$.each([0, 1, 2, 3 ,4 ,5 ,6 ,7], function(ind, slot) {
csv += portal.resonators[slot][0] + '\t';
});
csv += portal.energyratio + '\t' + portal.shields[0][0] + '\t' + portal.shields[1][0] + '\t' + portal.shields[2][0] + '\t' + portal.shields[3][0] + '\t' + portal.APgain + '\t' + portal.EAP + '\t';
csv += portal.lat + '\t' + portal.lng;
csv += '\n';
}
});
return csv;
}
window.plugin.portalslist.exportKML = function(){
var kml = '';
var filter = window.plugin.portalslist.filter;
// all portals informations are avalaible in the listPortals array
var portals = window.plugin.portalslist.listPortals;
//headers
kml = '<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document>\n'
+ '<name>Ingress Export</name><description><![CDATA[Ingress Portals\nExported from IITC using the Portals-list plugin\n' + new Date().toLocaleString() + ']]></description>';
// define colored markers as style0 (neutral), style1 (Resistance), style2 (Enlight)
kml += '<Style id="style1"><IconStyle><Icon><href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href></Icon></IconStyle></Style>'
+ '<Style id="style2"><IconStyle><Icon><href>http://maps.gstatic.com/mapfiles/ms2/micons/green-dot.png</href></Icon></IconStyle></Style>'
+ '<Style id="style0"><IconStyle><Icon><href>http://maps.gstatic.com/mapfiles/ms2/micons/pink-dot.png</href></Icon></IconStyle></Style>\n';
$.each(portals, function(ind, portal) {
// add the portal in the kml file only if part of the filter choice
if (filter === 0 || filter === portal.team){
// description contain picture of the portal, address and link to the Intel map
var description = '<![CDATA['
+ '<div><table><tr><td><img style="width:100px" src="' + portal.img + '"></td><td>' + portal.address
+ '<br><a href="https://ingress.com/intel?latE6=' + portal.lat*1E6 + '&lngE6=' + portal.lng*1E6 + '&z=17">Link to Intel Map</a></td></tr></table>'
+ ']]>';
kml += '<Placemark><name>L' + Math.floor(portal.level) + ' - ' + portal.name + '</name>'
+ '<description>' + description + '</description>'
+ '<styleUrl>#style' + portal.team + '</styleUrl>';
//coordinates
kml += '<Point><coordinates>' + portal.lng + ',' + portal.lat + ',0</coordinates></Point>';
kml += '</Placemark>\n';
}
});
kml += '</Document></kml>';
return kml;
}
// A little helper functon so the above isn't so messy
window.plugin.portalslist.portalTableSort = function(name, by) {
var retVal = 'data-sort="' + name + '"';
@ -286,7 +398,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
onClick: jsSingleClick,
onDblClick: jsDoubleClick
})[0].outerHTML;
var div = '<div style="overflow: hidden; text-overflow:ellipsis;">'+a+'</div>';
var div = '<div style="max-height: 15px !important; min-width:140px !important;max-width:180px !important; overflow: hidden; text-overflow:ellipsis;">'+a+'</div>';
return div;
}
@ -302,15 +414,15 @@ var setup = function() {
'#portalslist table tr.neutral td { background-color: #000000; }' +
'#portalslist table th { text-align:center;}' +
'#portalslist table td { text-align: center;}' +
'#portalslist table td.L0 { background-color: #000000 !important;}' +
'#portalslist table td.L1 { background-color: #FECE5A !important;}' +
'#portalslist table td.L2 { background-color: #FFA630 !important;}' +
'#portalslist table td.L3 { background-color: #FF7315 !important;}' +
'#portalslist table td.L4 { background-color: #E40000 !important;}' +
'#portalslist table td.L5 { background-color: #FD2992 !important;}' +
'#portalslist table td.L6 { background-color: #EB26CD !important;}' +
'#portalslist table td.L7 { background-color: #C124E0 !important;}' +
'#portalslist table td.L8 { background-color: #9627F4 !important;}' +
'#portalslist table td.L0 { cursor: help; background-color: #000000 !important;}' +
'#portalslist table td.L1 { cursor: help; background-color: #FECE5A !important;}' +
'#portalslist table td.L2 { cursor: help; background-color: #FFA630 !important;}' +
'#portalslist table td.L3 { cursor: help; background-color: #FF7315 !important;}' +
'#portalslist table td.L4 { cursor: help; background-color: #E40000 !important;}' +
'#portalslist table td.L5 { cursor: help; background-color: #FD2992 !important;}' +
'#portalslist table td.L6 { cursor: help; background-color: #EB26CD !important;}' +
'#portalslist table td.L7 { cursor: help; background-color: #C124E0 !important;}' +
'#portalslist table td.L8 { cursor: help; background-color: #9627F4 !important;}' +
'#portalslist table td:nth-child(1) { text-align: left;}' +
'#portalslist table th { cursor:pointer; text-align: right;}' +
'#portalslist table th:nth-child(1) { text-align: left;}' +

View File

@ -0,0 +1,130 @@
// ==UserScript==
// @id iitc-plugin-privacy-view@Scrool
// @name IITC plugin: Privacy view on Intel
// @version 1.0.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description [@@BUILDNAME@@-@@BUILDDATE@@] From Intel hides info which shouldn't leak to players of other fraction
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @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.privacyView = function() {};
window.plugin.privacyView.chatExpanded = function() {
return $('#chat, #chatcontrols').hasClass('expand');
};
window.plugin.privacyView.toggle = function() {
var b = $('body');
var t = $('#privacycontrols .toggle');
if(b.hasClass('privacy_active')) {
b.removeClass('privacy_active').addClass('privacy_inactive');
t.text('Privacy inactive');
} else {
b.removeClass('privacy_inactive').addClass('privacy_active');
t.text('Privacy active');
if(window.plugin.privacyView.chatExpanded()) {
window.plugin.privacyView.wrapChatToggle();
}
}
};
window.plugin.privacyView.wrapChatToggle = function() {
window.chat.toggle();
var c = $('#chat, #chatcontrols');
if(c.hasClass('expand')) {
$('#privacycontrols').removeClass('shrinked').addClass('expanded');
} else {
$('#privacycontrols').removeClass('expanded').addClass('shrinked');
}
};
window.plugin.privacyView.setup = function() {
var privacy_button_width = 135;
$('head').append('<style>' +
'.privacy_active #playerstat,' +
'.privacy_active #chatinput,' +
'.privacy_active #chatcontrols,' +
'.privacy_active #chat { display: none; }' +
'#privacycontrols {' +
' color: #FFCE00;' +
' background: rgba(8, 48, 78, 0.9);' +
' position: absolute;' +
' left: 0;' +
' z-index: 3001;' +
' height: 26px;' +
' padding-left:1px;' +
' bottom: 82px;' +
'}' +
'#privacycontrols a {' +
' margin-left: -1px;' +
' display: inline-block;' +
' width: ' + privacy_button_width + 'px;' +
' text-align: center;' +
' height: 24px;' +
' line-height: 24px;' +
' border: 1px solid #20A8B1;' +
' vertical-align: top;' +
'}' +
'#privacycontrols a {' +
' text-decoration: none !important;' +
'}' +
'#privacycontrols .toggle {' +
' border-left: 10px solid transparent;' +
' border-right: 10px solid transparent;' +
' width: auto;' +
'}' +
'#chatcontrols {' +
' left: ' + (privacy_button_width + 1) + 'px;' +
'}' +
'#privacycontrols.expanded { top: 0; bottom: auto; }' +
'#privacycontrols.shrinked { bottom: 82px; }' +
'.privacy_active #privacycontrols { bottom: 0; }' +
'</style>');
$('body').addClass('privacy_inactive');
//Wrap iitc chat toggle to update our elements
$('#chatcontrols a:first').unbind('click');
$('#chatcontrols a:first').click(window.plugin.privacyView.wrapChatToggle);
$('#chatcontrols').before('<div id="privacycontrols" class="shrinked">' +
' <a><span class="toggle"></span></a>' +
'</div>');
$('#privacycontrols a').click(window.plugin.privacyView.toggle);
window.plugin.privacyView.toggle();
};
var setup = window.plugin.privacyView.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,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-show-linked-portals@fstopienski
// @name IITC plugin: Show linked portals
// @version 0.0.1.@@DATETIMEVERSION@@
// @version 0.0.2.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -79,7 +79,8 @@ window.plugin.showLinkedPortal.getPortalByGuid = function (guid) {
portalInfoString = '';
var portalNameAdressAlt = "'" + portalDetails.portalV2.descriptiveText.TITLE + "' (" + portalDetails.portalV2.descriptiveText.ADDRESS + ")";
var portalNameAdressTitle = "'<strong>" + portalDetails.portalV2.descriptiveText.TITLE + "</strong>'<br/> <em>(" + portalDetails.portalV2.descriptiveText.ADDRESS + ")</em>";
portalInfoString = '<img src="' + portalDetails.imageByUrl.imageUrl + '" class="minImg" alt="' + portalNameAdressAlt + '" title="' + portalNameAdressTitle + '"/>';
var imageUrl = (portalDetails.imageByUrl ? portalDetails.imageByUrl.imageUrl : window.DEFAULT_PORTAL_IMG);
portalInfoString = '<img src="' + imageUrl + '" class="minImg" alt="' + portalNameAdressAlt + '" title="' + portalNameAdressTitle + '"/>';
}
return portalInfoString;
};

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-show-portal-weakness@vita10gy
// @name IITC plugin: show portal weakness
// @version 0.6.1.@@DATETIMEVERSION@@
// @version 0.6.2.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -58,7 +58,7 @@ window.plugin.portalWeakness.portalAdded = function(data) {
}
if(portal_weakness > 0) {
var fill_opacity = portal_weakness*.7 + .3;
var fill_opacity = portal_weakness*.85 + .15;
var color = 'orange';
if(only_shields) {
color = 'yellow';

BIN
screenshots/plugin_keys.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -14,7 +14,8 @@ body {
}
#scrollwrapper {
overflow: hidden;
overflow-x: hidden;
overflow-y: auto;
position: fixed;
right: -38px;
top: 0;