Skip to content

Commit

Permalink
Condensed toggle update routine ↞ [auto-sync from `adamlui/chatgpt-ap…
Browse files Browse the repository at this point in the history
…ps/chatgpt-infinity/greasemonkey`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Jun 26, 2024
1 parent c857159 commit 8b45647
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 37 deletions.
12 changes: 3 additions & 9 deletions chrome/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,9 @@
// Update visual state
navToggleDiv.style.display = config.toggleHidden ? 'none' : 'flex'
setTimeout(() => {
if (toggleInput.checked) {
switchSpan.style.backgroundColor = '#AD68FF'
switchSpan.style.boxShadow = '2px 1px 9px #D8A9FF'
knobSpan.style.transform = `translateX(${ knobWidth }px) translateY(0)`
} else {
switchSpan.style.backgroundColor = '#CCC'
switchSpan.style.boxShadow = 'none'
knobSpan.style.transform = 'translateX(0)'
}
switchSpan.style.backgroundColor = toggleInput.checked ? '#ad68ff' : '#ccc'
switchSpan.style.boxShadow = toggleInput.checked ? '2px 1px 9px #d8a9ff' : 'none'
knobSpan.style.transform = toggleInput.checked ? `translateX(${ knobWidth }px) translateY(0)` : 'translateX(0)'
}, 1) // min delay to trigger transition fx
}})}

Expand Down
12 changes: 3 additions & 9 deletions edge/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,9 @@
// Update visual state
navToggleDiv.style.display = config.toggleHidden ? 'none' : 'flex'
setTimeout(() => {
if (toggleInput.checked) {
switchSpan.style.backgroundColor = '#AD68FF'
switchSpan.style.boxShadow = '2px 1px 9px #D8A9FF'
knobSpan.style.transform = `translateX(${ knobWidth }px) translateY(0)`
} else {
switchSpan.style.backgroundColor = '#CCC'
switchSpan.style.boxShadow = 'none'
knobSpan.style.transform = 'translateX(0)'
}
switchSpan.style.backgroundColor = toggleInput.checked ? '#ad68ff' : '#ccc'
switchSpan.style.boxShadow = toggleInput.checked ? '2px 1px 9px #d8a9ff' : 'none'
knobSpan.style.transform = toggleInput.checked ? `translateX(${ knobWidth }px) translateY(0)` : 'translateX(0)'
}, 1) // min delay to trigger transition fx
}})}

Expand Down
14 changes: 4 additions & 10 deletions greasemonkey/chatgpt-infinity.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
// @description:zh-TW 從無所不知的 ChatGPT 生成無窮無盡的答案 (用任何語言!)
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.6.25.7
// @version 2024.6.26
// @license MIT
// @match *://chatgpt.com/*
// @match *://chat.openai.com/*
Expand Down Expand Up @@ -614,15 +614,9 @@
// Update visual state
navToggleDiv.style.display = config.toggleHidden ? 'none' : 'flex'
setTimeout(() => {
if (toggleInput.checked) {
switchSpan.style.backgroundColor = '#AD68FF'
switchSpan.style.boxShadow = '2px 1px 9px #D8A9FF'
knobSpan.style.transform = `translateX(${ knobWidth }px) translateY(0)`
} else {
switchSpan.style.backgroundColor = '#CCC'
switchSpan.style.boxShadow = 'none'
knobSpan.style.transform = 'translateX(0)'
}
switchSpan.style.backgroundColor = toggleInput.checked ? '#ad68ff' : '#ccc'
switchSpan.style.boxShadow = toggleInput.checked ? '2px 1px 9px #d8a9ff' : 'none'
knobSpan.style.transform = toggleInput.checked ? `translateX(${ knobWidth }px) translateY(0)` : 'translateX(0)'
}, 1) // min delay to trigger transition fx
}

Expand Down
12 changes: 3 additions & 9 deletions opera/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,9 @@
// Update visual state
navToggleDiv.style.display = config.toggleHidden ? 'none' : 'flex'
setTimeout(() => {
if (toggleInput.checked) {
switchSpan.style.backgroundColor = '#AD68FF'
switchSpan.style.boxShadow = '2px 1px 9px #D8A9FF'
knobSpan.style.transform = `translateX(${ knobWidth }px) translateY(0)`
} else {
switchSpan.style.backgroundColor = '#CCC'
switchSpan.style.boxShadow = 'none'
knobSpan.style.transform = 'translateX(0)'
}
switchSpan.style.backgroundColor = toggleInput.checked ? '#ad68ff' : '#ccc'
switchSpan.style.boxShadow = toggleInput.checked ? '2px 1px 9px #d8a9ff' : 'none'
knobSpan.style.transform = toggleInput.checked ? `translateX(${ knobWidth }px) translateY(0)` : 'translateX(0)'
}, 1) // min delay to trigger transition fx
}})}

Expand Down

0 comments on commit 8b45647

Please sign in to comment.