YoutubeSkipAdsAuto

Youtube skip ads!

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         YoutubeSkipAdsAuto
// @namespace    M.Sadok
// @version      0.1
// @description  Youtube skip ads!
// @author       You
// @match        https://www.youtube.com/*
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

var currentUrl="";
jQuery(function ($){
    currentUrl = window.location.href;
    setTimeout(skipAd, 4000);
    setInterval(checkPageChange,2000);
});

function checkPageChange(){
    var oldUrl = currentUrl;
    var newUrl=window.location.href;
    //check if the url is changed
    if( newUrl !== oldUrl ){
       setTimeout(skipAd, 4000);
       setCurrentUrl(newUrl);
    }
}
function skipAd(){
    if ($(".videoAdUiSkipContainer ").css("display") === "none") {
        //--- Not found skip button"
        setTimeout(skipAd, 1000);
    }else{
        //"--- Skip button found :) -> click it");
        $('.videoAdUiSkipButton').click();
    }
}
function setCurrentUrl(url){
    currentUrl=url;
}