From a93ab1f2c5e87931b7f522a8e950a457de668579 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 21 Jun 2012 23:02:33 -0700 Subject: Fixed issue with Youtube not updating after save and Picasa bacground Signed-off-by: Valerio Virgillito --- .../youtube-channel.reel/youtube-channel.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'node_modules/montage-google/youtube-channel.reel') 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, var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { + _savedReference: { + value: null + }, + _userRe: { value: /youtube.com\/(user\/)?([a-z0-9]+)/i }, @@ -113,13 +117,20 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { this.imageC.element.addEventListener("click", this, false); this._positionPopup(); + + this._savedReference = this.element; } }, draw: { value: function() { if (this._script) { - this._element.appendChild(this._script); + if(this.element.childNodes.length < 1) { + this._savedReference.appendChild(this._script); + } else { + this.element.appendChild(this._script); + } + this._script = null; } @@ -134,16 +145,17 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { this._videoId = null; } + var self = this; + if (this._shouldShowPopup) { this._positionPopup(); // Need the video to be on top - this._element.style.zIndex = 9000; + this.element.style.zIndex = 9000; // Fix for Canary where the thumbnail in the video doesn't // change until the CSS transition has finished, so wait for // it to change before starting the animation - var self = this; window.setTimeout(function() { self._element.classList.add("show"); self._popupElement.classList.add("show"); @@ -155,7 +167,7 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { document.addEventListener('keyup', this, false); } } else { - this._element.classList.remove("show"); + this.element.classList.remove("show"); this._popupElement.classList.remove("show"); this.player.stop(); @@ -168,7 +180,7 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { // take the video from the top only once it's stopped animating window.setTimeout(function() { - this._element.style.zIndex = null; + self.element.style.zIndex = null; }, 500); } -- cgit v1.2.3