Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // config
- var speed = 100;
- var i = 0;
- var count = 1;
- // change to you language button label (e.g: approve, disapprove)
- var buttonText = 'recusar';
- var regex = new RegExp( buttonText,'ig' );
- // read elements
- var els = [].slice.call(document.querySelectorAll('a[ajaxify]'));
- // the compile function
- var compile = function(){
- if(count === 5){
- i = 0;
- count = 1;
- console.log('Find more..');
- window.els = [].slice.call(document.querySelectorAll('a[ajaxify]'));
- }
- console.log('Start compile..');
- setTimeout(function(){
- console.log('Check element..');
- if(typeof els[i] === 'object' && els[i].innerHTML.match(regex)){
- els[i].click();
- setTimeout(function(){
- count++;
- i++;
- console.log('Call element: '+i)
- compile();
- },speed);
- console.log(els[i].getAttribute('ajaxify'))
- } else {
- i++;
- console.log('Next: '+i)
- compile();
- }
- }, speed);
- };
- // inspect remove post confirm window
- setInterval(function(){
- var a = document.querySelectorAll('button[data-testid=delete_post_confirm_button][type="submit"]');
- if(a.length && a[0]){
- a[0].click();
- window.scrollTo(0,document.body.scrollHeight);
- }
- }, speed);
- // init
- compile();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement