<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">$ = jQuery.noConflict();
$(document).ready(function(){

// window.startNano = function(){
//     if($(document).find('.nano').length){
//         $(document).find('.nano').nanoScroller();
//     }
// }

var selectFirstLoad = true;
window.loadCustomSelect = function(){
    if($(document).find('.custom-select').length){
        $(document).find('.custom-select').each(function() {
            container = $(this);
            if(selectFirstLoad){
                selectOptions = '&lt;div class="nano"&gt;&lt;div class="nano-content"&gt;&lt;ul class="custom-select__list"&gt;';
                selectedOption = false;
                if($(this).find(':selected').length){
                    inputText = $(this).find(':selected').text().trim();
                    // console.log(inputText);
                    container.find('.custom-select-name span').html( inputText );
                    selectedOption = $(this).find(':selected').val();
                }
                else{
                    container.find('.custom-select-name span').text( $(this).find('option').eq(0).text() ).addClass('placeholder');
                }
                if(container.find('optgroup').length){
                    selectOptions += '&lt;li data-value="' + container.find('option').eq(0).val() + '" class="' + ((selectedOption == container.find('option').eq(0).val())? 'selected' : '') + '"&gt;' + container.find('option').eq(0).text() + '&lt;/li&gt;';
                    container.find('optgroup').each(function(){
                        selectOptions += '&lt;li class="groupname"&gt;' + $(this).attr('label') + '&lt;/li&gt;';
                        $(this).find('option').each(function(){
                            inputText = $(this).text().trim();
                            selectOptions += '&lt;li data-value="' + $(this).val() + '" class="' + ((selectedOption == $(this).val())? 'selected' : '') + '"&gt;' + inputText + '&lt;/li&gt;';
                        });
                    });
                }
                else{
                    container.find('option').each(function(){
                        inputText = $(this).text().trim();
                        optionVal = $(this).val();
                        optionIcon = '';
                        optionColor = '';
                        
                        selectOptions += '&lt;li data-value="' + $(this).val() + '" class="' + ((selectedOption == $(this).val())? 'selected' : '') + '"&gt;' + inputText + '&lt;/li&gt;';
                        
                    });
                }
                selectOptions += '&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;';
                container.find('.custom-select-options').html(selectOptions);
            }
        });
        selectFirstLoad = false;
        // startNano();
    }
}
loadCustomSelect();

$(document).on('change', '.custom-select select', function(){
    inputText = $(this).find('option').filter(':selected').text().trim();
    //console.log(inputText);
    optionVal = $(this).find('option').filter(':selected').val();
    name = $(this).attr('name');
    //console.log(name);

    $(this).closest('.custom-select').addClass('hasValue');
    $(this).parent().parent().find('.custom-select-name span').html( inputText ).removeClass('placeholder');
    
    $(this).parent().parent().find('.custom-select-options li').removeClass('selected');
    $(this).parent().parent().find('.custom-select-options').find('li[data-value="' + $(this).find('option').filter(':selected').val() + '"]').addClass('selected');


    $(this).parent().parent().removeClass('open error');
    $(this).parent().removeClass('open error');

    //console.log($(this));
}).change();

$(document).on('click', '.custom-select .custom-select-name', function(e){
    currentSelect = $(this);
    $(document).find('.custom-select').each(function(ele){
        if(currentSelect.offset().top != $(this).offset().top){
            $(this).removeClass('open');
        }
    });
    currentSelect.parent().toggleClass('open');
    e.stopImmediatePropagation()  
    e.stopPropagation();
    e.preventDefault();
    return false;
})

$(document).on('click', '.custom-select .custom-select-options li:not(.groupname)', function(){
    $(this).closest('.custom-select').find('select').val( $(this).data('value') ).change();
})

$(document).on('click',function(e){
    if (!$(e.target).closest('.custom-select').length) {
        $('.custom-select').removeClass('open');
    }
})

    
function checkSelectOptions(select) {
    $('.submit').on('click', function(){
        //console.log($(select).val());
       if($(select).val() == '') {
         $(select).parent().addClass('error');
         $(select).parent().parent().addClass('error');
       } else {
         $(select).parent().removeClass('error');
         $(select).parent().parent().removeClass('error');
       }
    });
  }

  if($('.g__form .custom-select select').length) checkSelectOptions('.g__form .custom-select--stanowisko select');



});
</pre></body></html>