ok scnr

ok scnr
mail@pastecode.io avatar
unknown
javascript
2 years ago
1.5 kB
1
Indexable
Never
// initial conditions 
let runCounter = 0;
let runLimit = 25;
let invervalId;
function stop(id) {
  clearInterval(id);
}

// cpal procedure automator function to be used in interval 
function cpal() {

    var url = document.querySelector("#main_content > div.desktop-dt-wrapper > div > div.desktop-dt-top > div.desktop-dt-top-actionrow > div.card-content-header > a").href;
const splitUrl = url.split('/');
const profileUrl = splitUrl[0] + '//' + splitUrl[2] + '/' + splitUrl[3] + '/' + splitUrl[4];

    var windowObjectReference;
    var windowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";

    function openRequestedPopup(url) {
        windowObjectReference = window.open(url, "tab:" + url, windowFeatures);
    }

    openRequestedPopup(profileUrl);

    var likeButton = document.querySelector("#main_content > div.desktop-dt-wrapper > div > div.desktop-dt-top > div.desktop-dt-top-actionrow > div.desktop-dt-top-actionrow-controls > div.desktop-dt-top-actionrow-actions > div > div:nth-child(2) > button");
    likeButton.click();
  runCounter++;

  if (runCounter > runLimit ) {
    stop(intervalId);
    console.log("finished running " + runLimit + " times. Interval Removed. Counter has been reset.");
    runCounter = 0;
  }
} // end of cpal procedure automator function for iterator


// run procedure  X times  and then stop
function runXTimes(times) {
  runLimit = times;
intervalId = setInterval(cpal, 1100);
}

runXTimes;