Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tshddx/8739362 to your computer and use it in GitHub Desktop.
Save tshddx/8739362 to your computer and use it in GitHub Desktop.
Make GitHub Pull Request, Commit, and Blob pages full width with the touch of a button
// ==UserScript==
// @name make github pull request commit and blob pages full width with the touch of a button
// @namespace https://gist.github.com/baddox/8739362
// @description Makes the GitHub Pull Request, Commit, and Blob pages span the full width of the browser, rather than maxing out at the default ~900 pixels.
// @include https://github.com/*
// @grant none
// @version 1.1
// ==/UserScript==
var html = '<span class="go-full-width" style="font-size:18px; padding:6px; background-color:silver; opacity:0.6; cursor:pointer; position:fixed; bottom:10px; left:10px;">Full width</span>';
var bodyElement = document.body;
var temp = document.createElement('div');
temp.innerHTML = html;
var el = temp.childNodes[0];
el.addEventListener('click', function(event) {
elements = document.getElementsByClassName('container');
for (index = 0; index < elements.length; index++)
{
elements[index].style.width="95%"; // Only 95% to leave room for the "add comment" tooltip icon.
}
elements = document.getElementsByClassName('repository-content context-loader-container');
for (index = 0; index < elements.length; index++)
{
elements[index].style.width="96%";
}
var buttons = document.getElementsByClassName('go-full-width');
buttons[0].style.display = "none";
}, false);
bodyElement.appendChild(el);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment