I have the button linked with the comment being pasted but, I can't for the life of me figure out how to click the submit button then after it submits it should click the favorite button. But it doesn't.
I've tried a bunch of different things including document.GetElementsbyTag() and all of those different variations. None of them worked. The website is https://www.furaffinity.net/view/* and all the sub domains after this.
The goal of the script is to, once you click a button, paste a line of text into the comment box then submit the comment by clicking the button. After this happens it needs a delay to then click the "+Add to Favorites" link just below the post image/text. I just have 0 idea how to do all this since ive barely ever used JS for greasemonkey before.
Here's all of my script.
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.furaffinity.net/view/*
// @grant none
// ==/UserScript==
function addButton(text, onclick, cssObj) {
cssObj = cssObj || {position: 'absolute', bottom: '7%', left:'4%', 'z-index': 3}
let button = document.createElement('button'), btnStyle = button.style
document.body.appendChild(button)
button.innerHTML = text
button.onclick = onclick
Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key])
return button
}
(function(){
'use strict'
window.addEventListener('load', () => {
addButton('Comment and Favourite!', gfg_Run)
})
var el_down = document.getElementById("JSMessage");
var inputF = document.getElementById("JSMessage");
function gfg_Run() {
inputF.value = "Very Nice!";
el_down.innerHTML =
"Value = " + "'" + inputF.value + "'";
}
}())