GitHub - Make PRs easier to diff

Add some functionality to github

2016/05/04のページです。最新版はこちら。

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name GitHub - Make PRs easier to diff
  3. // @namespace https://github.com/drKnoxy/
  4. // @version 1.2
  5. // @description Add some functionality to github
  6. // @author DrKnoxy
  7. // @include https://github.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function(){
  12.  
  13.  
  14. activate();
  15.  
  16. ////////////////
  17.  
  18. function activate() {
  19. _monitorHeader();
  20. }
  21.  
  22. function _monitorHeader() {
  23. document.addEventListener('click', _monitor);
  24.  
  25. function _monitor(e){
  26. var el = e.srcElement;
  27. var isFileHeader = el.classList.contains('file-header');
  28. if (!isFileHeader) return;
  29.  
  30. var next = el.nextElementSibling;
  31. if (!next.classList.contains('blob-wrapper')) return;
  32. toggleVis(next);
  33. }
  34.  
  35. function toggleVis(el) {
  36. if(el.style.display === '') {
  37. el.style.display = 'none';
  38. } else {
  39. el.style.display = '';
  40. }
  41. }
  42. }
  43.  
  44. })();