您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
3/5/2021, 11:13:26 PM
// ==UserScript== // @name Autoskip Prime Trailers // @namespace Violentmonkey Scripts // @match https://addons.mozilla.org/en-US/firefox/addon/violentmonkey/ // @grant none // @version 1.3 // @author - // @description 3/5/2021, 11:13:26 PM // @match https://www.amazon.com/gp/product/* // @match https://www.amazon.com/gp/video/* // ==/UserScript== const INTERVAL_MAX_ATTEMPTS = 120; // When triggered, the seekSkipButton method will run a maximum of 120 times before stopping const INTERVAL_WAIT_DURATION = 500; // when triggered, the seekSkipButton method will wait half a second in between each execution let skipButtonInterval; let intervalCurrentAttempts = 0; let seekSkipButton = function() { intervalCurrentAttempts++; let xpath = "//div[text()='Skip']"; let skipButton = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE, null).singleNodeValue; if (skipButton != null) { console.log("Skipping the ad lol."); skipButton.click(); clearInterval(skipButtonInterval); } if (intervalCurrentAttempts >= INTERVAL_MAX_ATTEMPTS) { clearInterval(skipButtonInterval); } } const observer = new MutationObserver(function(mutationList) { console.log("mutations have been observed"); for (let mutation of mutationList) { if (mutation.addedNodes.length == 0) { return; } for (let elem in mutation.addedNodes) { if (elem instanceof HTMLElement && elem.classList.contains("webPlayerUIContainer")) { intervalCurrentAttempts = 0; skipButtonInterval = setInterval(seekSkipButton, 500); return; } } } }); console.log("We are listening"); observer.observe(document, {childList: true, subtree: true});
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址