Skip to content

Instantly share code, notes, and snippets.

@kezzyhko
Created November 5, 2020 19:29
Show Gist options
  • Select an option

  • Save kezzyhko/49c6716840e9735d7bb8d26eae558af4 to your computer and use it in GitHub Desktop.

Select an option

Save kezzyhko/49c6716840e9735d7bb8d26eae558af4 to your computer and use it in GitHub Desktop.
JS script to like every loaded post on https://vk.com
function shuffle(o) {
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
var workArray = shuffle(document.querySelectorAll('.like_btn.like:not(.active)'));
var curTaskElement = 0;
function triggerCurElement() {
if (curTaskElement >= workArray.length) {
console.log("Всё!");
return true;
};
var rand = Math.floor(Math.random() * (4100 - 1550 + 1)) + 1550;
workArray[curTaskElement].click();
setTimeout(function() {
curTaskElement++;
if (document.querySelectorAll(".box_body .captcha").length) {
var me = document.querySelectorAll(".box_body .captcha").parent().parent().find(".box_controls_wrap .button_blue");
me.click(function() {
triggerCurElement();
});
return false;
}
triggerCurElement();
}, rand);
}
triggerCurElement();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment