diff --git a/css/templates/twitter.css b/css/templates/twitter.css index 7c8a1b7..9381d39 100644 --- a/css/templates/twitter.css +++ b/css/templates/twitter.css @@ -1,4 +1,15 @@ .survol-tweet { background-color: rgba(21, 32, 43, 1); border-radius: 10px; +} +#tweeter{ + max-width: 520px; + overflow: hidden; + cursor: pointer; + background-color: #fff; + border: 1px solid #e1e8ed; + border-radius: 5px; + font: normal normal 16px/1.4 Helvetica,Roboto,"Segoe UI",Calibri,sans-serif; + color: #1c2022; + white-space: initial; } \ No newline at end of file diff --git a/js/templates/twitter.js b/js/templates/twitter.js index f551865..5b79546 100644 --- a/js/templates/twitter.js +++ b/js/templates/twitter.js @@ -35,21 +35,26 @@ class TwitterHover { .then((res) => { let tweetContainer = document.createElement('div'); tweetContainer.className = 'survol-tooltiptext survol-tweet'; - + tweetContainer.id = "tweeter" let container = document.createElement('blockquote'); container.className = 'twitter-tweet'; let tweetContent = document.createElement('p'); tweetContent.setAttribute('lang', 'en'); tweetContent.setAttribute('dir', 'ltr'); - tweetContent.appendChild(document.createTextNode(res.data.html.split('dir="ltr">')[1].split('

')[0])); + // tweetContent.appendChild(document.createTextNode(res.data.html.split('dir="ltr">')[1].split('

')[0])); + + // innerHTML to make a tag as link + tweetContent.innerHTML=res.data.html.split('dir="ltr">')[1].split('

')[0]; /*let link = document.createElement('a'); link.setAttribute('src', this.redirectLink); link.appendChild(document.createTextNode('date));*/ container.appendChild(tweetContent); - container.appendChild(document.createTextNode(`${res.data.author_name} - (@${res.data.author_url.split('twitter.com/')[1]})`)); + // container.appendChild(document.createTextNode(`${res.data.author_name} - (@${res.data.author_url.split('twitter.com/')[1]})`)); + + container.insertAdjacentHTML('beforeend',`${res.data.author_name} - (@${res.data.author_url.split('twitter.com/')[1]})` ) //container.appendChild(link); this.boundNode.classList.add('survol-tooltip');