Is there a way to display a commit on github.com without showing whitespace changes?
Is there a way to display that from console? i.e. clone and then look at commit
After looking into source HTML of commit page, I've found out that github marks pure whitespace changes with "x" CSS class... Which makes the following oneliner possible:
jQuery.expr[':'].hasX = function(obj) { var $this = $(obj); return ($this.find('.x').length && $this.next().find('.x').length); }; jQuery('.data tbody tr:hasX').toggle().next().toggle();
What it does, is runs through all rows of the commit table, and hides rows if given line and the one after that do have ".x" element in them.
Here's full JS:
// create new selector
jQuery.expr[':'].hasX = function(obj) {
// cache
var $this = $(obj);
// whether this and next line do have '.x' element as child
return $this.find('.x').length && $this.next().find('.x').length;
}
// select all rows and hide (ones containing "-")
jQuery('.data tbody tr:hasX').toggle()
// hide the ones after selected (ones containing "+")
.next().toggle();