diff options
author | François Frisch | 2012-03-17 19:28:30 -0700 |
---|---|---|
committer | François Frisch | 2012-03-17 19:28:30 -0700 |
commit | 09852e9b9b8e64f003bed5aa57630d8b42c8ac95 (patch) | |
tree | de6f15ae7557a17f105386729952f35783f67647 /node_modules/montage/examples | |
parent | a086ca62423a09807e2f3a79107249bc31d5e908 (diff) | |
download | ninja-09852e9b9b8e64f003bed5aa57630d8b42c8ac95.tar.gz |
Integrating picasa carousel and youtube channel
Diffstat (limited to 'node_modules/montage/examples')
3 files changed, 1 insertions, 136 deletions
diff --git a/node_modules/montage/examples/youtube-channel-example/index.html b/node_modules/montage/examples/youtube-channel-example/index.html index 71baba29..b313d5d8 100755 --- a/node_modules/montage/examples/youtube-channel-example/index.html +++ b/node_modules/montage/examples/youtube-channel-example/index.html | |||
@@ -12,7 +12,7 @@ | |||
12 | <script type="text/montage-serialization"> | 12 | <script type="text/montage-serialization"> |
13 | { | 13 | { |
14 | "player": { | 14 | "player": { |
15 | "prototype": "youtube-channel.reel", | 15 | "prototype": "montage/ui/youtube-channel.reel", |
16 | "properties": { | 16 | "properties": { |
17 | "element": {"#": "player"} | 17 | "element": {"#": "player"} |
18 | } | 18 | } |
diff --git a/node_modules/montage/examples/youtube-channel-example/youtube-channel.reel/youtube-channel.html b/node_modules/montage/examples/youtube-channel-example/youtube-channel.reel/youtube-channel.html deleted file mode 100644 index 8514f5ce..00000000 --- a/node_modules/montage/examples/youtube-channel-example/youtube-channel.reel/youtube-channel.html +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- <copyright> | ||
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
5 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
6 | </copyright> --> | ||
7 | <html> | ||
8 | <head> | ||
9 | <title></title> | ||
10 | <script type="text/montage-serialization"> | ||
11 | { | ||
12 | "player": { | ||
13 | "prototype": "montage/ui/youtube-player.reel", | ||
14 | "properties": { | ||
15 | "element": {"#": "player"} | ||
16 | } | ||
17 | }, | ||
18 | |||
19 | "owner": { | ||
20 | "prototype": "youtube-channel.reel", | ||
21 | "properties": { | ||
22 | "element": {"#": "container"}, | ||
23 | "player": {"@": "player"} | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | </script> | ||
28 | </head> | ||
29 | <body> | ||
30 | <div data-montage-id="container" class="montage-youtube-channel"> | ||
31 | <div data-montage-id="player"></div> | ||
32 | </div> | ||
33 | </body> | ||
34 | </html> | ||
diff --git a/node_modules/montage/examples/youtube-channel-example/youtube-channel.reel/youtube-channel.js b/node_modules/montage/examples/youtube-channel-example/youtube-channel.reel/youtube-channel.js deleted file mode 100644 index 1f5aa2d1..00000000 --- a/node_modules/montage/examples/youtube-channel-example/youtube-channel.reel/youtube-channel.js +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | /*global require,exports*/ | ||
7 | var Montage = require("montage").Montage, | ||
8 | Component = require("montage/ui/component").Component, | ||
9 | Uuid = require("montage/core/uuid").Uuid; | ||
10 | |||
11 | |||
12 | var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { | ||
13 | |||
14 | _userRe: { | ||
15 | enumerable: false, | ||
16 | value: /youtube.com\/(user\/)?([a-z0-9]+)/i | ||
17 | }, | ||
18 | |||
19 | _channelUrl: { | ||
20 | enumerable: false, | ||
21 | value: null | ||
22 | }, | ||
23 | channelUrl: { | ||
24 | depends: ["channel"], | ||
25 | get: function() { | ||
26 | return this._channelUrl; | ||
27 | }, | ||
28 | set: function(value, fromChannel) { | ||
29 | if (this._channelUrl !== value) { | ||
30 | this._channelUrl = value; | ||
31 | |||
32 | // prevent infinite loop | ||
33 | if (!fromChannel) { | ||
34 | var match = this._userRe.exec(value); | ||
35 | if (match && match[2]) { | ||
36 | Object.getPropertyDescriptor(this, "channel").set.call(this, match[2], true); | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | }, | ||
42 | |||
43 | _channel: { | ||
44 | enumerable: false, | ||
45 | value: null | ||
46 | }, | ||
47 | channel: { | ||
48 | get: function() { | ||
49 | return this._channel; | ||
50 | }, | ||
51 | set: function(value, fromUrl) { | ||
52 | if (this._channel !== value) { | ||
53 | this._channel = value; | ||
54 | |||
55 | // prevent infinite loop | ||
56 | if (!fromUrl) { | ||
57 | Object.getPropertyDescriptor(this, "channelUrl").set.call(this, "http://www.youtube.com/user/" + value, true); | ||
58 | } | ||
59 | |||
60 | this._loadChannel(); | ||
61 | } | ||
62 | } | ||
63 | }, | ||
64 | |||
65 | _loadChannel: { | ||
66 | enumerable: false, | ||
67 | value: function() { | ||
68 | var self = this; | ||
69 | |||
70 | var callbackName = "scriptCallback" + Uuid.generate().replace(/-/g, "_"); | ||
71 | |||
72 | window[callbackName] = function(data) { | ||
73 | self.handleData(data); | ||
74 | delete window[callbackName]; | ||
75 | }; | ||
76 | |||
77 | // create url | ||
78 | var url = "http://gdata.youtube.com/feeds/api/users/" + this._channel + "/uploads?v=2&alt=json-in-script&callback=" + callbackName; | ||
79 | |||
80 | var script = document.createElement("script"); | ||
81 | script.src = url; | ||
82 | this._element.appendChild(script); | ||
83 | } | ||
84 | }, | ||
85 | |||
86 | handleData: { | ||
87 | value: function(data) { | ||
88 | var entries = data.feed.entry || []; | ||
89 | |||
90 | var playlist = []; | ||
91 | |||
92 | for (var i = 0, len = entries.length; i < len; i++) { | ||
93 | var id = entries[i]["media$group"]["yt$videoid"]["$t"]; | ||
94 | playlist.push(id); | ||
95 | } | ||
96 | |||
97 | this.player.playlist = playlist; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | }); \ No newline at end of file | ||