Skip to content

Instantly share code, notes, and snippets.

@klaascuvelier
Last active January 12, 2016 13:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save klaascuvelier/d280eb91c393debbb597 to your computer and use it in GitHub Desktop.
Save klaascuvelier/d280eb91c393debbb597 to your computer and use it in GitHub Desktop.
Collapse diffs for certain file extensions in a PR

Collapse file diffs for files with a certain exentions. The list of extensions is on the end of gist.

// The ES5 version, add extensions in the array at the end of the gist
(function (extensions) { return [].concat(Array.prototype.slice.call(document.querySelectorAll('.file.js-details-container'))).filter(function (item) { return extensions.indexOf(item.querySelector('.file-header .file-info .js-selectable-text').innerHTML.split('.').pop().toLowerCase().trim()) > -1; }).forEach(function (item) { return item.querySelector('.data').style.display = 'none'; }); })(['php']);
// Needs ES6, add extensions in the array at the end of the gist
((extensions) => [...document.querySelectorAll('.file.js-details-container')].filter((item) => {
return extensions.indexOf(item.querySelector('.file-header .file-info .js-selectable-text').innerHTML.split('.').pop().toLowerCase().trim()) > -1;
}).forEach((item) => item.querySelector('.data').style.display = 'none'))(['php']);
@vdclouis
Copy link

GitHub changed .js-selectable-text to .user-select-contain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment