Default to All Branches Page (GitHub)

Changes the link so that clicking branches takes you to the all branches page

As of 2016-01-28. See the latest version.

  1. // ==UserScript==
  2. // @name Default to All Branches Page (GitHub)
  3. // @namespace chriskim06
  4. // @description Changes the link so that clicking branches takes you to the all branches page
  5. // @include https://github.com/*
  6. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
  7. // @version 1.4.7
  8. // @grant none
  9. // @locale en
  10. // ==/UserScript==
  11.  
  12. this.$ = this.jQuery = jQuery.noConflict(true);
  13.  
  14. $(function() {
  15.  
  16. function allBranches() {
  17. if ($('.repository-content').length) {
  18. var link = $('.repository-content').find('ul.numbers-summary').find('li:nth-child(2) > a');
  19. if (link.length) {
  20. var href = link.attr('href');
  21. if (href.length && !href.endsWith('/all')) {
  22. link.attr('href', href + '/all');
  23. }
  24. }
  25. }
  26. }
  27. allBranches();
  28. window.$(document).on('pjax:end', function() {
  29. allBranches();
  30. });
  31.  
  32. });