Last active
August 26, 2021 17:15
-
-
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.
This file contains 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 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