Let callbacks update settings info. #182

Open
wants to merge 1 commit into
from

Projects

None yet

2 participants

@pnomolos

This patch lets you return an object from the various callbacks which gets merged with the current settings, giving you a lot more flexibility in tweaking things on the fly without getting messy.

@MacDada MacDada commented on the diff Nov 26, 2014
colorbox/jquery.colorbox.js
@@ -174,9 +174,16 @@
}
function trigger(event, callback) {
- $.event.trigger(event);
+ var ret = null;
+ ret = $.event.trigger(event);
+ if ($.isPlainObject(ret)) {
+ settiongs = $.extend(settings, ret);
@MacDada
MacDada Nov 26, 2014

@pnomolos A typo here: settiongs instead of settings

@MacDada MacDada commented on the diff Nov 26, 2014
colorbox/jquery.colorbox.js
if (callback) {
- callback.call(element);
+ ret = callback.call(element);
+ if ($.isPlainObject(ret)) {
+ settiongs = $.extend(settings, ret);
@MacDada
MacDada Nov 26, 2014

@pnomolos A typo here: settiongs instead of settings

@pnomolos

Oh wow this is an ancient PR. Good catch!

@MacDada
MacDada commented Nov 26, 2014

@pnomolos Well, the functionality of this PR is what I'm looking for right now ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment