diff --git a/src/components/Dropdown.astro b/src/components/Dropdown.astro index 2ea995a..0f79859 100644 --- a/src/components/Dropdown.astro +++ b/src/components/Dropdown.astro @@ -1,5 +1,4 @@ --- -// TODO: Add Props to make this component more dynamic!! const { buttonNameDefault, dropdownList, id } = Astro.props; --- diff --git a/src/components/Input.astro b/src/components/Input.astro index 37083ee..3adabe7 100644 --- a/src/components/Input.astro +++ b/src/components/Input.astro @@ -1,7 +1,29 @@ --- -const { type } = Astro.props; +const { type, inputName, defaultTextContent } = Astro.props; +// as any should not be necessary here... but it is womp womp. +interface Props { + type?: string; + inputName: string; + defaultTextContent?: string; +} ---
- -
\ No newline at end of file + + + + \ No newline at end of file diff --git a/src/components/SettingsTablist.astro b/src/components/SettingsTablist.astro index df949fd..d4d0324 100644 --- a/src/components/SettingsTablist.astro +++ b/src/components/SettingsTablist.astro @@ -21,7 +21,7 @@ import Input from "./Input.astro";

Bare URL

- +
@@ -140,7 +140,7 @@ import Input from "./Input.astro"; } } - function applyEventListeners(item, dropdownID, localStorageItem) { + function applyDropdownEventListeners(item, dropdownID, localStorageItem) { Array.from(item.children).forEach((item) => { item.addEventListener('click', () => { localStorage.setItem(localStorageItem, item.dataset.setting) @@ -154,7 +154,7 @@ import Input from "./Input.astro"; loadContent('setting-tab-proxy') - function setLocalStorageItem(event) { + function setupSettings(event) { if (event.detail == "setting-tab-proxy") { applySavedLocalStorage('selectedProxy', 'dropdown__selected-proxy'); applySavedLocalStorage('selectedSearchEngine', 'dropdown__search-engine'); @@ -162,15 +162,23 @@ import Input from "./Input.astro"; let selectedProxyDropdown = document.getElementById('dropdown__selected-proxy-menu') let searchEngineDropdown = document.getElementById('dropdown__search-engine-menu') let openWithDropdown = document.getElementById('dropdown__open-with-menu') - applyEventListeners(searchEngineDropdown, 'dropdown__search-engine', 'selectedSearchEngine'); - applyEventListeners(selectedProxyDropdown, 'dropdown__selected-proxy', 'selectedProxy'); - applyEventListeners(openWithDropdown, 'dropdown__open-with', 'selectedOpenWith'); - + let bareUrlInput = document.getElementById('bare-url-input') + bareUrlInput.addEventListener('change', () => { + localStorage.setItem('bareUrl', bareUrlInput.value) + }) + applyDropdownEventListeners(searchEngineDropdown, 'dropdown__search-engine', 'selectedSearchEngine'); + applyDropdownEventListeners(selectedProxyDropdown, 'dropdown__selected-proxy', 'selectedProxy'); + applyDropdownEventListeners(openWithDropdown, 'dropdown__open-with', 'selectedOpenWith'); + if (localStorage.getItem('bareUrl')) { + bareUrlInput.value = localStorage.getItem('bareUrl') + } else { + bareUrlInput.value = '/bare/' + } } } - document.addEventListener('setting-tabLoad', setLocalStorageItem) + document.addEventListener('setting-tabLoad', setupSettings)