-
-
Save mykiwi/0b9ebc4850ef28a8686d83e702205fee to your computer and use it in GitHub Desktop.
Greasemonkey scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Favicons for HackerNews | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
for(let link of document.querySelectorAll('.titlelink')) { | |
const domain = new URL(link.href).hostname | |
const imageUrl = `https://icons.duckduckgo.com/ip3/${domain}.ico` | |
const image = document.createElement('img') | |
image.src = imageUrl | |
image.width = 16 | |
image.height = 16 | |
image.style.paddingRight = '0.25em' | |
image.style.paddingLeft = '0.25em' | |
link.prepend(image) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Favicons for Lobsters | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
for(let element of document.querySelectorAll('.story .details')) { | |
const link = element.querySelector('.u-url') | |
const icon = element.querySelector('.byline > a > img') | |
const domain = new URL(link.href).hostname | |
const imageUrl = `https://icons.duckduckgo.com/ip3/${domain}.ico` | |
icon.src = imageUrl | |
icon.srcset = "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment