Created
June 13, 2012 17:39
-
-
Save ctdk/2925425 to your computer and use it in GitHub Desktop.
Diff to fix Octopress' github.js to make it not use the deactivated Github v2 API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/source/javascripts/github.js b/source/javascripts/github.js | |
index 678775a..bc4c9bd 100644 | |
--- a/source/javascripts/github.js | |
+++ b/source/javascripts/github.js | |
@@ -3,22 +3,22 @@ var github = (function(){ | |
var i = 0, fragment = '', t = $(target)[0]; | |
for(i = 0; i < repos.length; i++) { | |
- fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>'; | |
+ fragment += '<li><a href="'+repos[i].html_url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>'; | |
} | |
t.innerHTML = fragment; | |
} | |
return { | |
showRepos: function(options){ | |
$.ajax({ | |
- url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?" | |
+ url: "https://api.github.com/users/"+options.user+"/repos?callback=?" | |
, type: 'jsonp' | |
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); } | |
, success: function(data) { | |
var repos = []; | |
- if (!data || !data.repositories) { return; } | |
- for (var i = 0; i < data.repositories.length; i++) { | |
- if (options.skip_forks && data.repositories[i].fork) { continue; } | |
- repos.push(data.repositories[i]); | |
+ if (!data || !data.data) { return; } | |
+ for (var i = 0; i < data.data.length; i++) { | |
+ if (options.skip_forks && data.data[i].fork) { continue; } | |
+ repos.push(data.data[i]); | |
} | |
repos.sort(function(a, b) { | |
var aDate = new Date(a.pushed_at).valueOf(), |
Huh, weird. I swear it worked before, but maybe I dreamed it up. Anyway, I'll update this shortly.
And, updated. Thanks for the heads up.
Works great, thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's another little bit that needs to change above this patch. Line 6:
Old version:
New Version
The URL is now html_url