-
Notifications
You must be signed in to change notification settings - Fork 38
Issue #24 #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Issue #24 #30
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,13 +203,21 @@ function updateConversation(data) { | |
var messageText = $("<div></div>").addClass("message-text"); | ||
|
||
// Embed YouTube video if link presents in message. | ||
var result = anchorme(data[i].message.replace(/<(?:.|\n)*?>/gm, ''), { attributes:[ { name:"target", value:"_blank" } ] }); | ||
var youtube_link = data[i].message.indexOf('https://www.youtube.com'); | ||
if(youtube_link !== -1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather repeating the same code again and again, it would be better to make a new function and cal that function on getting link similar to http://youtube.com or http://youtu.be/ else will send message. What do you say ?? |
||
messageText.html(data[i].message + '<iframe width="100%" src="https://www.youtube.com/embed/' + | ||
data[i].message.substring(youtube_link + 32, youtube_link + 43) + '" frameborder="0" allowfullscreen></iframe>'); | ||
messageText.html(result + '<iframe width="100%" src="https://www.youtube.com/embed/' + | ||
data[i].message.substring(youtube_link + 32, youtube_link + 43) + '" frameborder="0" allowfullscreen></iframe>'); | ||
} | ||
else { | ||
messageText.text(data[i].message); | ||
youtube_link = data[i].message.indexOf('https://youtu.be/'); | ||
if(youtube_link !== -1) { | ||
messageText.html(result + '<iframe width="100%" src="https://www.youtube.com/embed/' + | ||
data[i].message.substring(youtube_link + 17, youtube_link + 28) + '" frameborder="0" allowfullscreen></iframe>'); | ||
} | ||
else { | ||
messageText.html(result); | ||
} | ||
} | ||
|
||
var spanElement = $("<span></span>").addClass("message-time pull-right").text(data[i].time); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@forsd You need to check it for youtube short url like
https://youtu.be/*
and one more thing, pls put this link in<a>
tag so user can opn this link directly in the new tab alsoThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check it.