Skip to content

Instantly share code, notes, and snippets.

@svebal
Last active June 11, 2019 10:55
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save svebal/8199690 to your computer and use it in GitHub Desktop.
Save svebal/8199690 to your computer and use it in GitHub Desktop.
Plugin for IITC - let you im- / export your sketches from drawing tools
// ==UserScript==
// @id iitc-export-import-draw@skamander
// @name IITC plugin: export and import data from draw tools
// @version 0.0.1
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description Import/Export Data from draw tools
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// ==/UserScript==
function wrapper() {
// ensure plugin framework is there, even if iitc is not yet loaded
if(typeof window.plugin !== 'function'){
window.plugin = function() {};
}
// ===[ PLUGIN START ]=================================================================================
// use own namespace for plugin
var thisplugin = window.plugin.drawtools_export = function() {};
// function to import
window.plugin.drawtools_export.import_drawdata = function() {
localStorage['plugin-draw-tools-layer'] = prompt('Bitte geben sie die Daten ein:');
window.location.reload()
}
// funcion to export
window.plugin.drawtools_export.export_drawdata = function() {
prompt("Copy to clipboard: Ctrl+C, Enter", localStorage['plugin-draw-tools-layer']);
}
// ===[ Settings ]=====================================================================================
var setup = function () {
content = "<a onclick='window.plugin.drawtools_export.import_drawdata();' >Import draw-data</a>"
content += "<a onclick='window.plugin.drawtools_export.export_drawdata();' >Export draw-data</a>"
$('#toolbox').append(content);
}
if(window.iitcLoaded && typeof setup === 'function') {
setup();
} else {
if(window.bootPlugins) {
window.bootPlugins.push(setup);
} else {
window.bootPlugins = [setup];
}
}
} // wrapper end
// inject code into site context
var script = document.createElement('script');
script.appendChild(document.createTextNode('('+ wrapper +')();'));
(document.body || document.head || document.documentElement).appendChild(script);
@nan0tEch
Copy link

for some reason there are sometimes errors in the array
{"lat":51...ype":"polyline",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment