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 var MIN_VERSION_TAB_CLOSE = 25; | 5 var MIN_VERSION_TAB_CLOSE = 25; |
6 var MIN_VERSION_TARGET_ID = 26; | 6 var MIN_VERSION_TARGET_ID = 26; |
7 var MIN_VERSION_NEW_TAB = 29; | 7 var MIN_VERSION_NEW_TAB = 29; |
8 var MIN_VERSION_TAB_ACTIVATE = 30; | 8 var MIN_VERSION_TAB_ACTIVATE = 30; |
9 | 9 |
10 function sendCommand(command, args) { | 10 function sendCommand(command, args) { |
(...skipping 22 matching lines...) Expand all Loading... |
33 tabHeader.appendChild(button); | 33 tabHeader.appendChild(button); |
34 tabHeader.addEventListener('click', selectTab.bind(null, tabContent.id)); | 34 tabHeader.addEventListener('click', selectTab.bind(null, tabContent.id)); |
35 $('navigation').appendChild(tabHeader); | 35 $('navigation').appendChild(tabHeader); |
36 } | 36 } |
37 onHashChange(); | 37 onHashChange(); |
38 initSettings(); | 38 initSettings(); |
39 sendCommand('init-ui'); | 39 sendCommand('init-ui'); |
40 } | 40 } |
41 | 41 |
42 function onHashChange() { | 42 function onHashChange() { |
43 var hash = window.location.hash.slice(1); | 43 var hash = window.location.hash.slice(1).toLowerCase(); |
44 if (!selectTab(hash)) | 44 if (!selectTab(hash)) |
45 selectTab('devices'); | 45 selectTab('devices'); |
46 } | 46 } |
47 | 47 |
48 /** | 48 /** |
49 * @param {string} id Tab id. | 49 * @param {string} id Tab id. |
50 * @return {boolean} True if successful. | 50 * @return {boolean} True if successful. |
51 */ | 51 */ |
52 function selectTab(id) { | 52 function selectTab(id) { |
53 var tabContents = document.querySelectorAll('#content > div'); | 53 var tabContents = document.querySelectorAll('#content > div'); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 line.classList.remove('fresh'); | 801 line.classList.remove('fresh'); |
802 var freshLine = createEmptyConfigLine(); | 802 var freshLine = createEmptyConfigLine(); |
803 line.parentNode.appendChild(freshLine); | 803 line.parentNode.appendChild(freshLine); |
804 if (opt_selectNew) | 804 if (opt_selectNew) |
805 freshLine.querySelector('.port').focus(); | 805 freshLine.querySelector('.port').focus(); |
806 } | 806 } |
807 | 807 |
808 document.addEventListener('DOMContentLoaded', onload); | 808 document.addEventListener('DOMContentLoaded', onload); |
809 | 809 |
810 window.addEventListener('hashchange', onHashChange); | 810 window.addEventListener('hashchange', onHashChange); |
OLD | NEW |