Skip to content

Instantly share code, notes, and snippets.

@vyznev
Last active August 26, 2021 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyznev/944e0ac962790bcc97d0 to your computer and use it in GitHub Desktop.
Save vyznev/944e0ac962790bcc97d0 to your computer and use it in GitHub Desktop.
User script to restyle the OP's username in comments on Meta.SE so that it's circled by a red ellipse, as per http://meta.stackexchange.com/questions/229759/you-cant-see-the-question-owners-special-color/231282#231282.
// ==UserScript==
// @name Circle OP's username on Meta.SE
// @version 1.1
// @description Restyle the OP's username in comments on Meta.SE so that it's circled by a red ellipse.
// @namespace https://github.com/vyznev/
// @author Ilmari Karonen
// @license ISC (http://opensource.org/licenses/ISC)
// @match *://meta.stackexchange.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
var css =
"a.comment-user.owner {\n" +
" border: 3px solid #faa;\n" +
" border-radius: 53% 47%;\n" +
" padding: 0.4em !important; /* override existing padding style */\n" +
" margin: -0.4em;\n" +
" background: transparent;\n" +
"}\n" +
"span.comment-copy {\n" +
" position: relative; /* keep username border from overlapping text */\n" +
"}\n";
var style = document.createElement('style');
style.textContent = css;
var parent = (document.head || document.documentElement);
if (parent) parent.appendChild(style);
else {
// work-around for https://github.com/greasemonkey/greasemonkey/issues/2996
var obs = new MutationObserver(function () {
var parent = (document.head || document.documentElement);
if (parent) { obs.disconnect(); parent.appendChild(style); }
});
obs.observe(document, {childList: true});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment