Timeout in pinterest following script not working

Toern

Newbie
Joined
Feb 15, 2017
Messages
39
Reaction score
8
I'm making a simple script for mass-following boards. The only thing left is a working timeout, in order to avoid algorithm detection.

Here is what i have. It follows all the boards on a page, but does so instantaneously

Code:
var buttonsx = document.getElementsByClassName('BoardFollowButton');
function removeClass(el, className) {    //remove class without jquery
  if (el.classList)
    el.classList.remove(className)
  else if (hasClass(el, className)) {
    var reg = new RegExp('(\\s|^)' + className + '(\\s|$)')
    el.className=el.className.replace(reg, ' ')
  }
}
function clicket(el) {    //could not do this inline for some reason
    el.click();
}
for (i = 0; i< buttonsx.length; i++) {
  if (!buttonsx[i].classList.contains("followed")) {
    removeClass(buttonsx[i], 'notNavigatable')     // not sure if this matters
    var timeOut = timeOut + Math.random() * 2000 + 500;    // 0.5 - 2.5 seconds extra for each button
    setTimeout(clicket(buttonsx[i]), timeOut);
  } 
}

I'm a bit of an amateur and it was a while since I did any coding, so could use some help here.
 
Back
Top