move classification out of load
This commit is contained in:
parent
27990678c2
commit
5a64ee41c3
88
index.html
88
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<inNode.Children.length; i++)
|
||||
{
|
||||
Node.Decedents(inNode.Children[i], inList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
inList.push(inNode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -417,9 +392,7 @@ var App = {
|
||||
])
|
||||
}
|
||||
},
|
||||
Update:
|
||||
{
|
||||
Load:(file)=>
|
||||
OldClassifier:()=>
|
||||
{
|
||||
let leafStructure = inTree=>
|
||||
{
|
||||
@ -433,38 +406,14 @@ var App = {
|
||||
});
|
||||
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<columns.length; i+=5)
|
||||
{
|
||||
let title = columns[i+0];
|
||||
let id = columns[i+1];
|
||||
let date = columns[i+2];
|
||||
let bible = columns[i+3].split("*");
|
||||
let topics = columns[i+4].split("*");
|
||||
|
||||
let output = { title, id, date, topics, bible };
|
||||
|
||||
////
|
||||
|
||||
var matched, match;
|
||||
|
||||
// match topics
|
||||
matched = false;
|
||||
topics.forEach(t=>
|
||||
@ -510,12 +459,41 @@ var App = {
|
||||
structDate[""].Leaves.push(output);
|
||||
}
|
||||
|
||||
App.State.Items.All.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)=>
|
||||
{
|
||||
fetch(file)
|
||||
.then(inAccept=>inAccept.text())
|
||||
.then(inAccept=>
|
||||
{
|
||||
let columns = inAccept.split("|");
|
||||
for(let i=0; i<columns.length; i+=5)
|
||||
{
|
||||
let title = columns[i+0];
|
||||
let id = columns[i+1];
|
||||
let date = columns[i+2];
|
||||
let bible = columns[i+3].split("*");
|
||||
let topics = columns[i+4].split("*");
|
||||
|
||||
let output = { title, id, date, topics, bible };
|
||||
|
||||
App.State.Items.All.push(output);
|
||||
}
|
||||
})
|
||||
.then(inAccept=>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user