Skip to content

Commit 0bd8520

Browse files
authored
Update better-hackernews.user.js
1 parent f3c6cb7 commit 0bd8520

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

better-hackernews.user.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
// @name Better Hacker News
33
// @author https://github.com/qligier/
44
// @namespace qligier
5-
// @version 20190927
5+
// @version 20231113
66
// @updateURL https://raw.githubusercontent.com/qligier/web_userscripts/master/better-hackernews.user.js
77
// @match https://news.ycombinator.com/*
88
// @grant none
99
// @run-at document-end
10+
// @inject-into content
1011
// ==/UserScript==
1112

1213
/**
@@ -116,5 +117,17 @@ td.title a:visited {
116117
const stylesheet = document.createElement('style');
117118
stylesheet.innerHTML = stylesheetContent;
118119
document.body.appendChild(stylesheet);
120+
121+
for (let link of document.querySelectorAll('.titleline > a')) {
122+
const domain = new URL(link.href).hostname
123+
const imageUrl = `https://icons.duckduckgo.com/ip3/${domain}.ico`
124+
const image = document.createElement('img')
125+
image.src = imageUrl
126+
image.width = 16
127+
image.height = 16
128+
image.style.paddingRight = '0.6em'
129+
image.style.paddingLeft = '0.25em'
130+
link.prepend(image)
131+
}
119132
}
120133
)();

0 commit comments

Comments
 (0)