Skip to content

Instantly share code, notes, and snippets.

@bjorne
Created September 24, 2015 09:49
Show Gist options
  • Save bjorne/ae78a670dce7da5c0693 to your computer and use it in GitHub Desktop.
Save bjorne/ae78a670dce7da5c0693 to your computer and use it in GitHub Desktop.
Widen Github Diffs. Useful when violators of 80 character lines are in action.
// ==UserScript==
// @name Widen Github
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match https://github.com/*
// @copyright 2012+, You
// ==/UserScript==
var containerWidth = $('.container').css('width');
var repoContentWidth = $('.repository-with-sidebar .repository-content').css('width');
var button = $('<a>').addClass('btn btn-sm').append($('<span>').addClass('octicon octicon-unfold').css('transform', 'rotate(90deg)'));
button.on('click', function() {
if ( $('.container').css('width') == containerWidth ) {
$('.container').css('width', '90%');
$('.repository-with-sidebar .repository-content').css('width', '95%');
button.addClass('selected');
} else {
$('.container').css('width', containerWidth);
$('.repository-with-sidebar .repository-content').css('width', repoContentWidth);
button.removeClass('selected');
}
});
$('#toc').prepend($('<div>').addClass('btn-group right').css('margin-left', '5px').append(button));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment