Skip to content

Instantly share code, notes, and snippets.

@liuguangw
Last active March 13, 2018 07:48
Show Gist options
  • Save liuguangw/bc4431056d35b440b733a4d665519427 to your computer and use it in GitHub Desktop.
Save liuguangw/bc4431056d35b440b733a4d665519427 to your computer and use it in GitHub Desktop.
steam批量退组
/*退出各种steam组*/
(function () {    
/*时间间隔*/     
var timeP = 5;    
/*略过的组id*/     
var specialIds = ["103582791457524672", "103582791457596561"];    
var groupIdArr = [];    
jQuery(".groupLeftBlock a.linkStandard").each(function () {        
var surl = jQuery(this).attr("href"); 
var matchResult=surl.match(/'(\d+)'/);
if(matchResult!=null){
groupIdArr.push(matchResult[1]);    
}
});    
function leaveStGroup(sindex) {        
if (sindex >= groupIdArr.length) {            
console.log("ok");            
return;        
}        
var groupId = groupIdArr[sindex],
i;         /*跳过*/         
for (i = 0; i < specialIds.length; i++) {            
if (specialIds[i] == groupId) {                
sindex++;                
console.log("proc " + sindex + "/" + groupIdArr.length);                
setTimeout(function () {                    
leaveStGroup(sindex);                
}, timeP);                
return;            
}        
}        
jQuery.ajax({            
type: "GET",
            url: processURL + '?action=leaveGroup&groupId=' + groupId + '&sessionID=' + escape($('sessionID').value),
            success: function () {                
sindex++;                
console.log("proc " + sindex + "/" + groupIdArr.length);                
setTimeout(function () {                    
leaveStGroup(sindex)                
}, timeP);            
}        
});    
}    
leaveStGroup(0);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment