Skip to content

Instantly share code, notes, and snippets.

@himanshu8dev
Last active August 5, 2021 12:49
Show Gist options
  • Select an option

  • Save himanshu8dev/2bb2058d76326dd53fc189735616c4dd to your computer and use it in GitHub Desktop.

Select an option

Save himanshu8dev/2bb2058d76326dd53fc189735616c4dd to your computer and use it in GitHub Desktop.
function unfollowProcess() {
init = function(){
var requestButton = this.getMainButton()
setTimeout(function() {
requestButton.onclick = this.unfollow();
// console.log(requestButton);
requestButton.click();
}, 5000);
},
getMainButton = function() {
let buttons = document.querySelectorAll('button');
requestButton = false;
buttons.forEach(function(k,v){
var btn = buttons[v];
if(btn.innerHTML == 'Requested') {
requestButton = btn;
return;
}
})
return requestButton;
},
unfollow = function(){
setTimeout(function(){
var popupButton = document.querySelectorAll('button');
popupButton.forEach(function(k,v){
var btn = popupButton[v];
if(btn.innerHTML == 'Unfollow') {
// console.log(btn);
btn.click();
}
})
}, 6000);
}
init();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment