Skip to content

Instantly share code, notes, and snippets.

@daveyarwood
Last active December 12, 2021 15:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save daveyarwood/ab85d38e365cdc10e26d11c67ba23d64 to your computer and use it in GitHub Desktop.
Save daveyarwood/ab85d38e365cdc10e26d11c67ba23d64 to your computer and use it in GitHub Desktop.
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
Copy link
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