Created
March 31, 2016 18:55
-
-
Save typeoneerror/77c235cc7ebb9336932774435c7cebb7 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 63443cb0583523c81f1f88be73cd095aea936419 Mon Sep 17 00:00:00 2001 | |
From: Benjamin Borowski <[email protected]> | |
Date: Thu, 31 Mar 2016 11:53:50 -0700 | |
Subject: [PATCH] [REDACTOR] adds wistia support to videos | |
--- | |
vendor/redactorII/lib/redactor.js | 12 +++++++++--- | |
vendor/redactorII/plugins/video.js | 12 ++++++------ | |
2 files changed, 15 insertions(+), 9 deletions(-) | |
diff --git a/vendor/redactorII/lib/redactor.js b/vendor/redactorII/lib/redactor.js | |
index 9a98e13..16ee4ee 100644 | |
--- a/vendor/redactorII/lib/redactor.js | |
+++ b/vendor/redactorII/lib/redactor.js | |
@@ -297,6 +297,7 @@ | |
regexps: { | |
linkyoutube: /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig, | |
linkvimeo: /https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/, | |
+ linkwistia: /https?:\/\/(?:.*).(?:wistia.com|wi.st)\/(?:medias|embed)(?:\/iframe)?\/([\w\-]+)\/?/i, | |
linkimage: /((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/ig, | |
url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/ig | |
} | |
@@ -6617,7 +6618,7 @@ | |
}, | |
isLink: function(node) | |
{ | |
- return (node.nodeValue.match(this.opts.regexps.linkyoutube) || node.nodeValue.match(this.opts.regexps.linkvimeo) || node.nodeValue.match(this.opts.regexps.linkimage) || node.nodeValue.match(this.opts.regexps.url)); | |
+ return (node.nodeValue.match(this.opts.regexps.linkyoutube) || node.nodeValue.match(this.opts.regexps.linkvimeo) || node.nodeValue.match(this.opts.regexps.linkvimeo) || node.nodeValue.match(this.opts.regexps.linkimage) || node.nodeValue.match(this.opts.regexps.url)); | |
}, | |
isFiltered: function(i, node) | |
{ | |
@@ -6629,7 +6630,7 @@ | |
var text = $el.text(); | |
var html = text; | |
- if (html.match(this.opts.regexps.linkyoutube) || html.match(this.opts.regexps.linkvimeo)) | |
+ if (html.match(this.opts.regexps.linkyoutube) || html.match(this.opts.regexps.linkvimeo) || html.match(this.opts.regexps.linkwistia)) | |
{ | |
html = this.linkify.convertVideoLinks(html); | |
} | |
@@ -6734,6 +6735,11 @@ | |
html = html.replace(this.opts.regexps.linkvimeo, iframeStart + '//player.vimeo.com/video/$2' + iframeEnd); | |
} | |
+ if (html.match(this.opts.regexps.linkwistia)) | |
+ { | |
+ html = html.replace(this.opts.regexps.linkwistia, iframeStart + '//fast.wistia.com/embed/iframe/$1' + iframeEnd); | |
+ } | |
+ | |
return html; | |
}, | |
convertImages: function(html) | |
@@ -10042,4 +10048,4 @@ | |
} | |
}; | |
-})(jQuery); | |
\ No newline at end of file | |
+})(jQuery); | |
diff --git a/vendor/redactorII/plugins/video.js b/vendor/redactorII/plugins/video.js | |
index 537a52b..b92ab72 100755 | |
--- a/vendor/redactorII/plugins/video.js | |
+++ b/vendor/redactorII/plugins/video.js | |
@@ -5,6 +5,7 @@ | |
return { | |
reUrlYoutube: /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig, | |
reUrlVimeo: /https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/, | |
+ reUrlWistia: /https?:\/\/(?:.*).(?:wistia.com|wi.st)\/(?:medias|embed)(?:\/iframe)?\/([\w\-]+)\/?/i, | |
langs: { | |
en: { | |
"video": "Video", | |
@@ -46,11 +47,8 @@ | |
setTimeout(function() | |
{ | |
$('#redactor-insert-video-area').focus(); | |
- | |
}, 1); | |
} | |
- | |
- | |
}, | |
insert: function() | |
{ | |
@@ -74,6 +72,10 @@ | |
{ | |
data = data.replace(this.video.reUrlVimeo, iframeStart + '//player.vimeo.com/video/$2' + iframeEnd); | |
} | |
+ else if (data.match(this.video.reUrlWistia)) | |
+ { | |
+ data = data.replace(this.video.reUrlWistia, iframeStart + '//fast.wistia.com/embed/iframe/$1' + iframeEnd); | |
+ } | |
} | |
this.modal.close(); | |
@@ -85,9 +87,7 @@ | |
// insert | |
this.air.collapsed(); | |
this.insert.html(data); | |
- | |
} | |
- | |
}; | |
}; | |
-})(jQuery); | |
\ No newline at end of file | |
+})(jQuery); | |
-- | |
2.2.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment