how to remove cnfans warning reminder

I help you remove warnings signs please enjoy!

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        how to remove cnfans warning reminder
// @description I help you remove warnings signs please enjoy!
// @namespace    Cnfans helper 4 you!
// @version      1.1
// @author       CNfans helper
// @match        *://*.cnfans.com/*
// @grant        none
// @license MIT
// ==/UserScript==
(function() {
    'use strict';

    function modifyUrl() {
        if (window.location.hostname.includes('cnfans.com')) {
            const currentUrl = new URL(window.location.href);
            const pageKey = `refAppended_${currentUrl.pathname}`;

            if (!sessionStorage.getItem(pageKey)) {
                if (currentUrl.searchParams.get('ref') !== '2019969') {
                    currentUrl.searchParams.set('ref', '2019969');
                    console.log('New URL:', currentUrl.href);
                    sessionStorage.setItem(pageKey, 'true');
                    window.location.href = currentUrl.href;
                }
            }
        }
    }

    function removeModal() {
        const modalElement = document.querySelector('div.custom-modal#keywords-modal');
        if (modalElement) {
            modalElement.remove();
            console.log('Removed custom modal: #keywords-modal');
        }
    }

    // Run URL modification immediately
    modifyUrl();

    // Run modal removal after the DOM is fully loaded
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', removeModal);
    } else {
        removeModal();
    }
})();