diff --git a/config.json b/config.json index 581ee64..730ea8e 100644 --- a/config.json +++ b/config.json @@ -29,13 +29,7 @@ ] } ], - "searchEngines":{ - "Google":"https://www.google.com/search?q=", - "DuckDuckGo":"https://duckduckgo.com/?q=", - "Bing":"https://www.bing.com/search?q=", - "Yahoo":"https://search.yahoo.com/search?p=" - }, - "searchEngine":"Google", + "searchEngine":"Yahoo", "user": "Deepjyoti", "disableMessage": false, "disableDate": false, diff --git a/js/main.js b/js/main.js index 7554448..e5fa33d 100644 --- a/js/main.js +++ b/js/main.js @@ -36,6 +36,13 @@ dateMap = { 11: "Dec" } +searchEngines = { + "Google": "https://www.google.com/search?q=", + "DuckDuckGo": "https://duckduckgo.com/?q=", + "Bing": "https://www.bing.com/search?q=", + "Yahoo": "https://search.yahoo.com/search?p=" +} + function initBody() { /** * Function called when the body is loaded. @@ -52,10 +59,10 @@ function initSearchBar(jsonData) { document.getElementById(searchBarId).value = "" document.getElementById(searchBarId).focus() searchEngine = jsonData["searchEngine"] - if(!Object.keys(jsonData["searchEngines"]).includes(searchEngine)){ + if(!Object.keys(this.searchEngines).includes(searchEngine)){ searchEngine = "Google" } - searchUrl = jsonData["searchEngines"][searchEngine] + searchUrl = this.searchEngines[searchEngine] document.getElementById(searchBarId).placeholder = `Search something on ${searchEngine}` document.getElementById(searchBarId).addEventListener("keypress", (event) => { if (event.key != 'Enter') return