Last active
August 29, 2015 14:04
-
-
Save zvodd/035e488f912aa18ba0c6 to your computer and use it in GitHub Desktop.
UserScript | xkcd.com | Show xkcd comic captions on the page. (Click the comic image to make it stay.)
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== | |
| // @name xkcd captionator | |
| // @namespace https://gist.github.com/zvodd/035e488f912aa18ba0c6 | |
| // @version 0.1 | |
| // @description Show xkcd comic captions on the page. (Click the comic image to make it stay.) | |
| // @match http://xkcd.com/* | |
| // @copyright 2014+, zvodd | |
| // ==/UserScript== | |
| var comic = $("#comic>img"), | |
| caption = $("<p>"+comic.attr("title")+"</p>").insertAfter(comic); | |
| comic.removeAttr("title"); | |
| caption.hide(); | |
| comic.hover(function () { | |
| caption.clearQueue().slideDown(); | |
| }); | |
| comic.mouseleave(function () { | |
| caption.clearQueue().delay(1200).slideUp(); | |
| }); | |
| comic.click(function () { | |
| comic.unbind('mouseleave'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment