diff options
author | Jose Antonio Marquez | 2012-06-22 16:21:25 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-22 16:21:25 -0700 |
commit | 7fd53b9676f51c60c139a9b48b0256184883191a (patch) | |
tree | 22985c8362329c2a3b9aeb2be49c1b84817ce7d6 /node_modules/montage-google/youtube-channel.reel | |
parent | d6360c39f6cd90dd5e9a1d5ef5bd5211641dad42 (diff) | |
parent | f5b8f2cc5f2b7e9cff892d7487ce56019bf66d4c (diff) | |
download | ninja-7fd53b9676f51c60c139a9b48b0256184883191a.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into FileIO
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 | ||