added i18n, refactoring
This commit is contained in:
+22
-20
@@ -6,8 +6,8 @@ var markdown = require('markdown-it')()
|
||||
.use(require('markdown-it-footnote'));
|
||||
|
||||
var _dbs = require('./dbs');
|
||||
var _Header = require('./header');
|
||||
var _Footer = require('./footer');
|
||||
// var _Header = require('./header');
|
||||
// var _Footer = require('./footer');
|
||||
var _Ui = require('./ui.js');
|
||||
|
||||
// __ _ __
|
||||
@@ -29,7 +29,7 @@ var _Link = {
|
||||
view(vn){
|
||||
this.tid_known = typeof _dbs.data_byid[_dbs.lang][this.tid] === 'undefined' ? false : true;
|
||||
if (!this.tid_known) {
|
||||
console.log('!! target id '+this.tid+' unkonwn !!');
|
||||
// console.log('!! target id '+this.tid+' unkonwn !!');
|
||||
}
|
||||
if(this.opened && this.tid_known){
|
||||
// console.log('this.tid', vn.state);
|
||||
@@ -140,7 +140,7 @@ var _Text = {
|
||||
// get the text nodes (avoid html document extra)
|
||||
this.textchilds = parseTextDom(this.textdom.getElementsByTagName('body')[0].childNodes);
|
||||
if(this.id == "115sc"){
|
||||
console.log(this.textchilds);
|
||||
// console.log(this.textchilds);
|
||||
}
|
||||
},
|
||||
oninit(vn){
|
||||
@@ -308,7 +308,7 @@ var _Part = {
|
||||
// /___/_/ /_/\__/_/ \____/
|
||||
var _Intro = {
|
||||
oninit(vn){
|
||||
console.log('_Intro : oninit : vn', vn);
|
||||
// console.log('_Intro : oninit : vn', vn);
|
||||
this.id = vn.attrs.id;
|
||||
this.text = vn.attrs.text || '';
|
||||
},
|
||||
@@ -329,27 +329,29 @@ var _Intro = {
|
||||
// /_/ \___/_/|_|\__/
|
||||
module.exports = {
|
||||
// oninit(vn){
|
||||
// this.lang = vn.attrs.lang;
|
||||
// // this.lang = vn.attrs.lang;
|
||||
// console.log('ModeText oninit : lang', vn.attrs.lang);
|
||||
// // i18next.changeLanguage(vn.attrs.lang);
|
||||
// },
|
||||
oncreate(vn){
|
||||
document.body.classList.add('mode-text');
|
||||
_Ui.init();
|
||||
},
|
||||
// onbeforeupdate(vn, old){
|
||||
// console.log('ModeText onbeforeupdate : lang', vn.attrs.lang);
|
||||
// // i18next.changeLanguage(vn.attrs.lang);
|
||||
// },
|
||||
view(vn){
|
||||
console.log('_ModeText view', vn.attrs.lang);
|
||||
return [
|
||||
m(_Header),
|
||||
m('main', {id:"content", 'class':'mode-text'}, _dbs.data[vn.attrs.lang].map((p) => {
|
||||
console.log("MAP _dbs", p);
|
||||
if(p.id == 'intro'){
|
||||
return m(_Intro,p);
|
||||
}else{
|
||||
return m(_Part,p);
|
||||
}
|
||||
})
|
||||
),
|
||||
m(_Footer)
|
||||
]
|
||||
// console.log('_ModeText view : lang', vn.attrs.lang);
|
||||
return m('main', {id:"content", 'class':'mode-text'}, _dbs.data[vn.attrs.lang].map((p) => {
|
||||
// console.log("MAP _dbs", p);
|
||||
if(p.id == 'intro'){
|
||||
return m(_Intro,p);
|
||||
}else{
|
||||
return m(_Part,p);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user