From 408ef4a3e6ab6cd8fe215acedcacee3ed5c10229 Mon Sep 17 00:00:00 2001 From: sava Date: Sat, 28 Mar 2020 04:40:45 +0100 Subject: [PATCH] eyo, fix. spam filter next? --- it1/js/converters/bok.js | 25 +++++++++---------------- it1/js/converters/kommentar.js | 5 +---- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/it1/js/converters/bok.js b/it1/js/converters/bok.js index 67550d8..12f28b1 100644 --- a/it1/js/converters/bok.js +++ b/it1/js/converters/bok.js @@ -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 } toHtml(elm) { - let span = function(selector, string, color='red') { + let span = function(selector, string, p, color='red') { $($(selector)[$(selector).length-1]).append('') - //$($(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('

', this.title) - span('.book') - //.text(this.toString()) - if (user) { - $($('.kommentar')[$('.kommentar').length-1]).append('   Slett') - } - } /* - let span = function(string, color='red') { - return ''+string+'' + elm.append('

') + span('.book', this.title, ' av ') + span('.book', this.author, ', terningkast ') + span('.book', this.rating, ', utgitt ') + span('.book', this.published.toString().slice(0,15), ', forlag: ', 'green') + span('.book', this.publisher, firebase.auth().currentUser?'   Slett':'', 'yellow') } - return '

'+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?'   Slett':'')+'

' - }*/ } bookConverter = { diff --git a/it1/js/converters/kommentar.js b/it1/js/converters/kommentar.js index 5e4136d..1c2142f 100644 --- a/it1/js/converters/kommentar.js +++ b/it1/js/converters/kommentar.js @@ -9,12 +9,9 @@ class Comment { return this.name+': '+this.message } toHtml(elm) { - let user = firebase.auth().currentUser elm.append('

') $($('.kommentar')[$('.kommentar').length-1]).text(this.toString()) - if (user) { - $($('.kommentar')[$('.kommentar').length-1]).append('   Slett') - } + firebase.auth().currentUser?$($('.kommentar')[$('.kommentar').length-1]).append('   Slett'):undefined } }