if (!RedactorPlugins) var RedactorPlugins = {};
(function($)
{
RedactorPlugins.video = function()
{
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+)($|\/)/,
getTemplate: function()
{
return String()
+ ''
+ ''
+ ''
+ '';
},
init: function()
{
var button = this.button.addAfter('image', 'video', this.lang.get('video'));
this.button.addCallback(button, this.video.show);
},
show: function()
{
this.modal.addTemplate('video', this.video.getTemplate());
this.modal.load('video', this.lang.get('video'), 700);
this.modal.createCancelButton();
var button = this.modal.createActionButton(this.lang.get('insert'));
button.on('click', this.video.insert);
this.selection.save();
this.modal.show();
$('#redactor-insert-video-area').focus();
},
insert: function()
{
var data = $('#redactor-insert-video-area').val();
if (!data.match(/