").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.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"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.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,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){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===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.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=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],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=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.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&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.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)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.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 On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=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 u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.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,On.push(o)),s&&b.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){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.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,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.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,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.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||(b.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?b.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=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.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)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.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=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._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=b.timers,a=b._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)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),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}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.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,b.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},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.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?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.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?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
\ No newline at end of file
diff --git a/public/tinymce/plugins/leaui_image/public/js/jquery.lazyload.min.js b/public/tinymce/plugins/leaui_image/public/js/jquery.lazyload.min.js
new file mode 100644
index 0000000..615b90e
--- /dev/null
+++ b/public/tinymce/plugins/leaui_image/public/js/jquery.lazyload.min.js
@@ -0,0 +1,2 @@
+/*! Lazy Load 1.9.3 - MIT license - Copyright 2010-2013 Mika Tuupola */
+!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("
").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);
\ No newline at end of file
diff --git a/public/tinymce/plugins/leaui_image/public/js/jquery.pagination.js b/public/tinymce/plugins/leaui_image/public/js/jquery.pagination.js
new file mode 100644
index 0000000..3fc6cd7
--- /dev/null
+++ b/public/tinymce/plugins/leaui_image/public/js/jquery.pagination.js
@@ -0,0 +1,172 @@
+/**
+ * This jQuery plugin displays pagination links inside the selected elements.
+ *
+ * @author Gabriel Birke (birke *at* d-scribe *dot* de)
+ * @version 1.2
+ * @param {int} maxentries Number of entries to paginate
+ * @param {Object} opts Several options (see README for documentation)
+ * @return {Object} jQuery Object
+ */
+jQuery.fn.pagination = function(maxentries, opts){
+ opts = jQuery.extend({
+ items_per_page:10,
+ num_display_entries:10,
+ current_page:0,
+ num_edge_entries:2,
+ link_to:"#",
+ prev_text:"Prev",
+ next_text:"Next",
+ ellipse_text:"...",
+ prev_show_always:true,
+ next_show_always:true,
+ callback:function(){return false;}
+ },opts||{});
+
+ return this.each(function() {
+ /**
+ * Calculate the maximum number of pages
+ */
+ function numPages() {
+ return Math.ceil(maxentries/opts.items_per_page);
+ }
+
+ /**
+ * Calculate start and end point of pagination links depending on
+ * current_page and num_display_entries.
+ * @return {Array}
+ */
+ function getInterval() {
+ var ne_half = Math.ceil(opts.num_display_entries/2);
+ var np = numPages();
+ var upper_limit = np-opts.num_display_entries;
+ var start = current_page>ne_half?Math.max(Math.min(current_page-ne_half, upper_limit), 0):0;
+ var end = current_page>ne_half?Math.min(current_page+ne_half, np):Math.min(opts.num_display_entries, np);
+ return [start,end];
+ }
+
+ /**
+ * This is the event handling function for the pagination links.
+ * @param {int} page_id The new page number
+ */
+ function pageSelected(page_id, evt){
+ evt.preventDefault();
+ current_page = page_id;
+ drawLinks();
+ var continuePropagation = opts.callback(page_id, panel);
+ if (!continuePropagation) {
+ if (evt.stopPropagation) {
+ evt.stopPropagation();
+ }
+ else {
+ evt.cancelBubble = true;
+ }
+ }
+ return continuePropagation;
+ }
+
+ /**
+ * This function inserts the pagination links into the container element
+ */
+ function drawLinks() {
+ panel.empty();
+ var interval = getInterval();
+ var np = numPages();
+ // This helper function returns a handler function that calls pageSelected with the right page_id
+ var getClickHandler = function(page_id) {
+ return function(evt){ return pageSelected(page_id,evt); }
+ }
+ // Helper function for generating a single link (or a span tag if it's the current page)
+ var appendItem = function(page_id, appendopts){
+ page_id = page_id<0?0:(page_id
"+(appendopts.text)+"");
+ if(appendopts.text != opts.prev_text && appendopts.text != opts.next_text) {
+ classes='class="active"';
+ }
+ }
+ else
+ {
+ var lnk = jQuery(""+(appendopts.text)+" ")
+ .bind("click", getClickHandler(page_id))
+ .attr('href', opts.link_to.replace(/__id__/,page_id));
+ }
+ if(appendopts.classes){lnk.addClass(appendopts.classes);}
+ var l = $(" ").append(lnk);
+ panel.append(l);
+ }
+ // Generate "Previous"-Link
+ if(opts.prev_text && (current_page > 0 || opts.prev_show_always)){
+ appendItem(current_page-1,{text:opts.prev_text, classes:"prev"});
+ }
+ // Generate starting points
+ if (interval[0] > 0 && opts.num_edge_entries > 0)
+ {
+ var end = Math.min(opts.num_edge_entries, interval[0]);
+ for(var i=0; i"+opts.ellipse_text+" ").appendTo(panel);
+ }
+ }
+ // Generate interval links
+ for(var i=interval[0]; i 0)
+ {
+ if(np-opts.num_edge_entries > interval[1]&& opts.ellipse_text)
+ {
+ jQuery(""+opts.ellipse_text+" ").appendTo(panel);
+ }
+ var begin = Math.max(np-opts.num_edge_entries, interval[1]);
+ for(var i=begin; i 0) {
+ pageSelected(current_page - 1);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ this.nextPage = function(){
+ if(current_page < numPages()-1) {
+ pageSelected(current_page+1);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ // When all initialisation is done, draw the links
+ drawLinks();
+ // call callback function
+ // opts.callback(current_page, this);
+ });
+}
+
+
diff --git a/public/tinymce/plugins/leaui_image/public/js/jquery.ui.widget.js b/public/tinymce/plugins/leaui_image/public/js/jquery.ui.widget.js
new file mode 100644
index 0000000..59b1129
--- /dev/null
+++ b/public/tinymce/plugins/leaui_image/public/js/jquery.ui.widget.js
@@ -0,0 +1,534 @@
+/*
+ * jQuery UI Widget 1.10.1+amd
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/jQuery.widget/
+ */
+
+(function (factory) {
+ /* 需要jquery, 会重新加载jquery, slimScroll会覆盖
+ if (typeof define === "function" && define.amd) {
+ // Register as an anonymous AMD module:
+ define(["jquery"], factory);
+ } else {
+ // Browser globals:
+ factory(jQuery);
+ }
+ */
+
+ factory(jQuery);
+}(function( $, undefined ) {
+
+var uuid = 0,
+ slice = Array.prototype.slice,
+ _cleanData = $.cleanData;
+$.cleanData = function( elems ) {
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ try {
+ $( elem ).triggerHandler( "remove" );
+ // http://bugs.jquery.com/ticket/8235
+ } catch( e ) {}
+ }
+ _cleanData( elems );
+};
+
+$.widget = function( name, base, prototype ) {
+ var fullName, existingConstructor, constructor, basePrototype,
+ // proxiedPrototype allows the provided prototype to remain unmodified
+ // so that it can be used as a mixin for multiple widgets (#8876)
+ proxiedPrototype = {},
+ namespace = name.split( "." )[ 0 ];
+
+ name = name.split( "." )[ 1 ];
+ fullName = namespace + "-" + name;
+
+ if ( !prototype ) {
+ prototype = base;
+ base = $.Widget;
+ }
+
+ // create selector for plugin
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+ return !!$.data( elem, fullName );
+ };
+
+ $[ namespace ] = $[ namespace ] || {};
+ existingConstructor = $[ namespace ][ name ];
+ constructor = $[ namespace ][ name ] = function( options, element ) {
+ // allow instantiation without "new" keyword
+ if ( !this._createWidget ) {
+ return new constructor( options, element );
+ }
+
+ // allow instantiation without initializing for simple inheritance
+ // must use "new" keyword (the code above always passes args)
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
+ };
+ // extend with the existing constructor to carry over any static properties
+ $.extend( constructor, existingConstructor, {
+ version: prototype.version,
+ // copy the object used to create the prototype in case we need to
+ // redefine the widget later
+ _proto: $.extend( {}, prototype ),
+ // track widgets that inherit from this widget in case this widget is
+ // redefined after a widget inherits from it
+ _childConstructors: []
+ });
+
+ basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
+ $.each( prototype, function( prop, value ) {
+ if ( !$.isFunction( value ) ) {
+ proxiedPrototype[ prop ] = value;
+ return;
+ }
+ proxiedPrototype[ prop ] = (function() {
+ var _super = function() {
+ return base.prototype[ prop ].apply( this, arguments );
+ },
+ _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
+ };
+ return function() {
+ var __super = this._super,
+ __superApply = this._superApply,
+ returnValue;
+
+ this._super = _super;
+ this._superApply = _superApply;
+
+ returnValue = value.apply( this, arguments );
+
+ this._super = __super;
+ this._superApply = __superApply;
+
+ return returnValue;
+ };
+ })();
+ });
+ constructor.prototype = $.widget.extend( basePrototype, {
+ // TODO: remove support for widgetEventPrefix
+ // always use the name + a colon as the prefix, e.g., draggable:start
+ // don't prefix for widgets that aren't DOM-based
+ widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
+ }, proxiedPrototype, {
+ constructor: constructor,
+ namespace: namespace,
+ widgetName: name,
+ widgetFullName: fullName
+ });
+
+ // If this widget is being redefined then we need to find all widgets that
+ // are inheriting from it and redefine all of them so that they inherit from
+ // the new version of this widget. We're essentially trying to replace one
+ // level in the prototype chain.
+ if ( existingConstructor ) {
+ $.each( existingConstructor._childConstructors, function( i, child ) {
+ var childPrototype = child.prototype;
+
+ // redefine the child widget using the same prototype that was
+ // originally used, but inherit from the new version of the base
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+ });
+ // remove the list of existing child constructors from the old constructor
+ // so the old child constructors can be garbage collected
+ delete existingConstructor._childConstructors;
+ } else {
+ base._childConstructors.push( constructor );
+ }
+
+ $.widget.bridge( name, constructor );
+};
+
+$.widget.extend = function( target ) {
+ var input = slice.call( arguments, 1 ),
+ inputIndex = 0,
+ inputLength = input.length,
+ key,
+ value;
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
+ for ( key in input[ inputIndex ] ) {
+ value = input[ inputIndex ][ key ];
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+ // Clone objects
+ if ( $.isPlainObject( value ) ) {
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
+ $.widget.extend( {}, target[ key ], value ) :
+ // Don't extend strings, arrays, etc. with objects
+ $.widget.extend( {}, value );
+ // Copy everything else by reference
+ } else {
+ target[ key ] = value;
+ }
+ }
+ }
+ }
+ return target;
+};
+
+$.widget.bridge = function( name, object ) {
+ var fullName = object.prototype.widgetFullName || name;
+ $.fn[ name ] = function( options ) {
+ var isMethodCall = typeof options === "string",
+ args = slice.call( arguments, 1 ),
+ returnValue = this;
+
+ // allow multiple hashes to be passed on init
+ options = !isMethodCall && args.length ?
+ $.widget.extend.apply( null, [ options ].concat(args) ) :
+ options;
+
+ if ( isMethodCall ) {
+ this.each(function() {
+ var methodValue,
+ instance = $.data( this, fullName );
+ if ( !instance ) {
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
+ "attempted to call method '" + options + "'" );
+ }
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+ }
+ methodValue = instance[ options ].apply( instance, args );
+ if ( methodValue !== instance && methodValue !== undefined ) {
+ returnValue = methodValue && methodValue.jquery ?
+ returnValue.pushStack( methodValue.get() ) :
+ methodValue;
+ return false;
+ }
+ });
+ } else {
+ this.each(function() {
+ var instance = $.data( this, fullName );
+ if ( instance ) {
+ instance.option( options || {} )._init();
+ } else {
+ $.data( this, fullName, new object( options, this ) );
+ }
+ });
+ }
+
+ return returnValue;
+ };
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+ widgetName: "widget",
+ widgetEventPrefix: "",
+ defaultElement: "",
+ options: {
+ disabled: false,
+
+ // callbacks
+ create: null
+ },
+ _createWidget: function( options, element ) {
+ element = $( element || this.defaultElement || this )[ 0 ];
+ this.element = $( element );
+ this.uuid = uuid++;
+ this.eventNamespace = "." + this.widgetName + this.uuid;
+ this.options = $.widget.extend( {},
+ this.options,
+ this._getCreateOptions(),
+ options );
+
+ this.bindings = $();
+ this.hoverable = $();
+ this.focusable = $();
+
+ if ( element !== this ) {
+ $.data( element, this.widgetFullName, this );
+ this._on( true, this.element, {
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
+ this.document = $( element.style ?
+ // element within the document
+ element.ownerDocument :
+ // element is window or document
+ element.document || element );
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+ }
+
+ this._create();
+ this._trigger( "create", null, this._getCreateEventData() );
+ this._init();
+ },
+ _getCreateOptions: $.noop,
+ _getCreateEventData: $.noop,
+ _create: $.noop,
+ _init: $.noop,
+
+ destroy: function() {
+ this._destroy();
+ // we can probably remove the unbind calls in 2.0
+ // all event bindings should go through this._on()
+ this.element
+ .unbind( this.eventNamespace )
+ // 1.9 BC for #7810
+ // TODO remove dual storage
+ .removeData( this.widgetName )
+ .removeData( this.widgetFullName )
+ // support: jquery <1.6.3
+ // http://bugs.jquery.com/ticket/9413
+ .removeData( $.camelCase( this.widgetFullName ) );
+ this.widget()
+ .unbind( this.eventNamespace )
+ .removeAttr( "aria-disabled" )
+ .removeClass(
+ this.widgetFullName + "-disabled " +
+ "ui-state-disabled" );
+
+ // clean up events and states
+ this.bindings.unbind( this.eventNamespace );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ },
+ _destroy: $.noop,
+
+ widget: function() {
+ return this.element;
+ },
+
+ option: function( key, value ) {
+ var options = key,
+ parts,
+ curOption,
+ i;
+
+ if ( arguments.length === 0 ) {
+ // don't return a reference to the internal hash
+ return $.widget.extend( {}, this.options );
+ }
+
+ if ( typeof key === "string" ) {
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+ options = {};
+ parts = key.split( "." );
+ key = parts.shift();
+ if ( parts.length ) {
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+ for ( i = 0; i < parts.length - 1; i++ ) {
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+ curOption = curOption[ parts[ i ] ];
+ }
+ key = parts.pop();
+ if ( value === undefined ) {
+ return curOption[ key ] === undefined ? null : curOption[ key ];
+ }
+ curOption[ key ] = value;
+ } else {
+ if ( value === undefined ) {
+ return this.options[ key ] === undefined ? null : this.options[ key ];
+ }
+ options[ key ] = value;
+ }
+ }
+
+ this._setOptions( options );
+
+ return this;
+ },
+ _setOptions: function( options ) {
+ var key;
+
+ for ( key in options ) {
+ this._setOption( key, options[ key ] );
+ }
+
+ return this;
+ },
+ _setOption: function( key, value ) {
+ this.options[ key ] = value;
+
+ if ( key === "disabled" ) {
+ this.widget()
+ .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
+ .attr( "aria-disabled", value );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ }
+
+ return this;
+ },
+
+ enable: function() {
+ return this._setOption( "disabled", false );
+ },
+ disable: function() {
+ return this._setOption( "disabled", true );
+ },
+
+ _on: function( suppressDisabledCheck, element, handlers ) {
+ var delegateElement,
+ instance = this;
+
+ // no suppressDisabledCheck flag, shuffle arguments
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
+ handlers = element;
+ element = suppressDisabledCheck;
+ suppressDisabledCheck = false;
+ }
+
+ // no element argument, shuffle and use this.element
+ if ( !handlers ) {
+ handlers = element;
+ element = this.element;
+ delegateElement = this.widget();
+ } else {
+ // accept selectors, DOM elements
+ element = delegateElement = $( element );
+ this.bindings = this.bindings.add( element );
+ }
+
+ $.each( handlers, function( event, handler ) {
+ function handlerProxy() {
+ // allow widgets to customize the disabled handling
+ // - disabled as an array instead of boolean
+ // - disabled class as method for disabling individual parts
+ if ( !suppressDisabledCheck &&
+ ( instance.options.disabled === true ||
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
+ return;
+ }
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+
+ // copy the guid so direct unbinding works
+ if ( typeof handler !== "string" ) {
+ handlerProxy.guid = handler.guid =
+ handler.guid || handlerProxy.guid || $.guid++;
+ }
+
+ var match = event.match( /^(\w+)\s*(.*)$/ ),
+ eventName = match[1] + instance.eventNamespace,
+ selector = match[2];
+ if ( selector ) {
+ delegateElement.delegate( selector, eventName, handlerProxy );
+ } else {
+ element.bind( eventName, handlerProxy );
+ }
+ });
+ },
+
+ _off: function( element, eventName ) {
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
+ element.unbind( eventName ).undelegate( eventName );
+ },
+
+ _delay: function( handler, delay ) {
+ function handlerProxy() {
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+ var instance = this;
+ return setTimeout( handlerProxy, delay || 0 );
+ },
+
+ _hoverable: function( element ) {
+ this.hoverable = this.hoverable.add( element );
+ this._on( element, {
+ mouseenter: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-hover" );
+ },
+ mouseleave: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
+ }
+ });
+ },
+
+ _focusable: function( element ) {
+ this.focusable = this.focusable.add( element );
+ this._on( element, {
+ focusin: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-focus" );
+ },
+ focusout: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
+ }
+ });
+ },
+
+ _trigger: function( type, event, data ) {
+ var prop, orig,
+ callback = this.options[ type ];
+
+ data = data || {};
+ event = $.Event( event );
+ event.type = ( type === this.widgetEventPrefix ?
+ type :
+ this.widgetEventPrefix + type ).toLowerCase();
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[ 0 ];
+
+ // copy original event properties over to the new event
+ orig = event.originalEvent;
+ if ( orig ) {
+ for ( prop in orig ) {
+ if ( !( prop in event ) ) {
+ event[ prop ] = orig[ prop ];
+ }
+ }
+ }
+
+ this.element.trigger( event, data );
+ return !( $.isFunction( callback ) &&
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+ event.isDefaultPrevented() );
+ }
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+ if ( typeof options === "string" ) {
+ options = { effect: options };
+ }
+ var hasOptions,
+ effectName = !options ?
+ method :
+ options === true || typeof options === "number" ?
+ defaultEffect :
+ options.effect || defaultEffect;
+ options = options || {};
+ if ( typeof options === "number" ) {
+ options = { duration: options };
+ }
+ hasOptions = !$.isEmptyObject( options );
+ options.complete = callback;
+ if ( options.delay ) {
+ element.delay( options.delay );
+ }
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
+ element[ method ]( options );
+ } else if ( effectName !== method && element[ effectName ] ) {
+ element[ effectName ]( options.duration, options.easing, callback );
+ } else {
+ element.queue(function( next ) {
+ $( this )[ method ]();
+ if ( callback ) {
+ callback.call( element[ 0 ] );
+ }
+ next();
+ });
+ }
+ };
+});
+
+}));
diff --git a/public/tinymce/plugins/leaui_image/public/js/main.js b/public/tinymce/plugins/leaui_image/public/js/main.js
new file mode 100644
index 0000000..94a60d5
--- /dev/null
+++ b/public/tinymce/plugins/leaui_image/public/js/main.js
@@ -0,0 +1,814 @@
+/**
+ * leaui tinymce image plugin
+ * @author leaui
+ * http://leaui.com
+ */
+function log(o) {
+ // console.log(o);
+}
+function retIsOk(ret) {
+ if(ret && typeof ret == "object" && ret.Ok == 1) {
+ return true;
+ }
+ return false;
+}
+
+var urlPrefix = window.location.protocol + "//" + window.location.host;
+
+// load image
+function getImageSize(url, callback) {
+ var img = document.createElement('img');
+
+ function done(width, height) {
+ img.parentNode.removeChild(img);
+ callback({width: width, height: height});
+ }
+
+ img.onload = function() {
+ done(img.clientWidth, img.clientHeight);
+ };
+
+ img.onerror = function() {
+ done();
+ };
+
+ img.src = url;
+
+ var style = img.style;
+ style.visibility = 'hidden';
+ style.position = 'fixed';
+ style.bottom = style.left = 0;
+ style.width = style.height = 'auto';
+
+ document.body.appendChild(img);
+}
+
+var o = {
+ maxSelected: G.maxSelected,
+ selectedZoneO:$("#preview"),
+ previewO: $("#preview"),
+ selectedImages:[], // selected urls
+ imageAttrs: {}, // src => {width, height, title}
+
+ pageNum: 1,
+
+ pagination: function(count) {
+ var self = this;
+ $(".pagination").pagination(count, {
+ items_per_page: G.perPageItems,
+ callback: function(pageNum) {
+ self.pageNum = pageNum+1;
+ self.renderImages($("#albumsForList").val(), self.pageNum, false);
+ }
+ });
+ },
+
+ showMsg: function(msg) {
+ $("#msg").html(msg).css("display", "inline");
+ setTimeout(function() {
+ $("#msg").fadeOut();
+ }, 2000);
+ },
+
+ pageAddAlbum: function(ret) {
+ var html = '
' + ret.Name + ' ';
+ $("#albumsForUpload").append(html).val(ret.AlbumId);
+ $("#albumsForList").append(html);
+ },
+ pageUpdateAlbum: function(albumId, albumName) {
+ $('option[value="' + albumId + '"]').html(albumName);
+ },
+ // add, delete, update album
+ processAlbum: function() {
+ var self = this;
+ var isAddAlbum = true;
+ var curAlbum = "";
+ function toggleAddAlbum() {
+ if($("#addOrUpdateAlbumForm").is(":hidden")) {
+ $("#addOrUpdateAlbumForm").show();
+ $("#albumSelect").hide();
+ } else {
+ $("#addOrUpdateAlbumForm").hide();
+ $("#albumSelect").show();
+ }
+ }
+ // rename
+ $("#renameAlbumBtn").click(function(){
+ curAlbum = $("#albumsForUpload").val();
+ if(!curAlbum) {
+ alert("Cannot rename default album");
+ return;
+ }
+ toggleAddAlbum();
+ $("#addOrUpdateAlbumBtn").html("Rename Album");
+ $("#albumName").val($("#albumsForUpload option:selected").html()).focus();
+ isAddAlbum = false;
+ });
+ // add album
+ $("#addAlbumBtn").click(function() {
+ toggleAddAlbum();
+ $("#addOrUpdateAlbumBtn").html("Add Album");
+ $("#albumName").val("").focus();
+ isAddAlbum = true;
+ });
+ $("#cancelAlbumBtn").click(function() {
+ toggleAddAlbum();
+ });
+ // add or update album
+ $("#addOrUpdateAlbumBtn").click(function() {
+ var albumName = $("#albumName").val();
+ if(!albumName) {
+ $("#albumName").focus();
+ return;
+ }
+ if(isAddAlbum) {
+ $.get("/album/addAlbum", {name: albumName}, function(ret) {
+ if(typeof ret == "object" && ret.AlbumId != "") {
+ $("#albumName").val("");
+ self.showMsg("Add Sucess!");
+ self.pageAddAlbum(ret);
+
+ setTimeout(function() {
+ toggleAddAlbum();
+ }, 200);
+ } else {
+ alert("error");
+ }
+ });
+ } else {
+ $.get("/album/updateAlbum", {albumId: curAlbum, name: albumName}, function(ret) {
+ if(typeof ret == "boolean" && ret) {
+ $("#albumName").val("");
+ self.showMsg("Rename Sucess!");
+ self.pageUpdateAlbum(curAlbum, albumName);
+
+ setTimeout(function() {
+ toggleAddAlbum();
+ }, 200);
+ } else {
+ alert("error!");
+ }
+ });
+ }
+ })
+ // delete album
+ $("#deleteAlbumBtn").click(function() {
+ var albumId = $("#albumsForUpload").val();
+ if(!albumId) {
+ alert("Cannot delete default album");
+ return;
+ }
+ $.get("/album/deleteAlbum", {albumId: albumId}, function(ret) {
+ if(typeof ret == "object" && ret.Ok == true) {
+ self.showMsg("Delete Sucess!");
+ // delete this album from select
+ $("#albumsForUpload option[value='" + albumId + "']").remove();
+
+ // if the albumsForList has select this album, it must refresh list after delete it;
+ if($("#albumsForList").val() == albumId) {
+ self.needRefresh = true;
+ }
+
+ $("#albumsForList option[value='" + albumId + "']").remove();
+
+ } else {
+ alert("This album has images, please delete it's images at first.");
+ }
+ });
+
+ });
+ },
+
+ renderAlbums: function() {
+ var self = this;
+ $.get("/album/getAlbums", function(ret) {
+ if(!ret) return;
+ var html = "";
+ for(var i in ret) {
+ var each = ret[i];
+ var option = '
' + each.Name+ ' ';
+ html += option;
+ }
+
+ $("#albumsForUpload").append(html);
+ $("#albumsForList").append(html);
+
+ var albumId = $("#albumsForList").val();
+ self.renderImages(albumId, 1, true);
+ });
+ },
+
+ imageMaskO: $("#imageMask"),
+ noImagesO: $("#noImages"),
+ loadingO: $("#loading"),
+
+ loadingStart: function() {
+ if(this.imageMaskO.is(":hidden")) {
+ this.imageMaskO.css("opacity", 0.8).show();
+ }
+ this.noImagesO.hide();
+ this.loadingO.show();
+ },
+ loadingEnd: function() {
+ this.imageMaskO.hide();
+ },
+
+ noImages: function () {
+ this.imageMaskO.show().css("opacity", 1);
+ this.noImagesO.show();
+ this.loadingO.hide();
+ },
+
+
+ search: function() {
+ var self = this;
+ var t1 = 1;
+ $("#key").on("keyup", function() {
+ var t2 = ++t1;
+ var key = $(this).val();
+ var albumId = $("#albumsForList").val();
+
+ self.renderImages(albumId, 1, true, key, function(){
+ return t1 == t2;
+ });
+ });
+ },
+
+ renderImages: function(albumId, page, needRenderPagination, key, needRender) {
+ var self = this;
+
+ if(!page) {
+ page = 1;
+ }
+ self.loadingStart();
+ $.get("/file/getImages", {albumId: albumId, page: page, key: key}, function(ret) {
+ if(!ret || !ret.Count) {
+ self.noImages();
+ return;
+ }
+ self.loadingEnd();
+ var datas = ret.List;
+ var selectedMap = {};
+
+ for(var i in self.selectedImages) {
+ var src = self.selectedImages[i]; // src include G.imageSrcPrefix
+ selectedMap[src] = true;
+ }
+ // log(self.selectedImages);
+
+ var html = "";
+ for(var i in datas){
+ var each = datas[i];
+ var classes = "";
+ var src = urlPrefix + each.Path;
+ // log(src);
+ if(selectedMap[src]) {
+ classes = 'class="selected"';
+ }
+ html += '
';
+ html += ' ';
+ // html += '';
+ html += '';
+ html += " ";
+ }
+
+ // var html = $("#tImage").render(datas);
+ $("#imageList").html(html);
+
+ if(needRenderPagination) {
+ self.pagination(ret.Count);
+ }
+
+ // $("#imageList img").lazyload({effect : "fadeIn"});
+ $("#imageList img").lazyload();
+ });
+ },
+
+ // 初始化已选择的图片区域
+ initSelectedZones: function() {
+ var self = this;
+ num = this.maxSelected;
+ self.previewO.html("");
+ for(var i = 1; i <= num; ++i) {
+ self.previewO.append("
" + i + " ");
+ }
+ },
+
+ reRenderSelectedImages: function(isRemove, addSrc) {
+ var self = this;
+
+ var lis = this.selectedZoneO.find("li");
+ var size = this.selectedImages.length-1;
+ for(var i = 0; i < this.maxSelected; ++i) {
+ var target = lis.eq(i);
+ if(i > size) {
+ target.html(i+1);
+ } else {
+ src = this.selectedImages[i];
+
+ var data = self.imageAttrs[src];
+ var attrs = "";
+ if(data) {
+ if(data.width) attrs += ' data-width="' + data.width + '"';
+ if(data.height) attrs += ' data-height="' + data.height + '"';
+ if(data.title) attrs += ' data-title="' + data.title + '"';
+ }
+
+ target.html('
');
+ }
+
+ // remove selected
+ if(isRemove) {
+ target.removeClass("selected");
+ } else {
+ // is add
+ // trigger click and set attrs
+ if(addSrc == src) {
+ target.click();
+ }
+ }
+ }
+ },
+ removeSelectedImage: function($li) {
+ var self = this;
+
+ var src = $li.find("img").attr('src');
+ for(var i in this.selectedImages) {
+ if(this.selectedImages[i] == src) {
+ this.selectedImages.splice(i, 1)
+ }
+ }
+ this.reRenderSelectedImages(true);
+
+ // clear attrs and disable it
+ self.clearAttrs();
+ },
+ addSelectedImage: function($li) {
+ if(this.maxSelected <= this.selectedImages.length) {
+ return false;
+ }
+
+ if(typeof $li == "object") {
+ var src = $li.find("img").attr('src');
+ } else {
+ src = $li;
+ }
+ this.selectedImages.push(src);
+ this.reRenderSelectedImages(false, src);
+
+ return true;
+ },
+ initDataFromTinymce: function() {
+ var self = this;
+ var datas = top.LEAUI_DATAS;
+ var lastSrc = "";
+ if(datas && datas.length > 0) {
+ for(var i in datas) {
+ var data = datas[i];
+ data.constrain = true;
+ lastSrc = data.src;
+ self.selectedImages.push(data.src);
+ self.imageAttrs[data.src] = data;
+ }
+
+ self.reRenderSelectedImages(false, lastSrc);
+ }
+ },
+
+ init: function() {
+ var self = this;
+
+ self.processAlbum();
+
+ $("#albumsForList").change(function() {
+ var albumId = $(this).val();
+ self.renderImages(albumId, 1, true);
+ });
+
+ $("#imageList").on("click", 'li', function() {
+ if($(this).hasClass("selected")) {
+ $(this).removeClass("selected");
+ self.removeSelectedImage($(this));
+ } else {
+ if(self.addSelectedImage($(this))){
+ $(this).addClass("selected");
+ }
+ }
+ });
+
+
+ // delete file
+ $("#imageList").on("click", '.del', function(e) {
+ var t = this;
+ e.stopPropagation();
+
+ if(confirm("Are you sure to delete this image ?")) {
+ var fileId = $(this).data('id');
+ $.get("/file/deleteImage", {fileId: fileId}, function(ret) {
+ if(ret) {
+ var $li = $(t).closest('li');
+ if($li.hasClass("selected")) {
+ self.removeSelectedImage($li);
+ }
+ $(t).closest('li').remove();
+ }
+ });
+ }
+ });
+ // edit file title
+ $("#imageList").on("click", '.file-title', function(e) {
+ var p = this;
+ var t = this;
+ e.stopPropagation();
+ if($(this).children().eq(0).is("input")){
+ return;
+ }
+ var fileId = $(p).parent().data('id');
+ var fileTitle = $(this).text();
+ $(this).html('
');
+
+ var $input = $(this).find("input");
+ $input.focus();
+ $input.keydown(function(e){
+ if(e.keyCode==13){
+ $(this).trigger("blur");
+ }
+ });
+ $input.blur(function() {
+ var title = $(this).val();
+ if(!title) {
+ title = fileTitle;
+ } else {
+ $.post("/file/updateImageTitle", {fileId: fileId, title: title});
+ }
+ $(p).html(title);
+ });
+ });
+
+ // remove preview
+ $("#preview").on("click", '.del', function(e) {
+ e.stopPropagation();
+ var $li = $(this).closest("li");
+ var src = $li.find("img").attr("src");
+ self.removeSelectedImage($li);
+
+ // 在当前的imagesList下看是否有
+ $("#imageList img").each(function() {
+ var src2 = $(this).attr('src');
+ if(src == src2) {
+ $(this).parent().parent().removeClass("selected");
+ }
+ });
+ });
+
+ //
+ $("#goAddImageBtn").click(function() {
+ $("#albumsForUpload").val($("#albumsForList").val());
+ $('#myTab li:eq(1) a').tab('show');
+ });
+
+ // toggle tab
+ // refresh
+ $('#myTab a').on('shown.bs.tab', function(e) {
+ e.preventDefault()
+ $(this).tab('show');
+ var href = $(this).attr("href");
+
+ if(self.needRefresh && href == "#images") {
+ setTimeout(function(){
+ var albumId = $("#albumsForList").val();
+ var key = $("#key").val();
+ self.renderImages(albumId, self.pageNum, true, key);
+ }, 200);
+ self.needRefresh = false;
+ }
+
+ if(href == "#url") {
+ $("#imageUrl").focus();
+ }
+ });
+ $("#refresh").click(function() {
+ var albumId = $("#albumsForList").val();
+ var key = $("#key").val();
+ self.renderImages(albumId, self.pageNum, false, key);
+ });
+
+ // add url
+ $("#addImageUrlBtn").click(function(e) {
+ e.preventDefault();
+ var url = $.trim($("#imageUrl").val());
+ if(!url) {
+ $("#imageUrl").focus();
+ return;
+ }
+
+ getImageSize(url, function(ret) {
+ if(!ret.width || !ret.height){
+ $("#msgForUrl").show();
+ return;
+ }
+ $("#msgForUrl").hide();
+ $("#imageUrl").val("");
+ self.addSelectedImage(url);
+ });
+ });
+
+ // 设置属性
+ $("#preview").on("click", 'li', function() {
+ if($(this).hasClass("selected")) {
+ // $(this).removeClass("selected");
+ } else {
+ if($(this).find("img").length){
+ $("#preview li").removeClass("selected");
+ $(this).addClass("selected");
+
+ self.initAttr($(this));
+ }
+ }
+ });
+
+ $("#attrTitle, #attrWidth, #attrHeight").on("keyup", function(){
+ self.modifyAttr($(this));
+ });
+ $("#attrConstrain").on("click", function(){
+ self.modifyAttr($(this));
+ });
+
+ // file search
+ self.search();
+
+ self.initSelectedZones();
+
+ self.initDataFromTinymce();
+
+ self.renderAlbums();
+ //...
+ self.initUploader();
+ },
+
+ // 设置
+ curSrc: "",
+ curLi: null,
+ attrTitleO: $("#attrTitle"),
+ attrWidthO: $("#attrWidth"),
+ attrHeightO: $("#attrHeight"),
+ attrConstrainO: $("#attrConstrain"),
+ // clear attrs and disable it
+ clearAttrs: function() {
+ var self = this;
+ self.attrTitleO.val("").attr("disabled", true);
+ self.attrHeightO.val("").attr("disabled", true);
+ self.attrWidthO.val("").attr("disabled", true);
+ self.attrConstrainO.prop("checked", false).attr("disabled", true);
+ },
+ scale: function(isWidth) {
+ var self = this;
+ var autoScale = self.attrConstrainO.is(":checked");
+ var width = +self.attrWidthO.val();
+ var height = +self.attrHeightO.val();
+ if(isNaN(width) || isNaN(height)) {
+ return;
+ }
+
+ var curAttrs = self.getCurAttrs();
+ var preWidth = curAttrs.preWidth || curAttrs.width;
+ var preHeight = curAttrs.preHeight || curAttrs.height;
+
+ if(autoScale && preWidth && preHeight) {
+ if(isWidth) {
+ height = parseInt((width/preWidth) * preHeight);
+ self.attrHeightO.val(height);
+ } else {
+ width = parseInt((height/preHeight) * preWidth);
+ self.attrWidthO.val(width);
+ }
+ }
+ var ret = {width: width, height: height};
+ return ret;
+ },
+ getCurAttrs: function() {
+ var self = this;
+ return self.imageAttrs[self.curSrc];
+ },
+ setCurDataAttrs: function(attrs) {
+ var self = this;
+ var img = self.curLi.find("img");
+ img.attr("data-width", attrs.width);
+ img.attr("data-height", attrs.height);
+ img.attr("data-title", attrs.title);
+
+ self.imageAttrs[self.curSrc] = attrs;
+ },
+ // 修改属性
+ modifyAttr: function($target){
+ var self = this;
+ var id = $target.attr("id");
+ var val = $target.val();
+ var curAttrs = self.getCurAttrs();
+ if(!curAttrs) {
+ return;
+ }
+ switch(id) {
+ case "attrConstrain":
+ val = 0;
+ if($target.is(":checked")) {
+ val = 1;
+ }
+ curAttrs['constrain'] = val;
+ break;
+ case "attrTitle":
+ curAttrs['title'] = val;
+ break;
+ case "attrWidth":
+ $.extend(curAttrs, self.scale(true));
+ break;
+ case "attrHeight":
+ $.extend(curAttrs, self.scale(false));
+ break;
+ }
+
+ self.setCurDataAttrs(curAttrs);
+ },
+ // when click preview li
+ initAttr: function($li) {
+ var self = this;
+ if(typeof $li != "object") {
+ $li = $("#preview").find('img[src="' + $li + '"]').parent();
+ };
+
+ var src = $li.find("img").attr("src");
+ self.curSrc = src;
+ self.curLi = $li;
+
+ var attrs = self.imageAttrs[src];
+ function setAttr(attrs) {
+ attrs = attrs || {};
+ self.attrTitleO.val(attrs.title).attr("disabled", false);
+ self.attrWidthO.val(attrs.width).attr("disabled", false);
+ self.attrHeightO.val(attrs.height).attr("disabled", false);
+ self.attrConstrainO.attr("disabled", false);
+
+ if(attrs.constrain) {
+ self.attrConstrainO.prop('checked', true);
+ } else {
+ self.attrConstrainO.prop('checked', false);
+ }
+
+ self.setCurDataAttrs(attrs);
+ }
+ attrs = attrs || {};
+ if(!attrs || !attrs.width || !attrs.height) {
+ getImageSize(src, function(ret) {
+ ret.title = attrs.title || "";
+ ret.constrain = 1;
+ ret.preWidth = ret.width;
+ ret.preHeight = ret.height;
+ if(src != self.curSrc) {
+ self.imageAttrs[src] = ret;
+ // in case user click fast
+ self.setCurDataAttrs(attrs);
+ return;
+ }
+ // set attrs
+ setAttr(ret);
+ return;
+ });
+ } else {
+ setAttr(attrs);
+ }
+ },
+
+ needRefresh: false,
+
+ uploadRefreshImageList: function() {
+ var self = this;
+ // check albumId
+ var albumId = $("#albumsForList").val();
+ if(albumId == $("#albumsForUpload").val()){
+ self.needRefresh = true;
+ }
+ },
+
+ initUploader: function() {
+ var self = this;
+ var ul = $('#upload ul');
+
+ $('#drop a').click(function() {
+ // trigger to show file select
+ $(this).parent().find('input').click();
+ });
+
+ // Initialize the jQuery File Upload plugin
+ $('#upload').fileupload({
+ dataType: 'json',
+ acceptFileTypes: /(\.|\/)(gif|jpg|jpeg|png|jpe)$/i,
+ maxFileSize: 210000,
+
+ // This element will accept file drag/drop uploading
+ dropZone: $('#drop'),
+ formData: function(form) {
+ return [{name: 'albumId', value: $("#albumsForUpload").val()}]
+ },
+ /*
+ urlFunc: function() {
+ return 'server/index.php?action=file:uploadImage&album_id=' + $("#albumsForUpload").val();
+ },
+ */
+
+ // This function is called when a file is added to the queue;
+ // either via the browse button, or via drag/drop:
+ add: function(e, data) {
+
+ var tpl = $('
');
+
+ // Append the file name and file size
+ tpl.find('div').append(data.files[0].name + '
[' + formatFileSize(data.files[0].size) + ' ] ');
+
+ // Add the HTML to the UL element
+ data.context = tpl.appendTo(ul);
+
+ // data.form[0].action += "&album_id=" + $("#albumsForUpload").val();
+
+ // Automatically upload the file once it is added to the queue
+ var jqXHR = data.submit();
+ },
+
+ done: function(e, data) {
+ if (data.result.Ok == true) {
+ data.context.remove();
+
+ // add image to preview
+ self.addSelectedImage(data.result.Id);
+ // reresh image list
+ self.uploadRefreshImageList();
+ } else {
+ data.context.empty();
+ var tpl = $('
');
+ tpl.find('div').append('
Error: ' + data.files[0].name + '
[' + formatFileSize(data.files[0].size) + ' ] ' + data.result.Msg);
+ data.context.append(tpl);
+ }
+ $("#upload-msg").scrollTop(1000);
+ },
+ fail: function(e, data) {
+ data.context.empty();
+ var tpl = $('
');
+ tpl.find('div').append('
Error: ' + data.files[0].name + '
[' + formatFileSize(data.files[0].size) + ' ] ' + data.errorThrown);
+ data.context.append(tpl);
+
+ $("#upload-msg").scrollTop(1000);
+ }
+ });
+
+ // Prevent the default action when a file is dropped on the window
+ $(document).on('drop dragover', function(e) {
+ e.preventDefault();
+ });
+
+ // Helper function that formats the file sizes
+ function formatFileSize(bytes) {
+ if (typeof bytes !== 'number') {
+ return '';
+ }
+ if (bytes >= 1000000000) {
+ return (bytes / 1000000000).toFixed(2) + ' GB';
+ }
+ if (bytes >= 1000000) {
+ return (bytes / 1000000).toFixed(2) + ' MB';
+ }
+ return (bytes / 1000).toFixed(2) + ' KB';
+ }
+
+ // drag css
+ $(document).bind('dragover', function (e) {
+ var dropZone = $('#drop'),
+ timeout = window.dropZoneTimeout;
+ if (!timeout) {
+ dropZone.addClass('in');
+ } else {
+ clearTimeout(timeout);
+ }
+ var found = false,
+ node = e.target;
+ do {
+ if (node === dropZone[0]) {
+ found = true;
+ break;
+ }
+ node = node.parentNode;
+ } while (node != null);
+ if (found) {
+ dropZone.addClass('hover');
+ } else {
+ dropZone.removeClass('hover');
+ }
+ window.dropZoneTimeout = setTimeout(function () {
+ window.dropZoneTimeout = null;
+ dropZone.removeClass('in hover');
+ }, 100);
+ });
+ }
+}
+
+$(function() {
+ o.init();
+});
diff --git a/public/tinymce/plugins/leaui_image/public/js/main.min.js b/public/tinymce/plugins/leaui_image/public/js/main.min.js
new file mode 100644
index 0000000..4fe6431
--- /dev/null
+++ b/public/tinymce/plugins/leaui_image/public/js/main.min.js
@@ -0,0 +1 @@
+function log(e){console.log(e)}function retIsOk(e){return e&&"object"==typeof e&&1==e.status?!0:!1}function getImageSize(e,t){function a(e,a){i.parentNode.removeChild(i),t({width:e,height:a})}var i=document.createElement("img");i.onload=function(){a(i.clientWidth,i.clientHeight)},i.onerror=function(){a()},i.src=e;var s=i.style;s.visibility="hidden",s.position="fixed",s.bottom=s.left=0,s.width=s.height="auto",document.body.appendChild(i)}var o={maxSelected:G.maxSelected,selectedZoneO:$("#preview"),previewO:$("#preview"),selectedImages:[],imageAttrs:{},pageNum:1,pagination:function(e){var t=this;$(".pagination").pagination(e,{items_per_page:G.perPageItems,callback:function(e){t.pageNum=e+1,t.renderImages($("#albumsForList").val(),t.pageNum,!1)}})},showMsg:function(e){$("#msg").html(e).css("display","inline"),setTimeout(function(){$("#msg").fadeOut()},2e3)},pageAddAlbum:function(e){var t='
'+e.album_name+" ";$("#albumsForUpload").append(t).val(e.id),$("#albumsForList").append(t)},renderAlbums:function(){var e=this;$.get("server/index.php?action=album:getAlbums",function(t){if(t){var a="";for(var i in t){var s=t[i],r='
'+s.album_name+" ";a+=r}$("#albumsForUpload").html(a),$("#albumsForList").html(a);var l=$("#albumsForList").val();e.renderImages(l,1,!0)}})},imageMaskO:$("#imageMask"),noImagesO:$("#noImages"),loadingO:$("#loading"),loadingStart:function(){this.imageMaskO.is(":hidden")&&this.imageMaskO.css("opacity",.8).show(),this.noImagesO.hide(),this.loadingO.show()},loadingEnd:function(){this.imageMaskO.hide()},noImages:function(){this.imageMaskO.show().css("opacity",1),this.noImagesO.show(),this.loadingO.hide()},renderImages:function(e,t,a){var i=this;t||(t=1),i.loadingStart(),$.get("server/index.php?action=file:getImages",{album_id:e,page:t},function(e){if(!e||!e.count)return void i.noImages();i.loadingEnd();var t=e.datas,s={};for(var r in i.selectedImages){var l=i.selectedImages[r];s[l]=!0}var n="";for(var r in t){var o=t[r],d="",l=G.imageSrcPrefix+"/"+o.file_path;s[l]&&(d='class="selected"'),n+="
",n+=' ',n+='',n+=" "}$("#imageList").html(n),a&&i.pagination(e.count),$("#imageList img").lazyload()})},initSelectedZones:function(){var e=this;num=this.maxSelected,e.previewO.html("");for(var t=1;num>=t;++t)e.previewO.append("
"+t+" ")},reRenderSelectedImages:function(e,t){for(var a=this,i=this.selectedZoneO.find("li"),s=this.selectedImages.length-1,r=0;r
s)l.html(r+1);else{src=this.selectedImages[r];var n=a.imageAttrs[src],o="";n&&(n.width&&(o+=' data-width="'+n.width+'"'),n.height&&(o+=' data-height="'+n.height+'"'),n.title&&(o+=' data-title="'+n.title+'"')),l.html(" ')}e?l.removeClass("selected"):t==src&&l.click()}},removeSelectedImage:function(e){var t=this,a=e.find("img").attr("src");for(var i in this.selectedImages)this.selectedImages[i]==a&&this.selectedImages.splice(i,1);this.reRenderSelectedImages(!0),t.clearAttrs()},addSelectedImage:function(e){if(this.maxSelected<=this.selectedImages.length)return!1;if("object"==typeof e)var t=e.find("img").attr("src");else t=e;return this.selectedImages.push(t),this.reRenderSelectedImages(!1,t),!0},initDataFromTinymce:function(){var e=this,t=top.LEAUI_DATAS,a="";if(t&&t.length>0){for(var i in t){var s=t[i];a=s.src,e.selectedImages.push(s.src),e.imageAttrs[s.src]=s}e.reRenderSelectedImages(!1,a)}},init:function(){var e=this;$("#addAlbumBtn").click(function(){var t=$("#albumName").val();return t?void $.get("server/index.php?action=album:addAlbum",{album_name:t},function(a){retIsOk(a)&&($("#albumName").val(""),e.showMsg("Add Sucess!"),a.album_name=t,e.pageAddAlbum(a))}):void $("#albumName").focus()}),$("#deleteAlbumBtn").click(function(){var t=$("#albumsForUpload").val();$.get("server/index.php?action=album:deleteAlbum",{album_id:t},function(a){1==a?(e.showMsg("Delete Sucess!"),$("#albumsForUpload option[value='"+t+"']").remove(),$("#albumsForList").val()==t&&(e.needRefresh=!0),$("#albumsForList option[value='"+t+"']").remove()):alert("This album has images, please delete it's images at first.")})}),$("#albumsForList").change(function(){var t=$(this).val();e.renderImages(t,1,!0)}),$("#imageList").on("click","li",function(){$(this).hasClass("selected")?($(this).removeClass("selected"),e.removeSelectedImage($(this))):e.addSelectedImage($(this))&&$(this).addClass("selected")}),$("#imageList").on("click",".del",function(t){var a=this;if(t.stopPropagation(),confirm("Are you sure to delete this image ?")){var i=$(this).data("id");$.get("server/index.php?action=file:deleteImage",{file_id:i},function(t){if(t){var i=$(a).closest("li");i.hasClass("selected")&&e.removeSelectedImage(i),$(a).closest("li").remove()}})}}),$("#preview").on("click",".del",function(t){t.stopPropagation();var a=$(this).closest("li"),i=a.find("img").attr("src");e.removeSelectedImage(a),$("#imageList img").each(function(){var e=$(this).attr("src");i==e&&$(this).parent().parent().removeClass("selected")})}),$("#goAddImageBtn").click(function(){$("#albumsForUpload").val($("#albumsForList").val()),$("#myTab li:eq(1) a").tab("show")}),$("#myTab a").click(function(t){t.preventDefault(),$(this).tab("show"),e.needRefresh&&"#images"==$(this).attr("href")&&(setTimeout(function(){var t=$("#albumsForList").val();e.renderImages(t,e.pageNum,!0)},200),e.needRefresh=!1)}),$("#refresh").click(function(){var t=$("#albumsForList").val();e.renderImages(t,e.pageNum,!1)}),$("#addImageUrlBtn").click(function(t){t.preventDefault();var a=$.trim($("#imageUrl").val());return a?void getImageSize(a,function(t){return t.width&&t.height?($("#msgForUrl").hide(),$("#imageUrl").val(""),void e.addSelectedImage(a)):void $("#msgForUrl").show()}):void $("#imageUrl").focus()}),$("#preview").on("click","li",function(){$(this).hasClass("selected")||$(this).find("img").length&&($("#preview li").removeClass("selected"),$(this).addClass("selected"),e.initAttr($(this)))}),$("#attrTitle, #attrWidth, #attrHeight").on("blur",function(){e.modifyAttr($(this))}),$("#attrConstrain").on("click",function(){e.modifyAttr($(this))}),e.initSelectedZones(),e.initDataFromTinymce(),e.renderAlbums(),e.initUploader()},curSrc:"",curLi:null,attrTitleO:$("#attrTitle"),attrWidthO:$("#attrWidth"),attrHeightO:$("#attrHeight"),attrConstrainO:$("#attrConstrain"),clearAttrs:function(){var e=this;e.attrTitleO.val("").attr("disabled",!0),e.attrHeightO.val("").attr("disabled",!0),e.attrWidthO.val("").attr("disabled",!0),e.attrConstrainO.prop("checked",!1).attr("disabled",!0)},scale:function(e){var t=this,a=t.attrConstrainO.is(":checked"),i=+t.attrWidthO.val(),s=+t.attrHeightO.val();if(!isNaN(i)&&!isNaN(s)){var r=t.getCurAttrs(),l=r.preWidth||r.width,n=r.preHeight||r.height;a&&l&&n&&(e?(s=parseInt(i/l*n),t.attrHeightO.val(s)):(i=parseInt(s/n*l),t.attrWidthO.val(i)));var o={width:i,height:s};return o}},getCurAttrs:function(){var e=this;return e.imageAttrs[e.curSrc]},setCurDataAttrs:function(e){var t=this,a=t.curLi.find("img");a.attr("data-width",e.width),a.attr("data-height",e.height),a.attr("data-title",e.title),t.imageAttrs[t.curSrc]=e},modifyAttr:function(e){var t=this,a=e.attr("id"),i=e.val(),s=t.getCurAttrs();if(s){switch(a){case"attrConstrain":i=0,e.is(":checked")&&(i=1),s.constrain=i;break;case"attrTitle":s.title=i;break;case"attrWidth":$.extend(s,t.scale(!0));break;case"attrHeight":$.extend(s,t.scale(!1))}t.setCurDataAttrs(s)}},initAttr:function(e){function t(e){e=e||{},a.attrTitleO.val(e.title).attr("disabled",!1),a.attrWidthO.val(e.width).attr("disabled",!1),a.attrHeightO.val(e.height).attr("disabled",!1),a.attrConstrainO.attr("disabled",!1),e.constrain?a.attrConstrainO.prop("checked",!0):a.attrConstrainO.prop("checked",!1),a.setCurDataAttrs(e)}var a=this;"object"!=typeof e&&(e=$("#preview").find('img[src="'+e+'"]').parent());var i=e.find("img").attr("src");a.curSrc=i,a.curLi=e;var s=a.imageAttrs[i];s=s||{},s&&s.width&&s.height?t(s):getImageSize(i,function(e){return e.title=s.title||"",e.constrain=1,e.preWidth=e.width,e.preHeight=e.height,i!=a.curSrc?(a.imageAttrs[i]=e,void a.setCurDataAttrs(s)):void t(e)})},needRefresh:!1,uploadRefreshImageList:function(){var e=this,t=$("#albumsForList").val();t==$("#albumsForUpload").val()&&(e.needRefresh=!0)},initUploader:function(){function e(e){return"number"!=typeof e?"":e>=1e9?(e/1e9).toFixed(2)+" GB":e>=1e6?(e/1e6).toFixed(2)+" MB":(e/1e3).toFixed(2)+" KB"}var t=this,a=$("#upload ul");$("#drop a").click(function(){$(this).parent().find("input").click()}),$("#upload").fileupload({dataType:"json",acceptFileTypes:/(\.|\/)(gif|jpg|jpeg|png|jpe)$/i,maxFileSize:21e4,dropZone:$("#drop"),formData:function(e){return[{name:"album_id",value:$("#albumsForUpload").val()}]},add:function(t,i){var s=$(' ');s.find("div").append(i.files[0].name+" ["+e(i.files[0].size)+" ] "),i.context=s.appendTo(a);var r=i.submit()},done:function(a,i){if(1==i.result.status)i.context.remove(),t.addSelectedImage(G.imageSrcPrefix+"/"+i.result.file_path),t.uploadRefreshImageList();else{i.context.empty();var s=$(' ');s.find("div").append("Error: "+i.files[0].name+" ["+e(i.files[0].size)+" ] "+i.result.msg),i.context.append(s)}$("#upload-msg").scrollTop(1e3)},fail:function(t,a){a.context.empty();var i=$(' ');i.find("div").append("Error: "+a.files[0].name+" ["+e(a.files[0].size)+" ] "+a.errorThrown),a.context.append(i),$("#upload-msg").scrollTop(1e3)}}),$(document).on("drop dragover",function(e){e.preventDefault()})}};$(function(){o.init()});
\ No newline at end of file