mirror of
https://github.com/Ximi1970/systray-x.git
synced 2025-11-12 16:26:09 +01:00
Add base folder to the tree
This commit is contained in:
@@ -54,10 +54,13 @@ SysTrayX.Accounts = {
|
|||||||
console.debug("SysTrayX accounts type: " + mailAccount[i].type);
|
console.debug("SysTrayX accounts type: " + mailAccount[i].type);
|
||||||
for (let j = 0; j < mailAccount[i].folders.length; j++) {
|
for (let j = 0; j < mailAccount[i].folders.length; j++) {
|
||||||
console.debug(
|
console.debug(
|
||||||
"SysTrayX accounts folder: " +
|
"SysTrayX accounts folder path: " + mailAccount[i].folders[j].path
|
||||||
mailAccount[i].folders[j].name +
|
);
|
||||||
", " +
|
console.debug(
|
||||||
mailAccount[i].folders[j].type
|
"SysTrayX accounts folder name: " + mailAccount[i].folders[j].name
|
||||||
|
);
|
||||||
|
console.debug(
|
||||||
|
"SysTrayX accounts folder type: " + mailAccount[i].folders[j].type
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,10 +119,17 @@ SysTrayX.Accounts = {
|
|||||||
const folders = createFolderTree(accounts[prop][i].folders);
|
const folders = createFolderTree(accounts[prop][i].folders);
|
||||||
|
|
||||||
// Recursive list creator
|
// Recursive list creator
|
||||||
function createListLevel(level) {
|
function createListLevel(level, parent) {
|
||||||
const typeLevelUl = document.createElement("ul");
|
const typeLevelUl = document.createElement("ul");
|
||||||
typeLevelUl.setAttribute("class", "nested");
|
typeLevelUl.setAttribute("class", "nested");
|
||||||
|
|
||||||
|
if (parent) {
|
||||||
|
parent.children = [];
|
||||||
|
parent.name = "^ Add base folder";
|
||||||
|
|
||||||
|
level.unshift(parent);
|
||||||
|
}
|
||||||
|
|
||||||
level.forEach((element) => {
|
level.forEach((element) => {
|
||||||
const typeEleLi = document.createElement("li");
|
const typeEleLi = document.createElement("li");
|
||||||
|
|
||||||
@@ -151,7 +161,9 @@ SysTrayX.Accounts = {
|
|||||||
typeEleLi.appendChild(typeEleText);
|
typeEleLi.appendChild(typeEleText);
|
||||||
|
|
||||||
if (element.children.length > 0) {
|
if (element.children.length > 0) {
|
||||||
typeEleLi.appendChild(createListLevel(element.children));
|
typeEleLi.appendChild(
|
||||||
|
createListLevel(element.children, element)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
typeLevelUl.appendChild(typeEleLi);
|
typeLevelUl.appendChild(typeEleLi);
|
||||||
|
|||||||
Reference in New Issue
Block a user