Our solution for blurring NSFW content

더 이상 첫 게시글(OP)을 수정할 수 없지만, 업데이트된 코드를 여기에 올립니다. ‘클릭 시’ 솔루션도 함께 공유해 주시겠어요?

<!-- 현재 사용자의 nsfw 설정을 body 태그에 추가 -->
<script type="text/discourse-plugin" version="0.8.7">

// https://meta.discourse.org/t/css-classes-for-group-membership-for-simplified-ui-mode/60838/2
if (window.jQuery) {
    window.jQuery(function ($) {

        let currentUser = api.getCurrentUser();
        
        if (currentUser) {
            api.container.lookup('store:main').find('user', currentUser.username).then((user) => {

                if (user.user_fields[2]) {
                    $('body').addClass('nsfw-always-show' );
                }
            });
        }
    });
};
</script>
2개의 좋아요