OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 g_browserBridge; | 5 var g_browserBridge; |
6 var g_mainView; | 6 var g_mainView; |
7 | 7 |
8 /** | 8 /** |
9 * Main entry point called once the page has loaded. | 9 * Main entry point called once the page has loaded. |
10 */ | 10 */ |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 for (var i = 0; i < select.options.length; ++i) { | 723 for (var i = 0; i < select.options.length; ++i) { |
724 if (select.options[i].value == value) { | 724 if (select.options[i].value == value) { |
725 select.options[i].selected = true; | 725 select.options[i].selected = true; |
726 return true; | 726 return true; |
727 } | 727 } |
728 } | 728 } |
729 return false; | 729 return false; |
730 } | 730 } |
731 | 731 |
732 /** | 732 /** |
| 733 * Adds a checkbox to |parent|. The checkbox will have a label on its right |
| 734 * with text |label|. Returns the checkbox input node. |
| 735 */ |
| 736 function addLabeledCheckbox(parent, label) { |
| 737 var labelNode = addNode(parent, 'label'); |
| 738 var checkbox = addNode(labelNode, 'input'); |
| 739 checkbox.type = 'checkbox'; |
| 740 addText(labelNode, label); |
| 741 return checkbox; |
| 742 } |
| 743 |
| 744 /** |
733 * Return the last component in a path which is separated by either forward | 745 * Return the last component in a path which is separated by either forward |
734 * slashes or backslashes. | 746 * slashes or backslashes. |
735 */ | 747 */ |
736 function getFilenameFromPath(path) { | 748 function getFilenameFromPath(path) { |
737 var lastSlash = Math.max(path.lastIndexOf('/'), | 749 var lastSlash = Math.max(path.lastIndexOf('/'), |
738 path.lastIndexOf('\\')); | 750 path.lastIndexOf('\\')); |
739 if (lastSlash == -1) | 751 if (lastSlash == -1) |
740 return path; | 752 return path; |
741 | 753 |
742 return path.substr(lastSlash + 1); | 754 return path.substr(lastSlash + 1); |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 if (n.style.display == '') { | 1489 if (n.style.display == '') { |
1478 n.style.display = 'none'; | 1490 n.style.display = 'none'; |
1479 } else { | 1491 } else { |
1480 n.style.display = ''; | 1492 n.style.display = ''; |
1481 } | 1493 } |
1482 }, | 1494 }, |
1483 | 1495 |
1484 fillSelectionCheckboxes_: function(parent) { | 1496 fillSelectionCheckboxes_: function(parent) { |
1485 this.selectionCheckboxes_ = {}; | 1497 this.selectionCheckboxes_ = {}; |
1486 | 1498 |
| 1499 var onChangeFunc = this.onSelectCheckboxChanged_.bind(this); |
| 1500 |
1487 for (var i = 0; i < ALL_TABLE_COLUMNS.length; ++i) { | 1501 for (var i = 0; i < ALL_TABLE_COLUMNS.length; ++i) { |
1488 var key = ALL_TABLE_COLUMNS[i]; | 1502 var key = ALL_TABLE_COLUMNS[i]; |
1489 var checkbox = addNode(parent, 'input'); | 1503 var checkbox = addLabeledCheckbox(parent, getNameForKey(key)); |
1490 checkbox.type = 'checkbox'; | |
1491 checkbox.onchange = this.onSelectCheckboxChanged_.bind(this); | |
1492 checkbox.checked = true; | 1504 checkbox.checked = true; |
1493 addNode(parent, 'span', getNameForKey(key) + ' '); | 1505 checkbox.onchange = onChangeFunc; |
| 1506 addText(parent, ' '); |
1494 this.selectionCheckboxes_[key] = checkbox; | 1507 this.selectionCheckboxes_[key] = checkbox; |
1495 } | 1508 } |
1496 | 1509 |
1497 for (var i = 0; i < INITIALLY_HIDDEN_KEYS.length; ++i) { | 1510 for (var i = 0; i < INITIALLY_HIDDEN_KEYS.length; ++i) { |
1498 this.selectionCheckboxes_[INITIALLY_HIDDEN_KEYS[i]].checked = false; | 1511 this.selectionCheckboxes_[INITIALLY_HIDDEN_KEYS[i]].checked = false; |
1499 } | 1512 } |
1500 }, | 1513 }, |
1501 | 1514 |
1502 getSelectionColumns_: function() { | 1515 getSelectionColumns_: function() { |
1503 return getKeysForCheckedBoxes(this.selectionCheckboxes_); | 1516 return getKeysForCheckedBoxes(this.selectionCheckboxes_); |
1504 }, | 1517 }, |
1505 | 1518 |
1506 getMergeColumns_: function() { | 1519 getMergeColumns_: function() { |
1507 return getKeysForCheckedBoxes(this.mergeCheckboxes_); | 1520 return getKeysForCheckedBoxes(this.mergeCheckboxes_); |
1508 }, | 1521 }, |
1509 | 1522 |
1510 shouldMergeSimilarThreads_: function() { | 1523 shouldMergeSimilarThreads_: function() { |
1511 return $(MERGE_SIMILAR_THREADS_CHECKBOX_ID).checked; | 1524 return $(MERGE_SIMILAR_THREADS_CHECKBOX_ID).checked; |
1512 }, | 1525 }, |
1513 | 1526 |
1514 fillMergeCheckboxes_: function(parent) { | 1527 fillMergeCheckboxes_: function(parent) { |
1515 this.mergeCheckboxes_ = {}; | 1528 this.mergeCheckboxes_ = {}; |
1516 | 1529 |
| 1530 var onChangeFunc = this.onMergeCheckboxChanged_.bind(this); |
| 1531 |
1517 for (var i = 0; i < MERGEABLE_KEYS.length; ++i) { | 1532 for (var i = 0; i < MERGEABLE_KEYS.length; ++i) { |
1518 var key = MERGEABLE_KEYS[i]; | 1533 var key = MERGEABLE_KEYS[i]; |
1519 var checkbox = addNode(parent, 'input'); | 1534 var checkbox = addLabeledCheckbox(parent, getNameForKey(key)); |
1520 checkbox.type = 'checkbox'; | 1535 checkbox.onchange = onChangeFunc; |
1521 checkbox.onchange = this.onMergeCheckboxChanged_.bind(this); | 1536 addText(parent, ' '); |
1522 checkbox.checked = false; | |
1523 addNode(parent, 'span', getNameForKey(key) + ' '); | |
1524 this.mergeCheckboxes_[key] = checkbox; | 1537 this.mergeCheckboxes_[key] = checkbox; |
1525 } | 1538 } |
1526 | 1539 |
1527 for (var i = 0; i < INITIALLY_MERGED_KEYS.length; ++i) { | 1540 for (var i = 0; i < INITIALLY_MERGED_KEYS.length; ++i) { |
1528 this.mergeCheckboxes_[INITIALLY_MERGED_KEYS[i]].checked = true; | 1541 this.mergeCheckboxes_[INITIALLY_MERGED_KEYS[i]].checked = true; |
1529 } | 1542 } |
1530 }, | 1543 }, |
1531 | 1544 |
1532 fillGroupingDropdowns_: function() { | 1545 fillGroupingDropdowns_: function() { |
1533 var parent = $(GROUP_BY_CONTAINER_ID); | 1546 var parent = $(GROUP_BY_CONTAINER_ID); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 groupKey.push(entry); | 1748 groupKey.push(entry); |
1736 } | 1749 } |
1737 | 1750 |
1738 return JSON.stringify(groupKey); | 1751 return JSON.stringify(groupKey); |
1739 }; | 1752 }; |
1740 }, | 1753 }, |
1741 }; | 1754 }; |
1742 | 1755 |
1743 return MainView; | 1756 return MainView; |
1744 })(); | 1757 })(); |
OLD | NEW |