stuppid_bot

Untitled

Mar 27th, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.     var tasks = new Sync();
  3.     var curHref;
  4.    
  5.     // глвный цикл
  6.     setInterval(function() {      
  7.         if ( !geByClass('captcha')[0] ) {
  8.             // ожидаем
  9.             tasks.wait();
  10.         }
  11.        
  12.         if (curHref != location.href) {
  13.             curHref = location.href;
  14.             console.log('Интерфейс обновлен.');
  15.            
  16.             // подтвердить все заявки в друзья
  17.             if (location.pathname == '/friends') {
  18.                 if (cur.section == 'requests' || cur.section == 'all_requests' || (ge('friends_hide_all') && ge('friends_hide_all').style.display != 'none')) {
  19.                     var arr = cur.section == 'all_requests' ? cur.friendsList.all_requests : cur.friendsList.requests;
  20.                     console.log(arr);
  21.                    
  22.                     if (arr.length > 1) {
  23.                         // ce(tagName, attr, style)
  24.                         var div = ce('span', { innerHTML: '|', className: 'divide' });                      
  25.                         var wrap = ce('span');
  26.                         var link = ce('a', { innerHTML: 'Добавить всех', onclick: function() {
  27.                             wrap.innerHTML = '✓ сделано';
  28.                            
  29.                             for (var i = 0; i < arr.length; ++i) {
  30.                                 (function(item) {
  31.                                     tasks.append(function() {
  32.                                         setTimeout(function() {        
  33.                                             if (Friends) {
  34.                                                 Friends.acceptRequest(item[0], item[8][0], ge('accept_request_' + item[0]))
  35.                                             }
  36.                                             else {
  37.                                                 ajax.post('al_friends.php', {
  38.                                                     act: 'add',
  39.                                                     ads_section: 'friends',
  40.                                                     al: 1,
  41.                                                     al_ad: 1,
  42.                                                     hash: item[8][0],
  43.                                                     mid: item[0],
  44.                                                     request: 1,
  45.                                                     select_list: 1
  46.                                                 }, {
  47.                                                     onDone: function() {
  48.                                                         Notifier.showEvent({
  49.                                                             title: 'Входящая заявка принята',
  50.                                                             text: '<a href="' + item[2] + '" target="_blank" class="mem_link">' + item[5] + '</a> и Вы теперь друзья.',                            
  51.                                                             author_photo: item[1],
  52.                                                             author_link: item[2],
  53.                                                             add_photo: ''                                  
  54.                                                         });
  55.                                                     }
  56.                                                 });
  57.                                             }
  58.  
  59.                                             console.log(Math.floor(new Date().getTime() / 1000) + ' - выполнено');
  60.                                             tasks.next();
  61.                                         }, irand(1000, 3000));
  62.                                     });
  63.                                 })(arr[i]);
  64.                             }
  65.                         }});
  66.                        
  67.                         wrap.appendChild(link);
  68.                         ge('friends_summary').appendChild(div);
  69.                         ge('friends_summary').appendChild(wrap);                    
  70.                     }
  71.                 }
  72.             }
  73.         }
  74.     }, 40);
  75. })();
Advertisement
Add Comment
Please, Sign In to add comment