In an effort to make my script more undetectable robust, I've decided to use more human events, ie mouseover, mousedown, mouseup, mouseout. As these are jQuery dependant, I have added
// @require https://code.jquery.com/jquery-3.1.1.slim.min.js
to the top of my script, and, as per the instructions at the Greasmonkey Wiki included this line:
this.$ = this.jQuery = jQuery.noConflict(true);
When I run this script, I get this error in the console:
Uncaught TypeError: document.getElementsByClassName(...)[0].mouseover is not a function
This would lead me to believe that jQuery hasn't been loaded on the script install. I have tried the same code without the 'noConflict' and it effectivey breaks the site, as well as still returning the aforementioned error.
Here is my Code:
else if (document.getElementsByClassName('thumb-container active')[0] == null &&
document.getElementsByClassName('feed-ajax-next')[0] != null){
document.getElementsByClassName('feed-ajax-next')[0].mouseover();
console.log("M_over");
document.getElementsByClassName('feed-ajax-next')[0].mousedown();
console.log("M_down");
document.getElementsByClassName('feed-ajax-next')[0].mouseup();
console.log("M_up");
document.getElementsByClassName('feed-ajax-next')[0].mouseout();
console.log("M_out");
document.getElementsByClassName()
doesn't return a jQuery object, but mouseover()
and the other functions are jQuery functions.
In that case, you need to use jQuery('.feed-ajax-next')
to get the element as a jQuery object and then use the function like this - jQuery('.feed-ajax-next').mouseover()
You can read more about jQuery objects here: https://learn.jquery.com/using-jquery-core/jquery-object/