Show HN: Favicons for HN
gist.github.com
gist.github.com
Features need to be ruthlessly questioned.
> Refused to load the image '<URL>' because it violates the following Content Security Policy directive: "img-src data: 'self' <URL>".
Overriding this would probably require an extension with a Service Worker that edits the CSP header.
Unfortunately, it still doesn't help in Tamper Monkey in Safari.
ViolentMonkey supports this API, but unfortunately doesn't use it by default. You can enable it with `// @inject-into content` in the header.
Firefox additionally has an API and context specifically for user scripts (the userScript API), but GreaseMonkey doesn't use this unfortunately. A pull request adding support for it to either GM or ViolentMonkey would be nice if someone knowledgeable were so inclined. This API provides some additional protection (scripts are subject to SOP unless the extension breaks them out, and scripts are in addition isolated from each other), so it's a "nice-to-have" but not totally necessary if your user scripts come from trustworthy sources (i.e. you write them yourself).
[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
But I think there's no need to integrate its functionality to the site. This way one can choose how to customize the site without increasing complexity of the site itself.
For example, the google domains (gmail/cal/drive/etc) all show the same google accounts favicon [1] and we had to special case a few more.
// ==UserScript==
// @name hacker news favicons
// @match https://news.ycombinator.com/*
// ==/UserScript==
for (let link of document.querySelectorAll('.titlelink')) {
if (link.attributes["hasIcon"] != 'true') {
const domain = new URL(link.href).hostname
const imageUrl = `https://icons.duckduckgo.com/ip3/${domain}.ico`
const image = document.createElement('img')
link.attributes["hasIcon"] = 'true'
image.src = imageUrl
image.width = 16
image.height = 16
image.style.paddingRight = '0.50em'
image.style.paddingLeft = '0.50em'
image.style.verticalAlign = 'middle';
image.style.filter = 'grayscale(1)';
link.prepend(image)
}
}* https://news.ycombinator.com/item?id=31096151
* https://gist.github.com/goldbattle/695f869e43fe8d0e628061cb9...
I don't want HN to turn into something like slack that is filled with emojis and animated gifs.
It's just too much noise.
HackerNew [1] adds a 'hideAll' button to the HN top bar and an 'Open in new tabs' control. This is a minimal, non distracting, change which optimizes my workflow of occasionally visiting HN throughout the day to gather a set of interesting stories to drill into but avoiding re-skimming the same stories on every visit. Source available [2]
[1] https://chrome.google.com/webstore/detail/hackernew/ehlfambi...
It shows smaller favicons, and it prevents adding new images when going back in history too :)
https://gist.github.com/frabert/48b12088441f6195ea9292c2a5a7...
This is one of the few places on the web where I'm not utterly overwhelmed by visual clutter, and I genuinely wish more sites had a 'no images/thumbnails' mode like HN.
I've been using it on a links heavy dashboard page for a couple of years now, and it always worked.
I'll probably switch to DDG now tho.
---
Publishing request is pending.
> Loading module from “https://hn.hsblhsn.me/assets/index.c8baae85.js” was blocked because of a disallowed MIME type (“text/plain”).
> The resource from “https://hn.hsblhsn.me/assets/index.49215043.css” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff).
1. Your web browser is not supported. 2. You use some kind of strict browser feature or extension. 3. My code is crap.
I am going to solve point 3 soon.
I'd prefer to only share that information with sites I click on, and HN itself, of course.
https://hn.algolia.com/cool_apps
(It's linked from the bottom of each search result page, if you search from inside HN).
image.width = 12
image.height = 12
image.style.marginRight = '0.25em'
//image.style.paddingRight = '0.25em'
//image.style.paddingLeft = '0.25em'
document.querySelectorAll('.athing > td:nth-child(3), .titlelink').forEach(e => {
e.style.display = 'flex',
e.style.alignItems = 'center',
e.style.marginRight = '0.25em'
})
Screenshot: https://imgur.com/BN2wHgoVisually I find them messy and not helpful for filtering.