personal website

Commit f5105c2b

f5105c2bbc95Merged

Justin Dorfman <[email protected]> · 10 years ago · 3 files · ~3 modified

Description

Combined js

Details

Commit
f5105c2bbc95
Parent
dc9f639567d4

public/2016/assets/js/main.jsmodifiedView file

@@ -1,3 +1,404 @@
1+/*! jquery.rss
2+Copyright (c) 2011 DaWanda GmbH | MIT License | https://github.com/sdepold/jquery-rss
3+*/
4+(function(d){var e=function(a,b,c,f){this.target=a;this.url=b;this.html=[];this.effectQueue=[];this.options=d.extend({ssl:!1,host:"www.feedrapp.info",limit:null,key:null,layoutTemplate:"<ul>{entries}</ul>",entryTemplate:'<li><a href="{url}">[{author}@{date}] {title}</a><br/>{shortBodyPlain}</li>',tokens:{},outputMode:"json",dateFormat:"dddd MMM Do",dateLocale:"en",effect:"show",offsetStart:!1,offsetEnd:!1,error:function(){console.log("jQuery RSS: url doesn't link to RSS-Feed")},onData:function(){},
5+success:function(){}},c||{});this.options.ssl&&"www.feedrapp.info"===this.options.host&&(this.options.host="feedrapp.herokuapp.com");this.callback=f||this.options.success};e.htmlTags="doctype,html,head,title,base,link,meta,style,script,noscript,body,article,nav,aside,section,header,footer,h1-h6,hgroup,address,p,hr,pre,blockquote,ol,ul,li,dl,dt,dd,figure,figcaption,div,table,caption,thead,tbody,tfoot,tr,th,td,col,colgroup,form,fieldset,legend,label,input,button,select,datalist,optgroup,option,textarea,keygen,output,progress,meter,details,summary,command,menu,del,ins,img,iframe,embed,object,param,video,audio,source,canvas,track,map,area,a,em,strong,i,b,u,s,small,abbr,q,cite,dfn,sub,sup,time,code,kbd,samp,var,mark,bdi,bdo,ruby,rt,rp,span,br,wbr".split(",");
6+e.prototype.load=function(a){var b="http"+(this.options.ssl?"s":"")+"://"+this.options.host+"?callback=?&q="+encodeURIComponent(this.url);this.options.offsetStart&&this.options.offsetEnd&&(this.options.limit=this.options.offsetEnd);null!==this.options.limit&&(b+="&num="+this.options.limit);null!==this.options.key&&(b+="&key="+this.options.key);d.getJSON(b,a)};e.prototype.render=function(){var a=this;this.load(function(b){try{a.feed=b.responseData.feed,a.entries=b.responseData.feed.entries}catch(c){return a.entries=
7+[],a.feed=null,a.options.error.call(a)}b=a.generateHTMLForEntries();a.target.append(b.layout);0!==b.entries.length&&(d.isFunction(a.options.onData)&&a.options.onData.call(a),a.appendEntriesAndApplyEffects(d("entries",b.layout),b.entries));0<a.effectQueue.length?a.executeEffectQueue(a.callback):d.isFunction(a.callback)&&a.callback.call(a)})};e.prototype.appendEntriesAndApplyEffects=function(a,b){var c=this;d.each(b,function(b,e){var d=c.wrapContent(e);"show"===c.options.effect?a.before(d):(d.css({display:"none"}),
8+a.before(d),c.applyEffect(d,c.options.effect))});a.remove()};e.prototype.generateHTMLForEntries=function(){var a=this,b={entries:[],layout:null};d(this.entries).each(function(){var c=a.options.offsetStart,f=a.options.offsetEnd;c&&f?index>=c&&index<=f&&a.isRelevant(this,b.entries)&&(c=a.evaluateStringForEntry(a.options.entryTemplate,this),b.entries.push(c)):a.isRelevant(this,b.entries)&&(c=a.evaluateStringForEntry(a.options.entryTemplate,this),b.entries.push(c))});b.layout=this.options.entryTemplate?
9+this.wrapContent(this.options.layoutTemplate.replace("{entries}","<entries></entries>")):this.wrapContent("<div><entries></entries></div>");return b};e.prototype.wrapContent=function(a){return 0!==d.trim(a).indexOf("<")?d("<div>"+a+"</div>"):d(a)};e.prototype.applyEffect=function(a,b,c){switch(b){case "slide":a.slideDown("slow",c);break;case "slideFast":a.slideDown(c);break;case "slideSynced":this.effectQueue.push({element:a,effect:"slide"});break;case "slideFastSynced":this.effectQueue.push({element:a,
10+effect:"slideFast"})}};e.prototype.executeEffectQueue=function(a){var b=this;this.effectQueue.reverse();var c=function(){var f=b.effectQueue.pop();f?b.applyEffect(f.element,f.effect,c):a&&a()};c()};e.prototype.evaluateStringForEntry=function(a,b){var c=a,f=this;d(a.match(/(\{.*?\})/g)).each(function(){var a=this.toString();c=c.replace(a,f.getValueForToken(a,b))});return c};e.prototype.isRelevant=function(a,b){var c=this.getTokenMap(a);return this.options.filter?this.options.filterLimit&&this.options.filterLimit===
11+b.length?!1:this.options.filter(a,c):!0};e.prototype.getFormattedDate=function(a){if(this.options.dateFormatFunction)return this.options.dateFormatFunction(a);return"undefined"!==typeof moment?(a=moment(new Date(a)),a=a.locale?a.locale(this.options.dateLocale):a.lang(this.options.dateLocale),a.format(this.options.dateFormat)):a};e.prototype.getTokenMap=function(a){if(!this.feedTokens){var b=JSON.parse(JSON.stringify(this.feed));delete b.entries;this.feedTokens=b}return d.extend({feed:this.feedTokens,
12+url:a.link,author:a.author,date:this.getFormattedDate(a.publishedDate),title:a.title,body:a.content,shortBody:a.contentSnippet,bodyPlain:function(a){for(var a=a.content.replace(/<script[\\r\\\s\S]*<\/script>/mgi,"").replace(/<\/?[^>]+>/gi,""),b=0;b<e.htmlTags.length;b++)a=a.replace(RegExp("<"+e.htmlTags[b],"gi"),"");return a}(a),shortBodyPlain:a.contentSnippet.replace(/<\/?[^>]+>/gi,""),index:d.inArray(a,this.entries),totalEntries:this.entries.length,teaserImage:function(a){try{return a.content.match(/(<img.*?>)/gi)[0]}catch(b){return""}}(a),
13+teaserImageUrl:function(a){try{return a.content.match(/(<img.*?>)/gi)[0].match(/src="(.*?)"/)[1]}catch(b){return""}}(a)},this.options.tokens)};e.prototype.getValueForToken=function(a,b){var c=this.getTokenMap(b),d=a.replace(/[\{\}]/g,""),d=c[d];if("undefined"!==typeof d)return"function"===typeof d?d(b,c):d;throw Error("Unknown token: "+a+", url:"+this.url);};d.fn.rss=function(a,b,c){(new e(this,a,b,c)).render();return this}})(jQuery);
14+
15+/*! github-calendar
16+Copyright (c) 2016 Ionică Bizău <[email protected]> (http://ionicabizau.net)
17+*/
18+"use strict";function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.GitHubCalendar=e()}}(function(){return function e(t,n,r){function o(i,f){if(!n[i]){if(!t[i]){var d="function"==typeof require&&require;if(!f&&d)return d(i,!0);if(u)return u(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[i]={exports:{}};t[i][0].call(p.exports,function(e){var n=t[i][1][e];return o(n?n:e)},p,p.exports,e,t,n,r)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){t.exports=function(e,t,n){return"string"==typeof e&&(e=document.querySelector(e)),n=n||{},n.summary_text=n.summary_text||'Summary of pull requests, issues opened, and commits made by <a href="https://github.com/'+t+'" target="blank">@'+t+"</a>",n.proxy=n.proxy||function(e){return"https://urlreq.appspot.com/req?method=GET&url="+e},fetch(n.proxy("https://github.com/"+t)).then(function(e){return e.text()}).then(function(t){var r=document.createElement("div");r.innerHTML=t;var o=r.querySelector("#contributions-calendar");o.querySelector(".left.text-muted").innerHTML=n.summary_text,e.innerHTML=o.innerHTML})}},{}]},{},[1])(1)});
19+
20+/*!
21+ * GitHub Activity Stream - v0.1.4 - 10/7/2015
22+ * https://github.com/caseyscarborough/github-activity
23+ *
24+ * Copyright (c) 2015 Casey Scarborough
25+ * MIT License
26+ * http://opensource.org/licenses/MIT
27+ */
28+
29+var GitHubActivity = (function() {
30+ 'use strict';
31+
32+ var obj = {};
33+
34+ var methods = {
35+ renderLink: function(url, title, cssClass) {
36+ if (!title) { title = url; }
37+ if (typeof(cssClass) === 'undefined') cssClass = "";
38+ return Mustache.render('<a class="' + cssClass + '" href="{{url}}" target="_blank">{{{title}}}</a>', { url: url, title: title });
39+ },
40+ renderGitHubLink: function(url, title, cssClass) {
41+ if (!title) { title = url; }
42+ if (typeof(cssClass) === 'undefined') cssClass = "";
43+ return methods.renderLink('https://github.com/' + url, title, cssClass);
44+ },
45+ getMessageFor: function(data) {
46+ var p = data.payload;
47+ data.repoLink = methods.renderGitHubLink(data.repo.name);
48+ data.userGravatar = Mustache.render('<div class="gha-gravatar-user"><img src="{{url}}" class="gha-gravatar-small"></div>', { url: data.actor.avatar_url });
49+
50+ // Get the branch name if it exists.
51+ if (p.ref) {
52+ if (p.ref.substring(0, 11) === 'refs/heads/') {
53+ data.branch = p.ref.substring(11);
54+ } else {
55+ data.branch = p.ref;
56+ }
57+ data.branchLink = methods.renderGitHubLink(data.repo.name + '/tree/' + data.branch, data.branch) + ' at ';
58+ }
59+
60+ // Only show the first 6 characters of the SHA of each commit if given.
61+ if (p.commits) {
62+ var shaDiff = p.before + '...' + p.head;
63+ var length = p.commits.length;
64+ if (length === 2) {
65+ // If there are 2 commits, show message 'View comparison for these 2 commits >>'
66+ data.commitsMessage = Mustache.render('<a href="https://github.com/{{repo}}/compare/{{shaDiff}}">View comparison for these 2 commits &raquo;</a>', { repo: data.repo.name, shaDiff: shaDiff });
67+ } else if (length > 2) {
68+ // If there are more than two, show message '(numberOfCommits - 2) more commits >>'
69+ data.commitsMessage = Mustache.render('<a href="https://github.com/{{repo}}/compare/{{shaDiff}}">{{length}} more ' + pluralize('commit', length - 2) + ' &raquo;</a>', { repo: data.repo.name, shaDiff: shaDiff, length: p.size - 2 });
70+ }
71+
72+ p.commits.forEach(function(d, i) {
73+ if (d.message.length > 66) {
74+ d.message = d.message.substring(0, 66) + '...';
75+ }
76+ if (i < 2) {
77+ d.shaLink = methods.renderGitHubLink(data.repo.name + '/commit/' + d.sha, d.sha.substring(0, 6), 'gha-sha');
78+ d.committerGravatar = Mustache.render('<img class="gha-gravatar-commit" src="https://gravatar.com/avatar/{{hash}}?s=30&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="16" />', { hash: md5(d.author.email) });
79+ } else {
80+ // Delete the rest of the commits after the first 2, and then break out of the each loop.
81+ p.commits.splice(2, p.size);
82+ return false;
83+ }
84+ });
85+ }
86+
87+ // Get the link if this is an IssueEvent.
88+ if (p.issue) {
89+ var title = data.repo.name + "#" + p.issue.number;
90+ data.issueLink = methods.renderLink(p.issue.html_url, title);
91+ data.issueType = "issue";
92+ if (p.issue.pull_request) {
93+ data.issueType = "pull request";
94+ }
95+ }
96+
97+ // Retrieve the pull request link if this is a PullRequestEvent.
98+ if (p.pull_request) {
99+ var pr = p.pull_request;
100+ data.pullRequestLink = methods.renderLink(pr.html_url, data.repo.name + "#" + pr.number);
101+ data.mergeMessage = "";
102+
103+ // If this was a merge, set the merge message.
104+ if (p.pull_request.merged) {
105+ p.action = "merged";
106+ var message = '{{c}} ' + pluralize('commit', pr.commits) + ' with {{a}} ' + pluralize('addition', pr.additions) + ' and {{d}} ' + pluralize('deletion', pr.deletions);
107+ data.mergeMessage = Mustache.render('<br><small class="gha-message-merge">' + message + '</small>', { c: pr.commits, a: pr.additions, d: pr.deletions });
108+ }
109+ }
110+
111+ // Get the link if this is a PullRequestReviewCommentEvent
112+ if (p.comment && p.comment.pull_request_url) {
113+ var title = data.repo.name + "#" + p.comment.pull_request_url.split('/').pop();
114+ data.pullRequestLink = methods.renderGitHubLink(p.comment.pull_request_url, title);
115+ }
116+
117+ // Get the comment if one exists, and trim it to 150 characters.
118+ if (p.comment && p.comment.body) {
119+ data.comment = p.comment.body;
120+ if (data.comment.length > 150) {
121+ data.comment = data.comment.substring(0, 150) + '...';
122+ }
123+ if (p.comment.html_url && p.comment.commit_id) {
124+ var title = data.repo.name + '@' + p.comment.commit_id.substring(0, 10);
125+ data.commentLink = methods.renderLink(p.comment.html_url, title);
126+ }
127+ }
128+
129+ if (data.type === 'ReleaseEvent') {
130+ data.tagLink = methods.renderLink(p.release.html_url, p.release.tag_name);
131+ data.zipLink = methods.renderLink(p.release.zipball_url, 'Download Source Code (zip)');
132+ }
133+
134+ // Wiki event
135+ if (data.type === 'GollumEvent') {
136+ var page = p.pages[0];
137+ data.actionType = page.action;
138+ data.message = data.actionType.charAt(0).toUpperCase() + data.actionType.slice(1) + ' ';
139+ data.message += methods.renderGitHubLink(page.html_url, page.title);
140+ }
141+
142+ if (data.type === 'FollowEvent') data.targetLink = methods.renderGitHubLink(p.target.login);
143+ if (data.type === 'ForkEvent') data.forkLink = methods.renderGitHubLink(p.forkee.full_name);
144+ if (data.type === 'MemberEvent') data.memberLink = methods.renderGitHubLink(p.member.login);
145+
146+ if (p.gist) {
147+ data.actionType = p.action === 'fork' ? p.action + 'ed' : p.action + 'd';
148+ data.gistLink = methods.renderLink(p.gist.html_url, 'gist: ' + p.gist.id);
149+ }
150+
151+ var message = Mustache.render(templates[data.type], data);
152+ var timeString = millisecondsToStr(new Date() - new Date(data.created_at));
153+ var icon;
154+
155+ if (data.type == 'CreateEvent' && (['repository', 'branch', 'tag'].indexOf(p.ref_type) >= 0)) {
156+ // Display separate icons depending on type of create event.
157+ icon = icons[data.type + '_' + p.ref_type];
158+ } else {
159+ icon = icons[data.type]
160+ }
161+ var activity = { message: message, icon: icon, timeString: timeString, userLink: methods.renderGitHubLink(data.actor.login) };
162+
163+ if (singleLineActivities.indexOf(data.type) > -1) {
164+ return Mustache.render(templates.SingleLineActivity, activity);
165+ }
166+ return Mustache.render(templates.Activity, activity);
167+ },
168+ getHeaderHTML: function(data) {
169+ if (data.name) {
170+ data.userNameLink = methods.renderLink(data.html_url, data.name);
171+ } else {
172+ data.withoutName = ' without-name';
173+ }
174+ data.userLink = methods.renderLink(data.html_url, data.login);
175+ data.gravatarLink = methods.renderLink(data.html_url, '<img src="' + data.avatar_url + '">');
176+
177+ return Mustache.render(templates.UserHeader, data);
178+ },
179+ getActivityHTML: function(data, limit) {
180+ var text = '';
181+ var dataLength = data.length;
182+ if (limit && limit > dataLength) {
183+ limit = dataLength;
184+ }
185+ limit = limit ? limit : dataLength;
186+
187+ if (limit === 0) {
188+ return Mustache.render(templates.NoActivity, {});
189+ }
190+ for (var i = 0; i < limit; i++) {
191+ text += methods.getMessageFor(data[i]);
192+ }
193+
194+ return text;
195+ },
196+ getOutputFromRequest: function(url, callback) {
197+ var request = new XMLHttpRequest();
198+ request.open('GET', url);
199+ request.setRequestHeader('Accept', 'application/vnd.github.v3+json');
200+
201+ request.onreadystatechange = function() {
202+ if (request.readyState === 4) {
203+ if (request.status >= 200 && request.status < 300){
204+ var data = JSON.parse(request.responseText);
205+ callback(undefined, data);
206+ } else {
207+ callback('request for ' + url + ' yielded status ' + request.status);
208+ }
209+ }
210+ };
211+
212+ request.onerror = function() { callback('An error occurred connecting to ' + url); };
213+ request.send();
214+ },
215+ renderStream: function(output, div) {
216+ div.innerHTML = Mustache.render(templates.Stream, { text: output, footer: templates.Footer });
217+ div.style.position = 'relative';
218+ },
219+ writeOutput: function(selector, content) {
220+ var div = selector.charAt(0) === '#' ? document.getElementById(selector.substring(1)) : document.getElementsByClassName(selector.substring(1));
221+ if (div instanceof HTMLCollection) {
222+ for (var i = 0; i < div.length; i++) {
223+ methods.renderStream(content, div[i]);
224+ }
225+ } else {
226+ methods.renderStream(content, div);
227+ }
228+ },
229+ renderIfReady: function(selector, header, activity) {
230+ if (header && activity) {
231+ methods.writeOutput(selector, header + activity);
232+ }
233+ }
234+ };
235+
236+ obj.feed = function(options) {
237+ if (!options.username || !options.selector) {
238+ throw "You must specify the username and selector options for the activity stream.";
239+ return false;
240+ }
241+
242+ var selector = options.selector,
243+ userUrl = 'https://api.github.com/users/' + options.username,
244+ eventsUrl = userUrl + '/events',
245+ header,
246+ activity;
247+
248+ if (!!options.repository){
249+ eventsUrl = 'https://api.github.com/repos/' + options.username + '/' + options.repository + '/events';
250+ }
251+
252+ if (options.clientId && options.clientSecret) {
253+ var authString = '?client_id=' + options.clientId + '&client_secret=' + options.clientSecret;
254+ userUrl += authString;
255+ eventsUrl += authString;
256+ }
257+
258+ if (!!options.eventsUrl){
259+ eventsUrl = options.eventsUrl;
260+ }
261+
262+ // Allow templates override
263+ if (typeof options.templates == 'object') {
264+ for (var template in templates) {
265+ if (typeof options.templates[template] == 'string') {
266+ templates[template] = options.templates[template];
267+ }
268+ }
269+ }
270+
271+ methods.getOutputFromRequest(userUrl, function(error, output) {
272+ if (error) {
273+ header = Mustache.render(templates.UserNotFound, { username: options.username });
274+ } else {
275+ header = methods.getHeaderHTML(output)
276+ }
277+ methods.renderIfReady(selector, header, activity)
278+ });
279+
280+ methods.getOutputFromRequest(eventsUrl, function(error, output) {
281+ if (error) {
282+ activity = Mustache.render(templates.EventsNotFound, { username: options.username });
283+ } else {
284+ var limit = options.limit != 'undefined' ? parseInt(options.limit, 10) : null;
285+ activity = methods.getActivityHTML(output, limit);
286+ }
287+ methods.renderIfReady(selector, header, activity);
288+ });
289+ };
290+
291+ return obj;
292+}());
293+
294+// Takes in milliseconds and converts it to a human readable time,
295+// such as 'about 3 hours ago' or '23 days ago'
296+function millisecondsToStr(milliseconds) {
297+ 'use strict';
298+
299+ function numberEnding(number) {
300+ return (number > 1) ? 's ago' : ' ago';
301+ }
302+ var temp = Math.floor(milliseconds / 1000);
303+
304+ var years = Math.floor(temp / 31536000);
305+ if (years) return years + ' year' + numberEnding(years);
306+
307+ var months = Math.floor((temp %= 31536000) / 2592000);
308+ if (months) return months + ' month' + numberEnding(months);
309+
310+ var days = Math.floor((temp %= 2592000) / 86400);
311+ if (days) return days + ' day' + numberEnding(days);
312+
313+ var hours = Math.floor((temp %= 86400) / 3600);
314+ if (hours) return 'about ' + hours + ' hour' + numberEnding(hours);
315+
316+ var minutes = Math.floor((temp %= 3600) / 60);
317+ if (minutes) return minutes + ' minute' + numberEnding(minutes);
318+
319+ var seconds = temp % 60;
320+ if (seconds) return seconds + ' second' + numberEnding(seconds);
321+
322+ return 'just now';
323+}
324+
325+// Pluralizes a word, but only works when the word requires
326+// an 's' to be added for pluralization.
327+function pluralize(word, number) {
328+ // Yeah I know, this sucks.
329+ if (number !== 1) return word + 's';
330+ return word;
331+}
332+
333+/** MD5 methods written by Joseph Myers. http://www.myersdaily.org/joseph/javascript/md5-text.html */
334+function md5cycle(f,h){var g=f[0],e=f[1],j=f[2],i=f[3];g=ff(g,e,j,i,h[0],7,-680876936);i=ff(i,g,e,j,h[1],12,-389564586);j=ff(j,i,g,e,h[2],17,606105819);e=ff(e,j,i,g,h[3],22,-1044525330);g=ff(g,e,j,i,h[4],7,-176418897);i=ff(i,g,e,j,h[5],12,1200080426);j=ff(j,i,g,e,h[6],17,-1473231341);e=ff(e,j,i,g,h[7],22,-45705983);g=ff(g,e,j,i,h[8],7,1770035416);i=ff(i,g,e,j,h[9],12,-1958414417);j=ff(j,i,g,e,h[10],17,-42063);e=ff(e,j,i,g,h[11],22,-1990404162);g=ff(g,e,j,i,h[12],7,1804603682);i=ff(i,g,e,j,h[13],12,-40341101);j=ff(j,i,g,e,h[14],17,-1502002290);e=ff(e,j,i,g,h[15],22,1236535329);g=gg(g,e,j,i,h[1],5,-165796510);i=gg(i,g,e,j,h[6],9,-1069501632);j=gg(j,i,g,e,h[11],14,643717713);e=gg(e,j,i,g,h[0],20,-373897302);g=gg(g,e,j,i,h[5],5,-701558691);i=gg(i,g,e,j,h[10],9,38016083);j=gg(j,i,g,e,h[15],14,-660478335);e=gg(e,j,i,g,h[4],20,-405537848);g=gg(g,e,j,i,h[9],5,568446438);i=gg(i,g,e,j,h[14],9,-1019803690);j=gg(j,i,g,e,h[3],14,-187363961);e=gg(e,j,i,g,h[8],20,1163531501);g=gg(g,e,j,i,h[13],5,-1444681467);i=gg(i,g,e,j,h[2],9,-51403784);j=gg(j,i,g,e,h[7],14,1735328473);e=gg(e,j,i,g,h[12],20,-1926607734);g=hh(g,e,j,i,h[5],4,-378558);i=hh(i,g,e,j,h[8],11,-2022574463);j=hh(j,i,g,e,h[11],16,1839030562);e=hh(e,j,i,g,h[14],23,-35309556);g=hh(g,e,j,i,h[1],4,-1530992060);i=hh(i,g,e,j,h[4],11,1272893353);j=hh(j,i,g,e,h[7],16,-155497632);e=hh(e,j,i,g,h[10],23,-1094730640);g=hh(g,e,j,i,h[13],4,681279174);i=hh(i,g,e,j,h[0],11,-358537222);j=hh(j,i,g,e,h[3],16,-722521979);e=hh(e,j,i,g,h[6],23,76029189);g=hh(g,e,j,i,h[9],4,-640364487);i=hh(i,g,e,j,h[12],11,-421815835);j=hh(j,i,g,e,h[15],16,530742520);e=hh(e,j,i,g,h[2],23,-995338651);g=ii(g,e,j,i,h[0],6,-198630844);i=ii(i,g,e,j,h[7],10,1126891415);j=ii(j,i,g,e,h[14],15,-1416354905);e=ii(e,j,i,g,h[5],21,-57434055);g=ii(g,e,j,i,h[12],6,1700485571);i=ii(i,g,e,j,h[3],10,-1894986606);j=ii(j,i,g,e,h[10],15,-1051523);e=ii(e,j,i,g,h[1],21,-2054922799);g=ii(g,e,j,i,h[8],6,1873313359);i=ii(i,g,e,j,h[15],10,-30611744);j=ii(j,i,g,e,h[6],15,-1560198380);e=ii(e,j,i,g,h[13],21,1309151649);g=ii(g,e,j,i,h[4],6,-145523070);i=ii(i,g,e,j,h[11],10,-1120210379);j=ii(j,i,g,e,h[2],15,718787259);e=ii(e,j,i,g,h[9],21,-343485551);f[0]=add32(g,f[0]);f[1]=add32(e,f[1]);f[2]=add32(j,f[2]);f[3]=add32(i,f[3])}function cmn(h,e,d,c,g,f){e=add32(add32(e,h),add32(c,f));return add32((e<<g)|(e>>>(32-g)),d)}function ff(g,f,k,j,e,i,h){return cmn((f&k)|((~f)&j),g,f,e,i,h)}function gg(g,f,k,j,e,i,h){return cmn((f&j)|(k&(~j)),g,f,e,i,h)}function hh(g,f,k,j,e,i,h){return cmn(f^k^j,g,f,e,i,h)}function ii(g,f,k,j,e,i,h){return cmn(k^(f|(~j)),g,f,e,i,h)}function md51(c){txt="";var e=c.length,d=[1732584193,-271733879,-1732584194,271733878],b;for(b=64;b<=c.length;b+=64){md5cycle(d,md5blk(c.substring(b-64,b)))}c=c.substring(b-64);var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(b=0;b<c.length;b++){a[b>>2]|=c.charCodeAt(b)<<((b%4)<<3)}a[b>>2]|=128<<((b%4)<<3);if(b>55){md5cycle(d,a);for(b=0;b<16;b++){a[b]=0}}a[14]=e*8;md5cycle(d,a);return d}function md5blk(b){var c=[],a;for(a=0;a<64;a+=4){c[a>>2]=b.charCodeAt(a)+(b.charCodeAt(a+1)<<8)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+3)<<24)}return c}var hex_chr="0123456789abcdef".split("");function rhex(c){var b="",a=0;for(;a<4;a++){b+=hex_chr[(c>>(a*8+4))&15]+hex_chr[(c>>(a*8))&15]}return b}function hex(a){for(var b=0;b<a.length;b++){a[b]=rhex(a[b])}return a.join("")}function md5(a){return hex(md51(a))}function add32(d,c){return(d+c)&4294967295}if(md5("hello")!="5d41402abc4b2a76b9719d911017c592"){function add32(a,d){var c=(a&65535)+(d&65535),b=(a>>16)+(d>>16)+(c>>16);return(b<<16)|(c&65535)}};
335+
336+var templates = {
337+ Stream: '<div class="gha-feed">{{{text}}}<div class="gha-push-small"></div>{{{footer}}}</div>',
338+ Activity: '<div id="{{id}}" class="gha-activity">\
339+ <div class="gha-activity-icon"><span class="octicon octicon-{{icon}}"></span></div>\
340+ <div class="gha-message"><div class="gha-time">{{{timeString}}}</div>{{{userLink}}} {{{message}}}</div>\
341+ <div class="gha-clear"></div>\
342+ </div>',
343+ SingleLineActivity: '<div class="gha-activity gha-small">\
344+ <div class="gha-activity-icon"><span class="octicon octicon-{{icon}}"></span></div>\
345+ <div class="gha-message">{{{userLink}}} {{{message}}}</div><div class="gha-time">{{{timeString}}}</div>\
346+ <div class="gha-clear"></div>\
347+ </div>',
348+ UserHeader: '<div class="gha-header">\
349+ <div class="gha-github-icon"><span class="octicon octicon-mark-github"></span></div>\
350+ <div class="gha-user-info{{withoutName}}">{{{userNameLink}}}<p>{{{userLink}}}</p></div>\
351+ <div class="gha-gravatar">{{{gravatarLink}}}</div>\
352+ </div><div class="gha-push"></div>',
353+ Footer: '<div class="gha-footer">Public Activity <a href="https://github.com/caseyscarborough/github-activity" target="_blank">GitHub Activity Stream</a>',
354+ NoActivity: '<div class="gha-info">This user does not have any public activity yet.</div>',
355+ UserNotFound: '<div class="gha-info">User {{username}} wasn\'t found.</div>',
356+ EventsNotFound: '<div class="gha-info">Events for user {{username}} not found.</div>',
357+ CommitCommentEvent: 'commented on commit {{{commentLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
358+ CreateEvent: 'created {{payload.ref_type}} {{{branchLink}}}{{{repoLink}}}',
359+ DeleteEvent: 'deleted {{payload.ref_type}} {{payload.ref}} at {{{repoLink}}}',
360+ FollowEvent: 'started following {{{targetLink}}}',
361+ ForkEvent: 'forked {{{repoLink}}} to {{{forkLink}}}',
362+ GistEvent: '{{actionType}} {{{gistLink}}}',
363+ GollumEvent: '{{actionType}} the {{{repoLink}}} wiki<br>{{{userGravatar}}}<small>{{{message}}}</small>',
364+ IssueCommentEvent: 'commented on {{issueType}} {{{issueLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
365+ IssuesEvent: '{{payload.action}} issue {{{issueLink}}}<br>{{{userGravatar}}}<small>{{payload.issue.title}}</small>',
366+ MemberEvent: 'added {{{memberLink}}} to {{{repoLink}}}',
367+ PublicEvent: 'open sourced {{{repoLink}}}',
368+ PullRequestEvent: '{{payload.action}} pull request {{{pullRequestLink}}}<br>{{{userGravatar}}}<small>{{payload.pull_request.title}}</small>{{{mergeMessage}}}',
369+ PullRequestReviewCommentEvent: 'commented on pull request {{{pullRequestLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
370+ PushEvent: 'pushed to {{{branchLink}}}{{{repoLink}}}<br>\
371+ <ul class="gha-commits">{{#payload.commits}}<li><small>{{{committerGravatar}}} {{{shaLink}}} {{message}}</small></li>{{/payload.commits}}</ul>\
372+ <small class="gha-message-commits">{{{commitsMessage}}}</small>',
373+ ReleaseEvent: 'released {{{tagLink}}} at {{{repoLink}}}<br>{{{userGravatar}}}<small><span class="octicon octicon-cloud-download"></span> {{{zipLink}}}</small>',
374+ WatchEvent: 'starred {{{repoLink}}}'
375+},
376+
377+icons = {
378+ CommitCommentEvent: 'comment-discussion',
379+ CreateEvent_repository: 'repo-create',
380+ CreateEvent_tag: 'tag-add',
381+ CreateEvent_branch: 'git-branch-create',
382+ DeleteEvent: 'repo-delete',
383+ FollowEvent: 'person-follow',
384+ ForkEvent: 'repo-forked',
385+ GistEvent: 'gist',
386+ GollumEvent: 'repo',
387+ IssuesEvent: 'issue-opened',
388+ IssueCommentEvent: 'comment-discussion',
389+ MemberEvent: 'person',
390+ PublicEvent: 'globe',
391+ PullRequestEvent: 'git-pull-request',
392+ PullRequestReviewCommentEvent: 'comment-discussion',
393+ PushEvent: 'git-commit',
394+ ReleaseEvent: 'tag-add',
395+ WatchEvent: 'star'
396+},
397+
398+singleLineActivities = [ 'CreateEvent', 'DeleteEvent', 'FollowEvent', 'ForkEvent', 'GistEvent', 'MemberEvent', 'WatchEvent' ];
399+
400+
401+/* main.js */
1402 jQuery(document).ready(function($) {
2403
3404