您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Trying to skip Cyber Monday sale, Black Friday sale, and ads with a "Decline offer", "Competition started" or "The Leap is on" in them
当前为
// ==UserScript== // @name Tradingview Skip Ads // @description Trying to skip Cyber Monday sale, Black Friday sale, and ads with a "Decline offer", "Competition started" or "The Leap is on" in them // @author Konf // @namespace https://greasyforks.org/users/424058 // @icon https://www.google.com/s2/favicons?sz=64&domain=tradingview.com // @version 4.0.0 // @match https://www.tradingview.com/* // @require https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js#sha512-wkU3qYWjenbM+t2cmvw2ADRRh4opbOYBjkhrPGHV7M6dcE/TR0oKpoDkWXfUs3HrulI2JFuTQyqPLRih1V54EQ== // @grant GM_getValue // @grant GM_setValue // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @run-at document-start // @noframes // ==/UserScript== /* jshint esversion: 11 */ (function() { 'use strict'; (function main() { if (!document.documentElement) return setTimeout(main); const stats = GM_getValue('adSkipStats', {}); let menuCommandId = null; updateMenuCommand(); document.arrive('div.tv-dialog__modal-body', { existing: true }, (modal) => { for (const span of modal.querySelectorAll('span')) { if (span.innerText === 'Cyber Monday') { modal.querySelector('div.tv-dialog__close').click(); incrementStat('Cyber Monday'); break; } if ( span.innerText.includes('Black Friday') ) { modal.querySelector('div.tv-dialog__close').click(); incrementStat('Black Friday'); break; } } } ); document.arrive('div[data-dialog-name="gopro"]', { existing: true }, (modal) => { if (findAndDeclineOffer(modal)) incrementStat('Go pro offer'); } ); document.arrive('div[data-dialog-name="gopro-mobile"]', { existing: true }, (modal) => { if (findAndDeclineOffer(modal)) incrementStat('Go pro mobile offer'); for (const p of modal.querySelectorAll('p')) { if (p.innerText === 'Competition started') { modal.querySelector('button[aria-label="Close"]').click(); incrementStat('Competition started'); break; } else if (p.innerText === 'The Leap is on') { modal.querySelector('button[class*=closeButton-]').click(); incrementStat('The Leap is on'); break; } } } ); document.arrive('div.banner-WnHzIH9Q', { existing: true }, (popup) => { popup.closest('div.tv-dialog__modal-container')?.querySelector('.tv-dialog__close').click(); incrementStat('Black Friday'); } ); // utils ---------------------------------------------------------- function findAndDeclineOffer(goProModal) { for (const span of goProModal.querySelectorAll('span')) { if (span.innerText === 'Decline offer') { span.parentElement.click(); return true; } } } function incrementStat(adType) { stats[adType] = (stats[adType] || 0) + 1; GM_setValue('adSkipStats', stats); updateMenuCommand(); } function showStats() { alert( 'Total skipped ads history:\n' + JSON.stringify(GM_getValue('adSkipStats', {}), null, 2) ); } function updateMenuCommand() { if (menuCommandId !== null) GM_unregisterMenuCommand(menuCommandId); menuCommandId = GM_registerMenuCommand( `Show skipped ads (${Object.values(stats).reduce((a, b) => a + b, 0)})`, showStats ); } // ---------------------------------------------------------- utils })(); })();