Make GitHub Pull Request, Commit, and Blob pages full width

Makes the GitHub Pull Request, Commit, and Blob pages span the full width of the browser, rather than maxing out at the default.

As of 2020-06-23. See the latest version.

  1. // ==UserScript==
  2. // @name Make GitHub Pull Request, Commit, and Blob pages full width
  3. // @namespace https://bitbucket.org/deadlydog/greasemonkeyscripts
  4. // @description Makes the GitHub Pull Request, Commit, and Blob pages span the full width of the browser, rather than maxing out at the default.
  5. // @include https://github.com/*/pull/*
  6. // @include https://github.com/*/commit/*
  7. // @include https://github.com/*/blob/*
  8. // @grant none
  9. // @version 1.2.0
  10. // ==/UserScript==
  11.  
  12. function large() {
  13. elements = document.getElementsByClassName('container-lg');
  14. for (index = 0; index < elements.length; index++)
  15. {
  16. elements[index].style.maxWidth="95%"; // Only 95% to leave room for the "add comment" tooltip icon.
  17. }
  18.  
  19. elements = document.getElementsByClassName('container-xl');
  20. for (index = 0; index < elements.length; index++)
  21. {
  22. elements[index].style.maxWidth="95%"; // Only 95% to leave room for the "add comment" tooltip icon.
  23. }
  24. }
  25. large();
  26.  
  27. var observer = new MutationObserver(large);
  28.  
  29. observer.observe(document.body, {
  30. childList: true
  31. });