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.js210
1 files changed, 104 insertions, 106 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
index bdc74c83..0fcbeb2d 100644
--- a/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js
+++ b/node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js
@@ -15,10 +15,10 @@ var Montage = require("montage").Montage,
15 @extends module:montage/ui/component.Component 15 @extends module:montage/ui/component.Component
16 */ 16 */
17var PicasaCarousel = exports.PicasaCarousel = Montage.create(Component, /** @lends module:"montage/ui/toggle-switch.reel".ToggleSwitch# */ { 17var PicasaCarousel = exports.PicasaCarousel = Montage.create(Component, /** @lends module:"montage/ui/toggle-switch.reel".ToggleSwitch# */ {
18 photoListController: { 18 photoListController: {
19 enumerable: false, 19 enumerable: false,
20 value: null 20 value: null
21 }, 21 },
22 22
23 flow: { 23 flow: {
24 value: null 24 value: null
@@ -28,14 +28,12 @@ var PicasaCarousel = exports.PicasaCarousel = Montage.create(Component, /** @len
28 value: 2300 28 value: 2300
29 }, 29 },
30 30
31
32
33 _queryParameter: { 31 _queryParameter: {
34 enumerable: false, 32 enumerable: false,
35 value: null 33 value: null
36 }, 34 },
37 35
38 queryParameter: { 36 queryParameter: {
39 get: function() { 37 get: function() {
40 return this._queryParameter; 38 return this._queryParameter;
41 }, 39 },
@@ -43,111 +41,111 @@ var PicasaCarousel = exports.PicasaCarousel = Montage.create(Component, /** @len
43 this._queryParameter = value; 41 this._queryParameter = value;
44 this.performSearch(); 42 this.performSearch();
45 } 43 }
46 }, 44 },
47 45
48 resultCount: { 46 resultCount: {
49 enumerable: false, 47 enumerable: false,
50 value: 40 48 value: 1000
51 }, 49 },
52 50
53 prepareForDraw: { 51 prepareForDraw: {
54 enumerable: false, 52 enumerable: false,
55 value: function() { 53 value: function() {
56 // this.searchForm.identifier = "searchForm"; 54 // this.searchForm.identifier = "searchForm";
57 // this.searchForm.addEventListener("submit", this, false); 55 // this.searchForm.addEventListener("submit", this, false);
58 } 56 }
59 }, 57 },
60 58
61 _isSearching: { 59 _isSearching: {
62 value: false, 60 value: false,
63 enumerable: false 61 enumerable: false
64 }, 62 },
65 63
66 isSearching: { 64 isSearching: {
67 enumerable: false, 65 enumerable: false,
68 get: function() { 66 get: function() {
69 return this._isSearching; 67 return this._isSearching;
70 }, 68 },
71 set: function(value) { 69 set: function(value) {
72 if (value === this._isSearching) { 70 if (value === this._isSearching) {
73 return; 71 return;
74 } 72 }
75 73
76 this._isSearching = value; 74 this._isSearching = value;
77 this.needsDraw = true; 75 this.needsDraw = true;
78 } 76 }
79 }, 77 },
80 78
81 handleSearchFormSubmit: { 79 handleSearchFormSubmit: {
82 value: function(evt) { 80 value: function(evt) {
83 evt.preventDefault(); 81 evt.preventDefault();
84 this.performSearch(); 82 this.performSearch();
85 } 83 }
86 }, 84 },
87 85
88 performSearch: { 86 performSearch: {
89 value: function() { 87 value: function() {
90 if (this.isSearching) { 88 if (this.isSearching) {
91 console.log("already searching!") 89 console.log("already searching!")
92 return; 90 return;
93 } 91 }
94 92
95 this.isSearching = true; 93 this.isSearching = true;
96 this.searchResults = null; 94 this.searchResults = null;
97 95
98 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=" 96 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="
99 // var base = "http://picasaweb.google.com/data/feed/base/featured?visibility=public&alt=json&max-results=" + this.resultCount + "&kind=photo&prettyprint=true" 97 // var base = "http://picasaweb.google.com/data/feed/base/featured?visibility=public&alt=json&max-results=" + this.resultCount + "&kind=photo&prettyprint=true"
100 var url = base + this.queryParameter; 98 var url = base + this.queryParameter;
101 99
102 var req = new XMLHttpRequest(); 100 var req = new XMLHttpRequest();
103 req.identifier = "searchRequest"; 101 req.identifier = "searchRequest";
104 req.open("GET", url); 102 req.open("GET", url);
105 req.addEventListener("load", this, false); 103 req.addEventListener("load", this, false);
106 req.addEventListener("error", this, false); 104 req.addEventListener("error", this, false);
107 req.send(); 105 req.send();
108 106
109 } 107 }
110 }, 108 },
111 109
112 handleSearchRequestLoad: { 110 handleSearchRequestLoad: {
113 value: function(evt) { 111 value: function(evt) {
114 var response = JSON.parse(evt.target.responseText), 112 var response = JSON.parse(evt.target.responseText);
115 previousOrigin = this.flow.origin; 113
116 this.searchResults = response.feed.entry; 114 this.searchResults = response.feed.entry;
117 if (this.flow.length === 0) { 115 /*if (this.flow.length === 0) {
118 this.flow.length = this.initialPosition; 116 this.flow.length = this.initialPosition;
119 } 117 }
120 if (previousOrigin === 0) { 118 if (previousOrigin === 0) {
121 this.flow.origin = this.initialPosition; 119 this.flow.origin = this.initialPosition;
122 } else { 120 } else {
123 this.flow.origin = previousOrigin; 121 this.flow.origin = previousOrigin;
122 }*/
123 this.isSearching = false;
124 }
125 },
126
127 handleSearchRequestError: {
128 value: function(evt) {
129 console.error("handleSearchRequestError", evt);
130 this.isSearching = false;
131 }
132 },
133
134 searchResults: {
135 enumerable: false,
136 value: null
137 },
138
139 draw: {
140 value: function() {
141
142 if (this.isSearching) {
143 this.element.classList.add("searching");
144 } else {
145 this.element.classList.remove("searching");
124 } 146 }
125 this.isSearching = false; 147
126 } 148 }
127 }, 149 }
128
129 handleSearchRequestError: {
130 value: function(evt) {
131 console.error("handleSearchRequestError", evt);
132 this.isSearching = false;