Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Converted eval usage to native Javascript. Fixes #57 #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions jquery.carouFredSel-6.2.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@
// callback function for specific option
if (is_function(b))
{
var val = eval('opts.'+a);
var val = get_set_path(opts, a);
if (is_undefined(val))
{
val = '';
Expand All @@ -2065,14 +2065,14 @@
else if (!is_undefined(b))
{
if (typeof c !== 'boolean') c = true;
eval('opts_orig.'+a+' = b');
get_set_path(opts_orig, a, b);
if (c !== false) reInit = true;
else eval('opts.'+a+' = b');
else get_set_path(opts, a, b);
}
// return value for specific option
else
{
return eval('opts.'+a);
return get_set_path(opts, a);
}
}
if (reInit)
Expand Down Expand Up @@ -4159,6 +4159,13 @@
}

// helper functions
function get_set_path(object, path, value) {
path = path.split('.')
var key = path.pop();
var target = path.reduce(function (target, key) { return target[key] }, object);

return is_undefined(value) ? target[key] : target[key] = value;
}
function is_null(a) {
return (a === null);
}
Expand Down Expand Up @@ -4252,4 +4259,4 @@
});


})(jQuery);
})(jQuery);