Skip to content

Instantly share code, notes, and snippets.

@Zirak
Created May 9, 2014 13:20
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 Zirak/6420b850a207cddf82c3 to your computer and use it in GitHub Desktop.
Save Zirak/6420b850a207cddf82c3 to your computer and use it in GitHub Desktop.
var ids = $('#access-section-read-write .usercard').map(function () { return /\d+/.exec(this.id); }).toArray()
function remove (userId, cb) {
$.post('/rooms/setuseraccess/17', fkey({
aclUserId : userId,
userAccess : 'remove'
})).always(cb);
}
(function step (ids) {
if (!ids.length) {
console.log('done');
return;
}
var id = ids.pop();
remove(id, finish);
function finish (xhr) {
if (xhr.statusCode !== 200) {
console.error(xhr.statusText);
console.log(xhr);
}
setTimeout(function () {
step(ids);
}, 500);
}
})(ids);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment