(function($) {
    "use strict";
    $(document).ready(function() {

        // Adds variable for handling script

        var $filter_list_elements = $('.filter-controls[team-id] ').children();

        // Loops through all <li> items and adds class for 
        $filter_list_elements.each(function(i) {
            // Add atribute to have a backup value
            $(this).attr('default-order', (i + 1));

            // Create class name and latinize it
            var $class_name = $(this).text().latinize();

            if ($class_name.split(' ')[0]) {
                // Add class name if exist word inside a node
                $(this).addClass('wpk-order-' + $class_name.split(' ')[0].toLowerCase());
            } else if ($(this).children().hasClass('ats-search')) {
                // Add class name for search 
                $(this).addClass('wpk-order-search');

            } else {
                // Add class name for any other empty element
                $(this).addClass('wpk-order-element');
            }

        });

    });
})(jQuery);