├── README.md ├── index.js └── manifest.json /README.md: -------------------------------------------------------------------------------- 1 | # chrome-github-expanded 2 | 3 | Expand diffs that GitHub mistakenly hides. 4 | 5 | This is currently hard wired to expand diffs for files matching `*/node_modules/*`. 6 | 7 | ## Installation 8 | 9 | 1) Clone this repository 10 | 2) Go to [chrome://extensions/](chrome://extensions/) 11 | 3) Enable `Developer mode` 12 | 4) Load this folder via `Load unpacked extension...` 13 | 14 | ## Updates 15 | 16 | To update the extension, pull the latest changes and then 17 | hit `Reload` in [chrome://extensions/](chrome://extensions/). 18 | 19 | ## License 20 | 21 | MIT 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const debug = false 4 | 5 | document.addEventListener('DOMContentLoaded', () => { 6 | const loop = () => { 7 | const start = debug && Date.now() 8 | const buttons = Array.from(document.querySelectorAll('.load-diff-button')) 9 | for (let button of buttons) { 10 | let header 11 | let container = button 12 | while (container = container.parentNode) { 13 | header = container.querySelector('.file-header') 14 | if (header) break 15 | } 16 | if (/^[^\/]+\/node_modules\//.test(header.dataset.path)) { 17 | button.click() 18 | } 19 | } 20 | if (buttons.length) requestAnimationFrame(loop) 21 | if (debug) console.log('%sms', Date.now() - start) 22 | } 23 | loop() 24 | window.addEventListener('pjax:complete', loop) 25 | }) 26 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Chrome Github Expanded", 4 | "description": "Expand diffs that GitHub mistakenly hides", 5 | "version": "1.1.0", 6 | "content_scripts": [ 7 | { 8 | "run_at": "document_start", 9 | "matches": [ 10 | "https://github.com/*" 11 | ], 12 | "js": [ 13 | "index.js" 14 | ] 15 | } 16 | ] 17 | } 18 | --------------------------------------------------------------------------------