From ade3cb989823c7f2093c7cabd4ef6072ac305211 Mon Sep 17 00:00:00 2001 From: abelter Date: Sun, 13 Sep 2020 00:27:43 -0400 Subject: [PATCH 1/2] Update WazeWrapLib.js WME compatibility updates for non-standard layer groups; allow non-standard layer groups names to have capitalization specified via script (e.g. NCDOT vs Ncdot as layer group name) --- WazeWrapLib.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/WazeWrapLib.js b/WazeWrapLib.js index 8d07d4f..1ba7217 100644 --- a/WazeWrapLib.js +++ b/WazeWrapLib.js @@ -1936,31 +1936,32 @@ * @param {Layer object} **/ this.AddLayerCheckbox = function (group, checkboxText, checked, callback, layer) { - group = group.toLowerCase(); + let normalizedGroup = group.toLowerCase(); let normalizedText = checkboxText.toLowerCase().replace(/\s/g, '_'); let checkboxID = "layer-switcher-item_" + normalizedText; let groupPrefix = 'layer-switcher-group_'; - let groupClass = groupPrefix + group.toLowerCase(); + let groupClass = groupPrefix + normalizedGroup; sessionStorage[normalizedText] = checked; let CreateParentGroup = function (groupChecked) { let groupList = $('.layer-switcher').find('.list-unstyled.togglers'); - let checkboxText = group.charAt(0).toUpperCase() + group.substr(1); let newLI = $('
  • '); newLI.html([ '
    ', - '', - '', - '', + '', + '', + '', + '', '
    ', - '
  • ' + '' ].join(' ')); groupList.append(newLI); $('#' + groupClass).change(function () { sessionStorage[groupClass] = this.checked; }); }; - if (group !== "issues" && group !== "places" && group !== "road" && group !== "display") //"non-standard" group, check its existence + if (normalizedGroup !== "issues" && normalizedGroup !== "places" && normalizedGroup !== "road" && normalizedGroup !== "display") //"non-standard" group, check its existence if ($('.' + groupClass).length === 0) { //Group doesn't exist yet, create it let isParentChecked = (typeof sessionStorage[groupClass] == "undefined" ? true : sessionStorage[groupClass] == 'true'); CreateParentGroup(isParentChecked); //create the group From 523d57fa83b779ff3508a52cdde2c87ad984dc07 Mon Sep 17 00:00:00 2001 From: abelter Date: Sun, 13 Sep 2020 00:30:48 -0400 Subject: [PATCH 2/2] Update WazeWrapLib.js --- WazeWrapLib.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/WazeWrapLib.js b/WazeWrapLib.js index 1ba7217..3ec3bba 100644 --- a/WazeWrapLib.js +++ b/WazeWrapLib.js @@ -1936,11 +1936,12 @@ * @param {Layer object} **/ this.AddLayerCheckbox = function (group, checkboxText, checked, callback, layer) { - let normalizedGroup = group.toLowerCase(); + let groupLabel = group; + group = group.toLowerCase(); let normalizedText = checkboxText.toLowerCase().replace(/\s/g, '_'); let checkboxID = "layer-switcher-item_" + normalizedText; let groupPrefix = 'layer-switcher-group_'; - let groupClass = groupPrefix + normalizedGroup; + let groupClass = groupPrefix + group; sessionStorage[normalizedText] = checked; let CreateParentGroup = function (groupChecked) { @@ -1951,7 +1952,7 @@ '', '', '', - '', + '', '', '' @@ -1961,7 +1962,7 @@ $('#' + groupClass).change(function () { sessionStorage[groupClass] = this.checked; }); }; - if (normalizedGroup !== "issues" && normalizedGroup !== "places" && normalizedGroup !== "road" && normalizedGroup !== "display") //"non-standard" group, check its existence + if (group !== "issues" && group !== "places" && group !== "road" && group !== "display") //"non-standard" group, check its existence if ($('.' + groupClass).length === 0) { //Group doesn't exist yet, create it let isParentChecked = (typeof sessionStorage[groupClass] == "undefined" ? true : sessionStorage[groupClass] == 'true'); CreateParentGroup(isParentChecked); //create the group