├── plusone.png ├── README.md ├── manifest.json └── content_script.js /plusone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eligolding/github-plusone-extension/master/plusone.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub +1 Chrome Extension 2 | 3 | [](https://chrome.google.com/webstore/detail/github-%201s/lddfkkebajnpiicnpfamebilmhamkeme) 4 | 5 | More information and installation instructions can be found [here](https://chrome.google.com/webstore/detail/github-%201s/lddfkkebajnpiicnpfamebilmhamkeme) on the Chrome Web Store. 6 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Github +1s", 3 | "description": "Shows you the counts and avatars of those noisy '+1' comments and hides the original comments.", 4 | "version": "1.4.0", 5 | "permissions": [ 6 | "activeTab" 7 | ], 8 | "icons": { 9 | "128": "plusone.png" 10 | }, 11 | "manifest_version": 2, 12 | "content_scripts": [ 13 | { 14 | "matches": ["https://github.com/*"], 15 | "js": ["content_script.js"] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /content_script.js: -------------------------------------------------------------------------------- 1 | function removePlusOnes() { 2 | var comments = [].slice.call(document.querySelectorAll('.timeline-comment-wrapper'), 0); 3 | var avatars = []; 4 | var alreadySeen = []; 5 | comments.forEach(function (comment) { 6 | var text = comment.querySelector('.comment-body').textContent.trim(); 7 | if ( 8 | text.match(/^(\+1|👍)/) || 9 | comment.querySelector('img[title=":+1:"]') || 10 | comment.querySelector('img[title=":thumbsup:"]') 11 | ) { 12 | var avatar = comment.querySelector('a').cloneNode(true); 13 | var user = avatar.href; 14 | if(alreadySeen.indexOf(user) < 0) { 15 | avatars.push(avatar); 16 | alreadySeen.push(user); 17 | } 18 | if(text.match(/^(\+1|👍)$/) || !text) { // there wont be text if the comment is just a 👍 19 | comment.style.display = 'none'; 20 | } 21 | } 22 | }); 23 | 24 | if(avatars.length > 0) { 25 | var div = document.createElement('div'); 26 | div.className = 'js-plus-one-count flex-table gh-header-meta'; 27 | div.innerHTML = '' + 28 | '