| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 this.lastDisplayed_ = []; | 468 this.lastDisplayed_ = []; |
| 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 this.updateEditControls_(); |
| 479 this.editButtonTd_.hidden = true; |
| 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 there are no history results to display. |
| 588 this.editButtonTd_.hidden = !this.model_.getSize(); |
| 589 |
| 586 var results = this.model_.getNumberedRange( | 590 var results = this.model_.getNumberedRange( |
| 587 this.pageIndex_ * RESULTS_PER_PAGE, | 591 this.pageIndex_ * RESULTS_PER_PAGE, |
| 588 this.pageIndex_ * RESULTS_PER_PAGE + RESULTS_PER_PAGE); | 592 this.pageIndex_ * RESULTS_PER_PAGE + RESULTS_PER_PAGE); |
| 589 | 593 |
| 590 if (this.model_.getSearchText()) { | 594 if (this.model_.getSearchText()) { |
| 591 var resultTable = createElementWithClassName('table', 'results'); | 595 var resultTable = createElementWithClassName('table', 'results'); |
| 592 resultTable.cellSpacing = 0; | 596 resultTable.cellSpacing = 0; |
| 593 resultTable.cellPadding = 0; | 597 resultTable.cellPadding = 0; |
| 594 resultTable.border = 0; | 598 resultTable.border = 0; |
| 595 | 599 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 * else). | 1068 * else). |
| 1065 */ | 1069 */ |
| 1066 function historyDeleted() { | 1070 function historyDeleted() { |
| 1067 window.console.log('History deleted'); | 1071 window.console.log('History deleted'); |
| 1068 var anyChecked = document.querySelector('.entry input:checked') != null; | 1072 var anyChecked = document.querySelector('.entry input:checked') != null; |
| 1069 if (!(historyView.getEditMode() && anyChecked)) | 1073 if (!(historyView.getEditMode() && anyChecked)) |
| 1070 historyView.reload(); | 1074 historyView.reload(); |
| 1071 } | 1075 } |
| 1072 | 1076 |
| 1073 document.addEventListener('DOMContentLoaded', load); | 1077 document.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |