├── .jshintrc ├── README.md ├── assets ├── css │ ├── dashPix.css │ └── options.css ├── img │ ├── icon.png │ ├── icon128.png │ ├── icon16.png │ ├── icon24.png │ ├── icon256.png │ ├── icon32.png │ ├── icon48.png │ └── icon_orig.png ├── js │ ├── addPicture.js │ ├── background.js │ └── options.js └── options.html └── manifest.json /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "esversion": 6 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | GitHub has improved it's news feed to also include pictures 3 | 4 | # GitHub News Pics 5 | Google Chrome extension that shows author's pictures for all entries in the news feed on GitHub's dashboard 6 | 7 | ### [Install It From Here](https://chrome.google.com/webstore/detail/github-news-pics/fkdieaaoplknkhnhbfmbacphglmenppg) 8 | 9 | ![](https://cloud.githubusercontent.com/assets/11520795/22998679/79690376-f3e0-11e6-8623-d96e565e1878.jpg) 10 | -------------------------------------------------------------------------------- /assets/css/dashPix.css: -------------------------------------------------------------------------------- 1 | .news .alert .title .userPicture 2 | { 3 | border-radius: 3px; 4 | vertical-align: middle; 5 | margin-right: 5px; 6 | } 7 | -------------------------------------------------------------------------------- /assets/css/options.css: -------------------------------------------------------------------------------- 1 | #btnBar { 2 | margin-top: 10px; 3 | } 4 | -------------------------------------------------------------------------------- /assets/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon.png -------------------------------------------------------------------------------- /assets/img/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon128.png -------------------------------------------------------------------------------- /assets/img/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon16.png -------------------------------------------------------------------------------- /assets/img/icon24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon24.png -------------------------------------------------------------------------------- /assets/img/icon256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon256.png -------------------------------------------------------------------------------- /assets/img/icon32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon32.png -------------------------------------------------------------------------------- /assets/img/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon48.png -------------------------------------------------------------------------------- /assets/img/icon_orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surdu/github-news-pics/9804bfa3620b758403e003092388717bb29e90cd/assets/img/icon_orig.png -------------------------------------------------------------------------------- /assets/js/addPicture.js: -------------------------------------------------------------------------------- 1 | chrome.storage.sync.get({iconSize: 30}, function(options) { 2 | 3 | var newsNode = document.querySelector(".news"); 4 | 5 | if (newsNode) { 6 | var firstEntries = document.querySelectorAll(".news .alert.simple"); 7 | addPictureToNodes(firstEntries); 8 | 9 | var observer = new MutationObserver(function(mutations) { 10 | for (var f = 0; f < mutations.length; f++) { 11 | addPictureToNodes(mutations[f].addedNodes); 12 | } 13 | }); 14 | observer.observe(newsNode, {childList: true}); 15 | } 16 | 17 | function hasClass(node, className) { 18 | return node.className.indexOf(className) !== -1; 19 | } 20 | 21 | function addPictureToNodes(nodes) { 22 | for (var f = 0; f < nodes.length; f++) { 23 | 24 | var node = nodes[f]; 25 | 26 | if (node.className && hasClass(node, "simple")) { 27 | var links = node.querySelectorAll("a"); 28 | var userLink = links[0]; 29 | var isAddEntry = hasClass(node, "member_add"); 30 | if (isAddEntry) { 31 | userLink = links[1]; 32 | } 33 | var username = userLink.innerHTML; 34 | 35 | var avatarImg = document.createElement("img"); 36 | avatarImg.setAttribute("src", `//github.com/${username}.png?size=${options.iconSize * 2}`); 37 | avatarImg.setAttribute("width", options.iconSize); 38 | avatarImg.setAttribute("height", options.iconSize); 39 | avatarImg.className = "userPicture"; 40 | 41 | var avatarLink = document.createElement("a"); 42 | avatarLink.setAttribute("href", userLink.getAttribute("href")); 43 | avatarLink.appendChild(avatarImg); 44 | 45 | var title = node.querySelector(".title"); 46 | if (isAddEntry) { 47 | // for better readability, we'll rephrase the entry 48 | // from 'X added Y to REPO' into 'Y was added by X to REPO' 49 | title.innerHTML = ""; 50 | title.appendChild(avatarLink); 51 | title.appendChild(links[1]); 52 | title.appendChild(document.createTextNode(" was added by ")); 53 | title.appendChild(links[0]); 54 | title.appendChild(document.createTextNode(" to ")); 55 | title.appendChild(links[2]); 56 | } 57 | else { 58 | title.prepend(avatarLink); 59 | } 60 | } 61 | } 62 | } 63 | 64 | }); 65 | -------------------------------------------------------------------------------- /assets/js/background.js: -------------------------------------------------------------------------------- 1 | chrome.browserAction.onClicked.addListener(function(activeTab) 2 | { 3 | chrome.tabs.create({ url: "https://github.com" }); 4 | }); 5 | -------------------------------------------------------------------------------- /assets/js/options.js: -------------------------------------------------------------------------------- 1 | var iconSizeSelector = document.getElementById("iconSize"); 2 | 3 | (function init() { 4 | chrome.storage.sync.get({ 5 | iconSize: 30 6 | }, function(options) { 7 | iconSizeSelector.value = options.iconSize; 8 | }); 9 | })(); 10 | 11 | iconSizeSelector.addEventListener("change", function() { 12 | chrome.storage.sync.set({ 13 | iconSize: this.value 14 | }); 15 | }); 16 | 17 | document.getElementById("closeBtn").addEventListener("click", function() { 18 | window.close(); 19 | }); 20 | -------------------------------------------------------------------------------- /assets/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GitHub news pix 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 |
16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "GitHub News Pics", 5 | "description": "Show pictures for all entries in the news feed on GitHub's dashboard", 6 | "version": "1.2", 7 | "author": "Surdu Nicolae", 8 | 9 | "icons": { 10 | "16": "assets/img/icon16.png", 11 | "48": "assets/img/icon48.png", 12 | "128": "assets/img/icon128.png", 13 | "256": "assets/img/icon256.png" 14 | }, 15 | 16 | "browser_action": { 17 | "default_icon": { 18 | "16": "assets/img/icon16.png", 19 | "24": "assets/img/icon24.png", 20 | "32": "assets/img/icon32.png" 21 | }, 22 | 23 | "default_title": "GitHub News Pics" 24 | }, 25 | 26 | "options_ui": { 27 | "page": "assets/options.html", 28 | "chrome_style": true 29 | }, 30 | 31 | "content_scripts": [ 32 | { 33 | "matches": [ 34 | "*://github.com/", 35 | "*://github.com/dashboard" 36 | ], 37 | "js": ["assets/js/addPicture.js"], 38 | "css": ["assets/css/dashPix.css"] 39 | } 40 | ], 41 | 42 | "background": { 43 | "scripts": ["assets/js/background.js"], 44 | "persistent": false 45 | }, 46 | 47 | "permissions": [ 48 | "storage" 49 | ] 50 | } 51 | --------------------------------------------------------------------------------