chisaka

Untitled

Mar 30th, 2017
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function startImporter(data) {
  2.     var index = 0;
  3.     totalCount = data.users.length;
  4.     $("#blockchain-dialog .totalCount").text(totalCount);
  5.     blockerInterval = setInterval(function() {
  6.         for(var i = 0; i < batchBlockCount && index < data.users.length; i++) {
  7.             var user = data.users[index];
  8.             if (typeof user !== "undefined") {
  9.                 doBlock($("#signout-form input.authenticity_token").val(), user.id, user.name);
  10.             }
  11.             index++;
  12.         }
  13.     });
  14. }
  15. function doBlock(authenticity_token, user_id, user_name, callback) {
  16.     $.ajax({
  17.         url: "https://twitter.com/i/user/block",
  18.         method: "POST",
  19.         dataType: 'json',
  20.         data: {
  21.             authenticity_token: authenticity_token,
  22.             block_user: true,
  23.             impression_id: "",
  24.             report_type: "",
  25.             screen_name: user_name,
  26.             user_id: String(user_id)
  27.         }
  28.     }).done(function(response) {
  29.         //console.log(response);
  30.         queuedStorage[user_name] = {type: connectionType, connection: currentProfileName, on: Date.now(), id: String(user_id)};
  31.     }).fail(function(xhr, text, err) {
  32.         errors++;
  33.         $("#blockchain-dialog .errorCount").text(errors);
  34.         //console.log(xhr);
  35.     }).always(function() {
  36.         usersBlocked++;
  37.         $("#blockchain-dialog .usersBlocked").text(usersBlocked);
  38.         if ((
  39.                 usersBlocked == totalCount
  40.                 || usersBlocked == usersFound
  41.                 || (mode == 'import' && usersBlocked + errors >= totalCount && totalCount > 0)
  42.             ) && totalCount > 0 && !finderRunning) {
  43.             clearInterval(blockerInterval);
  44.             blockerInterval = false;
  45.             saveBlockingReceipts();
  46.         }
  47.     });
  48. }
Advertisement
Add Comment
Please, Sign In to add comment