This is a greasemonkey script that is for OKC. Since userscripts is down, I can’t ask there so thought I’d try here. I do not understand javascript at all so what I would like to know is, what piece of code could I add below to prevent the script from visiting profiles with a low percentage? So say I only want this to visit to visit 80% and up, how can I translate that into JS?
Also, the code is supposed to skip profiles already visited but doesn’t. I read somewhere that the solution is to use a persistent data feature such as localStorage.
Would really appreciate any help on this.
function go_to_profile(){
var new_profile = document.getElementById("section_matches");
var match = new_profile.childNodes[3];
var ref = match.childNodes[1];
var almost = ref.childNodes[1];
var go = almost.getAttribute("href");
var link = "http://www.okcupid.com" + go;
//New array for visited profiles
var visited_profiles = new Array();
//Check to see if any profiles have been visited before
if (visited_profiles.length > 0){
//This for command takes the length of the array "visited_profiles" and counts down
//to zero while checking that the variable "go" is not equal to any of the entries
//in the array.
for(var array_length = visited_profiles.length;array_length >= 0;array_length--){
if(visited_profiles[array_length] == go){
location.reload();
break;
}
//If profile hasn't been viewed yet, put variable "go" into the
//visited profiles array
else {
visited_profiles.push(go);
break;
}
}
}
window.location.replace(link);
};
setTimeout(go_to_profile, Math.random()*15000);