GitHub - Make the site better (and wider)

Makes github full width in a few views, and makes PR diffs easier to browse

18.08.2015 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         GitHub - Make the site better (and wider)
// @namespace    http://adamwknox.com
// @version      0.5
// @description  Makes github full width in a few views, and makes PR diffs easier to browse
// @author       DrKnoxy
// @include      https://github.com/*
// @grant        none
// ==/UserScript==

var styleTemplate = [
	'<style id="knoxyTemplate">',
        // General
		'.container {',
			'width: 100%;',
			'padding-left: 15px;',
			'padding-right: 15px;',
		'}',
		'.repository-with-sidebar .repository-content {',
			'margin-right: 60px;',
			'float: none;',
			'width: auto;',
		'}',
    
        // PR / Compare
		'.blob-wrapper { display:none; }',
		'.file-header { max-height: 42px; }',
        '.subnav { max-height: 34px; }',
        '.table-list-header { max-height: 44px; }',
        
        // wiki pages
        '.wiki-wrapper #wiki-content {clear: none;}',
	'</style>',
].join('');

function workStyleTemplate(url) {
	var pattern = /https:\/\/github.com\/.*\/.*\/(pull|compare|wiki).*/g;
	var reg = new RegExp(pattern);
	if ( url.match(reg) ) {
		$('head').append(styleTemplate);
	} else {
		$('head').find('#knoxyTemplate').remove();
	}
}

$(function(){

	$(document).on('click', '.file-header', function(e){
	    $(this).next('.blob-wrapper').toggle();
	});

	// Update stylesheet on page load
	workStyleTemplate(window.location.href);

	// When pjax finishes, update our stylesheet
    $(document).on('pjax:complete pjax:popstate', function(e){
		var url = e.delegateTarget.URL;
		workStyleTemplate(url);
	});
});