iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
991 stars 553 forks source link

Advice/support for "Ingress Planner" #932

Open manierim opened 9 years ago

manierim commented 9 years ago

Hi all,

I am a "newbie" Ingress player (started last November, just reached L8) and an hobbyist "web coder".

Soon after starting playing I found the wonderful IITC addon and started to use it to plan my fielding operations. I do love complex fielding ops! I quickly gained AP with a number of articulated "lone wolf" operation and become known in my local faction community (I'm ENL) as "the crazy fielder".

I was designing my plan with the Draw Tools and then writing down on text files my detailed schedules, using IITC to check for proper progression against portal keys, portal ownership & resos status, cross links removal etc.

After a while I realized that there was too much manual work that often led to mistakes. I started to think to code something to help me check at least the basic stuff, like portal keys. A few trials for a "disconnected" solution quickly revealed it was not a way to go.

So I started checking if there was a way to "interact" with IITC, and started to "lurk" at your user-scripts and to a way to access them from an "external" site. I made the decision to "host" IITC inside a frame on my own webapp and "bidirectionally" exchange information trough "Cross-document messaging" between my site script and a custom IITC plugin.

As of today I feel the app to be complete for my personal use, and started to think to the possibility to make it publicly and freely available to other Ingress enthusiasts.

Since my work is heavily based on IITC, I feel appropriate to get advice/evaluation first of all from the IITC admin/dev group about this project.

It is currently hosted at http://www.marco.manieri.name/ingressplanner/

I would like any comment, idea, suggestion from you about the idea, the realization and the evaluation of its value for the Ingress community. If you think it might be worth trying to make it to the public, I would like very much any kind of support/direction you might want to give me: from issues in the quality/behavior of the IITC plugin to any other technical aspect, as well as non-technical things as, for example, language issue (English is not my native language), look & feel, etc etc.

So if you can please explore the webapp and let me know your thought on it.

Best regards,

Marco Manieri Perugia, Italy

flamusdiu commented 9 years ago

@manierim That's an interesting tool you have setup.

Here's what I noticed for it:

1) Needs better documentation. It took me a few mins to realized there is a IITC plugin required to use the site. Along with this, need to make clear any other IITC plugins that need to be installed/enabled as well.

2) There is some odd issues with trying to get it to actually get the portals/links/fields to show up in the list. I don't know why that is. However, going with point 1, you might need to show an example or other Tips on using the site in case things need to be worked out in a certain order.

You've still got a good working site though. =)

manierim commented 9 years ago

@flamusdiu Added a "quickstep" on top of the "Help" tab, might this help?

flamusdiu commented 9 years ago

@manierim yeah, that might. write it up and me or someone else can take a look. Some of the work flow isn't very well documented at the moment and an example would help people who just saw your tool.

flamusdiu commented 9 years ago

You could also link the the proper plugins using this table of information

Info Link: http://iitc.jonatkins.com/?page=desktop#plugin-ref-id(from col 1)
Download Link: http://iitc.jonatkins.com/(Info from 3rd col)

Examples:

Plugin ID Ref Plugin Name Plugin Download URL
plugin-show-linked-portals Show linked portals release/plugins/show-linked-portals.user.js
plugin-reso-energy-pct-in-portal-detail reso energy pct in portal detail release/plugins/reso-energy-pct-in-portal-detail.user.js
plugin-portals-list show list of portals release/plugins/portals-list.user.js
plugin-guess-player-levels guess player level release/plugins/guess-player-levels.user.js
plugin-portal-counts Show total counts of portals release/plugins/portal-counts.user.js
plugin-compute-ap-stats Compute AP statistics release/plugins/compute-ap-stats.user.js
plugin-layer-farms-find Show farms by level release/plugins/layer-farms-find.user.js
plugin-scoreboard show a localized scoreboard. release/plugins/scoreboard.user.js
plugin-score-cycle-times Show scoreboard cycle/checkpoint times release/plugins/score-cycle-times.user.js
plugin-layer-count layer count release/plugins/layer-count.user.js
plugin-keys Keys release/plugins/keys.user.js
plugin-keys-on-map Keys on map release/plugins/keys-on-map.user.js
plugin-bookmarks-by-zaso Bookmarks for maps and portals release/plugins/bookmarks-by-zaso.user.js
plugin-scale-bar scale bar release/plugins/scale-bar.user.js
plugin-zoom-slider zoom slider release/plugins/zoom-slider.user.js
plugin-pan-control pan control release/plugins/pan-control.user.js
plugin-minimap Mini map release/plugins/minimap.user.js
plugin-show-portal-weakness show portal weakness release/plugins/show-portal-weakness.user.js
plugin-portal-highlighter-forgotten Inactive portals. Hightlight unclaimed portals with no recent activity release/plugins/portal-highlighter-forgotten.user.js
plugin-portal-highlighter-needs-recharge hightlight portals that need recharging release/plugins/portal-highlighter-needs-recharge.user.js
plugin-portal-highlighter-missing-resonators highlight portals missing resonators release/plugins/portal-highlighter-missing-resonators.user.js
plugin-portal-highlighter-level-color highlight portals by level color release/plugins/portal-highlighter-level-color.user.js
plugin-portal-highlighter-hide-team Hide portal ownership release/plugins/portal-highlighter-hide-team.user.js
plugin-portal-highlighter-high-level highlight high level portals release/plugins/portal-highlighter-high-level.user.js
plugin-portal-highlighter-portals-my-level highlight portals by my level release/plugins/portal-highlighter-portals-my-level.user.js
plugin-portal-highlighter-infrastructure highlight portals with infrastructure problems release/plugins/portal-highlighter-infrastructure.user.js
plugin-portal-highlighter-ornaments hightlight portals with ornaments release/plugins/portal-highlighter-ornaments.user.js
plugin-player-tracker Player tracker release/plugins/player-tracker.user.js
plugin-draw-tools draw tools release/plugins/draw-tools.user.js
plugin-portal-level-numbers Portal Level Numbers release/plugins/portal-level-numbers.user.js
plugin-max-links Max Links release/plugins/max-links.user.js
plugin-fly-links Fly Links release/plugins/fly-links.user.js
plugin-cross_link cross links release/plugins/cross_link.user.js
plugin-portal-names Portal Names release/plugins/portal-names.user.js
plugin-regions Show the local score regions release/plugins/regions.user.js
plugin-zaprange Zaprange release/plugins/zaprange.user.js
plugin-add-kml overlay KML release/plugins/add-kml.user.js
plugin-done-links done links release/plugins/done-links.user.js
plugin-basemap-openstreetmap OpenStreetMap.org map tiles release/plugins/basemap-openstreetmap.user.js
plugin-basemap-gmaps-gray Gray Google Roads release/plugins/basemap-gmaps-gray.user.js
plugin-basemap-blank Blank map release/plugins/basemap-blank.user.js
plugin-basemap-opencyclemap OpenCycleMap.org map tiles release/plugins/basemap-opencyclemap.user.js
plugin-basemap-yandex Yandex maps release/plugins/basemap-yandex.user.js
plugin-basemap-bing Bing maps release/plugins/basemap-bing.user.js
plugin-basemap-stamen Map layers from stamen.com release/plugins/basemap-stamen.user.js
plugin-basemap-mapquest-open-aerial MapQuest Open Satellite view (US Only) release/plugins/basemap-mapquest-open-aerial.user.js
plugin-basemap-nokia-ovi Nokia OVI maps release/plugins/basemap-nokia-ovi.user.js
plugin-basemap-kartverket Kartverket.no map tiles release/plugins/basemap-kartverket.user.js
plugin-show-more-portals Show more portals release/plugins/show-more-portals.user.js
plugin-link-show-direction Show the direction of links on the map release/plugins/link-show-direction.user.js
plugin-force-https force https access for ingress.com/intel release/plugins/force-https.user.js
plugin-periodic-refresh Periodic refresh release/plugins/periodic-refresh.user.js
plugin-default-intel-detail Default intel detail level release/plugins/default-intel-detail.user.js
plugin-canvas-render Use Canvas rendering release/plugins/canvas-render.user.js
plugin-scroll-wheel-zoom-disable disable mouse wheel zoom release/plugins/scroll-wheel-zoom-disable.user.js
plugin-show-less-portals-zoomed-out Show less portals when zoomed out release/plugins/show-less-portals-zoomed-out.user.js
plugin-fix-googlemap-china-offset Fix Google Map offsets in China release/plugins/fix-googlemap-china-offset.user.js
plugin-sync Sync release/plugins/sync.user.js
plugin-uniques Uniques release/plugins/uniques.user.js
plugin-update-check Check for updates release/plugins/update-check.user.js
plugin-privacy-view Privacy view on Intel release/plugins/privacy-view.user.js
plugin-speech-search Speech Search release/plugins/speech-search.user.js
manierim commented 9 years ago

After a little break due to personal things I was going to try implement/improve as per above suggestions but I discovered that my app no longer works due to an IITC code change.

The problem is in this piece of code in window.extractFromStock() function, called at boot:

  // required for botguard
  var requestPrototype = (function() {
    for(var topLevel in window) {
      if(!window[topLevel]) continue;
      // need an example for a request object
      for(var property in window[topLevel]) {
        if(window[topLevel][property] == "getRegionScoreDetails") {
          return Object.getPrototypeOf(window[topLevel]);
        }
      }
    }
  })();

What happens is that when the code (running in an iframe inside my site) try to access window.top or window.parent or window.frameElement the browser throws a "SecurityError: Blocked a frame with origin "https://www.ingress.com" from accessing a frame with origin "http://www.marco.manieri.name"".

I've solved the issue dropping some checks to avoid this as follow:

  var requestPrototype = (function() {

    for(var topLevel in window) {

      // avoid SecurityError when IITC is inside a frame on a different domain (i.e. Ingress Planner)
      if (topLevel=='top') continue;

      if(!window[topLevel]) continue;
      // need an example for a request object
      for(var property in window[topLevel]) {

        // avoid SecurityError when IITC is inside a frame on a different domain (i.e. Ingress Planner)
        if (property=='top') continue;
        if (property=='parent') continue;
        if (property=='frameElement') continue;

        if(window[topLevel][property] == "getRegionScoreDetails") {
          return Object.getPrototypeOf(window[topLevel]);
        }
      }
    }
  })();

Is this a change, and the problem it causes to (just) my webapp worth submitting as a pull request?

fkloft commented 9 years ago

This has already been fixed in the test builds.

manierim commented 9 years ago

Just downloaded the test build (2015-02-09-135508) but the problem still exist before the try catch in the second loop.

In the outer loop

      if(!window[topLevel]) continue;

still causes the cross-origin SecurityError. I tried wrapping it in another try catch as well but for some reasons it still generate an unhandled exception?!

So I had to add the following check

      if (topLevel=='top') continue; // next line might throw SecurityError on cross-origin, also if wrapped in a try catch?!
      if(!window[topLevel]) continue;

PS: meanwhile I also added the info & download links in the relevan help/quickstart items

lablua commented 9 years ago

Intriguing, but the problem with implementing this as a website rather than a plugin is that i have to trust your website not to steal my plans and give them to my opponents, or at least the Resistance do. Wait, maybe that's not a problem, I just have to verify you are really ENL. :-)

manierim commented 9 years ago

Well, you can check the JavaScript downloaded to your browser from the site as well as you should do with the iitc script to make sure data are not logged externally :) You would then notice that plans are stored in your gdrive account and not on my server. The only tracking activity done on the site is the standard Google analytics one. BTW I have been thinking to move everything inside an IITC plugin to make it usable also on mobile devices (tablets). I'll have to learn much more about IITC plugins framework before, but I'll eventually try that way if there will be enough interest in the future for the system itself.

andy-elaphos commented 9 years ago

Can I reorder the steps? Didn't find any possibilty...

manierim commented 9 years ago

Just drag and drop the rows in the table to reorder them.

andy-elaphos commented 9 years ago

Ok, got it. Tried that on the only spot where this doesn't work: First column, left of the quadruple arrow... -.-