Skip to content

Commit

Permalink
Changed Settings toggles to only init opposite enabled state + unstag…
Browse files Browse the repository at this point in the history
…gered animations on modal open ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/googlegpt]
  • Loading branch information
kudo-sync-bot committed Jan 30, 2025
1 parent 2b90059 commit a1876e2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions chatgpt/googlegpt/googlegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.30.3
// @version 2025.1.30.4
// @license MIT
// @icon https://assets.googlegpt.io/images/icons/googlegpt/black/icon48.png?v=59409b2
// @icon64 https://assets.googlegpt.io/images/icons/googlegpt/black/icon64.png?v=59409b2
Expand Down Expand Up @@ -1476,19 +1476,16 @@
const switchSpan = document.createElement('span')
Object.assign(switchSpan.style, {
position: 'relative', left: '-1px', bottom:'-5.5px', float: 'right',
backgroundColor: settingToggle.checked ? '#ccc' : '#AD68FF', // init opposite final color
width: '26px', height: '13px', borderRadius: '28px',
backgroundColor: '#ccc', width: '26px', height: '13px', borderRadius: '28px',
transition: '0.4s', '-webkit-transition': '0.4s', '-moz-transition': '0.4s',
'-o-transition': '0.4s', '-ms-transition': '0.4s'
})

// Create/stylize knob
const knobSpan = document.createElement('span')
Object.assign(knobSpan.style, {
position: 'absolute', left: '1px', bottom: '1px', backgroundColor: 'white',
width: '11px', height: '11px', content: '""', borderRadius: '28px',
transform: settingToggle.checked ? // init opposite final pos
'translateX(0)' : 'translateX(14px) translateY(0)',
position: 'absolute', left: '1px', bottom: '1px', backgroundColor: 'white', content: '""',
width: '11px', height: '11px', borderRadius: '28px', transform: 'translateX(0)',
transition: '0.2s', '-webkit-transition': '0.2s', '-moz-transition': '0.2s',
'-o-transition': '0.2s', '-ms-transition': '0.2s'
})
Expand All @@ -1497,7 +1494,7 @@
switchSpan.append(knobSpan) ; settingItem.append(settingToggle, switchSpan)

// Update visual state w/ animation
setTimeout(() => modals.settings.toggle.updateStyles(settingToggle), idx *25 -25)
setTimeout(() => modals.settings.toggle.updateStyles(settingToggle), +155)

// Add click listener
settingItem.onclick = () => {
Expand Down

0 comments on commit a1876e2

Please sign in to comment.