Chromium Code Reviews| Index: chrome/browser/resources/history/history.js |
| diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js |
| index ea13c540614ebf93841463be8ab4b8f23b47d034..e329e90c9bbe76a8cfdf00387b415b50130234a6 100644 |
| --- a/chrome/browser/resources/history/history.js |
| +++ b/chrome/browser/resources/history/history.js |
| @@ -72,10 +72,8 @@ function Visit(result, continued, model, id) { |
| * Returns a dom structure for a browse page result or a search page result. |
| * @param {Object} propertyBag A bag of configuration properties, false by |
| * default: |
| - * <ul> |
| - * <li>isSearchResult: Whether or not the result is a search result.</li> |
| - * <li>addTitleFavicon: Whether or not the favicon should be added.</li> |
| - * </ul> |
| + * - isSearchResult: Whether or not the result is a search result. |
| + * - addTitleFavicon: Whether or not the favicon should be added. |
| * @return {Node} A DOM node to represent the history entry or search result. |
| */ |
| Visit.prototype.getResultDOM = function(propertyBag) { |
| @@ -161,7 +159,7 @@ Visit.prototype.getResultDOM = function(propertyBag) { |
| * @private |
| */ |
| Visit.prototype.getDomainFromURL_ = function(url) { |
| - var domain = url.replace(/^.+:\/\//, '').match(/[^/]+/); |
| + var domain = url.replace(/^.+?:\/\//, '').match(/[^/]+/); |
|
Patrick Dubroy
2013/01/30 19:23:04
And...this is why doing this is with a regex is a
Sergiu
2013/01/30 21:12:43
I'll put in a TODO.
Sergiu
2013/02/05 18:21:23
Put the TODO in.
|
| return domain ? domain[0] : ''; |
| }; |
| @@ -379,8 +377,8 @@ HistoryModel.prototype.addResults = function(info, results) { |
| this.isQueryFinished_ = info.finished; |
| this.queryCursor_ = info.cursor; |
| - // If the results are not for the current search term there's nothing more |
| - // to do. |
| + // If the results are not for the current search term then there is nothing |
| + // more to do. |
| if (info.term != this.searchText_) |
| return; |
| @@ -698,9 +696,9 @@ HistoryView.prototype.setVisitRendered_ = function(visit) { |
| }; |
| /** |
| - * This function generates and adds the grouped visits DOM for a certain |
| - * domain. This includes the clickable arrow and domain name and the visit |
| - * entries for that domain. |
| + * Generates and adds the grouped visits DOM for a certain domain. This |
| + * includes the clickable arrow and domain name and the visit entries for |
| + * that domain. |
| * @param {Element} results DOM object to which to add the elements. |
| * @param {string} domain Current domain name. |
| * @param {Array} domainVisits Array of visits for this domain. |
| @@ -722,7 +720,9 @@ HistoryView.prototype.getGroupedVisitsDOM_ = function( |
| var numberOfVisits = createElementWithClassName('span', 'number-visits'); |
| numberOfVisits.textContent = loadTimeData.getStringF('numbervisits', |
| domainVisits.length); |
| - siteDomain.textContent = domain; |
| + var domainElement = document.createElement('span'); |
| + domainElement.textContent = domain; |
| + siteDomain.appendChild(domainElement); |
| siteDomain.appendChild(numberOfVisits); |
| siteResults.appendChild(siteDomainWrapper); |
| var resultsList = siteResults.appendChild( |
| @@ -765,9 +765,8 @@ HistoryView.prototype.groupVisitsByDomain_ = function(visits, results) { |
| }; |
| domains.sort(sortByVisits); |
| - for (var i = 0, domain; domain = domains[i]; i++) { |
| + for (var i = 0, domain; domain = domains[i]; i++) |
| this.getGroupedVisitsDOM_(results, domain, visitsByDomain[domain]); |
| - } |
| }; |
| /** |
| @@ -969,11 +968,10 @@ PageState.prototype.getHashData = function() { |
| PageState.prototype.setUIState = function(term, page, grouped) { |
| // Make sure the form looks pretty. |
| $('search-field').value = term; |
| - if (grouped) { |
| + if (grouped) |
|
Patrick Dubroy
2013/01/30 19:23:04
I'd change this to:
$('display-filter-sites')
Sergiu
2013/02/05 18:21:23
Done.
|
| $('display-filter-sites').checked = true; |
| - } else { |
| + else |
| $('display-filter-sites').checked = false; |
| - } |
| var hash = this.getHashData(); |
| if (hash.q != term || hash.p != page || hash.g != grouped) { |
| window.location.hash = PageState.getHashString( |