Last active
October 31, 2015 21:40
-
-
Save IOZ/22ba00684f28b7f6ddb4 to your computer and use it in GitHub Desktop.
Remove VK deleted subscribers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
var VKCleaner = { | |
init: function() { | |
this.config = { | |
'userClass' : '#gedit_users_members .gedit_user', | |
'photoClass' : '.gedit_user_img', | |
'buttonsClass' : '.gedit_user_action' | |
}; | |
this.users = null; | |
this.user = {}; | |
this.body = document.body; | |
this.html = document.documentElement; | |
this.count = 0; | |
this.showStat(); | |
this.runIteration(); | |
}, | |
runIteration: function() { | |
var self = this; | |
self.scrollDown(); | |
setTimeout(function() { | |
GroupsEdit.uShowMore(); | |
setTimeout(function() { | |
self.getUsers(); | |
self.cleanUsers(); | |
}, 500); | |
}, 500); | |
}, | |
getUsers: function() { | |
this.users = document.querySelectorAll(this.config.userClass + ':not(.done)'); | |
}, | |
cleanUsers: function() { | |
var userLength, i, user; | |
userLength = this.users.length; | |
i = 0; | |
for (i; i < userLength; i++) { | |
user = this.users[i]; | |
this.user.photo = user.querySelector(this.config.photoClass); | |
user.className = user.className + ' done'; | |
if (this.isUserDeactivated(this.user.photo)) { | |
this.user.controls = this.users[i].querySelectorAll(this.config.buttonsClass); | |
if (typeof this.user.controls[1] == 'object') { | |
this.count += 1; | |
this.statCounter.innerHTML = this.count; | |
user.style.background = 'red'; | |
user.className = user.className + ' delete'; | |
this.user.controls[1].click(); | |
} | |
} | |
this.runIteration(); | |
} | |
}, | |
isUserDeactivated: function(photo) { | |
return /deactivated/g.test(photo.src); | |
}, | |
_getDocumentHeight: function() { | |
return Math.max( this.body.scrollHeight, this.body.offsetHeight, this.html.clientHeight, this.html.scrollHeight, this.html.offsetHeight ); | |
}, | |
scrollDown: function() { | |
window.scrollTo(0, this._getDocumentHeight()); | |
}, | |
showStat: function() { | |
var boxC, cont, wrap, cont, opts, Mybox; | |
boxC = '<div class=""><div class="fc_tab_head"><a class="fc_tab_close_wrap fl_r"><div class="chats_sp fc_tab_close"></div></a><div class="fc_tab_title noselect">%title%</div></div><div id="fc_ctabs_cont"><div class="fc_ctab fc_ctab_active">%content%</div></div></div></div>'; | |
cont = '<div class="fc_content_wrap"><div class="fc_content"><div class="wk_likes_likers_rows"><img class="emoji" src="/images/emoji/D83CDF1F_2x.png">Удалено пользователей: <b id="deletedSubscribersStat">0</b> </div></div>'; | |
wrap = se(rs(boxC, { | |
title: 'Статистика:', | |
content: cont | |
})); | |
cont = geByClass1('fc_content', wrap, 'div'); | |
opts = { | |
movable: geByClass1('fc_tab_head', wrap), | |
hider: geByClass1('fc_tab_close_wrap', wrap, 'a'), | |
startHeight: 100, | |
startWidth: 300, | |
resizeableH: cont, | |
resize: false, | |
minH: 50 | |
}; | |
Mybox = new RBox(wrap, extend(opts, {})); | |
this.statCounter = document.getElementById('deletedSubscribersStat'); | |
} | |
} | |
VKCleaner.init(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment