2016-11-28 17:13:15 +01:00
// ==UserScript==
// @name OpenStreetmap
// @namespace https://www.schtobia.de/
// @include https://www.openstreetmap.org/*
2016-11-28 17:37:25 +01:00
// @description OpenStreetmap GeoURI Handler. This resolved "geo:<lat>,<lon>" URIs via openstreetmap, by registering to an unidentified URL on osm and then rewriting it on call.
2017-11-21 09:48:39 +01:00
// @author Tobias Schmidl
// @version 0.1.9
2016-11-28 17:13:15 +01:00
// @grant GM_getValue
// @grant GM_listValues
2017-11-21 09:48:39 +01:00
// @downloadURL https://github.com/schtobia/greasemonkey/raw/master/openstreetmap_geouri.user.js
// @updateURL https://github.com/schtobia/greasemonkey/raw/master/openstreetmap_geouri.user.js
2016-11-28 17:13:15 +01:00
// ==/UserScript==
window . navigator . registerProtocolHandler ( "geo" , "https://www.openstreetmap.org/geouri/%s" , GM _info . script . name ) ;
var regex = /geouri\/geo(%3A|:)([0-9\.-]+)(%2C|,)([0-9\.-]+)/ ;
if ( location . href . match ( regex ) )
location . href = location . href . replace ( regex , "?mlat=$2&mlon=$4&zoom=12" ) ;