aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js')
-rw-r--r--node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js134
1 files changed, 134 insertions, 0 deletions
diff --git a/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js
new file mode 100644
index 00000000..1f5e7dd0
--- /dev/null
+++ b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js
@@ -0,0 +1,134 @@
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/**
7
8 @requires montage/core/core
9 @requires montage/ui/component
10*/
11var Montage = require("montage").Montage,
12 Component = require("ui/component").Component;
13/**
14 @class module:"montage/ui/google/map.reel".Map
15 @extends module:montage/ui/component.Component
16 */
17var PicasaCarousel = exports.PicasaCarousel = Montage.create(Component, /** @lends module:"montage/ui/toggle-switch.reel".ToggleSwitch# */ {
18 photoListController: {
19 enumerable: false,
20 value: null
21 },
22
23 _queryParameter: {
24 enumerable: false,
25 value: null
26 },
27
28 queryParameter: {
29 get: function() {
30 return this._queryParameter;
31 },
32 set: function(value) {
33 this._queryParameter = value;
34 this.performSearch();
35 }
36 },
37
38 resultCount: {
39 enumerable: false,
40 value: 20
41 },
42
43 prepareForDraw: {
44 enumerable: false,
45 value: function() {
46 // this.searchForm.identifier = "searchForm";
47 // this.searchForm.addEventListener("submit", this, false);
48 }
49 },
50
51 _isSearching: {
52 value: false,
53 enumerable: false
54 },
55
56 isSearching: {
57 enumerable: false,
58 get: function() {
59 return this._isSearching;
60 },
61 set: function(value) {
62 if (value === this._isSearching) {
63 return;
64 }
65
66 this._isSearching = value;
67 this.needsDraw = true;
68 }
69 },
70
71 handleSearchFormSubmit: {
72 value: function(evt) {
73 evt.preventDefault();
74 this.performSearch();
75 }
76 },
77
78 performSearch: {
79 value: function() {
80 if (this.isSearching) {
81 console.log("already searching!")
82 return;
83 }
84
85 this.isSearching = true;
86 this.searchResults = null;
87
88 var base = "http://picasaweb.google.com/data/feed/base/all?visibility=public&alt=json&max-results=" + this.resultCount + "&kind=photo&prettyprint=true&imgmax=720u&q="
89 // var base = "http://picasaweb.google.com/data/feed/base/featured?visibility=public&alt=json&max-results=" + this.resultCount + "&kind=photo&prettyprint=true"
90 var url = base + this.queryParameter;
91
92 var req = new XMLHttpRequest();
93 req.identifier = "searchRequest";
94 req.open("GET", url);
95 req.addEventListener("load", this, false);
96 req.addEventListener("error", this, false);
97 req.send();
98
99 }
100 },
101
102 handleSearchRequestLoad: {
103 value: function(evt) {
104 var response = JSON.parse(evt.target.responseText);
105 this.searchResults = response.feed.entry;
106 this.isSearching = false;
107 }
108 },
109
110 handleSearchRequestError: {
111 value: function(evt) {
112 console.error("handleSearchRequestError", evt);
113 this.isSearching = false;
114 }
115 },
116
117 searchResults: {
118 enumerable: false,
119 value: null
120 },
121
122 draw: {
123 value: function() {
124
125 if (this.isSearching) {
126 this.element.classList.add("searching");
127 } else {
128 this.element.classList.remove("searching");
129 }
130
131 }
132 }
133
134});