diff options
Diffstat (limited to 'lib/scripts/cookie.js')
-rw-r--r-- | lib/scripts/cookie.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/scripts/cookie.js b/lib/scripts/cookie.js index 4dd77beea..c70d0bb56 100644 --- a/lib/scripts/cookie.js +++ b/lib/scripts/cookie.js @@ -9,7 +9,7 @@ * @author Andreas Gohr <andi@splitbrain.org> * @author Michal Rezler <m.rezler@centrum.cz> */ -DokuCookie = { +var DokuCookie = { data: {}, name: 'DOKU_PREFS', @@ -19,17 +19,18 @@ DokuCookie = { * @author Andreas Gohr <andi@splitbrain.org> */ setValue: function(key,val){ - var text = ''; + var text = [], + _this = this; this.init(); this.data[key] = val; //save the whole data array - jQuery.each(this.data, function (key, val) { - if (DokuCookie.data.hasOwnProperty(key)) { - text += '#'+encodeURIComponent(key)+'#'+encodeURIComponent(val); - } + jQuery.each(_this.data, function (key, val) { + if (_this.data.hasOwnProperty(key)) { + text.push(encodeURIComponent(key)+'#'+encodeURIComponent(val)); + } }); - jQuery.cookie(this.name,text.substr(1), {expires: 365, path: DOKU_BASE}); + jQuery.cookie(this.name, text.join('#'), {expires: 365, path: DOKU_BASE}); }, /** |