<script src="{{ constant('SITE_TEMPLATES_PATH') ~ '/' ~ siteConfig.getTemplate }}/js/jquery-3.6.0.min.js"></script>
<script src="{{ constant('SITE_TEMPLATES_PATH') ~ '/' ~ siteConfig.getTemplate }}/js/bootstrap.bundle.min.js"></script>
<script src="{{ constant('SITE_TEMPLATES_PATH') ~ '/' ~ siteConfig.getTemplate }}/js/jquery-scrollto.js"></script>
<script src="{{ constant('SITE_TEMPLATES_PATH') ~ '/' ~ siteConfig.getTemplate }}/js/jquery.inview.min.js"></script>
<script src="{{ constant('SITE_TEMPLATES_PATH') ~ '/' ~ siteConfig.getTemplate }}/js/jquery.fancybox.min.js"></script>
{% if not editmode %}
<script src="{{ constant('SITE_TEMPLATES_PATH') ~ '/' ~ siteConfig.getTemplate }}/js/ccm.js"></script>
{% endif %}
<script>
$().ready(function() {
// get enviroment dimensions
var viewportHeight = $(window).height();
var viewportWidth = $(window).width();
var displayHeight = $('html').height();
var scrollTop = $(window).scrollTop();
// re-adjust on resize ...
$(window).resize(function()
{
var viewportHeight = $(window).height();
var viewportWidth = $('html').width();
$('.fixed-banner').css('height', viewportHeight+'px');
});
// set cover height
$('.fixed-banner').css('height', viewportHeight+'px');
// flash transition
$('body').css('opacity', 0).animate({opacity: 1}, 800);
// navbar
$('#nav-icon').click(function(){
$(this).toggleClass('open');
});
$('.navbar .nav-link').click(function() {
$('.navbar-collapse').removeClass('show');
});
$(window).scroll(function() {
var v = $(window).scrollTop();
if ( v > viewportHeight )
{
$('.navbar .nav-link, #nav-icon,.site-name,.dropdown-item').addClass('inverted');
$('.navbar,.dropdown-menu').addClass('navbar-inverted');
}
else
{
$('.navbar .nav-link, #nav-icon,.site-name,.dropdown-item').removeClass('inverted');
$('.navbar,.dropdown-menu').removeClass('navbar-inverted');
}
});
// background images
$('.section-bg-image').each(function() {
var img = $(this).data('src');
$(this).css("background-image", "url('" + img + "')");
});
// scroll to
$('a[href*=\\#]').bind("click", function(event) {
event.preventDefault();
var target = $(this).attr("href");
if (!target.match(/slider(.*)/i)) {
$('html,body').animate({
scrollTop: $(target).offset().top
}, 2000);
}
});
// animate on scroll
$('.scroll-animated').bind('inview', function(event, visible) {
if ( visible ) {
$(this).animate({
bottom: '1rem',
opacity: 1
}, 600, 'swing');
}
});
// init animated
$('.animated').each(function() {
var a = $(this).data('animation');
$(this).addClass(a);
});
// animate
$('.animated').bind('inview', function(event, visible) {
if ( visible ) {
var a = $(this).data('animation');
var d = ($(this).data('delay') != undefined && $(this).data('delay') != '') ? parseInt($(this).data('delay')) : 100;
var t = ($(this).data('timing') != undefined && $(this).data('timing') != '') ? parseInt($(this).data('timing')) : 500;
switch(a) {
case 'animate__fadeIn' :
$(this).delay(d).animate({
opacity: 1
}, t);
break;
case 'animate__slideInUp' :
$(this).delay(d).animate({
top: '0px',
opacity: 1
}, t);
break;
case 'animate__slideInLeft' :
$(this).delay(d).animate({
left: '0px',
opacity: 1
}, t);
break;
case 'animate__slideInRight' :
$(this).delay(d).animate({
right: '0px',
opacity: 1
}, t);
break;
};
}
});
// calendar
$('.calendar-toggler').click(function() {
e = $(this).data('item');
$(this).hide();
$(e).slideToggle();
});
$('footer').bind('inview', function(event, visible) {
if ( visible ) {
$('.scroll-top').animate({
bottom: '2rem',
opacity: 1
}, 200, 'swing');
}
});
// animate animated
$('.animate__animated').bind('inview', function(event, visible) {
var a = $(this).data('fx');
$(this).addClass(a);
$(this).animate({opacity:1},800);
});
// submit form data
$('.submitAjaxForm').click(function() {
var formId = $(this).data('form');
var formType = $(this).data('type');
var formFields = $('#'+formId).find('.ajax-form-field').toArray();
var formQueryString = {};
// prefill fqs
formQueryString['locale'] = '{{ locale }}';
// auto fill input + textarea values
for (i = 0; i < formFields.length; i += 1) {
console.log('Parse element ' + formFields[i].getAttribute('name') + ' -> value: ' + formFields[i].value);
input_id = formFields[i].getAttribute('name');
input_value = formFields[i].value;
formQueryString[input_id] = input_value;
}
// loading ...
var b = $(this).html();
$(this).prepend('<div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div>');
// send data
console.log('Calling end point: ' + formType);
$.ajax({
url : formType,
type : "POST",
data : formQueryString,
dataType : "text",
success : function(data, jqXHR) {
// console.log('Response: ' + data);
var r = data;
var s = JSON.parse(r);
console.log('Json: ' + s);
$('#'+formId).find('.ajax-message').remove();
$('#'+formId).append('<div class="ajax-message"><div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div></div>');
if (s.code != '200') {
$('#'+formId + ' .ajax-message').delay(500).html(s.message).fadeIn();
$('.spinner-border').remove();
} else {
$('#'+formId).html('<div class="alert alert-success">' + s.message + '</div>');
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$('#'+formId).html('Es tut uns leid, es ist ein Fehler aufgetreten.');
}
});
});
// ajax mediathek update
var om = 0; // last offset
$('#loadMediathekData').bind('inview', function(event, visible) {
var t = $(this).data('target');
var o = parseInt($(this).data('offset'));
if (typeof o==='number' && om < o)
{
$.ajax({
url : '/ajax/mediathek/load',
type : "POST",
data : { offset: o },
dataType : "text",
success : function(data, jqXHR) {
console.log('Response: ' + data);
var r = data;
var s = JSON.parse(r);
if (s.html!='') {
$(t).append(s.html);
$('#loadMediathekData').data('offset', s.offset);
om = o;
} else {
$('#loadMediathekData').data('offset', -1);
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
console.log('Es ist ein Fehler aufgetreten.');
}
});
}
});
// ajax newsblog update
var on = 0; // last offset
$('#loadNewsblogData').bind('inview', function(event, visible) {
var t = $(this).data('target');
var o = parseInt($(this).data('offset'));
if (typeof o==='number' && on < o)
{
$.ajax({
url : '/ajax/newsblog/load',
type : "POST",
data : { offset: o },
dataType : "text",
success : function(data, jqXHR) {
// console.log('Response: ' + data);
var r = data;
var s = JSON.parse(r);
if (s.html!='') {
$(t).append(s.html);
$('#loadNewsblogData').data('offset', s.offset);
on = o;
} else {
$('#loadNewsblogData').data('offset', -1);
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
console.log('Es ist ein Fehler aufgetreten.');
}
});
}
});
// navbar search
$('.openSearchform').click(function() {
var f = $(this).data('toggle');
console.log('toggle: ' + f);
$(this).hide();
$(f).show().animate({width:'150px'}, 300);
});
{% if initWidgets is defined %}
$(window).on('load resize', function() {
// init {{ initWidgets }} widgets
var widgetInitOffset = (viewportWidth<1400) ? 20 : 40;
var widgetOffset = (viewportWidth<1400) ? 30 : 40;
{% if siteConfig.getWidgetShowPreviewImage=='1' %}
var widgetHeight = (viewportWidth<1400) ? 90 : 380;
{% else %}
var widgetHeight = (viewportWidth<1400) ? 90 : 120;
{% endif %}
var widgetDelay = 300;
$('.widget').each(function(index) {
var w=index;
var y=(w==0) ? widgetInitOffset : widgetOffset;
var h=$(this).height();
if (w != undefined && w > -1)
{
$(this)
.animate({'opacity': 1}, widgetDelay*3)
.animate({'bottom': (w*widgetHeight + (w+1*y)) + 'px'}, widgetDelay*(w+1));
console.log('Placed widget h=' + h + ' ' + w + ' to position ' + widgetOffset*(w+1) + 'px');
}
});
});
{% endif %}
$(window).on('scroll', function() {
var b=0;
var y=$(window).scrollTop();
if (viewportWidth>1199)
{
if (b<y)
{
$('.widget').animate({
'right': '-'+y+'px'
}, 10);
}
else
{
if (y==0)
y=30;
$('.widget').animate({
'right': y+'px'
}, 10);
}
b=y;
}
});
});
</script>
<script language="javascript">
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(c_name) {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x == c_name) {
return unescape(y);
}
}
}
function validateEmail(email)
{
// var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
if( email.match( /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ ) )
return true;
else
return false;
}
</script>