GTB4WE

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

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

// ==UserScript==
// @name         GTB4WE
// @name:es      Herramientas pa Gaia
// @version      0.1.3
// @description  Gaia ToolBox for Waze Editors. Some funcionalities to make waze map editing a little bit easier.
// @description:es 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_detail")[0]) {
            init();
        } else if (tries < 1000) {
            setTimeout(function () {bootstrap(tries++);}, 200);
        }
    }

    bootstrap();

    function init(){
debugger;
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                selectStreetName();
            });    
        });
        observer.observe($("#mdm6DinamicPanel_detail")[0],{ childList: true});

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

    function selectStreetName(){
debugger;
        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" && child.nodeValue.indexOf("Calles")>=0){
                range.setStart(child, 7);
                range.setEndAfter(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或关注我们的公众号极客氢云获取最新地址