diff --git a/css/main.css b/css/main.css index f6c0faa..9c902d4 100644 --- a/css/main.css +++ b/css/main.css @@ -17,7 +17,7 @@ body { padding-bottom: 35px; } .main #search-bar { width: 50%; - margin: 0 auto; + margin: 0 auto 50px auto; height: 45px; } .main #search-bar input { height: inherit; diff --git a/index.html b/index.html index 3ee89d7..4363368 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@
-

Hey Deepjyoti, Good Morning!

+

Hey Deepjyoti, Good Morning!

- - diff --git a/js/main.js b/js/main.js index d2a93ea..0032c9a 100644 --- a/js/main.js +++ b/js/main.js @@ -3,7 +3,7 @@ window.onload = function() { } searchBarId = "search-bar-input" -messageId = "message h1" +messageId = "message-text" userName = "Deepjyoti" function initBody() { @@ -14,9 +14,9 @@ function initBody() { * other things. */ // Clear the search bar on load, just in case - $("#" + searchBarId).val("") - $("#" + searchBarId).on("keypress", (event) => { - if (event.which != 13) return + document.getElementById(searchBarId).value = "" + document.getElementById(searchBarId).addEventListener("keypress", (event) => { + if (event.key != 'Enter') return // Open google with the search results. googleSearchUrl = "https://www.google.com/search?q=" @@ -28,7 +28,8 @@ function initBody() { builtMsg = buildMsg() builtMsg == "" ? builtMsg = `Hello ${userName}` : builtMsg = `Hey ${userName}, ${builtMsg}!` - $("#" + messageId).text(builtMsg) + console.log(builtMsg) + document.getElementById(messageId).textContent = builtMsg } function buildMsg() { @@ -41,7 +42,7 @@ function buildMsg() { * 9 - 11:59 : Have a good day ahead * 12 - 16:59 : Good Afternoon * 17 - 19:59 : Good Evening - * 20 - 23:59 : Get away from the computer + * 20 - 23:59 : It's time to wrap up for the day */ date = new Date() currentHour = date.getHours() @@ -59,7 +60,7 @@ function buildMsg() { if (inRange(currentTime, 17, 19.59)) return "Good Evening" if (inRange(currentTime, 20, 24)) - return "Get away from the computer" + return "It's time to wrap up for the day" else return "" } diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..5072d5b --- /dev/null +++ b/manifest.json @@ -0,0 +1,18 @@ +{ + "manifest_version": 2, + "name": "minimal-startpage", + "short_name": "minimal-startpage", + "version": "1.0", + "description": "Overrides the browsers newtab page with a custom startpage.", + "author": "deepjyoti30", + + "icons": { + "48": "img/icon48.png", + "96": "img/icon96.png", + "128": "img/icon128.png", + "192": "img/icon192.png" + }, + "chrome_url_overrides": { + "newtab": "index.html" + } +} diff --git a/scss/main.scss b/scss/main.scss index fec59c2..92413c9 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -30,7 +30,7 @@ body { #search-bar { width: 50%; - margin: 0 auto; + margin: 0 auto 50px auto; height: 45px; input {