diff --git a/index.html b/index.html
index 5661e97..775b826 100644
--- a/index.html
+++ b/index.html
@@ -259,31 +259,6 @@ let Node = {
{
Node.IterateUp(inNode.Parent, inIterator);
}
- },
- Path:(inNode, inList) =>
- {
- let node = inNode;
- while(node)
- {
- inList.push(node);
- node = node.Parent;
- }
- },
- Leaves:(inNode, inList) =>
- {
- var i;
- var child;
- if(inNode.Children)
- {
- for(i=0; i
+ {
+ let leafStructure = inTree=>
+ {
+ let output = [];
+ Node.IterateDown(inTree.Root, n=>
+ {
+ if(!n.Children)
+ {
+ output[n.ID] = n;
+ }
+ });
+ return output;
+ };
+ let structTopics = leafStructure(App.State.Topics)
+ let structBible = leafStructure(App.State.Bible);
+ let structDate = leafStructure(App.State.Date);
+
+
+ ////
+
+ var matched, match;
+ // match topics
+ matched = false;
+ topics.forEach(t=>
+ {
+ match = structTopics[t];
+ if(match)
+ {
+ match.Leaves.push(output);
+ matched = true;
+ }
+ });
+ if(!matched)
+ {
+ structTopics[""].Leaves.push(output);
+ }
+
+ // match bible
+ matched = false;
+ bible.forEach(t=>
+ {
+ match = structBible[ Util.ParsePassage(t)[0] ];
+ if(match)
+ {
+ match.Leaves.push(output);
+ matched = true;
+ }
+ });
+ if(!matched)
+ {
+ structBible[""].Leaves.push(output);
+ }
+
+ // match date
+ matched = false;
+ match = structDate[date[2]];
+ if(match)
+ {
+ match.Leaves.push(output);
+ matched = true;
+ }
+ if(!matched)
+ {
+ structDate[""].Leaves.push(output);
+ }
+
+ ////
+
+
+ let itrUp = inLeaf=>
+ {
+ Node.IterateUp(inLeaf, inBranch=>
+ {
+ inBranch.Leaves = _.union(inBranch.Leaves, inLeaf.Leaves)
+ });
+ };
+ Object.values(structTopics).forEach(itrUp);
+ Object.values(structBible).forEach(itrUp);
+ Object.values(structDate).forEach(itrUp);
+ },
Update:
{
Load:(file)=>
{
- let leafStructure = inTree=>
- {
- let output = [];
- Node.IterateDown(inTree.Root, n=>
- {
- if(!n.Children)
- {
- output[n.ID] = n;
- }
- });
- return output;
- };
-
- let structTopics = leafStructure(App.State.Topics)
- let structBible = leafStructure(App.State.Bible);
- let structDate = leafStructure(App.State.Date);
-
fetch(file)
.then(inAccept=>inAccept.text())
.then(inAccept=>
{
- let itrUp = inLeaf=>
- {
- Node.IterateUp(inLeaf, inBranch=>
- {
- inBranch.Leaves = _.union(inBranch.Leaves, inLeaf.Leaves)
- });
- };
-
let columns = inAccept.split("|");
-
for(let i=0; i
- {
- match = structTopics[t];
- if(match)
- {
- match.Leaves.push(output);
- matched = true;
- }
- });
- if(!matched)
- {
- structTopics[""].Leaves.push(output);
- }
-
- // match bible
- matched = false;
- bible.forEach(t=>
- {
- match = structBible[ Util.ParsePassage(t)[0] ];
- if(match)
- {
- match.Leaves.push(output);
- matched = true;
- }
- });
- if(!matched)
- {
- structBible[""].Leaves.push(output);
- }
-
- // match date
- matched = false;
- match = structDate[date[2]];
- if(match)
- {
- match.Leaves.push(output);
- matched = true;
- }
- if(!matched)
- {
- structDate[""].Leaves.push(output);
- }
-
App.State.Items.All.push(output);
}
-
- Object.values(structTopics).forEach(itrUp);
- Object.values(structBible).forEach(itrUp);
- Object.values(structDate).forEach(itrUp);
})
.then(inAccept=>
{