Skip to content

Commit

Permalink
Twitter integration : Embed medias mdolr#20
Browse files Browse the repository at this point in the history
  • Loading branch information
sravan7 committed Oct 12, 2019
1 parent 1925588 commit 4c3518a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 11 additions & 0 deletions css/templates/twitter.css
Original file line number Diff line number Diff line change
@@ -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;
}
11 changes: 8 additions & 3 deletions js/templates/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('</p>')[0]));
// tweetContent.appendChild(document.createTextNode(res.data.html.split('dir="ltr">')[1].split('</p>')[0]));

// innerHTML to make a tag as link
tweetContent.innerHTML=res.data.html.split('dir="ltr">')[1].split('</p>')[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');
Expand Down

0 comments on commit 4c3518a

Please sign in to comment.