Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save evoactivity/368d2b125a0e2145f255 to your computer and use it in GitHub Desktop.
Save evoactivity/368d2b125a0e2145f255 to your computer and use it in GitHub Desktop.
Trello Mood Board
if ($('.mood-board').length > 0) {
$('.mood-board').remove();
} else {
var $thumbnails = $(".js-card-cover"),
board,
image;
board = '<style class="mood-board">' +
'.body-board-view {'+
'overflow-y: scroll;' +
'}' +
'ul.mood-board {' +
'position: absolute;' +
'z-index: 50;' +
'top: 0;' +
'right: 0;' +
'bottom: 0;' +
'left: 0;' +
'overflow-y: scroll;' +
'padding: 0;' +
'background: #000;' +
'}' +
'ul.mood-board li {' +
'width: 33.333%' +
'}' +
'ul.mood-board img {' +
'padding: 0;' +
'background: #000;' +
'display: block;' +
'width: 100%;' +
'}' +
'</style>';
$thumbnails.each(function () {
image = $(this).css('background-image').replace('url("', '').replace('")', '');
if ( image !== 'none' ){
board += '<li><a href="' + image + '"><img src="' + image + '" /></a></li>';
}
});
$('body').append('<ul class="mood-board">' + board + '</ol>');
$.ajax({
url: 'https://cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.min.js',
dataType: 'script',
success: function () {
$('ul.mood-board').masonry({
columnWidth: 0,
containerStyle: null,
itemSelector: 'li'
});
}
});
}
@evoactivity
Copy link
Author

Found this gist here https://gist.github.com/curtisj44/10951996 but it no longer worked, forked and updated so it works.

bookmarklet

javascript:(function(){if%20($('.mood-board').length%20>%200)%20{$('.mood-board').remove();%20}%20else%20{var%20$thumbnails%20=%20$(".js-card-cover"),%20board,%20image;%20board%20=%20'<style%20class="mood-board">'%20+%20'.body-board-view%20{'+%20'overflow-y:%20scroll;'%20+%20'}'%20+%20'ul.mood-board%20{'%20+%20'position:%20absolute;'%20+%20'z-index:%2050;'%20+%20'top:%200;'%20+%20'right:%200;'%20+%20'bottom:%200;'%20+%20'left:%200;'%20+%20'overflow-y:%20scroll;'%20+%20'padding:%200;'%20+%20'background:%20#000;'%20+%20'}'%20+%20'ul.mood-board%20li%20{'%20+%20'width:%2033.333%'%20+%20'}'%20+%20'ul.mood-board%20img%20{'%20+%20'padding:%200;'%20+%20'background:%20#000;'%20+%20'display:%20block;'%20+%20'width:%20100%;'%20+%20'}'%20+%20'</style>';%20$thumbnails.each(function%20()%20{image%20=%20$(this).css('background-image').replace('url("',%20'').replace('")',%20'');%20if%20(%20image%20!==%20'none'%20){board%20+=%20'<li><a%20href="'%20+%20image%20+%20'"><img%20src="'%20+%20image%20+%20'"%20/></a></li>';%20}%20});%20$('body').append('<ul%20class="mood-board">'%20+%20board%20+%20'</ol>');%20$.ajax({url:%20'https://cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.min.js',%20dataType:%20'script',%20success:%20function%20()%20{$('ul.mood-board').masonry({columnWidth:%200,%20containerStyle:%20null,%20itemSelector:%20'li'});%20}%20});%20}%20})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment