Created
February 15, 2017 14:30
-
-
Save ishche/6f3a7e6d2e1ae9d0fb1447f7d13d64f8 to your computer and use it in GitHub Desktop.
Invite VK script
This file contains hidden or 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
| // javascript: | |
| const INVATED_STATE_ELEMENT_POS = 11; | |
| const HASH_ELEMENT_POS = 12; | |
| var click_tm=700; | |
| var click_tm_incr=100; | |
| var tm_stat_num=2;var tm_coeff=1.2; | |
| var min_tm = 300;var tm_increased=0; | |
| var clicked={all:{'num':0},members:{'num':0},online:{'num':0}}; | |
| var toclick=[]; | |
| function updateTitle(msg){ | |
| var frTotal=cur.friendsList[cur.curList].length; | |
| var frInvited=clicked[cur.curList].num; | |
| if(msg==undefined){ | |
| msg='' | |
| } | |
| document.title="[ "+frInvited+" / "+frTotal+" ] { "+click_tm+" } "+msg} | |
| function upd_toclick(){ | |
| var i;toclick=[]; | |
| for(i in cur.friendsList[cur.curList]){ | |
| if(cur.friendsList[cur.curList][i][INVATED_STATE_ELEMENT_POS]==0 | |
| && !clicked[cur.curList][i]) { | |
| toclick.push(i)} | |
| } | |
| } | |
| function click(){ | |
| var i; | |
| upd_toclick(); | |
| var captcha=geByClass('recaptcha',document).length; | |
| if(captcha==0) { | |
| tm_increased=0; | |
| if(toclick.length>0) { | |
| var id=toclick.shift(); | |
| Friends.inviteToGroup(null,cur.gid,cur.friendsList[cur.curList][id][0],0,cur.friendsList[cur.curList][id][HASH_ELEMENT_POS]); | |
| clicked[cur.curList][id]=-1*new Date().getTime(); | |
| clicked[cur.curList].num+=1; | |
| } | |
| } else if((captcha>1) && (tm_increased==0)) { | |
| clearInterval(click_interval); | |
| click_tm=click_tm+click_tm_incr; | |
| tm_increased=1; | |
| click_interval=setInterval(click,click_tm) | |
| } | |
| if(captcha > 0) { | |
| updateTitle(captcha+" CAPTHA"); | |
| for(i in cur.friendsList[cur.curList]) { | |
| if(clicked[cur.curList][i]<0) { | |
| clicked[cur.curList][i]=0; | |
| } | |
| } | |
| } else { | |
| updateTitle() | |
| } | |
| } | |
| function get_stats(){ | |
| var now=new Date().getTime(); | |
| var i; | |
| for(i in cur.friendsList[cur.curList]){ | |
| if(cur.friendsList[cur.curList][i][INVATED_STATE_ELEMENT_POS]==0&&clicked[cur.curList][i]<0){ | |
| clicked[cur.curList][i]+=now | |
| } | |
| } | |
| var tottime=0; | |
| var counted=0; | |
| for(i=cur.friendsList[cur.curList].length-1;i>=0;i-=1){ | |
| if(clicked[cur.curList][i]>0){ | |
| tottime+=clicked[cur.curList][i]; | |
| counted+=1; | |
| if(counted>=tm_stat_num){ | |
| var new_click_tm=Math.max(Math.round(tottime/counted*tm_coeff),min_tm); | |
| if(new_click_tm!==click_tm){ | |
| click_tm=new_click_tm; | |
| clearInterval(click_interval); | |
| click_interval=setInterval(click,click_tm) | |
| } | |
| i=-1 | |
| } | |
| } | |
| } | |
| } | |
| var friends_interval=setInterval("Friends.showMore()",500); | |
| var stat_interval=setInterval(get_stats,10); | |
| var click_interval=setInterval(click,click_tm); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment