Skip to content

Instantly share code, notes, and snippets.

@theY4Kman
Created September 29, 2014 21:04
Show Gist options
  • Save theY4Kman/336aec46057c222e7e89 to your computer and use it in GitHub Desktop.
Save theY4Kman/336aec46057c222e7e89 to your computer and use it in GitHub Desktop.
// ==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