Bugzilla – Attachment 98050 Details for
Bug 23944
Phase out use of jquery.cookie.js in favor of js.cookie.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23944: Phase out use of jquery.cookie.js in favor of js.cookie.js
Bug-23944-Phase-out-use-of-jquerycookiejs-in-favor.patch (text/plain), 9.56 KB, created by
Katrin Fischer
on 2020-01-29 07:21:15 UTC
(
hide
)
Description:
Bug 23944: Phase out use of jquery.cookie.js in favor of js.cookie.js
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-01-29 07:21:15 UTC
Size:
9.56 KB
patch
obsolete
>From c2f2c8c2ecdad4cc45ba6577da9bf9a5a282850c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 1 Nov 2019 13:00:03 +0000 >Subject: [PATCH] Bug 23944: Phase out use of jquery.cookie.js in favor of > js.cookie.js > >This patch adds a new JavaScript file to the staff client's global >JavaScript include file: js.cookie-2.2.1.min.js. This "plugin" will >replace jquery.cookie.js which is no longer maintained. > >The "About" page in the staff client is updated to include this new >resource as well as adding previously-missing information about the old >plugin which will remain until all instances of its usage have been >removed. > >To test, apply the patch and check the About page to confirm the correct >information is included. > >No functionality change is introduced by this bug. The only other >observable change is the existence of the new files and the inclusion of >the minified version of the file in any staff client page. > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.js | 163 +++++++++++++++++++++ > .../lib/js-cookie/js.cookie-2.2.1.min.js | 3 + > .../intranet-tmpl/prog/en/includes/js_includes.inc | 1 + > koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 6 + > 4 files changed, 173 insertions(+) > create mode 100644 koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.js > create mode 100644 koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.min.js > >diff --git a/koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.js b/koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.js >new file mode 100644 >index 0000000000..80a755124a >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.js >@@ -0,0 +1,163 @@ >+/*! >+ * JavaScript Cookie v2.2.1 >+ * https://github.com/js-cookie/js-cookie >+ * >+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack >+ * Released under the MIT license >+ */ >+;(function (factory) { >+ var registeredInModuleLoader; >+ if (typeof define === 'function' && define.amd) { >+ define(factory); >+ registeredInModuleLoader = true; >+ } >+ if (typeof exports === 'object') { >+ module.exports = factory(); >+ registeredInModuleLoader = true; >+ } >+ if (!registeredInModuleLoader) { >+ var OldCookies = window.Cookies; >+ var api = window.Cookies = factory(); >+ api.noConflict = function () { >+ window.Cookies = OldCookies; >+ return api; >+ }; >+ } >+}(function () { >+ function extend () { >+ var i = 0; >+ var result = {}; >+ for (; i < arguments.length; i++) { >+ var attributes = arguments[ i ]; >+ for (var key in attributes) { >+ result[key] = attributes[key]; >+ } >+ } >+ return result; >+ } >+ >+ function decode (s) { >+ return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); >+ } >+ >+ function init (converter) { >+ function api() {} >+ >+ function set (key, value, attributes) { >+ if (typeof document === 'undefined') { >+ return; >+ } >+ >+ attributes = extend({ >+ path: '/' >+ }, api.defaults, attributes); >+ >+ if (typeof attributes.expires === 'number') { >+ attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); >+ } >+ >+ // We're using "expires" because "max-age" is not supported by IE >+ attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; >+ >+ try { >+ var result = JSON.stringify(value); >+ if (/^[\{\[]/.test(result)) { >+ value = result; >+ } >+ } catch (e) {} >+ >+ value = converter.write ? >+ converter.write(value, key) : >+ encodeURIComponent(String(value)) >+ .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); >+ >+ key = encodeURIComponent(String(key)) >+ .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent) >+ .replace(/[\(\)]/g, escape); >+ >+ var stringifiedAttributes = ''; >+ for (var attributeName in attributes) { >+ if (!attributes[attributeName]) { >+ continue; >+ } >+ stringifiedAttributes += '; ' + attributeName; >+ if (attributes[attributeName] === true) { >+ continue; >+ } >+ >+ // Considers RFC 6265 section 5.2: >+ // ... >+ // 3. If the remaining unparsed-attributes contains a %x3B (";") >+ // character: >+ // Consume the characters of the unparsed-attributes up to, >+ // not including, the first %x3B (";") character. >+ // ... >+ stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; >+ } >+ >+ return (document.cookie = key + '=' + value + stringifiedAttributes); >+ } >+ >+ function get (key, json) { >+ if (typeof document === 'undefined') { >+ return; >+ } >+ >+ var jar = {}; >+ // To prevent the for loop in the first place assign an empty array >+ // in case there are no cookies at all. >+ var cookies = document.cookie ? document.cookie.split('; ') : []; >+ var i = 0; >+ >+ for (; i < cookies.length; i++) { >+ var parts = cookies[i].split('='); >+ var cookie = parts.slice(1).join('='); >+ >+ if (!json && cookie.charAt(0) === '"') { >+ cookie = cookie.slice(1, -1); >+ } >+ >+ try { >+ var name = decode(parts[0]); >+ cookie = (converter.read || converter)(cookie, name) || >+ decode(cookie); >+ >+ if (json) { >+ try { >+ cookie = JSON.parse(cookie); >+ } catch (e) {} >+ } >+ >+ jar[name] = cookie; >+ >+ if (key === name) { >+ break; >+ } >+ } catch (e) {} >+ } >+ >+ return key ? jar[key] : jar; >+ } >+ >+ api.set = set; >+ api.get = function (key) { >+ return get(key, false /* read as raw */); >+ }; >+ api.getJSON = function (key) { >+ return get(key, true /* read as json */); >+ }; >+ api.remove = function (key, attributes) { >+ set(key, '', extend(attributes, { >+ expires: -1 >+ })); >+ }; >+ >+ api.defaults = {}; >+ >+ api.withConverter = init; >+ >+ return api; >+ } >+ >+ return init(function () {}); >+})); >diff --git a/koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.min.js b/koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.min.js >new file mode 100644 >index 0000000000..f5f4c36c17 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/lib/js-cookie/js.cookie-2.2.1.min.js >@@ -0,0 +1,3 @@ >+/*! js-cookie v2.2.1 | MIT */ >+ >+!function(a){var b;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(a){return a.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function c(d){function e(){}function f(b,c,f){if("undefined"!=typeof document){f=a({path:"/"},e.defaults,f),"number"==typeof f.expires&&(f.expires=new Date(1*new Date+864e5*f.expires)),f.expires=f.expires?f.expires.toUTCString():"";try{var g=JSON.stringify(c);/^[\{\[]/.test(g)&&(c=g)}catch(j){}c=d.write?d.write(c,b):encodeURIComponent(c+"").replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(b+"").replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var h="";for(var i in f)f[i]&&(h+="; "+i,!0!==f[i]&&(h+="="+f[i].split(";")[0]));return document.cookie=b+"="+c+h}}function g(a,c){if("undefined"!=typeof document){for(var e={},f=document.cookie?document.cookie.split("; "):[],g=0;g<f.length;g++){var h=f[g].split("="),i=h.slice(1).join("=");c||'"'!==i.charAt(0)||(i=i.slice(1,-1));try{var j=b(h[0]);if(i=(d.read||d)(i,j)||b(i),c)try{i=JSON.parse(i)}catch(k){}if(e[j]=i,a===j)break}catch(k){}}return a?e[a]:e}}return e.set=f,e.get=function(a){return g(a,!1)},e.getJSON=function(a){return g(a,!0)},e.remove=function(b,c){f(b,"",a(c,{expires:-1}))},e.defaults={},e.withConverter=c,e}return c(function(){})}); >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index f2ee27411b..daf0dc7935 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -19,6 +19,7 @@ > [% Asset.js("lib/jquery/jquery-ui-1.11.4.min.js") | $raw %] > [% Asset.js("lib/shortcut/shortcut.js") | $raw %] > [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %] >+[% Asset.js("lib/js-cookie/js.cookie-2.2.1.min.js") | $raw %] > [% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %] > [% Asset.js("lib/bootstrap/bootstrap.min.js") | $raw %] > [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index c612e90b51..1c94254b6c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -710,6 +710,12 @@ > > <h2>Verovio</h2> > <p><a href="https://www.verovio.org/index.xhtml">Verovio is developed by the Swiss RISM Office with the support of the Swiss National Science Foundation, licensed under the <a href="http://www.gnu.org/licenses/lgpl-3.0.html">LGPL v3.0</a>.</p> >+ >+ <h2>jquery.cookie</h2> >+ <p><a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a> by Klaus Hartl is a jQuery plugin for setting, reading, and deleting browser cookies, licensed under the <a href="https://github.com/carhartl/jquery-cookie/blob/master/MIT-LICENSE.txt">MIT license</a>.</p> >+ >+ <h2>JavaScript Cookie</h2> >+ <p><a href="https://github.com/js-cookie/js-cookie">JavaScript Cookie</a> is a "simple, lightweight JavaScript API for handling cookies," licensed under the <a href="https://github.com/js-cookie/js-cookie/blob/master/LICENSE">MIT license</a>.</p> > </div> > > <div id="translations"> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23944
:
94951
|
94953
|
96826
|
96827
|
97937
|
97938
| 98050 |
98051