diff options
author | Phy <git@phy25.com> | 2019-03-13 18:27:33 -0400 |
---|---|---|
committer | Phy <git@phy25.com> | 2019-03-13 18:27:33 -0400 |
commit | fe36a27b514198b045f9b92daa1c0252bd4680c3 (patch) | |
tree | 42772ed860405a91f57a7962d9a0f60d8614ee87 /lib/scripts/cookie.js | |
parent | bded2f50427c1a29306e13bec420fd7804b75718 (diff) | |
download | dokuwiki-fe36a27b514198b045f9b92daa1c0252bd4680c3.tar.gz dokuwiki-fe36a27b514198b045f9b92daa1c0252bd4680c3.zip |
cookie.js when setValue‘s value parameter is false delete entry
Diffstat (limited to 'lib/scripts/cookie.js')
-rw-r--r-- | lib/scripts/cookie.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/scripts/cookie.js b/lib/scripts/cookie.js index 4fb9c25f7..e260e5919 100644 --- a/lib/scripts/cookie.js +++ b/lib/scripts/cookie.js @@ -22,8 +22,13 @@ var DokuCookie = { var text = [], _this = this; this.init(); - val = val + ""; - this.data[key] = val; + if (val === false){ + delete this.data[key]; + }else{ + val = val + ""; + this.data[key] = val; + } + //save the whole data array jQuery.each(_this.data, function (key, val) { @@ -42,7 +47,7 @@ var DokuCookie = { */ getValue: function(key, def){ this.init(); - return key in this.data ? this.data[key] : def; + return this.data.hasOwnProperty(key) ? this.data[key] : def; }, /** |