diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b608236 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org + +root = true + +[*] +indent_style = tab +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.gitignore b/.gitignore index 496ee2c..0bc7c71 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.DS_Store \ No newline at end of file +.DS_Store +node_modules +bower_components diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..fff0d5e --- /dev/null +++ b/.jshintrc @@ -0,0 +1,17 @@ +{ + "boss": true, + "curly": true, + "eqeqeq": true, + "eqnull": true, + "expr": true, + "immed": true, + "noarg": true, + "onevar": true, + "quotmark": "double", + "smarttabs": true, + "trailing": true, + "undef": false, + "unused": false, + "node": true, + "multistr": true +} diff --git a/.travis.yml b/.travis.yml index c2ba3f9..20fd86b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: node_js node_js: - - 0.8 \ No newline at end of file + - 0.10 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5fbd9fb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -m 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request :D + +Don't edit files under `dist` folder, those are generated after running `grunt` command, edit files under `src` folder instead. + +Also remember to follow [jQuery's Code Style](http://contribute.jquery.org/style-guide/js/). diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..5ccdd80 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,101 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + + pkg: grunt.file.readJSON('bower.json'), + + meta: { + banner: '/*\n' + + ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' + + ' * <%= pkg.description %>\n' + + ' * <%= pkg.homepage %>\n' + + ' *\n' + + ' * Copyright (c) <%= grunt.template.today("yyyy") %>\n' + + ' * MIT License\n' + + ' */\n' + }, + + bump: { + options: { + files: ['bower.json', 'github.jquery.json'], + commit: true, + commitMessage: 'Release v%VERSION%', + commitFiles: ['bower.json', 'github.jquery.json', 'dist'], + createTag: true, + tagName: '%VERSION%', + tagMessage: '', + push: true, + pushTo: 'origin' + } + }, + + concat: { + options: { + banner: '<%= meta.banner %>' + }, + dist: { + src: ['src/jquery.github.js'], + dest: 'dist/jquery.github.js' + } + }, + + lintspaces: { + all: { + src: [ + '*', 'src/*', 'spec/*', 'demo/*', 'assets/base.css', '!package.json' + ], + options: { + newline: true, + trailingspaces: true, + indentation: 'tabs', + spaces: 2 + } + } + }, + + jasmine: { + src: 'src/jquery.github.js', + options: { + specs: 'spec/*spec.js', + helpers: 'spec/helpers/*.js', + vendor: 'lib/jquery.min.js' + } + }, + + jshint: { + files: ['src/jquery.github.js'], + options: { + jshintrc: ".jshintrc" + } + }, + + uglify: { + options: { + banner: '<%= meta.banner %>' + }, + my_target: { + src: ['dist/jquery.github.js'], + dest: 'dist/jquery.github.min.js' + } + }, + + watch: { + files: ['**/*'], + tasks: ['jshint', 'concat', 'uglify'], + } + + }); + + grunt.loadNpmTasks('grunt-bump'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-jasmine'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-lintspaces'); + + grunt.registerTask('default', ['lintspaces', 'jshint', 'concat', 'uglify']); + grunt.registerTask('release', ['bump-only:patch', 'default', 'bump-commit']); + grunt.registerTask('test', ['lintspaces', 'jshint', 'jasmine']); + +}; diff --git a/README.md b/README.md index a4cfb42..2cb5712 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,51 @@ -# jQuery Github [](https://travis-ci.org/zenorocha/jquery-github) +# jQuery Github -[](http://zenorocha.github.com/jquery-github/) +[](http://bower.io/search/?q=jquery-github) +[](https://travis-ci.org/zenorocha/jquery-github) +[](https://david-dm.org/zenorocha/jquery-github#info=devDependencies) + +[](http://zenorocha.github.io/jquery-github/) + +> A jQuery plugin to display your Github Repositories. + +## Browser Support + +We do care about it. + + |  |  |  |  +--- | --- | --- | --- | --- | +IE 8+ ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | + +## 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 jquery-github` + +## Setup + +Use [Bower](http://bower.io) to fetch all dependencies: + +```sh +$ bower install +``` + +Now you're ready to go! ## Usage Create an attribute called `data-repo`: ```html -
+ ``` Include jQuery: ```html - + ``` Include plugin's CSS and JS: @@ -26,50 +58,153 @@ Include plugin's CSS and JS: Call the plugin: ```javascript -$('[data-repo]').github(); +$("[data-repo]").github(); ``` And that's it \o/ -[Check the full example here](https://github.com/zenorocha/jquery-github/blob/master/demo/index.html) +[Check full example's source code](https://github.com/zenorocha/jquery-github/blob/master/demo/index.html). + +## Options + +Here's a list of available settings. + +```javascript +$("[data-repo]").github({ + iconStars: true, + iconForks: true, + iconIssues: false +}); +``` + +Attribute | Type | Default | Description +--- | --- | --- | --- +`iconStars` | *Boolean* | `true` | Displays the number of stars in a repository. +`iconForks` | *Boolean* | `true` | Displays the number of forks in a repository. +`iconIssues` | *Boolean* | `false` | Displays the number of issues in a repository. + +## Structure + +The basic structure of the project is given in the following way: + +``` +. +|-- assets/ +|-- demo/ +| |-- index.html +| |-- index-zepto.html +|-- dist/ +| |-- jquery.boilerplate.js +| |-- jquery.boilerplate.min.js +|-- src/ +| |-- jquery.boilerplate.coffee +| |-- jquery.boilerplate.js +|-- .editorconfig +|-- .gitignore +|-- .jshintrc +|-- .travis.yml +|-- github.jquery.json +|-- Gruntfile.js +`-- package.json +``` + +#### [assets/](https://github.com/zenorocha/jquery-github/tree/master/assets) + +Contains CSS and Font files to create that lovely Github box. + +#### bower_components/ + +Contains all dependencies like jQuery and Zepto. + +#### [demo/](https://github.com/zenorocha/jquery-github/tree/master/demo) + +Contains a simple HTML file to demonstrate the plugin. + +#### [dist/](https://github.com/zenorocha/jquery-github/tree/master/dist) + +This is where the generated files are stored once Grunt runs JSHint and other stuff. + +#### [src/](https://github.com/zenorocha/jquery-github/tree/master/src) + +Contains the files responsible for the plugin. + +#### [.editorconfig](https://github.com/zenorocha/jquery-github/tree/master/.editorconfig) + +This file is for unifying the coding style for different editors and IDEs. + +> Check [editorconfig.org](http://editorconfig.org) if you haven't heard about this project yet. + +#### [.gitignore](https://github.com/zenorocha/jquery-github/tree/master/.gitignore) + +List of files that we don't want Git to track. + +> Check this [Git Ignoring Files Guide](https://help.github.com/articles/ignoring-files) for more details. + +#### [.jshintrc](https://github.com/zenorocha/jquery-github/tree/master/.jshintrc) + +List of rules used by JSHint to detect errors and potential problems in JavaScript. + +> Check [jshint.com](http://jshint.com/about/) if you haven't heard about this project yet. + +#### [.travis.yml](https://github.com/zenorocha/jquery-github/tree/master/.travis.yml) + +Definitions for continous integration using Travis. + +> Check [travis-ci.org](http://about.travis-ci.org/) if you haven't heard about this project yet. + +#### [github.jquery.json](https://github.com/zenorocha/jquery-github/tree/master/github.jquery.json) + +Package manifest file used to publish plugins in jQuery Plugin Registry. + +> Check this [Package Manifest Guide](http://plugins.jquery.com/docs/package-manifest/) for more details. + +#### [Gruntfile.js](https://github.com/zenorocha/jquery-github/tree/master/Gruntfile.js) + +Contains all automated tasks using Grunt. + +> Check [gruntjs.com](http://gruntjs.com) if you haven't heard about this project yet. + +#### [package.json](https://github.com/zenorocha/jquery-github/tree/master/package.json) + +Specify all dependencies loaded via Node.JS. + +> Check [NPM](https://npmjs.org/doc/json.html) for more details. + +## Showcase + +* [zenorocha.com/projects](http://zenorocha.com/projects/) +* [anasnakawa.com/projects](http://anasnakawa.com/projects/) + +**Have you used this plugin in your project?** + +Let me know! Send a [tweet](http://twitter.com/zenorocha) or [pull request](https://github.com/zenorocha/jquery-github/pull/new/master) and I'll add it here :) + +## Alternatives + +**Prefer a non-jquery version with pure JavaScript?** + +No problem, [@ricardobeat](https://github.com/ricardobeat) already did one. Check [his fork](https://github.com/ricardobeat/github-repos)! + +**Prefer Zepto instead of jQuery?** + +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). -## Forks +**Prefer AngularJS instead of jQuery?** -Prefer a non-jquery version with pure JavaScript? No problem, [@ricardobeat](https://github.com/ricardobeat) already did one :) Check [his fork!](https://github.com/ricardobeat/github-repos) +No problem, [@lucasconstantino](https://github.com/lucasconstantino) already did that. Check [his fork](https://github.com/lucasconstantino/angular-github-repo)! ## Contributing -1. Fork it! -2. Create your feature branch: `git checkout -b my-new-feature` -3. Commit your changes: `git commit -am 'Add some feature'` -4. Push to the branch: `git push origin my-new-feature` -5. Submit a pull request :D +Check [CONTRIBUTING.md](https://github.com/zenorocha/jquery-github/blob/master/CONTRIBUTING.md). ## History -* v0.2.4 January 17, 2013 - * Renamed from `jquery-github-repos` to `jquery-github` -* v0.2.3 January 17, 2013 - * Added to jQuery Plugins Registry - * Updated to jQuery v1.9 -* v0.2.2 January 15, 2013 - * Fixed "Last commit" date - * Cached repo data using sessionStorage - * Added error message if API exceeds its limits -* v0.2.1 January 13, 2013 - * Added live demo - * Replaced single images for a sprite - * Added minified version -* v0.2 September 11, 2012 - * Code wrapped into a jQuery plugin - * Demonstration page created -* v0.1 September 10, 2012 - * Initial commit +Check [Releases](https://github.com/zenorocha/jquery-github/releases) for detailed changelog. ## Credits -Built on top of [jQuery Boilerplate](http://jqueryboilerplate.com) +Built on top of [jQuery Boilerplate](http://jqueryboilerplate.com). ## License -[MIT License](http://zenorocha.mit-license.org/) \ No newline at end of file +[MIT License](http://zenorocha.mit-license.org/) © Zeno Rocha diff --git a/assets/Entypo-webfont.eot b/assets/Entypo-webfont.eot new file mode 100755 index 0000000..a754415 Binary files /dev/null and b/assets/Entypo-webfont.eot differ diff --git a/assets/Entypo-webfont.svg b/assets/Entypo-webfont.svg new file mode 100755 index 0000000..0bdb76b --- /dev/null +++ b/assets/Entypo-webfont.svg @@ -0,0 +1,141 @@ + + + \ No newline at end of file diff --git a/assets/Entypo-webfont.ttf b/assets/Entypo-webfont.ttf new file mode 100755 index 0000000..25438bd Binary files /dev/null and b/assets/Entypo-webfont.ttf differ diff --git a/assets/Entypo-webfont.woff b/assets/Entypo-webfont.woff new file mode 100755 index 0000000..b859168 Binary files /dev/null and b/assets/Entypo-webfont.woff differ diff --git a/assets/base.css b/assets/base.css index c992d35..157d2cd 100644 --- a/assets/base.css +++ b/assets/base.css @@ -1,156 +1,206 @@ /* Github Box */ +.github-box-wrap { + display: inline-block; + width: 46%; + margin-right: 0.6em; + margin-left: 0.6em; + margin-bottom: 2em; +} + .github-box { - font-family: "Helvetica Neue", Arial, sans-serif; - background: #fafafa; - border: 1px solid #ddd; - color: #666; - border-radius: 5px; - float: left; - margin-right: 1.2em; - margin-bottom: 2em; - width: 46%; + font-family: "Helvetica Neue", Arial, sans-serif; + background: #fafafa; + border: 1px solid #ddd; + color: #666; + border-radius: 5px; + width: 100%; } .github-box a { - color: #4183C4; - border: none; + color: #4183C4; + border: none; } /* Github Box Header */ .github-box .github-box-header { - position: relative; - border-bottom: 1px solid #ddd; - border-radius: 5px 5px 0 0; - background: #fcfcfc; - background: -moz-linear-gradient(#fcfcfc, #ebebeb); - background: -webkit-linear-gradient(#fcfcfc, #ebebeb); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfcfc',endColorstr='#ebebeb')"; + position: relative; + border-bottom: 1px solid #ddd; + border-radius: 5px 5px 0 0; + background: #fcfcfc; + background: -moz-linear-gradient(#fcfcfc, #ebebeb); + background: -webkit-linear-gradient(#fcfcfc, #ebebeb); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfcfc',endColorstr='#ebebeb')"; } .github-box .github-box-header h3 { - font-family: Helvetica, Arial, sans-serif; - font-weight: normal; - font-size: 16px; - color: gray; - margin: 0; - padding: 10px 10px 10px 10px; + font-family: Helvetica, Arial, sans-serif; + font-weight: normal; + font-size: 16px; + color: gray; + margin: 0; + padding: 10px 10px 10px 10px; } .github-box .github-box-header h3 a { - font-weight: bold + font-weight: bold } /* Github Box Header - Stats */ .github-box .github-box-header .github-stats { - position: absolute; - top: 10px; - right: 10px; - background: white; - border: 1px solid #ddd; - border-radius: 3px; - font-size: 11px; - font-weight: bold; - line-height: 21px; - height: 21px; + line-height: 36px; + position: absolute; + top: 10px; + right: 10px; + background: white; + border: 1px solid #ddd; + border-radius: 3px; + font-size: 11px; + font-weight: bold; + line-height: 21px; + height: 21px; } .github-box .github-box-header .github-stats a { - display: inline-block; - height: 21px; - color: #666; - padding: 0 5px 0 18px; - background: url('btn-sprite.png') no-repeat; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70); - opacity: 0.7; + display: inline-block; + height: 21px; + color: #666; + padding: 0 5px 0 5px; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70); + opacity: 0.7; + vertical-align: top; } .github-box .github-box-header .github-stats a:hover { - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); - opacity: 1; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); + opacity: 1; +} + +.github-box .github-box-header .github-stats a:before { + font-family: 'EntypoRegular'; + content: attr(data-icon); + display: inline-block; + speak: none; + padding-right: 2px; + font-size: 2em; } -.github-box .github-box-header .github-stats .repo-watchers { - border-right: 1px solid #ddd; - background-position: 3px 4px; +.github-box .github-box-header .github-stats .repo-stars { + border-right: 1px solid #ddd; } .github-box .github-box-header .github-stats .repo-forks { - background-position: 2px -14px; - padding-left: 15px; + padding-left: 2px; + border-right: 1px solid #ddd; } /* Github Box Content */ .github-box .github-box-content { - padding: 10px; - font-weight: 300; - font-size: 0.7em; + padding: 10px; + font-weight: 300; + font-size: 0.7em; } .github-box .github-box-content p { - margin: 0; + margin: 0; + width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } .github-box .github-box-content .repo-link { - font-weight: bold; + font-weight: bold; } /* Github Box Download */ .github-box .github-box-download { - position: relative; - border-top: 1px solid #ddd; - background: white; - border-radius: 0 0 3px 3px; - padding: 10px; - height: 24px; + position: relative; + border-top: 1px solid #ddd; + background: white; + border-radius: 0 0 3px 3px; + padding: 10px; + height: 24px; } .github-box .github-box-download .repo-update { - margin: 0; - font-size: 11px; - color: #666; - line-height: 24px; + margin: 0; + font-size: 11px; + color: #666; + line-height: 24px; } .github-box .github-box-download .repo-update strong { - font-size: 12px; - font-weight: bold; - color: #000; + font-size: 12px; + font-weight: bold; + color: #000; } .github-box .github-box-download .repo-download { - position: absolute; - display: block; - top: 10px; - right: 10px; - height: 24px; - line-height: 24px; - font-size: 12px; - color: #666; - font-weight: bold; - text-shadow: 0 1px 0 rgba(255,255,255,0.9); - padding: 0 10px; - border: 1px solid #ddd; - border-bottom-color: #bbb; - border-radius: 3px; - display: block; - text-indent: -9999px; - width: 24px; - padding: 0; - background: url('btn-sprite.png') no-repeat 4px -31px,-webkit-linear-gradient(whiteSmoke, #E5E5E5); - background: url('btn-sprite.png') no-repeat 4px -31px,-moz-linear-gradient(#f1f7fa, #dbeaf1); - filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=70); - opacity: 0.7; + position: absolute; + display: block; + top: 10px; + right: 10px; + height: 24px; + line-height: 24px; + font-size: 12px; + color: #666; + font-weight: bold; + text-shadow: 0 1px 0 rgba(255,255,255,0.9); + padding: 0 10px; + border: 1px solid #ddd; + border-bottom-color: #bbb; + border-radius: 3px; + display: block; + width: 24px; + padding: 0; + background: -webkit-linear-gradient(whiteSmoke, #E5E5E5); + background: -moz-linear-gradient(#f1f7fa, #dbeaf1); + filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=70); + opacity: 1; } .github-box .github-box-download .repo-download:hover { - color: #527894; - border-color: #cfe3ed; - border-bottom-color: #9fc7db; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); - opacity: 1; -} \ No newline at end of file + color: #527894; + border-color: #cfe3ed; + border-bottom-color: #9fc7db; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); + opacity: 1; +} + +.github-box .github-box-download .repo-download:before { + font-family: 'EntypoRegular'; + text-indent: 0px; + content: attr(data-icon); + display: inline-block; + speak: none; + font-size: 2.0em; + padding: 0 6px; +} + +/* Breakpoint content-driven */ + +@media all and (max-width: 678px) { + .github-box-wrap { + display: block; + width: inherit; + margin-right: 0; + } +} + +/* Fonts */ + +@font-face { + font-family: 'EntypoRegular'; + src: url('Entypo-webfont.eot'); + src: url('Entypo-webfont.eot?#iefix') format('embedded-opentype'), + url('Entypo-webfont.woff') format('woff'), + url('Entypo-webfont.ttf') format('truetype'), + url('Entypo-webfont.svg#EntypoRegular') format('svg'); + font-weight: normal; + font-style: normal; +} diff --git a/assets/btn-sprite.png b/assets/btn-sprite.png deleted file mode 100644 index b9e22c0..0000000 Binary files a/assets/btn-sprite.png and /dev/null differ diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..f804d76 --- /dev/null +++ b/bower.json @@ -0,0 +1,19 @@ +{ + "name": "jquery-github", + "version": "0.4.0", + "homepage": "https://github.com/zenorocha/jquery-github", + "authors": [ + "Zeno RochaA jQuery plugin to display your favorite Github Repositories.
For more informations, visit our repository.
Made with love by Zeno Rocha.
+ +A jQuery plugin to display your favorite Github Repositories.
For more informations, visit our repository.
A jQuery plugin to display your favorite Github Repositories.
For more informations, visit our repository.
Made with love by Zeno Rocha.
+Made with love by Zeno Rocha.
-