// ==UserScript== // @name GitHub images as icons // @description Displays small images in place of file-type icons in a repository source tree // @namespace wOxxOm.scripts // @include https://github.com/* // @match https://github.com/* // @version 1.01 // @grant GM_addStyle // @run-at document-start // @downloadURL none // ==/UserScript== iconSize = 24; function addStyle(e) { GM_addStyle('.wOxxOm-image-icon { max-width:'+iconSize+'px; max-height:'+iconSize+ 'px; width:auto; height:auto; margin:-4px 0 -7px -6px }'); window.removeEventListener('DOMContentLoaded', addStyle); iconify(document.body); } window.addEventListener('DOMContentLoaded', addStyle); function iconify(n) { var aa = (n.className == 'js-directory-link') ? [n] : n.getElementsByClassName('js-directory-link'); for (var a, i=0; i