1/** 2 * get object from cookie 3 * @param cname 4 * @returns {any} 5 */ 6function getCookie(cname) { 7 return cookieLite(cname); 8} 9 10/** 11 * set object to cookie 12 * @param cname 13 * @param cvalue 14 * @param exdays 15 * @param path 16 * @param domain 17 * @param secure 18 * @param sameSiteValue 19 */ 20function setCookie(cname, cvalue, exdays, path = '/', domain = '', secure = false, sameSiteValue = '') { 21 cookieLite(cname, cvalue, (exdays * 24 * 60 * 60), path, domain, secure, sameSiteValue); 22} 23// matsch: copied from browser-cookie-banner; turned this into a properly exported function 24 25/* 26* @version 1.0.4 27* @date 2015-03-13 28* @stability 3 - Stable 29* @author Lauri Rooden <[email protected]> 30* @license MIT License 31*/ 32 33function cookieLite (name, value, ttl, path, domain, secure, sameSite) { 34 35 if (arguments.length > 1) { 36 return document.cookie = name + "=" + encodeURIComponent(value) + 37 (ttl ? "; expires=" + new Date(+new Date() + (ttl * 1000)).toUTCString() : "") + 38 (path ? "; path=" + path : "") + 39 (domain ? "; domain=" + domain : "") + 40 (secure ? "; secure" : "") + 41 (sameSite ? "; SameSite=" + sameSite : ""); 42 } 43 44 return decodeURIComponent((("; " + document.cookie).split("; " + name + "=")[1] || "").split(";")[0]); 45}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.