diff options
author | Roman Gräf <roman.graef@gmail.com> | 2018-05-25 15:07:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-25 15:07:42 +0000 |
commit | 83f28a6a7c3824d3ec313d1bcc637997171f1305 (patch) | |
tree | 2e67b752d1024b48b75ad1dc2b146f72a6c4fa7c | |
parent | 1f38c966c40765bc8c285f3f2baff27064f5c18f (diff) | |
download | devrant-greentext-83f28a6a7c3824d3ec313d1bcc637997171f1305.tar.gz devrant-greentext-83f28a6a7c3824d3ec313d1bcc637997171f1305.tar.bz2 devrant-greentext-83f28a6a7c3824d3ec313d1bcc637997171f1305.zip |
Initial commit
-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>")); + }); +})(); |