Skip to content

Instantly share code, notes, and snippets.

@selcuk
Last active April 19, 2023 02:15
Show Gist options
  • Save selcuk/00948de9717b25d0d5e824c3e80da959 to your computer and use it in GitHub Desktop.
Save selcuk/00948de9717b25d0d5e824c3e80da959 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Hacker News UI
// @description Better Hacker News UI
// @namespace https://gist.github.com/selcuk
// @version 0.3
// @match https://news.ycombinator.com/*
// @icon https://news.ycombinator.com/favicon.ico
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
(function () {
'use strict';
// Improve style
GM_addStyle('* { font-size: 18px !important; font-family: Arial, Helvetica, sans-serif; }');
GM_addStyle('code { font-family: Courier, monospace; }');
GM_addStyle('table#hnmain { background-color: white; max-width: 800px; }');
GM_addStyle('table#hnmain > tbody > tr > td { background-color: white; }');
GM_addStyle('.athing > td { border-top: 1px dashed #cccccc; padding: 8px 0; }');
window.addEventListener('load', function () {
// Append archive.today link
let titleSpan = document.querySelector(".titleline");
let articleUrl = titleSpan.querySelector("a").href;
titleSpan.innerHTML += ' [<a href="https://archive.is/newest/' + articleUrl + '" style="text-decoration: underline;">archive.today</a>]';
// Remove favicon (because why not?)
var favicon = document.querySelector('link[rel~="icon"]');
var clone = favicon.cloneNode(!0);
clone.href = "data:image/jpeg;base64,";
favicon.parentNode.removeChild(favicon);
document.head.appendChild(clone);
}, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment