WME City Name Marker

Add keyboard keys ESC and Enter. Auto click on icon edit and selected city name (for editors 5+).

当前为 2017-02-18 提交的版本,查看 最新版本

// ==UserScript==
// @name         WME City Name Marker
// @description  Add keyboard keys ESC and Enter. Auto click on icon edit and selected city name (for editors 5+).
// @namespace
// @include      https://*.waze.com/*editor/*
// @grant        none
// @author       Alexash
// @version      0.3
// @namespace https://greasyfork.org/users/102642
// ==/UserScript==

$('#sidebar').on('keyup', 'input.city-name', function(event) {

    if (event.keyCode == 13) {
        $('button.save-button').click();
    }

    if (event.keyCode == 27) {
        $('button.cancel-button').click();
    }
});

$('#sidebar').on('focus', 'input.city-name', function() {

    $(this).select();
});

$('#WazeMap').on('mouseup', '.city-name-marker', function() {

    setTimeout(function() {
        $('.preview').attr('style','display: none;');
        $('.attributes-form.inner-form').attr('style','display: block;');
        $('input.city-name').select();
    }, 500);
});