From b24bc57ce1630c213606543437ce09857063c508 Mon Sep 17 00:00:00 2001 From: Yi JiHong <0125ses@hanmail.net> Date: Sun, 11 Aug 2024 19:05:15 +0900 Subject: [PATCH] Add: vimeoQuery #1410 --- README.md | 4 ++++ src/lib/constructor.js | 1 + src/plugins/dialog/video.js | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 5066cc3c..effe532d 100644 --- a/README.md +++ b/README.md @@ -739,6 +739,10 @@ youtubeQuery : The query string of a YouTube embedded URL. default: '' It takes precedence over the value user entered. ex) 'autoplay=1&mute=1&enablejsapi=1&controls=0&rel=0&modestbranding=1' // https://developers.google.com/youtube/player_parameters +vimeoQuery : The query string of a Vimeo embedded URL. default: '' {String} + It takes precedence over the value user entered. + ex) 'autoplay=1&muted=1' + // https://help.vimeo.com/hc/en-us/articles/12426260232977-Player-parameters-overview videoFileInput : Choose whether to create a file input tag in the video upload window. default: false {Boolean} videoUrlInput : Choose whether to create a video url input tag in the video upload window. If the value of videoFileInput is false, it will be unconditionally. default: true {Boolean} diff --git a/src/lib/constructor.js b/src/lib/constructor.js index 75f7a1e3..a80a68dc 100755 --- a/src/lib/constructor.js +++ b/src/lib/constructor.js @@ -557,6 +557,7 @@ export default { options.videoRatio = (util.getNumber(options.videoRatio, 4) || 0.5625); options.videoRatioList = !options.videoRatioList ? null : options.videoRatioList; options.youtubeQuery = (options.youtubeQuery || '').replace('?', ''); + options.vimeoQuery = (options.vimeoQuery || '').replace('?', ''); options.videoFileInput = !!options.videoFileInput; options.videoUrlInput = (options.videoUrlInput === undefined || !options.videoFileInput) ? true : options.videoUrlInput; options.videoUploadHeader = options.videoUploadHeader || null; diff --git a/src/plugins/dialog/video.js b/src/plugins/dialog/video.js index 72d4e739..a309d642 100644 --- a/src/plugins/dialog/video.js +++ b/src/plugins/dialog/video.js @@ -29,6 +29,7 @@ export default { _align: 'none', _floatClassRegExp: '__se__float\\-[a-z]+', _youtubeQuery: options.youtubeQuery, + _vimeoQuery: options.vimeoQuery, _videoRatio: (options.videoRatio * 100) + '%', _defaultRatio: (options.videoRatio * 100) + '%', _linkValue: '', @@ -540,6 +541,15 @@ export default { url = url.slice(0, -1); } url = 'https://player.vimeo.com/video/' + url.slice(url.lastIndexOf('/') + 1); + + if (contextVideo._vimeoQuery.length > 0) { + if (/\?/.test(url)) { + const splitUrl = url.split('?'); + url = splitUrl[0] + '?' + contextVideo._vimeoQuery + '&' + splitUrl[1]; + } else { + url += '?' + contextVideo._vimeoQuery; + } + } } this.plugins.video.create_video.call(this, this.plugins.video[(!/embed|iframe|player|\/e\/|\.php|\.html?/.test(url) && !/vimeo\.com/.test(url) ? "createVideoTag" : "createIframeTag")].call(this), url, contextVideo.inputX.value, contextVideo.inputY.value, contextVideo._align, null, this.context.dialog.updateModal);