A
A
ArturFaizullin2017-02-09 21:46:23
In contact with
ArturFaizullin, 2017-02-09 21:46:23

How to open all comments on news in VK?

Hello.
Is there a java script for chrome to open all comments on news in a VK social network group?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ArturFaizullin, 2017-02-09
@ArturFaizullin

I don't know java script at all - I know delphi a bit, c syntax of similar languages.
The search led me to write this:

document.getElementById("wrh-58343385_3471632").click()

wrh - constant text 58343385_3471632
- varies depending on the post
the array takes the form of the same numbers
The full code turned out like this
var p=/wrh-([\d]+_[\d]+)/g;  
var a=document.body.innerHTML.match(p).length; 
for (var i = 0; i < a-1; i++) {
   document.getElementById(document.body.innerHTML.match(p)[i]).click()
   
}

Only on all elements the circle is spinning - in my opinion it is necessary to add a delay ...
setTimeout something does not want to work
Final working code:
var p=/wrh-([\d]+_[\d]+)/g;  
var a=document.body.innerHTML.match(p).length; 
go.count=0;

function go() {
    if (go.count < a) {
        // logs 1, 2, 3 to firebug console at 1 second intervals
        document.getElementById(document.body.innerHTML.match(p)[go.count]).click()
go.count++;
        window.setTimeout(go, 2000);
    }
}
go();

Many thanks to everyone who took part in solving my problem!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question