├── sampleWidget.png ├── README.md ├── main.css ├── LICENSE ├── main.js ├── widget.min.js ├── widget.js └── index.html /sampleWidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ikuwow/yourcontributions/HEAD/sampleWidget.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Yourcontributions 2 | 3 | ![sampleWidget](./sampleWidget.png) 4 | 5 | GitHub contributions widget. 6 | 7 | https://ikuwow.github.io/yourcontributions/ 8 | 9 | ## Usage 10 | 11 | * Input your GitHub username 12 | * Preview 13 | * Copy & paste code 14 | 15 | ## LICENSE 16 | 17 | MIT 18 | 19 | -------------------------------------------------------------------------------- /main.css: -------------------------------------------------------------------------------- 1 | h1, h2 { 2 | margin: 30px 0; 3 | } 4 | body { 5 | text-align: center; 6 | } 7 | textarea { 8 | resize: none; 9 | } 10 | #preview-display { 11 | height: 240px; 12 | } 13 | #preview-display h3 { 14 | margin-top: 81px; 15 | margin-bottom: 81px; 16 | } 17 | .preview-toolbox .flex-table-item-primary { 18 | padding: 0 8px; 19 | } 20 | .flex-table-item span { 21 | margin-right: 8px; 22 | } 23 | .get-code { 24 | width: 100%; 25 | height: 72px; 26 | margin: 16px 0; 27 | font-family: 'Courier New', Monaco, monospace; 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 ikuwow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 'use strict'; 3 | 4 | var getcode = document.getElementsByClassName('get-code')[0]; 5 | 6 | var preview = function() { 7 | var gh_username = document.getElementsByClassName("form-gh-username")[0].value; 8 | if (gh_username === "") { 9 | return; 10 | } 11 | var preview = document.getElementById("preview-display"); 12 | 13 | var aTag = document.createElement("a"); 14 | aTag.href = "https://github.com/"+gh_username; 15 | aTag.className = "gh-contributions"; 16 | aTag.dataset.ghUsername = gh_username; 17 | aTag.target="_blank"; 18 | aTag.innerHTML = gh_username+"'s contributions"; 19 | 20 | var scriptTag = document.createElement("script"); 21 | scriptTag.src = location.href.split('?')[0]+"widget.min.js"; 22 | 23 | var child; 24 | while (child = preview.lastChild) { 25 | preview.removeChild(preview.firstChild); 26 | } 27 | preview.appendChild(aTag); 28 | preview.appendChild(scriptTag); 29 | 30 | getcode.textContent = aTag.outerHTML + scriptTag.outerHTML; 31 | }; 32 | 33 | var ptb = document.getElementsByClassName("form-preview")[0]; 34 | var inputGitHubUsername = document.getElementsByClassName("form-gh-username")[0]; 35 | ptb.onclick = preview; 36 | inputGitHubUsername.onkeypress = function() { 37 | if (window.event.keyCode === 13) { 38 | preview(); 39 | } 40 | }; 41 | 42 | // autofocus 43 | getcode.onclick = function(){ 44 | getcode.select(); 45 | }; 46 | 47 | })(); 48 | -------------------------------------------------------------------------------- /widget.min.js: -------------------------------------------------------------------------------- 1 | (function(){"use strict";var atag=document.getElementsByClassName("gh-contributions");atag[0].style.display="none";var username=atag[0].dataset.ghUsername;var iframe=document.createElement("iframe");iframe.scrolling="no";iframe.frameBorder=0;iframe.marginWidth=0;iframe.marginHeight=0;iframe.width="100%";iframe.height="180px";iframe.id="gh-contributions-widget";atag[0].parentNode.insertBefore(iframe,atag[0]);var widget='
';widget+='
';widget+=''+username+"'s Contributions";widget+="
";widget+='
';widget+=''+username+";widget+='Powered by Yourcontributions';widget+='See on GitHub';widget+="
";widget+="
"; widget += (function(){/* */}).toString().replace(/(\n)/g, '').split('/*')[1].split('*/')[0]; var doc=iframe.contentWindow.document;doc.open();doc.write(widget);doc.close();})(); 2 | -------------------------------------------------------------------------------- /widget.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 3 | 'use strict'; 4 | 5 | var atag = document.getElementsByClassName('gh-contributions'); 6 | atag[0].style.display = 'none'; 7 | 8 | var username = atag[0].dataset.ghUsername; 9 | 10 | var iframe = document.createElement('iframe'); 11 | iframe.scrolling = 'no'; 12 | iframe.frameBorder = 0; 13 | iframe.marginWidth = 0; 14 | iframe.marginHeight = 0; 15 | iframe.width = '100%'; 16 | iframe.height = '180px'; 17 | iframe.id = 'gh-contributions-widget'; 18 | 19 | atag[0].parentNode.insertBefore(iframe,atag[0]); 20 | 21 | var widget = '
'; 22 | widget += '
'; 23 | widget += ''+username+'\'s Contributions'; 24 | widget += '
'; 25 | widget += '
'; 26 | widget += ''+username+'\'s Github chart'; 27 | widget += 'Powered by Yourcontributions'; 28 | widget += 'See on GitHub'; 29 | widget += '
'; 30 | 31 | widget += '
'; 32 | 33 | widget += (function(){/* 34 | 86 | */}).toString().replace(/(\n)/g, '').split('/*')[1].split('*/')[0]; 87 | 88 | var doc = iframe.contentWindow.document; 89 | doc.open(); 90 | doc.write(widget); 91 | doc.close(); 92 | 93 | })(); 94 | 95 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Yourcontributions: GitHub Contribution widget 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 | 43 |
44 |
45 |
46 |

Yourcontributions

47 |

GitHub contribution chart widget

48 |
49 |
50 | 51 |
52 |
53 | 54 | 55 |
56 |
57 | 58 |
59 |
60 | 61 |
62 |

Preview Area

63 |
64 | 65 | 67 | 68 | 73 | 74 |
75 |
76 | 82 |
83 | 84 | 85 |
86 | 93 | 94 | 95 | 96 | --------------------------------------------------------------------------------