KISSY.Editor.add("video/dialog/support",function(){function f(){f.superclass.constructor.apply(this,arguments)}var g=KISSY,c=g.Editor,d=c.Video;g.extend(f,c.Flash.FlashDialog,{_config:function(){var b=this.editor.cfg.pluginConfig;this._cls="ke_video";this._type="video";this._title="\u89c6\u9891";this._bodyHtml="<div style='padding:20px 20px 0 20px'><p><label>\u94fe\u63a5\uff1a <input class='ke-video-url ke-input' style='width:410px;vertical-align:middle;'/></label></p><table style='margin:10px 0 5px  40px;width:400px;'><tr><td><label>\u5bbd\u5ea6\uff1a  <input  data-verify='^(\u81ea\u52a8|((?!0$)\\d+))?$'  data-warning='\u5bbd\u5ea6\u8bf7\u8f93\u5165\u6b63\u6574\u6570' class='ke-video-width ke-input' style='width:60px;margin-left:2px;vertical-align:middle;' /> \u50cf\u7d20</label></td><td><label> \u9ad8\u5ea6\uff1a  <input  data-verify='^(\u81ea\u52a8|((?!0$)\\d+))?$'  data-warning='\u9ad8\u5ea6\u8bf7\u8f93\u5165\u6b63\u6574\u6570' class='ke-video-height ke-input' style='width:60px;vertical-align:middle;'/> \u50cf\u7d20</label></td></tr><tr><td><label>\u5bf9\u9f50\uff1a <select class='ke-video-align'><option value='none'>\u65e0</option><option value='left'>\u5de6\u5bf9\u9f50</option><option value='right'>\u53f3\u5bf9\u9f50</option></select></td><td><label>\u95f4\u8ddd\uff1a <input  data-verify='^\\d+$'  data-warning='\u95f4\u8ddd\u8bf7\u8f93\u5165\u975e\u8d1f\u6574\u6570' class='ke-video-margin ke-input' style='width:60px;vertical-align:middle;' value='0'/> \u50cf\u7d20</label></td></tr></table></div>";
this._footHtml="<div style='padding:5px 20px 20px;'><a class='ke-video-ok ke-button' style='margin-left:40px;margin-right:20px;'>\u786e\u5b9a</button> <a class='ke-video-cancel ke-button'>\u53d6\u6d88</a></div>";this.urlCfg=b.video&&b.video.urlCfg;this._urlTip=b.video&&b.video.urlTip||"\u8bf7\u8f93\u5165\u89c6\u9891\u64ad\u653e\u94fe\u63a5..."},_initD:function(){var b=this.d,a=b.get("el");this.dUrl=a.one(".ke-video-url");this.dAlign=c.Select.decorate(a.one(".ke-video-align"));this.dMargin=a.one(".ke-video-margin");this.dWidth=a.one(".ke-video-width");this.dHeight=
a.one(".ke-video-height");var e=a.one(".ke-video-ok");a=a.one(".ke-video-cancel");e.on("click",this._gen,this);a.on("click",function(h){b.hide();h.halt()});c.Utils.placeholder(this.dUrl,this._urlTip);c.Utils.placeholder(this.dWidth,"\u81ea\u52a8");c.Utils.placeholder(this.dHeight,"\u81ea\u52a8");this.addRes(e,a,this.dUrl,this.dWidth,this.dHeight)},_getDInfo:function(){var b=this.dUrl.val(),a=this.editor.cfg.pluginConfig;a.video=a.video||{};if(a=a.video.getProvider(b))if(b=a.detect(b))return{url:b,attrs:{height:parseInt(this.dHeight.val())||
a.height,width:parseInt(this.dWidth.val())||a.width,style:"margin:"+(parseInt(this.dMargin.val())||0)+"px;float:"+this.dAlign.val()+";"}};else alert("\u4e0d\u652f\u6301\u8be5\u94fe\u63a5\uff0c\u8bf7\u76f4\u63a5\u8f93\u5165\u8be5\u89c6\u9891\u63d0\u4f9b\u7684\u5206\u4eab\u94fe\u63a5");else alert("\u4e0d\u652f\u6301\u8be5\u94fe\u63a5\u6765\u6e90!")},_gen:function(b){var a=this.dUrl.val(),e=this.urlCfg;if(e)for(var h=0;h<e.length;h++){var i=e[h];if(i.reg.test(a)){this.d.loading();d.dynamicUrl.origin=a;d.dynamicUrl.instance=this;setTimeout(function(){g.getScript(i.url.replace(/@url@/,encodeURIComponent(a)).replace(/@callback@/,encodeURIComponent("KISSY.Editor.Video.dynamicUrl")))},
30);return}}f.superclass._gen.call(this);b&&b.halt()},_dynamicUrlPrepare:function(b){this.dUrl.val(b);this.d.unloading();f.superclass._gen.call(this)},_updateD:function(){var b=this.editor,a=this.selectedFlash;if(a){b=b.restoreRealElement(a);c.Utils.valInput(this.dUrl,this._getFlashUrl(b));this.dAlign.val(a.css("float"));this.dMargin.val(parseInt(b._4e_style("margin"))||0);c.Utils.valInput(this.dWidth,parseInt(a.css("width")));c.Utils.valInput(this.dHeight,parseInt(a.css("height")))}else{c.Utils.resetInput(this.dUrl);
this.dAlign.val("none");this.dMargin.val(0);c.Utils.resetInput(this.dWidth);c.Utils.resetInput(this.dHeight)}}});d.dynamicUrl=function(b,a){g.trim(b)==g.trim(d.dynamicUrl.origin)&&d.dynamicUrl.instance._dynamicUrlPrepare(a)};d.Dialog=f},{attach:false});
