Guest User

index.html

a guest
Oct 24th, 2018
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Hello.. Again</title>
  5. <link rel="stylesheet" type="text/css" href="style.css">
  6. </head>
  7. <body background="background.png" style="background-style: cover;">
  8. <div id="search">
  9. <input id="search-field" type="text" name="search-field" onkeypress="return search(event)"></input>
  10. </div>
  11.  
  12. <div id="container">
  13. <h1 id="clock"></h1>
  14.  
  15. <div id="bookmarks">
  16. <a class="bookmark" href="https://www.4chan.org/wg/">/wg/</a>
  17. <a class="bookmark" href="https://www.4chan.org/gif/">/gif/</a>
  18. <a class="bookmark" href="https://www.4chan.org/b/">/b/</a>
  19. <a class="bookmark" href="https://www.4chan.org/s4s/">[s4s]</a>
  20. </div>
  21.  
  22. <div id="links">
  23. <a class="bookmark" href="https://youtube.com/">/yt/</a>
  24. <a class="bookmark" href="https://www.amazon.co.uk/">/am/</a>
  25. <a class="bookmark" href="https://www.papajohns.co.uk">/pj/</a>
  26. <a class="bookmark" href="https://robertsspaceindustries.com/">/rsi/</a>
  27. <a class="bookmark" href="https://www.twitch.tv/reckful">/reckful/</a>
  28. <a class="bookmark" href="https://www.twitch.tv/reckful">/tw/</a>
  29. <a class="bookmark" href="https://www.watch2gether.com/?lang=en">/w2g/</a>
  30. <a class="bookmark" href="https://www.urbandictionary.com">/ud/</a>
  31. <a class="bookmark" href="https://mail.google.com">/gm/</a>
  32. </div>
  33.  
  34. </div>
  35. </body>
  36. <script>
  37. function search(e) {
  38. if (e.keyCode == 13) {
  39. var val = document.getElementById("search-field").value;
  40. window.open("https://google.com/search?q=" + val)
  41. }
  42. }
  43.  
  44. function getTime() {
  45. let date = new Date(),
  46. min = date.getMinutes(),
  47. sec = date.getSeconds(),
  48. hour = date.getHours();
  49.  
  50. return (hour < 10 ? ("0" + hour) : hour) + ":" +
  51. (min < 10 ? ("0" + min) : min) + ":" +
  52. (sec < 10 ? ("0" + sec) : sec);
  53. }
  54. window.onload = () => {
  55. // Set up the clock
  56. document.getElementById("clock").innerHTML = getTime();
  57. // Set clock interval to tick clock
  58. setInterval( () => {
  59. document.getElementById("clock").innerHTML = getTime();
  60. },100);
  61. }
  62. document.addEventListener("keydown", event => {
  63. if (event.keyCode == 32) { // Spacebar code to open search
  64. document.getElementById('search').style.display = 'flex';
  65. document.getElementById('search-field').focus();
  66. }
  67. else if (event.keyCode == 27) { // Esc to close search
  68. document.getElementById('search-field').value = '';
  69. document.getElementById('search-field').blur();
  70. document.getElementById('search').style.display = 'none';
  71. }
  72. });
  73. </script>
  74.  
  75. </html>
Advertisement
Add Comment
Please, Sign In to add comment