Skip to content

Commit

Permalink
Update OpenOtherMaps.js
Browse files Browse the repository at this point in the history
Support for WME -> NMRoads
  • Loading branch information
justins83 authored Mar 19, 2018
1 parent 3ba3d41 commit 0da319b
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions OpenOtherMaps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name WME Open Other Maps
// @namespace https://greasyfork.org/users/30701-justins83-waze
// @version 2018.03.19.01
// @version 2018.03.19.02
// @description Links for opening external resources at the WME location and WME from external resources
// @author JustinS83
// @include https://www.waze.com/editor*
Expand Down Expand Up @@ -44,7 +44,7 @@
var Miss511Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTnU1rJkAAABjUlEQVQ4T2MYWsClYXM+Q/CcEoZAVGxfvakkpHWbKFQZflA272iXXOqyXwxBs/+jY8eaTf+jenfpQpXiBpuP356uV7j6B1PwHAxDQNivdfv/7BkHCBtkULTmElvYXKyGgHDipL3/21eexm/Q2iM3luHyEgwXzz3yf96u6/gNOnLlwQ6zsnX/JRKX4MT9G8/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+Fztt2Vv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0+ZbOM35D71LLoHrO4tFLC0obh1D1dBTlLe8x882B9SkGdl1KOxlEMnonyiHGN+bqDu8YWfMqyHJJTZZcrddcqHe35uGuhkV9x0dcrmNQ2GDYNhyfsoE3MXB0Ksw0fV1Hs1WVxN3OIffkjpEfzN85SOzJBxsjSTpXUzoswywu3OvDC4bDxBc7+kbn0GmYhrvtPha0ijYyHDhNXHmMUL6b7WZHSOGUncX64iJca5uwOXy98Wxio78Hy5FS9KSl7W723/y6NbtEAvuxKLgfVsP9uAmrykIsRR7BnFiM7tTUvRlN+N7RWELC/HBsNOvsPu+wd2WMrRjkDpNK1cAUFyuZmppTgjwwAyqVeCA3l/mk18f71zR6QkvWAjWxcdptQbDQ985M36dV01LzUSEVPDRZohbC/wMQ7RPCAIhEPwGmF45ZgI9RNAAAAABJRU5ErkJggg==";

function initInterface(){
var $section = $("<div>");
Expand Down Expand Up @@ -472,7 +472,7 @@
});
}*/

/*$('#OOMNM511').remove();
$('#OOMNM511').remove();
if(settings.NM511){
let $sectionNM511 = $("<div>");
$sectionNM511.html([
Expand All @@ -483,11 +483,12 @@

$('.view-area.olMap >div > div > div.WazeControlPermalink').append($sectionNM511.html());
$('#OOMNM511Img').click(function(){
let latlon = get4326CenterPoint();
let latlon = W.map.center;

//http://nmroads.com/mapIndex.html?
window.open(`http://www.511nj.org/trafficmap.aspx?X=${latlon.lat}&Y=${latlon.lon}&zoom=${(W.map.zoom + 12)}`);
window.open(`http://nmroads.com/mapIndex.html?X=${latlon.lon}&Y=${latlon.lat}&zoom=${(W.map.zoom + 12)}`);
});
}*/
}
}

function loadSettings() {
Expand All @@ -508,7 +509,8 @@
rosreestr: false,
PA511: false,
Miss511: false,
LAFC: false
LAFC: false,
NM511: false
//NJ511: false
};
settings = loadedSettings ? loadedSettings : defaultSettings;
Expand Down Expand Up @@ -536,7 +538,8 @@
rosreestr: settings.rosreestr,
PA511: settings.PA511,
Miss511: settings.Miss511,
LAFC: settings.LAFC
LAFC: settings.LAFC,
NM511: settings.NM511
//NJ511: settings.NJ511
};

Expand Down Expand Up @@ -582,6 +585,15 @@
});
}

function bootstrapNM511(tries = 1){
if(map && map.extent && map.loaded){
initNM511();
}
else{
setTimeout(function() {bootstrapNM511(tries++);}, 100);
}
}

function bootstrap(tries = 1) {
if(location.href.indexOf("google.com/maps") > -1)
bootstrapGeneral(initGoogleMaps, 1);
Expand All @@ -604,7 +616,7 @@
setTimeout(function () {bootstrap(tries++);}, 200);
}
else if(location.href.indexOf("http://nmroads.com/mapIndex.html") > -1){
bootstrapGeneral(initNM511, 1);
bootstrapNM511(1);
}
/*else if(location.href.indexOf("http://www.511nj.org/trafficmap") > -1){
bootstrapGeneral(initNJ511, 1);
Expand Down Expand Up @@ -743,13 +755,19 @@
}

function initNM511(){
/*$(document).ready(function() {
if(location.search.indexOf("?") > -1){
let params = location.search.match(/X=(-?\d*.\d*)&Y=(-?\d*.\d*)&zoom=(\d+)/);
$("#EvetnsMap").attr('src', `http://icx1-map21x.lan.511nj.org/mapwidget/mapwidget.aspx?FullScreen=false&fss=0&njlegend=1&search=0&X=${parseFloat(params[1])}Y=${parseFloat(params[2])}&zoom=${parseFloat(params[3])}&maplegend=2&Weather=1&Congestion=1&Construction=1&Incident=1&Detour=1&SpecialEvents=1&AirportParking=0&height=100&width=100&ispercent=1&WinkCamera=2&zoom=14&refershcamera=1&refershevent=1&refershspeed=1`);
}
});*/
//#mapSettingsList
if(location.search.indexOf("?") > -1){
let params = location.search.match(/X=(-?\d*.\d*)&Y=(-?\d*.\d*)&zoom=(\d+)/);
setTimeout(function(){
try{
map.centerAt({x:parseFloat(params[1]), y:parseFloat(params[2])});
setTimeout(function(){map.setLevel(parseInt(params[3]));}, 500);
}
catch(err) {
console.log(err);
}
}, 1000);
}

var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === "attributes" && mutation.target == document.getElementsByClassName("mapSettingsList")[0]) insertWMELinkNM511();
Expand Down

0 comments on commit 0da319b

Please sign in to comment.