Advertisement
Guest User

The fancy version of remove applications from profile settings

a guest
Dec 17th, 2021
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // The fancy version
  2. var appCount = 0;
  3. var emptyBlock = '<div class="s-empty-state p48 bg-black-025 bar-md ba bc-black-075 ta-center"><svg aria-hidden="true" class="mb24 svg-spot spotEmptyLg" width="96" height="96" viewBox="0 0 96 96"><path d="M8 12a4 4 0 014-4h79a4 4 0 014 4v18a4 4 0 01-4 4H12a4 4 0 01-4-4V12zm0 33a4 4 0 014-4h79a4 4 0 014 4v18a4 4 0 01-4 4H12a4 4 0 01-4-4V45zM4 78.63a1.5 1.5 0 01-3 0V75.5A4.5 4.5 0 015.5 71h2.44a1.5 1.5 0 010 3H5.5c-.83 0-1.5.67-1.5 1.5v3.13zm9.27-6.13c0-.83.68-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.72 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 110 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.71 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 110 3H38.2a1.5 1.5 0 01-1.5-1.5zm11.72 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.71 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.72 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.71 0c0-.83.67-1.5 1.5-1.5h2.44a4.5 4.5 0 014.5 4.5v3.13a1.5 1.5 0 01-3 0V75.5a1.5 1.5 0 00-1.5-1.5h-2.44a1.5 1.5 0 01-1.5-1.5zM2.5 85.88c.83 0 1.5.67 1.5 1.5v3.15A1.5 1.5 0 005.5 92h2.44a1.5 1.5 0 010 3H5.4A4.5 4.5 0 011 90.5v-3.13c0-.82.67-1.5 1.5-1.5zm88 0c.83 0 1.5.67 1.5 1.5v3.12a4.52 4.52 0 01-4.5 4.5h-2.44a1.5 1.5 0 010-3h2.44a1.5 1.5 0 001.5-1.5v-3.13c0-.82.67-1.5 1.5-1.5zM13.27 93.5c0-.83.68-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.72 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.71 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 110 3H38.2a1.5 1.5 0 01-1.5-1.5zm11.72 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.71 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5zm11.72 0c0-.83.67-1.5 1.5-1.5h4.88a1.5 1.5 0 010 3h-4.88a1.5 1.5 0 01-1.5-1.5z" opacity=".2"></path><path d="M14.5 18a2.5 2.5 0 100-5 2.5 2.5 0 0 0 0 5zm8.5-2.5c0-.83.67-1.5 1.5-1.5h57a1.5 1.5 0 010 3h-57a1.5 1.5 0 01-1.5-1.5zM5.5 1A4.5 4.5 0 001 5.5v20A4.5 4.5 0 005.5 30h81a4.5 4.5 0 004.5-4.5v-20A4.5 4.5 0 0086.5 1h-81zM4 5.5C4 4.67 4.67 4 5.5 4h81c.83 0 1.5.67 1.5 1.5v20c0 .83-.67 1.5-1.5 1.5h-81A1.5 1.5 0 014 25.5v-20zm13 43a2.5 2.5 0 11-5 0 2.5 2.5 0 0 1 5 0zm7.5-1.5a1.5 1.5 0 000 3h57a1.5 1.5 0 000-3h-57zm-19-13A4.5 4.5 0 001 38.5v20A4.5 4.5 0 005.5 63h81a4.5 4.5 0 004.5-4.5v-20a4.5 4.5 0 00-4.5-4.5h-81zM4 38.5c0-.83.67-1.5 1.5-1.5h81c.83 0 1.5.67 1.5 1.5v20c0 .83-.67 1.5-1.5 1.5h-81A1.5 1.5 0 014 58.5v-20z"></path></svg><div>You have no authorized applications</div></div>';
  4. $.each($("#mainbar a[href='#']:contains('Remove')"),function(index, node){
  5.     $(node).attr('href','javascript:;');
  6.     appCount++;
  7.     var userId = StackExchange.options.user.userId;
  8.     $(node).click(function(){
  9.         var params = {
  10.             fkey: StackExchange.options.user.fkey,
  11.             appId: $(this).attr('id').replace('app-','')
  12.         };
  13.        
  14.         $.post("/users/apps/de-authorize/" + userId,params,function(){
  15.             appCount--;
  16.             if (appCount == 0) {
  17.                 $(node).parent().parent().parent().parent().append(emptyBlock);
  18.             }
  19.             $(node).parent().parent().parent().remove();
  20.         });
  21.     });
  22. });
Advertisement
RAW Paste Data Copied
Advertisement