From da19648b9c239bf4962d2fb198ecc37897a457c1 Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Wed, 11 Dec 2013 23:28:14 -0800 Subject: [PATCH 01/36] Add browser support --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 4439817..580cf6a 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,14 @@ No problem, [@ricardobeat](https://github.com/ricardobeat) already did one. Chec No problem, [@igorlima](https://github.com/igorlima) already did that. Check [demo/index-zepto.html](https://github.com/zenorocha/jquery-github/tree/master/demo/index-zepto.html). +## Browser Support + +We do care about it. + +![IE](https://raw.github.com/paulirish/browser-logos/master/ie/ie_48x48.png) | ![Chrome](https://raw.github.com/paulirish/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/paulirish/browser-logos/master/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/paulirish/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/paulirish/browser-logos/master/safari/safari_48x48.png) +--- | --- | --- | --- | --- | +IE 8+ ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | + ## Contributing Check [CONTRIBUTING.md](https://github.com/zenorocha/jquery-github/blob/master/CONTRIBUTING.md). From 6230e84db22eb1e84c7645d9422e1fa04dfc8ffa Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Thu, 12 Dec 2013 16:54:43 -0800 Subject: [PATCH 02/36] Fetch dependencies using Bower - Fixes #28 --- .gitignore | 1 + README.md | 16 +++++++++++ bower.json | 19 ++++++++++++ demo/index-zepto.html | 3 +- demo/index.html | 2 +- lib/jquery.min.js | 4 --- lib/zepto.data.js | 67 ------------------------------------------- lib/zepto.min.js | 2 -- 8 files changed, 38 insertions(+), 76 deletions(-) create mode 100644 bower.json delete mode 100644 lib/jquery.min.js delete mode 100644 lib/zepto.data.js delete mode 100644 lib/zepto.min.js diff --git a/.gitignore b/.gitignore index 9daa824..0bc7c71 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store node_modules +bower_components diff --git a/README.md b/README.md index 580cf6a..2dbce03 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,22 @@ [![Github Repo Demonstration](http://f.cl.ly/items/2I3u29002A1g2w1R1I0X/Screen%20Shot%202013-01-17%20at%202.16.36%20PM.png)](http://zenorocha.github.com/jquery-github/) +## Getting started + +Three quick start options are available: + +* [Download latest release](https://github.com/zenorocha/jquery-github/releases) +* Clone the repo: `git@github.com:zenorocha/jquery-github.git` +* Install with [Bower](http://bower.io): `bower install bootstrap` + +## Setup + +Use [Bower](http://bower.io) to fetch all dependencies and you're ready to go: + +```sh +$ bower install +``` + ## Usage Create an attribute called `data-repo`: diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..f7009c0 --- /dev/null +++ b/bower.json @@ -0,0 +1,19 @@ +{ + "name": "jquery-github", + "version": "0.3.2", + "homepage": "https://github.com/zenorocha/jquery-github", + "authors": [ + "Zeno Rocha " + ], + "description": "A jQuery plugin to display your Github Repositories.", + "main": "src/jquery.github.js", + "keywords": [ + "jquery", + "github" + ], + "license": "MIT", + "dependencies": { + "zepto": "~1.0.0", + "jquery": "~2.0.3" + } +} diff --git a/demo/index-zepto.html b/demo/index-zepto.html index 8e9833c..a4c2b26 100644 --- a/demo/index-zepto.html +++ b/demo/index-zepto.html @@ -34,8 +34,7 @@

jQuery Github

- - + + + ``` Include plugin's CSS and JS: diff --git a/bower.json b/bower.json index 3ca05f1..4bcfc3d 100644 --- a/bower.json +++ b/bower.json @@ -13,7 +13,7 @@ ], "license": "MIT", "dependencies": { - "zepto": "~1.0.0", - "jquery": "~2.0.3" + "jquery": "^2.1.1", + "zepto": "^1.1.4" } } diff --git a/demo/index.html b/demo/index.html index a7dc9d2..265417e 100644 --- a/demo/index.html +++ b/demo/index.html @@ -34,7 +34,7 @@

jQuery Github

- + diff --git a/github.jquery.json b/github.jquery.json index 35f90ca..e7f7c1e 100644 --- a/github.jquery.json +++ b/github.jquery.json @@ -7,7 +7,7 @@ "repositories", "git" ], - "version": "0.3.3", + "version": "0.3.4", "author": { "name": "Zeno Rocha", "url": "https://github.com/zenorocha" From c20ad941e3b0aa037cb58193d39524c619c17ec0 Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Tue, 4 Nov 2014 14:56:10 +0100 Subject: [PATCH 31/36] Release v0.4.0 --- bower.json | 2 +- dist/jquery.github.min.js | 2 +- github.jquery.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index 4bcfc3d..f804d76 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jquery-github", - "version": "0.3.4", + "version": "0.4.0", "homepage": "https://github.com/zenorocha/jquery-github", "authors": [ "Zeno Rocha " diff --git a/dist/jquery.github.min.js b/dist/jquery.github.min.js index 5a9707a..3f350b3 100644 --- a/dist/jquery.github.min.js +++ b/dist/jquery.github.min.js @@ -6,4 +6,4 @@ * Copyright (c) 2014 * MIT License */ -function GithubRepo(a){this.description=a.description,this.forks=a.forks_count,this.name=a.name,this.open_issues=a.open_issues,this.pushed_at=a.pushed_at,this.url=a.url,this.stargazers=a.stargazers_count}function Github(a,b){var c={iconStars:!0,iconForks:!0,iconIssues:!1};this.element=a,this.$container=$(a),this.repo=this.$container.attr("data-repo"),this.options=$.extend({},c,b),this._defaults=c,this.init(),this.displayIcons()}GithubRepo.prototype.toHTML=function(){return this.pushed_at=this._parsePushedDate(this.pushed_at),this.url=this._parseURL(this.url),$("

"+this.description+" — Read More

Latest commit to master on "+this.pushed_at+"

")},GithubRepo.prototype._parsePushedDate=function(a){var b=new Date(a);return b.getDate()+"/"+(b.getMonth()+1)+"/"+b.getFullYear()},GithubRepo.prototype._parseURL=function(a){return a.replace("api.","").replace("repos/","")},Github.prototype.init=function(){var a=this.getCache();return null!==a?(this.applyTemplate(JSON.parse(a)),void 0):(this.requestData(this.repo),void 0)},Github.prototype.displayIcons=function(){var a=this.options,b=$(".repo-stars"),c=$(".repo-forks"),d=$(".repo-issues");b.css("display",a.iconStars?"inline-block":"none"),c.css("display",a.iconForks?"inline-block":"none"),d.css("display",a.iconIssues?"inline-block":"none")},Github.prototype.requestData=function(a){var b=this;$.ajax({url:"https://api.github.com/repos/"+a,dataType:"jsonp",success:function(a){var c=a.data,d=a.meta.status>=400&&c.message;return d?(b.handleErrorRequest(c),void 0):(b.handleSuccessfulRequest(c),void 0)}})},Github.prototype.handleErrorRequest=function(a){console.warn(a.message)},Github.prototype.handleSuccessfulRequest=function(a){this.applyTemplate(a),this.setCache(a)},Github.prototype.setCache=function(a){window.sessionStorage&&window.sessionStorage.setItem("gh-repos:"+this.repo,JSON.stringify(a))},Github.prototype.getCache=function(){return window.sessionStorage?window.sessionStorage.getItem("gh-repos:"+this.repo):!1},Github.prototype.applyTemplate=function(a){var b=new GithubRepo(a),c=b.toHTML();c.appendTo(this.$container)},function(a){a.fn.github=function(b){return this.each(function(){a(this).data("plugin_github")||a(this).data("plugin_github",new Github(this,b))})}}(window.jQuery||window.Zepto,window); \ No newline at end of file +function GithubRepo(a){this.description=a.description,this.forks=a.forks_count,this.name=a.name,this.open_issues=a.open_issues,this.pushed_at=a.pushed_at,this.url=a.url,this.stargazers=a.stargazers_count}function Github(a,b){var c={iconStars:!0,iconForks:!0,iconIssues:!1};this.element=a,this.$container=$(a),this.repo=this.$container.attr("data-repo"),this.options=$.extend({},c,b),this._defaults=c,this.init(),this.displayIcons()}GithubRepo.prototype.toHTML=function(){return this.pushed_at=this._parsePushedDate(this.pushed_at),this.url=this._parseURL(this.url),$("

"+this.description+" — Read More

Latest commit to master on "+this.pushed_at+"

")},GithubRepo.prototype._parsePushedDate=function(a){var b=new Date(a);return b.getDate()+"/"+(b.getMonth()+1)+"/"+b.getFullYear()},GithubRepo.prototype._parseURL=function(a){return a.replace("api.","").replace("repos/","")},Github.prototype.init=function(){var a=this.getCache();return null!==a?void this.applyTemplate(JSON.parse(a)):void this.requestData(this.repo)},Github.prototype.displayIcons=function(){var a=this.options,b=$(".repo-stars"),c=$(".repo-forks"),d=$(".repo-issues");b.css("display",a.iconStars?"inline-block":"none"),c.css("display",a.iconForks?"inline-block":"none"),d.css("display",a.iconIssues?"inline-block":"none")},Github.prototype.requestData=function(a){var b=this;$.ajax({url:"https://api.github.com/repos/"+a,dataType:"jsonp",success:function(a){var c=a.data,d=a.meta.status>=400&&c.message;return d?void b.handleErrorRequest(c):void b.handleSuccessfulRequest(c)}})},Github.prototype.handleErrorRequest=function(a){console.warn(a.message)},Github.prototype.handleSuccessfulRequest=function(a){this.applyTemplate(a),this.setCache(a)},Github.prototype.setCache=function(a){window.sessionStorage&&window.sessionStorage.setItem("gh-repos:"+this.repo,JSON.stringify(a))},Github.prototype.getCache=function(){return window.sessionStorage?window.sessionStorage.getItem("gh-repos:"+this.repo):!1},Github.prototype.applyTemplate=function(a){var b=new GithubRepo(a),c=b.toHTML();c.appendTo(this.$container)},function(a){a.fn.github=function(b){return this.each(function(){a(this).data("plugin_github")||a(this).data("plugin_github",new Github(this,b))})}}(window.jQuery||window.Zepto,window); \ No newline at end of file diff --git a/github.jquery.json b/github.jquery.json index e7f7c1e..4e3a30c 100644 --- a/github.jquery.json +++ b/github.jquery.json @@ -7,7 +7,7 @@ "repositories", "git" ], - "version": "0.3.4", + "version": "0.4.0", "author": { "name": "Zeno Rocha", "url": "https://github.com/zenorocha" From a3b997fc6907dcbffe0cf5ad75c3a2bcef4edb19 Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Fri, 28 Nov 2014 14:10:20 -0800 Subject: [PATCH 32/36] Update attribute names - "stargazers" > "stargazers_count" & "forks" > "forks_count" --- spec/jquery.github.repo-spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/jquery.github.repo-spec.js b/spec/jquery.github.repo-spec.js index 0169e4e..88464bb 100644 --- a/spec/jquery.github.repo-spec.js +++ b/spec/jquery.github.repo-spec.js @@ -6,10 +6,10 @@ describe("jquery.github.repo", function() { instance = new GithubRepo({ name: "jquery-github", description: "A jQuery plugin to display your Github Repositories", - forks: 33, + forks_count: 33, pushed_at: "2013-07-02T12:08:36Z", url: "https://api.github.com/repos/zenorocha/jquery-github", - stargazers: 131 + stargazers_count: 131 }); }); From 3b135ab8ce96523fe33f07680d8fb06fa501feea Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Fri, 28 Nov 2014 14:11:16 -0800 Subject: [PATCH 33/36] Bump version in dist files --- dist/jquery.github.js | 2 +- dist/jquery.github.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/jquery.github.js b/dist/jquery.github.js index a3e88a1..27e6de9 100644 --- a/dist/jquery.github.js +++ b/dist/jquery.github.js @@ -1,5 +1,5 @@ /* - * jquery-github - v0.3.4 + * jquery-github - v0.4.0 * A jQuery plugin to display your Github Repositories. * https://github.com/zenorocha/jquery-github * diff --git a/dist/jquery.github.min.js b/dist/jquery.github.min.js index 3f350b3..4d06fc4 100644 --- a/dist/jquery.github.min.js +++ b/dist/jquery.github.min.js @@ -1,5 +1,5 @@ /* - * jquery-github - v0.3.4 + * jquery-github - v0.4.0 * A jQuery plugin to display your Github Repositories. * https://github.com/zenorocha/jquery-github * From 3c8c8c083a54c4466376369ec47bc497e77dd454 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Thu, 8 Jan 2015 01:31:23 -0200 Subject: [PATCH 34/36] Move displayIcons to be called inside applyTemplate --- src/jquery.github.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jquery.github.js b/src/jquery.github.js index 1fadfa9..197663b 100644 --- a/src/jquery.github.js +++ b/src/jquery.github.js @@ -67,7 +67,6 @@ function Github( element, options ) { this._defaults = defaults; this.init(); - this.displayIcons(); } // Initializer @@ -151,6 +150,8 @@ Github.prototype.applyTemplate = function ( repo ) { $widget = githubRepo.toHTML(); $widget.appendTo( this.$container ); + + this.displayIcons(); }; // -- Attach plugin to jQuery's prototype -------------------------------------- From 00710d66c0d4b36d09b802684c03663172efc649 Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Thu, 10 Mar 2016 11:09:12 -0800 Subject: [PATCH 35/36] Uses parsed URL from API --- src/jquery.github.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/jquery.github.js b/src/jquery.github.js index 197663b..97f0871 100644 --- a/src/jquery.github.js +++ b/src/jquery.github.js @@ -6,14 +6,13 @@ function GithubRepo( repo ) { this.name = repo.name; this.open_issues = repo.open_issues; this.pushed_at = repo.pushed_at; - this.url = repo.url; + this.url = repo.html_url; this.stargazers = repo.stargazers_count; } // Parses HTML template GithubRepo.prototype.toHTML = function () { - this.pushed_at = this._parsePushedDate( this.pushed_at ), - this.url = this._parseURL( this.url ); + this.pushed_at = this._parsePushedDate( this.pushed_at ); return $( "
" + @@ -44,11 +43,6 @@ GithubRepo.prototype._parsePushedDate = function ( pushed_at ) { return date.getDate() + "/" + ( date.getMonth() + 1 ) + "/" + date.getFullYear(); }; -// Parses URL to be friendly -GithubRepo.prototype._parseURL = function ( url ) { - return url.replace( "api.", "" ).replace( "repos/", "" ); -}; - // -- Github Plugin ------------------------------------------------------------ function Github( element, options ) { From 98f752cf92ef99ff49df5c574c98b3753db55591 Mon Sep 17 00:00:00 2001 From: Zeno Rocha Date: Thu, 10 Mar 2016 11:13:26 -0800 Subject: [PATCH 36/36] Removes broken test --- spec/jquery.github.repo-spec.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/spec/jquery.github.repo-spec.js b/spec/jquery.github.repo-spec.js index 88464bb..28c4d12 100644 --- a/spec/jquery.github.repo-spec.js +++ b/spec/jquery.github.repo-spec.js @@ -34,11 +34,6 @@ describe("jquery.github.repo", function() { .toEqual("2013-07-02T12:08:36Z"); }); - it("should be repository's api url", function() { - expect(instance.url) - .toEqual("https://api.github.com/repos/zenorocha/jquery-github"); - }); - it("should be repository's number of stargazers", function() { expect(instance.stargazers) .toEqual(131); @@ -52,14 +47,4 @@ describe("jquery.github.repo", function() { }); }); - describe("execute _parseURL()", function() { - it("should parse repository's url attribute", function() { - expect(instance._parseURL(instance.url)) - .toEqual("https://github.com/zenorocha/jquery-github"); - }); - }); - - describe("execute toHTML()", function() { - // TODO - }); });