From 2c76dd5d2be7543e6c3d6e5377bc6ae63c870495 Mon Sep 17 00:00:00 2001 From: Laurent Ghigonis Date: Sun, 16 Jun 2013 21:50:37 +0200 Subject: jsaccess: ensure refresh of status before decryption --- jsaccess/jsa/jsa.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'jsaccess') diff --git a/jsaccess/jsa/jsa.js b/jsaccess/jsa/jsa.js index eb28a01..c2e40f2 100644 --- a/jsaccess/jsa/jsa.js +++ b/jsaccess/jsa/jsa.js @@ -93,8 +93,8 @@ function _dl(file, pass) { xhr.overrideMimeType("application/base64"); }, success: function ( data ) { - _status("Download complete, decrypting ..."); - _decrypt(data, pass, file); + _status("Download complete, decrypting ...", + function() { _decrypt(data, pass, file); }); }, error: function (xhr, opts, err) { _status("Dowload failed (status="+xhr.status+")"); @@ -123,13 +123,19 @@ function _save(obj, name) { } var blob = new Blob([ia], {type:"application/octet-binary"}); saveAs(blob, name); - _status("File \""+name+"\" is in your hands,"); - _status("Have a good day."); + _status("File \""+name+"\" is in your hands,
Have a good day."); } -function _status(txt) { +function _status(txt, run_func) { var div = document.getElementById('status'); div.innerHTML = div.innerHTML + '
' + txt; - $('#status').hide().show(); + jQuery.fn.redraw = function() { + return this.hide(0, function() { + $(this).show(); + }); + }; + $('#status').redraw(); + if (run_func) + setTimeout(run_func, 100); /* to force refresh */ } -- cgit v1.2.3-59-g8ed1b