-
-
Save fayak/e6caaa644be1506f5dea9ef81e1ebc95 to your computer and use it in GitHub Desktop.
An IITC plugin that exports portals currently in view as a CSV list for use with Ingress Dual Map.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id iitc-plugin-ingressdataextract@LeCoon | |
// @name IITC plugin: Ingress Data Extractor | |
// @category Keys | |
// @version 0.0.0.1 | |
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion | |
// @description Data Extractor | |
// @include https://www.ingress.com/intel* | |
// @include http://www.ingress.com/intel* | |
// @match https://www.ingress.com/intel* | |
// @match http://www.ingress.com/intel* | |
// @grant none | |
// ==/UserScript== | |
function wrapper() { | |
if (typeof window.plugin !== "function") { | |
window.plugin = function() {}; | |
} | |
window.plugin.lcex = function() {}; | |
var self = window.plugin.lcex; | |
self.gen = function gen() { | |
console.log("Intel Data Extraction Starting"); | |
var s = ""; | |
for (var x in window.portals) { | |
var p = window.portals[x]; | |
if (p.options.data.title != "undefined" && p.options.data.title != null) | |
s = s + p.options.data.title + "|#|" + p.options.guid + "|#|" + p._latlng.lat + "|#|" + p._latlng.lng+"|###|"; | |
} | |
var http = new XMLHttpRequest(); | |
var url = "https://coon.fr/ingress/trt.php"; | |
var params = "p="+s; | |
http.open("POST", url, true); | |
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
http.send(params); | |
console.log(params); | |
window.plugin.lcex.loop(); | |
} | |
self.loop = function loop() { | |
if (document.getElementById('innerstatus') == null || document.getElementById('innerstatus').lastChild == null || document.getElementById('innerstatus').lastChild.lastChild == null || document.getElementById('innerstatus').lastChild.lastChild.textContent != "done") | |
window.plugin.lcex.start(); | |
else | |
setTimeout(window.plugin.lcex.loop, 500); | |
} | |
self.start = function start() { | |
if (document.getElementById('innerstatus') == null || document.getElementById('innerstatus').lastChild == null || document.getElementById('innerstatus').lastChild.lastChild == null || document.getElementById('innerstatus').lastChild.lastChild.textContent != "done") | |
setTimeout(window.plugin.lcex.start, 500); | |
else | |
window.plugin.lcex.gen(); | |
} | |
// setup function called by IITC | |
self.setup = function init() { | |
setTimeout(window.plugin.lcex.start, 1000); | |
delete self.setup; | |
} | |
// IITC plugin setup | |
if (window.iitcLoaded && typeof self.setup === "function") { | |
self.setup(); | |
} else if (window.bootPlugins) { | |
window.bootPlugins.push(self.setup); | |
} else { | |
window.bootPlugins = [self.setup]; | |
} | |
} | |
// inject plugin into page | |
var script = document.createElement("script"); | |
script.appendChild(document.createTextNode("(" + wrapper + ")();")); | |
(document.body || document.head || document.documentElement).appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment