function t(t, e) { var a = $(t).attr("data-date"); a = new Date(a); var n = $(e).attr("data-date"); return (n = new Date(n)) - a } function e(t, e) { return 1 * $(t).attr("data-popularity") < 1 * $(e).attr("data-popularity") ? 1 : -1 } $(window).scroll((function () { if ($(this).scrollTop() > 150) { $("#fixed-items").addClass("fixed-top"), $("#main-nav").addClass("shrink"); var t = $("#top-header").height(); $(".fs-wrapper").css("padding-top", t + 80) } else $("#fixed-items").removeClass("fixed-top"), $("#main-nav").removeClass("shrink"), $(".fs-wrapper").css("padding-top", 0) })), $(document).ready((function () { $(window).width() < 1024 ? $("#navbarSide").addClass("navbar-side") : $("#navbarSide").removeClass("navbar-side") })), $(document).ready((function () { $("#navbarSideButton").on("click", (function () { $(".navbar-side").addClass("reveal"), $(".overlay").show() })), $(".closenav").on("click", (function () { $(".navbar-side").removeClass("reveal"), $(".overlay").hide() })), $("#elementNav a").on("click", (function () { $("#elementNav a").removeClass("active"), $(this).addClass("active") })), $(".mega-toggle").on("click", (function () { $(".navbar-side .dropdown-menu.mega").toggle() })) })), window.addEventListener("load", (function () { var t = document.getElementsByClassName("needs-validation"); Array.prototype.filter.call(t, (function (t) { t.addEventListener("submit", (function (e) { if (!1 === t.checkValidity()) { e.preventDefault(), e.stopPropagation(); for (var a = document.querySelectorAll("input.form-control:invalid,input.form-check-input:invalid,select.custom-select:invalid"), n = 0; n < a.length; n++)"valid-feedback" == a.className && (a.className = "invalid-feedback", a.innerText = "This field is required."); $("html, body").animate({ scrollTop: $(a[0]).offset().top - 150 }, 1e3) } t.classList.add("was-validated") }), !1) })) }), !1), $(document).ready((function () { $(window).width() < 768 ? $("#searchRefine").addClass("search-mobile") : $("#searchRefine").removeClass("search-mobile") })), $(document).ready((function () { $("#searchRefineButton").on("click", (function () { $(".search-mobile").addClass("reveal"), $(".overlay").show() })), $(".closenav").on("click", (function () { $(".search-mobile").removeClass("reveal"), $(".overlay").hide() })) })), $((function () { $('[data-toggle="tooltip"]').tooltip() })), $((function () { $("#storybar_close").click((function () { $("#storybar").hide(), $("#theme").removeClass("bg-image"), $("#theme_style").remove(), $("#storybar_open_container").show() })), $("#storybar_open").click((function () { $("#storybar").show(), $("#theme").addClass("bg-image"), $("#storybar_open_container").hide() })) })), $(document).ready((function () { $(window).scroll((function () { $(this).scrollTop() > 50 ? $(".share-widget-inner").addClass("stick") : $(".share-widget-inner").removeClass("stick") })) })), $("#share").jsSocials({ showLabel: !0, shareIn: "popup", shares: ["twitter", "facebook", "linkedin", "email"] }); function a(t, e) { return $(t).attr("data-topic").replace(/ /g, "") > $(e).attr("data-topic").replace(/ /g, "") ? 1 : -1 } function n(t, e) { return $(t).attr("data-element") > $(e).attr("data-element") ? 1 : -1 } function i(t) { var e = 0; $(".dont-sort").each((function () { card_count = $("#directory .course").length, box_html = $(this).clone(), box_index = 1 * $(this).attr("data-position"), box_index_1 = 1 * $(this).attr("data-position") - e, $(this).remove(), card_count >= box_index_1 && null != $("#directory .sort-card:eq(" + box_index_1 + ")").attr(t) ? $("#directory .sort-card:eq(" + box_index_1 + ")").before(box_html) : $("#directory .sort-card:last").after(box_html), e++ })) } $(document).ready((function () { $("a.most_recent").click((function (e) { e.preventDefault(); $(".dont-sort").each((function () { $(this).attr("data-position", 1 * $(this).index()) })), $("#directory .sort-card").sort(t).appendTo("#directory"), i("data-date") })), $("a.element").click((function (t) { if (t.preventDefault(), !$(this).hasClass("active")) { $(".dont-sort").each((function () { $(this).attr("data-position", 1 * $(this).index()) })), $("#directory .sort-card").sort(n).appendTo("#directory"), i("data-element") } })), $("a.topic").click((function (t) { if (t.preventDefault(), !$(this).hasClass("active")) { $(".dont-sort").each((function () { $(this).attr("data-position", 1 * $(this).index()) })), $("#directory .sort-card").sort(a).appendTo("#directory"), i("data-topic") } })), $("a.popularity").click((function (t) { t.preventDefault(); $(".dont-sort").each((function () { $(this).attr("data-position", 1 * $(this).index()) })), $("#directory .sort-card").sort(e).appendTo("#directory"), i("data-popularity") })), $(".nav .nav-item").click((function () { $(".nav .nav-item").removeClass("active"), $(this).addClass("active"), $("#directory .course").fadeOut() })) })), $(document).ready((function () { var t = window.location.hash.substr(1); if ("" != t) { switch (t) { case "element": var o = $("a.element"), s = n, r = "data-element"; break; case "topic": o = $("a.topic"), s = a, r = "data-topic"; break; case "popularity": o = $("a.popularity"), s = e, r = "data-popularity"; break; default: return }if (!$(o).hasClass("active")) { $(".dont-sort").each((function () { $(o).attr("data-position", 1 * $(o).index()) })), $("#directory .sort-card").sort(s).appendTo("#directory"), i(r), $(".nav .nav-item").removeClass("active"), $(o).addClass("active") } } })), $(".scroll").click((function (t) { t.preventDefault(), $("html,body").animate({ scrollTop: $(this.hash).offset().top - 75 }, 500) })), $(".expiry").on("input", (function () { if (2 === $(this).val().length) { var t = $(this).val(); t += "/", $(this).val(t) } })), $((function () { $(".typeselector").change((function () { $(".types").hide(), $("#" + $(this).val()).fadeIn() })) })), $("#billingaddress").hide(), $("#chkbilling").click((function () { $(this).is(":checked") ? $("#billingaddress").show() : $("#billingaddress").hide() })), $(window).scroll((function () { $(this).scrollTop() > 50 ? $(".total-bar").fadeIn() : $(".total-bar").fadeOut() })), $(".editable").on("click", ".showButton", (function () { $(this).parent().parent().find(".defaultView").toggle(), $(this).parent().parent().find(".editView").toggle(), $(this).removeClass("showButton").addClass("hideButton").text("CLOSE") })), $(".editable").on("click", ".hideButton", (function () { $(this).parent().parent().find(".editView").toggle(), $(this).parent().parent().find(".defaultView").toggle(), $(this).removeClass("hideButton").addClass("showButton").text("EDIT") })), $("button.btn-cancel").click((function () { $(this).closest(".editable").find(".defaultView").toggle(), $(this).closest(".editable").find(".editView").toggle(), $(this).closest(".editable").find("button.edit-toggle").text("EDIT") })), $("#button-menu").click((function () { "nav-open" == $("#button-menu").attr("class") ? ($(".navigation").css({ width: "100%", background: "rgba(0,0,0,.2)" }), $("#button-menu").addClass("nav-close"), $(window).width() > 991 ? $(".navigation .menu").css({ left: "0px" }) : ($(".navigation .menu").css({ left: "0px" }), $(".navigation #menu-training.submenu").css({ left: "0px" }), $(".navigation #menu-ent.subsubmenu").css({ left: "0px" }))) : ($(".navigation").css({ width: "0%", background: "rgba(0,0,0,.2)" }), $("#button-menu").removeClass("nav-close").addClass("nav-open"), $(".navigation .submenu").css({ left: "-320px" }), $(".navigation .subsubmenu").css({ left: "-320px" }), $(".navigation .menu").css({ left: "-320px" })) })), $(".navigation .menu > .item-submenu a").click((function () { var t = $(this).parent().attr("menu"); $(".item-submenu[menu=" + t + "] .submenu").css({ left: "0px" }) })), $(".navigation .menu .item-subsubmenu a").click((function () { var t = $(this).parent().attr("menu"); $(".item-subsubmenu[menu=" + t + "] .subsubmenu").css({ left: "0px" }) })), $(".navigation li.go-back").click((function () { $(this).parent().css({ left: "-320px" }) }));