1var process = process || {env: {NODE_ENV: "development"}}; 2/* 3 Copyright 2026 FIZ Karlsruhe - Leibniz-Institut fuer Informationsinfrastruktur GmbH 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 https://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16*/ 17 18const removeErrorFieldClass = (errorFields) => { 19 errorFields.forEach(errorField => { 20 errorField.classList.remove('error-input'); 21 }); 22} 23 24const resetForm = (formEl) => { 25 formEl.reset(); 26 formEl.classList.remove('was-validated'); 27} 28 29/** 30 * Displays a login form if a URL is called that requires the user to be logged in. 31 */ 32export const displayLoginForm = () => { 33 const href = window.location.href; 34 const url = new URL(href); 35 const paramValue = url.searchParams.get("doLogin"); 36 if (paramValue === 'true') { 37 const loginModal = document.getElementById("loginModal"); 38 if (loginModal) { 39 loginModal.addEventListener('hidden.bs.modal', function () { 40 // Remove query string from URL 41 window.location.href = window.location.href.split('?')[0]; 42 }); 43 44 const modalInstance = new bootstrap.Modal(loginModal); 45 modalInstance.show(); 46 } 47 } 48}; 49 50export const resetLoginContent = () => { 51 const loginModal = document.getElementById('loginModal'); 52 53 if (loginModal) { 54 loginModal.addEventListener('hidden.bs.modal', function () { 55 const loginForm = document.getElementById('login-form'); 56 const loginFormErrorFields = loginForm.querySelectorAll('.error-input'); 57 const loginErrorBlock = document.getElementById('login-errors-container'); 58 59 resetForm(loginForm) 60 removeErrorFieldClass(loginFormErrorFields) 61 loginErrorBlock.style.display = 'none'; 62 }); 63 } 64}; 65 66export const resetRegistrationContent = () => { 67 const registrationModal = document.getElementById('registrationModal'); 68 69 if (registrationModal) { 70 registrationModal.addEventListener('hidden.bs.modal', function () { 71 const registrationFormContainer = document.querySelector('.registration-container'); 72 const registrationSuccessMessage = document.getElementById('registrationSuccess-message'); 73 const registrationForm = document.getElementById('registration-form'); 74 const registrationFormErrorFields = registrationForm.querySelectorAll('.error-input'); 75 76 resetForm(registrationForm) 77 removeErrorFieldClass(registrationFormErrorFields) 78 79 registrationSuccessMessage.style.display = 'none'; 80 registrationFormContainer.style.display = 'block'; 81 }); 82 } 83}; 84 85export const initForgotPasswordModal = () => { 86 const forgotPasswordModal = document.getElementById('forgotPassword'); 87 88 if (forgotPasswordModal) { 89 forgotPasswordModal.addEventListener('hidden.bs.modal', function () { 90 const forgotPasswordForm = document.getElementById('password-reset-form'); 91 const forgotPasswordFormContainer = document.getElementById('forgotPassword-form-container'); 92 const forgotPasswordFormErrorFields = forgotPasswordForm.querySelectorAll('.error-input'); 93 const forgotPasswordMessage = document.getElementById('forgotPassword-message'); 94 95 resetForm(forgotPasswordForm) 96 removeErrorFieldClass(forgotPasswordFormErrorFields) 97 forgotPasswordMessage.style.display = 'none'; 98 forgotPasswordFormContainer.style.display = 'block'; 99 }); 100 } 101}; 102 103export const formPrecaution = () => { 104 const registrationModal = document.getElementById('registrationModal'); 105 if (!registrationModal) { 106 return; 107 } 108 109 const termsOfUseCheckbox = document.querySelector('#termOfUse'); 110 const registrationForm = document.forms['registration-form']; 111 112 let startTime = new Date().getTime(); 113 114 registrationForm.addEventListener('submit', function (event) { 115 event.preventDefault(); 116 117 let endTime = new Date().getTime(); 118 let timeTaken = (endTime - startTime) / 1000; 119 const registrationFormValue = this['a_g_e'].value; 120 121 if (timeTaken < 3 || registrationFormValue.trim() !== "") { 122 registrationForm.action = "false"; 123 return false;
124 } 125 126 if (!termsOfUseCheckbox.checked) { 127 return false; 128 } 129 }); 130};
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.