Skip to content

Commit

Permalink
Rename callback() option to onSelect().
Browse files Browse the repository at this point in the history
  • Loading branch information
recurser committed Apr 7, 2013
1 parent 81928ce commit a6f1a72
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
9 changes: 5 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ colorCodeColor: Text color of the color code inside the button. Only
used if 'displayColorCode' is true.
default value: '#FFF'

callback: Function to be called when a color is selected. The
onSelect: Function to be called when a color is selected. The
hex code is passed into the function.
default value: null

Expand Down Expand Up @@ -170,10 +170,11 @@ Total time: 2 seconds
Change history
-----------

* **Version 1.1.2 (2013-04-06)** : Add onCellEnter, onClose and livePreview options (thanks [jbergen](https://github.com/jbergen)).
* **Version 1.1.1 (2013-03-29)** : Add callback option (thanks [jbergen](https://github.com/jbergen)).
* **Version 1.1.3 (2013-04-07)** : Rename *callback* option to *onSelect*.
* **Version 1.1.2 (2013-04-06)** : Add *onCellEnter*, *onClose* and *livePreview* options (thanks [jbergen](https://github.com/jbergen)).
* **Version 1.1.1 (2013-03-29)** : Add *callback* option (thanks [jbergen](https://github.com/jbergen)).
* **Version 1.1.0 (2012-10-14)** : Remove select and cancel buttons (thanks [wesnolte](https://github.com/wesnolte)).
* **Version 1.0.1 (2011-08-15)** : Trigger change() event when a color is selected (thanks [firstclown](https://github.com/firstclown)), and make colored display box clickable to select colors.
* **Version 1.0.1 (2011-08-15)** : Trigger *change()* event when a color is selected (thanks [firstclown](https://github.com/firstclown)), and make colored display box clickable to select colors.
* **Version 1.0.0 (2011-05-21)** : 1.0 release.


Expand Down
4 changes: 2 additions & 2 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$('.simple_color_live_preview').simpleColor({ livePreview: true });

$('.simple_color_callback').simpleColor({
callback: function( hex ) {
onSelect: function( hex ) {
alert("You selected #" + hex);
}
});
Expand All @@ -35,7 +35,7 @@
buttonClass: 'button',
displayColorCode: true,
livePreview: true,
callback: function( hex ) {
onSelect: function( hex ) {
alert("You selected #" + hex);
},
onCellEnter: function( hex ) {
Expand Down
10 changes: 5 additions & 5 deletions src/jquery.simple-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* colorCodeColor: Text color of the color code inside the button. Only used if 'displayColorCode' is true.
* Default value: '#FFF'
*
* callback: Callback function to call after a color has been chosen.
* onSelect: Callback function to call after a color has been chosen.
* Default value: null
* Returns: hex value
*
Expand Down Expand Up @@ -118,7 +118,7 @@
displayColorCode: this.attr('displayColorCode') || false,
colorCodeAlign: this.attr('colorCodeAlign') || 'center',
colorCodeColor: this.attr('colorCodeColor') || '#FFF',
callback: null,
onSelect: null,
onCellEnter: null,
onClose: null,
livePreview: false
Expand Down Expand Up @@ -262,9 +262,9 @@
if (options.displayColorCode) {
event.data.display_box.text('#' + this.id);
}
// If a callback function is defined then excecute it.
if (options.callback) {
options.callback(this.id);
// If an onSelect callback function is defined then excecute it.
if (options.onSelect) {
options.onSelect(this.id);
}

});
Expand Down

0 comments on commit a6f1a72

Please sign in to comment.