OLD | NEW |
1 "use strict"; | 1 "use strict"; |
2 /* | 2 /* |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 * @param {!string} className | 210 * @param {!string} className |
211 * @return {?Element} | 211 * @return {?Element} |
212 */ | 212 */ |
213 function enclosingNodeOrSelfWithClass(selfNode, className) | 213 function enclosingNodeOrSelfWithClass(selfNode, className) |
214 { | 214 { |
215 for (var node = selfNode; node && node !== selfNode.ownerDocument; node = no
de.parentNode) { | 215 for (var node = selfNode; node && node !== selfNode.ownerDocument; node = no
de.parentNode) { |
216 if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains(class
Name)) | 216 if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains(class
Name)) |
217 return node; | 217 return node; |
218 } | 218 } |
219 return null; | 219 return null; |
220 }; | 220 } |
221 | 221 |
222 /** | 222 /** |
223 * @constructor | 223 * @constructor |
224 * @param {!Element} element | 224 * @param {!Element} element |
225 * @param {!Object} config | 225 * @param {!Object} config |
226 */ | 226 */ |
227 function Picker(element, config) { | 227 function Picker(element, config) { |
228 this._element = element; | 228 this._element = element; |
229 this._config = config; | 229 this._config = config; |
230 } | 230 } |
231 | 231 |
232 /** | 232 /** |
233 * @enum {number} | 233 * @enum {number} |
234 */ | 234 */ |
235 Picker.Actions = { | 235 Picker.Actions = { |
236 SetValue: 0, | 236 SetValue: 0, |
237 Cancel: -1, | 237 Cancel: -1, |
238 ChooseOtherColor: -2 | 238 ChooseOtherColor: -2 |
239 }; | 239 }; |
240 | 240 |
241 /** | 241 /** |
242 * @param {!string} value | 242 * @param {!string} value |
243 */ | 243 */ |
244 Picker.prototype.submitValue = function(value) { | 244 Picker.prototype.submitValue = function(value) { |
245 window.pagePopupController.setValue(value); | 245 window.pagePopupController.setValue(value); |
246 window.pagePopupController.closePopup(); | 246 window.pagePopupController.closePopup(); |
247 } | 247 }; |
248 | 248 |
249 Picker.prototype.handleCancel = function() { | 249 Picker.prototype.handleCancel = function() { |
250 window.pagePopupController.closePopup(); | 250 window.pagePopupController.closePopup(); |
251 } | 251 }; |
252 | 252 |
253 Picker.prototype.chooseOtherColor = function() { | 253 Picker.prototype.chooseOtherColor = function() { |
254 window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherC
olor, ""); | 254 window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherC
olor, ""); |
255 } | 255 }; |
256 | 256 |
257 Picker.prototype.cleanup = function() {}; | 257 Picker.prototype.cleanup = function() {}; |
OLD | NEW |