diff --git a/core/src/javascript/flowplayer.js/flowplayer-src.js b/core/src/javascript/flowplayer.js/flowplayer-src.js index c216e56..ce7373b 100644 --- a/core/src/javascript/flowplayer.js/flowplayer-src.js +++ b/core/src/javascript/flowplayer.js/flowplayer-src.js @@ -136,10 +136,27 @@ to[evt].push(fn); } - // escape & and = in config written into flashvars (issue #21) - function queryescape(url) { - return url.replace(/&/g, '%26').replace(/&/g, '%26').replace(/=/g, '%3D'); - } + // recursively cycle through config objects for queryescaping, + // i.e. escape & and = only (issues #21, #260) + // because & and = cannot be written into the Flash object on the page + function queryescape(obj) { + if (typeof obj === "string") { + return obj.replace(/&(amp;)?/g, '%26').replace(/=/g, '%3D'); + } else if (typeof obj === "object") { + if (obj.length) { + each(obj, function (i, item) { + each(item, function (key, val) { + obj[i][key] = queryescape(val); + }); + }); + } else { + each(obj, function (key, val) { + obj[key] = queryescape(val); + }); + } + } + return obj; + } // generates an unique id function makeId() { @@ -980,10 +997,6 @@ function Player(wrapper, params, conf) { conf.clip.url = wrapper.getAttribute("href", 2); } - if (conf.clip.url) { - conf.clip.url = queryescape(conf.clip.url); - } - commonClip = new Clip(conf.clip, -1, self); // playlist @@ -1000,10 +1013,6 @@ function Player(wrapper, params, conf) { clip = {url: "" + clip}; } - if (clip.url) { - clip.url = queryescape(clip.url); - } - // populate common clip properties to each clip each(conf.clip, function(key, val) { if (val !== undefined && clip[key] === undefined && typeof val != 'function') { @@ -1038,6 +1047,9 @@ function Player(wrapper, params, conf) { } }); + // queryescape string values + conf = queryescape(conf); + // plugins each(conf.plugins, function(name, val) {