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 } }