OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 (function() { | 5 (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 cr.define('cr.translateInternals', function() { | 8 cr.define('cr.translateInternals', function() { |
9 | 9 |
10 var detectionLogs_ = null; | 10 var detectionLogs_ = null; |
11 | 11 |
12 function detectionLogs() { | 12 function detectionLogs() { |
13 if (detectionLogs_ === null) | 13 if (detectionLogs_ === null) |
14 detectionLogs_ = []; | 14 detectionLogs_ = []; |
15 return detectionLogs_; | 15 return detectionLogs_; |
16 } | 16 } |
17 | 17 |
18 /** | 18 /** |
19 * Initializes UI and sends a message to the browser for | 19 * Initializes UI and sends a message to the browser for |
20 * initialization. | 20 * initialization. |
21 */ | 21 */ |
22 function initialize() { | 22 function initialize() { |
23 cr.ui.decorate('tabbox', cr.ui.TabBox); | 23 cr.ui.decorate('tabbox', cr.ui.TabBox); |
24 chrome.send('requestInfo'); | 24 chrome.send('requestInfo'); |
25 | 25 |
26 var button = $('detection-logs-dump'); | 26 var button = $('detection-logs-dump'); |
27 button.addEventListener('click', onDetectionLogsDump); | 27 button.addEventListener('click', onDetectionLogsDump); |
28 | 28 |
29 var enableTranslateSettings = templateData['enable-translate-settings']; | |
30 if (!enableTranslateSettings) { | |
31 $('prefs-blocked-languages').hidden = true; | |
32 $('prefs-language-blacklist').querySelector('h2 span').hidden = true; | |
33 } | |
34 | |
35 var tabpanelNodeList = document.getElementsByTagName('tabpanel'); | 29 var tabpanelNodeList = document.getElementsByTagName('tabpanel'); |
36 var tabpanels = Array.prototype.slice.call(tabpanelNodeList, 0); | 30 var tabpanels = Array.prototype.slice.call(tabpanelNodeList, 0); |
37 var tabpanelIds = tabpanels.map(function(tab) { | 31 var tabpanelIds = tabpanels.map(function(tab) { |
38 return tab.id; | 32 return tab.id; |
39 }); | 33 }); |
40 | 34 |
41 var tabNodeList = document.getElementsByTagName('tab'); | 35 var tabNodeList = document.getElementsByTagName('tab'); |
42 var tabs = Array.prototype.slice.call(tabNodeList, 0); | 36 var tabs = Array.prototype.slice.call(tabNodeList, 0); |
43 tabs.forEach(function(tab) { | 37 tabs.forEach(function(tab) { |
44 tab.onclick = function(e) { | 38 tab.onclick = function(e) { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 /** | 424 /** |
431 * The entry point of the UI. | 425 * The entry point of the UI. |
432 */ | 426 */ |
433 function main() { | 427 function main() { |
434 cr.doc.addEventListener('DOMContentLoaded', | 428 cr.doc.addEventListener('DOMContentLoaded', |
435 cr.translateInternals.initialize); | 429 cr.translateInternals.initialize); |
436 } | 430 } |
437 | 431 |
438 main(); | 432 main(); |
439 })(); | 433 })(); |
OLD | NEW |