forked from tastytea/userscripts
Add support for small displays to CW-toggle script.
This commit is contained in:
parent
41e4e2f22b
commit
21198efd51
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Mastodon CW toggle
|
// @name Mastodon CW toggle
|
||||||
// @description Adds a button to toggle the visibility of all statuses with content warnings on status-pages and profile-pages.
|
// @description Adds a button to toggle the visibility of all statuses with content warnings on status-pages and profile-pages.
|
||||||
// @version 2019.06.06.2
|
// @version 2019.06.06.3
|
||||||
// @author tastytea
|
// @author tastytea
|
||||||
// @copyright 2019, tastytea (https://tastytea.de/)
|
// @copyright 2019, tastytea (https://tastytea.de/)
|
||||||
// @license GPL-3.0-only
|
// @license GPL-3.0-only
|
||||||
|
@ -53,6 +53,10 @@ function add_button()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (root.offsetParent === null) // If element is hidden,
|
||||||
|
{ // we are probably on a device with a small display.
|
||||||
|
root = document.getElementsByClassName("column-2")[0];
|
||||||
|
}
|
||||||
|
|
||||||
// Create a div, necessary to get the correct styling for the button.
|
// Create a div, necessary to get the correct styling for the button.
|
||||||
const div = document.createElement("div");
|
const div = document.createElement("div");
|
||||||
|
|
Loading…
Reference in New Issue