Skip to content

Commit

Permalink
WIP: Display bookmark favicons
Browse files Browse the repository at this point in the history
  • Loading branch information
msmolens committed Jan 2, 2024
1 parent 3f13e5e commit 507f2a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"options_ui": {
"page": "options.html"
},
"permissions": ["bookmarks", "contextMenus", "history", "storage"],
"permissions": ["bookmarks", "contextMenus", "favicon", "history", "storage"],
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
Expand Down
29 changes: 26 additions & 3 deletions src/treetop/Bookmark.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
// Maximum length of displayed bookmark titles and, in tooltips, URLs.
const maxLength = 78;
const faviconSize = 16;
// Favicon
const faviconUrl = `/_favicon/?pageUrl=${encodeURIComponent(
new URL(url).origin,
)}&size=${faviconSize}`;
let name: string;
$: {
// Set name, truncating based on preference setting.
Expand Down Expand Up @@ -100,6 +107,15 @@
}
}
span {
white-space: nowrap;
}
img {
vertical-align: middle;
padding-right: 3px;
}
a:link,
a:visited {
color: inherit;
Expand Down Expand Up @@ -149,6 +165,13 @@
}
</style>

<a href={url} data-node-id={nodeId} title={tooltip} class={visitedClass}>
{name}
</a>
<span>
<img

Check failure on line 169 in src/treetop/Bookmark.svelte

View workflow job for this annotation

GitHub Actions / build

A11y: <img> element should have an alt attribute(a11y-missing-attribute)
aria-hidden={true}
src={faviconUrl}
height={faviconSize}
width={faviconSize} />
<a href={url} data-node-id={nodeId} title={tooltip} class={visitedClass}>
{name}
</a>
</span>

0 comments on commit 507f2a9

Please sign in to comment.