// ==UserScript== // @name WME FS MVUM GIS Map // @namespace https://greasyfork.org/users/45389 // @version 0.0.2 // @description Open a FS MVUM GIS map in another window, at the same location as the WME map. Keeps the location of the GIS map synced to WME. // @author jcloudm for localization, MapOMatic original // @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor.*$/ // @include /^http:\/\/www\.arcgis\.com\/home\/webmap\/viewer\.html\?*/ // @license GNU GPLv3 // @downloadURL https://update.greasyfork.org/scripts/28097/WME%20FS%20MVUM%20GIS%20Map.user.js // @updateURL https://update.greasyfork.org/scripts/28097/WME%20FS%20MVUM%20GIS%20Map.meta.js // ==/UserScript== (function() { 'use strict'; var debugLevel = 0; var mapWindow; var Extent; var SpatialReference; var receiverAdded = false; function log(message, level) { if (message && level <= debugLevel) { console.log('FS GIS:', message); } } function onButtonClick() { var wazeExt = W.map.getExtent(); var url = 'http://www.arcgis.com/home/webmap/viewer.html?layers=f3ddf325eb02467da65b08d73280ae4a&extent='; url += wazeExt.left + '%2C' + wazeExt.bottom + '%2C' + wazeExt.right + '%2C' + wazeExt.top + '%2C102113'; if (!mapWindow || mapWindow.closed) { mapWindow = window.open(null, 'fs_gis_map'); try { if (mapWindow.location && mapWindow.location.href) { mapWindow.location.assign(url); } } catch (ex) { if (ex.code === 18) { // Ignore if accessing location.href is blocked by cross-domain. } else { throw ex; } } } mapWindow.focus(); syncGISMapExtent(); } function syncGISMapExtent() { if (mapWindow && !mapWindow.closed) { var wazeExt = W.map.getExtent(); mapWindow.postMessage({type:'setExtent', xmin:wazeExt.left, xmax:wazeExt.right, ymin:wazeExt.bottom, ymax:wazeExt.top, spatialReference: 102113}, 'http://www.arcgis.com'); } } function init() { $('.WazeControlPermalink').prepend( $('