video countdown wait

video countdown wait|play click

Verzia zo dňa 31.03.2016. Pozri najnovšiu verziu.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==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;