Created
October 7, 2014 07:44
-
-
Save TApicella/d8bf382199c915d220c3 to your computer and use it in GitHub Desktop.
Mount fade out for HabitRPG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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, 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
Hi,
Forgive the Newbie question, but can this be uploaded to Stylish?
Thanks