Added invalid url detection
This commit is contained in:
parent
b433161d72
commit
6ea60a0723
|
@ -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.3.2
|
||||
* Fixed Selective Open not working properly when multiple windows are in session.
|
||||
# Version: 0.2.3.3
|
||||
* Fixed tab open logic to exclude urls not valid for api opening (due to security).
|
||||
|
||||
|
||||
# Images
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Easy Session Manager",
|
||||
"version": "0.2.3.2",
|
||||
"version": "0.2.3.3",
|
||||
"description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.",
|
||||
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "sessionManager@itdominator.com",
|
||||
"strict_min_version": "57.0"
|
||||
"strict_min_version": "79.0"
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ document.addEventListener("click", (e) => {
|
|||
const target = e.target;
|
||||
const action = target.getAttribute("name");
|
||||
|
||||
|
||||
// Set selection first before doing any actions...
|
||||
if (target.tagName == "LI" && target.className.includes("sessionLI")) {
|
||||
if (selectedItem) {
|
||||
|
@ -56,6 +55,8 @@ document.addEventListener("click", (e) => {
|
|||
return ;
|
||||
}
|
||||
|
||||
if (!action) return;
|
||||
|
||||
if (/(closeSave|closeEdit|closeDownload|closeDelete|closeConfirm|closeLoad)/.test(action)) {
|
||||
if (action.includes("closeSave")) {
|
||||
hideModal("saveModal");
|
||||
|
@ -70,8 +71,7 @@ document.addEventListener("click", (e) => {
|
|||
} else if (action.includes("closeLoad")) {
|
||||
hideModal("loadModal");
|
||||
}
|
||||
}
|
||||
else if (action.includes("deselectAll")) {
|
||||
} else if (action.includes("deselectAll")) {
|
||||
let container = document.getElementById("editSelectionContainer");
|
||||
deselectAll(container);
|
||||
}
|
||||
|
|
|
@ -40,10 +40,14 @@ const loadContainer = (sessionData, keys, keysLength, divID) => {
|
|||
|
||||
/* Selection Process */
|
||||
const generateSelectionWindow = (json = "", keys = null, keysLength = 0) => {
|
||||
let invalidURLsMessage = document.createElement("P")
|
||||
let container = document.createElement("DIV");
|
||||
let ulTemplate = document.querySelector('#ulTemplate');
|
||||
let liTemplate = document.querySelector('#liTemplate');
|
||||
|
||||
invalidURLsMessage.innerText = "The Session has invalid URLs (highlighted for convenience). They might break loading of a session...";
|
||||
invalidURLsMessage.classList.add("warning");
|
||||
|
||||
for (let i = 0; i < keysLength; i++) {
|
||||
let ulClone = document.importNode(ulTemplate.content, true);
|
||||
let ulTag = ulClone.querySelector('.collection');
|
||||
|
@ -56,6 +60,7 @@ const generateSelectionWindow = (json = "", keys = null, keysLength = 0) => {
|
|||
let ulLblTag2 = ulClone.querySelector('.titleAllLbl');
|
||||
let store = json[keys[i]];
|
||||
let j = 0;
|
||||
let hasInvalidURLs = false;
|
||||
|
||||
container.id = "editSelectionContainer";
|
||||
selAll.id = "selectAllWin" + i;
|
||||
|
@ -72,12 +77,12 @@ const generateSelectionWindow = (json = "", keys = null, keysLength = 0) => {
|
|||
toggleTitles(eve.target, "Win" + i);
|
||||
});
|
||||
|
||||
|
||||
|
||||
h2Tag.prepend(h2Txt);
|
||||
store.forEach(tab => {
|
||||
let liClone = document.importNode(liTemplate.content, true);
|
||||
let liTag = liClone.querySelector("li");
|
||||
let inptTag = liClone.querySelector("input");
|
||||
|
||||
// link lbl
|
||||
let lblTag = liClone.querySelector(".linkLbl");
|
||||
let labelTxt = document.createTextNode(tab.link);
|
||||
|
@ -94,6 +99,13 @@ const generateSelectionWindow = (json = "", keys = null, keysLength = 0) => {
|
|||
|
||||
inptTag.setAttribute("name", "Win" + i); // Used for toggle select all
|
||||
|
||||
if (/(file:\/\/|ws:\/\/|wss:\/\/|moz-extension:\/\/|about:)/.test(tab.link)) {
|
||||
liTag.classList.add("error-bg");
|
||||
lblTag.classList.add("error");
|
||||
lblTag2.classList.add("error");
|
||||
hasInvalidURLs = true;
|
||||
}
|
||||
|
||||
lblTag.appendChild(labelTxt);
|
||||
lblTag2.appendChild(labelTxt2);
|
||||
|
||||
|
@ -102,6 +114,10 @@ const generateSelectionWindow = (json = "", keys = null, keysLength = 0) => {
|
|||
j++;
|
||||
});
|
||||
|
||||
if (hasInvalidURLs) {
|
||||
container.appendChild(invalidURLsMessage);
|
||||
}
|
||||
|
||||
container.appendChild(ulClone);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ ul, li {
|
|||
li {
|
||||
user-select: none; /* Non-prefixed version, currently
|
||||
supported by Chrome, Opera and Firefox */
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,3 +118,14 @@ li {
|
|||
background-color: rgba(41, 95, 115, 0.65);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.error-bg { background-color: rgba(44, 44, 44, 0.64); }
|
||||
.warning-bg { background-color: rgba(44, 44, 44, 0.64); }
|
||||
.success-bg { background-color: rgba(44, 44, 44, 0.64); }
|
||||
|
||||
|
||||
.error { color: rgb(170, 18, 18); }
|
||||
.warning { color: rgb(255, 168, 0); }
|
||||
.success { color: rgb(136, 204, 39); }
|
||||
|
||||
|
|
Loading…
Reference in New Issue