Skip to content

Instantly share code, notes, and snippets.

@hshoff
Forked from reissbaker/grove-ui.js
Created April 11, 2012 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hshoff/2360738 to your computer and use it in GitHub Desktop.
Save hshoff/2360738 to your computer and use it in GitHub Desktop.
Grove UI improvements
!function($) {
App.on('messageAdded', function() {
var $pic, $picLI, index, $prevLI, $prevPic,
$picSeparator, $picContent,
$pics = $('.userpic img'),
SPACING = '3px';
for(index = $pics.length - 1; index >= 0; index--) {
$pic = $($pics[index]);
$picLI = $pic.closest('li');
if($picLI.attr('data-seen')) break;
$picLI.attr('data-seen', true);
$prevLI = $picLI.prev();
if($prevLI) {
$prevPic = $prevLI.find('.userpic img');
$picSeparator = $picLI.find('.separator');
if($prevPic.attr('src') === $pic.attr('src')) {
$pic.hide();
$picLI.find('.user').hide();
$picSeparator.hide();
$picLI.css('margin-top', '-5px');
} else {
$picSeparator.css({
'border-bottom': '1px solid #EAEAEA',
'margin-bottom': SPACING
});
$picLI.find('.content').css({
display: 'block',
'margin-top': '9px'
});
$picLI.css('margin-top', SPACING);
}
}
}
});
}(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment