Greasy Fork is available in English.
Bypass all youtube ads including in video ads, skippable and non-skippable Ads
当前为
// ==UserScript==
// @name Youtube Ad Cleaner(Include Non-Skippable Ads- works)
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @namespace http://tampermonkey.net/
// @version 1.29
// @description Bypass all youtube ads including in video ads, skippable and non-skippable Ads
// @author BjDanny
// @match *://*.youtube.com/*
// ==/UserScript==
setInterval(worker, 1000);
function killAds(){
if ($(".videoAdUiRedesign")[0] !==undefined){
$(".video-stream").attr("src", "");
}
$("#player-ads").remove();
$("#masthead-ad").remove();
$("#offer-module").remove();
$(".video-ads").remove();
$("#pyv-watch-related-dest-url").remove();
}
function worker(){
killAds();
if (window.location.href !== 'https://www.youtube.com/'){
var ytplayer = document.getElementById("movie_player");
var adChannelName = $('.ytp-title-channel-name')[0].text;
var pauseOrNot = document.querySelector('.ytp-play-button.ytp-button').getAttribute('title');
if (pauseOrNot == 'Pause (k)' && ytplayer.getCurrentTime() == 0){
location.reload();
}
if ($('.ad-showing') [0] !== undefined || adChannelName !==""){
ytplayer.cancelPlayback();
setTimeout(ytplayer.playVideo(), 1000);
}
try{
if (document.querySelector('.style-scope.yt-button-renderer.style-blue-text.size-default').textContent ==='Yes') {
document.querySelector('.style-scope.yt-button-renderer.style-blue-text.size-default').click();}
}catch(err){
return;
}
if( document.querySelector('.ytp-ad-text.ytp-ad-skip-button-text') !== null ){
document.querySelector('.ytp-ad-text.ytp-ad-skip-button-text').click();
}
if($('#toast')){$('#toast').remove();}
}
else{
killAds,4000;
}
}