Greasy Fork

Greasy Fork is available in English.

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

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

当前为 2025-06-09 提交的版本,查看 最新版本

// ==UserScript==
// @name         提醒自己这里面有不该看的内容
// @namespace    http://tampermonkey.net/
// @version      2025-03-24 1.6
// @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>'
    }
    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 ) {
       alertContent('小说')
         return;
     }
     if ( content.indexOf("海贼王") > -1 || content.indexOf("航海王") > -1 || content.indexOf("路飞") > -1 || content.indexOf("娜美") > -1) {
        alertContent('海贼王')
         return;
     }
    }, 2000)
    // Your code here...
})();