update functions
This commit is contained in:
parent
14cadbef04
commit
e68dca926c
37
index.html
37
index.html
@ -64,7 +64,7 @@ let ElemPager = ({count, active}) =>
|
||||
let output = [];
|
||||
for(let i=inStart; i<=inStop; i++)
|
||||
{
|
||||
output.push(h("button", {key:i, onClick:e=>App.Update("page", i)}, i+1));
|
||||
output.push(h("button", {key:i, onClick:e=>App.Update.Page(i)}, i+1));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
@ -86,7 +86,7 @@ let ElemPager = ({count, active}) =>
|
||||
{
|
||||
if( (hitLeft && hitRight) || count < 7)
|
||||
{
|
||||
children = renderRange(_.head(blockIntro), _.last(blockOutro))
|
||||
children = renderRange(_.head(blockIntro), _.last(blockOutro)) /* merge all */
|
||||
}
|
||||
else if(!hitLeft && hitRight)
|
||||
{
|
||||
@ -125,7 +125,7 @@ let ElemTopics = props =>
|
||||
let children = App.State.Topics.All.map( t=>
|
||||
{
|
||||
return h(ElemTopic, {
|
||||
onClick:e=>App.Update("topic-toggle", t),
|
||||
onClick:e=>App.Update.Topic(t),
|
||||
key:t.id,
|
||||
label:t.display,
|
||||
active:t.active
|
||||
@ -224,14 +224,11 @@ var App = {
|
||||
App.State.Pages.All = _.chunk(App.State.Items.Active, 10);
|
||||
App.State.Pages.Active = 0;
|
||||
},
|
||||
Update:(...action)=>
|
||||
Update:
|
||||
{
|
||||
if(action)
|
||||
Load:(file)=>
|
||||
{
|
||||
switch(action[0])
|
||||
{
|
||||
case "load":
|
||||
fetch(action[1])
|
||||
fetch(file)
|
||||
.then(inAccept=>inAccept.text())
|
||||
.then(inAccept=>
|
||||
{
|
||||
@ -251,10 +248,9 @@ var App = {
|
||||
App.Render();
|
||||
}
|
||||
);
|
||||
break;
|
||||
|
||||
case "topic-toggle" :
|
||||
let topic = action[1];
|
||||
},
|
||||
Topic:(topic)=>
|
||||
{
|
||||
if(topic.active)
|
||||
{
|
||||
topic.active = false;
|
||||
@ -267,21 +263,18 @@ var App = {
|
||||
}
|
||||
App.ApplyFilters();
|
||||
App.Render();
|
||||
break;
|
||||
|
||||
case "page" :
|
||||
if(action[1] !== false)
|
||||
},
|
||||
Page:(page)=>
|
||||
{
|
||||
App.State.Pages.Active = action[1];
|
||||
if(page !== false)
|
||||
{
|
||||
App.State.Pages.Active = page;
|
||||
App.Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
App.Update("load", "data-flat.csv");
|
||||
|
||||
App.Update.Load("data-flat.csv");
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user