As part of the rollout of new network site themes, many of the Stack Exchange sites I visit regularly now have links in posts and comments underlined.
Preferring the non-underlined look, and since I primarily use Chrome (68.0.3440.106 (Official Build) (64-bit)) and Edge (42.17692.1004.0), which do not appear to have a global override setting, I installed Tampermonkey and wrote a small userscript, based on an example I found on Stack Apps, and some related code I found via searching this site for a solution:
// ==UserScript==
// @name Remove link underlines on Stack Exchange
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
// @match *://*.mathoverflow.com/*
// @match *://*.serverfault.com/*
// @match *://*.superuser.com/*
// @match *://*.stackapps.com/*
// @match *://*.askubuntu.com/*
// @grant none
// @run-at document-body
// ==/UserScript==
(function() {
'use strict';
// Your code here...
var style = document.createElement("style");
style.appendChild(document.createTextNode("a {text-decoration: none !important;}"));
document.head.appendChild(style);
})();
This seems basically to work pretty well, though I do notice brief link underlining on page load sometimes, before it is replaced with the non-underlined look.
Is there something I can do to make my preferred look appear more immediately, without the brief flash of underlining?
I tried // @run-at document-start
, which removed the flashing, but sometimes this fails to apply the style change at all.
I have no experience in this area, beyond hacking together this first userscript, so please explain the benefits and risks of any proposed changes.
I chose (and tagged) Tampermonkey for compatibility with my browsers of choice, and to enable me to run other userscripts in future (including scripts not limited to styling changes).