WME Google POI verifier

Verify Waze landmarks linked to Google POI

当前为 2016-04-26 提交的版本,查看 最新版本

// ==UserScript==
// @name         WME Google POI verifier
// @name:cs      WME Kontrola Google POI
// @version      0.5.2b
// @description  Verify Waze landmarks linked to Google POI
// @description:cs Kontroluje landmarky ve Waze nalinované na Google POI
// @author       Kebb01
// @include 			https://www.waze.com/editor/*
// @include 			https://www.waze.com/*/editor/*
// @include 			https://editor-beta.waze.com/*
// @namespace           http://www.dammerung.cz/_waze/skript
// @grant               none
// ==/UserScript==

function readTextFile(file, callback) {
    var rawFile = new XMLHttpRequest();
    rawFile.overrideMimeType("text/plain");
    rawFile.open("GET", file, true);
    rawFile.onreadystatechange = function() {
        if (rawFile.readyState === 4 && rawFile.status == "200") {
            callback(rawFile.responseText);
        }
    };
    rawFile.send(null);
}

// ---

var input=document.createElement("input");
input.type="button";
input.value="Find Google place";
input.onclick = runGPOI;
input.setAttribute("style", "font-size:12px;position:absolute;bottom:70px;left:350px;");
document.body.appendChild(input);

function runGPOI()
{
    var gpoiCount = document.getElementsByClassName("select2-chosen");
    gpoiCount = gpoiCount.length;
    console.log("GPOI: Count of linked Google POIs: " + gpoiCount);

    if (gpoiCount < 1) {console.log("GPOI: place is not selected or has no linked Google POI");
                        alert("GPOI: place is not selected or has no linked Google POI");
                       } else {
                           var gpoi = document.getElementsByClassName('select2-chosen')[0].innerHTML;
                           console.log("GPOI: used");
                           console.log("GPOI: " + gpoi + ", " + gpoiCount);

                           var gpoiPlaceId = document.getElementsByClassName('placeId')[0].innerHTML;
                           var gpoiData = "https://editor-beta.waze.com/maps/api/place/details/json?placeid=" + gpoiPlaceId + "&key=AIzaSyBIfV0EMXrTDjrvD92QX5bBiyFmBbT-W8E";

                           readTextFile(gpoiData, function(text){
                               var data = JSON.parse(text);
                               var url = data.result.url;
                               function loadUrl(location) {
                                   this.document.location.href = location;
                               }
                               loadUrl(url, "_blank");
//                               window.open(url, "_blank");
                           });
                       }
}

QingJ © 2025

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