OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 document.documentElement.className = "js"; | 3 document.documentElement.className = "js"; |
4 | 4 |
5 var visibleTab; | 5 var visibleTab; |
6 var container = document.getElementById("more-container"); | 6 var container = document.getElementById("more-container"); |
7 | 7 |
8 window.toggleMore = function() | 8 window.toggleMore = function() |
9 { | 9 { |
10 if (container.className == "hidden") | 10 if (container.className == "hidden") |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 function getDefaultTab() | 23 function getDefaultTab() |
24 { | 24 { |
25 var content = document.getElementById("content"); | 25 var content = document.getElementById("content"); |
26 var ua = content.className.match(/ua\-([^\s]+)/); | 26 var ua = content.className.match(/ua\-([^\s]+)/); |
27 visibleTab = ua && ua[1] || "firefox"; | 27 visibleTab = ua && ua[1] || "firefox"; |
28 return visibleTab; | 28 return visibleTab; |
29 } | 29 } |
30 | 30 |
31 // Change overlay icon on #video to play icon | |
32 document | |
33 .getElementById("video-play") | |
34 .setAttribute("src", "/img/video-play.png"); | |
35 | |
36 // Save time user clicked to show video disclaimer | |
37 var timeClickedVideo; | |
38 | |
39 function changeImageToVideo(event) | |
40 { | |
41 event.preventDefault(); | |
42 | |
43 var videoContainer = document.getElementById("video-container"); | |
44 | |
45 if (videoContainer.className == "show-disclaimer") | |
46 { | |
47 // Enfore 600ms delay | |
48 var currentTime = new Date().getTime(); | |
49 if (currentTime - timeClickedVideo < 600) return; | |
50 | |
51 var image = this; | |
52 | |
53 var video = document.createElement("iframe"); | |
54 video.id = "video"; | |
55 video.setAttribute("frameborder", "0"); | |
56 video.setAttribute("height", "285"); | |
57 video.setAttribute("width", "520"); | |
58 video.setAttribute("itemprop", "video"); | |
59 video.setAttribute("allowfullscreen", "allowfullscreen"); | |
60 video.setAttribute("src", image.getAttribute("href")); | |
61 | |
62 image.parentNode.replaceChild(video, image); | |
63 | |
64 videoContainer.className = ""; | |
65 } | |
66 else | |
67 { | |
68 videoContainer.className = "show-disclaimer"; | |
69 timeClickedVideo = new Date().getTime(); | |
70 } | |
71 } | |
72 | |
73 document | |
74 .getElementById("video") | |
75 .addEventListener("click", changeImageToVideo); | |
76 | |
77 })(); | 31 })(); |
OLD | NEW |