PageSourceSearch

https://www.memphis.edu/_resources/js/cookie/load.js

js memphis.edu collected 2026-10-01 08:51:23 UTC 7,571 bytes, 264 lines download raw bytes

1(function (window, undefined){
2	"use strict";
3	
4	var document = window.document;
5	
6	function log() {
7		if (window.console && window.console.log) {
8			for (var x in arguments) {
9				if (arguments.hasOwnProperty(x)) {
10					window.console.log(arguments[x]);
11				}
12			}
13		}
14	}
15	
16	function AcceptCookie() {
17		if (!(this instanceof AcceptCookie)) {
18			return new AcceptCookie();
19		}
20				
21		this.init.call(this);
22		
23		return this;
24	}
25	
26	AcceptCookie.prototype = {
27		
28		init: function () {
29			var self = this;
30			
31			if(self.readCookie('pjAcceptCookie') == null)
32			{
33				self.appendCss();
34				self.addCookieBar();
35			}
36			
37			var clear_cookie_arr = self.getElementsByClass("pjClearCookie", null, "a");
38			if(clear_cookie_arr.length > 0)
39			{
40				self.addEvent(clear_cookie_arr[0], "click", function (e) {
41					if (e.preventDefault) {
42						e.preventDefault();
43					}
44					self.eraseCookie('pjAcceptCookie');
45					document.location.reload();
46					return false;
47				});
48			}
49		},
50		getElementsByClass: function (searchClass, node, tag) {
51			var classElements = new Array();
52			if (node == null) {
53				node = document;
54			}
55			if (tag == null) {
56				tag = '*';
57			}
58			var els = node.getElementsByTagName(tag);
59			var elsLen = els.length;
60			var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
61			for (var i = 0, j = 0; i < elsLen; i++) {
62				if (pattern.test(els[i].className)) {
63					classElements[j] = els[i];
64					j++;
65				}
66			}
67			return classElements;
68		},
69		addEvent: function (obj, type, fn) {
70			if (obj.addEventListener) {
71				obj.addEventListener(type, fn, false);
72			} else if (obj.attachEvent) {
73				obj["e" + type + fn] = fn;
74				obj[type + fn] = function() { obj["e" + type + fn](window.event); };
75				obj.attachEvent("on" + type, obj[type + fn]);
76			} else {
77				obj["on" + type] = obj["e" + type + fn];
78			}
79		},
80		createCookie: function (name, value, days){
81			var expires;
82		    if (days) {
83		        var date = new Date();
84		        date.setTime(date.getTime()+(days*24*60*60*1000));
85		        expires = "; expires="+date.toGMTString();
86		    } else {
87		        expires = "";
88		    }
89		    document.cookie = name+"="+value+expires+"; path=/";
90		},
91		readCookie: function (name) {
92		    var nameEQ = name + "=";
93		    var ca = document.cookie.split(';');
94		    for(var i=0;i < ca.length;i++) {
95		        var c = ca[i];
96		        while (c.charAt(0) === ' ') {
97		            c = c.substring(1,c.length);
98		        }
99		        if (c.indexOf(nameEQ) === 0) {
100		            return c.substring(nameEQ.length,c.length);
101		        }
102		    }
103		    return null;
104		},
105		eraseCookie: function (name) {
106			var self = this;
107			self.createCookie(name,"",-1);
108		},
109		appendCss: function() {
110			var self = this;
111
112			var cssCode = "";
113
114			// Begin banner styling correction | seh 7.16.2026
115			
116			// --- BASE BANNER WRAPPER ---
117			cssCode += "#pjAcceptCookieBar {";
118			cssCode += "position: sticky;";
119			cssCode += "top: 0;";
120			cssCode += "z-index: 9999;";
121			cssCode += "width: 100%;";
122			cssCode += "padding: 1rem 1.5rem;";
123			cssCode += "background-image: url('/_resources/images/patterns/tiger-white-lg.svg');";
124			cssCode += "background-size: cover;";
125			cssCode += "background-position: center;";
126			cssCode += "background-repeat: no-repeat;";
127			cssCode += "background-color: #5F6363;";
128			cssCode += "box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);";
129			cssCode += "color: #FFFFFF;";
130			cssCode += "}";
131
132			// --- INNER CONTAINER ---
133			cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarShell {";
134			cssCode += "max-width: 1200px;";
135			cssCode += "margin: 0 auto;";
136			cssCode += "padding: 0;";
137			cssCode += "display: flex;";
138			cssCode += "align-items: center;";
139			cssCode += "justify-content: space-between;";
140			cssCode += "gap: 1.5rem;";
141			cssCode += "text-align: left;";
142			cssCode += "}";
143
144			// --- TEXT ---
145			cssCode += "#pjAcceptCookieBar a {";
146			cssCode += "color: #FFFFFF;";
147			cssCode += "text-decoration: underline;";
148			cssCode += "}";
149
150			// --- TEXT CONTENT ---
151			cssCode += "#pjAcceptCookieBar p {";
152			cssCode += "margin: 0;";
153			cssCode += "font-size: 1rem;";
154			cssCode += "line-height: 1.5;";
155			cssCode += "text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);";
156			cssCode += "}";
157
158			// --- ACTIONS ---
159			cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarActions {";
160			cssCode += "flex: 0 0 auto;";
161			cssCode += "}";
162
163			// --- BUTTON ---
164			cssCode += "#pjAcceptCookieBar button {";
165			cssCode += "border: none;";
166			cssCode += "white-space: nowrap;";
167			cssCode += "}";
168
169			// --- MOBILE ---
170			cssCode += "@media (max-width: 767px) {";
171			cssCode += "#pjAcceptCookieBar {";
172			cssCode += "padding: 0.75rem;";
173			cssCode += "}";
174			cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarShell {";
175			cssCode += "flex-direction: column;";
176			cssCode += "margin-bottom: -10px;";
177			cssCode += "align-items: stretch;";
178			cssCode += "gap: 0.5rem;";
179			cssCode += "text-align: left;";
180			cssCode += "}";
181			cssCode += "#pjAcceptCookieBar p {";
182			cssCode += "font-size: 0.95rem;";
183			cssCode += "line-height: 1.35;";
184			cssCode += "}";
185			cssCode += "#pjAcceptCookieBar button {";
186			cssCode += "width: 100%;";
187			cssCode += "}";
188			cssCode += "}";
189			
190			// End banner styling correction 
191
192			var styleElement = document.createElement("style");
193			styleElement.type = "text/css";
194			styleElement.appendChild(document.createTextNode(cssCode));
195			document.head.appendChild(styleElement);
196		},
197
198		addCookieBar: function() {
199			var htmlBar = "";
200
201			htmlBar += '<div class="pjAcceptCookieBarShell" role="region" aria-label="Cookie consent notice">';
202			htmlBar += '  <p>';
203			htmlBar += '    The University of Memphis uses cookies to enhance your website experience. For more information, visit our <a href="/privacy/">Cookie Policy</a>. ';
204			htmlBar += '    By continuing to use this site, you consent to our use of cookies. ';
205			htmlBar += '    <a href="/notice/">More information</a> >';
206			htmlBar += '  </p>';
207			htmlBar += '<div class="pjAcceptCookieBarActions">';
208			htmlBar += '<button id="pjAcceptCookieBarBtn" type="button" class="pjAcceptCookieBarBtn d-btn btn-primary">I Agree</button>';
209			htmlBar += '<button type="submit" class="pjAcceptCookieBarBtn" style=\'display:none;\'>&nbsp;</button>';
210			htmlBar += '</div>';
211			htmlBar += '</div>';
212
213			var barDiv = document.createElement("div");
214			barDiv.id = "pjAcceptCookieBar";
215			
216			// Begin tab order correction | seh 7.16.2026
217			
218			barDiv.innerHTML = htmlBar;
219			var skipLink = document.querySelector(
220				'a.skip-link, a[href="#main-content"], a[href="#main"]'
221			);
222
223			if (skipLink && skipLink.parentNode === document.body) {
224				skipLink.insertAdjacentElement("afterend", barDiv);
225			} else {
226				document.body.insertBefore(barDiv, document.body.firstChild);
227			}
228			
229			// End tab order correction
230			
231			// --- MODAL BODY OPTION ---
232			//document.body.classList.add("cookie-banner-open");
233
234			this.bindCookieBar();
235		},
236
237		bindCookieBar: function(){
238			var self = this;
239			var btn_arr = self.getElementsByClass("pjAcceptCookieBarBtn", null, "button");
240			if(btn_arr.length > 0)
241			{
242				self.addEvent(btn_arr[0], "click", function (e) {
243					if (e.preventDefault) {
244						e.preventDefault();
245					}
246					self.createCookie('pjAcceptCookie', 'YES', 365);
247					
248					// --- MODAL BODY OPTION ---
249					//document.body.classList.remove("cookie-banner-open");
250					
251					document.getElementById("pjAcceptCookieBar").remove();
252					
253					return false;
254				});
255			}
256		}
257	};
258	
259	window.AcceptCookie = AcceptCookie;	
260})(window);
261
262window.onload = function() {
263	AcceptCookie = AcceptCookie();
264}

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.