Guest User

Untitled

a guest
Sep 15th, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var interv = 120000; // ms
  2. window._intervalId = undefined;
  3. function startAutoRefresh(){
  4.     window._intervalId = setInterval(function(){
  5.         if (!document.getElementsByClassName('scan active')[0]) {
  6.             document.getElementsByClassName('scan')[0].click();
  7.             console.log('auto scan start');
  8.         }
  9.         else{
  10.             console.log('auto scan skipped, already running');
  11.         }
  12.     }, interv)
  13. }
  14.  
  15. function stopAutoRefresh(){
  16.     if (window._intervalId){
  17.         clearInterval(window._intervalId);
  18.         window._intervalId = undefined;
  19.     }
  20.     else{
  21.         console.error('stop called without start');
  22.     }
  23. }
  24.  
  25. startAutoRefresh();
Add Comment
Please, Sign In to add comment