/*!
* froala_editor v1.1.6 (http://editor.froala.com)
* Copyright 2014-2014 Froala
*/
$.Editable.VIDEO_PROVIDERS=[{test_regex:/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|embed\/)?(.+)/g,url_text:"//www.youtube.com/embed/$1",html:''},{test_regex:/^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com)\/(?:channels\/[A-z]+\/|groups\/[A-z]+\/videos\/)?(.+)/g,url_text:"//player.vimeo.com/video/$1",html:''},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"//www.dailymotion.com/embed/video/$1",html:''},{test_regex:/^.+(screen.yahoo.com)\/(videos-for-you|popular)?\/[^_&]+/,url_regex:"",url_text:"",html:''}],$.Editable.commands=$.extend($.Editable.commands,{insertVideo:{title:"Insert Video",icon:"fa fa-video-camera"}}),$.Editable.prototype.execCommand=$.extend($.Editable.prototype.execCommand,{insertVideo:function(){this.insertVideo()}}),$.Editable.prototype.command_dispatcher=$.extend($.Editable.prototype.command_dispatcher,{insertVideo:function(a){var b=this.buildDefaultButton(a);this.$bttn_wrapper.append(b),this.buildInsertVideo()}}),$.Editable.prototype.insertVideo=function(){this.showInsertVideo(),this.saveSelection(),this.options.inlineMode||this.positionPopup("insertVideo"),this.$video_wrapper.find("textarea").val("")},$.Editable.prototype.insertVideoHTML=function(){var a='
';return a},$.Editable.prototype.buildInsertVideo=function(){this.$video_wrapper=$(this.insertVideoHTML()),this.$popup_editor.append(this.$video_wrapper),this.addListener("hidePopups",this.hideVideoWrapper),this.$video_wrapper.on("mouseup keydown","input#f-video-input-"+this._id+", textarea#f-video-textarea-"+this._id,$.proxy(function(a){a.stopPropagation()},this));var a=this;this.$video_wrapper.on("change","input#f-video-input-"+this._id+", textarea#f-video-textarea-"+this._id,function(){"INPUT"==this.tagName?a.$video_wrapper.find("textarea#f-video-textarea-"+a._id).val(""):"TEXTAREA"==this.tagName&&a.$video_wrapper.find("input#f-video-input-"+a._id).val("")}),this.$video_wrapper.on("click","button#f-video-ok-"+this._id,$.proxy(function(){var a=this.$video_wrapper.find("input#f-video-input-"+this._id),b=this.$video_wrapper.find("textarea#f-video-textarea-"+this._id);""!==a.val()?this.writeVideo(a.val(),!1):""!==b.val()&&this.writeVideo(b.val(),!0)},this)),this.$video_wrapper.on("click","i#f-video-close-"+this._id,$.proxy(function(){this.$bttn_wrapper.show(),this.hideVideoWrapper(),this.restoreSelection(),this.options.inlineMode||this.hide()},this)),this.$video_wrapper.on("click",function(a){a.stopPropagation()}),this.$video_wrapper.on("click","*",function(a){a.stopPropagation()})},$.Editable.prototype.writeVideo=function(a,b){if(b)c=a;else for(var c=null,d=0;d<$.Editable.VIDEO_PROVIDERS.length;d++){var e=$.Editable.VIDEO_PROVIDERS[d];if(e.test_regex.test(a)){a=a.replace(e.url_regex,e.url_text),c=e.html.replace(/\{url\}/,a);break}}c?(this.$element.focus(),this.restoreSelection(),this.insertHTML(this.stripScript(c)),this.saveUndoStep(),this.$bttn_wrapper.show(),this.hideVideoWrapper(),this.hide(),this.callback("insertVideo",[c])):this.callback("insertVideoError")},$.Editable.prototype.showVideoWrapper=function(){this.$video_wrapper&&(this.$video_wrapper.show(),this.$video_wrapper.find(".f-popup-line input").val(""))},$.Editable.prototype.hideVideoWrapper=function(){this.$video_wrapper&&this.$video_wrapper.hide()},$.Editable.prototype.showInsertVideo=function(){this.hidePopups(),this.showVideoWrapper()};