1 2var individee = individee || {}; 3individee.config = individee.config || {}; 4individee.meta = individee.meta || {}; 5individee.meta.table = individee.meta.table || []; 6individee.meta.components = individee.meta.components || {}; 7individee.session = individee.session || {}; 8individee.callbacks = individee.callbacks || []; 9individee.callbackresponses = individee.callbackresponses || []; 10individee.accordion = individee.accordion || {}; 11individee.decorateObjectOnScroll = function (clazz) { 12$(window).scroll(function () { 13var nav = $('.' + clazz); 14if (nav) { 15var top = 20; 16if ($(window).scrollTop() >= top) { 17nav.addClass('scrolled'); 18} else { 19nav.removeClass('scrolled'); 20} 21} 22}); 23}; 24individee.publishEvent = function (event) { 25$('body').trigger(event); 26}; 27individee.redirect = function (url, timeout, newTab) { 28if (timeout) { 29setTimeout(function () { 30individee.openUrl(url, newTab); 31}, timeout); 32} else { 33individee.openUrl(url, newTab); 34} 35}; 36individee.openUrl = function (url, newTab) { 37if (newTab) { 38window.open(url, '_blank'); 39} else { 40window.open(url, '_self'); 41} 42}; 43individee.openTab = function (url) { 44individee.openUrl(url, true); 45}; 46individee.callWicketBehavior = function (url, timeout, ep) { 47if (timeout) { 48setTimeout(function () { 49if (!ep) { 50Wicket.Ajax.get({u: url}); 51} else { 52Wicket.Ajax.get({u: url, ep: ep}); 53} 54}, timeout); 55} else { 56if (!ep) { 57Wicket.Ajax.get({u: url}); 58} else { 59Wicket.Ajax.get({u: url, ep: ep}); 60} 61} 62}; 63individee.changeQueryParameter = function (parameter, value, reload) { 64 65var queryParameters = {}, queryString = location.search.substring(1), 66re = /([^&=]+)=([^&]*)/g, m; 67 68 while (m = re.exec(queryString)) { 69queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); 70} 71queryParameters[parameter] = value; 72 73if (reload) { 74location.search = $.param(queryParameters); 75 } else { 76var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + $.param(queryParameters); 77window.history.pushState({path: newurl}, '', newurl); 78} 79}; 80individee.submitForm = function (id) { 81$('#' + id + ' button:submit').each(function () { 82$(this).click(); 83}); 84}; 85individee.submitForms = function (clazz) { 86$('form.' + clazz + ' button:submit').each(function () { 87$(this).click(); 88}); 89}; 90individee.clearSelection = function () { 91var element = document.activeElement; 92if (element && /INPUT|TEXTAREA/i.test(element.tagName)) { 93if ('selectionStart' in element) { 94element.selectionEnd = element.selectionStart; 95} 96element.blur(); 97} 98if (window.getSelection) { 99 window.getSelection().removeAllRanges(); 100} else if (document.selection) { 101 document.selection.empty(); 102} 103}; 104individee.copyValueToClipboard = async function (value) { 105if (navigator.clipboard?.writeText) { 106await navigator.clipboard.writeText(value); 107} else { 108 109 const textarea = document.createElement("textarea"); 110textarea.value = value; 111textarea.style = "display: none"; 112document.body.appendChild(textarea); 113textarea.select(); 114document.execCommand("copy"); 115document.body.removeChild(textarea); 116} 117} 118individee.copyToClipboard = function (id, btn) { 119var copyText = document.getElementById(id); 120copyText.select(); 121document.execCommand("copy"); 122individee.clearSelection(); 123btn = $(btn); 124btn.html('<i class="fal fa-check text-success"></i>'); 125btn.prop('disabled', true); 126btn.attr('disabled', true); 127setTimeout(function () { 128btn.removeAttr('disabled'); 129btn.prop('disabled', false); 130btn.html('<i class="fal fa-copy"></i>') 131}, 2000); 132}; 133individee.addReplaceUrlParam = function (key, value) { 134var url = window.location.href; 135if (value == null) { 136value = ''; 137} 138var pattern = new RegExp('(\\?|\\&)(' + key + '=).*?(&|$)'); 139if (url.search(pattern) >= 0) { 140url = url.replace(pattern, '$1$2' + value + '$3'); 141} else { 142url += (url.indexOf('?') > 0 ? '&' : '?') + key + '=' + value; 143} 144window.history.replaceState(null, null, url); 145}; 146individee.activateTooltips = function (id) { 147var selector = id ? '#' + id + ' ' : ''; 148selector = selector + '[data-toggle="tooltip"]'; 149$(selector).tooltip(); 150if (!id) { 151$(document).on('shown.bs.modal', function (e) { 152$('#' + e.target.id + ' [data-toggle="tooltip"]').tooltip(); 153}); 154$(document).on('shown.ii.canvas', function (e) { 155$('#' + e.target.id + ' [data-toggle="tooltip"]').tooltip(); 156}); 157} 158}; 159individee.hideAllTooltips = function () { 160$(".tooltip.show").remove(); 161}; 162individee.getComponents = function (type) { 163return $('*[data-template-type="' + type + '"]'); 164}; 165individee.getComponentIds = function (type) { 166var ids = []; 167individee.getComponents(type).each(function () { 168var id = $(this).attr('id'); 169if (id) { 170ids.push(id); 171} 172}); 173return ids; 174}; 175individee.publishParameters = function (parameters) { 176try { 177individee.meta.parameters = parameters; 178} catch (ex) { 179console.warn(ex); 180} 181}; 182individee.publishComponentTypes = function (components) { 183try { 184individee.meta.components = components; 185} catch (ex) { 186console.warn(ex); 187} 188}; 189individee.publishTable = function (id, array) { 190try { 191individee.meta.table[id] = array; 192} catch (ex) { 193console.warn(ex); 194} 195}; 196$(document).ready(function () { 197$('div[data-activate-scroll-spy="true"]').each(function () { 198$('body').css('position', 'relative'); 199$('body').scrollspy({target: '#' + $(this).attr('id'), offset: 150}); 200}); 201if ($(window).width() >= 768) { 202$('.fixed-container').each(function () { 203$(this).stick_in_parent({ 204offset_top: $('#main-nav').outerHeight(false) - 2 205}); 206}); 207} 208higlightCurrentNavigationPosition(); 209disableWizardTabs(); 210checkForTransparentNav(); 211activateSmoothScrollOnAnchorLinks(); 212makeContainersSameHeight(); 213$(window).resize(function () { 214makeContainersSameHeight(); 215}); 216decorateFadeContentReadMoreButtons(); 217showTabFromHashIfAvailable(); 218individee.decorateObjectOnScroll('scroll-aware'); 219individee.activateTooltips(); 220individee.activateFloatingLabels(); 221individee.activateIntersectionObserver(individee.loadLazyBehavior); 222individee.registerTabId(); 223}); 224individee.registerTabId = function () { 225const tabID = sessionStorage.tabId && 226sessionStorage.closedLastTab !== '2' ? 227sessionStorage.tabId : 228sessionStorage.tabId = individee.createUUID(); 229sessionStorage.closedLastTab = '2'; 230$(window).on('unload beforeunload', function () { 231sessionStorage.closedLastTab = '1'; 232}); 233} 234individee.createUUID = function () { 235let dt = new Date().getTime(); 236return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { 237var r = (dt + Math.random() * 16) % 16 | 0; 238dt = Math.floor(dt / 16); 239return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); 240}); 241} 242individee.activateIntersectionObserver = function (method, ...args) { 243if ("IntersectionObserver" in window) { 244if (args) { 245method(args); 246} else { 247method(); 248} 249} else { 250individee.loadScript("/wicket/resource/com.individee.webdirector.WebDirectorAp
250p/resources/js/frontend/polyfill/intersection-observer.js", method); 251} 252}; 253individee.loadLazyBehavior = function (selector) { 254if (selector) { 255selector = selector + " img.lazy"; 256} else { 257selector = "img.lazy"; 258} 259var lazyImages = [].slice.call(document.querySelectorAll(selector)); 260let lazyImageObserver = new IntersectionObserver(function (entries, observer) { 261entries.forEach(function (entry) { 262if (entry.isIntersecting) { 263let lazyImage = entry.target; 264lazyImage.src = lazyImage.dataset.src; 265lazyImage.srcset = lazyImage.dataset.srcset; 266lazyImage.classList.remove("lazy"); 267lazyImageObserver.unobserve(lazyImage); 268} 269}); 270}); 271lazyImages.forEach(function (lazyImage) { 272lazyImageObserver.observe(lazyImage); 273}); 274}; 275individee.loadScript = function (src, done) { 276var js = document.createElement('script'); 277js.src = src; 278js.onload = function () { 279done(); 280}; 281js.onerror = function () { 282done(new Error('Failed to load script ' + src)); 283}; 284document.head.appendChild(js); 285}; 286individee.activateTabLink = function (id) { 287$('.nav-link[href$="#' + id + '"]:first').addClass('active'); 288}; 289individee.deactivateTabLink = function (id) { 290$('.nav-link[href$="#' + id + '"]:first').removeClass('active'); 291}; 292individee.activateFloatingLabels = function () { 293$("body").on("input propertychange", ".floating-label-form-group", function (e) { 294$(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val()); 295}).on("focus", ".floating-label-form-group", function () { 296$(this).addClass("floating-label-form-group-with-focus"); 297}).on("blur", ".floating-label-form-group", function () { 298$(this).removeClass("floating-label-form-group-with-focus"); 299}); 300}; 301individee.reactivateElementsAfterRefresh = function (id) { 302decorateFadeContentReadMoreButtons(id); 303individee.activateTooltips(id); 304}; 305individee.replaceValue = function (parentId, placeholder, value) { 306var parent; 307if (parentId) { 308parent = $('#' + parentId); 309} else { 310parent = $('body'); 311} 312parent.find('span:contains("' + placeholder + '"), small:contains("' + placeholder + '"), ' + 313'i:contains("' + placeholder + '"), strong:contains("' + placeholder + '")').each(function () { 314var element = $(this); 315element.html(element.html().replace(placeholder, value)); 316}); 317parent.find('h1:contains("' + placeholder + '"), h2:contains("' + placeholder + '"), ' + 318'h3:contains("' + placeholder + '"), h4:contains("' + placeholder + '"), h5:contains("' + placeholder + '"), ' + 319'h6:contains("' + placeholder + '")').each(function () { 320var element = $(this); 321element.html(element.html().replace(placeholder, value)); 322}); 323parent.find('li:contains("' + placeholder + '")').each(function () { 324var element = $(this); 325element.html(element.html().replace(placeholder, value)); 326}); 327parent.find('p:contains("' + placeholder + '")').each(function () { 328var element = $(this); 329element.html(element.html().replace(placeholder, value)); 330}); 331parent.find('td:contains("' + placeholder + '")').each(function () { 332var element = $(this); 333element.html(element.html().replace(placeholder, value)); 334}); 335parent.find('th:contains("' + placeholder + '")').each(function () { 336var element = $(this); 337element.html(element.html().replace(placeholder, value)); 338}); 339}; 340individee.listenForTabShow = function (id, callbackUrl) { 341individee.listenForTabShowBySelector('#' + id, callbackUrl); 342}; 343individee.listenForTabShowBySelector = function (selector, callbackUrl) { 344$(selector).on('show.bs.tab', function (e) { 345Wicket.Ajax.get({u: callbackUrl + "&target=" + e.target.id}); 346}); 347}; 348individee.treatExternalLinks = function (domainName, storagePath) { 349if (domainName && storagePath) { 350domainName = domainName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); 351$("a").each(function () { 352const href = $(this).attr("href"); 353if (href && href.startsWith('http') && !href.match(new RegExp('^http.*:\\/\\/' + domainName + '.*$', 'g')) && !href.match(storagePath)) { 354$(this).attr("rel", "noreferrer"); 355$(this).attr("target", "_blank"); 356} 357}); 358} 359}; 360individee.treatAssetsLinks = function (storagePath) { 361if (storagePath) { 362$("a").each(function () { 363const href = $(this).attr("href"); 364if (href) { 365if ((href.startsWith('http') && href.match(storagePath))) { 366$(this).attr("target", "_blank"); 367} 368} 369}); 370} 371}; 372function showTabFromHashIfAvailable() { 373if ($(".nav-tabs").length) { 374var url = document.location.href.split('#'); 375if (url[1] != undefined) { 376removeInitialTabActivation(url[1]); 377activateTab(url[1]); 378} 379} 380} 381function removeInitialTabActivation(tabId) { 382$('.nav-tabs a' + '[href="#' + tabId + '"]').parent().parent().find(".active").removeClass("active"); 383$('.nav-tabs #' + tabId).removeClass("active", "show"); 384} 385function activateTab(tabId) { 386$('.nav-tabs a' + '[href="#' + tabId + '"]').tab('show'); 387$('.nav-tabs a' + '[href="#' + tabId + '"]').addClass('active'); 388$('.nav-tabs #' + tabId).addClass("active show"); 389$('.nav-tabs #' + tabId).attr("aria-expanded", "true"); 390} 391function activateSmoothScrollOnAnchorLinks() { 392 393 $("a[href^='#']").on('click', function (event) { 394 395 if (!$(this).hasClass('carousel-control-prev') 396&& !$(this).hasClass('carousel-control-next') 397&& !$(this).attr("data-toggle") 398&& this.hash !== "") { 399 400 event.preventDefault(); 401 402 var hash = this.hash; 403 404 405 var position = $(hash).offset().top; 406if (individee.config.scrollOffset) { 407position = position + individee.config.scrollOffset; 408} 409$('html, body').animate({ 410scrollTop: position 411}, 800, function () { 412 413 if (history.pushState) { 414history.pushState(null, null, hash); 415} 416}); 417} 418 }); 419} 420function registerCallback(name, callback) { 421individee.callbacks[name] = callback; 422} 423function triggerCallback(name, ep) { 424if (ep) { 425Wicket.Ajax.get({u: individee.callbacks[name], ep: ep}); 426} else { 427Wicket.Ajax.get({u: individee.callbacks[name]}); 428} 429} 430function triggerAction(id, showBusyIndicator, properties) { 431const callbackResponse = id + "_" + (+new Date * Math.random()).toString(36).substring(0, 24); 432const parameters = {action: id, indicator: !showBusyIndicator, 'callback_response': callbackResponse}; 433if (properties) { 434parameters.properties = btoa(JSON.stringify(properties)); 435} 436return new Promise((resolve, reject) => { 437Wicket.Ajax.get({ 438u: individee.callbacks['webdirector-execute-action-by-id'], 439ep: parameters, 440sh: [function (attrs, jqXHR, data, textStatus) { 441if (individee.callbackresponses[callbackResponse]['success']) { 442resolve(individee.callbackresponses[callbackResponse]['data']); 443} else { 444reject(new Error(individee.callbackresponses[callbackResponse]['message'])); 445} 446delete individee.callbackresponses[callbackResponse]; 447} 448], 449fh: [function (attrs, jqXHR, data, textStatus) { 450reject(new Error("Unknown error thrown.")); 451delete individee.callbackresponses[callbackResponse]; 452} 453] 454}); 455}); 456} 457function enableTouchOnSlider(id) { 458$('#' + id).swiperight(function () { 459$(this).carousel('prev'); 460}); 461$('#' + id).swipeleft(function () { 462$(this).carousel('next'); 463}); 464} 465function setCookieConsentOptions(message, dismiss, learnMore, link, cookieName) { 466$(document).euCookieLawPopup().init({ 467cookiePolicyUrl: link, 468popupPosition: 'bottomright', 469colorStyle: 'default', 470compactStyle: false, 471popupTitle: '', 472popupText: message, 473buttonContinueTitle: dismiss, 474buttonLearnmoreTitle: learnMore, 475buttonLearnmoreOpenInNewWindow: true, 476agreementExpiresInDays: 30, 477autoAcceptCookiePolicy: false, 478htmlMarkup: null, 479cookieName: cookieName 480}); 481} 482function setDynamicNavButtons(loginHref, logoutHref, registerHref, myAccountHref, user) { 483if (loginHref) { 484$('.navbar-login-link').attr("href", loginHref); 485} else { 486$('.navbar-login-link').hide(); 487} 488if (logoutHref) { 489$('.navbar-logout-link').attr("href", logoutHref); 490} else { 491$('.navbar-logout-link').hide(); 492} 493if (registerHref) { 494$('.navbar-register-link').attr("href", "javascript:ensureAuthentication();"); 495} else { 496$('.navbar-register-link').hide(); 497} 498if (myAccountHref) { 499$('.navbar-my-account-link').attr("href", myAccountHref); 500if (window.location.href.split("?")[0].split("//")[1].endsWith(myAccountHref.split("//")[1])) { 501$('.navbar-my-account-link').addClass("active"); 502$('.navbar-my-account-link').parent().parent().addClass("active"); 503} 504} else { 505$('.navbar-my-account-link').hide(); 506} 507if (user !== null) { 508$('.user-name-display').text(user); 509} 510} 511String.prototype.endsWith = function (suffix) { 512if (suffix) { 513return this.indexOf(suffix, this.length - suffix.length) !== -1; 514} else { 515return false;
516} 517}; 518function backWithParameter(fallbackUrl) { 519 520 var lastUrl = document.referrer; 521 522 523 524var lastParameters = lastUrl.split('?')[1]; 525var lastParametersArray; 526if (lastParameters !== undefined && lastParameters !== null) { 527lastParametersArray = lastParameters.split("&"); 528} 529var currentUrl = window.location.href; 530var currentUrlArray = currentUrl.split("/"); 531var currentDomain = currentUrlArray[2]; 532var currentParameters = currentUrl.split('?')[1]; 533var currentParametersArray; 534if (currentParameters !== undefined && currentParameters !== null) { 535currentParametersArray = currentParameters.split("&"); 536} 537 538 if (lastUrl !== undefined && lastUrl !== null && lastUrl !== "") { 539 540 if (lastUrl.indexOf(currentDomain) !== -1) { 541 542 if (!currentUrl.endsWith("?") && currentParameters !== undefined && currentParameters !== null && currentParameters !== "" && currentParametersArray.length > 0) { 543 544 if (!lastUrl.endsWith("?") && lastParametersArray !== undefined && lastParametersArray !== null && lastParametersArray.length > 0) { 545 546 547var parametersSplicedFromLastUrl = false; 548for (iLast = 0; iLast < lastParametersArray.length; ++iLast) { 549if (iLast in lastParametersArray) { 550var urlParaLast = lastParametersArray[iLast].split("=")[0]; 551for (iCurrent = 0; iCurrent < currentParametersArray.length; ++iCurrent) { 552if (iCurrent in currentParametersArray) { 553var urlParaCurrent = currentParametersArray[iCurrent].split("=")[0]; 554if (urlParaLast === urlParaCurrent) { 555lastParametersArray.splice(iLast, 1); 556parametersSplicedFromLastUrl = true; 557} 558} 559} 560} 561} 562if (parametersSplicedFromLastUrl) { 563lastParameters = ""; 564if (lastParametersArray.length > 0) { 565for (iLast = 0; iLast < lastParametersArray.length; ++iLast) { 566if (iLast in lastParametersArray) { 567lastParameters += lastParametersArray[iLast]; 568} 569} 570lastParameters += "&"; 571} 572} 573 574 window.location = lastUrl.split('?')[0] + "?" + lastParameters + currentParameters; 575} else { 576 577 window.location = lastUrl + "?" + currentParameters; 578} 579} else { 580 581 history.back(); 582} 583} else { 584 585 window.location = currentUrlArray[0] + currentUrlArray[1] + fallbackUrl + "?" + currentParameters; 586} 587} else { 588 589 window.location = currentUrlArray[0] + currentUrlArray[1] + fallbackUrl + "?" + currentParameters; 590} 591 592} 593function higlightCurrentNavigationPosition() { 594 595 try { 596var curUrl = window.location.href.split("?")[0]; 597var curUrlLevelAboveArray = curUrl.split("/"); 598var curUrlLevelAbove = ""; 599for (index = 0; index < curUrlLevelAboveArray.length - 1; index++) { 600curUrlLevelAbove += "/" + curUrlLevelAboveArray[index]; 601} 602$('.nav-link').each(function () { 603if (curUrl.endsWith($(this).attr("href"))) { 604$(this).addClass("active"); 605} 606if (curUrlLevelAbove.endsWith($(this).attr("href"))) { 607$(this).addClass("active-parent"); 608} 609}); 610 611 var regExForOnClick = /(["'])(?:(?=(\\?)).)*?\1/i; 612var onClickAttributeArray; 613var targetUrl; 614var targetUrlArray; 615var arrayLength; 616$('.nav-item.dropdown').each(function () { 617$currentDropdown = $(this); 618$(this).find('.dropdown-item').each(function () { 619if ($(this).attr("href") != null && (curUrl.endsWith($(this).attr("href")) || curUrlLevelAbove.endsWith($(this).attr("href")))) { 620$currentDropdown.addClass("active"); 621$(this).addClass("active"); 622$(this).prev().removeClass("active"); 623} else { 624onClickAttributeArray = regExForOnClick.exec($(this).attr("onclick")); 625if (onClickAttributeArray !== null) { 626targetUrl = atob(onClickAttributeArray[0].substring(1, onClickAttributeArray[0].length - 1)); 627if (curUrl.endsWith(targetUrl) || curUrlLevelAbove.endsWith(targetUrl)) { 628$currentDropdown.addClass("active"); 629$(this).addClass("active"); 630$(this).prev().removeClass("active"); 631} else { 632targetUrlArray = targetUrl.split("/"); 633arrayLength = targetUrlArray.length; 634for (var i = 0; i < arrayLength; i++) { 635if (curUrl.endsWith("/" + targetUrlArray[i]) || curUrlLevelAbove.endsWith(targetUrlArray[i])) { 636if (i > 0) { 637$currentDropdown.addClass("active"); 638} else if (i > 1) { 639$(this).addClass("active"); 640$(this).prev().removeClass("active"); 641} 642} 643} 644} 645} 646} 647}); 648}); 649} catch (ex) { 650console.log(ex); 651console.log("Error on attaching 'active' css class to nav-links and nav dropdowns."); 652} 653} 654function disableWizardTabs() { 655$('.wizard-tabs .nav-link').click(function (event) { 656return false;
657}); 658} 659function checkForTransparentNav() { 660if ($('#main-nav.transparent-nav').length) { 661$(document).scroll(function () { 662if ($(this).scrollTop() > 100) { 663$('#main-nav').removeClass('transparent-nav'); 664$('#main-nav .navbar-brand img').attr('src', '/assets/images/logo-color.png'); 665} else { 666$('#main-nav').addClass('transparent-nav'); 667$('#main-nav .navbar-brand img').attr('src', '/assets/images/logo.png'); 668} 669}); 670} 671} 672function showPopup(html) { 673var markUp = '<div class="web-director-pop-up" style="display: none;">' + html + '</div>'; 674if ($('.web-director-pop-up').length) { 675$('.web-director-pop-up').hide(); 676$('.web-director-pop-up').html(markUp) 677} 678$('body').append(markUp); 679$('.web-director-pop-up').show(); 680} 681function styleResponsiveTables() { 682$('.table-responsive-reorder td').each(function () { 683 684 var tdIndex = $(this).index(); 685if ($('tr').find('th').eq(tdIndex).attr('data-label')) { 686var thText = $('.table-responsive-reorder tr').find('th').eq(tdIndex).data('label'); 687} else { 688var thText = $('.table-responsive-reorder tr').find('th').eq(tdIndex).text(); 689} 690$(this).attr('data-label', thText); 691}); 692} 693function makeContainersSameHeight() { 694doHeightCorrections($('.make-same-height')); 695doCardHeightCorrections(); 696} 697function doCardHeightCorrections() { 698doHeightCorrections($('.card-header.make-card-element-same-height')); 699doHeightCorrections($('.card-body.make-card-element-same-height')); 700doHeightCorrections($('.card-footer.make-card-element-same-height')); 701} 702function doHeightCorrections(elements) { 703if (elements.length) { 704var maxHeights = []; 705var differencesFlag = []; 706elements.each(function () { 707if (maxHeights[$(this).offset().top] !== undefined 708&& ($(this).height() > maxHeights[$(this).offset().top] || $(this).height() < maxHeights[$(this).offset().top])) { 709differencesFlag[$(this).offset().top] = true; 710} 711if (maxHeights[$(this).offset().top] === undefined || $(this).height() > maxHeights[$(this).offset().top]) { 712maxHeights[$(this).offset().top] = $(this).height(); 713} 714}); 715$(elements.get().reverse()).each(function () { 716if (maxHeights[$(this).offset().top] > 0.0 && differencesFlag[$(this).offset().top]) { 717$(this).height(maxHeights[$(this).offset().top]); 718} 719}); 720} 721} 722function decorateFadeContentReadMoreButtons(id) { 723var selector = id && id !== null ? "#" + id + " " : ""; 724selector = selector + ".fade-content "; 725if (!id) { 726$(document).on('shown.bs.modal', function (e) { 727decorateFadeContentReadMoreButtons(e.target.id); 728}); 729} 730$(selector + ".read-more-btn").click(function () { 731return executeFadeContentReadMoreButton($(this)); 732}); 733$(selector + ".read-less-btn").click(function () { 734var $el = $(this); 735var $p = $el.parent(); 736var $up = $p.parent().find('.fade-body'); 737var height = $up.data("fade-height") > 0 ? $up.data("fade-height") : 90; 738var opacity = $up.data("fade-opacity") > 0 ? $up.data("fade-opacity") : 0.6; 739var $readMore = $up.parent().find(".read-more-btn"); 740$up.animate({ 741"height": height, 742"opacity": opacity 743}); 744$el.fadeOut(); 745$readMore.fadeIn(); 746 747 return false; 748}); 749} 750function executeFadeContentReadMoreButton($el) { 751var $p = $el.parent(); 752var $up = $p.parent().find('.fade-body'); 753var $readLess = $up.parent().find(".read-less-btn"); 754$up.css({ 755 756 "height": $up.height(), 757"max-height": 9999 758}).animate({ 759"height": "100%", 760"opacity": 1 761}); 762 763 $el.fadeOut(); 764$readLess.fadeIn(); 765 766 return false; 767} 768individee.preventSubmitOnEnter = function (selector) { 769$(selector).keydown(function (event) { 770if (event.keyCode === 13) { 771event.preventDefault(); 772$(this).trigger('change'); 773return false; 774} 775}); 776}; 777individee.showBusyIndicator = function () { 778const indicator = '<div id="standard-busy-indicator" class="busy-indicator d-flex w-100 h-100 justify-content-center align-items-center" ' + 779'style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;">' + 780'<i class="fad fa-5x fa-spinner-third fa-spin"></i>' + 781'</div>' 782$('body').append(indicator); 783} 784individee.hideBusyIndicator = function () { 785$('#standard-busy-indicator').remove(); 786} 787individee.showCollapsibleNaviElements = function () { 788setTimeout(() => { 789const location = window.location; 790var url = location.pathname ? location.pathname : "/"; 791if (location.hash) { 792url = url + location.hash; 793} 794$('.final-navi').each(function () { 795$(this).removeClass("active"); 796if ($(this).attr("href").endsWith(url)) { 797$(this).addClass("active"); 798$(this).closest(".third-level").addClass("show"); 799$(this).closest(".second-level").addClass("show"); 800} 801}
801); 802}, 30); 803} 804individee.toggleRadio = function (id) { 805let elem = $("#" + id); 806if (elem.attr("checked") === "checked") { 807elem.attr("checked", false); 808} else { 809elem.attr("checked", true); 810} 811} 812individee.copyValueToClipboard = function (value, tooltipId, copiedText) { 813navigator.clipboard.writeText(value); 814if (tooltipId) { 815const $tooltip = $('#' + tooltipId); 816$tooltip.find(".tooltip-inner") 817.text(copiedText); 818$tooltip.tooltip('update'); 819setTimeout(() => { 820$tooltip.tooltip('hide'); 821}, 1000) 822} 823} 824individee.createLinkAndTrigger = function (url) { 825const a = document.createElement("a"); 826a.style = "display: none"; 827a.href = url; 828document.body.appendChild(a); 829a.click(); 830setTimeout(function () { 831document.body.removeChild(a); 832}, 100); 833} 834individee.initiateDownload = function (url, filters, btnId, timeout, tooltipLastingLonger, tooltipTimeout, tooltipException) { 835let timer = 0; 836let timerRunning = true; 837let isDone = false; 838const btn = btnId ? $("#" + btnId) : null; 839let originalTitle; 840if (btn && btn.attr("data-original-title")) { 841originalTitle = btn.attr("data-original-title"); 842} 843try { 844$.post({ 845url: url.replace('_TYPE_', 'start'), 846data: filters, 847dataType: 'json', 848contentType: "application/json" 849}).done(function (data) { 850const taskId = data.taskId; 851const tid = setInterval(executeOnTimer, 2000); 852function executeOnTimer() { 853$.get({ 854url: url.replace('_TYPE_', 'status') + "&tid=" + taskId, 855dataType: 'json', 856contentType: "application/json" 857}).done(data => { 858console.log("Status: " + data.done); 859if (data.done) { 860isDone = true; 861timerRunning = false; 862} 863}) 864if (timer === 5) { 865if (btn && tooltipLastingLonger) { 866addTooltipText(btn, tooltipLastingLonger); 867} 868} 869if (timer * 2000 > timeout) { 870if (btn && tooltipTimeout) { 871addTooltipText(btn, tooltipTimeout); 872setTimeout(() => removeTooltipText(btn, originalTitle), 3000); 873} 874timerRunning = false; 875} 876if (!timerRunning) { 877if (btn) { 878individee.disableLoadingOnButton(btn); 879setTimeout(() => removeTooltipText(btn, originalTitle), 3000); 880} 881clearInterval(tid); 882if (isDone) { 883saveFileFromUrl(url.replace('_TYPE_', 'result') + "&tid=" + taskId) 884.then(() => { 885restoreTooltipText(btn); 886}) 887.catch(err => { 888if (err.timeout) { 889if (btn && tooltipTimeout) { 890addTooltipText(btn, tooltipTimeout); 891setTimeout(() => removeTooltipText(btn, originalTitle), 3000); 892} 893} else { 894if (btn && tooltipException) { 895addTooltipText(btn, tooltipException); 896setTimeout(() => removeTooltipText(btn, originalTitle), 3000); 897} 898} 899timerRunning = false; 900}); 901} 902} 903timer++; 904} 905}); 906} catch (ex) { 907console.error(ex); 908timerRunning = false; 909} 910function saveFileFromUrl(url) { 911return new Promise(function (resolve, reject) { 912const xhr = new XMLHttpRequest(); 913xhr.open(this.method, url); 914xhr.setRequestHeader('Content-type', 'application/json'); 915xhr.responseType = 'blob'; 916xhr.onload = function () { 917resolve(xhr); 918}; 919xhr.ontimeout = function (e) { 920reject({message: "Timed out", timeout: true}); 921}; 922xhr.onerror = reject; 923xhr.open('POST', url); 924xhr.send(); 925}).then(function (xhr) { 926if (xhr.status >= 200 && xhr.status < 300) { 927const contentDisposition = xhr.getResponseHeader('Content-Disposition'); 928const contentType = "application/octet-stream; charset=utf-8"; 929const filename = contentDisposition.match(/filename="(.+)"/)[1]; 930const file = new Blob([xhr.response], {type: contentType}); 931if ('msSaveOrOpenBlob' in window.navigator) { 932window.navigator.msSaveOrOpenBlob(file, filename); 933} else { 934const data = URL.createObjectURL(file); 935const a = document.createElement("a"); 936a.style = "display: none"; 937a.href = data; 938a.download = decodeURI(filename); 939document.body.appendChild(a); 940a.click(); 941setTimeout(function () { 942document.body.removeChild(a); 943window.URL.revokeObjectURL(data); 944}, 100); 945} 946} else { 947throw new Error('Failed'); 948} 949return xhr; 950}); 951} 952function addTooltipText(btn, tooltipText) { 953if (!btn.attr('data-ky-original-title') && btn.attr("data-original-title")) { 954btn.attr('data-ky-original-title', btn.attr('data-original-title')); 955} 956btn.attr("data-original-title", tooltipText); 957$(btn).tooltip('show'); 958} 959function restoreTooltipText(btn) { 960if (btn.attr("data-ky-original-title")) { 961$(btn).tooltip('hide'); 962btn.attr('data-original-title', btn.attr('data-ky-original-title')); 963btn.attr('data-ky-original-title', null); 964} 965} 966function removeTooltipText(btn, originalTitle) { 967btn.tooltip('hide') 968btn.removeAttr('data-ky-original-title'); 969originalTitle ? btn.attr('data-original-title', originalTitle) : btn.removeAttr('data-original-title'); 970} 971} 972individee.togglePassword = function (buttonId, passwordFieldId) { 973var elem = document.getElementById(buttonId); 974let parent = document.getElementById(passwordFieldId); 975if (elem.classList.contains('fa-eye-slash')) { 976elem.classList.replace('fa-eye-slash', 'fa-eye'); 977if (parent.getAttribute("type") === "password") { 978parent.setAttribute("type", "text"); 979} 980} else if (elem.classList.contains('fa-eye')) { 981elem.classList.replace('fa-eye', 'fa-eye-slash'); 982parent.setAttribute("type", "password"); 983} 984} 985individee.testCapsLock = function (id, message) { 986var elem = document.getElementById(id); 987var messageElem = document.getElementById(message); 988elem.addEventListener("keyup", function (event) { 989if (event.getModifierState("CapsLock")) { 990messageElem.style.display = "block"; 991} else { 992messageElem.style.display = "none"; 993} 994}); 995} 996individee.activateSessionStorageCache = function (id, fieldId) { 997var elem = $("[data-id='" + fieldId + "']"); 998elem.on("input", function () { 999sessionStorage.setItem(id + "_" + fieldId, elem.val()) 1000}) 1001} 1002individee.loadFromSessionStorage = function (id, fieldId) { 1003var elem = $("[data-id='" + fieldId + "']"); 1004const formAndFieldId = id + "_" + fieldId; 1005if (sessionStorage.getItem(formAndFieldId) != null) { 1006elem.val(sessionStorage.getItem(formAndFieldId)) 1007} 1008} 1009individee.cleanFormFieldsFromSessionStorage = function (id) { 1010Object.keys(sessionStorage) 1011.filter(x => 1012x.startsWith(id)) 1013.forEach(x => 1014sessionStorage.removeItem(x)) 1015} 1016individee.accordion.init = function (id) { 1017$(`#${id} .collapse`) 1018.on('hide.bs.collapse', function (d) { 1019$(d.target).closest('.card') 1020.removeClass('open') 1021.find('.accordion-panel-icon') 1022.addClass('fa-caret-down') 1023.removeClass('fa-caret-up'); 1024}).on('show.bs.collapse', function (d) { 1025$(d.target).closest('.card') 1026.addClass('open') 1027.find('.accordion-panel-icon') 1028.removeClass('fa-caret-down') 1029.addClass('fa-caret-up'); 1030}); 1031} 1032individee.removeUrlParam = function (key) { 1033var sourceURL = window.location.href; 1034var rtn = sourceURL.split("?")[0]; 1035var param; 1036var params_arr = []; 1037var queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; 1038if (queryString !== "") { 1039params_arr = queryString.split("&"); 1040for (var i = params_arr.length - 1; i >= 0; i -= 1) { 1041param = params_arr[i].split("=")[0]; 1042if (param === key) { 1043params_arr.splice(i, 1); 1044} 1045} 1046rtn = rtn + "?" + params_arr.join("&"); 1047} 1048window.history.replaceState(null, null, rtn); 1049}
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.