mirror of
https://github.com/Ximi1970/systray-x.git
synced 2025-11-12 08:16:08 +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);
|
||||
for (let j = 0; j < mailAccount[i].folders.length; j++) {
|
||||
console.debug(
|
||||
"SysTrayX accounts folder: " +
|
||||
mailAccount[i].folders[j].name +
|
||||
", " +
|
||||
mailAccount[i].folders[j].type
|
||||
"SysTrayX accounts folder path: " + mailAccount[i].folders[j].path
|
||||
);
|
||||
console.debug(
|
||||
"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);
|
||||
|
||||
// Recursive list creator
|
||||
function createListLevel(level) {
|
||||
function createListLevel(level, parent) {
|
||||
const typeLevelUl = document.createElement("ul");
|
||||
typeLevelUl.setAttribute("class", "nested");
|
||||
|
||||
if (parent) {
|
||||
parent.children = [];
|
||||
parent.name = "^ Add base folder";
|
||||
|
||||
level.unshift(parent);
|
||||
}
|
||||
|
||||
level.forEach((element) => {
|
||||
const typeEleLi = document.createElement("li");
|
||||
|
||||
@@ -151,7 +161,9 @@ SysTrayX.Accounts = {
|
||||
typeEleLi.appendChild(typeEleText);
|
||||
|
||||
if (element.children.length > 0) {
|
||||
typeEleLi.appendChild(createListLevel(element.children));
|
||||
typeEleLi.appendChild(
|
||||
createListLevel(element.children, element)
|
||||
);
|
||||
}
|
||||
|
||||
typeLevelUl.appendChild(typeEleLi);
|
||||
|
||||
Reference in New Issue
Block a user