// ==UserScript== // @name IITC plugin: Fix floating comma URL // @version 1.0.0.20220705.222400 // @author DanielOnDiordna // @updateURL https://softspot.nl/ingress/plugins/iitc-plugin-fixfloatingcommaurl.meta.js // @downloadURL https://softspot.nl/ingress/plugins/iitc-plugin-fixfloatingcommaurl.user.js // @description [danielondiordna-1.0.0.20220705.222400] Regional settings can cause scanner links to have a comma instead of a point/dot in the latitude and longitude values. IITC then loads the wrong location at startup. This plugin converts any set of 4 numbers with 3 comma separators in the url, into 2 floating point values with 1 comma separator and reloads Intel with the fixed URL. // @namespace https://softspot.nl/ingress/ // @match https://intel.ingress.com/* // @grant none // @category Misc // @id iitc-plugin-fixfloatingcommaurl@danielondiordna // ==/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() {}; // use own namespace for plugin window.plugin.fixfloatingcommaurl = function() {}; var self = window.plugin.fixfloatingcommaurl; self.id = 'fixfloatingcommaurl'; self.title = 'Fix floating comma URL'; self.version = '1.0.0.20220705.222400'; self.author = 'DanielOnDiordna'; self.changelog = ` Changelog: version 1.0.0.20220705.222400 - first release - replace any set of 4 numbers with 3 comma separators in the url, into 2 floating point values with 1 comma separator, and reload the page `; var setup = function() { console.log('IITC plugin loaded: ' + self.title + ' version ' + self.version); let fixedurl = window.location.href.replaceAll(/([\-0-9]+),([0-9]+),([\-0-9]+),([0-9]+)/g,"$1.$2,$3.$4"); if (fixedurl != window.location.href) { console.log(self.title + ' - old URL: ' + window.location.href); console.log(self.title + ' - fixed URL: ' + fixedurl); window.location = fixedurl; } }; setup.priority = 'boot'; setup.info = plugin_info; //add the script info data to the function as a property if(!window.bootPlugins) window.bootPlugins = []; window.bootPlugins.push(setup); // if IITC has already booted, immediately run the 'setup' function if(window.iitcLoaded && typeof setup === 'function') setup(); } // wrapper end // inject code into site context var script = document.createElement('script'); var info = {}; if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description }; script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');')); (document.body || document.head || document.documentElement).appendChild(script); (function() { // fix the url as fast as possible let fixedurl = window.location.href.replaceAll(/([\-0-9]+),([0-9]+),([\-0-9]+),([0-9]+)/g,"$1.$2,$3.$4"); if (fixedurl != window.location.href) { console.log('Fix floating comma URL - old URL: ' + window.location.href); console.log('Fix floating comma URL - fixed URL: ' + fixedurl); window.location = fixedurl; } })();