SwagTv script

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

La data de 26-05-2015. Vezi ultima versiune.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name 	SwagTv script
// @description	this script will automatically fetch and go to the next video after the meter goes up. 
// @version 0.33
// @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'))
            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;
            }
        }
    }
}