Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- var tasks = new Sync();
- var curHref;
- // глвный цикл
- setInterval(function() {
- if ( !geByClass('captcha')[0] ) {
- // ожидаем
- tasks.wait();
- }
- if (curHref != location.href) {
- curHref = location.href;
- console.log('Интерфейс обновлен.');
- // подтвердить все заявки в друзья
- if (location.pathname == '/friends') {
- if (cur.section == 'requests' || cur.section == 'all_requests' || (ge('friends_hide_all') && ge('friends_hide_all').style.display != 'none')) {
- var arr = cur.section == 'all_requests' ? cur.friendsList.all_requests : cur.friendsList.requests;
- console.log(arr);
- if (arr.length > 1) {
- // ce(tagName, attr, style)
- var div = ce('span', { innerHTML: '|', className: 'divide' });
- var wrap = ce('span');
- var link = ce('a', { innerHTML: 'Добавить всех', onclick: function() {
- wrap.innerHTML = '✓ сделано';
- for (var i = 0; i < arr.length; ++i) {
- (function(item) {
- tasks.append(function() {
- setTimeout(function() {
- if (Friends) {
- Friends.acceptRequest(item[0], item[8][0], ge('accept_request_' + item[0]))
- }
- else {
- ajax.post('al_friends.php', {
- act: 'add',
- ads_section: 'friends',
- al: 1,
- al_ad: 1,
- hash: item[8][0],
- mid: item[0],
- request: 1,
- select_list: 1
- }, {
- onDone: function() {
- Notifier.showEvent({
- title: 'Входящая заявка принята',
- text: '<a href="' + item[2] + '" target="_blank" class="mem_link">' + item[5] + '</a> и Вы теперь друзья.',
- author_photo: item[1],
- author_link: item[2],
- add_photo: ''
- });
- }
- });
- }
- console.log(Math.floor(new Date().getTime() / 1000) + ' - выполнено');
- tasks.next();
- }, irand(1000, 3000));
- });
- })(arr[i]);
- }
- }});
- wrap.appendChild(link);
- ge('friends_summary').appendChild(div);
- ge('friends_summary').appendChild(wrap);
- }
- }
- }
- }
- }, 40);
- })();
Advertisement
Add Comment
Please, Sign In to add comment