-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgithub-widget.min.js
More file actions
executable file
·11 lines (11 loc) · 2.68 KB
/
github-widget.min.js
File metadata and controls
executable file
·11 lines (11 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
/*
https://github.com/jawj/github-widget
Copyright (c) 2011 - 2012 George MacKerron
Released under the MIT licence: http://opensource.org/licenses/mit-license
*/
(function(){var j,k,i,f,p,q,u=[].indexOf||function(c){for(var b=0,a=this.length;b<a;b++)if(b in this&&this[b]===c)return b;return-1},v={}.hasOwnProperty;p=function(c,b){var a,e,d,h,g,m;f({cls:"gw-clearer",prevSib:b});e=""+b.getAttribute("data-user")+".github.com";g=c.data.sort(function(a,b){return b.watchers-a.watchers});m=[];d=0;for(h=g.length;d<h;d++)a=g[d],!a.fork&&(a.name!==e&&a.description)&&m.push(f({parent:b,cls:"gw-repo-outer",kids:[f({cls:"gw-repo",kids:[f({cls:"gw-title",kids:[f({tag:"ul",
cls:"gw-stats",kids:[f({tag:"li",text:a.watchers,cls:"gw-watchers"}),f({tag:"li",text:a.forks,cls:"gw-forks"})]}),f({tag:"a",href:a.html_url,text:a.name,cls:"gw-name"})]}),null!=a.language?f({cls:"gw-lang",text:a.language}):void 0,f({cls:"gw-repo-desc",text:a.description})]})]}));return m};j=function(c,b){var a,e,d,h,g,f;null==b&&(b={});e={};d=c.className.match(j.re);if(null!=d){h=0;for(f=d.length;h<f;h++)a=d[h],e[a]=!0}d=null!=(g=b.has)?g.match(j.re):void 0;if(null!=d){g=0;for(h=d.length;g<h;g++)if(a=
d[g],!e[a])return!1;return!0}return null};j.re=/\S+/g;k=function(c){var b,a,e,d,h;null==c&&(c={});a=null!=(e=c.inside)?e:document;e=null!=(b=c.tag)?b:"*";if(null!=c.id)return a.getElementById(c.id);if((b=null!=c.cls)&&"*"===e&&null!=a.getElementsByClassName)return a.getElementsByClassName(c.cls);a=a.getElementsByTagName(e);if(b){var g,f,i;i=[];g=0;for(f=a.length;g<f;g++)b=a[g],j(b,{has:c.cls})&&i.push(b);a=i}return null==c.multi&&(d=e.toLowerCase(),0<=u.call(k.uniqueTags,d))?null!=(h=a[0])?h:null:
a};k.uniqueTags="html body frameset head title base".split(" ");q=function(c){return document.createTextNode(""+c)};f=function(c){var b,a,e,d,f,g;null==c&&(c={});e=document.createElement(null!=(b=c.tag)?b:"div");for(a in c)if(v.call(c,a))switch(d=c[a],a){case "tag":continue;case "parent":d.appendChild(e);break;case "kids":f=0;for(g=d.length;f<g;f++)b=d[f],null!=b&&e.appendChild(b);break;case "prevSib":d.parentNode.insertBefore(e,d.nextSibling);break;case "text":e.appendChild(q(d));break;case "cls":e.className=
d;break;default:e[a]=d}return e};i=function(c){var b,a,e;b=null!=(a=c.callback)?a:"_JSONPCallback_"+i.callbackNum++;a=c.url.replace("<cb>",b);window[b]=null!=(e=c.success)?e:i.noop;return f({tag:"script",src:a,parent:k({tag:"head"})})};i.callbackNum=0;i.noop=function(){};var r,l,s,n,t;n=k({tag:"div",cls:"github-widget"});t=[];l=0;for(s=n.length;l<s;l++)r=n[l],t.push(function(c){var b;b="https://api.github.com/users/"+c.getAttribute("data-user")+"/repos?callback=<cb>";return i({url:b,success:function(a){return p(a,
c)}})}(r))}).call(this);