diff options
author | Stuart Knightley | 2012-03-21 14:16:55 -0700 |
---|---|---|
committer | Stuart Knightley | 2012-03-21 14:16:55 -0700 |
commit | 7edc0c123f9157d48543b09f5a9d7bb496e14f44 (patch) | |
tree | 54916d017ed55814b632c82067d6bed1ba92d37c /node_modules/montage/ui/youtube-channel.reel/youtube-channel.js | |
parent | 33c557491c23e8dcf802bcd15fa500d03e5f115b (diff) | |
download | ninja-7edc0c123f9157d48543b09f5a9d7bb496e14f44.tar.gz |
Make Youtube video fill the full page
Includes Chrome and Canary code paths for rendering bug fixes
Diffstat (limited to 'node_modules/montage/ui/youtube-channel.reel/youtube-channel.js')
-rw-r--r-- | node_modules/montage/ui/youtube-channel.reel/youtube-channel.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js index ccbd9978..6cd43a3c 100644 --- a/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js +++ b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js | |||
@@ -111,6 +111,8 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
111 | this.imageA.element.addEventListener("click", this, false); | 111 | this.imageA.element.addEventListener("click", this, false); |
112 | this.imageB.element.addEventListener("click", this, false); | 112 | this.imageB.element.addEventListener("click", this, false); |
113 | this.imageC.element.addEventListener("click", this, false); | 113 | this.imageC.element.addEventListener("click", this, false); |
114 | |||
115 | this._positionPopup(); | ||
114 | } | 116 | } |
115 | }, | 117 | }, |
116 | 118 | ||
@@ -133,7 +135,9 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
133 | } | 135 | } |
134 | 136 | ||
135 | if (this._shouldShowPopup) { | 137 | if (this._shouldShowPopup) { |
138 | this._positionPopup(); | ||
136 | this._element.classList.add("show"); | 139 | this._element.classList.add("show"); |
140 | this._popupElement.classList.add("show"); | ||
137 | if (window.Touch) { | 141 | if (window.Touch) { |
138 | document.addEventListener('touchstart', this, false); | 142 | document.addEventListener('touchstart', this, false); |
139 | } else { | 143 | } else { |
@@ -142,6 +146,7 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
142 | } | 146 | } |
143 | } else { | 147 | } else { |
144 | this._element.classList.remove("show"); | 148 | this._element.classList.remove("show"); |
149 | this._popupElement.classList.remove("show"); | ||
145 | this.player.stop(); | 150 | this.player.stop(); |
146 | 151 | ||
147 | if (window.Touch) { | 152 | if (window.Touch) { |
@@ -161,6 +166,26 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
161 | value: null | 166 | value: null |
162 | }, | 167 | }, |
163 | 168 | ||
169 | _positionPopup: { | ||
170 | value: function() { | ||
171 | |||
172 | var viewport = this._element.parentNode; | ||
173 | var viewportStyle = window.getComputedStyle(viewport); | ||
174 | |||
175 | this.player.width = viewportStyle.width; | ||
176 | this.player.height = viewportStyle.height; | ||
177 | |||
178 | // // Chrome | ||
179 | viewport.insertBefore(this._popupElement, viewport.firstChild); | ||
180 | this._popupElement.style.top = viewport.offsetTop; | ||
181 | this._popupElement.style.left = viewport.offsetLeft; | ||
182 | |||
183 | // Canary | ||
184 | // this._popupElement.style.top = - (this._element.offsetTop || 0) + 'px'; | ||
185 | // this._popupElement.style.left = - (this._element.offsetLeft || 0) + 'px'; | ||
186 | } | ||
187 | }, | ||
188 | |||
164 | handleClick: { | 189 | handleClick: { |
165 | value: function(event) { | 190 | value: function(event) { |
166 | switch(event.target.dataset.montageId) { | 191 | switch(event.target.dataset.montageId) { |