Commit 1f50c0e2 authored by frjo's avatar frjo
Browse files

Issue #1161342 by jdanthinne: Bug in colorbox_load js. Making sure true/false...

Issue #1161342 by jdanthinne: Bug in colorbox_load js. Making sure true/false is bool and not string.
parent 5906327f
......@@ -6,16 +6,28 @@ Drupal.behaviors.initColorboxLoad = {
return;
}
$.urlParams = function (url) {
var p = [],
var p = {},
e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
q = url.split('?');
while (e = r.exec(q[1])) {
e[1] = d(e[1]);
e[2] = d(e[2]);
switch (e[2].toLowerCase()) {
case 'true':
case 'yes':
e[2] = true;
break;
case 'false':
case 'no':
e[2] = false;
break;
}
if (e[1] == 'width') { e[1] = 'innerWidth'; }
if (e[1] == 'height') { e[1] = 'innerHeight'; }
p[d(e[1])] = d(e[2]);
p[e[1]] = e[2];
}
return p;
};
......@@ -23,9 +35,8 @@ Drupal.behaviors.initColorboxLoad = {
.filter('.colorbox-load')
.once('init-colorbox-load-processed', function () {
var params = $.urlParams($(this).attr('href'));
$.extend(settings.colorbox, params);
})
.colorbox(settings.colorbox);
$(this).colorbox($.extend({}, settings.colorbox, params));
});
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment