Skip to content

Instantly share code, notes, and snippets.

@starzonmyarmz
Created November 30, 2012 15:32
Show Gist options
  • Save starzonmyarmz/4176451 to your computer and use it in GitHub Desktop.
Save starzonmyarmz/4176451 to your computer and use it in GitHub Desktop.
dot-js script that adds a button to toggle my/all cards
(function agilezen() {
// Only run if on board page
if ( (window.location.href).indexOf("board") !== -1 ) {
// window.ui.userid is unavailable for some reason,
// so this is a crazy workaround to get the user id
var userid = $('#owner').find('option[selected="selected"]').val();
// Add a button to toggle my cards
$('#toolbar-right').prepend('<a href="#" onclick="return false" class="filter-my-cards">Show <span>My</span><span style="display:none;">All</span> Cards</a>');
// When the button is clicked, toggle my cards
$('.filter-my-cards').click(function() {
$('li.story:not([data-ownerid="' + userid + '"])').toggle();
$(this).find('span').toggle();
});
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment