Spaces:
Paused
Paused
Download opticparse-extension/options.js from paras9909/opticparse-python: direct link, hf CLI and curl.
- Browser
- Download file 794 Bytes
-
https://huggingface.co/spaces/paras9909/opticparse-python/resolve/main/opticparse-extension/options.js
- Command line
-
hf download hf://spaces/paras9909/opticparse-python/opticparse-extension/options.js
-
curl -L -o options.js https://huggingface.co/spaces/paras9909/opticparse-python/resolve/main/opticparse-extension/options.js
794 Bytes
| // Load saved API key on startup | |
| chrome.storage.sync.get(['apiKey'], (result) => { | |
| if (result.apiKey) { | |
| document.getElementById('apiKey').value = result.apiKey; | |
| } | |
| }); | |
| // Save API key | |
| document.getElementById('saveBtn').addEventListener('click', () => { | |
| const apiKey = document.getElementById('apiKey').value.trim(); | |
| const statusDiv = document.getElementById('status'); | |
| if (!apiKey.startsWith('op_live_')) { | |
| statusDiv.textContent = 'Invalid API key format. Must start with op_live_'; | |
| return; | |
| } | |
| chrome.storage.sync.set({ apiKey: apiKey }, () => { | |
| statusDiv.style.color = '#00ffcc'; | |
| statusDiv.textContent = 'Settings saved successfully!'; | |
| setTimeout(() => { | |
| statusDiv.textContent = ''; | |
| statusDiv.style.color = '#ffaa00'; | |
| }, 3000); | |
| }); | |
| }); | |