Created
March 31, 2016 19:30
-
-
Save typeoneerror/ccb26cbaf4bbaba967c65a09106e1d3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2b5c9988688ab2d7fddfc2f80bfeb6a343edccd7 Mon Sep 17 00:00:00 2001 | |
From: Benjamin Borowski <[email protected]> | |
Date: Thu, 31 Mar 2016 12:18:57 -0700 | |
Subject: [PATCH] [REDACTOR] adds video param options to convertVideoLinks | |
[REDACTOR] adds video embed options to video plugin | |
--- | |
vendor/redactorII/lib/redactor.js | 19 ++++++++++++++++--- | |
vendor/redactorII/plugins/video.js | 12 ++++++++---- | |
2 files changed, 24 insertions(+), 7 deletions(-) | |
diff --git a/vendor/redactorII/lib/redactor.js b/vendor/redactorII/lib/redactor.js | |
index 16ee4ee..1f2857e 100644 | |
--- a/vendor/redactorII/lib/redactor.js | |
+++ b/vendor/redactorII/lib/redactor.js | |
@@ -178,6 +178,7 @@ | |
linkSize: 30, | |
videoContainerClass: 'video-container', | |
+ videoEmbedOptions: {}, | |
toolbar: true, | |
toolbarFixed: true, | |
@@ -6724,24 +6725,36 @@ | |
{ | |
var iframeStart = '<div class="' + this.opts.videoContainerClass + ' redactor-linkify-object"><iframe class="redactor-linkify-object" width="500" height="281" src="'; | |
var iframeEnd = '" frameborder="0" allowfullscreen></iframe></div>'; | |
+ var params = ''; | |
if (html.match(this.opts.regexps.linkyoutube)) | |
{ | |
- html = html.replace(this.opts.regexps.linkyoutube, iframeStart + '//www.youtube.com/embed/$1' + iframeEnd); | |
+ params = this.linkify.buildVideoEmbedOptions('youtube'); | |
+ html = html.replace(this.opts.regexps.linkyoutube, iframeStart + '//www.youtube.com/embed/$1' + params + iframeEnd); | |
} | |
if (html.match(this.opts.regexps.linkvimeo)) | |
{ | |
- html = html.replace(this.opts.regexps.linkvimeo, iframeStart + '//player.vimeo.com/video/$2' + iframeEnd); | |
+ params = this.linkify.buildVideoEmbedOptions('vimeo'); | |
+ html = html.replace(this.opts.regexps.linkvimeo, iframeStart + '//player.vimeo.com/video/$2' + params + iframeEnd); | |
} | |
if (html.match(this.opts.regexps.linkwistia)) | |
{ | |
- html = html.replace(this.opts.regexps.linkwistia, iframeStart + '//fast.wistia.com/embed/iframe/$1' + iframeEnd); | |
+ params = this.linkify.buildVideoEmbedOptions('wistia'); | |
+ html = html.replace(this.opts.regexps.linkwistia, iframeStart + '//fast.wistia.com/embed/iframe/$1' + params + iframeEnd); | |
} | |
return html; | |
}, | |
+ buildVideoEmbedOptions: function(service) { | |
+ var opts = this.opts.videoEmbedOptions[service]; | |
+ if (opts) | |
+ { | |
+ return '?' + $.param(opts); | |
+ } | |
+ return ''; | |
+ }, | |
convertImages: function(html) | |
{ | |
var matches = html.match(this.opts.regexps.linkimage); | |
diff --git a/vendor/redactorII/plugins/video.js b/vendor/redactorII/plugins/video.js | |
index b92ab72..4661292 100755 | |
--- a/vendor/redactorII/plugins/video.js | |
+++ b/vendor/redactorII/plugins/video.js | |
@@ -62,19 +62,23 @@ | |
// parse if it is link on youtube & vimeo | |
var iframeStart = '<div class="' + this.opts.videoContainerClass + '"><iframe style="width: 500px; height: 281px;" src="', | |
- iframeEnd = '" frameborder="0" allowfullscreen></iframe></div>'; | |
+ iframeEnd = '" frameborder="0" allowfullscreen></iframe></div>', | |
+ params = ''; | |
if (data.match(this.video.reUrlYoutube)) | |
{ | |
- data = data.replace(this.video.reUrlYoutube, iframeStart + '//www.youtube.com/embed/$1' + iframeEnd); | |
+ params = this.linkify.buildVideoEmbedOptions('youtube'); | |
+ data = data.replace(this.video.reUrlYoutube, iframeStart + '//www.youtube.com/embed/$1' + params + iframeEnd); | |
} | |
else if (data.match(this.video.reUrlVimeo)) | |
{ | |
- data = data.replace(this.video.reUrlVimeo, iframeStart + '//player.vimeo.com/video/$2' + iframeEnd); | |
+ params = this.linkify.buildVideoEmbedOptions('vimeo'); | |
+ data = data.replace(this.video.reUrlVimeo, iframeStart + '//player.vimeo.com/video/$2' + params + iframeEnd); | |
} | |
else if (data.match(this.video.reUrlWistia)) | |
{ | |
- data = data.replace(this.video.reUrlWistia, iframeStart + '//fast.wistia.com/embed/iframe/$1' + iframeEnd); | |
+ params = this.linkify.buildVideoEmbedOptions('wistia'); | |
+ data = data.replace(this.video.reUrlWistia, iframeStart + '//fast.wistia.com/embed/iframe/$1' + params + iframeEnd); | |
} | |
} | |
-- | |
2.2.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment