MCPcopy Index your code
hub / github.com/devploit/debugHunter / setupRangeInput

Function setupRangeInput

options.js:66–85  ·  view source on GitHub ↗
(inputId, valueId, savedId, storageKey, defaultValue, transform = (v) => v)

Source from the content-addressed store, hash-verified

64// ============================================================================
65
66function setupRangeInput(inputId, valueId, savedId, storageKey, defaultValue, transform = (v) => v) {
67 const input = document.getElementById(inputId);
68 const value = document.getElementById(valueId);
69
70 if (!input || !value) return;
71
72 // Load saved value
73 chrome.storage.sync.get(storageKey, (data) => {
74 const val = data[storageKey] !== undefined ? data[storageKey] : defaultValue;
75 input.value = val;
76 value.textContent = val;
77 });
78
79 // Save on change
80 input.addEventListener('input', (e) => {
81 const val = transform(e.target.value);
82 value.textContent = e.target.value;
83 saveOption(storageKey, val, savedId);
84 });
85}
86
87// ============================================================================
88// CHECKBOXES

Callers 1

options.jsFile · 0.85

Calls 1

saveOptionFunction · 0.85

Tested by

no test coverage detected