Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
Support YoutTube custom start time
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyapps committed Apr 9, 2018
1 parent 2d1e511 commit c33194d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
12 changes: 8 additions & 4 deletions dist/jquery.fancybox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==================================================
// fancyBox v3.3.2
// fancyBox v3.3.3
//
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
Expand Down Expand Up @@ -2765,7 +2765,7 @@
});

$.fancybox = {
version: "3.3.2",
version: "3.3.3",
defaults: defaults,

// Get current instance and execute a command.
Expand Down Expand Up @@ -3253,8 +3253,12 @@
thumb =
$.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);

if (providerName === "vimeo") {
url = url.replace("&%23", "#");
if (providerName === "youtube") {
url = url.replace(/&t=((\d+)m)?(\d+)s/, function(match, p1, m, s) {
return "&start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
});
} else if (providerName === "vimeo") {
c = url.replace("&%23", "#");
}

return false;
Expand Down
6 changes: 3 additions & 3 deletions dist/jquery.fancybox.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fancyapps/fancybox",
"description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
"version": "3.3.2",
"version": "3.3.3",
"homepage": "http://fancyapps.com/fancybox/",
"main": "./dist/jquery.fancybox.js",
"author": "fancyApps",
Expand Down
8 changes: 6 additions & 2 deletions src/js/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@
thumb =
$.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);

if (providerName === "vimeo") {
url = url.replace("&%23", "#");
if (providerName === "youtube") {
url = url.replace(/&t=((\d+)m)?(\d+)s/, function(match, p1, m, s) {
return "&start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
});
} else if (providerName === "vimeo") {
c = url.replace("&%23", "#");
}

return false;
Expand Down

0 comments on commit c33194d

Please sign in to comment.