您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Miscelannia stuff for LV Waze editors
当前为
// ==UserScript== // @name LV WME Helper // @description Miscelannia stuff for LV Waze editors // @namespace https://dev.laacz.lv/ // @include https://www.waze.com/*/editor* // @include https://www.waze.com/editor* // @include https://beth,.waze.com/* // @exclude https://www.waze.com/*user/*editor/* // @require https://gf.qytechs.cn/scripts/24851-wazewrap/code/WazeWrap.js // @version 1.01 // @grant none // ==/UserScript== /* global W */ /* global WazeWrap */ (function () { 'use strict'; let redrawTimeout = false; /** * Logging */ const log = { info(...args) { console.info('LV-WME', ...args); }, debug(...args) { console.debug('LV-WME', ...args); } }; /** * Settings */ let settings = { configuration: { lowerCaseHNs: true, }, /** * Retreives configuration parameter "key" or value of "def", if not found. * * @param key * @param def * @returns {*} */ get: function (key, def) { return typeof this.configuration[key] !== 'undefined' ? this.configuration[key] : def; }, /** * Sets configuration parameter "key" to "value". * * @param key * @param value */ set: function (key, value) { this.configuration[key] = value; this.save(); }, /** * Saves to local storage. */ save: function () { if (localStorage) { localStorage.setItem("_lv_wme_settings", JSON.stringify(this.configuration)); } }, /** * Loads from localstorage */ load: function () { let loadedSettings = JSON.parse(localStorage.getItem("_lv_wme_settings")); loadedSettings = loadedSettings ? loadedSettings : {}; this.configuration = Object.assign(this.configuration, loadedSettings); } }; /** * Bootstraps app. Waits until everything is ready or tries exceed 100, then calls init. * @param tries */ function bootstrap(tries = 1) { if (W && W.map && W.model && W.loginManager.user && typeof W.selectionManager !== 'undefined' && typeof WazeWrap !== "undefined" && WazeWrap.Ready) { init(); } else if (tries < 1000) { setTimeout(() => { bootstrap(tries + 1); }, 200); } } /** * Initializes UserScript. */ function init() { settings.load(); initTab(); } /** * Initialises tab */ function initTab() { let html = ` <h4>LV WME helper</h4> <hr> <div class="form-group"> <div class="controls-container"> <input type="checkbox" name="lv-wme-lowercase-hns" id="lv-wme-lowercase-hns" ${settings.get('lowerCaseHNs') ? 'checked' : ''}> <label for="lv-wme-lowercase-hns"> Highlight places with lowercase HN (red border)</label> </div> </div> <hr> <p><small>${WazeWrap.User.Username()} (${WazeWrap.User.Rank()}), CM: ${WazeWrap.User.isCM()}, AM: ${WazeWrap.User.isAM()}</small></p> `; new WazeWrap.Interface.Tab('LV WME', html, () => { document.querySelector('#lv-wme-lowercase-hns').addEventListener('change', (e) => { settings.set('lowerCaseHNs', e.target.checked); }); helperRun(); }); } function helperRun() { if (redrawTimeout) { clearTimeout(redrawTimeout); } if (settings.get('lowerCaseHNs')) { let venues = Object.values(W.model.venues.objects); venues.forEach(v => { let hn = v.attributes.houseNumber, name = v.attributes.name, olID = v.geometry ? v.geometry.id : false, hl = false, olGeom = olID ? document.querySelector('#' + olID) : false; if (!olID || !olGeom) return; // Check if hn is lowercase if (hn && ('' + hn).toUpperCase() !== ('' + hn)) { hl = true; // log.info(hn, 'must be uppercased'); } // Check if name relects hn and is lowercase if (hn && name && ('' + name).toUpperCase().indexOf(('' + hn).toUpperCase()) === 0 && ('' + name).substr(0, ('' + hn).length) !== ('' + hn).toUpperCase() ) { hl = true; // log.info(name, 'contains', hn, 'but must be uppercased'); } if (hl && !v.isSelected()) { olGeom.setAttribute('stroke', '#ff0000'); olGeom.setAttribute("stroke-width", "4"); olGeom.setAttribute("stroke-dash-array", "none"); } }); } setTimeout(helperRun, 345); } bootstrap(); })(); /* end ======================================================================= */
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址