Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment