Left: | ||
Right: |
OLD | NEW |
---|---|
1 (function() | 1 (function() |
2 { | 2 { |
3 document.documentElement.className = "js"; | |
4 | |
3 var visibleTab; | 5 var visibleTab; |
4 var container = document.getElementById("more-container"); | 6 var container = document.getElementById("more-container"); |
5 | 7 |
6 window.toggleMore = function() | 8 window.toggleMore = function() |
7 { | 9 { |
8 if (container.className == "hidden") | 10 if (container.className == "hidden") |
9 container.className = visibleTab || getDefaultTab(); | 11 container.className = visibleTab || getDefaultTab(); |
10 else | 12 else |
11 container.className = "hidden"; | 13 container.className = "hidden"; |
12 } | 14 } |
13 | 15 |
14 window.showTab = function(button) | 16 window.showTab = function(button) |
15 { | 17 { |
16 var id = button.id.substr(5); | 18 var id = button.id.substr(5); |
17 container.className = id; | 19 container.className = id; |
18 visibleTab = id; | 20 visibleTab = id; |
19 } | 21 } |
20 | 22 |
21 function getDefaultTab() | 23 function getDefaultTab() |
22 { | 24 { |
23 var content = document.getElementById("content"); | 25 var content = document.getElementById("content"); |
24 var ua = content.className.match(/ua\-([^\s]+)/); | 26 var ua = content.className.match(/ua\-([^\s]+)/); |
25 visibleTab = ua && ua[1] || "firefox"; | 27 visibleTab = ua && ua[1] || "firefox"; |
26 return visibleTab; | 28 return visibleTab; |
27 } | 29 } |
30 | |
31 // Change overlay icon on #video to play icon | |
ire
2017/10/12 19:48:25
I thought it would make more sense to change the u
juliandoucette
2017/10/13 12:20:11
Acknowledged.
| |
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 | |
28 })(); | 77 })(); |
OLD | NEW |