HEX
Server: Apache/2
System: Linux sm.stlbg.net 3.10.0-962.3.2.lve1.5.87.el7.x86_64 #1 SMP Tue Jan 28 09:38:56 UTC 2025 x86_64
User: todorterziev (1053)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/todorterziev/public_html/wp-content/plugins/cyrlitera/admin/assets/js/cyrlitera-for-acf.js
jQuery(function($){
    // transliterate field-name
    acf.addFilter('generate_field_object_name', function(val){
        return replace_field(val);
    });

    $(document).on('keyup change', '.acf-field .field-name', function(){
        if ( $(this).is(':focus') ){
            return false;
        }else{
            var val = $(this).val();
            val = replace_field( val );

            if ( val !== $(this).val() ) {
                $(this).val(val);
            }
        }

    });
    function replace_field( val ){
        console.log(val);
        val = $.trim(val);
        if(window.cyr_and_lat_dict === undefined){
            console.error('Cyrlitera for ACF: lang dictionary not loaded!')
            return val;
        }
        var table = window.cyr_and_lat_dict;

        $.each( table, function(k, v){
            var regex = new RegExp( k, 'g' );
            val = val.replace( regex, v );
        });

        val = val.replace( /[^\w\d-_]/g, '' );
        val = val.replace( /_+/g, '_' );
        val = val.replace( /^_?(.*)$/g, '$1' );
        val = val.replace( /^(.*)_$/g, '$1' );

        return val;
    }
});