Situatie
You can use this method to wish your friends a happy birthday or just comment on anything. It is useful when you want to comment a number of times on a post. You just need to specify the count and message that will be automatically commented on a time-interval. Also, you don’t need to install anything for this method to work.
Solutie
Pasi de urmat
Approach:
- Initialize count and message value.
- Then define an interval function which will be called each time.
- Make an input variable that points to the input field of comment section.
- Make a submit variable that points to the comment button.
- Since, comment button is disabled by default, so first enable it.
- Set the message to be written in input.
- Click on the submit.
- Decrement the count.
- If count become zero, then clear the interval function.
- Set the time interval of 10000ms, it means the function will be called after each 10 seconds.
Below are the steps:
- Go to facebook page
- Sign in and open any post.
- Open developer mode in Chrome by pressing Ctrl+Shift+I
- Navigate to the console.
- Now, run the below script.
var count = 100;
var message = “Hi”;
var loop = setInterval(function(){
var input = document.getElementsByName(“comment_text”)[0];
var submit = document.querySelector(‘button[type=”submit”]’);
submit.disabled = false;
input.value = message;
submit.click();
count -= 1;
if(count == 0)
{
clearInterval(loop);
}
}, 10000);
Leave A Comment?