Boa noite pessoal alguma alma bondosa pode me ajudar? agradeço desde já
preciso de um script de loop infinito para esses problemas
1º a janela está protegida para eu focar nela
var timer;
var timerElapsedTime;
var timerFullTime;
var is_visible_focus = true;
var formSent = true;
// main visibility API function
// use visibility API to check if current tab is active or not
var vis = (function () {
var stateKey,
eventKey,
keys = {
hidden: "visibilitychange",
webkitHidden: "webkitvisibilitychange",
mozHidden: "mozvisibilitychange",
msHidden: "msvisibilitychange"
};
for (stateKey in keys) {
if (stateKey in document) {
eventKey = keys[stateKey];
break;
}
}
return function (c) {
if (c) document.addEventListener(eventKey, c);
return !document[stateKey];
}
})();
window.focus();
window.onfocus = function () {
is_visible_focus = true;
};
window.onblur = function () {
is_visible_focus = false;
};
// check if current tab is active or not
vis(function () {
if (vis()) {
console.log("tab is visible - has focus");
is_visible_focus = true;
window.focus();
} else {
// tween pause() code goes here
console.log("tab is invisible - has blur");
is_visible_focus = false;
}
});
//FOCUS END
function drawTimer(percent) {
window.focus();
$('div.timer').html('<div class="percent"></div><div id="slice"' + (percent > 50 ? ' class="gt50"' : '') + '><div class="pie"></div>' + (percent > 50 ? '<div class="pie fill"></div>' : '') + '</div>');
var deg = 360 / 100 * percent;
$('#slice .pie').css({
'-moz-transform': 'rotate(' + deg + 'deg)',
'-webkit-transform': 'rotate(' + deg + 'deg)',
'-o-transform': 'rotate(' + deg + 'deg)',
'transform': 'rotate(' + deg + 'deg)'
});
$('.percent').html(Math.round(percent) + '%');
}
function stopWatch(timerSeconds, timeLeftString, requierFocus) {
if (is_visible_focus == true || !requierFocus) {
timerElapsedTime = timerElapsedTime + 300;
}
var seconds = (timerFullTime - timerElapsedTime) / 1000;
if (seconds <= 0) {
drawTimer(100);
clearInterval(timer);
//FINISH, send postback
if (formSent == false) {
__doPostBack('CaptchaPostbackHackButton', 'eValue');
formSent = true;
}
} else {
var percent = 100 - ((seconds / timerSeconds) * 100);
drawTimer(percent);
document.title = timeLeftString + ': ' + parseInt(seconds) + 's';
}
}
function startBar(timerSeconds, timeLeftString, requierFocus) {
timerElapsedTime = 0;
timerFullTime = timerSeconds * 1000;
timer = setInterval('stopWatch(' + timerSeconds + ',"' + timeLeftString + '",' + requierFocus + ')', 300);
formSent = false;
}
2º ele tem um tempo para que o site carregue totalmente
<div id="timerDiv" class="timer"><div class="percent">72%</div><div id="slice" class="gt50"><div class="pie" style="transform: rotate(259.2deg);"></div><div class="pie fill" style="transform: rotate(259.2deg);"></div></div></div>
3º tem um captcha do lado tem um botão enviar
<input type="submit" name="CreditAfterCaptcha" value="Enviar" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("CreditAfterCaptcha", "", true, "RegisterUserValidationGroup", "", false, false))" id="CreditAfterCaptcha" class="btn btn-default bg-green">
4º tem outro botão proximo
<input type="submit" name="NextAddButton" value="Próximo" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("NextAddButton", "", false, "", "user/earn/surf.aspx?f=6&auto=29", false, false))" id="NextAddButton" class="btn btn-primary m-l-10" style="color:White;">
Então resumindo o script tem que tirar o bloqueio de janela, esperar o tempo para carregar, burla o captcha e aperta proximo isso infinitamente agradeço quem me ajudar obrigado pela atenção.