Created
March 16, 2015 19:54
-
-
Save potch/c0e7093e02d388c11459 to your computer and use it in GitHub Desktop.
newt abs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> | |
| <title>New Tab</title> | |
| <style> | |
| html, body { | |
| height: 100%; | |
| } | |
| * { | |
| margin: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: sans-serif; | |
| font-size: 4vmax; | |
| margin: 0; | |
| color: #000; | |
| overflow: hidden; | |
| text-shadow: 0 0 .2em #fff, 0 0 .2em #fff, 0 0 .2em #fff; | |
| } | |
| .time { | |
| position: absolute; | |
| top: 30%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| } | |
| .weather { | |
| position: absolute; | |
| top: 1rem; | |
| right: 1.5rem; | |
| color: #333; | |
| } | |
| iframe { | |
| pointer-events: none; | |
| position: absolute; | |
| top: -200px; | |
| left: -10%; | |
| width: 120%; | |
| height: calc(100% + 300px); | |
| opacity: .3; | |
| border: 0; | |
| } | |
| h3 { | |
| position: absolute; | |
| top: 50%; | |
| padding: 0 5%; | |
| width: 100%; | |
| text-align: center; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <iframe src=""></iframe> | |
| <h1 class="time"></h1> | |
| <h4 class="weather"></h4> | |
| <h3>What should you be doing right now?</h3> | |
| <script> | |
| var d = new Date(); | |
| var t = d.getHours() + ':' + ('0' + d.getMinutes()).substr(-2); | |
| document.querySelector('.time').innerHTML = t; | |
| var xhr = new XMLHttpRequest(); | |
| xhr.onload = function () { | |
| document.querySelector('.weather').innerHTML = this.response; | |
| }; | |
| xhr.open('GET', '.weather'); | |
| xhr.send(); | |
| var xhr = new XMLHttpRequest(); | |
| xhr.onload = function () { | |
| var loc = JSON.parse(this.response); | |
| document.querySelector('iframe').src="http://maps.stamen.com/watercolor/#15/" + loc.coordinates[0] + "/" + loc.coordinates[1]; | |
| }; | |
| xhr.open('GET', '.location.json'); | |
| xhr.send(); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment