PageSourceSearch

https://shopping.chiefarchitect.com/js/mage/cookies.js

js chiefarchitect.com collected 2026-09-24 10:19:37 UTC 2,597 bytes, 78 lines download raw bytes

1/**
2 * Magento
3 *
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the Academic Free License (AFL 3.0)
7 * that is bundled with this package in the file LICENSE_AFL.txt.
8 * It is also available through the world-wide-web at this URL:
9 * http://opensource.org/licenses/afl-3.0.php
10 * If you did not receive a copy of the license and are unable to
11 * obtain it through the world-wide-web, please send an email
12 * to [email protected] so we can send you a copy immediately.
13 *
14 * DISCLAIMER
15 *
16 * Do not edit or add to this file if you wish to upgrade Magento to newer
17 * versions in the future. If you wish to customize Magento for your
18 * needs please refer to http://www.magento.com for more information.
19 *
20 * @category    Mage
21 * @package     js
22 * @copyright   Copyright (c) 2006-2018 Magento, Inc. (http://www.magento.com)
23 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
24 */
25// old school cookie functions grabbed off the web
26
27if (!window.Mage) var Mage = {};
28
29Mage.Cookies = {};
30Mage.Cookies.expires  = null;
31Mage.Cookies.path     = '/';
32Mage.Cookies.domain   = null;
33Mage.Cookies.secure   = false;
34Mage.Cookies.set = function(name, value){
35     var argv = arguments;
36     var argc = arguments.length;
37     var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires;
38     var path = (argc > 3) ? argv[3] : Mage.Cookies.path;
39     var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain;
40     var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure;
41     document.cookie = name + "=" + escape (value) +
42       ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
43       ((path == null) ? "" : ("; path=" + path)) +
44       ((domain == null) ? "" : ("; domain=" + domain)) +
45       ((secure == true) ? "; secure" : "");
46};
47
48Mage.Cookies.get = function(name){
49    var arg = name + "=";
50    var alen = arg.length;
51    var clen = document.cookie.length;
52    var i = 0;
53    var j = 0;
54    while(i < clen){
55        j = i + alen;
56        if (document.cookie.substring(i, j) == arg)
57            return Mage.Cookies.getCookieVal(j);
58        i = document.cookie.indexOf(" ", i) + 1;
59        if(i == 0)
60            break;
61    }
62    return null;
63};
64
65Mage.Cookies.clear = function(name) {
66  if(Mage.Cookies.get(name)){
67    document.cookie = name + "=" +
68    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
69  }
70};
71
72Mage.Cookies.getCookieVal = function(offset){
73   var endstr = document.cookie.indexOf(";", offset);
74   if(endstr == -1){
75       endstr = document.cookie.length;
76   }
77   return unescape(document.cookie.substring(offset, endstr));
78};

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.