Display favicons for external links
This commit is contained in:
12
assets/content.js
Normal file
12
assets/content.js
Normal file
@@ -0,0 +1,12 @@
|
||||
(function () {
|
||||
document.querySelectorAll('.content a[href^="http"]').forEach(function (a) {
|
||||
var hostname = new URL(a.href).hostname;
|
||||
var img = document.createElement('img');
|
||||
img.src = 'https://icons.duckduckgo.com/ip3/' + hostname + '.ico';
|
||||
img.width = 16;
|
||||
img.height = 16;
|
||||
img.style.verticalAlign = 'middle';
|
||||
img.style.marginRight = '3px';
|
||||
a.prepend(img);
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user