GitHub - Make PRs easier

Collapsing Headers on diffs

22.09.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 PRs easier
// @namespace    http://adamwknox.com
// @version      0.6
// @description  Collapsing Headers on diffs
// @author       DrKnoxy
// @include      https://github.com/*
// @grant        none
// ==/UserScript==

var blobSelector = '.blob-wrapper, .render-wrapper, .file-header + .empty';
function monitorHeaderToggle() {
  $(document).on('click', '.file-header', function(e){
    $(this).next(blobSelector).toggle();
  });
}

var toggleID = 'js-blob-collapser';
function addToggle() {
  if (!$('#'+toggleID).length){
    $('#toc .btn-group').before('<a id="'+toggleID+'" class="btn btn-sm right" style="margin-left:4px;">Collapse</a>');
  }
}

var allVisible = true;
function monitorToggle() {
  $(document).on('click', '#'+toggleID, function(e) {
    e.preventDefault();
    if (allVisible) {
      $(this).addClass('selected');
      $(blobSelector).hide();
    } else {
      $(this).removeClass('selected');
      $(blobSelector).show();
    }

    allVisible = !allVisible;
  });
}

$(function(){
  // Toggling with the header
  monitorHeaderToggle();

  // Collapsing all
  addToggle();
  monitorToggle();

  $(document).on('pjax:complete pjax:popstate', function(e){
    addToggle();
  });
});