goodreads expand: Also expand author info.
This commit is contained in:
parent
82af43deef
commit
acfde28419
|
@ -1,8 +1,8 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Goodreads expand
|
// @name Goodreads expand
|
||||||
// @description Show the whole description on goodreads.com.
|
// @description Show the whole description / author information on goodreads.com.
|
||||||
// @description:de Zeige die ganze beschreibung auf goodreads.com an.
|
// @description:de Zeige die ganze beschreibung / author·inneninformation auf goodreads.com an.
|
||||||
// @version 2020.08.17.1
|
// @version 2020.08.18.1
|
||||||
// @author tastytea
|
// @author tastytea
|
||||||
// @copyright 2020, tastytea (https://tastytea.de/)
|
// @copyright 2020, tastytea (https://tastytea.de/)
|
||||||
// @license GPL-3.0-only
|
// @license GPL-3.0-only
|
||||||
|
@ -12,25 +12,31 @@
|
||||||
// @downloadURL https://schlomp.space/tastytea/userscripts/raw/branch/main/catalogues/goodreads_expand.user.js
|
// @downloadURL https://schlomp.space/tastytea/userscripts/raw/branch/main/catalogues/goodreads_expand.user.js
|
||||||
// @grant none
|
// @grant none
|
||||||
// @match https://www.goodreads.com/book/*
|
// @match https://www.goodreads.com/book/*
|
||||||
|
// @match https://www.goodreads.com/author/*
|
||||||
// @run-at document-end
|
// @run-at document-end
|
||||||
// @inject-into content
|
// @inject-into content
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
(function()
|
(function()
|
||||||
{
|
{
|
||||||
const description = document.getElementById("description");
|
let root = document.getElementById("description");
|
||||||
if (description !== null)
|
if (root === null)
|
||||||
{
|
{
|
||||||
const spans = description.getElementsByTagName("span");
|
root = document.getElementsByClassName("aboutAuthorInfo")[0];
|
||||||
if (spans.length >= 2)
|
if (root === null)
|
||||||
{
|
{
|
||||||
spans[1].setAttribute("style", "display: block;");
|
console.warn("Could not find description / author info.");
|
||||||
spans[0].setAttribute("style", "display: none;");
|
return;
|
||||||
description.getElementsByTagName("a")[0].text = "(less)";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
const spans = root.getElementsByTagName("span");
|
||||||
|
if (spans.length >= 2)
|
||||||
{
|
{
|
||||||
console.warn("Could not find description.");
|
spans[1].setAttribute("style", "display: block;");
|
||||||
|
spans[0].setAttribute("style", "display: none;");
|
||||||
|
|
||||||
|
const links = root.getElementsByTagName("a");
|
||||||
|
links[links.length - 1].text = "(less)";
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue