| 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 <include src="../uber/uber_utils.js"> | 5 <include src="../uber/uber_utils.js"> |
| 6 | 6 |
| 7 /////////////////////////////////////////////////////////////////////////////// | 7 /////////////////////////////////////////////////////////////////////////////// |
| 8 // Globals: | 8 // Globals: |
| 9 /** @const */ var RESULTS_PER_PAGE = 150; | 9 /** @const */ var RESULTS_PER_PAGE = 150; |
| 10 | 10 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 [this.searchText_, this.offset_, this.rangeInDays_, endTime, maxResults]); | 608 [this.searchText_, this.offset_, this.rangeInDays_, endTime, maxResults]); |
| 609 }; | 609 }; |
| 610 | 610 |
| 611 /** | 611 /** |
| 612 * Check to see if we have data for the given page. | 612 * Check to see if we have data for the given page. |
| 613 * @param {number} page The page number. | 613 * @param {number} page The page number. |
| 614 * @return {boolean} Whether we have any data for the given page. | 614 * @return {boolean} Whether we have any data for the given page. |
| 615 * @private | 615 * @private |
| 616 */ | 616 */ |
| 617 HistoryModel.prototype.haveDataForPage_ = function(page) { | 617 HistoryModel.prototype.haveDataForPage_ = function(page) { |
| 618 return (page * RESULTS_PER_PAGE < this.getSize()); | 618 return page * RESULTS_PER_PAGE < this.getSize(); |
| 619 }; | 619 }; |
| 620 | 620 |
| 621 /** | 621 /** |
| 622 * Check to see if we have data to fill the given page. | 622 * Check to see if we have data to fill the given page. |
| 623 * @param {number} page The page number. | 623 * @param {number} page The page number. |
| 624 * @return {boolean} Whether we have data to fill the page. | 624 * @return {boolean} Whether we have data to fill the page. |
| 625 * @private | 625 * @private |
| 626 */ | 626 */ |
| 627 HistoryModel.prototype.canFillPage_ = function(page) { | 627 HistoryModel.prototype.canFillPage_ = function(page) { |
| 628 return ((page + 1) * RESULTS_PER_PAGE <= this.getSize()); | 628 return ((page + 1) * RESULTS_PER_PAGE <= this.getSize()); |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 | 1256 |
| 1257 this.model = model; | 1257 this.model = model; |
| 1258 this.view = view; | 1258 this.view = view; |
| 1259 | 1259 |
| 1260 if (typeof this.checker_ != 'undefined' && this.checker_) { | 1260 if (typeof this.checker_ != 'undefined' && this.checker_) { |
| 1261 clearInterval(this.checker_); | 1261 clearInterval(this.checker_); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 // TODO(glen): Replace this with a bound method so we don't need | 1264 // TODO(glen): Replace this with a bound method so we don't need |
| 1265 // public model and view. | 1265 // public model and view. |
| 1266 this.checker_ = setInterval((function(state_obj) { | 1266 this.checker_ = window.setInterval(function(stateObj) { |
| 1267 var hashData = state_obj.getHashData(); | 1267 var hashData = stateObj.getHashData(); |
| 1268 var isGroupedByDomain = (hashData.grouped == 'true'); | 1268 var isGroupedByDomain = hashData.grouped == 'true'; |
| 1269 var page = parseInt(hashData.page, 10); | 1269 var page = parseInt(hashData.page, 10); |
| 1270 var range = parseInt(hashData.range, 10); | 1270 var range = parseInt(hashData.range, 10); |
| 1271 var offset = parseInt(hashData.offset, 10); | 1271 var offset = parseInt(hashData.offset, 10); |
| 1272 if (hashData.q != state_obj.model.getSearchText() || | 1272 if (hashData.q != stateObj.model.getSearchText() || |
| 1273 page != state_obj.view.getPage() || | 1273 page != stateObj.view.getPage() || |
| 1274 isGroupedByDomain != state_obj.view.model_.getGroupByDomain() || | 1274 isGroupedByDomain != stateObj.view.model_.getGroupByDomain() || |
| 1275 range != state_obj.model.rangeInDays || | 1275 range != stateObj.model.rangeInDays || |
| 1276 offset != state_obj.model.offset) { | 1276 offset != stateObj.model.offset) { |
| 1277 state_obj.view.setPageState(hashData.q, page, isGroupedByDomain, | 1277 stateObj.view.setPageState(hashData.q, page, isGroupedByDomain, |
| 1278 range, offset); | 1278 range, offset); |
| 1279 } | 1279 } |
| 1280 }), 50, this); | 1280 }, 50, this); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 /** | 1283 /** |
| 1284 * Holds the singleton instance. | 1284 * Holds the singleton instance. |
| 1285 */ | 1285 */ |
| 1286 PageState.instance = null; | 1286 PageState.instance = null; |
| 1287 | 1287 |
| 1288 /** | 1288 /** |
| 1289 * @return {Object} An object containing parameters from our window hash. | 1289 * @return {Object} An object containing parameters from our window hash. |
| 1290 */ | 1290 */ |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 * @param {Element} checkbox The checkbox that has been clicked. | 1593 * @param {Element} checkbox The checkbox that has been clicked. |
| 1594 */ | 1594 */ |
| 1595 function updateParentCheckbox(checkbox) { | 1595 function updateParentCheckbox(checkbox) { |
| 1596 if (checkbox.checked) | 1596 if (checkbox.checked) |
| 1597 return; | 1597 return; |
| 1598 | 1598 |
| 1599 var entry = findAncestorByClass(checkbox, 'site-entry'); | 1599 var entry = findAncestorByClass(checkbox, 'site-entry'); |
| 1600 if (!entry) | 1600 if (!entry) |
| 1601 return; | 1601 return; |
| 1602 | 1602 |
| 1603 var group_checkbox = entry.querySelector('.site-domain-wrapper input'); | 1603 var groupCheckbox = entry.querySelector('.site-domain-wrapper input'); |
| 1604 if (group_checkbox) | 1604 if (groupCheckbox) |
| 1605 group_checkbox.checked = false; | 1605 groupCheckbox.checked = false; |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 function entryBoxMousedown(event) { | 1608 function entryBoxMousedown(event) { |
| 1609 // Prevent text selection when shift-clicking to select multiple entries. | 1609 // Prevent text selection when shift-clicking to select multiple entries. |
| 1610 if (event.shiftKey) { | 1610 if (event.shiftKey) { |
| 1611 event.preventDefault(); | 1611 event.preventDefault(); |
| 1612 } | 1612 } |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 function removeNode(node) { | 1615 function removeNode(node) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 } | 1761 } |
| 1762 } | 1762 } |
| 1763 | 1763 |
| 1764 // Add handlers to HTML elements. | 1764 // Add handlers to HTML elements. |
| 1765 document.addEventListener('DOMContentLoaded', load); | 1765 document.addEventListener('DOMContentLoaded', load); |
| 1766 | 1766 |
| 1767 // This event lets us enable and disable menu items before the menu is shown. | 1767 // This event lets us enable and disable menu items before the menu is shown. |
| 1768 document.addEventListener('canExecute', function(e) { | 1768 document.addEventListener('canExecute', function(e) { |
| 1769 e.canExecute = true; | 1769 e.canExecute = true; |
| 1770 }); | 1770 }); |
| OLD | NEW |