Skip to content

Commit f17f2c9

Browse files
committed
Corrected entryData.<min|max> refs in createMenuEntry() for sliders, added step support + default to 2% for FF ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-widescreen]
1 parent 470b6ba commit f17f2c9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

chromium/extension/popup/controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
}
5151
if (entryData.type == 'slider') { // append slider, add listeners, remove .highlight-on-hover
5252
entry.slider = dom.create.elem('input', { class: 'slider', type: 'range',
53-
min: entry.min || 0, max: entry.max || 100, value: config[entryData.key] })
53+
min: entryData.min || 0, max: entryData.max || 100, value: config[entryData.key] })
54+
if (entryData.step || env.browser.isFF) // use val from entryData or default to 2% in FF for being laggy
55+
entry.slider.step = entryData.step || ( 0.02 * entry.slider.max - entry.slider.min )
5456
entry.label.textContent += `: ${entry.slider.value}${ entryData.labelSuffix || '' }`
5557
entry.slider.style.setProperty('--track-fill-percent', `${ entry.slider.value / entry.slider.max *100 }%`)
5658
entry.slider.oninput = ({ target: { value }}) => { // update label/color

firefox/extension/popup/controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
}
5151
if (entryData.type == 'slider') { // append slider, add listeners, remove .highlight-on-hover
5252
entry.slider = dom.create.elem('input', { class: 'slider', type: 'range',
53-
min: entry.min || 0, max: entry.max || 100, value: config[entryData.key] })
53+
min: entryData.min || 0, max: entryData.max || 100, value: config[entryData.key] })
54+
if (entryData.step || env.browser.isFF) // use val from entryData or default to 2% in FF for being laggy
55+
entry.slider.step = entryData.step || ( 0.02 * entry.slider.max - entry.slider.min )
5456
entry.label.textContent += `: ${entry.slider.value}${ entryData.labelSuffix || '' }`
5557
entry.slider.style.setProperty('--track-fill-percent', `${ entry.slider.value / entry.slider.max *100 }%`)
5658
entry.slider.oninput = ({ target: { value }}) => { // update label/color

0 commit comments

Comments
 (0)