您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically close the Continue window and remove ads from Senpa.io
当前为
- // ==UserScript==
- // @name Senpa+
- // @namespace http://tampermonkey.net/
- // @version 1.0.0
- // @description Automatically close the Continue window and remove ads from Senpa.io
- // @author ChatGPT
- // @match https://senpa.io/web/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Function to simulate the pressing of the "Esc" key
- function triggerEscKey() {
- var event = new KeyboardEvent('keydown', {
- bubbles: true,
- cancelable: true,
- keyCode: 27,
- key: 'Escape',
- code: 'Escape'
- });
- document.dispatchEvent(event);
- }
- // Function to detect the respawn window and trigger the "Esc" key
- function checkRespawnWindow() {
- var respawnWindow = document.querySelector('.modal.scale-modal');
- if (respawnWindow && getComputedStyle(respawnWindow).opacity === '1') {
- console.log('Respawn window detected, triggering Esc key...');
- setTimeout(triggerEscKey, 10);
- }
- }
- // Function to remove ads and social sidebar
- function removeAdsAndSocialSidebar() {
- // Remove div with id "bottomAd"
- var bottomAdDiv = document.getElementById("bottomAd");
- if (bottomAdDiv) {
- bottomAdDiv.parentNode.removeChild(bottomAdDiv);
- }
- // Remove divs with class "ads-block-1"
- var adsBlockDivs = document.querySelectorAll(".ads-block-1");
- adsBlockDivs.forEach(function(adsBlockDiv) {
- adsBlockDiv.parentNode.removeChild(adsBlockDiv);
- });
- // Remove divs with class "banner"
- var bannerDivs = document.querySelectorAll(".banner");
- bannerDivs.forEach(function(bannerDiv) {
- bannerDiv.parentNode.removeChild(bannerDiv);
- });
- // Remove divs with class "advertisement-informer-endgame"
- var advertisementInformerEndgameDivs = document.querySelectorAll(".advertisement-informer-endgame");
- advertisementInformerEndgameDivs.forEach(function(advertisementInformerEndgameDiv) {
- advertisementInformerEndgameDiv.parentNode.removeChild(advertisementInformerEndgameDiv);
- });
- // Remove div with id "senpa-io_300x250_3"
- var senpaIoDiv = document.getElementById("senpa-io_300x250_3");
- if (senpaIoDiv) {
- senpaIoDiv.parentNode.removeChild(senpaIoDiv);
- }
- // Remove ul with id "socialsidebar"
- var socialSidebarUl = document.getElementById("socialsidebar");
- if (socialSidebarUl) {
- socialSidebarUl.parentNode.removeChild(socialSidebarUl);
- }
- }
- // Check for the respawn window periodically
- setInterval(checkRespawnWindow, 150);
- // Wait for the DOM to be fully loaded and then remove ads and social sidebar
- window.addEventListener('load', removeAdsAndSocialSidebar);
- // Observe DOM mutations to remove ads and social sidebar dynamically
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if (mutation.addedNodes.length) {
- removeAdsAndSocialSidebar();
- }
- });
- });
- observer.observe(document.body, { childList: true, subtree: true });
- })();