tracking link actions in text mode

This commit is contained in:
2018-11-04 13:15:23 +01:00
parent d46b38afe6
commit c29d18cf86
6 changed files with 36 additions and 5 deletions
+4
View File
@@ -883,6 +883,10 @@ main#content.mode-text section.enonce {
color: inherit; }
main#content.mode-text section.enonce div.text div.paragraph span.link.text:after {
content: ':'; }
main#content.mode-text section.enonce div.text div.paragraph span.unknown-link {
font-weight: 600;
text-decoration: line-through;
color: inherit; }
main#content.mode-text section.enonce div.text div.paragraph section.enonce, main#content.mode-text section.enonce div.text div.paragraph section.item {
padding-left: 2em;
border-left: 1px solid #999; }
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2
View File
@@ -33,7 +33,9 @@ var Layout = {
if(typeof _paq !== 'undefined'){
_paq.push(['setCustomUrl', m.route.get()]);
// _paq.push(['setDocumentTitle', e.title]);
_paq.push(['setGenerationTimeMs', 0]);
_paq.push(['trackPageView']);
// _paq.push(['trackEvent', 'Audio', 'play', node.title]);
}
return [
+5
View File
@@ -373,6 +373,11 @@ main#content.mode-text{
span.link.text:after{
content:':'
}
span.unknown-link{
font-weight: 600;
text-decoration:line-through;
color: inherit;
}
section.enonce, section.item{
padding-left:2em;
border-left: 1px solid #999;
+23 -3
View File
@@ -39,10 +39,11 @@ var _Link = {
if (!this.tid_known) {
// console.log(`!! in ${this.id}, target id ${this.tid} is unkonwn !!`);
}
if(this.opened && this.tid_known){
console.log('link vn.state', vn.state);
// traget object
// traget object
this.tob = Object.assign({"nested":true},_dbs.data_byid[vn.attrs.lang][this.tid]);
// this.tob = Object.assign({'lang':vn.attrs.lang}, this.tob);
console.log('this.tob',this.tob);
@@ -56,6 +57,11 @@ var _Link = {
// e.preventDefault();
console.log('click close btn', this);
vn.state.opened = false;
// matomo
if(typeof _paq !== 'undefined'){
// console.log('Matomo text closed', vn.state.tob.breadcrumb);
_paq.push(['trackEvent', 'Text', 'closed', vn.state.tob.breadcrumb]);
}
// return false;
}
}),//, m('span', m.trust("🗙"))),
@@ -64,19 +70,33 @@ var _Link = {
: m(_Item, this.tob)
]
);
}else{
}else if(this.tid_known){
// console.log(vn);
this.tob = _dbs.data_byid[vn.attrs.lang][this.tid];
return m('a', {
'class':'link',
'href':'#'+this.tid,
'rel':this.tid,
onclick(e){
e.preventDefault();
console.log('click', this);
// console.log('click open this', this);
console.log('click open vn', vn);
vn.state.opened = true;
// matomo
if(typeof _paq !== 'undefined'){
// console.log('Matomo text opened', vn.state.tob.breadcrumb);
_paq.push(['trackEvent', 'Text', 'opened', vn.state.tob.breadcrumb]);
}
return false;
}
}, vn.children);
}else{
// if target is unknown
return m('span', {
'class':'unknown-link'
}, vn.children);
}
}