Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
5ecdf7e7
Commit
5ecdf7e7
authored
Dec 18, 2015
by
Sean Hammond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve a code comment
parent
1a3d7e0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
media-embedder.js
h/static/scripts/media-embedder.js
+18
-6
No files found.
h/static/scripts/media-embedder.js
View file @
5ecdf7e7
...
...
@@ -107,16 +107,28 @@ function embedForLink(link) {
/** Replace the given link element with an embed.
*
* If the given link element is a link to an embeddable media then it will be
* replaced in the DOM with an embed (e.g. an <iframe>) of the same media.
* If the given link element is a link to an embeddable media and if its link
* text is the same as its href then it will be replaced in the DOM with an
* embed (e.g. an <iframe>) of the same media.
*
* If it's not an embeddable link the link will be left untouched.
* If the link text is different from the href, then the link will be left
* untouched. We want to convert links like these from the Markdown source into
* embeds:
*
* https://vimeo.com/channels/staffpicks/148845534
* <https://vimeo.com/channels/staffpicks/148845534>
*
* But we don't want to convert links like this:
*
* [Custom link text](https://vimeo.com/channels/staffpicks/148845534)
*
* because doing so would destroy the user's custom link text, and leave users
* with no way to just insert a media link without it being embedded.
*
* If the link is not a link to an embeddable media it will be left untouched.
*
*/
function
replaceLinkWithEmbed
(
link
)
{
// If the user gives a custom link text then we don't replace the link with
// an embed.
if
(
link
.
href
!==
link
.
innerText
)
{
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment