Skip to content

Commit 507f2a9

Browse files
committed
WIP: Display bookmark favicons
1 parent 3f13e5e commit 507f2a9

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"options_ui": {
3232
"page": "options.html"
3333
},
34-
"permissions": ["bookmarks", "contextMenus", "history", "storage"],
34+
"permissions": ["bookmarks", "contextMenus", "favicon", "history", "storage"],
3535
"browser_specific_settings": {
3636
"gecko": {
3737
"id": "treetop@maxsmolens.org",

src/treetop/Bookmark.svelte

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
// Maximum length of displayed bookmark titles and, in tooltips, URLs.
2222
const maxLength = 78;
2323
24+
const faviconSize = 16;
25+
26+
// Favicon
27+
const faviconUrl = `/_favicon/?pageUrl=${encodeURIComponent(
28+
new URL(url).origin,
29+
)}&size=${faviconSize}`;
30+
2431
let name: string;
2532
$: {
2633
// Set name, truncating based on preference setting.
@@ -100,6 +107,15 @@
100107
}
101108
}
102109
110+
span {
111+
white-space: nowrap;
112+
}
113+
114+
img {
115+
vertical-align: middle;
116+
padding-right: 3px;
117+
}
118+
103119
a:link,
104120
a:visited {
105121
color: inherit;
@@ -149,6 +165,13 @@
149165
}
150166
</style>
151167

152-
<a href={url} data-node-id={nodeId} title={tooltip} class={visitedClass}>
153-
{name}
154-
</a>
168+
<span>
169+
<img
170+
aria-hidden={true}
171+
src={faviconUrl}
172+
height={faviconSize}
173+
width={faviconSize} />
174+
<a href={url} data-node-id={nodeId} title={tooltip} class={visitedClass}>
175+
{name}
176+
</a>
177+
</span>

0 commit comments

Comments
 (0)