Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 (function() | 3 (function() |
4 { | 4 { |
5 function initLanguageSelection() | 5 function initLanguageSelection() |
6 { | 6 { |
7 var locale = document.getElementById("navbar-locale-selected"); | 7 var locale = document.getElementById("navbar-locale-selected"); |
8 | 8 |
9 // skip if page does not have language selection (EG: blog) | 9 // skip if page does not have language selection (EG: blog) |
10 if (!locale) return; | 10 if (!locale) return; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 { | 95 { |
96 event.preventDefault(); | 96 event.preventDefault(); |
97 | 97 |
98 if (this.parent.classList.contains("hide-disclaimer")) | 98 if (this.parent.classList.contains("hide-disclaimer")) |
99 this.toggleDisclaimer(); | 99 this.toggleDisclaimer(); |
100 //prevent bypassing the disclaimer via double click | 100 //prevent bypassing the disclaimer via double click |
101 else if (new Date().getTime() - this.lastClicked > 600) | 101 else if (new Date().getTime() - this.lastClicked > 600) |
102 this.insertVideo(); | 102 this.insertVideo(); |
103 }, | 103 }, |
104 | 104 |
105 /** Toggle video disclaimer */ | |
ire
2018/02/26 18:33:18
NIT: Unnecessary comment, the function title toggl
juliandoucette
2018/02/27 13:10:39
Agreed.
| |
106 toggleDisclaimer: function() | 105 toggleDisclaimer: function() |
107 { | 106 { |
108 this.parent.classList.toggle("hide-disclaimer"); | 107 this.parent.classList.toggle("hide-disclaimer"); |
109 this.lastClicked = new Date().getTime(); | 108 this.lastClicked = new Date().getTime(); |
110 }, | 109 }, |
111 | 110 |
112 /** Replace video thumbnail with video iframe */ | 111 /** Replace video thumbnail with video iframe */ |
113 insertVideo: function() | 112 insertVideo: function() |
114 { | 113 { |
115 this.parent.classList.add("hide-disclaimer"); | 114 this.parent.classList.add("hide-disclaimer"); |
116 this.parent.classList.add("has-iframe"); | 115 this.parent.classList.add("has-iframe"); |
117 | 116 |
118 //replace static thumbnail with iframe video | 117 //replace static thumbnail with iframe video |
119 this.parent.innerHTML = | 118 this.parent.innerHTML = |
120 "<iframe " + | 119 "<iframe " + |
121 "class='video-iframe' " + | 120 "class='video-iframe' " + |
122 "frameborder=0 " + | 121 "frameborder=0 " + |
123 "allowfullscreen " + | 122 "allowfullscreen " + |
124 "src='" + this.src + "'>" + | 123 "src='" + encodeURI(this.src) + "'>" + |
125 "</iframe>"; | 124 "</iframe>"; |
126 } | 125 } |
127 }; | 126 }; |
128 | 127 |
129 window.videos = [].slice.call(document.querySelectorAll(".video-parent")) | 128 window.videos = [].slice.call(document.querySelectorAll(".video-parent")) |
130 .map(function(parent) {return new Video(parent);}); | 129 .map(function(parent) {return new Video(parent);}); |
131 }()); | 130 }()); |
LEFT | RIGHT |