Skip to content

Commit 09528ce

Browse files
committed
Reversed state change check in toggle.anchorMode() for early return to reduce nesting ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions]
1 parent d8c55f3 commit 09528ce

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

greasemonkey/duckduckgpt.user.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.1.4.2
151+
// @version 2025.1.4.3
152152
// @license MIT
153153
// @icon https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png?af89302
154154
// @icon64 https://media.ddgpt.com/images/icons/duckduckgpt/icon64.png?af89302
@@ -2781,18 +2781,17 @@
27812781
settings.save('anchored', false)
27822782
if (config.expanded) toggle.expandedMode('off')
27832783
}
2784+
if (prevState == config.anchored) return
27842785

2785-
// Apply new state to UI
2786+
// Apply changed state to UI
27862787
appDiv.classList[config.anchored ? 'add' : 'remove']('anchored')
27872788
update.rqVisibility() ; update.answerPreMaxHeight() ; update.bylineVisibility() ; update.chatbarWidth()
27882789
if (modals.settings.get()) { // update visual state of Settings toggle
27892790
const anchorToggle = document.querySelector('[id*=anchor][id*=menu-entry] input')
27902791
if (anchorToggle.checked != config.anchored) modals.settings.toggle.switch(anchorToggle)
27912792
}
2792-
if (prevState != config.anchored) {
2793-
menus.pin.topPos = menus.pin.rightPos = null
2794-
notify(`${app.msgs.mode_anchor} ${menu.state.words[+config.anchored]}`)
2795-
}
2793+
menus.pin.topPos = menus.pin.rightPos = null
2794+
notify(`${app.msgs.mode_anchor} ${menu.state.words[+config.anchored]}`)
27962795
},
27972796

27982797
animations(layer) {

0 commit comments

Comments
 (0)