SwagTv script

this script will automatically fetch and go to the next video after the meter goes up.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name 	SwagTv script
// @description	this script will automatically fetch and go to the next video after the meter goes up. 
// @version 0.34
// @include	http://video.swagbucks.com/*
// @require      http://code.jquery.com/jquery-git.js
// @namespace swagtv
// ==/UserScript==
//
// --------------------------------------------------------------------

var iLoops = 0;
window.setInterval(reloadTimer,1000);
var notes = false;

var k = getK();

$("video-title").remove();
$("commentsCont").remove();

var randomNum = 0;

function getK(){
    $("#video-title").remove();
    $("#commentsCont").remove();
    var m = $('div.thumb-container.next-item a').attr("href");
    if (!m){
        if (!$('span.feed-ajax-next').length)
            m = null;
        else{
            $('span.feed-ajax-next').click();
            setTimeout(function() { getURL() }, 5000);
        }
    }
    return m
}

function getURL(){
    var m = $('div.thumb-container:first a').attr("href");
    k=m;
}

function reloadTimer(){
    iLoops++;
    if (iLoops%5==0)
        console.log(iLoops);
    if (iLoops == 5) {
        console.log(k);
        if ($("#meterDuplicateVideo").is(':visible'))
            randomNum = 8;
        else 
            randomNum = Math.floor(Math.random()*15 + 50);            
        if (k == null) 
            notes = true;
    }

    if (iLoops == randomNum){
        console.log("Match!");
        if ($("#sbvd_capText").is(":visible")) 
            alert('Captcha');
        else {
            if (notes)
                alert("Pick a new category");
            else{
                link = k;
                window.location.href = link;
            }
        }
    }
}