Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 /** @const */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
| 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 // The GUID of the loaded address. | 9 // The GUID of the loaded address. |
| 10 var guid; | 10 var guid; |
| 11 | 11 |
| 12 // The BCP 47 language code for the layout of input fields. | |
| 13 var languageCode; | |
| 14 | |
| 12 /** | 15 /** |
| 13 * AutofillEditAddressOverlay class | 16 * AutofillEditAddressOverlay class |
| 14 * Encapsulated handling of the 'Add Page' overlay page. | 17 * Encapsulated handling of the 'Add Page' overlay page. |
| 15 * @class | 18 * @class |
| 16 */ | 19 */ |
| 17 function AutofillEditAddressOverlay() { | 20 function AutofillEditAddressOverlay() { |
| 18 OptionsPage.call(this, 'autofillEditAddress', | 21 OptionsPage.call(this, 'autofillEditAddress', |
| 19 loadTimeData.getString('autofillEditAddressTitle'), | 22 loadTimeData.getString('autofillEditAddressTitle'), |
| 20 'autofill-edit-address-overlay'); | 23 'autofill-edit-address-overlay'); |
| 21 } | 24 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 // affects layout, which interferes with being able to click on the | 61 // affects layout, which interferes with being able to click on the |
| 59 // buttons. | 62 // buttons. |
| 60 $('autofill-edit-address-apply-button').onmousedown = function(event) { | 63 $('autofill-edit-address-apply-button').onmousedown = function(event) { |
| 61 event.preventDefault(); | 64 event.preventDefault(); |
| 62 }; | 65 }; |
| 63 $('autofill-edit-address-cancel-button').onmousedown = function(event) { | 66 $('autofill-edit-address-cancel-button').onmousedown = function(event) { |
| 64 event.preventDefault(); | 67 event.preventDefault(); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 self.guid = ''; | 70 self.guid = ''; |
| 71 self.languageCode = ''; | |
| 68 self.populateCountryList_(); | 72 self.populateCountryList_(); |
| 69 self.clearInputFields_(); | 73 self.clearInputFields_(); |
| 70 self.connectInputEvents_(); | 74 self.connectInputEvents_(); |
| 71 }, | 75 }, |
| 72 | 76 |
| 73 /** | 77 /** |
| 74 * Specifically catch the situations in which the overlay is cancelled | 78 * Specifically catch the situations in which the overlay is cancelled |
| 75 * externally (e.g. by pressing <Esc>), so that the input fields and | 79 * externally (e.g. by pressing <Esc>), so that the input fields and |
| 76 * GUID can be properly cleared. | 80 * GUID can be properly cleared. |
| 77 * @override | 81 * @override |
| 78 */ | 82 */ |
| 79 handleCancel: function() { | 83 handleCancel: function() { |
| 80 this.dismissOverlay_(); | 84 this.dismissOverlay_(); |
| 81 }, | 85 }, |
| 82 | 86 |
| 83 /** | 87 /** |
| 84 * Creates, decorates and initializes the multi-value lists for full name, | 88 * Creates, decorates and initializes the multi-value lists for full name, |
| 85 * phone, and email. | 89 * phone, and email. |
| 86 * @private | 90 * @private |
| 87 */ | 91 */ |
| 88 createMultiValueLists_: function() { | 92 createMultiValueLists_: function() { |
| 89 var list = $('full-name-list'); | 93 var list = $('phone-list'); |
| 90 options.autofillOptions.AutofillNameValuesList.decorate(list); | |
| 91 list.autoExpands = true; | |
| 92 | |
| 93 list = $('phone-list'); | |
| 94 options.autofillOptions.AutofillPhoneValuesList.decorate(list); | 94 options.autofillOptions.AutofillPhoneValuesList.decorate(list); |
| 95 list.autoExpands = true; | 95 list.autoExpands = true; |
| 96 | 96 |
| 97 list = $('email-list'); | 97 list = $('email-list'); |
| 98 options.autofillOptions.AutofillValuesList.decorate(list); | 98 options.autofillOptions.AutofillValuesList.decorate(list); |
| 99 list.autoExpands = true; | 99 list.autoExpands = true; |
| 100 }, | 100 }, |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * Updates the data model for the list named |listName| with the values from | 103 * Updates the data model for the list named |listName| with the values from |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 124 }, | 124 }, |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * Clears any uncommitted input, resets the stored GUID and dismisses the | 127 * Clears any uncommitted input, resets the stored GUID and dismisses the |
| 128 * overlay. | 128 * overlay. |
| 129 * @private | 129 * @private |
| 130 */ | 130 */ |
| 131 dismissOverlay_: function() { | 131 dismissOverlay_: function() { |
| 132 this.clearInputFields_(); | 132 this.clearInputFields_(); |
| 133 this.guid = ''; | 133 this.guid = ''; |
| 134 this.languageCode = ''; | |
| 134 OptionsPage.closeOverlay(); | 135 OptionsPage.closeOverlay(); |
| 135 }, | 136 }, |
| 136 | 137 |
| 137 /** | 138 /** |
| 139 * Aggregates the values in the input fields into an object. | |
| 140 * @private | |
| 141 */ | |
| 142 getAddress_: function() { | |
| 143 var address = {}; | |
| 144 | |
| 145 var list = $('full-name-list'); | |
| 146 address.recipient = | |
| 147 list ? list.dataModel.slice(0, list.dataModel.length - 1) : []; | |
| 148 | |
| 149 var item = $('organization'); | |
| 150 address.organization = item ? item.value : ''; | |
| 151 | |
| 152 list = $('street-address-list'); | |
| 153 address.streetAddress = | |
| 154 list ? list.dataModel.slice(0, list.dataModel.length - 1) : []; | |
| 155 | |
| 156 item = $('dependent-locality'); | |
| 157 address.dependentLocality = item ? item.value : ''; | |
| 158 | |
| 159 item = $('locality'); | |
| 160 address.locality = item ? item.value : ''; | |
| 161 | |
| 162 item = $('admin-area'); | |
| 163 address.adminArea = item ? item.value : ''; | |
| 164 | |
| 165 item = $('postal-code'); | |
| 166 address.postalCode = item ? item.value : ''; | |
| 167 | |
| 168 item = $('sorting-code'); | |
| 169 address.sortingCode = item ? item.value : ''; | |
| 170 | |
| 171 address.country = $('country').value; | |
| 172 | |
| 173 list = $('phone-list'); | |
| 174 address.phone = list.dataModel.slice(0, list.dataModel.length - 1); | |
| 175 | |
| 176 list = $('email-list'); | |
| 177 address.email = list.dataModel.slice(0, list.dataModel.length - 1); | |
| 178 | |
| 179 return address; | |
| 180 }, | |
| 181 | |
| 182 /** | |
| 138 * Aggregates the values in the input fields into an array and sends the | 183 * Aggregates the values in the input fields into an array and sends the |
| 139 * array to the Autofill handler. | 184 * array to the Autofill handler. |
| 140 * @private | 185 * @private |
| 141 */ | 186 */ |
| 142 saveAddress_: function() { | 187 saveAddress_: function() { |
| 143 var address = new Array(); | 188 var address = this.getAddress_(); |
| 144 address[0] = this.guid; | 189 var serialized = new Array(); |
| 145 var list = $('full-name-list'); | 190 serialized[0] = this.guid; |
| 146 address[1] = list.dataModel.slice(0, list.dataModel.length - 1); | 191 serialized[1] = address.recipient; |
| 147 address[2] = $('company-name').value; | 192 serialized[2] = address.organization; |
| 148 address[3] = $('addr-line-1').value; | 193 serialized[3] = address.streetAddress; |
| 149 address[4] = $('addr-line-2').value; | 194 serialized[4] = address.dependentLocality; |
| 150 address[5] = $('city').value; | 195 serialized[5] = address.locality; |
| 151 address[6] = $('state').value; | 196 serialized[6] = address.adminArea; |
| 152 address[7] = $('postal-code').value; | 197 serialized[7] = address.postalCode; |
| 153 address[8] = $('country').value; | 198 serialized[8] = address.sortingCode; |
| 154 list = $('phone-list'); | 199 serialized[9] = address.country; |
| 155 address[9] = list.dataModel.slice(0, list.dataModel.length - 1); | 200 serialized[10] = address.phone; |
| 156 list = $('email-list'); | 201 serialized[11] = address.email; |
| 157 address[10] = list.dataModel.slice(0, list.dataModel.length - 1); | 202 serialized[12] = this.languageCode; |
| 158 | 203 |
| 159 chrome.send('setAddress', address); | 204 chrome.send('setAddress', serialized); |
| 160 }, | 205 }, |
| 161 | 206 |
| 162 /** | 207 /** |
| 163 * Connects each input field to the inputFieldChanged_() method that enables | 208 * Connects each input field to the inputFieldChanged_() method that enables |
| 164 * or disables the 'Ok' button based on whether all the fields are empty or | 209 * or disables the 'Ok' button based on whether all the fields are empty or |
| 165 * not. | 210 * not. |
| 166 * @private | 211 * @private |
| 167 */ | 212 */ |
| 168 connectInputEvents_: function() { | 213 connectInputEvents_: function() { |
| 169 var self = this; | 214 var self = this; |
| 170 $('company-name').oninput = $('addr-line-1').oninput = | 215 var item = $('organization'); |
| 171 $('addr-line-2').oninput = $('city').oninput = $('state').oninput = | 216 if (item) |
| 172 $('postal-code').oninput = function(event) { | 217 item.oninput = function(event) { self.inputFieldChanged_(); }; |
| 173 self.inputFieldChanged_(); | |
| 174 }; | |
| 175 | 218 |
| 176 $('country').onchange = function(event) { | 219 item = $('postal-code'); |
| 177 self.countryChanged_(); | 220 if (item) |
| 178 }; | 221 item.oninput = function(event) { self.inputFieldChanged_(); }; |
| 222 | |
| 223 item = $('sorting-code'); | |
| 224 if (item) | |
| 225 item.oninput = function(event) { self.inputFieldChanged_(); }; | |
| 226 | |
| 227 item = $('dependent-locality'); | |
| 228 if (item) | |
| 229 item.oninput = function(event) { self.inputFieldChanged_(); }; | |
| 230 | |
| 231 item = $('locality'); | |
| 232 if (item) | |
| 233 item.oninput = function(event) { self.inputFieldChanged_(); }; | |
| 234 | |
| 235 item = 'admin-area'; | |
|
Evan Stade
2014/04/22 00:51:58
ditto
please use gerrit instead
2014/04/24 20:10:59
Done.
| |
| 236 if (item) | |
| 237 item.oninput = function(event) { self.inputFieldChanged_(); }; | |
| 238 | |
| 239 $('country').onchange = function(event) { self.countryChanged_(); }; | |
| 179 }, | 240 }, |
| 180 | 241 |
| 181 /** | 242 /** |
| 182 * Checks the values of each of the input fields and disables the 'Ok' | 243 * Checks the values of each of the input fields and disables the 'Ok' |
| 183 * button if all of the fields are empty. | 244 * button if all of the fields are empty. |
| 184 * @private | 245 * @private |
| 185 */ | 246 */ |
| 186 inputFieldChanged_: function() { | 247 inputFieldChanged_: function() { |
| 187 // Length of lists are tested for <= 1 due to the "add" placeholder item | 248 // Length of lists are tested for <= 1 due to the "add" placeholder item |
| 188 // in the list. | 249 // in the list. |
| 189 var disabled = | 250 var disabled = |
| 190 $('full-name-list').items.length <= 1 && | 251 (!$('full-name-list') || $('full-name-list').items.length <= 1) && |
| 191 !$('company-name').value && | 252 (!$('organization') || !$('organization').value) && |
| 192 !$('addr-line-1').value && !$('addr-line-2').value && | 253 (!$('street-address-list') || |
| 193 !$('city').value && !$('state').value && !$('postal-code').value && | 254 $('street-address-list').items.length <= 1) && |
| 194 !$('country').value && $('phone-list').items.length <= 1 && | 255 (!$('dependent-locality') || !$('dependent-locality').value) && |
| 256 (!$('locality') || !$('locality').value) && | |
| 257 (!$('admin-area') || !$('admin-area').value) && | |
| 258 (!$('postal-code') || !$('postal-code').value) && | |
| 259 (!$('sorting-code') || !$('sorting-code').value) && | |
| 260 !$('country').value && | |
| 261 $('phone-list').items.length <= 1 && | |
| 195 $('email-list').items.length <= 1; | 262 $('email-list').items.length <= 1; |
| 196 $('autofill-edit-address-apply-button').disabled = disabled; | 263 $('autofill-edit-address-apply-button').disabled = disabled; |
| 197 }, | 264 }, |
| 198 | 265 |
| 199 /** | 266 /** |
| 200 * Updates the postal code and state field labels appropriately for the | 267 * Updates the address fields appropriately for the selected country. |
| 201 * selected country. | |
| 202 * @private | 268 * @private |
| 203 */ | 269 */ |
| 204 countryChanged_: function() { | 270 countryChanged_: function() { |
| 205 var countryCode = $('country').value || | 271 var countryCode = $('country').value || |
| 206 loadTimeData.getString('defaultCountryCode'); | 272 loadTimeData.getString('defaultCountryCode'); |
| 207 | 273 chrome.send('loadAddressEditorComponents', [countryCode]); |
| 208 var details = loadTimeData.getValue('autofillCountryData')[countryCode]; | |
| 209 var postal = $('postal-code-label'); | |
| 210 postal.textContent = details.postalCodeLabel; | |
| 211 $('state-label').textContent = details.stateLabel; | |
| 212 | |
| 213 // Also update the 'Ok' button as needed. | |
| 214 this.inputFieldChanged_(); | |
| 215 }, | 274 }, |
| 216 | 275 |
| 217 /** | 276 /** |
| 218 * Populates the country <select> list. | 277 * Populates the country <select> list. |
| 219 * @private | 278 * @private |
| 220 */ | 279 */ |
| 221 populateCountryList_: function() { | 280 populateCountryList_: function() { |
| 222 var countryList = loadTimeData.getValue('autofillCountrySelectList'); | 281 var countryList = loadTimeData.getValue('autofillCountrySelectList'); |
| 223 | 282 |
| 224 // Add the countries to the country <select> list. | 283 // Add the countries to the country <select> list. |
| 225 var countrySelect = $('country'); | 284 var countrySelect = $('country'); |
| 226 // Add an empty option. | 285 // Add an empty option. |
| 227 countrySelect.appendChild(new Option('', '')); | 286 countrySelect.appendChild(new Option('', '')); |
| 228 for (var i = 0; i < countryList.length; i++) { | 287 for (var i = 0; i < countryList.length; i++) { |
| 229 var option = new Option(countryList[i].name, | 288 var option = new Option(countryList[i].name, |
| 230 countryList[i].value); | 289 countryList[i].value); |
| 231 option.disabled = countryList[i].value == 'separator'; | 290 option.disabled = countryList[i].value == 'separator'; |
| 232 countrySelect.appendChild(option); | 291 countrySelect.appendChild(option); |
| 233 } | 292 } |
| 234 }, | 293 }, |
| 235 | 294 |
| 236 /** | 295 /** |
| 237 * Clears the value of each input field. | 296 * Clears the value of each input field. |
| 238 * @private | 297 * @private |
| 239 */ | 298 */ |
| 240 clearInputFields_: function() { | 299 clearInputFields_: function() { |
|
Evan Stade
2014/04/22 00:51:58
you should be able to use a clever query selector
please use gerrit instead
2014/04/24 20:10:59
Done.
| |
| 241 this.setMultiValueList_('full-name-list', []); | 300 if ($('full-name-list')) |
| 242 $('company-name').value = ''; | 301 this.setMultiValueList_('full-name-list', []); |
| 243 $('addr-line-1').value = ''; | 302 |
| 244 $('addr-line-2').value = ''; | 303 var item = $('organization'); |
| 245 $('city').value = ''; | 304 if (item) |
| 246 $('state').value = ''; | 305 item.value = ''; |
| 247 $('postal-code').value = ''; | 306 |
| 307 if ($('street-address-list')) | |
| 308 this.setMultiValueList_('street-address-list', []); | |
| 309 | |
| 310 item = $('postal-code'); | |
| 311 if (item) | |
| 312 item.value = ''; | |
| 313 | |
| 314 item = $('sorting-code'); | |
| 315 if (item) | |
| 316 item.value = ''; | |
| 317 | |
| 318 item = $('dependent-locality'); | |
| 319 if (item) | |
| 320 item.value = ''; | |
| 321 | |
| 322 item = $('locality'); | |
| 323 if (item) | |
| 324 item.value = ''; | |
| 325 | |
| 326 item = 'admin-area'; | |
|
Evan Stade
2014/04/22 00:51:58
this is missing a dollar sign
please use gerrit instead
2014/04/24 20:10:59
Done.
| |
| 327 if (item) | |
| 328 item.value = ''; | |
| 329 | |
| 248 $('country').value = ''; | 330 $('country').value = ''; |
| 249 this.setMultiValueList_('phone-list', []); | 331 this.setMultiValueList_('phone-list', []); |
| 250 this.setMultiValueList_('email-list', []); | 332 this.setMultiValueList_('email-list', []); |
| 251 | |
| 252 this.countryChanged_(); | |
| 253 }, | 333 }, |
| 254 | 334 |
| 255 /** | 335 /** |
| 256 * Loads the address data from |address|, sets the input fields based on | 336 * Loads the address data from |address|, sets the input fields based on |
| 257 * this data and stores the GUID of the address. | 337 * this data, and stores the GUID and language code of the address. |
| 258 * @private | 338 * @private |
| 259 */ | 339 */ |
| 260 loadAddress_: function(address) { | 340 loadAddress_: function(address) { |
| 341 this.rebuildInputFields_(address.components); | |
| 261 this.setInputFields_(address); | 342 this.setInputFields_(address); |
| 262 this.inputFieldChanged_(); | 343 this.inputFieldChanged_(); |
| 263 this.guid = address.guid; | 344 this.guid = address.guid; |
| 345 this.languageCode = address.languageCode; | |
| 264 }, | 346 }, |
| 265 | 347 |
| 266 /** | 348 /** |
| 267 * Sets the value of each input field according to |address| | 349 * Takes a snapshot of the input values, clears the input values, loads the |
| 350 * address input layout from |input.components|, restores the input values | |
| 351 * from snapshot, and stores the |input.languageCode| for the address. | |
| 352 * @private | |
| 353 */ | |
| 354 loadAddressComponents_: function(input) { | |
| 355 var address = this.getAddress_(); | |
| 356 this.rebuildInputFields_(input.components); | |
| 357 this.setInputFields_(address); | |
| 358 this.inputFieldChanged_(); | |
| 359 this.languageCode = input.languageCode; | |
| 360 }, | |
| 361 | |
| 362 /** | |
| 363 * Sets the value of each input field according to |address|. | |
| 268 * @private | 364 * @private |
| 269 */ | 365 */ |
| 270 setInputFields_: function(address) { | 366 setInputFields_: function(address) { |
| 271 this.setMultiValueList_('full-name-list', address.fullName); | 367 if ($('full-name-list')) |
| 272 $('company-name').value = address.companyName; | 368 this.setMultiValueList_('full-name-list', address.recipient); |
| 273 $('addr-line-1').value = address.addrLine1; | 369 |
| 274 $('addr-line-2').value = address.addrLine2; | 370 var item = $('organization'); |
| 275 $('city').value = address.city; | 371 if (item) |
| 276 $('state').value = address.state; | 372 item.value = address.organization; |
| 277 $('postal-code').value = address.postalCode; | 373 |
| 374 if ($('street-address-list')) | |
| 375 this.setMultiValueList_('street-address-list', address.streetAddress); | |
| 376 | |
| 377 item = $('postal-code'); | |
| 378 if (item) | |
| 379 item.value = address.postalCode; | |
| 380 | |
| 381 item = $('sorting-code'); | |
| 382 if (item) | |
| 383 item.value = address.sortingCode; | |
| 384 | |
| 385 item = $('dependent-locality'); | |
| 386 if (item) | |
| 387 item.value = address.dependentLocality; | |
| 388 | |
| 389 item = $('locality'); | |
| 390 if (item) | |
| 391 item.value = address.locality; | |
| 392 | |
| 393 item = $('admin-area'); | |
| 394 if (item) | |
| 395 item.value = address.adminArea; | |
| 396 | |
| 278 $('country').value = address.country; | 397 $('country').value = address.country; |
| 279 this.setMultiValueList_('phone-list', address.phone); | 398 this.setMultiValueList_('phone-list', address.phone); |
| 280 this.setMultiValueList_('email-list', address.email); | 399 this.setMultiValueList_('email-list', address.email); |
| 400 }, | |
| 281 | 401 |
| 282 this.countryChanged_(); | 402 /** |
| 403 * Returns the HTML for recipient name. | |
| 404 * @private | |
| 405 */ | |
| 406 getRecipientNameHtml_: function() { | |
|
Evan Stade
2014/04/22 00:51:58
ditto the below comment about templates
please use gerrit instead
2014/04/24 20:10:59
Done.
| |
| 407 return '<div>' + | |
| 408 '<div>' + | |
| 409 '<div id="autofill-name-labels">' + | |
| 410 '<span>' + | |
| 411 loadTimeData.getString('autofillFirstNameLabel') + | |
| 412 '</span>' + | |
| 413 '<span>' + | |
| 414 loadTimeData.getString('autofillMiddleNameLabel') + | |
| 415 '</span>' + | |
| 416 '<span>' + | |
| 417 loadTimeData.getString('autofillLastNameLabel') + | |
| 418 '</span>' + | |
| 419 '</div>' + | |
| 420 '</div>' + | |
| 421 '<list id="full-name-list"></list>' + | |
| 422 '</div>'; | |
| 423 }, | |
| 424 | |
| 425 /** | |
| 426 * Clears address inputs and rebuilds the input fields according to | |
| 427 * |components|. | |
| 428 * @private | |
| 429 */ | |
| 430 rebuildInputFields_: function(components) { | |
|
Evan Stade
2014/04/22 00:51:58
please don't write html in js strings. You can use
please use gerrit instead
2014/04/24 20:10:59
Done.
| |
| 431 content = '<div class="input-group settings-row">'; | |
| 432 var hasNameFields = false; | |
| 433 for (var i in components) { | |
| 434 if (components[i].field == 'country') | |
| 435 continue; | |
| 436 | |
| 437 if (i != 0 && (components[i].length == 'long' || | |
| 438 components[i - 1].length == 'long')) { | |
| 439 content += '</div><div class="input-group settings-row">'; | |
| 440 } | |
| 441 | |
| 442 if (components[i].field == 'street-address') { | |
| 443 content += | |
| 444 '<div>' + | |
| 445 '<div>' + components[i].name + '</div>' + | |
| 446 '<list id="street-address-list" placeholder="' + | |
| 447 loadTimeData.getString('addStreetAddressLinePlaceholder') + | |
| 448 '"></list>' + | |
| 449 '</div>'; | |
| 450 continue; | |
| 451 } | |
| 452 | |
| 453 if (components[i].field == 'recipient') { | |
| 454 hasNameFields = true; | |
| 455 content += this.getRecipientNameHtml_(); | |
| 456 continue; | |
| 457 } | |
| 458 | |
| 459 content += '<label>'; | |
| 460 content += '<div>' + components[i].name + '</div>'; | |
| 461 content += '<input id="' + components[i].field + '" type="text">'; | |
|
Evan Stade
2014/04/22 00:51:58
the id should be more specific, "company" is not s
please use gerrit instead
2014/04/24 20:10:59
Done.
| |
| 462 content += '</label>'; | |
| 463 } | |
| 464 | |
| 465 if (!hasNameFields) | |
| 466 content += this.getRecipientNameHtml_(); | |
| 467 | |
| 468 content += '</div>'; | |
| 469 $('dynamic-content-area').innerHTML = content; | |
| 470 | |
| 471 var list = $('full-name-list'); | |
| 472 if (list) { | |
| 473 options.autofillOptions.AutofillNameValuesList.decorate(list); | |
| 474 list.autoExpands = true; | |
| 475 } | |
| 476 | |
| 477 list = $('street-address-list'); | |
| 478 if (list) { | |
| 479 options.autofillOptions.AutofillValuesList.decorate(list); | |
| 480 list.autoExpands = true; | |
| 481 } | |
| 283 }, | 482 }, |
| 284 }; | 483 }; |
| 285 | 484 |
| 286 AutofillEditAddressOverlay.loadAddress = function(address) { | 485 AutofillEditAddressOverlay.loadAddress = function(address) { |
| 287 AutofillEditAddressOverlay.getInstance().loadAddress_(address); | 486 AutofillEditAddressOverlay.getInstance().loadAddress_(address); |
| 288 }; | 487 }; |
| 289 | 488 |
| 489 AutofillEditAddressOverlay.loadAddressComponents = function(input) { | |
| 490 AutofillEditAddressOverlay.getInstance().loadAddressComponents_(input); | |
| 491 }; | |
| 492 | |
| 290 AutofillEditAddressOverlay.setTitle = function(title) { | 493 AutofillEditAddressOverlay.setTitle = function(title) { |
| 291 $('autofill-address-title').textContent = title; | 494 $('autofill-address-title').textContent = title; |
| 292 }; | 495 }; |
| 293 | 496 |
| 294 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) { | 497 AutofillEditAddressOverlay.setValidatedPhoneNumbers = function(numbers) { |
| 295 AutofillEditAddressOverlay.getInstance().setMultiValueList_('phone-list', | 498 AutofillEditAddressOverlay.getInstance().setMultiValueList_('phone-list', |
| 296 numbers); | 499 numbers); |
| 297 $('phone-list').didReceiveValidationResult(); | 500 $('phone-list').didReceiveValidationResult(); |
| 298 }; | 501 }; |
| 299 | 502 |
| 300 // Export | 503 // Export |
| 301 return { | 504 return { |
| 302 AutofillEditAddressOverlay: AutofillEditAddressOverlay | 505 AutofillEditAddressOverlay: AutofillEditAddressOverlay |
| 303 }; | 506 }; |
| 304 }); | 507 }); |
| OLD | NEW |