Popup warning for NSFW category


#1

Suppose we have a category for NSFW content, is a popup warning before entry easy to implement? Something that tells the user he/she is entering NSFW category, something like:

“The content of this section is for mature audiences only and may not be suitable for minors. If you are a minor or if it is illegal for you to access mature images and language, do not proceed.”


(Marcin Rataj) #2

I think you could trigger popup with custom JS snippet added in /admin/customize/css_html.

For example, if your category name is nsfw, try something along this lines (when document is ready):

  if ($('#topic-title a.badge-category:contains("nsfw")').length) { 
   console.log('This post belongs to NSFW category'); 
  }

#3

Thanks for replying. :smile:

If I understand you correctly, the popup comes when you finish writing your post, am I right? That’s not quite what I have in mind.

What I was thinking is, for example you have categories like: Meta, Games, Anime, and Sex. You want a popup warning to appear when people click on Sex, warning them of explicit content.


(Marcin Rataj) #4

Hm… to facilitate your requirement you can add jQuery .on('click') listener to every link of a topic from NSFW category.
It would trigger a custom popup requiring confirmation before going further.
You could even store confirmation in a cookie, so that on this specific machine user does not have to confirm each time.

I don’t know if such feature will arrive to upstream any time soon.
If you really need this feature custom JS is the easiest way to go IMO.
If you need more specific help (eg. custom code for your forum) feel free to PM me :wink: