diff --git a/plugins/portals-list.user.js b/plugins/portals-list.user.js index 2a44acf3..ab923fa6 100644 --- a/plugins/portals-list.user.js +++ b/plugins/portals-list.user.js @@ -1,11 +1,11 @@ // ==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@@ -// @description Display a sortable list of all localized portails with team, level, resonators informations +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Display a sortable list of all localized portails with team, level, resonators informations // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* @@ -13,16 +13,20 @@ // ==/UserScript== /* whatsnew +* 0.0.9 : bug 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,14 +135,17 @@ 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) { var retVal = 0; @@ -191,7 +202,7 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) { html += '
Portal | ' + 'Level | ' - + 'Team | ' + + 'T | ' + 'R1 | ' + 'R2 | ' + 'R3 | ' @@ -200,63 +211,164 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) { + 'R6 | ' + 'R7 | ' + 'R8 | ' - + 'Energy | ' - + 'Shield 1 | ' - + 'Shield 2 | ' - + 'Shield 3 | ' - + 'Shield 4 | ' - + 'AP Gain | Energy | ' + + 'S1 | ' + + 'S2 | ' + + 'S3 | ' + + 'S4 | ' + + 'AP Gain | ' + + 'E/AP | '; $.each(portals, function(ind, portal) { if (filter === 0 || filter === portal.team){ html += '||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
' + window.plugin.portalslist.getPortalLink(portal.portal, portal.guid) + ' | ' - //+ '' + portal.name + ' | ' + + '' + window.plugin.portalslist.getPortalLink(portal.portal, portal.guid) + ' | ' + '' + portal.level + ' | ' - + '' + portal.team + ' | ' - + '' + portal.resonators[0][0] + ' | ' - //+ '6' - + ' | ' + portal.resonators[1][0] + ' | ' - + '' + portal.resonators[2][0] + ' | ' - + '' + portal.resonators[3][0] + ' | ' - + '' + portal.resonators[4][0] + ' | ' - + '' + portal.resonators[5][0] + ' | ' - + '' + portal.resonators[6][0] + ' | ' - + '' + portal.resonators[7][0] + ' | ' - + '' + portal.energy + '% | ' - + '' + portal.shields[0] + ' | ' - + '' + portal.shields[1] + ' | ' - + '' + portal.shields[2] + ' | ' - + '' + portal.shields[3] + ' | ' - + '' + portal.APgain + ' | '; + + '' + portal.team + ' | '; + + $.each([0, 1, 2, 3 ,4 ,5 ,6 ,7], function(ind, slot) { + + var title = 'title="owner: ' + portal.resonators[slot][1] + '' + portal.resonators[slot][0] + ' | '; + + }); + + html += '' + portal.energyratio + '% | ' + + '' + portal.shields[0][0] + ' | ' + + '' + portal.shields[1][0] + ' | ' + + '' + portal.shields[2][0] + ' | ' + + '' + portal.shields[3][0] + ' | ' + + '' + portal.APgain + ' | ' + + '' + portal.EAP + ' | '; html+= '
' + portal.address
+ + ' Link to Intel Map |