Skip to content

Instantly share code, notes, and snippets.

@euppi98
Last active August 26, 2019 16:32
Show Gist options
  • Select an option

  • Save euppi98/1d3ca3939f749b00459d39e46d5b5d06 to your computer and use it in GitHub Desktop.

Select an option

Save euppi98/1d3ca3939f749b00459d39e46d5b5d06 to your computer and use it in GitHub Desktop.
ВК - библиотека скриптов (VK - script library)
for (const button of document.querySelectorAll("button")) {
if (button.textContent.includes("Добавить в друзья")) {
button.click();
}
}
//scroll down at max
function scrollDown(callback) {
let scroll = document.body.scrollHeight;
let lastScroll = scroll;
window.scrollTo(0, document.body.scrollHeight);
requestAnimationFrame(function() {
scroll = document.body.scrollHeight;
if (scroll != lastScroll)
scrollDown(callback);
else callback();
});
}
//add all music
//setTimeout - 1000 ms = 1 second
scrollDown(function() {
var list = document.querySelectorAll(".audio_row");
console.log(`Total songs: ${list.length}`);
function add(el, obj, delay) {
setTimeout(function() {
console.log(`add ${obj.title}`);
AudioUtils.addAudio(el, obj);
}, 1000 * delay);
}
list.forEach(function(el, num) {
let obj = AudioUtils.asObject(AudioUtils.getAudioFromEl(el));
add(el, obj, num);
});
});
for (const button of document.querySelectorAll("button")) {
if (button.textContent.includes("Отписаться")) {
button.click();
}
}
for (const button of document.querySelectorAll("button")) {
if (button.textContent.includes("Отменить заявку")) {
button.click();
}
}
var bl_list = document.querySelectorAll('.settings_bl_row'),
i;
function iterateBlocked() {
if (!bl_list.length) return;
for (i = 0; i < bl_list.length; i++) {
if (bl_list[i]) {
removeBlockedFan(i);
}
};
}
function removeBlockedFan(id) {
var remove_control = bl_list[id].getElementsByTagName('a')[1];
remove_control.click();
}
iterateBlocked();
//scroll down at max
function scrollDown(callback) {
let scroll = document.body.scrollHeight;
let lastScroll = scroll;
window.scrollTo(0, document.body.scrollHeight);
requestAnimationFrame(function() {
scroll = document.body.scrollHeight;
if (scroll != lastScroll)
scrollDown(callback);
else callback();
});
}
//delete all music
scrollDown(function() {
var list = document.querySelectorAll(".audio_row");
console.log(`Total songs: ${list.length}`);
function del(obj) {
console.log(`delete ${obj.title}`);
ajax.post("al_audio.php", {
act: "delete_audio",
oid: obj.ownerId,
aid: obj.id,
hash: obj.deleteHash,
restore: 1
});
}
list.forEach(function(el) {
let obj = AudioUtils.asObject(AudioUtils.getAudioFromEl(el));
del(obj);
});
});
for (const button of document.querySelectorAll("button")) {
if (button.textContent.includes("Оставить в подписчиках")) {
button.click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment