Last active
June 1, 2018 02:39
-
-
Save curtisj44/10951996 to your computer and use it in GitHub Desktop.
Trello Mood Board bookmarklet
This file contains 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
if ($('.mood-board').length > 0) { | |
// off | |
$('.mood-board').remove(); | |
} else { | |
// on | |
var | |
$attachment = $('.attachment-thumbnail'), | |
$this, | |
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: 2px;' + | |
'background: #000;' + | |
'}' + | |
'ul.mood-board img {' + | |
'padding: 2px;' + | |
'max-width: 500px;' + | |
'background: #000;' + | |
'}' + | |
'</style>', | |
imageName, | |
imageSrc; | |
$attachment.each(function () { | |
$this = $(this); | |
imageName = $this.find('.attachment-thumbnail-name').text(); | |
imageSrc = $this.find('.attachment-thumbnail-preview').attr('href'); | |
if (imageName.toLowerCase() !== 'skip') { | |
board += '<li>' + | |
'<a href="' + imageSrc + '">' + | |
'<img src="' + imageSrc + '" />' + | |
'</a>' + | |
'</li>'; | |
} else { | |
console.log('skipped: ' + imageSrc); | |
} | |
}); | |
$('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: 20, | |
containerStyle: null, | |
itemSelector: 'li' | |
}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A bookmarklet to view all of the attached images in an open Trello card in a grid layout (using masonry.js):