From af034e7d5456466c16201d4bd9b4d03a7cd80c6e Mon Sep 17 00:00:00 2001 From: Ciprian Mihai Coman Date: Wed, 14 Aug 2024 10:01:47 +0300 Subject: [PATCH 1/6] Fix increment storage --- RapidHouseNumbers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RapidHouseNumbers.js b/RapidHouseNumbers.js index 23de39c..073cd1d 100644 --- a/RapidHouseNumbers.js +++ b/RapidHouseNumbers.js @@ -216,7 +216,7 @@ }); $("input.rapidHN.increment").change(() => { - window.localStorage.setItem("rapidHNincrement", $(this).val()); + window.localStorage.setItem("rapidHNincrement", $("input.rapidHN.increment").val()); }); $("div.rapidHN-control input").on("change", () => { From 2c5587088acb528dc399cc361c73f2ae63167448 Mon Sep 17 00:00:00 2001 From: Ciprian Mihai Coman Date: Wed, 14 Aug 2024 10:03:34 +0300 Subject: [PATCH 2/6] Fix next house number selection on subsequent streets --- RapidHouseNumbers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RapidHouseNumbers.js b/RapidHouseNumbers.js index 073cd1d..4fdd1ad 100644 --- a/RapidHouseNumbers.js +++ b/RapidHouseNumbers.js @@ -324,7 +324,7 @@ if (rapidHNNext) { rapidHNtoolbarButton = undefined; - addHouseNumber = rapidHNNext.previousSibling; // recursiveSearchFor(mutation.addedNodes, ['add-house-number']); + addHouseNumber = rapidHNNext.previousElementSibling; // recursiveSearchFor(mutation.addedNodes, ['add-house-number']); if ( addHouseNumber && !addHouseNumber.classList.contains("ItemDisabled") From 77da81cd8c2b57dd6a9784cfc1ecda1aefa923a4 Mon Sep 17 00:00:00 2001 From: Ciprian Mihai Coman Date: Wed, 14 Aug 2024 10:10:26 +0300 Subject: [PATCH 3/6] version 2.9 --- RapidHouseNumbers.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/RapidHouseNumbers.js b/RapidHouseNumbers.js index 4fdd1ad..6019292 100644 --- a/RapidHouseNumbers.js +++ b/RapidHouseNumbers.js @@ -7,7 +7,7 @@ // @name WME Rapid House Numbers // @description A House Number script with its controls in the House Number mini-editor. It injects the next value in a sequence into each new HN. To support different regions, house numbers may be [0-9]+, [0-9]+[a-z]+, or [0-9]+-[0-9]+. // @namespace https://github.com/WazeDev -// @version 2.8 +// @version 2.9 // @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor\/?.*$/ // @copyright 2017-2024, kjg53 // @author kjg53, WazeDev (2023-?), SaiCode (2024-?) @@ -31,9 +31,9 @@ { version: "1.2", message: "Now does full reset when exiting House Number Editor." }, { version: "1.3", message: "Fixed typo in change log." }, { version: "1.4", message: "The accelerator key bindings are removed upon exiting the House Number editor." }, - { version: "1.5", message: "The primary accelerator has been changed from 'a' to 'h'. The keys '1' .. '9' are now accelerators that create the next house number then increment next by the value of the key." }, + { version: "1.5", message: "The primary accelerator has been changed from 'a' to 'h'. The keys '1' .. '9' are now accelerators that create the next house number then increment next by the value of the key." }, { version: "1.6", message: "Disabled numeric accelerators in text fields." }, - { version: "1.7", message: "Added support for numpads. Event handler now removed when the House Number editor is exited." }, + { version: "1.7", message: "Added support for numpads. Event handler now removed when the House Number editor is exited." }, { version: "1.8", message: "Removed info dialog." }, { version: "1.9", message: "Increased width of increment field." }, { version: "1.10", message: "The increment is now persisted between sessions." }, @@ -50,7 +50,8 @@ { version: "2.5", message: "Firefox compatibility and Style update." }, { version: "2.6", message: "Fixed bug when re entering HN editor." }, { version: "2.7", message: "Minor version check fix." }, - { version: "2.8", message: "Changelog UI enhancements" }, + { version: "2.8", message: "Changelog UI enhancements." }, + { version: "2.9", message: "Bug fixing." }, ]; const ALL_DIGITS = /^[0-9]+$/; From f83187a70503da849e4d6bf6e8870085d8af5e05 Mon Sep 17 00:00:00 2001 From: Ciprian Mihai Coman Date: Mon, 19 Aug 2024 09:56:54 +0300 Subject: [PATCH 4/6] Fix the save of the next value when closing RHN --- RapidHouseNumbers.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/RapidHouseNumbers.js b/RapidHouseNumbers.js index 6019292..3a0fe56 100644 --- a/RapidHouseNumbers.js +++ b/RapidHouseNumbers.js @@ -259,15 +259,6 @@ } }); - $("div.toolbar-button.waze-icon-exit").click(() => { - // Add ItemDisabled to add-house-number to prevent handlePrimaryToolbarMutations from saving a value - // in rapidHnNext when exiting the house number editor mode. This is, currently, only - // an issue in beta as it's firing this event handler BEFORE WME's own event handler - // deletes the input fields. - $("div.toolbar-button.add-house-number").addClass("ItemDisabled"); - rapidHnNext = undefined; - }); - if (rapidHnNext) { $("input.rapidHN.next") .filter(":visible") @@ -318,21 +309,13 @@ createRHNcontrols(addHouseNumber); } - const rapidHNNext = recursiveSearchFor(mutation.removedNodes, [ + const rapidHNNextInput = recursiveSearchFor(mutation.removedNodes, [ "rapidHN", "next", ]); - if (rapidHNNext) { + if (rapidHNNextInput) { rapidHNtoolbarButton = undefined; - - addHouseNumber = rapidHNNext.previousElementSibling; // recursiveSearchFor(mutation.addedNodes, ['add-house-number']); - if ( - addHouseNumber - && !addHouseNumber.classList.contains("ItemDisabled") - ) { - rapidHnNext = rapidHNNext.value; - } - + rapidHnNext = rapidHNNextInput.value; disconnectHouseNumbersObserver(); } } @@ -478,8 +461,8 @@ className => !node.classList.contains(className), ) === -1 ) { - const { display } = window.getComputedStyle(node); - const visible = display !== "none"; + const display = node.attributeStyleMap.get("display"); + const visible = !display || "none" !== display.value; if (visible) { return node; From 05feed9baac6b23e91b2747223b0c597cea08317 Mon Sep 17 00:00:00 2001 From: Ciprian Mihai Coman Date: Thu, 22 Aug 2024 09:53:32 +0300 Subject: [PATCH 5/6] Adapt to the lates WME UI --- RapidHouseNumbers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RapidHouseNumbers.js b/RapidHouseNumbers.js index 3a0fe56..64d1dad 100644 --- a/RapidHouseNumbers.js +++ b/RapidHouseNumbers.js @@ -123,7 +123,7 @@ || typeof W.selectionManager === "undefined" || typeof I18n === "undefined" || typeof I18n.translations === "undefined" - || $("div#primary-toolbar>div").length === 0 + || $("#toolbar [class^='primaryToolbar']").length === 0 ) { console.log(`${scriptName} dependencies not ready. Waiting...`); setTimeout(rapidHNBootstrap, 500); @@ -141,9 +141,9 @@ W.editingMediator.on("change:editingHouseNumbers", () => $(".rapidHN-control").remove()); // Listen for changes in the edit mode - // The contents of div.primary-toolbar is entirely replaced when switching into, and out of, house number mode. + // The contents of .primaryToolbar is updated when switching into, and out of, house number mode. - const primaryToolbar = $("div#primary-toolbar"); + const primaryToolbar = $("#toolbar [class^='primaryToolbar']"); const primaryToolbarObserver = new MutationObserver( handlePrimaryToolbarMutations, ); @@ -153,7 +153,7 @@ subtree: true, }); } else { - console.log("ERROR: Failed to find div#primary-toolbar"); + console.log("ERROR: Failed to find the primary toolbar"); } W.map.registerMapEvent( From 3710eee81669587a22054bc36bacab4f50e10d01 Mon Sep 17 00:00:00 2001 From: Ciprian Mihai Coman Date: Thu, 22 Aug 2024 09:54:05 +0300 Subject: [PATCH 6/6] Fix visibility check to work on both Chrome and Firefox --- RapidHouseNumbers.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RapidHouseNumbers.js b/RapidHouseNumbers.js index 64d1dad..77c8b61 100644 --- a/RapidHouseNumbers.js +++ b/RapidHouseNumbers.js @@ -461,8 +461,7 @@ className => !node.classList.contains(className), ) === -1 ) { - const display = node.attributeStyleMap.get("display"); - const visible = !display || "none" !== display.value; + const visible = node.style.display !== "none"; if (visible) { return node;