diff --git a/OpenOtherMaps.js b/OpenOtherMaps.js index da257ca..907d81e 100644 --- a/OpenOtherMaps.js +++ b/OpenOtherMaps.js @@ -1,7 +1,7 @@ // ==UserScript== // @name WME Open Other Maps // @namespace https://greasyfork.org/users/30701-justins83-waze -// @version 2018.03.09.01 +// @version 2018.03.10.01 // @description Links for opening external resources at the WME location and WME from external resources // @author JustinS83 // @include https://www.waze.com/editor* @@ -14,6 +14,7 @@ // @include http://pkk5.rosreestr.ru* // @include http://www.511pa.com/Traffic.aspx* // @include http://newengland511.org* +// @include https://www.mdottraffic.com* // @exclude https://www.waze.com/*/user/editor* // @require https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js // @require https://greasyfork.org/scripts/13097-proj4js/code/Proj4js.js @@ -38,6 +39,7 @@ var NYFCIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTnU1rJkAAADL0lEQVQ4T2VUSUtjQRDObRzw7kSdgyKiiCIo7stBPMw4MyB4M4mDB8E/oF48eBJUPImIDqIgiOKCJ3HfsrgkuB4EBb0paojGLC8Jz5rva19EZxrqdb+q+r6upbtN/w4R+QKxQIZ1XXdrmuaDPGLtgW4EYn15eUk23P8fMH6C0/doNDp9c3Nzd3x87He73ZrdbtcpBwcHGnW0hcPhOfj/gH+CAX8dV1dXCVBaYLT7fL7gxcWFnJycCIBydHSkhP+np6dCG3xC8HUAY/tAhp9vANknJiai/f390tPT8ya9vb3S19enhGvquB4dHY3t7+87ga2LkyR7vd7ptra2SHFxseTk5EhBQYEUFhZKSUmJVFVVSXV1tZSVlSldfn6+ZGdnS2Njo2xubkaBn0V0KSSyoAZ39fX1kpeXp8ClpaUKSMKMjAxJS0uTrKwsKSoqUmQVFRXS0dGhUkeaDyCymtCN4fn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8/9P3DxEX6Dbj58saNvw7n/dUtP4sRHrzz8/+jFW/wGXbr7bEf+nMP/I3v34MY9u9yhynGDG0AX1S498T91yv7/KVhwzsxD/4vmHcRv0K2HL90qFx2/IZm05D9H+DysWClj+X+jojX4DVp96MZMy4oN/3GlHxCWSVn6Xy+fgEEJk/bOlAYqxGYADIvEL/qvkLEUv0Hz91yd2bP+7P+GZSf/1y87AcfiwCiHGcQdOf+/YOxC/AbtPnOXf9mus1JzNqBihfTlcIOYQ+b8Zw6bh98gXGD2jkv/PZu2/m9ddfp/84pT/6sWHiXPoFWrVjGHhq5iBtEgzPD/PyNUCgoYGACx+Fztt2VvAQAAAABJRU5ErkJggg=="; function initInterface(){ var $section = $("
"); @@ -48,6 +50,7 @@ `
NY FC
`, `
`, `
`, + `
`, '
', "

The below maps are for reference only and no data should be copied from them as it violates copyright.

", `
`, @@ -86,6 +89,7 @@ setChecked('chkNYFC', settings.NYFC); setChecked('chkrosreestr', settings.rosreestr); setChecked('chkPA511', settings.PA511); + setChecked('chkMiss511', settings.Miss511); if(settings.LangSetting == 0) setChecked("radOOMNoLang", true); @@ -404,6 +408,26 @@ window.open(`http://www.511pa.com/Traffic.aspx?${latlon.lat},${latlon.lon},${(W.map.zoom + 12)}z`); }); } + + $('#OOMMiss511').remove(); + if(settings.Miss511) + { + let $section = $("
", {style:"padding:8px 16px"}); + $section.html([ + '', + `Google Maps`, + '' + ].join(' ')); + + $('.view-area.olMap >div > div > div.WazeControlPermalink').append($section.html()); + + $('#OOMMiss511Img').click(function(){ + let latlon = get4326CenterPoint(); + let lang = GetLanguage(); + + window.open(`https://www.mdottraffic.com/default.aspx?lat=${latlon.lat}&lon=${latlon.lon}&zoom=${(W.map.zoom + 12)}`, 'Mississippi 511'); + }); + } } function loadSettings() { @@ -422,7 +446,8 @@ MiDrive: false, NYFC: false, rosreestr: false, - PA511: false + PA511: false, + Miss511: false }; settings = loadedSettings ? loadedSettings : defaultSettings; for (var prop in defaultSettings) { @@ -447,7 +472,8 @@ MiDrive: settings.MiDrive, NYFC: settings.NYFC, rosreestr: settings.rosreestr, - PA511: settings.PA511 + PA511: settings.PA511, + Miss511: settings.Miss511 }; localStorage.setItem("OOM_Settings", JSON.stringify(localsettings)); @@ -507,6 +533,12 @@ bootstrap511PA(1);//bootstrapGeneral(init511PA, 1); else if(location.href.indexOf("http://newengland511.org") > -1) bootstrapGeneral(initNE511, 1); + else if(location.href.indexOf("https://www.mdottraffic.com") > -1){ + if(document.getElementById("map-container") != null) + initMississipie511(); + else if(tries < 1000) + setTimeout(function () {bootstrap(tries++);}, 200); + } else{ if (W && W.map && @@ -587,6 +619,31 @@ }); } + let isMiss511Loaded = false; + function initMississipie511(){ + map.addListener('tilesloaded', function() { + //https://www.mdottraffic.com/default.aspx?lat=32.36435&lon=-88.70366&zoom=15 + if(!isMiss511Loaded){ + if(location.search.indexOf("?") > -1 && location.search.indexOf("loadAlertid") === -1){ + let params = location.search.match(/lat=(-?\d*.\d*)&lon=(-?\d*.\d*)&zoom=(\d+)/); + map.setCenter({lat: parseFloat(params[1]), lng: parseFloat(params[2])}); + map.setZoom(parseInt(params[3])); + } + isMiss511Loaded = true; + } + }); + + let $OOMWazeButton = document.createElement("div"); + $OOMWazeButton.innerHTML = '
'; + //let parent = document.getElementById("content-container"); + document.getElementById("map-container").appendChild($OOMWazeButton); + + document.getElementById("OOMWazeButtonDiv").addEventListener("click", function(){ + let center = map.getCenter(); + window.open(`https://www.waze.com/en-US/editor/?lon=${center.lng()}&lat=${center.lat()}&zoom=${(Math.max(0,Math.min(10,(map.getZoom() - 12))))}`); + }); + } + var copyToClipboard = function(str) { var temp = document.createElement("input"); document.body.append(temp);