From d76799219debdaed870a772f25e576187e9cb37d Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 17 Aug 2020 22:23:17 +0200 Subject: [PATCH] Add goddreads expand. --- catalogues/goodreads_expand.user.js | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 catalogues/goodreads_expand.user.js diff --git a/catalogues/goodreads_expand.user.js b/catalogues/goodreads_expand.user.js new file mode 100644 index 0000000..bda7af6 --- /dev/null +++ b/catalogues/goodreads_expand.user.js @@ -0,0 +1,36 @@ +// ==UserScript== +// @name Goodreads expand +// @description Show the whole description on goodreads.com. +// @description:de Zeige die ganze beschreibung auf goodreads.com an. +// @version 2020.08.17.1 +// @author tastytea +// @copyright 2020, tastytea (https://tastytea.de/) +// @license GPL-3.0-only +// @namespace tastytea.de +// @homepageURL https://schlomp.space/tastytea/userscripts +// @supportURL https://schlomp.space/tastytea/userscripts/issues +// @downloadURL https://schlomp.space/tastytea/userscripts/raw/branch/main/goodreads_expand.user.js +// @grant none +// @match https://www.goodreads.com/book/* +// @run-at document-end +// @inject-into content +// ==/UserScript== + +(function() + { + const description = document.getElementById("description"); + if (description !== null) + { + const spans = description.getElementsByTagName("span"); + if (spans.length >= 2) + { + spans[1].setAttribute("style", "display: block;"); + spans[0].setAttribute("style", "display: none;"); + description.getElementsByTagName("a")[0].text = "(less)"; + } + } + else + { + console.warn("Could not find description."); + } + })();