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/ui | |
parent | a086ca62423a09807e2f3a79107249bc31d5e908 (diff) | |
download | ninja-09852e9b9b8e64f003bed5aa57630d8b42c8ac95.tar.gz |
Integrating picasa carousel and youtube channel
Diffstat (limited to 'node_modules/montage/ui')
-rw-r--r-- | node_modules/montage/ui/picasa-carousel.reel/image.reel/image.html (renamed from node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html) | 0 | ||||
-rw-r--r-- | node_modules/montage/ui/picasa-carousel.reel/image.reel/image.js (renamed from node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js) | 0 | ||||
-rwxr-xr-x | node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.css (renamed from node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css) | 0 | ||||
-rwxr-xr-x | node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.html (renamed from node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html) | 0 | ||||
-rw-r--r-- | node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js (renamed from node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js) | 0 | ||||
-rw-r--r-- | node_modules/montage/ui/youtube-channel.reel/youtube-channel.html | 34 | ||||
-rw-r--r-- | node_modules/montage/ui/youtube-channel.reel/youtube-channel.js | 101 |
7 files changed, 135 insertions, 0 deletions
diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html b/node_modules/montage/ui/picasa-carousel.reel/image.reel/image.html index e3d9c7a2..e3d9c7a2 100644 --- a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html +++ b/node_modules/montage/ui/picasa-carousel.reel/image.reel/image.html | |||
diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js b/node_modules/montage/ui/picasa-carousel.reel/image.reel/image.js index 0bced41b..0bced41b 100644 --- a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js +++ b/node_modules/montage/ui/picasa-carousel.reel/image.reel/image.js | |||
diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.css index cab6d1bb..cab6d1bb 100755 --- a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css +++ b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.css | |||
diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.html index 73ccf076..73ccf076 100755 --- a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html +++ b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.html | |||
diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js index 25d363b0..25d363b0 100644 --- a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js +++ b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js | |||
diff --git a/node_modules/montage/ui/youtube-channel.reel/youtube-channel.html b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.html new file mode 100644 index 00000000..b3858ec9 --- /dev/null +++ b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.html | |||
@@ -0,0 +1,34 @@ | |||
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": "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/ui/youtube-channel.reel/youtube-channel.js b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js new file mode 100644 index 00000000..fd642290 --- /dev/null +++ b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js | |||
@@ -0,0 +1,101 @@ | |||
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("ui/component").Component, | ||
9 | Uuid = require("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 | ||