Greasy Fork

Greasy Fork is available in English.

提醒自己这里面有不该看的内容

强制自己不要看不应该看的东西

// ==UserScript==
// @name         提醒自己这里面有不该看的内容
// @namespace    http://tampermonkey.net/
// @version      2025-07-28 2.2.0
// @description  强制自己不要看不应该看的东西
// @author       You
// @match        *://*/*
// @exclude      *://www.baidu.com/*
// @exclude      *://*.bing.com/*
// @exclude      *://*.google.com/*
// @exclude      http://greasyfork.icu/*

// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function alertContent(title) {
        var tips = "你正在浏览"+ title +"相关的内容,你不应该看这些内容,关闭它!"
        // document.body.innerHTML = '<h1>不要浪费时间在这些内容上!!!</h1>'
        document.body.insertAdjacentHTML('beforeend', '<div style="z-index:99999;padding-top: 50px; font-size: 48px; text-align: center; width: 100%; height: 100%; position:fixed; top: 0; background: white;">不要看这些没用的东西了!!!!</div>')
    }
    setTimeout(() => {
        // 获取文章内容
     var content = document.body.innerHTML
     if (location.href.indexOf('msn.cn') > -1) {
         content = document.getElementsByTagName('cp-article-reader')[0]._articleContent.body.innerHTML
     }
        // 简单判断是否在看不该看的东西
     if ( (/第.*章/.test(content) && /书架/.test(content)) || (content.indexOf("玄幻") > -1 && content.indexOf("都市") > -1 )) {
       alertContent('小说')
         return;
     }
     if ( /漫画/.test(content) ) {
       alertContent('漫画')
         return;
     }
     if ( content.indexOf("海贼王") > -1 || content.indexOf("航海王") > -1 || content.indexOf("路飞") > -1 || content.indexOf("娜美") > -1) {
        alertContent('海贼王')
         return;
     }
    }, 2000)
    // Your code here...
})();