places level wme

Script para seleccionar lugares en Waze según su nivel

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         places level wme
// @namespace    http://example.com
// @version      1.0
// @description  Script para seleccionar lugares en Waze según su nivel
// @author       Crotalo
// @match        https://www.waze.com/editor/*
// @grant        none
// @license MIT 
// ==/UserScript==

(function() {
    'use strict';

    // Definir el nivel deseado (puedes cambiarlo según tus necesidades)
    const nivelObjetivo = 4;

    // Función para seleccionar lugares según su nivel
    function seleccionarPorNivel() {
        // Obtener todos los lugares en la vista
        const lugares = Waze.model.venues.objects;

        // Iterar sobre los lugares y seleccionar los que coinciden con el nivel objetivo
        for (const id in lugares) {
            if (lugares.hasOwnProperty(id)) {
                const lugar = lugares[id];
                if (lugar && lugar.attributes && lugar.attributes.level === nivelObjetivo) {
                    Waze.selectionManager.setSelectedModels([lugar]);
                }
            }
        }
    }

    // Ejecutar la función al hacer clic en un botón (puedes personalizar esto)
    const botonSeleccionar = document.createElement('button');
    botonSeleccionar.textContent = 'Seleccionar lugares nivel ' + nivelObjetivo;
    botonSeleccionar.style.position = 'absolute';
    botonSeleccionar.style.top = '10px';
    botonSeleccionar.style.left = '10px';
    botonSeleccionar.addEventListener('click', seleccionarPorNivel);

    // Agregar el botón a la interfaz de usuario
    document.body.appendChild(botonSeleccionar);
})();