// ==UserScript== // @id ingress-intel-total-conversion@jonatkins // @name IITC: Ingress intel map total conversion // @version 0.14.3.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ // @description [@@BUILDNAME@@-@@BUILDDATE@@] Total conversion for the ingress intel map. // @include http://www.ingress.com/intel* // @include https://www.ingress.com/intel* // @match http://www.ingress.com/intel* // @match https://www.ingress.com/intel* // @grant none // ==/UserScript== // REPLACE ORIG SITE /////////////////////////////////////////////////// if(document.getElementsByTagName('html')[0].getAttribute('itemscope') != null) throw('Ingress Intel Website is down, not a userscript issue.'); window.iitcBuildDate = '@@BUILDDATE@@'; // disable vanilla JS window.onload = function() {}; document.body.onload = function() {}; // rescue user data from original page var scr = document.getElementsByTagName('script'); for(var x in scr) { var s = scr[x]; if(s.src) continue; if(s.type !== 'text/javascript') continue; var d = s.innerHTML.split('\n'); break; } if(!d) { // page doesn’t have a script tag with player information. if(document.getElementById('header_email')) { // however, we are logged in. setTimeout('location.reload();', 3*1000); throw("Page doesn't have player data, but you are logged in. Reloading in 3s."); } // FIXME: handle nia takedown in progress throw("Couldn't retrieve player data. Are you logged in?"); } for(var i = 0; i < d.length; i++) { if(!d[i].match('var PLAYER = ')) continue; eval(d[i].match(/^var /, 'window.')); break; } // player information is now available in a hash like this: // window.PLAYER = {"ap": "123", "energy": 123, "available_invites": 123, "nickname": "somenick", "team": "ENLIGHTENED||RESISTANCE"}; // remove complete page. We only wanted the user-data and the page’s // security context so we can access the API easily. Setup as much as // possible without requiring scripts. document.getElementsByTagName('head')[0].innerHTML = '' + 'Ingress Intel Map' + '' + '' //note: smartphone.css injection moved into code/smartphone.js + '