Added manifest to make it work like a chrome extension.
This commit is contained in:
@@ -17,7 +17,7 @@ body {
|
|||||||
padding-bottom: 35px; }
|
padding-bottom: 35px; }
|
||||||
.main #search-bar {
|
.main #search-bar {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
margin: 0 auto;
|
margin: 0 auto 50px auto;
|
||||||
height: 45px; }
|
height: 45px; }
|
||||||
.main #search-bar input {
|
.main #search-bar input {
|
||||||
height: inherit;
|
height: inherit;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="main" class="main">
|
<div id="main" class="main">
|
||||||
<div id="message">
|
<div id="message">
|
||||||
<h1>Hey Deepjyoti, Good Morning!</h1>
|
<h1 id="message-text">Hey Deepjyoti, Good Morning!</h1>
|
||||||
</div>
|
</div>
|
||||||
<div id="search-bar">
|
<div id="search-bar">
|
||||||
<input id="search-bar-input" placeholder="Search something on Google"></input>
|
<input id="search-bar-input" placeholder="Search something on Google"></input>
|
||||||
@@ -46,8 +46,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- JQuery -->
|
|
||||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
|
||||||
<!--Custom JS-->
|
<!--Custom JS-->
|
||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
15
js/main.js
15
js/main.js
@@ -3,7 +3,7 @@ window.onload = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
searchBarId = "search-bar-input"
|
searchBarId = "search-bar-input"
|
||||||
messageId = "message h1"
|
messageId = "message-text"
|
||||||
userName = "Deepjyoti"
|
userName = "Deepjyoti"
|
||||||
|
|
||||||
function initBody() {
|
function initBody() {
|
||||||
@@ -14,9 +14,9 @@ function initBody() {
|
|||||||
* other things.
|
* other things.
|
||||||
*/
|
*/
|
||||||
// Clear the search bar on load, just in case
|
// Clear the search bar on load, just in case
|
||||||
$("#" + searchBarId).val("")
|
document.getElementById(searchBarId).value = ""
|
||||||
$("#" + searchBarId).on("keypress", (event) => {
|
document.getElementById(searchBarId).addEventListener("keypress", (event) => {
|
||||||
if (event.which != 13) return
|
if (event.key != 'Enter') return
|
||||||
|
|
||||||
// Open google with the search results.
|
// Open google with the search results.
|
||||||
googleSearchUrl = "https://www.google.com/search?q="
|
googleSearchUrl = "https://www.google.com/search?q="
|
||||||
@@ -28,7 +28,8 @@ function initBody() {
|
|||||||
builtMsg = buildMsg()
|
builtMsg = buildMsg()
|
||||||
builtMsg == "" ?
|
builtMsg == "" ?
|
||||||
builtMsg = `Hello ${userName}` : builtMsg = `Hey ${userName}, ${builtMsg}!`
|
builtMsg = `Hello ${userName}` : builtMsg = `Hey ${userName}, ${builtMsg}!`
|
||||||
$("#" + messageId).text(builtMsg)
|
console.log(builtMsg)
|
||||||
|
document.getElementById(messageId).textContent = builtMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildMsg() {
|
function buildMsg() {
|
||||||
@@ -41,7 +42,7 @@ function buildMsg() {
|
|||||||
* 9 - 11:59 : Have a good day ahead
|
* 9 - 11:59 : Have a good day ahead
|
||||||
* 12 - 16:59 : Good Afternoon
|
* 12 - 16:59 : Good Afternoon
|
||||||
* 17 - 19:59 : Good Evening
|
* 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()
|
date = new Date()
|
||||||
currentHour = date.getHours()
|
currentHour = date.getHours()
|
||||||
@@ -59,7 +60,7 @@ function buildMsg() {
|
|||||||
if (inRange(currentTime, 17, 19.59))
|
if (inRange(currentTime, 17, 19.59))
|
||||||
return "Good Evening"
|
return "Good Evening"
|
||||||
if (inRange(currentTime, 20, 24))
|
if (inRange(currentTime, 20, 24))
|
||||||
return "Get away from the computer"
|
return "It's time to wrap up for the day"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
18
manifest.json
Normal file
18
manifest.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ body {
|
|||||||
|
|
||||||
#search-bar {
|
#search-bar {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
margin: 0 auto;
|
margin: 0 auto 50px auto;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
|||||||
Reference in New Issue
Block a user