diff options
-rw-r--r-- | greentext.user.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/greentext.user.js b/greentext.user.js new file mode 100644 index 0000000..42a0e3a --- /dev/null +++ b/greentext.user.js @@ -0,0 +1,27 @@ +// ==UserScript== +// @name devRant Greentext +// @namespace https://devrant.com +// @include https://devrant.com/* +// @version 1 +// @description Makes lines prefixed with > green. Just like greentext does. +// @run-at document-end +// @grant none +// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js +// ==/UserScript== + +(function() { + $('.rantlist-content,.rantlist-title-text,.username-row+.rantlist-title').each(function() { + $(this).html( + $(this) + .html() + .split("<br>") + .map((text) => text.trim()) + .map((text) => { + if (text.startsWith(">")) { + return `<span style="color: #78FB78;">${text}</span>`; + } + return text; + }) + .join("<br>")); + }); +})(); |