/xml/relaxng/testData/highlighting/Html5.xml

https://bitbucket.org/nbargnesi/idea · XML · 100 lines · 88 code · 11 blank · 1 comment · 0 complexity · e3906183ccee313385e18904ea358c34 MD5 · raw file

  1. <html xmlns="http://www.w3.org/1999/xhtml/html5">
  2. <head>
  3. <meta charset="utf-8"/>
  4. <meta name="viewport" content="width=620"/>
  5. <title>HTML5 Demo: Video</title>
  6. <!--<link rel="stylesheet" href="/css/html5demos.css" type="text/css">-->
  7. <!--<script src="/js/h5utils.js"></script>--></head><body>
  8. <section id="wrapper">
  9. <header>
  10. <h1>Video &copy;</h1>
  11. </header>
  12. <article>
  13. <video tabindex="0">
  14. <source src="assets/dizzy.mp4"/>
  15. <source src="assets/dizzy.ogv"/>
  16. </video>
  17. <p id="controls">
  18. <input id="play" value="play" type="button"/>
  19. <span id="position">00:00</span> / <span id="duration">loading...</span>
  20. </p>
  21. <p>Note that (at time of writing) <a href="http://webkit.org/" title="The WebKit Open Source Project">Webkit nightly</a> supports full screen mode, which will add a button above.</p>
  22. </article>
  23. <script>
  24. var video = document.querySelector('video'),
  25. togglePlay = document.querySelector('#play'),
  26. position = document.querySelector('#position'),
  27. ready = false,
  28. controls = document.querySelector('#controls'),
  29. fullscreen = null;
  30. addEvent(togglePlay, 'click', function () {
  31. if (ready) {
  32. video.playbackRate = 0.5;
  33. if (video.paused) {
  34. if (video.ended) video.currentTime = 0;
  35. video.play();
  36. this.value = "pause";
  37. } else {
  38. video.pause();
  39. this.value = "play";
  40. }
  41. }
  42. });
  43. addEvent(video, 'timeupdate', function () {
  44. position.innerHTML = asTime(this.currentTime);
  45. });
  46. addEvent(video, 'ended', function () {
  47. togglePlay.value = "play";
  48. });
  49. addEvent(video, 'canplay', function () {
  50. video.muted = true;
  51. ready = true;
  52. document.querySelector('#duration').innerHTML = asTime(this.duration);
  53. // note: .webkitSupportsFullscreen is false while the video is loading, so we bind in to the canplay event
  54. if (video.webkitSupportsFullscreen) {
  55. fullscreen = document.createElement('input');
  56. fullscreen.setAttribute('type', 'button');
  57. fullscreen.setAttribute('value', 'fullscreen');
  58. controls.insertBefore(fullscreen, controls.firstChild);
  59. addEvent(fullscreen, 'click', function () {
  60. video.webkitEnterFullScreen();
  61. });
  62. }
  63. });
  64. function asTime(t) {
  65. t = Math.round(t);
  66. var s = t % 60;
  67. var m = Math.round(t / 60);
  68. return two(m) + ':' + two(s);
  69. }
  70. function two(s) {
  71. s += "";
  72. if (s.length == 2) s = "0" + s;
  73. return s;
  74. }
  75. </script>
  76. <footer><a href="/">HTML5 demos</a>/<a id="built" href="http://twitter.com/rem">@rem built this</a>/</footer>
  77. </section>
  78. <a href="http://github.com/remy/html5demos"><img style="position: absolute; top: 0pt; left: 0pt; border: 0pt none;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub"/></a>
  79. <script>
  80. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  81. document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  82. </script><script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
  83. <script>
  84. try {
  85. var pageTracker = _gat._getTracker("UA-1656750-18");
  86. pageTracker._trackPageview();
  87. } catch(err) {}</script>
  88. </body>
  89. </html>