|
87 | 87 | "<th>Owner</th>" +
|
88 | 88 | "<th>File size</th>" +
|
89 | 89 | "<th>Last modified</th>" +
|
90 |
| - "<th>Stars</th>" + |
91 | 90 | "</tr>" +
|
92 | 91 | "</thead>");
|
93 | 92 | resp.items.forEach(function (file) {
|
|
113 | 112 | .append("<span>" + file.quotaBytesUsed + "</span>"));
|
114 | 113 | row.append($("<td>")
|
115 | 114 | .append("<span>" + file.modifiedDate + "</span>"));
|
116 |
| - appendStars(file, row); |
117 | 115 |
|
118 | 116 | table.append(row)
|
119 | 117 | });
|
120 | 118 | });
|
121 | 119 | }
|
122 | 120 |
|
123 |
| - function appendStars(file, row) { |
124 |
| - var td = $("<td>"); |
125 |
| - var prop = undefined; |
126 |
| - if (file.properties !== undefined) { |
127 |
| - prop = file.properties.find(function (p) { return p.key === "stars"; }); |
128 |
| - } |
129 |
| - var value = prop !== undefined ? prop.value : 0; |
130 |
| - var stars = []; |
131 |
| - for (var i = 0; i < 5; i++) { |
132 |
| - (function (index) { |
133 |
| - var star = $("<span>"); |
134 |
| - stars.push(star); |
135 |
| - star.attr("class", "glyphicon glyphicon-star") |
136 |
| - .css("color", index >= value ? "grey" : "goldenrod") |
137 |
| - .on("click", function () { |
138 |
| - stars.forEach(function (e, i) { |
139 |
| - e.css("color", i > index ? "grey" : "goldenrod"); |
140 |
| - }); |
141 |
| - value = index + 1; |
142 |
| - var request = gapi.client.drive.properties.insert({ |
143 |
| - 'fileId': file.id, |
144 |
| - 'resource': { |
145 |
| - 'key': "stars", |
146 |
| - 'value': value, |
147 |
| - 'visibility': 'PRIVATE' |
148 |
| - } |
149 |
| - }); |
150 |
| - request.execute(function(resp) { console.log(resp); }); |
151 |
| - |
152 |
| - // Let our server know |
153 |
| - ajax.request({ |
154 |
| - type: 'POST', |
155 |
| - url: '/events/classify', |
156 |
| - data: { |
157 |
| - document_id: file.id, |
158 |
| - stars: value |
159 |
| - }, |
160 |
| - success: function (resp) { |
161 |
| - console.log(resp); |
162 |
| - }, |
163 |
| - error: function (err) { |
164 |
| - console.log(err); |
165 |
| - } |
166 |
| - }); |
167 |
| - }) |
168 |
| - .on("mouseover", function () { |
169 |
| - stars.forEach(function (e, i) { |
170 |
| - e.css("color", i > index ? "grey" : "goldenrod"); |
171 |
| - }); |
172 |
| - }) |
173 |
| - .on("mouseout", function () { |
174 |
| - stars.forEach(function (e, i) { |
175 |
| - e.css("color", i >= value ? "grey" : "goldenrod"); |
176 |
| - }); |
177 |
| - }); |
178 |
| - td.append(star); |
179 |
| - })(i); |
180 |
| - } |
181 |
| - row.append(td); |
182 |
| - } |
183 |
| - |
| 121 | + |
184 | 122 | function openFolder(id) {
|
185 | 123 | var state = {
|
186 | 124 | folder: id
|
|
0 commit comments