!function(a){"function"==typeof window.define?window.define.amd?window.define("wangEditor",["jquery"],a):window.define.cmd?window.define(function(){return a}):a(window.jQuery):"object"==typeof module&&"object"==typeof module.exports?(window.wangEditorCssPath?require(window.wangEditorCssPath):require("../css/wangEditor.css"),module.exports=a(window.wangEditorJQueryPath?require(window.wangEditorJQueryPath):require("jquery"))):a(window.jQuery)}(function(a){if(!a||!a.fn||!a.fn.jquery)return alert("在引用wangEditor.js之前,先引用jQuery,否则无法使用 wangEditor"),void 0;var b=function(b){var c=window.wangEditor;c&&b(c,a)};return function(a,b){if(a.wangEditor)return alert("一个页面不能重复引用 wangEditor.js 或 wangEditor.min.js !!!"),void 0;var c=function(a){var c,d;"string"==typeof a&&(a="#"+a),c=b(a),1===c.length&&(d=c[0].nodeName,("TEXTAREA"===d||"DIV"===d)&&(this.valueNodeName=d.toLowerCase(),this.$valueContainer=c,this.$prev=c.prev(),this.$parent=c.parent(),this.init()))};c.fn=c.prototype,c.$body=b("body"),c.$document=b(document),c.$window=b(a),c.userAgent=navigator.userAgent,c.getComputedStyle=a.getComputedStyle,c.w3cRange="function"==typeof document.createRange,c.hostname=location.hostname.toLowerCase(),c.websiteHost="wangeditor.github.io|www.wangeditor.com|wangeditor.coding.me",c.isOnWebsite=c.websiteHost.indexOf(c.hostname)>=0,c.docsite="http://www.kancloud.cn/wangfupeng/wangeditor2/113961",a.wangEditor=c,c.plugin=function(a){c._plugins||(c._plugins=[]),"function"==typeof a&&c._plugins.push(a)}}(window,a),b(function(a){a.fn.init=function(){this.initDefaultConfig(),this.addEditorContainer(),this.addTxt(),this.addMenuContainer(),this.menus={},this.commandHooks()}}),b(function(a,b){a.fn.ready=function(a){this.readyFns||(this.readyFns=[]),this.readyFns.push(a)},a.fn.readyHeadler=function(){for(var a=this.readyFns;a.length;)a.shift().call(this)},a.fn.updateValue=function(){var d,a=this,b=a.$valueContainer,c=a.txt.$txt;b!==c&&(d=c.html(),b.val(d))},a.fn.getInitValue=function(){var a=this,b=a.$valueContainer,c="",d=a.valueNodeName;return"div"===d?c=b.html():"textarea"===d&&(c=b.val()),c},a.fn.updateMenuStyle=function(){var a=this.menus;b.each(a,function(a,b){b.updateSelected()})},a.fn.enableMenusExcept=function(a){this._disabled||(a=a||[],"string"==typeof a&&(a=[a]),b.each(this.menus,function(b,c){a.indexOf(b)>=0||c.disabled(!1)}))},a.fn.disableMenusExcept=function(a){this._disabled||(a=a||[],"string"==typeof a&&(a=[a]),b.each(this.menus,function(b,c){a.indexOf(b)>=0||c.disabled(!0)}))},a.fn.hideDropPanelAndModal=function(){var a=this.menus;b.each(a,function(a,b){var c=b.dropPanel||b.dropList||b.modal;c&&c.hide&&c.hide()})}}),b(function(a,b){function d(){}var c=!a.w3cRange;a.fn.currentRange=function(a){return a?(this._rangeData=a,void 0):this._rangeData},a.fn.collapseRange=function(a,b){b=b||"end",b="start"===b?!0:!1,a=a||this.currentRange(),a&&(a.collapse(b),this.currentRange(a))},a.fn.getRangeText=c?d:function(a){return(a=a||this.currentRange())?a.toString():void 0},a.fn.getRangeElem=c?d:function(a){a=a||this.currentRange();var b=a.commonAncestorContainer;return 1===b.nodeType?b:b.parentNode},a.fn.isRangeEmpty=c?d:function(a){return a=a||this.currentRange(),a&&a.startContainer&&a.startContainer===a.endContainer&&a.startOffset===a.endOffset?!0:!1},a.fn.saveSelection=c?d:function(a){var d,e,c=this,f=c.txt.$txt.get(0);a?d=a.commonAncestorContainer:(e=document.getSelection(),e.getRangeAt&&e.rangeCount&&(a=document.getSelection().getRangeAt(0),d=a.commonAncestorContainer)),d&&(b.contains(f,d)||f===d)&&c.currentRange(a)},a.fn.restoreSelection=c?d:function(b){var c;if(b=b||this.currentRange())try{c=document.getSelection(),c.removeAllRanges(),c.addRange(b)}catch(d){a.error("执行 editor.restoreSelection 时,IE可能会有异常,不影响使用")}},a.fn.restoreSelectionByElem=c?d:function(a,b){a&&(b=b||"end",this.setRangeByElem(a),"start"===b&&this.collapseRange(this.currentRange(),"start"),"end"===b&&this.collapseRange(this.currentRange(),"end"),this.restoreSelection())},a.fn.initSelection=c?d:function(){var c,d,a=this;a.currentRange()||(c=a.txt.$txt,d=c.children().first(),d.length&&a.restoreSelectionByElem(d.get(0)))},a.fn.setRangeByElem=c?d:function(a){var e,f,g,c=this,d=c.txt.$txt.get(0);if(a&&b.contains(d,a)){for(e=a.firstChild;e&&3!==e.nodeType;)e=e.firstChild;for(f=a.lastChild;f&&3!==f.nodeType;)f=f.lastChild;g=document.createRange(),e&&f?(g.setStart(e,0),g.setEnd(f,f.textContent.length)):(g.setStart(a,0),g.setEnd(a,0)),c.saveSelection(g)}}}),b(function(a,b){a.w3cRange||(a.fn.getRangeText=function(a){return(a=a||this.currentRange())?a.text:void 0},a.fn.getRangeElem=function(a){if(a=a||this.currentRange()){var b=a.parentElement();return 1===b.nodeType?b:b.parentNode}},a.fn.isRangeEmpty=function(a){return a=a||this.currentRange(),a&&a.text?!1:!0},a.fn.saveSelection=function(a){var d,c=this,f=c.txt.$txt.get(0);a?d=a.parentElement():(a=document.selection.createRange(),d="undefined"==typeof a.parentElement?null:a.parentElement()),d&&(b.contains(f,d)||f===d)&&c.currentRange(a)},a.fn.restoreSelection=function(a){var d,b=this;if(a=a||b.currentRange()){d=document.selection.createRange();try{d.setEndPoint("EndToEnd",a)}catch(e){}if(0===a.text.length)try{d.collapse(!1)}catch(e){}else d.setEndPoint("StartToStart",a);d.select()}})}),b(function(a,b){a.fn.commandHooks=function(){var a=this,c={};c.insertHtml=function(c){var d=b(c),e=a.getRangeElem(),f=a.getLegalTags(e);f&&b(f).after(d)},a.commandHooks=c}}),b(function(a){a.fn.command=function(a,b,c,d){function g(){b&&(e.queryCommandSupported(b)?document.execCommand(b,!1,c):(f=e.commandHooks,b in f&&f[b](c)))}var f,e=this;this.customCommand(a,g,d)},a.fn.commandForElem=function(a,b,c,d,e){var f,g,h;"string"==typeof a?f=a:(f=a.selector,g=a.check),h=this.getRangeElem(),h=this.getSelfOrParentByName(h,f,g),h&&this.setRangeByElem(h),this.command(b,c,d,e)},a.fn.customCommand=function(a,b,c){function f(){d.hideDropPanelAndModal()}var d=this,e=d.currentRange();return e?(d.undoRecord(),this.restoreSelection(e),b.call(d),this.saveSelection(),this.restoreSelection(),c&&"function"==typeof c&&c.call(d),d.txt.insertEmptyP(),d.txt.wrapImgAndText(),d.updateValue(),d.updateMenuStyle(),setTimeout(f,200),a&&a.preventDefault(),void 0):(a&&a.preventDefault(),void 0)},a.fn.queryCommandValue=function(a){var b="";try{b=document.queryCommandValue(a)}catch(c){}return b},a.fn.queryCommandState=function(a){var b=!1;try{b=document.queryCommandState(a)}catch(c){}return b},a.fn.queryCommandSupported=function(a){var b=!1;try{b=document.queryCommandSupported(a)}catch(c){}return b}}),b(function(a,b){function d(a){var c=this,d=b(a),e=!1;return d.each(function(){return this===c?(e=!0,!1):void 0}),e}var c;a.fn.getLegalTags=function(b){var c=this.config.legalTags;return c?this.getSelfOrParentByName(b,c):(a.error("配置项中缺少 legalTags 的配置"),void 0)},a.fn.getSelfOrParentByName=function(a,e,f){if(a&&e){c||(c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector),c||(c=d);for(var g=this.txt.$txt.get(0);a&&g!==a&&b.contains(g,a);){if(c.call(a,e)){if(!f)return a;if(f(a))return a}a=a.parentNode}}}}),b(function(a){function d(a){return null==a._redoList&&(a._redoList=[]),a._redoList}function e(a){return null==a._undoList&&(a._undoList=[]),a._undoList}function f(a,b,c){var d=b.val,e=a.txt.$txt.html();if(null!=d){if(d===e)return"redo"===c?(a.redo(),void 0):"undo"===c?(a.undo(),void 0):void 0;a.txt.$txt.html(d),a.updateValue(),a.onchange&&"function"==typeof a.onchange&&a.onchange.call(a)}}var c=20;a.fn.undoRecord=function(){var a=this,b=a.txt.$txt,f=b.html(),g=e(a),h=d(a),i=g.length?g[0]:"";f!==i.val&&(h.length&&(h=[]),g.unshift({range:a.currentRange(),val:f}),g.length>c&&g.pop())},a.fn.undo=function(){var g,a=this,b=e(a),c=d(a);b.length&&(g=b.shift(),c.unshift(g),f(this,g,"undo"))},a.fn.redo=function(){var g,a=this,b=e(a),c=d(a);c.length&&(g=c.shift(),b.unshift(g),f(this,g,"redo"))}}),b(function(a,b){a.fn.create=function(){var d,c=this;a.$body&&0!==a.$body.length||(a.$body=b("body"),a.$document=b(document),a.$window=b(window)),c.addMenus(),c.renderMenus(),c.renderMenuContainer(),c.renderTxt(),c.renderEditorContainer(),c.eventMenus(),c.eventMenuContainer(),c.eventTxt(),c.readyHeadler(),c.initSelection(),c.$txt=c.txt.$txt,d=a._plugins,d&&d.length&&b.each(d,function(a,b){b.call(c)})},a.fn.disable=function(){this.txt.$txt.removeAttr("contenteditable"),this.disableMenusExcept(),this._disabled=!0},a.fn.enable=function(){this._disabled=!1,this.txt.$txt.attr("contenteditable","true"),this.enableMenusExcept()},a.fn.destroy=function(){var a=this,b=a.$valueContainer,c=a.$editorContainer,d=a.valueNodeName;"div"===d?(b.removeAttr("contenteditable"),c.after(b),c.hide()):(b.show(),c.hide())},a.fn.undestroy=function(){var a=this,b=a.$valueContainer,c=a.$editorContainer,d=a.menuContainer.$menuContainer,e=a.valueNodeName;"div"===e?(b.attr("contenteditable","true"),d.after(b),c.show()):(b.hide(),c.show())},a.fn.clear=function(){var a=this,b=a.txt.$txt;b.html("
'+f+"
"),a.$body.append(h),e.ready(function(){var b=h.outerWidth()+5,c=g.outerWidth(),e=parseFloat(g.css("margin-left"),10);h.remove(),h=null,g.css({width:b,"margin-left":e+(c-b)/2}),d.tipWidth=b})),g.append(f),c.append(g),c.find("a").on("mouseenter",function(){d.active()||d.disabled()||(k=setTimeout(i,200))}).on("mouseleave",function(){k&&clearTimeout(k),j()}).on("click",j)},c.fn.bindEvent=function(){var f,b=this,c=b.$domNormal,d=b.$domSelected,e=b.clickEvent;e||(e=function(c){var e,f,g,h,d=b.dropPanel||b.dropList||b.modal;return d&&d.show?(d.isShowing?d.hide():d.show(),void 0):(e=b.editor,h=b.selected,h?(f=b.commandNameSelected,g=b.commandValueSelected):(f=b.commandName,g=b.commandValue),f?e.command(c,f,g):(a.warn('菜单 "'+b.id+'" 未定义click事件'),c.preventDefault()),void 0)}),f=b.clickEventSelected||e,c.click(function(a){b.disabled()||(e.call(b,a),b.updateSelected()),a.preventDefault()}),d.click(function(a){b.disabled()||(f.call(b,a),b.updateSelected()),a.preventDefault()})},c.fn.updateSelected=function(){var c,d,a=this;a.editor,c=a.updateSelectedEvent,c||(c=function(){var a=this,b=a.editor,c=a.commandName,d=a.commandValue;if(d){if(b.queryCommandValue(c).toLowerCase()===d.toLowerCase())return!0}else if(b.queryCommandState(c))return!0;return!1}),d=c.call(a),d=!!d,a.changeSelectedState(d)},c.fn.changeSelectedState=function(a){var b=this,c=b.selected;if(null!=a&&"boolean"==typeof a){if(c===a)return;b.selected=a,a?(b.$domNormal.hide(),b.$domSelected.show()):(b.$domNormal.show(),b.$domSelected.hide())}},c.fn.active=function(a){return null==a?this._activeState:(this._activeState=a,void 0)},c.fn.activeStyle=function(a){var c,d;this.selected,c=this.$domNormal,d=this.$domSelected,a?(c.addClass("active"),d.addClass("active")):(c.removeClass("active"),d.removeClass("active")),this.active(a)},c.fn.disabled=function(a){var b,c;return null==a?!!this._disabled:(this._disabled!==a&&(b=this.$domNormal,c=this.$domSelected,a?(b.addClass("disable"),c.addClass("disable")):(b.removeClass("disable"),c.removeClass("disable")),this._disabled=a),void 0)}}),b(function(a){var c=function(a,b,c){this.editor=a,this.menu=b,this.data=c.data,this.tpl=c.tpl,this.selectorForELemCommand=c.selectorForELemCommand,this.beforeEvent=c.beforeEvent,this.afterEvent=c.afterEvent,this.init()};c.fn=c.prototype,a.DropList=c}),b(function(a,b){var c=a.DropList;c.fn.init=function(){var a=this;a.initDOM(),a.bindEvent(),a.initHideEvent()},c.fn.initDOM=function(){var f,g,a=this,c=a.data,d=a.tpl||"{#title}",e=b('');b.each(c,function(a,c){f=d.replace(/{#commandValue}/gi,a).replace(/{#title}/gi,c),g=b(''),g.append(f),e.append(g)}),a.$list=e},c.fn.bindEvent=function(){var a=this,c=a.editor,d=a.menu,e=d.commandName,f=a.selectorForELemCommand,g=a.$list,h=a.beforeEvent,i=a.afterEvent;g.on("click","a[commandValue]",function(a){h&&"function"==typeof h&&h.call(a);var g=b(a.currentTarget).attr("commandValue");d.selected&&c.isRangeEmpty()&&f?c.commandForElem(f,a,e,g):c.command(a,e,g),i&&"function"==typeof i&&i.call(a)})},c.fn.initHideEvent=function(){var c=this,d=c.$list.get(0);a.$body.on("click",function(a){var e,f,g;c.isShowing&&(e=a.target,f=c.menu,g=f.selected?f.$domSelected.get(0):f.$domNormal.get(0),g===e||b.contains(g,e)||d===e||b.contains(d,e)||c.hide())}),a.$window.scroll(function(){c.hide()}),a.$window.on("resize",function(){c.hide()})}}),b(function(a){var c=a.DropList;c.fn._render=function(){var a=this,b=a.editor,c=a.$list;b.$editorContainer.append(c),a.rendered=!0},c.fn._position=function(){var a=this,b=a.$list,c=a.editor,d=a.menu,e=c.menuContainer.$menuContainer,f=d.selected?d.$domSelected:d.$domNormal,g=f.offsetParent().position(),h=g.top,i=g.left,j=f.offsetParent().height(),k=f.offsetParent().width(),l=b.outerWidth(),m=c.txt.$txt.outerWidth(),n=h+j,o=i+k/2,p=0-k/2,q=o+l-m;q>-10&&(p=p-q-10),b.css({top:n,left:o,"margin-left":p}),c._isMenufixed&&(n+=e.offset().top+e.outerHeight()-b.offset().top,b.css({top:n}))},c.fn.show=function(){var c,a=this,b=a.menu;a.rendered||a._render(),a.isShowing||(c=a.$list,c.show(),a._position(),a.isShowing=!0,b.activeStyle(!0))},c.fn.hide=function(){var c,a=this,b=a.menu;a.isShowing&&(c=a.$list,c.hide(),a.isShowing=!1,b.activeStyle(!1))}}),b(function(a){var c=function(a,b,c){this.editor=a,this.menu=b,this.$content=c.$content,this.width=c.width||200,this.height=c.height,this.onRender=c.onRender,this.init()};c.fn=c.prototype,a.DropPanel=c}),b(function(a,b){var c=a.DropPanel;c.fn.init=function(){var a=this;a.initDOM(),a.initHideEvent()},c.fn.initDOM=function(){var a=this,c=a.$content,d=a.width,e=a.height,f=b(''),g=b('');f.css({width:d,height:e?e:"auto"}),f.append(g),f.append(c),a.$panel=f,a.$triangle=g},c.fn.initHideEvent=function(){var c=this,d=c.$panel.get(0);a.$body.on("click",function(a){var e,f,g;c.isShowing&&(e=a.target,f=c.menu,g=f.selected?f.$domSelected.get(0):f.$domNormal.get(0),g===e||b.contains(g,e)||d===e||b.contains(d,e)||c.hide())}),a.$window.scroll(function(){c.hide()}),a.$window.on("resize",function(){c.hide()})}}),b(function(a,b){var c=a.DropPanel;c.fn._render=function(){var a=this,b=a.onRender,c=a.editor,d=a.$panel;c.$editorContainer.append(d),b&&b.call(a),a.rendered=!0},c.fn._position=function(){var s,a=this,b=a.$panel,c=a.$triangle,d=a.editor,e=d.menuContainer.$menuContainer,f=a.menu,g=f.selected?f.$domSelected:f.$domNormal,h=g.offsetParent().position(),i=h.top,j=h.left,k=g.offsetParent().height(),l=g.offsetParent().width(),m=b.outerWidth(),n=d.txt.$txt.outerWidth(),o=i+k,p=j+l/2,q=0-m/2,r=q;0-q>p-10&&(q=0-(p-10)),s=p+m+q-n,s>-10&&(q=q-s-10),b.css({top:o,left:p,"margin-left":q}),d._isMenufixed&&(o+=e.offset().top+e.outerHeight()-b.offset().top,b.css({top:o})),c.css({"margin-left":r-q-5})},c.fn.focusFirstInput=function(){var a=this,c=a.$panel;c.find("input[type=text],textarea").each(function(){var a=b(this);return null==a.attr("disabled")?(a.focus(),!1):void 0})},c.fn.show=function(){var d,b=this,c=b.menu;b.rendered||b._render(),b.isShowing||(d=b.$panel,d.show(),b._position(),b.isShowing=!0,c.activeStyle(!0),a.w3cRange?b.focusFirstInput():a.placeholderForIE8(d))},c.fn.hide=function(){var c,a=this,b=a.menu;a.isShowing&&(c=a.$panel,c.hide(),a.isShowing=!1,b.activeStyle(!1))}}),b(function(a){var c=function(a,b,c){this.editor=a,this.menu=b,this.$content=c.$content,this.init()};c.fn=c.prototype,a.Modal=c}),b(function(a,b){var c=a.Modal;c.fn.init=function(){var a=this;a.initDom(),a.initHideEvent()},c.fn.initDom=function(){var a=this,c=a.$content,d=b(''),e=b('"+g.html()+"
");g.after(a),g.remove()}}var d,e,f,g;a.config.legalTags,d=this,e=d.editor,f=d.$txt,f.on("keydown keyup",function(a){var c,d,f,i;if(13===a.keyCode&&(c=e.getRangeElem(),d=e.getLegalTags(c),!d)){if(d=e.getSelfOrParentByName(c,"div"),!d)return;f=b(d),"keydown"===a.type&&(g=f,setTimeout(h,0)),"keyup"===a.type&&(i=b(""+f.html()+"
"),f.after(i),f.remove(),e.restoreSelectionByElem(i.get(0),"start"))}})},c.fn.bindEnterForText=function(){var c,a=this,b=a.$txt;b.on("keyup",function(b){13===b.keyCode&&(c||(c=function(){a.wrapImgAndText()}),setTimeout(c))})},c.fn.bindTabEvent=function(){var a=this,b=a.editor,c=a.$txt;c.on("keydown",function(a){9===a.keyCode&&b.queryCommandSupported("insertHtml")&&b.command(a,"insertHtml"," ")})},c.fn.bindPasteFilter=function(){function h(a){var c,e,f,k;if(a&&a.nodeType&&a.nodeName&&(e=a.nodeName.toLowerCase(),f=a.nodeType,3===f||1===f)){if(c=b(a),"div"===e)return k=[],b.each(a.childNodes,function(a,b){k.push(b)}),b.each(k,function(){h(this)}),void 0;if(g.indexOf(e)>=0)d+=i(a);else if(3===f)d+=""+a.textContent+"
";else if("br"===e)d+=""+g+"
")}else if(j&&j.getData)g=j.getData("text/html"),g?(i=b(""),d="
"+g+"
",d=d.replace(/(https?:\/\/.*?)<\/p>/gi,function(a,b){return'
"})));else{if(!k||!k.getData)return;if(d=k.getData("text"),!d)return;d=""+d+"
",d=d.replace(new RegExp("\n","g"),"")}d&&(c.command(e,"insertHtml",d),a.clearEmptyOrNestP())}})},c.fn.bindFormatText=function(){var e,f,g,i,c=this;c.editor,e=c.$txt,f=a.config.legalTags,g=f.split(","),g.length,i=[],b.each(g,function(a,b){var c=">\\s*<("+b+")>";i.push(new RegExp(c,"ig"))}),i.push(new RegExp(">\\s*<(li)>","ig")),i.push(new RegExp(">\\s*<(tr)>","ig")),i.push(new RegExp(">\\s*<(code)>","ig")),e.formatText=function(){var a=b("
")}),g=0;f>g;g++)h=e[g],3===h.nodeType&&h.textContent&&b.trim(h.textContent)&&b(h).wrap("
")},c.fn.clearEmptyOrNestP=function(){var a=this.$txt,c=a.find("p");c.each(function(){var e,a=b(this),c=a.children(),d=c.length,f=b.trim(a.html());return f?(1===d&&(e=c.first(),e.get(0)&&"P"===e.get(0).nodeName&&a.html(e.html())),void 0):(a.remove(),void 0)})},c.fn.scrollTop=function(a){var b=this,c=b.editor,d=b.$txt;return c.useMaxHeight?d.parent().scrollTop(a):d.scrollTop(a)},c.fn.showHeightOnHover=function(){function h(a){var i,j,k,l,m,n;g||(c.append(f),g=!0),e.position().top,e.outerHeight(),i=a.height(),j=a.position().top,k=parseInt(a.css("margin-top"),10),l=parseInt(a.css("padding-top"),10),m=parseInt(a.css("margin-bottom"),10),n=parseInt(a.css("padding-bottom"),10),j+d.height(),f.css({height:i+l+k+n+m,top:j+d.height()})}function i(){g&&(f.remove(),g=!1)}var a=this.editor,c=a.$editorContainer,d=a.menuContainer,e=this.$txt,f=b(''),g=!1;e.on("mouseenter","ul,ol,blockquote,p,h1,h2,h3,h4,h5,table,pre",function(a){h(b(a.currentTarget))}).on("mouseleave",function(){i()})}}),b(function(a,b){var c,d;Array.prototype.indexOf||(Array.prototype.indexOf=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},Array.prototype.lastIndexOf=function(a){var b=this.length;for(b-=1;b>=0;b--)if(this[b]===a)return b;return-1}),Date.now||(Date.now=function(){return(new Date).valueOf()}),c=window.console,d=function(){},b.each(["info","log","warn","error"],function(b,e){a[e]=null==c?d:function(b){a.config&&a.config.printLog&&c[e]("wangEditor提示: "+b)}}),a.random=function(){return Math.random().toString().slice(2)},a.placeholder="placeholder"in document.createElement("input"),a.placeholderForIE8=function(c){a.placeholder||c.find("input[placeholder]").each(function(){var a=b(this),c=a.attr("placeholder");""===a.val()&&(a.css("color","#666"),a.val(c),a.on("focus.placeholder click.placeholder",function(){a.val(""),a.css("color","#333"),a.off("focus.placeholder click.placeholder")}))})}}),b(function(a){a.langs={},a.langs["zh-cn"]={bold:"粗体",underline:"下划线",italic:"斜体",forecolor:"文字颜色",bgcolor:"背景色",strikethrough:"删除线",eraser:"清空格式",source:"源码",quote:"引用",fontfamily:"字体",fontsize:"字号",head:"标题",orderlist:"有序列表",unorderlist:"无序列表",alignleft:"左对齐",aligncenter:"居中",alignright:"右对齐",link:"链接",text:"文本",submit:"提交",cancel:"取消",unlink:"取消链接",table:"表格",emotion:"表情",img:"图片",video:"视频",width:"宽",height:"高",location:"位置",loading:"加载中",searchlocation:"搜索位置",dynamicMap:"动态地图",clearLocation:"清除位置",langDynamicOneLocation:"动态地图只能显示一个位置",insertcode:"插入代码",undo:"撤销",redo:"重复",fullscreen:"全屏",openLink:"打开链接"},a.langs.en={bold:"Bold",underline:"Underline",italic:"Italic",forecolor:"Color",bgcolor:"Backcolor",strikethrough:"Strikethrough",eraser:"Eraser",source:"Codeview",quote:"Quote",fontfamily:"Font family",fontsize:"Font size",head:"Head",orderlist:"Ordered list",unorderlist:"Unordered list",alignleft:"Align left",aligncenter:"Align center",alignright:"Align right",link:"Insert link",text:"Text",submit:"Submit",cancel:"Cancel",unlink:"Unlink",table:"Table",emotion:"Emotions",img:"Image",video:"Video",width:"width",height:"height",location:"Location",loading:"Loading",searchlocation:"search",dynamicMap:"Dynamic",clearLocation:"Clear",langDynamicOneLocation:"Only one location in dynamic map",insertcode:"Insert Code",undo:"Undo",redo:"Redo",fullscreen:"Full screnn",openLink:"open link"}}),b(function(a){a.config={},a.config.zindex=1e4,a.config.printLog=!0,a.config.menuFixed=0,a.config.jsFilter=!0,a.config.legalTags="p,h1,h2,h3,h4,h5,h6,blockquote,table,ul,ol,pre",a.config.lang=a.langs["zh-cn"],a.config.menus=["source","|","bold","underline","italic","strikethrough","eraser","forecolor","bgcolor","|","quote","fontfamily","fontsize","head","unorderlist","orderlist","alignleft","aligncenter","alignright","|","link","unlink","table","emotion","|","img","video","location","insertcode","|","undo","redo","fullscreen"],a.config.colors={"#880000":"暗红色","#800080":"紫色","#ff0000":"红色","#ff00ff":"鲜粉色","#000080":"深蓝色","#0000ff":"蓝色","#00ffff":"湖蓝色","#008080":"蓝绿色","#008000":"绿色","#808000":"橄榄色","#00ff00":"浅绿色","#ffcc00":"橙黄色","#808080":"灰色","#c0c0c0":"银色","#000000":"黑色","#ffffff":"白色"},a.config.familys=["宋体","黑体","楷体","微软雅黑","Arial","Verdana","Georgia","Times New Roman","Microsoft JhengHei","Trebuchet MS","Courier New","Impact","Comic Sans MS","Consolas"],a.config.fontsizes={1:"12px",2:"13px",3:"16px",4:"18px",5:"24px",6:"32px",7:"48px"},a.config.emotionsShow="icon",a.config.emotions={weibo:{title:"微博表情",data:[{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/7a/shenshou_thumb.gif",value:"[草泥马]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/60/horse2_thumb.gif",value:"[神马]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/bc/fuyun_thumb.gif",value:"[浮云]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/c9/geili_thumb.gif",value:"[给力]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/f2/wg_thumb.gif",value:"[围观]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/70/vw_thumb.gif",value:"[威武]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/6e/panda_thumb.gif",value:"[熊猫]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/81/rabbit_thumb.gif",value:"[兔子]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/bc/otm_thumb.gif",value:"[奥特曼]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/15/j_thumb.gif",value:"[囧]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/89/hufen_thumb.gif",value:"[互粉]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/c4/liwu_thumb.gif",value:"[礼物]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/ac/smilea_thumb.gif",value:"[呵呵]"},{icon:"http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/0b/tootha_thumb.gif",value:"[哈哈]"}]}},a.config.mapAk="TVhjYjq1ICT2qqL5LdS8mwas",a.config.uploadImgUrl="",a.config.uploadTimeout=2e4,a.config.uploadImgFns={},a.config.customUpload=!1,a.config.uploadParams={},a.config.uploadHeaders={},a.config.hideLinkImg=!1,a.config.pasteFilter=!0,a.config.pasteText=!1,a.config.codeDefaultLang="javascript" }),b(function(a){a.UI={},a.UI.menus={"default":{normal:'',selected:".selected"},bold:{normal:'',selected:".selected"},underline:{normal:'',selected:".selected"},italic:{normal:'',selected:".selected"},forecolor:{normal:'',selected:".selected"},bgcolor:{normal:'',selected:".selected"},strikethrough:{normal:'',selected:".selected"},eraser:{normal:'',selected:".selected"},quote:{normal:'',selected:".selected"},source:{normal:'',selected:".selected"},fontfamily:{normal:'',selected:".selected"},fontsize:{normal:'',selected:".selected"},head:{normal:'',selected:".selected"},orderlist:{normal:'',selected:".selected"},unorderlist:{normal:'',selected:".selected"},alignleft:{normal:'',selected:".selected"},aligncenter:{normal:'',selected:".selected"},alignright:{normal:'',selected:".selected"},link:{normal:'',selected:".selected"},unlink:{normal:'',selected:".selected"},table:{normal:'',selected:".selected"},emotion:{normal:'',selected:".selected"},img:{normal:'',selected:".selected"},video:{normal:'',selected:".selected"},location:{normal:'',selected:".selected"},insertcode:{normal:'',selected:".selected"},undo:{normal:'',selected:".selected"},redo:{normal:'',selected:".selected"},fullscreen:{normal:'',selected:''}}}),b(function(a,b){a.fn.initDefaultConfig=function(){var c=this;c.config=b.extend({},a.config),c.UI=b.extend({},a.UI)}}),b(function(a,b){a.fn.addEditorContainer=function(){this.$editorContainer=b('')}}),b(function(a){a.fn.addTxt=function(){var b=this,c=new a.Txt(b);b.txt=c}}),b(function(a){a.fn.addMenuContainer=function(){var b=this;b.menuContainer=new a.MenuContainer(b)}}),b(function(a,b){a.createMenuFns=[],a.createMenu=function(b){a.createMenuFns.push(b)},a.fn.addMenus=function(){function e(a){return d.indexOf(a)>=0?!0:!1}var c=this,d=c.config.menus;b.each(a.createMenuFns,function(a,b){b.call(c,e)})}}),b(function(a){a.createMenu(function(b){var d,e,f,c="bold";b(c)&&(d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.bold,commandName:"Bold"}),f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("b,strong,h1,h2,h3,h4,h5",a,"Bold"):d.command(a,"Bold")},d.menus[c]=f)})}),b(function(a){a.createMenu(function(b){var d,e,f,c="underline";b(c)&&(d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.underline,commandName:"Underline"}),f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("u,a",a,"Underline"):d.command(a,"Underline")},d.menus[c]=f)})}),b(function(a){a.createMenu(function(b){var d,e,f,c="italic";b(c)&&(d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.italic,commandName:"Italic"}),f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("i",a,"Italic"):d.command(a,"Italic")},d.menus[c]=f)})}),b(function(a,b){a.createMenu(function(c){var e,f,g,h,i,d="forecolor";c(d)&&(e=this,f=e.config.lang,g=e.config.colors,h=new a.Menu({editor:e,id:d,title:f.forecolor}),i=b(""),b.each(g,function(a,b){i.append([''].join(""))}),i.on("click","a[commandValue]",function(a){var c=b(this),d=c.attr("commandValue");h.selected&&e.isRangeEmpty()?e.commandForElem("font[color]",a,"forecolor",d):e.command(a,"forecolor",d)}),h.dropPanel=new a.DropPanel(e,h,{$content:i,width:125}),h.updateSelectedEvent=function(){var a=e.getRangeElem();return a=e.getSelfOrParentByName(a,"font[color]"),a?!0:!1},e.menus[d]=h)})}),b(function(a,b){a.createMenu(function(c){function h(a){var b;return a&&a.style&&null!=a.style.cssText&&(b=a.style.cssText,b&&b.indexOf("background-color:")>=0)?!0:!1}var e,f,g,i,j,d="bgcolor";c(d)&&(e=this,f=e.config.lang,g=e.config.colors,i=new a.Menu({editor:e,id:d,title:f.bgcolor}),j=b(""),b.each(g,function(a,b){j.append([''].join(""))}),j.on("click","a[commandValue]",function(a){var c=b(this),d=c.attr("commandValue");i.selected&&e.isRangeEmpty()?e.commandForElem({selector:"span,font",check:h},a,"BackColor",d):e.command(a,"BackColor",d)}),i.dropPanel=new a.DropPanel(e,i,{$content:j,width:125}),i.updateSelectedEvent=function(){var a=e.getRangeElem();return a=e.getSelfOrParentByName(a,"span,font",h),a?!0:!1},e.menus[d]=i)})}),b(function(a){a.createMenu(function(b){var d,e,f,c="strikethrough";b(c)&&(d=this,e=d.config.lang,f=new a.Menu({editor:d,id:c,title:e.strikethrough,commandName:"StrikeThrough"}),f.clickEventSelected=function(a){var b=d.isRangeEmpty();b?d.commandForElem("strike",a,"StrikeThrough"):d.command(a,"StrikeThrough")},d.menus[c]=f)})}),b(function(a,b){a.createMenu(function(c){var e,f,g,d="eraser";c(d)&&(e=this,f=e.config.lang,g=new a.Menu({editor:e,id:d,title:f.eraser,commandName:"RemoveFormat"}),g.clickEvent=function(a){function f(){var e,f,h,i,j,a=this,c=a.getRangeElem(),g=a.getSelfOrParentByName(c,"blockquote");g&&(h=b(g),d=b("
"+h.text()+"
"),h.after(d).remove()),e=a.getSelfOrParentByName(c,"p,h1,h2,h3,h4,h5"),e&&(f=b(e),d=b(""+f.text()+"
"),f.after(d).remove()),i=a.getSelfOrParentByName(c,"ul,ol"),i&&(j=b(i),d=b(""+j.text()+"
"),j.after(d).remove())}function g(){var a=this;d&&a.restoreSelectionByElem(d.get(0))}var d,c=e.isRangeEmpty();return c?(e.customCommand(a,f,g),void 0):(e.command(a,"RemoveFormat"),void 0)},e.menus[d]=g)})}),b(function(a,b){a.createMenu(function(c){function i(){var a=h.$codeTextarea,c=e.txt.$txt,d=b.trim(a.val());d||(d="