diff --git a/README.md b/README.md index 509ecd940..f6a30a5f7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ +## What this fork is + +This is me messing around with IITC. + +Changes to Maxfield plugin: +- Display in console the names of the portals + +Changes to Bookmarks plugin: +- Export to Tab Separated Values +- Export bookmarks to a list of URLS for http://www.ingress-maxfield.com/ +- Export bookmarks to a list of URLS for http://www.ingressrouteplanner.com/ + ingress intel total conversion (IITC) ===================================== diff --git a/plugins/bookmarks-by-zaso.user.js b/plugins/bookmarks-by-zaso.user.js index 02155ace8..0ef3ca49f 100644 --- a/plugins/bookmarks-by-zaso.user.js +++ b/plugins/bookmarks-by-zaso.user.js @@ -641,6 +641,85 @@ } } + window.plugin.bookmarks.optMaxfield = function() { + if(typeof android !== 'undefined' && android && android.shareString) { + return android.shareString(localStorage[window.plugin.bookmarks.KEY_STORAGE]); + } else { + + var portals = JSON.parse(localStorage['plugin-bookmarks']).portals, + output = ''; + + for (var key in portals) { + if (!portals.hasOwnProperty(key)) { + continue; + } + var bkmrk = portals[key].bkmrk; + for (var key in bkmrk) { + output += bkmrk[key].label + ';' + 'https://www.ingress.com/intel?ll=' + bkmrk[key].latlng + '&z=17&pll=' + bkmrk[key].latlng + ';0\n'; + } + } + + dialog({ + html: '

Select all and press CTRL+C to copy it.

', + dialogClass: 'ui-dialog-bkmrksSet-copy', + title: 'Ingress Maxfield' + }); + } + } + + window.plugin.bookmarks.optRoutePlanner = function() { + if(typeof android !== 'undefined' && android && android.shareString) { + return android.shareString(localStorage[window.plugin.bookmarks.KEY_STORAGE]); + } else { + + var portals = JSON.parse(localStorage['plugin-bookmarks']).portals, + output = ''; + for (var key in portals) { + if (!portals.hasOwnProperty(key)) { + continue; + } + var bkmrk = portals[key].bkmrk; + for (var key in bkmrk) { + output += 'https://www.ingress.com/intel?ll=' + bkmrk[key].latlng + '&z=17&pll=' + bkmrk[key].latlng + '\n'; + } + } + + dialog({ + html: '

Select all and press CTRL+C to copy it.

', + dialogClass: 'ui-dialog-bkmrksSet-copy', + title: 'Ingress Route Panner' + }); + } + } + + window.plugin.bookmarks.optCSV = function() { + if(typeof android !== 'undefined' && android && android.shareString) { + return android.shareString(localStorage[window.plugin.bookmarks.KEY_STORAGE]); + } else { + + var portals = JSON.parse(localStorage['plugin-bookmarks']).portals, + output = ''; + for (var key in portals) { + if (!portals.hasOwnProperty(key)) { + continue; + } + output += '\n\nFolder: ' + portals[key].label + '\n'; + output += 'ID\tGUID\tName\tLatitude Longitude\tURL\n'; + + var bkmrk = portals[key].bkmrk; + for (var key in bkmrk) { + output += key+'\t'+bkmrk[key].guid + '\t' + bkmrk[key].label + '\t' + bkmrk[key].latlng +'\t'+ 'https://www.ingress.com/intel?ll=' + bkmrk[key].latlng + '&z=17&pll=' + bkmrk[key].latlng + '\n'; + } + } + + dialog({ + html: '

Select all and press CTRL+C to copy it.

', + dialogClass: 'ui-dialog-bkmrksSet-copy', + title: 'Ingress Route Panner' + }); + } + } + window.plugin.bookmarks.optExport = function() { if(typeof android !== 'undefined' && android && android.saveFile) { android.saveFile("IITC-bookmarks.json", "application/json", localStorage[window.plugin.bookmarks.KEY_STORAGE]); @@ -1208,6 +1287,9 @@ actions += 'Reset bookmarks'; actions += 'Copy bookmarks'; actions += 'Paste bookmarks'; + actions += 'Bookmarks to Maxfield'; + actions += 'Bookmarks to Route Planner'; + actions += 'Bookmarks to CSV'; if(plugin.bookmarks.isAndroid()) { actions += 'Import bookmarks'; diff --git a/plugins/max-links.user.js b/plugins/max-links.user.js index d930fc09b..01f1a7354 100644 --- a/plugins/max-links.user.js +++ b/plugins/max-links.user.js @@ -73,6 +73,7 @@ window.plugin.maxLinks.updateLayer = function() { window.plugin.maxLinks.layer.clearLayers(); var locations = []; + var myPortals = {}; var bounds = map.getBounds(); $.each(window.portals, function(guid, portal) { @@ -80,6 +81,7 @@ window.plugin.maxLinks.updateLayer = function() { if (bounds.contains(ll)) { var p = map.project (portal.getLatLng(), window.plugin.maxLinks.PROJECT_ZOOM); locations.push(p); + myPortals[(p.x+':'+p.y)] = {'x':p.x,'y':p.y,'title':portal.options.data.title,'guid':portal.options.guid}; if (locations.length > window.plugin.maxLinks.MAX_PORTALS_TO_LINK) return false; //$.each break } }); @@ -99,9 +101,12 @@ window.plugin.maxLinks.updateLayer = function() { return [b,a]; } var drawnLinks = {}; + var drawnLog = ''; //draw a link, but only if it hasn't already been drawn var drawLink = function(a,b) { + drawnLog+= (myPortals[a.x+':'+a.y].title+'\tto\t' + myPortals[b.x+':'+b.y].title+'\n'); + drawnLog+= (myPortals[b.x+':'+b.y].title+'\tto\t' + myPortals[a.x+':'+a.y].title+'\n'); //order the points, so a pair of coordinates in any order is handled in one direction only var points = orderedPoints(a,b); a=points[0]; @@ -134,6 +139,7 @@ window.plugin.maxLinks.updateLayer = function() { drawLink(triangle.b,triangle.c); drawLink(triangle.c,triangle.a); }); + console.log(drawnLog); } window.plugin.maxLinks.setup = function() {