Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var expectedOrgName = 'AdzerkBC';
var expectedBoardName = 'The Sprint Board';
function getOrgName() {
return $('.board-header-btn-org-name .board-header-btn-text').text();
}
function getBoardName() {
return $('.board-header-btn-name .board-header-btn-text').text();
}
function runExtension() {
if (getOrgName() != expectedOrgName ||
getBoardName() != expectedBoardName)
return;
var allColumns = $('.list-wrapper');
var columnsICareAbout = [
"Crushable: Mgmt UI/API",
"Crushing",
"Needs Code Review",
"Needs QA Deploy",
"Needs Prod Deploy (Passed QA)",
"CRUSHED!"
];
function showOnlyColumnsICareAbout() {
console.info("Hiding columns I don't care about.");
$.map(allColumns, function(column) {
var columnName = $(column).find('.list-header-name-assist').text();
if (!columnsICareAbout.includes(columnName)) {
$(column).hide();
}
});
}
function showAllColumns() {
console.info("Showing all columns.")
allColumns.show();
}
var showAll = true;
function toggleColumns() {
showAll = !showAll;
if (showAll) {
showAllColumns();
} else {
showOnlyColumnsICareAbout();
}
}
toggleColumns();
document.onkeypress = function(e) {
if ((e.key == '`' || e.keyCode == 96) && !$('.window').is(':visible')) {
toggleColumns();
}
}
}
var onTheRightBoard = false;
function checkOrgAndBoardName() {
var orgName = getOrgName();
var boardName = getBoardName();
if (orgName == expectedOrgName && boardName == expectedBoardName) {
if (!onTheRightBoard) {
onTheRightBoard = true;
runExtension();
}
} else {
onTheRightBoard = false;
// console.log('orgName: ' + orgName + ', boardName: ' + boardName);
}
setTimeout(checkOrgAndBoardName, 1000);
}
checkOrgAndBoardName();
@daveyarwood

This comment has been minimized.

Copy link
Owner Author

daveyarwood commented Feb 16, 2017

How to use this script to optimize your Trello experience:

  1. Be using Chrome.
  2. Install the cjs (custom javascript for web) extension.
  3. Use cjs to run the JavaScript above whenever you're on trello.com.
  4. Edit the orgName and boardName to reflect the name of your Trello organization and board you want to optimize.
  5. Edit columnsICareAbout to reflect the columns that you personally care about.
  6. Press ` to toggle between showing all columns and just the ones you care about. (Just the ones you care about is the default behavior.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.