I am writing Tampermonkey Userscript to help autoswipe profiles.
Problem is that I cannot click on vote buttons - standard method to be used to click, being:
document.querySelector(button_selector).click();
does not work here. No error message is there. Peaking with Firefox Developer Edition, the buttons (divs) have only mouseenter
and mouseleave
events.
So I thought of using keyboard shortcuts (pressing 1 = liking profile, pressing 2 = disliking/skipping). With solutions from topics like this - Is it possible to simulate key press events programmatically?. Also does not work.
The only thing that seems to be potential culprit is isTrusted
event - read more.
When I try to examine the code for keydown
or keyup
events (from Developer Console -> Elements -> Event Listeners), it looks like gibberish in source code, example:
//Partial code
case "keydown":
case "keyup":
Cn(s, r, i)
//Function "Cn"
function Cn(e, t, r) {
var n = r.window === r ? r.document : 9 === r.nodeType ? r : r.ownerDocument;
Sn || null == En || En !== X(n) || ("selectionStart"in (n = En) && vn(n) ? n = {
start: n.selectionStart,
end: n.selectionEnd
} : n = {
anchorNode: (n = (n.ownerDocument && n.ownerDocument.defaultView || window).getSelection()).anchorNode,
anchorOffset: n.anchorOffset,
focusNode: n.focusNode,
focusOffset: n.focusOffset
},
bn && dn(bn, n) || (bn = n,
0 < (n = Vn(yn, "onSelect")).length && (t = new dr("onSelect","select",null,t,r),
e.push({
event: t,
listeners: n
}),
t.target = En)))
}
Is there any way to detect what actually triggers voting yes-or-no?
And how to code it in JavaScript, to make voting for me, with potential hacks that Tampermonkey provides. I thought that maybe "unsafeWindow" would help here, but I am highly unsure if I understand concept of that.