personal website

Commit e0fb0cd7

e0fb0cd79ef1Merged

Justin Dorfman <[email protected]> · 10 years ago · 6 files · +1 added · ~5 modified

Description

Uglify and JS optimization

Details

Commit
e0fb0cd79ef1
Parent
f5105c2bbc95

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

@@ -18,12 +18,8 @@
1818 "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)});
1919
2020 /*!
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
21+ * GitHub Activity Stream | v0.1.4 | 10/7/2015
22+ * Copyright (c) 2015 Casey Scarborough | MIT License | https://github.com/caseyscarborough/github-activity
2723 */
2824
2925 var GitHubActivity = (function() {
@@ -47,7 +43,6 @@
4743 data.repoLink = methods.renderGitHubLink(data.repo.name);
4844 data.userGravatar = Mustache.render('<div class="gha-gravatar-user"><img src="{{url}}" class="gha-gravatar-small"></div>', { url: data.actor.avatar_url });
4945
50- // Get the branch name if it exists.
5146 if (p.ref) {
5247 if (p.ref.substring(0, 11) === 'refs/heads/') {
5348 data.branch = p.ref.substring(11);
@@ -57,15 +52,14 @@
5752 data.branchLink = methods.renderGitHubLink(data.repo.name + '/tree/' + data.branch, data.branch) + ' at ';
5853 }
5954
60- // Only show the first 6 characters of the SHA of each commit if given.
6155 if (p.commits) {
6256 var shaDiff = p.before + '...' + p.head;
6357 var length = p.commits.length;
6458 if (length === 2) {
65- // If there are 2 commits, show message 'View comparison for these 2 commits >>'
59+
6660 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 });
6761 } else if (length > 2) {
68- // If there are more than two, show message '(numberOfCommits - 2) more commits >>'
62+
6963 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 });
7064 }
7165
@@ -77,14 +71,13 @@
7771 d.shaLink = methods.renderGitHubLink(data.repo.name + '/commit/' + d.sha, d.sha.substring(0, 6), 'gha-sha');
7872 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) });
7973 } else {
80- // Delete the rest of the commits after the first 2, and then break out of the each loop.
74+
8175 p.commits.splice(2, p.size);
8276 return false;
8377 }
8478 });
8579 }
8680
87- // Get the link if this is an IssueEvent.
8881 if (p.issue) {
8982 var title = data.repo.name + "#" + p.issue.number;
9083 data.issueLink = methods.renderLink(p.issue.html_url, title);
@@ -94,13 +87,12 @@
9487 }
9588 }
9689
97- // Retrieve the pull request link if this is a PullRequestEvent.
9890 if (p.pull_request) {
9991 var pr = p.pull_request;
10092 data.pullRequestLink = methods.renderLink(pr.html_url, data.repo.name + "#" + pr.number);
10193 data.mergeMessage = "";
10294
103- // If this was a merge, set the merge message.
95+
10496 if (p.pull_request.merged) {
10597 p.action = "merged";
10698 var message = '{{c}} ' + pluralize('commit', pr.commits) + ' with {{a}} ' + pluralize('addition', pr.additions) + ' and {{d}} ' + pluralize('deletion', pr.deletions);
@@ -108,13 +100,13 @@
108100 }
109101 }
110102
111- // Get the link if this is a PullRequestReviewCommentEvent
103+
112104 if (p.comment && p.comment.pull_request_url) {
113105 var title = data.repo.name + "#" + p.comment.pull_request_url.split('/').pop();
114106 data.pullRequestLink = methods.renderGitHubLink(p.comment.pull_request_url, title);
115107 }
116108
117- // Get the comment if one exists, and trim it to 150 characters.
109+
118110 if (p.comment && p.comment.body) {
119111 data.comment = p.comment.body;
120112 if (data.comment.length > 150) {
@@ -131,7 +123,7 @@
131123 data.zipLink = methods.renderLink(p.release.zipball_url, 'Download Source Code (zip)');
132124 }
133125
134- // Wiki event
126+
135127 if (data.type === 'GollumEvent') {
136128 var page = p.pages[0];
137129 data.actionType = page.action;
@@ -153,7 +145,7 @@
153145 var icon;
154146
155147 if (data.type == 'CreateEvent' && (['repository', 'branch', 'tag'].indexOf(p.ref_type) >= 0)) {
156- // Display separate icons depending on type of create event.
148+
157149 icon = icons[data.type + '_' + p.ref_type];
158150 } else {
159151 icon = icons[data.type]
@@ -259,7 +251,6 @@
259251 eventsUrl = options.eventsUrl;
260252 }
261253
262- // Allow templates override
263254 if (typeof options.templates == 'object') {
264255 for (var template in templates) {
265256 if (typeof options.templates[template] == 'string') {
@@ -291,8 +282,6 @@
291282 return obj;
292283 }());
293284
294-// Takes in milliseconds and converts it to a human readable time,
295-// such as 'about 3 hours ago' or '23 days ago'
296285 function millisecondsToStr(milliseconds) {
297286 'use strict';
298287
@@ -322,15 +311,13 @@
322311 return 'just now';
323312 }
324313
325-// Pluralizes a word, but only works when the word requires
326-// an 's' to be added for pluralization.
327314 function pluralize(word, number) {
328- // Yeah I know, this sucks.
315+
329316 if (number !== 1) return word + 's';
330317 return word;
331318 }
332319
333-/** MD5 methods written by Joseph Myers. http://www.myersdaily.org/joseph/javascript/md5-text.html */
320+/**! MD5 methods written by Joseph Myers. http://www.myersdaily.org/joseph/javascript/md5-text.html */
334321 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)}};
335322
336323 var templates = {
@@ -397,7 +384,6 @@
397384
398385 singleLineActivities = [ 'CreateEvent', 'DeleteEvent', 'FollowEvent', 'ForkEvent', 'GistEvent', 'MemberEvent', 'WatchEvent' ];
399386
400-
401387 /* main.js */
402388 jQuery(document).ready(function($) {
403389
@@ -428,28 +414,15 @@
428414
429415 $("#rss-feeds").rss(
430416
431- //Change this to your own rss feeds
417+
432418 "http://feeds.feedburner.com/TechCrunch/startups",
433419
434420 {
435- // how many entries do you want?
436- // default: 4
437- // valid values: any integer
438421 limit: 3,
439422
440- // the effect, which is used to let the entries appear
441- // default: 'show'
442- // valid values: 'show', 'slide', 'slideFast', 'slideSynced', 'slideFastSynced'
443423 effect: 'slideFastSynced',
444424
445- // outer template for the html transformation
446- // default: "<ul>{entries}</ul>"
447- // valid values: any string
448425 layoutTemplate: "<div class='item'>{entries}</div>",
449-
450- // inner template for each entry
451- // default: '<li><a href="{url}">[{author}@{date}] {title}</a><br/>{shortBodyPlain}</li>'
452- // valid values: any string
453426 entryTemplate: '<h3 class="title"><a href="{url}" target="_blank">{title}</a></h3><div><p>{shortBodyPlain}</p><a class="more-link" href="{url}" target="_blank"><i class="fa fa-external-link"></i>Read more</a></div>'
454427
455428 }