(function(){tinymce.create("tinymce.plugins.kadvideo",{init:function(e,t){var n=this;e.onNodeChange.add(function(e,t,n){t.setActive("kadvideo",n.nodeName=="IMG")});e.onBeforeSetContent.add(function(e,r){r.content=n._do_video(r.content,t)});e.onBeforeSetContent.add(function(e,r){r.content=n._do_videoend(r.content,t)});e.onPostProcess.add(function(e,r){r.get&&(r.content=n._get_video(r.content,t))});e.onPostProcess.add(function(e,r){r.get&&(r.content=n._get_videoend(r.content,t))})},_do_video:function(e){return e.replace(/\[video([^\]]*)\]/g,function(e,t){return'<img src="'+url+'/img/t.gif" class="kadvideo mceItem" title="video'+tinymce.DOM.encode(t)+'" />'})},_do_videoend:function(e){return e.replace(/\[\/video([^\]]*)\]/g,function(e,t){return'<img src="'+url+'/img/t.gif" class="kadvideoend mceItem" title="/video" />'})},_get_video:function(e){function t(e,t){t=(new RegExp(t+'="([^"]+)"',"g")).exec(e);return t?tinymce.DOM.decode(t[1]):""}return e.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,n){var r=t(n,"class");return r.indexOf("kadvideo")!=-1?"<p>["+tinymce.trim(t(n,"title"))+"]</p>":e})},_get_videoend:function(e){function t(e,t){t=(new RegExp(t+'="([^"]+)"',"g")).exec(e);return t?tinymce.DOM.decode(t[1]):""}return e.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,n){var r=t(n,"class");return r.indexOf("kadvideoend")!=-1?"<p>["+tinymce.trim(t(n,"title"))+"]</p>":e})},getInfo:function(){return{longname:"Insert video",author:"Benjamin Ritner",authorurl:"http://kadencethemes.com",infourl:"http://kadencethemes.com",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("kadvideo",tinymce.plugins.kadvideo)})();