(function ($) {
/**
* Get an HTMLElement using Jquery, and store them in a cache for a faster access later
* @param selector {String} The Jquery selector to use
* @return {(jQuery.fn.init | jQuery | HTMLElement)} The JQuery HTMLElement
*/
$.selector_cache = function (selector) {
if (!$.selector_cache[selector]) {
$.selector_cache[selector] = $(selector);
}
return $.selector_cache[selector];
};
})(jQuery); // Edit JQuery namespace to use the function as $.selector_cache('#elements');
$(document).ready(function () {
loadHeader();
fixheader();
});
$.selector_cache('.nav-item')
.on('mouseover', function () {
$(this).find('.link-effect').addClass('link-hovered');
})
.on('mouseleave', function () {
$(this).find('.link-effect').removeClass('link-hovered');
}).on('click', function () {
$(this).find('.link-effect').removeClass('link-hovered');
$(this).find('.link-effect').addClass('link-active');
});
/**
* Stop the header from changing height on mobile (with fullscreen browsing)
*/
function fixheader() {
if ($.selector_cache("#headerJumbotron").length > 0) {
let height = $(window).height() * 0.4;
$.selector_cache('#headerJumbotron').css('height', height);
}
}
function loadHeader() {
if ($.selector_cache("#headerJumbotron").length > 0) {
animateCss($.selector_cache('#headerTitle'), 'fadeInUp faster');
$.selector_cache('#headerTitle').css('opacity', 1);
setTimeout(function () {
animateCss($.selector_cache('#headerSubTitle'), 'fadeInUp faster');
$.selector_cache('#headerSubTitle').css('opacity', 1);
}, 100);
setTimeout(function () {
$.selector_cache('#headerTop').addClass('loaded');
}, 100);
setTimeout(function () {
$.selector_cache('#headerBottom').addClass('loaded');
}, 300);
}
}
// Using animate.css, translated into jquery
// https://github.com/daneden/animate.css
function animateCss($elem, animationName, callback) {
$elem.addClass('animated ' + animationName);
$elem.on('animationend', function () {
$elem.removeClass('animated ' + animationName);
if (typeof callback === 'function')
callback();
});
}
jconfirm.defaults = {
title: 'Title',
titleClass: '',
type: 'red',
typeAnimated: true,
draggable: false,
dragWindowGap: 15,
dragWindowBorder: true,
animateFromElement: true,
smoothContent: true,
content: 'content',
escapeKey: 'ok',
buttons: {},
defaultButtons: {
ok: {
keys: ['enter'],
text: 'OK',
action: function () {
}
},
close: {
action: function () {
}
},
},
contentLoaded: function (data, status, xhr) {
},
icon: '',
lazyOpen: false,
bgOpacity: null,
theme: 'supervan',
animation: 'scale',
closeAnimation: 'scale',
animationSpeed: 300,
animationBounce: 1,
rtl: false,
container: 'body',
containerFluid: false,
backgroundDismiss: false,
backgroundDismissAnimation: 'shake',
autoClose: false,
closeIcon: null,
closeIconClass: false,
watchInterval: 100,
columnClass: 'xlarge',
boxWidth: '50%',
scrollToPreviousElement: true,
scrollToPreviousElementAnimate: true,
useBootstrap: true,
offsetTop: 40,
offsetBottom: 40,
bootstrapClasses: {
container: 'container',
containerFluid: 'container-fluid',
row: 'row',
},
onContentReady: function () {
},
onOpenBefore: function () {
// after the modal is displayed.
$('body').css('overflow', 'hidden');
},
onOpen: function () {
},
onClose: function () {
// before the modal is hidden.
$('body').css('overflow', 'auto');
},
onDestroy: function () {
},
onAction: function () {
}
};