diff --git a/dist/lib/kindeditor/kindeditor.js b/dist/lib/kindeditor/kindeditor.js index b303b6655260ca00f309405b1440d39c70668cac..ab44935f51b63893885b295ec81d0244139c2f86 100644 --- a/dist/lib/kindeditor/kindeditor.js +++ b/dist/lib/kindeditor/kindeditor.js @@ -10102,6 +10102,7 @@ KindEditor.plugin('pasteimage', function(K) { var oldPlaceholder = self.getPlaceholder(); if (!oldPlaceholder) oldPlaceholder = placeholder; else if (oldPlaceholder.indexOf(placeholder) < 0) placeholder = oldPlaceholder + '\n' + placeholder; + self.setPlaceholder(placeholder); } } @@ -11103,7 +11104,7 @@ KindEditor.plugin('table', function (K) { // 获取用户拖选的单元格 self.plugin.getSelectedCells = function () { var table = self.plugin.getSelectedTable(); - if (table.length) { + if (table && table.length) { var cells = K('.ke-select-cell', table.get(0)); if (cells && cells.length > 1) { return cells; diff --git a/dist/lib/kindeditor/kindeditor.min.js b/dist/lib/kindeditor/kindeditor.min.js index 04ab2ff6eeaf792a07c74f4bfa573dbdd54b9447..2626c4984b4918cbecc405f1731b84b8d20173e2 100644 --- a/dist/lib/kindeditor/kindeditor.min.js +++ b/dist/lib/kindeditor/kindeditor.min.js @@ -3,5 +3,5 @@ html:r.innerHTML},_addBookmarkToStack(t,i);var l=e.pop();return _removeBookmarkT if(1==d.nodeType&&d===u&&c+1===p){var h=d.childNodes[c];if("a"==h.nodeName.toLowerCase())return n(h,e,t),i}return _nativeCommand(a,"createlink","__kindeditor_temp_url__"),K('a[href="__kindeditor_temp_url__"]',a).each(function(){n(this,e,t)}),i},unlink:function(){var e=this,t=e.doc,n=e.range;if(e.select(),n.collapsed){var i=e.commonNode({a:"*"});if(i&&(n.selectNode(i.get()),e.select()),_nativeCommand(t,"unlink",null),_WEBKIT&&"img"===K(n.startContainer).name){var a=K(n.startContainer).parent();"a"===a.name&&a.remove(!0)}}else _nativeCommand(t,"unlink",null);return e}}),_each("formatblock,selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript".split(","),function(e,t){KCmd.prototype[t]=function(e){var n=this;return n.select(),_nativeCommand(n.doc,t,e),_IERANGE&&_inArray(t,"justifyleft,justifycenter,justifyright,justifyfull".split(","))>=0&&n.selection(),(!_IERANGE||_inArray(t,"formatblock,selectall,insertorderedlist,insertunorderedlist".split(","))>=0)&&n.selection(),n}}),_each("cut,copy,paste".split(","),function(e,t){KCmd.prototype[t]=function(){var e=this;if(!e.doc.queryCommandSupported(t))throw"not supported";return e.select(),_nativeCommand(e.doc,t,null),e}}),K.CmdClass=KCmd,K.cmd=_cmd,_extend(KWidget,{init:function(e){var t=this;if(t.name=e.name||"",t.doc=e.doc||document,t.win=_getWin(t.doc),t.x=_addUnit(e.x),t.y=_addUnit(e.y),t.z=e.z,t.width=_addUnit(e.width),t.height=_addUnit(e.height),t.div=K('
'),t.options=e,t._alignEl=e.alignEl,t.width&&t.div.css("width",t.width),t.height&&t.div.css("height",t.height),t.z&&t.div.css({position:"absolute",left:t.x,top:t.y,"z-index":t.z}),!t.z||t.x!==undefined&&t.y!==undefined||t.autoPos(t.width,t.height),e.cls&&t.div.addClass(e.cls),e.shadowMode&&t.div.addClass("ke-shadow"),e.css&&t.div.css(e.css),e.src?K(e.src).replaceWith(t.div):K(t.doc.body).append(t.div),e.html&&t.div.html(e.html),e.autoScroll)if(_IE&&_V<7||_QUIRKS){var n=_getScrollPos();K(t.win).bind("scroll",function(e){var i=_getScrollPos(),a=i.x-n.x,o=i.y-n.y;t.pos(_removeUnit(t.x)+a,_removeUnit(t.y)+o,!1)})}else t.div.css("position","fixed")},pos:function(e,t,n){var i=this;return n=_undef(n,!0),null!==e&&(e=e<0?0:_addUnit(e),i.div.css("left",e),n&&(i.x=e)),null!==t&&(t=t<0?0:_addUnit(t),i.div.css("top",t),n&&(i.y=t)),i},autoPos:function(e,t){var n=this,i=_removeUnit(e)||0,a=_removeUnit(t)||0,o=_getScrollPos();if(n._alignEl){var r=K(n._alignEl),l=r.pos(),s=_round(r[0].clientWidth/2-i/2),d=_round(r[0].clientHeight/2-a/2);x=s<0?l.x:l.x+s,y=d<0?l.y:l.y+d}else{var c=_docElement(n.doc);x=_round(o.x+(c.clientWidth-i)/2),y=_round(o.y+(c.clientHeight-a)/2)}return _IE&&_V<7||_QUIRKS||(x-=o.x,y-=o.y),n.pos(x,y)},remove:function(){var e=this;return(_IE&&_V<7||_QUIRKS)&&K(e.win).unbind("scroll"),e.div.remove(),_each(e,function(t){e[t]=null}),this},show:function(){return this.div.show(),this},hide:function(){return this.div.hide(),this},draggable:function(e){var t=this;return e=e||{},e.moveEl=t.div,e.moveFn=function(e,n,i,a,o,r){(e+=o)<0&&(e=0),(n+=r)<0&&(n=0),t.pos(e,n)},_drag(e),t}}),K.WidgetClass=KWidget,K.widget=_widget;var html,_direction="";(html=document.getElementsByTagName("html"))&&(_direction=html[0].dir),_extend(KEdit,KWidget,{init:function(e){function t(){var t=_iframeDoc(n.iframe);t.open(),l&&(t.domain=document.domain),t.write(_getInitHtml(i,a,o,r)),t.close(),n.win=n.iframe[0].contentWindow,n.doc=t;var s=_cmd(t);n.afterChange(function(e){s.selection()}),_WEBKIT&&K(t).click(function(e){"img"===K(e.target).name&&(s.selection(!0),s.range.selectNode(e.target),s.select())}),_IE&&(n._mousedownHandler=function(){var e=s.range.cloneRange();e.shrink(),e.isControl()&&n.blur()},K(document).mousedown(n._mousedownHandler),K(t).keydown(function(e){if(8==e.which){s.selection();var t=s.range;t.isControl()&&(t.collapse(!0),K(t.startContainer.childNodes[t.startOffset]).remove(),e.preventDefault())}})),n.cmd=s,n.html(_elementVal(n.srcElement)),_IE?(t.body.disabled=!0,t.body.contentEditable=!0,t.body.removeAttribute("disabled")):t.designMode="on",e.afterCreate&&e.afterCreate.call(n)}var n=this;KEdit.parent.init.call(n,e),n.srcElement=K(e.srcElement),n.div.addClass("ke-edit"),n.designMode=_undef(e.designMode,!0),n.beforeGetHtml=e.beforeGetHtml,n.beforeSetHtml=e.beforeSetHtml,n.afterSetHtml=e.afterSetHtml;var i=_undef(e.themesPath,""),a=e.bodyClass,o=e.cssPath,r=e.cssData,l="res:"!=location.protocol&&location.host.replace(/:\d+/,"")!==document.domain,s="document.open();"+(l?'document.domain="'+document.domain+'";':"")+"document.close();",d=_IE?' src="javascript:void(function(){'+encodeURIComponent(s)+'}())"':"";n.iframe=K('").css("width","100%"),n.textarea=K('').css("width","100%"),n.tabIndex=isNaN(parseInt(e.tabIndex,10))?n.srcElement.attr("tabindex"):parseInt(e.tabIndex,10),n.iframe.attr("tabindex",n.tabIndex),n.textarea.attr("tabindex",n.tabIndex),n.width&&n.setWidth(n.width),n.height&&n.setHeight(n.height),n.designMode?n.textarea.hide():n.iframe.hide(),l&&n.iframe.bind("load",function(e){n.iframe.unbind("load"),_IE?t():setTimeout(t,0)}),n.div.append(n.iframe),n.div.append(n.textarea),n.srcElement.hide(),!l&&t()},setWidth:function(e){return this.div.css("width",_addUnit(e)),this},setHeight:function(e){var t=this;return e=_addUnit(e),t.div.css("height",e),t.iframe.css("height",e),(_IE&&_V<8||_QUIRKS)&&(e=_addUnit(_removeUnit(e)-2)),t.textarea.css("height",e),t},remove:function(){var e=this,t=e.doc;K(t.body).unbind(),K(t).unbind(),K(e.win).unbind(),e._mousedownHandler&&K(document).unbind("mousedown",e._mousedownHandler),_elementVal(e.srcElement,e.html()),e.srcElement.show(),t.write(""),e.iframe.unbind(),e.textarea.unbind(),KEdit.parent.remove.call(e)},html:function(e,t){var n=this,i=n.doc;if(n.designMode){var a=i.body;return e===undefined?(e=t?""+a.parentNode.innerHTML+"":a.innerHTML,n.beforeGetHtml&&(e=n.beforeGetHtml(e)),_GECKO&&"
"==e&&(e=""),e):(n.beforeSetHtml&&(e=n.beforeSetHtml(e)),_IE&&_V>=9&&(e=e.replace(/(<.*?checked=")checked(".*>)/gi,"$1$2")),K(a).html(e),n.afterSetHtml&&n.afterSetHtml(),n)}return e===undefined?n.textarea.val():(n.textarea.val(e),n)},design:function(e){var t,n=this;return(e===undefined?!n.designMode:e)?n.designMode||(t=n.html(),n.designMode=!0,n.html(t),n.textarea.hide(),n.iframe.show()):n.designMode&&(t=n.html(),n.designMode=!1,n.html(t),n.iframe.hide(),n.textarea.show()),n.focus()},focus:function(){var e=this;return e.designMode?e.win.focus():e.textarea[0].focus(),e},blur:function(){var e=this;if(_IE){var t=K('',e.div);e.div.append(t),t[0].focus(),t.remove()}else e.designMode?e.win.blur():e.textarea[0].blur();return e},afterChange:function(e){function t(t){setTimeout(function(){e(t)},1)}var n=this,i=n.doc,a=i.body;return K(i).keyup(function(t){t.ctrlKey||t.altKey||!_CHANGE_KEY_MAP[t.which]||e(t)}),K(i).mouseup(e).contextmenu(e),K(n.win).blur(e),K(a).bind("paste",t),K(a).bind("cut",t),n}}),K.EditClass=KEdit,K.edit=_edit,K.iframeDoc=_iframeDoc,_extend(KToolbar,KWidget,{init:function(e){function t(e){var t=K(e);return t.hasClass("ke-outline")?t:t.hasClass("ke-toolbar-icon")?t.parent():void 0}function n(e,n){var i=t(e.target);if(i){if(i.hasClass("ke-disabled"))return;if(i.hasClass("ke-selected"))return;i[n]("ke-on")}}var i=this;KToolbar.parent.init.call(i,e),i.disableMode=_undef(e.disableMode,!1),i.noDisableItemMap=_toMap(_undef(e.noDisableItems,[])),i._itemMap={},i.div.addClass("ke-toolbar").bind("contextmenu,mousedown,mousemove",function(e){e.preventDefault()}).attr("unselectable","on"),i.div.mouseover(function(e){n(e,"addClass")}).mouseout(function(e){n(e,"removeClass")}).click(function(e){var n=t(e.target);if(n){if(n.hasClass("ke-disabled"))return;i.options.click.call(this,e,n.attr("data-name"))}})},get:function(e){return this._itemMap[e]?this._itemMap[e]:this._itemMap[e]=K("span.ke-icon-"+e,this.div).parent()},select:function(e){return _selectToolbar.call(this,e,function(e){e.addClass("ke-selected")}),self},unselect:function(e){return _selectToolbar.call(this,e,function(e){e.removeClass("ke-selected").removeClass("ke-on")}),self},enable:function(e){var t=this,n=e.get?e:t.get(e);return n&&(n.removeClass("ke-disabled"),n.opacity(1)),t},disable:function(e){var t=this,n=e.get?e:t.get(e);return n&&(n.removeClass("ke-selected").addClass("ke-disabled"),n.opacity(.5)),t},disableAll:function(e,t){var n=this,i=n.noDisableItemMap;return t&&(i=_toMap(t)),(e===undefined?!n.disableMode:e)?(K("span.ke-outline",n.div).each(function(){var e=K(this),t=e[0].getAttribute("data-name",2);i[t]||n.disable(e)}),n.disableMode=!0):(K("span.ke-outline",n.div).each(function(){var e=K(this),t=e[0].getAttribute("data-name",2);i[t]||n.enable(e)}),n.disableMode=!1),n}}),K.ToolbarClass=KToolbar,K.toolbar=_toolbar,_extend(KMenu,KWidget,{init:function(e){var t=this;e.z=e.z||811213,KMenu.parent.init.call(t,e),t.centerLineMode=_undef(e.centerLineMode,!0),t.div.addClass("ke-menu").bind("click,mousedown",function(e){e.stopPropagation()}).attr("unselectable","on")},addItem:function(e){var t=this;if("-"===e.title)return void t.div.append(K('
'));var n=K('
'),i=K('
'),a=K('
'),o=_addUnit(e.height),r=_undef(e.iconClass,"");t.div.append(n),o&&(n.css("height",o),a.css("line-height",o));var l;return t.centerLineMode&&(l=K('
'),o&&l.css("height",o)),n.mouseover(function(e){K(this).addClass("ke-menu-item-on"),l&&l.addClass("ke-menu-item-center-on")}).mouseout(function(e){K(this).removeClass("ke-menu-item-on"),l&&l.removeClass("ke-menu-item-center-on")}).click(function(t){e.click.call(K(this)),t.stopPropagation()}).append(i),l&&n.append(l),n.append(a),e.checked&&(r="ke-icon-checked"),""!==r&&i.html(''),a.html(e.title),t},remove:function(){var e=this;return e.options.beforeRemove&&e.options.beforeRemove.call(e),K(".ke-menu-item",e.div[0]).unbind(),KMenu.parent.remove.call(e),e}}),K.MenuClass=KMenu,K.menu=_menu,_extend(KColorPicker,KWidget,{init:function(e){var t=this;e.z=e.z||811213,KColorPicker.parent.init.call(t,e);var n=e.colors||[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900","#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]];t.selectedColor=(e.selectedColor||"").toLowerCase(),t._cells=[],t.div.addClass("ke-colorpicker").bind("click,mousedown",function(e){e.stopPropagation()}).attr("unselectable","on");var i=t.doc.createElement("table");t.div.append(i),i.className="ke-colorpicker-table",i.cellPadding=0,i.cellSpacing=0,i.border=0;var a=i.insertRow(0),o=a.insertCell(0);o.colSpan=n[0].length,t._addAttr(o,"","ke-colorpicker-cell-top");for(var r=0;r').css("background-color",t)):e.html(i.options.noColor),K(e).attr("unselectable","on"),i._cells.push(e)},remove:function(){var e=this;return _each(e._cells,function(){this.unbind()}),KColorPicker.parent.remove.call(e),e}}),K.ColorPickerClass=KColorPicker,K.colorpicker=_colorpicker,_extend(KUploadButton,{init:function(e){var t=this,n=K(e.button),i=e.fieldName||"file",a=e.url||"",o=n.val(),r=e.extraParams||{},l=n[0].className||"",s=e.target||"kindeditor_upload_iframe_"+(new Date).getTime();e.afterError=e.afterError||function(e){alert(e)};var d=[];for(var c in r)d.push('');var u=['
',e.target?"":'',e.form?'
':'
','',d.join(""),'',"",'',e.form?"
":"","
"].join(""),p=K(u,n.doc);n.hide(),n.before(p),t.div=p,t.button=n,t.iframe=e.target?K('iframe[name="'+s+'"]'):K("iframe",p),t.form=e.form?K(e.form):K("form",p),t.fileBox=K(".ke-upload-file",p),t.options=e},submit:function(){var e=this,t=e.iframe;return t.bind("load",function(){t.unbind();var n=document.createElement("form");e.fileBox.before(n),K(n).append(e.fileBox),n.reset(),K(n).remove(!0);var i,a=K.iframeDoc(t),o=a.getElementsByTagName("pre")[0],r="";r=o?o.innerHTML:a.body.innerHTML,r=_unescape(r),t[0].src="javascript:false";try{i=K.json(r)}catch(l){e.options.afterError.call(e,""+a.body.parentNode.innerHTML+"")}i&&e.options.afterUpload.call(e,i)}),e.form[0].submit(),e},remove:function(){var e=this;return e.fileBox&&e.fileBox.unbind(),e.iframe.remove(),e.div.remove(),e.button.show(),e}}),K.UploadButtonClass=KUploadButton,K.uploadbutton=_uploadbutton,_extend(KDialog,KWidget,{init:function(e){var t=this,n=_undef(e.shadowMode,!0);e.z=e.z||811213,e.shadowMode=!1,e.autoScroll=_undef(e.autoScroll,!0),KDialog.parent.init.call(t,e);var i=e.title,a=K(e.body,t.doc),o=e.previewBtn,r=e.yesBtn,l=e.noBtn,s=e.closeBtn,d=_undef(e.showMask,!0);t.div.addClass("ke-dialog").bind("click,mousedown",function(e){e.stopPropagation()});var c=K('
').appendTo(t.div);_IE&&_V<7?t.iframeMask=K('').appendTo(t.div):n&&K('
').appendTo(t.div);var u=K('
');c.append(u),u.html(i),t.closeIcon=K('').click(s.click),u.append(t.closeIcon),t.draggable({clickEl:u,beforeDrag:e.beforeDrag});var p=K('
');c.append(p),p.append(a);var h=K('');if((o||r||l)&&c.append(h),_each([{btn:o,name:"preview"},{btn:r,name:"yes"},{btn:l,name:"no"}],function(){if(this.btn){var e=_createButton(this.btn);e.addClass("ke-dialog-"+this.name),h.append(e)}}),t.height&&p.height(_removeUnit(t.height)-u.height()-h.height()),t.div.width(t.div.width()),t.div.height(t.div.height()),t.mask=null,d){var f=_docElement(t.doc),m=Math.max(f.scrollWidth,f.clientWidth),g=Math.max(f.scrollHeight,f.clientHeight);t.mask=_widget({x:0,y:0,z:t.z-1,cls:"ke-dialog-mask",width:m,height:g})}t.autoPos(t.div.width(),t.div.height()),t.footerDiv=h,t.bodyDiv=p,t.headerDiv=u,t.isLoading=!1},setMaskIndex:function(e){var t=this;t.mask.div.css("z-index",e)},showLoading:function(e){e=_undef(e,"");var t=this,n=t.bodyDiv;return t.loading=K('
'+e+"
").width(n.width()).height(n.height()).css("top",t.headerDiv.height()+"px"),n.css("visibility","hidden").after(t.loading),t.isLoading=!0,t},hideLoading:function(){return this.loading&&this.loading.remove(),this.bodyDiv.css("visibility","visible"),this.isLoading=!1,this},remove:function(){var e=this;return e.options.beforeRemove&&e.options.beforeRemove.call(e),e.mask&&e.mask.remove(),e.iframeMask&&e.iframeMask.remove(),e.closeIcon.unbind(),K("input",e.div).unbind(),K("button",e.div).unbind(),e.footerDiv.unbind(),e.bodyDiv.unbind(),e.headerDiv.unbind(),K("iframe",e.div).each(function(){K(this).remove()}),KDialog.parent.remove.call(e),e}}),K.DialogClass=KDialog,K.dialog=_dialog,K.tabs=_tabs,K.loadScript=_loadScript,K.loadStyle=_loadStyle,K.ajax=_ajax;var _plugins={},_language={};KEditor.prototype={lang:function(e){return _lang(e,this.langType)},loadPlugin:function(e,t){var n=this;return _plugins[e]?_isFunction(_plugins[e])?(_plugins[e].call(n,KindEditor),t&&t.call(n),n):(setTimeout(function(){n.loadPlugin(e,t)},100),n):(_plugins[e]="loading",_loadScript(n.pluginsPath+e+"/"+e+".js?ver="+encodeURIComponent(K.DEBUG?_TIME:_VERSION),function(){setTimeout(function(){_plugins[e]&&n.loadPlugin(e,t)},0)}),n)},handler:function(e,t){var n=this;return n._handlers[e]||(n._handlers[e]=[]),_isFunction(t)?(n._handlers[e].push(t),n):(_each(n._handlers[e],function(){t=this.call(n,t)}),t)},clickToolbar:function(e,t){var n=this,i="clickToolbar"+e;return t===undefined?n._handlers[i]?n.handler(i):(n.loadPlugin(e,function(){n.handler(i)}),n):n.handler(i,t)},updateState:function(){var e=this;return _each("justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,subscript,superscript,bold,italic,underline,strikethrough".split(","),function(t,n){e.cmd.state(n)?e.toolbar.select(n):e.toolbar.unselect(n)}),e},addContextmenu:function(e){return this._contextmenus.push(e),this},afterCreate:function(e){return this.handler("afterCreate",e)},beforeRemove:function(e){return this.handler("beforeRemove",e)},beforeGetHtml:function(e){return this.handler("beforeGetHtml",e)},beforeSetHtml:function(e){return this.handler("beforeSetHtml",e)},afterSetHtml:function(e){return this.handler("afterSetHtml",e)},create:function(){function e(){return 0===s.height()?void setTimeout(e,100):void t.resize(i,a,!1)}var t=this,n=t.fullscreenMode;if(t.isCreated)return t;if(t.srcElement.data("kindeditor"))return t;t.srcElement.data("kindeditor","true"),n?_docElement().style.overflow="hidden":_docElement().style.overflow="";var i=n?_docElement().clientWidth+"px":t.width,a=n?_docElement().clientHeight+"px":t.height;(_IE&&_V<8||_QUIRKS)&&(a=_addUnit(_removeUnit(a)+2));var o=t.container=K(t.layout);n?K(document.body).append(o):t.srcElement.before(o);var r=K(".toolbar",o),l=K(".edit",o),s=t.statusbar=K(".statusbar",o);o.removeClass("container").addClass("ke-container ke-container-"+t.themeType).css("width",i),n?(o.css({position:"absolute",left:0,top:0,"z-index":811211}),_GECKO||(t._scrollPos=_getScrollPos()),window.scrollTo(0,0),K(document.body).css({height:"1px",overflow:"hidden"}),K(document.body.parentNode).css("overflow","hidden"),t._fullscreenExecuted=!0):(t._fullscreenExecuted&&(K(document.body).css({height:"",overflow:""}),K(document.body.parentNode).css("overflow","")),t._scrollPos&&window.scrollTo(t._scrollPos.x,t._scrollPos.y));var d=[];K.each(t.items,function(e,n){"|"==n?d.push(''):"/"==n?d.push('
'):(d.push(''),d.push(''))});var c=t.toolbar=_toolbar({src:r,html:d.join(""),noDisableItems:t.noDisableItems,click:function(e,n){if(e.stop(),t.menu){var i=t.menu.name;if(t.hideMenu(),i===n)return}t.clickToolbar(n)}}),u=_removeUnit(a)-c.div.height(),p=t.edit=_edit({height:u>0&&_removeUnit(a)>t.minHeight?u:t.minHeight,src:l,srcElement:t.srcElement,designMode:t.designMode,themesPath:t.themesPath,bodyClass:t.bodyClass,cssPath:t.cssPath,cssData:t.cssData,beforeGetHtml:function(e){return e=t.beforeGetHtml(e),e=_removeBookmarkTag(_removeTempTag(e)),_formatHtml(e,t.filterMode?t.htmlTags:null,t.urlType,t.wellFormatMode,t.indentChar)},beforeSetHtml:function(e){return e=_formatHtml(e,t.filterMode?t.htmlTags:null,"",!1),t.beforeSetHtml(e)},afterSetHtml:function(){t.edit=p=this,t.afterSetHtml()},afterCreate:function(){if(t.edit=p=this,t.cmd=p.cmd,t._docMousedownFn=function(e){t.menu&&t.hideMenu()},K(p.doc,document).mousedown(t._docMousedownFn),_bindContextmenuEvent.call(t),_bindNewlineEvent.call(t),_bindTabEvent.call(t),_bindFocusEvent.call(t),p.afterChange(function(e){p.designMode&&(t.updateState(),t.addBookmark(),t.options.afterChange&&t.options.afterChange.call(t))}),p.textarea.keyup(function(e){e.ctrlKey||e.altKey||!_INPUT_KEY_MAP[e.which]||t.options.afterChange&&t.options.afterChange.call(t)}),t.readonlyMode&&t.readonly(),t.isCreated=!0,""===t.initContent&&(t.initContent=t.html()),t._undoStack.length>0){var e=t._undoStack.pop();e.start&&(t.html(e.html),p.cmd.range.moveToBookmark(e),t.select())}t.afterCreate(),t.options.afterCreate&&t.options.afterCreate.call(t),t.container.removeClass("ke-loading")}});return s.removeClass("statusbar").addClass("ke-statusbar").append(''),t._fullscreenResizeHandler&&(K(window).unbind("resize",t._fullscreenResizeHandler),t._fullscreenResizeHandler=null),e(),n?(t._fullscreenResizeHandler=function(e){t.isCreated&&t.resize(_docElement().clientWidth,_docElement().clientHeight,!1)},K(window).bind("resize",t._fullscreenResizeHandler),c.select("fullscreen")):(_GECKO&&K(window).bind("scroll",function(e){t._scrollPos=_getScrollPos()}),t.resizeType>0&&_drag({moveEl:o,clickEl:s,moveFn:function(e,n,i,a,o,r){a+=r,t.resize(null,a)}}),2===t.resizeType&&_drag({moveEl:o,clickEl:s.last(),moveFn:function(e,n,i,a,o,r){i+=o,a+=r,t.resize(i,a)}})),t},remove:function(){var e=this;return e.isCreated?(e.beforeRemove(),e.srcElement.data("kindeditor",""),e.menu&&e.hideMenu(),_each(e.dialogs,function(){e.hideDialog()}),K(document).unbind("mousedown",e._docMousedownFn),e.toolbar.remove(),e.edit.remove(),e.statusbar.last().unbind(),e.statusbar.unbind(),e.container.remove(),e.container=e.toolbar=e.edit=e.menu=null,e.dialogs=[],e.isCreated=!1,e):e},resize:function(e,t,n){var i=this;return n=_undef(n,!0),e&&(/%/.test(e)||(e=_removeUnit(e),e=e/gi,"").replace(/ /gi," ")):t.html(_escape(e))},isEmpty:function(){return""===_trim(this.text().replace(/\r\n|\n|\r/,""))},isDirty:function(){return _trim(this.initContent.replace(/\r\n|\n|\r|t/g,""))!==_trim(this.html().replace(/\r\n|\n|\r|t/g,""))},selectedHtml:function(){var e=this.isCreated?this.cmd.range.html():"";return e=_removeBookmarkTag(_removeTempTag(e))},count:function(e){var t=this;return e=(e||"html").toLowerCase(),"html"===e?t.html().length:"text"===e?t.text().replace(/<(?:img|embed).*?>/gi,"K").replace(/\r\n|\n|\r/g,"").length:0},exec:function(e){e=e.toLowerCase();var t=this,n=t.cmd,i=_inArray(e,"selectall,copy,paste,print".split(","))<0;return i&&t.addBookmark(!1),n[e].apply(n,_toArray(arguments,1)),i&&(t.updateState(),t.addBookmark(!1),t.options.afterChange&&t.options.afterChange.call(t)),t},insertHtml:function(e,t){return this.isCreated?(e=this.beforeSetHtml(e),this.exec("inserthtml",e,t),this):this},appendHtml:function(e){if(this.html(this.html()+e),this.isCreated){var t=this.cmd;t.range.selectNodeContents(t.doc.body).collapse(!1),t.select()}return this},sync:function(){return _elementVal(this.srcElement,this.html()),this},focus:function(){return this.isCreated?this.edit.focus():this.srcElement[0].focus(),this},blur:function(){return this.isCreated?this.edit.blur():this.srcElement[0].blur(),this},addBookmark:function(e){e=_undef(e,!0);var t,n=this,i=n.edit,a=i.doc.body,o=_removeTempTag(a.innerHTML);if(e&&n._undoStack.length>0){var r=n._undoStack[n._undoStack.length-1];if(Math.abs(o.length-_removeBookmarkTag(r.html).length)0){var n=t.dialogs[0],i=t.dialogs[t.dialogs.length-1];n.setMaskIndex(i.z+2),e.z=i.z+3,e.showMask=!1}var a=_dialog(e);return t.dialogs.push(a),a},hideDialog:function(){var e=this;if(e.dialogs.length>0&&e.dialogs.pop().remove(),e.dialogs.length>0){var t=e.dialogs[0],n=e.dialogs[e.dialogs.length-1];t.setMaskIndex(n.z-1)}return e},errorDialog:function(e){var t=this,n=t.createDialog({width:750,title:t.lang("uploadError"),body:'
'}),i=K("iframe",n.div),a=K.iframeDoc(i);return a.open(),a.write(e),a.close(),K(a.body).css("background-color","#FFF"),i[0].contentWindow.focus(),t}},_instances=[],K.remove=function(e){_eachEditor(e,function(e){this.remove(),_instances.splice(e,1)})},K.sync=function(e){_eachEditor(e,function(){this.sync()})},K.html=function(e,t){_eachEditor(e,function(){this.html(t)})},K.insertHtml=function(e,t){_eachEditor(e,function(){this.insertHtml(t)})},K.appendHtml=function(e,t){_eachEditor(e,function(){this.appendHtml(t)})},_IE&&_V<7&&_nativeCommand(document,"BackgroundImageCache",!0),K.EditorClass=KEditor,K.editor=_editor,K.create=_create,K.instances=_instances,K.plugin=_plugin,K.lang=_lang,_plugin("core",function(e){var t=this,n={undo:"Z",redo:"Y",bold:"B",italic:"I",underline:"U",print:"P",selectall:"A"};if(t.afterSetHtml(function(){t.options.afterChange&&t.options.afterChange.call(t)}),t.afterCreate(function(){if("form"==t.syncType){for(var n=e(t.srcElement),i=!1;n=n.parent();)if("form"==n.name){i=!0;break}if(i){n.bind("submit",function(n){t.sync(),e(window).bind("unload",function(){t.edit.textarea.remove()})});var a=e('[type="reset"]',n);a.click(function(){t.html(t.initContent),t.cmd.selection()}),t.beforeRemove(function(){n.unbind(),a.unbind()})}}}),t.clickToolbar("source",function(){t.edit.designMode?(t.toolbar.disableAll(!0),t.edit.design(!1),t.toolbar.select("source")):(t.toolbar.disableAll(!1),t.edit.design(!0),t.toolbar.unselect("source"),_GECKO?setTimeout(function(){t.cmd.selection()},0):t.cmd.selection()),t.designMode=t.edit.designMode}),t.afterCreate(function(){t.designMode||t.toolbar.disableAll(!0).select("source")}),t.clickToolbar("fullscreen",function(){t.fullscreen()}),t.fullscreenShortcut){var i=!1;t.afterCreate(function(){if(e(t.edit.doc,t.edit.textarea).keyup(function(e){27==e.which&&setTimeout(function(){t.fullscreen()},0)}),i){if(_IE&&!t.designMode)return;t.focus()}i||(i=!0)})}_each("undo,redo".split(","),function(e,i){n[i]&&t.afterCreate(function(){_ctrl(this.edit.doc,n[i],function(){t.clickToolbar(i)})}),t.clickToolbar(i,function(){t[i]()})}),t.clickToolbar("formatblock",function(){var e=t.lang("formatblock.formatBlock"),n={h1:28,h2:24,h3:18,H4:14,p:12},i=t.cmd.val("formatblock"),a=t.createMenu({name:"formatblock",width:"en"==t.langType?200:150});_each(e,function(e,o){var r="font-size:"+n[e]+"px;";"h"===e.charAt(0)&&(r+="font-weight:bold;"),a.addItem({title:''+o+"",height:n[e]+12,checked:i===e||i===o,click:function(){t.select().exec("formatblock","<"+e+">").hideMenu()}})})}),t.clickToolbar("fontname",function(){var e=t.cmd.val("fontname"),n=t.createMenu({name:"fontname",width:150});_each(t.lang("fontname.fontName"),function(i,a){n.addItem({title:''+a+"",checked:e===i.toLowerCase()||e===a.toLowerCase(),click:function(){t.exec("fontname",i).hideMenu()}})})}),t.clickToolbar("fontsize",function(){var e=t.cmd.val("fontsize"),n=t.createMenu({name:"fontsize",width:150});_each(t.fontSizeTable,function(i,a){n.addItem({title:''+a+"",height:_removeUnit(a)+12,checked:e===a,click:function(){t.exec("fontsize",a).hideMenu()}})})}),_each("forecolor,hilitecolor".split(","),function(e,n){t.clickToolbar(n,function(){t.createMenu({name:n,selectedColor:t.cmd.val(n)||"default",colors:t.colorTable,click:function(e){t.exec(n,e).hideMenu()}})})}),_each("cut,copy,paste".split(","),function(e,n){t.clickToolbar(n,function(){t.focus();try{t.exec(n,null)}catch(e){alert(t.lang(n+"Error"))}})}),t.clickToolbar("about",function(){var e='
KindEditor '+_VERSION+'
Copyright © kindsoft.net All rights reserved.
';t.createDialog({name:"about",width:350,title:t.lang("about"),body:e})}),t.plugin.getSelectedLink=function(){return t.cmd.commonAncestor("a")},t.plugin.getSelectedImage=function(){return _getImageFromRange(t.edit.cmd.range,function(e){return!/^ke-\w+$/i.test(e[0].className)})},t.plugin.getSelectedFlash=function(){return _getImageFromRange(t.edit.cmd.range,function(e){return"ke-flash"==e[0].className})},t.plugin.getSelectedMedia=function(){return _getImageFromRange(t.edit.cmd.range,function(e){return"ke-media"==e[0].className||"ke-rm"==e[0].className})},t.plugin.getSelectedAnchor=function(){return _getImageFromRange(t.edit.cmd.range,function(e){return"ke-anchor"==e[0].className})},_each("link,image,flash,media,anchor".split(","),function(e,n){var i=n.charAt(0).toUpperCase()+n.substr(1);_each("edit,delete".split(","),function(e,a){t.addContextmenu({title:t.lang(a+i),click:function(){t.loadPlugin(n,function(){t.plugin[n][a](),t.hideMenu()})},cond:t.plugin["getSelected"+i],width:150,iconClass:"edit"==a?"ke-icon-"+n:undefined})}),t.addContextmenu({title:"-"})}),t.addContextmenu({title:"-"}),_each("selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript,hr,print,bold,italic,underline,strikethrough,removeformat,unlink".split(","),function(e,i){n[i]&&t.afterCreate(function(){ _ctrl(this.edit.doc,n[i],function(){t.cmd.selection(),t.clickToolbar(i)})}),t.clickToolbar(i,function(){t.focus().exec(i,null)})}),t.afterCreate(function(){function n(){i.range.moveToBookmark(a),i.select(),_WEBKIT&&(e("div."+l,o).each(function(){e(this).after("
").remove(!0)}),e("span.Apple-style-span",o).remove(!0),e("span.Apple-tab-span",o).remove(!0),e("span[style]",o).each(function(){"nowrap"==e(this).css("white-space")&&e(this).remove(!0)}),e("meta",o).remove());var n=o[0].innerHTML;o.remove(),""!==n&&(_WEBKIT&&(n=n.replace(/(
)\1/gi,"$1")),2===t.pasteType&&(n=n.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,""),/schemas-microsoft-com|worddocument|mso-\w+/i.test(n)?n=_clearMsWord(n,t.filterMode?t.htmlTags:e.options.htmlTags):(n=_formatHtml(n,t.filterMode?t.htmlTags:null),n=t.beforeSetHtml(n))),1===t.pasteType&&(n=n.replace(/ /gi," "),n=n.replace(/\n\s*\n/g,"\n"),n=n.replace(/]*>/gi,"\n"),n=n.replace(/<\/p>]*>/gi,"\n"),n=n.replace(/<[^>]+>/g,""),n=n.replace(/ {2}/g,"  "),"p"==t.newlineTag?/\n/.test(n)&&(n=n.replace(/^/,"

").replace(/$/,"

").replace(/\n/g,"

")):n=n.replace(/\n/g,"
$&")),t.insertHtml(n,!0))}var i,a,o,r=t.edit.doc,l="__kindeditor_paste__",s=!1;e(r.body).bind("paste",function(d){if(0===t.pasteType)return void d.stop();if(!s){if(s=!0,e("div."+l,r).remove(),i=t.cmd.selection(),a=i.range.createBookmark(),o=e('

',r).css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",left:"-1981px",top:e(a.start).pos().y+"px","white-space":"nowrap"}),e(r.body).append(o),_IE){var c=i.range.get(!0);c.moveToElementText(o[0]),c.select(),c.execCommand("paste"),d.preventDefault()}else i.range.selectNodeContents(o[0]),i.select(),o[0].tabIndex=-1,o[0].focus();setTimeout(function(){n(),s=!1},0)}})}),t.beforeGetHtml(function(e){return _IE&&_V<=8&&(e=e.replace(/]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(e,t){return unescape(t)}),e=e.replace(/(]*)?>)/gi,function(e,t,n){return/\s+type="[^"]+"/i.test(e)?e:t+' type="text"'+n})),e.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/gi,function(e,t,n,i){return t+_unescape(n).replace(/\s+/g," ")+i}).replace(/]*class="?ke-(flash|rm|media)"?[^>]*>/gi,function(e){var t=_getAttrList(e),n=_getCssList(t.style||""),i=_mediaAttrs(t["data-ke-tag"]),a=_undef(n.width,""),o=_undef(n.height,"");return/px/i.test(a)&&(a=_removeUnit(a)),/px/i.test(o)&&(o=_removeUnit(o)),i.width=_undef(t.width,a),i.height=_undef(t.height,o),_mediaEmbed(i)}).replace(/]*class="?ke-anchor"?[^>]*>/gi,function(e){var t=_getAttrList(e);return''}).replace(/]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(e,t,n){return""+unescape(n)+""}).replace(/]*data-ke-noscript-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(e,t,n){return""+unescape(n)+""}).replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/gi,function(e,t,n,i){return e=e.replace(/(\s+(?:href|src)=")[^"]*(")/i,function(e,t,i){return t+_unescape(n)+i}),e=e.replace(/\s+data-ke-src="[^"]*"/i,"")}).replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/gi,function(e,t,n){return t+n})}),t.beforeSetHtml(function(e){return _IE&&_V<=8&&(e=e.replace(/]*>|<(select|button)[^>]*>[\s\S]*?<\/\1>/gi,function(e){var t=_getAttrList(e),n=_getCssList(t.style||"");return"none"==n.display?'
':e})),e.replace(/]*type="([^"]+)"[^>]*>(?:<\/embed>)?/gi,function(e){var n=_getAttrList(e);return n.src=_undef(n.src,""),n.width=_undef(n.width,0),n.height=_undef(n.height,0),_mediaImg(t.themesPath+"common/blank.gif",n)}).replace(/]*name="([^"]+)"[^>]*>(?:<\/a>)?/gi,function(e){var n=_getAttrList(e);return n.href!==undefined?e:''}).replace(/]*)>([\s\S]*?)<\/script>/gi,function(e,t,n){return'
'+escape(n)+"
"}).replace(/]*)>([\s\S]*?)<\/noscript>/gi,function(e,t,n){return'
'+escape(n)+"
"}).replace(/(<[^>]*)(href|src)="([^"]*)"([^>]*>)/gi,function(e,t,n,i,a){return e.match(/\sdata-ke-src="[^"]*"/i)?e:e=t+n+'="'+i+'" data-ke-src="'+_escape(i)+'"'+a}).replace(/(<[^>]+\s)(on\w+="[^"]*"[^>]*>)/gi,function(e,t,n){return t+"data-ke-"+n}).replace(/]*\s+border="0"[^>]*>/gi,function(e){return e.indexOf("ke-zeroborder")>=0?e:_addClassToTag(e,"ke-zeroborder")})})})}}(window),KindEditor.lang({source:"HTML代码",preview:"预览",undo:"后退(Ctrl+Z)",redo:"前进(Ctrl+Y)",cut:"剪切(Ctrl+X)",copy:"复制(Ctrl+C)",paste:"粘贴(Ctrl+V)",plainpaste:"粘贴为无格式文本",wordpaste:"从Word粘贴",selectall:"全选(Ctrl+A)",justifyleft:"左对齐",justifycenter:"居中",justifyright:"右对齐",justifyfull:"两端对齐",insertorderedlist:"编号",insertunorderedlist:"项目符号",indent:"增加缩进",outdent:"减少缩进",subscript:"下标",superscript:"上标",formatblock:"段落",fontname:"字体",fontsize:"文字大小",forecolor:"文字颜色",hilitecolor:"文字背景",bold:"粗体(Ctrl+B)",italic:"斜体(Ctrl+I)",underline:"下划线(Ctrl+U)",strikethrough:"删除线",removeformat:"删除格式",image:"图片",multiimage:"批量图片上传",flash:"Flash",media:"视音频",table:"表格",tablecell:"单元格",hr:"插入横线",emoticons:"插入表情",link:"超级链接",unlink:"取消超级链接",fullscreen:"全屏显示",about:"关于",print:"打印(Ctrl+P)",filemanager:"文件空间",code:"插入程序代码",map:"Google地图",baidumap:"百度地图",lineheight:"行距",clearhtml:"清理HTML代码",pagebreak:"插入分页符",quickformat:"一键排版",insertfile:"插入文件",template:"插入模板",anchor:"锚点",yes:"确定",no:"取消",close:"关闭",editImage:"图片属性",deleteImage:"删除图片",editFlash:"Flash属性",deleteFlash:"删除Flash",editMedia:"视音频属性",deleteMedia:"删除视音频",editLink:"超级链接属性",deleteLink:"取消超级链接",editAnchor:"锚点属性",deleteAnchor:"删除锚点",tableprop:"表格属性",tablecellprop:"单元格属性",tableinsert:"插入表格",tabledelete:"删除表格",tablecolinsertleft:"左侧插入列",tablecolinsertright:"右侧插入列",tablerowinsertabove:"上方插入行",tablerowinsertbelow:"下方插入行",tablerowmerge:"向下合并单元格",tablecolmerge:"向右合并单元格",tablerowsplit:"拆分行",tablecolsplit:"拆分列",tablecoldelete:"删除列",tablerowdelete:"删除行",noColor:"无颜色",pleaseSelectFile:"请选择文件。",invalidImg:"请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。",invalidMedia:"请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。",invalidWidth:"宽度必须为数字。",invalidHeight:"高度必须为数字。",invalidBorder:"边框必须为数字。",invalidUrl:"请输入有效的URL地址。",invalidRows:"行数为必选项,只允许输入大于0的数字。",invalidCols:"列数为必选项,只允许输入大于0的数字。",invalidPadding:"边距必须为数字。",invalidSpacing:"间距必须为数字。",invalidJson:"服务器发生故障。",uploadSuccess:"上传成功。",cutError:"您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。",copyError:"您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。",pasteError:"您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。",ajaxLoading:"加载中,请稍候 ...",uploadLoading:"上传中,请稍候 ...",uploadError:"上传错误","plainpaste.comment":"请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。","wordpaste.comment":"请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。","code.pleaseInput":"请输入程序代码。","link.url":"URL","link.linkType":"打开类型","link.newWindow":"新窗口","link.selfWindow":"当前窗口","flash.url":"URL","flash.width":"宽度","flash.height":"高度","flash.upload":"上传","flash.viewServer":"文件空间","media.url":"URL","media.width":"宽度","media.height":"高度","media.autostart":"自动播放","media.upload":"上传","media.viewServer":"文件空间","image.remoteImage":"网络图片","image.localImage":"本地上传","image.remoteUrl":"图片地址","image.localUrl":"上传文件","image.size":"图片大小","image.width":"宽","image.height":"高","image.resetSize":"重置大小","image.align":"对齐方式","image.defaultAlign":"默认方式","image.leftAlign":"左对齐","image.rightAlign":"右对齐","image.imgTitle":"图片说明","image.upload":"浏览...","image.viewServer":"图片空间","multiimage.uploadDesc":"允许用户同时上传<%=uploadLimit%>张图片,单张图片容量不超过<%=sizeLimit%>","multiimage.startUpload":"开始上传","multiimage.clearAll":"全部清空","multiimage.insertAll":"全部插入","multiimage.queueLimitExceeded":"文件数量超过限制。","multiimage.fileExceedsSizeLimit":"文件大小超过限制。","multiimage.zeroByteFile":"无法上传空文件。","multiimage.invalidFiletype":"文件类型不正确。","multiimage.unknownError":"发生异常,无法上传。","multiimage.pending":"等待上传","multiimage.uploadError":"上传失败","filemanager.emptyFolder":"空文件夹","filemanager.moveup":"移到上一级文件夹","filemanager.viewType":"显示方式:","filemanager.viewImage":"缩略图","filemanager.listImage":"详细信息","filemanager.orderType":"排序方式:","filemanager.fileName":"名称","filemanager.fileSize":"大小","filemanager.fileType":"类型","insertfile.url":"URL","insertfile.title":"文件说明","insertfile.upload":"上传","insertfile.viewServer":"文件空间","table.cells":"单元格数","table.rows":"行数","table.cols":"列数","table.size":"大小","table.width":"宽度","table.height":"高度","table.percent":"%","table.px":"px","table.space":"边距间距","table.padding":"边距","table.spacing":"间距","table.align":"对齐方式","table.textAlign":"水平对齐","table.verticalAlign":"垂直对齐","table.alignDefault":"默认","table.alignLeft":"左对齐","table.alignCenter":"居中","table.alignRight":"右对齐","table.alignTop":"顶部","table.alignMiddle":"中部","table.alignBottom":"底部","table.alignBaseline":"基线","table.border":"边框","table.borderWidth":"边框","table.borderColor":"颜色","table.backgroundColor":"背景颜色","map.address":"地址: ","map.search":"搜索","baidumap.address":"地址: ","baidumap.search":"搜索","baidumap.insertDynamicMap":"插入动态地图","anchor.name":"锚点名称","formatblock.formatBlock":{h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",p:"正 文"},"fontname.fontName":{SimSun:"宋体",NSimSun:"新宋体",FangSong_GB2312:"仿宋_GB2312",KaiTi_GB2312:"楷体_GB2312",SimHei:"黑体","Source Han Sans":"思源黑体","Source Han Serif":"思源宋体","Microsoft YaHei":"微软雅黑",Arial:"Arial","Arial Black":"Arial Black","Times New Roman":"Times New Roman","Courier New":"Courier New",Tahoma:"Tahoma",Verdana:"Verdana"},"lineheight.lineHeight":[{1:"单倍行距"},{1.5:"1.5倍行距"},{2:"2倍行距"},{2.5:"2.5倍行距"},{3:"3倍行距"}],"template.selectTemplate":"可选模板","template.replaceContent":"替换当前内容","template.fileList":{"1.html":"图片和文字","2.html":"表格","3.html":"项目编号"}},"zh_CN"),KindEditor.plugin("anchor",function(e){var t=this,n="anchor",i=t.lang(n+".");t.plugin.anchor={edit:function(){var a=['
','
','",'',"
","
"].join(""),o=t.createDialog({name:n,width:300,title:t.lang(n),body:a,yesBtn:{name:t.lang("yes"),click:function(e){t.insertHtml('').hideDialog().focus()}}}),r=o.div,l=e('input[name="name"]',r),s=t.plugin.getSelectedAnchor();s&&l.val(unescape(s.attr("data-ke-name"))),l[0].focus(),l[0].select()},"delete":function(){t.plugin.getSelectedAnchor().remove()}},t.clickToolbar(n,t.plugin.anchor.edit)}),KindEditor.plugin("autoheight",function(e){function t(){i.iframe.height(o),n.resize(null,Math.max((e.IE?a.scrollHeight:a.offsetHeight)+76,o))}var n=this;if(n.autoHeightMode){var i=n.edit,a=i.doc.body,o=e.removeUnit(n.height);i.iframe[0].scroll="no",a.style.overflowY="hidden",i.afterChange(t),n.isCreated?t():n.afterCreate(t)}}),KindEditor.plugin("baidumap",function(e){var t=this,n="baidumap",i=t.lang(n+"."),a=e.undef(t.mapWidth,558),o=e.undef(t.mapHeight,360);t.clickToolbar(n,function(){function r(){l=m[0].contentWindow,s=e.iframeDoc(m)}var l,s,d=['
','
','
',i.address+' ','','',"","
",'
',' ","
",'
',"
",'
',"
"].join(""),c=t.createDialog({name:n,width:a+42,title:t.lang(n),body:d,yesBtn:{name:t.lang("yes"),click:function(e){var n=l.map,i=n.getCenter(),r=i.lng+","+i.lat,s=n.getZoom(),d=[f[0].checked?t.pluginsPath+"baidumap/index.html":"http://api.map.baidu.com/staticimage","?center="+encodeURIComponent(r),"&zoom="+encodeURIComponent(s),"&width="+a,"&height="+o,"&markers="+encodeURIComponent(r),"&markerStyles="+encodeURIComponent("l,A")].join("");f[0].checked?t.insertHtml(''):t.exec("insertimage",d),t.hideDialog().focus()}},beforeRemove:function(){h.remove(),s&&s.write(""),m.remove()}}),u=c.div,p=e('[name="address"]',u),h=e('[name="searchBtn"]',u),f=e('[name="insertDynamicMap"]',c.div),m=e('');m.bind("load",function(){m.unbind("load"),e.IE?r():setTimeout(r,0)}),e(".ke-map",u).replaceWith(m),h.click(function(){l.search(p.val())})})}),KindEditor.plugin("clearhtml",function(e){var t=this,n="clearhtml";t.clickToolbar(n,function(){t.focus();var n=t.html();n=n.replace(/(]*>)([\s\S]*?)(<\/script>)/gi,""),n=n.replace(/(]*>)([\s\S]*?)(<\/style>)/gi,""),n=e.formatHtml(n,{a:["href","target"],embed:["src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess"],img:["src","width","height","border","alt","title",".width",".height"],table:["border"],"td,th":["rowspan","colspan"],"div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":[]}),t.html(n),t.cmd.selection(!0),t.addBookmark()})}),KindEditor.plugin("code",function(e){var t=this,n="code";t.clickToolbar(n,function(){var i=t.lang(n+"."),a=['
','
','","
",'',"
"].join(""),o=t.createDialog({name:n,width:450,title:t.lang(n),body:a,yesBtn:{name:t.lang("yes"),click:function(n){var a=e(".ke-code-type",o.div).val(),l=r.val(),s=""===a?"":" lang-"+a,d='
\n'+e.escape(l)+"
";return""===e.trim(l)?(alert(i.pleaseInput),void r[0].focus()):void t.insertHtml(d).hideDialog().focus()}}}),r=e("textarea",o.div);r[0].focus()})}),KindEditor.plugin("emoticons",function(e){var t=this,n="emoticons",i=t.emoticonsPath||t.pluginsPath+"emoticons/images/",a=void 0===t.allowPreviewEmoticons||t.allowPreviewEmoticons,o=1;t.clickToolbar(n,function(){function r(n,a,o){k?n.mouseover(function(){a>v?(k.css("left",0),k.css("right","")):(k.css("left",""),k.css("right",0)),w.attr("src",i+o+".gif"),e(this).addClass("ke-on")}):n.mouseover(function(){e(this).addClass("ke-on")}),n.mouseout(function(){e(this).removeClass("ke-on")}),n.click(function(e){t.insertHtml('').hideMenu().focus(),e.stop()})}function l(t,n){var a=document.createElement("table");n.append(a),k&&(e(a).mouseover(function(){k.show("block")}),e(a).mouseout(function(){k.hide()}),b.push(e(a))),a.className="ke-table",a.cellPadding=0,a.cellSpacing=0,a.border=0;for(var o=(t-1)*m+f,l=0;l').css("background-position","-"+24*o+"px 0px").css("background-image","url("+i+"static.gif)");c.append(h),b.push(c),o++}return a}function s(){e.each(b,function(){this.unbind()})}function d(e,t){e.click(function(e){s(),S.parentNode.removeChild(S),C.remove(),S=l(t,_),c(t),o=t,e.stop()})}function c(t){C=e('
'),_.append(C);for(var n=1;n<=g;n++){if(t!==n){var i=e('
['+n+"]");d(i,n),C.append(i),b.push(i)}else C.append(e("@["+n+"]"));C.append(e("@ "))}}var u=5,p=9,h=135,f=0,m=u*p,g=Math.ceil(h/m),v=Math.floor(p/2),_=e('
'),b=[],y=t.createMenu({name:n,beforeRemove:function(){s()}});y.div.append(_);var k,w;a&&(k=e('
').css("right",0),w=e(''),_.append(k),k.append(w));var C,S=l(o,_);c(o)})}),KindEditor.plugin("filemanager",function(e){function t(e,t,n){return e+" ("+Math.ceil(t/1024)+"KB, "+n+")"}function n(e,n){n.is_dir?e.attr("title",n.filename):e.attr("title",t(n.filename,n.filesize,n.datetime))}var i=this,a="filemanager",o=e.undef(i.fileManagerJson,i.basePath+"php/file_manager_json.php"),r=i.pluginsPath+a+"/images/",l=i.lang(a+".");i.plugin.filemanagerDialog=function(t){function s(t,n,a){var r="path="+t+"&order="+n+"&dir="+m;b.showLoading(i.lang("ajaxLoading")),e.ajax(e.addParam(o,r+"&"+(new Date).getTime()),function(e){b.hideLoading(),a(e)})}function d(t,n,i,a){var o=e.formatUrl(n.current_url+i.filename,"absolute"),r=encodeURIComponent(n.current_dir_path+i.filename+"/");i.is_dir?t.click(function(e){s(r,S.val(),a)}):i.is_photo?t.click(function(e){v.call(this,o,i.filename)}):t.click(function(e){v.call(this,o,i.filename)}),x.push(t)}function c(t,n){function i(){"VIEW"==C.val()?s(t.current_dir_path,S.val(),p):s(t.current_dir_path,S.val(),u)}e.each(x,function(){this.unbind()}),w.unbind(),C.unbind(),S.unbind(),t.current_dir_path&&w.click(function(e){s(t.moveup_dir_path,S.val(),n)}),C.change(i),S.change(i),k.html("")}function u(t){c(t,u);var n=document.createElement("table");n.className="ke-table",n.cellPadding=0,n.cellSpacing=0,n.border=0,k.append(n);for(var i=t.file_list,a=0,o=i.length;a'),m=e(p[0].insertCell(0)).addClass("ke-cell ke-name").append(f).append(document.createTextNode(" "+s.filename));!s.is_dir||s.has_file?(p.css("cursor","pointer"),m.attr("title",s.filename),d(m,t,s,u)):m.attr("title",l.emptyFolder),e(p[0].insertCell(1)).addClass("ke-cell ke-size").html(s.is_dir?"-":Math.ceil(s.filesize/1024)+"KB"),e(p[0].insertCell(2)).addClass("ke-cell ke-datetime").html(s.datetime)}}function p(t){c(t,p);for(var i=t.file_list,a=0,o=i.length;a');k.append(u);var h=e('
').mouseover(function(t){e(this).addClass("ke-on")}).mouseout(function(t){e(this).removeClass("ke-on")});u.append(h);var f=t.current_url+s.filename,m=s.is_dir?r+"folder-64.gif":s.is_photo?f:r+"file-64.gif",g=e(''+s.filename+'');!s.is_dir||s.has_file?(h.css("cursor","pointer"),n(h,s),d(h,t,s,p)):h.attr("title",l.emptyFolder),h.append(g),u.append('
'+s.filename+"
")}}var h=e.undef(t.width,650),f=e.undef(t.height,510),m=e.undef(t.dirName,""),g=e.undef(t.viewType,"VIEW").toUpperCase(),v=t.clickFn,_=['
','
','
',' ',''+l.moveup+"","
",'
',l.viewType+' ",l.orderType+' ","
",'
',"
",'
',"
"].join(""),b=i.createDialog({name:a,width:h,height:f,title:i.lang(a),body:_}),y=b.div,k=e(".ke-plugin-filemanager-body",y),w=(e('[name="moveupImg"]',y),e('[name="moveupLink"]',y)),C=(e('[name="viewServer"]',y),e('[name="viewType"]',y)),S=e('[name="orderType"]',y),x=[];return C.val(g),s("",S.val(),"VIEW"==g?p:u),b}}),KindEditor.plugin("flash",function(e){var t=this,n="flash",i=t.lang(n+"."),a=e.undef(t.allowFlashUpload,!0),o=e.undef(t.allowFileManager,!1),r=e.undef(t.formatUploadUrl,!0),l=e.undef(t.extraFileUploadParams,{}),s=e.undef(t.filePostName,"imgFile"),d=e.undef(t.uploadJson,t.basePath+"php/upload_json.php");t.plugin.flash={edit:function(){var c=['
','
','",'  ','  ','','',"","
",'
','",' ',"
",'
','",' ',"
","
"].join(""),u=t.createDialog({name:n,width:450,title:t.lang(n),body:c,yesBtn:{name:t.lang("yes"),click:function(n){var i=e.trim(h.val()),a=m.val(),o=g.val();if("http://"==i||e.invalidUrl(i))return alert(t.lang("invalidUrl")),void h[0].focus();if(!/^\d*$/.test(a))return alert(t.lang("invalidWidth")),void m[0].focus();if(!/^\d*$/.test(o))return alert(t.lang("invalidHeight")),void g[0].focus();var r=e.mediaImg(t.themesPath+"common/blank.gif",{src:i,type:e.mediaType(".swf"),width:a,height:o,quality:"high"});t.insertHtml(r).hideDialog().focus()}}}),p=u.div,h=e('[name="url"]',p),f=e('[name="viewServer"]',p),m=e('[name="width"]',p),g=e('[name="height"]',p);if(h.val("http://"),a){var v=e.uploadbutton({button:e(".ke-upload-button",p)[0],fieldName:s,extraParams:l,url:e.addParam(d,"dir=flash"),afterUpload:function(i){if(u.hideLoading(),0===i.error){var a=i.url;r&&(a=e.formatUrl(a,"absolute")),h.val(a),t.afterUpload&&t.afterUpload.call(t,a,i,n),alert(t.lang("uploadSuccess"))}else alert(i.message)},afterError:function(e){u.hideLoading(),t.errorDialog(e)}});v.fileBox.change(function(e){u.showLoading(t.lang("uploadLoading")),v.submit()})}else e(".ke-upload-button",p).hide();o?f.click(function(n){t.loadPlugin("filemanager",function(){t.plugin.filemanagerDialog({viewType:"LIST",dirName:"flash",clickFn:function(n,i){t.dialogs.length>1&&(e('[name="url"]',p).val(n),t.afterSelectFile&&t.afterSelectFile.call(t,n),t.hideDialog())}})})}):f.hide();var _=t.plugin.getSelectedFlash();if(_){var b=e.mediaAttrs(_.attr("data-ke-tag"));h.val(b.src),m.val(e.removeUnit(_.css("width"))||b.width||0),g.val(e.removeUnit(_.css("height"))||b.height||0)}h[0].focus(),h[0].select()},"delete":function(){t.plugin.getSelectedFlash().remove(),t.addBookmark()}},t.clickToolbar(n,t.plugin.flash.edit)}),KindEditor.plugin("image",function(e){var t=this,n="image",i=e.undef(t.allowImageUpload,!0),a=e.undef(t.allowImageRemote,!0),o=e.undef(t.formatUploadUrl,!0),r=e.undef(t.allowFileManager,!1),l=e.undef(t.uploadJson,t.basePath+"php/upload_json.php"),s=e.undef(t.imageTabIndex,0),d=t.pluginsPath+"image/images/",c=e.undef(t.extraFileUploadParams,{}),u=e.undef(t.filePostName,"imgFile"),p=e.undef(t.fillDescAfterUploadImage,!1),h=t.lang(n+".");t.plugin.imageDialog=function(i){function a(e,t){K.val(e),U.val(t),R=e,M=t}var s=(i.imageUrl,e.undef(i.imageWidth,""),e.undef(i.imageHeight,""),e.undef(i.imageTitle,""),e.undef(i.imageAlign,""),e.undef(i.showRemote,!0)),f=e.undef(i.showLocal,!0),m=e.undef(i.tabIndex,0),g=i.clickFn,v="kindeditor_upload_iframe_"+(new Date).getTime(),_=[];for(var b in c)_.push('');var y,k=['
','
','",'","
"].join(""),w=f||r?450:400,C=f&&s?300:250,S=t.createDialog({name:n,width:w,height:C,title:t.lang(n),body:k,yesBtn:{name:t.lang("yes"),click:function(n){if(!S.isLoading){if(f&&s&&y&&1===y.selectedIndex||!s)return""==D.fileBox.val()?void alert(t.lang("pleaseSelectFile")):(S.showLoading(t.lang("uploadLoading")),D.submit(),void T.val(""));var i=e.trim(E.val()),a=K.val(),o=U.val(),r=N.val(),l="";return I.each(function(){if(this.checked)return l=this.value,!1}),"http://"==i||e.invalidUrl(i)?(alert(t.lang("invalidUrl")),void E[0].focus()):/^\d*$/.test(a)?/^\d*$/.test(o)?void g.call(t,i,r,a,o,0,l):(alert(t.lang("invalidHeight")),void U[0].focus()):(alert(t.lang("invalidWidth")),void K[0].focus())}}},beforeRemove:function(){A.unbind(),K.unbind(),U.unbind(),F.unbind()}}),x=S.div,E=e('[name="url"]',x),T=e('[name="localUrl"]',x),A=e('[name="viewServer"]',x),K=e('.tab1 [name="width"]',x),U=e('.tab1 [name="height"]',x),F=e(".ke-refresh-btn",x),N=e('.tab1 [name="title"]',x),I=e('.tab1 [name="align"]',x);s&&f?(y=e.tabs({src:e(".tabs",x),afterSelect:function(e){}}),y.add({title:h.remoteImage,panel:e(".tab1",x)}),y.add({title:h.localImage,panel:e(".tab2",x)}),y.select(m)):s?e(".tab1",x).show():f&&e(".tab2",x).show();var D=e.uploadbutton({button:e(".ke-upload-button",x)[0],fieldName:u,form:e(".ke-form",x),target:v,width:70,afterUpload:function(i){if(S.hideLoading(),0===i.error){var a=i.url;o&&(a=e.formatUrl(a,"absolute")),t.afterUpload&&t.afterUpload.call(t,a,i,n),p?(e(".ke-dialog-row #remoteUrl",x).val(a),e(".ke-tabs-li",x)[0].click(),e(".ke-refresh-btn",x).click()):g.call(t,a,i.title,i.width,i.height,i.border,i.align)}else alert(i.message)},afterError:function(e){S.hideLoading(),t.errorDialog(e)}});D.fileBox.change(function(e){T.val(D.fileBox.val())}),r?A.click(function(n){t.loadPlugin("filemanager",function(){t.plugin.filemanagerDialog({viewType:"VIEW",dirName:"image",clickFn:function(n,i){t.dialogs.length>1&&(e('[name="url"]',x).val(n),t.afterSelectFile&&t.afterSelectFile.call(t,n),t.hideDialog())}})})}):A.hide();var R=0,M=0;return F.click(function(t){var n=e('',document).css({position:"absolute",visibility:"hidden",top:0,left:"-1000px"});n.bind("load",function(){a(n.width(),n.height()),n.remove()}),e(document.body).append(n)}),K.change(function(e){R>0&&U.val(Math.round(M/R*parseInt(this.value,10)))}),U.change(function(e){M>0&&K.val(Math.round(R/M*parseInt(this.value,10)))}),E.val(i.imageUrl),a(i.imageWidth,i.imageHeight),N.val(i.imageTitle),I.each(function(){if(this.value===i.imageAlign)return this.checked=!0,!1}),s&&0===m&&(E[0].focus(),E[0].select()),S},t.plugin.image={edit:function(){var e=t.plugin.getSelectedImage();t.plugin.imageDialog({imageUrl:e?e.attr("data-ke-src"):"http://",imageWidth:e?e.width():"",imageHeight:e?e.height():"",imageTitle:e?e.attr("title"):"",imageAlign:e?e.attr("align"):"",showRemote:a,showLocal:i,tabIndex:e?0:s,clickFn:function(n,i,a,o,r,l){e?(e.attr("src",n),e.attr("data-ke-src",n),e.attr("width",a),e.attr("height",o),e.attr("title",i),e.attr("align",l),e.attr("alt",i)):t.exec("insertimage",n,i,a,o,r,l),setTimeout(function(){t.hideDialog().focus()},0)}})},"delete":function(){var e=t.plugin.getSelectedImage();"a"==e.parent().name&&(e=e.parent()),e.remove(),t.addBookmark()}},t.clickToolbar(n,t.plugin.image.edit)}),KindEditor.plugin("insertfile",function(e){var t=this,n="insertfile",i=e.undef(t.allowFileUpload,!0),a=e.undef(t.allowFileManager,!1),o=e.undef(t.formatUploadUrl,!0),r=e.undef(t.uploadJson,t.basePath+"php/upload_json.php"),l=e.undef(t.extraFileUploadParams,{}),s=e.undef(t.filePostName,"imgFile"),d=t.lang(n+".");t.plugin.fileDialog=function(c){var u=e.undef(c.fileUrl,"http://"),p=e.undef(c.fileTitle,""),h=c.clickFn,f=['
','
','",'  ','  ','','',"","
",'
','",'
',"
","",""].join(""),m=t.createDialog({name:n,width:450,title:t.lang(n),body:f,yesBtn:{name:t.lang("yes"),click:function(n){var i=e.trim(v.val()),a=b.val();return"http://"==i||e.invalidUrl(i)?(alert(t.lang("invalidUrl")),void v[0].focus()):(""===e.trim(a)&&(a=i),void h.call(t,i,a))}}}),g=m.div,v=e('[name="url"]',g),_=e('[name="viewServer"]',g),b=e('[name="title"]',g);if(i){var y=e.uploadbutton({button:e(".ke-upload-button",g)[0],fieldName:s,url:e.addParam(r,"dir=file"),extraParams:l,afterUpload:function(i){if(m.hideLoading(),0===i.error){var a=i.url;o&&(a=e.formatUrl(a,"absolute")),v.val(a),t.afterUpload&&t.afterUpload.call(t,a,i,n),alert(t.lang("uploadSuccess"))}else alert(i.message)},afterError:function(e){m.hideLoading(),t.errorDialog(e)}});y.fileBox.change(function(e){m.showLoading(t.lang("uploadLoading")),y.submit()})}else e(".ke-upload-button",g).hide(); a?_.click(function(n){t.loadPlugin("filemanager",function(){t.plugin.filemanagerDialog({viewType:"LIST",dirName:"file",clickFn:function(n,i){t.dialogs.length>1&&(e('[name="url"]',g).val(n),t.afterSelectFile&&t.afterSelectFile.call(t,n),t.hideDialog())}})})}):_.hide(),v.val(u),b.val(p),v[0].focus(),v[0].select()},t.clickToolbar(n,function(){t.plugin.fileDialog({clickFn:function(e,n){var i=''+n+"";t.insertHtml(i).hideDialog().focus()}})})}),KindEditor.plugin("lineheight",function(e){var t=this,n="lineheight",i=t.lang(n+".");t.clickToolbar(n,function(){var a="",o=t.cmd.commonNode({"*":".line-height"});o&&(a=o.css("line-height"));var r=t.createMenu({name:n,width:150});e.each(i.lineHeight,function(n,i){e.each(i,function(e,n){r.addItem({title:n,checked:a===e,click:function(){t.cmd.toggle('',{span:".line-height="+e}),t.updateState(),t.addBookmark(),t.hideMenu()}})})})})}),KindEditor.plugin("link",function(e){var t=this,n="link";t.plugin.link={edit:function(){var i=t.lang(n+"."),a='
',o=t.createDialog({name:n,width:450,title:t.lang(n),body:a,yesBtn:{name:t.lang("yes"),click:function(n){var i=e.trim(l.val());return"http://"==i||e.invalidUrl(i)?(alert(t.lang("invalidUrl")),void l[0].focus()):void t.exec("createlink",i,s.val()).hideDialog().focus()}}}),r=o.div,l=e('input[name="url"]',r),s=e('select[name="type"]',r);l.val("http://"),s[0].options[0]=new Option(i.newWindow,"_blank"),s[0].options[1]=new Option(i.selfWindow,""),t.cmd.selection();var d=t.plugin.getSelectedLink();d&&(t.cmd.range.selectNode(d[0]),t.cmd.select(),l.val(d.attr("data-ke-src")),s.val(d.attr("target"))),l[0].focus(),l[0].select()},"delete":function(){t.exec("unlink",null)}},t.clickToolbar(n,t.plugin.link.edit)}),KindEditor.plugin("map",function(e){var t=this,n="map",i=t.lang(n+".");t.clickToolbar(n,function(){function a(){o=p[0].contentWindow,r=e.iframeDoc(p)}var o,r,l=['
','
',i.address+' ','','',"","
",'
',"
"].join(""),s=t.createDialog({name:n,width:600,title:t.lang(n),body:l,yesBtn:{name:t.lang("yes"),click:function(e){var n=(o.geocoder,o.map),i=n.getCenter().lat()+","+n.getCenter().lng(),a=n.getZoom(),r=n.getMapTypeId(),l="http://maps.googleapis.com/maps/api/staticmap";l+="?center="+encodeURIComponent(i),l+="&zoom="+encodeURIComponent(a),l+="&size=558x360",l+="&maptype="+encodeURIComponent(r),l+="&markers="+encodeURIComponent(i),l+="&language="+t.langType,l+="&sensor=false",t.exec("insertimage",l).hideDialog().focus()}},beforeRemove:function(){u.remove(),r&&r.write(""),p.remove()}}),d=s.div,c=e('[name="address"]',d),u=e('[name="searchBtn"]',d),p=(["",'',"",'',"","",'','
',""].join("\n"),e(''));p.bind("load",function(){p.unbind("load"),e.IE?a():setTimeout(a,0)}),e(".ke-map",d).replaceWith(p),u.click(function(){o.search(c.val())})})}),KindEditor.plugin("media",function(e){var t=this,n="media",i=t.lang(n+"."),a=e.undef(t.allowMediaUpload,!0),o=e.undef(t.allowFileManager,!1),r=e.undef(t.formatUploadUrl,!0),l=e.undef(t.extraFileUploadParams,{}),s=e.undef(t.filePostName,"imgFile"),d=e.undef(t.uploadJson,t.basePath+"php/upload_json.php");t.plugin.media={edit:function(){var c=['
','
','",'  ','  ','','',"","
",'
','",'',"
",'
','",'',"
",'
','",' ',"
","
"].join(""),u=t.createDialog({name:n,width:450,height:230,title:t.lang(n),body:c,yesBtn:{name:t.lang("yes"),click:function(n){var i=e.trim(h.val()),a=m.val(),o=g.val();if("http://"==i||e.invalidUrl(i))return alert(t.lang("invalidUrl")),void h[0].focus();if(!/^\d*$/.test(a))return alert(t.lang("invalidWidth")),void m[0].focus();if(!/^\d*$/.test(o))return alert(t.lang("invalidHeight")),void g[0].focus();var r=e.mediaImg(t.themesPath+"common/blank.gif",{src:i,type:e.mediaType(i),width:a,height:o,autostart:v[0].checked?"true":"false",loop:"true"});t.insertHtml(r).hideDialog().focus()}}}),p=u.div,h=e('[name="url"]',p),f=e('[name="viewServer"]',p),m=e('[name="width"]',p),g=e('[name="height"]',p),v=e('[name="autostart"]',p);if(h.val("http://"),a){var _=e.uploadbutton({button:e(".ke-upload-button",p)[0],fieldName:s,extraParams:l,url:e.addParam(d,"dir=media"),afterUpload:function(i){if(u.hideLoading(),0===i.error){var a=i.url;r&&(a=e.formatUrl(a,"absolute")),h.val(a),t.afterUpload&&t.afterUpload.call(t,a,i,n),alert(t.lang("uploadSuccess"))}else alert(i.message)},afterError:function(e){u.hideLoading(),t.errorDialog(e)}});_.fileBox.change(function(e){u.showLoading(t.lang("uploadLoading")),_.submit()})}else e(".ke-upload-button",p).hide();o?f.click(function(n){t.loadPlugin("filemanager",function(){t.plugin.filemanagerDialog({viewType:"LIST",dirName:"media",clickFn:function(n,i){t.dialogs.length>1&&(e('[name="url"]',p).val(n),t.afterSelectFile&&t.afterSelectFile.call(t,n),t.hideDialog())}})})}):f.hide();var b=t.plugin.getSelectedMedia();if(b){var y=e.mediaAttrs(b.attr("data-ke-tag"));h.val(y.src),m.val(e.removeUnit(b.css("width"))||y.width||0),g.val(e.removeUnit(b.css("height"))||y.height||0),v[0].checked="true"===y.autostart}h[0].focus(),h[0].select()},"delete":function(){t.plugin.getSelectedMedia().remove(),t.addBookmark()}},t.clickToolbar(n,t.plugin.media.edit)}),function(e){function t(e){this.init(e)}e.extend(t,{init:function(t){function n(t,n){e(".ke-status > div",t).hide(),e(".ke-message",t).addClass("ke-error").show().html(e.escape(n))}var i=this;t.afterError=t.afterError||function(e){alert(e)},i.options=t,i.progressbars={},i.div=e(t.container).html(['
','
','
','',"
",'
'+t.uploadDesc+"
",'','',"","
",'
',"
"].join("")),i.bodyDiv=e(".ke-swfupload-body",i.div);var a={debug:!1,upload_url:t.uploadUrl,flash_url:t.flashUrl,file_post_name:t.filePostName,button_placeholder:e(".ke-swfupload-button > input",i.div)[0],button_image_url:t.buttonImageUrl,button_width:t.buttonWidth,button_height:t.buttonHeight,button_cursor:SWFUpload.CURSOR.HAND,file_types:t.fileTypes,file_types_description:t.fileTypesDesc,file_upload_limit:t.fileUploadLimit,file_size_limit:t.fileSizeLimit,post_params:t.postParams,file_queued_handler:function(e){e.url=i.options.fileIconUrl,i.appendFile(e)},file_queue_error_handler:function(n,i,a){var o="";switch(i){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:o=t.queueLimitExceeded;break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:o=t.fileExceedsSizeLimit;break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:o=t.zeroByteFile;break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:o=t.invalidFiletype;break;default:o=t.unknownError}e.DEBUG&&alert(o)},upload_start_handler:function(t){var n=this,i=e('div[data-id="'+t.id+'"]',n.bodyDiv);e(".ke-status > div",i).hide(),e(".ke-progressbar",i).show()},upload_progress_handler:function(e,t,n){var a=Math.round(100*t/n),o=i.progressbars[e.id];o.bar.css("width",Math.round(80*a/100)+"px"),o.percent.html(a+"%")},upload_error_handler:function(t,a,o){if(t&&t.filestatus==SWFUpload.FILE_STATUS.ERROR){var r=e('div[data-id="'+t.id+'"]',i.bodyDiv).eq(0);n(r,i.options.errorMessage)}},upload_success_handler:function(t,a){var o=e('div[data-id="'+t.id+'"]',i.bodyDiv).eq(0),r={};try{r=e.json(a)}catch(l){i.options.afterError.call(this,""+a+"")}return 0!==r.error?void n(o,e.DEBUG?r.message:i.options.errorMessage):(t.url=r.url,e(".ke-img",o).attr("src",t.url).attr("data-status",t.filestatus).data("data",r),void e(".ke-status > div",o).hide())}};i.swfu=new SWFUpload(a),e(".ke-swfupload-startupload input",i.div).click(function(){i.swfu.startUpload()})},getUrlList:function(){var t=[];return e(".ke-img",self.bodyDiv).each(function(){var n=e(this),i=n.attr("data-status");i==SWFUpload.FILE_STATUS.COMPLETE&&t.push(n.data("data"))}),t},removeFile:function(t){var n=this;n.swfu.cancelUpload(t);var i=e('div[data-id="'+t+'"]',n.bodyDiv);e(".ke-photo",i).unbind(),e(".ke-delete",i).unbind(),i.remove()},removeFiles:function(){var t=this;e(".ke-item",t.bodyDiv).each(function(){t.removeFile(e(this).attr("data-id"))})},appendFile:function(t){var n=this,i=e('
');n.bodyDiv.append(i);var a=e('
').mouseover(function(t){e(this).addClass("ke-on")}).mouseout(function(t){e(this).removeClass("ke-on")});i.append(a);var o=e(''+t.name+'');a.append(o),e('').appendTo(a).click(function(){n.removeFile(t.id)});var r=e('
').appendTo(a);e(['
','
','
0%
'].join("")).hide().appendTo(r),e('
'+n.options.pendingMessage+"
").appendTo(r),i.append('
'+t.name+"
"),n.progressbars[t.id]={bar:e(".ke-progressbar-bar-inner",a),percent:e(".ke-progressbar-percent",a)}},remove:function(){this.removeFiles(),this.swfu.destroy(),this.div.html("")}}),e.swfupload=function(e,n){return new t(e,n)}}(KindEditor),KindEditor.plugin("multiimage",function(e){var t=this,n="multiimage",i=(e.undef(t.formatUploadUrl,!0),e.undef(t.uploadJson,t.basePath+"php/upload_json.php")),a=t.pluginsPath+"multiimage/images/",o=e.undef(t.imageSizeLimit,"1MB"),r=(e.undef(t.imageFileTypes,"*.jpg;*.gif;*.png"),e.undef(t.imageUploadLimit,20)),l=e.undef(t.filePostName,"imgFile"),s=t.lang(n+".");t.plugin.multiImageDialog=function(d){var c=d.clickFn,u=e.tmpl(s.uploadDesc,{uploadLimit:r,sizeLimit:o}),p=['
','
',"
","
"].join(""),h=t.createDialog({name:n,width:650,height:510,title:t.lang(n),body:p,previewBtn:{name:s.insertAll,click:function(e){c.call(t,m.getUrlList())}},yesBtn:{name:s.clearAll,click:function(e){m.removeFiles()}},beforeRemove:function(){(!e.IE||e.V<=8)&&m.remove()}}),f=h.div,m=e.swfupload({container:e(".swfupload",f),buttonImageUrl:a+("zh-CN"==t.langType?"select-files-zh-CN.png":"select-files-en.png"),buttonWidth:"zh-CN"==t.langType?72:88,buttonHeight:23,fileIconUrl:a+"image.png",uploadDesc:u,startButtonValue:s.startUpload,uploadUrl:e.addParam(i,"dir=image"),flashUrl:a+"swfupload.swf",filePostName:l,fileTypes:"*.jpg;*.jpeg;*.gif;*.png;*.bmp",fileTypesDesc:"Image Files",fileUploadLimit:r,fileSizeLimit:o,postParams:e.undef(t.extraFileUploadParams,{}),queueLimitExceeded:s.queueLimitExceeded,fileExceedsSizeLimit:s.fileExceedsSizeLimit,zeroByteFile:s.zeroByteFile,invalidFiletype:s.invalidFiletype,unknownError:s.unknownError,pendingMessage:s.pending,errorMessage:s.uploadError,afterError:function(e){t.errorDialog(e)}});return h},t.clickToolbar(n,function(){t.plugin.multiImageDialog({clickFn:function(n){0!==n.length&&(e.each(n,function(e,n){t.afterUpload&&t.afterUpload.call(t,n.url,n,"multiimage"),t.exec("insertimage",n.url,n.title,n.width,n.height,n.border,n.align)}),setTimeout(function(){t.hideDialog().focus()},0))}})})}),function(){window.SWFUpload=function(e){this.initSWFUpload(e)},SWFUpload.prototype.initSWFUpload=function(e){try{this.customSettings={},this.settings=e,this.eventQueue=[],this.movieName="KindEditor_SWFUpload_"+SWFUpload.movieCount++,this.movieElement=null,SWFUpload.instances[this.movieName]=this,this.initSettings(),this.loadFlash(),this.displayDebugInfo()}catch(t){throw delete SWFUpload.instances[this.movieName],t}},SWFUpload.instances={},SWFUpload.movieCount=0,SWFUpload.version="2.2.0 2009-03-25",SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130},SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290},SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5},SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120},SWFUpload.CURSOR={ARROW:-1,HAND:-2},SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"},SWFUpload.completeURL=function(e){if("string"!=typeof e||e.match(/^https?:\/\//i)||e.match(/^\//))return e;var t=(window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),window.location.pathname.lastIndexOf("/"));return t<=0?path="/":path=window.location.pathname.substr(0,t)+"/",path+e},SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(e,t){this.settings[e]=void 0==this.settings[e]?t:this.settings[e]},this.ensureDefault("upload_url",""),this.ensureDefault("preserve_relative_urls",!1),this.ensureDefault("file_post_name","Filedata"),this.ensureDefault("post_params",{}),this.ensureDefault("use_query_string",!1),this.ensureDefault("requeue_on_error",!1),this.ensureDefault("http_success",[]),this.ensureDefault("assume_success_timeout",0),this.ensureDefault("file_types","*.*"),this.ensureDefault("file_types_description","All Files"),this.ensureDefault("file_size_limit",0),this.ensureDefault("file_upload_limit",0),this.ensureDefault("file_queue_limit",0),this.ensureDefault("flash_url","swfupload.swf"),this.ensureDefault("prevent_swf_caching",!0),this.ensureDefault("button_image_url",""),this.ensureDefault("button_width",1),this.ensureDefault("button_height",1),this.ensureDefault("button_text",""),this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;"),this.ensureDefault("button_text_top_padding",0),this.ensureDefault("button_text_left_padding",0),this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES),this.ensureDefault("button_disabled",!1),this.ensureDefault("button_placeholder_id",""),this.ensureDefault("button_placeholder",null),this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW),this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW),this.ensureDefault("debug",!1),this.settings.debug_enabled=this.settings.debug,this.settings.return_upload_start_handler=this.returnUploadStart,this.ensureDefault("swfupload_loaded_handler",null),this.ensureDefault("file_dialog_start_handler",null),this.ensureDefault("file_queued_handler",null),this.ensureDefault("file_queue_error_handler",null),this.ensureDefault("file_dialog_complete_handler",null),this.ensureDefault("upload_start_handler",null),this.ensureDefault("upload_progress_handler",null),this.ensureDefault("upload_error_handler",null),this.ensureDefault("upload_success_handler",null),this.ensureDefault("upload_complete_handler",null),this.ensureDefault("debug_handler",this.debugMessage),this.ensureDefault("custom_settings",{}),this.customSettings=this.settings.custom_settings,this.settings.prevent_swf_caching&&(this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+(new Date).getTime()),this.settings.preserve_relative_urls||(this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url),this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)),delete this.ensureDefault},SWFUpload.prototype.loadFlash=function(){var e,t;if(null!==document.getElementById(this.movieName))throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";if(e=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder,void 0==e)throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;t=document.createElement("div"),t.innerHTML=this.getFlashHTML(),e.parentNode.replaceChild(t.firstChild,e),void 0==window[this.movieName]&&(window[this.movieName]=this.getMovieElement())},SWFUpload.prototype.getFlashHTML=function(){var e="";return KindEditor.IE&&KindEditor.V>8&&(e=' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'),['','','','','','','',""].join("")},SWFUpload.prototype.getFlashVars=function(){var e=this.buildParamString(),t=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&uploadURL=",encodeURIComponent(this.settings.upload_url),"&useQueryString=",encodeURIComponent(this.settings.use_query_string),"&requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&httpSuccess=",encodeURIComponent(t),"&assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&params=",encodeURIComponent(e),"&filePostName=",encodeURIComponent(this.settings.file_post_name),"&fileTypes=",encodeURIComponent(this.settings.file_types),"&fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&buttonWidth=",encodeURIComponent(this.settings.button_width),"&buttonHeight=",encodeURIComponent(this.settings.button_height),"&buttonText=",encodeURIComponent(this.settings.button_text),"&buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&buttonAction=",encodeURIComponent(this.settings.button_action),"&buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")},SWFUpload.prototype.getMovieElement=function(){if(void 0==this.movieElement&&(this.movieElement=document.getElementById(this.movieName)),null===this.movieElement)throw"Could not find Flash element";return this.movieElement},SWFUpload.prototype.buildParamString=function(){var e=this.settings.post_params,t=[];if("object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&t.push(encodeURIComponent(n.toString())+"="+encodeURIComponent(e[n].toString()));return t.join("&")},SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,!1);var e=null;if(e=this.getMovieElement(),e&&"unknown"==typeof e.CallFunction){for(var t in e)try{"function"==typeof e[t]&&(e[t]=null)}catch(n){}try{e.parentNode.removeChild(e)}catch(i){}}return window[this.movieName]=null,SWFUpload.instances[this.movieName]=null,delete SWFUpload.instances[this.movieName],this.movieElement=null,this.settings=null,this.customSettings=null,this.eventQueue=null,this.movieName=null,!0}catch(a){return!1}},SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url: ",this.settings.upload_url,"\n","\t","flash_url: ",this.settings.flash_url,"\n","\t","use_query_string: ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error: ",this.settings.requeue_on_error.toString(),"\n","\t","http_success: ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout: ",this.settings.assume_success_timeout,"\n","\t","file_post_name: ",this.settings.file_post_name,"\n","\t","post_params: ",this.settings.post_params.toString(),"\n","\t","file_types: ",this.settings.file_types,"\n","\t","file_types_description: ",this.settings.file_types_description,"\n","\t","file_size_limit: ",this.settings.file_size_limit,"\n","\t","file_upload_limit: ",this.settings.file_upload_limit,"\n","\t","file_queue_limit: ",this.settings.file_queue_limit,"\n","\t","debug: ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching: ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id: ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder: ",this.settings.button_placeholder?"Set":"Not Set","\n","\t","button_image_url: ",this.settings.button_image_url.toString(),"\n","\t","button_width: ",this.settings.button_width.toString(),"\n","\t","button_height: ",this.settings.button_height.toString(),"\n","\t","button_text: ",this.settings.button_text.toString(),"\n","\t","button_text_style: ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding: ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action: ",this.settings.button_action.toString(),"\n","\t","button_disabled: ",this.settings.button_disabled.toString(),"\n","\t","custom_settings: ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned: ",("function"==typeof this.settings.swfupload_loaded_handler).toString(),"\n","\t","file_dialog_start_handler assigned: ",("function"==typeof this.settings.file_dialog_start_handler).toString(),"\n","\t","file_queued_handler assigned: ",("function"==typeof this.settings.file_queued_handler).toString(),"\n","\t","file_queue_error_handler assigned: ",("function"==typeof this.settings.file_queue_error_handler).toString(),"\n","\t","upload_start_handler assigned: ",("function"==typeof this.settings.upload_start_handler).toString(),"\n","\t","upload_progress_handler assigned: ",("function"==typeof this.settings.upload_progress_handler).toString(),"\n","\t","upload_error_handler assigned: ",("function"==typeof this.settings.upload_error_handler).toString(),"\n","\t","upload_success_handler assigned: ",("function"==typeof this.settings.upload_success_handler).toString(),"\n","\t","upload_complete_handler assigned: ",("function"==typeof this.settings.upload_complete_handler).toString(),"\n","\t","debug_handler assigned: ",("function"==typeof this.settings.debug_handler).toString(),"\n"].join(""))},SWFUpload.prototype.addSetting=function(e,t,n){return void 0==t?this.settings[e]=n:this.settings[e]=t},SWFUpload.prototype.getSetting=function(e){return void 0!=this.settings[e]?this.settings[e]:""},SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement(),returnValue,returnString;try{returnString=movieElement.CallFunction(''+__flash__argumentsToXML(argumentArray,0)+""),returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}return void 0!=returnValue&&"object"==typeof returnValue.post&&(returnValue=this.unescapeFilePostParams(returnValue)),returnValue},SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")},SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")},SWFUpload.prototype.startUpload=function(e){this.callFlash("StartUpload",[e])},SWFUpload.prototype.cancelUpload=function(e,t){t!==!1&&(t=!0),this.callFlash("CancelUpload",[e,t])},SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")},SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")},SWFUpload.prototype.setStats=function(e){this.callFlash("SetStats",[e])},SWFUpload.prototype.getFile=function(e){return"number"==typeof e?this.callFlash("GetFileByIndex",[e]):this.callFlash("GetFile",[e])},SWFUpload.prototype.addFileParam=function(e,t,n){return this.callFlash("AddFileParam",[e,t,n])},SWFUpload.prototype.removeFileParam=function(e,t){this.callFlash("RemoveFileParam",[e,t])},SWFUpload.prototype.setUploadURL=function(e){this.settings.upload_url=e.toString(),this.callFlash("SetUploadURL",[e])},SWFUpload.prototype.setPostParams=function(e){this.settings.post_params=e,this.callFlash("SetPostParams",[e])},SWFUpload.prototype.addPostParam=function(e,t){this.settings.post_params[e]=t,this.callFlash("SetPostParams",[this.settings.post_params])},SWFUpload.prototype.removePostParam=function(e){delete this.settings.post_params[e],this.callFlash("SetPostParams",[this.settings.post_params])},SWFUpload.prototype.setFileTypes=function(e,t){this.settings.file_types=e,this.settings.file_types_description=t,this.callFlash("SetFileTypes",[e,t])},SWFUpload.prototype.setFileSizeLimit=function(e){this.settings.file_size_limit=e,this.callFlash("SetFileSizeLimit",[e])},SWFUpload.prototype.setFileUploadLimit=function(e){this.settings.file_upload_limit=e,this.callFlash("SetFileUploadLimit",[e])},SWFUpload.prototype.setFileQueueLimit=function(e){this.settings.file_queue_limit=e,this.callFlash("SetFileQueueLimit",[e])},SWFUpload.prototype.setFilePostName=function(e){this.settings.file_post_name=e,this.callFlash("SetFilePostName",[e])},SWFUpload.prototype.setUseQueryString=function(e){this.settings.use_query_string=e,this.callFlash("SetUseQueryString",[e])},SWFUpload.prototype.setRequeueOnError=function(e){this.settings.requeue_on_error=e,this.callFlash("SetRequeueOnError",[e])},SWFUpload.prototype.setHTTPSuccess=function(e){"string"==typeof e&&(e=e.replace(" ","").split(",")),this.settings.http_success=e,this.callFlash("SetHTTPSuccess",[e])},SWFUpload.prototype.setAssumeSuccessTimeout=function(e){this.settings.assume_success_timeout=e,this.callFlash("SetAssumeSuccessTimeout",[e])},SWFUpload.prototype.setDebugEnabled=function(e){this.settings.debug_enabled=e,this.callFlash("SetDebugEnabled",[e])},SWFUpload.prototype.setButtonImageURL=function(e){void 0==e&&(e=""),this.settings.button_image_url=e,this.callFlash("SetButtonImageURL",[e])},SWFUpload.prototype.setButtonDimensions=function(e,t){this.settings.button_width=e,this.settings.button_height=t;var n=this.getMovieElement();void 0!=n&&(n.style.width=e+"px",n.style.height=t+"px"),this.callFlash("SetButtonDimensions",[e,t])},SWFUpload.prototype.setButtonText=function(e){this.settings.button_text=e,this.callFlash("SetButtonText",[e])},SWFUpload.prototype.setButtonTextPadding=function(e,t){this.settings.button_text_top_padding=t,this.settings.button_text_left_padding=e,this.callFlash("SetButtonTextPadding",[e,t])},SWFUpload.prototype.setButtonTextStyle=function(e){this.settings.button_text_style=e,this.callFlash("SetButtonTextStyle",[e])},SWFUpload.prototype.setButtonDisabled=function(e){this.settings.button_disabled=e,this.callFlash("SetButtonDisabled",[e])},SWFUpload.prototype.setButtonAction=function(e){this.settings.button_action=e,this.callFlash("SetButtonAction",[e])},SWFUpload.prototype.setButtonCursor=function(e){this.settings.button_cursor=e,this.callFlash("SetButtonCursor",[e])},SWFUpload.prototype.queueEvent=function(e,t){void 0==t?t=[]:t instanceof Array||(t=[t]);var n=this;if("function"==typeof this.settings[e])this.eventQueue.push(function(){this.settings[e].apply(this,t)}),setTimeout(function(){n.executeNextEvent()},0);else if(null!==this.settings[e])throw"Event handler "+e+" is unknown or is not a function"},SWFUpload.prototype.executeNextEvent=function(){var e=this.eventQueue?this.eventQueue.shift():null;"function"==typeof e&&e.apply(this)},SWFUpload.prototype.unescapeFilePostParams=function(e){var t,n=/[$]([0-9a-f]{4})/i,i={};if(void 0!=e){for(var a in e.post)if(e.post.hasOwnProperty(a)){t=a;for(var o;null!==(o=n.exec(t));)t=t.replace(o[0],String.fromCharCode(parseInt("0x"+o[1],16)));i[t]=e.post[a]}e.post=i}return e},SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface"); -}catch(e){return!1}},SWFUpload.prototype.flashReady=function(){var e=this.getMovieElement();return e?(this.cleanUp(e),void this.queueEvent("swfupload_loaded_handler")):void this.debug("Flash called back ready but the flash movie can't be found.")},SWFUpload.prototype.cleanUp=function(e){try{if(this.movieElement&&"unknown"==typeof e.CallFunction){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var t in e)try{"function"==typeof e[t]&&(e[t]=null)}catch(n){}}}catch(i){}window.__flash__removeCallback=function(e,t){try{e&&(e[t]=null)}catch(n){}}},SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")},SWFUpload.prototype.fileQueued=function(e){e=this.unescapeFilePostParams(e),this.queueEvent("file_queued_handler",e)},SWFUpload.prototype.fileQueueError=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("file_queue_error_handler",[e,t,n])},SWFUpload.prototype.fileDialogComplete=function(e,t,n){this.queueEvent("file_dialog_complete_handler",[e,t,n])},SWFUpload.prototype.uploadStart=function(e){e=this.unescapeFilePostParams(e),this.queueEvent("return_upload_start_handler",e)},SWFUpload.prototype.returnUploadStart=function(e){var t;if("function"==typeof this.settings.upload_start_handler)e=this.unescapeFilePostParams(e),t=this.settings.upload_start_handler.call(this,e);else if(void 0!=this.settings.upload_start_handler)throw"upload_start_handler must be a function";void 0===t&&(t=!0),t=!!t,this.callFlash("ReturnUploadStart",[t])},SWFUpload.prototype.uploadProgress=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("upload_progress_handler",[e,t,n])},SWFUpload.prototype.uploadError=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("upload_error_handler",[e,t,n])},SWFUpload.prototype.uploadSuccess=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("upload_success_handler",[e,t,n])},SWFUpload.prototype.uploadComplete=function(e){e=this.unescapeFilePostParams(e),this.queueEvent("upload_complete_handler",e)},SWFUpload.prototype.debug=function(e){this.queueEvent("debug_handler",e)},SWFUpload.prototype.debugMessage=function(e){if(this.settings.debug){var t,n=[];if("object"==typeof e&&"string"==typeof e.name&&"string"==typeof e.message){for(var i in e)e.hasOwnProperty(i)&&n.push(i+": "+e[i]);t=n.join("\n")||"",n=t.split("\n"),t="EXCEPTION: "+n.join("\nEXCEPTION: "),SWFUpload.Console.writeLine(t)}else SWFUpload.Console.writeLine(e)}},SWFUpload.Console={},SWFUpload.Console.writeLine=function(e){var t,n;try{t=document.getElementById("SWFUpload_Console"),t||(n=document.createElement("form"),document.getElementsByTagName("body")[0].appendChild(n),t=document.createElement("textarea"),t.id="SWFUpload_Console",t.style.fontFamily="monospace",t.setAttribute("wrap","off"),t.wrap="off",t.style.overflow="auto",t.style.width="700px",t.style.height="350px",t.style.margin="5px",n.appendChild(t)),t.value+=e+"\n",t.scrollTop=t.scrollHeight-t.clientHeight}catch(i){alert("Exception: "+i.name+" Message: "+i.message)}}}(),function(){"function"==typeof SWFUpload&&(SWFUpload.queue={},SWFUpload.prototype.initSettings=function(e){return function(){"function"==typeof e&&e.call(this),this.queueSettings={},this.queueSettings.queue_cancelled_flag=!1,this.queueSettings.queue_upload_count=0,this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler,this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler,this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler,this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler,this.settings.queue_complete_handler=this.settings.queue_complete_handler||null}}(SWFUpload.prototype.initSettings),SWFUpload.prototype.startUpload=function(e){this.queueSettings.queue_cancelled_flag=!1,this.callFlash("StartUpload",[e])},SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=!0,this.stopUpload();for(var e=this.getStats();e.files_queued>0;)this.cancelUpload(),e=this.getStats()},SWFUpload.queue.uploadStartHandler=function(e){var t;return"function"==typeof this.queueSettings.user_upload_start_handler&&(t=this.queueSettings.user_upload_start_handler.call(this,e)),t=t!==!1,this.queueSettings.queue_cancelled_flag=!t,t},SWFUpload.queue.uploadCompleteHandler=function(e){var t,n=this.queueSettings.user_upload_complete_handler;if(e.filestatus===SWFUpload.FILE_STATUS.COMPLETE&&this.queueSettings.queue_upload_count++,t="function"==typeof n?n.call(this,e)!==!1:e.filestatus!==SWFUpload.FILE_STATUS.QUEUED){var i=this.getStats();i.files_queued>0&&this.queueSettings.queue_cancelled_flag===!1?this.startUpload():this.queueSettings.queue_cancelled_flag===!1?(this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]),this.queueSettings.queue_upload_count=0):(this.queueSettings.queue_cancelled_flag=!1,this.queueSettings.queue_upload_count=0)}})}(),KindEditor.plugin("pagebreak",function(e){var t=this,n="pagebreak",i=e.undef(t.pagebreakHtml,'
');t.clickToolbar(n,function(){var n=t.cmd,a=n.range;t.focus();var o="br"==t.newlineTag||e.WEBKIT?"":'';if(t.insertHtml(i+o),""!==o){var r=e("#__kindeditor_tail_tag__",t.edit.doc);a.selectNodeContents(r[0]),r.removeAttr("id"),n.select()}})}),KindEditor.plugin("plainpaste",function(e){var t=this,n="plainpaste";t.clickToolbar(n,function(){var i=t.lang(n+"."),a='
'+i.comment+'
',o=t.createDialog({name:n,width:450,title:t.lang(n),body:a,yesBtn:{name:t.lang("yes"),click:function(n){var i=r.val();i=e.escape(i),i=i.replace(/ {2}/g,"  "),i="p"==t.newlineTag?i.replace(/^/,"

").replace(/$/,"

").replace(/\n/g,"

"):i.replace(/\n/g,"
$&"),t.insertHtml(i).hideDialog().focus()}}}),r=e("textarea",o.div);r[0].focus()})}),KindEditor.plugin("preview",function(e){var t=this,n="preview";t.clickToolbar(n,function(){var i=(t.lang(n+"."),'

'),a=t.createDialog({name:n,width:750,title:t.lang(n),body:i}),o=e("iframe",a.div),r=e.iframeDoc(o);r.open(),r.write(t.fullHtml()),r.close(),e(r.body).css("background-color","#FFF"),o[0].contentWindow.focus()})}),KindEditor.plugin("quickformat",function(e){function t(e){for(var t=e.first();t&&t.first();)t=t.first();return t}var n=this,i="quickformat",a=e.toMap("blockquote,center,div,h1,h2,h3,h4,h5,h6,p");n.clickToolbar(i,function(){n.focus();for(var i,o=n.edit.doc,r=n.cmd.range,l=e(o.body).first(),s=[],d=[],c=r.createBookmark(!0);l;){i=l.next();var u=t(l);u&&"img"==u.name||(a[l.name]?(l.html(l.html().replace(/^(\s| | )+/gi,"")),l.css("text-indent","2em")):d.push(l),(!i||a[i.name]||a[l.name]&&!a[i.name])&&(d.length>0&&s.push(d),d=[])),l=i}e.each(s,function(t,n){var i=e('

',o);n[0].before(i),e.each(n,function(e,t){i.append(t)})}),r.moveToBookmark(c),n.addBookmark()})}),KindEditor.plugin("template",function(e){function t(t){return a+t+"?ver="+encodeURIComponent(e.DEBUG?e.TIME:e.VERSION)}var n=this,i="template",a=(n.lang(i+"."),n.pluginsPath+i+"/html/");n.clickToolbar(i,function(){var a=n.lang(i+"."),o=['
','
','
',a.selectTemplate+"
",'
',' ","
",'
',"
",'',"
"].join("");var r=n.createDialog({name:i,width:500,title:n.lang(i),body:html,yesBtn:{name:n.lang("yes"),click:function(t){var i=e.iframeDoc(d);n[s[0].checked?"html":"insertHtml"](i.body.innerHTML).hideDialog().focus()}}}),l=e("select",r.div),s=e('[name="replaceFlag"]',r.div),d=e("iframe",r.div);s[0].checked=!0,d.attr("src",t(l.val())),l.change(function(){d.attr("src",t(this.value))})})}),KindEditor.plugin("wordpaste",function(e){var t=this,n="wordpaste";t.clickToolbar(n,function(){var i=t.lang(n+"."),a='
'+i.comment+'
',o=t.createDialog({name:n,width:450,title:t.lang(n),body:a,yesBtn:{name:t.lang("yes"),click:function(n){var i=s.body.innerHTML;i=e.clearMsWord(i,t.filterMode?t.htmlTags:e.options.htmlTags),t.insertHtml(i).hideDialog().focus()}}}),r=o.div,l=e("iframe",r),s=e.iframeDoc(l);e.IE||(s.designMode="on"),s.open(),s.write("WordPaste"),s.write(''),e.IE||s.write("
"),s.write(""),s.close(),e.IE&&(s.body.contentEditable="true"),l[0].contentWindow.focus()})}),$.each(["afterBlur","afterFocus","afterChange","afterTab"],function(e,t){KindEditor.EditorClass.prototype[t]=function(e){return this.handler(t,e)}}),KindEditor.plugin("zui",function(e){var t=this,n=t.options;t.uuid=$.zui.uuid(),t.afterBlur(function(){n.syncAfterBlur&&t.sync(),t.container.removeClass("focus")}),t.afterFocus(function(){t.container.addClass("focus")}),t.afterChange(function(){t.edit.srcElement.change().hide()}),t.afterCreate(function(){$(t.edit.srcElement[0]).data("keditor",t);var e=n.spellcheck;void 0!==e&&t.edit.doc.documentElement.setAttribute("spellcheck",e)});var i='input:not([type="hidden"]), textarea:not(.ke-edit-textarea), button[type="submit"], select';t.afterTab(function(){var e=$(t.edit.srcElement[0]),n=e.next(i);n.length||(n=e.parent().next().find(i)),n.length||(n=e.parent().parent().next().find(i)),n=n.first();var a=n.data("keditor");a?a.focus():n.focus()})}),KindEditor.EditorClass.prototype.setPlaceholder=function(e,t){var n=this,i=n.options,a=n.edit,o=$(a.doc),r=o.find(".kindeditor-ph");r.length||(r=$('
'),i.placeholderStyle&&r.css(i.placeholderStyle),o.find("body").after(r)),n.plugin.hasContent()&&r.hide(),r[t?"html":"text"](e)},KindEditor.EditorClass.prototype.getPlaceholder=function(e){return $(this.edit.doc).find(".kindeditor-ph")[e?"html":"text"]()},KindEditor.plugin("placeholder",function(e){var t=this;t.plugin.hasContent=function(){return""!==t.html().replace(/\s|\n|\r|\t/g,"").replace(//g,"").replace(/

<\/p>/g,"")},t.afterBlur(function(){t.plugin.hasContent()||$(t.edit.doc).find(".kindeditor-ph").show()}),t.afterFocus(function(){$(t.edit.doc).find(".kindeditor-ph").hide()}),t.afterCreate(function(){var e=t.options;e.placeholderHtml?t.setPlaceholder(e.placeholderHtml,!0):e.placeholder&&t.setPlaceholder(e.placeholder)})}),KindEditor.plugin("pasteimage",function(e){var t=this,n={zh_cn:{notSupportMsg:"您的浏览器不支持粘贴图片!",placeholder:"可以在编辑器直接贴图。",failMsg:"贴图失败,请稍后重试。",uploadingHint:"正在上传图片,请稍后..."},zh_tw:{notSupportMsg:"您的瀏覽器不支持粘貼圖片!",placeholder:"可以在編輯器直接貼圖。",failMsg:"貼圖失敗,請稍後重試。",uploadingHint:"正在上傳圖片,請稍後..."},en:{notSupportMsg:"Image is not allowed to paste in your browser!",placeholder:"Paste images here.",failMsg:"Pasting image failed. Try again later.",uploadingHint:"Uploading..."}},i=$.extend({},n[($.clientLang||$.zui.clientLang)()]);t.afterCreate(function(){var n=t.edit,a=n.doc,o=t.uuid,r=t.options.pasteImage;if(r){if("string"==typeof r&&(r={postUrl:r}),$.extend({placeholder:l},r),e.WEBKIT||e.GECKO||$(a.body).on("keyup.ke"+o,function(e){86==e.keyCode&&e.ctrlKey&&alert(i.notSupportMsg)}),t.setPlaceholder){var l=r.placeholder;if(l===!0&&(l=i.placeholder),l){var s=t.getPlaceholder();s?s.indexOf(l)<0&&(l=s+"\n"+l):s=l}}var d=function(){r.beforePaste&&r.beforePaste();var e='

'+i.uploadingHint+"
";n.cmd.inserthtml(e),t.readonly(!0)},c=function(e){e&&(r.onError?r.onError(e):(e===!0&&(e=i.failMsg),$.zui&&$.zui.messager&&$.zui.messager.danger(e,{placement:"center"}))),r.afterPaste&&r.afterPaste(),$(a.body).find(".image-loading-ele").remove(),t.readonly(!1)},u=r.postUrl;$(a.body).on("paste.ke"+o,function(t){if(e.WEBKIT){var i=t.originalEvent,o=i.clipboardData&&i.clipboardData.items,r=null;if(o)for(var l=/^image\/(p?jpeg|gif|png)$/i,s=0;s';$.post(u,{editor:i},function(e){e?n.cmd.inserthtml(e):n.cmd.inserthtml(i),c()}).error(function(){c(!0)})},h.readAsDataURL(p)}else setTimeout(function(){var t=e(a.body).html();t.search(/"),n.html(e),c()}).error(function(){c(!0)}))},80)}),t.beforeRemove(function(){$(a.body).off(".ke"+o)})}})}),function(e){function t(t){var n=[],i=0,a=0;t.children("thead,tbody,tfoot").children("tr").each(function(t,o){e(o).children("td,th").each(function(o,r){var l,s,d=e(r),c=0|d.attr("colspan"),u=0|d.attr("rowspan");for(c=c?c:1,u=u?u:1;n[t]&&n[t][o];++o);for(l=o;ltr"),r=o.filter(function(){return!!this.style.backgroundColor}).length;t.stripedRows=r>=Math.floor(o/2)}if(s.tableSetting=t,void 0!==t.header){if(n.is(".ke-plugin-table-example"))n.find("thead").toggleClass("hidden",!t.header);else{var l=n.find("thead");if(t.header){if(!l.length){var d=[""],c=n.find("tbody>tr:first").children(),u=0;c.each(function(){var e=$(this),t=e.attr("colspan");u+=t?parseInt(t):1});for(var p=0;p'+(e.IE?" ":"
")+"");d.push(""),l=$(d.join("")),n.prepend(l)}}else l.remove()}i&&i("header",t.header)}if(void 0!==t.stripedRows){var o=n.find("tbody>tr");o.each(function(e){$(this).css("background-color",t.stripedRows&&e%2===0?"#f9f9f9":"none")}),i&&i("stripedRows",t.stripedRows)}void 0!==t.autoWidth&&(n.css(t.autoWidth?{width:"auto",maxWidth:"100%"}:{width:"100%"}),i&&i("autoWidth",t.autoWidth)),void 0!==t.borderColor&&(n.find("td,th").css("border-color",t.borderColor),i&&i("borderColor",t.borderColor))}}function r(t,n,i,a){if(t*n){for(var o=$('
'),r=$(""),l=0;l"),c=0;c'+(e.IE?" ":"
")+"");d.append(u)}r.append(d)}o.append(r);var p=$("
").append(o).html();return e.IE||(p+="
"),s.insertHtml(p),o}}function l(i){for(var a=$(i[0]),r=[""],l=[""],c=0;c<6;++c){r.push('{tableHead}'),l.push("");for(var u=0;u<6;++u)l.push('{tableContent}');l.push("")}r.push(""),l.push("");var f=['
','
','
','
',"",'
','
',"
",'
',"",'
','
',"
",'
',"",'
','{borderColor}','',"
","
","
",'
','',r.join(""),l.join(""),"
","","",""].join("").format(p),m=$(f),g=m.find(".ke-plugin-table-example"),v=s.cmd.range.createBookmark(),_=m.find(".ke-plugin-table-input-color"),b=e(_[0]);m.on("change.kTable","input[name]",function(){var e=$(this),t={};t[e.attr("name")]=e.is('[type="checkbox"]')?e.is(":checked"):e.val(),o(t,g)});var y=s.createDialog({name:d+"Dialog",width:550,title:s.lang(d),body:m[0],beforeRemove:function(){m.off(".kTable")},yesBtn:{name:s.lang("yes"),click:function(e){o({borderColor:m.find('[name="borderColor"]').val(),header:m.find('[name="header"]').is(":checked"),stripedRows:m.find('[name="stripedRows"]').is(":checked"),hoverRows:m.find('[name="hoverRows"]').is(":checked"),autoWidth:m.find('[name="autoWidth"]:checked').val()},a),s.hideDialog().focus(),s.cmd.range.moveToBookmark(v),s.cmd.select(),s.addBookmark()}}});n(y.div,b,function(e){o({borderColor:e},g)}),o(s.tableSetting,g,function(e,n){switch(e){case"borderColor":t(b,n||h);break;case"header":m.find('[name="header"]').prop("checked",!!n);break;case"stripedRows":m.find('[name="stripedRows"]').prop("checked",!!n);break;case"hoverRows":m.find('[name="hoverRows"]').prop("checked",!!n);break;case"autoWidth":m.find('[name="autoWidth"][value="'+(n?"auto":"")+'"]').prop("checked",!0)}})}var s=this,d="table",c={zh_cn:{name:"表格",xRxC:"{0}行 × {1}列",headerRow:"标题行",headerCol:"标题列",tableStyle:"表格样式",addHeaderRow:"添加表格标题行",stripedRows:"隔行变色效果",hoverRows:"鼠标悬停效果",autoChangeTableWidth:"自动调整表格尺寸",tableWidthFixed:"按表格文字自适应",tableWidthFull:"按页面宽度自适应",tableBorder:"表格边框",tableHead:"标题",tableContent:"内容",mergeCells:"合并单元格",defaultColor:"默认颜色",color:"颜色",forecolor:"文字颜色",backcolor:"背景颜色"},zh_tw:{name:"表格",xRxC:"{0}行×{1}列",headerRow:"標題行",headerCol:"標題列",tableStyle:"表格樣式",addHeaderRow:"添加表格標題行",stripedRows:"隔行變色效果",hoverRows:"鼠標懸停效果",autoChangeTableWidth:"自動調整表格尺寸",tableWidthFixed:"按表格文字自適應",tableWidthFull:"按頁面寬度自適應",tableBorder:"表格邊框",tableHead:"標題",tableContent:"內容",mergeCells:"合併單元格",defaultColor:"默認顏色",color:"顏色",forecolor:"文字顏色",backcolor:"背景顏色"},en:{name:"Table",xRxC:"{0} Rows × {1} Columns",headerRow:"Header Row",headerCol:"Header Column",tableStyle:"Table style",addHeaderRow:"Add header row",stripedRows:"Striped effection",hoverRows:"Mouse hover effection",autoChangeTableWidth:"Automatically adjust table size",tableWidthFixed:"Adaptive by form text",tableWidthFull:"Page width adaptive",tableBorder:"Table border",tableHead:"Title",tableContent:"Text",mergeCells:"Merge Cells",defaultColor:"Default color",color:"Color",forecolor:"Text Color",backcolor:"Back Color"}},u=[],p=$.extend({},s.lang("table."),c[($.clientLang||$.zui.clientLang)()]),h=s.options.tableBorderColor||"#ddd",f=[];if(!s.plugin.table){s.plugin.table={prop:function(){var e=s.plugin.getSelectedTable();e&&e.length&&l(e)},cellprop:function(){var i,a,o,r,r,l,c,u,f,m=['
','
','",'
','
',''+p.width+"",'','','","
","
",'
','
',''+p.height+"",'','','","
","
","
",'
','",'
','
',''+p.textAlign+"",'","
","
",'
','
',''+p.verticalAlign+"",'","
","
","
",'
','",'
','
',''+p.borderColor+"",'',"
","
",'
','
',''+p.size+"",'','px',"
","
","
",'
','",'
','
',''+p.forecolor+"",'',"
","
",'
','
',''+p.backcolor+"",'',"
","
","
","
"].join(""),g=s.cmd.range.createBookmark(),v=s.createDialog({name:d,width:500,title:s.lang("tablecell"),body:m,beforeRemove:function(){u.unbind()},yesBtn:{name:s.lang("yes"),click:function(t){var n=a.val(),i=o.val(),d=r.val(),p=heightTypeBox.val(),h=l.val(),m=c.val(),v=f.val()+"px",_=e(u[0]).val()||"",b=e(u[1]).val()||"",y=e(u[2]).val()||"";if(!/^\d*$/.test(n))return alert(s.lang("invalidWidth")),void a[0].focus();if(!/^\d*$/.test(i))return alert(s.lang("invalidHeight")),void o[0].focus();for(var k=s.plugin.getAllSelectedCells(),w={width:""!==n?n+d:"",height:""!==i?i+p:"","background-color":y,"text-align":h,"border-width":v,"vertical-align":m,"border-color":_,color:b},C=0;C'+(e.IE?" ":"
")+"",r=i(n,c,u)}s.cmd.range.selectNodeContents(o).collapse(!0),s.cmd.select(),s.addBookmark()},colinsertleft:function(){this.colinsert(0)},colinsertright:function(){this.colinsert(1)},rowinsert:function(t){var n=s.plugin.getSelectedTable()[0],i=s.plugin.getSelectedRow()[0],a=s.plugin.getSelectedCell()[0],o=i.rowIndex;1===t&&(o=i.rowIndex+(a.rowSpan-1)+t);for(var r=n.insertRow(o),l="THEAD"===r.parentNode.tagName,d=0,c=i.cells.length;d1&&(c-=i.cells[d].rowSpan-1);var u=r.insertCell(d);1===t&&i.cells[d].colSpan>1&&(u.colSpan=i.cells[d].colSpan),u.outerHTML="<"+(l?"th":"td")+' style="border: 1px solid '+(s.tableSetting&&s.tableSetting.borderColor||h)+'">'+(e.IE?" ":"
")+""}for(var p=o;p>=0;p--){var f=n.rows[p].cells;if(f.length>d){for(var m=a.cellIndex;m>=0;m--)f[m].rowSpan>1&&(f[m].rowSpan+=1);break}}s.cmd.range.selectNodeContents(a).collapse(!0),s.cmd.select(),s.addBookmark()},rowinsertabove:function(){this.rowinsert(0)},rowinsertbelow:function(){this.rowinsert(1)},rowmerge:function(){var e=s.plugin.getSelectedTable()[0],t=s.plugin.getSelectedRow()[0],n=s.plugin.getSelectedCell()[0],i=t.rowIndex,a=i+n.rowSpan,o=e.rows[a];if(!(e.rows.length<=a)){var r=n.cellIndex;if(!(o.cells.length<=r)){var l=o.cells[r];n.colSpan===l.colSpan&&(n.rowSpan+=l.rowSpan,o.deleteCell(r),s.cmd.range.selectNodeContents(n).collapse(!0),s.cmd.select(),s.addBookmark())}}},colmerge:function(){var e=(s.plugin.getSelectedTable()[0],s.plugin.getSelectedRow()[0]),t=s.plugin.getSelectedCell()[0],n=(e.rowIndex,t.cellIndex),i=n+1;if(!(e.cells.length<=i)){var a=e.cells[i];t.rowSpan===a.rowSpan&&(t.colSpan+=a.colSpan,e.deleteCell(i),s.cmd.range.selectNodeContents(t).collapse(!0),s.cmd.select(),s.addBookmark())}},mergeCells:function(){var e=s.tableSelectionRange;if(e){var t,n=s.plugin.getSelectedTable()[0],i=$(n),a=e.top,o=e.left,r=e.right,l=e.bottom;i.children("thead,tbody,tfoot").children("tr").each(function(){$(this).children("td,th").each(function(){var e=$(this),n=e.cellPos();n.left===o&&n.top===a?t=e:n.right>=o&&n.left<=r&&n.bottom>=a&&n.top<=l&&e.addClass("ke-cell-removed")})}),t&&(t.attr({rowspan:l-a+1,colspan:r-o+1}),i.find(".ke-cell-removed").remove(),s.cmd.range.selectNodeContents(t[0]).collapse(!0),s.cmd.select(),s.addBookmark())}},rowsplit:function(){var t=s.plugin.getSelectedTable()[0],n=s.plugin.getSelectedRow()[0],a=s.plugin.getSelectedCell()[0],o=n.rowIndex;if(1!==a.rowSpan){for(var r=i(t,n,a),l=1,d=a.rowSpan;l1&&(u.colSpan=a.colSpan),u.innerHTML=e.IE?" ":"
",r=i(t,c,u)}e(a).removeAttr("rowSpan"),s.cmd.range.selectNodeContents(a).collapse(!0),s.cmd.select(),s.addBookmark()}},colsplit:function(){var t=(s.plugin.getSelectedTable()[0],s.plugin.getSelectedRow()[0]),n=s.plugin.getSelectedCell()[0],i=n.cellIndex;if(1!==n.colSpan){for(var a=1,o=n.colSpan;a1&&(r.rowSpan=n.rowSpan),r.innerHTML=e.IE?" ":"
"}e(n).removeAttr("colSpan"),s.cmd.range.selectNodeContents(n).collapse(!0),s.cmd.select(),s.addBookmark()}},coldelete:function(){var t=s.plugin.getSelectedTable()[0],n=s.plugin.getAllSelectedCells();if(n.length){for(var i=0;i1?(u.colSpan-=1,1===u.colSpan&&e(u).removeAttr("colSpan")):c.deleteCell(r),u.rowSpan>1&&(l+=u.rowSpan-1)}if(0===o.cells.length){s.cmd.range.setStartBefore(t).collapse(!0),s.cmd.select(),e(t).remove();break}}}t.parentNode&&s.cmd.selection(!0),s.addBookmark()}},rowdelete:function(){var t=s.plugin.getSelectedTable()[0],n=s.plugin.getAllSelectedCells();if(n.length){for(var i=0;i=0;r--)t.deleteRow(o.rowIndex+r)}0===t.rows.length?(s.cmd.range.setStartBefore(t).collapse(!0),s.cmd.select(),e(t).remove()):s.cmd.selection(!0),s.addBookmark()}}},s.plugin.getSelectedTable=function(){return e($(s.cmd.range.startContainer).closest("table")[0])},s.plugin.getSelectedRow=function(){return e($(s.cmd.range.startContainer).closest("tr")[0])},s.plugin.getSelectedCell=function(){return e($(s.cmd.range.startContainer).closest("td,th")[0])},s.plugin.getSelectedCells=function(){var t=s.plugin.getSelectedTable();if(t.length){var n=e(".ke-select-cell",t.get(0));if(n&&n.length>1)return n}},s.plugin.getSingleSelectedCell=function(){var e=s.plugin.getSelectedCells();if(!(e&&e.length>1))return s.plugin.getSelectedCell()},s.plugin.getAllSelectedCells=function(){var e=s.plugin.getSelectedCells();return e&&e.length?e:s.plugin.getSelectedCell()};var m={mergeCells:"ke-icon-tablecolmerge"};e.each("prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,mergeCells,rowmerge,colmerge,rowsplit,colsplit,coldelete,rowdelete,delete".split(","),function(t,n){var i;i="prop"===n||"delete"===n?s.plugin.getSelectedTable:"mergeCells"===n?s.plugin.getSelectedCells:"rowmerge"===n?function(){var e=s.plugin.getSingleSelectedCell();if(e&&e.length&&$(e.get(0)).parent().next("tr").length)return e; +}catch(e){return!1}},SWFUpload.prototype.flashReady=function(){var e=this.getMovieElement();return e?(this.cleanUp(e),void this.queueEvent("swfupload_loaded_handler")):void this.debug("Flash called back ready but the flash movie can't be found.")},SWFUpload.prototype.cleanUp=function(e){try{if(this.movieElement&&"unknown"==typeof e.CallFunction){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var t in e)try{"function"==typeof e[t]&&(e[t]=null)}catch(n){}}}catch(i){}window.__flash__removeCallback=function(e,t){try{e&&(e[t]=null)}catch(n){}}},SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")},SWFUpload.prototype.fileQueued=function(e){e=this.unescapeFilePostParams(e),this.queueEvent("file_queued_handler",e)},SWFUpload.prototype.fileQueueError=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("file_queue_error_handler",[e,t,n])},SWFUpload.prototype.fileDialogComplete=function(e,t,n){this.queueEvent("file_dialog_complete_handler",[e,t,n])},SWFUpload.prototype.uploadStart=function(e){e=this.unescapeFilePostParams(e),this.queueEvent("return_upload_start_handler",e)},SWFUpload.prototype.returnUploadStart=function(e){var t;if("function"==typeof this.settings.upload_start_handler)e=this.unescapeFilePostParams(e),t=this.settings.upload_start_handler.call(this,e);else if(void 0!=this.settings.upload_start_handler)throw"upload_start_handler must be a function";void 0===t&&(t=!0),t=!!t,this.callFlash("ReturnUploadStart",[t])},SWFUpload.prototype.uploadProgress=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("upload_progress_handler",[e,t,n])},SWFUpload.prototype.uploadError=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("upload_error_handler",[e,t,n])},SWFUpload.prototype.uploadSuccess=function(e,t,n){e=this.unescapeFilePostParams(e),this.queueEvent("upload_success_handler",[e,t,n])},SWFUpload.prototype.uploadComplete=function(e){e=this.unescapeFilePostParams(e),this.queueEvent("upload_complete_handler",e)},SWFUpload.prototype.debug=function(e){this.queueEvent("debug_handler",e)},SWFUpload.prototype.debugMessage=function(e){if(this.settings.debug){var t,n=[];if("object"==typeof e&&"string"==typeof e.name&&"string"==typeof e.message){for(var i in e)e.hasOwnProperty(i)&&n.push(i+": "+e[i]);t=n.join("\n")||"",n=t.split("\n"),t="EXCEPTION: "+n.join("\nEXCEPTION: "),SWFUpload.Console.writeLine(t)}else SWFUpload.Console.writeLine(e)}},SWFUpload.Console={},SWFUpload.Console.writeLine=function(e){var t,n;try{t=document.getElementById("SWFUpload_Console"),t||(n=document.createElement("form"),document.getElementsByTagName("body")[0].appendChild(n),t=document.createElement("textarea"),t.id="SWFUpload_Console",t.style.fontFamily="monospace",t.setAttribute("wrap","off"),t.wrap="off",t.style.overflow="auto",t.style.width="700px",t.style.height="350px",t.style.margin="5px",n.appendChild(t)),t.value+=e+"\n",t.scrollTop=t.scrollHeight-t.clientHeight}catch(i){alert("Exception: "+i.name+" Message: "+i.message)}}}(),function(){"function"==typeof SWFUpload&&(SWFUpload.queue={},SWFUpload.prototype.initSettings=function(e){return function(){"function"==typeof e&&e.call(this),this.queueSettings={},this.queueSettings.queue_cancelled_flag=!1,this.queueSettings.queue_upload_count=0,this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler,this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler,this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler,this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler,this.settings.queue_complete_handler=this.settings.queue_complete_handler||null}}(SWFUpload.prototype.initSettings),SWFUpload.prototype.startUpload=function(e){this.queueSettings.queue_cancelled_flag=!1,this.callFlash("StartUpload",[e])},SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=!0,this.stopUpload();for(var e=this.getStats();e.files_queued>0;)this.cancelUpload(),e=this.getStats()},SWFUpload.queue.uploadStartHandler=function(e){var t;return"function"==typeof this.queueSettings.user_upload_start_handler&&(t=this.queueSettings.user_upload_start_handler.call(this,e)),t=t!==!1,this.queueSettings.queue_cancelled_flag=!t,t},SWFUpload.queue.uploadCompleteHandler=function(e){var t,n=this.queueSettings.user_upload_complete_handler;if(e.filestatus===SWFUpload.FILE_STATUS.COMPLETE&&this.queueSettings.queue_upload_count++,t="function"==typeof n?n.call(this,e)!==!1:e.filestatus!==SWFUpload.FILE_STATUS.QUEUED){var i=this.getStats();i.files_queued>0&&this.queueSettings.queue_cancelled_flag===!1?this.startUpload():this.queueSettings.queue_cancelled_flag===!1?(this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]),this.queueSettings.queue_upload_count=0):(this.queueSettings.queue_cancelled_flag=!1,this.queueSettings.queue_upload_count=0)}})}(),KindEditor.plugin("pagebreak",function(e){var t=this,n="pagebreak",i=e.undef(t.pagebreakHtml,'
');t.clickToolbar(n,function(){var n=t.cmd,a=n.range;t.focus();var o="br"==t.newlineTag||e.WEBKIT?"":'';if(t.insertHtml(i+o),""!==o){var r=e("#__kindeditor_tail_tag__",t.edit.doc);a.selectNodeContents(r[0]),r.removeAttr("id"),n.select()}})}),KindEditor.plugin("plainpaste",function(e){var t=this,n="plainpaste";t.clickToolbar(n,function(){var i=t.lang(n+"."),a='
'+i.comment+'
',o=t.createDialog({name:n,width:450,title:t.lang(n),body:a,yesBtn:{name:t.lang("yes"),click:function(n){var i=r.val();i=e.escape(i),i=i.replace(/ {2}/g,"  "),i="p"==t.newlineTag?i.replace(/^/,"

").replace(/$/,"

").replace(/\n/g,"

"):i.replace(/\n/g,"
$&"),t.insertHtml(i).hideDialog().focus()}}}),r=e("textarea",o.div);r[0].focus()})}),KindEditor.plugin("preview",function(e){var t=this,n="preview";t.clickToolbar(n,function(){var i=(t.lang(n+"."),'

'),a=t.createDialog({name:n,width:750,title:t.lang(n),body:i}),o=e("iframe",a.div),r=e.iframeDoc(o);r.open(),r.write(t.fullHtml()),r.close(),e(r.body).css("background-color","#FFF"),o[0].contentWindow.focus()})}),KindEditor.plugin("quickformat",function(e){function t(e){for(var t=e.first();t&&t.first();)t=t.first();return t}var n=this,i="quickformat",a=e.toMap("blockquote,center,div,h1,h2,h3,h4,h5,h6,p");n.clickToolbar(i,function(){n.focus();for(var i,o=n.edit.doc,r=n.cmd.range,l=e(o.body).first(),s=[],d=[],c=r.createBookmark(!0);l;){i=l.next();var u=t(l);u&&"img"==u.name||(a[l.name]?(l.html(l.html().replace(/^(\s| | )+/gi,"")),l.css("text-indent","2em")):d.push(l),(!i||a[i.name]||a[l.name]&&!a[i.name])&&(d.length>0&&s.push(d),d=[])),l=i}e.each(s,function(t,n){var i=e('

',o);n[0].before(i),e.each(n,function(e,t){i.append(t)})}),r.moveToBookmark(c),n.addBookmark()})}),KindEditor.plugin("template",function(e){function t(t){return a+t+"?ver="+encodeURIComponent(e.DEBUG?e.TIME:e.VERSION)}var n=this,i="template",a=(n.lang(i+"."),n.pluginsPath+i+"/html/");n.clickToolbar(i,function(){var a=n.lang(i+"."),o=['
','
','
',a.selectTemplate+"
",'
',' ","
",'
',"
",'',"
"].join("");var r=n.createDialog({name:i,width:500,title:n.lang(i),body:html,yesBtn:{name:n.lang("yes"),click:function(t){var i=e.iframeDoc(d);n[s[0].checked?"html":"insertHtml"](i.body.innerHTML).hideDialog().focus()}}}),l=e("select",r.div),s=e('[name="replaceFlag"]',r.div),d=e("iframe",r.div);s[0].checked=!0,d.attr("src",t(l.val())),l.change(function(){d.attr("src",t(this.value))})})}),KindEditor.plugin("wordpaste",function(e){var t=this,n="wordpaste";t.clickToolbar(n,function(){var i=t.lang(n+"."),a='
'+i.comment+'
',o=t.createDialog({name:n,width:450,title:t.lang(n),body:a,yesBtn:{name:t.lang("yes"),click:function(n){var i=s.body.innerHTML;i=e.clearMsWord(i,t.filterMode?t.htmlTags:e.options.htmlTags),t.insertHtml(i).hideDialog().focus()}}}),r=o.div,l=e("iframe",r),s=e.iframeDoc(l);e.IE||(s.designMode="on"),s.open(),s.write("WordPaste"),s.write(''),e.IE||s.write("
"),s.write(""),s.close(),e.IE&&(s.body.contentEditable="true"),l[0].contentWindow.focus()})}),$.each(["afterBlur","afterFocus","afterChange","afterTab"],function(e,t){KindEditor.EditorClass.prototype[t]=function(e){return this.handler(t,e)}}),KindEditor.plugin("zui",function(e){var t=this,n=t.options;t.uuid=$.zui.uuid(),t.afterBlur(function(){n.syncAfterBlur&&t.sync(),t.container.removeClass("focus")}),t.afterFocus(function(){t.container.addClass("focus")}),t.afterChange(function(){t.edit.srcElement.change().hide()}),t.afterCreate(function(){$(t.edit.srcElement[0]).data("keditor",t);var e=n.spellcheck;void 0!==e&&t.edit.doc.documentElement.setAttribute("spellcheck",e)});var i='input:not([type="hidden"]), textarea:not(.ke-edit-textarea), button[type="submit"], select';t.afterTab(function(){var e=$(t.edit.srcElement[0]),n=e.next(i);n.length||(n=e.parent().next().find(i)),n.length||(n=e.parent().parent().next().find(i)),n=n.first();var a=n.data("keditor");a?a.focus():n.focus()})}),KindEditor.EditorClass.prototype.setPlaceholder=function(e,t){var n=this,i=n.options,a=n.edit,o=$(a.doc),r=o.find(".kindeditor-ph");r.length||(r=$('
'),i.placeholderStyle&&r.css(i.placeholderStyle),o.find("body").after(r)),n.plugin.hasContent()&&r.hide(),r[t?"html":"text"](e)},KindEditor.EditorClass.prototype.getPlaceholder=function(e){return $(this.edit.doc).find(".kindeditor-ph")[e?"html":"text"]()},KindEditor.plugin("placeholder",function(e){var t=this;t.plugin.hasContent=function(){return""!==t.html().replace(/\s|\n|\r|\t/g,"").replace(//g,"").replace(/

<\/p>/g,"")},t.afterBlur(function(){t.plugin.hasContent()||$(t.edit.doc).find(".kindeditor-ph").show()}),t.afterFocus(function(){$(t.edit.doc).find(".kindeditor-ph").hide()}),t.afterCreate(function(){var e=t.options;e.placeholderHtml?t.setPlaceholder(e.placeholderHtml,!0):e.placeholder&&t.setPlaceholder(e.placeholder)})}),KindEditor.plugin("pasteimage",function(e){var t=this,n={zh_cn:{notSupportMsg:"您的浏览器不支持粘贴图片!",placeholder:"可以在编辑器直接贴图。",failMsg:"贴图失败,请稍后重试。",uploadingHint:"正在上传图片,请稍后..."},zh_tw:{notSupportMsg:"您的瀏覽器不支持粘貼圖片!",placeholder:"可以在編輯器直接貼圖。",failMsg:"貼圖失敗,請稍後重試。",uploadingHint:"正在上傳圖片,請稍後..."},en:{notSupportMsg:"Image is not allowed to paste in your browser!",placeholder:"Paste images here.",failMsg:"Pasting image failed. Try again later.",uploadingHint:"Uploading..."}},i=$.extend({},n[($.clientLang||$.zui.clientLang)()]);t.afterCreate(function(){var n=t.edit,a=n.doc,o=t.uuid,r=t.options.pasteImage;if(r){if("string"==typeof r&&(r={postUrl:r}),$.extend({placeholder:l},r),e.WEBKIT||e.GECKO||$(a.body).on("keyup.ke"+o,function(e){86==e.keyCode&&e.ctrlKey&&alert(i.notSupportMsg)}),t.setPlaceholder){var l=r.placeholder;if(l===!0&&(l=i.placeholder),l){var s=t.getPlaceholder();s?s.indexOf(l)<0&&(l=s+"\n"+l):s=l,t.setPlaceholder(l)}}var d=function(){r.beforePaste&&r.beforePaste();var e='

'+i.uploadingHint+"
";n.cmd.inserthtml(e),t.readonly(!0)},c=function(e){e&&(r.onError?r.onError(e):(e===!0&&(e=i.failMsg),$.zui&&$.zui.messager&&$.zui.messager.danger(e,{placement:"center"}))),r.afterPaste&&r.afterPaste(),$(a.body).find(".image-loading-ele").remove(),t.readonly(!1)},u=r.postUrl;$(a.body).on("paste.ke"+o,function(t){if(e.WEBKIT){var i=t.originalEvent,o=i.clipboardData&&i.clipboardData.items,r=null;if(o)for(var l=/^image\/(p?jpeg|gif|png)$/i,s=0;s';$.post(u,{editor:i},function(e){e?n.cmd.inserthtml(e):n.cmd.inserthtml(i),c()}).error(function(){c(!0)})},h.readAsDataURL(p)}else setTimeout(function(){var t=e(a.body).html();t.search(/"),n.html(e),c()}).error(function(){c(!0)}))},80)}),t.beforeRemove(function(){$(a.body).off(".ke"+o)})}})}),function(e){function t(t){var n=[],i=0,a=0;t.children("thead,tbody,tfoot").children("tr").each(function(t,o){e(o).children("td,th").each(function(o,r){var l,s,d=e(r),c=0|d.attr("colspan"),u=0|d.attr("rowspan");for(c=c?c:1,u=u?u:1;n[t]&&n[t][o];++o);for(l=o;ltr"),r=o.filter(function(){return!!this.style.backgroundColor}).length;t.stripedRows=r>=Math.floor(o/2)}if(s.tableSetting=t,void 0!==t.header){if(n.is(".ke-plugin-table-example"))n.find("thead").toggleClass("hidden",!t.header);else{var l=n.find("thead");if(t.header){if(!l.length){var d=["
"],c=n.find("tbody>tr:first").children(),u=0;c.each(function(){var e=$(this),t=e.attr("colspan");u+=t?parseInt(t):1});for(var p=0;p'+(e.IE?" ":"
")+"");d.push("
"),l=$(d.join("")),n.prepend(l)}}else l.remove()}i&&i("header",t.header)}if(void 0!==t.stripedRows){var o=n.find("tbody>tr");o.each(function(e){$(this).css("background-color",t.stripedRows&&e%2===0?"#f9f9f9":"none")}),i&&i("stripedRows",t.stripedRows)}void 0!==t.autoWidth&&(n.css(t.autoWidth?{width:"auto",maxWidth:"100%"}:{width:"100%"}),i&&i("autoWidth",t.autoWidth)),void 0!==t.borderColor&&(n.find("td,th").css("border-color",t.borderColor),i&&i("borderColor",t.borderColor))}}function r(t,n,i,a){if(t*n){for(var o=$('
'),r=$(""),l=0;l"),c=0;c'+(e.IE?" ":"
")+"");d.append(u)}r.append(d)}o.append(r);var p=$("
").append(o).html();return e.IE||(p+="
"),s.insertHtml(p),o}}function l(i){for(var a=$(i[0]),r=[""],l=[""],c=0;c<6;++c){r.push('{tableHead}'),l.push("");for(var u=0;u<6;++u)l.push('{tableContent}');l.push("")}r.push(""),l.push("");var f=['
','
','
','
',"",'
','
',"
",'
',"",'
','
',"
",'
',"",'
','{borderColor}','',"
","
","
",'
','',r.join(""),l.join(""),"
","","",""].join("").format(p),m=$(f),g=m.find(".ke-plugin-table-example"),v=s.cmd.range.createBookmark(),_=m.find(".ke-plugin-table-input-color"),b=e(_[0]);m.on("change.kTable","input[name]",function(){var e=$(this),t={};t[e.attr("name")]=e.is('[type="checkbox"]')?e.is(":checked"):e.val(),o(t,g)});var y=s.createDialog({name:d+"Dialog",width:550,title:s.lang(d),body:m[0],beforeRemove:function(){m.off(".kTable")},yesBtn:{name:s.lang("yes"),click:function(e){o({borderColor:m.find('[name="borderColor"]').val(),header:m.find('[name="header"]').is(":checked"),stripedRows:m.find('[name="stripedRows"]').is(":checked"),hoverRows:m.find('[name="hoverRows"]').is(":checked"),autoWidth:m.find('[name="autoWidth"]:checked').val()},a),s.hideDialog().focus(),s.cmd.range.moveToBookmark(v),s.cmd.select(),s.addBookmark()}}});n(y.div,b,function(e){o({borderColor:e},g)}),o(s.tableSetting,g,function(e,n){switch(e){case"borderColor":t(b,n||h);break;case"header":m.find('[name="header"]').prop("checked",!!n);break;case"stripedRows":m.find('[name="stripedRows"]').prop("checked",!!n);break;case"hoverRows":m.find('[name="hoverRows"]').prop("checked",!!n);break;case"autoWidth":m.find('[name="autoWidth"][value="'+(n?"auto":"")+'"]').prop("checked",!0)}})}var s=this,d="table",c={zh_cn:{name:"表格",xRxC:"{0}行 × {1}列",headerRow:"标题行",headerCol:"标题列",tableStyle:"表格样式",addHeaderRow:"添加表格标题行",stripedRows:"隔行变色效果",hoverRows:"鼠标悬停效果",autoChangeTableWidth:"自动调整表格尺寸",tableWidthFixed:"按表格文字自适应",tableWidthFull:"按页面宽度自适应",tableBorder:"表格边框",tableHead:"标题",tableContent:"内容",mergeCells:"合并单元格",defaultColor:"默认颜色",color:"颜色",forecolor:"文字颜色",backcolor:"背景颜色"},zh_tw:{name:"表格",xRxC:"{0}行×{1}列",headerRow:"標題行",headerCol:"標題列",tableStyle:"表格樣式",addHeaderRow:"添加表格標題行",stripedRows:"隔行變色效果",hoverRows:"鼠標懸停效果",autoChangeTableWidth:"自動調整表格尺寸",tableWidthFixed:"按表格文字自適應",tableWidthFull:"按頁面寬度自適應",tableBorder:"表格邊框",tableHead:"標題",tableContent:"內容",mergeCells:"合併單元格",defaultColor:"默認顏色",color:"顏色",forecolor:"文字顏色",backcolor:"背景顏色"},en:{name:"Table",xRxC:"{0} Rows × {1} Columns",headerRow:"Header Row",headerCol:"Header Column",tableStyle:"Table style",addHeaderRow:"Add header row",stripedRows:"Striped effection",hoverRows:"Mouse hover effection",autoChangeTableWidth:"Automatically adjust table size",tableWidthFixed:"Adaptive by form text",tableWidthFull:"Page width adaptive",tableBorder:"Table border",tableHead:"Title",tableContent:"Text",mergeCells:"Merge Cells",defaultColor:"Default color",color:"Color",forecolor:"Text Color",backcolor:"Back Color"}},u=[],p=$.extend({},s.lang("table."),c[($.clientLang||$.zui.clientLang)()]),h=s.options.tableBorderColor||"#ddd",f=[];if(!s.plugin.table){s.plugin.table={prop:function(){var e=s.plugin.getSelectedTable();e&&e.length&&l(e)},cellprop:function(){var i,a,o,r,r,l,c,u,f,m=['
','
','",'
','
',''+p.width+"",'','','","
","
",'
','
',''+p.height+"",'','','","
","
","
",'
','",'
','
',''+p.textAlign+"",'","
","
",'
','
',''+p.verticalAlign+"",'","
","
","
",'
','",'
','
',''+p.borderColor+"",'',"
","
",'
','
',''+p.size+"",'','px',"
","
","
",'
','",'
','
',''+p.forecolor+"",'',"
","
",'
','
',''+p.backcolor+"",'',"
","
","
","
"].join(""),g=s.cmd.range.createBookmark(),v=s.createDialog({name:d,width:500,title:s.lang("tablecell"),body:m,beforeRemove:function(){u.unbind()},yesBtn:{name:s.lang("yes"),click:function(t){var n=a.val(),i=o.val(),d=r.val(),p=heightTypeBox.val(),h=l.val(),m=c.val(),v=f.val()+"px",_=e(u[0]).val()||"",b=e(u[1]).val()||"",y=e(u[2]).val()||"";if(!/^\d*$/.test(n))return alert(s.lang("invalidWidth")),void a[0].focus();if(!/^\d*$/.test(i))return alert(s.lang("invalidHeight")),void o[0].focus();for(var k=s.plugin.getAllSelectedCells(),w={width:""!==n?n+d:"",height:""!==i?i+p:"","background-color":y,"text-align":h,"border-width":v,"vertical-align":m,"border-color":_,color:b},C=0;C'+(e.IE?" ":"
")+"",r=i(n,c,u)}s.cmd.range.selectNodeContents(o).collapse(!0),s.cmd.select(),s.addBookmark()},colinsertleft:function(){this.colinsert(0)},colinsertright:function(){this.colinsert(1)},rowinsert:function(t){var n=s.plugin.getSelectedTable()[0],i=s.plugin.getSelectedRow()[0],a=s.plugin.getSelectedCell()[0],o=i.rowIndex;1===t&&(o=i.rowIndex+(a.rowSpan-1)+t);for(var r=n.insertRow(o),l="THEAD"===r.parentNode.tagName,d=0,c=i.cells.length;d1&&(c-=i.cells[d].rowSpan-1);var u=r.insertCell(d);1===t&&i.cells[d].colSpan>1&&(u.colSpan=i.cells[d].colSpan),u.outerHTML="<"+(l?"th":"td")+' style="border: 1px solid '+(s.tableSetting&&s.tableSetting.borderColor||h)+'">'+(e.IE?" ":"
")+""}for(var p=o;p>=0;p--){var f=n.rows[p].cells;if(f.length>d){for(var m=a.cellIndex;m>=0;m--)f[m].rowSpan>1&&(f[m].rowSpan+=1);break}}s.cmd.range.selectNodeContents(a).collapse(!0),s.cmd.select(),s.addBookmark()},rowinsertabove:function(){this.rowinsert(0)},rowinsertbelow:function(){this.rowinsert(1)},rowmerge:function(){var e=s.plugin.getSelectedTable()[0],t=s.plugin.getSelectedRow()[0],n=s.plugin.getSelectedCell()[0],i=t.rowIndex,a=i+n.rowSpan,o=e.rows[a];if(!(e.rows.length<=a)){var r=n.cellIndex;if(!(o.cells.length<=r)){var l=o.cells[r];n.colSpan===l.colSpan&&(n.rowSpan+=l.rowSpan,o.deleteCell(r),s.cmd.range.selectNodeContents(n).collapse(!0),s.cmd.select(),s.addBookmark())}}},colmerge:function(){var e=(s.plugin.getSelectedTable()[0],s.plugin.getSelectedRow()[0]),t=s.plugin.getSelectedCell()[0],n=(e.rowIndex,t.cellIndex),i=n+1;if(!(e.cells.length<=i)){var a=e.cells[i];t.rowSpan===a.rowSpan&&(t.colSpan+=a.colSpan,e.deleteCell(i),s.cmd.range.selectNodeContents(t).collapse(!0),s.cmd.select(),s.addBookmark())}},mergeCells:function(){var e=s.tableSelectionRange;if(e){var t,n=s.plugin.getSelectedTable()[0],i=$(n),a=e.top,o=e.left,r=e.right,l=e.bottom;i.children("thead,tbody,tfoot").children("tr").each(function(){$(this).children("td,th").each(function(){var e=$(this),n=e.cellPos();n.left===o&&n.top===a?t=e:n.right>=o&&n.left<=r&&n.bottom>=a&&n.top<=l&&e.addClass("ke-cell-removed")})}),t&&(t.attr({rowspan:l-a+1,colspan:r-o+1}),i.find(".ke-cell-removed").remove(),s.cmd.range.selectNodeContents(t[0]).collapse(!0),s.cmd.select(),s.addBookmark())}},rowsplit:function(){var t=s.plugin.getSelectedTable()[0],n=s.plugin.getSelectedRow()[0],a=s.plugin.getSelectedCell()[0],o=n.rowIndex;if(1!==a.rowSpan){for(var r=i(t,n,a),l=1,d=a.rowSpan;l1&&(u.colSpan=a.colSpan),u.innerHTML=e.IE?" ":"
",r=i(t,c,u)}e(a).removeAttr("rowSpan"),s.cmd.range.selectNodeContents(a).collapse(!0),s.cmd.select(),s.addBookmark()}},colsplit:function(){var t=(s.plugin.getSelectedTable()[0],s.plugin.getSelectedRow()[0]),n=s.plugin.getSelectedCell()[0],i=n.cellIndex;if(1!==n.colSpan){for(var a=1,o=n.colSpan;a1&&(r.rowSpan=n.rowSpan),r.innerHTML=e.IE?" ":"
"}e(n).removeAttr("colSpan"),s.cmd.range.selectNodeContents(n).collapse(!0),s.cmd.select(),s.addBookmark()}},coldelete:function(){var t=s.plugin.getSelectedTable()[0],n=s.plugin.getAllSelectedCells();if(n.length){for(var i=0;i1?(u.colSpan-=1,1===u.colSpan&&e(u).removeAttr("colSpan")):c.deleteCell(r),u.rowSpan>1&&(l+=u.rowSpan-1)}if(0===o.cells.length){s.cmd.range.setStartBefore(t).collapse(!0),s.cmd.select(),e(t).remove();break}}}t.parentNode&&s.cmd.selection(!0),s.addBookmark()}},rowdelete:function(){var t=s.plugin.getSelectedTable()[0],n=s.plugin.getAllSelectedCells();if(n.length){for(var i=0;i=0;r--)t.deleteRow(o.rowIndex+r)}0===t.rows.length?(s.cmd.range.setStartBefore(t).collapse(!0),s.cmd.select(),e(t).remove()):s.cmd.selection(!0),s.addBookmark()}}},s.plugin.getSelectedTable=function(){return e($(s.cmd.range.startContainer).closest("table")[0])},s.plugin.getSelectedRow=function(){return e($(s.cmd.range.startContainer).closest("tr")[0])},s.plugin.getSelectedCell=function(){return e($(s.cmd.range.startContainer).closest("td,th")[0])},s.plugin.getSelectedCells=function(){var t=s.plugin.getSelectedTable();if(t&&t.length){var n=e(".ke-select-cell",t.get(0));if(n&&n.length>1)return n}},s.plugin.getSingleSelectedCell=function(){var e=s.plugin.getSelectedCells();if(!(e&&e.length>1))return s.plugin.getSelectedCell()},s.plugin.getAllSelectedCells=function(){var e=s.plugin.getSelectedCells();return e&&e.length?e:s.plugin.getSelectedCell()};var m={mergeCells:"ke-icon-tablecolmerge"};e.each("prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,mergeCells,rowmerge,colmerge,rowsplit,colsplit,coldelete,rowdelete,delete".split(","),function(t,n){var i;i="prop"===n||"delete"===n?s.plugin.getSelectedTable:"mergeCells"===n?s.plugin.getSelectedCells:"rowmerge"===n?function(){var e=s.plugin.getSingleSelectedCell();if(e&&e.length&&$(e.get(0)).parent().next("tr").length)return e; }:"colmerge"===n?function(){var e=s.plugin.getSingleSelectedCell();if(e&&e.length&&$(e.get(0)).next("th,td").length)return e}:"rowsplit"===n?function(){var e=s.plugin.getSingleSelectedCell();if(e&&e.get(0).rowSpan>1)return e}:"colsplit"===n?function(){var e=s.plugin.getSingleSelectedCell();if(e&&e.get(0).colSpan>1)return e}:e.inArray(n,["colinsertleft","colinsertright","rowinsertabove","rowinsertbelow"])>-1?s.plugin.getSingleSelectedCell:s.plugin.getSelectedCell,s.addContextmenu({title:p[n]||s.lang("table"+n),click:function(){s.loadPlugin("table",function(){s.plugin.table[n](),s.hideMenu()})},cond:i,width:170,iconClass:m[n]||"ke-icon-table"+n})})}s.clickToolbar(d,function(){if(!s.menu){var e=s.createMenu({name:d,beforeRemove:function(){a()}}),t=$('
'),n=$('
'+p.xRxC.format(0,0)+"
");t.append(n);var i=$('
');i.on("mouseenter.kTable",".ke-plugin-table-grid-cell",function(){var e=$(this),t=e.data("row"),a=e.data("col");n.text(p.xRxC.format(t,a));var o=i.find(".ke-plugin-table-grid-cell");o.each(function(){var e=$(this),n=e.data("row"),i=e.data("col");n<=t&&i<=a?e.css({border:"1px solid #2286d2",background:"#eff7ff"}):e.css({border:"1px solid #ddd",background:"#f1f1f1"})})}).on("click.kTable",".ke-plugin-table-grid-cell",function(e){var t=$(this),n=t.data("row"),i=t.data("col");r(n,i),s.hideMenu().focus(),s.addBookmark(),e.stopPropagation()});for(var o=1;o<11;o++)for(var l=1;l<11;l++)i.append('
');u.push(i),t.append(i),e.div.append(t[0])}}),s.afterTab(function(){var e=s.plugin.getSelectedCell();if(e&&e.length){var t=function(e){if(e.length){var t=e.next();if(t.is("td,th")||(t=e.parent().next("tr").children("th,td").first()),t.is("td,th")||(t=e.closest("tbody,tfoot,thead").next().children("tr").first().children("th,td").first()),t.length)return s.cmd.range.selectNode(t[0]),s.cmd.select(),!0}return!1},n=$(e.get(0));if(n.length)return t(n)||(s.plugin.table.rowinsertbelow(),t(n)),!0}return!1});var g=function(e,t,n){var i=n?Math.min(t.top,n.top):t.top,a=n?Math.min(t.left,n.left):t.left,o=n?Math.max(t.bottom,n.bottom):t.bottom,r=n?Math.max(t.right,n.right):t.right;if(i===o&&a===r)return!1;for(var l=!1,d=!1,c=e.children("thead,tbody,tfoot").children("tr").each(function(){$(this).children("td,th").each(function(){var e=$(this),t=e.cellPos();t.right>=a&&t.left<=r&&t.bottom>=i&&t.top<=o&&(i=Math.min(i,t.top),a=Math.min(a,t.left),o=Math.max(o,t.bottom),r=Math.max(r,t.right),e.addClass("ke-select-cell"),l=!0,d=!0)})});d;)d=!1,c.each(function(){$(this).children("td,th").each(function(){var e=$(this);if(!e.hasClass("ke-select-cell")){var t=e.cellPos();t.right>=a&&t.left<=r&&t.bottom>=i&&t.top<=o&&(i=Math.min(i,t.top),a=Math.min(a,t.left),o=Math.max(o,t.bottom),r=Math.max(r,t.right),e.addClass("ke-select-cell"),d=!0)}})});var u=e.find(".ke-select-cell");return 1===u.length&&(u.removeClass("ke-select-cell"),l=!1),l?s.tableSelectionRange={top:i,left:a,bottom:o,right:r}:s.tableSelectionRange=null,l},v=function(e,t){return g(e,{left:0,right:e.data("tableSize").width-1,top:t,bottom:t})},_=function(e,t){return g(e,{left:t,right:t,top:0,bottom:e.data("tableSize").height-1})};s.afterCreate(function(){var e=!1,t=null,n=null,i=null,a=null,o=function(){e=!1,t=null,a=null};$(s.edit.doc.body).on("mousedown.ke"+s.uuid,function(n){var a=$(n.target).closest("td,th"),o=a.closest("table"),r=!1;a.length&&o.length&&(t=o,e=!0,i=a.cellPos(!0),r=3===n.which,o.removeClass("ke-select-cells")),r||($(s.edit.doc).find(".ke-select-cell").removeClass("ke-select-cell"),s.tableSelectionRange=null)}).on("mousemove.ke"+s.uuid,function(o){var r=$(o.target).closest("td,th");if(!r.length)return e?o.preventDefault():null;var l=r.closest("table");if(!l.length)return e?o.preventDefault():null;if(l.removeClass("ke-select-row ke-select-col ke-select-cells"),a=r.cellPos(),e){if(l[0]!==t[0])return o.preventDefault();$(s.edit.doc).find("table").find(".ke-select-cell").removeClass("ke-select-cell"),g(l,i,a)&&(l.addClass("ke-select-cells"),o.preventDefault())}else{n=l;var d=l.offset(),c=o.pageX,u=o.pageY,p=c-d.left,h=u-d.top;p<8?(l.addClass("ke-select-row"),a.selectRow=a.top,o.preventDefault(),o.stopPropagation()):h<8&&(l.addClass("ke-select-col"),a.selectCol=a.left,o.preventDefault(),o.stopPropagation())}}).on("mouseup.ke"+s.uuid,function(e){var t=$(e.target),i=t.closest("td,th");i.length&&(a&&void 0!==a.selectRow?(v(n,a.selectRow),e.stopPropagation()):a&&void 0!==a.selectCol&&(_(n,a.selectCol),e.stopPropagation())),o()}).on("paste.ke"+s.uuid+" keydown.ke"+s.uuid,function(){$(s.edit.doc).find("table").removeClass("ke-select-row ke-select-col").find(".ke-select-cell").removeClass("ke-select-cell")}),$(document).on("mouseup.ke"+s.uuid,function(){o()}),$(s.edit.doc.head).append([""].join(""));var r=s.cmd.toggle,l=function(e,t,n){var i=this;return void 0!==n&&null!==n||(n=i.commonNode(t)),n?i.remove(t):i.wrap(e),i.select()},d=function(e,t,n){var i=s.cmd.range;if(i&&i.endContainer){var a=$(i.endContainer).closest("th,td");if(!a.length)return;var o=a.closest("table");if(!o.length)return;var r=o.children("thead,tbody,tfoot").children("tr").children(".ke-select-cell");if(r.length)return t&&t(a,o),r.each(e),n&&n(a,o),i.selectNodeContents(a[0]),s.cmd.select(),s.focus(),!0}};s.cmd.toggle=function(e,t){var n;if(!d(function(){s.cmd.range.selectNodeContents(this),s.cmd.select(),l.call(s.cmd,e,t,n)},function(e){s.cmd.range.selectNodeContents(e[0]),s.cmd.select(),n=!!s.cmd.commonNode(t)}))return r.call(s.cmd,e,t)};var c=",justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,",u=s.clickToolbar;s.clickToolbar=function(e,t){if(!(void 0===t&&c.indexOf(","+e+",")>-1&&d(function(){s.cmd.range.selectNode(this),s.cmd.select(),u.call(s,e,t)})))return u.call(s,e,t)}}),s.beforeRemove(function(){$(s.edit.doc.body).off(".ke"+s.uuid),$(document).off(".ke"+s.uuid)})}),KindEditor.lang({table:KindEditor.lang("table")}); \ No newline at end of file diff --git a/src/js/kindeditor/plugins/advance-table.js b/src/js/kindeditor/plugins/advance-table.js index bd65071fa0403ea25cacccad491a09779c859b9f..2c8a08d172219fbd314a2053078d774edcd9606e 100644 --- a/src/js/kindeditor/plugins/advance-table.js +++ b/src/js/kindeditor/plugins/advance-table.js @@ -891,7 +891,7 @@ KindEditor.plugin('table', function (K) { // 获取用户拖选的单元格 self.plugin.getSelectedCells = function () { var table = self.plugin.getSelectedTable(); - if (table.length) { + if (table && table.length) { var cells = K('.ke-select-cell', table.get(0)); if (cells && cells.length > 1) { return cells; diff --git a/src/js/kindeditor/plugins/paste-image.js b/src/js/kindeditor/plugins/paste-image.js index 84cddae471c3bf3db9b39c5c16ccc89fa9be0e2c..015ebeecfe22939764cf104d3734ddaff1e99031 100644 --- a/src/js/kindeditor/plugins/paste-image.js +++ b/src/js/kindeditor/plugins/paste-image.js @@ -58,6 +58,7 @@ KindEditor.plugin('pasteimage', function(K) { var oldPlaceholder = self.getPlaceholder(); if (!oldPlaceholder) oldPlaceholder = placeholder; else if (oldPlaceholder.indexOf(placeholder) < 0) placeholder = oldPlaceholder + '\n' + placeholder; + self.setPlaceholder(placeholder); } }