Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.21 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Idiot</title>
  6.  
  7. <!--
  8. Original Flash Movie: http://youareanidiot.org/
  9. Audio from http://shane-o.com/sound-drops/163-idiot-drop
  10. This implementation: Rodney Rehm - http://rodneyrehm.de/en/
  11. -->
  12.  
  13. <style>
  14. body {
  15. margin: 0;
  16. padding: 0;
  17. font-family: Comic Sans;
  18. font-weight: bold;
  19. font-size: 16px;
  20. color: #CCC;
  21. background: white;
  22. -webkit-transition: background-color 0.05s ease-in 0s,
  23. color 0.05s ease-in 0s;
  24. transition: background-color 0.05s ease-in 0s,
  25. color 0.05s ease-in 0s;
  26. }
  27.  
  28. .browser-fail .happy {
  29. display: none;
  30. }
  31.  
  32. .no-track {
  33. color: black;
  34. }
  35.  
  36. #idiot-text,
  37. #idiot-face {
  38. display: block;
  39. padding: 1em;
  40. text-align: center;
  41. font-size: 4em;
  42. }
  43.  
  44. #idiot-text span {
  45. white-space: nowrap;
  46. }
  47.  
  48. #idiot-face {
  49. padding: 0;
  50. font-size: 10em;
  51. color: black;
  52. }
  53.  
  54. .visited {
  55. color: #666;
  56. }
  57.  
  58. .active {
  59. color: #336699;
  60. }
  61.  
  62. .inverted {
  63. background: black;
  64. color: #333;
  65. }
  66.  
  67. .inverted.no-track {
  68. color: white;
  69. }
  70.  
  71. .inverted .visited {
  72. color: #AAA;
  73. }
  74.  
  75. .inverted .active {
  76. color: #6699CC;
  77. }
  78.  
  79. .inverted #idiot-face {
  80. color: white;
  81. }
  82.  
  83. @media only screen and (min-width: 1000px) {
  84. body {
  85. width: 1000px;
  86. margin: 0 auto;
  87. }
  88. }
  89.  
  90. @media only screen and (max-width: 400px) {
  91. body {
  92. font-size: 10px;
  93. }
  94. }
  95. </style>
  96. </head>
  97. <body>
  98.  
  99. <output id="idiot-text">
  100. <span id ="idiot-cue-1">you</span>
  101. <span id ="idiot-cue-2">are</span>
  102. <span id ="idiot-cue-3">an</span>
  103. <span id ="idiot-cue-4">idiot</span>
  104. <span id ="idiot-cue-5">ah</span>
  105. <span id ="idiot-cue-6">haha</span>
  106. <span id ="idiot-cue-7">ha ha ha</span>
  107. <span id ="idiot-cue-8">aha ha</span>
  108. <span id ="idiot-cue-9">ha ha</span>
  109. <span id ="idiot-cue-10">ha</span>
  110. </output>
  111.  
  112. <output id="idiot-face">
  113. <span class="smiley happy">☺</span>
  114. <span class="smiley sad">☹</span>
  115. <span class="smiley happy">☺</span>
  116. </output>
  117.  
  118. <audio id="idiot-audio" volume="0.2" auto-play="off" lo-op="true">
  119. <source src="audio/idiot.mp3" type="audio/mp3">
  120. <source src="audio/idiot.ogg" type="audio/ogg">
  121. <source src="audio/idiot.wav" type="audio/wav">
  122. </audio>
  123.  
  124. <script>
  125. (function() {
  126. "use strict";
  127.  
  128. var output = document.getElementById('idiot-text');
  129. var audio = document.getElementById('idiot-audio');
  130.  
  131. if (!window.Audio) {
  132. output.innerHTML = 'Your Browser Is An Idiot!';
  133. document.body.className = 'browser-fail';
  134. console.error('Audio not supported');
  135. return;
  136. }
  137.  
  138. if (Audio.prototype.addTextTrack) {
  139. var track = audio.addTextTrack('metadata');
  140. var cues = [
  141. {start: 0.040, stop: 0.474, id: 'idiot-cue-1', text: "you"},
  142. {start: 0.580, stop: 0.860, id: 'idiot-cue-2', text: "are"},
  143. {start: 0.860, stop: 1.013, id: 'idiot-cue-3', text: "an"},
  144. {start: 1.069, stop: 1.672, id: 'idiot-cue-4', text: "idiot"},
  145. {start: 1.945, stop: 2.112, id: 'idiot-cue-5', text: "ah"},
  146. {start: 2.234, stop: 2.566, id: 'idiot-cue-6', text: "haha"},
  147. {start: 2.593, stop: 3.131, id: 'idiot-cue-7', text: "ha ha ha"},
  148. {start: 3.207, stop: 3.802, id: 'idiot-cue-8', text: "aha ha"},
  149. {start: 3.871, stop: 4.397, id: 'idiot-cue-9', text: "ha ha"},
  150. {start: 4.494, stop: 4.883, id: 'idiot-cue-10', text: "ha"}
  151. ];
  152.  
  153. cues.forEach(function(cue) {
  154. track.addCue(new TextTrackCue(cue.start, cue.stop, cue.id));
  155. });
  156.  
  157. track.addEventListener('cuechange', function(event) {
  158. if (!track.activeCues.length) {
  159. return;
  160. }
  161.  
  162. // TODO: improve this
  163. [].forEach.call(output.querySelectorAll('.active'), function(node) {
  164. node.classList.remove('active');
  165. });
  166.  
  167. var id = track.activeCues[0].text;
  168. document.getElementById(id).className = 'visited active';
  169. document.body.offsetTop;
  170. });
  171. } else {
  172. document.body.classList.add('no-track');
  173. console.error('Audio.prototype.addTextTrack() not supported');
  174. }
  175.  
  176. audio.addEventListener('play', function(event) {
  177. [].forEach.call(output.childNodes, function(node) {
  178. node.className = '';
  179. });
  180. });
  181.  
  182. // loop prevents ended event (in Chrome), but wee need something to reset the canvas
  183. // audio.loop = true;
  184. audio.addEventListener('ended', function(event) {
  185. setTimeout(function() {
  186. audio.currentTime = 0;
  187. audio.play();
  188. }, 200);
  189. });
  190.  
  191. document.addEventListener('keydown', toggle);
  192. document.addEventListener('touchend', toggle);
  193. document.addEventListener('mouseup', toggle);
  194.  
  195. function toggle(event) {
  196. if (event.type === 'keydown' && event.keyCode != 32) {
  197. return;
  198. }
  199.  
  200. event.preventDefault();
  201. event.stopPropagation();
  202.  
  203. audio[audio.paused ? 'play' : 'pause']();
  204. }
  205.  
  206. function invertBackground() {
  207. if (!audio.paused) {
  208. document.body.classList.toggle('inverted');
  209. }
  210.  
  211. return setTimeout(invertBackground, 500);
  212. }
  213.  
  214. audio.play();
  215. invertBackground();
  216.  
  217. })();
  218. </script>
  219.  
  220. <script>
  221. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  222. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  223. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  224. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  225.  
  226. ga('create', 'UA-8922143-5', 'rodneyrehm.github.io');
  227. ga('send', 'pageview');
  228.  
  229. </script>
  230. </body>
  231. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement