{% extends "base.html" %}

{% block extra_script %}
<script type="text/javascript">
    // Update progress bar
    function updateProgress() {
        $.ajax({
            url: '{{ fileserver_root }}/upload_progress/?X-Progress-ID=' + '{{ uuid }}' + '&callback=?', 
            dataType: 'jsonp',
            cache: false,
            success: function(data) {
                if (data) {
                $('#{{ upload_progress_con_id }} .upload-progress-text', window.parent.document).html(filesizeformat(data.uploaded, 2) + ' / ' +  filesizeformat(data.length, 2));
                    $('#{{ upload_progress_con_id }} .upload-progress-bar', window.parent.document).progressbar({
                            value: data.uploaded / data.length * 100
                    });
                }
            }
        });
        setTimeout(updateProgress, 1000);
    };
    updateProgress();
</script>
{% endblock %}

