Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <link href='http://fonts.googleapis.com/css?family=Roboto:400,100' rel='stylesheet' type='text/css'/>
- <link href='https://fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet' type='text/css'>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
- <link href="style.css" rel="stylesheet"/>
- <title>New Tab</title>
- </head>
- <body>
- <script>
- $(window).bind('keydown', function(event) {
- if (event.ctrlKey || event.metaKey) {
- switch (String.fromCharCode(event.which).toLowerCase()) {
- case 'r':
- event.preventDefault();
- window.location = "../writer/index.html"
- break;
- }
- }
- });
- </script>
- <style>
- html, body, div, span {
- margin: 0;
- padding: 0;
- border: 0;
- }
- body {
- background-color: #fafafa;
- font-family: "Roboto", sans-serif;
- background-image: url("bg.png");
- }
- #searchbar-container {
- width: 100%;
- height: 5vh;
- margin-top: 2vh;
- /*
- -webkit-box-shadow: 0px 4px 5px 0px rgba(0,0,0,0.25);
- -moz-box-shadow: 0px 4px 5px 0px rgba(0,0,0,0.25);
- box-shadow: 0px 4px 5px 0px rgba(0,0,0,0.25);
- */
- text-align: center;
- cursor: text;
- }
- #searchbar {
- /* a lot of the weird stuff here is for centering */
- border: none;
- margin-left: auto;
- margin-right: auto;
- height: 4vh;
- min-height: 50px;
- position: relative;
- top: 50%;
- transform: translateX(-50%);
- transform: translateY(-50%);
- font-size: 18pt;
- color: rgba(70, 80, 95, 1);
- color: mediumseagreen;
- border-bottom: 2px solid mediumseagreen;
- opacity: 0.5;
- background-color: rgba(0, 0, 0, 0);
- -webkit-transition: width .1s ease;
- width: 0px;
- opacity: 0;
- }
- ::selection {
- color: white;
- background-color: mediumseagreen;
- }
- #searchbar:focus {
- width: 30vw;
- outline: none;
- opacity: 1;
- }
- #searchbar:hover {
- opacity: 1;
- }
- #searchbar::-webkit-search-cancel-button{
- display:none;
- }
- ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
- opacity: .25;
- }
- ::-moz-placeholder { /* Firefox 19+ */
- opacity: .25;
- }
- :-ms-input-placeholder { /* IE 10+ */
- opacity: .25;
- }
- :-moz-placeholder { /* Firefox 18- */
- opacity: .25;
- }
- #stripe {
- margin-top: 100px;
- text-align: center;
- }
- #clock {
- color: rgb(50, 60, 75);
- font-weight: 400;
- font-size: 40pt;
- display: inline;
- text-align: center;
- padding: 20px 40px 40px 40px;
- transition: width .1s ease;
- -webkit-transition: width .1s ease;
- }
- #date {
- color: rgba(50, 60, 75, 1);
- font-weight: 400;
- font-size: 12pt;
- }
- .card {
- padding: 20px;
- /*background-color: white;
- -webkit-box-shadow: 0px 1px 4px 0px rgba(0,0,0,0.20);
- -moz-box-shadow: 0px 1px 4px 0px rgba(0,0,0,0.20);
- box-shadow: 0px 1px 4px 0px rgba(0,0,0,0.20);*/
- }
- .cardcolumn {
- width: 150px;
- padding: 20px;
- margin: 0px 20px;
- /*background-color: white;
- -webkit-box-shadow: 0px 1px 4px 0px rgba(0,0,0,0.20);
- -moz-box-shadow: 0px 1px 4px 0px rgba(0,0,0,0.20);
- box-shadow: 0px 1px 4px 0px rgba(0,0,0,0.20);*/
- text-align: center;
- float: left;
- transition: box-shadow .1s ease;
- }
- .cardcolumn:hover {
- /*border-bottom: 3px solid mediumseagreen;*/
- /*-webkit-box-shadow: 0px 1px 7px 0px rgba(0,0,0,0.20);
- -moz-box-shadow: 0px 1px 7px 0px rgba(0,0,0,0.20);
- box-shadow: 0px 1px 7px 0px rgba(0,0,0,0.20);*/
- }
- #cards-holder {
- display: table;
- margin: auto;
- margin-top: 0px;
- }
- li {
- text-align: left;
- margin: 10px;
- list-style:none;
- color: rgb(50, 60, 75);
- }
- a {
- color: rgb(50, 60, 75);
- text-decoration: none;
- transition: color .1s ease;
- }
- a:hover {
- color: mediumseagreen;
- }
- </style>
- <div id="stripe">
- <h1 id="clock" class="card"></h1>
- <br/>
- <span id="date"></span>
- </div>
- <div id="searchbar-container">
- <input type="search" placeholder = "-a -m -w -y" id="searchbar" onsubmit="search()" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" title="press TAB to focus"/>
- </div>
- <div id="cards-holder">
- <div id="music" class="cardcolumn">
- <li>
- <a href="https://play.spotify.com/">spotify</a>
- </li>
- <li>
- <a href="https://www.reddit.com/r/listentothis/">listentothis</a>
- </li>
- <li>
- <a href="http://play.google.com/music/listen?hl=en&u=0#/wmp">google play</a>
- </li>
- </div>
- <div id="reference" class="cardcolumn">
- <li>
- <a href="">current lab</a>
- </li>
- <li>
- <a href="">design doc</a>
- </li>
- <li>
- <a href="">project genesis</a>
- </li>
- </div>
- <div id="aesthetics" class="cardcolumn">
- <li>
- <a href="http://boards.4chan.org/wg/">/wg/</a>
- </li>
- <li>
- <a href="https://unsplash.com/">unsplash</a>
- </li>
- <li>
- <a href="https://design.google.com/">google design</a>
- </li>
- </div>
- <div id="other" class="cardcolumn">
- <li>
- <a href="https://www.google.com/#q=weather" id="temp_curr">it's ??? out</a>
- </li>
- <li>
- <a href="https://www.google.com/#q=weather" id="description">probly okay</a>
- </li>
- <li>
- <a href="https://www.google.com/#q=weather" id="badness">weather here</a>
- </li>
- </div>
- </div>
- <script>
- function startTime() {
- var today = new Date();
- var h = today.getHours();
- //america
- if (h >= 13) {
- h -= 12;
- } else if (h < 1) {
- h += 12;
- }
- var m = today.getMinutes();
- var s = today.getSeconds();
- m = checkTime(m);
- s = checkTime(s);
- document.getElementById('clock').innerHTML =
- h + ":" + m + ":" + s;
- var t = setTimeout(startTime, 500);
- }
- function checkTime(i) {
- if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
- return i;
- }
- startTime();
- //press SHIFT to focus on the search bar
- //modifiers have to be AT THE END
- searchinput = document.getElementById("searchbar");
- if(!!searchinput){
- searchinput.addEventListener("keypress", function(a){
- var key = a.keyCode;
- if(key == 13){
- var query = this.value;
- search(query);
- }
- });
- }
- function search(query) {
- console.log(query)
- var original = query;
- var modifier = query.substr(query.length-2);
- query = query.slice(0, query.length-2);
- switch (modifier) {
- case "-a":
- window.location = "http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=" +
- query.replace(" ", "+");
- break;
- case "-y":
- window.location =
- "https://www.youtube.com/results?search_query=" +
- query.replace(" ", "+");
- break;
- case "-w":
- window.location =
- "https://en.wikipedia.org/w/index.php?search=" +
- query.replace(" ", "%20");
- break;
- case "-m":
- window.location =
- "http://www.wolframalpha.com/input/?i=" +
- query.replace("+", "%2B");
- break;
- default:
- window.location="https://www.google.com/#q=" +
- original.replace(" ", "+");
- }
- }
- $(document).bind('keydown', function(e) {
- if (e.which == 16) {
- document.getElementById("searchbar").focus();
- }
- });
- //weather shamelessly stolen from Austin Kilduff
- var json_url = "http://api.openweathermap.org/data/2.5/weather?q=NewYork,ny&appid=6e131a2916d5d45d8367b72a4675be0a";
- var city;
- var temp_curr;
- var temp_low;
- var temp_high;
- var description;
- var weatherCode;
- var humidity;
- $.when(
- $.getJSON(json_url)
- ).done( function(json_obj) {
- city = json_obj["name"];
- temp_curr = k_to_f(json_obj["main"]["temp"]);
- temp_low = k_to_f(json_obj["main"]["temp_min"]);
- temp_high = k_to_f(json_obj["main"]["temp_max"]);
- description = json_obj["weather"][0]["description"];
- weatherCode = Number(json_obj["weather"][0]["id"]);
- humidity = Number(json_obj["main"]["humidity"])
- insertWeatherInfo();
- }
- );
- function k_to_f(kelvin) {
- return ((9 / 5) * (kelvin - 273) + 32).toFixed(0);
- }
- function insertWeatherInfo() {
- //$("#city").append(city.toLowerCase());
- document.getElementById("description").innerHTML = (description.toLowerCase());
- document.getElementById("temp_curr").innerHTML = ("it's " + temp_curr + "° out");
- $("#temp_low").append("lo " + temp_low + "° /");
- $("#temp_high").append("hi " + temp_high + "°");
- console.log("weather code: " + weatherCode);
- console.log("humidity: " + humidity);
- var disgusting = (weatherCode > 500 && weatherCode < 800);
- if (disgusting || Number(temp_low) < 30 || Number(temp_high) > 95
- || humidity > 75) {
- document.getElementById("badness").innerHTML = ("disgusting");
- } else {
- document.getElementById("badness").innerHTML = ("not bad");
- }
- }
- var monthNames = [
- "January", "February", "March",
- "April", "May", "June", "July",
- "August", "September", "October",
- "November", "December"
- ];
- var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
- var date = new Date();
- var day = date.getDate();
- var weekday = date.getDay();
- var monthIndex = date.getMonth();
- var year = date.getFullYear();
- document.getElementById("date").innerHTML = days[weekday] + ", " + monthNames[monthIndex] + " " + day;
- $("#searchbar-container").click(function() {
- $("#searchbar").focus();
- })
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment