function mediaLCR() {
    $(".media").length > 0 && $.ajax({
        url: "https://ice.lsu.co.uk/status-json.xsl",
        success: function(e) {}})
}

function activity_filter() {
    $(".filter").length > 0 && $(".filter .filter-item").click((function() {
        $(".filter .filter-item").removeClass("active"), $(this).addClass("active");
        var e = $(this).attr("data-filter-id");
        $(".society-item-wrapper").hide(), $(".society-item-wrapper[data-cat-id='" + e + "']").show()
    }))
}

function randomBetween(e, t) {
    return Math.floor(Math.random() * (t - e + 1) + e)
}

function menu() {
    $(".mobile-menu-btn").click((function() {
        $("#main-menu").slideToggle(), $("#main-menu").toggleClass("mobile"), $(this).toggleClass("active")
    })), $(".sub-menu").click((function(e) {e.stopPropagation()})), $(".main-menu > ul > li").click((function() {$(this).children(".sub-menu").slideToggle(500)}))
}

function swipes(e, t, i, a) {
    let n = $("#" + e + " ." + t).length,
        s = "1/" + n;
    $(".slider-counter[data-parent='" + e + "']").length > 0 && $(".slider-counter[data-parent='" + e + "']").html(s), window.mySwipe = new Swipe(document.getElementById(e), {
        startSlide: 0,
        speed: 400,
        auto: 6e3,
        draggable: a,
        continuous: !0,
        disableScroll: !1,
        stopPropagation: !1,
        callback: function(e, t, i) {},
        transitionEnd: function(t, i) {
            let a = t + 1 + "/" + n;
            $(".slider-counter[data-parent='" + e + "']").length > 0 && $(".slider-counter[data-parent='" + e + "']").html(a)
        }
    })
}

function eventsNotifications() {
    $(".visible-date").each((function(e) {
        let t = $(this).attr("data-event-date");
        $(".event-list ." + t).length > 0 && $(this).addClass("noti")
    }))
}

function eventsCalander(e) {
    let t = e.getFullYear() + "-" + ("0" + (e.getMonth() + 1)).slice(-2) + "-" + ("0" + e.getDate()).slice(-2);
    $(".event-item").removeClass("active current"), $(".event-list ." + t).addClass("active"), $(".event-list ." + t).first().addClass("current"), $("#event-containter ." + t).first().addClass("active"), $(".event-item").click((function() {
        let e = $(this).attr("data-event-id");
        $(".event-item").removeClass("current"), $(this).addClass("current"), $(".event-info").each((function(t) {
            $(this).attr("data-event-id") == e && ($(".event-info").removeClass("active"), $(this).addClass("active"))
        }))
    }))
}

function eventsByMonthAjax(e) {
    $.ajax({
        url: "/whats-on/by-month-ajax",
        method: "POST",
        data: {
            month: e
        }
    }).done((function(e) {
        (e = JSON.parse(e)).success ? $.each(e.events, (function(e, t) {
            let i = t.id,
                a = t.name,
                n = t.short_desc,
                s = t.type_name,
                l = t.thumbnail_url,
                r = t.image_url,
                c = t.filter_date,
                o = t.start_date,
                d = t.u_start_date,
                u = t.venue_name,
                v = t.start_time,
                m = t.end_time,
                f = t.url;
            $(".visible-date[data-event-date='" + c + "']").addClass("noti"), eventContainerMarkup(i, a, n, s, l, r, c, o, d, u, v, m, f)
        })) : null != e.error_message && alert(e.error_message)
    })).fail((function(e) {
        null != e.error_message && alert(e.error_message)
    }))
}

function eventContainerMarkup(e, t, i, a, n, s, l, r, c, o, d, u, v) {
    eventListMarkup = '<a style="text-decoration: none;" href="/whats-on/id/' + e + "-" + v + '"><div class="event-item ' + l + ' " data-event-id="' + e + '">' + t + '<div class="event-time"><i class="far fa-clock"></i>' + d + " - " + u + "</div></div></a>", 
    $(".event-list").empty, 
    $(".event-list").append(eventListMarkup)
}

function kukriTruncatePrefix() {
    const e = "Kukri - ";
    $(".kukri-page .kukri-name").each((function(t) {
        let i = $(this).text();
        i.substring(0, e.length) == e && (i = i.substring(e.length), $(this).text(i))
    }))
}

function newsblock() {
    $(".news-item").length;
    $(".news-item").first().addClass("current first");
    setInterval((function() {
        var e = $(".news-item.current"),
            t = e.next();
        $(e).is(":last-child") && (t = $(".news-item").first()), newBlockTransition(e, t)
    }), 5e3)
}

function newBlockTransition(e, t) {
    var i = new TimelineMax({
        paused: !0
    });
    i.to($(e), .8, {
        scale: 1.2,
        opacity: 0,
        ease: Power3.easeOut,
        onComplete: function() {
            $(".news-item").removeClass("active current"), t.addClass("current"), i.to($(t), .8, {
                scale: 1,
                opacity: 1,
                ease: Power3.easeOut
            })
        }
    }), i.play()
}
