Skip to content

Commit b0f55f9

Browse files
authored
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
1 parent 6116518 commit b0f55f9

File tree

1 file changed

+13
-1
lines changed
  • functional-samples/sample.bookmarks

1 file changed

+13
-1
lines changed

functional-samples/sample.bookmarks/popup.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,19 @@ function dumpNode(bookmarkNode, query) {
4040

4141
const anchor = $('<a>');
4242
anchor.attr('href', bookmarkNode.url);
43-
anchor.text(bookmarkNode.title);
43+
44+
// Chrome may have multiple top-level folder nodes with the same title. To
45+
// disambiguate them, include a suffix depending on the value of the
46+
// syncing property.
47+
//
48+
// folderType is set for top-level folders in the tree, and not for child
49+
// folders. In Chrome versions prior to milestone 134, folderType is never
50+
// set.
51+
let title_text = bookmarkNode.title;
52+
if (bookmarkNode.folderType) {
53+
title_text += bookmarkNode.syncing ? ' (Account)' : ' (Local)';
54+
}
55+
anchor.text(title_text);
4456

4557
/*
4658
* When clicking on a bookmark in the extension, a new tab is fired with

0 commit comments

Comments
 (0)