WME englishName display

Display the englishName for selected cities

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         WME englishName display
// @namespace    https://greatest.deepsurf.us/users/30701-justins83-waze
// @version      2018.09.18.01
// @description  Display the englishName for selected cities
// @author       JustinS83
// @include      https://beta.waze.com/*
// @include      https://www.waze.com/editor*
// @include      https://www.waze.com/*/editor*
// @exclude      https://www.waze.com/user/editor*
// @require      https://greatest.deepsurf.us/scripts/24851-wazewrap/code/WazeWrap.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function bootstrap(tries = 1) {
        if (W && W.map &&
            W.model &&
            $ && WazeWrap.Ready) {
            init();
        } else if (tries < 1000)
            setTimeout(function () {bootstrap(tries++);}, 200);
    }

    function init()
    {
         W.selectionManager.events.register("selectionchanged", null, displayEnglishname);
    }

    function displayEnglishname()
    {
        if(WazeWrap.hasSelectedFeatures() && WazeWrap.getSelectedFeatures()[0].model.type == "city")
        {
            var $cityAttributes = $(`<div class='preview'>cityID: <span>${WazeWrap.getSelectedFeatures()[0].model.attributes.id}</span></div>
<div class='preview'>stateID: <span>${WazeWrap.getSelectedFeatures()[0].model.attributes.stateID}</span></div>
<div class='preview'>englishName: <span>${WazeWrap.getSelectedFeatures()[0].model.attributes.englishName}</span></div><br/>
<div><a href="https://docs.google.com/forms/d/e/1FAIpQLSeoEtS5lQNwakeTXzHz98FpB_p2ji-U3XWwyv-Er4nbgEuf9A/viewform" target="_blank">Cities form</a></div>`);
            $('#edit-panel > div > div > div > div > div.preview').after($cityAttributes);
        }
    }

    bootstrap();
})();