mirror of
https://github.com/Rushilwiz/newtab.git
synced 2025-04-09 15:00:18 -04:00
init commit
This commit is contained in:
commit
2700f85fc8
BIN
RobotoMono.ttf
Normal file
BIN
RobotoMono.ttf
Normal file
Binary file not shown.
66
main.js
Normal file
66
main.js
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
|
||||||
|
|
||||||
|
// Search on enter key event
|
||||||
|
function search(e) {
|
||||||
|
if (e.keyCode == 13) {
|
||||||
|
var val = document.getElementById("search-field").value;
|
||||||
|
window.open("https://google.com/search?q=" + val, "_self");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Get current time and format
|
||||||
|
function getTime() {
|
||||||
|
let date = new Date(),
|
||||||
|
min = date.getMinutes(),
|
||||||
|
sec = date.getSeconds(),
|
||||||
|
hour = date.getHours();
|
||||||
|
|
||||||
|
return "" +
|
||||||
|
(hour < 10 ? ("0" + hour) : hour) + ":" +
|
||||||
|
(min < 10 ? ("0" + min) : min) + ":" +
|
||||||
|
(sec < 10 ? ("0" + sec) : sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = () => {
|
||||||
|
//randomize background color
|
||||||
|
let colors = ["#E0BBE4","#957DAD","#D291BC",
|
||||||
|
"#FEC8D8","#FF9AA2","#FFB7B2",
|
||||||
|
"#FFDAC1","#32F0CB","#B5EAD7","#C7CEEA"]
|
||||||
|
document.getElementsByTagName("body")[0].style.background = colors[Math.floor(Math.random() * 10)];
|
||||||
|
|
||||||
|
//get HTTP request
|
||||||
|
let xhr = new XMLHttpRequest();
|
||||||
|
// Request to open weather map
|
||||||
|
xhr.open('GET', 'http://api.openweathermap.org/data/2.5/weather?id=4744870&units=imperial&appid=e5b292ae2f9dae5f29e11499c2d82ece');
|
||||||
|
xhr.onload = () => {
|
||||||
|
if (xhr.readyState === 4) {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
let json = JSON.parse(xhr.responseText);
|
||||||
|
console.log(json);
|
||||||
|
document.getElementById("temp").innerHTML = json.main.temp.toFixed(0) + " F";
|
||||||
|
document.getElementById("weather-description").innerHTML = json.weather[0].description;
|
||||||
|
} else {
|
||||||
|
console.log('error msg: ' + xhr.status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send();
|
||||||
|
// Set up the clock
|
||||||
|
document.getElementById("clock").innerHTML = getTime();
|
||||||
|
// Set clock interval to tick clock
|
||||||
|
setInterval( () => {
|
||||||
|
document.getElementById("clock").innerHTML = getTime();
|
||||||
|
},100);
|
||||||
|
|
||||||
|
document.getElementById('search-field').addEventListener('keypress', search);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("keydown", event => {
|
||||||
|
if (event.keyCode == 32) { // Spacebar code to open search
|
||||||
|
document.getElementById('search').style.display = 'flex';
|
||||||
|
document.getElementById('search-field').focus();
|
||||||
|
} else if (event.keyCode == 27) { // Esc to close search
|
||||||
|
document.getElementById('search-field').value = '';
|
||||||
|
document.getElementById('search-field').blur();
|
||||||
|
document.getElementById('search').style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
11
manifest.json
Normal file
11
manifest.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"name": "rushilwiz's newtab",
|
||||||
|
"version": "4.20",
|
||||||
|
"description": "It's my newtab!",
|
||||||
|
"permissions" : ["management"],
|
||||||
|
"chrome_url_overrides" : {
|
||||||
|
"newtab": "newtab.html"
|
||||||
|
},
|
||||||
|
|
||||||
|
"manifest_version": 2
|
||||||
|
}
|
72
newtab.html
Normal file
72
newtab.html
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
|
||||||
|
<title>Home</title>
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
<link href="favicon.png" rel="shortcut icon" type="image/x-icon" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="search">
|
||||||
|
<input id="search-field" type="text" name="search-field"/>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div id="clock"></div>
|
||||||
|
<div class="weather-container">
|
||||||
|
<div class="row">
|
||||||
|
<div id="weather-description"class="inline"></div>
|
||||||
|
<div class="inline">-</div>
|
||||||
|
<div id="temp" class="inline"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bookmark-container">
|
||||||
|
<div class="bookmark-set">
|
||||||
|
<div class="bookmark-title">Daily</div>
|
||||||
|
<div class="bookmark-inner-container">
|
||||||
|
<a class="bookmark" href="https://inbox.google.com/u/0" >Inbox</a>
|
||||||
|
<a class="bookmark" href="https://github.com/" >Github</a>
|
||||||
|
<a class="bookmark" href="https://drive.google.com/u/1" >Drive</a>
|
||||||
|
<a class="bookmark" href="https://ally.com" >Ally</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bookmark-set">
|
||||||
|
<div class="bookmark-title">Media</div>
|
||||||
|
<div class="bookmark-inner-container">
|
||||||
|
<a class="bookmark" href="https://youtube.com" >Youtube</a>
|
||||||
|
<a class="bookmark" href="https://netflix.com" >Netflix</a>
|
||||||
|
<a class="bookmark" href="https://disneyplus.com" >DisneyPlus</a>
|
||||||
|
<a class="bookmark" href="https://open.spotify.com">Spotify</a>
|
||||||
|
<a class="bookmark" href="https://amazon.com/prime" >Amazon Prime</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bookmark-set">
|
||||||
|
<div class="bookmark-title">School</div>
|
||||||
|
<div class="bookmark-inner-container">
|
||||||
|
<a class="bookmark" href="https://mail.google.com/mail/u/1/#inbox" >Email</a>
|
||||||
|
<a class="bookmark" href="https://lms.fcps.edu">Schoology</a>
|
||||||
|
<a class="bookmark" href="https://classroom.google.com/u/1/">Classroom</a>
|
||||||
|
<a class="bookmark" href="https://ion.tjhsst.edu">Ion</a>
|
||||||
|
<a class="bookmark" href="https://drive.google.com/u/1">Drive</a>
|
||||||
|
<a class="bookmark" href="https://docs.google.com/u/1" >Docs</a>
|
||||||
|
<a class="bookmark" href="https://slides.google.com/u/1" >Slides</a>
|
||||||
|
<a class="bookmark" href="https://sheets..google.com/u/1" >Sheets</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bookmark-set">
|
||||||
|
<div class="bookmark-title">Social</div>
|
||||||
|
<div class="bookmark-inner-container">
|
||||||
|
<a class="bookmark" href="https://twitter.com" >Twitter</a>
|
||||||
|
<a class="bookmark" href="https://facebook.com" >Facebook</a>
|
||||||
|
<a class="bookmark" href="https://messenger.com" >Messenger</a>
|
||||||
|
<a class="bookmark" href="https://instagram.com">Insta</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
153
styles.css
Normal file
153
styles.css
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
@font-face {
|
||||||
|
font-family: "Roboto Mono";
|
||||||
|
src: url(RobotoMono.ttf);
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
/*--bg: #5f4b8b;*/
|
||||||
|
--bg: #ffd1dc;
|
||||||
|
--fg: #ffffff;
|
||||||
|
--secondaryFg: #b3b3b3;
|
||||||
|
--containerBg: #272727;
|
||||||
|
--searchBg: var(--containerBg);
|
||||||
|
--scrollbarColor: #3f3f3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
/* background-color: var(--bg); */
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clock {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 3.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
font-family: "Roboto Mono";
|
||||||
|
color: var(--fg);
|
||||||
|
margin-bottom: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#search {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: var(--searchBg);
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#search-field {
|
||||||
|
width: 90%;
|
||||||
|
padding: 0.75em 1em;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: var(--searchBg);
|
||||||
|
border: solid 0px var(--searchBg);
|
||||||
|
font-family: "Roboto Mono";
|
||||||
|
font-size: 4rem;
|
||||||
|
color: var(--fg);
|
||||||
|
outline: none;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-container {
|
||||||
|
width: 30%;
|
||||||
|
background-color: var(--containerBg);
|
||||||
|
padding: 1em;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-family: "Roboto Mono";
|
||||||
|
color: var(--fg);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.inline {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookmark-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
width: 50%;
|
||||||
|
margin: 1em 0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 960px) {
|
||||||
|
.container {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
#clock {
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
.container > .bookmark-container {
|
||||||
|
flex-direction: column;
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
.bookmark-container > .bookmark-set {
|
||||||
|
width: auto;
|
||||||
|
margin: 1em 0em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookmark-set {
|
||||||
|
padding: 1em;
|
||||||
|
background-color: var(--containerBg);
|
||||||
|
border-radius: 3px;
|
||||||
|
font-family: "Roboto Mono";
|
||||||
|
font-size: 0.85rem;
|
||||||
|
width: 25%;
|
||||||
|
height: 12em;
|
||||||
|
margin: 0em 0.5em;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookmark-inner-container {
|
||||||
|
overflow-y: scroll;
|
||||||
|
height: 80%;
|
||||||
|
vertical-align: top;
|
||||||
|
padding-right: 6px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: var(--scrollbarColor) #ffffff00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookmark-inner-container::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
}
|
||||||
|
.bookmark-inner-container::-webkit-scrollbar-track {
|
||||||
|
background: #ffffff00;
|
||||||
|
}
|
||||||
|
.bookmark-inner-container::-webkit-scrollbar-thumb {
|
||||||
|
background-color: var(--scrollbarColor);
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 3px solid #ffffff00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookmark-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--fg);
|
||||||
|
margin: 0em 0em 0.35em 0em;
|
||||||
|
}
|
||||||
|
.bookmark {
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--secondaryFg);
|
||||||
|
display: block;
|
||||||
|
margin: 0.5em 0em;
|
||||||
|
}
|
||||||
|
.bookmark:hover {
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user