public static function textToUidJs($wrap_js_tags = true, array $link_ids = [], $max_length = 99, $run_on_page_load = true, $run_on_input_change = true)
    {
        // Js inner part
        echo self::uidFromTextJsFunction($wrap_js_tags);

        if ($link_ids) {
            if ($wrap_js_tags) {
                echo '<script>';
            }

            $auto_run = $run_on_page_load || $run_on_input_change;

            foreach ($link_ids as $id_src => $id_dst) {
                echo '
                function uidFromTextEvent_', $id_src, '_', $id_dst, '() {
                    document.getElementById("', $id_dst, '").value = uidFromText(document.getElementById("', $id_src, '").value, ', $max_length, ');
                }
                ',
                ($auto_run ? '$(function() {' : ''),
                ($run_on_page_load ? 'uidFromTextEvent_' . $id_src . '_' . $id_dst . '();' : ''),
                ($run_on_input_change ? 'document.getElementById("' . $id_src . '").onchange = uidFromTextEvent_' . $id_src . '_' . $id_dst . '; document.getElementById("' . $id_src . '").onkeyup = uidFromTextEvent_' . $id_src . '_' . $id_dst . ';' : ''),
                ($auto_run ? '});' : '');
            }

            if ($wrap_js_tags) {
                echo '</script>';
            }
        }
    }
public static function textToUidJs($wrap_js_tags = true, array $link_ids = [], $max_length = 99, $run_on_page_load = true, $run_on_input_change = true)
    {
        // Js inner part
        echo self::uidFromTextJsFunction($wrap_js_tags);

        if ($link_ids) {
            if ($wrap_js_tags) {
                echo '<script>';
            }

            $auto_run = $run_on_page_load || $run_on_input_change;

            foreach ($link_ids as $id_src => $id_dst) {
                echo '
                function uidFromTextEvent_', $id_src, '_', $id_dst, '() {
                    document.getElementById("', $id_dst, '").value = uidFromText(document.getElementById("', $id_src, '").value, ', $max_length, ');
                }
                ',
                ($auto_run ? '$(function() {' : ''),
                ($run_on_page_load ? 'uidFromTextEvent_' . $id_src . '_' . $id_dst . '();' : ''),
                ($run_on_input_change ? 'document.getElementById("' . $id_src . '").onchange = uidFromTextEvent_' . $id_src . '_' . $id_dst . '; document.getElementById("' . $id_src . '").onkeyup = uidFromTextEvent_' . $id_src . '_' . $id_dst . ';' : ''),
                ($auto_run ? '});' : '');
            }

            if ($wrap_js_tags) {
                echo '</script>';
            }
        }
    }
public static function textToUidJs ( $ wrap_js_tags = true , array $ link_ids = [ ] , $ max_length = 99 , $ run_on_page_load = true , $ run_on_input_change = true ) { // Js inner part echo self :: uidFromTextJsFunction ( $ wrap_js_tags ) ; if ( $ link_ids ) { if ( $ wrap_js_tags ) { echo '<script>' ; } $ auto_run = $ run_on_page_load || $ run_on_input_change ; foreach ( $ link_ids as $ id_src => $ id_dst ) { echo '
                function uidFromTextEvent_' , $ id_src , '_' , $ id_dst , '() {
                    document.getElementById("' , $ id_dst , '").value = uidFromText(document.getElementById("' , $ id_src , '").value, ' , $ max_length , ');
                }
                ' , ( $ auto_run ? '$(function() {' : '' ) , ( $ run_on_page_load ? 'uidFromTextEvent_' . $ id_src . '_' . $ id_dst . '();' : '' ) , ( $ run_on_input_change ? 'document.getElementById("' . $ id_src . '").onchange = uidFromTextEvent_' . $ id_src . '_' . $ id_dst . '; document.getElementById("' . $ id_src . '").onkeyup = uidFromTextEvent_' . $ id_src . '_' . $ id_dst . ';' : '' ) , ( $ auto_run ? '});' : '' ) ; } if ( $ wrap_js_tags ) { echo '</script>' ; } } }
Replaces non-latin chars to latin pairs, with JS event handlers

@param bool  $wrap_js_tags if need to use Javascript wrap
@param array $link_ids     list of elements to link with in HTML
@param int   $max_length
@param bool  $run_on_page_load
@param bool  $run_on_input_change
Replaces non - latin chars to latin pairs with JS event handlers