Sie sind auf Seite 1von 2

var surveyClicked = false;

var checkSurveyComplete=true;
var file_id = "206014";
var visitor_id = 256319744;
var downloadURL="http://templates.cleanfiles.net/download_file2.
php?file_id=" + file_id + "&visitor_id="+visitor_id;
var surveysCompleted=0;
var earningsCompleted=0;
var surveysTarget=1;
var earningsTarget=0;
var isMobile=false;
$(document).ready(function() {
checkl();
$(".offer_table tr:nth-child(even)").addClass("even");
if(!isMobile){
$(".popularityBar").each(function(){
var popvalue=$(this).attr("popularityVal
ue");
$(this).css("width",popvalue+"%");
});
$('.toolTipBottom').tooltip({placement:"bottom",
container: 'body'});
$('.toolTipTop').tooltip({placement:"top"});
}
activate_click();
});

function activate_click() {
$(".cleanfilesOffer").click(function () {
if (!surveyClicked) {
parent.offerClickAdmin();
surveyClicked = true;
}
});
}
function checkl() {
var time = new Date().getTime();
$.ajax({
type:"POST",
url:"/check_survey.php",
dataType: "json",
data:{file_id:file_id,time:time,visitor_id:visit
or_id},
timeout:1500,
success: function(response){
var response_earnings=response.earnings;
var response_count=response.count;
if(response_count > surveysCompleted){
//New survey completed on check!
surveysCompleted=response_count;

earningsCompleted=response_earni
ngs;
if(surveysCompleted < surveysTar
get){
alert(surveysCompleted +
" survey(s) complete! Please complete "+surveysTarget+" to unlock this file!");
}
else if(earningsCompleted < earn
ingsTarget){
var pointComplete=earnin
gsCompleted*100;
var pointsNeeded=earning
sTarget*100;
alert(pointComplete + "
points earned! Please earn "+pointsNeeded+" points to unlock this file!");
}
else{
alert("Complete! Click t
he link to download your file!");
window.top.location.href
= downloadURL;
var downloadHTML="Survey
complete! Download via the following URL: "+"<a href='"+downloadURL+"'>"+downlo
adURL+"</a>";
$('#cf_offers').html(dow
nloadHTML);
checkSurveyComplete=fals
e;
}
}
if(checkSurveyComplete){
setTimeout(function () {
checkl();
}, 14000);
}
},
error: function(msg, xhr){
console.log("Error occurred. Please try
again.");
console.log(msg.responseText);
setTimeout(function () {
checkl();
}, 14000);
}
});
}

Das könnte Ihnen auch gefallen