您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
adds the aerial photos from the col gis as a basemap layer
当前为
// ==UserScript== // @name WME COL Basemap // @namespace https://fxzfun.com/ // @version 1.1 // @description adds the aerial photos from the col gis as a basemap layer // @author FXZFun // @match https://*.waze.com/*/editor* // @match https://*.waze.com/editor* // @match https://maps.cityoflewisville.com/* // @exclude https://*.waze.com/user/editor* // @icon https://www.google.com/s2/favicons?sz=64&domain=waze.com // @grant GM_setValue // @grant GM_getValue // @require https://gf.qytechs.cn/scripts/24851-wazewrap/code/WazeWrap.js // @license GNU GPLv3 // ==/UserScript== /* global W, OL, WazeWrap */ (function() { 'use strict'; var errorOccurred; var colBasemap; function getTicket() { document.addEventListener("ticketRetrieved", (e) => { GM_setValue("wmecolbasemap-ticket", e.ticket); if (location.href.includes("wmecolbasemap")) window.close(); }); var script = document.createElement("script"); script.innerHTML = ` var ticketUpdated = false; const NativeImage = Image; const ticketRetrieved = new CustomEvent('ticketRetrieved'); class FakeImage { constructor(w, h) { const nativeImage = new NativeImage(w, h); const handler = { set: function (obj, prop, value) { if (prop === 'src') { if (value.includes("nearmap")) { if (!ticketUpdated) { ticketUpdated = true; window.Image = NativeImage; ticketRetrieved.ticket = value.split("&ticket=")[1]; document.dispatchEvent(ticketRetrieved); } } } nativeImage[prop] = value; }, get: function(target, prop) { return target[prop]; } }; return new Proxy(nativeImage, handler); } } window.Image = FakeImage;`; document.body.appendChild(script); } function addLayer() { var ticket = GM_getValue("wmecolbasemap-ticket"); var date = "20221010"; // changes as aerials get updated if (ticket == null) { window.open("https://maps.cityoflewisville.com/?&zoom=13¢er=33.043,-96.957&basemap=nearmap_"+date+"&wmecolbasemap=true","_blank"); var ali = setInterval(() => { if (GM_getValue("wmecolbasemap-ticket") != null) { return addLayer(); } }, 1000); } if (colBasemap == null) { colBasemap = new OL.Layer.XYZ( 'COL GIS Basemap', "https://us0.nearmap.com/maps/?z=${z}&x=${x}&y=${y}&nml=V&version=2&nmd=" + date + "&ticket=" + ticket, { isBaseLayer: false, uniqueName: 'colgis', tileSize: new OL.Size(256,256), transitionEffect: 'resize', displayInLayerSwitcher: true, opacity: 1, visibility: false, tileOptions: { eventListeners: { 'loaderror': function(evt) { if (!errorOccurred) { errorOccurred = true; window.open("https://maps.cityoflewisville.com/?&zoom=13¢er=33.043,-96.957&basemap=nearmap_"+date+"&wmecolbasemap=true","_blank"); var ali = setInterval(() => { if (GM_getValue("wmecolbasemap-ticket") != null) { return addLayer(); } }, 1000); } } } } }); W.map.addLayer(colBasemap); W.map.setLayerIndex(colBasemap, 2); } else { colBasemap.url = "https://us0.nearmap.com/maps/?z=${z}&x=${x}&y=${y}&nml=V&version=2&nmd=" + date + "&ticket=" + ticket; } } function toggleBasemap(value) { W.map.getLayerByName("COL GIS Basemap").setVisibility(value); localStorage.setItem("wmecolbasemap-visibility", value); } if (location.href.includes("cityoflewisville.com")) { // get ticket console.log("WME COL Basemap: Start"); getTicket(); } else if (location.href.includes("waze.com")) { // load layer var wmeI = setInterval(() => { if (WazeWrap != null && WazeWrap.Ready) { clearInterval(wmeI); console.log("WME COL Basemap: Start"); WazeWrap.Interface.AddLayerCheckbox( "display", "COL GIS Basemap", false, toggleBasemap, W.map.getLayerByName("WME COL Basemap")); addLayer(); } }, 500); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址