├── .gitignore ├── index.js ├── manifest.json ├── package.json ├── readme.md └── style.css /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node 3 | 4 | ### Node ### 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | 15 | # Directory for instrumented libs generated by jscoverage/JSCover 16 | lib-cov 17 | 18 | # Coverage directory used by tools like istanbul 19 | coverage 20 | 21 | # nyc test coverage 22 | .nyc_output 23 | 24 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 25 | .grunt 26 | 27 | # node-waf configuration 28 | .lock-wscript 29 | 30 | # Compiled binary addons (http://nodejs.org/api/addons.html) 31 | build/Release 32 | 33 | # Dependency directories 34 | node_modules 35 | jspm_packages 36 | 37 | # Optional npm cache directory 38 | .npm 39 | 40 | # Optional REPL history 41 | .node_repl_history 42 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | ; 2 | (function () { 3 | function wrap(classes) { 4 | return ''; 5 | } 6 | 7 | function wrapDevicons(ext) { 8 | return wrap('devicons devicons-' + ext); 9 | } 10 | 11 | function wrapFontAwesome(ext) { 12 | return wrap('fa fa-' + ext); 13 | } 14 | 15 | var icons = { 16 | 'bat': wrapDevicons('terminal_badge'), 17 | 'clj': wrapDevicons('clojure'), 18 | 'css': wrapDevicons('css3_full'), 19 | 'exe': wrapDevicons('windows'), 20 | 'hs': wrapDevicons('haskell'), 21 | 'html': wrapDevicons('html5'), 22 | 'js': wrapDevicons('javascript'), 23 | 'json': wrapDevicons('database'), 24 | 'less': wrapDevicons('less'), 25 | 'markdown': wrapDevicons('markdown'), 26 | 'md': wrapDevicons('markdown'), 27 | 'mdown': wrapDevicons('markdown'), 28 | 'php': wrapDevicons('php'), 29 | 'plist': wrapDevicons('apple'), 30 | 'py': wrapDevicons('python'), 31 | 'rb': wrapDevicons('ruby_rough'), 32 | 'scss': wrapDevicons('sass'), 33 | 'sh': wrapDevicons('terminal'), 34 | 'swift': wrapDevicons('swift'), 35 | 'yaml': wrapDevicons('database'), 36 | 'yml': wrapDevicons('database') 37 | }; 38 | 39 | [].slice.call(document.querySelectorAll('tr.js-navigation-item')).forEach(function (tr) { 40 | var icon = tr.querySelector('.icon'); 41 | var content = tr.querySelector('.content a'); 42 | if (!content) { 43 | return; 44 | } 45 | var fn = content.innerText.trim(); 46 | 47 | if (fn.toLowerCase() === 'license') { 48 | icon.innerHTML = wrapFontAwesome('certificate'); 49 | } else if (fn === 'configure') { 50 | icon.innerHTML = wrapFontAwesome('cog'); 51 | } else if (fn === 'manifest.json') { 52 | icon.innerHTML = wrapDevicons('chrome'); 53 | } else if (fn === 'CNAME') { 54 | icon.innerHTML = wrapFontAwesome('globe'); 55 | } else if (fn.startsWith('.git')) { 56 | icon.innerHTML = wrapDevicons('git'); 57 | } else if (fn.startsWith('.vim')) { 58 | icon.innerHTML = wrapDevicons('vim'); 59 | } else if (fn.startsWith('.npm') || fn.toLowerCase() === 'package.json') { 60 | icon.innerHTML = wrapDevicons('npm'); 61 | } else if (fn.startsWith('.travis')) { 62 | icon.innerHTML = wrapDevicons('travis'); 63 | } else if (fn.startsWith('.docker') || fn === 'Dockerfile') { 64 | icon.innerHTML = wrapDevicons('docker'); 65 | } else if (fn === 'gulpfile.js') { 66 | icon.innerHTML = wrapDevicons('gulp'); 67 | } else if (fn.includes('.')) { 68 | icon.innerHTML = icons[fn.split('.').slice(-1)[0]] || icon.innerHTML; 69 | } 70 | 71 | }); 72 | })(); 73 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "GitHub File Icon", 5 | "author": "chad luo", 6 | "description": "Get a better idea about files", 7 | "version": "1.0", 8 | "permissions": [ 9 | "activeTab", 10 | "https://ajax.googleapis.com/" 11 | ], 12 | "content_scripts": [{ 13 | "matches": ["https://github.com/*"], 14 | "css": [ 15 | "node_modules/devicons/css/devicons.min.css", 16 | "node_modules/font-awesome/css/font-awesome.min.css", 17 | "style.css" 18 | ], 19 | "js": ["index.js"] 20 | }], 21 | "web_accessible_resources": [ 22 | "node_modules/devicons/fonts/*.*", 23 | "node_modules/font-awesome/fonts/*.*" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-file-icon", 3 | "version": "0.1.0", 4 | "description": "get a better idea about files on github", 5 | "main": "index.js", 6 | "author": "chad luo", 7 | "license": "ISC", 8 | "dependencies": { 9 | "devicons": "^1.8.0", 10 | "font-awesome": "^4.6.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # GitHub File Icon 2 | 3 | ![Preview](http://i.imgur.com/zJHMHzH.png) 4 | 5 | Preview on [underscore](https://github.com/jashkenas/underscore). 6 | 7 | ## Install 8 | 9 | 1. clone here 10 | 2. `npm i` 11 | 3. goto [chrome://extensions/](chrome://extensions/), turn on Dev mode, drag directory in 12 | 13 | Probably deploy to Chrome Web Store in the future. 14 | 15 | ## License 16 | 17 | import MIT 18 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | table.files td.icon { 2 | padding-top: 0; 3 | padding-bottom: 0; 4 | padding-right: 5px !important; 5 | text-align: center; 6 | } 7 | 8 | .extfont { 9 | display: inline-block; 10 | font-style: normal; 11 | font-weight: normal; 12 | font-variant: normal; 13 | text-transform: none; 14 | text-rendering: auto; 15 | -webkit-font-smoothing: antialiased; 16 | -moz-osx-font-smoothing: grayscale; 17 | width: 14px; 18 | } 19 | 20 | /*! 21 | * Devicons 1.8.0 made by Theodore Vorillas / http://vorillaz.com 22 | */ 23 | 24 | @font-face { 25 | font-family: devicons; 26 | src: url(chrome-extension://__MSG_@@extension_id__/node_modules/devicons/fonts/devicons.eot?xqxft6); 27 | src: url(chrome-extension://__MSG_@@extension_id__/node_modules/devicons/fonts/devicons.eot?#iefixxqxft6) format("embedded-opentype"), url(chrome-extension://__MSG_@@extension_id__/node_modules/devicons/fonts/devicons.woff?xqxft6) format("woff"), url(chrome-extension://__MSG_@@extension_id__/node_modules/devicons/fonts/devicons.ttf?xqxft6) format("truetype"), url(chrome-extension://__MSG_@@extension_id__/node_modules/devicons/fonts/devicons.svg?xqxft6#devicons) format("svg"); 28 | font-weight: 400; 29 | font-style: normal 30 | } 31 | 32 | .devicons { 33 | font-family: devicons; 34 | font-size: 18px; 35 | transform: translate(-2px, 2px); 36 | } 37 | 38 | /*! 39 | * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome 40 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 41 | */ 42 | 43 | @font-face { 44 | font-family: 'FontAwesome'; 45 | src: url(chrome-extension://__MSG_@@extension_id__/node_modules/font-awesome/fonts/fontawesome-webfont.eot?v=4.6.3); 46 | src: url(chrome-extension://__MSG_@@extension_id__/node_modules/font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.6.3) format('embedded-opentype'), url(chrome-extension://__MSG_@@extension_id__/node_modules/font-awesome/fonts/fontawesome-webfont.woff2?v=4.6.3) format('woff2'), url(chrome-extension://__MSG_@@extension_id__/node_modules/font-awesome/fonts/fontawesome-webfont.woff?v=4.6.3) format('woff'), url(chrome-extension://__MSG_@@extension_id__/node_modules/font-awesome/fonts/fontawesome-webfont.ttf?v=4.6.3) format('truetype'), url(chrome-extension://__MSG_@@extension_id__/node_modules/font-awesome/fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular) format('svg'); 47 | font-weight: normal; 48 | font-style: normal; 49 | } 50 | 51 | .fa { 52 | font-family: FontAwesome; 53 | font-size: 16px; 54 | transform: translateY(2px); 55 | } 56 | --------------------------------------------------------------------------------