Skip to content

Commit

Permalink
Fix "swap pedestrian button" in non-compact mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mapomatic committed Oct 26, 2024
1 parent face830 commit 0005016
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions WME ClickSaver.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name WME ClickSaver
// @namespace https://greasyfork.org/users/45389
// @version 2024.10.12.000
// @version 2024.10.26.000
// @description Various UI changes to make editing faster and easier.
// @author MapOMatic
// @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor\/?.*$/
Expand Down Expand Up @@ -604,7 +604,7 @@
}
}

function addSwapPedestrianButton(displayMode) { // Added displayMode argument to identify compact vs. regular mode.
function addSwapPedestrianButton() { // Added displayMode argument to identify compact vs. regular mode.
const id = 'csSwapPedestrianContainer';
$(`#${id}`).remove();
const segments = getSelectedSegments();
Expand All @@ -624,14 +624,8 @@
$container.append($button);

// Insert swap button in the correct location based on display mode.
if (displayMode === 'compact') {
const $label = $('#segment-edit-general > form > div > div.road-type-control > wz-label');
$label.css({ display: 'inline' }).append($container);
} else {
const $label = $('#segment-edit-general > form > div[0] > wz-label');
$label.css({ display: 'inline' }).append($container);
}
// TODO css
const $label = $('#segment-edit-general > form > div > div.road-type-control > wz-label');
$label.css({ display: 'inline' }).append($container);

$('#csBtnSwapPedestrianRoadType').click(onSwapPedestrianButtonClick);
}
Expand Down Expand Up @@ -887,6 +881,9 @@
if (isChecked('csRoadTypeButtonsCheckBox')) addRoadTypeButtons();
}
addCompactRoadTypeColors();
if (isSwapPedestrianPermitted() && isChecked('csAddSwapPedestrianButtonCheckBox')) {
addSwapPedestrianButton();
}
// if ($(PARKING_SPACES_DROPDOWN_SELECTOR).length > 0 && isChecked('csParkingSpacesButtonsCheckBox')) {
// addParkingSpacesButtons(); // TODO - add option setting
// }
Expand Down Expand Up @@ -1008,14 +1005,14 @@
if (addedNode.querySelector(ROAD_TYPE_DROPDOWN_SELECTOR)) {
if (isChecked('csRoadTypeButtonsCheckBox')) addRoadTypeButtons();
if (isSwapPedestrianPermitted() && isChecked('csAddSwapPedestrianButtonCheckBox')) {
addSwapPedestrianButton('regular');
addSwapPedestrianButton();
}
}
// Checks to identify if this is a segment in compact display mode.
if (addedNode.querySelector(ROAD_TYPE_CHIP_SELECTOR)) {
if (isChecked('csRoadTypeButtonsCheckBox')) addCompactRoadTypeChangeEvents();
if (isSwapPedestrianPermitted() && isChecked('csAddSwapPedestrianButtonCheckBox')) {
addSwapPedestrianButton('compact');
addSwapPedestrianButton();
}
}
// if (addedNode.querySelector(PARKING_SPACES_DROPDOWN_SELECTOR) && isChecked('csParkingSpacesButtonsCheckBox')) {
Expand Down

0 comments on commit 0005016

Please sign in to comment.