diff options
Diffstat (limited to 'juick-www/src/main/js')
-rw-r--r-- | juick-www/src/main/js/killy/index.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/juick-www/src/main/js/killy/index.js b/juick-www/src/main/js/killy/index.js index 142d08d9d..fe249faed 100644 --- a/juick-www/src/main/js/killy/index.js +++ b/juick-www/src/main/js/killy/index.js @@ -190,16 +190,17 @@ function getEmbeddableLinkTypes() { id: 'embed_youtube_videos', onByDefault: false, ctsDefault: false, - re: /^(?:https?:)?\/\/(?:www\.|m\.)?(?:youtu(?:(?:\.be\/|be\.com\/(?:v|embed)\/)([-\w]+)|be\.com\/watch)((?:(?:\?|&(?:amp;)?)(?:\w+=[-\.\w]*[-\w]))*)|youtube\.com\/playlist\?list=([-\w]*)(&(amp;)?[-\w\?=]*)?)/i, + re: /^(?:https?:)?\/\/(?:www\.|m\.|gaming\.)?(?:youtu(?:(?:\.be\/|be\.com\/(?:v|embed)\/)([-\w]+)|be\.com\/watch)((?:(?:\?|&(?:amp;)?)(?:\w+=[-\.\w]*[-\w]))*)|youtube\.com\/playlist\?list=([-\w]*)(&(amp;)?[-\w\?=]*)?)/i, makeNode: function(aNode, reResult) { let [url, v, args, plist] = reResult; let iframeUrl; if (plist !== undefined) { iframeUrl = '//www.youtube-nocookie.com/embed/videoseries?list=' + plist; } else { - args = args.replace(/^\?/, ''); - let arr = args.split('&').map(s => s.split('=')); - let pp = {}; arr.forEach(z => pp[z[0]] = z[1]); + let pp = {}; args.replace(/^\?/, '') + .split('&') + .map(s => s.split('=')) + .forEach(z => pp[z[0]] = z[1]); let embedArgs = { rel: '0' }; if (pp.t != undefined) { const tre = /^(?:(\d+)|(?:(\d+)h)?(?:(\d+)m)?(\d+)s|(?:(\d+)h)?(\d+)m|(\d+)h)$/i; @@ -210,10 +211,13 @@ function getEmbeddableLinkTypes() { embedArgs['list'] = pp.list; } v = v || pp.v; - iframeUrl = '//www.youtube-nocookie.com/embed/' + v + '?' + Object.keys(embedArgs).map(k => `${k}=${embedArgs[k]}`).join('&'); + let argsStr = Object.keys(embedArgs) + .map(k => `${k}=${embedArgs[k]}`) + .join('&'); + iframeUrl = `//www.youtube-nocookie.com/embed/${v}?${argsStr}`; } let iframe = makeIframe(iframeUrl, '100%', '360px'); - setTimeout(() => makeResizableToRatio(iframe, 9.0/16.0), 10); + setTimeout(() => makeResizableToRatio(iframe, 9.0 / 16.0), 10); return wrapIntoTag(iframe, 'div', 'youtube resizableV'); } }, @@ -226,7 +230,7 @@ function getEmbeddableLinkTypes() { re: /^(?:https?:)?\/\/(?:www\.)?(?:player\.)?vimeo\.com\/(?:video\/|album\/[\d]+\/video\/)?([\d]+)/i, makeNode: function(aNode, reResult) { let iframe = makeIframe('//player.vimeo.com/video/' + reResult[1], '100%', '360px'); - setTimeout(() => makeResizableToRatio(iframe, 9.0/16.0), 10); + setTimeout(() => makeResizableToRatio(iframe, 9.0 / 16.0), 10); return wrapIntoTag(iframe, 'div', 'vimeo resizableV'); } } |