// ==UserScript==
// @name Widen Code Container (GitHub)
// @namespace chriskim06
// @description Adds a button to allow you to widen the container when viewing files
// @include https://github.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @version 1.2.6
// @grant none
// @locale en
// @downloadURL none
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
$(function() {
if ($('#user-links').length) {
$('#user-links').prepend('
');
$('#user-links').prepend('');
$('#code-widen-button').click(function(e) {
e.preventDefault();
if ($('.repository-content > .file').length || $('.repository-content').find('#files').length) {
if ($('#diff > #toc > .btn-group > a:nth-child(2)').hasClass('selected')) {
return;
}
var container = $('.container.new-discussion-timeline.experiment-repo-nav');
var expanded = $(window).width() * 0.75;
if (container.width() < expanded) {
container.css('width', expanded + 'px');
} else {
container.css('width', '980px');
}
}
$(this).blur();
});
$('#hide-whitespace-button').click(function(e) {
e.preventDefault();
var url = window.location.href;
if ($('#diff > #files').length && !url.endsWith('?w=1')) {
window.location.href = url + '?w=1';
}
$(this).blur();
});
}
});