Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. // config
  2. var speed = 100;
  3. var i = 0;
  4. var count = 1;
  5.  
  6. // change to you language button label (e.g: approve, disapprove)
  7. var buttonText = 'recusar';
  8. var regex = new RegExp( buttonText,'ig' );
  9.  
  10. // read elements
  11. var els = [].slice.call(document.querySelectorAll('a[ajaxify]'));
  12.  
  13. // the compile function
  14. var compile = function(){
  15.  
  16. if(count === 5){
  17. i = 0;
  18. count = 1;
  19. console.log('Find more..');
  20. window.els = [].slice.call(document.querySelectorAll('a[ajaxify]'));
  21. }
  22.  
  23. console.log('Start compile..');
  24. setTimeout(function(){
  25. console.log('Check element..');
  26. if(typeof els[i] === 'object' && els[i].innerHTML.match(regex)){
  27. els[i].click();
  28. setTimeout(function(){
  29. count++;
  30. i++;
  31. console.log('Call element: '+i)
  32. compile();
  33. },speed);
  34. console.log(els[i].getAttribute('ajaxify'))
  35. } else {
  36. i++;
  37. console.log('Next: '+i)
  38. compile();
  39. }
  40.  
  41. }, speed);
  42.  
  43. };
  44.  
  45. // inspect remove post confirm window
  46. setInterval(function(){
  47.  
  48. var a = document.querySelectorAll('button[data-testid=delete_post_confirm_button][type="submit"]');
  49. if(a.length && a[0]){
  50.  
  51. a[0].click();
  52. window.scrollTo(0,document.body.scrollHeight);
  53. }
  54. }, speed);
  55.  
  56. // init
  57. compile();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement