Skip to content

Commit 711c998

Browse files
Igor Limazenorocha
Igor Lima
authored andcommitted
Refactor to be possible compatibilty with Zepto
1 parent 9c848a5 commit 711c998

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

src/jquery.github.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -129,27 +129,26 @@
129129
pushed_at = self.parsePushedDate( repo.pushed_at ),
130130
repo_url = self.parseRepositoryURL( repo.url );
131131

132-
return $( $.parseHTML(" \
133-
<div class='github-box'> \
134-
<div class='github-box-header'> \
135-
<h3> \
136-
<a href='" + repo_url + "'>" + repo.name + "</a> \
137-
</h3> \
138-
<div class='github-stats'> \
139-
<a class='repo-stars' title='Stars' data-icon='7' href='" + repo_url + "/watchers'>" + repo.watchers + "</a> \
140-
<a class='repo-forks' title='Forks' data-icon='f' href='" + repo_url + "/network'>" + repo.forks + "</a> \
141-
<a class='repo-issues' title='Issues' data-icon='i' href='" + repo_url + "/issues'>" + repo.open_issues + "</a> \
142-
</div> \
143-
</div> \
144-
<div class='github-box-content'> \
145-
<p>" + repo.description + " &mdash; <a href='" + repo_url + "#readme'>Read More</a></p> \
146-
</div> \
147-
<div class='github-box-download'> \
148-
<p class='repo-update'>Latest commit to <strong>master</strong> on " + pushed_at + "</p> \
149-
<a class='repo-download' title='Download as zip' data-icon='w' href='" + repo_url + "/zipball/master'></a> \
150-
</div> \
151-
</div> \
152-
") );
132+
return $(
133+
"<div class='github-box'>" +
134+
"<div class='github-box-header'>" +
135+
"<h3>" +
136+
"<a href='" + repo_url + "'>" + repo.name + "</a>" +
137+
"</h3>" +
138+
"<div class='github-stats'>" +
139+
"<a class='repo-stars' title='Stars' data-icon='7' href='" + repo_url + "/watchers'>" + repo.watchers + "</a>" +
140+
"<a class='repo-forks' title='Forks' data-icon='f' href='" + repo_url + "/network'>" + repo.forks + "</a>" +
141+
"<a class='repo-issues' title='Issues' data-icon='i' href='" + repo_url + "/issues'>" + repo.open_issues + "</a>" +
142+
"</div>" +
143+
"</div>" +
144+
"<div class='github-box-content'>" +
145+
"<p>" + repo.description + " &mdash; <a href='" + repo_url + "#readme'>Read More</a></p>" +
146+
"</div>" +
147+
"<div class='github-box-download'>" +
148+
"<p class='repo-update'>Latest commit to <strong>master</strong> on " + pushed_at + "</p>" +
149+
"<a class='repo-download' title='Download as zip' data-icon='w' href='" + repo_url + "/zipball/master'></a>" +
150+
"</div>" +
151+
"</div>");
153152
};
154153

155154
// Request repositories from Github
@@ -173,12 +172,12 @@
173172
});
174173
};
175174

176-
$.fn[ pluginName ] = function ( options ) {
175+
$.fn[pluginName] = function ( options ) {
177176
return this.each(function () {
178-
if ( !$.data( this, "plugin_" + pluginName ) ) {
179-
$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
177+
if ( !$( this ).data( "plugin_" + pluginName ) ) {
178+
$( this ).data( "plugin_" + pluginName, new Plugin( this, options ) );
180179
}
181180
});
182181
};
183182

184-
}( jQuery, window ) );
183+
}( window.jQuery || window.Zepto, window ));

0 commit comments

Comments
 (0)