ok scnr v2
ok scnr v2 btn fxd timeForOneIterationMSunknown
javascript
2 years ago
1.8 kB
3
Indexable
Never
// initial conditions let runCounter = 0; let runLimit = 25; let iterationTimeMS = 500; let invervalId; function stop(id) { clearInterval(id); } /** * Delay for a number of milliseconds */ function sleep(delay) { var start = new Date().getTime(); while (new Date().getTime() < start + delay); }; // 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(3) > button"); likeButton.click(); sleep(iterationTimeMS); 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, timeForOneIterationMS) { iterationTimeMS = timeForOneIterationMS; runLimit = times; intervalId = setInterval(cpal, 1100); } runXTimes;