diff --git a/HISTORY.md b/HISTORY.md index caa97d9..eef4c0e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,7 @@ # History +* v0.3.1 May 11, 2013 + * Added compatibility with Zepto * v0.3.0 May 11, 2013 * Added options to display or hide icons * Displayed the number of issues diff --git a/dist/jquery.github.js b/dist/jquery.github.js index 336661b..8581e7f 100644 --- a/dist/jquery.github.js +++ b/dist/jquery.github.js @@ -1,5 +1,5 @@ /* - * jQuery Github - v0.3.0 + * jQuery Github - v0.3.1 * A jQuery plugin to display your Github Repositories. * https://github.com/zenorocha/jquery-github/ * @@ -137,27 +137,26 @@ pushed_at = self.parsePushedDate( repo.pushed_at ), repo_url = self.parseRepositoryURL( repo.url ); - return $( $.parseHTML(" \ -
\ -
\ -

\ - " + repo.name + " \ -

\ - \ -
\ -
\ -

" + repo.description + " — Read More

\ -
\ -
\ -

Latest commit to master on " + pushed_at + "

\ - \ -
\ -
\ - ") ); + return $( + "
" + + "
" + + "

" + + "" + repo.name + "" + + "

" + + "" + + "
" + + "
" + + "

" + repo.description + " — Read More

" + + "
" + + "
" + + "

Latest commit to master on " + pushed_at + "

" + + "" + + "
" + + "
"); }; // Request repositories from Github @@ -181,12 +180,12 @@ }); }; - $.fn[ pluginName ] = function ( options ) { + $.fn[pluginName] = function ( options ) { return this.each(function () { - if ( !$.data( this, "plugin_" + pluginName ) ) { - $.data( this, "plugin_" + pluginName, new Plugin( this, options ) ); + if ( !$( this ).data( "plugin_" + pluginName ) ) { + $( this ).data( "plugin_" + pluginName, new Plugin( this, options ) ); } }); }; -}( jQuery, window ) ); +}( window.jQuery || window.Zepto, window )); diff --git a/dist/jquery.github.min.js b/dist/jquery.github.min.js index 662b8e9..151704c 100644 --- a/dist/jquery.github.min.js +++ b/dist/jquery.github.min.js @@ -1,9 +1,9 @@ /* - * jQuery Github - v0.3.0 + * jQuery Github - v0.3.1 * A jQuery plugin to display your Github Repositories. * https://github.com/zenorocha/jquery-github/ * * Copyright (c) 2013 * MIT License */ -(function(s,e){function t(e,t){var r=this;r.element=e,r.$container=s(e),r.repo=r.$container.attr("data-repo"),r.options=s.extend({},a,t),r._defaults=a,r._name=o,r.init(),r.displayIcons()}var o="github",a=(e.document,{iconStars:!0,iconForks:!0,iconIssues:!1});t.prototype.init=function(){var s=this,e=s.getCache();null!==e?s.applyTemplate(JSON.parse(e)):s.requestData(s.repo)},t.prototype.displayIcons=function(){$iconStars=s(".repo-stars"),$iconForks=s(".repo-forks"),$iconIssues=s(".repo-issues"),this.options.iconStars?$iconStars.css("display","inline-block"):$iconStars.css("display","none"),this.options.iconForks?$iconForks.css("display","inline-block"):$iconForks.css("display","none"),this.options.iconIssues?$iconIssues.css("display","inline-block"):$iconIssues.css("display","none")},t.prototype.applyTemplate=function(s){var e=this,t=e.parseTemplate(s);t.appendTo(e.$container)},t.prototype.cacheResults=function(s){var t=this;e.sessionStorage&&e.sessionStorage.setItem("gh-repos:"+t.repo,JSON.stringify(s))},t.prototype.getCache=function(){var s=this;return e.sessionStorage?e.sessionStorage.getItem("gh-repos:"+s.repo):!1},t.prototype.handlerErrorRequests=function(s){console.warn(s.message)},t.prototype.handlerSuccessfulRequest=function(s){var e=this;e.applyTemplate(s),e.cacheResults(s)},t.prototype.parsePushedDate=function(s){var e=new Date(s);return e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()},t.prototype.parseRepositoryURL=function(s){return s.replace("api.","").replace("repos/","")},t.prototype.parseTemplate=function(e){var t=this,o=t.parsePushedDate(e.pushed_at),a=t.parseRepositoryURL(e.url);return s(s.parseHTML("

"+e.name+"

"+e.description+" — Read More

Latest commit to master on "+o+"

"))},t.prototype.requestData=function(e){var t=this;s.ajax({url:"https://api.github.com/repos/"+e,dataType:"jsonp",success:function(s){var e=s.data;s.meta.status>=400&&e.message?t.handlerErrorRequest():t.handlerSuccessfulRequest(e)}})},s.fn[o]=function(e){return this.each(function(){s.data(this,"plugin_"+o)||s.data(this,"plugin_"+o,new t(this,e))})}})(jQuery,window); \ No newline at end of file +(function(s,e){function t(e,t){var i=this;i.element=e,i.$container=s(e),i.repo=i.$container.attr("data-repo"),i.options=s.extend({},a,t),i._defaults=a,i._name=o,i.init(),i.displayIcons()}var o="github",a=(e.document,{iconStars:!0,iconForks:!0,iconIssues:!1});t.prototype.init=function(){var s=this,e=s.getCache();null!==e?s.applyTemplate(JSON.parse(e)):s.requestData(s.repo)},t.prototype.displayIcons=function(){$iconStars=s(".repo-stars"),$iconForks=s(".repo-forks"),$iconIssues=s(".repo-issues"),this.options.iconStars?$iconStars.css("display","inline-block"):$iconStars.css("display","none"),this.options.iconForks?$iconForks.css("display","inline-block"):$iconForks.css("display","none"),this.options.iconIssues?$iconIssues.css("display","inline-block"):$iconIssues.css("display","none")},t.prototype.applyTemplate=function(s){var e=this,t=e.parseTemplate(s);t.appendTo(e.$container)},t.prototype.cacheResults=function(s){var t=this;e.sessionStorage&&e.sessionStorage.setItem("gh-repos:"+t.repo,JSON.stringify(s))},t.prototype.getCache=function(){var s=this;return e.sessionStorage?e.sessionStorage.getItem("gh-repos:"+s.repo):!1},t.prototype.handlerErrorRequests=function(s){console.warn(s.message)},t.prototype.handlerSuccessfulRequest=function(s){var e=this;e.applyTemplate(s),e.cacheResults(s)},t.prototype.parsePushedDate=function(s){var e=new Date(s);return e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()},t.prototype.parseRepositoryURL=function(s){return s.replace("api.","").replace("repos/","")},t.prototype.parseTemplate=function(e){var t=this,o=t.parsePushedDate(e.pushed_at),a=t.parseRepositoryURL(e.url);return s("

"+e.name+""+"

"+""+"
"+"
"+"

"+e.description+" — Read More

"+"
"+"
"+"

Latest commit to master on "+o+"

"+""+"
"+"
")},t.prototype.requestData=function(e){var t=this;s.ajax({url:"https://api.github.com/repos/"+e,dataType:"jsonp",success:function(s){var e=s.data;s.meta.status>=400&&e.message?t.handlerErrorRequest():t.handlerSuccessfulRequest(e)}})},s.fn[o]=function(e){return this.each(function(){s(this).data("plugin_"+o)||s(this).data("plugin_"+o,new t(this,e))})}})(window.jQuery||window.Zepto,window); \ No newline at end of file diff --git a/package.json b/package.json index a0d5bc4..b8c8996 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A jQuery plugin to display your Github Repositories.", "author": "Zeno Rocha", "homepage": "https://github.com/zenorocha/jquery-github/", - "version": "0.3.0", + "version": "0.3.1", "devDependencies": { "grunt": "~0.4.1", "grunt-cli": "~0.1.7",