Skip to content
This repository was archived by the owner on Jul 13, 2024. It is now read-only.

Commit a9a27fd

Browse files
committed
Merge develop into master
2 parents 6c6cb42 + 4bd26a2 commit a9a27fd

15 files changed

+432
-108
lines changed

CONTRIBUTING.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,41 @@ Glad to hear you'd like to help us improving the library. Here's the how-to!
77

88
Sounds nice! Please proceed as following:
99

10-
1. **Search for existing issues.** Sometimes, other folks may have reported the same issue and it'd be nice not to duplicate them.
11-
2. If possible, please **create an isolated and reproducible test case.** Make use of [jsFiddle](jsfiddle.net) - for instance - to share your isolated test cases. We won't hold it against you for feature requests, but a live [POC](http://en.wikipedia.org/wiki/Proof_of_concept) is sometimes easier to catch.
12-
3. **Share as much information as possible.** Include browser and version, version of gitgraph.js, etc. where appropriate. That can help us to reproduce the bug, if so.
10+
1. **Search for existing issues.** Sometimes, other folks may have reported the
11+
same issue and it'd be nice not to duplicate them.
12+
2. If possible, please **create an isolated and reproducible test case.** Make
13+
use of [jsFiddle](jsfiddle.net) - for instance - to share your isolated test
14+
cases. We won't hold it against you for feature requests, but a live [POC][]
15+
is sometimes easier to catch.
16+
[POC]: http://en.wikipedia.org/wiki/Proof_of_concept
17+
3. **Share as much information as possible.** Include browser and version,
18+
version of gitgraph.js, etc. where appropriate. That can help us to reproduce
19+
the bug, if so.
1320

1421
## Or wanna contribute to the code?
1522

1623
Github's Pull Request is a fantastic tool to contribute to the code.
1724

1825
Just keep in mind the following rules:
1926

20-
- Change must be done in `src/` files, eventually `test/` or `examples/`, that's all.
27+
- Change must be done in `src/` files, eventually `test/` or `examples/`, that's
28+
all.
2129
- You'd be nice not to pollute your pull request with unintended changes.
22-
- Pull requests should always be against the `develop` branch, never against `master` nor `gh-pages`.
30+
- Pull requests should always be against the `develop` branch, never against
31+
`master` nor `gh-pages`.
2332

24-
Once you send a Pull Request, your code will be check with [Travis CI](https://travis-ci.org/nicoespeon/gitgraph.js) to tell whether you break the build or not. The Travis test should pass before we accept any Pull Request.
33+
Once you send a Pull Request, your code will be checked with [Travis CI][] to
34+
tell whether you break the build or not. The Travis test should pass before we
35+
accept any Pull Request.
36+
[Travis CI]: https://travis-ci.org/nicoespeon/gitgraph.js
2537

2638
## Check about our coding standards
2739

28-
Please follow our coding standards as best as you can to keep consistency over code.
40+
Please follow our coding standards as best as you can to keep consistency over
41+
code.
2942

30-
The [.editorconfig](https://github.com/nicoespeon/gitgraph.js/blob/develop/.editorconfig) file should help you configure your IDE to do so.
43+
The [.editorconfig][] file should help you configure your IDE to do so.
44+
[.editorconfig]: https://github.com/nicoespeon/gitgraph.js/blob/develop/.editorconfig
3145

3246
### JS
3347

@@ -40,10 +54,14 @@ The [.editorconfig](https://github.com/nicoespeon/gitgraph.js/blob/develop/.edit
4054

4155
- Adhere to the (default) [CSScomb](http://csscomb.com/) property order
4256
- Multiple-line approach (one property and value per line)
43-
- Always a space after a property's colon (.e.g, `display: block;` and not `display:block;`)
57+
- Always a space after a property's colon (.e.g, `display: block;` and not
58+
`display:block;`)
4459
- End all lines with a semi-colon
4560
- For multiple, comma-separated selectors, place each selector on its own line
46-
- Attribute selectors, like `input[type="text"]`, should always wrap the attribute's value in double quotes, for consistency and safety (see [this blog post on unquoted attribute values](http://mathiasbynens.be/notes/unquoted-attribute-values) that can lead to XSS attacks).
61+
- Attribute selectors, like `input[type="text"]`, should always wrap the
62+
attribute's value in double quotes, for consistency and safety (see [this blog
63+
post on unquoted attribute values][blog] that can lead to XSS attacks).
64+
[blog]: http://mathiasbynens.be/notes/unquoted-attribute-values
4765

4866
### HTML
4967

@@ -54,6 +72,8 @@ The [.editorconfig](https://github.com/nicoespeon/gitgraph.js/blob/develop/.edit
5472

5573
## License
5674

57-
By contributing your code, you agree to license your contribution under the terms of [the MIT license](https://github.com/nicoespeon/gitgraph.js/blob/master/LICENSE.md).
75+
By contributing your code, you agree to license your contribution under the
76+
terms of the [MIT license][]
77+
[MIT license]: https://github.com/nicoespeon/gitgraph.js/blob/master/LICENSE.md
5878

5979
[> What does that mean?](http://choosealicense.com/licenses/mit/)

README.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,59 +13,78 @@ You have different options to start with the library:
1313

1414
- [Download the latest release](https://github.com/nicoespeon/gitgraph.js/releases/latest).
1515
- Clone the repo: `git clone git://github.com/nicoespeon/gitgraph.js.git`.
16+
- Install with [npm](https://www.npmjs.com): `npm install --save gitgraph.js`.
1617
- Install with [Bower](http://bower.io/): `bower install gitgraph.js`.
1718
- Use [the CDNjs hosted lib](https://cdnjs.com/libraries/gitgraph.js).
1819

1920
Production files are available under the `build/` directory.
2021

2122
## Report a bug / Ask for a feature
2223

23-
You found some nasty bug or have a cool feature request? [Just open a new issue](https://github.com/nicoespeon/gitgraph.js/issues).
24+
You found some nasty bug or have a cool feature request? [Just open a new
25+
issue](https://github.com/nicoespeon/gitgraph.js/issues).
2426

25-
Please have a look at [the Issue Guidelines](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md) from [Nicolas Gallagher](https://github.com/necolas) before doing so.
27+
Please have a look at the [Issue Guidelines][] from [Nicolas Gallagher][] before
28+
doing so.
29+
[Issue Guidelines]: https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md
30+
[Nicolas Gallagher]: https://github.com/necolas
2631

2732
## Documentation
2833

2934
The JavaScript source code is documented with [JSDoc](http://usejsdoc.org/).
3035

3136
## Contributing
3237

33-
Editor preferences are available in [the editor config](https://github.com/nicoespeon/gitgraph.js/blob/master/.editorconfig) for easy use in common text editors. Read more and download plugins at <http://editorconfig.org>.
38+
Editor preferences are available in for [the editor config][] easy use in common
39+
text editors. Read more and download plugins at <http://editorconfig.org>.
40+
[the editor config]: https://github.com/nicoespeon/gitgraph.js/blob/master/.editorconfig
3441

35-
The project uses [Grunt](http://gruntjs.com) with convenient methods for our workflow. It's how we lint our code, run tests, generate documentation, etc. To use it, install the required dependencies as directed and then run the following Grunt commands.
42+
The project uses [Grunt](http://gruntjs.com) with convenient methods for our
43+
workflow. It's how we lint our code, run tests, generate documentation, etc. To
44+
use it, install the required dependencies as directed and then run the following
45+
Grunt commands.
3646

3747
### Install Grunt
3848

3949
From the command line:
4050

4151
- Install `grunt-cli` globally with `npm install -g grunt-cli`.
42-
- Install [the necessary local dependencies](https://github.com/nicoespeon/gitgraph.js/blob/master/.editorconfig) with `npm install`.
52+
- Install [the necessary local dependencies][] with `npm install`.
53+
[the necessary local dependencies]: https://github.com/nicoespeon/gitgraph.js/blob/master/package.json
4354

44-
When completed, you'll be able to run the various Grunt commands provided from the command line.
55+
When completed, you'll be able to run the various Grunt commands provided from
56+
the command line.
4557

4658
[> Need more information about how to get started with Grunt?](http://gruntjs.com/getting-started)
4759

4860
### Available Grunt commands
4961

5062
#### test code - `grunt test`
5163

52-
Check source code against [JSHint](http://www.jshint.com/) then runs unit tests with [Jasmine](http://pivotal.github.io/jasmine/).
64+
Check source code against [JSHint][] then runs unit tests with [Jasmine][].
65+
[JSHint]: http://www.jshint.com/
66+
[Jasmine]: https://jasmine.github.io/
5367

5468
#### generate documentation - `grunt doc`
5569

56-
Generate source code documentation into `dist/docs/` (not versioned) with [JSDoc](http://usejsdoc.org/).
70+
Generate source code documentation into `dist/docs/` (not versioned) with
71+
[JSDoc](http://usejsdoc.org/).
5772

5873
#### compile a non-versioned release - `grunt dist`
5974

60-
Clean `dist/` directory, lint code, output the minified release into `dist/gitgraph.min.js` and generate the documentation into `dist/docs/`.
75+
Clean `dist/` directory, lint code, output the minified release into
76+
`dist/gitgraph.min.js` and generate the documentation into `dist/docs/`.
6177

6278
#### compile a new release - `grunt release`
6379

64-
Lint code, output the source and minified releases into `build/` and generate the official documentation into `docs/`.
80+
Lint code, output the source and minified releases into `build/` and generate
81+
the official documentation into `docs/`.
6582

6683
#### open a live reload server - `grunt server`
6784

68-
For a better code experience, this grunt task opens a live server in your favorite browser. This server is automatically reloaded when you save a project file.
85+
For a better code experience, this grunt task opens a live server in your
86+
favorite browser. This server is automatically reloaded when you save a project
87+
file.
6988

7089
Please note that `examples/index.html` is the default file for testing ;)
7190

@@ -83,9 +102,11 @@ Releases will be numbered with the following format:
83102

84103
And constructed with the following guidelines:
85104

86-
- Breaking backward compatibility bumps the `<major>` (and resets the `<minor>` and `<patch>`)
87-
- New additions without breaking backward compatibility bumps the `<minor>` (and resets the `<patch>`)
88-
- Bug fixes and misc. changes bumps the `<patch>`
105+
- Breaking backward compatibility bumps the `<major>` (and resets the `<minor>`
106+
and `<patch>`)
107+
- New additions without breaking backward compatibility bump the `<minor>` (and
108+
reset the `<patch>`)
109+
- Bug fixes and misc. changes bump the `<patch>`
89110

90111
## Authors and contributors
91112

@@ -95,6 +116,7 @@ And constructed with the following guidelines:
95116

96117
## Copyright and License
97118

98-
Copyright (c) 2013 Nicolas CARLO and Fabien BERNARD under [the MIT license](https://github.com/nicoespeon/gitgraph.js/blob/master/LICENSE.md).
119+
Copyright (c) 2013 Nicolas CARLO and Fabien BERNARD under the [MIT license][]
120+
[MIT license]: https://github.com/nicoespeon/gitgraph.js/blob/master/LICENSE.md
99121

100122
[> What does that mean?](http://choosealicense.com/licenses/mit/)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitgraph.js",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"main": [ "./build/gitgraph.js", "./build/gitgraph.css" ],
55
"ignore": [
66
"**/.*"

build/gitgraph.js

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ==========================================================
2-
* GitGraph v1.4.0
2+
* GitGraph v1.5.0
33
* https://github.com/nicoespeon/gitgraph.js
44
* ==========================================================
55
* Copyright (c) 2016 Nicolas CARLO (@nicoespeon) ٩(^‿^)۶
@@ -196,22 +196,32 @@
196196
this.commitOffsetY = options.initCommitOffsetY || 0;
197197

198198
// Bindings
199-
var mouseMoveOptions = {
199+
this.mouseMoveOptions = {
200200
handleEvent: this.hover,
201201
gitgraph: this
202202
};
203-
this.canvas.addEventListener( "mousemove", mouseMoveOptions, false );
203+
this.canvas.addEventListener( "mousemove", this.mouseMoveOptions, false );
204204

205-
var mouseDownOptions = {
205+
this.mouseDownOptions = {
206206
handleEvent: this.click,
207207
gitgraph: this
208208
};
209-
this.canvas.addEventListener( "mousedown", mouseDownOptions, false );
209+
this.canvas.addEventListener( "mousedown", this.mouseDownOptions, false );
210210

211211
// Render on window resize
212212
window.onresize = this.render.bind( this );
213213
}
214214

215+
/**
216+
* Disposing canvas event handlers
217+
*
218+
* @this GitGraph
219+
**/
220+
GitGraph.prototype.dispose = function () {
221+
this.canvas.removeEventListener( "mousemove", this.mouseMoveOptions, false );
222+
this.canvas.removeEventListener( "mousedown", this.mouseDownOptions, false );
223+
};
224+
215225
/**
216226
* Create new branch
217227
*
@@ -372,6 +382,14 @@
372382
* @callback commitCallback
373383
* @param {Commit} commit - A commit
374384
* @param {boolean} mouseOver - True, if the mouse is currently hovering over the commit
385+
* @param {Event} event - The DOM event (e.g. a click event)
386+
*/
387+
388+
/**
389+
* A formatter for commit
390+
*
391+
* @callback commitFormatter
392+
* @param {Commit} commit - The commit to format
375393
*/
376394

377395
/**
@@ -403,7 +421,7 @@
403421
var distanceBetweenCommitCenterAndMouse = Math.sqrt( Math.pow( distanceX, 2 ) + Math.pow( distanceY, 2 ) );
404422
var isOverCommit = distanceBetweenCommitCenterAndMouse < this.template.commit.dot.size;
405423

406-
callbackFn( commit, isOverCommit );
424+
callbackFn( commit, isOverCommit, event );
407425
}
408426
};
409427

@@ -450,7 +468,7 @@
450468
_emitEvent( self.canvas, "commit:" + event, mouseEventOptions );
451469
}
452470

453-
self.applyCommits( event, function ( commit, isOverCommit ) {
471+
self.applyCommits( event, function ( commit, isOverCommit, event ) {
454472
if ( isOverCommit ) {
455473
if ( !self.template.commit.message.display && self.template.commit.shouldDisplayTooltipsInCompactMode ) {
456474
showCommitTooltip( commit );
@@ -485,13 +503,13 @@
485503
* @this GitGraph
486504
**/
487505
GitGraph.prototype.click = function ( event ) {
488-
this.gitgraph.applyCommits( event, function ( commit, isOverCommit ) {
506+
this.gitgraph.applyCommits( event, function ( commit, isOverCommit, event ) {
489507
if ( !isOverCommit ) {
490508
return;
491509
}
492510

493511
if ( commit.onClick !== null ) {
494-
commit.onClick( commit, true );
512+
commit.onClick( commit, true, event );
495513
}
496514
} );
497515
};
@@ -1220,7 +1238,7 @@
12201238
* @param {Boolean} [options.commit.message.displayHash] - Commit message hash policy
12211239
* @param {String} [options.commit.message.font = "normal 12pt Calibri"] - Commit message font
12221240
* @param {Boolean} [options.commit.shouldDisplayTooltipsInCompactMode] - Tooltips policy
1223-
* @param {commitCallback} [options.commit.tooltipHTMLFormatter=true] - Formatter for the tooltip contents.
1241+
* @param {commitFormatter} [options.commit.tooltipHTMLFormatter=true] - Formatter for the tooltip contents.
12241242
*
12251243
* @this Template
12261244
**/

build/gitgraph.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Branch.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ <h6>Properties</h6>
324324

325325
<dt class="tag-source">Source:</dt>
326326
<dd class="tag-source"><ul class="dummy"><li>
327-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line506">line 506</a>
327+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line524">line 524</a>
328328
</li></ul></dd>
329329

330330

@@ -465,7 +465,7 @@ <h5>Parameters:</h5>
465465

466466
<dt class="tag-source">Source:</dt>
467467
<dd class="tag-source"><ul class="dummy"><li>
468-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line595">line 595</a>
468+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line613">line 613</a>
469469
</li></ul></dd>
470470

471471

@@ -566,7 +566,7 @@ <h5>This:</h5>
566566

567567
<dt class="tag-source">Source:</dt>
568568
<dd class="tag-source"><ul class="dummy"><li>
569-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line870">line 870</a>
569+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line888">line 888</a>
570570
</li></ul></dd>
571571

572572

@@ -638,7 +638,7 @@ <h5>This:</h5>
638638

639639
<dt class="tag-source">Source:</dt>
640640
<dd class="tag-source"><ul class="dummy"><li>
641-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line790">line 790</a>
641+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line808">line 808</a>
642642
</li></ul></dd>
643643

644644

@@ -833,7 +833,7 @@ <h6>Properties</h6>
833833

834834
<dt class="tag-source">Source:</dt>
835835
<dd class="tag-source"><ul class="dummy"><li>
836-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line669">line 669</a>
836+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line687">line 687</a>
837837
</li></ul></dd>
838838

839839

@@ -912,7 +912,7 @@ <h5>This:</h5>
912912

913913
<dt class="tag-source">Source:</dt>
914914
<dd class="tag-source"><ul class="dummy"><li>
915-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line799">line 799</a>
915+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line817">line 817</a>
916916
</li></ul></dd>
917917

918918

@@ -1092,7 +1092,7 @@ <h5>Parameters:</h5>
10921092

10931093
<dt class="tag-source">Source:</dt>
10941094
<dd class="tag-source"><ul class="dummy"><li>
1095-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line813">line 813</a>
1095+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line831">line 831</a>
10961096
</li></ul></dd>
10971097

10981098

@@ -1187,7 +1187,7 @@ <h5>This:</h5>
11871187

11881188
<dt class="tag-source">Source:</dt>
11891189
<dd class="tag-source"><ul class="dummy"><li>
1190-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line895">line 895</a>
1190+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line913">line 913</a>
11911191
</li></ul></dd>
11921192

11931193

@@ -1259,7 +1259,7 @@ <h5>This:</h5>
12591259

12601260
<dt class="tag-source">Source:</dt>
12611261
<dd class="tag-source"><ul class="dummy"><li>
1262-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line620">line 620</a>
1262+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line638">line 638</a>
12631263
</li></ul></dd>
12641264

12651265

@@ -1306,7 +1306,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
13061306
<br clear="both">
13071307

13081308
<footer>
1309-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Sep 02 2016 21:24:48 GMT+0200 (CEST)
1309+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Dec 09 2016 08:47:33 GMT+0100 (CET)
13101310
</footer>
13111311

13121312
<script> prettyPrint(); </script>

0 commit comments

Comments
 (0)