Reload GitHub Pull Request Diff page to ignore whitespace

Reloads the GitHub Pull Request Diff page, adjusting the URL to have the diffs ignore whitespace.

  1. // ==UserScript==
  2. // @name Reload GitHub Pull Request Diff page to ignore whitespace
  3. // @namespace https://bitbucket.org/deadlydog/greasemonkeyscripts
  4. // @description Reloads the GitHub Pull Request Diff page, adjusting the URL to have the diffs ignore whitespace.
  5. // @include https://github.com/*/pull/*/files
  6. // @exclude https://github.com/*/pull/*/files?w=1
  7. // @grant none
  8. // @version 1.1
  9. // ==/UserScript==
  10.  
  11. // Wipe out the head and body contents so that we don't wait for them to load before doing the redirect.
  12. document.head.innerHTML='';
  13. document.body.innerHTML='';
  14.  
  15. // Redirect to the URL we are at, with the special modifier attached that signals to ignore whitespace in the diffs.
  16. window.location.href=window.location.href + '?w=1';