diff --git a/README.md b/README.md
index fd5eb20..db51bc4 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.2.1.5
-Fixed issues 1, 3-5
+# Version: 0.2.1.6
+Added title toggling option.
# Images
diff --git a/src/manifest.json b/src/manifest.json
index 541250d..f388b5a 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": " Easy Session Manager",
- "version": "0.2.2.5",
+ "version": "0.2.2.6",
"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/sessionManager.html b/src/pages/sessionManager.html
index b21c7fa..761c1c6 100755
--- a/src/pages/sessionManager.html
+++ b/src/pages/sessionManager.html
@@ -206,19 +206,25 @@
-
+
-
+
+
diff --git a/src/scripts/utils.js b/src/scripts/utils.js
index 4f6ff91..bcf5f1d 100644
--- a/src/scripts/utils.js
+++ b/src/scripts/utils.js
@@ -45,33 +45,59 @@ const generateSelectionWindow = (json = "", keys = null, keysLength = 0) => {
let liTemplate = document.querySelector('#liTemplate');
for (let i = 0; i < keysLength; i++) {
- let ulClone = document.importNode(ulTemplate.content, true);
- let ulTag = ulClone.querySelector('.collection');
- let selAll = ulClone.querySelector('input');
- let h2Tag = ulClone.querySelector('.ulHeader');
- let ulLblTag = ulClone.querySelector('label');
- let h2Txt = document.createTextNode("Window: " + (i + 1));
- let store = json[keys[i]];
- let j = 0;
+ let ulClone = document.importNode(ulTemplate.content, true);
+ let ulTag = ulClone.querySelector('.collection');
+ let h2Tag = ulClone.querySelector('.ulHeader');
+ let h2Txt = document.createTextNode("Window: " + (i + 1));
+
+ let selAll = ulClone.querySelector('.selAll');
+ let titleAll = ulClone.querySelector('.titleAll');
+ let ulLblTag = ulClone.querySelector('.selAllLbl');
+ let ulLblTag2 = ulClone.querySelector('.titleAllLbl');
+ let store = json[keys[i]];
+ let j = 0;
+
+ container.id = "editSelectionContainer";
+ selAll.id = "selectAllWin" + i;
+ titleAll.id = "selectAllTitle" + i;
+ ulLblTag.htmlFor = "selectAllWin" + i;
+ ulLblTag2.htmlFor = "selectAllTitle" + i;
- container.id = "editSelectionContainer";
- selAll.id = "selectAllWin" + i;
- ulLblTag.htmlFor = "selectAllWin" + i;
selAll.addEventListener("click", function (eve) {
toggleSelect(eve.target, "Win" + i);
});
- h2Tag.prepend(h2Txt);
+
+ titleAll.addEventListener("click", function (eve) {
+ toggleTitles(eve.target, "Win" + i);
+ });
+
+
+
+ h2Tag.prepend(h2Txt);
store.forEach(tab => {
let liClone = document.importNode(liTemplate.content, true);
let inptTag = liClone.querySelector("input");
- let lblTag = liClone.querySelector("label");
+ // link lbl
+ let lblTag = liClone.querySelector(".linkLbl");
let labelTxt = document.createTextNode(tab.link);
+ // title lbnl
+ let lblTag2 = liClone.querySelector(".titleLbl");
+ let labelTxt2 = document.createTextNode(tab.title);
inptTag.id = "Win" + i + "Li" + j;
+
lblTag.htmlFor = "Win" + i + "Li" + j;
lblTag.title = tab.link;
+
+ lblTag2.htmlFor = "Win" + i + "Li" + j;
+ lblTag2.title = tab.link;
+
inptTag.setAttribute("name", "Win" + i); // Used for toggle select all
+
lblTag.appendChild(labelTxt);
+ lblTag2.appendChild(labelTxt2);
+
+
ulTag.appendChild(liClone);
j++;
});
@@ -131,7 +157,8 @@ const getSessionData = (windows) => {
for (var ii = 0; ii < windows[i].tabs.length; ii++) {
if (!windows[i].tabs[ii].url.includes("about:")) {
links.push(
- {"link" : windows[i].tabs[ii].url.trim()}
+ {"link" : windows[i].tabs[ii].url.trim(),
+ "title" : windows[i].tabs[ii].title.trim()}
);
}
}
@@ -151,7 +178,9 @@ const getSelectionData = (container = null, keys = null, keysLength = 0) => {
let li = ulTags[i].children[ii];
if (li.children[0].checked) {
links.push(
- {"link" : li.children[1].innerText.trim()}
+ {"link" : li.children[1].title.trim(),
+ "title" : li.children[2].innerText.trim()
+ }
);
}
}
@@ -228,6 +257,23 @@ const toggleSelect = (source, name) => {
}
}
+const toggleTitles = (source, name) => {
+ let checkboxes = document.getElementsByName(name);
+ for (let i = 0; i < checkboxes.length; i++) {
+ const parent = checkboxes[i].parentElement;
+ const lElm = parent.querySelector(".linkLbl");
+ const tElm = parent.querySelector(".titleLbl");
+
+ if (tElm.style.display !== "none") {
+ tElm.style.display = "none";
+ lElm.style.display = "";
+ } else {
+ tElm.style.display = "";
+ lElm.style.display = "none";
+ }
+ }
+}
+
const clearChildNodes = (parent) => {
while (parent.firstChild) {
parent.removeChild(parent.firstChild);