Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed 0 progress bar bug, added zip progress bar #21

  • Loading branch information...
commit 317a23d3d0060c31d96b6ea3cd2122dcbd7ddc11 1 parent 22293e5
@scottcheng authored
Showing with 12 additions and 7 deletions.
  1. +1 −1  README.md
  2. +11 −6 content.js
View
2  README.md
@@ -1,7 +1,7 @@
Renren Album Downloader
====
-This is a Chrome extension which enables you to download a Renren album with one click.
+A Chrome extension which enables you to download a Renren album with one click
- - - - -
View
17 content.js
@@ -185,9 +185,10 @@ var view = (function() {
.slideDown();
};
- obj.startDownload = function() {
+ obj.startDownload = function(ttl) {
state = 'downloading';
createProgressBar();
+ this.updateDownloadProgress(0, ttl);
$info.html(chrome.i18n.getMessage('msgDownloading'));
};
@@ -196,16 +197,17 @@ var view = (function() {
$progressBar.width((cur / ttl * 100) + '%');
};
- obj.startZipping = function() {
+ obj.startZipping = function(ttl) {
state = 'zipping';
- $progressBarWrapper.slideUp(function() {
- $progressBarWrapper.remove();
- });
+ this.updateDownloadProgress(0, ttl);
$info.html(chrome.i18n.getMessage('msgZipping'));
};
obj.finish = function() {
state = 'finished';
+ $progressBarWrapper.slideUp(function() {
+ $progressBarWrapper.remove();
+ });
$info.html(chrome.i18n.getMessage('msgFinished'));
disabled = false;
$btn.removeClass('disabled');
@@ -233,6 +235,7 @@ var downloader = (function() {
folderName = '',
cnt = 0,
len = 0,
+ zipLen = 0,
errList = []; // Size of current zip
var triggerDownload = function(url) {
@@ -251,6 +254,7 @@ var downloader = (function() {
var url = 'data:application/zip;base64,' + zip2Dld.generate();
triggerDownload(url);
}
+ view.updateDownloadProgress(zipLen - queue.length, zipLen);
}
if (!isStarted || queue.length > 0) {
window.setTimeout(checkQueue, conf.DLD_ITV);
@@ -284,7 +288,8 @@ var downloader = (function() {
folder.file('errors.txt', errorsTxt);
}
queue.push(zip);
- view.startZipping();
+ zipLen = queue.length;
+ view.startZipping(zipLen);
isStarted = true;
};
Please sign in to comment.
Something went wrong with that request. Please try again.