1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-20 02:41:29 +00:00

nsfw: support API clients

This commit is contained in:
Andrew Dolgov
2021-03-07 13:22:38 +03:00
parent ffb93d72ac
commit ac6a59914b
7 changed files with 66 additions and 34 deletions

View File

@@ -2,11 +2,17 @@
Plugins.NSFW = {
toggle: function(elem) {
const content = elem.domNode.parentNode.querySelector(".nswf.content");
elem = elem.domNode || elem;
if (content) {
Element.toggle(content);
}
const content = elem.closest(".nsfw-wrapper").querySelector('.nsfw-content');
// we can't use .toggle() here because this script could be invoked by the api client
// so it's back to vanilla js
if (content.style.display == 'none')
content.style.display = '';
else
content.style.display = 'none';
}
}