Add progress bar for pad download
parent
2ee3b77a43
commit
f017215300
|
@ -92,7 +92,15 @@ define([
|
|||
var opts = {
|
||||
password: pData.password
|
||||
};
|
||||
updateProgress.progress(0);
|
||||
var done = false;
|
||||
ctx.sframeChan.on("EV_CRYPTGET_PROGRESS", function (data) {
|
||||
if (done || data.hash !== parsed.hash) { return; }
|
||||
updateProgress.progress(data.progress);
|
||||
if (data.progress === 1) {
|
||||
done = true;
|
||||
updateProgress.progress2(1);
|
||||
}
|
||||
});
|
||||
ctx.get({
|
||||
hash: parsed.hash,
|
||||
opts: opts
|
||||
|
@ -100,12 +108,9 @@ define([
|
|||
if (cancelled) { return; }
|
||||
if (err) { return; }
|
||||
if (!val) { return; }
|
||||
updateProgress.progress(1);
|
||||
|
||||
transform(ctx, parsed.type, val, function (res) {
|
||||
if (cancelled) { return; }
|
||||
if (!res.data) { return; }
|
||||
updateProgress.progress2(1);
|
||||
var dl = function () {
|
||||
saveAs(res.data, Util.fixFileName(name));
|
||||
};
|
||||
|
|
|
@ -482,6 +482,7 @@ define([
|
|||
|
||||
var ctx = {
|
||||
get: common.getPad,
|
||||
sframeChan: sframeChan,
|
||||
};
|
||||
var dl = downloadFunction(ctx, data, function (err, obj) {
|
||||
$link.prepend($('<span>', {'class': 'fa fa-external-link'}))
|
||||
|
|
|
@ -880,7 +880,12 @@ define([
|
|||
error: err,
|
||||
data: val
|
||||
});
|
||||
}, data.opts);
|
||||
}, data.opts, function (progress) {
|
||||
sframeChan.event("EV_CRYPTGET_PROGRESS", {
|
||||
hash: data.hash,
|
||||
progress: progress,
|
||||
});
|
||||
});
|
||||
};
|
||||
//return void todo();
|
||||
if (i > 30) {
|
||||
|
|
Loading…
Reference in New Issue