Skip to content

Instantly share code, notes, and snippets.

@erikras
Created December 31, 2024 10:27
Show Gist options
  • Save erikras/b31fbf7bee90495423f3b9f0a939dfd0 to your computer and use it in GitHub Desktop.
Save erikras/b31fbf7bee90495423f3b9f0a939dfd0 to your computer and use it in GitHub Desktop.
Code to modify github's "Files changed" tab to "hide whitespace"
setTimeout(() => {
const tabs = [...document.querySelectorAll(".tabnav-tab.flex-shrink-0")]
const filesTab = tabs.find((element) => /.+\/files$/.test(element.href))
if (!filesTab) {
return
}
const filesURL = new URL(filesTab.href)
filesURL.searchParams.set("w", "1")
filesTab.href = filesURL.toString()
}, 500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment