WME Rapid UR Reply

Shortcut keys to answer URs with the F8 key and closes them with the F9 -- also, F8 can approve PURs and lock at L2.

// ==UserScript==
// @name         WME Rapid UR Reply
// @description  Shortcut keys to answer URs with the F8 key and closes them with the F9 -- also, F8 can approve PURs and lock at L2.
// @author       TxAgBQ with lots of help from YUL
// @version      20241128
// @namespace    https://greasyfork.org/en/users/820296-txagbq/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=waze.com
// @match        https://*.waze.com/*/editor*
// @match        https://*.waze.com/editor*
// @exclude      https://*.waze.com/user/editor*
// @require      https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js
// @grant        none
// ==/UserScript==

/* global W */

(function() {
    'use strict';

    document.addEventListener('keydown', (event) => {
    // Add comment then click send, Next
        if (event.key === 'F8') {
            // Inserts this text
              //let textToInsert = "I got your map issue report.  What issue did you experience? \n\nWould you please tell us your destination EXACTLY as selected in Waze? Click on 'Where to?' then scroll down to see recent destinations.  Include both the bold name and address underneath, with city. If it's spelled out, spell it out. If it's abbreviated, abbreviate it.  How to find your recent destination: https://www.youtube.com/watch?v=PExNTIQfJI8  \n\nWe don't receive email replies so please respond in the Waze inbox.";

             //$('#panel-container .mapUpdateRequest .body .conversation .new-comment-text').val(textToInsert);

            // Clicks send
            $("#panel-container .mapUpdateRequest .body .conversation .new-comment-form .send-button").click();

            // Clicks Next (for open URs)
            $('#panel-container .mapUpdateRequest .actions .navigation .waze-plain-btn').click();
       }
       if (event.key === 'F9') {
        // Inserts this text
        // Comment to close out report
            let textToInsert = "You asked us to help you with a map issue but you didn't respond back with the info we need to fix your problem, so we'll infer everything is okay and close your request. \n\nIf you were reporting a closure, the quickest way to get closures on the map is to use the Report > Closure feature built into the Waze app on your phone.";

        $('#panel-container .mapUpdateRequest .body .conversation .new-comment-text').val(textToInsert);

        // Clicks send
        $("#panel-container .mapUpdateRequest .body .conversation .new-comment-form .send-button").click();

        // Clicks NI
        $('#panel-container .mapUpdateRequest .actions .controls-container label[for|="state-not-identified"').click();
        // Clicks Next (for open URs)
        $('#panel-container .mapUpdateRequest .actions .navigation .waze-plain-btn').click();
       }

   // Approves PUR then sets to lock level 2
      if (event.key === 'F8') {
       // Click Add and edit
       $('#panel-container .place-update-edit .actions .controls-container label[for="approved-true"').click();
       // Lock to L2
       $('#lockRank-1').click();
     }
    });
})();