KmAd-Mini

R18快猫短视频去广告+自动登录

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         KmAd-Mini
// @namespace    https://github.com/emokui
// @version      2.0
// @description  R18快猫短视频去广告+自动登录
// @author       𝙁𝙖𝙩𝙖𝙡𝙚𝙫𝙚𝙡
// @match        https://4b55n57.xyz/km/*
// @match        https://kmsvip.pages.dev/km/*
// @match        https://kmvip.pages.dev/km/*
// @match        http://23.225.181.59/km/*
// @match        https://24y2if5.xyz/km/*
// @match        https://i4433b6.xyz/km/*
// @match        https://4uchxzz.xyz/km/*
// @match        https://kmsvip.xyz/km/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    const ACCOUNT = '你的账号';
    const PASSWORD = '你的密码';

    const fillCredentials = () => {
        const inputAccount = document.querySelector('div.login-account input[type="text"][placeholder="请输入账号(邮箱)"]');
        const inputPassword = document.querySelector('div.login-account input[type="password"][placeholder="请输入密码"]');
        const loginButton = document.querySelector('div.buttonbox');

        if (inputAccount && inputPassword && loginButton) {
            [inputAccount, inputPassword].forEach((input, index) => {
                input.value = index === 0 ? ACCOUNT : PASSWORD;
                ['input', 'change', 'blur'].forEach(eventType => {
                    input.dispatchEvent(new Event(eventType, { bubbles: true, cancelable: true }));
                });
            });
            loginButton.click();
        }
    };

    const removeElements = () => {
        try {
            const adImages = document.querySelectorAll('ul.g-list img');
            adImages.forEach(img => {
                img.remove();
            });

            const adList = document.querySelector('ul.g-list');
            if (adList) {
                adList.remove();
            }

            document.querySelectorAll('.van-notice-bar, .swiper, .vip_ad, .bootup, .download').forEach(el => el.remove());

            const overlay = document.querySelector('.van-overlay');
            if (overlay) {
                overlay.style.display = 'none';
            }

            const bottomImage = document.querySelector('img[src="static/img/collectdesktop.ff055cee.png"]');
            if (bottomImage) {
                bottomImage.style.display = 'none';  // 隐藏底部弹窗图片
            }

            // 隐藏弹窗
            const popup = document.querySelector('.van-popup.van-popup--center');
            if (popup) {
                popup.style.display = 'none';  // 隐藏整个公告弹窗
            }
        } catch (error) {}
    };

    const observer = new MutationObserver(() => {
        fillCredentials();
        removeElements();
    });

    observer.observe(document.body, { childList: true, subtree: true, attributes: true });
})();