video countdown wait

video countdown wait|play click

Versione datata 31/03/2016. Vedi la nuova versione l'ultima versione.

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        video countdown wait
// @namespace   manobastardo
// @include     *vodlocker.com*
// @include     *gorillavid*
// @include     http://bestreams.net*
// @include     *thevideo*
// @include     *streamin*
// @include     *vidbull*
// @include     *daclips*
// @version     1
// @grant       none
// @description video countdown wait|play click
// ==/UserScript==

current_url = window.location.href;

var click_event = document.createEvent('MouseEvents');
click_event.initEvent('click', true, true);

function get_player(player) {
    if (typeof(jwplayer) === typeof(Function)) {
        return jwplayer()
    }
    return $(player);
}

function elements() {
    var values = {
        "button": "",
        "player": "",
        "wanted": "",
        "current": ""
    };

    if (current_url.indexOf("gorillavid") > -1) {
        values.button = $('#btn_download');
        values.player = get_player("#flvplayer");
        values.wanted = "continue";
        values.current = values.button.attr("value");
    } else if (current_url.indexOf("daclips") > -1) {
        values.button = $('#btn_download');
        values.player = get_player("#flvplayer");
        values.wanted = "continue";
        values.current = values.button.attr("value");
    } else if (current_url.indexOf("bestreams") > -1) {
        values.button = $('#btn_download');
        values.player = get_player("#flvplayer");
        values.wanted = "hidden";
        values.current = $("#countdown_str").css("visibility");
    } else if (current_url.indexOf("vodlocker") > -1) {
        values.button = $('#btn_download');
        values.player = get_player("#flvplayer");
        values.wanted = "hidden";
        values.current = $("#countdown_str").css("visibility");
    } else if (current_url.indexOf("thevideo") > -1) {
        values.button = $('#btn_download');
        values.player = get_player("#flvplayer");
        values.wanted = "proceed";
        values.current = values.button.text();
    } else if (current_url.indexOf("streamin") > -1) {
        values.button = $('#btn_download');
        values.player = get_player("#flvplayer");
        values.wanted = "hidden";
        values.current = $("#countdown_str").css("visibility");
    } else if (current_url.indexOf("vidbull") > -1) {
        values.button = $('#btn_download');
        values.player = get_player("#flvplayer");
        values.wanted = "block";
        values.current = $('#download_linkb').css("display");
    }

    return values
}

function is_player(player) {
    console.log("is_player");
    return player.length > 0 || typeof player === "object";
}

function is_button(button) {
    console.log("is_button");
    return button.length > 0;
}

function wait_button() {
    console.log("wait_button");
    check_button = setInterval(function () {
        var e = elements();
        if (e.current.toLowerCase().indexOf(e.wanted) > -1) {
            clearInterval(check_button);
            e.button[0].dispatchEvent(click_event);
            wait_player(e.player);
        } else {
            console.log("wait_button");
        }
    }, 111);
}


function play_player(player) {
    console.log("play_player");
    player.play();
    player[0].play();
    jwplayer().play();
}

function wait_player(player) {
    console.log("wait_player");
    check_video = setInterval(function () {
        if (is_player(player)) {
            clearInterval(check_video);
            play_player(player);
        } else {
            console.log("wait_player");
        }
    }, 111);
}

function wait_check() {
    console.log("wait_check");
    var e = elements();
    if (is_button(e.button)) {
        wait_button();
    } else {
        wait_player(e.player);
    }
}

console.log("wait");
window.onload = wait_check;