Skip to content

Commit

Permalink
Added better parameters for callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
rvera committed Jan 17, 2014
1 parent a0f846a commit d7ab1a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.2
0.2.3
10 changes: 5 additions & 5 deletions image-picker/image-picker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Image Picker
// by Rodrigo Vera
//
// Version 0.2.2
// Version 0.2.3
// Full source at https://github.com/rvera/image-picker
// MIT License, https://github.com/rvera/image-picker/blob/master/LICENSE
// Generated by CoffeeScript 1.4.0
Expand All @@ -23,7 +23,7 @@
}
select.data("picker", new ImagePicker(this, sanitized_options(opts)));
if (opts.initialized != null) {
return opts.initialized();
return opts.initialized.call(select.data("picker"));
}
});
}
Expand Down Expand Up @@ -192,7 +192,7 @@
if (!both_array_are_equal(old_values, this.selected_values())) {
this.select.change();
if (this.opts.changed != null) {
return this.opts.changed.call(this.select);
return this.opts.changed.call(this.select, old_values, this.selected_values());
}
}
};
Expand Down Expand Up @@ -253,10 +253,10 @@
ImagePickerOption.prototype.clicked = function() {
this.picker.toggle(this);
if (this.opts.clicked != null) {
this.opts.clicked.call(this.picker.select);
this.opts.clicked.call(this.picker.select, this);
}
if ((this.opts.selected != null) && this.is_selected()) {
return this.opts.selected.call(this.picker.select);
return this.opts.selected.call(this.picker.select, this);
}
};

Expand Down
4 changes: 2 additions & 2 deletions image-picker/image-picker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions source/coffee/image-picker.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jQuery.fn.extend({
select = jQuery(this)
select.data("picker").destroy() if select.data("picker")
select.data "picker", new ImagePicker(this, sanitized_options(opts))
opts.initialized() if opts.initialized?
opts.initialized.call(select.data("picker")) if opts.initialized?
})

sanitized_options = (opts) ->
Expand Down Expand Up @@ -106,7 +106,7 @@ class ImagePicker
@select.val(selected_value)
unless both_array_are_equal(old_values, @selected_values())
@select.change()
@opts.changed.call(@select) if @opts.changed?
@opts.changed.call(@select, old_values, @selected_values()) if @opts.changed?


class ImagePickerOption
Expand Down Expand Up @@ -144,8 +144,8 @@ class ImagePickerOption

clicked: () =>
@picker.toggle(this)
@opts.clicked.call(@picker.select) if @opts.clicked?
@opts.selected.call(@picker.select) if @opts.selected? and @is_selected()
@opts.clicked.call(@picker.select, this) if @opts.clicked?
@opts.selected.call(@picker.select, this) if @opts.selected? and @is_selected()

create_node: () ->
@node = jQuery("<li/>")
Expand Down

0 comments on commit d7ab1a7

Please sign in to comment.