diff options
author | Kruti Shah | 2012-06-26 09:46:59 -0700 |
---|---|---|
committer | Kruti Shah | 2012-06-26 09:46:59 -0700 |
commit | 4b4a95140d52e191e5e637371dfc369e50e7f9c8 (patch) | |
tree | 274b55f66527a9925032c5d6da4baa6f12be8ada /node_modules/montage-google/youtube-channel.reel | |
parent | 4bf8e4cdc179c3b388fc06f26008808aa4b77eb0 (diff) | |
parent | f0d4d89d856b99da1ca8dd3366c48bb76ba6b1f6 (diff) | |
download | ninja-4b4a95140d52e191e5e637371dfc369e50e7f9c8.tar.gz |
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'node_modules/montage-google/youtube-channel.reel')
-rw-r--r-- | node_modules/montage-google/youtube-channel.reel/youtube-channel.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/node_modules/montage-google/youtube-channel.reel/youtube-channel.js b/node_modules/montage-google/youtube-channel.reel/youtube-channel.js index 782318f0..ca08564b 100644 --- a/node_modules/montage-google/youtube-channel.reel/youtube-channel.js +++ b/node_modules/montage-google/youtube-channel.reel/youtube-channel.js | |||
@@ -10,6 +10,10 @@ var Montage = require("montage").Montage, | |||
10 | 10 | ||
11 | var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | 11 | var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { |
12 | 12 | ||
13 | _savedReference: { | ||
14 | value: null | ||
15 | }, | ||
16 | |||
13 | _userRe: { | 17 | _userRe: { |
14 | value: /youtube.com\/(user\/)?([a-z0-9]+)/i | 18 | value: /youtube.com\/(user\/)?([a-z0-9]+)/i |
15 | }, | 19 | }, |
@@ -113,13 +117,20 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
113 | this.imageC.element.addEventListener("click", this, false); | 117 | this.imageC.element.addEventListener("click", this, false); |
114 | 118 | ||
115 | this._positionPopup(); | 119 | this._positionPopup(); |
120 | |||
121 | this._savedReference = this.element; | ||
116 | } | 122 | } |
117 | }, | 123 | }, |
118 | 124 | ||
119 | draw: { | 125 | draw: { |
120 | value: function() { | 126 | value: function() { |
121 | if (this._script) { | 127 | if (this._script) { |
122 | this._element.appendChild(this._script); | 128 | if(this.element.childNodes.length < 1) { |
129 | this._savedReference.appendChild(this._script); | ||
130 | } else { | ||
131 | this.element.appendChild(this._script); | ||
132 | } | ||
133 | |||
123 | this._script = null; | 134 | this._script = null; |
124 | } | 135 | } |
125 | 136 | ||
@@ -134,16 +145,17 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
134 | this._videoId = null; | 145 | this._videoId = null; |
135 | } | 146 | } |
136 | 147 | ||
148 | var self = this; | ||
149 | |||
137 | if (this._shouldShowPopup) { | 150 | if (this._shouldShowPopup) { |
138 | this._positionPopup(); | 151 | this._positionPopup(); |
139 | 152 | ||
140 | // Need the video to be on top | 153 | // Need the video to be on top |
141 | this._element.style.zIndex = 9000; | 154 | this.element.style.zIndex = 9000; |
142 | 155 | ||
143 | // Fix for Canary where the thumbnail in the video doesn't | 156 | // Fix for Canary where the thumbnail in the video doesn't |
144 | // change until the CSS transition has finished, so wait for | 157 | // change until the CSS transition has finished, so wait for |
145 | // it to change before starting the animation | 158 | // it to change before starting the animation |
146 | var self = this; | ||
147 | window.setTimeout(function() { | 159 | window.setTimeout(function() { |
148 | self._element.classList.add("show"); | 160 | self._element.classList.add("show"); |
149 | self._popupElement.classList.add("show"); | 161 | self._popupElement.classList.add("show"); |
@@ -155,7 +167,7 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
155 | document.addEventListener('keyup', this, false); | 167 | document.addEventListener('keyup', this, false); |
156 | } | 168 | } |
157 | } else { | 169 | } else { |
158 | this._element.classList.remove("show"); | 170 | this.element.classList.remove("show"); |
159 | this._popupElement.classList.remove("show"); | 171 | this._popupElement.classList.remove("show"); |
160 | this.player.stop(); | 172 | this.player.stop(); |
161 | 173 | ||
@@ -168,7 +180,7 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | |||
168 | 180 | ||
169 | // take the video from the top only once it's stopped animating | 181 | // take the video from the top only once it's stopped animating |
170 | window.setTimeout(function() { | 182 | window.setTimeout(function() { |
171 | this._element.style.zIndex = null; | 183 | self.element.style.zIndex = null; |
172 | }, 500); | 184 | }, 500); |
173 | } | 185 | } |
174 | 186 | ||