Skip to content

Instantly share code, notes, and snippets.

@cs278
Last active August 29, 2015 14:04
Show Gist options
  • Save cs278/a293661b574d0c2ac92d to your computer and use it in GitHub Desktop.
Save cs278/a293661b574d0c2ac92d to your computer and use it in GitHub Desktop.
Toggles ignore whitespace on GitHub diffs.
(function(location, domain) {
var search, regexp;
domain = domain || 'github.com';
search = location.search;
regexp = /[\?&]w=1/;
if (domain !== location.hostname) return;
if (regexp.test(search)) {
search = search.replace(regexp, '');
} else {
search = (search.length > 0
? search.concat('&')
: search.concat('?')).concat('w=1');
}
location.search = search;
})(window.location);
(function(b,d){var a,c;a=b.search;c=/[\?&]w=1/;(d||"github.com")===b.hostname&&(a=c.test(a)?a.replace(c,""):(0<a.length?a.concat("&"):a.concat("?")).concat("w=1"),b.search=a)})(window.location);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment