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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 checkEmptyLine(line); | 703 checkEmptyLine(line); |
704 | 704 |
705 return line; | 705 return line; |
706 } | 706 } |
707 | 707 |
708 function validatePort(input) { | 708 function validatePort(input) { |
709 var match = input.value.match(/^(\d+)$/); | 709 var match = input.value.match(/^(\d+)$/); |
710 if (!match) | 710 if (!match) |
711 return false; | 711 return false; |
712 var port = parseInt(match[1]); | 712 var port = parseInt(match[1]); |
713 if (port < 1024 || 10000 < port) | 713 if (port < 1024 || 65535 < port) |
714 return false; | 714 return false; |
715 | 715 |
716 var inputs = document.querySelectorAll('input.port:not(.invalid)'); | 716 var inputs = document.querySelectorAll('input.port:not(.invalid)'); |
717 for (var i = 0; i != inputs.length; ++i) { | 717 for (var i = 0; i != inputs.length; ++i) { |
718 if (inputs[i] == input) | 718 if (inputs[i] == input) |
719 break; | 719 break; |
720 if (parseInt(inputs[i].value) == port) | 720 if (parseInt(inputs[i].value) == port) |
721 return false; | 721 return false; |
722 } | 722 } |
723 return true; | 723 return true; |
724 } | 724 } |
725 | 725 |
726 function validateLocation(input) { | 726 function validateLocation(input) { |
727 var match = input.value.match(/^([a-zA-Z0-9\.]+):(\d+)$/); | 727 var match = input.value.match(/^([a-zA-Z0-9\.]+):(\d+)$/); |
728 if (!match) | 728 if (!match) |
729 return false; | 729 return false; |
730 var port = parseInt(match[2]); | 730 var port = parseInt(match[2]); |
731 return port <= 10000; | 731 return port <= 65535; |
732 } | 732 } |
733 | 733 |
734 function createEmptyConfigLine() { | 734 function createEmptyConfigLine() { |
735 var line = createConfigLine('', ''); | 735 var line = createConfigLine('', ''); |
736 line.classList.add('fresh'); | 736 line.classList.add('fresh'); |
737 return line; | 737 return line; |
738 } | 738 } |
739 | 739 |
740 function createConfigField(value, className, hint, validate) { | 740 function createConfigField(value, className, hint, validate) { |
741 var input = document.createElement('input'); | 741 var input = document.createElement('input'); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 line.classList.remove('fresh'); | 803 line.classList.remove('fresh'); |
804 var freshLine = createEmptyConfigLine(); | 804 var freshLine = createEmptyConfigLine(); |
805 line.parentNode.appendChild(freshLine); | 805 line.parentNode.appendChild(freshLine); |
806 if (opt_selectNew) | 806 if (opt_selectNew) |
807 freshLine.querySelector('.port').focus(); | 807 freshLine.querySelector('.port').focus(); |
808 } | 808 } |
809 | 809 |
810 document.addEventListener('DOMContentLoaded', onload); | 810 document.addEventListener('DOMContentLoaded', onload); |
811 | 811 |
812 window.addEventListener('hashchange', onHashChange); | 812 window.addEventListener('hashchange', onHashChange); |
OLD | NEW |