Skip to content

Commit

Permalink
Hardcode https protocol for youtube, vimeo and gmaps embeds
Browse files Browse the repository at this point in the history
Fixes missing youtube player controls when loaded via http.
  • Loading branch information
jsor committed Mar 10, 2016
1 parent 950e0cf commit b97c140
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion dist/lity.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Lity - v1.6.2 - 2016-02-12
/*! Lity - v1.6.2 - 2016-03-10
* http://sorgalla.com/lity/
* Copyright (c) 2016 Jan Sorgalla; Licensed MIT */
.lity {
Expand Down
12 changes: 4 additions & 8 deletions dist/lity.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Lity - v1.6.2 - 2016-02-12
/*! Lity - v1.6.2 - 2016-03-10
* http://sorgalla.com/lity/
* Copyright (c) 2016 Jan Sorgalla; Licensed MIT */
(function(window, factory) {
Expand Down Expand Up @@ -92,10 +92,6 @@
return this;
}

function protocol() {
return 'file:' === window.location.protocol ? 'http:' : '';
}

function parseQueryParams(params){
var pairs = decodeURI(params).split('&');
var obj = {}, p;
Expand Down Expand Up @@ -180,7 +176,7 @@

if (matches) {
url = appendQueryParams(
protocol() + '//www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4],
'https://www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4],
$.extend(
{
autoplay: 1
Expand All @@ -194,7 +190,7 @@

if (matches) {
url = appendQueryParams(
protocol() + '//player.vimeo.com/video/' + matches[3],
'https://player.vimeo.com/video/' + matches[3],
$.extend(
{
autoplay: 1
Expand All @@ -208,7 +204,7 @@

if (matches) {
url = appendQueryParams(
protocol() + '//www.google.' + matches[3] + '/maps?' + matches[6],
'https://www.google.' + matches[3] + '/maps?' + matches[6],
{
output: matches[6].indexOf('layer=c') > 0 ? 'svembed' : 'embed'
}
Expand Down
2 changes: 1 addition & 1 deletion dist/lity.min.css

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

4 changes: 2 additions & 2 deletions dist/lity.min.js

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

10 changes: 3 additions & 7 deletions src/lity.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@
return this;
}

function protocol() {
return 'file:' === window.location.protocol ? 'http:' : '';
}

function parseQueryParams(params){
var pairs = decodeURI(params).split('&');
var obj = {}, p;
Expand Down Expand Up @@ -177,7 +173,7 @@

if (matches) {
url = appendQueryParams(
protocol() + '//www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4],
'https://www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4],
$.extend(
{
autoplay: 1
Expand All @@ -191,7 +187,7 @@

if (matches) {
url = appendQueryParams(
protocol() + '//player.vimeo.com/video/' + matches[3],
'https://player.vimeo.com/video/' + matches[3],
$.extend(
{
autoplay: 1
Expand All @@ -205,7 +201,7 @@

if (matches) {
url = appendQueryParams(
protocol() + '//www.google.' + matches[3] + '/maps?' + matches[6],
'https://www.google.' + matches[3] + '/maps?' + matches[6],
{
output: matches[6].indexOf('layer=c') > 0 ? 'svembed' : 'embed'
}
Expand Down

0 comments on commit b97c140

Please sign in to comment.