Added multiple file import functionality and changed discard setup.
This commit is contained in:
parent
016984eda9
commit
0a9b1630d9
|
@ -4,8 +4,8 @@ Easy Session Manager allows you to manage your Firefox session by backing up or
|
||||||
# Download
|
# Download
|
||||||
https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/
|
https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/
|
||||||
|
|
||||||
# Version: 0.0.3
|
# Version: 0.0.4
|
||||||
Set tabs to auto discard but the currently active one.
|
Added multiple file import functionality and changed discard setup.
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
![1 Default interface with no sessions. ](images/pic1.png)
|
![1 Default interface with no sessions. ](images/pic1.png)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": " Easy Session Manager",
|
"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.",
|
"description": " Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.",
|
||||||
|
|
||||||
"applications": {
|
"applications": {
|
||||||
|
|
|
@ -22,7 +22,7 @@ body, html {
|
||||||
|
|
||||||
<div class="container" name="import">
|
<div class="container" name="import">
|
||||||
<h1 id="lableTag">Select File</h1>
|
<h1 id="lableTag">Select File</h1>
|
||||||
<input id="inputId" type="file" accept="application/json"/>
|
<input id="inputId" type="file" enctype='multipart/form-data' multiple accept="application/json"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,26 @@
|
||||||
document.getElementById("inputId").onchange = (e) => {
|
let processor = (obj, name) => {
|
||||||
var reader = new FileReader();
|
|
||||||
reader.onloadend = function(obj){
|
|
||||||
let data = obj.target.result;
|
let data = obj.target.result;
|
||||||
let enteryName = prompt("What is this session's name?", "" + new Date().toLocaleString()
|
let enteryName = prompt("What is this session's name?", "" + name);
|
||||||
.split(',')[0]);
|
console.log(name);
|
||||||
if (enteryName) {
|
if (enteryName) {
|
||||||
browser.storage.local.set({[enteryName]: data});
|
browser.storage.local.set({[enteryName]: data});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (e.target.files[0].type == "application/json")
|
document.getElementById("inputId").onchange = (e) => {
|
||||||
reader.readAsText(e.target.files[0], {encoding: "string"});
|
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"});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,6 @@ const loadSession = (id = null) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
windowSys.create({ url: urls });
|
windowSys.create({ url: urls });
|
||||||
browser.tabs.discard(urls);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Finalize clear out windows
|
// Finalize clear out windows
|
||||||
|
|
Loading…
Reference in New Issue