eyo, fix. spam filter next?

This commit is contained in:
sava 2020-03-28 04:40:45 +01:00
parent 135e877fa8
commit 408ef4a3e6
2 changed files with 10 additions and 20 deletions

View File

@ -12,25 +12,18 @@ class Book {
return this.title+' av '+this.author+', terningkast '+this.rating+', utgitt '+this.published.toString().slice(0,15)+', forlag; '+this.publisher return this.title+' av '+this.author+', terningkast '+this.rating+', utgitt '+this.published.toString().slice(0,15)+', forlag; '+this.publisher
} }
toHtml(elm) { toHtml(elm) {
let span = function(selector, string, color='red') { let span = function(selector, string, p, color='red') {
$($(selector)[$(selector).length-1]).append('<span style="color: '+color+'"></span>') $($(selector)[$(selector).length-1]).append('<span style="color: '+color+'"></span>')
//$($(selector+' > span')[$(selector+' > span').length-1]) $($(selector+' > span')[$(selector+' > span').length-1]).text(string)
$($(selector)[$(selector).length-1]).append(p)
} }
let user = firebase.auth().currentUser elm.append('<p class="book"></p>')
elm.append('<p class="book"></p>', this.title) span('.book', this.title, ' av ')
span('.book') span('.book', this.author, ', terningkast ')
//.text(this.toString()) span('.book', this.rating, ', utgitt ')
if (user) { span('.book', this.published.toString().slice(0,15), ', forlag: ', 'green')
$($('.kommentar')[$('.kommentar').length-1]).append(' &nbsp; <a class="btn btn-primary" href="javascript: remove(\''+this.cfid+'\')">Slett</a>') span('.book', this.publisher, firebase.auth().currentUser?' &nbsp; <a class="btn btn-primary" href="javascript: remove(\''+this.cfid+'\')">Slett</a>':'', 'yellow')
} }
} /*
let span = function(string, color='red') {
return '<span style="color: '+color+'">'+string+'</span>'
}
return '<p>'+span(this.title)+' av '+span(this.author)+', terningkast '+span(this.rating)+', utgitt '
+span(this.published.toString().slice(0,15), 'green')+', forlag; '+span(this.publisher, 'yellow')
+(user?' &nbsp; <a class="btn btn-primary" href="javascript: remove(\''+this.cfid+'\')">Slett</a>':'')+'</p>'
}*/
} }
bookConverter = { bookConverter = {

View File

@ -9,12 +9,9 @@ class Comment {
return this.name+': '+this.message return this.name+': '+this.message
} }
toHtml(elm) { toHtml(elm) {
let user = firebase.auth().currentUser
elm.append('<p class="kommentar"></p>') elm.append('<p class="kommentar"></p>')
$($('.kommentar')[$('.kommentar').length-1]).text(this.toString()) $($('.kommentar')[$('.kommentar').length-1]).text(this.toString())
if (user) { firebase.auth().currentUser?$($('.kommentar')[$('.kommentar').length-1]).append(' &nbsp; <a class="btn btn-primary" href="javascript: remove(\''+this.cfid+'\')">Slett</a>'):undefined
$($('.kommentar')[$('.kommentar').length-1]).append(' &nbsp; <a class="btn btn-primary" href="javascript: remove(\''+this.cfid+'\')">Slett</a>')
}
} }
} }