Skip to content

Commit

Permalink
Fix protocol relative facebook video url's
Browse files Browse the repository at this point in the history
  • Loading branch information
jsor committed Oct 8, 2016
1 parent 225d01f commit b23c050
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions dist/lity.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@
return false;
}

if (0 !== target.indexOf('http')) {
target = 'https:' + target;
}

return iframeHandler(
transferHash(
target,
Expand Down
2 changes: 1 addition & 1 deletion dist/lity.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/lity.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@
return false;
}

if (0 !== target.indexOf('http')) {
target = 'https:' + target;
}

return iframeHandler(
transferHash(
target,
Expand Down
10 changes: 5 additions & 5 deletions test/functional/uri.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,23 @@ <h2>Vimeo</h2>
<h2>Facebook</h2>

<ul>
<li>
THIS TEST FAILS: <a href="//www.facebook.com/facebook/videos/10154181299581729" data-lity></a>
</li>
<li>
<a href="https://www.facebook.com/facebook/videos/10154181299581729/" data-lity></a>
</li>
<li>
<a href="http://www.facebook.com/facebook/videos/10154181299581729/" data-lity></a>
</li>
<li>
<a href="www.facebook.com/facebook/videos/10154181299581729" data-lity></a>
<a href="//www.facebook.com/facebook/videos/10154181299581729" data-lity></a>
</li>
<li>
<a href="https://facebook.com/facebook/videos/10154181299581729/" data-lity></a>
</li>
<li>
<a href="facebook.com/facebook/videos/10154181299581729/" data-lity></a>
<a href="http://facebook.com/facebook/videos/10154181299581729" data-lity></a>
</li>
<li>
<a href="//facebook.com/facebook/videos/10154181299581729/" data-lity></a>
</li>
</ul>

Expand Down

0 comments on commit b23c050

Please sign in to comment.