Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mount fade out for HabitRPG
// ==UserScript==
// Sources: http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
// @name Mount Fader
// @namespace habitRPGMountFader
// @include https://habitrpg.com/*
// @author Tom Apicella (jquery by Erik Vergobbi Vold & Tyler G. Hicks-Wright)
// @description This userscript fades out your mount when you mouse over your hero
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
// Note, jQ replaces $ to avoid conflicts.
jQ(".herobox").hover(function(){
jQ(this).find("[class*=Mount_Head],[class*=Mount_Body]").delay(400).fadeTo("slow", 0.3);
}, function(){
jQ(this).find("[class*=Mount_Head],[class*=Mount_Body]").fadeTo("fast", 1.0);
});
}
// load jQuery and execute the main function
addJQuery(main);
@cTheDragons

This comment has been minimized.

Copy link

@cTheDragons cTheDragons commented Aug 15, 2016

Hi,

Forgive the Newbie question, but can this be uploaded to Stylish?

Thanks

@tripplehelix

This comment has been minimized.

Copy link

@tripplehelix tripplehelix commented Dec 25, 2016

@cTheDragons, it would need to be converted to css. As far as I know, Stylish doesn't support javascript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment