// ==UserScript== // @id iitc-plugin-portal-coords // @name IITC plugin: portal-coords // @category Misc // @version 0.2.0 // @namespace https://github.com/vrabcak/iitc-portal-coords // @description Portal coords // @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(plugin_info) { // 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 window.plugin.pocoo = function () {}; window.plugin.pocoo.portaldetailsUpdated = function (data) { var ll = {}; ll.lat = data.portalData.latE6/1E6; ll.lng = data.portalData.lngE6/1E6; window.plugin.pocoo.render(ll); }; window.plugin.pocoo.render = function (ll) { var html = '
' + 'Coords: ' + '' + ll.lat + ' ' + ll.lng + '
'; $('#portaldetails > .imgpreview').after(html); $('#coords-container').click( function() { var selection = window.getSelection(), range = document.createRange(), tmpEl = document.createElement("input"), tmpUrl = "https://www.ingress.com/intel?ll=" + ll.lat + "," + ll.lng + "&pll=" + ll.lat + "," + ll.lng; // copy url portal to clipboard tmpEl.setAttribute("value",tmpUrl); document.body.appendChild(tmpEl); tmpEl.select(); document.execCommand("copy"); document.body.removeChild(tmpEl); //highlight coords range.selectNodeContents(document.getElementById('coords-text')); selection.removeAllRanges(); selection.addRange(range); }); }; window.plugin.pocoo.setupCSS = function() { $("