Forked from daveyarwood/hideKanbanBoardNoise.js
Last active
February 23, 2017 16:51
-
-
Save karnowski/23bdaa67edf70d1bc886dbe76c937d60 to your computer and use it in GitHub Desktop.
Fork of Dave's Kanban noise reducer that works in my Fluidapp SSB for Trello.
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
// From Dave Yarwood's Gist: | |
// https://gist.github.com/daveyarwood/ab85d38e365cdc10e26d11c67ba23d64 | |
console.log("loading Dave's userscript..."); | |
function runDaveRun() { | |
var orgName = $('.board-header-btn-org-name .board-header-btn-text').text(); | |
var boardName = $('.board-header-btn-name-with-org-logo .board-header-btn-text').text(); | |
if (orgName == 'Adzerk' && boardName == 'The Kanban Board') { | |
console.log("Kanban board detected; adding Dave's good stuff...") | |
var allColumns = $('.list-wrapper'); | |
var ACTIVE_COLUMNS = [ | |
"Crushing", | |
"Needs Code Review", | |
"Needs Staging Deploy", | |
"Acceptance Testing (QA)", | |
"Needs Prod Deploy (Passed QA)", | |
"Packaging / Enablement", | |
"Needs Product Sign-off", | |
"Needs Support Sign-off", | |
"CRUSHED!", | |
]; | |
var UI_COLUMNS = [ | |
"Larry's Bag of Holding", | |
"Crushable: Mgmt UI/API", | |
"Backlog: UI/API", | |
]; | |
var ENGINE_COLUMNS = [ | |
"Larry's Bag of Holding", | |
"Crushable: Ad Delivery", | |
"Backlog: Engines", | |
]; | |
var REPORTING_COLUMNS = [ | |
"Larry's Bag of Holding", | |
"Crushable: Reporting", | |
"Backlog: Reporting", | |
]; | |
var SUPPORT_COLUMNS = [ | |
"Inbox", | |
"Larry's Bag of Holding", | |
"Eng Backpressure to Support", | |
"Crushable: Support Engineering", | |
]; | |
var PRODUCT_COLUMNS = [ | |
"Inbox", | |
"Larry's Bag of Holding", | |
"Crushable: Mgmt UI/API", | |
"Crushable: Ad Delivery", | |
"Crushable: Reporting", | |
"Argonath", | |
"Backlog: UI/API", | |
"Backlog: Engines", | |
"Backlog: Reporting", | |
]; | |
function showOnlyColumnsICareAbout(cols) { | |
console.info("Hiding columns..."); | |
$.map(allColumns, function(column) { | |
var columnName = $(column).find('.list-header-name-assist').text(); | |
if (!cols.includes(columnName)) { | |
$(column).hide(); | |
} | |
}); | |
} | |
function showAllColumns() { | |
console.info("Showing all columns.") | |
allColumns.show(); | |
} | |
var showAll = true; | |
function toggleColumns(cols) { | |
showAll = !showAll; | |
if (showAll) { | |
showAllColumns(); | |
} else { | |
showOnlyColumnsICareAbout(cols); | |
} | |
} | |
//Dave wants the columns off by default; I don't. | |
//toggleColumns(); | |
document.onkeypress = function(e) { | |
console.log("onkeypress", e.keyCode, e); | |
//console.log("altKey", e.altKey, "ctrlKey", e.ctrlKey, "metaKey", e.metaKey, "shiftKey", e.shiftKey); | |
//short circuit if the window is not visible | |
//if (!$('.window').is(':visible')) { | |
// console.log("bailing because window is invisible"); | |
// return; | |
//} | |
// Dave's behavior | |
//if (e.key == '`' || e.keyCode == 96) { | |
// toggleColumns(columnsICareAbout); | |
//} | |
// cntrl-shift-A for Team UI columns | |
if ((e.key == 'A' || e.keyCode == 1) && e.shiftKey && e.ctrlKey) { | |
console.log("Enable Team UI columns!"); | |
toggleColumns(ACTIVE_COLUMNS); | |
} | |
// cntrl-shift-U for Team UI columns | |
if ((e.key == 'U' || e.keyCode == 21) && e.shiftKey && e.ctrlKey) { | |
console.log("Enable Team UI columns!"); | |
toggleColumns(UI_COLUMNS); | |
} | |
// cntrl-shift-E for Team Engines columns | |
if ((e.key == 'E' || e.keyCode == 5) && e.shiftKey && e.ctrlKey) { | |
console.log("Enable Team Engines columns!"); | |
toggleColumns(ENGINE_COLUMNS); | |
} | |
// cntrl-shift-R for Team Reporting columns | |
if ((e.key == 'R' || e.keyCode == 18) && e.shiftKey && e.ctrlKey) { | |
console.log("Enable Team Reporting columns!"); | |
toggleColumns(REPORTING_COLUMNS); | |
} | |
// cntrl-shift-X for Team Support columns | |
if ((e.key == 'X' || e.keyCode == 24) && e.shiftKey && e.ctrlKey) { | |
console.log("Enable Team Support columns!"); | |
toggleColumns(SUPPORT_COLUMNS); | |
} | |
// cntrl-shift-K for Team Product columns | |
if ((e.key == 'K' || e.keyCode == 11) && e.shiftKey && e.ctrlKey) { | |
console.log("Enable Team Product columns!"); | |
toggleColumns(PRODUCT_COLUMNS); | |
} | |
} | |
} | |
} | |
setTimeout(runDaveRun, 1500); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment