PageSourceSearch

https://qsupport.quantum.com/kb/flare/Content/doc_portal/Content/docs-portal/Scripts/createQTMUpdHeader.js

js quantum.com collected 2026-10-02 04:26:07 UTC 18,719 bytes, 545 lines download raw bytes

1// JavaScript source code
2// Create the XHR object.
3//var urlprefix = "https://qntm02mstre747hinte.dxcloud.episerver.net/";
4//urlprefix = "https://qntm02mstre747hprep.dxcloud.episerver.net/";
5//urlprefix = "https://qntm02mstre747hprod-slot.dxcloud.episerver.net/";
6var urlprefix = "https://qntm02mstr2ij5p7inte.dxcloud.episerver.net/";
7 //urlprefix = "https://localhost:44397/";
8 urlprefix = "https://www.quantum.com/";
9
10function createCORSRequest(method, url) {
11    var xhr = new XMLHttpRequest();
12    if ("withCredentials" in xhr) {
13        // XHR for Chrome/Firefox/Opera/Safari.
14        xhr.open(method, url, true);
15    } else if (typeof XDomainRequest != "undefined") {
16        // XDomainRequest for IE.
17        xhr = new XDomainRequest();
18        xhr.open(method, url);
19    } else {
20        // CORS not supported.
21        xhr = null;
22    }
23    return xhr;
24}
25
26// Helper method to parse the title tag from the response.
27function getTitle(text) {
28    return text.match('<title>(.*)?</title>')[1];
29}
30
31// Make the actual CORS request.
32function makeCorsRequest() {
33    var url = urlprefix + 'en/ext-header-page/';   
34  
35    var xhr = createCORSRequest('GET', url);
36
37    if (!xhr) {
38        alert('CORS not supported');
39        return;
40    }
41
42    // Response handlers.
43    xhr.onload = function () {
44        var text = xhr.responseText;
45        //var title = getTitle(text);
46        //alert('Response from CORS request to ' + url + ': ' + title);
47        //var MyDiv = document.getElementById('header-ext')        
48        //MyDiv.innerHTML = text;       
49        //console.log(text);
50        //$('body').prepend(text);
51        /*var theDiv = document.getElementById("header-ext");
52        var content = document.createTextNode(text);
53        theDiv.appendChild(content);
54        */
55        //$('#header-ext').append(text)
56        document.body.innerHTML = text + document.body.innerHTML;
57        //var body = document.body || document.getElementsByTagName('body')[0],
58        //    newpar = document.createElement('div');
59        //newpar.innerHTML = text;
60        fixheader();
61    };
62
63    xhr.onerror = function () {
64        alert('Woops, there was an error making the request when retrieving Header.');
65    };
66    xhr.send();
67}
68
69function makeAnotherCorsRequest() {   
70    var url2 = urlprefix + 'en/ext-footer-page/';    
71   
72    var xhr2 = createCORSRequest('GET',  url2);  
73    if (!xhr2) {
74        alert('CORS not supported');
75        return;
76    }
77
78    // Response handlers.
79    xhr2.onload = function () {
80        var text = xhr2.responseText;      
81        var MyDiv = document.getElementById('footer-ext')       
82     
83        MyDiv.innerHTML = text;      
84        //MyDiv.append(text);
85       
86    };
87
88
89    xhr2.onerror = function () {
90        alert('Woops, there was an error making the request when retrieving Footer.');
91    };
92
93    xhr2.send();
94}
95
96function fixheader() {
97	
98    $('ul.tabs li').click(function () {
99        var tab_id = $(this).attr('data-tab');
100
101        $('ul.tabs li').removeClass('current');
102        $('.tab-content').removeClass('current');
103
104        $(this).addClass('current');
105        $("#" + tab_id).addClass('current');
106    })
107
108    //DESKTOP MENU FUNCTIONALITY
109    $('.megamenu').hide();
110    $('.dropdown_megamenus').hide();
111    $('[data-submenu]').click(function () {
112        if ($(this).hasClass("active")) {
113            $(this).removeClass("active")
114            $('.megamenu').hide();
115            $('.dropdown_megamenus').hide();
116            $('.dropdown_megamenus').addClass("hidden");
117        } else {
118            $('.dropdown_megamenus').show();
119            $('.dropdown_megamenus').removeClass("hidden");
120            $("#cd-primary-nav li a").removeClass("active")
121            $(this).addClass("active")
122            $('.megamenu').hide();
123            var target = $(this).data('submenu');
124            $("#" + target).show();
125        }
126    });
127
128    //MOBILE MENU FUNCTIONALITY
129    $(".menu-name").hide();
130    // mobile-menu-primary-container
131	$('.mobile-menu-secondary-container').hide();
132	$('[data-submenu-mobile]').click(function () {
133		$('.mobile-menu-primary-container').hide();
134		$('.logo_mobile_svg').hide();
135		$('header').css('justify-content', 'space-between')
136		$('header').css('border-bottom', '1px solid #ebebeb')
137		var target = $(this).data('submenu-mobile');
138		$("#" + target).show();
139		$("#" + target + " ul li").first().find("a").trigger('click')
140		$(".menu-name").show();
141		var menu_text = ($(this).text());
142		$("#menu-name").text(menu_text);
143        //if (target.split("_")[0] == 'products') {
144        //    $("#menu-name").text("Products & Services");
145        //    $('#menu-name').css('textTransform', 'capitalize');
146        //} else {
147        //    $("#menu-name").text(target.split("_")[0]);
148        //    $('#menu-name').css('textTransform', 'capitalize');
149        //}
150    });
151
152    $('#menu-toggle').click(function () {
153        $(".megamenu-mobile").removeClass('hidden')
154        $('header').css('border-bottom', ' none')
155
156    })
157
158    $('#close-menu').click(function () {
159        $('header').css('border-bottom', '1px solid #ebebeb')
160        $(".megamenu-mobile").addClass('hidden');
161    })
162
163
164    $('#back-to-primary').click(function () {
165        $(".menu-name").hide()
166        $('.logo_mobile_svg').show();
167        $('header').css('justify-content', 'space-between')
168        $('header').css('border-bottom', ' none')
169        $(".mobile-menu-primary-container").show();
170        $(".mobile-menu-secondary-container").hide();
171    })
172
173    $('.secondary-has-children').click(function () {
174        if ($(this).hasClass('selected-category')) {
175            $(this).removeClass('selected-category')
176            $(this).parent().find('ul').addClass('hidden')
177        } else {
178            $('.secondary-has-children').each(function (i) {
179                $(this).removeClass('selected-category')
180            });
181            $('.secondary-submenu').each(function (i) {
182                $(this).addClass('hidden')
183            });
184            $(this).addClass('selected-category')
185            $(this).parent().find('ul').removeClass('hidden')
186        }
187    })
188
189    $(window).resize(function () {
190        let windowSize = $(window).innerWidth();
191        if (windowSize > 1180) {
192            $(".megamenu-mobile").hide();
193            $(".megamenu").removeClass('hidden');
194
195        } else {
196            $(".megamenu-mobile").show()
197            $(".megamenu").addClass('hidden');
198        }
199    });
200    $(document).on('click', function (event) {
201        var targetElement = $('.dropdown_megamenus');
202        var clickedElement = $(event.target);
203        if (!clickedElement.hasClass("active") && !targetElement.is(clickedElement) && !targetElement.has(clickedElement).length) {
204            if (!$('.dropdown_megamenus').hasClass("hidden")) {
205                $('.dropdown_megamenus').hide();
206                $('.dropdown_megamenus').addClass("hidden");
207                $("#cd-primary-nav li a").removeClass("active")
208
209            }
210        }
211    });
212
213    /* Global Popup Script */
214    $("#global").magnificPopup({
215        delegate: "a",
216        removalDelay: 500,
217        callbacks: {
218            beforeOpen: function () {
219                this.st.mainClass = this.st.el.attr("data-effect")
220            },
221            open: function () {
222                $("body").css("overflow", "hidden")
223            },
224            close: function () {
225                $("body").css("overflow", "")
226            }
227        },
228        midClick: !0
229    });
230
231
232	/* Search Script */
233	function Util() { }
234	; Util.hasClass = function (el, className) {
235		if (el.classList)
236			return el.classList.contains(className);
237		else
238			return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
239	}
240		;
241	Util.addClass = function (el, className) {
242		var classList = className.split(' ');
243		if (el.classList)
244			el.classList.add(classList[0]);
245		else if (!Util.hasClass(el, classList[0]))
246			el.className += " " + classList[0];
247		if (classList.length > 1)
248			Util.addClass(el, classList.slice(1).join(' '));
249	}
250		;
251	Util.removeClass = function (el, className) {
252		var classList = className.split(' ');
253		if (el.classList)
254			el.classList.remove(classList[0]);
255		else if (Util.hasClass(el, classList[0])) {
256			var reg = new RegExp('(\\s|^)' + classList[0] + '(\\s|$)');
257			el.className = el.className.replace(reg, ' ');
258		}
259		if (classList.length > 1)
260			Util.removeClass(el, classList.slice(1).join(' '));
261	}
262		;
263	Util.toggleClass = function (el, className, bool) {
264		if (bool)
265			Util.addClass(el, className);
266		else
267			Util.removeClass(el, className);
268	}
269		;
270	function resetFocusTabsStyle() {
271		window.dispatchEvent(new CustomEvent('initFocusTabs'));
272	}
273	; window.menuAim = function (e) {
274		!function (e) {
275			var v = null
276				, f = []
277				, p = null
278				, s = null
279				, y = Util.extend({
280					menu: "",
281					rows: !1,
282					submenuSelector: "*",
283					submenuDirection: "right",
284					tolerance: 75,
285					enter: function () { },
286					exit: function () { },
287					activate: function () { },
288					deactivate: function () { },
289					exitMenu: function () { }
290				}, e)
291				, b = y.menu
292				, t = function (e) {
293					f.push({
294						x: e.pageX,
295						y: e.pageY
296					}),
297						3 < f.length && f.shift()
298				}
299				, n = function () {
300					s && clearTimeout(s),
301						y.enter(this),
302						o(this)
303				}
304				, i = function () {
305					y.exit(this)
306				}
307				, a = function () {
308					l(this)
309				}
310				, l = function (e) {
311					e != v && (v && y.deactivate(v),
312						y.activate(e),
313						v = e)
314				}
315				, o = function (e) {
316					var t = r();
317					t ? s = setTimeout(function () {
318						o(e)
319					}, t) : l(e)
320				}
321				, r = function () {
322					if (!v || !Util.is(v, y.submenuSelector))
323						return 0;
324					var e, t = {
325						top: (e = b.getBoundingClientRect()).top + window.pageYOffset,
326						left: e.left + window.pageXOffset
327					}, s = {
328						x: t.left,
329						y: t.top - y.tolerance
330					}, n = {
331						x: t.left + b.offsetWidth,
332						y: s.y
333					}, i = {
334						x: t.left,
335						y: t.top + b.offsetHeight + y.tolerance
336					}, a = {
337						x: t.left + b.offsetWidth,
338						y: i.y
339					}, l = f[f.length - 1], o = f[0];
340					if (!l)
341						return 0;
342					if (o || (o = l),
343						o.x < t.left || o.x > a.x || o.y < t.top || o.y > a.y)
344						return 0;
345					if (p && l.x == p.x && l.y == p.y)
346						return 0;
347					function r(e, t) {
348						return (t.y - e.y) / (t.x - e.x)
349					}
350					var u = n
351						, c = a;
352					"left" == y.submenuDirection ? (u = i,
353						c = s) : "below" == y.submenuDirection ? (u = a,
354							c = i) : "above" == y.submenuDirection && (u = s,
355								c = n);
356					var d = r(l, u)
357						, h = r(l, c)
358						, m = r(o, u)
359						, g = r(o, c);
360					return d < m && g < h ? (p = l,
361						300) : (p = null,
362							0)
363				};
364			b.addEventListener("mouseleave", function () {
365				s && clearTimeout(s),
366					y.exitMenu(this) && (v && y.deactivate(v),
367						v = null)
368			});
369			var u, c = y.rows ? y.rows : b.children;
370			if (0 < c.length)
371				for (var d = 0; d < c.length; d++)
372					c[u = d].addEventListener("mouseenter", n),
373						c[u].addEventListener("mouseleave", i),
374						c[u].addEventListener("click", a);
375			document.addEventListener("mousemove", function (e) {
376				window.requestAnimationFrame ? window.requestAnimationFrame(function () {
377					t(e)
378				}) : t(e)
379			})
380		}(e)
381	}
382		,
383		function () {
384			var e = function (e) {
385				var t, i;
386				this.element = e,
387					this.search = this.element.getElementsByClassName("js-mega-nav__search"),
388					this.searchActiveController = !1,
389					this.menu = this.element.getElementsByClassName("js-mega-nav__nav"),
390					this.menuItems = this.menu[0].getElementsByClassName("js-mega-nav__item"),
391					this.menuActiveController = !1,
392					this.itemExpClass = "x-nut",
393					this.classIconBtn = "x-nor",
394					this.classSearchVisible = "x-nod",
395					this.classNavVisible = "x-nop",
396					this.classMobileLayout = "x-nof",
397					this.classDesktopLayout = "x-tmega-nav--desktopn",
398					this.layout = "mobile",
399					this.dropdown = this.element.getElementsByClassName("js-dropdown"),
400					this.expandedClass = "x-ns_",
401					s(t = this),
402					function (s) {
403						if (0 != s.search.length) {
404							s.searchToggles = document.querySelectorAll('[aria-controls="' + s.search[0].getAttribute("id") + '"]');
405							for (var e = 0; e < s.searchToggles.length; e++)
406								!function (t) {
407									s.searchToggles[t].addEventListener("click", function (e) {
408										l(s, s.search[0], "searchActiveController", s.classSearchVisible, s.searchToggles[t], !0),
409											Util.hasClass(s.menu[0], s.classNavVisible) && l(s, s.menu[0], "menuActiveController", s.classNavVisible, s.menuActiveController, !1),
410											o(s, !1),
411											u(s)
412									})
413								}(e)
414						}
415					}(t),
416					function (s) {
417						if (0 != s.menu.length) {
418							s.menuToggles = document.querySelectorAll('[aria-controls="' + s.menu[0].getAttribute("id") + '"]');
419							for (var e = 0; e < s.menuToggles.length; e++)
420								!function (t) {
421									s.menuToggles[t].addEventListener("click", function (e) {
422										l(s, s.menu[0], "menuActiveController", s.classNavVisible, s.menuToggles[t], !0),
423											Util.hasClass(s.search[0], s.classSearchVisible) && l(s, s.search[0], "searchActiveController", s.classSearchVisible, s.searchActiveController, !1),
424											u(s)
425									})
426								}(e)
427						}
428					}(t),
429					(i = t).element.addEventListener("click", function (e) {
430						var t = e.target.closest(".js-mega-nav__control");
431						if (t) {
432							var s = t.closest(".js-mega-nav__item");
433							if (s) {
434								var n = Util.hasClass(s, i.itemExpClass);
435								Util.toggleClass(s, i.itemExpClass, !n),
436									n ? t.removeAttribute("aria-expanded") : t.setAttribute("aria-expanded", "true"),
437									"desktop" != i.layout || n || o(i, s),
438									a(i, !1),
439									u(i)
440							}
441						}
442					}),
443					t.element.addEventListener("update-menu-layout", function (e) {
444						s(t)
445					})
446			};
447			function s(e) {
448				var t, s = getComputedStyle(e.element, ":before").getPropertyValue("content").replace(/\'|"/g, "");
449				s != e.layout && (e.layout = s,
450					Util.toggleClass(e.element, e.classDesktopLayout, "desktop" == e.layout),
451					Util.toggleClass(e.element, e.classMobileLayout, "desktop" != e.layout),
452					"desktop" == e.layout && (o(e, !1),
453						function (e) {
454							if (0 == e.dropdown.length)
455								return;
456							for (var t = 0; t < e.dropdown.length; t++)
457								e.dropdown[t].dispatchEvent(new CustomEvent("placeDropdown"))
458						}(e)),
459					a(e, !1),
460					t = e,
461					document.documentElement.style.setProperty("--mega-nav-offset-y", t.element.getBoundingClientRect().top + "px"),
462					u(e))
463			}
464			function n(e) {
465				a(e),
466					Util.hasClass(e.menu[0], e.classNavVisible) && l(e, e.menu[0], "menuActiveController", e.classNavVisible, e.menuActiveController, !0),
467					o(e, !1),
468					u(e)
469			}
470			function i(e) {
471				Util.hasClass(e.search[0], e.classSearchVisible) && !document.activeElement.closest(".js-mega-nav__search") && l(e, e.search[0], "searchActiveController", e.classSearchVisible, e.searchActiveController, !0),
472					Util.hasClass(e.menu[0], e.classNavVisible) && !document.activeElement.closest(".js-mega-nav__nav") && l(e, e.menu[0], "menuActiveController", e.classNavVisible, e.menuActiveController, !0);
473				for (var t = 0; t < e.menuItems.length; t++)
474					if (Util.hasClass(e.menuItems[t], e.itemExpClass)) {
475						var s = document.activeElement.closest(".js-mega-nav__item");
476						s && s == e.menuItems[t] || r(e, t)
477					}
478				u(e)
479			}
480			function a(e, t) {
481				e.search.length < 1 || Util.hasClass(e.search[0], e.classSearchVisible) && l(e, e.search[0], "searchActiveController", e.classSearchVisible, e.searchActiveController, t)
482			}
483			function l(e, t, s, n, i, a) {
484				var l = Util.hasClass(t, n);
485				Util.toggleClass(t, n, !l),
486					Util.toggleClass(i, e.classIconBtn, !l),
487					l ? i.removeAttribute("aria-expanded") : i.setAttribute("aria-expanded", "true"),
488					l ? (i && a && i.focus(),
489						e[s] = !1) : (i && (e[s] = i),
490							function (e) {
491								for (var t = e.querySelectorAll('[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex]:not([tabindex="-1"]), [contenteditable], audio[controls], video[controls], summary'), s = !1, n = 0; n < t.length; n++)
492									if (t[n].offsetWidth || t[n].offsetHeight || t[n].getClientRects().length) {
493										s = t[n];
494										break
495									}
496								return s
497							}(t).focus())
498			}
499			function o(e, t) {
500				if (0 != e.menuItems.length)
501					for (var s = 0; s < e.menuItems.length; s++)
502						e.menuItems[s] != t && r(e, s)
503			}
504			function r(e, t) {
505				Util.removeClass(e.menuItems[t], e.itemExpClass);
506				var s = e.menuItems[t].getElementsByClassName("js-mega-nav__control");
507				0 < s.length && s[0].removeAttribute("aria-expanded")
508			}
509			function u(e) {
510				0 < e.element.getElementsByClassName(e.itemExpClass).length && "desktop" == e.layout || 0 < e.element.getElementsByClassName(e.classSearchVisible).length || 0 < e.element.getElementsByClassName(e.classNavVisible).length && "mobile" == e.layout ? Util.addClass(e.element, e.expandedClass) : Util.removeClass(e.element, e.expandedClass)
511			}
512			var t, c = document.getElementsByClassName("js-mega-nav");
513			if (0 < c.length) {
514				for (var d = [], h = 0; h < c.length; h++)
515					t = h,
516						d.push(new e(c[t]));
517				window.addEventListener("keyup", function (e) {
518					if (e.keyCode && 27 == e.keyCode || e.key && "escape" == e.key.toLowerCase())
519						for (var t = 0; t < d.length; t++)
520							n(d[t]);
521					if (e.keyCode && 9 == e.keyCode || e.key && "tab" == e.key.toLowerCase())
522						for (t = 0; t < d.length; t++)
523							i(d[t])
524				}),
525					window.addEventListener("click", function (e) {
526						e.target.closest(".js-mega-nav") || n(d[0])
527					});
528				var m = !1
529					, g = new CustomEvent("update-menu-layout");
530				function v() {
531					for (var e = 0; e < d.length; e++)
532						d[e].element.dispatchEvent(g)
533				}
534				window.addEventListener("resize", function (e) {
535					clearTimeout(m),
536						m = setTimeout(v, 200)
537				})
538			}
539		}();
540
541
542
543}
544
545

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.