diff --git a/src/lib/components/Setup.svelte b/src/lib/components/Setup.svelte index 4f0f4cd..b7dd5c1 100644 --- a/src/lib/components/Setup.svelte +++ b/src/lib/components/Setup.svelte @@ -50,9 +50,9 @@ //load settings from local storage const storedSettings: ISettings = JSON.parse(localStorage.getItem('settings') ?? '{}'); if (storedSettings) { - preferredSearchEngine.set(storedSettings.preferredSearchEngine); - expandAdvancedOptionsByDefault.set(storedSettings.expandAdvancedOptionsByDefault); - expandStatsByDefault.set(storedSettings.expandStatsByDefault); + preferredSearchEngine.set(storedSettings.preferredSearchEngine ?? 'Google'); + expandAdvancedOptionsByDefault.set(storedSettings.expandAdvancedOptionsByDefault ?? false); + expandStatsByDefault.set(storedSettings.expandStatsByDefault ?? true); statUnits.set(storedSettings.statUnits ?? 'Imperial'); inputUnits.set(storedSettings.inputUnits ?? 'Imperial'); theme.set(storedSettings.theme ?? 'dark'); diff --git a/src/lib/utils/searchEngine.ts b/src/lib/utils/searchEngine.ts index f5fd67f..0f40af1 100644 --- a/src/lib/utils/searchEngine.ts +++ b/src/lib/utils/searchEngine.ts @@ -53,12 +53,13 @@ export const performSearch = (searchEngine: string, monitor: IMonitor) => { let searchUrl = ''; //url based on search engine chosen - if (searchEngine === 'Google') searchUrl = 'https://www.google.com/search?q='; if (searchEngine === 'Bing') searchUrl = 'https://www.bing.com/search?q='; - if (searchEngine === 'DuckDuckGo') searchUrl = 'https://www.duckduckgo.com/?q='; - if (searchEngine === 'Amazon') searchUrl = 'https://www.amazon.com/s?k='; - if (searchEngine === 'Newegg') searchUrl = 'https://www.newegg.com/p/pl?d='; - if (searchEngine === 'Best Buy') searchUrl = 'https://www.bestbuy.com/site/searchpage.jsp?st='; + else if (searchEngine === 'DuckDuckGo') searchUrl = 'https://www.duckduckgo.com/?q='; + else if (searchEngine === 'Amazon') searchUrl = 'https://www.amazon.com/s?k='; + else if (searchEngine === 'Newegg') searchUrl = 'https://www.newegg.com/p/pl?d='; + else if (searchEngine === 'Best Buy') + searchUrl = 'https://www.bestbuy.com/site/searchpage.jsp?st='; + else searchUrl = 'https://www.google.com/search?q='; //base search string searchUrl += 'monitor';