From 5df4d3f2b92d5ae7040d31ebe811c057bbfea4ed Mon Sep 17 00:00:00 2001 From: nekonigohan Date: Mon, 5 Oct 2020 15:25:37 +0900 Subject: [PATCH] Update youtube.js When `Link` is fired, var matches in lity.js is filled as ``` matche[0]: youtu.be/WJ88GhJJI3Q?start=4394 matche[1]: youtu.be matche[2]: undefined matche[3]: undefined matche[4]: WJ88GhJJI3Q matche[5]: ?start=4394 ``` and then, lity builds a url below which includes `%3F` as an urlencoded result of `?` in `matche[5]` so that YouTube does not start the movie at 4394. `https://www.youtube.com/embed/WJ88GhJJI3Q?autoplay=1&%3Fstart=4394` So, `var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i;` should be `var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})\?(.*)?/i;` for the expected behavior. --- src/plugins/youtube/youtube.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/youtube/youtube.js b/src/plugins/youtube/youtube.js index f3118de..5999430 100644 --- a/src/plugins/youtube/youtube.js +++ b/src/plugins/youtube/youtube.js @@ -11,7 +11,7 @@ }(typeof window !== "undefined" ? window : this, function(lity) { 'use strict'; - var _regex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i; + var _regex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})\?(.*)?/i; lity.handlers('youtube', function(target, instance) { var matches = _regex.exec(target);