Compare commits

...

13 Commits
main ... main

4 changed files with 137 additions and 15 deletions

View File

@ -2,9 +2,9 @@
// @name DLF download button
// @description Adds a download button for each audio file on DLF sites.
// @description:de Fügt einen download-button für jede audio-datei auf DLF-seiten hinzu.
// @version 2021.04.29.1
// @version 2022.07.17.1
// @author tastytea
// @copyright 2019, 2021, tastytea (https://tastytea.de/)
// @copyright 2019, 2021, 2022, tastytea (https://tastytea.de/)
// @license GPL-3.0-only
// @namespace tastytea.de
// @homepageURL https://schlomp.space/tastytea/userscripts
@ -18,7 +18,7 @@
// @inject-into content
// ==/UserScript==
function main()
function dlf_us_main()
{
// deutschlandradio.de, deutschlandfunkkultur.de
let root = document.getElementsByClassName("player-embed")[0];
@ -36,6 +36,14 @@ function main()
return;
}
// share.deutschlandradio.de
root = document.getElementsByClassName("b-btn-player")[1];
if (root !== undefined)
{
add_button(root.getAttribute("data-audioreference"));
return;
}
console.warn("Could not find player / download-button element.");
}
@ -55,7 +63,7 @@ function add_button(url)
}
else if (window.location.href.search("deutschlandfunkkultur.de") > 0)
{
button.setAttribute("class", "drk-articleplay");
button.style.fontWeight = "bold";
}
button.style.textDecoration = "underline";
@ -83,7 +91,15 @@ function add_button(url)
return;
}
// share.deutschlandradio.de
root = document.getElementsByClassName("b-audio-player-wrapper")[0];
if (root !== undefined)
{
root.parentElement.insertBefore(button, root);
return;
}
console.warn("Could not find root element.");
}
main();
dlf_us_main();

View File

@ -2,7 +2,7 @@
// @name Goodreads expand
// @description Show the whole description / author information / book details on goodreads.com.
// @description:de Zeige die ganze beschreibung / author·inneninformation / buchdetails auf goodreads.com an.
// @version 2021.04.24.1
// @version 2021.07.20.1
// @author tastytea
// @copyright 2020, 2021, tastytea (https://tastytea.de/)
// @license GPL-3.0-only
@ -11,8 +11,7 @@
// @supportURL https://schlomp.space/tastytea/userscripts/issues
// @downloadURL https://schlomp.space/tastytea/userscripts/raw/branch/main/catalogues/goodreads_expand.user.js
// @grant none
// @match https://www.goodreads.com/book/*
// @match https://www.goodreads.com/author/*
// @match https://www.goodreads.com/*
// @run-at document-end
// @inject-into content
// ==/UserScript==
@ -55,3 +54,29 @@
document.getElementById("bookDataBoxShow").setAttribute("style", "display: none;");
}
})();
// On-hover book descriptions are getting loaded dynamically, so we have to look
// for them periodically.
function userscript_expand_hover_description()
{
const descriptions = document.getElementsByClassName("addBookTipDescription");
for (const element of descriptions)
{
if (element == null) // null or undefined.
{
continue;
}
const spans = element.getElementsByTagName("span");
if (spans.length >= 2)
{
spans[1].setAttribute("style", "display: block;");
spans[0].setAttribute("style", "display: none;");
const links = element.getElementsByTagName("a");
links[links.length - 1].text = "(less)";
}
}
}
setInterval(userscript_expand_hover_description, 1000);

View File

@ -0,0 +1,81 @@
// ==UserScript==
// @name Misskey CW toggle
// @description Adds a button to toggle the visibility of all notes with content warnings on note-pages.
// @version 2023.1.26.2
// @author tastytea
// @copyright 2022-2023, 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/fediverse/misskey_cw_toggle.user.js
// @grant none
// @match https://*/notes/*
// @run-at document-end
// @inject-into content
// ==/UserScript==
let interval;
let counter = 0;
function get_root() {
const root = document.getElementsByClassName("lxwezrsl note")[0]; // MK 13
if (root === undefined) {
root = document.getElementsByClassName("_block note")[0]; // MK 12
}
return root;
}
// Toggle the visibility of each status with CW.
function toggle() {
const root = get_root()
if (root === undefined) {
return;
}
const cw_classes = ["cw", "xpfPt"];
for (let classname of cw_classes) {
for (let status of root.getElementsByClassName(classname)) {
let button = status.getElementsByTagName("button")[0];
if (button === undefined) {
continue;
}
button.click();
}
}
}
// Add a “Toggle all CWs”-button.
function add_button() {
const root = get_root()
if (root === undefined) {
console.error("No suitable parent-element found.");
return;
}
const button = document.createElement("button");
button.setAttribute("id", "global-cw-toggle");
button.setAttribute("class", "_button");
button.setAttribute("style", "margin-top: 0.2em; margin-right: 0.5em;");
button.appendChild(document.createTextNode("Toggle all CWs"));
root.insertBefore(button, root.firstChild);
button.onclick = toggle;
}
function check() {
const root = get_root()
if (root === undefined) {
return;
}
// If there is a “Show content” button, add our button, if we didn't do so before.
if (root.getElementsByClassName("cw").length > 0
&& document.getElementById("global-cw-toggle") === null) {
add_button();
console.debug("Global CW toggle button added");
}
}
interval = setInterval(check, 1000); // Try to add button every second.

View File

@ -1,9 +1,9 @@
// ==UserScript==
// @name Pleroma CW toggle
// @description Adds a button to toggle the visibility of all statuses with content warnings on status-pages, profile-pages and timelines.
// @version 2019.06.25.2
// @version 2022.02.19.2
// @author tastytea
// @copyright 2019, tastytea (https://tastytea.de/)
// @copyright 2019, 2022, tastytea (https://tastytea.de/)
// @license GPL-3.0-only
// @namespace tastytea.de
// @homepageURL https://schlomp.space/tastytea/userscripts
@ -105,13 +105,13 @@ function check()
{
parent = root[0].parentElement;
}
// if root element and a status was found, disable interval and add button.
if (root.length !== 0
&& parent.getElementsByClassName("status-content").length > 0)
// if root element and a status was found, add button.
if (root.length !== 0)
{
if (is_static)
if (!parent.getElementsByClassName("StatusContent").length > 0
&& !parent.getElementsByClassName("status-content").length > 0)
{
clearInterval(interval);
return;
}
for (let element of root)