Created
November 3, 2016 06:38
-
-
Save mainnika/a07dbf2c136a04e9742032df50fec9e2 to your computer and use it in GitHub Desktop.
ok.ru auto add friends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// when «people you may know» window is open | |
function add_friends(){ | |
var q = []; | |
return setInterval(function(){ | |
var r = document.getElementsByName('button_save_rlshp')[0]; | |
if (r) { | |
r.click(); | |
} | |
var p = q.pop(); | |
if (!p) { | |
q = Array.prototype.slice.call(document.getElementsByClassName('mt-x')); | |
return; | |
} | |
p.children[0].children[0].click(); | |
}, 2000); | |
} | |
// when notification window is open | |
function accept_friends(){ | |
Array.prototype.slice.call(document.getElementsByTagName('button')).filter(function(el){ | |
var attr = el.attributes.getNamedItem('data-l') | |
if (!attr || (attr && attr.nodeValue != 't,btn_accept')) { | |
return false; | |
} | |
return true; | |
}).forEach(function(el) { | |
el.click(); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment