Увеличьте время на индикаторе прогресса - PullRequest
1 голос
/ 15 октября 2019

У меня есть веб-сайт, который выполняет перевод субтитров, но перед переводом индикатор выполнения субтитров завершает загрузку и показывает кнопку загрузки, чтобы мои посетители сохранили неполные субтитры.

Можно ли мне продлить времяиндикатор выполнения или после перевода субтитров, который выполняет обратный отсчет как минимум на 5 секунд дольше, пока перевод субтитров завершен?

Это штрих-код прогресса:

<div id="select_lang">
<div class="wrapper"> Translating <span class="info"></span>...<div class="progress-bar" ease-in-out><span class="progress-bar-fill" style="width: 0%;"></span></div>
</div>
</div>

И этоCSS.

.progress-bar {
    width: 100%;
    background-color: #e0e0e0;
    padding: 3px;
    border-radius: 3px;
    box-shadow: inset 0 1px 3px rgba(47, 44, 56);
}

.progress-bar-fill {
    display: block;
    height: 22px;
    background-color: #ffffff;
    border-radius: 3px;
    transition: width 500ms ease-in-out;
}

также этот сценарий может помочь больше:

               ```<script type="text/javascript">
                function getFile() {
                    var filePath = document.getElementById("file").value;
                    var valu = document.getElementById("updateFile").value = filePath;
                    var valu  = valu.split(/(\\|\/)/g).pop();
                    var parts = valu.split(".");
                    document.getElementById("subtitle").value = parts[0];
                    var langPath = $("select.goog-te-combo option:selected").text();
                    document.getElementById("country").value = langPath;
                    //file upload
                    var file_data = $('#file').prop('files')[0];
                    var form_data = new FormData();
                    form_data.append('file', file_data);
                    $.ajax({
                        url: 'upload_file.php', // point to server-side PHP script
                        dataType: 'text',  // what to expect back from the PHP script, if anything
                        cache: false,
                        contentType: false,
                        processData: false,
                        data: form_data,
                        type: 'post',
                        success: function(data){
                            console.log(data); // display response from the PHP script, if any
                        }
                    });
                }
            </script>```

или этот:

<script type="text/javascript">
            /*function stoppedTyping(){
                if($('#subtitle').val().length > 1 && $('#country').val().length >0 ) {
                    document.getElementById('submit_button').disabled = false;
                } else {
                    document.getElementById('submit_button').disabled = true;
                }
            }*/

            function savedb() {

                var php_var = document.getElementById("subtitle").value+".srt";
                var srt = document.getElementById('srt_text').innerHTML;
                var subtitle = document.getElementById("file").value.replace(/^.*[\\\/]/, '');
                subtitle = encodeURIComponent(subtitle); 
                var language = document.getElementById('country').value;
                var author = document.getElementById('author').value;
                console.log(php_var);
                console.log(subtitle);
                console.log(language);
                $.ajax({
                    type: "POST",
                    url: "save_database.php",
                    data: {
                        file: php_var,
                        srt: srt,
                        subtitle: subtitle,
                        language: language,
                    },
                    cache: false,

                    success: function (data) {
                        console.log("hello");
                        console.log(data);

                        $("#loaderModal").remove();
                        alert(data);
                        setTimeout(function(){
                            window.location = 'https://translatesubtitles.com/demosub/browse_subtitle.php';
                        }, 10);
                    },
                });
                $("#exampleModal").modal('hide');
            }
        </script>

1 Ответ

0 голосов
/ 15 октября 2019
please go through the below link


https://jsfiddle.net/y4dfor7t/1/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...