text: KindEditor.plugin("media",function(a){var c=this,g="media",h=c.lang(g+"."),v=a.undef(c.allowMediaUpload,!0),k=a.undef(c.allowFileManager,!1),b=a.undef(c.formatUploadUrl,!0),w=a.undef(c.extraFileUploadParams,{}),y=a.undef(c.filePostName,"imgFile"),U=a.undef(c.uploadJson,c.basePath+"php/upload_json.php");c.plugin.media={edit:function(){var S=['<div style="padding:20px;">','<div class="ke-dialog-row">','<label for="keUrl" style="width:60px;">'+h.url+"</label>",'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> &nbsp;','<input type="button" class="ke-upload-button" value="'+h.upload+'" /> &nbsp;','<span class="ke-button-common ke-button-outer">','<input type="button" class="ke-button-common ke-button" name="viewServer" value="'+h.viewServer+'" />',"</span>","</div>",'<div class="ke-dialog-row">','<label for="keWidth" style="width:60px;">'+h.width+"</label>",'<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" />',"</div>",'<div class="ke-dialog-row">','<label for="keHeight" style="width:60px;">'+h.height+"</label>",'<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" />',"</div>",'<div class="ke-dialog-row">','<label for="keAutostart">'+h.autostart+"</label>",'<input type="checkbox" id="keAutostart" name="autostart" value="" /> ',"</div>","</div>"].join(""),P=c.createDialog({name:g,width:450,height:230,title:c.lang(g),body:S,yesBtn:{name:c.lang("yes"),click:function(){var g=a.trim(D.val()),h=H.val(),v=M.val();if("http://"==g||a.invalidUrl(g))return alert(c.lang("invalidUrl")),void D[0].focus();if(!/^\d*$/.test(h))return alert(c.lang("invalidWidth")),void H[0].focus();if(!/^\d*$/.test(v))return alert(c.lang("invalidHeight")),void M[0].focus();var k=a.mediaImg(c.themesPath+"common/blank.gif",{src:g,type:a.mediaType(g),width:h,height:v,autostart:T[0].checked?"true":"false",loop:"true"});c.insertHtml(k).hideDialog().focus()}}}),F=P.div,D=a('[name="url"]',F),L=a('[name="viewServer"]',F),H=a('[name="width"]',F),M=a('[name="height"]',F),T=a('[name="autostart"]',F);if(D.val("http://"),v){var A=a.uploadbutton({button:a(".ke-upload-button",F)[0],fieldName:y,extraParams:w,url:a.addParam(U,"dir=media"),afterUpload:function(h){if(P.hideLoading(),0===h.error){var v=h.url;b&&(v=a.formatUrl(v,"absolute")),D.val(v),c.afterUpload&&c.afterUpload.call(c,v,h,g),alert(c.lang("uploadSuccess"))}else alert(h.message)},afterError:function(a){P.hideLoading(),c.errorDialog(a)}});A.fileBox.change(function(){P.showLoading(c.lang("uploadLoading")),A.submit()})}else a(".ke-upload-button",F).hide();k?L.click(function(){c.loadPlugin("filemanager",function(){c.plugin.filemanagerDialog({viewType:"LIST",dirName:"media",clickFn:function(g){c.dialogs.length>1&&(a('[name="url"]',F).val(g),c.afterSelectFile&&c.afterSelectFile.call(c,g),c.hideDialog())}})})}):L.hide();var B=c.plugin.getSelectedMedia();if(B){var N=a.mediaAttrs(B.attr("data-ke-tag"));D.val(N.src),H.val(a.removeUnit(B.css("width"))||N.width||0),M.val(a.removeUnit(B.css("height"))||N.height||0),T[0].checked="true"===N.autostart}D[0].focus(),D[0].select()},"delete":function(){c.plugin.getSelectedMedia().remove(),c.addBookmark()}},c.clickToolbar(g,c.plugin.media.edit)});