| ... | ... |
@@ -9,12 +9,11 @@ var github = (function(){
|
| 9 | 9 |
} |
| 10 | 10 |
return {
|
| 11 | 11 |
showRepos: function(options){
|
| 12 |
- var feed = new jXHR(); |
|
| 13 |
- feed.onerror = function (msg,url) {
|
|
| 14 |
- $(options.target + ' li.loading').addClass('error').text("Error loading feed");
|
|
| 15 |
- }; |
|
| 16 |
- feed.onreadystatechange = function(data) {
|
|
| 17 |
- if (feed.readyState === 4) {
|
|
| 12 |
+ $.ajax({
|
|
| 13 |
+ url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?" |
|
| 14 |
+ , type: 'jsonp' |
|
| 15 |
+ , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
|
|
| 16 |
+ , success: function(data) {
|
|
| 18 | 17 |
var repos = []; |
| 19 | 18 |
for (var i = 0; i < data.repositories.length; i++){
|
| 20 | 19 |
if (options.skip_forks && data.repositories[i].fork) { continue; }
|
| ... | ... |
@@ -31,9 +30,7 @@ var github = (function(){
|
| 31 | 31 |
if (options.count) { repos.splice(options.count); }
|
| 32 | 32 |
render(options.target, repos); |
| 33 | 33 |
} |
| 34 |
- }; |
|
| 35 |
- feed.open("GET","http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?");
|
|
| 36 |
- feed.send(); |
|
| 34 |
+ }) |
|
| 37 | 35 |
} |
| 38 | 36 |
}; |
| 39 |
-})(); |
|
| 40 | 37 |
\ No newline at end of file |
| 38 |
+})(); |