Commit f34abf9c authored by edwin's avatar edwin

fix loading time when download single image on fetch

parent 84fc6d17
......@@ -38,7 +38,7 @@ chrome.extension.onMessage.addListener(function(request,sender,sendResponse){
chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
if(item.url.includes("https://digitallibrary-external.fastretailing.com/api/asset")){
if(item.url.includes("https://digitallibrary-external.fastretailing.com/api/asset/download/")){
chrome.storage.local.get(['idArray', 'index'], function (items) {
if(Object.keys(items).length !== 0){
let index = items.index;
......@@ -46,16 +46,19 @@ chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
let new_filename = idArray[index] + ".zip";
suggest({filename: new_filename});
chrome.storage.local.set({index: (index+1)});
index += 1;
if(index >= idArray.length) {
if(index + 1 >= idArray.length) {
console.log("Last file was downloaded");
chrome.storage.local.remove(['idArray', 'index']);
}else{
chrome.storage.local.set({index: (index+1)});
}
}
return true;
});
return true;
}else{
suggest();
}
return true;
});
......@@ -26,7 +26,7 @@
<h6>Filtering</h6>
<div class="input-box">
<label>Date: </label>
<label>Day before: </label>
<input type="text" id="filter-date" name="filter-date" value="">
</div>
<div class="input-box">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment