GTB4WE

Gaia ToolBox for Waze Editors. Some funcionalities to make waze map editing a little bit easier.

目前為 2017-05-04 提交的版本,檢視 最新版本

// ==UserScript==
// @name         GTB4WE
// @name:es      Herramientas pa Gaia
// @version      0.1.5
// @description  Gaia ToolBox for Waze Editors. Some funcionalities to make waze map editing a little bit easier.
// @description:es Gaia ToolBox for Waze Editors. Algunas funcionalidades pa hacer la edición del mapa mas sencilla.
// @author       abdielisai
// @include      http://gaia.inegi.org.mx/mdm6/*
// @grant        none
// @license      GPLv3
// @namespace https://gf.qytechs.cn/users/118132
// ==/UserScript==

(function() {

    function bootstrap(tries) {
        tries = tries || 1;

        if ($ && $("#mdm6DinamicPanel")[0]) {
            init();
        } else if (tries < 1000) {
            setTimeout(function() {
                bootstrap(tries++);
            }, 200);
        } else {
            console.log("Gaia ToolBox for Waze Editors (GTB4WE) couldn't start.");
        }
    }

    bootstrap();

    function init() {

        initStreetNameObserver();

        console.log("Gaia ToolBox for Waze Editors (GTB4WE) " + GM_info.script.version + " is running.");
    }

    function initStreetNameObserver() {
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                if ($(mutation.target).hasClass("dinamicPanel-detail")) {
                    selectStreetName();
                }
            });
        });
        observer.observe($("#mdm6DinamicPanel")[0], {
                childList: true,
                subtree: true
            });
    }

    function selectStreetName() {
        var elements = $(".dinamicPanel-detailMainLabel");
        if (elements.length === 0 || elements[0].childNodes.length === 0) return;
        var sel = window.getSelection();
        if (!sel.isCollapsed) return;

        var range = document.createRange();
        elements[0].childNodes.forEach(function(child) {
            if (child.nodeName == "#text") {
                range.selectNodeContents(child);
                return;
            } else if (child.nodeName == "TABLE") {
                range.selectNodeContents(child.childNodes[0].childNodes[0].childNodes[1]);
                return;
            }
        });
        sel.removeAllRanges();
        sel.addRange(range);
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址