-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtooltip-render.js
More file actions
32 lines (27 loc) · 984 Bytes
/
tooltip-render.js
File metadata and controls
32 lines (27 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
window.addEventListener('DOMContentLoaded', () => {
const langSelect = document.getElementById('language-select');
const input = document.getElementById('apiKeyInput');
window.electronAPI.setLanguageDropdown((language) => {
console.log('🔵 Setting dropdown to:', language);
if (langSelect) {
langSelect.value = language;
}
});
window.electronAPI.fetchApiKey((savedApiKey) => {
console.log('🔵 Setting api key');
if (input) {
input.value = savedApiKey;
}
});
langSelect.addEventListener('change', (event) => {
const selectedLanguage = event.target.value;
console.log(`Selected language: ${selectedLanguage}`);
window.electronAPI.setLanguage(selectedLanguage);
});
input.addEventListener('input', () => {
const key = input.value.trim();
if (key.length > 10) {
window.electronAPI.sendApiKey(key);
}
});
});