started to use ES6 coding standard
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -45,7 +45,7 @@ function init(){
|
|||||||
// /_/ |_/ .___/ .___/
|
// /_/ |_/ .___/ .___/
|
||||||
// /_/ /_/
|
// /_/ /_/
|
||||||
// var _App = {
|
// var _App = {
|
||||||
// view: function(){
|
// view(){
|
||||||
// console.log('_App view', _lang);
|
// console.log('_App view', _lang);
|
||||||
// return [
|
// return [
|
||||||
// m('header', [
|
// m('header', [
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ var _Dot = {
|
|||||||
links:null,
|
links:null,
|
||||||
parents:[],
|
parents:[],
|
||||||
lang:_dbs.lang,
|
lang:_dbs.lang,
|
||||||
setuptext:function(vn){
|
setuptext(vn){
|
||||||
// console.log('setuptext', vn);
|
// console.log('setuptext', vn);
|
||||||
|
|
||||||
// construct text
|
// construct text
|
||||||
@@ -40,7 +40,7 @@ var _Dot = {
|
|||||||
this.summary = markdown.renderInline(this.summary) + " …";
|
this.summary = markdown.renderInline(this.summary) + " …";
|
||||||
|
|
||||||
},
|
},
|
||||||
oninit: function(vn){
|
oninit(vn){
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.type = vn.attrs.type;
|
this.type = vn.attrs.type;
|
||||||
|
|
||||||
@@ -60,28 +60,28 @@ var _Dot = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
oncreate: function(vn){
|
oncreate(vn){
|
||||||
if(this.active){
|
if(this.active){
|
||||||
vn.dom.classList.remove('disabled');
|
vn.dom.classList.remove('disabled');
|
||||||
}else{
|
}else{
|
||||||
vn.dom.classList.add('disabled');
|
vn.dom.classList.add('disabled');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onbeforeupdate: function(vn){
|
onbeforeupdate(vn){
|
||||||
// console.log('onbeforeupdate');
|
// console.log('onbeforeupdate');
|
||||||
if(this.lang != _dbs.lang){
|
if(this.lang != _dbs.lang){
|
||||||
this.lang = _dbs.lang;
|
this.lang = _dbs.lang;
|
||||||
this.setuptext(vn);
|
this.setuptext(vn);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
if (this.active && this.opened) {
|
if (this.active && this.opened) {
|
||||||
// full view of dot with linked dots
|
// full view of dot with linked dots
|
||||||
// console.log('_Dot view '+this.id+' parents :',this.parents);
|
// console.log('_Dot view '+this.id+' parents :',this.parents);
|
||||||
var dot_content = [
|
var dot_content = [
|
||||||
// links to
|
// links to
|
||||||
this.links.to.length
|
this.links.to.length
|
||||||
? m('nav', {'class':'links to'}, this.links.to.map(function(id){
|
? m('nav', {'class':'links to'}, this.links.to.map(id => {
|
||||||
// console.log(id);
|
// console.log(id);
|
||||||
if(typeof _dbs.data_byid[_dbs.lang][id] !== 'undefined'){
|
if(typeof _dbs.data_byid[_dbs.lang][id] !== 'undefined'){
|
||||||
return m(_Dot, {
|
return m(_Dot, {
|
||||||
@@ -104,7 +104,7 @@ var _Dot = {
|
|||||||
// full text
|
// full text
|
||||||
m('section', {
|
m('section', {
|
||||||
'class':'text',
|
'class':'text',
|
||||||
onmouseover: function(e){
|
onmouseover(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if(e.target.nodeName == "A" ){
|
if(e.target.nodeName == "A" ){
|
||||||
// console.log("over e.target", e.target);
|
// console.log("over e.target", e.target);
|
||||||
@@ -119,7 +119,7 @@ var _Dot = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onclick:function(e){
|
onclick(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if(e.target.nodeName == "A" ){
|
if(e.target.nodeName == "A" ){
|
||||||
// console.log("over e.target", e.target);
|
// console.log("over e.target", e.target);
|
||||||
@@ -132,7 +132,7 @@ var _Dot = {
|
|||||||
}, m.trust(this.rendered_text)),
|
}, m.trust(this.rendered_text)),
|
||||||
// links from
|
// links from
|
||||||
this.links.from.length
|
this.links.from.length
|
||||||
? m('nav', {'class':'links from'}, this.links.from.map(function(id){
|
? m('nav', {'class':'links from'}, this.links.from.map(id => {
|
||||||
// retrun a dot
|
// retrun a dot
|
||||||
return m(_Dot, {
|
return m(_Dot, {
|
||||||
"id":id,
|
"id":id,
|
||||||
@@ -154,7 +154,7 @@ var _Dot = {
|
|||||||
m('span', {'class':'bullet'}, m.trust('•')),
|
m('span', {'class':'bullet'}, m.trust('•')),
|
||||||
m('p', {
|
m('p', {
|
||||||
'class':'summary',
|
'class':'summary',
|
||||||
onclick:function(e){
|
onclick(e){
|
||||||
// TODO: animate openening (text and links separatly)
|
// TODO: animate openening (text and links separatly)
|
||||||
vn.state.opened = true;
|
vn.state.opened = true;
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ var _Dot = {
|
|||||||
dot_content
|
dot_content
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onupdate: function(vn){
|
onupdate(vn){
|
||||||
// console.log('_Dot : onupdate', vn);
|
// console.log('_Dot : onupdate', vn);
|
||||||
if(this.active){
|
if(this.active){
|
||||||
if (this.opened){
|
if (this.opened){
|
||||||
@@ -213,7 +213,7 @@ var _Child = {
|
|||||||
type:null,
|
type:null,
|
||||||
// nested:false,
|
// nested:false,
|
||||||
text:'',
|
text:'',
|
||||||
oninit: function(vn){
|
oninit(vn){
|
||||||
// console.log('vn.attrs', vn.attrs);
|
// console.log('vn.attrs', vn.attrs);
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.type = vn.attrs.type;
|
this.type = vn.attrs.type;
|
||||||
@@ -221,12 +221,12 @@ var _Child = {
|
|||||||
this.text = vn.attrs.text;
|
this.text = vn.attrs.text;
|
||||||
// this.nested = vn.attrs.nested || false;
|
// this.nested = vn.attrs.nested || false;
|
||||||
},
|
},
|
||||||
onbeforeupdate: function(vn, old){
|
onbeforeupdate(vn, old){
|
||||||
// this.nested = vn.attrs.nested || false;
|
// this.nested = vn.attrs.nested || false;
|
||||||
this.type = vn.attrs.type;
|
this.type = vn.attrs.type;
|
||||||
this.text = vn.attrs.text;
|
this.text = vn.attrs.text;
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
return m(_Dot, {"id":this.id, 'text':this.text, 'type':this.type});
|
return m(_Dot, {"id":this.id, 'text':this.text, 'type':this.type});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -243,7 +243,7 @@ var _Enonce = {
|
|||||||
text:null,
|
text:null,
|
||||||
// nested:false,
|
// nested:false,
|
||||||
childs:[],
|
childs:[],
|
||||||
oninit:function(vn){
|
oninit(vn){
|
||||||
// // console.log('Enonce on init', vn);
|
// // console.log('Enonce on init', vn);
|
||||||
this.partid = vn.attrs.partid;
|
this.partid = vn.attrs.partid;
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
@@ -252,7 +252,7 @@ var _Enonce = {
|
|||||||
this.childs = vn.attrs.childs || [];
|
this.childs = vn.attrs.childs || [];
|
||||||
// this.nested = vn.attrs.nested || false;
|
// this.nested = vn.attrs.nested || false;
|
||||||
},
|
},
|
||||||
onbeforeupdate:function(vn, old) {
|
onbeforeupdate(vn, old) {
|
||||||
// console.log(vn.attrs.childs);
|
// console.log(vn.attrs.childs);
|
||||||
this.title = vn.attrs.title || "";
|
this.title = vn.attrs.title || "";
|
||||||
this.text = vn.attrs.text;
|
this.text = vn.attrs.text;
|
||||||
@@ -260,15 +260,13 @@ var _Enonce = {
|
|||||||
// this.nested = vn.attrs.nested || false;
|
// this.nested = vn.attrs.nested || false;
|
||||||
// if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
|
// if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
// if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
|
// if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
|
||||||
return [
|
return [
|
||||||
// create dot
|
// create dot
|
||||||
m(_Dot, {"id":this.id, 'text':this.text,'type':this.title}),
|
m(_Dot, {"id":this.id, 'text':this.text,'type':this.title}),
|
||||||
// addd children
|
// addd children
|
||||||
this.childs.map(function(c){
|
this.childs.map(c => { return m(_Child, c); })
|
||||||
return m(_Child, c);
|
|
||||||
})
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,17 +278,17 @@ var _Enonce = {
|
|||||||
// / ____/ /_/ / / / /_
|
// / ____/ /_/ / / / /_
|
||||||
// /_/ \__,_/_/ \__/
|
// /_/ \__,_/_/ \__/
|
||||||
var _Part = {
|
var _Part = {
|
||||||
oninit: function(vn){
|
oninit(vn){
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.title = vn.attrs.title || "";
|
this.title = vn.attrs.title || "";
|
||||||
this.enonces = vn.attrs.enonces;
|
this.enonces = vn.attrs.enonces;
|
||||||
},
|
},
|
||||||
onbeforeupdate: function(vn, old){
|
onbeforeupdate(vn, old){
|
||||||
// console.log('_Part, onbeforeupdate old',old);
|
// console.log('_Part, onbeforeupdate old',old);
|
||||||
this.title = vn.attrs.title || "";
|
this.title = vn.attrs.title || "";
|
||||||
this.enonces = vn.attrs.enonces;
|
this.enonces = vn.attrs.enonces;
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
// console.log(vn.attrs.enonces);
|
// console.log(vn.attrs.enonces);
|
||||||
return m("section", {
|
return m("section", {
|
||||||
'id' :this.id,
|
'id' :this.id,
|
||||||
@@ -300,7 +298,7 @@ var _Part = {
|
|||||||
// create title node
|
// create title node
|
||||||
m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
|
m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
|
||||||
// create text node
|
// create text node
|
||||||
this.enonces.map(function(e){
|
this.enonces.map(e => {
|
||||||
// console.log(e.text);
|
// console.log(e.text);
|
||||||
// return m(_Enonce, Object.assign({"partid":this.id},e))
|
// return m(_Enonce, Object.assign({"partid":this.id},e))
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
@@ -328,16 +326,16 @@ var _Part = {
|
|||||||
// _/ // / / / /_/ / / /_/ /
|
// _/ // / / / /_/ / / /_/ /
|
||||||
// /___/_/ /_/\__/_/ \____/
|
// /___/_/ /_/\__/_/ \____/
|
||||||
var _Intro = {
|
var _Intro = {
|
||||||
oninit : function(vn){
|
oninit(vn){
|
||||||
console.log('_Intro : oninit : vn', vn);
|
console.log('_Intro : oninit : vn', vn);
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.text = vn.attrs.text || '';
|
this.text = vn.attrs.text || '';
|
||||||
},
|
},
|
||||||
onbeforeupdate : function(vn, old){
|
onbeforeupdate(vn, old){
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.text = vn.attrs.text || '';
|
this.text = vn.attrs.text || '';
|
||||||
},
|
},
|
||||||
view : function(vn){
|
view(vn){
|
||||||
return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
|
return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -349,15 +347,15 @@ var _Intro = {
|
|||||||
// / /___/ /_/ / / / / / / / __/ /__/ /_/ / /_/ / / / (__ )
|
// / /___/ /_/ / / / / / / / __/ /__/ /_/ / /_/ / / / (__ )
|
||||||
// \____/\____/_/ /_/_/ /_/\___/\___/\__/_/\____/_/ /_/____/
|
// \____/\____/_/ /_/_/ /_/\___/\___/\__/_/\____/_/ /_/____/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
oncreate: function(vn){
|
oncreate(vn){
|
||||||
document.body.classList.add('mode-connections');
|
document.body.classList.add('mode-connections');
|
||||||
_Ui.init();
|
_Ui.init();
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
console.log('_ModeConnections view', vn.attrs.lang);
|
console.log('_ModeConnections view', vn.attrs.lang);
|
||||||
return [
|
return [
|
||||||
m(_Header),
|
m(_Header),
|
||||||
m('main', {id:"content", 'class':'mode-connections'}, _dbs.data[vn.attrs.lang].map(function(p){
|
m('main', {id:"content", 'class':'mode-connections'}, _dbs.data[vn.attrs.lang].map(p => {
|
||||||
if(p.id == 'intro'){
|
if(p.id == 'intro'){
|
||||||
return m(_Intro,p);
|
return m(_Intro,p);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
+25
-27
@@ -18,15 +18,15 @@ var _Ui = require('./ui.js');
|
|||||||
var _Link = {
|
var _Link = {
|
||||||
tid:"",
|
tid:"",
|
||||||
opened:false,
|
opened:false,
|
||||||
oninit: function(vn){
|
oninit(vn){
|
||||||
// console.log("INIT LINK : vn", vn);
|
// console.log("INIT LINK : vn", vn);
|
||||||
// define target id
|
// define target id
|
||||||
this.tid = vn.attrs.href;
|
this.tid = vn.attrs.href;
|
||||||
},
|
},
|
||||||
onbeforeupdate: function(vn){
|
onbeforeupdate(vn){
|
||||||
this.tid = vn.attrs.href;
|
this.tid = vn.attrs.href;
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
this.tid_known = typeof _dbs.data_byid[_dbs.lang][this.tid] === 'undefined' ? false : true;
|
this.tid_known = typeof _dbs.data_byid[_dbs.lang][this.tid] === 'undefined' ? false : true;
|
||||||
if (!this.tid_known) {
|
if (!this.tid_known) {
|
||||||
console.log('!! target id '+this.tid+' unkonwn !!');
|
console.log('!! target id '+this.tid+' unkonwn !!');
|
||||||
@@ -47,7 +47,7 @@ var _Link = {
|
|||||||
'class':'link',
|
'class':'link',
|
||||||
'href':'#'+this.tid,
|
'href':'#'+this.tid,
|
||||||
'rel':this.tid,
|
'rel':this.tid,
|
||||||
onclick:function(e){
|
onclick(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log('click', this);
|
console.log('click', this);
|
||||||
vn.state.opened = true;
|
vn.state.opened = true;
|
||||||
@@ -128,7 +128,7 @@ var _Text = {
|
|||||||
texthtml:"",
|
texthtml:"",
|
||||||
textdom:null,
|
textdom:null,
|
||||||
textchilds:[],
|
textchilds:[],
|
||||||
parsetext: function(){
|
parsetext(){
|
||||||
// console.log('parsetext', this);
|
// console.log('parsetext', this);
|
||||||
// !! we need to convert markdown to html here because parseTextDom() is recursive through nodes tree
|
// !! we need to convert markdown to html here because parseTextDom() is recursive through nodes tree
|
||||||
// convert markdown to html
|
// convert markdown to html
|
||||||
@@ -143,16 +143,16 @@ var _Text = {
|
|||||||
console.log(this.textchilds);
|
console.log(this.textchilds);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
oninit: function(vn){
|
oninit(vn){
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.text = vn.attrs.text || "";
|
this.text = vn.attrs.text || "";
|
||||||
this.parsetext();
|
this.parsetext();
|
||||||
},
|
},
|
||||||
onbeforeupdate: function(vn,old){
|
onbeforeupdate(vn,old){
|
||||||
this.text = vn.attrs.text;
|
this.text = vn.attrs.text;
|
||||||
this.parsetext();
|
this.parsetext();
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
// console.log('_Text :: view : '+vn.attrs.slug, vn);
|
// console.log('_Text :: view : '+vn.attrs.slug, vn);
|
||||||
return m('div',
|
return m('div',
|
||||||
{'class':'text'},
|
{'class':'text'},
|
||||||
@@ -172,7 +172,7 @@ var _Item = {
|
|||||||
part:null,
|
part:null,
|
||||||
type:null,
|
type:null,
|
||||||
nested:false,
|
nested:false,
|
||||||
oninit: function(vn){
|
oninit(vn){
|
||||||
// console.log('vn.attrs', vn.attrs);
|
// console.log('vn.attrs', vn.attrs);
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.type = vn.attrs.type;
|
this.type = vn.attrs.type;
|
||||||
@@ -180,12 +180,12 @@ var _Item = {
|
|||||||
this.text = vn.attrs.text;
|
this.text = vn.attrs.text;
|
||||||
this.nested = vn.attrs.nested || false;
|
this.nested = vn.attrs.nested || false;
|
||||||
},
|
},
|
||||||
onbeforeupdate: function(vn, old){
|
onbeforeupdate(vn, old){
|
||||||
this.nested = vn.attrs.nested || false;
|
this.nested = vn.attrs.nested || false;
|
||||||
this.type = vn.attrs.type;
|
this.type = vn.attrs.type;
|
||||||
this.text = vn.attrs.text;
|
this.text = vn.attrs.text;
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
return m("section", {
|
return m("section", {
|
||||||
'id':this.id,
|
'id':this.id,
|
||||||
'class':'item'+(this.nested ? ' nested':'')
|
'class':'item'+(this.nested ? ' nested':'')
|
||||||
@@ -194,7 +194,7 @@ var _Item = {
|
|||||||
// create title node
|
// create title node
|
||||||
m("h3", {
|
m("h3", {
|
||||||
// 'ref':vn.attrs.href,
|
// 'ref':vn.attrs.href,
|
||||||
onclick: function(e){
|
onclick(e){
|
||||||
vn.state.active = vn.state.active ? 0 : 1;
|
vn.state.active = vn.state.active ? 0 : 1;
|
||||||
}
|
}
|
||||||
}, m.trust(markdown.renderInline(this.type))),
|
}, m.trust(markdown.renderInline(this.type))),
|
||||||
@@ -217,7 +217,7 @@ var _Enonce = {
|
|||||||
text:null,
|
text:null,
|
||||||
nested:false,
|
nested:false,
|
||||||
childs:[],
|
childs:[],
|
||||||
oninit:function(vn){
|
oninit(vn){
|
||||||
// // console.log('Enonce on init', vn);
|
// // console.log('Enonce on init', vn);
|
||||||
this.partid = vn.attrs.partid;
|
this.partid = vn.attrs.partid;
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
@@ -226,7 +226,7 @@ var _Enonce = {
|
|||||||
this.childs = vn.attrs.childs || [];
|
this.childs = vn.attrs.childs || [];
|
||||||
this.nested = vn.attrs.nested || false;
|
this.nested = vn.attrs.nested || false;
|
||||||
},
|
},
|
||||||
onbeforeupdate:function(vn, old) {
|
onbeforeupdate(vn, old) {
|
||||||
// console.log(vn.attrs.childs);
|
// console.log(vn.attrs.childs);
|
||||||
this.title = vn.attrs.title || "";
|
this.title = vn.attrs.title || "";
|
||||||
this.text = vn.attrs.text;
|
this.text = vn.attrs.text;
|
||||||
@@ -234,7 +234,7 @@ var _Enonce = {
|
|||||||
this.nested = vn.attrs.nested || false;
|
this.nested = vn.attrs.nested || false;
|
||||||
// if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
|
// if(vn.attrs.id == '1d1') console.log('_Enonce UPDATE, text :', vn.attrs.text);
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
// if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
|
// if(vn.attrs.id == '1d1') console.log('_Enonce VIEW, text :', vn.attrs.text);
|
||||||
return m("section", {
|
return m("section", {
|
||||||
'id' :this.id,
|
'id' :this.id,
|
||||||
@@ -246,9 +246,7 @@ var _Enonce = {
|
|||||||
// create text node
|
// create text node
|
||||||
m(_Text, {'text':this.text, 'id':this.id}),
|
m(_Text, {'text':this.text, 'id':this.id}),
|
||||||
// addd children
|
// addd children
|
||||||
this.childs.map(function(c){
|
this.childs.map(c => { return m(_Item, c); })
|
||||||
return m(_Item, c)
|
|
||||||
})
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,17 +257,17 @@ var _Enonce = {
|
|||||||
// / ____/ /_/ / / / /_
|
// / ____/ /_/ / / / /_
|
||||||
// /_/ \__,_/_/ \__/
|
// /_/ \__,_/_/ \__/
|
||||||
var _Part = {
|
var _Part = {
|
||||||
oninit: function(vn){
|
oninit(vn){
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.title = vn.attrs.title || '';
|
this.title = vn.attrs.title || '';
|
||||||
this.enonces = vn.attrs.enonces;
|
this.enonces = vn.attrs.enonces;
|
||||||
},
|
},
|
||||||
onbeforeupdate: function(vn, old){
|
onbeforeupdate(vn, old){
|
||||||
// console.log('_Part, onbeforeupdate old',old);
|
// console.log('_Part, onbeforeupdate old',old);
|
||||||
this.title = vn.attrs.title || '';
|
this.title = vn.attrs.title || '';
|
||||||
this.enonces = vn.attrs.enonces;
|
this.enonces = vn.attrs.enonces;
|
||||||
},
|
},
|
||||||
view: function(vn){
|
view(vn){
|
||||||
// console.log(vn.attrs.enonces);
|
// console.log(vn.attrs.enonces);
|
||||||
return m("section", {
|
return m("section", {
|
||||||
'id' :this.id,
|
'id' :this.id,
|
||||||
@@ -279,7 +277,7 @@ var _Part = {
|
|||||||
// create title node
|
// create title node
|
||||||
m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
|
m("h1", {'class':'part-title', 'part':this.id}, m.trust(markdown.renderInline(this.title))),
|
||||||
// create text node
|
// create text node
|
||||||
this.enonces.map(function(e){
|
this.enonces.map(e => {
|
||||||
// console.log(e.type);
|
// console.log(e.type);
|
||||||
// var title = e.title || '';
|
// var title = e.title || '';
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
@@ -309,16 +307,16 @@ var _Part = {
|
|||||||
// _/ // / / / /_/ / / /_/ /
|
// _/ // / / / /_/ / / /_/ /
|
||||||
// /___/_/ /_/\__/_/ \____/
|
// /___/_/ /_/\__/_/ \____/
|
||||||
var _Intro = {
|
var _Intro = {
|
||||||
oninit : function(vn){
|
oninit(vn){
|
||||||
console.log('_Intro : oninit : vn', vn);
|
console.log('_Intro : oninit : vn', vn);
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.text = vn.attrs.text || '';
|
this.text = vn.attrs.text || '';
|
||||||
},
|
},
|
||||||
onbeforeupdate : function(vn, old){
|
onbeforeupdate(vn, old){
|
||||||
this.id = vn.attrs.id;
|
this.id = vn.attrs.id;
|
||||||
this.text = vn.attrs.text || '';
|
this.text = vn.attrs.text || '';
|
||||||
},
|
},
|
||||||
view : function(vn){
|
view(vn){
|
||||||
return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
|
return m("section", {'class':'intro'}, m("p",m.trust(markdown.renderInline(this.text))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,7 +328,7 @@ var _Intro = {
|
|||||||
// / / / __/> </ /_
|
// / / / __/> </ /_
|
||||||
// /_/ \___/_/|_|\__/
|
// /_/ \___/_/|_|\__/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// oninit : function(vn){
|
// oninit(vn){
|
||||||
// this.lang = vn.attrs.lang;
|
// this.lang = vn.attrs.lang;
|
||||||
// },
|
// },
|
||||||
oncreate(vn){
|
oncreate(vn){
|
||||||
@@ -341,7 +339,7 @@ module.exports = {
|
|||||||
console.log('_ModeText view', vn.attrs.lang);
|
console.log('_ModeText view', vn.attrs.lang);
|
||||||
return [
|
return [
|
||||||
m(_Header),
|
m(_Header),
|
||||||
m('main', {id:"content", 'class':'mode-text'}, _dbs.data[vn.attrs.lang].map(function(p){
|
m('main', {id:"content", 'class':'mode-text'}, _dbs.data[vn.attrs.lang].map((p) => {
|
||||||
console.log("MAP _dbs", p);
|
console.log("MAP _dbs", p);
|
||||||
if(p.id == 'intro'){
|
if(p.id == 'intro'){
|
||||||
return m(_Intro,p);
|
return m(_Intro,p);
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ module.exports = {
|
|||||||
loaded_dbs:0,
|
loaded_dbs:0,
|
||||||
data_byid:[],
|
data_byid:[],
|
||||||
data_strct:{},
|
data_strct:{},
|
||||||
load: function(callback) {
|
load(callback) {
|
||||||
// load all dbs, when all loaded call main app callback function
|
// load all dbs, when all loaded call main app callback function
|
||||||
for (var i = 0; i < this.langs.length; i++) {
|
for (var i = 0; i < this.langs.length; i++) {
|
||||||
this.loadJSON(this.langs[i].lc, '/assets/jsondb/'+this.langs[i].db, callback)
|
this.loadJSON(this.langs[i].lc, '/assets/jsondb/'+this.langs[i].db, callback)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadJSON: function(lc, file, callback){
|
loadJSON(lc, file, callback){
|
||||||
|
|
||||||
var xobj = new XMLHttpRequest();
|
var xobj = new XMLHttpRequest();
|
||||||
xobj.overrideMimeType("application/json");
|
xobj.overrideMimeType("application/json");
|
||||||
@@ -65,7 +65,7 @@ module.exports = {
|
|||||||
xobj.open('GET', file, true);
|
xobj.open('GET', file, true);
|
||||||
xobj.send(null);
|
xobj.send(null);
|
||||||
},
|
},
|
||||||
onJSONLoaded: function(lc, json, callback){
|
onJSONLoaded(lc, json, callback){
|
||||||
console.log('onDBLoaded '+lc);
|
console.log('onDBLoaded '+lc);
|
||||||
this.data[lc] = JSON.parse(json);
|
this.data[lc] = JSON.parse(json);
|
||||||
this.loaded_dbs ++;
|
this.loaded_dbs ++;
|
||||||
@@ -76,7 +76,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
parseByID: function(callback){
|
parseByID(callback){
|
||||||
for(l in this.data){
|
for(l in this.data){
|
||||||
// console.log('l', l);
|
// console.log('l', l);
|
||||||
this.data_byid[l] = {};
|
this.data_byid[l] = {};
|
||||||
@@ -97,7 +97,7 @@ module.exports = {
|
|||||||
// console.log('this.data_byid', this.data_byid);
|
// console.log('this.data_byid', this.data_byid);
|
||||||
this.parseStrct(callback);
|
this.parseStrct(callback);
|
||||||
},
|
},
|
||||||
parseStrct: function(callback){
|
parseStrct(callback){
|
||||||
|
|
||||||
var id, item, obj, links_match, link, tid;
|
var id, item, obj, links_match, link, tid;
|
||||||
for (id in this.data_byid[this.langs[0].lc]) {
|
for (id in this.data_byid[this.langs[0].lc]) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ var m = require('mithril');
|
|||||||
// / __/ /_/ / /_/ / /_/ __/ /
|
// / __/ /_/ / /_/ / /_/ __/ /
|
||||||
// /_/ \____/\____/\__/\___/_/
|
// /_/ \____/\____/\__/\___/_/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
view: function(vn){
|
view(vn){
|
||||||
return m('footer', [
|
return m('footer', [
|
||||||
m('p', m.trust('© 2017 <a href="./">Ethica Spinoza</a>'))
|
m('p', m.trust('© 2017 <a href="./">Ethica Spinoza</a>'))
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ var markdown = require('markdown-it')()
|
|||||||
// / __ / __/ /_/ / /_/ / __/ /
|
// / __ / __/ /_/ / /_/ / __/ /
|
||||||
// /_/ /_/\___/\__,_/\__,_/\___/_/
|
// /_/ /_/\___/\__,_/\__,_/\___/_/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
view: function(vn){
|
view(vn){
|
||||||
return m('header', [
|
return m('header', [
|
||||||
m('hgroup', [
|
m('hgroup', [
|
||||||
m('h1', 'Ethica'),
|
m('h1', 'Ethica'),
|
||||||
@@ -35,7 +35,7 @@ module.exports = {
|
|||||||
// / ____/ /_/ / / / /_(__ ) / / / / / / __/ / / / /_/ /
|
// / ____/ /_/ / / / /_(__ ) / / / / / / __/ / / / /_/ /
|
||||||
// /_/ \__,_/_/ \__/____/ /_/ /_/ /_/\___/_/ /_/\__,_/
|
// /_/ \__,_/_/ \__/____/ /_/ /_/ /_/\___/_/ /_/\__,_/
|
||||||
var _PartsNav = {
|
var _PartsNav = {
|
||||||
view: function(vn){
|
view(vn){
|
||||||
var lang = m.route.param('lang');
|
var lang = m.route.param('lang');
|
||||||
console.log('partsmenu', lang);
|
console.log('partsmenu', lang);
|
||||||
return m('nav', {id:'parts-nav'}, [
|
return m('nav', {id:'parts-nav'}, [
|
||||||
@@ -60,7 +60,7 @@ var _PartsNav = {
|
|||||||
// / _, _/ /_/ / /_/ / /_/ __/ / / / / / / __/ / / / /_/ /
|
// / _, _/ /_/ / /_/ / /_/ __/ / / / / / / __/ / / / /_/ /
|
||||||
// /_/ |_|\____/\__,_/\__/\___/ /_/ /_/ /_/\___/_/ /_/\__,_/
|
// /_/ |_|\____/\__,_/\__/\___/ /_/ /_/ /_/\___/_/ /_/\__,_/
|
||||||
var _RouteMenu = {
|
var _RouteMenu = {
|
||||||
view: function(){
|
view(){
|
||||||
var lang = m.route.param('lang');
|
var lang = m.route.param('lang');
|
||||||
var path = m.route.get().match(/^(\/[^\/]+)(\/[^\/|#]+)(.*)$/);
|
var path = m.route.get().match(/^(\/[^\/]+)(\/[^\/|#]+)(.*)$/);
|
||||||
console.log('Route menu Path', path);
|
console.log('Route menu Path', path);
|
||||||
@@ -90,21 +90,21 @@ var _RouteMenu = {
|
|||||||
// /_____/\__,_/_/ /_/\__, /_/ /_/\___/_/ /_/\__,_/
|
// /_____/\__,_/_/ /_/\__, /_/ /_/\___/_/ /_/\__,_/
|
||||||
// /____/
|
// /____/
|
||||||
var _LangMenu = {
|
var _LangMenu = {
|
||||||
view: function(){
|
view(){
|
||||||
var path = m.route.get().match(/^\/[^\/]+(.+)$/);
|
var path = m.route.get().match(/^\/[^\/]+(.+)$/);
|
||||||
// console.log('Lang menu Path', path);
|
// console.log('Lang menu Path', path);
|
||||||
// create ul dom
|
// create ul dom
|
||||||
return m('nav', {id:'languages'}, [
|
return m('nav', {id:'languages'}, [
|
||||||
// TODO: replaced labels with localized content
|
// TODO: replaced labels with localized content
|
||||||
m('h3', 'languages'),
|
m('h3', 'languages'),
|
||||||
m('ul', _dbs.langs.map(function(lang){
|
m('ul', _dbs.langs.map(lang => {
|
||||||
// create li dom for each lank link
|
// create li dom for each lank link
|
||||||
return m('li',
|
return m('li',
|
||||||
// create a dom
|
// create a dom
|
||||||
m('a', {
|
m('a', {
|
||||||
'lang':lang.lc,
|
'lang':lang.lc,
|
||||||
'href':'/'+lang.lc+path[1]
|
'href':'/'+lang.lc+path[1]
|
||||||
// onclick:function(e){
|
// onclick(e){
|
||||||
// e.preventDefault();
|
// e.preventDefault();
|
||||||
// // console.log('click lang', e);
|
// // console.log('click lang', e);
|
||||||
// var lang = e.target.getAttribute('lang');
|
// var lang = e.target.getAttribute('lang');
|
||||||
|
|||||||
Reference in New Issue
Block a user