diff options
author | Mario <mario@mariovavti.com> | 2021-11-09 09:10:19 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-11-09 09:10:19 +0000 |
commit | fe7ecede700fe04631d23f36473e697ce2b364dc (patch) | |
tree | e713fc39dba500a25cb2acf8561e286fb8b41ff0 /view/js/mod_import_progress.js | |
parent | 42de18d96d201d74e5df3ed1b8f6132cb00357b6 (diff) | |
parent | 089708ab9f90309a0c27ae633cf8f2604fce1170 (diff) | |
download | volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.tar.gz volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.tar.bz2 volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.zip |
Merge branch '6.4RC'6.4
Diffstat (limited to 'view/js/mod_import_progress.js')
-rw-r--r-- | view/js/mod_import_progress.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/view/js/mod_import_progress.js b/view/js/mod_import_progress.js new file mode 100644 index 000000000..7aed56365 --- /dev/null +++ b/view/js/mod_import_progress.js @@ -0,0 +1,54 @@ +$(document).ready(function() { + setInterval(get_progress, 5000); + + function get_progress(){ + $.get('import_progress', function(data) { + update_progress(data); + }); + } + + function update_progress(data){ + + // items + if (typeof data.cprogress == 'number') { + $('#cprogress-label').html(data.cprogress + '%'); + $('#cprogress-bar').css('width', data.cprogress + '%'); + + if (data.cprogress == 100) { + $('#cprogress-resume').addClass('d-none'); + $('#cprogress-completed').removeClass('d-none'); + $('#cprogress-bar').removeClass('progress-bar-animated'); + } + else if (data.cprogress < 100) { + $('#cprogress-resume').removeClass('d-none'); + $('#cprogress-completed').addClass('d-none'); + $('#cprogress-bar').addClass('progress-bar-animated'); + } + } + else { + $('#cprogress-label').html(data.cprogress); + $('#cprogress-bar').css('width', '0%'); + } + + // files + if (typeof data.fprogress == 'number') { + $('#fprogress-label').html(data.fprogress + '%'); + $('#fprogress-bar').css('width', data.fprogress + '%'); + + if (data.fprogress == 100) { + $('#fprogress-resume').addClass('d-none'); + $('#fprogress-completed').removeClass('d-none'); + $('#fprogress-bar').removeClass('progress-bar-animated'); + } + else if (data.fprogress < 100) { + $('#fprogress-resume').removeClass('d-none'); + $('#fprogress-completed').addClass('d-none'); + $('#fprogress-bar').addClass('progress-bar-animated'); + } + } + else { + $('#fprogress-label').html(data.fprogress); + $('#fprogress-bar').css('width', '0%'); + } + } +}); |