From 222562c734396403c18c90a1ca395a36c4d49da4 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Mon, 19 Mar 2012 09:21:15 -0700 Subject: Youtube appending script in draw --- .../ui/youtube-channel.reel/youtube-channel.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 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 fd642290..3e20c406 100644 --- a/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js +++ b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js @@ -77,9 +77,22 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { // create url var url = "http://gdata.youtube.com/feeds/api/users/" + this._channel + "/uploads?v=2&alt=json-in-script&callback=" + callbackName; - var script = document.createElement("script"); - script.src = url; - this._element.appendChild(script); + this.script = document.createElement("script"); + this.script.src = url; + this.needsDraw = true; + } + }, + + script: { + value: null + }, + + draw: { + value: function() { + if (this.script) { + this._element.appendChild(this.script); + this.script = null; + } } }, -- cgit v1.2.3