Created
March 27, 2019 14:57
-
-
Save wovalle/599e2ff6509f909893f4972b1e332947 to your computer and use it in GitHub Desktop.
Only works in an instagram post page. Takes the text you have in the comment input and post each line as a comment every 2s
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
const frm = document.querySelector('article form') | |
const commentBox = frm.querySelector('textarea') | |
const postButton = frm.querySelector('button') | |
const comments = commentBox.value.split('\n').filter(c => c.length) | |
const postComment = comment => { | |
console.log('Commenting: ', comment) | |
let lastValue = commentBox.value | |
commentBox.value = comment | |
let event = new Event('input', { bubbles: true }) | |
let tracker = commentBox._valueTracker | |
if (tracker) | |
tracker.setValue(lastValue) | |
} | |
commentBox.dispatchEvent(event) | |
postButton.click() | |
} | |
comments.forEach((comment, i) => { | |
setTimeout(() => postComment(comment) , i * 2000) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment