1/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 3Theme Name: Victoria Foundation 4Theme URI: https://victoriafoundation.bc.ca/ 5Description: Mobile and Responsive Divi Child Theme 6 - Session Script File 7Author: Trapeze.ca 8 9~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ 10 11/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 * jQuery Session.js 13 * Copyright (c) 2013 AlexChittock 14 * https://github.com/AlexChittock/JQuery-Session-Plugin 15 */ 16 17// if (!VICFO_is_ie) { 18(function ($) { 19 $.session = { 20 _id: null, 21 22 _cookieCache: undefined, 23 24 _init: function () { 25 if (!window.name) { 26 window.name = Math.random(); 27 } 28 this._id = window.name; 29 this._initCache(); 30 31 // See if we've changed protcols 32 33 var matches = new RegExp(this._generatePrefix() + "=([^;]+);").exec( 34 document.cookie 35 ); 36 if (matches && document.location.protocol !== matches[1]) { 37 this._clearSession(); 38 for (var key in this._cookieCache) { 39 try { 40 window.sessionStorage.setItem(key, this._cookieCache[key]); 41 } catch (e) {} 42 } 43 } 44 45 document.cookie = 46 this._generatePrefix() + 47 "=" + 48 document.location.protocol + 49 ";path=/;expires=" + 50 new Date(new Date().getTime() + 120000).toUTCString(); 51 }, 52 53 _generatePrefix: function () { 54 return "__session:" + this._id + ":"; 55 }, 56 57 _initCache: function () { 58 var cookies = document.cookie.split(";"); 59 this._cookieCache = {}; 60 for (var i in cookies) { 61 var kv = cookies[i].split("="); 62 if (new RegExp(this._generatePrefix() + ".+").test(kv[0]) && kv[1]) { 63 this._cookieCache[kv[0].split(":", 3)[2]] = kv[1]; 64 } 65 } 66 }, 67 68 _setFallback: function (key, value, onceOnly) { 69 var cookie = this._generatePrefix() + key + "=" + value + "; path=/"; 70 if (onceOnly) { 71 cookie += "; expires=" + new Date(Date.now() + 120000).toUTCString(); 72 } 73 document.cookie = cookie; 74 this._cookieCache[key] = value; 75 return this; 76 }, 77 78 _getFallback: function (key) { 79 if (!this._cookieCache) { 80 this._initCache(); 81 } 82 return this._cookieCache[key]; 83 }, 84 85 _clearFallback: function () { 86 for (var i in this._cookieCache) { 87 document.cookie = 88 this._generatePrefix() + 89 i + 90 "=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;"; 91 } 92 this._cookieCache = {}; 93 }, 94 95 _deleteFallback: function (key) { 96 document.cookie = 97 this._generatePrefix() + 98 key + 99 "=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;"; 100 delete this._cookieCache[key]; 101 }, 102 103 get: function (key) { 104 return window.sessionStorage.getItem(key) || this._getFallback(key); 105 }, 106 107 set: function (key, value, onceOnly) { 108 try { 109 window.sessionStorage.setItem(key, value); 110 } catch (e) { 111 // doing it after catch defeats purpose of fallback 112 this._setFallback(key, value, onceOnly || false); 113 } 114 return this; 115 }, 116 117 delete: function (key) { 118 return this.remove(key); 119 }, 120 121 remove: function (key) { 122 try { 123 window.sessionStorage.removeItem(key); 124 } catch (e) {} //here it's correct because get() returns value from any source 125 this._deleteFallback(key); 126 return this; 127 }, 128 129 _clearSession: function () { 130 try { 131 window.sessionStorage.clear(); 132 } catch (e) { 133 for (var i in window.sessionStorage) { 134 window.sessionStorage.removeItem(i); 135 } 136 } 137 }, 138 139 clear: function () { 140 this._clearSession(); 141 this._clearFallback(); 142 return this; 143 }, 144 }; 145 146 $.session._init(); 147})(jQuery); 148// };
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.