From 35bec75d66637bd3c4cff499ed7fb534b8d09f35 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Tue, 10 Dec 2013 19:12:01 +0200 Subject: [PATCH] Bug 11369 - Updating the jquery.cookie.js-plugin The current jquery.cookie-plugin crashes when trying to fetch all cookies using $.cookie(); Downloaded the newest plugin version and minified it. Now works as intended. Encountered an issue with the plugin now returning null when no cookies are found, and applied a fix in browser.js. ------------- - Test plan - ------------- Plugin is used in browser.js and batchMod.js so testing both Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Signed-off-by: Galen Charlton --- koha-tmpl/intranet-tmpl/js/browser.js | 5 ++++- .../intranet-tmpl/lib/jquery/plugins/jquery.cookie.min.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js index fd99bb1ab2..c3c151653a 100644 --- a/koha-tmpl/intranet-tmpl/js/browser.js +++ b/koha-tmpl/intranet-tmpl/js/browser.js @@ -5,7 +5,10 @@ KOHA.browser = function (searchid, biblionumber) { this.searchid = searchid; if (me.searchid) { - me.searchCookie = JSON.parse($.cookie(searchid)); + var cookie = $.cookie(searchid) + if (cookie) { + me.searchCookie = JSON.parse(cookie); + } } var browseRecords = function (searchid, movement) { diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.cookie.min.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.cookie.min.js index eb129db969..2ec98c020c 100644 --- a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.cookie.min.js +++ b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.cookie.min.js @@ -1 +1 @@ -jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h