From 83f28a6a7c3824d3ec313d1bcc637997171f1305 Mon Sep 17 00:00:00 2001 From: Roman Gräf Date: Fri, 25 May 2018 15:07:42 +0000 Subject: Initial commit --- greentext.user.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 greentext.user.js 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("
") + .map((text) => text.trim()) + .map((text) => { + if (text.startsWith(">")) { + return `${text}`; + } + return text; + }) + .join("
")); + }); +})(); -- cgit