summaryrefslogtreecommitdiff
path: root/plugins/nsfw/init.js
blob: 71fe4747bdd18e480250f59c33293d90d8c38d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* global Plugins */

Plugins.NSFW = {
	toggle: function(elem) {
		elem = elem.domNode || elem;

		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';
	}
}