mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-27 13:29:34 +07:00
Disambiguate account/local folders sample bookmarks extension (#1435)
* Disambiguate account/local folders in the UI for sample bookmarks extension * Code-review markups * Fix lint issues
This commit is contained in:
@@ -40,7 +40,19 @@ function dumpNode(bookmarkNode, query) {
|
||||
|
||||
const anchor = $('<a>');
|
||||
anchor.attr('href', bookmarkNode.url);
|
||||
anchor.text(bookmarkNode.title);
|
||||
|
||||
// Chrome may have multiple top-level folder nodes with the same title. To
|
||||
// disambiguate them, include a suffix depending on the value of the
|
||||
// syncing property.
|
||||
//
|
||||
// folderType is set for top-level folders in the tree, and not for child
|
||||
// folders. In Chrome versions prior to milestone 134, folderType is never
|
||||
// set.
|
||||
let title_text = bookmarkNode.title;
|
||||
if (bookmarkNode.folderType) {
|
||||
title_text += bookmarkNode.syncing ? ' (Account)' : ' (Local)';
|
||||
}
|
||||
anchor.text(title_text);
|
||||
|
||||
/*
|
||||
* When clicking on a bookmark in the extension, a new tab is fired with
|
||||
|
||||
Reference in New Issue
Block a user