From 1108cb3710e3093ce9b75cf26ffe7aabe35a4ade Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 12 Jun 2019 21:10:24 +0200 Subject: [PATCH] =?UTF-8?q?pleroma=5Fcw=5Ftoggle:=20Added=20span=20around?= =?UTF-8?q?=20a,=20like=20the=20=E2=80=9CCollapse=E2=80=9D-link.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fediverse/pleroma_cw_toggle.user.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fediverse/pleroma_cw_toggle.user.js b/fediverse/pleroma_cw_toggle.user.js index ea985dc..e4f4d1b 100644 --- a/fediverse/pleroma_cw_toggle.user.js +++ b/fediverse/pleroma_cw_toggle.user.js @@ -1,7 +1,7 @@ // ==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.12.1 +// @version 2019.06.12.2 // @author tastytea // @copyright 2019, tastytea (https://tastytea.de/) // @license GPL-3.0-only @@ -52,14 +52,16 @@ function get_root_elements() function add_button(parent) { + const span = document.createElement("span"); const button = document.createElement("a"); button.setAttribute("class", "global-cw-toggle"); button.setAttribute("style", "margin-left: 1em; cursor: pointer;"); button.appendChild(document.createTextNode("Toggle all CWs")); - // button.setAttribute("href", "#"); button.addEventListener('click', function() { toggle(parent.parentElement); }); - parent.append(button); + + span.append(button); + parent.append(span); } function check()