OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 /////////////////////////////////////////////////////////////////////////////// | 5 /////////////////////////////////////////////////////////////////////////////// |
6 // AddLanguageOverlay class: | 6 // AddLanguageOverlay class: |
7 | 7 |
8 cr.define('options.language', function() { | 8 cr.define('options.language', function() { |
9 | 9 |
10 const OptionsPage = options.OptionsPage; | 10 const OptionsPage = options.OptionsPage; |
(...skipping 21 matching lines...) Expand all Loading... |
32 initializePage: function() { | 32 initializePage: function() { |
33 // Call base class implementation to starts preference initialization. | 33 // Call base class implementation to starts preference initialization. |
34 OptionsPage.prototype.initializePage.call(this); | 34 OptionsPage.prototype.initializePage.call(this); |
35 | 35 |
36 // Set up the cancel button. | 36 // Set up the cancel button. |
37 $('add-language-overlay-cancel-button').onclick = function(e) { | 37 $('add-language-overlay-cancel-button').onclick = function(e) { |
38 OptionsPage.clearOverlays(); | 38 OptionsPage.clearOverlays(); |
39 }; | 39 }; |
40 | 40 |
41 // Create the language list with which users can add a language. | 41 // Create the language list with which users can add a language. |
42 // Note that we have about 40 languages. | |
43 var addLanguageList = $('add-language-overlay-language-list'); | 42 var addLanguageList = $('add-language-overlay-language-list'); |
44 var languageListData = templateData.languageList; | 43 var languageListData = templateData.languageList; |
45 for (var i = 0; i < languageListData.length; i++) { | 44 for (var i = 0; i < languageListData.length; i++) { |
46 var language = languageListData[i]; | 45 var language = languageListData[i]; |
47 var button = document.createElement('button'); | 46 var displayText = language.displayName; |
48 button.className = 'link-button'; | |
49 button.textContent = language.displayName; | |
50 // If the native name is different, add it. | 47 // If the native name is different, add it. |
51 if (language.displayName != language.nativeDisplayName) { | 48 if (language.displayName != language.nativeDisplayName) { |
52 button.textContent += ' - ' + language.nativeDisplayName; | 49 displayText += ' - ' + language.nativeDisplayName; |
53 } | 50 } |
54 button.languageCode = language.code; | 51 if (cr.isChromeOS) { |
55 var li = document.createElement('li'); | 52 var button = document.createElement('button'); |
56 li.languageCode = language.code; | 53 button.className = 'link-button'; |
57 li.appendChild(button); | 54 button.textContent = displayText; |
58 addLanguageList.appendChild(li); | 55 button.languageCode = language.code; |
| 56 var li = document.createElement('li'); |
| 57 li.languageCode = language.code; |
| 58 li.appendChild(button); |
| 59 addLanguageList.appendChild(li); |
| 60 } else { |
| 61 var option = document.createElement('option'); |
| 62 option.value = language.code; |
| 63 option.textContent = displayText; |
| 64 addLanguageList.appendChild(option); |
| 65 } |
59 } | 66 } |
60 }, | 67 }, |
61 }; | 68 }; |
62 | 69 |
63 return { | 70 return { |
64 AddLanguageOverlay: AddLanguageOverlay | 71 AddLanguageOverlay: AddLanguageOverlay |
65 }; | 72 }; |
66 }); | 73 }); |
OLD | NEW |