| 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 // TODO(kochi): Generalize the notification as a component and put it | 5 // TODO(kochi): Generalize the notification as a component and put it |
| 6 // in js/cr/ui/notification.js . | 6 // in js/cr/ui/notification.js . |
| 7 | 7 |
| 8 cr.define('options', function() { | 8 cr.define('options', function() { |
| 9 /** @const */ var OptionsPage = options.OptionsPage; | 9 /** @const */ var OptionsPage = options.OptionsPage; |
| 10 /** @const */ var LanguageList = options.LanguageList; | 10 /** @const */ var LanguageList = options.LanguageList; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // the URL hash (ex. lang_add=ja). Used for automated testing. | 83 // the URL hash (ex. lang_add=ja). Used for automated testing. |
| 84 var match = document.location.hash.match(/\blang_add=([\w-]+)/); | 84 var match = document.location.hash.match(/\blang_add=([\w-]+)/); |
| 85 if (match) { | 85 if (match) { |
| 86 var addLanguageCode = match[1]; | 86 var addLanguageCode = match[1]; |
| 87 $('language-options-list').addLanguage(addLanguageCode); | 87 $('language-options-list').addLanguage(addLanguageCode); |
| 88 } else { | 88 } else { |
| 89 OptionsPage.navigateToPage('addLanguage'); | 89 OptionsPage.navigateToPage('addLanguage'); |
| 90 } | 90 } |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 if (!cr.isMac) { |
| 94 // Set up the button for editing custom spelling dictionary. |
| 95 $('edit-dictionary-button') .onclick = function(e) { |
| 96 OptionsPage.navigateToPage('editDictionary'); |
| 97 }; |
| 98 } |
| 99 |
| 93 if (cr.isChromeOS) { | 100 if (cr.isChromeOS) { |
| 94 // Listen to user clicks on the add language list. | 101 // Listen to user clicks on the add language list. |
| 95 var addLanguageList = $('add-language-overlay-language-list'); | 102 var addLanguageList = $('add-language-overlay-language-list'); |
| 96 addLanguageList.addEventListener( | 103 addLanguageList.addEventListener( |
| 97 'click', | 104 'click', |
| 98 this.handleAddLanguageListClick_.bind(this)); | 105 this.handleAddLanguageListClick_.bind(this)); |
| 99 $('language-options-extension-ime-button').addEventListener( | 106 $('language-options-extension-ime-button').addEventListener( |
| 100 'click', | 107 'click', |
| 101 this.handleExtensionImeButtonClick_.bind(this)); | 108 this.handleExtensionImeButtonClick_.bind(this)); |
| 102 } else { | 109 } else { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 this.canDeleteLanguage_(languageCode)); | 691 this.canDeleteLanguage_(languageCode)); |
| 685 }, | 692 }, |
| 686 | 693 |
| 687 /** | 694 /** |
| 688 * Handles browse.enable_spellchecking change. | 695 * Handles browse.enable_spellchecking change. |
| 689 * @param {Event} e Change event. | 696 * @param {Event} e Change event. |
| 690 * @private | 697 * @private |
| 691 */ | 698 */ |
| 692 updateEnableSpellCheck_: function() { | 699 updateEnableSpellCheck_: function() { |
| 693 var value = !$('enable-spell-check').checked; | 700 var value = !$('enable-spell-check').checked; |
| 694 | |
| 695 $('language-options-spell-check-language-button').disabled = value; | 701 $('language-options-spell-check-language-button').disabled = value; |
| 702 if (!cr.IsMac) |
| 703 $('edit-dictionary-button').hidden = value; |
| 696 }, | 704 }, |
| 697 | 705 |
| 698 /** | 706 /** |
| 699 * Handles spellCheckDictionaryPref change. | 707 * Handles spellCheckDictionaryPref change. |
| 700 * @param {Event} e Change event. | 708 * @param {Event} e Change event. |
| 701 * @private | 709 * @private |
| 702 */ | 710 */ |
| 703 handleSpellCheckDictionaryPrefChange_: function(e) { | 711 handleSpellCheckDictionaryPrefChange_: function(e) { |
| 704 var languageCode = e.value.value; | 712 var languageCode = e.value.value; |
| 705 this.spellCheckDictionary_ = languageCode; | 713 this.spellCheckDictionary_ = languageCode; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 // only take effect after restart. | 995 // only take effect after restart. |
| 988 showMutuallyExclusiveNodes([$('language-options-ui-language-button'), | 996 showMutuallyExclusiveNodes([$('language-options-ui-language-button'), |
| 989 $('language-options-ui-notification-bar')], 1); | 997 $('language-options-ui-notification-bar')], 1); |
| 990 }; | 998 }; |
| 991 | 999 |
| 992 // Export | 1000 // Export |
| 993 return { | 1001 return { |
| 994 LanguageOptions: LanguageOptions | 1002 LanguageOptions: LanguageOptions |
| 995 }; | 1003 }; |
| 996 }); | 1004 }); |
| OLD | NEW |