"use strict";
(function ($) {
    $.block_top_event = function (element, options) {
        let defaults = {
            row_state_template: ""
        };
        let plugin = this;
        plugin.settings = {}
        let $element = $(element);
        plugin.init = function () {
            plugin.settings = $.extend({}, defaults, options);

            $element.find('.my-choice').click(function (e) {
                $('.my-choice').not(this).removeClass('active')
                $(this).addClass('active')
            });
            $element.find('.heart').click(function (e) {
                $(this).toggleClass('active')
            });
            $element.find('.list-event-top').hide();
            $element.find('.list-event-best').hide();

            $element.find('.top').click(function (e) {
                let $link =$(this).closest('.link');
                $link.next('.list-event-newest').hide();
                $element.find('.list-event-best').hide();
                $element.find('.list-event-top').show();
            });
            $element.find('.newest').click(function (e) {
                let $link =$(this).closest('.link');
                $element.find('.list-event-top').hide();
                $element.find('.list-event-best').hide();
                $link.next('.list-event-newest').show();
            });
            $element.find('.best').click(function (e) {
                let $link =$(this).closest('.link');
                $link.next('.list-event-newest').hide();
                $element.find('.list-event-best').show();
                $element.find('.list-event-top').hide();
            });
        }
        plugin.example_function = function () {
        }
        plugin.init();
    }
    $.fn.block_top_event = function (options) {
        return this.each(function () {
            if (undefined === $(this).data('block_top_event')) {
                let plugin = new $.block_top_event(this, options);
                $(this).data('block_top_event'
                    , plugin);
            }
        });
    }
})(jQuery);
