Skip to content

Instantly share code, notes, and snippets.

@tifletcher
Last active February 13, 2018 19:55
Show Gist options
  • Save tifletcher/58a57a9de2b09199334518ee0451e368 to your computer and use it in GitHub Desktop.
Save tifletcher/58a57a9de2b09199334518ee0451e368 to your computer and use it in GitHub Desktop.
Bookmarklet: Hide files by regex(pathname) during github code review.
(function(){
var hideIfMatches = (matcher) => (node) => {
if(node.querySelector(".file-header").getAttribute("data-path").match(matcher))
node.style.display = "none"
}
var fileNodes = document.querySelectorAll("#files .file")
var matcher = RegExp(prompt("Hide files when path matches regex:", "^reference.*"))
fileNodes.forEach(hideIfMatches(matcher))
})()
// bookmarklet
// javascript:(function(){var hideIfMatches = (matcher) => (node) => {if(node.querySelector(".file-header").getAttribute("data-path").match(matcher)){node.style.display = "none";}};var fileNodes = document.querySelectorAll("#files .file");var matcher = RegExp(prompt("Hide files when path matches regex:", "^reference.*")); fileNodes.forEach(hideIfMatches(matcher));})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment