Skip to content

Instantly share code, notes, and snippets.

@IOZ
Last active March 25, 2017 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IOZ/9210206 to your computer and use it in GitHub Desktop.
Save IOZ/9210206 to your computer and use it in GitHub Desktop.
Tiny script, which automatically remove vk fans
/* User settings */
var time = 500; // time delay, 500 work fine
var type = 'deactivated'; // type of user: deactivated or all
/* do not change */
var
fans = document.querySelectorAll('.fans_fan_row'),
fans_length = fans.length,
fans_bl = [],
i;
for(i=0;i<fans_length;i++){
var fan = fans[i],
fan_img = fan.querySelector('.fans_fan_img'),
src = fan_img.src;
switch(type){
case 'deactivated':
if (/deactivated/.test(src)){
fans_bl.push(fans[i]);
};
break;
default:
fans_bl.push(fans[i]);
break;
}
};
function iterateFans(){
if(!fans_bl.length) return;
for(i=0; i<fans_bl.length; i++){
if(fans_bl[i]) {
removeDeactivatedFan(i);
break;
}
};
}
function removeDeactivatedFan(id){
var remove_control = fans_bl[id].querySelector('.fans_fan_bl');
remove_control.click();
setTimeout(function(){
var add_to_bl = document.querySelectorAll('.flat_button')[1];
add_to_bl.click();
fans_bl.splice(id,1);
setTimeout(iterateFans, time);
}, time);
}
iterateFans();
@AlexEdunov
Copy link

Don't work with current version. To fix errors you should change class name from "button_blue" to "flat_button".

@IOZ
Copy link
Author

IOZ commented Feb 1, 2015

AlexEdunov, thank's. Fix problem according your approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment