File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 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) ( ) ;
You can’t perform that action at this time.
0 commit comments