Skip to content

Instantly share code, notes, and snippets.

@TApicella
Created October 7, 2014 07:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TApicella/d8bf382199c915d220c3 to your computer and use it in GitHub Desktop.
Save TApicella/d8bf382199c915d220c3 to your computer and use it in GitHub Desktop.
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
Copy link

Hi,

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

Thanks

@tripplehelix
Copy link

@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