NSFW Content Blocker

Block NSFW content on the internet.

  1. // ==UserScript==
  2. // @name NSFW Content Blocker
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @license MIT
  6. // @description Block NSFW content on the internet.
  7. // @author Narada K
  8. // @match *://*/*
  9. // @grant GM_addStyle
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // NSFW content detection logic
  17. function isNSFW(url) {
  18. const nsfwKeywords = ['porn', 'xxx', 'adult', 'explicit', 'nudity', 'sex', 'erotic', 'hardcore', 'fetish', 'bondage' , 'bdsm' , 'anal' , 'threesome' , 'ganbang' , 'lesbian' , 'gay' , 'bisexual' , 'shemale' , 'milf' , 'cougar' , 'incest' , 'bestiality' , 'rape' , 'pedophilia' , 'child porn' , 'hentai' , 'webcam porn' , 'live cam' , 'cowgirl' , 'camboy' , 'webcam show' , 'masturbation' , 'vibrator' , 'ass' , 'dildo' , 'spank' , 'cumshot' , 'cum' , 'cumshot' , 'voyeur' , 'upskirt' , 'lingerie' , 'nude model' , 'adult film' , 'adult content' , '18+']; // Updated NSFW keywords
  19. const nsfwUrls = ['pornhub.com', 'xvideos.com', 'youporn.com' , 'xnxx.com']; // Updated NSFW URLs
  20. const allowedDomains = ['google.com', 'youtube.com', 'twitter.com', 'facebook.com', 'instagram.com']; // Allowed domains
  21.  
  22. // Check if the URL is from allowed domains
  23. for (const domain of allowedDomains) {
  24. if (url.toLowerCase().includes(domain)) {
  25. return false;
  26. }
  27. }
  28.  
  29. // Check if the URL contains NSFW keywords or matches NSFW URLs
  30. for (const keyword of nsfwKeywords) {
  31. if (url.toLowerCase().includes(keyword)) {
  32. return true;
  33. }
  34. }
  35.  
  36. for (const nsfwUrl of nsfwUrls) {
  37. if (url.toLowerCase().includes(nsfwUrl)) {
  38. return true;
  39. }
  40. }
  41.  
  42. return false;
  43. }
  44.  
  45. // Block NSFW content and display a gray overlay
  46. function blockNSFW() {
  47. if (isNSFW(window.location.href)) {
  48. document.documentElement.innerHTML = ''; // Clear the page content
  49. document.documentElement.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; // Gray overlay
  50. }
  51. }
  52.  
  53. blockNSFW(); // Call the function to block NSFW content
  54. })();