zui
Version:
一个基于 Bootstrap 深度定制开源前端实践方案,帮助你快速构建现代跨屏应用。
2 lines • 187 kB
JavaScript
!function(window,undefined){function _isArray(e){return!!e&&"[object Array]"===Object.prototype.toString.call(e)}function _isFunction(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function _inArray(e,t){for(var n=0,i=t.length;n<i;n++)if(e===t[n])return n;return-1}function _each(e,t){if(_isArray(e))for(var n=0,i=e.length;n<i&&t.call(e[n],n,e[n])!==!1;n++);else for(var a in e)if(e.hasOwnProperty(a)&&t.call(e[a],a,e[a])===!1)break}function _trim(e){return e.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,"")}function _inString(e,t,n){return n=n===undefined?",":n,(n+t+n).indexOf(n+e+n)>=0}function _addUnit(e,t){return t=t||"px",e&&/^\d+$/.test(e)?e+t:e}function _removeUnit(e){var t;return e&&(t=/(\d+)/.exec(e))?parseInt(t[1],10):0}function _escape(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function _unescape(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function _toCamel(e){var t=e.split("-");return e="",_each(t,function(t,n){e+=t>0?n.charAt(0).toUpperCase()+n.substr(1):n}),e}function _toHex(e){function t(e){var t=parseInt(e,10).toString(16).toUpperCase();return t.length>1?t:"0"+t}return e.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/gi,function(e,n,i,a){return"#"+t(n)+t(i)+t(a)})}function _toMap(e,t){t=t===undefined?",":t;var n,i={},a=_isArray(e)?e:e.split(t);return _each(a,function(e,t){if(n=/^(\d+)\.\.(\d+)$/.exec(t))for(var a=parseInt(n[1],10);a<=parseInt(n[2],10);a++)i[a.toString()]=!0;else i[t]=!0}),i}function _toArray(e,t){return Array.prototype.slice.call(e,t||0)}function _undef(e,t){return e===undefined?t:e}function _invalidUrl(e){return!e||/[<>"]/.test(e)}function _addParam(e,t){return e.indexOf("?")>=0?e+"&"+t:e+"?"+t}function _extend(e,t,n){n||(n=t,t=null);var i;if(t){var a=function(){};a.prototype=t.prototype,i=new a,_each(n,function(e,t){i[e]=t})}else i=n;i.constructor=e,e.prototype=i,e.parent=t?t.prototype:null}function _json(text){var match;(match=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))&&(text=match[0]);var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+text+")");throw"JSON parse error"}function _getBasePath(){for(var e,t=document.getElementsByTagName("script"),n=0,i=t.length;n<i;n++)if(e=t[n].src||"",/kindeditor[\w\-\.]*\.js/.test(e))return e.substring(0,e.lastIndexOf("/")+1);return""}function _bindEvent(e,t,n){e.addEventListener?e.addEventListener(t,n,_useCapture):e.attachEvent&&e.attachEvent("on"+t,n)}function _unbindEvent(e,t,n){e.removeEventListener?e.removeEventListener(t,n,_useCapture):e.detachEvent&&e.detachEvent("on"+t,n)}function KEvent(e,t){this.init(e,t)}function _getId(e){return e[_eventExpendo]||null}function _setId(e){return e[_eventExpendo]=++_eventId,_eventId}function _removeId(e){try{delete e[_eventExpendo]}catch(t){e.removeAttribute&&e.removeAttribute(_eventExpendo)}}function _bind(e,t,n){if(t.indexOf(",")>=0)return void _each(t.split(","),function(){_bind(e,this,n)});var i=_getId(e);i||(i=_setId(e)),_eventData[i]===undefined&&(_eventData[i]={});var a=_eventData[i][t];a&&a.length>0?_unbindEvent(e,t,a[0]):(_eventData[i][t]=[],_eventData[i].el=e),a=_eventData[i][t],0===a.length&&(a[0]=function(t){var n=t?new KEvent(e,t):undefined;_each(a,function(t,i){t>0&&i&&i.call(e,n)})}),_inArray(n,a)<0&&a.push(n),_bindEvent(e,t,a[0])}function _unbind(e,t,n){if(t&&t.indexOf(",")>=0)return void _each(t.split(","),function(){_unbind(e,this,n)});var i=_getId(e);if(i){if(t===undefined)return void(i in _eventData&&(_each(_eventData[i],function(t,n){"el"!=t&&n.length>0&&_unbindEvent(e,t,n[0])}),delete _eventData[i],_removeId(e)));if(_eventData[i]){var a=_eventData[i][t];if(a&&a.length>0){n===undefined?(_unbindEvent(e,t,a[0]),delete _eventData[i][t]):(_each(a,function(e,t){e>0&&t===n&&a.splice(e,1)}),1==a.length&&(_unbindEvent(e,t,a[0]),delete _eventData[i][t]));var o=0;_each(_eventData[i],function(){o++}),o<2&&(delete _eventData[i],_removeId(e))}}}}function _fire(e,t){if(t.indexOf(",")>=0)return void _each(t.split(","),function(){_fire(e,this)});var n=_getId(e);if(n){var i=_eventData[n][t];_eventData[n]&&i&&i.length>0&&i[0]()}}function _ctrl(e,t,n){t=/^\d{2,}$/.test(t)?t:t.toUpperCase().charCodeAt(0),_bind(e,"keydown",function(i){!i.ctrlKey||i.which!=t||i.shiftKey||i.altKey||(n.call(e),i.stop())})}function _ready(e){function t(){a||(a=!0,e(KindEditor),_readyFinished=!0)}function n(){if(!a){try{document.documentElement.doScroll("left")}catch(e){return void setTimeout(n,100)}t()}}function i(){"complete"===document.readyState&&t()}if(_readyFinished)return void e(KindEditor);var a=!1;if(document.addEventListener)_bind(document,"DOMContentLoaded",t);else if(document.attachEvent){_bind(document,"readystatechange",i);var o=!1;try{o=null==window.frameElement}catch(r){}document.documentElement.doScroll&&o&&n()}_bind(window,"load",t)}function _getCssList(e){for(var t,n={},i=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g;t=i.exec(e);){var a=_trim(t[1].toLowerCase()),o=_trim(_toHex(t[2]));n[a]=o}return n}function _getAttrList(e){for(var t,n={},i=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g;t=i.exec(e);){var a=(t[1]||t[2]||t[4]||t[6]).toLowerCase(),o=(t[2]?t[3]:t[4]?t[5]:t[7])||"";n[a]=o}return n}function _addClassToTag(e,t){return e=/\s+class\s*=/.test(e)?e.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(e,n,i,a){return(" "+i+" ").indexOf(" "+t+" ")<0?""===i?n+t+a:n+i+" "+t+a:e}):e.substr(0,e.length-1)+' class="'+t+'">'}function _formatCss(e){var t="";return _each(_getCssList(e),function(e,n){t+=e+":"+n+";"}),t}function _formatUrl(e,t,n,i){function a(e){for(var t=e.split("/"),n=[],i=0,a=t.length;i<a;i++){var o=t[i];".."==o?n.length>0&&n.pop():""!==o&&"."!=o&&n.push(o)}return"/"+n.join("/")}function o(t,n){if(e.substr(0,t.length)===t){for(var a=[],r=0;r<n;r++)a.push("..");var s=".";return a.length>0&&(s+="/"+a.join("/")),"/"==i&&(s+="/"),s+e.substr(t.length)}if(l=/^(.*)\//.exec(t))return o(l[1],++n)}if(t=_undef(t,"").toLowerCase(),"data:"!=e.substr(0,5)&&(e=e.replace(/([^:])\/\//g,"$1/")),_inArray(t,["absolute","relative","domain"])<0)return e;if(n=n||location.protocol+"//"+location.host,i===undefined){var r=location.pathname.match(/^(\/.*)\//);i=r?r[1]:""}var l;if(l=/^(\w+:\/\/[^\/]*)/.exec(e)){if(l[1]!==n)return e}else if(/^\w+:/.test(e))return e;return/^\//.test(e)?e=n+a(e.substr(1)):/^\w+:\/\//.test(e)||(e=n+a(i+"/"+e)),"relative"===t?e=o(n+i,0).substr(2):"absolute"===t&&e.substr(0,n.length)===n&&(e=e.substr(n.length)),e}function _formatHtml(e,t,n,i,a){null==e&&(e=""),n=n||"",i=_undef(i,!1),a=_undef(a,"\t");var o="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");e=e.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(e,t,n,i){return t+n.replace(/<(?:br|br\s[^>]*)>/gi,"\n")+i}),e=e.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/gi,"</p>"),e=e.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/gi,"$1<br />$2"),e=e.replace(/\u200B/g,""),e=e.replace(/\u00A9/g,"©"),e=e.replace(/<[^>]+>/g,function(e){return e.replace(/\s+/g," ")});var r={};t&&(_each(t,function(e,t){for(var n=e.split(","),i=0,a=n.length;i<a;i++)r[n[i]]=_toMap(t)}),r.script||(e=e.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/gi,"")),r.style||(e=e.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/gi,"")));var l=/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,s=[];return e=e.replace(l,function(e,l,d,c,u,p,h){var f=e,m=l||"",g=d||"",v=c.toLowerCase(),_=u||"",b=p?" "+p:"",y=h||"";if(t&&!r[v])return"";if(""===b&&_SINGLE_TAG_MAP[v]&&(b=" /"),_INLINE_TAG_MAP[v]&&(m&&(m=" "),y&&(y=" ")),_PRE_TAG_MAP[v]&&(g?y="\n":m="\n"),i&&"br"==v&&(y="\n"),_BLOCK_TAG_MAP[v]&&!_PRE_TAG_MAP[v])if(i){g&&s.length>0&&s[s.length-1]===v?s.pop():s.push(v),m="\n",y="\n";for(var k=0,w=g?s.length:s.length-1;k<w;k++)m+=a,g||(y+=a);b?s.pop():g||(y+=a)}else m=y="";if(""!==_){var S=_getAttrList(f);if("font"===v){var C={},E="";_each(S,function(e,t){"color"===e&&(C.color=t,delete S[e]),"size"===e&&(C["font-size"]=o[parseInt(t,10)-1]||"",delete S[e]),"face"===e&&(C["font-family"]=t,delete S[e]),"style"===e&&(E=t)}),E&&!/;$/.test(E)&&(E+=";"),_each(C,function(e,t){""!==t&&(/\s/.test(t)&&(t="'"+t+"'"),E+=e+":"+t+";")}),S.style=E}_each(S,function(e,i){if(_FILL_ATTR_MAP[e]&&(S[e]=e),_inArray(e,["src","href"])>=0&&(S[e]=_formatUrl(i,n)),(t&&"style"!==e&&!r[v]["*"]&&!r[v][e]||"body"===v&&"contenteditable"===e||/^kindeditor_\d+$/.test(e))&&delete S[e],"style"===e&&""!==i){var a=_getCssList(i);_each(a,function(e,n){!t||r[v].style||r[v]["."+e]||delete a[e]});var o="";_each(a,function(e,t){o+=e+":"+t+";"}),S.style=o}}),_="",_each(S,function(e,t){"style"===e&&""===t||(t=t.replace(/"/g,"""),_+=" "+e+'="'+t+'"')})}return"font"===v&&(v="span"),m+"<"+g+v+_+b+">"+y}),e=e.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(e,t,n,i){return t+n.replace(/\n/g,'<span id="__kindeditor_pre_newline__">\n')+i}),e=e.replace(/\n\s*\n/g,"\n"),e=e.replace(/<span id="__kindeditor_pre_newline__">\n/g,"\n"),_trim(e)}function _clearMsWord(e,t){return e=e.replace(/<meta[\s\S]*?>/gi,"").replace(/<![\s\S]*?>/gi,"").replace(/<style[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<w:[^>]+>[\s\S]*?<\/w:[^>]+>/gi,"").replace(/<o:[^>]+>[\s\S]*?<\/o:[^>]+>/gi,"").replace(/<xml>[\s\S]*?<\/xml>/gi,"").replace(/<(?:table|td)[^>]*>/gi,function(e){return e.replace(/border-bottom:([#\w\s]+)/gi,"border:$1")}),_formatHtml(e,t)}function _mediaType(e){return/\.(rm|rmvb)(\?|$)/i.test(e)?"audio/x-pn-realaudio-plugin":/\.(swf|flv)(\?|$)/i.test(e)?"application/x-shockwave-flash":"video/x-ms-asf-plugin"}function _mediaClass(e){return/realaudio/i.test(e)?"ke-rm":/flash/i.test(e)?"ke-flash":"ke-media"}function _mediaAttrs(e){return _getAttrList(unescape(e))}function _mediaEmbed(e){var t="<embed ";return _each(e,function(e,n){t+=e+'="'+n+'" '}),t+="/>"}function _mediaImg(e,t){var n=t.width,i=t.height,a=t.type||_mediaType(t.src),o=_mediaEmbed(t),r="";/\D/.test(n)?r+="width:"+n+";":n>0&&(r+="width:"+n+"px;"),/\D/.test(i)?r+="height:"+i+";":i>0&&(r+="height:"+i+"px;");var l='<img class="'+_mediaClass(a)+'" src="'+e+'" ';return""!==r&&(l+='style="'+r+'" '),l+='data-ke-tag="'+escape(o)+'" alt="" />'}function _tmpl(e,t){var n=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return t?n(t):n}function _contains(e,t){if(9==e.nodeType&&9!=t.nodeType)return!0;for(;t=t.parentNode;)if(t==e)return!0;return!1}function _getAttr(e,t){t=t.toLowerCase();var n=null;if(_GET_SET_ATTRIBUTE||"script"==e.nodeName.toLowerCase())try{n=e.getAttribute(t,2)}catch(i){n=e.getAttribute(t,1)}else{var a=e.ownerDocument.createElement("div");a.appendChild(e.cloneNode(!1));var o=_getAttrList(_unescape(a.innerHTML));t in o&&(n=o[t])}return"style"===t&&null!==n&&(n=_formatCss(n)),n}function _queryAll(e,t){function n(e){return"string"!=typeof e?e:e.replace(/([^\w\-])/g,"\\$1")}function i(e){return e.replace(/\\/g,"")}function a(e,t){return"*"===e||e.toLowerCase()===n(t.toLowerCase())}function o(e,t,n){var o=[],r=n.ownerDocument||n,l=r.getElementById(i(e));return l&&a(t,l.nodeName)&&_contains(n,l)&&o.push(l),o}function r(e,t,n){var o,r,l,s,d=n.ownerDocument||n,c=[];if(n.getElementsByClassName)for(o=n.getElementsByClassName(i(e)),r=0,l=o.length;r<l;r++)s=o[r],a(t,s.nodeName)&&c.push(s);else if(d.querySelectorAll)for(o=d.querySelectorAll(("#document"!==n.nodeName?n.nodeName+" ":"")+t+"."+e),r=0,l=o.length;r<l;r++)s=o[r],_contains(n,s)&&c.push(s);else for(o=n.getElementsByTagName(t),e=" "+e+" ",r=0,l=o.length;r<l;r++)if(s=o[r],1==s.nodeType){var u=s.className;u&&(" "+u+" ").indexOf(e)>-1&&c.push(s)}return c}function l(e,t,n){for(var o,r=[],l=n.ownerDocument||n,s=l.getElementsByName(i(e)),d=0,c=s.length;d<c;d++)o=s[d],a(t,o.nodeName)&&_contains(n,o)&&null!==o.getAttribute("name")&&r.push(o);return r}function s(e,t,i,a){for(var o,r=[],l=a.getElementsByTagName(i),s=0,d=l.length;s<d;s++)o=l[s],1==o.nodeType&&(null===t?null!==_getAttr(o,e)&&r.push(o):t===n(_getAttr(o,e))&&r.push(o));return r}function d(e,t){var n,i=[];n=/^((?:\\.|[^.#\s\[<>])+)/.exec(e);var a=n?n[1]:"*";if(n=/#((?:[\w\-]|\\.)+)$/.exec(e))i=o(n[1],a,t);else if(n=/\.((?:[\w\-]|\\.)+)$/.exec(e))i=r(n[1],a,t);else if(n=/\[((?:[\w\-]|\\.)+)\]/.exec(e))i=s(n[1].toLowerCase(),null,a,t);else if(n=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(e)){var d=n[1].toLowerCase(),c=n[2];i="id"===d?o(c,a,t):"class"===d?r(c,a,t):"name"===d?l(c,a,t):s(d,c,a,t)}else for(var u,p=t.getElementsByTagName(a),h=0,f=p.length;h<f;h++)u=p[h],1==u.nodeType&&i.push(u);return i}var c=e.split(",");if(c.length>1){var u=[];return _each(c,function(){_each(_queryAll(this,t),function(){_inArray(this,u)<0&&u.push(this)})}),u}t=t||document;for(var p,h=[],f=/((?:\\.|[^\s>])+|[\s>])/g;p=f.exec(e);)" "!==p[1]&&h.push(p[1]);var m=[];if(1==h.length)return d(h[0],t);var g,v,_,b,y,k,w,S,C,E,x=!1;for(k=0,lenth=h.length;k<lenth;k++)if(g=h[k],">"!==g){if(k>0){for(v=[],w=0,C=m.length;w<C;w++)for(b=m[w],_=d(g,b),S=0,E=_.length;S<E;S++)y=_[S],x?b===y.parentNode&&v.push(y):v.push(y);m=v}else m=d(g,t);if(0===m.length)return[]}else x=!0;return m}function _query(e,t){var n=_queryAll(e,t);return n.length>0?n[0]:null}function _get(e){return K(e)[0]}function _getDoc(e){return e?e.ownerDocument||e.document||e:document}function _getWin(e){if(!e)return window;var t=_getDoc(e);return t.parentWindow||t.defaultView}function _setHtml(e,t){if(1==e.nodeType){var n=_getDoc(e);try{e.innerHTML='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+t;var i=n.getElementById("__kindeditor_temp_tag__");i.parentNode.removeChild(i)}catch(a){K(e).empty(),K("@"+t,n).each(function(){e.appendChild(this)})}}}function _hasClass(e,t){return _inString(t,e.className," ")}function _setAttr(e,t,n){_IE&&_V<8&&"class"==t.toLowerCase()&&(t="className"),e.setAttribute(t,""+n)}function _removeAttr(e,t){_IE&&_V<8&&"class"==t.toLowerCase()&&(t="className"),_setAttr(e,t,""),e.removeAttribute(t)}function _getNodeName(e){return e&&e.nodeName?e.nodeName.toLowerCase():""}function _computedCss(e,t){var n=_getWin(e),i=_toCamel(t),a="";if(n.getComputedStyle){var o=n.getComputedStyle(e,null);a=o[i]||o.getPropertyValue(t)||e.style[i]}else e.currentStyle&&(a=e.currentStyle[i]||e.style[i]);return a}function _hasVal(e){return!!_VALUE_TAG_MAP[_getNodeName(e)]}function _docElement(e){return e=e||document,_QUIRKS?e.body:e.documentElement}function _docHeight(e){var t=_docElement(e);return Math.max(t.scrollHeight,t.clientHeight)}function _docWidth(e){var t=_docElement(e);return Math.max(t.scrollWidth,t.clientWidth)}function _getScrollPos(e){e=e||document;var t,n;return _IE||_NEWIE||_OPERA?(t=_docElement(e).scrollLeft,n=_docElement(e).scrollTop):(t=_getWin(e).scrollX,n=_getWin(e).scrollY),{x:t,y:n}}function KNode(e){this.init(e)}function _updateCollapsed(e){return e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e}function _copyAndDelete(e,t,n){function i(i,a,o){var r,s=i.nodeValue.length;if(t){var d=i.cloneNode(!0);r=a>0?d.splitText(a):d,o<s&&r.splitText(o-a)}if(n){var c=i;if(a>0&&(c=i.splitText(a),e.setStart(i,a)),o<s){var u=c.splitText(o-a);e.setEnd(u,0)}l.push(c)}return r}function a(){n&&e.up().collapse(!0);for(var t=0,i=l.length;t<i;t++){var a=l[t];a.parentNode&&a.parentNode.removeChild(a)}}function o(a,h){for(var f,m=a.firstChild;m;){var g=new KRange(r).selectNode(m);if(d=g.compareBoundaryPoints(_START_TO_END,e),d>=0&&c<=0&&(c=g.compareBoundaryPoints(_START_TO_START,e)),c>=0&&u<=0&&(u=g.compareBoundaryPoints(_END_TO_END,e)),u>=0&&p<=0&&(p=g.compareBoundaryPoints(_END_TO_START,e)),p>=0)return!1;if(f=m.nextSibling,d>0)if(1==m.nodeType)if(c>=0&&u<=0)t&&h.appendChild(m.cloneNode(!0)),n&&l.push(m);else{var v;if(t&&(v=m.cloneNode(!1),h.appendChild(v)),o(m,v)===!1)return!1}else if(3==m.nodeType){var _;if(_=m==s.startContainer?i(m,s.startOffset,m.nodeValue.length):m==s.endContainer?i(m,0,s.endOffset):i(m,0,m.nodeValue.length),t)try{h.appendChild(_)}catch(b){}}m=f}}var r=e.doc,l=[],s=e.cloneRange().down(),d=-1,c=-1,u=-1,p=-1,h=e.commonAncestor(),f=r.createDocumentFragment();if(3==h.nodeType){var m=i(h,e.startOffset,e.endOffset);return t&&f.appendChild(m),a(),t?f:e}o(h,f),n&&e.up().collapse(!0);for(var g=0,v=l.length;g<v;g++){var _=l[g];_.parentNode&&_.parentNode.removeChild(_)}return t?f:e}function _moveToElementText(e,t){for(var n=t;n;){var i=K(n);if("marquee"==i.name||"select"==i.name)return;n=n.parentNode}try{e.moveToElementText(t)}catch(a){}}function _getStartEnd(e,t){var n=e.parentElement().ownerDocument,i=e.duplicate();i.collapse(t);var a=i.parentElement(),o=a.childNodes;if(0===o.length)return{node:a.parentNode,offset:K(a).index()};var r=n,l=0,s=-1,d=e.duplicate();_moveToElementText(d,a);for(var c=0,u=o.length;c<u;c++){var p=o[c];if(s=d.compareEndPoints("StartToStart",i),0===s)return{node:p.parentNode,offset:c};if(1==p.nodeType){var h,f=e.duplicate(),m=K(p),g=p;m.isControl()&&(h=n.createElement("span"),m.after(h),g=h,l+=m.text().replace(/\r\n|\n|\r/g,"").length),_moveToElementText(f,g),d.setEndPoint("StartToEnd",f),s>0?l+=f.text.replace(/\r\n|\n|\r/g,"").length:l=0,h&&K(h).remove()}else 3==p.nodeType&&(d.moveStart("character",p.nodeValue.length),l+=p.nodeValue.length);s<0&&(r=p)}if(s<0&&1==r.nodeType)return{node:a,offset:K(a.lastChild).index()+1};if(s>0)for(;r.nextSibling&&1==r.nodeType;)r=r.nextSibling;if(d=e.duplicate(),_moveToElementText(d,a),d.setEndPoint("StartToEnd",i),l-=d.text.replace(/\r\n|\n|\r/g,"").length,s>0&&3==r.nodeType)for(var v=r.previousSibling;v&&3==v.nodeType;)l-=v.nodeValue.length,v=v.previousSibling;return{node:r,offset:l}}function _getEndRange(e,t){var n=e.ownerDocument||e,i=n.body.createTextRange();if(n==e)return i.collapse(!0),i;if(1==e.nodeType&&e.childNodes.length>0){var a,o,r=e.childNodes;if(0===t?(o=r[0],a=!0):(o=r[t-1],a=!1),!o)return i;if("head"===K(o).name)return 1===t&&(a=!0),2===t&&(a=!1),i.collapse(a),i;if(1==o.nodeType){var l,s=K(o);return s.isControl()&&(l=n.createElement("span"),a?s.before(l):s.after(l),o=l),_moveToElementText(i,o),i.collapse(a),l&&K(l).remove(),i}e=o,t=a?0:o.nodeValue.length}var d=n.createElement("span");return K(e).before(d),_moveToElementText(i,d),i.moveStart("character",t),K(d).remove(),i}function _toRange(e){function t(e){"tr"==K(e.node).name&&(e.node=e.node.cells[e.offset],e.offset=0)}var n,i;if(_IERANGE){if(e.item)return n=_getDoc(e.item(0)),i=new KRange(n),i.selectNode(e.item(0)),i;n=e.parentElement().ownerDocument;var a=_getStartEnd(e,!0),o=_getStartEnd(e,!1);return t(a),t(o),i=new KRange(n),i.setStart(a.node,a.offset),i.setEnd(o.node,o.offset),i}var r=e.startContainer;return n=r.ownerDocument||r,i=new KRange(n),i.setStart(r,e.startOffset),i.setEnd(e.endContainer,e.endOffset),i}function KRange(e){this.init(e)}function _range(e){return e.nodeName?new KRange(e):e.constructor===KRange?e:_toRange(e)}function _nativeCommand(e,t,n){try{e.execCommand(t,!1,n)}catch(i){}}function _nativeCommandValue(e,t){var n="";try{n=e.queryCommandValue(t)}catch(i){}return"string"!=typeof n&&(n=""),n}function _getSel(e){var t=_getWin(e);return _IERANGE?e.selection:t.getSelection()}function _getRng(e){var t,n=_getSel(e);try{t=n.rangeCount>0?n.getRangeAt(0):n.createRange()}catch(i){}return!_IERANGE||t&&(t.item||t.parentElement().ownerDocument===e)?t:null}function _singleKeyMap(e){var t,n,i={};return _each(e,function(e,a){t=e.split(",");for(var o=0,r=t.length;o<r;o++)n=t[o],i[n]=a}),i}function _hasAttrOrCss(e,t){return _hasAttrOrCssByKey(e,t,"*")||_hasAttrOrCssByKey(e,t)}function _hasAttrOrCssByKey(e,t,n){if(n=n||e.name,1!==e.type)return!1;var i=_singleKeyMap(t);if(!i[n])return!1;for(var a=i[n].split(","),o=0,r=a.length;o<r;o++){var l=a[o];if("*"===l)return!0;var s=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(l),d=s[1]?"css":"attr";l=s[2];var c=s[3]||"";if(""===c&&""!==e[d](l))return!0;if(""!==c&&e[d](l)===c)return!0}return!1}function _removeAttrOrCss(e,t){1==e.type&&(_removeAttrOrCssByKey(e,t,"*"),_removeAttrOrCssByKey(e,t))}function _removeAttrOrCssByKey(e,t,n){if(n=n||e.name,1===e.type){var i=_singleKeyMap(t);if(i[n]){for(var a=i[n].split(","),o=!1,r=0,l=a.length;r<l;r++){var s=a[r];if("*"===s){o=!0;break}var d=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(s);s=d[2],d[1]?(s=_toCamel(s),e[0].style[s]&&(e[0].style[s]="")):e.removeAttr(s)}o&&e.remove(!0)}}}function _getInnerNode(e){for(var t=e;t.first();)t=t.first();return t}function _isEmptyNode(e){return 1==e.type&&!e.isSingle()&&""===e.html().replace(/<[^>]+>/g,"")}function _mergeWrapper(e,t){e=e.clone(!0);for(var n=_getInnerNode(e),i=e,a=!1;t;){for(;i;)i.name===t.name&&(_mergeAttrs(i,t.attr(),t.css()),a=!0),i=i.first();a||n.append(t.clone(!1)),a=!1,t=t.first()}return e}function _wrapNode(e,t){if(t=t.clone(!0),3==e.type)return _getInnerNode(t).append(e.clone(!1)),e.replaceWith(t),t;for(var n,i=e;(n=e.first())&&1==n.children().length;)e=n;n=e.first();for(var a=e.doc.createDocumentFragment();n;)a.appendChild(n[0]),n=n.next();return t=_mergeWrapper(i,t),a.firstChild&&_getInnerNode(t).append(a),i.replaceWith(t),t}function _mergeAttrs(e,t,n){_each(t,function(t,n){"style"!==t&&e.attr(t,n)}),_each(n,function(t,n){e.css(t,n)})}function _inPreElement(e){for(;e&&"body"!=e.name;){if(_PRE_TAG_MAP[e.name]||"div"==e.name&&e.hasClass("ke-script"))return!0;e=e.parent()}return!1}function KCmd(e){this.init(e)}function _cmd(e){if(e.nodeName){var t=_getDoc(e);e=_range(t).selectNodeContents(t.body).collapse(!1)}return new KCmd(e)}function _drag(e){var t=e.moveEl,n=e.moveFn,i=e.clickEl||t,a=e.beforeDrag,o=e.iframeFix===undefined||e.iframeFix,r=[document];o&&K("iframe").each(function(){var e=_formatUrl(this.src||"","absolute");if(!/^https?:\/\//.test(e)){var t;try{t=_iframeDoc(this)}catch(n){}if(t){var i=K(this).pos();K(t).data("pos-x",i.x),K(t).data("pos-y",i.y),r.push(t)}}}),i.mousedown(function(e){function o(e){e.preventDefault();var t=K(_getDoc(e.target)),a=_round((t.data("pos-x")||0)+e.pageX-f),o=_round((t.data("pos-y")||0)+e.pageY-m);n.call(i,c,u,p,h,a,o)}function l(e){e.preventDefault()}function s(e){e.preventDefault(),K(r).unbind("mousemove",o).unbind("mouseup",s).unbind("selectstart",l),d.releaseCapture&&d.releaseCapture(),K(d).removeClass("ke-dragging")}e.stopPropagation();var d=i.get(),c=_removeUnit(t.css("left")),u=_removeUnit(t.css("top")),p=t.width(),h=t.height(),f=e.pageX,m=e.pageY;K(d).addClass("ke-dragging"),a&&a(),K(r).mousemove(o).mouseup(s).bind("selectstart",l),d.setCapture&&d.setCapture()})}function KWidget(e){this.init(e)}function _widget(e){return new KWidget(e)}function _iframeDoc(e){return e=_get(e),e.contentDocument||e.contentWindow.document}function _getInitHtml(e,t,n,i){var a=[""===_direction?"<html>":'<html dir="'+_direction+'">','<head><meta charset="utf-8" /><title></title>',"<style>","html {margin:0;padding:0;}","body {margin:0;padding:5px;}",'body, td {font:12px/1.5 "sans serif",tahoma,verdana,helvetica;}',"body, p, div {word-wrap: break-word;}","p {margin:5px 0;}","table {border-collapse:collapse;}","img {border:0;}","noscript {display:none;}","table.ke-zeroborder td {border:1px dotted #AAA;}","img.ke-flash {"," border:1px solid #AAA;"," background-image:url("+e+"common/flash.gif);"," background-position:center center;"," background-repeat:no-repeat;"," width:100px;"," height:100px;","}","img.ke-rm {"," border:1px solid #AAA;"," background-image:url("+e+"common/rm.gif);"," background-position:center center;"," background-repeat:no-repeat;"," width:100px;"," height:100px;","}","img.ke-media {"," border:1px solid #AAA;"," background-image:url("+e+"common/media.gif);"," background-position:center center;"," background-repeat:no-repeat;"," width:100px;"," height:100px;","}","img.ke-anchor {"," border:1px dashed #666;"," width:16px;"," height:16px;","}",".ke-script, .ke-noscript, .ke-display-none {"," display:none;"," font-size:0;"," width:0;"," height:0;","}",".ke-pagebreak {"," border:1px dotted #AAA;"," font-size:0;"," height:2px;","}","</style>"];return _isArray(n)||(n=[n]),_each(n,function(e,t){t&&a.push('<link href="'+t+'" rel="stylesheet" />')}),i&&a.push("<style>"+i+"</style>"),a.push("</head><body "+(t?'class="'+t+'"':"")+"></body></html>"),a.join("\n")}function _elementVal(e,t){if(e.hasVal()){if(t===undefined){var n=e.val();return n=n.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,"")}return e.val(t)}return e.html(t)}function KEdit(e){this.init(e)}function _edit(e){return new KEdit(e)}function _selectToolbar(e,t){var n=this,i=n.get(e);if(i){if(i.hasClass("ke-disabled"))return;t(i)}}function KToolbar(e){this.init(e)}function _toolbar(e){return new KToolbar(e)}function KMenu(e){this.init(e)}function _menu(e){return new KMenu(e)}function KColorPicker(e){this.init(e)}function _colorpicker(e){return new KColorPicker(e)}function KUploadButton(e){this.init(e)}function _uploadbutton(e){return new KUploadButton(e)}function _createButton(e){e=e||{};var t=e.name||"",n=K('<span class="ke-button-common ke-button-outer" title="'+t+'"></span>'),i=K('<input class="ke-button-common ke-button" type="button" value="'+t+'" />');return e.click&&i.click(e.click),n.append(i),n}function KDialog(e){this.init(e)}function _dialog(e){return new KDialog(e)}function _tabs(e){var t=_widget(e),n=t.remove,i=e.afterSelect,a=t.div,o=[];a.addClass("ke-tabs").bind("contextmenu,mousedown,mousemove",function(e){e.preventDefault()});var r=K('<ul class="ke-tabs-ul ke-clearfix"></ul>');return a.append(r),t.add=function(e){var t=K('<li class="ke-tabs-li">'+e.title+"</li>");t.data("tab",e),o.push(t),r.append(t)},t.selectedIndex=0,t.select=function(e){t.selectedIndex=e,_each(o,function(n,i){i.unbind(),n===e?(i.addClass("ke-tabs-li-selected"),K(i.data("tab").panel).show("")):(i.removeClass("ke-tabs-li-selected").removeClass("ke-tabs-li-on").mouseover(function(){K(this).addClass("ke-tabs-li-on")}).mouseout(function(){K(this).removeClass("ke-tabs-li-on")}).click(function(){t.select(n)}),K(i.data("tab").panel).hide())}),i&&i.call(t,e)},t.remove=function(){_each(o,function(){this.remove()}),r.remove(),n.call(t)},t}function _loadScript(e,t){var n=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),i=document.createElement("script");n.appendChild(i),i.src=e,i.charset="utf-8",i.onload=i.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState||(t&&t(),i.onload=i.onreadystatechange=null,n.removeChild(i))}}function _chopQuery(e){var t=e.indexOf("?");return t>0?e.substr(0,t):e}function _loadStyle(e){for(var t=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),n=document.createElement("link"),i=_chopQuery(_formatUrl(e,"absolute")),a=K('link[rel="stylesheet"]',t),o=0,r=a.length;o<r;o++)if(_chopQuery(_formatUrl(a[o].href,"absolute"))===i)return;t.appendChild(n),n.href=e,n.rel="stylesheet"}function _ajax(e,t,n,i,a){n=n||"GET",a=a||"json";var o=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");if(o.open(n,e,!0),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status&&t){var e=_trim(o.responseText);"json"==a&&(e=_json(e)),t(e)}},"POST"==n){var r=[];_each(i,function(e,t){r.push(encodeURIComponent(e)+"="+encodeURIComponent(t))});try{o.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(l){}o.send(r.join("&"))}else o.send(null)}function _plugin(e,t){return e===undefined?_plugins:t?void(_plugins[e]=t):_plugins[e]}function _parseLangKey(e){var t,n="core";return(t=/^(\w+)\.(\w+)$/.exec(e))&&(n=t[1],e=t[2]),{ns:n,key:e}}function _lang(e,t){if(t=t===undefined?K.options.langType:t,"string"==typeof e){if(!_language[t])return"no language";var n=e.length-1;if("."===e.substr(n))return _language[t][e.substr(0,n)];var i=_parseLangKey(e);return _language[t][i.ns][i.key]}_each(e,function(e,n){var i=_parseLangKey(e);_language[t]||(_language[t]={}),_language[t][i.ns]||(_language[t][i.ns]={}),_language[t][i.ns][i.key]=n})}function _getImageFromRange(e,t){if(!e.collapsed){e=e.cloneRange().up();var n=e.startContainer,i=e.startOffset;if(_WEBKIT||e.isControl()){var a=K(n.childNodes[i]);if(a&&"img"==a.name)return t(a)?a:void 0}}}function _bindContextmenuEvent(){var e=this,t=e.edit.doc;K(t).contextmenu(function(t){if(e.menu&&e.hideMenu(),!e.useContextmenu)return void t.preventDefault();if(0!==e._contextmenus.length){var n=0,i=[];for(_each(e._contextmenus,function(){return"-"==this.title?void i.push(this):void(this.cond&&this.cond()&&(i.push(this),this.width&&this.width>n&&(n=this.width)))});i.length>0&&"-"==i[0].title;)i.shift();for(;i.length>0&&"-"==i[i.length-1].title;)i.pop();var a=null;if(_each(i,function(e){"-"==this.title&&"-"==a.title&&delete i[e],a=this}),i.length>0){t.preventDefault();var o=K(e.edit.iframe).pos(),r=_menu({x:o.x+t.clientX,y:o.y+t.clientY,width:n,css:{visibility:"hidden"},shadowMode:e.shadowMode});_each(i,function(){this.title&&r.addItem(this)});var l=_docElement(r.doc),s=r.div.height();t.clientY+s>=l.clientHeight-100&&r.pos(r.x,_removeUnit(r.y)-s),r.div.css("visibility","visible"),e.menu=r}}})}function _bindNewlineEvent(){function e(e){for(var t=K(e.commonAncestor());t&&(1!=t.type||t.isStyle());)t=t.parent();return t.name}var t=this,n=t.edit.doc,i=t.newlineTag;if(!(_IE&&"br"!==i||_GECKO&&_V<3&&"p"!==i||_OPERA&&_V<9)){var a=_toMap("h1,h2,h3,h4,h5,h6,pre,li"),o=_toMap("p,h1,h2,h3,h4,h5,h6,pre,li,blockquote");K(n).keydown(function(r){if(!(13!=r.which||r.shiftKey||r.ctrlKey||r.altKey)){t.cmd.selection();var l=e(t.cmd.range);if("marquee"!=l&&"select"!=l)return"br"!==i||a[l]?void(o[l]||_nativeCommand(n,"formatblock","<p>")):(r.preventDefault(),void t.insertHtml("<br />"+(_IE&&_V<9?"":"")))}}),K(n).keyup(function(a){if(!(13!=a.which||a.shiftKey||a.ctrlKey||a.altKey)&&"br"!=i){if(_GECKO){var r=t.cmd.commonAncestor("p"),l=t.cmd.commonAncestor("a");return void(l&&""==l.text()&&(l.remove(!0),t.cmd.range.selectNodeContents(r[0]).collapse(!0),t.cmd.select()))}t.cmd.selection();var s=e(t.cmd.range);if("marquee"!=s&&"select"!=s){o[s]||_nativeCommand(n,"formatblock","<p>");var d=t.cmd.commonAncestor("div");if(d){for(var c=K("<p></p>"),u=d[0].firstChild;u;){var p=u.nextSibling;c.append(u),u=p}d.before(c),d.remove(),t.cmd.range.selectNodeContents(c[0]),t.cmd.select()}}}})}}function _bindTabEvent(){var e=this,t=e.edit.doc;K(t).keydown(function(n){if(9==n.which){if(n.preventDefault(),e.afterTab)return void e.afterTab.call(e,n);var i=e.cmd,a=i.range;a.shrink(),a.collapsed&&1==a.startContainer.nodeType&&(a.insertNode(K("@ ",t)[0]),i.select()),e.insertHtml(" ")}})}function _bindFocusEvent(){var e=this;K(e.edit.textarea[0],e.edit.win).focus(function(t){e.afterFocus&&e.afterFocus.call(e,t),e.container.addClass("focus")}).blur(function(t){e.afterBlur&&e.afterBlur.call(e,t),e.container.removeClass("focus")})}function _removeBookmarkTag(e){return _trim(e.replace(/<span [^>]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/gi,""))}function _removeTempTag(e){return e.replace(/<div[^>]+class="?__kindeditor_paste__"?[^>]*>[\s\S]*?<\/div>/gi,"")}function _addBookmarkToStack(e,t){if(0===e.length)return void e.push(t);var n=e[e.length-1];_removeBookmarkTag(t.html)!==_removeBookmarkTag(n.html)&&e.push(t)}function _undoToRedo(e,t){var n,i,a=this,o=a.edit,r=o.doc.body;if(0===e.length)return a;o.designMode?(n=a.cmd.range,i=n.createBookmark(!0),
i.html=r.innerHTML):i={html:r.innerHTML},_addBookmarkToStack(t,i);var l=e.pop();return _removeBookmarkTag(i.html)===_removeBookmarkTag(l.html)&&e.length>0&&(l=e.pop()),o.designMode?(o.html(l.html),l.start&&(n.moveToBookmark(l),a.select())):K(r).html(_removeBookmarkTag(l.html)),a}function KEditor(e){function t(e,t){KEditor.prototype[e]===undefined&&(n[e]=t),n.options[e]=t}var n=this;n.options={},_each(e,function(n,i){t(n,e[n])}),_each(K.options,function(e,i){n[e]===undefined&&t(e,i)});var i=K(n.srcElement||"<textarea/>");n.width||(n.width=i[0].style.width||i.width()),n.height||(n.height=i[0].style.height||i.height()),t("width",_undef(n.width,n.minWidth)),t("height",_undef(n.height,n.minHeight)),t("width",_addUnit(n.width)),t("height",_addUnit(n.height)),_MOBILE&&(!_IOS||_V<534)&&(n.designMode=!1),n.srcElement=i,n.initContent="",n.plugin={},n.isCreated=!1,n._handlers={},n._contextmenus=[],n._undoStack=[],n._redoStack=[],n._firstAddBookmark=!0,n.menu=n.contextmenu=null,n.dialogs=[]}function _editor(e){return new KEditor(e)}function _create(e,t){function n(e){return _each(_plugins,function(t,n){_isFunction(n)&&n.call(e,KindEditor)}),e.create()}if(t=t||{},t.basePath=_undef(t.basePath,K.basePath),t.themesPath=_undef(t.themesPath,t.basePath+"themes/"),t.langPath=_undef(t.langPath,t.basePath+"lang/"),t.pluginsPath=_undef(t.pluginsPath,t.basePath+"plugins/"),_undef(t.loadStyleMode,K.options.loadStyleMode)){_undef(t.themeType,K.options.themeType);_loadStyle(t.basePath+"/kindeditor.min.css")}var i=K(e);if(i&&0!==i.length){if(i.length>1)return i.each(function(){_create(this,t)}),_instances[0];t.srcElement=i[0];var a=new KEditor(t);return _instances.push(a),_language[a.langType]?n(a):(_loadScript(a.langPath+a.langType+".js?ver="+encodeURIComponent(K.DEBUG?_TIME:_VERSION),function(){n(a)}),a)}}function _eachEditor(e,t){K(e).each(function(e,n){K.each(_instances,function(e,i){if(i&&i.srcElement[0]==n)return t.call(i,e),!1})})}if(!window.KindEditor){window.console||(window.console={}),console.log||(console.log=function(){});var _VERSION="4.1.9 (2013-10-08)",_ua=navigator.userAgent.toLowerCase(),_IE=_ua.indexOf("msie")>-1&&_ua.indexOf("opera")==-1,_NEWIE=_ua.indexOf("msie")==-1&&_ua.indexOf("trident")>-1,_GECKO=_ua.indexOf("gecko")>-1&&_ua.indexOf("khtml")==-1,_WEBKIT=_ua.indexOf("applewebkit")>-1,_OPERA=_ua.indexOf("opera")>-1,_MOBILE=_ua.indexOf("mobile")>-1,_IOS=/ipad|iphone|ipod/.test(_ua),_QUIRKS="CSS1Compat"!=document.compatMode,_IERANGE=!window.getSelection,_matches=/(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(_ua),_V=_matches?_matches[1]:"0",_TIME=(new Date).getTime(),_round=Math.round,K={DEBUG:!1,VERSION:_VERSION,IE:_IE,GECKO:_GECKO,WEBKIT:_WEBKIT,OPERA:_OPERA,V:_V,TIME:_TIME,each:_each,isArray:_isArray,isFunction:_isFunction,inArray:_inArray,inString:_inString,trim:_trim,addUnit:_addUnit,removeUnit:_removeUnit,escape:_escape,unescape:_unescape,toCamel:_toCamel,toHex:_toHex,toMap:_toMap,toArray:_toArray,undef:_undef,invalidUrl:_invalidUrl,addParam:_addParam,extend:_extend,json:_json},_INLINE_TAG_MAP=_toMap("a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),_BLOCK_TAG_MAP=_toMap("address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul"),_SINGLE_TAG_MAP=_toMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),_STYLE_TAG_MAP=_toMap("b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u"),_CONTROL_TAG_MAP=_toMap("img,table,input,textarea,button"),_PRE_TAG_MAP=_toMap("pre,style,script"),_NOSPLIT_TAG_MAP=_toMap("html,head,body,td,tr,table,ol,ul,li"),_AUTOCLOSE_TAG_MAP=_toMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),_FILL_ATTR_MAP=_toMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),_VALUE_TAG_MAP=_toMap("input,button,textarea,select");K.basePath=_getBasePath(),K.options={designMode:!0,fullscreenMode:!1,filterMode:!0,wellFormatMode:!0,shadowMode:!0,loadStyleMode:!0,basePath:K.basePath,themesPath:K.basePath+"themes/",langPath:K.basePath+"lang/",pluginsPath:K.basePath+"plugins/",themeType:"default",langType:"zh_CN",urlType:"",newlineTag:"p",resizeType:1,syncType:"form",pasteType:2,dialogAlignType:"page",useContextmenu:!0,fullscreenShortcut:!1,bodyClass:"ke-content",indentChar:"\t",cssPath:"",cssData:"",minWidth:650,minHeight:100,minChangeSize:50,zIndex:811213,items:["source","|","undo","redo","|","preview","print","template","code","cut","copy","paste","plainpaste","wordpaste","|","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","clearhtml","quickformat","selectall","|","fullscreen","/","formatblock","fontname","fontsize","|","forecolor","hilitecolor","bold","italic","underline","strikethrough","lineheight","removeformat","|","image","multiimage","flash","media","insertfile","table","hr","emoticons","baidumap","pagebreak","anchor","link","unlink","|","about"],noDisableItems:["source","fullscreen"],colorTable:[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900","#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]],fontSizeTable:["9px","10px","12px","14px","16px","18px","24px","32px"],htmlTags:{font:["id","class","color","size","face",".background-color"],span:["id","class",".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".line-height"],div:["id","class","align",".border",".margin",".padding",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".background",".font-style",".text-decoration",".vertical-align",".margin-left"],table:["id","class","border","cellspacing","cellpadding","width","height","align","bordercolor",".padding",".margin",".border","bgcolor",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".background",".width",".height",".border-collapse"],"td,th":["id","class","align","valign","width","height","colspan","rowspan","bgcolor",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".vertical-align",".background",".border"],a:["id","class","href","target","name"],embed:["id","class","src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess"],img:["id","class","src","width","height","border","alt","title","align",".width",".height",".border"],"p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":["id","class","align",".text-align",".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".text-indent",".margin-left"],pre:["id","class"],hr:["id","class",".page-break-after"],"br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del":["id","class"],iframe:["id","class","src","frameborder","width","height",".width",".height"]},layout:'<div class="container"><div class="toolbar"></div><div class="edit"></div><div class="statusbar"></div></div>'};var _useCapture=!1,_INPUT_KEY_MAP=_toMap("8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222"),_CURSORMOVE_KEY_MAP=_toMap("33..40"),_CHANGE_KEY_MAP={};_each(_INPUT_KEY_MAP,function(e,t){_CHANGE_KEY_MAP[e]=t}),_each(_CURSORMOVE_KEY_MAP,function(e,t){_CHANGE_KEY_MAP[e]=t});var _EVENT_PROPS="altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which".split(",");_extend(KEvent,{init:function(e,t){var n=this,i=e.ownerDocument||e.document||e;if(n.event=t,_each(_EVENT_PROPS,function(e,i){n[i]=t[i]}),n.target||(n.target=n.srcElement||i),3===n.target.nodeType&&(n.target=n.target.parentNode),!n.relatedTarget&&n.fromElement&&(n.relatedTarget=n.fromElement===n.target?n.toElement:n.fromElement),null==n.pageX&&null!=n.clientX){var a=i.documentElement,o=i.body;n.pageX=n.clientX+(a&&a.scrollLeft||o&&o.scrollLeft||0)-(a&&a.clientLeft||o&&o.clientLeft||0),n.pageY=n.clientY+(a&&a.scrollTop||o&&o.scrollTop||0)-(a&&a.clientTop||o&&o.clientTop||0)}switch(!n.which&&(n.charCode||0===n.charCode?n.charCode:n.keyCode)&&(n.which=n.charCode||n.keyCode),!n.metaKey&&n.ctrlKey&&(n.metaKey=n.ctrlKey),n.which||n.button===undefined||(n.which=1&n.button?1:2&n.button?3:4&n.button?2:0),n.which){case 186:n.which=59;break;case 187:case 107:case 43:n.which=61;break;case 189:case 45:n.which=109;break;case 42:n.which=106;break;case 47:n.which=111;break;case 78:n.which=110}n.which>=96&&n.which<=105&&(n.which-=48)},preventDefault:function(){var e=this.event;e.preventDefault&&e.preventDefault(),e.returnValue=!1},stopPropagation:function(){var e=this.event;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stop:function(){this.preventDefault(),this.stopPropagation()}});var _eventExpendo="kindeditor_"+_TIME,_eventId=0,_eventData={},_readyFinished=!1;_IE&&window[window.attachEvent?"attachEvent":"addEventListener"]("onunload",function(){_each(_eventData,function(e,t){t.el&&_unbind(t.el)})}),K.ctrl=_ctrl,K.ready=_ready,K.formatUrl=_formatUrl,K.formatHtml=_formatHtml,K.getCssList=_getCssList,K.getAttrList=_getAttrList,K.mediaType=_mediaType,K.mediaAttrs=_mediaAttrs,K.mediaEmbed=_mediaEmbed,K.mediaImg=_mediaImg,K.clearMsWord=_clearMsWord,K.tmpl=_tmpl;var _getSetAttrDiv=document.createElement("div");_getSetAttrDiv.setAttribute("className","t");var _GET_SET_ATTRIBUTE="t"!==_getSetAttrDiv.className;K.query=_query,K.queryAll=_queryAll,_extend(KNode,{init:function(e){var t=this;e=_isArray(e)?e:[e];for(var n=0,i=0,a=e.length;i<a;i++)e[i]&&(t[i]=e[i].constructor===KNode?e[i][0]:e[i],n++);t.length=n,t.doc=_getDoc(t[0]),t.name=_getNodeName(t[0]),t.type=t.length>0?t[0].nodeType:null,t.win=_getWin(t[0])},each:function(e){for(var t=this,n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t;return t},bind:function(e,t){return this.each(function(){_bind(this,e,t)}),this},unbind:function(e,t){return this.each(function(){_unbind(this,e,t)}),this},fire:function(e){return this.length<1?this:(_fire(this[0],e),this)},hasAttr:function(e){return!(this.length<1)&&!!_getAttr(this[0],e)},attr:function(e,t){var n=this;return e===undefined?_getAttrList(n.outer()):"object"==typeof e?(_each(e,function(e,t){n.attr(e,t)}),n):t===undefined?(t=n.length<1?null:_getAttr(n[0],e),null===t?"":t):(n.each(function(){_setAttr(this,e,t)}),n)},removeAttr:function(e){return this.each(function(){_removeAttr(this,e)}),this},get:function(e){return this.length<1?null:this[e||0]},eq:function(e){return this.length<1?null:this[e]?new KNode(this[e]):null},hasClass:function(e){return!(this.length<1)&&_hasClass(this[0],e)},addClass:function(e){return this.each(function(){_hasClass(this,e)||(this.className=_trim(this.className+" "+e))}),this},removeClass:function(e){return this.each(function(){_hasClass(this,e)&&(this.className=_trim(this.className.replace(new RegExp("(^|\\s)"+e+"(\\s|$)")," ")))}),this},html:function(e){var t=this;return e===undefined?t.length<1||1!=t.type?"":_formatHtml(t[0].innerHTML):(t.each(function(){_setHtml(this,e)}),t)},text:function(){var e=this;return e.length<1?"":_IE?e[0].innerText:e[0].textContent},hasVal:function(){return!(this.length<1)&&_hasVal(this[0])},val:function(e){var t=this;return e===undefined?t.length<1?"":t.hasVal()?t[0].value:t.attr("value"):(t.each(function(){_hasVal(this)?this.value=e:_setAttr(this,"value",e)}),t)},css:function(e,t){var n=this;return e===undefined?_getCssList(n.attr("style")):"object"==typeof e?(_each(e,function(e,t){n.css(e,t)}),n):t===undefined?n.length<1?"":n[0].style[_toCamel(e)]||_computedCss(n[0],e)||"":(n.each(function(){this.style[_toCamel(e)]=t}),n)},width:function(e){var t=this;return e===undefined?t.length<1?0:t[0].offsetWidth:t.css("width",_addUnit(e))},height:function(e){var t=this;return e===undefined?t.length<1?0:t[0].offsetHeight:t.css("height",_addUnit(e))},opacity:function(e){return this.each(function(){this.style.opacity===undefined?this.style.filter=1==e?"":"alpha(opacity="+100*e+")":this.style.opacity=1==e?"":e}),this},data:function(e,t){var n=this;return e="kindeditor_data_"+e,t===undefined?n.length<1?null:n[0][e]:(this.each(function(){this[e]=t}),n)},pos:function(){var e=this,t=e[0],n=0,i=0;if(t)if(t.getBoundingClientRect){var a=t.getBoundingClientRect(),o=_getScrollPos(e.doc);n=a.left+o.x,i=a.top+o.y}else for(;t;)n+=t.offsetLeft,i+=t.offsetTop,t=t.offsetParent;return{x:_round(n),y:_round(i)}},clone:function(e){return new KNode(this.length<1?[]:this[0].cloneNode(e))},append:function(e){return this.each(function(){this.appendChild&&this.appendChild(_get(e))}),this},appendTo:function(e){return this.each(function(){_get(e).appendChild(this)}),this},before:function(e){return this.each(function(){this.parentNode.insertBefore(_get(e),this)}),this},after:function(e){return this.each(function(){this.nextSibling?this.parentNode.insertBefore(_get(e),this.nextSibling):this.parentNode.appendChild(_get(e))}),this},replaceWith:function(e){var t=[];return this.each(function(n,i){_unbind(i);var a=_get(e);i.parentNode.replaceChild(a,i),t.push(a)}),K(t)},empty:function(){var e=this;return e.each(function(e,t){for(var n=t.firstChild;n;){if(!t.parentNode)return;var i=n.nextSibling;n.parentNode.removeChild(n),n=i}}),e},remove:function(e){var t=this;return t.each(function(n,i){if(i.parentNode){if(_unbind(i),e)for(var a=i.firstChild;a;){var o=a.nextSibling;i.parentNode.insertBefore(a,i),a=o}i.parentNode.removeChild(i),delete t[n]}}),t.length=0,t},show:function(e){var t=this;return e===undefined&&(e=t._originDisplay||""),"none"!=t.css("display")?t:t.css("display",e)},hide:function(){var e=this;return e.length<1?e:(e._originDisplay=e[0].style.display,e.css("display","none"))},outer:function(){var e=this;if(e.length<1)return"";var t,n=e.doc.createElement("div");return n.appendChild(e[0].cloneNode(!0)),t=_formatHtml(n.innerHTML),n=null,t},isSingle:function(){return!!_SINGLE_TAG_MAP[this.name]},isInline:function(){return!!_INLINE_TAG_MAP[this.name]},isBlock:function(){return!!_BLOCK_TAG_MAP[this.name]},isStyle:function(){return!!_STYLE_TAG_MAP[this.name]},isControl:function(){return!!_CONTROL_TAG_MAP[this.name]},contains:function(e){return!(this.length<1)&&_contains(this[0],_get(e))},parent:function(){if(this.length<1)return null;var e=this[0].parentNode;return e?new KNode(e):null},children:function(){if(this.length<1)return new KNode([]);for(var e=[],t=this[0].firstChild;t;)3==t.nodeType&&""===_trim(t.nodeValue)||e.push(t),t=t.nextSibling;return new KNode(e)},first:function(){var e=this.children();return e.length>0?e.eq(0):null},last:function(){var e=this.children();return e.length>0?e.eq(e.length-1):null},index:function(){if(this.length<1)return-1;for(var e=-1,t=this[0];t;)e++,t=t.previousSibling;return e},prev:function(){if(this.length<1)return null;var e=this[0].previousSibling;return e?new KNode(e):null},next:function(){if(this.length<1)return null;var e=this[0].nextSibling;return e?new KNode(e):null},scan:function(e,t){function n(i){for(var a=t?i.firstChild:i.lastChild;a;){var o=t?a.nextSibling:a.previousSibling;if(e(a)===!1)return!1;if(n(a)===!1)return!1;a=o}}if(!(this.length<1))return t=t===undefined||t,n(this[0]),this}}),_each("blur,focus,focusin,focusout,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error,contextmenu".split(","),function(e,t){KNode.prototype[t]=function(e){return e?this.bind(t,e):this.fire(t)}});var _K=K;K=function(e,t){function n(e){return e[0]||(e=[]),new KNode(e)}if(e!==undefined&&null!==e){if("string"==typeof e){t&&(t=_get(t));var i=e.length;if("@"===e.charAt(0)&&(e=e.substr(1)),e.length!==i||/<.+>/.test(e)){var a=t?t.ownerDocument||t:document,o=a.createElement("div"),r=[];o.innerHTML='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+e;for(var l=0,s=o.childNodes.length;l<s;l++){var d=o.childNodes[l];"__kindeditor_temp_tag__"!=d.id&&r.push(d)}return n(r)}return n(_queryAll(e,t))}return e&&e.constructor===KNode?e:(e.toArray&&(e=e.toArray()),n(_isArray(e)?e:_toArray(arguments)))}},_each(_K,function(e,t){K[e]=t}),K.NodeClass=KNode,window.KindEditor=K;var _START_TO_START=0,_START_TO_END=1,_END_TO_END=2,_END_TO_START=3,_BOOKMARK_ID=0;_extend(KRange,{init:function(e){var t=this;t.startContainer=e,t.startOffset=0,t.endContainer=e,t.endOffset=0,t.collapsed=!0,t.doc=e},commonAncestor:function(){function e(e){for(var t=[];e;)t.push(e),e=e.parentNode;return t}for(var t,n,i=e(this.startContainer),a=e(this.endContainer),o=0,r=i.length,l=a.length;++o&&(t=i[r-o],n=a[l-o],t&&n&&t===n););return i[r-o+1]},setStart:function(e,t){var n=this,i=n.doc;return n.startContainer=e,n.startOffset=t,n.endContainer===i&&(n.endContainer=e,n.endOffset=t),_updateCollapsed(this)},setEnd:function(e,t){var n=this,i=n.doc;return n.endContainer=e,n.endOffset=t,n.startContainer===i&&(n.startContainer=e,n.startOffset=t),_updateCollapsed(this)},setStartBefore:function(e){return this.setStart(e.parentNode||this.doc,K(e).index())},setStartAfter:function(e){return this.setStart(e.parentNode||this.doc,K(e).index()+1)},setEndBefore:function(e){return this.setEnd(e.parentNode||this.doc,K(e).index())},setEndAfter:function(e){return this.setEnd(e.parentNode||this.doc,K(e).index()+1)},selectNode:function(e){return this.setStartBefore(e).setEndAfter(e)},selectNodeContent