").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
diff --git a/src/main/webapp/js/slide.js b/src/main/webapp/js/slide.js
new file mode 100644
index 0000000..5a4a369
--- /dev/null
+++ b/src/main/webapp/js/slide.js
@@ -0,0 +1,67 @@
+$(function() {
+ var len = $("#focus ul li").length; //获取焦点图个数
+ var index = 0;
+ var picTimer;
+
+ //以下代码添加数字按钮和按钮后的半透明条,还有上一页、下一页两个按钮
+ var btn = "
";
+ for(var i=0; i < len; i++) {
+ btn += "";
+ }
+ btn += "
";
+ $("#focus").append(btn);
+ //$("#focus .btnBg").css("opacity",0.5);
+
+ //为小按钮添加鼠标滑入事件,以显示相应的内容
+ $("#focus .btn span").addClass("on").mouseover(function() {
+ index = $("#focus .btn span").index(this);
+ showPics(index);
+ }).eq(0).trigger("mouseover");
+
+ //上一页、下一页按钮透明度处理
+ $("#focus .preNext").css("opacity",0.5).hover(function() {
+ $(this).stop(true,false).animate({"opacity":"0.9"},300);
+ },function() {
+ $(this).stop(true,false).animate({"opacity":"0.5"},300);
+ });
+
+ //上一页按钮
+ $("#focus .pre").click(function() {
+ index -= 1;
+ if(index == -1) {index = len - 1;}
+ showPics(index);
+ });
+
+ //下一页按钮
+ $("#focus .next").click(function() {
+ index += 1;
+ if(index == len) {index = 0;}
+ showPics(index);
+ });
+
+ //鼠标滑上焦点图时停止自动播放,滑出时开始自动播放
+ $("#focus").hover(function() {
+ clearInterval(picTimer);
+ },function() {
+ picTimer = setInterval(function() {
+ showPics(index);
+ index++;
+ if(index == len) {index = 0;}
+ },4000); //此4000代表自动播放的间隔,单位:毫秒
+ }).trigger("mouseleave");
+
+ //显示图片函数,根据接收的index值显示相应的内容
+ function showPics(index) { //普通切换
+ $("#focus li").stop(true,false).animate({"opacity":"0"},500);
+ $("#focus li:eq("+index+")").stop(true,false).animate({"opacity":"1"},500);
+ $("#focus .btn span").removeClass("on").eq(index).stop(true,false).addClass("on"); //为当前的按钮切换到选中的效果
+ }
+
+ /*登陆框隐藏*/
+ $('.close').click(function(){
+ $('.login').hide(200);
+ $('#screen').remove();
+ });
+
+
+});
diff --git a/src/main/webapp/js/xadmin.js b/src/main/webapp/js/xadmin.js
new file mode 100644
index 0000000..890aae8
--- /dev/null
+++ b/src/main/webapp/js/xadmin.js
@@ -0,0 +1,583 @@
+;!function (win) {
+ "use strict";
+ var doc = document
+
+ ,Xadmin = function(){
+ this.v = '2.2'; //版本号
+ }
+
+ Xadmin.prototype.init = function() {
+ var tab_list = this.get_data();
+ for(var i in tab_list){
+ this.add_lay_tab(tab_list[i].title,tab_list[i].url,i);
+ }
+ element.tabChange('xbs_tab', i);
+ };
+ /**
+ * [end 执行结束要做的]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.end = function() {
+
+ var cate_list = this.get_cate_data();
+
+ for(var i in cate_list){
+ if(cate_list[i]!=null){
+ $('.left-nav #nav li').eq(cate_list[i]).click();
+ }
+ }
+ };
+
+ Xadmin.prototype.add_tab = function (title,url,is_refresh) {
+ var id = md5(url);//md5每个url
+ //重复点击
+ for (var i = 0; i <$('.x-iframe').length; i++) {
+ if($('.x-iframe').eq(i).attr('tab-id')==id){
+ element.tabChange('xbs_tab', id);
+ if(is_refresh)
+ $('.x-iframe').eq(i).attr("src",$('.x-iframe').eq(i).attr('src'));
+ return;
+ }
+ };
+
+ this.add_lay_tab(title,url,id);
+ this.set_data(title,url,id);
+ element.tabChange('xbs_tab', id);
+
+ }
+
+ Xadmin.prototype.del_tab = function (id) {
+
+ if(id){
+ console.log(88);
+ }else{
+ var id = $(window.frameElement).attr('tab-id');
+ parent.element.tabDelete('xbs_tab', id);
+ }
+ }
+
+ Xadmin.prototype.add_lay_tab = function(title,url,id) {
+ element.tabAdd('xbs_tab', {
+ title: title
+ ,content: '
'
+ ,id: id
+ })
+ }
+ /**
+ * [open 打开弹出层]
+ * @param {[type]} title [弹出层标题]
+ * @param {[type]} url [弹出层地址]
+ * @param {[type]} w [宽]
+ * @param {[type]} h [高]
+ * @param {Boolean} full [全屏]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.open = function (title,url,w,h,full) {
+ if (title == null || title == '') {
+ var title=false;
+ };
+ if (url == null || url == '') {
+ var url="404.html";
+ };
+ if (w == null || w == '') {
+ var w=($(window).width()*0.9);
+ };
+ if (h == null || h == '') {
+ var h=($(window).height() - 50);
+ };
+ var index = layer.open({
+ type: 2,
+ area: [w+'px', h +'px'],
+ fix: false, //不固定
+ maxmin: true,
+ shadeClose: true,
+ shade:0.4,
+ title: title,
+ content: url
+ });
+ if(full){
+ layer.full(index);
+ }
+ }
+ /**
+ * [close 关闭弹出层]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.close = function() {
+ var index = parent.layer.getFrameIndex(window.name);
+ parent.layer.close(index);
+ };
+ /**
+ * [close 关闭弹出层父窗口关闭]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.father_reload = function() {
+ parent.location.reload();
+ };
+ /**
+ * [get_data 获取所有项]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.get_data = function () {
+ if(typeof is_remember!="undefined")
+ return false;
+ return layui.data('tab_list')
+ }
+ /**
+ * [set_data 增加某一项]
+ * @param {[type]} id [description]
+ */
+ Xadmin.prototype.set_data = function(title,url,id) {
+
+ if(typeof is_remember!="undefined")
+ return false;
+
+ layui.data('tab_list', {
+ key: id
+ ,value: {title:title,url:url}
+ });
+ };
+
+ /**
+ * [get_data 获取所有项]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.get_cate_data = function () {
+ if(typeof is_remember!="undefined")
+ return false;
+ return layui.data('cate')
+ }
+ /**
+ * [set_data 增加某一项]
+ * @param {[type]} id [description]
+ */
+ Xadmin.prototype.set_cate_data = function(data) {
+
+ if(typeof is_remember!="undefined")
+ return false;
+
+ layui.data('cate', data);
+ };
+ /**
+ * [del_data 删除某一项]
+ * @param {[type]} id [description]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.del_data = function(id) {
+ if(typeof is_remember!="undefined")
+ return false;
+ if(typeof id!="undefined"){
+ layui.data('tab_list', {
+ key: id
+ ,remove: true
+ });
+ }else{
+ layui.data('tab_list',null);
+ }
+ };
+ /**
+ * [del_other_data 删除其它]
+ * @param {[type]} id [description]
+ * @return {[type]} [description]
+ */
+ Xadmin.prototype.del_other_data = function(id) {
+ if(typeof is_remember!="undefined")
+ return false;
+ var tab_list = this.get_data();
+
+ layui.data('tab_list',null);
+
+ layui.data('tab_list', {
+ key: id
+ ,value: tab_list[id]
+ });
+ };
+ win.xadmin = new Xadmin();
+
+}(window);
+
+layui.use(['layer','element','jquery'],function() {
+ layer = layui.layer;
+ element = layui.element;
+ $ = layui.jquery;
+
+
+ // 打开页面初始
+ xadmin.init();
+
+ //关闭tab清除记忆
+ element.on('tabDelete(xbs_tab)', function(data){
+ var id = $(this).parent().attr('lay-id');
+ xadmin.del_data(id);
+ });
+ //左侧菜单
+ $('.left-nav #nav').on('click', 'li', function(event) {
+
+ if($(this).parent().attr('id')=='nav'){
+ xadmin.set_cate_data({key:'f1',value:$('.left-nav #nav li').index($(this))})
+ xadmin.set_cate_data({key:'f2',value:null})
+ xadmin.set_cate_data({key:'f3',value:null})
+ }
+
+ if($(this).parent().parent().parent().attr('id')=='nav'){
+ xadmin.set_cate_data({key:'f2',value:$('.left-nav #nav li').index($(this))})
+ xadmin.set_cate_data({key:'f3',value:null})
+ }
+
+ if($(this).parent().parent().parent().parent().parent().attr('id')=='nav'){
+ xadmin.set_cate_data({key:'f3',value:$('.left-nav #nav li').index($(this))})
+ }
+
+
+
+ if($('.left-nav').css('width')=='60px'){
+ $('.left-nav').animate({width: '220px'}, 100);
+ $('.page-content').animate({left: '220px'}, 100);
+ $('.left-nav i').css('font-size','14px');
+ $('.left-nav cite,.left-nav .nav_right').show();
+ }
+
+ if($(window).width()<768){
+ $('.page-content-bg').show();
+ }
+
+ $('.left-nav').find('a').removeClass('active');
+ $(this).children('a').addClass('active');
+ if($(this).children('.sub-menu').length){
+ if($(this).hasClass('open')){
+ $(this).removeClass('open');
+ $(this).find('.nav_right').html('');
+ $(this).children('.sub-menu').stop(true,true).slideUp();
+ $(this).siblings().children('.sub-menu').slideUp();
+ }else{
+ $(this).addClass('open');
+ $(this).children('a').find('.nav_right').html('');
+ $(this).children('.sub-menu').stop(true,true).slideDown();
+ $(this).siblings().children('.sub-menu').stop(true,true).slideUp();
+ $(this).siblings().find('.nav_right').html('');
+ $(this).siblings().removeClass('open');
+ }
+ }
+ event.stopPropagation();
+ })
+ var left_tips_index = null;
+ $('.left-nav #nav').on('mouseenter', '.left-nav-li', function(event) {
+ if($('.left-nav').css('width')!='220px'){
+ var tips = $(this).attr('lay-tips');
+ left_tips_index = layer.tips(tips, $(this));
+ }
+ })
+
+ $('.left-nav #nav').on('mouseout', '.left-nav-li', function(event) {
+ layer.close(left_tips_index);
+ })
+ // 隐藏左侧
+ $('.container .left_open i').click(function(event) {
+ if($('.left-nav').css('width')=='220px'){
+ $('.left-nav .open').click();
+ $('.left-nav i').css('font-size','18px');
+ $('.left-nav').animate({width: '60px'}, 100);
+ $('.left-nav cite,.left-nav .nav_right').hide();
+ $('.page-content').animate({left: '60px'}, 100);
+ $('.page-content-bg').hide();
+ }else{
+ $('.left-nav').animate({width: '220px'}, 100);
+ $('.page-content').animate({left: '220px'}, 100);
+ $('.left-nav i').css('font-size','14px');
+ $('.left-nav cite,.left-nav .nav_right').show();
+ if($(window).width()<768){
+ $('.page-content-bg').show();
+ }
+ }
+
+ });
+
+ $('.page-content-bg').click(function(event) {
+ $('.left-nav .open').click();
+ $('.left-nav i').css('font-size','18px');
+ $('.left-nav').animate({width: '60px'}, 100);
+ $('.left-nav cite,.left-nav .nav_right').hide();
+ $('.page-content').animate({left: '60px'}, 100);
+ $(this).hide();
+ });
+
+ $(".layui-tab-title").on('contextmenu', 'li', function(event) {
+ var tab_left = $(this).position().left;
+ var tab_width = $(this).width();
+ var left = $(this).position().top;
+ var this_index = $(this).attr('lay-id');
+ $('#tab_right').css({'left':tab_left+tab_width/2}).show().attr('lay-id',this_index);
+ $('#tab_show').show();
+ return false;
+ });
+
+ $('#tab_right').on('click', 'dd', function(event) {
+ var data_type = $(this).attr('data-type');
+ var lay_id = $(this).parents('#tab_right').attr('lay-id');
+ if(data_type=='this'){
+ $('.layui-tab-title li[lay-id='+lay_id+']').find('.layui-tab-close').click();
+ }else if(data_type=='other'){
+ $('.layui-tab-title li').eq(0).find('.layui-tab-close').remove();
+ $('.layui-tab-title li[lay-id!='+lay_id+']').find('.layui-tab-close').click();
+ }else if(data_type=='all'){
+ $('.layui-tab-title li[lay-id]').find('.layui-tab-close').click();
+ }
+ $('#tab_right').hide();
+ $('#tab_show').hide();
+ })
+
+
+ $('.page-content,#tab_show,.container,.left-nav').click(function(event) {
+ $('#tab_right').hide();
+ $('#tab_show').hide();
+ });
+
+ // 页面加载完要做的
+ xadmin.end();
+})
+// md5-----------------------------------------------------------------------------------
+/*
+* Add integers, wrapping at 2^32. This uses 16-bit operations internally
+* to work around bugs in some JS interpreters.
+*/
+function safeAdd (x, y) {
+ var lsw = (x & 0xffff) + (y & 0xffff)
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
+ return (msw << 16) | (lsw & 0xffff)
+}
+
+/*
+* Bitwise rotate a 32-bit number to the left.
+*/
+function bitRotateLeft (num, cnt) {
+ return (num << cnt) | (num >>> (32 - cnt))
+}
+
+/*
+* These functions implement the four basic operations the algorithm uses.
+*/
+function md5cmn (q, a, b, x, s, t) {
+ return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)
+}
+function md5ff (a, b, c, d, x, s, t) {
+ return md5cmn((b & c) | (~b & d), a, b, x, s, t)
+}
+function md5gg (a, b, c, d, x, s, t) {
+ return md5cmn((b & d) | (c & ~d), a, b, x, s, t)
+}
+function md5hh (a, b, c, d, x, s, t) {
+ return md5cmn(b ^ c ^ d, a, b, x, s, t)
+}
+function md5ii (a, b, c, d, x, s, t) {
+ return md5cmn(c ^ (b | ~d), a, b, x, s, t)
+}
+
+/*
+* Calculate the MD5 of an array of little-endian words, and a bit length.
+*/
+function binlMD5 (x, len) {
+ /* append padding */
+ x[len >> 5] |= 0x80 << (len % 32)
+ x[((len + 64) >>> 9 << 4) + 14] = len
+
+ var i
+ var olda
+ var oldb
+ var oldc
+ var oldd
+ var a = 1732584193
+ var b = -271733879
+ var c = -1732584194
+ var d = 271733878
+
+ for (i = 0; i < x.length; i += 16) {
+ olda = a
+ oldb = b
+ oldc = c
+ oldd = d
+
+ a = md5ff(a, b, c, d, x[i], 7, -680876936)
+ d = md5ff(d, a, b, c, x[i + 1], 12, -389564586)
+ c = md5ff(c, d, a, b, x[i + 2], 17, 606105819)
+ b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330)
+ a = md5ff(a, b, c, d, x[i + 4], 7, -176418897)
+ d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426)
+ c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341)
+ b = md5ff(b, c, d, a, x[i + 7], 22, -45705983)
+ a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416)
+ d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417)
+ c = md5ff(c, d, a, b, x[i + 10], 17, -42063)
+ b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162)
+ a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682)
+ d = md5ff(d, a, b, c, x[i + 13], 12, -40341101)
+ c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290)
+ b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329)
+
+ a = md5gg(a, b, c, d, x[i + 1], 5, -165796510)
+ d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632)
+ c = md5gg(c, d, a, b, x[i + 11], 14, 643717713)
+ b = md5gg(b, c, d, a, x[i], 20, -373897302)
+ a = md5gg(a, b, c, d, x[i + 5], 5, -701558691)
+ d = md5gg(d, a, b, c, x[i + 10], 9, 38016083)
+ c = md5gg(c, d, a, b, x[i + 15], 14, -660478335)
+ b = md5gg(b, c, d, a, x[i + 4], 20, -405537848)
+ a = md5gg(a, b, c, d, x[i + 9], 5, 568446438)
+ d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690)
+ c = md5gg(c, d, a, b, x[i + 3], 14, -187363961)
+ b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501)
+ a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467)
+ d = md5gg(d, a, b, c, x[i + 2], 9, -51403784)
+ c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473)
+ b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734)
+
+ a = md5hh(a, b, c, d, x[i + 5], 4, -378558)
+ d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463)
+ c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562)
+ b = md5hh(b, c, d, a, x[i + 14], 23, -35309556)
+ a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060)
+ d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353)
+ c = md5hh(c, d, a, b, x[i + 7], 16, -155497632)
+ b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640)
+ a = md5hh(a, b, c, d, x[i + 13], 4, 681279174)
+ d = md5hh(d, a, b, c, x[i], 11, -358537222)
+ c = md5hh(c, d, a, b, x[i + 3], 16, -722521979)
+ b = md5hh(b, c, d, a, x[i + 6], 23, 76029189)
+ a = md5hh(a, b, c, d, x[i + 9], 4, -640364487)
+ d = md5hh(d, a, b, c, x[i + 12], 11, -421815835)
+ c = md5hh(c, d, a, b, x[i + 15], 16, 530742520)
+ b = md5hh(b, c, d, a, x[i + 2], 23, -995338651)
+
+ a = md5ii(a, b, c, d, x[i], 6, -198630844)
+ d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415)
+ c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905)
+ b = md5ii(b, c, d, a, x[i + 5], 21, -57434055)
+ a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571)
+ d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606)
+ c = md5ii(c, d, a, b, x[i + 10], 15, -1051523)
+ b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799)
+ a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359)
+ d = md5ii(d, a, b, c, x[i + 15], 10, -30611744)
+ c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380)
+ b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649)
+ a = md5ii(a, b, c, d, x[i + 4], 6, -145523070)
+ d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379)
+ c = md5ii(c, d, a, b, x[i + 2], 15, 718787259)
+ b = md5ii(b, c, d, a, x[i + 9], 21, -343485551)
+
+ a = safeAdd(a, olda)
+ b = safeAdd(b, oldb)
+ c = safeAdd(c, oldc)
+ d = safeAdd(d, oldd)
+ }
+ return [a, b, c, d]
+}
+
+/*
+* Convert an array of little-endian words to a string
+*/
+function binl2rstr (input) {
+ var i
+ var output = ''
+ var length32 = input.length * 32
+ for (i = 0; i < length32; i += 8) {
+ output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff)
+ }
+ return output
+}
+
+/*
+* Convert a raw string to an array of little-endian words
+* Characters >255 have their high-byte silently ignored.
+*/
+function rstr2binl (input) {
+ var i
+ var output = []
+ output[(input.length >> 2) - 1] = undefined
+ for (i = 0; i < output.length; i += 1) {
+ output[i] = 0
+ }
+ var length8 = input.length * 8
+ for (i = 0; i < length8; i += 8) {
+ output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32)
+ }
+ return output
+}
+
+/*
+* Calculate the MD5 of a raw string
+*/
+function rstrMD5 (s) {
+ return binl2rstr(binlMD5(rstr2binl(s), s.length * 8))
+}
+
+/*
+* Calculate the HMAC-MD5, of a key and some data (raw strings)
+*/
+function rstrHMACMD5 (key, data) {
+ var i
+ var bkey = rstr2binl(key)
+ var ipad = []
+ var opad = []
+ var hash
+ ipad[15] = opad[15] = undefined
+ if (bkey.length > 16) {
+ bkey = binlMD5(bkey, key.length * 8)
+ }
+ for (i = 0; i < 16; i += 1) {
+ ipad[i] = bkey[i] ^ 0x36363636
+ opad[i] = bkey[i] ^ 0x5c5c5c5c
+ }
+ hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8)
+ return binl2rstr(binlMD5(opad.concat(hash), 512 + 128))
+}
+
+/*
+* Convert a raw string to a hex string
+*/
+function rstr2hex (input) {
+ var hexTab = '0123456789abcdef'
+ var output = ''
+ var x
+ var i
+ for (i = 0; i < input.length; i += 1) {
+ x = input.charCodeAt(i)
+ output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)
+ }
+ return output
+}
+
+/*
+* Encode a string as utf-8
+*/
+function str2rstrUTF8 (input) {
+ return unescape(encodeURIComponent(input))
+}
+
+/*
+* Take string arguments and return either raw or hex encoded strings
+*/
+function rawMD5 (s) {
+ return rstrMD5(str2rstrUTF8(s))
+}
+function hexMD5 (s) {
+ return rstr2hex(rawMD5(s))
+}
+function rawHMACMD5 (k, d) {
+ return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d))
+}
+function hexHMACMD5 (k, d) {
+ return rstr2hex(rawHMACMD5(k, d))
+}
+
+function md5 (string, key, raw) {
+ if (!key) {
+ if (!raw) {
+ return hexMD5(string)
+ }
+ return rawMD5(string)
+ }
+ if (!raw) {
+ return hexHMACMD5(key, string)
+ }
+ return rawHMACMD5(key, string)
+}
\ No newline at end of file
diff --git a/src/main/webapp/kindeditor/asp.net/README.txt b/src/main/webapp/kindeditor/asp.net/README.txt
new file mode 100644
index 0000000..24c7ad4
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp.net/README.txt
@@ -0,0 +1,12 @@
+KindEditor ASP.NET
+
+本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。
+如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+
+使用方法:
+
+1. 解压zip文件,将所有文件复制到IIS的wwwroot/kindeditor目录下。
+
+2. 将kindeditor/asp.net/bin目录下的dll文件复制到wwwroot/bin目录下。
+
+3. 打开浏览器,输入http://localhost:[P0RT]/kindeditor/asp.net/demo.aspx。
diff --git a/src/main/webapp/kindeditor/asp.net/bin/LitJSON.dll b/src/main/webapp/kindeditor/asp.net/bin/LitJSON.dll
new file mode 100644
index 0000000..9cc439d
Binary files /dev/null and b/src/main/webapp/kindeditor/asp.net/bin/LitJSON.dll differ
diff --git a/src/main/webapp/kindeditor/asp.net/demo.aspx b/src/main/webapp/kindeditor/asp.net/demo.aspx
new file mode 100644
index 0000000..94409b1
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp.net/demo.aspx
@@ -0,0 +1,53 @@
+<%@ Page Language="C#" AutoEventWireup="true" validateRequest="false" %>
+
+
+
+
+
+
+
+
+
KindEditor ASP.NET
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/kindeditor/asp.net/file_manager_json.ashx b/src/main/webapp/kindeditor/asp.net/file_manager_json.ashx
new file mode 100644
index 0000000..857e7ce
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp.net/file_manager_json.ashx
@@ -0,0 +1,227 @@
+<%@ webhandler Language="C#" class="FileManager" %>
+
+/**
+ * KindEditor ASP.NET
+ *
+ * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。
+ * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.IO;
+using System.Text.RegularExpressions;
+using LitJson;
+using System.Collections.Generic;
+
+public class FileManager : IHttpHandler
+{
+ public void ProcessRequest(HttpContext context)
+ {
+ String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1);
+
+ //根目录路径,相对路径
+ String rootPath = "../attached/";
+ //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
+ String rootUrl = aspxUrl + "../attached/";
+ //图片扩展名
+ String fileTypes = "gif,jpg,jpeg,png,bmp";
+
+ String currentPath = "";
+ String currentUrl = "";
+ String currentDirPath = "";
+ String moveupDirPath = "";
+
+ String dirPath = context.Server.MapPath(rootPath);
+ String dirName = context.Request.QueryString["dir"];
+ if (!String.IsNullOrEmpty(dirName)) {
+ if (Array.IndexOf("image,flash,media,file".Split(','), dirName) == -1) {
+ context.Response.Write("Invalid Directory name.");
+ context.Response.End();
+ }
+ dirPath += dirName + "/";
+ rootUrl += dirName + "/";
+ if (!Directory.Exists(dirPath)) {
+ Directory.CreateDirectory(dirPath);
+ }
+ }
+
+ //根据path参数,设置各路径和URL
+ String path = context.Request.QueryString["path"];
+ path = String.IsNullOrEmpty(path) ? "" : path;
+ if (path == "")
+ {
+ currentPath = dirPath;
+ currentUrl = rootUrl;
+ currentDirPath = "";
+ moveupDirPath = "";
+ }
+ else
+ {
+ currentPath = dirPath + path;
+ currentUrl = rootUrl + path;
+ currentDirPath = path;
+ moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1");
+ }
+
+ //排序形式,name or size or type
+ String order = context.Request.QueryString["order"];
+ order = String.IsNullOrEmpty(order) ? "" : order.ToLower();
+
+ //不允许使用..移动到上一级目录
+ if (Regex.IsMatch(path, @"\.\."))
+ {
+ context.Response.Write("Access is not allowed.");
+ context.Response.End();
+ }
+ //最后一个字符不是/
+ if (path != "" && !path.EndsWith("/"))
+ {
+ context.Response.Write("Parameter is not valid.");
+ context.Response.End();
+ }
+ //目录不存在或不是目录
+ if (!Directory.Exists(currentPath))
+ {
+ context.Response.Write("Directory does not exist.");
+ context.Response.End();
+ }
+
+ //遍历目录取得文件信息
+ string[] dirList = Directory.GetDirectories(currentPath);
+ string[] fileList = Directory.GetFiles(currentPath);
+
+ switch (order)
+ {
+ case "size":
+ Array.Sort(dirList, new NameSorter());
+ Array.Sort(fileList, new SizeSorter());
+ break;
+ case "type":
+ Array.Sort(dirList, new NameSorter());
+ Array.Sort(fileList, new TypeSorter());
+ break;
+ case "name":
+ default:
+ Array.Sort(dirList, new NameSorter());
+ Array.Sort(fileList, new NameSorter());
+ break;
+ }
+
+ Hashtable result = new Hashtable();
+ result["moveup_dir_path"] = moveupDirPath;
+ result["current_dir_path"] = currentDirPath;
+ result["current_url"] = currentUrl;
+ result["total_count"] = dirList.Length + fileList.Length;
+ List
dirFileList = new List();
+ result["file_list"] = dirFileList;
+ for (int i = 0; i < dirList.Length; i++)
+ {
+ DirectoryInfo dir = new DirectoryInfo(dirList[i]);
+ Hashtable hash = new Hashtable();
+ hash["is_dir"] = true;
+ hash["has_file"] = (dir.GetFileSystemInfos().Length > 0);
+ hash["filesize"] = 0;
+ hash["is_photo"] = false;
+ hash["filetype"] = "";
+ hash["filename"] = dir.Name;
+ hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
+ dirFileList.Add(hash);
+ }
+ for (int i = 0; i < fileList.Length; i++)
+ {
+ FileInfo file = new FileInfo(fileList[i]);
+ Hashtable hash = new Hashtable();
+ hash["is_dir"] = false;
+ hash["has_file"] = false;
+ hash["filesize"] = file.Length;
+ hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0);
+ hash["filetype"] = file.Extension.Substring(1);
+ hash["filename"] = file.Name;
+ hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
+ dirFileList.Add(hash);
+ }
+ context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8");
+ context.Response.Write(JsonMapper.ToJson(result));
+ context.Response.End();
+ }
+
+ public class NameSorter : IComparer
+ {
+ public int Compare(object x, object y)
+ {
+ if (x == null && y == null)
+ {
+ return 0;
+ }
+ if (x == null)
+ {
+ return -1;
+ }
+ if (y == null)
+ {
+ return 1;
+ }
+ FileInfo xInfo = new FileInfo(x.ToString());
+ FileInfo yInfo = new FileInfo(y.ToString());
+
+ return xInfo.FullName.CompareTo(yInfo.FullName);
+ }
+ }
+
+ public class SizeSorter : IComparer
+ {
+ public int Compare(object x, object y)
+ {
+ if (x == null && y == null)
+ {
+ return 0;
+ }
+ if (x == null)
+ {
+ return -1;
+ }
+ if (y == null)
+ {
+ return 1;
+ }
+ FileInfo xInfo = new FileInfo(x.ToString());
+ FileInfo yInfo = new FileInfo(y.ToString());
+
+ return xInfo.Length.CompareTo(yInfo.Length);
+ }
+ }
+
+ public class TypeSorter : IComparer
+ {
+ public int Compare(object x, object y)
+ {
+ if (x == null && y == null)
+ {
+ return 0;
+ }
+ if (x == null)
+ {
+ return -1;
+ }
+ if (y == null)
+ {
+ return 1;
+ }
+ FileInfo xInfo = new FileInfo(x.ToString());
+ FileInfo yInfo = new FileInfo(y.ToString());
+
+ return xInfo.Extension.CompareTo(yInfo.Extension);
+ }
+ }
+
+ public bool IsReusable
+ {
+ get
+ {
+ return true;
+ }
+ }
+}
diff --git a/src/main/webapp/kindeditor/asp.net/upload_json.ashx b/src/main/webapp/kindeditor/asp.net/upload_json.ashx
new file mode 100644
index 0000000..f5b8518
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp.net/upload_json.ashx
@@ -0,0 +1,121 @@
+<%@ webhandler Language="C#" class="Upload" %>
+
+/**
+ * KindEditor ASP.NET
+ *
+ * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。
+ * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.IO;
+using System.Globalization;
+using LitJson;
+
+public class Upload : IHttpHandler
+{
+ private HttpContext context;
+
+ public void ProcessRequest(HttpContext context)
+ {
+ String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1);
+
+ //文件保存目录路径
+ String savePath = "../attached/";
+
+ //文件保存目录URL
+ String saveUrl = aspxUrl + "../attached/";
+
+ //定义允许上传的文件扩展名
+ Hashtable extTable = new Hashtable();
+ extTable.Add("image", "gif,jpg,jpeg,png,bmp");
+ extTable.Add("flash", "swf,flv");
+ extTable.Add("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb");
+ extTable.Add("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2");
+
+ //最大文件大小
+ int maxSize = 1000000;
+ this.context = context;
+
+ HttpPostedFile imgFile = context.Request.Files["imgFile"];
+ if (imgFile == null)
+ {
+ showError("请选择文件。");
+ }
+
+ String dirPath = context.Server.MapPath(savePath);
+ if (!Directory.Exists(dirPath))
+ {
+ showError("上传目录不存在。");
+ }
+
+ String dirName = context.Request.QueryString["dir"];
+ if (String.IsNullOrEmpty(dirName)) {
+ dirName = "image";
+ }
+ if (!extTable.ContainsKey(dirName)) {
+ showError("目录名不正确。");
+ }
+
+ String fileName = imgFile.FileName;
+ String fileExt = Path.GetExtension(fileName).ToLower();
+
+ if (imgFile.InputStream == null || imgFile.InputStream.Length > maxSize)
+ {
+ showError("上传文件大小超过限制。");
+ }
+
+ if (String.IsNullOrEmpty(fileExt) || Array.IndexOf(((String)extTable[dirName]).Split(','), fileExt.Substring(1).ToLower()) == -1)
+ {
+ showError("上传文件扩展名是不允许的扩展名。\n只允许" + ((String)extTable[dirName]) + "格式。");
+ }
+
+ //创建文件夹
+ dirPath += dirName + "/";
+ saveUrl += dirName + "/";
+ if (!Directory.Exists(dirPath)) {
+ Directory.CreateDirectory(dirPath);
+ }
+ String ymd = DateTime.Now.ToString("yyyyMMdd", DateTimeFormatInfo.InvariantInfo);
+ dirPath += ymd + "/";
+ saveUrl += ymd + "/";
+ if (!Directory.Exists(dirPath)) {
+ Directory.CreateDirectory(dirPath);
+ }
+
+ String newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
+ String filePath = dirPath + newFileName;
+
+ imgFile.SaveAs(filePath);
+
+ String fileUrl = saveUrl + newFileName;
+
+ Hashtable hash = new Hashtable();
+ hash["error"] = 0;
+ hash["url"] = fileUrl;
+ context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
+ context.Response.Write(JsonMapper.ToJson(hash));
+ context.Response.End();
+ }
+
+ private void showError(string message)
+ {
+ Hashtable hash = new Hashtable();
+ hash["error"] = 1;
+ hash["message"] = message;
+ context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
+ context.Response.Write(JsonMapper.ToJson(hash));
+ context.Response.End();
+ }
+
+ public bool IsReusable
+ {
+ get
+ {
+ return true;
+ }
+ }
+}
diff --git a/src/main/webapp/kindeditor/asp/JSON_2.0.4.asp b/src/main/webapp/kindeditor/asp/JSON_2.0.4.asp
new file mode 100644
index 0000000..ae1b383
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp/JSON_2.0.4.asp
@@ -0,0 +1,210 @@
+<%
+'
+' VBS JSON 2.0.3
+' Copyright (c) 2009 Turul Topuz
+' Under the MIT (MIT-LICENSE.txt) license.
+'
+
+Const JSON_OBJECT = 0
+Const JSON_ARRAY = 1
+
+Class jsCore
+ Public Collection
+ Public Count
+ Public QuotedVars
+ Public Kind ' 0 = object, 1 = array
+
+ Private Sub Class_Initialize
+ Set Collection = CreateObject("Scripting.Dictionary")
+ QuotedVars = True
+ Count = 0
+ End Sub
+
+ Private Sub Class_Terminate
+ Set Collection = Nothing
+ End Sub
+
+ ' counter
+ Private Property Get Counter
+ Counter = Count
+ Count = Count + 1
+ End Property
+
+ ' - data maluplation
+ ' -- pair
+ Public Property Let Pair(p, v)
+ If IsNull(p) Then p = Counter
+ Collection(p) = v
+ End Property
+
+ Public Property Set Pair(p, v)
+ If IsNull(p) Then p = Counter
+ If TypeName(v) <> "jsCore" Then
+ Err.Raise &hD, "class: class", "Incompatible types: '" & TypeName(v) & "'"
+ End If
+ Set Collection(p) = v
+ End Property
+
+ Public Default Property Get Pair(p)
+ If IsNull(p) Then p = Count - 1
+ If IsObject(Collection(p)) Then
+ Set Pair = Collection(p)
+ Else
+ Pair = Collection(p)
+ End If
+ End Property
+ ' -- pair
+ Public Sub Clean
+ Collection.RemoveAll
+ End Sub
+
+ Public Sub Remove(vProp)
+ Collection.Remove vProp
+ End Sub
+ ' data maluplation
+
+ ' encoding
+ Function jsEncode(str)
+ Dim charmap(127), haystack()
+ charmap(8) = "\b"
+ charmap(9) = "\t"
+ charmap(10) = "\n"
+ charmap(12) = "\f"
+ charmap(13) = "\r"
+ charmap(34) = "\"""
+ charmap(47) = "\/"
+ charmap(92) = "\\"
+
+ Dim strlen : strlen = Len(str) - 1
+ ReDim haystack(strlen)
+
+ Dim i, charcode
+ For i = 0 To strlen
+ haystack(i) = Mid(str, i + 1, 1)
+
+ charcode = AscW(haystack(i)) And 65535
+ If charcode < 127 Then
+ If Not IsEmpty(charmap(charcode)) Then
+ haystack(i) = charmap(charcode)
+ ElseIf charcode < 32 Then
+ haystack(i) = "\u" & Right("000" & Hex(charcode), 4)
+ End If
+ Else
+ haystack(i) = "\u" & Right("000" & Hex(charcode), 4)
+ End If
+ Next
+
+ jsEncode = Join(haystack, "")
+ End Function
+
+ ' converting
+ Public Function toJSON(vPair)
+ Select Case VarType(vPair)
+ Case 0 ' Empty
+ toJSON = "null"
+ Case 1 ' Null
+ toJSON = "null"
+ Case 7 ' Date
+ ' toJSON = "new Date(" & (vPair - CDate(25569)) * 86400000 & ")" ' let in only utc time
+ toJSON = """" & CStr(vPair) & """"
+ Case 8 ' String
+ toJSON = """" & jsEncode(vPair) & """"
+ Case 9 ' Object
+ Dim bFI,i
+ bFI = True
+ If vPair.Kind Then toJSON = toJSON & "[" Else toJSON = toJSON & "{"
+ For Each i In vPair.Collection
+ If bFI Then bFI = False Else toJSON = toJSON & ","
+
+ If vPair.Kind Then
+ toJSON = toJSON & toJSON(vPair(i))
+ Else
+ If QuotedVars Then
+ toJSON = toJSON & """" & i & """:" & toJSON(vPair(i))
+ Else
+ toJSON = toJSON & i & ":" & toJSON(vPair(i))
+ End If
+ End If
+ Next
+ If vPair.Kind Then toJSON = toJSON & "]" Else toJSON = toJSON & "}"
+ Case 11
+ If vPair Then toJSON = "true" Else toJSON = "false"
+ Case 12, 8192, 8204
+ toJSON = RenderArray(vPair, 1, "")
+ Case Else
+ toJSON = Replace(vPair, ",", ".")
+ End select
+ End Function
+
+ Function RenderArray(arr, depth, parent)
+ Dim first : first = LBound(arr, depth)
+ Dim last : last = UBound(arr, depth)
+
+ Dim index, rendered
+ Dim limiter : limiter = ","
+
+ RenderArray = "["
+ For index = first To last
+ If index = last Then
+ limiter = ""
+ End If
+
+ On Error Resume Next
+ rendered = RenderArray(arr, depth + 1, parent & index & "," )
+
+ If Err = 9 Then
+ On Error GoTo 0
+ RenderArray = RenderArray & toJSON(Eval("arr(" & parent & index & ")")) & limiter
+ Else
+ RenderArray = RenderArray & rendered & "" & limiter
+ End If
+ Next
+ RenderArray = RenderArray & "]"
+ End Function
+
+ Public Property Get jsString
+ jsString = toJSON(Me)
+ End Property
+
+ Sub Flush
+ If TypeName(Response) <> "Empty" Then
+ Response.Write(jsString)
+ ElseIf WScript <> Empty Then
+ WScript.Echo(jsString)
+ End If
+ End Sub
+
+ Public Function Clone
+ Set Clone = ColClone(Me)
+ End Function
+
+ Private Function ColClone(core)
+ Dim jsc, i
+ Set jsc = new jsCore
+ jsc.Kind = core.Kind
+ For Each i In core.Collection
+ If IsObject(core(i)) Then
+ Set jsc(i) = ColClone(core(i))
+ Else
+ jsc(i) = core(i)
+ End If
+ Next
+ Set ColClone = jsc
+ End Function
+
+End Class
+
+Function jsObject
+ Set jsObject = new jsCore
+ jsObject.Kind = JSON_OBJECT
+End Function
+
+Function jsArray
+ Set jsArray = new jsCore
+ jsArray.Kind = JSON_ARRAY
+End Function
+
+Function toJSON(val)
+ toJSON = (new jsCore).toJSON(val)
+End Function
+%>
\ No newline at end of file
diff --git a/src/main/webapp/kindeditor/asp/UpLoad_Class.asp b/src/main/webapp/kindeditor/asp/UpLoad_Class.asp
new file mode 100644
index 0000000..476f6f9
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp/UpLoad_Class.asp
@@ -0,0 +1,561 @@
+<%
+'=========================================================
+ '类名: AnUpLoad(艾恩无组件上传类)
+ '作者: Anlige
+ '版本: 艾恩ASP无组件上传类V11.03.25
+ '开发日期: 2008-4-12
+ '修改日期: 2011-03025
+ '主页: http://dev.mo.cn
+ 'Email: zhanghuiguoanlige@126.com
+ 'QQ: 1034555083
+'=========================================================
+Dim StreamT
+Class AnUpLoad
+ Private Form, Fils
+ Private vCharSet, vMaxSize, vSingleSize, vErr, vVersion, vTotalSize, vExe, pID, vOP, vErrExe,vboundary, vLostTime, vMode, vFileCount
+
+ '==============================
+ '设置和读取属性开始
+ '==============================
+ Public Property Let Mode(ByVal value)
+ vMode = value
+ End Property
+
+ Public Property Let MaxSize(ByVal value)
+ vMaxSize = value
+ End Property
+
+ Public Property Let SingleSize(ByVal value)
+ vSingleSize = value
+ End Property
+
+ Public Property Let Exe(ByVal value)
+ vExe = LCase(value)
+ End Property
+
+ Public Property Let CharSet(ByVal value)
+ vCharSet = value
+ End Property
+
+ Public Property Get ErrorID()
+ ErrorID = vErr
+ End Property
+
+ Public Property Get FileCount()
+ FileCount = Fils.count
+ End Property
+
+ Public Property Get Description()
+ Description = GetErr(vErr)
+ End Property
+
+ Public Property Get Version()
+ Version = vVersion
+ End Property
+
+ Public Property Get TotalSize()
+ TotalSize = vTotalSize
+ End Property
+
+ Public Property Get ProcessID()
+ ProcessID = pID
+ End Property
+
+ Public Property Let openProcesser(ByVal value)
+ vOP = value
+ End Property
+
+ Public Property Get LostTime()
+ LostTime = vLostTime
+ End Property
+ '==============================
+ '设置和读取属性结束,初始化类
+ '==============================
+
+ Private Sub Class_Initialize()
+ set Form = server.createobject("Scripting.Dictionary")
+ set Fils = server.createobject("Scripting.Dictionary")
+ Set StreamT = server.CreateObject("Adodb.stream")
+ vVersion = "艾恩ASP无组件上传类V10.10.22"
+ vMaxSize = -1
+ vSingleSize = -1
+ vErr = -1
+ vExe = ""
+ vTotalSize = 0
+ vCharSet = "utf-8"
+ vOP=false
+ pID="AnUpload"
+ setApp "",0,0,""
+ vMode = 0
+ End Sub
+
+ Private Sub Class_Terminate()
+ Dim f
+ Form.RemoveAll()
+ For each f in Fils
+ Fils(f).value=empty
+ Set Fils(f) = Nothing
+ Next
+ Fils.RemoveAll()
+ Set Form = Nothing
+ Set Fils = Nothing
+ StreamT.Close()
+ Set StreamT = Nothing
+ End Sub
+
+ '==============================
+ '函数名:GetData
+ '作用:处理客户端提交来的所有数据
+ '==============================
+ Public Sub GetData()
+ Dim time1
+ time1 = timer()
+ if vOP And trim(request.querystring("processid"))<>"" then pID=request.querystring("processid")
+ Dim value, str, bcrlf, fpos, sSplit, slen, istart,ef
+ Dim TotalBytes,tempdata,BytesRead,ChunkReadSize,PartSize,DataPart,formend, formhead, startpos, endpos, formname, FileName, fileExe, valueend, NewName,localname,type_1,contentType
+ TotalBytes = Request.TotalBytes
+ ef = false
+ If checkEntryType = false Then ef = true : vErr = 2
+ '下面3句注释掉了,因为在IIS5.0中,如果上传大小大于限制大小的文件,会出错,一直没找到解决方法。如果是在IIS5以上的版本使用,可以取消下面3句的注释
+ 'If Not ef Then
+ 'If vMaxSize > 0 And TotalBytes > vMaxSize Then ef = true : vErr = 1
+ 'End If
+ If ef Then Exit Sub
+ If vMode = 0 Then
+ vTotalSize = 0
+ StreamT.Type = 1
+ StreamT.Mode = 3
+ StreamT.Open
+ BytesRead = 0
+ ChunkReadSize = 1024 * 16
+ Do While BytesRead < TotalBytes
+ PartSize = ChunkReadSize
+ If PartSize + BytesRead > TotalBytes Then PartSize = TotalBytes - BytesRead
+ DataPart = Request.BinaryRead(PartSize)
+ StreamT.Write DataPart
+ BytesRead = BytesRead + PartSize
+ setApp "uploading",TotalBytes,BytesRead,""
+ Loop
+ setApp "uploaded",TotalBytes,BytesRead,""
+ StreamT.Position = 0
+ tempdata = StreamT.Read
+ Else
+ tempdata = Request.BinaryRead(TotalBytes)
+ End If
+ bcrlf = ChrB(13) & ChrB(10)
+ fpos = InStrB(1, tempdata, bcrlf)
+ sSplit = MidB(tempdata, 1, fpos - 1)
+ slen = LenB(sSplit)
+ istart = slen + 2
+ Do
+ formend = InStrB(istart, tempdata, bcrlf & bcrlf)
+ formhead = MidB(tempdata, istart, formend - istart)
+ str = Bytes2Str(formhead)
+ startpos = InStr(str, "name=""") + 6
+ endpos = InStr(startpos, str, """")
+ formname = LCase(Mid(str, startpos, endpos - startpos))
+ valueend = InStrB(formend + 3, tempdata, sSplit)
+ If InStr(str, "filename=""") > 0 Then
+ startpos = InStr(str, "filename=""") + 10
+ endpos = InStr(startpos, str, """")
+ type_1=instr(endpos,lcase(str),"content-type")
+ contentType=trim(mid(str,type_1+13))
+ FileName = Mid(str, startpos, endpos - startpos)
+ If Trim(FileName) <> "" Then
+ LocalName = FileName
+ FileName = Replace(FileName, "/", "\")
+ FileName = Mid(FileName, InStrRev(FileName, "\") + 1)
+ If instr(FileName,".")>0 Then
+ fileExe = Split(FileName, ".")(UBound(Split(FileName, ".")))
+ else
+ fileExe = ""
+ End If
+ If vExe <> "" Then '判断扩展名
+ If checkExe(fileExe) = True Then
+ vErr = 3
+ vErrExe = fileExe
+ tempdata = empty
+ Exit Sub
+ End If
+ End If
+ NewName = Getname()
+ NewName = NewName & "." & fileExe
+ vTotalSize = vTotalSize + valueend - formend - 6
+ If vSingleSize > 0 And (valueend - formend - 6) > vSingleSize Then '判断上传单个文件大小
+ vErr = 5
+ tempdata = empty
+ Exit Sub
+ End If
+ If vMaxSize > 0 And vTotalSize > vMaxSize Then '判断上传数据总大小
+ vErr = 1
+ tempdata = empty
+ Exit Sub
+ End If
+ If Fils.Exists(formname) Then
+ vErr = 4
+ tempdata = empty
+ Exit Sub
+ Else
+ Dim fileCls:set fileCls= new UploadFileEx
+ fileCls.ContentType=contentType
+ fileCls.Size = (valueend - formend - 6)
+ fileCls.Position = (formend + 3)
+ fileCls.FormName = formname
+ fileCls.NewName = NewName
+ fileCls.FileName = FileName
+ fileCls.LocalName = FileName
+ fileCls.extend=split(NewName,".")(ubound(split(NewName,".")))
+ Fils.Add formname, fileCls
+ Set fileCls = Nothing
+ End If
+ End If
+ Else
+ value = MidB(tempdata, formend + 4, valueend - formend - 6)
+ If Form.Exists(formname) Then
+ Form(formname) = Form(formname) & "," & Bytes2Str(value)
+ Else
+ Form.Add formname, Bytes2Str(value)
+ End If
+ End If
+ istart = valueend + 2 + slen
+ Loop Until (istart + 2) >= LenB(tempdata)
+ vErr = 0
+ tempdata = empty
+ vLostTime = FormatNumber((timer-time1)*1000,2)
+ End Sub
+
+ Public sub setApp(stp,total,current,desc)
+ Application.lock()
+ Application(pID)="{ID:""" & pID & """,step:""" & stp & """,total:" & total & ",now:" & current & ",description:""" & desc & """,dt:""" & now() & """}"
+ Application.unlock()
+ end sub
+ '==============================
+ '判断扩展名
+ '==============================
+ Private Function checkExe(ByVal ex)
+ Dim notIn: notIn = True
+ If vExe="*" then
+ notIn=false
+ elseIf InStr(1, vExe, "|") > 0 Then
+ Dim tempExe: tempExe = Split(vExe, "|")
+ Dim I: I = 0
+ For I = 0 To UBound(tempExe)
+ If LCase(ex) = tempExe(I) Then
+ notIn = False
+ Exit For
+ End If
+ Next
+ Else
+ If vExe = LCase(ex) Then
+ notIn = False
+ End If
+ End If
+ checkExe = notIn
+ End Function
+
+ '==============================
+ '把数字转换为文件大小显示方式
+ '==============================
+ Public Function GetSize(ByVal Size)
+ If Size < 1024 Then
+ GetSize = FormatNumber(Size, 2) & "B"
+ ElseIf Size >= 1024 And Size < 1048576 Then
+ GetSize = FormatNumber(Size / 1024, 2) & "KB"
+ ElseIf Size >= 1048576 Then
+ GetSize = FormatNumber((Size / 1024) / 1024, 2) & "MB"
+ End If
+ End Function
+
+ '==============================
+ '二进制数据转换为字符
+ '==============================
+ Private Function Bytes2Str(ByVal byt)
+ If LenB(byt) = 0 Then
+ Bytes2Str = ""
+ Exit Function
+ End If
+ Dim mystream, bstr
+ Set mystream =server.createobject("ADODB.Stream")
+ mystream.Type = 2
+ mystream.Mode = 3
+ mystream.Open
+ mystream.WriteText byt
+ mystream.Position = 0
+ mystream.CharSet = vCharSet
+ mystream.Position = 2
+ bstr = mystream.ReadText()
+ mystream.Close
+ Set mystream = Nothing
+ Bytes2Str = bstr
+ End Function
+
+ '==============================
+ '获取错误描述
+ '==============================
+ Private Function GetErr(ByVal Num)
+ Select Case Num
+ Case 0
+ GetErr = "数据处理完毕!"
+ Case 1
+ GetErr = "上传数据超过" & GetSize(vMaxSize) & "限制!可设置MaxSize属性来改变限制!"
+ Case 2
+ GetErr = "未设置上传表单enctype属性为multipart/form-data或者未设置method属性为Post,上传无效!"
+ Case 3
+ GetErr = "含有非法扩展名(" & vErrExe & ")文件!只能上传扩展名为" & Replace(vExe, "|", ",") & "的文件"
+ Case 4
+ GetErr = "对不起,程序不允许使用相同name属性的文件域!"
+ Case 5
+ GetErr = "单个文件大小超出" & GetSize(vSingleSize) & "的上传限制!"
+ End Select
+ End Function
+
+ '==============================
+ '根据日期生成随机文件名
+ '==============================
+ Private Function Getname()
+ Dim y, m, d, h, mm, S, r
+ Randomize
+ y = Year(Now)
+ m = right("0" & Month(Now),2)
+ d = right("0" & Day(Now),2)
+ h = right("0" & Hour(Now),2)
+ mm =right("0" & Minute(Now),2)
+ S = right("0" & Second(Now),2)
+ r = 0
+ r = CInt(Rnd() * 10000)
+ S = right("0000" & r,4)
+ Getname = y & m & d & h & mm & S & r
+ End Function
+
+ '==============================
+ '检测上传类型是否为multipart/form-data
+ '==============================
+ Private Function checkEntryType()
+ Dim ContentType, ctArray, bArray,RequestMethod
+ RequestMethod=trim(LCase(Request.ServerVariables("REQUEST_METHOD")))
+ if RequestMethod="" or RequestMethod<>"post" then
+ checkEntryType = False
+ exit function
+ end if
+ ContentType = LCase(Request.ServerVariables("HTTP_CONTENT_TYPE"))
+ ctArray = Split(ContentType, ";")
+ if ubound(ctarray)>=0 then
+ If Trim(ctArray(0)) = "multipart/form-data" Then
+ checkEntryType = True
+ vboundary = Split(ContentType,"boundary=")(1)
+ Else
+ checkEntryType = False
+ End If
+ else
+ checkEntryType = False
+ end if
+ End Function
+
+ '==============================
+ '获取上传表单值,参数可选,如果为-1则返回一个包含所有表单项的一个dictionary对象
+ '==============================
+ Public Function Forms(ByVal formname)
+ If trim(formname) = "-1" Then
+ Set Forms = Form
+ Else
+ If Form.Exists(LCase(formname)) Then
+ Forms = Form(LCase(formname))
+ Else
+ Forms = ""
+ End If
+ End If
+ End Function
+
+ '==============================
+ '获取上传的文件类,参数可选,如果为-1则返回一个包含所有上传文件类的一个dictionary对象
+ '==============================
+ Public Function Files(ByVal formname)
+ If trim(formname) = "-1" Then
+ Set Files = Fils
+ Else
+ If Fils.Exists(LCase(formname)) Then
+ Set Files = Fils(LCase(formname))
+ Else
+ Set Files = Nothing
+ End If
+ End If
+ End Function
+End Class
+
+Class UploadFileEx
+ Private mvarFormName , mvarNewName , mvarLocalName , mvarFileName , mvarUserSetName , mvarContentType ,mException,mvarPosition
+ Private mvarSize , mvarValue , mvarPath , mvarExtend ,mvarWidth, mvarHeight
+
+ Public Property Let Extend(ByVal vData )
+ mvarExtend = vData
+ End Property
+ Public Property Get Extend()
+ Extend = mvarExtend
+ End Property
+
+ Public Property Get Width()
+ Width = mvarWidth
+ End Property
+
+ Public Property Get Height()
+ Height = mvarHeight
+ End Property
+
+
+ Public Property Let Path(ByVal vData )
+ mvarPath = vData
+ End Property
+ Public Property Get Path()
+ Path = mvarPath
+ End Property
+
+ Public Property Get Exception()
+ Exception = mException
+ End Property
+
+ Public Property Let Value(ByVal vData )
+ mvarValue = vData
+ End Property
+
+ Public Property Get Value()
+ Value = mvarValue
+ End Property
+
+ Public Property Let Size(ByVal vData )
+ mvarSize = vData
+ End Property
+ Public Property Get Size()
+ Size = mvarSize
+ End Property
+
+ Public Property Let Position(ByVal vData )
+ mvarPosition = vData
+ End Property
+ Public Property Get Position()
+ Size = mvarPosition
+ End Property
+
+ Public Property Let ContentType(ByVal vData )
+ mvarContentType = vData
+ End Property
+ Public Property Get ContentType()
+ ContentType = mvarContentType
+ End Property
+
+ Public Property Let UserSetName(ByVal vData )
+ mvarUserSetName = vData
+ End Property
+ Public Property Get UserSetName()
+ UserSetName = mvarUserSetName
+ End Property
+
+ Public Property Let FileName(ByVal vData )
+ mvarFileName = vData
+ End Property
+ Public Property Get FileName()
+ FileName = mvarFileName
+ End Property
+
+ Public Property Let LocalName(ByVal vData )
+ mvarLocalName = vData
+ End Property
+ Public Property Get LocalName()
+ LocalName = mvarLocalName
+ End Property
+
+ Public Property Let NewName(ByVal vData )
+ mvarNewName = vData
+ End Property
+ Public Property Get NewName()
+ NewName = mvarNewName
+ End Property
+
+ Public Property Let FormName(ByVal vData )
+ mvarFormName = vData
+ End Property
+ Public Property Get FormName()
+ FormName = mvarFormName
+ End Property
+
+ Private Sub Class_Initialize()
+ mvarSize =0
+ mvarWidth = 0
+ mvarHeight = 0
+ End Sub
+
+ Public Function SaveToFile(ByVal Path , byval tOption, byval OverWrite)
+ On Error Resume Next
+ Dim IsP
+ IsP = (InStr(Path, ":") = 2)
+ If Not IsP Then Path = Server.MapPath(Path)
+ Path = Replace(Path, "/", "\")
+ If Mid(Path, Len(Path) - 1) <> "\" Then Path = Path + "\"
+ CreateFolder Path
+ mvarPath = Path
+ If tOption = 1 Then
+ Path = Path & mvarLocalName: mvarFileName = mvarLocalName
+ Else
+ If tOption = -1 And mvarUserSetName <> "" Then
+ Path = Path & mvarUserSetName & "." & mvarExtend: mvarFileName = mvarUserSetName & "." & mvarExtend
+ Else
+ Path = Path & mvarNewName: mvarFileName = mvarNewName
+ End If
+ End If
+ If Not OverWrite Then
+ Path = GetFilePath()
+ End If
+ Dim tmpStrm
+ Set tmpStrm =server.CreateObject("ADODB.Stream")
+ tmpStrm.Mode = 3
+ tmpStrm.Type = 1
+ tmpStrm.Open
+ StreamT.Position = mvarPosition
+ StreamT.copyto tmpStrm,mvarSize
+ tmpStrm.SaveToFile Path, 2
+ tmpStrm.Close
+ Set tmpStrm = Nothing
+ If Not Err Then
+ Set SaveToFile = objFromJson("{error:false}")
+ Else
+ Set SaveToFile = objFromJson("{error:true,description:'" & replace(Err.Description,"'","\'") & "'}")
+ mException=Err.Description
+ End If
+ End Function
+
+ Public Function GetBytes()
+ StreamT.Position = mvarPosition
+ GetBytes = StreamT.read(mvarSize)
+ End Function
+ Private Function CreateFolder(ByVal folderPath )
+ Dim oFSO
+ Set oFSO = server.CreateObject("Scripting.FileSystemObject")
+ Dim sParent
+ sParent = oFSO.GetParentFolderName(folderPath)
+ If sParent = "" Then Exit Function
+ If Not oFSO.FolderExists(sParent) Then CreateFolder (sParent)
+ If Not oFSO.FolderExists(folderPath) Then oFSO.CreateFolder (folderPath)
+ Set oFSO = Nothing
+ End Function
+
+ Private Function GetFilePath()
+ Dim oFSO, Fname , FNameL , i
+ i = 0
+ Set oFSO = server.CreateObject("Scripting.FileSystemObject")
+ Fname = mvarPath & mvarFileName
+ FNameL = Mid(mvarFileName, 1, InStr(mvarFileName, ".") - 1)
+ Do While oFSO.FileExists(Fname)
+ Fname = mvarPath & FNameL & "(" & i & ")." & mvarExtend
+ mvarFileName = FNameL & "(" & i & ")." & mvarExtend
+ i = i + 1
+ Loop
+ Set oFSO = Nothing
+ GetFilePath = Fname
+ End Function
+End Class
+%>
+
\ No newline at end of file
diff --git a/src/main/webapp/kindeditor/asp/demo.asp b/src/main/webapp/kindeditor/asp/demo.asp
new file mode 100644
index 0000000..1f84c4c
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp/demo.asp
@@ -0,0 +1,60 @@
+<%@ CODEPAGE=65001 %>
+<%
+Option Explicit
+Response.CodePage=65001
+Response.Charset="UTF-8"
+
+Dim htmlData
+
+htmlData = Request.Form("content1")
+
+Function htmlspecialchars(str)
+ str = Replace(str, "&", "&")
+ str = Replace(str, "<", "<")
+ str = Replace(str, ">", ">")
+ str = Replace(str, """", """)
+ htmlspecialchars = str
+End Function
+%>
+
+
+
+
+ KindEditor ASP
+
+
+
+
+
+
+
+
+ <%=htmlData%>
+
+
+
diff --git a/src/main/webapp/kindeditor/asp/file_manager_json.asp b/src/main/webapp/kindeditor/asp/file_manager_json.asp
new file mode 100644
index 0000000..1f1ce51
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp/file_manager_json.asp
@@ -0,0 +1,228 @@
+<%@ CODEPAGE=65001 %>
+<% Option Explicit %>
+<% Response.CodePage=65001 %>
+<% Response.Charset="UTF-8" %>
+
+<%
+
+' KindEditor ASP
+'
+' 本ASP程序是演示程序,建议不要直接在实际项目中使用。
+' 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+'
+
+Dim aspUrl, rootPath, rootUrl, fileTypes
+Dim currentPath, currentUrl, currentDirPath, moveupDirPath
+Dim path, order, dirName, fso, folder, dir, file, result
+Dim fileExt, dirCount, fileCount, orderIndex, i, j
+Dim dirList(), fileList(), isDir, hasFile, filesize, isPhoto, filetype, filename, datetime
+
+aspUrl = Request.ServerVariables("SCRIPT_NAME")
+aspUrl = left(aspUrl, InStrRev(aspUrl, "/"))
+
+'根目录路径,可以指定绝对路径,比如 /var/www/attached/
+rootPath = "../attached/"
+'根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
+rootUrl = aspUrl & "../attached/"
+'图片扩展名
+fileTypes = "gif,jpg,jpeg,png,bmp"
+
+currentPath = ""
+currentUrl = ""
+currentDirPath = ""
+moveupDirPath = ""
+
+Set fso = Server.CreateObject("Scripting.FileSystemObject")
+
+'目录名
+dirName = Request.QueryString("dir")
+If Not isEmpty(dirName) Then
+ If instr(lcase("image,flash,media,file"), dirName) < 1 Then
+ Response.Write "Invalid Directory name."
+ Response.End
+ End If
+ rootPath = rootPath & dirName & "/"
+ rootUrl = rootUrl & dirName & "/"
+ If Not fso.FolderExists(Server.mappath(rootPath)) Then
+ fso.CreateFolder(Server.mappath(rootPath))
+ End If
+End If
+
+'根据path参数,设置各路径和URL
+path = Request.QueryString("path")
+If path = "" Then
+ currentPath = Server.MapPath(rootPath) & "\"
+ currentUrl = rootUrl
+ currentDirPath = ""
+ moveupDirPath = ""
+Else
+ currentPath = Server.MapPath(rootPath & path) & "\"
+ currentUrl = rootUrl + path
+ currentDirPath = path
+ moveupDirPath = RegexReplace(currentDirPath, "(.*?)[^\/]+\/$", "$1")
+End If
+
+Set folder = fso.GetFolder(currentPath)
+
+'排序形式,name or size or type
+order = lcase(Request.QueryString("order"))
+Select Case order
+ Case "type" orderIndex = 4
+ Case "size" orderIndex = 2
+ Case Else orderIndex = 5
+End Select
+
+'不允许使用..移动到上一级目录
+If RegexIsMatch(path, "\.\.") Then
+ Response.Write "Access is not allowed."
+ Response.End
+End If
+'最后一个字符不是/
+If path <> "" And Not RegexIsMatch(path, "\/$") Then
+ Response.Write "Parameter is not allowed."
+ Response.End
+End If
+'目录不存在或不是目录
+If Not DirectoryExists(currentPath) Then
+ Response.Write "Directory does not exist."
+ Response.End
+End If
+
+Set result = jsObject()
+'相对于根目录的上一级目录
+result("moveup_dir_path") = moveupDirPath
+'相对于根目录的当前目录
+result("current_dir_path") = currentDirPath
+'当前目录的URL
+result("current_url") = currentUrl
+
+'文件数
+dirCount = folder.SubFolders.count
+fileCount = folder.Files.count
+result("total_count") = dirCount + fileCount
+
+ReDim dirList(dirCount)
+i = 0
+For Each dir in folder.SubFolders
+ isDir = True
+ hasFile = (dir.Files.count > 0)
+ filesize = 0
+ isPhoto = False
+ filetype = ""
+ filename = dir.name
+ datetime = FormatDate(dir.DateLastModified)
+ dirList(i) = Array(isDir, hasFile, filesize, isPhoto, filetype, filename, datetime)
+ i = i + 1
+Next
+ReDim fileList(fileCount)
+i = 0
+For Each file in folder.Files
+ fileExt = lcase(mid(file.name, InStrRev(file.name, ".") + 1))
+ isDir = False
+ hasFile = False
+ filesize = file.size
+ isPhoto = (instr(lcase(fileTypes), fileExt) > 0)
+ filetype = fileExt
+ filename = file.name
+ datetime = FormatDate(file.DateLastModified)
+ fileList(i) = Array(isDir, hasFile, filesize, isPhoto, filetype, filename, datetime)
+ i = i + 1
+Next
+
+'排序
+Dim minidx, temp
+For i = 0 To dirCount - 2
+ minidx = i
+ For j = i + 1 To dirCount - 1
+ If (dirList(minidx)(5) > dirList(j)(5)) Then
+ minidx = j
+ End If
+ Next
+ If minidx <> i Then
+ temp = dirList(minidx)
+ dirList(minidx) = dirList(i)
+ dirList(i) = temp
+ End If
+Next
+For i = 0 To fileCount - 2
+ minidx = i
+ For j = i + 1 To fileCount - 1
+ If (fileList(minidx)(orderIndex) > fileList(j)(orderIndex)) Then
+ minidx = j
+ End If
+ Next
+ If minidx <> i Then
+ temp = fileList(minidx)
+ fileList(minidx) = fileList(i)
+ fileList(i) = temp
+ End If
+Next
+
+Set result("file_list") = jsArray()
+For i = 0 To dirCount - 1
+ Set result("file_list")(Null) = jsObject()
+ result("file_list")(Null)("is_dir") = dirList(i)(0)
+ result("file_list")(Null)("has_file") = dirList(i)(1)
+ result("file_list")(Null)("filesize") = dirList(i)(2)
+ result("file_list")(Null)("is_photo") = dirList(i)(3)
+ result("file_list")(Null)("filetype") = dirList(i)(4)
+ result("file_list")(Null)("filename") = dirList(i)(5)
+ result("file_list")(Null)("datetime") = dirList(i)(6)
+Next
+For i = 0 To fileCount - 1
+ Set result("file_list")(Null) = jsObject()
+ result("file_list")(Null)("is_dir") = fileList(i)(0)
+ result("file_list")(Null)("has_file") = fileList(i)(1)
+ result("file_list")(Null)("filesize") = fileList(i)(2)
+ result("file_list")(Null)("is_photo") = fileList(i)(3)
+ result("file_list")(Null)("filetype") = fileList(i)(4)
+ result("file_list")(Null)("filename") = fileList(i)(5)
+ result("file_list")(Null)("datetime") = fileList(i)(6)
+Next
+
+'输出JSON字符串
+Response.AddHeader "Content-Type", "text/html; charset=UTF-8"
+result.Flush
+Response.End
+
+'自定义函数
+Function DirectoryExists(dirPath)
+ Dim fso
+ Set fso = Server.CreateObject("Scripting.FileSystemObject")
+ DirectoryExists = fso.FolderExists(dirPath)
+End Function
+
+Function RegexIsMatch(subject, pattern)
+ Dim reg
+ Set reg = New RegExp
+ reg.Global = True
+ reg.MultiLine = True
+ reg.Pattern = pattern
+ RegexIsMatch = reg.Test(subject)
+End Function
+
+Function RegexReplace(subject, pattern, replacement)
+ Dim reg
+ Set reg = New RegExp
+ reg.Global = True
+ reg.MultiLine = True
+ reg.Pattern = pattern
+ RegexReplace = reg.Replace(subject, replacement)
+End Function
+
+Public Function FormatDate(datetime)
+ Dim y, m, d, h, i, s
+ y = CStr(Year(datetime))
+ m = CStr(Month(datetime))
+ If Len(m) = 1 Then m = "0" & m
+ d = CStr(Day(datetime))
+ If Len(d) = 1 Then d = "0" & d
+ h = CStr(Hour(datetime))
+ If Len(h) = 1 Then h = "0" & h
+ i = CStr(Minute(datetime))
+ If Len(i) = 1 Then i = "0" & i
+ s = CStr(Second(datetime))
+ If Len(s) = 1 Then s = "0" & s
+ FormatDate = y & "-" & m & "-" & d & " " & h & ":" & i & ":" & s
+End Function
+%>
diff --git a/src/main/webapp/kindeditor/asp/upload_json.asp b/src/main/webapp/kindeditor/asp/upload_json.asp
new file mode 100644
index 0000000..209f107
--- /dev/null
+++ b/src/main/webapp/kindeditor/asp/upload_json.asp
@@ -0,0 +1,119 @@
+<%@ CODEPAGE=65001 %>
+<% Option Explicit %>
+<% Response.CodePage=65001 %>
+<% Response.Charset="UTF-8" %>
+
+
+<%
+
+' KindEditor ASP
+'
+' 本ASP程序是演示程序,建议不要直接在实际项目中使用。
+' 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+'
+
+Dim aspUrl, savePath, saveUrl, maxSize, fileName, fileExt, newFileName, filePath, fileUrl, dirName
+Dim extStr, imageExtStr, flashExtStr, mediaExtStr, fileExtStr
+Dim upload, file, fso, ranNum, hash, ymd, mm, dd, result
+
+aspUrl = Request.ServerVariables("SCRIPT_NAME")
+aspUrl = left(aspUrl, InStrRev(aspUrl, "/"))
+
+'文件保存目录路径
+savePath = "../attached/"
+'文件保存目录URL
+saveUrl = aspUrl & "../attached/"
+'定义允许上传的文件扩展名
+imageExtStr = "gif|jpg|jpeg|png|bmp"
+flashExtStr = "swf|flv"
+mediaExtStr = "swf|flv|mp3|wav|wma|wmv|mid|avi|mpg|asf|rm|rmvb"
+fileExtStr = "doc|docx|xls|xlsx|ppt|htm|html|txt|zip|rar|gz|bz2"
+'最大文件大小
+maxSize = 5 * 1024 * 1024 '5M
+
+Set fso = Server.CreateObject("Scripting.FileSystemObject")
+If Not fso.FolderExists(Server.mappath(savePath)) Then
+ showError("上传目录不存在。")
+End If
+
+dirName = Request.QueryString("dir")
+If isEmpty(dirName) Then
+ dirName = "image"
+End If
+If instr(lcase("image,flash,media,file"), dirName) < 1 Then
+ showError("目录名不正确。")
+End If
+
+Select Case dirName
+ Case "flash" extStr = flashExtStr
+ Case "media" extStr = mediaExtStr
+ Case "file" extStr = fileExtStr
+ Case Else extStr = imageExtStr
+End Select
+
+set upload = new AnUpLoad
+upload.Exe = extStr
+upload.MaxSize = maxSize
+upload.GetData()
+if upload.ErrorID>0 then
+ showError(upload.Description)
+end if
+
+'创建文件夹
+savePath = savePath & dirName & "/"
+saveUrl = saveUrl & dirName & "/"
+If Not fso.FolderExists(Server.mappath(savePath)) Then
+ fso.CreateFolder(Server.mappath(savePath))
+End If
+mm = month(now)
+If mm < 10 Then
+ mm = "0" & mm
+End If
+dd = day(now)
+If dd < 10 Then
+ dd = "0" & dd
+End If
+ymd = year(now) & mm & dd
+savePath = savePath & ymd & "/"
+saveUrl = saveUrl & ymd & "/"
+If Not fso.FolderExists(Server.mappath(savePath)) Then
+ fso.CreateFolder(Server.mappath(savePath))
+End If
+
+set file = upload.files("imgFile")
+if file is nothing then
+ showError("请选择文件。")
+end if
+
+set result = file.saveToFile(savePath, 0, true)
+if result.error then
+ showError(file.Exception)
+end if
+
+filePath = Server.mappath(savePath & file.filename)
+fileUrl = saveUrl & file.filename
+
+Set upload = nothing
+Set file = nothing
+
+If Not fso.FileExists(filePath) Then
+ showError("上传文件失败。")
+End If
+
+Response.AddHeader "Content-Type", "text/html; charset=UTF-8"
+Set hash = jsObject()
+hash("error") = 0
+hash("url") = fileUrl
+hash.Flush
+Response.End
+
+Function showError(message)
+ Response.AddHeader "Content-Type", "text/html; charset=UTF-8"
+ Dim hash
+ Set hash = jsObject()
+ hash("error") = 1
+ hash("message") = message
+ hash.Flush
+ Response.End
+End Function
+%>
diff --git a/src/main/webapp/kindeditor/jsp/README.txt b/src/main/webapp/kindeditor/jsp/README.txt
new file mode 100644
index 0000000..f59dc08
--- /dev/null
+++ b/src/main/webapp/kindeditor/jsp/README.txt
@@ -0,0 +1,15 @@
+KindEditor JSP
+
+本JSP程序是演示程序,建议不要直接在实际项目中使用。
+如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+
+使用方法:
+
+1. 解压zip文件,将所有文件复制到Tomcat的webapps/kindeditor目录下。
+
+2. 将kindeditor/jsp/lib目录下的3个jar文件复制到Tomcat的lib目录下,并重新启动Tomcat。
+ * commons-fileupload-1.2.1.jar
+ * commons-io-1.4.jar
+ * json_simple-1.1.jar
+
+3. 打开浏览器,输入http://localhost:[P0RT]/kindeditor/jsp/demo.jsp。
diff --git a/src/main/webapp/kindeditor/jsp/demo.jsp b/src/main/webapp/kindeditor/jsp/demo.jsp
new file mode 100644
index 0000000..aa944f7
--- /dev/null
+++ b/src/main/webapp/kindeditor/jsp/demo.jsp
@@ -0,0 +1,56 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%
+request.setCharacterEncoding("UTF-8");
+String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
+%>
+
+
+
+
+ KindEditor JSP
+
+
+
+
+
+
+
+
+ <%=htmlData%>
+
+
+
+<%!
+private String htmlspecialchars(String str) {
+ str = str.replaceAll("&", "&");
+ str = str.replaceAll("<", "<");
+ str = str.replaceAll(">", ">");
+ str = str.replaceAll("\"", """);
+ return str;
+}
+%>
\ No newline at end of file
diff --git a/src/main/webapp/kindeditor/jsp/file_manager_json.jsp b/src/main/webapp/kindeditor/jsp/file_manager_json.jsp
new file mode 100644
index 0000000..808ada0
--- /dev/null
+++ b/src/main/webapp/kindeditor/jsp/file_manager_json.jsp
@@ -0,0 +1,155 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@ page import="java.util.*,java.io.*" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="org.json.simple.*" %>
+<%
+
+/**
+ * KindEditor JSP
+ *
+ * 本JSP程序是演示程序,建议不要直接在实际项目中使用。
+ * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+ *
+ */
+
+//根目录路径,可以指定绝对路径,比如 /var/www/attached/
+String rootPath = pageContext.getServletContext().getRealPath("/") + "attached/";
+//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
+String rootUrl = request.getContextPath() + "/attached/";
+//图片扩展名
+String[] fileTypes = new String[]{"gif", "jpg", "jpeg", "png", "bmp"};
+
+String dirName = request.getParameter("dir");
+if (dirName != null) {
+ if(!Arrays.asList(new String[]{"image", "flash", "media", "file"}).contains(dirName)){
+ out.println("Invalid Directory name.");
+ return;
+ }
+ rootPath += dirName + "/";
+ rootUrl += dirName + "/";
+ File saveDirFile = new File(rootPath);
+ if (!saveDirFile.exists()) {
+ saveDirFile.mkdirs();
+ }
+}
+//根据path参数,设置各路径和URL
+String path = request.getParameter("path") != null ? request.getParameter("path") : "";
+String currentPath = rootPath + path;
+String currentUrl = rootUrl + path;
+String currentDirPath = path;
+String moveupDirPath = "";
+if (!"".equals(path)) {
+ String str = currentDirPath.substring(0, currentDirPath.length() - 1);
+ moveupDirPath = str.lastIndexOf("/") >= 0 ? str.substring(0, str.lastIndexOf("/") + 1) : "";
+}
+
+//排序形式,name or size or type
+String order = request.getParameter("order") != null ? request.getParameter("order").toLowerCase() : "name";
+
+//不允许使用..移动到上一级目录
+if (path.indexOf("..") >= 0) {
+ out.println("Access is not allowed.");
+ return;
+}
+//最后一个字符不是/
+if (!"".equals(path) && !path.endsWith("/")) {
+ out.println("Parameter is not valid.");
+ return;
+}
+//目录不存在或不是目录
+File currentPathFile = new File(currentPath);
+if(!currentPathFile.isDirectory()){
+ out.println("Directory does not exist.");
+ return;
+}
+
+//遍历目录取的文件信息
+List fileList = new ArrayList();
+if(currentPathFile.listFiles() != null) {
+ for (File file : currentPathFile.listFiles()) {
+ Hashtable hash = new Hashtable();
+ String fileName = file.getName();
+ if(file.isDirectory()) {
+ hash.put("is_dir", true);
+ hash.put("has_file", (file.listFiles() != null));
+ hash.put("filesize", 0L);
+ hash.put("is_photo", false);
+ hash.put("filetype", "");
+ } else if(file.isFile()){
+ String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+ hash.put("is_dir", false);
+ hash.put("has_file", false);
+ hash.put("filesize", file.length());
+ hash.put("is_photo", Arrays.asList(fileTypes).contains(fileExt));
+ hash.put("filetype", fileExt);
+ }
+ hash.put("filename", fileName);
+ hash.put("datetime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(file.lastModified()));
+ fileList.add(hash);
+ }
+}
+
+if ("size".equals(order)) {
+ Collections.sort(fileList, new SizeComparator());
+} else if ("type".equals(order)) {
+ Collections.sort(fileList, new TypeComparator());
+} else {
+ Collections.sort(fileList, new NameComparator());
+}
+JSONObject result = new JSONObject();
+result.put("moveup_dir_path", moveupDirPath);
+result.put("current_dir_path", currentDirPath);
+result.put("current_url", currentUrl);
+result.put("total_count", fileList.size());
+result.put("file_list", fileList);
+
+response.setContentType("application/json; charset=UTF-8");
+out.println(result.toJSONString());
+%>
+<%!
+public class NameComparator implements Comparator {
+ public int compare(Object a, Object b) {
+ Hashtable hashA = (Hashtable)a;
+ Hashtable hashB = (Hashtable)b;
+ if (((Boolean)hashA.get("is_dir")) && !((Boolean)hashB.get("is_dir"))) {
+ return -1;
+ } else if (!((Boolean)hashA.get("is_dir")) && ((Boolean)hashB.get("is_dir"))) {
+ return 1;
+ } else {
+ return ((String)hashA.get("filename")).compareTo((String)hashB.get("filename"));
+ }
+ }
+}
+public class SizeComparator implements Comparator {
+ public int compare(Object a, Object b) {
+ Hashtable hashA = (Hashtable)a;
+ Hashtable hashB = (Hashtable)b;
+ if (((Boolean)hashA.get("is_dir")) && !((Boolean)hashB.get("is_dir"))) {
+ return -1;
+ } else if (!((Boolean)hashA.get("is_dir")) && ((Boolean)hashB.get("is_dir"))) {
+ return 1;
+ } else {
+ if (((Long)hashA.get("filesize")) > ((Long)hashB.get("filesize"))) {
+ return 1;
+ } else if (((Long)hashA.get("filesize")) < ((Long)hashB.get("filesize"))) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+ }
+}
+public class TypeComparator implements Comparator {
+ public int compare(Object a, Object b) {
+ Hashtable hashA = (Hashtable)a;
+ Hashtable hashB = (Hashtable)b;
+ if (((Boolean)hashA.get("is_dir")) && !((Boolean)hashB.get("is_dir"))) {
+ return -1;
+ } else if (!((Boolean)hashA.get("is_dir")) && ((Boolean)hashB.get("is_dir"))) {
+ return 1;
+ } else {
+ return ((String)hashA.get("filetype")).compareTo((String)hashB.get("filetype"));
+ }
+ }
+}
+%>
\ No newline at end of file
diff --git a/src/main/webapp/kindeditor/jsp/lib/commons-fileupload-1.2.1.jar b/src/main/webapp/kindeditor/jsp/lib/commons-fileupload-1.2.1.jar
new file mode 100644
index 0000000..aa209b3
Binary files /dev/null and b/src/main/webapp/kindeditor/jsp/lib/commons-fileupload-1.2.1.jar differ
diff --git a/src/main/webapp/kindeditor/jsp/lib/commons-io-1.4.jar b/src/main/webapp/kindeditor/jsp/lib/commons-io-1.4.jar
new file mode 100644
index 0000000..133dc6c
Binary files /dev/null and b/src/main/webapp/kindeditor/jsp/lib/commons-io-1.4.jar differ
diff --git a/src/main/webapp/kindeditor/jsp/lib/json_simple-1.1.jar b/src/main/webapp/kindeditor/jsp/lib/json_simple-1.1.jar
new file mode 100644
index 0000000..f395f41
Binary files /dev/null and b/src/main/webapp/kindeditor/jsp/lib/json_simple-1.1.jar differ
diff --git a/src/main/webapp/kindeditor/jsp/upload_json.jsp b/src/main/webapp/kindeditor/jsp/upload_json.jsp
new file mode 100644
index 0000000..ff2651c
--- /dev/null
+++ b/src/main/webapp/kindeditor/jsp/upload_json.jsp
@@ -0,0 +1,122 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@ page import="java.util.*,java.io.*" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="org.apache.commons.fileupload.*" %>
+<%@ page import="org.apache.commons.fileupload.disk.*" %>
+<%@ page import="org.apache.commons.fileupload.servlet.*" %>
+<%@ page import="org.json.simple.*" %>
+<%
+
+/**
+ * KindEditor JSP
+ *
+ * 本JSP程序是演示程序,建议不要直接在实际项目中使用。
+ * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
+ *
+ */
+
+//文件保存目录路径
+String savePath = pageContext.getServletContext().getRealPath("/") + "attached/";
+
+//文件保存目录URL
+String saveUrl = request.getContextPath() + "/attached/";
+
+//定义允许上传的文件扩展名
+HashMap extMap = new HashMap();
+extMap.put("image", "gif,jpg,jpeg,png,bmp");
+extMap.put("flash", "swf,flv");
+extMap.put("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb");
+extMap.put("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2");
+
+//最大文件大小
+long maxSize = 1000000;
+
+response.setContentType("text/html; charset=UTF-8");
+
+if(!ServletFileUpload.isMultipartContent(request)){
+ out.println(getError("请选择文件。"));
+ return;
+}
+//检查目录
+File uploadDir = new File(savePath);
+if(!uploadDir.isDirectory()){
+ out.println(getError("上传目录不存在。"));
+ return;
+}
+//检查目录写权限
+if(!uploadDir.canWrite()){
+ out.println(getError("上传目录没有写权限。"));
+ return;
+}
+
+String dirName = request.getParameter("dir");
+if (dirName == null) {
+ dirName = "image";
+}
+if(!extMap.containsKey(dirName)){
+ out.println(getError("目录名不正确。"));
+ return;
+}
+//创建文件夹
+savePath += dirName + "/";
+saveUrl += dirName + "/";
+File saveDirFile = new File(savePath);
+if (!saveDirFile.exists()) {
+ saveDirFile.mkdirs();
+}
+SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+String ymd = sdf.format(new Date());
+savePath += ymd + "/";
+saveUrl += ymd + "/";
+File dirFile = new File(savePath);
+if (!dirFile.exists()) {
+ dirFile.mkdirs();
+}
+
+FileItemFactory factory = new DiskFileItemFactory();
+ServletFileUpload upload = new ServletFileUpload(factory);
+upload.setHeaderEncoding("UTF-8");
+List items = upload.parseRequest(request);
+Iterator itr = items.iterator();
+while (itr.hasNext()) {
+ FileItem item = (FileItem) itr.next();
+ String fileName = item.getName();
+ long fileSize = item.getSize();
+ if (!item.isFormField()) {
+ //检查文件大小
+ if(item.getSize() > maxSize){
+ out.println(getError("上传文件大小超过限制。"));
+ return;
+ }
+ //检查扩展名
+ String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+ if(!Arrays.asList(extMap.get(dirName).split(",")).contains(fileExt)){
+ out.println(getError("上传文件扩展名是不允许的扩展名。\n只允许" + extMap.get(dirName) + "格式。"));
+ return;
+ }
+
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
+ String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt;
+ try{
+ File uploadedFile = new File(savePath, newFileName);
+ item.write(uploadedFile);
+ }catch(Exception e){
+ out.println(getError("上传文件失败。"));
+ return;
+ }
+
+ JSONObject obj = new JSONObject();
+ obj.put("error", 0);
+ obj.put("url", saveUrl + newFileName);
+ out.println(obj.toJSONString());
+ }
+}
+%>
+<%!
+private String getError(String message) {
+ JSONObject obj = new JSONObject();
+ obj.put("error", 1);
+ obj.put("message", message);
+ return obj.toJSONString();
+}
+%>
\ No newline at end of file
diff --git a/src/main/webapp/kindeditor/kindeditor-all-min.js b/src/main/webapp/kindeditor/kindeditor-all-min.js
new file mode 100644
index 0000000..9d4aacb
--- /dev/null
+++ b/src/main/webapp/kindeditor/kindeditor-all-min.js
@@ -0,0 +1,7 @@
+/* KindEditor 4.1.11 (2016-03-31), Copyright (C) kindsoft.net, Licence: http://kindeditor.net/license.php */
+!function(window,undefined){function _isArray(a){return a?"[object Array]"===Object.prototype.toString.call(a):!1}function _isFunction(a){return a?"[object Function]"===Object.prototype.toString.call(a):!1}function _inArray(a,b){for(var c=0,d=b.length;d>c;c++)if(a===b[c])return c;return-1}function _each(a,b){if(_isArray(a))for(var c=0,d=a.length;d>c&&b.call(a[c],c,a[c])!==!1;c++);else for(var e in a)if(a.hasOwnProperty(e)&&b.call(a[e],e,a[e])===!1)break}function _trim(a){return a.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,"")}function _inString(a,b,c){return c=c===undefined?",":c,(c+b+c).indexOf(c+a+c)>=0}function _addUnit(a,b){return b=b||"px",a&&/^-?\d+(?:\.\d+)?$/.test(a)?a+b:a}function _removeUnit(a){var b;return a&&(b=/(\d+)/.exec(a))?parseInt(b[1],10):0}function _escape(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function _unescape(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function _toCamel(a){var b=a.split("-");return a="",_each(b,function(b,c){a+=b>0?c.charAt(0).toUpperCase()+c.substr(1):c}),a}function _toHex(a){function b(a){var b=parseInt(a,10).toString(16).toUpperCase();return b.length>1?b:"0"+b}return a.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/gi,function(a,c,d,e){return"#"+b(c)+b(d)+b(e)})}function _toMap(a,b){b=b===undefined?",":b;var c,d={},e=_isArray(a)?a:a.split(b);return _each(e,function(a,b){if(c=/^(\d+)\.\.(\d+)$/.exec(b))for(var e=parseInt(c[1],10);e<=parseInt(c[2],10);e++)d[e.toString()]=!0;else d[b]=!0}),d}function _toArray(a,b){return Array.prototype.slice.call(a,b||0)}function _undef(a,b){return a===undefined?b:a}function _invalidUrl(a){return!a||/[<>"]/.test(a)}function _addParam(a,b){return a.indexOf("?")>=0?a+"&"+b:a+"?"+b}function _extend(a,b,c){c||(c=b,b=null);var d;if(b){var e=function(){};e.prototype=b.prototype,d=new e,_each(c,function(a,b){d[a]=b})}else d=c;d.constructor=a,a.prototype=d,a.parent=b?b.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(a){return"\\u"+("0000"+a.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 a,b=document.getElementsByTagName("script"),c=0,d=b.length;d>c;c++)if(a=b[c].src||"",/kindeditor[\w\-\.]*\.js/.test(a))return a.substring(0,a.lastIndexOf("/")+1);return""}function _bindEvent(a,b,c){a.addEventListener?a.addEventListener(b,c,_useCapture):a.attachEvent&&a.attachEvent("on"+b,c)}function _unbindEvent(a,b,c){a.removeEventListener?a.removeEventListener(b,c,_useCapture):a.detachEvent&&a.detachEvent("on"+b,c)}function KEvent(a,b){this.init(a,b)}function _getId(a){return a[_eventExpendo]||null}function _setId(a){return a[_eventExpendo]=++_eventId,_eventId}function _removeId(a){try{delete a[_eventExpendo]}catch(b){a.removeAttribute&&a.removeAttribute(_eventExpendo)}}function _bind(a,b,c){if(b.indexOf(",")>=0)return void _each(b.split(","),function(){_bind(a,this,c)});var d=_getId(a);d||(d=_setId(a)),_eventData[d]===undefined&&(_eventData[d]={});var e=_eventData[d][b];e&&e.length>0?_unbindEvent(a,b,e[0]):(_eventData[d][b]=[],_eventData[d].el=a),e=_eventData[d][b],0===e.length&&(e[0]=function(b){var c=b?new KEvent(a,b):undefined;_each(e,function(b,d){b>0&&d&&d.call(a,c)})}),_inArray(c,e)<0&&e.push(c),_bindEvent(a,b,e[0])}function _unbind(a,b,c){if(b&&b.indexOf(",")>=0)return void _each(b.split(","),function(){_unbind(a,this,c)});var d=_getId(a);if(d){if(b===undefined)return void(d in _eventData&&(_each(_eventData[d],function(b,c){"el"!=b&&c.length>0&&_unbindEvent(a,b,c[0])}),delete _eventData[d],_removeId(a)));if(_eventData[d]){var e=_eventData[d][b];if(e&&e.length>0){c===undefined?(_unbindEvent(a,b,e[0]),delete _eventData[d][b]):(_each(e,function(a,b){a>0&&b===c&&e.splice(a,1)}),1==e.length&&(_unbindEvent(a,b,e[0]),delete _eventData[d][b]));var f=0;_each(_eventData[d],function(){f++}),2>f&&(delete _eventData[d],_removeId(a))}}}}function _fire(a,b){if(b.indexOf(",")>=0)return void _each(b.split(","),function(){_fire(a,this)});var c=_getId(a);if(c){var d=_eventData[c][b];_eventData[c]&&d&&d.length>0&&d[0]()}}function _ctrl(a,b,c){b=/^\d{2,}$/.test(b)?b:b.toUpperCase().charCodeAt(0),_bind(a,"keydown",function(d){!d.ctrlKey||d.which!=b||d.shiftKey||d.altKey||(c.call(a),d.stop())})}function _ready(a){function b(){e||(e=!0,a(KindEditor),_readyFinished=!0)}function c(){if(!e){try{document.documentElement.doScroll("left")}catch(a){return void setTimeout(c,100)}b()}}function d(){"complete"===document.readyState&&b()}if(_readyFinished)return void a(KindEditor);var e=!1;if(document.addEventListener)_bind(document,"DOMContentLoaded",b);else if(document.attachEvent){_bind(document,"readystatechange",d);var f=!1;try{f=null==window.frameElement}catch(g){}document.documentElement.doScroll&&f&&c()}_bind(window,"load",b)}function _getCssList(a){for(var b,c={},d=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g;b=d.exec(a);){var e=_trim(b[1].toLowerCase()),f=_trim(_toHex(b[2]));c[e]=f}return c}function _getAttrList(a){for(var b,c={},d=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g;b=d.exec(a);){var e=(b[1]||b[2]||b[4]||b[6]).toLowerCase(),f=(b[2]?b[3]:b[4]?b[5]:b[7])||"";c[e]=f}return c}function _addClassToTag(a,b){return a=/\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,c,d,e){return(" "+d+" ").indexOf(" "+b+" ")<0?""===d?c+b+e:c+d+" "+b+e:a}):a.substr(0,a.length-1)+' class="'+b+'">'}function _formatCss(a){var b="";return _each(_getCssList(a),function(a,c){b+=a+":"+c+";"}),b}function _formatUrl(a,b,c,d){function e(a){for(var b=a.split("/"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];".."==f?c.length>0&&c.pop():""!==f&&"."!=f&&c.push(f)}return"/"+c.join("/")}function f(b,c){if(a.substr(0,b.length)===b){for(var e=[],g=0;c>g;g++)e.push("..");var i=".";return e.length>0&&(i+="/"+e.join("/")),"/"==d&&(i+="/"),i+a.substr(b.length)}return(h=/^(.*)\//.exec(b))?f(h[1],++c):void 0}if(b=_undef(b,"").toLowerCase(),"data:"!=a.substr(0,5)&&(a=a.replace(/([^:])\/\//g,"$1/")),_inArray(b,["absolute","relative","domain"])<0)return a;if(c=c||location.protocol+"//"+location.host,d===undefined){var g=location.pathname.match(/^(\/.*)\//);d=g?g[1]:""}var h;if(h=/^(\w+:\/\/[^\/]*)/.exec(a)){if(h[1]!==c)return a}else if(/^\w+:/.test(a))return a;return/^\//.test(a)?a=c+e(a.substr(1)):/^\w+:\/\//.test(a)||(a=c+e(d+"/"+a)),"relative"===b?a=f(c+d,0).substr(2):"absolute"===b&&a.substr(0,c.length)===c&&(a=a.substr(c.length)),a}function _formatHtml(a,b,c,d,e){null==a&&(a=""),c=c||"",d=_undef(d,!1),e=_undef(e," ");var f="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(a,b,c,d){return b+c.replace(/<(?:br|br\s[^>]*)>/gi,"\n")+d}),a=a.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/gi,""),a=a.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/gi,"$1
$2"),a=a.replace(/\u200B/g,""),a=a.replace(/\u00A9/g,"©"),a=a.replace(/\u00AE/g,"®"),a=a.replace(/\u2003/g," "),a=a.replace(/\u3000/g," "),a=a.replace(/<[^>]+/g,function(a){return a.replace(/\s+/g," ")});var g={};b&&(_each(b,function(a,b){for(var c=a.split(","),d=0,e=c.length;e>d;d++)g[c[d]]=_toMap(b)}),g.script||(a=a.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/gi,"")),g.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/gi,"")));var h=/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,i=[];return a=a.replace(h,function(a,h,j,k,l,m,n){var o=a,p=h||"",q=j||"",r=k.toLowerCase(),s=l||"",t=m?" "+m:"",u=n||"";if(b&&!g[r])return"";if(""===t&&_SINGLE_TAG_MAP[r]&&(t=" /"),_INLINE_TAG_MAP[r]&&(p&&(p=" "),u&&(u=" ")),_PRE_TAG_MAP[r]&&(q?u="\n":p="\n"),d&&"br"==r&&(u="\n"),_BLOCK_TAG_MAP[r]&&!_PRE_TAG_MAP[r])if(d){q&&i.length>0&&i[i.length-1]===r?i.pop():i.push(r),p="\n",u="\n";for(var v=0,w=q?i.length:i.length-1;w>v;v++)p+=e,q||(u+=e);t?i.pop():q||(u+=e)}else p=u="";if(""!==s){var x=_getAttrList(o);if("font"===r){var y={},z="";_each(x,function(a,b){"color"===a&&(y.color=b,delete x[a]),"size"===a&&(y["font-size"]=f[parseInt(b,10)-1]||"",delete x[a]),"face"===a&&(y["font-family"]=b,delete x[a]),"style"===a&&(z=b)}),z&&!/;$/.test(z)&&(z+=";"),_each(y,function(a,b){""!==b&&(/\s/.test(b)&&(b="'"+b+"'"),z+=a+":"+b+";")}),x.style=z}_each(x,function(a,d){if(_FILL_ATTR_MAP[a]&&(x[a]=a),_inArray(a,["src","href"])>=0&&(x[a]=_formatUrl(d,c)),(b&&"style"!==a&&!g[r]["*"]&&!g[r][a]||"body"===r&&"contenteditable"===a||/^kindeditor_\d+$/.test(a))&&delete x[a],"style"===a&&""!==d){var e=_getCssList(d);_each(e,function(a){!b||g[r].style||g[r]["."+a]||delete e[a]});var f="";_each(e,function(a,b){f+=a+":"+b+";"}),x.style=f}}),s="",_each(x,function(a,b){("style"!==a||""!==b)&&(b=b.replace(/"/g,"""),s+=" "+a+'="'+b+'"')})}return"font"===r&&(r="span"),p+"<"+q+r+s+t+">"+u}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(a,b,c,d){return b+c.replace(/\n/g,'\n')+d}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/\n/g,"\n"),_trim(a)}function _clearMsWord(a,b){return a=a.replace(//gi,"").replace(//gi,"").replace(/"];return _isArray(c)||(c=[c]),_each(c,function(a,b){b&&e.push('')}),d&&e.push(""),e.push(""),e.join("\n")}function _elementVal(a,b){if(a.hasVal()){if(b===undefined){var c=a.val();return c=c.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,"")}return a.val(b)}return a.html(b)}function KEdit(a){this.init(a)}function _edit(a){return new KEdit(a)}function _selectToolbar(a,b){var c=this,d=c.get(a);if(d){if(d.hasClass("ke-disabled"))return;b(d)}}function KToolbar(a){this.init(a)}function _toolbar(a){return new KToolbar(a)}function KMenu(a){this.init(a)}function _menu(a){return new KMenu(a)}function KColorPicker(a){this.init(a)}function _colorpicker(a){return new KColorPicker(a)}function KUploadButton(a){this.init(a)}function _uploadbutton(a){return new KUploadButton(a)}function _createButton(a){a=a||{};var b=a.name||"",c=K(''),d=K('');return a.click&&d.click(a.click),c.append(d),c}function KDialog(a){this.init(a)}function _dialog(a){return new KDialog(a)}function _tabs(a){var b=_widget(a),c=b.remove,d=a.afterSelect,e=b.div,f=[];e.addClass("ke-tabs").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()});var g=K('');return e.append(g),b.add=function(a){var b=K(''+a.title+"");b.data("tab",a),f.push(b),g.append(b)},b.selectedIndex=0,b.select=function(a){b.selectedIndex=a,_each(f,function(c,d){d.unbind(),c===a?(d.addClass("ke-tabs-li-selected"),K(d.data("tab").panel).show("")):(d.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(){b.select(c)}),K(d.data("tab").panel).hide())}),d&&d.call(b,a)},b.remove=function(){_each(f,function(){this.remove()}),g.remove(),c.call(b)},b}function _loadScript(a,b){var c=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),d=document.createElement("script");c.appendChild(d),d.src=a,d.charset="utf-8",d.onload=d.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState||(b&&b(),d.onload=d.onreadystatechange=null,c.removeChild(d))}}function _chopQuery(a){var b=a.indexOf("?");return b>0?a.substr(0,b):a}function _loadStyle(a){for(var b=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),c=document.createElement("link"),d=_chopQuery(_formatUrl(a,"absolute")),e=K('link[rel="stylesheet"]',b),f=0,g=e.length;g>f;f++)if(_chopQuery(_formatUrl(e[f].href,"absolute"))===d)return;b.appendChild(c),c.href=a,c.rel="stylesheet"}function _ajax(a,b,c,d,e){c=c||"GET",e=e||"json";var f=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");if(f.open(c,a,!0),f.onreadystatechange=function(){if(4==f.readyState&&200==f.status&&b){var a=_trim(f.responseText);"json"==e&&(a=_json(a)),b(a)}},"POST"==c){var g=[];_each(d,function(a,b){g.push(encodeURIComponent(a)+"="+encodeURIComponent(b))});try{f.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(h){}f.send(g.join("&"))}else f.send(null)}function _plugin(a,b){return a===undefined?_plugins:b?void(_plugins[a]=b):_plugins[a]}function _parseLangKey(a){var b,c="core";return(b=/^(\w+)\.(\w+)$/.exec(a))&&(c=b[1],a=b[2]),{ns:c,key:a}}function _lang(a,b){if(b=b===undefined?K.options.langType:b,"string"==typeof a){if(!_language[b])return"no language";var c=a.length-1;if("."===a.substr(c))return _language[b][a.substr(0,c)];var d=_parseLangKey(a);return _language[b][d.ns][d.key]}_each(a,function(a,c){var d=_parseLangKey(a);_language[b]||(_language[b]={}),_language[b][d.ns]||(_language[b][d.ns]={}),_language[b][d.ns][d.key]=c})}function _getImageFromRange(a,b){if(!a.collapsed){a=a.cloneRange().up();var c=a.startContainer,d=a.startOffset;if(_WEBKIT||a.isControl()){var e=K(c.childNodes[d]);if(e&&"img"==e.name)return b(e)?e:void 0}}}function _bindContextmenuEvent(){var a=this,b=a.edit.doc;K(b).contextmenu(function(b){if(a.menu&&a.hideMenu(),!a.useContextmenu)return void b.preventDefault();if(0!==a._contextmenus.length){var c=0,d=[];for(_each(a._contextmenus,function(){return"-"==this.title?void d.push(this):void(this.cond&&this.cond()&&(d.push(this),this.width&&this.width>c&&(c=this.width)))});d.length>0&&"-"==d[0].title;)d.shift();for(;d.length>0&&"-"==d[d.length-1].title;)d.pop();var e=null;if(_each(d,function(a){"-"==this.title&&"-"==e.title&&delete d[a],e=this}),d.length>0){b.preventDefault();var f=K(a.edit.iframe).pos(),g=_menu({x:f.x+b.clientX,y:f.y+b.clientY,width:c,css:{visibility:"hidden"},shadowMode:a.shadowMode});_each(d,function(){this.title&&g.addItem(this)});var h=_docElement(g.doc),i=g.div.height();b.clientY+i>=h.clientHeight-100&&g.pos(g.x,_removeUnit(g.y)-i),g.div.css("visibility","visible"),a.menu=g}}})}function _bindNewlineEvent(){function a(a){for(var b=K(a.commonAncestor());b&&(1!=b.type||b.isStyle());)b=b.parent();return b.name}var b=this,c=b.edit.doc,d=b.newlineTag;if(!(_IE&&"br"!==d||_GECKO&&3>_V&&"p"!==d||_OPERA&&9>_V)){var e=_toMap("h1,h2,h3,h4,h5,h6,pre,li"),f=_toMap("p,h1,h2,h3,h4,h5,h6,pre,li,blockquote");K(c).keydown(function(g){if(!(13!=g.which||g.shiftKey||g.ctrlKey||g.altKey)){b.cmd.selection();var h=a(b.cmd.range);if("marquee"!=h&&"select"!=h)return"br"!==d||e[h]?void(f[h]||_nativeCommand(c,"formatblock","")):(g.preventDefault(),void b.insertHtml("
"+(_IE&&9>_V?"":"")))}}),K(c).keyup(function(e){if(!(13!=e.which||e.shiftKey||e.ctrlKey||e.altKey)&&"br"!=d){if(_GECKO){var g=b.cmd.commonAncestor("p"),h=b.cmd.commonAncestor("a");return void(h&&""==h.text()&&(h.remove(!0),b.cmd.range.selectNodeContents(g[0]).collapse(!0),b.cmd.select()))}b.cmd.selection();var i=a(b.cmd.range);if("marquee"!=i&&"select"!=i){f[i]||_nativeCommand(c,"formatblock","
");var j=b.cmd.commonAncestor("div");if(j){for(var k=K("
"),l=j[0].firstChild;l;){var m=l.nextSibling;k.append(l),l=m}j.before(k),j.remove(),b.cmd.range.selectNodeContents(k[0]),b.cmd.select()}}}})}}function _bindTabEvent(){var a=this,b=a.edit.doc;K(b).keydown(function(c){if(9==c.which){if(c.preventDefault(),a.afterTab)return void a.afterTab.call(a,c);var d=a.cmd,e=d.range;e.shrink(),e.collapsed&&1==e.startContainer.nodeType&&(e.insertNode(K("@ ",b)[0]),d.select()),a.insertHtml(" ")}})}function _bindFocusEvent(){var a=this;K(a.edit.textarea[0],a.edit.win).focus(function(b){a.afterFocus&&a.afterFocus.call(a,b)}).blur(function(b){a.afterBlur&&a.afterBlur.call(a,b)})}function _removeBookmarkTag(a){return _trim(a.replace(/]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/gi,""))}function _removeTempTag(a){return a.replace(/]+class="?__kindeditor_paste__"?[^>]*>[\s\S]*?<\/div>/gi,"")}function _addBookmarkToStack(a,b){if(0===a.length)return void a.push(b);var c=a[a.length-1];_removeBookmarkTag(b.html)!==_removeBookmarkTag(c.html)&&a.push(b)}function _undoToRedo(a,b){var c,d,e=this,f=e.edit,g=f.doc.body;if(0===a.length)return e;f.designMode?(c=e.cmd.range,d=c.createBookmark(!0),d.html=g.innerHTML):d={html:g.innerHTML},_addBookmarkToStack(b,d);
+var h=a.pop();return _removeBookmarkTag(d.html)===_removeBookmarkTag(h.html)&&a.length>0&&(h=a.pop()),f.designMode?(f.html(h.html),h.start&&(c.moveToBookmark(h),e.select())):K(g).html(_removeBookmarkTag(h.html)),e}function KEditor(a){function b(a,b){KEditor.prototype[a]===undefined&&(c[a]=b),c.options[a]=b}var c=this;c.options={},_each(a,function(c){b(c,a[c])}),_each(K.options,function(a,d){c[a]===undefined&&b(a,d)});var d=K(c.srcElement||"
");c.width||(c.width=d[0].style.width||d.width()),c.height||(c.height=d[0].style.height||d.height()),b("width",_undef(c.width,c.minWidth)),b("height",_undef(c.height,c.minHeight)),b("width",_addUnit(c.width)),b("height",_addUnit(c.height)),_MOBILE&&(!_IOS||534>_V)&&(c.designMode=!1),c.srcElement=d,c.initContent="",c.plugin={},c.isCreated=!1,c._handlers={},c._contextmenus=[],c._undoStack=[],c._redoStack=[],c._firstAddBookmark=!0,c.menu=c.contextmenu=null,c.dialogs=[]}function _editor(a){return new KEditor(a)}function _create(a,b){function c(a){return _each(_plugins,function(b,c){_isFunction(c)&&(c.call(a,KindEditor),a._pluginStatus||(a._pluginStatus={}),a._pluginStatus[b]="inited")}),a.create()}if(b=b||{},b.basePath=_undef(b.basePath,K.basePath),b.themesPath=_undef(b.themesPath,b.basePath+"themes/"),b.langPath=_undef(b.langPath,b.basePath+"lang/"),b.pluginsPath=_undef(b.pluginsPath,b.basePath+"plugins/"),_undef(b.loadStyleMode,K.options.loadStyleMode)){var d=_undef(b.themeType,K.options.themeType);_loadStyle(b.themesPath+"default/default.css"),_loadStyle(b.themesPath+d+"/"+d+".css")}var e=K(a);if(e&&0!==e.length){if(e.length>1)return e.each(function(){_create(this,b)}),_instances[0];b.srcElement=e[0];var f=new KEditor(b);return _instances.push(f),_language[f.langType]?c(f):(_loadScript(f.langPath+f.langType+".js?ver="+encodeURIComponent(K.DEBUG?_TIME:_VERSION),function(){c(f)}),f)}}function _eachEditor(a,b){K(a).each(function(a,c){K.each(_instances,function(a,d){return d&&d.srcElement[0]==c?(b.call(d,a),!1):void 0})})}if(!window.KindEditor){window.console||(window.console={}),console.log||(console.log=function(){});var _VERSION="4.1.11 (2016-03-31)",_ua=navigator.userAgent.toLowerCase(),_IE=_ua.indexOf("msie")>-1&&-1==_ua.indexOf("opera"),_NEWIE=-1==_ua.indexOf("msie")&&_ua.indexOf("trident")>-1,_GECKO=_ua.indexOf("gecko")>-1&&-1==_ua.indexOf("khtml"),_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:2,syncType:"form",pasteType:2,dialogAlignType:"page",useContextmenu:!0,fullscreenShortcut:!1,bodyClass:"ke-content",indentChar:" ",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","wmode"],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:'
'};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(a,b){_CHANGE_KEY_MAP[a]=b}),_each(_CURSORMOVE_KEY_MAP,function(a,b){_CHANGE_KEY_MAP[a]=b});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(a,b){var c=this,d=a.ownerDocument||a.document||a;if(c.event=b,_each(_EVENT_PROPS,function(a,d){c[d]=b[d]}),c.target||(c.target=c.srcElement||d),3===c.target.nodeType&&(c.target=c.target.parentNode),!c.relatedTarget&&c.fromElement&&(c.relatedTarget=c.fromElement===c.target?c.toElement:c.fromElement),null==c.pageX&&null!=c.clientX){var e=d.documentElement,f=d.body;c.pageX=c.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),c.pageY=c.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)}switch(!c.which&&(c.charCode||0===c.charCode?c.charCode:c.keyCode)&&(c.which=c.charCode||c.keyCode),!c.metaKey&&c.ctrlKey&&(c.metaKey=c.ctrlKey),c.which||c.button===undefined||(c.which=1&c.button?1:2&c.button?3:4&c.button?2:0),c.which){case 186:c.which=59;break;case 187:case 107:case 43:c.which=61;break;case 189:case 45:c.which=109;break;case 42:c.which=106;break;case 47:c.which=111;break;case 78:c.which=110}c.which>=96&&c.which<=105&&(c.which-=48)},preventDefault:function(){var a=this.event;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){var a=this.event;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},stop:function(){this.preventDefault(),this.stopPropagation()}});var _eventExpendo="kindeditor_"+_TIME,_eventId=0,_eventData={},_readyFinished=!1;window.attachEvent&&window.attachEvent("onunload",function(){_each(_eventData,function(a,b){b.el&&_unbind(b.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(a){var b=this;a=_isArray(a)?a:[a];for(var c=0,d=0,e=a.length;e>d;d++)a[d]&&(b[d]=a[d].constructor===KNode?a[d][0]:a[d],c++);b.length=c,b.doc=_getDoc(b[0]),b.name=_getNodeName(b[0]),b.type=b.length>0?b[0].nodeType:null,b.win=_getWin(b[0])},each:function(a){for(var b=this,c=0;c
0?a.eq(0):null},last:function(){var a=this.children();return a.length>0?a.eq(a.length-1):null},index:function(){if(this.length<1)return-1;for(var a=-1,b=this[0];b;)a++,b=b.previousSibling;return a},prev:function(){if(this.length<1)return null;var a=this[0].previousSibling;return a?new KNode(a):null},next:function(){if(this.length<1)return null;var a=this[0].nextSibling;return a?new KNode(a):null},scan:function(a,b){function c(d){for(var e=b?d.firstChild:d.lastChild;e;){var f=b?e.nextSibling:e.previousSibling;if(a(e)===!1)return!1;if(c(e)===!1)return!1;e=f}}if(!(this.length<1))return b=b===undefined?!0:b,c(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(a,b){KNode.prototype[b]=function(a){return a?this.bind(b,a):this.fire(b)}});var _K=K;K=function(a,b){function c(a){return a[0]||(a=[]),new KNode(a)}if(a!==undefined&&null!==a){if("string"==typeof a){b&&(b=_get(b));var d=a.length;if("@"===a.charAt(0)&&(a=a.substr(1)),a.length!==d||/<.+>/.test(a)){var e=b?b.ownerDocument||b:document,f=e.createElement("div"),g=[];f.innerHTML='
'+a;for(var h=0,i=f.childNodes.length;i>h;h++){var j=f.childNodes[h];"__kindeditor_temp_tag__"!=j.id&&g.push(j)}return c(g)}return c(_queryAll(a,b))}return a&&a.constructor===KNode?a:(a.toArray&&(a=a.toArray()),c(_isArray(a)?a:_toArray(arguments)))}},_each(_K,function(a,b){K[a]=b}),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(a){var b=this;b.startContainer=a,b.startOffset=0,b.endContainer=a,b.endOffset=0,b.collapsed=!0,b.doc=a},commonAncestor:function(){function a(a){for(var b=[];a;)b.push(a),a=a.parentNode;return b}for(var b,c,d=a(this.startContainer),e=a(this.endContainer),f=0,g=d.length,h=e.length;++f&&(b=d[g-f],c=e[h-f],b&&c&&b===c););return d[g-f+1]},setStart:function(a,b){var c=this,d=c.doc;return c.startContainer=a,c.startOffset=b,c.endContainer===d&&(c.endContainer=a,c.endOffset=b),_updateCollapsed(this)},setEnd:function(a,b){var c=this,d=c.doc;return c.endContainer=a,c.endOffset=b,c.startContainer===d&&(c.startContainer=a,c.startOffset=b),_updateCollapsed(this)},setStartBefore:function(a){return this.setStart(a.parentNode||this.doc,K(a).index())},setStartAfter:function(a){return this.setStart(a.parentNode||this.doc,K(a).index()+1)},setEndBefore:function(a){return this.setEnd(a.parentNode||this.doc,K(a).index())},setEndAfter:function(a){return this.setEnd(a.parentNode||this.doc,K(a).index()+1)},selectNode:function(a){return this.setStartBefore(a).setEndAfter(a)},selectNodeContents:function(a){var b=K(a);if(3==b.type||b.isSingle())return this.selectNode(a);var c=b.children();return c.length>0?this.setStartBefore(c[0]).setEndAfter(c[c.length-1]):this.setStart(a,0).setEnd(a,0)},collapse:function(a){return a?this.setEnd(this.startContainer,this.startOffset):this.setStart(this.endContainer,this.endOffset)},compareBoundaryPoints:function(a,b){var c=this.get(),d=b.get();if(!_IERANGE)return c.compareBoundaryPoints(a,d);var e={};e[_START_TO_START]="StartToStart",e[_START_TO_END]="EndToStart",e[_END_TO_END]="EndToEnd",e[_END_TO_START]="StartToEnd";var f=c.compareEndPoints(e[a],d);if(0!==f)return f;var g,h,i,j,k;if((a===_START_TO_START||a===_END_TO_START)&&(g=this.startContainer,j=this.startOffset),(a===_START_TO_END||a===_END_TO_END)&&(g=this.endContainer,j=this.endOffset),(a===_START_TO_START||a===_START_TO_END)&&(h=b.startContainer,k=b.startOffset),(a===_END_TO_END||a===_END_TO_START)&&(h=b.endContainer,k=b.endOffset),g===h){var l=j-k;return l>0?1:0>l?-1:0}for(i=h;i&&i.parentNode!==g;)i=i.parentNode;if(i)return K(i).index()>=j?-1:1;for(i=g;i&&i.parentNode!==h;)i=i.parentNode;return i?K(i).index()>=k?1:-1:(i=K(h).next(),i&&i.contains(g)?1:(i=K(g).next(),i&&i.contains(h)?-1:void 0))},cloneRange:function(){return new KRange(this.doc).setStart(this.startContainer,this.startOffset).setEnd(this.endContainer,this.endOffset)},toString:function(){var a=this.get(),b=_IERANGE?a.text:a.toString();return b.replace(/\r\n|\n|\r/g,"")},cloneContents:function(){return _copyAndDelete(this,!0,!1)},deleteContents:function(){return _copyAndDelete(this,!1,!0)},extractContents:function(){return _copyAndDelete(this,!0,!0)},insertNode:function(a){var b,c,d,e=this,f=e.startContainer,g=e.startOffset,h=e.endContainer,i=e.endOffset,j=1;return"#document-fragment"===a.nodeName.toLowerCase()&&(b=a.firstChild,c=a.lastChild,j=a.childNodes.length),1==f.nodeType?(d=f.childNodes[g],d?(f.insertBefore(a,d),f===h&&(i+=j)):f.appendChild(a)):3==f.nodeType&&(0===g?(f.parentNode.insertBefore(a,f),f.parentNode===h&&(i+=j)):g>=f.nodeValue.length?f.nextSibling?f.parentNode.insertBefore(a,f.nextSibling):f.parentNode.appendChild(a):(d=g>0?f.splitText(g):f,f.parentNode.insertBefore(a,d),f===h&&(h=d,i-=g))),b?e.setStartBefore(b).setEndAfter(c):e.selectNode(a),e.compareBoundaryPoints(_END_TO_END,e.cloneRange().setEnd(h,i))>=1?e:e.setEnd(h,i)},surroundContents:function(a){return a.appendChild(this.extractContents()),this.insertNode(a).selectNode(a)},isControl:function(){var a=this,b=a.startContainer,c=a.startOffset,d=a.endContainer,e=a.endOffset;return 1==b.nodeType&&b===d&&c+1===e&&K(b.childNodes[c]).isControl()},get:function(a){var b,c=this,d=c.doc;if(!_IERANGE){b=d.createRange();try{b.setStart(c.startContainer,c.startOffset),b.setEnd(c.endContainer,c.endOffset)}catch(e){}return b}if(a&&c.isControl())return b=d.body.createControlRange(),b.addElement(c.startContainer.childNodes[c.startOffset]),b;var f=c.cloneRange().down();return b=d.body.createTextRange(),b.setEndPoint("StartToStart",_getEndRange(f.startContainer,f.startOffset)),b.setEndPoint("EndToStart",_getEndRange(f.endContainer,f.endOffset)),b},html:function(){return K(this.cloneContents()).outer()},down:function(){function a(a,c,d){if(1==a.nodeType){var e=K(a).children();if(0!==e.length){var f,g,h,i;c>0&&(f=e.eq(c-1)),c0&&(a=b.endContainer.childNodes[b.endOffset-1])&&1==a.nodeType&&!K(a).isSingle();)b.setEnd(a,a.childNodes.length);return b},createBookmark:function(a){var b,c=this,d=c.doc,e=K('',d)[0];return e.id="__kindeditor_bookmark_start_"+_BOOKMARK_ID++ +"__",c.collapsed||(b=e.cloneNode(!0),b.id="__kindeditor_bookmark_end_"+_BOOKMARK_ID++ +"__"),b&&c.cloneRange().collapse(!1).insertNode(b).setEndBefore(b),c.insertNode(e).setStartAfter(e),{start:a?"#"+e.id:e,end:b?a?"#"+b.id:b:null}},moveToBookmark:function(a){var b=this,c=b.doc,d=K(a.start,c),e=a.end?K(a.end,c):null;return!d||d.length<1?b:(b.setStartBefore(d[0]),d.remove(),e&&e.length>0?(b.setEndBefore(e[0]),e.remove()):b.collapse(!0),b)},dump:function(){console.log("--------------------"),console.log(3==this.startContainer.nodeType?this.startContainer.nodeValue:this.startContainer,this.startOffset),console.log(3==this.endContainer.nodeType?this.endContainer.nodeValue:this.endContainer,this.endOffset)}}),K.RangeClass=KRange,K.range=_range,K.START_TO_START=_START_TO_START,K.START_TO_END=_START_TO_END,K.END_TO_END=_END_TO_END,K.END_TO_START=_END_TO_START,_extend(KCmd,{init:function(a){var b=this,c=a.doc;b.doc=c,b.win=_getWin(c),b.sel=_getSel(c),b.range=a},selection:function(a){var b=this,c=b.doc,d=_getRng(c);return b.sel=_getSel(c),d?(b.range=_range(d),"html"==K(b.range.startContainer).name&&b.range.selectNodeContents(c.body).collapse(!1),b):(a&&b.range.selectNodeContents(c.body).collapse(!1),b)},select:function(a){a=_undef(a,!0);var b,c=this,d=c.sel,e=c.range.cloneRange().shrink(),f=e.startContainer,g=e.startOffset,h=(e.endContainer,e.endOffset,_getDoc(f)),i=c.win,j=!1;if(a&&1==f.nodeType&&e.collapsed){if(_IERANGE){var k=K(" ",h);e.insertNode(k[0]),b=h.body.createTextRange();try{b.moveToElementText(k[0])}catch(l){}return b.collapse(!1),b.select(),k.remove(),i.focus(),c}if(_WEBKIT){var m=f.childNodes;(K(f).isInline()||g>0&&K(m[g-1]).isInline()||m[g]&&K(m[g]).isInline())&&(e.insertNode(h.createTextNode("")),j=!0)}}if(_IERANGE)try{b=e.get(!0),b.select()}catch(n){}else if(j&&e.collapse(!1),b=e.get(!0),d.removeAllRanges(),d.addRange(b),h!==document){var o=K(b.endContainer).pos();i.scrollTo(o.x,o.y)}return i.focus(),c},wrap:function(a){var b,c=this,d=c.doc,e=c.range;if(b=K(a,d),e.collapsed)return e.shrink(),e.insertNode(b[0]).selectNodeContents(b[0]),c;if(b.isBlock()){for(var f=b.clone(!0),g=f;g.first();)g=g.first();return g.append(e.extractContents()),e.insertNode(f[0]).selectNode(f[0]),c}e.enlarge();var h=e.createBookmark(),i=e.commonAncestor(),j=!1;return K(i).scan(function(a){if(!j&&a==h.start)return void(j=!0);if(j){if(a==h.end)return!1;var c=K(a);if(_inPreElement(c))return;if(3==c.type&&_trim(a.nodeValue).length>0){for(var d;(d=c.parent())&&d.isStyle()&&1==d.children().length;)c=d;_wrapNode(c,b)}}}),e.moveToBookmark(h),c},split:function(a,b){for(var c,d=this.range,e=d.doc,f=d.cloneRange().collapse(a),g=f.startContainer,h=f.startOffset,i=3==g.nodeType?g.parentNode:g,j=!1;i&&i.parentNode;){if(c=K(i),b){if(!c.isStyle())break;if(!_hasAttrOrCss(c,b))break}else if(_NOSPLIT_TAG_MAP[c.name])break;j=!0,i=i.parentNode}if(j){var k=e.createElement("span");d.cloneRange().collapse(!a).insertNode(k),a?f.setStartBefore(i.firstChild).setEnd(g,h):f.setStart(g,h).setEndAfter(i.lastChild);var l=f.extractContents(),m=l.firstChild,n=l.lastChild;a?(f.insertNode(l),d.setStartAfter(n).setEndBefore(k)):(i.appendChild(l),d.setStartBefore(k).setEndBefore(m));var o=k.parentNode;if(o==d.endContainer){var p=K(k).prev(),q=K(k).next();p&&q&&3==p.type&&3==q.type?d.setEnd(p[0],p[0].nodeValue.length):a||d.setEnd(d.endContainer,d.endOffset-1)}o.removeChild(k)}return this},remove:function(a){var b=this,c=b.doc,d=b.range;if(d.enlarge(),0===d.startOffset){for(var e,f=K(d.startContainer);(e=f.parent())&&e.isStyle()&&1==e.children().length;)f=e;d.setStart(f[0],0),f=K(d.startContainer),f.isBlock()&&_removeAttrOrCss(f,a);var g=f.parent();g&&g.isBlock()&&_removeAttrOrCss(g,a)}var h,i;if(d.collapsed){if(b.split(!0,a),h=d.startContainer,i=d.startOffset,i>0){var j=K(h.childNodes[i-1]);j&&_isEmptyNode(j)&&(j.remove(),d.setStart(h,i-1))}var k=K(h.childNodes[i]);return k&&_isEmptyNode(k)&&k.remove(),_isEmptyNode(h)&&(d.startBefore(h),h.remove()),d.collapse(!0),b}b.split(!0,a),b.split(!1,a);var l=c.createElement("span"),m=c.createElement("span");d.cloneRange().collapse(!1).insertNode(m),d.cloneRange().collapse(!0).insertNode(l);var n=[],o=!1;K(d.commonAncestor()).scan(function(a){return o||a!=l?a==m?!1:void(o&&n.push(a)):void(o=!0)}),K(l).remove(),K(m).remove(),h=d.startContainer,i=d.startOffset;var p=d.endContainer,q=d.endOffset;if(i>0){var r=K(h.childNodes[i-1]);r&&_isEmptyNode(r)&&(r.remove(),d.setStart(h,i-1),h==p&&d.setEnd(p,q-1));var s=K(h.childNodes[i]);s&&_isEmptyNode(s)&&(s.remove(),h==p&&d.setEnd(p,q-1))}var t=K(p.childNodes[d.endOffset]);t&&_isEmptyNode(t)&&t.remove();var u=d.createBookmark(!0);return _each(n,function(b,c){_removeAttrOrCss(K(c),a)}),d.moveToBookmark(u),b},commonNode:function(a){function b(b){for(var c=b,d=b;d;){if(_hasAttrOrCss(K(d),a))return K(d);d=d.parentNode}for(;c&&(c=c.lastChild);)if(_hasAttrOrCss(K(c),a))return K(c);return null}var c=this.range,d=c.endContainer,e=c.endOffset,f=3==d.nodeType||0===e?d:d.childNodes[e-1],g=b(f);if(g)return g;if(1==f.nodeType||3==d.nodeType&&0===e){var h=K(f).prev();if(h)return b(h)}return null},commonAncestor:function(a){function b(b){for(;b;){if(1==b.nodeType&&b.tagName.toLowerCase()===a)return b;b=b.parentNode}return null}var c=this.range,d=c.startContainer,e=c.startOffset,f=c.endContainer,g=c.endOffset,h=3==d.nodeType||0===e?d:d.childNodes[e-1],i=3==f.nodeType||0===g?f:f.childNodes[g-1],j=b(h),k=b(i);return j&&k&&j===k?K(j):null},state:function(a){var b=this,c=b.doc,d=!1;try{d=c.queryCommandState(a)}catch(e){}return d},val:function(a){function b(a){return a.toLowerCase()}{var c=this,d=c.doc;c.range}a=b(a);var e,f="";return"fontfamily"===a||"fontname"===a?(f=_nativeCommandValue(d,"fontname"),f=f.replace(/['"]/g,""),b(f)):"formatblock"===a?(f=_nativeCommandValue(d,a),""===f&&(e=c.commonNode({"h1,h2,h3,h4,h5,h6,p,div,pre,address":"*"}),e&&(f=e.name)),"Normal"===f&&(f="p"),b(f)):"fontsize"===a?(e=c.commonNode({"*":".font-size"}),e&&(f=e.css("font-size")),b(f)):"forecolor"===a?(e=c.commonNode({"*":".color"}),e&&(f=e.css("color")),f=_toHex(f),""===f&&(f="default"),b(f)):"hilitecolor"===a?(e=c.commonNode({"*":".background-color"}),e&&(f=e.css("background-color")),f=_toHex(f),""===f&&(f="default"),b(f)):f},toggle:function(a,b){var c=this;return c.commonNode(b)?c.remove(b):c.wrap(a),c.select()},bold:function(){return this.toggle("",{span:".font-weight=bold",strong:"*",b:"*"})},italic:function(){return this.toggle("",{span:".font-style=italic",em:"*",i:"*"})},underline:function(){return this.toggle("",{span:".text-decoration=underline",u:"*"})},strikethrough:function(){return this.toggle("",{span:".text-decoration=line-through",s:"*"})},forecolor:function(a){return this.wrap('').select()},hilitecolor:function(a){return this.wrap('').select()},fontsize:function(a){return this.wrap('').select()},fontname:function(a){return this.fontfamily(a)},fontfamily:function(a){return this.wrap('').select()},removeformat:function(){var a={"*":".font-weight,.font-style,.text-decoration,.color,.background-color,.font-size,.font-family,.text-indent"},b=_STYLE_TAG_MAP;return _each(b,function(b){a[b]="*"}),this.remove(a),this.select()},inserthtml:function(a,b){function c(a,b){b='
'+b;var c=a.get();c.item?c.item(0).outerHTML=b:c.pasteHTML(b);var d=a.doc.getElementById("__kindeditor_temp_tag__");d.parentNode.removeChild(d);var f=_toRange(c);a.setEnd(f.endContainer,f.endOffset),a.collapse(!1),e.select(!1)}function d(a,b){var c=a.doc,d=c.createDocumentFragment();K("@"+b,c).each(function(){d.appendChild(this)}),a.deleteContents(),a.insertNode(d),a.collapse(!1),e.select(!1)}var e=this,f=e.range;if(""===a)return e;if(_IERANGE&&b){try{c(f,a)}catch(g){d(f,a)}return e}return d(f,a),e},hr:function(){return this.inserthtml("
")},print:function(){return this.win.print(),this},insertimage:function(a,b,c,d,e,f){b=_undef(b,""),e=_undef(e,0);var g='
",this.inserthtml(g)},createlink:function(a,b){function c(a,b,c){K(a).attr("href",b).attr("data-ke-src",b),c?K(a).attr("target",c):K(a).removeAttr("target")}var d=this,e=d.doc,f=d.range;d.select();var g=d.commonNode({a:"*"});g&&!f.isControl()&&(f.selectNode(g.get()),d.select());var h='"+_escape(a)+"",d.inserthtml(h);if(f.isControl()){var i=K(f.startContainer.childNodes[f.startOffset]);return h+=">",i.after(K(h,e)),i.next().append(i),f.selectNode(i[0]),d.select()}var j=f.startContainer,k=f.startOffset,l=f.endContainer,m=f.endOffset;if(1==j.nodeType&&j===l&&k+1===m){var n=j.childNodes[k];if("a"==n.nodeName.toLowerCase())return c(n,a,b),d
+}return _nativeCommand(e,"createlink","__kindeditor_temp_url__"),K('a[href="__kindeditor_temp_url__"]',e).each(function(){c(this,a,b)}),d},unlink:function(){var a=this,b=a.doc,c=a.range;if(a.select(),c.collapsed){var d=a.commonNode({a:"*"});if(d&&(c.selectNode(d.get()),a.select()),_nativeCommand(b,"unlink",null),_WEBKIT&&"img"===K(c.startContainer).name){var e=K(c.startContainer).parent();"a"===e.name&&e.remove(!0)}}else _nativeCommand(b,"unlink",null);return a}}),_each("formatblock,selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript".split(","),function(a,b){KCmd.prototype[b]=function(a){var c=this;return c.select(),_nativeCommand(c.doc,b,a),_IERANGE&&_inArray(b,"justifyleft,justifycenter,justifyright,justifyfull".split(","))>=0&&c.selection(),(!_IERANGE||_inArray(b,"formatblock,selectall,insertorderedlist,insertunorderedlist".split(","))>=0)&&c.selection(),c}}),_each("cut,copy,paste".split(","),function(a,b){KCmd.prototype[b]=function(){var a=this;if(!a.doc.queryCommandSupported(b))throw"not supported";return a.select(),_nativeCommand(a.doc,b,null),a}}),K.CmdClass=KCmd,K.cmd=_cmd,_extend(KWidget,{init:function(a){var b=this;if(b.name=a.name||"",b.doc=a.doc||document,b.win=_getWin(b.doc),b.x=_addUnit(a.x),b.y=_addUnit(a.y),b.z=a.z,b.width=_addUnit(a.width),b.height=_addUnit(a.height),b.div=K(''),b.options=a,b._alignEl=a.alignEl,b.width&&b.div.css("width",b.width),b.height&&b.div.css("height",b.height),b.z&&b.div.css({position:"absolute",left:b.x,top:b.y,"z-index":b.z}),!b.z||b.x!==undefined&&b.y!==undefined||b.autoPos(b.width,b.height),a.cls&&b.div.addClass(a.cls),a.shadowMode&&b.div.addClass("ke-shadow"),a.css&&b.div.css(a.css),a.src?K(a.src).replaceWith(b.div):K(b.doc.body).append(b.div),a.html&&b.div.html(a.html),a.autoScroll)if(_IE&&7>_V||_QUIRKS){var c=_getScrollPos();K(b.win).bind("scroll",function(){var a=_getScrollPos(),d=a.x-c.x,e=a.y-c.y;b.pos(_removeUnit(b.x)+d,_removeUnit(b.y)+e,!1)})}else b.div.css("position","fixed")},pos:function(a,b,c){var d=this;return c=_undef(c,!0),null!==a&&(a=0>a?0:_addUnit(a),d.div.css("left",a),c&&(d.x=a)),null!==b&&(b=0>b?0:_addUnit(b),d.div.css("top",b),c&&(d.y=b)),d},autoPos:function(a,b){var c=this,d=_removeUnit(a)||0,e=_removeUnit(b)||0,f=_getScrollPos();if(c._alignEl){var g=K(c._alignEl),h=g.pos(),i=_round(g[0].clientWidth/2-d/2),j=_round(g[0].clientHeight/2-e/2);x=0>i?h.x:h.x+i,y=0>j?h.y:h.y+j}else{var k=_docElement(c.doc);x=_round(f.x+(k.clientWidth-d)/2),y=_round(f.y+(k.clientHeight-e)/2)}return _IE&&7>_V||_QUIRKS||(x-=f.x,y-=f.y),c.pos(x,y)},remove:function(){var a=this;return(_IE&&7>_V||_QUIRKS)&&K(a.win).unbind("scroll"),a.div.remove(),_each(a,function(b){a[b]=null}),this},show:function(){return this.div.show(),this},hide:function(){return this.div.hide(),this},draggable:function(a){var b=this;return a=a||{},a.moveEl=b.div,a.moveFn=function(a,c,d,e,f,g){(a+=f)<0&&(a=0),(c+=g)<0&&(c=0),b.pos(a,c)},_drag(a),b}}),K.WidgetClass=KWidget,K.widget=_widget;var html,_direction="";(html=document.getElementsByTagName("html"))&&(_direction=html[0].dir),_extend(KEdit,KWidget,{init:function(a){function b(){var b=_iframeDoc(c.iframe);b.open(),h&&(b.domain=document.domain),b.write(_getInitHtml(d,e,f,g)),b.close(),c.win=c.iframe[0].contentWindow,c.doc=b;var i=_cmd(b);c.afterChange(function(){i.selection()}),_WEBKIT&&K(b).click(function(a){"img"===K(a.target).name&&(i.selection(!0),i.range.selectNode(a.target),i.select())}),_IE&&(c._mousedownHandler=function(){var a=i.range.cloneRange();a.shrink(),a.isControl()&&c.blur()},K(document).mousedown(c._mousedownHandler),K(b).keydown(function(a){if(8==a.which){i.selection();var b=i.range;b.isControl()&&(b.collapse(!0),K(b.startContainer.childNodes[b.startOffset]).remove(),a.preventDefault())}})),c.cmd=i,c.html(_elementVal(c.srcElement)),_IE?(b.body.disabled=!0,b.body.contentEditable=!0,b.body.removeAttribute("disabled")):b.designMode="on",a.afterCreate&&a.afterCreate.call(c)}var c=this;KEdit.parent.init.call(c,a),c.srcElement=K(a.srcElement),c.div.addClass("ke-edit"),c.designMode=_undef(a.designMode,!0),c.beforeGetHtml=a.beforeGetHtml,c.beforeSetHtml=a.beforeSetHtml,c.afterSetHtml=a.afterSetHtml;var d=_undef(a.themesPath,""),e=a.bodyClass,f=a.cssPath,g=a.cssData,h="res:"!=location.protocol&&location.host.replace(/:\d+/,"")!==document.domain,i="document.open();"+(h?'document.domain="'+document.domain+'";':"")+"document.close();",j=_IE?' src="javascript:void(function(){'+encodeURIComponent(i)+'}())"':"";c.iframe=K('").css("width","100%"),c.textarea=K('').css("width","100%"),c.tabIndex=isNaN(parseInt(a.tabIndex,10))?c.srcElement.attr("tabindex"):parseInt(a.tabIndex,10),c.iframe.attr("tabindex",c.tabIndex),c.textarea.attr("tabindex",c.tabIndex),c.width&&c.setWidth(c.width),c.height&&c.setHeight(c.height),c.designMode?c.textarea.hide():c.iframe.hide(),h&&c.iframe.bind("load",function(){c.iframe.unbind("load"),_IE?b():setTimeout(b,0)}),c.div.append(c.iframe),c.div.append(c.textarea),c.srcElement.hide(),!h&&b()},setWidth:function(a){var b=this;return a=_addUnit(a),b.width=a,b.div.css("width",a),b},setHeight:function(a){var b=this;return a=_addUnit(a),b.height=a,b.div.css("height",a),b.iframe.css("height",a),(_IE&&8>_V||_QUIRKS)&&(a=_addUnit(_removeUnit(a)-2)),b.textarea.css("height",a),b},remove:function(){var a=this,b=a.doc;K(b.body).unbind(),K(b).unbind(),K(a.win).unbind(),a._mousedownHandler&&K(document).unbind("mousedown",a._mousedownHandler),_elementVal(a.srcElement,a.html()),a.srcElement.show(),a.iframe.unbind(),a.textarea.unbind(),KEdit.parent.remove.call(a)},html:function(a,b){var c=this,d=c.doc;if(c.designMode){var e=d.body;return a===undefined?(a=b?""+e.parentNode.innerHTML+"":e.innerHTML,c.beforeGetHtml&&(a=c.beforeGetHtml(a)),_GECKO&&"
"==a&&(a=""),a):(c.beforeSetHtml&&(a=c.beforeSetHtml(a)),_IE&&_V>=9&&(a=a.replace(/(<.*?checked=")checked(".*>)/gi,"$1$2")),K(e).html(a),c.afterSetHtml&&c.afterSetHtml(),c)}return a===undefined?c.textarea.val():(c.textarea.val(a),c)},design:function(a){var b,c=this;if(a===undefined?!c.designMode:a){if(!c.designMode){b=c.html(),c.designMode=!0,c.textarea.hide(),c.html(b);var d=c.iframe,e=_removeUnit(c.height);d.height(e-2),d.show(),setTimeout(function(){d.height(e)},0)}}else c.designMode&&(b=c.html(),c.designMode=!1,c.html(b),c.iframe.hide(),c.textarea.show());return c.focus()},focus:function(){var a=this;return a.designMode?a.win.focus():a.textarea[0].focus(),a},blur:function(){var a=this;if(_IE){var b=K('',a.div);a.div.append(b),b[0].focus(),b.remove()}else a.designMode?a.win.blur():a.textarea[0].blur();return a},afterChange:function(a){function b(b){setTimeout(function(){a(b)},1)}var c=this,d=c.doc,e=d.body;return K(d).keyup(function(b){b.ctrlKey||b.altKey||!_CHANGE_KEY_MAP[b.which]||a(b)}),K(d).mouseup(a).contextmenu(a),K(c.win).blur(a),K(e).bind("paste",b),K(e).bind("cut",b),c}}),K.EditClass=KEdit,K.edit=_edit,K.iframeDoc=_iframeDoc,_extend(KToolbar,KWidget,{init:function(a){function b(a){var b=K(a);return b.hasClass("ke-outline")?b:b.hasClass("ke-toolbar-icon")?b.parent():void 0}function c(a,c){var d=b(a.target);if(d){if(d.hasClass("ke-disabled"))return;if(d.hasClass("ke-selected"))return;d[c]("ke-on")}}var d=this;KToolbar.parent.init.call(d,a),d.disableMode=_undef(a.disableMode,!1),d.noDisableItemMap=_toMap(_undef(a.noDisableItems,[])),d._itemMap={},d.div.addClass("ke-toolbar").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()}).attr("unselectable","on"),d.div.mouseover(function(a){c(a,"addClass")}).mouseout(function(a){c(a,"removeClass")}).click(function(a){var c=b(a.target);if(c){if(c.hasClass("ke-disabled"))return;d.options.click.call(this,a,c.attr("data-name"))}})},get:function(a){return this._itemMap[a]?this._itemMap[a]:this._itemMap[a]=K("span.ke-icon-"+a,this.div).parent()},select:function(a){return _selectToolbar.call(this,a,function(a){a.addClass("ke-selected")}),self},unselect:function(a){return _selectToolbar.call(this,a,function(a){a.removeClass("ke-selected").removeClass("ke-on")}),self},enable:function(a){var b=this,c=a.get?a:b.get(a);return c&&(c.removeClass("ke-disabled"),c.opacity(1)),b},disable:function(a){var b=this,c=a.get?a:b.get(a);return c&&(c.removeClass("ke-selected").addClass("ke-disabled"),c.opacity(.5)),b},disableAll:function(a,b){var c=this,d=c.noDisableItemMap;return b&&(d=_toMap(b)),(a===undefined?!c.disableMode:a)?(K("span.ke-outline",c.div).each(function(){var a=K(this),b=a[0].getAttribute("data-name",2);d[b]||c.disable(a)}),c.disableMode=!0):(K("span.ke-outline",c.div).each(function(){var a=K(this),b=a[0].getAttribute("data-name",2);d[b]||c.enable(a)}),c.disableMode=!1),c}}),K.ToolbarClass=KToolbar,K.toolbar=_toolbar,_extend(KMenu,KWidget,{init:function(a){var b=this;a.z=a.z||811213,KMenu.parent.init.call(b,a),b.centerLineMode=_undef(a.centerLineMode,!0),b.div.addClass("ke-menu").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on")},addItem:function(a){var b=this;if("-"===a.title)return void b.div.append(K(''));var c=K(''),d=K(''),e=K(''),f=_addUnit(a.height),g=_undef(a.iconClass,"");b.div.append(c),f&&(c.css("height",f),e.css("line-height",f));var h;return b.centerLineMode&&(h=K(''),f&&h.css("height",f)),c.mouseover(function(){K(this).addClass("ke-menu-item-on"),h&&h.addClass("ke-menu-item-center-on")}).mouseout(function(){K(this).removeClass("ke-menu-item-on"),h&&h.removeClass("ke-menu-item-center-on")}).click(function(b){a.click.call(K(this)),b.stopPropagation()}).append(d),h&&c.append(h),c.append(e),a.checked&&(g="ke-icon-checked"),""!==g&&d.html(''),e.html(a.title),b},remove:function(){var a=this;return a.options.beforeRemove&&a.options.beforeRemove.call(a),K(".ke-menu-item",a.div[0]).unbind(),KMenu.parent.remove.call(a),a}}),K.MenuClass=KMenu,K.menu=_menu,_extend(KColorPicker,KWidget,{init:function(a){var b=this;a.z=a.z||811213,KColorPicker.parent.init.call(b,a);var c=a.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"]];b.selectedColor=(a.selectedColor||"").toLowerCase(),b._cells=[],b.div.addClass("ke-colorpicker").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on");var d=b.doc.createElement("table");b.div.append(d),d.className="ke-colorpicker-table",d.cellPadding=0,d.cellSpacing=0,d.border=0;var e=d.insertRow(0),f=e.insertCell(0);f.colSpan=c[0].length,b._addAttr(f,"","ke-colorpicker-cell-top");for(var g=0;g ').css("background-color",b)):a.html(d.options.noColor),K(a).attr("unselectable","on"),d._cells.push(a)},remove:function(){var a=this;return _each(a._cells,function(){this.unbind()}),KColorPicker.parent.remove.call(a),a}}),K.ColorPickerClass=KColorPicker,K.colorpicker=_colorpicker,_extend(KUploadButton,{init:function(a){var b=this,c=K(a.button),d=a.fieldName||"file",e=a.url||"",f=c.val(),g=a.extraParams||{},h=c[0].className||"",i=a.target||"kindeditor_upload_iframe_"+(new Date).getTime();a.afterError=a.afterError||function(a){alert(a)};var j=[];for(var k in g)j.push('');var l=['"].join(""),m=K(l,c.doc);c.hide(),c.before(m),b.div=m,b.button=c,b.iframe=a.target?K('iframe[name="'+i+'"]'):K("iframe",m),b.form=a.form?K(a.form):K("form",m),b.fileBox=K(".ke-upload-file",m);var n=a.width||K(".ke-button-common",m).width();K(".ke-upload-area",m).width(n),b.options=a},submit:function(){var a=this,b=a.iframe;return b.bind("load",function(){b.unbind();var c=document.createElement("form");a.fileBox.before(c),K(c).append(a.fileBox),c.reset(),K(c).remove(!0);var d,e=K.iframeDoc(b),f=e.getElementsByTagName("pre")[0],g="";g=f?f.innerHTML:e.body.innerHTML,g=_unescape(g),b[0].src="javascript:false";try{d=K.json(g)}catch(h){a.options.afterError.call(a,""+e.body.parentNode.innerHTML+"")}d&&a.options.afterUpload.call(a,d)}),a.form[0].submit(),a},remove:function(){var a=this;return a.fileBox&&a.fileBox.unbind(),a.iframe.remove(),a.div.remove(),a.button.show(),a}}),K.UploadButtonClass=KUploadButton,K.uploadbutton=_uploadbutton,_extend(KDialog,KWidget,{init:function(a){var b=this,c=_undef(a.shadowMode,!0);a.z=a.z||811213,a.shadowMode=!1,a.autoScroll=_undef(a.autoScroll,!0),KDialog.parent.init.call(b,a);var d=a.title,e=K(a.body,b.doc),f=a.previewBtn,g=a.yesBtn,h=a.noBtn,i=a.closeBtn,j=_undef(a.showMask,!0);b.div.addClass("ke-dialog").bind("click,mousedown",function(a){a.stopPropagation()});var k=K('').appendTo(b.div);_IE&&7>_V?b.iframeMask=K('').appendTo(b.div):c&&K('').appendTo(b.div);var l=K('');k.append(l),l.html(d),b.closeIcon=K('').click(i.click),l.append(b.closeIcon),b.draggable({clickEl:l,beforeDrag:a.beforeDrag});var m=K('');k.append(m),m.append(e);var n=K('');if((f||g||h)&&k.append(n),_each([{btn:f,name:"preview"},{btn:g,name:"yes"},{btn:h,name:"no"}],function(){if(this.btn){var a=_createButton(this.btn);a.addClass("ke-dialog-"+this.name),n.append(a)}}),b.height&&m.height(_removeUnit(b.height)-l.height()-n.height()),b.div.width(b.div.width()),b.div.height(b.div.height()),b.mask=null,j){var o=_docElement(b.doc),p=Math.max(o.scrollWidth,o.clientWidth),q=Math.max(o.scrollHeight,o.clientHeight);b.mask=_widget({x:0,y:0,z:b.z-1,cls:"ke-dialog-mask",width:p,height:q})}b.autoPos(b.div.width(),b.div.height()),b.footerDiv=n,b.bodyDiv=m,b.headerDiv=l,b.isLoading=!1},setMaskIndex:function(a){var b=this;b.mask.div.css("z-index",a)},showLoading:function(a){a=_undef(a,"");var b=this,c=b.bodyDiv;return b.loading=K('").width(c.width()).height(c.height()).css("top",b.headerDiv.height()+"px"),c.css("visibility","hidden").after(b.loading),b.isLoading=!0,b},hideLoading:function(){return this.loading&&this.loading.remove(),this.bodyDiv.css("visibility","visible"),this.isLoading=!1,this},remove:function(){var a=this;return a.options.beforeRemove&&a.options.beforeRemove.call(a),a.mask&&a.mask.remove(),a.iframeMask&&a.iframeMask.remove(),a.closeIcon.unbind(),K("input",a.div).unbind(),K("button",a.div).unbind(),a.footerDiv.unbind(),a.bodyDiv.unbind(),a.headerDiv.unbind(),K("iframe",a.div).each(function(){K(this).remove()}),KDialog.parent.remove.call(a),a}}),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(a){return _lang(a,this.langType)},loadPlugin:function(a,b){var c=this,d=this._pluginStatus;return d||(d=this._pluginStatus={}),_plugins[a]?_isFunction(_plugins[a])?(d[a]||(_plugins[a].call(c,KindEditor),d[a]="inited"),b&&b.call(c),c):(setTimeout(function(){c.loadPlugin(a,b)},100),c):(_plugins[a]="loading",_loadScript(c.pluginsPath+a+"/"+a+".js?ver="+encodeURIComponent(K.DEBUG?_TIME:_VERSION),function(){setTimeout(function(){_plugins[a]&&c.loadPlugin(a,b)},0)}),c)},handler:function(a,b){var c=this;return c._handlers[a]||(c._handlers[a]=[]),_isFunction(b)?(c._handlers[a].push(b),c):(_each(c._handlers[a],function(){b=this.call(c,b)}),b)},clickToolbar:function(a,b){var c=this,d="clickToolbar"+a;return b===undefined?c._handlers[d]?c.handler(d):(c.loadPlugin(a,function(){c.handler(d)}),c):c.handler(d,b)},updateState:function(){var a=this;return _each("justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,subscript,superscript,bold,italic,underline,strikethrough".split(","),function(b,c){a.cmd.state(c)?a.toolbar.select(c):a.toolbar.unselect(c)}),a},addContextmenu:function(a){return this._contextmenus.push(a),this},afterCreate:function(a){return this.handler("afterCreate",a)},beforeRemove:function(a){return this.handler("beforeRemove",a)},beforeGetHtml:function(a){return this.handler("beforeGetHtml",a)},beforeSetHtml:function(a){return this.handler("beforeSetHtml",a)},afterSetHtml:function(a){return this.handler("afterSetHtml",a)},create:function(){function a(){return 0===i.height()?void setTimeout(a,100):void b.resize(d,e,!1)}var b=this,c=b.fullscreenMode;if(b.isCreated)return b;if(b.srcElement.data("kindeditor"))return b;b.srcElement.data("kindeditor","true"),_docElement().style.overflow=c?"hidden":"";var d=c?_docElement().clientWidth+"px":b.width,e=c?_docElement().clientHeight+"px":b.height;(_IE&&8>_V||_QUIRKS)&&(e=_addUnit(_removeUnit(e)+2));var f=b.container=K(b.layout);c?K(document.body).append(f):b.srcElement.before(f);var g=K(".toolbar",f),h=K(".edit",f),i=b.statusbar=K(".statusbar",f);f.removeClass("container").addClass("ke-container ke-container-"+b.themeType).css("width",d),c?(f.css({position:"absolute",left:0,top:0,"z-index":811211}),_GECKO||(b._scrollPos=_getScrollPos()),window.scrollTo(0,0),K(document.body).css({height:"1px",overflow:"hidden"}),K(document.body.parentNode).css("overflow","hidden"),b._fullscreenExecuted=!0):(b._fullscreenExecuted&&(K(document.body).css({height:"",overflow:""}),K(document.body.parentNode).css("overflow","")),b._scrollPos&&window.scrollTo(b._scrollPos.x,b._scrollPos.y));var j=[];K.each(b.items,function(a,c){"|"==c?j.push(''):"/"==c?j.push(''):(j.push(''),j.push(''))});var k=b.toolbar=_toolbar({src:g,html:j.join(""),noDisableItems:b.noDisableItems,click:function(a,c){if(a.stop(),b.menu){var d=b.menu.name;if(b.hideMenu(),d===c)return}b.clickToolbar(c)}}),l=_removeUnit(e)-k.div.height(),m=b.edit=_edit({height:l>0&&_removeUnit(e)>b.minHeight?l:b.minHeight,src:h,srcElement:b.srcElement,designMode:b.designMode,themesPath:b.themesPath,bodyClass:b.bodyClass,cssPath:b.cssPath,cssData:b.cssData,beforeGetHtml:function(a){return a=b.beforeGetHtml(a),a=_removeBookmarkTag(_removeTempTag(a)),_formatHtml(a,b.filterMode?b.htmlTags:null,b.urlType,b.wellFormatMode,b.indentChar)},beforeSetHtml:function(a){return a=_formatHtml(a,b.filterMode?b.htmlTags:null,"",!1),b.beforeSetHtml(a)},afterSetHtml:function(){b.edit=m=this,b.afterSetHtml()},afterCreate:function(){if(b.edit=m=this,b.cmd=m.cmd,b._docMousedownFn=function(){b.menu&&b.hideMenu()},K(m.doc,document).mousedown(b._docMousedownFn),_bindContextmenuEvent.call(b),_bindNewlineEvent.call(b),_bindTabEvent.call(b),_bindFocusEvent.call(b),m.afterChange(function(){m.designMode&&(b.updateState(),b.addBookmark(),b.options.afterChange&&b.options.afterChange.call(b))}),m.textarea.keyup(function(a){a.ctrlKey||a.altKey||!_INPUT_KEY_MAP[a.which]||b.options.afterChange&&b.options.afterChange.call(b)}),b.readonlyMode&&b.readonly(),b.isCreated=!0,""===b.initContent&&(b.initContent=b.html()),b._undoStack.length>0){var a=b._undoStack.pop();a.start&&(b.html(a.html),m.cmd.range.moveToBookmark(a),b.select())}b.afterCreate(),b.options.afterCreate&&b.options.afterCreate.call(b)}});return i.removeClass("statusbar").addClass("ke-statusbar").append('').append(''),b._fullscreenResizeHandler&&(K(window).unbind("resize",b._fullscreenResizeHandler),b._fullscreenResizeHandler=null),a(),c?(b._fullscreenResizeHandler=function(){b.isCreated&&b.resize(_docElement().clientWidth,_docElement().clientHeight,!1)},K(window).bind("resize",b._fullscreenResizeHandler),k.select("fullscreen"),i.first().css("visibility","hidden"),i.last().css("visibility","hidden")):(_GECKO&&K(window).bind("scroll",function(){b._scrollPos=_getScrollPos()}),b.resizeType>0?_drag({moveEl:f,clickEl:i,moveFn:function(a,c,d,e,f,g){e+=g,b.resize(null,e)}}):i.first().css("visibility","hidden"),2===b.resizeType?_drag({moveEl:f,clickEl:i.last(),moveFn:function(a,c,d,e,f,g){d+=f,e+=g,b.resize(d,e)}}):i.last().css("visibility","hidden")),b},remove:function(){var a=this;return a.isCreated?(a.beforeRemove(),a.srcElement.data("kindeditor",""),a.menu&&a.hideMenu(),_each(a.dialogs,function(){a.hideDialog()}),K(document).unbind("mousedown",a._docMousedownFn),a.toolbar.remove(),a.edit.remove(),a.statusbar.last().unbind(),a.statusbar.unbind(),a.container.remove(),a.container=a.toolbar=a.edit=a.menu=null,a.dialogs=[],a.isCreated=!1,a):a},resize:function(a,b,c){var d=this;return c=_undef(c,!0),a&&(/%/.test(a)||(a=_removeUnit(a),a=a/gi,"").replace(/ /gi," ")):b.html(_escape(a))},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 a=this.isCreated?this.cmd.range.html():"";return a=_removeBookmarkTag(_removeTempTag(a))},count:function(a){var b=this;return a=(a||"html").toLowerCase(),"html"===a?b.html().length:"text"===a?b.text().replace(/<(?:img|embed).*?>/gi,"K").replace(/\r\n|\n|\r/g,"").length:0},exec:function(a){a=a.toLowerCase();var b=this,c=b.cmd,d=_inArray(a,"selectall,copy,paste,print".split(","))<0;return d&&b.addBookmark(!1),c[a].apply(c,_toArray(arguments,1)),d&&(b.updateState(),b.addBookmark(!1),b.options.afterChange&&b.options.afterChange.call(b)),b},insertHtml:function(a,b){return this.isCreated?(a=this.beforeSetHtml(a),this.exec("inserthtml",a,b),this):this},appendHtml:function(a){if(this.html(this.html()+a),this.isCreated){var b=this.cmd;b.range.selectNodeContents(b.doc.body).collapse(!1),b.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(a){a=_undef(a,!0);var b,c=this,d=c.edit,e=d.doc.body,f=_removeTempTag(e.innerHTML);if(a&&c._undoStack.length>0){var g=c._undoStack[c._undoStack.length-1];if(Math.abs(f.length-_removeBookmarkTag(g.html).length)0){var c=b.dialogs[0],d=b.dialogs[b.dialogs.length-1];c.setMaskIndex(d.z+2),a.z=d.z+3,a.showMask=!1}var e=_dialog(a);return b.dialogs.push(e),e},hideDialog:function(){var a=this;if(a.dialogs.length>0&&a.dialogs.pop().remove(),a.dialogs.length>0){var b=a.dialogs[0],c=a.dialogs[a.dialogs.length-1];b.setMaskIndex(c.z-1)}return a},errorDialog:function(a){var b=this,c=b.createDialog({width:750,title:b.lang("uploadError"),body:''}),d=K("iframe",c.div),e=K.iframeDoc(d);return e.open(),e.write(a),e.close(),K(e.body).css("background-color","#FFF"),d[0].contentWindow.focus(),b}},_instances=[],K.remove=function(a){_eachEditor(a,function(a){this.remove(),_instances.splice(a,1)})},K.sync=function(a){_eachEditor(a,function(){this.sync()})},K.html=function(a,b){_eachEditor(a,function(){this.html(b)})},K.insertHtml=function(a,b){_eachEditor(a,function(){this.insertHtml(b)})},K.appendHtml=function(a,b){_eachEditor(a,function(){this.appendHtml(b)})},_IE&&7>_V&&_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(a){var b=this,c={undo:"Z",redo:"Y",bold:"B",italic:"I",underline:"U",print:"P",selectall:"A"};if(b.afterSetHtml(function(){b.options.afterChange&&b.options.afterChange.call(b)}),b.afterCreate(function(){if("form"==b.syncType){for(var c=a(b.srcElement),d=!1;c=c.parent();)if("form"==c.name){d=!0;break}if(d){c.bind("submit",function(){b.sync(),a(window).bind("unload",function(){b.edit.textarea.remove()})});var e=a('[type="reset"]',c);e.click(function(){b.html(b.initContent),b.cmd.selection()}),b.beforeRemove(function(){c.unbind(),e.unbind()})}}}),b.clickToolbar("source",function(){b.edit.designMode?(b.toolbar.disableAll(!0),b.edit.design(!1),b.toolbar.select("source")):(b.toolbar.disableAll(!1),b.edit.design(!0),b.toolbar.unselect("source"),_GECKO?setTimeout(function(){b.cmd.selection()},0):b.cmd.selection()),b.designMode=b.edit.designMode}),b.afterCreate(function(){b.designMode||b.toolbar.disableAll(!0).select("source")}),b.clickToolbar("fullscreen",function(){b.fullscreen()}),b.fullscreenShortcut){var d=!1;b.afterCreate(function(){if(a(b.edit.doc,b.edit.textarea).keyup(function(a){27==a.which&&setTimeout(function(){b.fullscreen()},0)}),d){if(_IE&&!b.designMode)return;b.focus()}d||(d=!0)})}_each("undo,redo".split(","),function(a,d){c[d]&&b.afterCreate(function(){_ctrl(this.edit.doc,c[d],function(){b.clickToolbar(d)})}),b.clickToolbar(d,function(){b[d]()})}),b.clickToolbar("formatblock",function(){var a=b.lang("formatblock.formatBlock"),c={h1:28,h2:24,h3:18,H4:14,p:12},d=b.cmd.val("formatblock"),e=b.createMenu({name:"formatblock",width:"en"==b.langType?200:150});_each(a,function(a,f){var g="font-size:"+c[a]+"px;";"h"===a.charAt(0)&&(g+="font-weight:bold;"),e.addItem({title:''+f+"",height:c[a]+12,checked:d===a||d===f,click:function(){b.select().exec("formatblock","<"+a+">").hideMenu()}})})}),b.clickToolbar("fontname",function(){var a=b.cmd.val("fontname"),c=b.createMenu({name:"fontname",width:150});_each(b.lang("fontname.fontName"),function(d,e){c.addItem({title:''+e+"",checked:a===d.toLowerCase()||a===e.toLowerCase(),click:function(){b.exec("fontname",d).hideMenu()}})})}),b.clickToolbar("fontsize",function(){var a=b.cmd.val("fontsize"),c=b.createMenu({name:"fontsize",width:150});_each(b.fontSizeTable,function(d,e){c.addItem({title:''+e+"",height:_removeUnit(e)+12,checked:a===e,click:function(){b.exec("fontsize",e).hideMenu()}})})}),_each("forecolor,hilitecolor".split(","),function(a,c){b.clickToolbar(c,function(){b.createMenu({name:c,selectedColor:b.cmd.val(c)||"default",colors:b.colorTable,click:function(a){b.exec(c,a).hideMenu()}})})}),_each("cut,copy,paste".split(","),function(a,c){b.clickToolbar(c,function(){b.focus();try{b.exec(c,null)}catch(a){alert(b.lang(c+"Error"))}})}),b.clickToolbar("about",function(){var a='';b.createDialog({name:"about",width:350,title:b.lang("about"),body:a})}),b.plugin.getSelectedLink=function(){return b.cmd.commonAncestor("a")},b.plugin.getSelectedImage=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return!/^ke-\w+$/i.test(a[0].className)})},b.plugin.getSelectedFlash=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-flash"==a[0].className})},b.plugin.getSelectedMedia=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-media"==a[0].className||"ke-rm"==a[0].className})},b.plugin.getSelectedAnchor=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-anchor"==a[0].className})},_each("link,image,flash,media,anchor".split(","),function(a,c){var d=c.charAt(0).toUpperCase()+c.substr(1);_each("edit,delete".split(","),function(a,e){b.addContextmenu({title:b.lang(e+d),click:function(){b.loadPlugin(c,function(){b.plugin[c][e](),b.hideMenu()})},cond:b.plugin["getSelected"+d],width:150,iconClass:"edit"==e?"ke-icon-"+c:undefined})
+}),b.addContextmenu({title:"-"})}),b.plugin.getSelectedTable=function(){return b.cmd.commonAncestor("table")},b.plugin.getSelectedRow=function(){return b.cmd.commonAncestor("tr")},b.plugin.getSelectedCell=function(){return b.cmd.commonAncestor("td")},_each("prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,rowmerge,colmerge,rowsplit,colsplit,coldelete,rowdelete,insert,delete".split(","),function(a,c){var d=_inArray(c,["prop","delete"])<0?b.plugin.getSelectedCell:b.plugin.getSelectedTable;b.addContextmenu({title:b.lang("table"+c),click:function(){b.loadPlugin("table",function(){b.plugin.table[c](),b.hideMenu()})},cond:d,width:170,iconClass:"ke-icon-table"+c})}),b.addContextmenu({title:"-"}),_each("selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript,hr,print,bold,italic,underline,strikethrough,removeformat,unlink".split(","),function(a,d){c[d]&&b.afterCreate(function(){_ctrl(this.edit.doc,c[d],function(){b.cmd.selection(),b.clickToolbar(d)})}),b.clickToolbar(d,function(){b.focus().exec(d,null)})}),b.afterCreate(function(){function c(){d.range.moveToBookmark(e),d.select(),_WEBKIT&&(a("div."+h,f).each(function(){a(this).after("
").remove(!0)}),a("span.Apple-style-span",f).remove(!0),a("span.Apple-tab-span",f).remove(!0),a("span[style]",f).each(function(){"nowrap"==a(this).css("white-space")&&a(this).remove(!0)}),a("meta",f).remove());var c=f[0].innerHTML;f.remove(),""!==c&&(_WEBKIT&&(c=c.replace(/(
)\1/gi,"$1")),2===b.pasteType&&(c=c.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,""),/schemas-microsoft-com|worddocument|mso-\w+/i.test(c)?c=_clearMsWord(c,b.filterMode?b.htmlTags:a.options.htmlTags):(c=_formatHtml(c,b.filterMode?b.htmlTags:null),c=b.beforeSetHtml(c))),1===b.pasteType&&(c=c.replace(/ /gi," "),c=c.replace(/\n\s*\n/g,"\n"),c=c.replace(/
]*>/gi,"\n"),c=c.replace(/<\/p>]*>/gi,"\n"),c=c.replace(/<[^>]+>/g,""),c=c.replace(/ {2}/g," "),"p"==b.newlineTag?/\n/.test(c)&&(c=c.replace(/^/,"
").replace(/$/,"
").replace(/\n/g,"
")):c=c.replace(/\n/g,"
$&")),b.insertHtml(c,!0))}var d,e,f,g=b.edit.doc,h="__kindeditor_paste__",i=!1;a(g.body).bind("paste",function(j){if(0===b.pasteType)return void j.stop();if(!i){if(i=!0,a("div."+h,g).remove(),d=b.cmd.selection(),e=d.range.createBookmark(),f=a('
',g).css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",left:"-1981px",top:a(e.start).pos().y+"px","white-space":"nowrap"}),a(g.body).append(f),_IE){var k=d.range.get(!0);k.moveToElementText(f[0]),k.select(),k.execCommand("paste"),j.preventDefault()}else d.range.selectNodeContents(f[0]),d.select(),f[0].tabIndex=-1,f[0].focus();setTimeout(function(){c(),i=!1},0)}})}),b.beforeGetHtml(function(a){return _IE&&8>=_V&&(a=a.replace(/]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b){return unescape(b)}),a=a.replace(/(
]*)?>)/gi,function(a,b,c){return/\s+type="[^"]+"/i.test(a)?a:b+' type="text"'+c})),a.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/gi,function(a,b,c,d){return b+_unescape(c).replace(/\s+/g," ")+d}).replace(/
![]()
]*class="?ke-(flash|rm|media)"?[^>]*>/gi,function(a){var b=_getAttrList(a),c=_getCssList(b.style||""),d=_mediaAttrs(b["data-ke-tag"]),e=_undef(c.width,""),f=_undef(c.height,"");return/px/i.test(e)&&(e=_removeUnit(e)),/px/i.test(f)&&(f=_removeUnit(f)),d.width=_undef(b.width,e),d.height=_undef(b.height,f),_mediaEmbed(d)}).replace(/
![]()
]*class="?ke-anchor"?[^>]*>/gi,function(a){var b=_getAttrList(a);return'
'}).replace(/
]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b,c){return""}).replace(/
]*data-ke-noscript-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b,c){return"
"}).replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/gi,function(a,b,c){return a=a.replace(/(\s+(?:href|src)=")[^"]*(")/i,function(a,b,d){return b+_unescape(c)+d}),a=a.replace(/\s+data-ke-src="[^"]*"/i,"")}).replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/gi,function(a,b,c){return b+c})}),b.beforeSetHtml(function(a){return _IE&&8>=_V&&(a=a.replace(/
]*>|<(select|button)[^>]*>[\s\S]*?<\/\1>/gi,function(a){var b=_getAttrList(a),c=_getCssList(b.style||"");return"none"==c.display?'
':a})),a.replace(/