tampermonkey uses JavaScript. if anyone here is a JavaScript wizard I'd be most thankful for even a direction towards that end. or to at least know if it's feasible or not. the idea is to click a button on a website (any). and then store whatever that button did. whereby we can then trigger it without it actually being there anymore (without it being present on the screen anymore). even if we change tabs or so.
so for example is we have a button that increases a number from 0 by an increment of 1 whenever it's clicked. then by storing what that button does with tampermonkey. we can simply initialize a keyboard value to equal that signal and click the key we want instead of having to bother with the button anymore
If I understand your question then Yes, you can do that. With a bit more information perhaps I can provide a more detailed response.
First, how to add a button onto the page:
(function() {
'use strict';
//Look carefully - this is Not jQuery
const $ = document.querySelector.bind(document);
$('body').insertAdjacentHTML('beforeend', init_css() );
//Get data saved last time, if available
const rmbr = localStorage.getItem('myVarName');
if (rmbr !== null){
alert(rmbr);
}
setTimeout(() => {
$('#mybutt').addEventListener('click', () => {
alert('You clicked me');
localStorage.setItem('myVarName','The data you want to save');
});
},300);
});
function init_css(){
return `
<button id="mybutt">Click My Buttn</button>
<style id="jdInitCss">
#mybutt{position:absolute;top:90px;left:45%;height:30px;width:120px;}
#mybutt{background:#0073ea;color:white;padding-top:5px;text-align:center;}
#mybutt{z-index:99999;}
</style>
`;
}
As for saving information, use LocalStorage. Super-easy. Here's a reference.
https://www.w3schools.com/jsref/met_storage_setitem.asp https://www.w3schools.com/jsref/met_storage_getitem.asp
The #mybutt event listener is created inside a setTimeout because you need a few nanoseconds for the button to be injected onto the page (via the init_css() function). Without the setTimeout, there's a good chance JavaScript will attempt to add an event listener onto a button that doesn't yet exist on the page (by just a handful of milliseconds... or, as Maxwell Smart used to say, "....missed it by THAT much...")
Because of how TamperMonkey works, you may need a different (unique) script for each website you wish to use this on. Of course, you can create a script that adds a button onto every webpage you visit, but that is rarely what is desired. Also, you can add multiple //MATCH conditions so that one script will run on multiple websites, but then you have to be more advanced in how you save your localStorage data.
With more information/feedback from you perhaps we can construct more helpful answers.