1/** 2A complete cookies reader/writer framework with full unicode support. 3@from https://developer.mozilla.org/en-US/docs/Web/API/document.cookie 4@info https://developer.mozilla.org/en-US/docs/DOM/document.cookie 5 6This framework is released under the GNU Public License, version 3 or later. 7http://www.gnu.org/licenses/gpl-3.0-standalone.html 8*/ 9var cookieMonster = { 10 get: function (sKey) { 11 return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; 12 }, 13 set: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) { 14 if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } 15 var sExpires = ""; 16 if (vEnd) { 17 switch (vEnd.constructor) { 18 case Number: 19 sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; 20 break; 21 case String: 22 sExpires = "; expires=" + vEnd; 23 break; 24 case Date: 25 sExpires = "; expires=" + vEnd.toUTCString(); 26 break; 27 } 28 } 29 document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); 30 return true; 31 }, 32 remove: function (sKey, sPath, sDomain) { 33 if (!sKey || !this.has(sKey)) { return false; } 34 document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + ( sDomain ? "; domain=" + sDomain : "") + ( sPath ? "; path=" + sPath : ""); 35 return true; 36 }, 37 has: function (sKey) { 38 return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie); 39 } 40};
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.