Skip to content

Commit e575a36

Browse files
committed
change labels on menu state button
1 parent ccc9769 commit e575a36

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/js/adn/menu.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ import { broadcast, onBroadcast } from '../broadcast.js';
140140
currentNotifications = data.notifications
141141
renderNotifications(data.notifications)
142142
adjustBlockHeight(data.disableWarnings)
143-
initialButtonState = getIsDisabled() ? 'disabled' : getIsStrictBlocked() ? 'strict' : 'active';
143+
initialButtonState = getIsDisabled() ? 'disable' : getIsStrictBlocked() ? 'strict' : 'active';
144+
updateLabels(initialButtonState)
144145
// set button state
145146
if (getIsDisabled()) {
146147
// disabled
@@ -623,14 +624,15 @@ import { broadcast, onBroadcast } from '../broadcast.js';
623624
// on change state of toggle button
624625
const onChangeState = function (evt) {
625626
updatedButtonState = this.value;
627+
updateLabels(this.value)
626628
switch (this.value) {
627629
case 'strict':
628630
onClickStrict();
629631
if (initialButtonState === 'active') {
630632
updateRefreshNotification(currentNotifications)
631633
} else {
632634
hideRefreshNotification()
633-
}
635+
}
634636
break;
635637
case 'active':
636638
toggleStrictAlert(popupData.pageURL, false)
@@ -654,6 +656,23 @@ import { broadcast, onBroadcast } from '../broadcast.js';
654656
}
655657
}
656658

659+
const updateLabels = function (val) {
660+
switch (val) {
661+
case 'strict':
662+
uDom("#active-lbl").text('activate')
663+
uDom("#disable-lbl .btn_radio_label-text").text('disable')
664+
break;
665+
case 'active':
666+
uDom("#active-lbl").text('active')
667+
uDom("#disable-lbl .btn_radio_label-text").text('disable')
668+
break;
669+
case 'disable':
670+
uDom("#active-lbl").text('activate')
671+
uDom("#disable-lbl .btn_radio_label-text").text('disabled')
672+
break;
673+
}
674+
}
675+
657676
// when changing "page" and "domain" scope from the popup menu on the "disable button"
658677
const onChangeDisabledScope = function (evt) {
659678
// check if url is domain home

0 commit comments

Comments
 (0)