aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js')
-rw-r--r--node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js124
1 files changed, 124 insertions, 0 deletions
diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js
new file mode 100644
index 00000000..25d363b0
--- /dev/null
+++ b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js
@@ -0,0 +1,124 @@
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 resultCount: {
29 enumerable: false,
30 value: 20
31 },
32
33 prepareForDraw: {
34 enumerable: false,
35 value: function() {
36 // this.searchForm.identifier = "searchForm";
37 // this.searchForm.addEventListener("submit", this, false);
38 }
39 },
40
41 _isSearching: {
42 value: false,
43 enumerable: false
44 },
45
46 isSearching: {
47 enumerable: false,
48 get: function() {
49 return this._isSearching;
50 },
51 set: function(value) {
52 if (value === this._isSearching) {
53 return;
54 }
55
56 this._isSearching = value;
57 this.needsDraw = true;
58 }
59 },
60
61 handleSearchFormSubmit: {
62 value: function(evt) {
63 evt.preventDefault();
64 this.performSearch();
65 }
66 },
67
68 performSearch: {
69 value: function() {
70 if (this.isSearching) {
71 console.log("already searching!")
72 return;
73 }
74
75 this.isSearching = true;
76 this.searchResults = null;
77
78 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="
79 // var base = "http://picasaweb.google.com/data/feed/base/featured?visibility=public&alt=json&max-results=" + this.resultCount + "&kind=photo&prettyprint=true"
80 var url = base + this.queryParameter;
81
82 var req = new XMLHttpRequest();
83 req.identifier = "searchRequest";
84 req.open("GET", url);
85 req.addEventListener("load", this, false);
86 req.addEventListener("error", this, false);
87 req.send();
88
89 }
90 },
91
92 handleSearchRequestLoad: {
93 value: function(evt) {
94 var response = JSON.parse(evt.target.responseText);
95 this.searchResults = response.feed.entry;
96 this.isSearching = false;
97 }
98 },
99
100 handleSearchRequestError: {
101 value: function(evt) {
102 console.error("handleSearchRequestError", evt);
103 this.isSearching = false;
104 }
105 },
106
107 searchResults: {
108 enumerable: false,
109 value: null
110 },
111
112 draw: {
113 value: function() {
114
115 if (this.isSearching) {
116 this.element.classList.add("searching");
117 } else {
118 this.element.classList.remove("searching");
119 }
120
121 }
122 }
123
124});