Skip to content

Commit d117b16

Browse files
author
tim
committed
production build for branch
1 parent 96e6d18 commit d117b16

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

dist/jquery.github.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
var pluginName = "github",
1212
document = window.document,
1313
defaults = {
14-
propertyName: "value"
14+
propertyName: "value",
15+
username: null,
16+
elClass: "github-box-wrap"
1517
};
1618

1719
function Plugin( element, options ) {
@@ -45,9 +47,19 @@
4547
// Apply results to HTML template
4648
Plugin.prototype.applyTemplate = function ( repo ) {
4749
var self = this,
48-
$widget = self.parseTemplate( repo );
49-
50-
$widget.appendTo( self.$container );
50+
$widget;
51+
52+
if ( Array.isArray( repo ) === true ) {
53+
repo.forEach( function(r) {
54+
var $repo = $( $.parseHTML( "<div data-repo='" + self.options.username + "/" + r.name + "' class='" + self.options.elClass + "'></div>" ) );
55+
$repo.appendTo( self.$container );
56+
$widget = self.parseTemplate( r );
57+
$widget.appendTo( $repo );
58+
});
59+
} else {
60+
$widget = self.parseTemplate( repo );
61+
$widget.appendTo( self.$container );
62+
}
5163
};
5264

5365
// Stores repostories in sessionStorage if available
@@ -133,10 +145,15 @@
133145

134146
// Request repositories from Github
135147
Plugin.prototype.requestData = function ( repo ) {
136-
var self = this;
148+
var self = this,
149+
url = "https://api.github.com/repos/" + repo;
150+
151+
if ( self.options.username !== null ) {
152+
url = "https://api.github.com/users/" + self.options.username + "/repos";
153+
}
137154

138155
$.ajax({
139-
url: "https://api.github.com/repos/" + repo,
156+
url: url,
140157
dataType: "jsonp",
141158
success: function( results ) {
142159
var result_data = results.data;

dist/jquery.github.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)