Permalink
Browse files

Merge

  • Loading branch information...
2 parents 559d034 + 2b2338f commit 04347e7ce94378a3b568ee45ef75c5f98514daae @medikoo committed Jul 26, 2012
Showing with 56 additions and 2 deletions.
  1. +3 −0 lib/client/public/main.js
  2. +47 −0 lib/client/shim/bind.js
  3. +6 −2 lib/server/data.js
View
3 lib/client/public/main.js
@@ -1,5 +1,8 @@
'use strict';
+// Shim missing API's and methods
+require('../shim/bind');
+
require('../view');
require('../server');
View
47 lib/client/shim/bind.js
@@ -0,0 +1,47 @@
+// Function.prototype.bind for imperfect
+
+'use strict';
+
+var slice = Array.prototype.slice
+
+ , cache, getBody, body;
+
+if (!Function.prototype.bind) {
+ cache = [];
+
+ body = function (target, that, args, slice, bound) {
+ if (this instanceof bound) {
+ var F = function () {}, self, result;
+ F.prototype = target.prototype;
+ self = new F();
+ result = target.apply(self, args.concat(slice.call(arguments)));
+ if (result && (typeof result === 'object')) {
+ return result;
+ }
+ return self;
+ } else {
+ return target.apply(that, args.concat(slice.call(arguments)));
+ }
+ }.toString();
+
+ getBody = (function (genArgs, body) {
+ return function (length) {
+ return cache[length] || (cache[length] = new Function('target', 'that',
+ 'args', 'slice', 'return function bound (' + genArgs(length) + ') {' +
+ body + '};'));
+ };
+ }(function (length) {
+ var args = [];
+ while (length--) {
+ args.push('a' + length.toString(32));
+ }
+ return args.join(', ');
+ }, body.slice(body.indexOf('{') + 1, -1)));
+
+ Function.prototype.bind = function bind(that) {
+ if (typeof this !== "function") {
+ return new TypeError();
+ }
+ return getBody(this.length)(this, that, slice.call(arguments, 1), slice);
+ };
+}
View
8 lib/server/data.js
@@ -153,7 +153,8 @@ handleOpenIssue = function (article, match) {
repo: data[1],
number: match[2]
}, bodyFromAPI(article));
- } else if (contains.call(article.title, 'closed issue')) {
+ } else if (contains.call(article.title, 'closed issue') ||
+ contains.call(article.title, 'closed pull request')) {
article.description = article.description
.replace(/<blockquote>([\0-\uffff]+)<\/blockquote>/, '')
.replace(' class="details">',
@@ -162,6 +163,9 @@ handleOpenIssue = function (article, match) {
};
process = {
+ commitcommentevent: partial.call(parse,
+ /^https:\/\/github.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)\/commit\/([a-z0-9.\-]+)#([\0-\uffff]+)$/,
+ ['Repo', 1, 'Commits'], fixLinks),
createevent: partial.call(parseUser, 'Created', fixLinks),
deleteevent: partial.call(parseUser, 'Deleted', fixLinks),
followevent: partial.call(parseUser, 'Followed', fixLinks),
@@ -203,7 +207,7 @@ process = {
/^https:\/\/github.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)\/pull\/(\d+)$/,
['Repo', 1, 'Issues & Pull Requests', 2], handleOpenIssue),
pullrequestreviewcommentevent: partial.call(parse,
- /^https:\/\/github.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)\/pull\/(\d+)#r(\d+)$/,
+ /^https:\/\/github.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)\/pull\/(\d+)#(?:discussion_)?r(\d+)$/,
['Repo', 1, 'Issues & Pull Requests', 2], function (article, orgmatch) {
var match, data;
fixLinks(article);

0 comments on commit 04347e7

Please sign in to comment.