Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: chrome/browser/resources/md_history/history_item.js

Issue 2046303002: [MD History] Add history-searched-label to embolden the synced device search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@disable_grouped
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_history/history_item.js
diff --git a/chrome/browser/resources/md_history/history_item.js b/chrome/browser/resources/md_history/history_item.js
index c061eef1fff60c114ab8f08715420c3dcd969734..b7e7f766f6079958d614c1aeed517b8ebe65a588 100644
--- a/chrome/browser/resources/md_history/history_item.js
+++ b/chrome/browser/resources/md_history/history_item.js
@@ -28,8 +28,6 @@ cr.define('md_history', function() {
numberOfItems: {type: Number}
},
- observers: ['setSearchedTextToBold_(item.title, searchTerm)'],
-
/**
* When a history-item is selected the toolbar is notified and increases
* or decreases its count of selected items accordingly.
@@ -64,41 +62,6 @@ cr.define('md_history', function() {
cr.icon.getFaviconImageSet(this.item.url);
},
- /**
- * Updates the page title. If the result was from a search, highlights any
- * occurrences of the search term in bold.
- * @private
- */
- // TODO(calamity): Pull this bolding behavior into a separate element for
- // synced device search.
- setSearchedTextToBold_: function() {
- var i = 0;
- var titleElem = this.$.title;
- var titleText = this.item.title;
-
- if (this.searchTerm == '' || this.searchTerm == null) {
- titleElem.textContent = titleText;
- return;
- }
-
- var re = new RegExp(quoteString(this.searchTerm), 'gim');
- var match;
- titleElem.textContent = '';
- while (match = re.exec(titleText)) {
- if (match.index > i)
- titleElem.appendChild(document.createTextNode(
- titleText.slice(i, match.index)));
- i = re.lastIndex;
- // Mark the highlighted text in bold.
- var b = document.createElement('b');
- b.textContent = titleText.substring(match.index, i);
- titleElem.appendChild(b);
- }
- if (i < titleText.length)
- titleElem.appendChild(
- document.createTextNode(titleText.slice(i)));
- },
-
selectionNotAllowed_: function() {
return !loadTimeData.getBoolean('allowDeletingHistory');
},

Powered by Google App Engine
This is Rietveld 408576698