Skip to content

Instantly share code, notes, and snippets.

@johnmaxwell
Forked from starzonmyarmz/hide-inline-images.js
Created February 16, 2012 16:35
Show Gist options
  • Save johnmaxwell/1846289 to your computer and use it in GitHub Desktop.
Save johnmaxwell/1846289 to your computer and use it in GitHub Desktop.
A userscript for Flowdock that adds a button next to inline elements like Tweets and Images that allows you to hide them. Really useful to hide annoying animated gifs and hubot pug bombs
// originally from: https://gist.github.com/1649063
$(function () {
if (window.fluid) {
setInterval(function(){
$('.image-preview-wrapper').not('.hideBtnAdded').each(function() {
var t = $(this);
if (t.find('.hideImg').length === 0) {
t.append('<button class="hideImg">Hide This Image</button>');
t.addClass('hideBtnAdded');
}
});
}, 1000);
var clickInit = function() {
var chats = $('#chat_app_lines');
if (chats.children().length > 0) {
chats.on('click', 'button.hideImg', function(){
var t = $(this).parent();
t.hide();
t.prev().show();
clearInterval(clickInit);
return false;
});
}
}
var clickInterval = setInterval(clickInit, 1000);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment