Created
September 29, 2014 21:04
-
-
Save theY4Kman/336aec46057c222e7e89 to your computer and use it in GitHub Desktop.
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 Hipchat Click to View Images | |
// @version 0.1 | |
// @match https://*.hipchat.com/chat | |
// @copyright 2014, Zach "theY4Kman" Kanzler | |
// @grant GM_unsafeWindow | |
// ==/UserScript== | |
// Add styles to initially disable images | |
unsafeWindow.$('head').append([ | |
'<style type="text/css">', | |
'.preview .image a {', | |
' display: none;', | |
'}', | |
'.preview .image:before {', | |
' content: "Image hidden. Click to show.";', | |
' font-style: italic;', | |
' color: grey;', | |
' cursor: pointer;', | |
'}', | |
'.preview.shown .image a {', | |
' display: block;', | |
'}', | |
'.preview.shown .image:before {', | |
' content: "";', | |
'}', | |
'</style>' | |
].join('\n')); | |
unsafeWindow.$(document).on('click', '.preview:not(.shown) .image', function() { | |
$(this).parent().addClass('shown'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment