您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This script will click on "YES" button
当前为
- // ==UserScript==
- // @name Ignore "Video Paused, continue watching?" using XPath
- // @version 25.5.4
- // @description This script will click on "YES" button
- // @author 8TM (https://github.com/8tm/youtube_video_paused_continue_watching)
- // @license https://choosealicense.com/licenses/mit/
- // @match https://youtube.com/*
- // @match https://www.youtube.com/*
- // @match http://youtube.com/*
- // @match http://www.youtube.com/*
- // @compatible firefox Works with Firefox and Tampermonkey
- // @grant none
- // @namespace https://greasyfork.org/users/1386567
- // ==/UserScript==
- (function() {
- setInterval(() => {
- // Find "YES" button using XPath
- let xpath = "//div[@id='main']//div[contains(@class, 'buttons')]//yt-button-renderer[@id='confirm-button']//button";
- let result = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
- let confirmButton = result.singleNodeValue;
- if (confirmButton && confirmButton.offsetParent !== null && !confirmButton.disabled) {
- confirmButton.click();
- // Debug:
- // let currentDateTime = new Date();
- // let formattedDateTime = currentDateTime.toLocaleString();
- // console.log(`[${formattedDateTime}] Pushed 'YES' button.`);
- // alert(`[${formattedDateTime}] Pushed 'YES' button.`);
- }
- },500);
- })();