PageSourceSearch

https://www.hs-nordhausen.de/wp-content/cache/min/8/9d165e6ad123/w…/assets/js/public-main.js?ver=1790843425

js hs-nordhausen.de collected 2026-10-02 07:17:26 UTC 18,217 bytes, 46 lines download raw bytes

1var greyd=greyd||{};greyd.forms=greyd.forms||{};greyd.forms.formHasBeenSubmitted=!1;greyd.forms.initForms=function(){if(typeof $==='undefined')$=jQuery;if($('form.greyd_form').length==0)return;class Greyd_Form{constructor(form){this.form=form;if(this.form.length==0)return;if(this.form.data('initialized'))return;this.addEvents();this.form.data('initialized',!0)}
2addEvents(){this.initValidations();this.initTooltips();this.initUploadFields();this.initRangeSlider();this.initMathFields();this.initConfirmPasswordField();this.initFormTags();this.initLocalStorageFields();this.form.on("submit",(e)=>{e.preventDefault();greyd.forms.captcha.maybeExecute(this.submit,[this.form])});this.form.on("reset",(e)=>{this.onReset(e)});this.form.on("error",(e,atts)=>{var html=typeof atts.html!=='undefined'?atts.html:'';var log=typeof atts.log!=='undefined'?atts.log:'';this.onError(html,log)});if(typeof greyd.forms.multistep!=='undefined'){greyd.forms.multistep.init(this.form)}
3if(typeof greyd.forms.conditions!=='undefined'){greyd.forms.conditions.init(this.form)}}
4initValidations(){this.form.find('input, textarea').each(function(){$(this).on('focusin focus',function(){$(this).addClass('input-focus').removeClass('input-unfocus invalid')});$(this).on('focusout',function(){var val=$(this).val().trim();$(this).removeClass('input-focus');if($(this).hasClass('validation')){if(val!==''||$(this).prop('required')){$(this).addClass('input-unfocus')}}else if($(this).prop('required')){if(val===''){$(this).addClass('input-unfocus invalid')}else{$(this).removeClass('input-unfocus invalid')}}
5if($(this).prop('required')){$(this).val(val)}})});this.form.find('.submitbutton').on('click',()=>{this.form.addClass('validate')});this.form.find('.input-inner-wrapper .input-field-icon').on("click",function(){$(this).siblings().removeClass('input-unfocus invalid')})}
6initTooltips(){if(this.form.find('.forms-tooltip').length==0)return;if(typeof custom_inputs!=='undefined'&&typeof custom_inputs.initTooltips!=='undefined')return;this.form.find(".forms-tooltip .forms-tooltip-toggle").on("click",(e)=>{let tooltip=$(e.target).parent();if(tooltip.hasClass('on')){greyd.forms.tooltips.hideTooltip(tooltip)}else{greyd.forms.tooltips.hideTooltip();greyd.forms.tooltips.showTooltip(tooltip)}
7e.stopPropagation()})};initUploadFields(){this.form.find('input[type="file"].custom-file-upload').each(function(){let input=$(this);let label=input.next();let labeltext;label.on('click',function(){if(!input.attr('id'))$(this).prev().trigger("click");labeltext=$(this).find('.input span[style="flex:1"]');$(this).prev().removeClass('input-unfocus valid invalid').addClass('input-focus')});input.on('keyup',function(){labeltext=$(this).siblings('label').find('.input span[style="flex:1"]')});input.on('change',function(e){var filename=$(this).val().replace(/C:\\fakepath\\/i,'');if(filename){if(labeltext)labeltext.text(filename);$(this).removeClass('input-focus').addClass('input-unfocus');var maxsize=$(this).data('max');if(maxsize!='none')
8maxsize=parseFloat(maxsize.toString().replace(',','.'))*1000*1000;if(maxsize=='none'||this.files[0].size<=maxsize)
9$(this).removeClass('invalid').addClass('valid');else $(this).removeClass('valid').addClass('invalid')}else{label.find('.input span[style="flex:1"]').text(label.data('text'));input.removeClass('valid invalid input-focus input-unfocus')}});input.on('focus',function(){$(this).addClass('has-focus')});input.on('blur',function(){$(this).removeClass('has-focus')});if(input[0].hasAttribute('value')){labeltext=label.find('.input span[style="flex:1"]')
10labeltext.text(input.attr('value'))}})};initRangeSlider=function(){var timeout;this.form.find('.range_control_wrapper').each(function(){var input=$(this).children("input[type='range']");function onChange(e){input=typeof e==="undefined"?input:$(this);var wrapper=input.parent();var track=wrapper.find(".track");var thumb=wrapper.find(".thumb_wrapper");var ttip=wrapper.find(".tooltip");var label=wrapper.siblings(".label_wrap").find(".range_value");var min=parseFloat(input.attr("min"));var max=parseFloat(input.attr("max"));var val=parseFloat(input.val());var offset=100/((max-min)/(val-min));var isRequired=input[0].hasAttribute('required');if(isRequired){if(input.val()=='0'||input.val()==''){input[0].setCustomValidity('Cannot be zero')}else if(input.val()>max){input[0].setCustomValidity('Cannot be greater than '+max)}else if(input.val()<min){input[0].setCustomValidity('Cannot be less than '+min)}else{input[0].setCustomValidity('')}}
11label.text(val);ttip.text(val);track.css("width","calc(10px + "+offset+"%)");thumb.css("left",offset+"%");if(typeof e!=="undefined"&&($("html").hasClass("safari")||$(window).width()<=1000)){$(".range_control_wrapper input[type='range']").removeClass("input-focus");input.addClass("input-focus");clearTimeout(timeout);timeout=setTimeout(function(){input.removeClass("input-focus")},1200)}}
12input.on("input change",onChange);onChange()})};initMathFields=function(){this.form.find('.math_field').each(function(){greyd.forms.tools.updateMathField($(this))})};initConfirmPasswordField=function(){const confirmPasswordFields=this.form[0].querySelectorAll('input[type="password"].confirm-password');confirmPasswordFields.forEach(confirmField=>{const form=confirmField.closest("form.greyd_form");const submit=form.querySelector("button[name='submit']");const confirmPasswordMessage=confirmField.closest('.input-wrapper').querySelector('span.confirm-password-message');const passwordField=confirmField.closest(".input-outer-wrapper").querySelector('input[type="password"]:not(.confirm-password)');const labelMatching=confirmPasswordMessage.getAttribute('data-label-matching');const labelNotMatching=confirmPasswordMessage.getAttribute('data-label-notmatching');confirmField.addEventListener("keyup",function(){if(this.value.length>0){if(this.value==passwordField.value){confirmPasswordMessage.style.color="green";confirmPasswordMessage.innerHTML=labelMatching;"matching";submit.disabled=!1;confirmField.setCustomValidity("")}else{confirmPasswordMessage.style.color="red";confirmPasswordMessage.innerHTML=labelNotMatching;submit.disabled=!0;confirmField.setCustomValidity("Invalid field.")}}})})};initFormTags=function(){$("form.greyd_form input, form.greyd_form textarea, form.greyd_form select").each(function(){$(this).on("change input",function(){greyd.forms.tools.changeDependingFormTags(this)})});setTimeout(function(){$("form.greyd_form input, form.greyd_form textarea, form.greyd_form select").each(function(){greyd.forms.tools.changeDependingFormTags(this)})},100)};initLocalStorageFields=function(){this.form.find('input[type="hidden"][data-localstorage-key]').each(function(){const key=$(this).attr('data-localstorage-key');const value=localStorage.getItem(key);console.log('Local storage key: '+key+' - Value: '+value);$(this).val(value)})};submit=function(form){if(typeof form==='undefined'){form=this.form}
13if(form.data('send')=="prevent"){return!1}
14const messageWrapper=form.siblings(".after-message");const message=messageWrapper.children(".message");const popup=form.siblings(".after-popup");const spinner=form.find('.greyd_upload_progress .spinner');const progressBar=form.find('.greyd_upload_progress .bar');const button=form.find(".submitbutton");messageWrapper.css({'height':0,"opacity":0},300);messageWrapper.siblings('pre').remove();button.prop('disabled',!0);button.children('span:not(.greyd_upload_progress)').css('opacity',0);spinner.css('opacity',1);let formData=new FormData();formData.append('action','handle_form_data');formData.append('data',greyd.forms.tools.getFormValues(form));formData.append('post_id',form.data('id'));formData.append('nonce',form.data('nonce'));formData.append('form_mode',form.data('form-mode'));if(typeof greyd.forms.tools.getWpmlLanguage==='function'){const _lang=greyd.forms.tools.getWpmlLanguage();if(_lang){formData.append('lang',_lang);if(typeof greyd.forms.tools.ensureWpmlAjaxLanguage==='function'){greyd.forms.tools.ensureWpmlAjaxLanguage(_lang)}}}
15let hasFiles=!1;form.find('input[type=file]').each(function(){hasFiles=!0;const inputName=greyd.forms.tools.getCleanName($(this).attr("name"));const fileToUpload=$(this)[0].files[0];formData.append(inputName,fileToUpload)});
15$.ajax({type:'POST',url:greyd.forms.tools.getAjaxUrl(),data:formData,processData:!1,contentType:!1,cache:!1,xhr:function(){var xhr=new window.XMLHttpRequest();xhr.upload.addEventListener("progress",function(event){if(event.lengthComputable&&hasFiles){const percentComplete=parseInt((event.loaded/event.total)*100);progressBar.show();progressBar.width(percentComplete+'%');if(percentComplete===100){setTimeout(function(){progressBar.hide();progressBar.width('0px')},400)}}},!1);xhr.addEventListener("error",function(event){form.trigger("error",{log:"Invalid Ajax Call to: "+greydFormSettings.ajaxurl})},!1);xhr.addEventListener("load",function(event){if(greydFormSettings.wp_debug){console.log(event);console.log(event.target.response)}
16if(event?.target?.status!==200){form.trigger("error",{log:"Error in handle.php"});return!1}
17if(!event?.target?.response){form.trigger("error",{log:"No response set"});return!1}
18let response;try{response=JSON.parse(event.target.response.split("greyd_form_response::")[1])}catch(e){console.error(e);console.log(event.target.response);form.trigger("error",{log:"Error parsing JSON response"});return!1}
19if(response.response=='ERROR'){let html=response.errors?response.errors:"";let errors=Array.isArray(html)?(html.length>1?"<ul><li>"+html.join("</li><li>")+"</li></ul>":html.join("")):html;if(Array.isArray(html)){html=response.message+"<br>"+errors}else{html=errors}
20let log=typeof response.errors==='object'?response.errors:response;log=response.errors&&typeof response.errors.body!=="undefined"?response.errors.body:log;form.trigger("error",{html:html,log:log});return!1}else if(response.response!='SUCCESS'){form.trigger("error",{log:"Error in handle.php. Activate WP_DEBUG and see console for details."});return!1}
21greyd.forms.formHasBeenSubmitted=!0;message.html('').removeClass('danger').addClass('success');if(response.message=='popup'||response.message=='fullscreen'){popup.addClass('in');if(response.message=='fullscreen')$('body').addClass('no-scroll');popup.animate({opacity:1},300)}else if(response.message.indexOf('page')!==-1){window.location.href=response.message.substr(response.message.indexOf("=")+1)}else{message.html(response.message)}
22console.log(response,form);form.trigger("reset",response)},!1);return xhr}})};onError=function(html,log){var messageWrapper=this.form.siblings(".after-message");if(typeof log!=='undefined'){log=typeof log==='object'||Array.isArray(log)?JSON.stringify(log,null,4):log;if(log.length>0){console.log(log)}}
23var message=messageWrapper.children(".message");var content=greydFormSettings.default_error;if(typeof html==='object'){content=JSON.stringify(html,null,4)}else if(Array.isArray(html)){if(html.length>1){content="<p style='margin-top:0;'>"+greydFormSettings.errors+"</p>";content+="<ul>";$.each(html,function(key,val){content+="<li>"+val+"</li>"});content+="</ul>"}else{content=html[0]}}else if(typeof html!=='undefined'&&html.length>0){content=html}
24message.html(content).removeClass('success').addClass('danger');this.resetFormElements()};onReset=function(e){this.resetFormElements();if(this.form.hasClass('no-reset')){if(e&&typeof e.preventDefault==='function'){e.preventDefault()}
25return}
26this.form.removeClass('validate');this.form.find('input, textarea, select').each(function(){$(this).removeClass('input-focus input-unfocus valid invalid');if($(this).attr('type')=='file'){}else if($(this).parent().hasClass('greyd_multiselect')){$(this).parent().find('.input .tag').each(function(){$(this).trigger("click")})}else if($(this).parent().hasClass('greyd_multiradio')){$(this).parent().find('.option.selected').removeClass('selected')}});greyd?.input?.closeAll(null)};resetFormElements=function(){const messageWrapper=this.form.siblings(".after-message");const message=messageWrapper.children(".message");const spinner=this.form.find('.greyd_upload_progress .spinner');const progressBar=this.form.find('.greyd_upload_progress .bar');const button=this.form.find(".submitbutton");if(message.html()!==""){var height=message.outerHeight()+parseInt(message.css("margin-top"))+parseInt(message.css("margin-bottom"));messageWrapper.css({'height':height,"opacity":1},300)}else{messageWrapper.css({'height':0,"opacity":0},300)}
27greyd.forms.captcha.clear();greyd.forms.turnstile.reset();greyd.forms.formHasBeenSubmitted=!0;setTimeout(function(){button.children('span:not(.greyd_upload_progress)').css('opacity',1);button.prop('disabled',!1);spinner.css('opacity',0);progressBar.hide();progressBar.width('0px')},150)}}
28$('form.greyd_form').each(function(){new Greyd_Form($(this))})};greyd.forms.captcha=new function(){this.isValid=!1;this.timeout=null;this.clear=function(){greyd.forms.captcha.isValid=!1;clearTimeout(greyd.forms.captcha.timeout)};this.init=function(){if(document.querySelectorAll('form.greyd_form #captcha.hide').length!==0){document.body.classList.add('hideCaptcha')}
29greyd.forms.captcha.maybeExecute()};this.maybeExecute=function(callback,args){let sitekey=typeof recaptchaSitekey!=='undefined'?recaptchaSitekey:null;if(sitekey&&!greyd.forms.captcha.isValid){grecaptcha.ready(function(){gre
29captcha.execute(sitekey,{action:'homepage'}).then(function(token){greyd.forms.captcha.isValid=!0;jQuery("input.recaptcha_input").each(function(){jQuery(this).val(token)});console.log('reCAPTCHA token set: '+token);clearTimeout(greyd.forms.captcha.timeout);greyd.forms.captcha.timeout=setTimeout(function(){greyd.forms.captcha.clear()},1000*60*1.9);if(typeof callback==="function"){callback.apply(null,args)}})})}else if(typeof callback==="function"){callback.apply(null,args)}}};greyd.forms.turnstile=new function(){this.init=function(){};this.reset=function(){if(typeof turnstile!=='undefined'){document.querySelectorAll('.cf-turnstile').forEach(function(el){try{turnstile.reset(el)}catch(e){}})}}};greyd.forms.tooltips=new function(){let lastFocusedElement=null;let usingKeyboard=!1;this.initTooltips=function(){const tooltipButtons=document.querySelectorAll('.greyd-forms-tooltip-toggle');tooltipButtons.forEach(btn=>{greyd.forms.tooltips.initializeTooltip(btn)});document.addEventListener('keydown',function(){usingKeyboard=!0;greyd.forms.tooltips.addKeyboardFocusClass()});document.addEventListener('mousedown',function(){usingKeyboard=!1;greyd.forms.tooltips.removeKeyboardFocusClass()})}
30this.initializeTooltip=function(btn){const tooltipId=btn.getAttribute('aria-controls');const tooltip=document.getElementById(tooltipId);const closeBtn=tooltip.querySelector('.greyd-forms-tooltip-close');btn.addEventListener('click',function(e){e.preventDefault();greyd.forms.tooltips.toggleTooltip(btn,tooltip)});closeBtn.addEventListener('click',function(e){greyd.forms.tooltips.closeTooltip(btn,tooltip);e.preventDefault()});btn.addEventListener('keydown',function(e){greyd.forms.tooltips.handleTooltipKeydown(e,btn,tooltip)});tooltip.addEventListener('keydown',function(e){greyd.forms.tooltips.handleTooltipKeydown(e,btn,tooltip)});document.addEventListener('click',function(e){if(!tooltip.contains(e.target)&&e.target!==btn&&tooltip.classList.contains('active')){greyd.forms.tooltips.closeTooltip(btn,tooltip)}});document.addEventListener('focusin',function(e){if(!tooltip.classList.contains('active')){return}
31const t=e.target;if(t===btn||tooltip.contains(t)){return}
32greyd.forms.tooltips.closeTooltip(btn,tooltip,!1)})}
33this.toggleTooltip=function(btn,tooltip){if(tooltip.classList.contains('active')){greyd.forms.tooltips.closeTooltip(btn,tooltip)}else{greyd.forms.tooltips.showNewTooltip(btn,tooltip)}}
34this.showNewTooltip=function(btn,tooltip){lastFocusedElement=document.activeElement;const allTooltips=document.querySelectorAll('.greyd-forms-tooltip-popup');allTooltips.forEach(t=>{if(t!==tooltip&&t.classList.contains('active')){const relatedBtn=document.querySelector(`[aria-controls="${t.id}"]`);greyd.forms.tooltips.closeTooltip(relatedBtn,t)}});tooltip.classList.add('active');btn.setAttribute('aria-expanded','true');const closeButton=tooltip.querySelector('.greyd-forms-tooltip-close');setTimeout(()=>{closeButton.focus()},10);const liveRegion=document.createElement('div');liveRegion.setAttribute('aria-live','polite');liveRegion.innerHTML='Tooltip opened';document.body.appendChild(liveRegion);setTimeout(()=>{document.body.removeChild(liveRegion)},1000)}
35this.closeTooltip=function(btn,tooltip,restoreFocus){if(typeof restoreFocus==='undefined'){restoreFocus=!0}
36tooltip.classList.remove('active');btn.setAttribute('aria-expanded','false');if(restoreFocus&&lastFocusedElement){lastFocusedElement.focus()}}
37this.handleTooltipKeydown=function(e,btn,tooltip){switch(e.key){case 'Escape':if(tooltip.classList.contains('active')){e.preventDefault();greyd.forms.tooltips.closeTooltip(btn,tooltip)}
38break;case 'Enter':case ' ':if(e.target===btn){e.preventDefault();greyd.forms.tooltips.toggleTooltip(btn,tooltip)}
39break}}
40this.addKeyboardFocusClass=function(){const focusableElements=document.querySelectorAll('button, input, a, [tabindex="0"]');focusableElements.forEach(el=>{el.classList.add('keyboard-focus')})}
41this.removeKeyboardFocusClass=function(){const focusableElements=document.querySelectorAll('.keyboard-focus');focusableElements.forEach(el=>{el.classList.remove('keyboard-focus')})}
42this.activeElement=null;
42this.init=function(){jQuery(document).off("click",greyd.forms.tooltips.hideTooltip).on("click",greyd.forms.tooltips.hideTooltip)}
43this.showTooltip=function(elem){var rect=jQuery(elem).find('.forms-tooltip-popup')[0].getBoundingClientRect();if(rect.left<10){jQuery(elem).css('--horizontal-offset',((rect.left-10)*-1)+'px')}else if(rect.right>(window.innerWidth-10)){jQuery(elem).css('--horizontal-offset',(window.innerWidth-rect.right-10)+'px')}
44jQuery(elem).addClass('on');greyd.forms.tooltips.activeElement=jQuery(elem)}
45this.hideTooltip=function(elem){if(typeof elem!=='undefined'){jQuery(elem).removeClass('on')}
46if(greyd.forms.tooltips.activeElement){greyd.forms.tooltips.activeElement.removeClass('on');greyd.forms.tooltips.activeElement=null}}}

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.