diff --git a/README.md b/README.md
index 32845d9..ed9e11f 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,8 @@ Easy Session Manager allows you to manage your Firefox session by backing up or
# Download
https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/
-# Version: 0.0.3
-Set tabs to auto discard but the currently active one.
+# Version: 0.0.4
+Added multiple file import functionality and changed discard setup.
# Images
![1 Default interface with no sessions. ](images/pic1.png)
diff --git a/src/manifest.json b/src/manifest.json
index 37d406a..a8f8d5d 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": " Easy Session Manager",
- "version": "0.0.3",
+ "version": "0.0.4",
"description": " Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.",
"applications": {
diff --git a/src/pages/import.html b/src/pages/import.html
index 1744ce0..3e7ece0 100644
--- a/src/pages/import.html
+++ b/src/pages/import.html
@@ -22,7 +22,7 @@ body, html {
Select File
-
+
diff --git a/src/scripts/background.js b/src/scripts/background.js
index 5dbb946..91754f7 100644
--- a/src/scripts/background.js
+++ b/src/scripts/background.js
@@ -1,16 +1,26 @@
-document.getElementById("inputId").onchange = (e) => {
- var reader = new FileReader();
- reader.onloadend = function(obj){
- let data = obj.target.result;
- let enteryName = prompt("What is this session's name?", "" + new Date().toLocaleString()
- .split(',')[0]);
- if (enteryName) {
- browser.storage.local.set({[enteryName]: data});
- }
- };
+let processor = (obj, name) => {
+ let data = obj.target.result;
+ let enteryName = prompt("What is this session's name?", "" + name);
+ console.log(name);
+ if (enteryName) {
+ browser.storage.local.set({[enteryName]: data});
+ }
+};
- if (e.target.files[0].type == "application/json")
- reader.readAsText(e.target.files[0], {encoding: "string"});
+document.getElementById("inputId").onchange = (e) => {
+ let size = e.target.files.length;
+ let fileArry = e.target.files;
+
+ for (var i = 0; i < size; i++) {
+ let reader = new FileReader();
+ let name = fileArry[i].name;
+ name = name.split(".")[0];
+
+ reader.onloadend = (obj) => { processor(obj, name); };
+
+ if (fileArry[i].type == "application/json")
+ reader.readAsText(fileArry[i], {encoding: "string"});
+ }
};
diff --git a/src/scripts/sessionManager.js b/src/scripts/sessionManager.js
index 67c0a61..5eb41fb 100644
--- a/src/scripts/sessionManager.js
+++ b/src/scripts/sessionManager.js
@@ -113,7 +113,6 @@ const loadSession = (id = null) => {
}
windowSys.create({ url: urls });
- browser.tabs.discard(urls);
});
// Finalize clear out windows