Skip to content

Instantly share code, notes, and snippets.

@r-k-b
Last active February 6, 2020 04:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-k-b/9e341370159e87b7f8b09200660e93ea to your computer and use it in GitHub Desktop.
Save r-k-b/9e341370159e87b7f8b09200660e93ea to your computer and use it in GitHub Desktop.
Expand all the entries in an Elm Debugger window.
// Intended to be run from the Snippets panel in Chrome Dev Tools, targeting the Elm Debugger popout window.
// https://gist.github.com/r-k-b/9e341370159e87b7f8b09200660e93ea
(() => {
// these are multiple megabytes in size, too big to diff
const blacklist = ['lookup', 'repository', 'historyDetail', 'templateInfos'];
const getChevrons = () => {
const all = [...document.querySelectorAll('span[style*="width: 2ch"]')]
.map(node => ({node, label: node.nextSibling.textContent}))
.filter(chev => !blacklist.includes(chev.label));
return ({
all,
unopened: all.filter(chev => chev.node.textContent === "▸"),
})
};
const {unopened, all} = getChevrons();
const toOpenCount = unopened.length;
const allChevronsCount = all.length;
console.info(
`Opening ${toOpenCount} of ${allChevronsCount - toOpenCount} items...`,
unopened.map(chev => chev.label)
);
unopened.forEach(chev => {
chev.node.click();
});
const postClick = getChevrons();
console.info(`new chevron counts`, {
unopened: postClick.unopened.length,
all: postClick.all.length,
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment