Chromium Code Reviews| 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 /////////////////////////////////////////////////////////////////////////////// | 5 /////////////////////////////////////////////////////////////////////////////// |
| 6 // Globals: | 6 // Globals: |
| 7 var RESULTS_PER_PAGE = 150; | 7 var RESULTS_PER_PAGE = 150; |
| 8 var MAX_SEARCH_DEPTH_MONTHS = 18; | 8 var MAX_SEARCH_DEPTH_MONTHS = 18; |
| 9 | 9 |
| 10 // Amount of time between pageviews that we consider a 'break' in browsing, | 10 // Amount of time between pageviews that we consider a 'break' in browsing, |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 | 469 |
| 470 this.model_.setView(this); | 470 this.model_.setView(this); |
| 471 | 471 |
| 472 this.currentPages_ = []; | 472 this.currentPages_ = []; |
| 473 | 473 |
| 474 var self = this; | 474 var self = this; |
| 475 window.onresize = function() { | 475 window.onresize = function() { |
| 476 self.updateEntryAnchorWidth_(); | 476 self.updateEntryAnchorWidth_(); |
| 477 }; | 477 }; |
| 478 self.updateEditControls_(); | 478 self.updateEditControls_(); |
| 479 this.editButtonTd_.hidden = true; | |
|
James Hawkins
2011/10/15 20:39:43
Inconsistent. The line directly above this uses se
NaveenBobbili (Motorola)
2011/10/18 04:12:43
Done.
| |
| 479 | 480 |
| 480 this.boundUpdateRemoveButton_ = function(e) { | 481 this.boundUpdateRemoveButton_ = function(e) { |
| 481 return self.updateRemoveButton_(e); | 482 return self.updateRemoveButton_(e); |
| 482 }; | 483 }; |
| 483 } | 484 } |
| 484 | 485 |
| 485 // HistoryView, public: ------------------------------------------------------- | 486 // HistoryView, public: ------------------------------------------------------- |
| 486 /** | 487 /** |
| 487 * Do a search and optionally view a certain page. | 488 * Do a search and optionally view a certain page. |
| 488 * @param {string} term The string to search for. | 489 * @param {string} term The string to search for. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 | 577 |
| 577 HistoryView.prototype.setPageRendered_ = function(page) { | 578 HistoryView.prototype.setPageRendered_ = function(page) { |
| 578 page.isRendered = true; | 579 page.isRendered = true; |
| 579 this.currentPages_.push(page); | 580 this.currentPages_.push(page); |
| 580 }; | 581 }; |
| 581 | 582 |
| 582 /** | 583 /** |
| 583 * Update the page with results. | 584 * Update the page with results. |
| 584 */ | 585 */ |
| 585 HistoryView.prototype.displayResults_ = function() { | 586 HistoryView.prototype.displayResults_ = function() { |
| 587 // Hide the Edit Button if we are not in edit mode and | |
|
James Hawkins
2011/10/15 20:39:43
Don't use 'we' in comments; it's ambiguous.
James Hawkins
2011/10/15 20:39:43
nit: Fill up the 80 cols when writing comments ins
NaveenBobbili (Motorola)
2011/10/18 04:12:43
Done.
NaveenBobbili (Motorola)
2011/10/18 04:12:43
Done.
| |
| 588 // if there are no history results to show. | |
| 589 if (this.model_.getSize() <= 0 && !this.model_.getEditMode()) | |
|
James Hawkins
2011/10/15 20:39:43
When can getSize() return a number < 0?
James Hawkins
2011/10/15 20:39:43
this.editButtonTd_.hidden = this.model_.getSize().
NaveenBobbili (Motorola)
2011/10/18 04:12:43
Done.
NaveenBobbili (Motorola)
2011/10/18 04:12:43
Done.
| |
| 590 this.editButtonTd_.hidden = true; | |
| 591 else | |
| 592 this.editButtonTd_.hidden = false; | |
| 593 | |
| 586 var results = this.model_.getNumberedRange( | 594 var results = this.model_.getNumberedRange( |
| 587 this.pageIndex_ * RESULTS_PER_PAGE, | 595 this.pageIndex_ * RESULTS_PER_PAGE, |
| 588 this.pageIndex_ * RESULTS_PER_PAGE + RESULTS_PER_PAGE); | 596 this.pageIndex_ * RESULTS_PER_PAGE + RESULTS_PER_PAGE); |
| 589 | 597 |
| 590 if (this.model_.getSearchText()) { | 598 if (this.model_.getSearchText()) { |
| 591 var resultTable = createElementWithClassName('table', 'results'); | 599 var resultTable = createElementWithClassName('table', 'results'); |
| 592 resultTable.cellSpacing = 0; | 600 resultTable.cellSpacing = 0; |
| 593 resultTable.cellPadding = 0; | 601 resultTable.cellPadding = 0; |
| 594 resultTable.border = 0; | 602 resultTable.border = 0; |
| 595 | 603 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1064 * else). | 1072 * else). |
| 1065 */ | 1073 */ |
| 1066 function historyDeleted() { | 1074 function historyDeleted() { |
| 1067 window.console.log('History deleted'); | 1075 window.console.log('History deleted'); |
| 1068 var anyChecked = document.querySelector('.entry input:checked') != null; | 1076 var anyChecked = document.querySelector('.entry input:checked') != null; |
| 1069 if (!(historyView.getEditMode() && anyChecked)) | 1077 if (!(historyView.getEditMode() && anyChecked)) |
| 1070 historyView.reload(); | 1078 historyView.reload(); |
| 1071 } | 1079 } |
| 1072 | 1080 |
| 1073 document.addEventListener('DOMContentLoaded', load); | 1081 document.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |