SwagTv script

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

当前为 2014-05-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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

var iLoops = 0;
window.setInterval(reloadTimer,1000);
var doc = document.getElementById("feed-ajax-div");
var notes = null;
var _class = document.getElementsByClassName("thumb-container");

for (var i = 0; i < _class.length; i++) {
	if (_class[i].className == "thumb-container active") {
			var k = i;
			break;			
	}
		
} 
		
var video = document.getElementById("video-title");
video.parentNode.removeChild(video);
var comment = document.getElementById("commentsCont");
comment.parentNode.removeChild(comment);



var randomNum = 0;
var strPercentStart = null;
var link = null;
var div = null;


function reloadTimer(){
	iLoops++;
	//console.log(iLoops);
	if (iLoops == 5) {
        console.log("k: "+k);
		strPercentStart = document.getElementById("meterNumber").innerHTML;
		div = document.getElementById("meterDuplicateVideo");
		
		if (div.style.display == 'none') {
			randomNum = Math.floor(Math.random()*15 + 50);
		}
		else {
			randomNum = 8;
		};
		if (k == null) {
            console.log("In K=3");
            document.getElementsByClassName("feed-ajax-next")[0].click();
			k = -1;
		}
		
	};
	
	if (iLoops == randomNum){
        	//console.log(k);
		if (strPercentStart == '90%') { //comment out
				alert('Captcha'); //comment out
		}                               //comment out
			else {                  //comment out
				link = document.getElementsByClassName("thumb-link")[k+1].href;
				window.location.href = link;
			}                       //comment out
	}
			
		
};