").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("
").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery);(function(t,e){var i="ui-effects-";t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=h(),n=s._rgba=[];return i=i.toLowerCase(),f(l,function(t,a){var o,r=a.re.exec(i),l=r&&a.parse(r),h=a.space||"rgba";return l?(o=s[h](l),s[c[h].cache]=o[c[h].cache],n=s._rgba=o._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,a.transparent),s):a[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,l=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],h=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=h.support={},p=t("
")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),h.fn=t.extend(h.prototype,{parse:function(n,o,r,l){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(o),o=e);var u=this,d=t.type(n),p=this._rgba=[];return o!==e&&(n=[n,o,r,l],d="array"),"string"===d?this.parse(s(n)||a._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof h?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var a=s.cache;f(s.props,function(t,e){if(!u[a]&&s.to){if("alpha"===t||null==n[t])return;u[a]=s.to(u._rgba)}u[a][e.idx]=i(n[t],e,!0)}),u[a]&&0>t.inArray(null,u[a].slice(0,3))&&(u[a][3]=1,s.from&&(u._rgba=s.from(u[a])))}),this):e},is:function(t){var i=h(t),s=!0,n=this;return f(c,function(t,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=h(t),n=s._space(),a=c[n],o=0===this.alpha()?h("transparent"):this,r=o[a.cache]||a.to(o._rgba),l=r.slice();return s=s[a.cache],f(a.props,function(t,n){var a=n.idx,o=r[a],h=s[a],c=u[n.type]||{};null!==h&&(null===o?l[a]=h:(c.mod&&(h-o>c.mod/2?o+=c.mod:o-h>c.mod/2&&(o-=c.mod)),l[a]=i((h-o)*e+o,n)))}),this[n](l)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=h(e)._rgba;return h(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),h.fn.parse.prototype=h.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,a=t[2]/255,o=t[3],r=Math.max(s,n,a),l=Math.min(s,n,a),h=r-l,c=r+l,u=.5*c;return e=l===r?0:s===r?60*(n-a)/h+360:n===r?60*(a-s)/h+120:60*(s-n)/h+240,i=0===h?0:.5>=u?h/c:h/(2-c),[Math.round(e)%360,i,u,null==o?1:o]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],a=t[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,e+1/3)),Math.round(255*n(r,o,e)),Math.round(255*n(r,o,e-1/3)),a]},f(c,function(s,n){var a=n.props,o=n.cache,l=n.to,c=n.from;h.fn[s]=function(s){if(l&&!this[o]&&(this[o]=l(this._rgba)),s===e)return this[o].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[o].slice();return f(a,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=h(c(d)),n[o]=d,n):h(d)},f(a,function(e,i){h.fn[e]||(h.fn[e]=function(n){var a,o=t.type(n),l="alpha"===e?this._hsla?"hsla":"rgba":s,h=this[l](),c=h[i.idx];return"undefined"===o?c:("function"===o&&(n=n.call(this,c),o=t.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=c+parseFloat(a[2])*("+"===a[1]?1:-1))),h[i.idx]=n,this[l](h)))})})}),h.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var a,o,r="";if("transparent"!==n&&("string"!==t.type(n)||(a=s(n)))){if(n=h(a||n),!d.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&o&&o.style;)try{r=t.css(o,"backgroundColor"),o=o.parentNode}catch(l){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(l){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=h(e.elem,i),e.end=h(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},h.hook(o),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},a=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function s(e,i){var s,n,o={};for(s in i)n=i[s],e[s]!==n&&(a[s]||(t.fx.step[s]||!isNaN(parseFloat(n)))&&(o[s]=n));return o}var n=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(jQuery.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(e,a,o,r){var l=t.speed(a,o,r);return this.queue(function(){var a,o=t(this),r=o.attr("class")||"",h=l.children?o.find("*").addBack():o;h=h.map(function(){var e=t(this);return{el:e,start:i(this)}}),a=function(){t.each(n,function(t,i){e[i]&&o[i+"Class"](e[i])})},a(),h=h.map(function(){return this.end=i(this.el[0]),this.diff=s(this.start,this.end),this}),o.attr("class",r),h=h.map(function(){var e=this,i=t.Deferred(),s=t.extend({},l,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,h.get()).done(function(){a(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),l.complete.call(o[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,a){return s?t.effects.animateClass.call(this,{add:i},s,n,a):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,a){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,a):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(i){return function(s,n,a,o,r){return"boolean"==typeof n||n===e?a?t.effects.animateClass.call(this,n?{add:s}:{remove:s},a,o,r):i.apply(this,arguments):t.effects.animateClass.call(this,{toggle:s},n,a,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,a){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,a)}})}(),function(){function s(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function n(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.10.4",save:function(t,e){for(var s=0;e.length>s;s++)null!==e[s]&&t.data(i+e[s],t[0].style[e[s]])},restore:function(t,s){var n,a;for(a=0;s.length>a;a++)null!==s[a]&&(n=t.data(i+s[a]),n===e&&(n=""),t.css(s[a],n))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return e.wrap(s),(e[0]===a||t.contains(e[0],a))&&t(a).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var a=e.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),t.fn.extend({effect:function(){function e(e){function s(){t.isFunction(a)&&a.call(n[0]),t.isFunction(e)&&e()}var n=t(this),a=i.complete,r=i.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),s()):o.call(n[0],i,s)}var i=s.apply(this,arguments),n=i.mode,a=i.queue,o=t.effects.effect[i.effect];return t.fx.off||!o?n?this[n](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):a===!1?this.each(e):this.queue(a||"fx",e)},show:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(t.fn.show),hide:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(t.fn.hide),toggle:function(t){return function(e){if(n(e)||"boolean"==typeof e)return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}()})(jQuery);(function(t){var e=/up|down|vertical/,i=/up|left|vertical|horizontal/;t.effects.effect.blind=function(s,n){var a,o,r,l=t(this),h=["position","top","bottom","left","right","height","width"],c=t.effects.setMode(l,s.mode||"hide"),u=s.direction||"up",d=e.test(u),p=d?"height":"width",f=d?"top":"left",g=i.test(u),m={},v="show"===c;l.parent().is(".ui-effects-wrapper")?t.effects.save(l.parent(),h):t.effects.save(l,h),l.show(),a=t.effects.createWrapper(l).css({overflow:"hidden"}),o=a[p](),r=parseFloat(a.css(f))||0,m[p]=v?o:0,g||(l.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),m[f]=v?r:o+r),v&&(a.css(p,0),g||a.css(f,r+o)),a.animate(m,{duration:s.duration,easing:s.easing,queue:!1,complete:function(){"hide"===c&&l.hide(),t.effects.restore(l,h),t.effects.removeWrapper(l),n()}})}})(jQuery);(function(t){t.effects.effect.bounce=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","height","width"],l=t.effects.setMode(o,e.mode||"effect"),h="hide"===l,c="show"===l,u=e.direction||"up",d=e.distance,p=e.times||5,f=2*p+(c||h?1:0),g=e.duration/f,m=e.easing,v="up"===u||"down"===u?"top":"left",_="up"===u||"left"===u,b=o.queue(),y=b.length;for((c||h)&&r.push("opacity"),t.effects.save(o,r),o.show(),t.effects.createWrapper(o),d||(d=o["top"===v?"outerHeight":"outerWidth"]()/3),c&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,_?2*-d:2*d).animate(a,g,m)),h&&(d/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(_?"-=":"+=")+d,o.animate(n,g,m).animate(a,g,m),d=h?2*d:d/2;h&&(n={opacity:0},n[v]=(_?"-=":"+=")+d,o.animate(n,g,m)),o.queue(function(){h&&o.hide(),t.effects.restore(o,r),t.effects.removeWrapper(o),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),o.dequeue()}})(jQuery);(function(t){t.effects.effect.clip=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","height","width"],l=t.effects.setMode(o,e.mode||"hide"),h="show"===l,c=e.direction||"vertical",u="vertical"===c,d=u?"height":"width",p=u?"top":"left",f={};t.effects.save(o,r),o.show(),s=t.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[d](),h&&(n.css(d,0),n.css(p,a/2)),f[d]=h?a:0,f[p]=h?0:a/2,n.animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){h||o.hide(),t.effects.restore(o,r),t.effects.removeWrapper(o),i()}})}})(jQuery);(function(t){t.effects.effect.drop=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","opacity","height","width"],o=t.effects.setMode(n,e.mode||"hide"),r="show"===o,l=e.direction||"left",h="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l?"pos":"neg",u={opacity:r?1:0};t.effects.save(n,a),n.show(),t.effects.createWrapper(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(h,"pos"===c?-s:s),u[h]=(r?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}})}})(jQuery);(function(t){t.effects.effect.explode=function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),g||p.hide(),i()}var a,o,r,l,h,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=t.effects.setMode(p,e.mode||"hide"),g="show"===f,m=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/d),_=Math.ceil(p.outerHeight()/u),b=[];for(a=0;u>a;a++)for(l=m.top+a*_,c=a-(u-1)/2,o=0;d>o;o++)r=m.left+o*v,h=o-(d-1)/2,p.clone().appendTo("body").wrap("
").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*_}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:_,left:r+(g?h*v:0),top:l+(g?c*_:0),opacity:g?0:1}).animate({left:r+(g?0:h*v),top:l+(g?0:c*_),opacity:g?1:0},e.duration||500,e.easing,s)}})(jQuery);(function(t){t.effects.effect.fade=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}})(jQuery);(function(t){t.effects.effect.fold=function(e,i){var s,n,a=t(this),o=["position","top","bottom","left","right","height","width"],r=t.effects.setMode(a,e.mode||"hide"),l="show"===r,h="hide"===r,c=e.size||15,u=/([0-9]+)%/.exec(c),d=!!e.horizFirst,p=l!==d,f=p?["width","height"]:["height","width"],g=e.duration/2,m={},v={};t.effects.save(a,o),a.show(),s=t.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],u&&(c=parseInt(u[1],10)/100*n[h?0:1]),l&&s.css(d?{height:0,width:c}:{height:c,width:0}),m[f[0]]=l?n[0]:c,v[f[1]]=l?n[1]:0,s.animate(m,g,e.easing).animate(v,g,e.easing,function(){h&&a.hide(),t.effects.restore(a,o),t.effects.removeWrapper(a),i()})}})(jQuery);(function(t){t.effects.effect.highlight=function(e,i){var s=t(this),n=["backgroundImage","backgroundColor","opacity"],a=t.effects.setMode(s,e.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),t.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(o,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&s.hide(),t.effects.restore(s,n),i()}})}})(jQuery);(function(t){t.effects.effect.pulsate=function(e,i){var s,n=t(this),a=t.effects.setMode(n,e.mode||"show"),o="show"===a,r="hide"===a,l=o||"hide"===a,h=2*(e.times||5)+(l?1:0),c=e.duration/h,u=0,d=n.queue(),p=d.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),u=1),s=1;h>s;s++)n.animate({opacity:u},c,e.easing),u=1-u;n.animate({opacity:u},c,e.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,h+1))),n.dequeue()}})(jQuery);(function(t){t.effects.effect.puff=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"hide"),a="hide"===n,o=parseInt(e.percent,10)||150,r=o/100,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};t.extend(e,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?l:{height:l.height*r,width:l.width*r,outerHeight:l.outerHeight*r,outerWidth:l.outerWidth*r}}),s.effect(e)},t.effects.effect.scale=function(e,i){var s=t(this),n=t.extend(!0,{},e),a=t.effects.setMode(s,e.mode||"effect"),o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"hide"===a?0:100),r=e.direction||"both",l=e.origin,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},c={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=l||["middle","center"],n.restore=!0),n.from=e.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:h),n.to={height:h.height*c.y,width:h.width*c.x,outerHeight:h.outerHeight*c.y,outerWidth:h.outerWidth*c.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},t.effects.effect.size=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],l=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],c=["fontSize"],u=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=t.effects.setMode(o,e.mode||"effect"),f=e.restore||"effect"!==p,g=e.scale||"both",m=e.origin||["middle","center"],v=o.css("position"),_=f?r:l,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===e.mode&&"show"===p?(o.from=e.to||b,o.to=e.from||s):(o.from=e.from||("show"===p?b:s),o.to=e.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===g||"both"===g)&&(a.from.y!==a.to.y&&(_=_.concat(u),o.from=t.effects.setTransition(o,u,a.from.y,o.from),o.to=t.effects.setTransition(o,u,a.to.y,o.to)),a.from.x!==a.to.x&&(_=_.concat(d),o.from=t.effects.setTransition(o,d,a.from.x,o.from),o.to=t.effects.setTransition(o,d,a.to.x,o.to))),("content"===g||"both"===g)&&a.from.y!==a.to.y&&(_=_.concat(c).concat(h),o.from=t.effects.setTransition(o,c,a.from.y,o.from),o.to=t.effects.setTransition(o,c,a.to.y,o.to)),t.effects.save(o,_),o.show(),t.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),m&&(n=t.effects.getBaseline(m,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===g||"both"===g)&&(u=u.concat(["marginTop","marginBottom"]).concat(c),d=d.concat(["marginLeft","marginRight"]),h=r.concat(u).concat(d),o.find("*[width]").each(function(){var i=t(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&t.effects.save(i,h),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=t.effects.setTransition(i,u,a.from.y,i.from),i.to=t.effects.setTransition(i,u,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=t.effects.setTransition(i,d,a.from.x,i.from),i.to=t.effects.setTransition(i,d,a.to.x,i.to)),i.css(i.from),i.animate(i.to,e.duration,e.easing,function(){f&&t.effects.restore(i,h)})})),o.animate(o.to,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),t.effects.restore(o,_),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):t.each(["top","left"],function(t,e){o.css(e,function(e,i){var s=parseInt(i,10),n=t?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),t.effects.removeWrapper(o),i()}})}})(jQuery);(function(t){t.effects.effect.shake=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","height","width"],o=t.effects.setMode(n,e.mode||"effect"),r=e.direction||"left",l=e.distance||20,h=e.times||3,c=2*h+1,u=Math.round(e.duration/c),d="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},g={},m={},v=n.queue(),_=v.length;for(t.effects.save(n,a),n.show(),t.effects.createWrapper(n),f[d]=(p?"-=":"+=")+l,g[d]=(p?"+=":"-=")+2*l,m[d]=(p?"-=":"+=")+2*l,n.animate(f,u,e.easing),s=1;h>s;s++)n.animate(g,u,e.easing).animate(m,u,e.easing);n.animate(g,u,e.easing).animate(f,u/2,e.easing).queue(function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}),_>1&&v.splice.apply(v,[1,0].concat(v.splice(_,c+1))),n.dequeue()}})(jQuery);(function(t){t.effects.effect.slide=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","width","height"],o=t.effects.setMode(n,e.mode||"show"),r="show"===o,l=e.direction||"left",h="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l,u={};t.effects.save(n,a),n.show(),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0),t.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(h,c?isNaN(s)?"-"+s:-s:s),u[h]=(r?c?"+=":"-=":c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}})}})(jQuery);(function(t){t.effects.effect.transfer=function(e,i){var s=t(this),n=t(e.to),a="fixed"===n.css("position"),o=t("body"),r=a?o.scrollTop():0,l=a?o.scrollLeft():0,h=n.offset(),c={top:h.top-r,left:h.left-l,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("
").appendTo(document.body).addClass(e.className).css({top:u.top-r,left:u.left-l,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),i()})}})(jQuery);
\ No newline at end of file
diff --git a/js/006.jquery.transForm.js b/js/006.jquery.transForm.js
new file mode 100644
index 0000000..d05794f
--- /dev/null
+++ b/js/006.jquery.transForm.js
@@ -0,0 +1,924 @@
+/*
+ * jQuery TransForm plugin v1.0
+ * http://jquery.sunhater.com/transForm
+ * 2014-08-01
+ *
+ * Copyright (c) 2014 Pavel Tzonkov
+ * Dual licensed under the MIT and GPL licenses.
+ */
+
+(function($) {
+
+ var scrollbarWidth;
+
+ $.fn.transForm = function(options) {
+
+ // Get scrollbar width
+ if (!scrollbarWidth) {
+ var div = $('
').css({
+ display: 'block',
+ visibility: 'visible',
+ position: 'absolute',
+ overflow: 'auto',
+ width: 100,
+ height: 100,
+ top: -1000,
+ left: -1000
+ }).prependTo('body').append('
').find('div').css({
+ display: 'block',
+ visibility: 'visible',
+ width: '100%',
+ height: 200
+ });
+ scrollbarWidth = 100 - div.width();
+ div.parent().remove();
+ }
+
+ var tags = "|form|fieldset|input|select|textarea|button|label|",
+ fields = "|text|password|color|datetime|datetime-local|email|month|number|range|search|tel|time|url|week|",
+ buttons = "|button|submit|reset|",
+ o = {
+ cssPrefix: "tf-",
+ file: {
+ noFile: "No file chosen",
+ browse: "Browse",
+ count: "{count} files"
+ },
+ textarea: {
+ autoExpand: false,
+ maxLength: 0
+ }
+ },
+
+ outerSpace = function(selector, type, mbp) {
+ var r = 0, x;
+
+ if (!mbp) mbp = "mbp";
+
+ if (/m/i.test(mbp)) {
+ x = parseInt($(selector).css('margin-' + type));
+ if (x) r += x;
+ }
+
+ if (/b/i.test(mbp)) {
+ x = parseInt($(selector).css('border-' + type + '-width'));
+ if (x) r += x;
+ }
+
+ if (/p/i.test(mbp)) {
+ x = parseInt($(selector).css('padding-' + type));
+ if (x) r += x;
+ }
+
+ return r;
+ },
+
+ outerLeftSpace = function(selector, mbp) {
+ return outerSpace(selector, 'left', mbp);
+ },
+
+ outerTopSpace = function(selector, mbp) {
+ return outerSpace(selector, 'top', mbp);
+ },
+
+ outerRightSpace = function(selector, mbp) {
+ return outerSpace(selector, 'right', mbp);
+ },
+
+ outerBottomSpace = function(selector, mbp) {
+ return outerSpace(selector, 'bottom', mbp);
+ },
+
+ outerHSpace = function(selector, mbp) {
+ return (outerLeftSpace(selector, mbp) + outerRightSpace(selector, mbp));
+ },
+
+ outerVSpace = function(selector, mbp) {
+ return (outerTopSpace(selector, mbp) + outerBottomSpace(selector, mbp));
+ },
+
+ disablePageScroll = function(selector) {
+ var evts = 'mousewheel.tf DOMMouseScroll.tf';
+ $(selector).unbind(evts).bind(evts, function(e) {
+ var e0 = e.originalEvent,
+ delta = e0.wheelDelta || -e0.detail;
+ this.scrollTop += ((delta < 0) ? 1 : -1) * 30;
+ e.preventDefault();
+ });
+ },
+
+ disableSelect = function(selector) {
+ $(selector).each(function() {
+ var evts = 'selectstart.tf';
+ $(this).css('MozUserSelect', "none");
+ $(this).unbind(evts).bind(evts, function() {
+ return false;
+ });
+ });
+ };
+
+ $.extend(true, o, options);
+
+ $(this).each(function() {
+
+ var t = this,
+ tagName = $(t).prop("tagName").toLowerCase();
+
+ // Skip non-form tags
+ if (tags.indexOf("|" + tagName + "|") == -1)
+ return;
+
+ var destroy = (options === false),
+ transForm = $(t).data('transForm'),
+ construct = (!destroy && !transForm),
+ destruct = (destroy && transForm),
+ prefix = transForm ? transForm.prefix : o.cssPrefix,
+ type = $(t).attr('type'),
+ type = type ? type : "text",
+ el, store = {},
+
+ toggleClass = function(el, cssClass) {
+ if (construct)
+ $(el).addClass(cssClass);
+ else if (destruct)
+ $(el).removeClass(cssClass);
+ },
+
+ cls = function(pClass) {
+ return prefix + pClass;
+ },
+
+ sel = function(pClass) {
+ return '.' + cls(pClass);
+ },
+
+ data = { // target parameter may be removed in the future
+ set: function(object, target) {
+ if (typeof target == 'undefined')
+ target = t;
+ var d = $(target).data('transForm');
+ if (!d) d = {};
+ $.extend(true, d, object);
+ $(target).data('transForm', d);
+ },
+ get: function(key, target) {
+ if (typeof target == 'undefined')
+ target = t;
+ var d = $(target).data('transForm');
+ if (typeof key == 'undefined')
+ return d;
+ if (!d) d = {};
+ return d[key];
+ },
+ remove: function(key, target) {
+ if (typeof target == 'undefined')
+ target = t;
+ var d = $(target).data('transForm');
+ if (!d) d = {};
+ if (typeof d[key] == 'undefined')
+ return;
+ delete d[key];
+ }
+ },
+
+ build = {
+
+ form: function() {
+ $(t).find(tags.substr(1, tags.length - 2).replace(/\|/g, ",")).transForm(options);
+ toggleClass(t, cls(tagName));
+ },
+
+ fieldset: function() {
+ this.form();
+ },
+
+ label: function() {
+ if ($(t).is('[for]'))
+ toggleClass(t, cls('label'));
+ },
+
+ input: function() {
+ if (this[type])
+ this[type]();
+
+ if (!el) {
+ toggleClass(t, cls("input"));
+ toggleClass(t, cls(type));
+ }
+
+ if (fields.indexOf('|' + type + '|') !== -1)
+ t.transForm.readOnly = function(readOnly) {
+ t.readOnly = readOnly;
+ if (readOnly)
+ $(t).addClass(cls('readOnly'));
+ else
+ $(t).removeClass(cls('readOnly'));
+ };
+ },
+
+ select: function() {
+
+ if ($(t).attr('multiple')) {
+ this.multiple();
+ return;
+ }
+
+ if (!construct) {
+ el = $(t).parent();
+ return;
+ }
+
+ el = $('');
+
+ var menu = el.find(sel('menu')),
+ selected = el.find(sel('selected')),
+ button = el.find(sel('button')),
+ clicked = false;
+
+ $(t).bind('keydown.tf', function(e) {
+ var code = e.keyCode,
+ up = (code == 38),
+ down = (code == 40),
+ enter = (code == 13),
+ space = (code == 32),
+ tab = (code == 9),
+ esc = (code == 27);
+
+ if ((e.metaKey && (code == 82)) || (code == 116))
+ return true;
+
+ if (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)
+ return false;
+
+ if (up || down) {
+ var current = selectCurrent();
+
+ var i = parseInt(current.attr('class').split(cls('index-'))[1].split(/\s/)[0]),
+ opts = menu.find('div'),
+ count = menu.data('count');
+
+ if (up) {
+ var prev = (i == 0) ? (count - 1) : (i - 1);
+ prev = opts[prev];
+ current.removeClass(cls('hover'));
+ current = $(prev);
+
+ } else {
+ var next = (i == count - 1) ? 0 : (i + 1);
+ next = opts[next];
+ current.removeClass(cls('hover'));
+ current = $(next);
+ }
+
+ opts.removeClass(cls('hover'));
+ current.addClass(cls('hover'));
+ data.set({current: current});
+
+ $(t).find('option').removeAttr('selected');
+ current.data('option').selected = true;
+ update();
+ }
+
+ if (space || enter) {
+ el.toggleClass(cls('opened'));
+ selectCurrent();
+ }
+
+ if (esc)
+ el.removeClass(cls('opened'));
+
+ if (!tab)
+ return false;
+ }).bind('focus.tf', function() {
+ el.addClass(cls('focused'));
+ }).bind('blur.tf', function() {
+ setTimeout(function() {
+ if (!clicked)
+ el.removeClass(cls('focused')).removeClass(cls('opened'));
+ else {
+ clicked = false;
+ t.focus();
+ }
+ }, 100);
+ return false;
+ }).after(el).detach().prependTo(el);
+
+ var count = 0,
+ optgroup = $(t).find('optgroup').get(0);
+
+ if (optgroup)
+ menu.html('');
+
+ $(t).find('option, optgroup').each(function() {
+ if ($(this).is('option')) {
+ var opt = $('' + this.text + '
'),
+ target = $(this).parent().is('optgroup')
+ ? optgroup
+ : (optgroup ? menu.find('ul') : menu);
+ opt.data({option: this}).appendTo(target);
+ } else {
+ optgroup = $('' + $(this).attr('label') + ' ');
+ $(menu).find('ul').append(optgroup);
+ }
+ });
+ menu.data({count: count});
+
+ var update = function() {
+ var text = $(t).find('option:selected').text();
+ el.find(sel('selected') + ' span').text(text);
+ },
+
+ selectCurrent = function() {
+ var current = false;
+ menu.find('div').each(function() {
+ if ($(this).data('option') === $(t).find('option:selected').get(0)) {
+ $(this).addClass(cls('hover'));
+ data.set({current: $(this)});
+ current = $(this);
+ return false;
+ }
+ });
+ return current;
+ },
+
+ fClick = function() {
+ if (!t.disabled) {
+ clicked = true;
+ $(sel('focused')).removeClass(cls('focused'));
+ selectCurrent();
+
+ setTimeout(function() {
+ t.focus();
+ el.toggleClass(cls('opened'));
+ var div = menu.get(0);
+ if (el.hasClass(cls('opened')) && (div.scrollHeight > div.clientHeight)) {
+ menu.css({borderBottomRightRadius: 0});
+ menu.find(sel('last')).css({borderBottomRightRadius: 0});
+ disablePageScroll(menu);
+ }
+ clicked = false;
+ }, 200);
+ }
+ return true;
+ };
+
+ selected.mousedown(fClick);
+ button.mousedown(fClick);
+
+ menu.find('div').mousedown(function() {
+ var oldOpt = $(t).find('option:selected').get(0),
+ newOpt = $(this).data('option');
+ $(t).find('option').removeAttr('selected');
+ newOpt.selected = true;
+ update();
+ clicked = true;
+ el.removeClass(cls('opened'));
+ setTimeout(function() {
+ t.focus();
+ clicked = false;
+ if (oldOpt !== newOpt)
+ $(t).trigger('change');
+ }, 200);
+ }).mouseover(function() {
+ menu.find('div').removeClass(cls('hover'));
+ $(this).addClass(cls('hover'));
+ }).mouseout(function() {
+ $(this).removeClass(cls('hover'));
+ });
+
+ selected.css({
+ width: menu.outerWidth() - outerHSpace(selected)
+ });
+ var i = 0;
+ do {
+ el.css({
+ width: selected.outerWidth() + button.outerWidth() + i++
+ });
+ } while ((selected.offset().top != button.offset().top) && (i < 10000));
+ menu.css({
+ marginTop: el.outerHeight() - 1,
+ width: el.outerWidth() - outerHSpace(menu)
+ }).find('li').first().addClass(cls('first'));
+ menu.find('li').last().addClass(cls('last'));
+ menu.find('li').each(function() {
+ $(this).find('div').first().addClass(cls('group-first')).parent().find('div').last().addClass(cls('group-last'));
+ });
+ menu.find('div').first().addClass(cls('first'));
+ menu.find('div').last().addClass(cls('last'));
+ var firstLi = menu.find('li').first(),
+ lastLi = menu.find('li').last();
+ if (firstLi.get(0) && firstLi.prev().get(0))
+ firstLi.removeClass(cls('first'));
+ if (lastLi.get(0) && lastLi.next().get(0))
+ lastLi.removeClass(cls('last'));
+
+ update();
+
+ disableSelect(el);
+
+ t.transForm.value = function(value) {
+ if (typeof value == "undefined")
+ return t.value;
+ var oldValue = t.value;
+ t.value = value;
+ update();
+ };
+ },
+
+ multiple: function() {
+
+ if (!construct) {
+ el = $(t).parent();
+ return;
+ }
+
+ el = $('
');
+
+ var count = 0,
+ optgroup = $(t).find('optgroup').get(0);
+
+ if (optgroup)
+ el.html('');
+
+ $(t).find('option, optgroup').each(function() {
+ if ($(this).is('option')) {
+ var opt = $('' + this.text + '
'),
+ inGroup = $(this).parent().is('optgroup'),
+ target = inGroup
+ ? optgroup
+ : (optgroup ? el.find('ul') : el);
+ opt.data({option: this}).appendTo(target);
+
+ if (this.selected)
+ opt.addClass(cls('selected'));
+ if (this === $(t).find('option').last().get(0))
+ opt.addClass(cls('last'));
+ if (!inGroup && (this === $(t).find('option').first().get(0)))
+ opt.addClass(cls('first'));
+ if (inGroup) {
+ if (this === $(this).parent().find('option').last().get(0))
+ opt.addClass(cls('group-last'));
+ if (this === $(this).parent().find('option').first().get(0))
+ opt.addClass(cls('group-first'));
+ }
+
+ } else {
+ optgroup = $('' + $(this).attr('label') + ' ');
+ if (this === $(t).find('optgroup, option').first().get(0))
+ optgroup.addClass(cls('first'));
+ if (this === $(t).find('optgroup').last().get(0))
+ optgroup.addClass(cls('last'));
+ el.find('ul').append(optgroup);
+ }
+ });
+
+ el.data({count: count});
+ $(t).after(el).detach().prependTo(el);
+ disableSelect(el);
+
+ var div = el.get(0);
+ if (div.scrollHeight > div.clientHeight) {
+ el.css({
+ width: el.innerWidth() + scrollbarWidth,
+ borderTopRightRadius: 0,
+ borderBottomRightRadius: 0
+ });
+ el.find('div' + sel('first')).css({borderTopRightRadius: 0});
+ el.find('div' + sel('last')).css({borderBottomRightRadius: 0});
+ el.find('li' + sel('last')).css({borderBottomRightRadius: 0});
+ disablePageScroll(el);
+ }
+
+ var liLast = el.find('li' + sel('last'));
+ if (liLast.get(0) && liLast.next().get(0))
+ liLast.removeClass(cls('last'));
+
+ el.find('div').mouseenter(function() {
+ if (!t.disabled)
+ $(this).addClass(cls('hover'));
+ }).mouseleave(function() {
+ if (!t.disabled)
+ $(this).removeClass(cls('hover'));
+ }).click(function(e) {
+ if (t.disabled)
+ return false;
+ var option = $(this).data('option');
+ if (option.selected) {
+ $(this).removeClass(cls('selected'));
+ option.selected = false;
+ } else {
+ $(this).addClass(cls('selected'));
+ option.selected = true
+ }
+ if (e.shiftKey && option.selected) {
+ var elm, next = true,
+ index = parseInt($(this).attr('class').split(cls('index-'))[1].split(/\s/)[0]);
+ while(index && next) {
+ index--;
+ elm = el.find(sel('index-') + index);
+ if (elm.hasClass(cls('selected')))
+ next = false;
+ else {
+ elm.addClass(cls('selected'));
+ elm.data('option').selected = true;
+ }
+ }
+ }
+ $(t).trigger('change');
+ });
+
+ el.click(function() {
+ var top = el.scrollTop();
+ t.focus();
+ el.scrollTop(top);
+ });
+
+ $(t).bind('focus.tf', function() {
+ el.addClass(cls('focused'));
+ }).bind('blur.tf', function() {
+ el.removeClass(cls('focused'))
+ }).bind('change.tf', function() {
+ $(t).find('option').each(function(i) {
+ var div = el.find(sel('index-') + i);
+ if (this.selected)
+ div.addClass(cls('selected'));
+ else
+ div.removeClass(cls('selected'));
+ });
+ });
+
+ t.transForm.values = function(values) {
+
+ // Get values
+ if (typeof values == "undefined") {
+ var ret = [];
+ $(t).find('option:selected').each(function() {
+ ret.push(this.value);
+ });
+ return ret;
+ }
+
+ if (!$.isArray(values))
+ return;
+
+ // Set values
+ $(t).find('option').attr({selected: false});
+ el.find('div').removeClass(cls('selected'));
+
+ $.each(values, function(j, v) {
+ $(t).find('option').each(function(i) {
+ if (this.value === v) {
+ this.selected = true;
+ el.find(sel('index-') + i).addClass(cls('selected'));
+ }
+ });
+ });
+ };
+ },
+
+ textarea: function() {
+
+ if (construct || destruct)
+ $(t).css({
+ overflow: '',
+ height: '',
+ borderTopRightRadius: '',
+ borderBottomRightRadius: '',
+ borderBottomLeftRadius: ''
+ });
+
+ toggleClass(t, cls(tagName));
+
+ if (!construct)
+ return;
+
+ var update;
+
+ if (o.textarea.autoExpand) {
+ $(t).css({overflow: 'hidden'});
+
+ update = function() {
+ $(t).scrollTop(0);
+
+ if (t.clientHeight >= t.scrollHeight)
+ $(t).css({height: 1});
+
+ $(t).css({height: t.scrollHeight + (document.doctype ? -outerVSpace($(t), 'p') : outerVSpace($(t), 'b'))});
+ };
+
+ } else
+ update = function() {
+
+ var vScroll = (t.clientHeight < t.scrollHeight),
+ hScroll = (t.clientWidth < t.scrollWidth);
+
+ if (!store.r)
+ store.r = {
+ tr: $(t).css('borderTopRightRadius'),
+ br: $(t).css('borderBottomRightRadius'),
+ bl: $(t).css('borderBottomLeftRadius')
+ };
+
+ $(t).css({
+ borderBottomRightRadius: (vScroll || hScroll) ? 0 : store.r.br,
+ borderTopRightRadius: vScroll ? 0 : store.r.tr,
+ borderBottomLeftRadius: hScroll ? 0 : store.r.bl
+ });
+ };
+
+ var u = function() {
+ update();
+ var maxLength = o.textarea.maxLength;
+ if (maxLength && (t.value.length > maxLength))
+ t.value = t.value.substr(0, maxLength);
+ };
+
+ u(); $(t).bind('keyup.tf', u).bind('keydown.tf', u).bind('change.tf', u).bind('scroll.tf', u);
+
+ t.transForm.readOnly = function(readOnly) {
+ t.readOnly = readOnly;
+ if (readOnly)
+ $(t).addClass(cls('readOnly'));
+ else
+ $(t).removeClass(cls('readOnly'));
+ };
+ },
+
+ button: function() {
+
+ if (!construct) {
+ el = $(t).parent();
+ return;
+ }
+
+ el = $('
');
+
+ $(t).after(el).detach().appendTo(el);
+ el.find('span').text(t.textContent);
+
+ $(t).css({
+ width: el.innerWidth() + outerHSpace(el),
+ height: el.innerHeight() + outerVSpace(el),
+ marginLeft: - parseInt(el.css('borderLeftWidth')),
+ marginTop: - parseInt(el.css('borderTopWidth'))
+ }).bind('focus.tf', function() {
+ el.addClass(cls('focused'));
+ }).bind('blur.tf', function() {
+ el.removeClass(cls('focused'));
+ }).bind('mousedown.tf', function() {
+ el.addClass(cls('focused'));
+ });
+ },
+
+ file: function() {
+
+ if (!construct) {
+ el = $(t).parent();
+ return;
+ }
+
+ el = $('');
+
+ $(t).after(el).detach().prependTo(el);
+
+ var info = el.find(sel('info')),
+ button = el.find(sel('button')),
+ u = function() {
+ var files = t.files;
+ if (!files || (files.length <= 0))
+ info.find('span').html(o.file.noFile);
+ else
+ info.find('span').text((files.length == 1) ? files[0]['name'] : o.file.count.replace('{count}', files.length));
+ el.attr('label', $(t).attr('label'))
+ };
+
+ var i = 0;
+ do {
+ info.css({
+ width: el.innerWidth() - button.outerWidth() - outerHSpace(info) - i++
+ });
+ } while ((info.offset().top != button.offset().top) && (i < 10000));
+
+ $(t).css({
+ width: el.outerWidth(),
+ height: el.outerHeight()
+ }).bind('focus.tf', function() {
+ $(sel('focused')).removeClass(cls('focused'));
+ el.addClass(cls('focused'));
+ }).bind('blur.tf', function() {
+ el.removeClass(cls('focused'));
+ }).bind('change.tf', u).bind('click.tf', function() {
+ t.focus();
+ });
+
+ u();
+ },
+
+ checkbox: function() {
+
+ if (!construct) {
+ el = $(t).parent();
+ return;
+ }
+
+ el = $('
');
+
+ var u = function() {
+ if (t.checked)
+ el.addClass(cls('checked'));
+ else
+ el.removeClass(cls('checked'));
+ },
+ label = $(t).attr('id');
+ if (label)
+ label = $('label[for="' + label + '"]');
+
+ disableSelect(label);
+
+ $(t).after(el).detach().appendTo(el).bind('focus.tf', function() {
+ el.addClass(cls('focused'));
+ if (label.get(0))
+ label.addClass(cls('focused'));
+ }).bind('blur.tf', function() {
+ el.removeClass(cls('focused'));
+ if (label.get(0))
+ label.removeClass(cls('focused'));
+ }).bind('click.tf', function() {
+ u();
+ $(sel('focused')).removeClass(cls('focused'));
+ el.addClass(cls('focused'));
+ if (label.get(0))
+ label.addClass(cls('focused'));
+ t.focus();
+ }).bind('change.tf', u);
+
+ u();
+
+ t.transForm.checked = function(checked) {
+ if (typeof checked == "undefined")
+ return t.checked;
+ t.checked = !!checked;
+ u();
+ };
+ },
+
+ radio: function() {
+
+ if (!construct) {
+ el = $(t).parent();
+ return;
+ }
+
+ el = $('
');
+
+ var radios = $(t).parents('body, form').find('input[type="radio"][name="' + t.name + '"]'),
+ u = function() {
+ $(radios).each(function() {
+ if (this.checked)
+ $(this).parent().addClass(cls('checked'));
+ else
+ $(this).parent().removeClass(cls('checked'));
+ });
+ },
+ f = function(focused) {
+ if (focused) {
+ $(radios).parent().addClass(cls('focused'));
+ $.each(labels, function(i, l) {
+ l.addClass(cls('focused'));
+ });
+ } else {
+ $(radios).parent().removeClass(cls('focused'));
+ $.each(labels, function(i, l) {
+ l.removeClass(cls('focused'));
+ });
+ }
+ },
+ labels = [];
+
+ $.each(radios, function(i, r) {
+ var label = $(r).attr('id');
+ if (!label)
+ return;
+ label = $('label[for="' + label +'"]');
+ if (!label.get(0))
+ return;
+ labels.push(label);
+ disableSelect(label);
+ });
+
+ $(t).after(el).detach().appendTo(el).bind('focus.tf', function() {
+ f(true);
+ }).bind('blur.tf', function() {
+ f(false);
+ }).bind('click.tf', function() {
+ u();
+ f(true);
+ t.focus();
+ }).bind('change.tf', u);
+
+ u();
+
+ t.transForm.checked = function(checked) {
+ if (typeof checked == "undefined")
+ return t.checked;
+ t.checked = !!checked;
+ u();
+ };
+ },
+
+ submit: function() {
+ this.button();
+ },
+
+ reset: function() {
+ this.button();
+ }
+ };
+
+ if (typeof t.transForm == "undefined")
+ t.transForm = {
+ disable: function(disabled) {
+ var target = el ? el : t;
+ t.disabled = !!disabled;
+ if (!!disabled)
+ target.addClass(cls('disabled'));
+ else
+ target.removeClass(cls('disabled'));
+ },
+ destruct: function() {
+ destruct = true;
+ construct = false;
+ build[tagName]();
+ destructFunc();
+ }
+ };
+
+ build[tagName]();
+
+ // Common Construct
+ if (construct) {
+ var target = el ? el : $(t);
+ if (t.disabled)
+ target.addClass(cls('disabled'));
+ if (t.readOnly)
+ target.addClass(cls('readOnly'));
+ data.set({
+ prefix: prefix,
+ transformed: true
+ });
+ }
+
+ // Common Destruct
+ var destructFunc = function() {
+ $(t).removeData('transForm').unbind('.tf');
+ if (el) {
+ $(t).detach();
+ el.after(t).detach();
+ }
+ if (typeof t.transForm != "undefined")
+ delete t.transForm;
+ var classes = $(t).attr('class');
+ if (!classes)
+ return;
+ $.each(classes.split(/\s+/g), function(i, c) {
+ if (c.substr(0, prefix.length) == prefix)
+ $(t).removeClass(c);
+ });
+ };
+ if (destruct)
+ destructFunc();
+
+ // Toggle disabled
+ if (typeof o.disabled != "undefined") {
+ t.disabled = !!o.disabled;
+ var target = el ? el : $(t);
+ if (o.disabled)
+ target.addClass(cls('disabled'));
+ else
+ target.removeClass(cls('disabled'));
+ }
+
+ // Toggle read-only
+ if ((typeof o.readOnly != "undefined") &&
+ (
+ (tagName == "textarea") ||
+ (
+ (tagName == "input") &&
+ (fields.indexOf('|' + type + '|') !== -1)
+ )
+ )
+ ) {
+ var readonly = !!o.readOnly;
+ $(t).attr({readonly: readonly});
+ if (!transForm)
+ return;
+ if (readonly)
+ $(t).addClass(cls('readOnly'));
+ else
+ $(t).removeClass(cls('readOnly'));
+ }
+ });
+ return $(this);
+ };
+
+})(jQuery);
diff --git a/js/010.jquery.fixes.js b/js/010.jquery.fixes.js
new file mode 100644
index 0000000..c0b98ee
--- /dev/null
+++ b/js/010.jquery.fixes.js
@@ -0,0 +1,32 @@
+/** This file is part of KCFinder project
+ *
+ * @desc My jQuery UI fixes
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+(function($) {
+
+ $.fn.oldMenu = $.fn.menu;
+ $.fn.menu = function(p1, p2, p3) {
+ var ret = $(this).oldMenu(p1, p2, p3);
+ $(this).each(function() {
+ if (!$(this).hasClass('sh-menu')) {
+ $(this).addClass('sh-menu')
+ .children().first().addClass('ui-menu-item-first');
+ $(this).children().last().addClass('ui-menu-item-last');
+ $(this).find('.ui-menu').addClass('sh-menu').each(function() {
+ $(this).children().first().addClass('ui-menu-item-first');
+ $(this).children().last().addClass('ui-menu-item-last');
+ });
+ }
+ });
+ return ret;
+ };
+
+})(jQuery);
\ No newline at end of file
diff --git a/js/020.jquery.rightClick.js b/js/020.jquery.rightClick.js
new file mode 100644
index 0000000..7ccc1b0
--- /dev/null
+++ b/js/020.jquery.rightClick.js
@@ -0,0 +1,27 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Right Click jQuery Plugin
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+(function($) {
+ $.fn.rightClick = function(func) {
+ var events = "contextmenu rightclick";
+ $(this).each(function() {
+ $(this).unbind(events).bind(events, function(e) {
+ $.globalBlur();
+ e.preventDefault();
+ $.clearSelection();
+ if ($.isFunction(func))
+ func(this, e);
+ });
+ });
+ return $(this);
+ };
+})(jQuery);
\ No newline at end of file
diff --git a/js/021.jquery.taphold.js b/js/021.jquery.taphold.js
new file mode 100644
index 0000000..96f4d70
--- /dev/null
+++ b/js/021.jquery.taphold.js
@@ -0,0 +1,117 @@
+// @author Rich Adams
+
+// Implements a tap and hold functionality. If you click/tap and release, it will trigger a normal
+// click event. But if you click/tap and hold for 1s (default), it will trigger a taphold event instead.
+
+;(function($)
+{
+ // Default options
+ var defaults = {
+ duration: 1000, // ms
+ clickHandler: null
+ }
+
+ // When start of a taphold event is triggered.
+ function startHandler(event)
+ {
+ var $elem = jQuery(this);
+
+ // Merge the defaults and any user defined settings.
+ settings = jQuery.extend({}, defaults, event.data);
+
+ // If object also has click handler, store it and unbind. Taphold will trigger the
+ // click itself, rather than normal propagation.
+ if (typeof $elem.data("events") != "undefined"
+ && typeof $elem.data("events").click != "undefined")
+ {
+ // Find the one without a namespace defined.
+ for (var c in $elem.data("events").click)
+ {
+ if ($elem.data("events").click[c].namespace == "")
+ {
+ var handler = $elem.data("events").click[c].handler
+ $elem.data("taphold_click_handler", handler);
+ $elem.unbind("click", handler);
+ break;
+ }
+ }
+ }
+ // Otherwise, if a custom click handler was explicitly defined, then store it instead.
+ else if (typeof settings.clickHandler == "function")
+ {
+ $elem.data("taphold_click_handler", settings.clickHandler);
+ }
+
+ // Reset the flags
+ $elem.data("taphold_triggered", false); // If a hold was triggered
+ $elem.data("taphold_clicked", false); // If a click was triggered
+ $elem.data("taphold_cancelled", false); // If event has been cancelled.
+
+ // Set the timer for the hold event.
+ $elem.data("taphold_timer",
+ setTimeout(function()
+ {
+ // If event hasn't been cancelled/clicked already, then go ahead and trigger the hold.
+ if (!$elem.data("taphold_cancelled")
+ && !$elem.data("taphold_clicked"))
+ {
+ // Trigger the hold event, and set the flag to say it's been triggered.
+ $elem.trigger(jQuery.extend(event, jQuery.Event("taphold")));
+ $elem.data("taphold_triggered", true);
+ }
+ }, settings.duration));
+ }
+
+ // When user ends a tap or click, decide what we should do.
+ function stopHandler(event)
+ {
+ var $elem = jQuery(this);
+
+ // If taphold has been cancelled, then we're done.
+ if ($elem.data("taphold_cancelled")) { return; }
+
+ // Clear the hold timer. If it hasn't already triggered, then it's too late anyway.
+ clearTimeout($elem.data("taphold_timer"));
+
+ // If hold wasn't triggered and not already clicked, then was a click event.
+ if (!$elem.data("taphold_triggered")
+ && !$elem.data("taphold_clicked"))
+ {
+ // If click handler, trigger it.
+ if (typeof $elem.data("taphold_click_handler") == "function")
+ {
+ $elem.data("taphold_click_handler")(jQuery.extend(event, jQuery.Event("click")));
+ }
+
+ // Set flag to say we've triggered the click event.
+ $elem.data("taphold_clicked", true);
+ }
+ }
+
+ // If a user prematurely leaves the boundary of the object we're working on.
+ function leaveHandler(event)
+ {
+ // Cancel the event.
+ $(this).data("taphold_cancelled", true);
+ }
+
+ // Determine if touch events are supported.
+ var touchSupported = ("ontouchstart" in window) // Most browsers
+ || ("onmsgesturechange" in window); // Microsoft
+
+ var taphold = $.event.special.taphold =
+ {
+ setup: function(data)
+ {
+ $(this).bind((touchSupported ? "touchstart" : "mousedown"), data, startHandler)
+ .bind((touchSupported ? "touchend" : "mouseup"), stopHandler)
+ .bind((touchSupported ? "touchmove touchcancel" : "mouseleave"), leaveHandler);
+ },
+ teardown: function(namespaces)
+ {
+ $(this).unbind((touchSupported ? "touchstart" : "mousedown"), startHandler)
+ .unbind((touchSupported ? "touchend" : "mouseup"), stopHandler)
+ .unbind((touchSupported ? "touchmove touchcancel" : "mouseleave"), leaveHandler);
+ }
+ };
+})(jQuery);
\ No newline at end of file
diff --git a/js/022.jquery.shDropUpload.js b/js/022.jquery.shDropUpload.js
new file mode 100644
index 0000000..4886737
--- /dev/null
+++ b/js/022.jquery.shDropUpload.js
@@ -0,0 +1,363 @@
+/*
+ * jQuery shDropUpload v1.2
+ * http://jquery.sunhater.com/shDropUpload
+ * 2014-08-12
+ *
+ * Copyright (c) 2014 Pavel Tzonkov
+ * Dual licensed under the MIT and GPL licenses.
+ */
+
+(function($) {
+
+ /** @param localOptions Options about local files drag & drop
+ * @param remoteOptions Options about HTML objects drag & drop */
+
+ $.fn.shDropUpload = function(localOptions, remoteOptions) {
+
+ // Compatibility check
+ if ((typeof XMLHttpRequest == "undefined") ||
+ (typeof document.addEventListener == "undefined") ||
+ (typeof File == "undefined") ||
+ (typeof FileReader == "undefined")
+ )
+ return;
+
+ // Default options about local files drag & drop
+ var lo = {
+
+ // URL to upload handler script
+ url: "",
+
+ // File field name
+ param: "upload",
+
+ // Maximum filesize in bytes. If a dragged file is too big, the browser crashes
+ maxFilesize: 10485760,
+
+ // Called before all uploads. Useful for implementing some checks before uploads begins
+ // If it returns false, the uploading will be canceled.
+ precheck: function(evt) {
+ console.log("shDropUpload: Upload process started");
+ return true;
+ },
+
+ // Called when an upload begins
+ begin: function(xhr, currentFile, filesCount) {
+ console.log("shDropUpload: Uploading file " + currentFile + " of " + filesCount + " (" + xhr.file.name + ")");
+ },
+
+ // Called after successful upload request
+ success: function(xhr, currentFile, filesCount) {
+ console.log("shDropUpload: Upload success (" + xhr.file.name + ")");
+ },
+
+ // Called when an upload request fails
+ error: function(xhr, currentFile, filesCount) {
+ console.log("shDropUpload: Upload request failed (" + xhr.file.name + ")");
+ },
+
+ // Called when an upload request is aborted
+ abort: function(xhr, currentFile, filesCount) {
+ console.log("shDropUpload: Upload request aborted (" + xhr.file.name + ")");
+ },
+
+ // Called when a file exceeds the maxFilesize option
+ filesizeCallback: function(xhr, currentFile, filesCount) {
+ console.log("shDropUpload: File is too big (" + xhr.file.name + ")");
+ },
+
+ // Called when all files are proceeded
+ finish: function() {
+ console.log("shDropUpload: Upload process finished");
+ }
+ },
+
+ // Default options about HTML objects drag & drop
+ ro = {
+
+ // If a selection is dropped you could to fetch multiple URLs from selected HTML
+ // You can define the selectors URLs will be fetched from. If you want only images
+ // leave 'img[src]' only
+ selectors: 'img[src]',
+ //selectors: 'img[src], a[href], script[src], link[href]',
+
+ // Check URLs for uniqueness
+ unique: true,
+
+ // Ajax options
+ ajax: {
+ url: "",
+ type: "post",
+ dataType: "json",
+ data: {
+ url: "{url}", // {url} marks the URL from dragged object
+ type: "{type}" // {type} marks the tag type ("a" or "img")
+ },
+ success: function(response) {
+ console.log("shDropUpload: URL has been passed to the server.");
+ },
+ error: function() {
+ console.log("shDropUpload: Request failed!");
+ }
+ }
+ },
+
+ utf8encode = function(string) {
+ string = string.replace(/\r\n/g, "\n");
+ var c, utftext = "";
+
+ for (var n = 0; n < string.length; n++) {
+
+ c = string.charCodeAt(n);
+
+ if (c < 128) {
+ utftext += String.fromCharCode(c);
+ } else if((c > 127) && (c < 2048)) {
+ utftext += String.fromCharCode((c >> 6) | 192);
+ utftext += String.fromCharCode((c & 63) | 128);
+ } else {
+ utftext += String.fromCharCode((c >> 12) | 224);
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+ }
+
+ return utftext;
+ };
+
+ $.extend(true, ro, remoteOptions);
+ $.extend(true, lo, localOptions);
+
+ if (!XMLHttpRequest.prototype.sendAsBinary) {
+ XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
+ var ords = Array.prototype.map.call(datastr, function(x) {
+ return x.charCodeAt(0) & 0xff;
+ }),
+ ui8a = new Uint8Array(ords);
+ this.send(ui8a);
+ }
+ }
+
+ $(this).each(function() {
+ var t = this,
+ uploadQueue = [],
+ uploadInProgress = false,
+ filesCount = 0,
+ boundary = "------multipartdropuploadboundary" + new Date().getTime(),
+ currentFile,
+
+ dragOver = function(e) {
+ if (e.preventDefault) e.preventDefault();
+ $(t).addClass('drag');
+ return false;
+ },
+
+ dragEnter = function(e) {
+ if (e.preventDefault) e.preventDefault();
+ return false;
+ },
+
+ dragLeave = function(e) {
+ if (e.preventDefault) e.preventDefault();
+ $(t).removeClass('drag');
+ return false;
+ },
+
+ drop = function(e) {
+ if (e.preventDefault) e.preventDefault();
+ if (e.stopPropagation) e.stopPropagation();
+ $(t).removeClass('drag');
+
+ try {
+ var el = e.dataTransfer.getData('text/html');
+ } catch (e) {
+ var el = false;
+ }
+
+ // Remote drop
+ if (el) {
+
+ if (!remoteOptions)
+ return false;
+
+ el = '' + el.toString() + '
';
+ var urls = [], types = [];
+
+ var selectors = $.isArray(ro.selectors)
+ ? ro.selectors
+ : ro.selectors.split(/\s*,\s*/g);
+
+ $.each(selectors, function(i, selector) {
+ if (!/^[a-z0-9]+\[[a-z]+\]$/gi.test(selector))
+ return true;
+ var type = selector.split('[')[0],
+ attr = selector.split('[')[1].split(']')[0];
+ $(el).find(selector).each(function() {
+ var url = $(this).attr(attr);
+ if (ro.unique)
+ for (var i = 0; i < urls.length; i++)
+ if ((urls[i] == url) && (types[i] == type))
+ return true;
+ urls.push(url);
+ types.push(type);
+ });
+ });
+
+ if (!urls.length)
+ return false;
+
+ if (urls.length == 1) {
+ urls = urls[0];
+ types = types[0];
+ }
+
+ var opts = $.extend(true, {}, ro.ajax);
+ if (opts.data) {
+ $.each(opts.data, function(i, j) {
+ if (j == "{url}")
+ opts.data[i] = urls;
+ if (j == "{type}")
+ opts.data[i] = types;
+ });
+ }
+ $.ajax(opts);
+
+ // Local drop
+ } else {
+ if (!localOptions)
+ return false;
+
+ filesCount += e.dataTransfer.files.length;
+
+ if (!filesCount || !lo.precheck(e))
+ return false;
+
+ for (var i = 0; i < filesCount; i++) {
+ var file = e.dataTransfer.files[i];
+ uploadQueue.push(file);
+ }
+
+ uploadNext();
+ }
+
+ return false;
+ },
+
+ uploadNext = function() {
+ if (uploadInProgress)
+ return false;
+
+ if (uploadQueue && uploadQueue.length) {
+
+ var file = uploadQueue.shift(),
+ currentNum = filesCount - uploadQueue.length,
+ reader = new FileReader(),
+ ie = (typeof reader.readAsBinaryString == "undefined");
+
+ currentFile = reader.file = file;
+
+ reader.onerror = function(evt) {
+ evt.file = file;
+ lo.error(evt, currentNum, filesCount);
+ uploadNext();
+ };
+
+ reader.onload = function(evt) {
+ uploadInProgress = true;
+
+ var xhr = new XMLHttpRequest(),
+ postbody = '--' + boundary + '\r\nContent-Disposition: form-data; name="' + lo.param + '"';
+
+ xhr.file = evt.target.file;
+
+ lo.begin(xhr, currentNum, filesCount);
+
+ if (lo.maxFilesize && (xhr.file.size > lo.maxFilesize)) {
+ uploadInProgress = false;
+ lo.filesizeCallback(xhr, currentNum, filesCount);
+ uploadNext();
+ return;
+ }
+
+ if (ie) {
+ var binary = "",
+ bytes = new Uint8Array(evt.target.result);
+
+ for (var i = 0; i < bytes.byteLength; i++)
+ binary += String.fromCharCode(bytes[i]);
+ }
+
+ if (xhr.file.name)
+ postbody += '; filename="' + utf8encode(xhr.file.name) + '"';
+ postbody += '\r\n';
+ if (xhr.file.size)
+ postbody += "Content-Length: " + xhr.file.size + "\r\n";
+ postbody += "Content-Type: " + xhr.file.type + "\r\n\r\n" + (ie ? binary : evt.target.result) + "\r\n--" + boundary + "--\r\n";
+
+ xhr.open('post', lo.url, true);
+ xhr.setRequestHeader('Content-Type', "multipart/form-data; boundary=" + boundary);
+
+ xhr.onload = function() {
+ uploadInProgress = false;
+ lo.success(xhr, currentNum, filesCount);
+ uploadNext();
+ };
+
+ xhr.onerror = function() {
+ uploadInProgress = false;
+ lo.error(xhr, currentNum, filesCount);
+ uploadNext();
+ };
+
+ xhr.onabort = function() {
+ uploadInProgress = false;
+ lo.abort(xhr, currentNum, filesCount);
+ uploadNext();
+ };
+
+ xhr.sendAsBinary(postbody);
+ };
+
+ if (ie)
+ reader.readAsArrayBuffer(file);
+ else
+ reader.readAsBinaryString(file);
+
+ } else {
+ filesCount = 0;
+ var loop = setInterval(function() {
+ if (uploadInProgress) return;
+ boundary = "------multipartdropuploadboundary" + new Date().getTime();
+ uploadQueue = [];
+ clearInterval(loop);
+ lo.finish();
+ }, 333);
+ }
+ };
+
+ if (!$(t).data('shdu'))
+ $(t).data('shdu', {
+ dragover: dragOver,
+ dragenter: dragEnter,
+ dragLeave: dragLeave,
+ drop: drop
+ });
+
+ var bind = function(event, callback) {
+ t.removeEventListener(event, $(t).data('shdu')[event], false);
+ var data = $(t).data('shdu'),
+ newData = {};
+ newData[event] = callback;
+ $.extend(data, newData);
+ $(t).data('shdu', data);
+ t.addEventListener(event, callback, false);
+ };
+
+ bind('dragover', dragOver);
+ bind('dragenter', dragEnter);
+ bind('dragleave', dragLeave);
+ bind('drop', drop);
+ });
+ }
+
+})(jQuery);
diff --git a/js/029.jquery.agent.js b/js/029.jquery.agent.js
new file mode 100644
index 0000000..9ba84de
--- /dev/null
+++ b/js/029.jquery.agent.js
@@ -0,0 +1,89 @@
+/** This file is part of KCFinder project
+ *
+ * @desc User Agent jQuery Plugin
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+(function($) {
+ $.agent = {};
+
+ var agent = " " + navigator.userAgent,
+
+ patterns = [
+ {
+ expr: / [a-z]+\/[0-9a-z\.]+/ig,
+ delim: "/"
+ }, {
+ expr: / [a-z]+:[0-9a-z\.]+/ig,
+ delim: ":",
+ keys: ["rv", "version"]
+ }, {
+ expr: / [a-z]+\s+[0-9a-z\.]+/ig,
+ delim: /\s+/,
+ keys: ["opera", "msie", "firefox", "android"]
+ }, {
+ expr: /[ \/\(]([a-z0-9_]+)[ ;\)\/]/ig,
+ keys: "i386|i486|i586|i686|x86|x64|x86_64|intel|ppc|powerpc|windows|macintosh|darwin|unix|linux|sunos|android|iphone|ipad|ipod|amiga|amigaos|beos|wii|playstation|gentoo|fedora|slackware|ubuntu|archlinux|debian|mint|mageia|mandriva|freebsd|openbsd|netbsd|solaris|opensolaris|x11|mobile|phone".split('|'),
+ sub: "platform"
+ }
+ ];
+
+ $.each(patterns, function(i, pattern) {
+ var elements = agent.match(pattern.expr);
+ if (elements === null)
+ return;
+ $.each(elements, function(j, ag) {
+ ag = ag.replace(/^\s+/, "").toLowerCase();
+ var key = ag.replace(pattern.expr, "$1"),
+ val = true;
+ if (typeof pattern.delim != "undefined") {
+ ag = ag.split(pattern.delim);
+ key = ag[0];
+ val = ag[1];
+ }
+
+ if (typeof pattern.keys != "undefined") {
+ var exists = false, k = 0;
+ for (; k < pattern.keys.length; k++)
+ if (pattern.keys[k] == key) {
+ exists = true;
+ break;
+ }
+ if (!exists)
+ return;
+ }
+
+ if (typeof pattern.sub != "undefined") {
+ if (typeof $.agent[pattern.sub] != "object")
+ $.agent[pattern.sub] = {};
+ if (typeof $.agent[pattern.sub][key] == "undefined")
+ $.agent[pattern.sub][key] = val;
+
+ } else if (typeof $.agent[key] == "undefined")
+ $.agent[key] = val;
+ });
+ });
+
+ if (!$.agent.platform)
+ $.agent.platform = {};
+
+ // Check for mobile device
+ $.mobile = false;
+ var keys = "mobile|android|iphone|ipad|ipod|iemobile|phone".split('|');
+ a = $.agent;
+
+ $.each([a, a.platform], function(i, p) {
+ for (var j = 0; j < keys.length; j++) {
+ if (p[keys[j]]) {
+ $.mobile = true;
+ return false;
+ }
+ }
+ });
+})(jQuery);
\ No newline at end of file
diff --git a/js/030.jquery.helper.js b/js/030.jquery.helper.js
new file mode 100644
index 0000000..62a3fe8
--- /dev/null
+++ b/js/030.jquery.helper.js
@@ -0,0 +1,315 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Helper functions integrated in jQuery
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+(function($) {
+
+ $.fn.fixScrollbarRadius = function() {
+ $(this).each(function() {
+ var t = this,
+ dataID = 'fixRadius',
+ vScroll = (t.clientHeight < t.scrollHeight),
+ hScroll = (t.clientWidth < t.scrollWidth);
+
+ if (!$(t).data(dataID))
+ $(t).data(dataID, {
+ tr: $(t).css('borderTopRightRadius'),
+ br: $(t).css('borderBottomRightRadius'),
+ bl: $(t).css('borderBottomLeftRadius')
+ });
+
+ var data = $(t).data(dataID);
+
+ $(t).css({
+ borderTopRightRadius: vScroll ? 0 : data.tr,
+ borderBottomRightRadius: (vScroll || hScroll) ? 0 : data.br,
+ borderBottomLeftRadius: hScroll ? 0 : data.bl
+ });
+ });
+ return $(this);
+ };
+
+ $.fn.selection = function(start, end) {
+ var field = this.get(0);
+
+ if (field.createTextRange) {
+ var selRange = field.createTextRange();
+ selRange.collapse(true);
+ selRange.moveStart('character', start);
+ selRange.moveEnd('character', end-start);
+ selRange.select();
+ } else if (field.setSelectionRange) {
+ field.setSelectionRange(start, end);
+ } else if (field.selectionStart) {
+ field.selectionStart = start;
+ field.selectionEnd = end;
+ }
+ field.focus();
+ };
+
+ $.fn.disableTextSelect = function() {
+ return this.each(function() {
+ if ($.agent.firefox) { // Firefox
+ $(this).css('MozUserSelect', "none");
+ } else { //Opera, etc.
+ $(this).mousedown(function() {
+ $.globalBlur();
+ return false;
+ });
+ }
+ });
+ };
+
+ $.fn.outerSpace = function(type, mbp) {
+ var selector = this.get(0),
+ r = 0, x;
+
+ if (!mbp) mbp = "mbp";
+
+ if (/m/i.test(mbp)) {
+ x = parseInt($(selector).css('margin-' + type));
+ if (x) r += x;
+ }
+
+ if (/b/i.test(mbp)) {
+ x = parseInt($(selector).css('border-' + type + '-width'));
+ if (x) r += x;
+ }
+
+ if (/p/i.test(mbp)) {
+ x = parseInt($(selector).css('padding-' + type));
+ if (x) r += x;
+ }
+
+ return r;
+ };
+
+ $.fn.outerLeftSpace = function(mbp) {
+ return this.outerSpace('left', mbp);
+ };
+
+ $.fn.outerTopSpace = function(mbp) {
+ return this.outerSpace('top', mbp);
+ };
+
+ $.fn.outerRightSpace = function(mbp) {
+ return this.outerSpace('right', mbp);
+ };
+
+ $.fn.outerBottomSpace = function(mbp) {
+ return this.outerSpace('bottom', mbp);
+ };
+
+ $.fn.outerHSpace = function(mbp) {
+ return (this.outerLeftSpace(mbp) + this.outerRightSpace(mbp));
+ };
+
+ $.fn.outerVSpace = function(mbp) {
+ return (this.outerTopSpace(mbp) + this.outerBottomSpace(mbp));
+ };
+
+ $.fn.fullscreen = function() {
+ if (!$(this).get(0))
+ return
+ var t = $(this).get(0),
+ requestMethod =
+ t.requestFullScreen ||
+ t.requestFullscreen ||
+ t.webkitRequestFullScreen ||
+ t.mozRequestFullScreen ||
+ t.msRequestFullscreen;
+
+ if (requestMethod)
+ requestMethod.call(t);
+
+ else if (typeof window.ActiveXObject !== "undefined") {
+ var wscript = new ActiveXObject("WScript.Shell");
+ if (wscript !== null)
+ wscript.SendKeys("{F11}");
+ }
+ };
+
+ $.fn.toggleFullscreen = function(doc) {
+ if ($.isFullscreen(doc))
+ $.exitFullscreen(doc);
+ else
+ $(this).fullscreen();
+ };
+
+ $.globalBlur = function() {
+ $(' ').appendTo('body').trigger('focus').detach();
+ };
+
+ $.exitFullscreen = function(doc) {
+ var d = doc ? doc : document,
+ requestMethod =
+ d.cancelFullScreen ||
+ d.cancelFullscreen ||
+ d.webkitCancelFullScreen ||
+ d.mozCancelFullScreen ||
+ d.msExitFullscreen ||
+ d.exitFullscreen;
+
+ if (requestMethod)
+ requestMethod.call(d);
+
+ else if (typeof window.ActiveXObject !== "undefined") {
+ var wscript = new ActiveXObject("WScript.Shell");
+ if (wscript !== null)
+ wscript.SendKeys("{F11}");
+ }
+ };
+
+ $.isFullscreen = function(doc) {
+ var d = doc ? doc : document;
+ return (d.fullScreenElement && (d.fullScreenElement !== null)) ||
+ (d.fullscreenElement && (d.fullscreenElement !== null)) ||
+ (d.msFullscreenElement && (d.msFullscreenElement !== null)) ||
+ d.mozFullScreen || d.webkitIsFullScreen;
+ };
+
+ $.clearSelection = function() {
+ if (document.selection)
+ document.selection.empty();
+ else if (window.getSelection)
+ window.getSelection().removeAllRanges();
+ };
+
+ $.$ = {
+
+ htmlValue: function(value) {
+ return value
+ .replace(/&/g, "&")
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
+ },
+
+ htmlData: function(value) {
+ return $('
').text(value).html();
+ },
+
+ jsValue: function(value) {
+ return value
+ .replace(/\\/g, "\\\\")
+ .replace(/\r?\n/, "\\\n")
+ .replace(/"/g, "\\\"")
+ .replace(/'/g, "\\'");
+ },
+
+ basename: function(path) {
+ var expr = /^.*\/([^\/]+)\/?$/g;
+ return expr.test(path)
+ ? path.replace(expr, "$1")
+ : path;
+ },
+
+ dirname: function(path) {
+ var expr = /^(.*)\/[^\/]+\/?$/g;
+ return expr.test(path)
+ ? path.replace(expr, "$1")
+ : '';
+ },
+
+ inArray: function(needle, arr) {
+ if (!$.isArray(arr))
+ return false;
+ for (var i = 0; i < arr.length; i++)
+ if (arr[i] == needle)
+ return true;
+ return false;
+ },
+
+ getFileExtension: function(filename, toLower) {
+ if (typeof toLower == 'undefined') toLower = true;
+ if (/^.*\.[^\.]*$/.test(filename)) {
+ var ext = filename.replace(/^.*\.([^\.]*)$/, "$1");
+ return toLower ? ext.toLowerCase(ext) : ext;
+ } else
+ return "";
+ },
+
+ escapeDirs: function(path) {
+ var fullDirExpr = /^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/,
+ prefix = "";
+ if (fullDirExpr.test(path)) {
+ var port = path.replace(fullDirExpr, "$4");
+ prefix = path.replace(fullDirExpr, "$1://$2");
+ if (port.length)
+ prefix += ":" + port;
+ prefix += "/";
+ path = path.replace(fullDirExpr, "$5");
+ }
+
+ var dirs = path.split('/'),
+ escapePath = '', i = 0;
+ for (; i < dirs.length; i++)
+ escapePath += encodeURIComponent(dirs[i]) + '/';
+
+ return prefix + escapePath.substr(0, escapePath.length - 1);
+ },
+
+ kuki: {
+ prefix: '',
+ duration: 356,
+ domain: '',
+ path: '',
+ secure: false,
+
+ set: function(name, value, duration, domain, path, secure) {
+ name = this.prefix + name;
+ if (duration == null) duration = this.duration;
+ if (secure == null) secure = this.secure;
+ if ((domain == null) && this.domain) domain = this.domain;
+ if ((path == null) && this.path) path = this.path;
+ secure = secure ? true : false;
+
+ var date = new Date();
+ date.setTime(date.getTime() + (duration * 86400000));
+ var expires = date.toGMTString();
+
+ var str = name + '=' + value + '; expires=' + expires;
+ if (domain != null) str += '; domain=' + domain;
+ if (path != null) str += '; path=' + path;
+ if (secure) str += '; secure';
+
+ return (document.cookie = str) ? true : false;
+ },
+
+ get: function(name) {
+ name = this.prefix + name;
+ var nameEQ = name + '=';
+ var kukis = document.cookie.split(';');
+ var kuki;
+
+ for (var i = 0; i < kukis.length; i++) {
+ kuki = kukis[i];
+ while (kuki.charAt(0) == ' ')
+ kuki = kuki.substring(1, kuki.length);
+
+ if (kuki.indexOf(nameEQ) == 0)
+ return kuki.substring(nameEQ.length, kuki.length);
+ }
+
+ return null;
+ },
+
+ del: function(name) {
+ return this.set(name, '', -1);
+ },
+
+ isSet: function(name) {
+ return (this.get(name) != null);
+ }
+ }
+
+ };
+
+})(jQuery);
diff --git a/js/031.jquery.md5.js b/js/031.jquery.md5.js
new file mode 100644
index 0000000..a25c7b3
--- /dev/null
+++ b/js/031.jquery.md5.js
@@ -0,0 +1,212 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Helper MD5 checksum function
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+(function($) {
+
+ $.$.utf8encode = function(string) {
+ string = string.replace(/\r\n/g,"\n");
+ var utftext = "";
+
+ for (var n = 0; n < string.length; n++) {
+
+ var c = string.charCodeAt(n);
+
+ if (c < 128) {
+ utftext += String.fromCharCode(c);
+ } else if((c > 127) && (c < 2048)) {
+ utftext += String.fromCharCode((c >> 6) | 192);
+ utftext += String.fromCharCode((c & 63) | 128);
+ } else {
+ utftext += String.fromCharCode((c >> 12) | 224);
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+
+ }
+
+ return utftext;
+ };
+
+ $.$.md5 = function(string) {
+
+ string = $.$.utf8encode(string);
+
+ var RotateLeft = function(lValue, iShiftBits) {
+ return (lValue<>>(32-iShiftBits));
+ },
+
+ AddUnsigned = function(lX, lY) {
+ var lX8 = (lX & 0x80000000),
+ lY8 = (lY & 0x80000000),
+ lX4 = (lX & 0x40000000),
+ lY4 = (lY & 0x40000000),
+ lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
+ if (lX4 & lY4)
+ return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
+ if (lX4 | lY4)
+ return (lResult & 0x40000000)
+ ? (lResult ^ 0xC0000000 ^ lX8 ^ lY8)
+ : (lResult ^ 0x40000000 ^ lX8 ^ lY8);
+ else
+ return (lResult ^ lX8 ^ lY8);
+ },
+
+ F = function(x, y, z) { return (x & y) | ((~x) & z); },
+ G = function(x, y, z) { return (x & z) | (y & (~z)); },
+ H = function(x, y, z) { return (x ^ y ^ z); },
+ I = function(x, y, z) { return (y ^ (x | (~z))); },
+
+ FF = function(a, b, c, d, x, s, ac) {
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
+ return AddUnsigned(RotateLeft(a, s), b);
+ },
+
+ GG = function(a, b, c, d, x, s, ac) {
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
+ return AddUnsigned(RotateLeft(a, s), b);
+ },
+
+ HH = function(a, b, c, d, x, s, ac) {
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
+ return AddUnsigned(RotateLeft(a, s), b);
+ },
+
+ II = function(a, b, c, d, x, s, ac) {
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
+ return AddUnsigned(RotateLeft(a, s), b);
+ },
+
+ ConvertToWordArray = function(string) {
+ var lWordCount,
+ lMessageLength = string.length,
+ lNumberOfWords_temp1 = lMessageLength + 8,
+ lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64,
+ lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16,
+ lWordArray = [lNumberOfWords - 1],
+ lBytePosition = 0,
+ lByteCount = 0;
+
+ while (lByteCount < lMessageLength) {
+ lWordCount = (lByteCount - (lByteCount % 4)) / 4;
+ lBytePosition = (lByteCount % 4) * 8;
+ lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
+ lByteCount++;
+ }
+
+ lWordCount = (lByteCount - (lByteCount % 4)) / 4;
+ lBytePosition = (lByteCount % 4) * 8;
+ lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
+ lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
+ lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
+
+ return lWordArray;
+ },
+
+ WordToHex = function(lValue) {
+ var lByte, lCount = 0,
+ WordToHexValue = "",
+ WordToHexValue_temp = "";
+
+ for (; lCount <= 3; lCount++) {
+ lByte = (lValue >>> (lCount * 8)) & 255;
+ WordToHexValue_temp = "0" + lByte.toString(16);
+ WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2,2);
+ }
+
+ return WordToHexValue;
+ },
+
+ AA, BB, CC, DD, k = 0,
+ x = ConvertToWordArray(string),
+ a = 0x67452301, b = 0xEFCDAB89,
+ c = 0x98BADCFE, d = 0x10325476,
+ S11 = 7, S12 = 12, S13 = 17, S14 = 22,
+ S21 = 5, S22 = 9, S23 = 14, S24 = 20,
+ S31 = 4, S32 = 11, S33 = 16, S34 = 23,
+ S41 = 6, S42 = 10, S43 = 15, S44 = 21;
+
+ for (; k < x.length; k += 16) {
+ AA = a; BB = b; CC = c; DD = d;
+ a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
+ d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
+ c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
+ b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
+ a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
+ d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
+ c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
+ b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
+ a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
+ d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
+ c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
+ b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
+ a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
+ d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
+ c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
+ b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
+ a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
+ d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
+ c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
+ b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
+ a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
+ d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
+ c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
+ b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
+ a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
+ d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
+ c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
+ b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
+ a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
+ d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
+ c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
+ b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
+ a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
+ d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
+ c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
+ b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
+ a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
+ d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
+ c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
+ b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
+ a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
+ d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
+ c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
+ b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
+ a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
+ d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
+ c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
+ b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
+ a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
+ d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
+ c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
+ b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
+ a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
+ d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
+ c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
+ b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
+ a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
+ d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
+ c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
+ b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
+ a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
+ d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
+ c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
+ b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
+ a = AddUnsigned(a, AA);
+ b = AddUnsigned(b, BB);
+ c = AddUnsigned(c, CC);
+ d = AddUnsigned(d, DD);
+ }
+
+ return (WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d)).toLowerCase();
+ };
+
+})(jQuery);
\ No newline at end of file
diff --git a/js/browser/0bject.js b/js/040.object.js
similarity index 65%
rename from js/browser/0bject.js
rename to js/040.object.js
index 521b1e4..def317f 100644
--- a/js/browser/0bject.js
+++ b/js/040.object.js
@@ -1,18 +1,16 @@
-
* @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
* @link http://kcfinder.sunhater.com
- */?>
+ */
-var browser = {
+var _ = {
opener: {},
support: {},
files: [],
@@ -20,5 +18,6 @@ var browser = {
labels: [],
shows: [],
orders: [],
- cms: ""
+ cms: "",
+ scrollbarWidth: 20
};
diff --git a/js/041.dialogs.js b/js/041.dialogs.js
new file mode 100644
index 0000000..d7fbe0e
--- /dev/null
+++ b/js/041.dialogs.js
@@ -0,0 +1,190 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Dialog boxes functionality
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.alert = function(text, field, options) {
+ var close = !field
+ ? function() {}
+ : ($.isFunction(field)
+ ? field
+ : function() { setTimeout(function() {field.focus(); }, 1); }
+ ),
+ o = {
+ close: function() {
+ close();
+ if ($(this).hasClass('ui-dialog-content'))
+ $(this).dialog('destroy').detach();
+ }
+ };
+
+ $.extend(o, options);
+
+ return _.dialog(_.label("Warning"), text.replace("\n", " \n"), o);
+};
+
+_.confirm = function(text, callback, options) {
+ var o = {
+ buttons: [
+ {
+ text: _.label("Yes"),
+ icons: {primary: "ui-icon-check"},
+ click: function() {
+ callback();
+ $(this).dialog('destroy').detach();
+ }
+ },
+ {
+ text: _.label("No"),
+ icons: {primary: "ui-icon-closethick"},
+ click: function() {
+ $(this).dialog('destroy').detach();
+ }
+ }
+ ]
+ };
+
+ $.extend(o, options);
+ return _.dialog(_.label("Confirmation"), text, o);
+};
+
+_.dialog = function(title, content, options) {
+
+ if (!options) options = {};
+ var dlg = $('
');
+ dlg.hide().attr('title', title).html(content).appendTo('body');
+ if (dlg.find('form').get(0) && !dlg.find('form [type="submit"]').get(0))
+ dlg.find('form').append('Submit ');
+
+ var o = {
+ resizable: false,
+ minHeight: false,
+ modal: true,
+ width: 351,
+ buttons: [
+ {
+ text: _.label("OK"),
+ icons: {primary: "ui-icon-check"},
+ click: function() {
+ if (typeof options.close != "undefined")
+ options.close();
+ if ($(this).hasClass('ui-dialog-content'))
+ $(this).dialog('destroy').detach();
+ }
+ }
+ ],
+ close: function() {
+ if ($(this).hasClass('ui-dialog-content'))
+ $(this).dialog('destroy').detach();
+ },
+ closeText: false,
+ zindex: 1000000,
+ alone: false,
+ blur: false,
+ legend: false,
+ nopadding: false,
+ show: { effect: "fade", duration: 250 },
+ hide: { effect: "fade", duration: 250 }
+ };
+
+ $.extend(o, options);
+
+ if (o.alone)
+ $('.ui-dialog .ui-dialog-content').dialog('destroy').detach();
+
+ dlg.dialog(o);
+
+ if (o.nopadding)
+ dlg.css({padding: 0});
+
+ if (o.blur)
+ dlg.parent().find('.ui-dialog-buttonpane button').first().get(0).blur();
+
+ if (o.legend)
+ dlg.parent().find('.ui-dialog-buttonpane').prepend('' + o.legend + '
');
+
+ if ($.agent && $.agent.firefox)
+ dlg.css('overflow-x', "hidden");
+
+ return dlg;
+};
+
+_.fileNameDialog = function(post, inputName, inputValue, url, labels, callBack, selectAll) {
+ var html = '',
+ submit = function() {
+ var name = dlg.find('[type="text"]').get(0);
+ name.value = $.trim(name.value);
+ if (name.value == "") {
+ _.alert(_.label(labels.errEmpty), function() {
+ name.focus();
+ });
+ return false;
+ } else if (/[\/\\]/g.test(name.value)) {
+ _.alert(_.label(labels.errSlash), function() {
+ name.focus();
+ });
+ return false;
+ } else if (name.value.substr(0, 1) == ".") {
+ _.alert(_.label(labels.errDot), function() {
+ name.focus();
+ });
+ return false;
+ }
+ post[inputName] = name.value;
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: url,
+ data: post,
+ async: false,
+ success: function(data) {
+ if (_.check4errors(data, false))
+ return;
+ if (callBack) callBack(data);
+ dlg.dialog("destroy").detach();
+ },
+ error: function() {
+ _.alert(_.label("Unknown error."));
+ }
+ });
+ return false;
+ },
+ dlg = _.dialog(_.label(labels.title), html, {
+ width: 351,
+ buttons: [
+ {
+ text: _.label("OK"),
+ icons: {primary: "ui-icon-check"},
+ click: function() {
+ submit();
+ }
+ },
+ {
+ text: _.label("Cancel"),
+ icons: {primary: "ui-icon-closethick"},
+ click: function() {
+ $(this).dialog('destroy').detach();
+ }
+ }
+ ]
+ }),
+
+ field = dlg.find('[type="text"]');
+
+ field.transForm().attr('value', inputValue).css('width', 310);
+ dlg.find('form').submit(submit);
+
+ if (!selectAll && /^(.+)\.[^\.]+$/ .test(inputValue))
+ field.selection(0, inputValue.replace(/^(.+)\.[^\.]+$/, "$1").length);
+ else {
+ field.get(0).focus();
+ field.get(0).select();
+ }
+};
\ No newline at end of file
diff --git a/js/050.init.js b/js/050.init.js
new file mode 100644
index 0000000..9aebf07
--- /dev/null
+++ b/js/050.init.js
@@ -0,0 +1,261 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Object initializations
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.init = function() {
+ if (!_.checkAgent()) return;
+
+ $('body').click(function() {
+ _.menu.hide();
+ }).rightClick();
+
+ $('#menu').unbind().click(function() {
+ return false;
+ });
+
+ _.initOpeners();
+ _.initSettings();
+ _.initContent();
+ _.initToolbar();
+ _.initResizer();
+ _.initDropUpload();
+
+ var div = $('
')
+ .css({width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000})
+ .prependTo('body').append('
').find('div').css({width: '100%', height: 200});
+ _.scrollbarWidth = 100 - div.width();
+ div.parent().remove();
+
+ $.each($.agent, function(i) {
+ if (i != "platform")
+ $('body').addClass(i)
+ });
+
+ if ($.agent.platform)
+ $.each($.agent.platform, function(i) {
+ $('body').addClass(i)
+ });
+
+ if ($.mobile)
+ $('body').addClass("mobile");
+};
+
+_.checkAgent = function() {
+ if (($.agent.msie && !$.agent.opera && !$.agent.chromeframe && (parseInt($.agent.msie) < 9)) ||
+ ($.agent.opera && (parseInt($.agent.version) < 10)) ||
+ ($.agent.firefox && (parseFloat($.agent.firefox) < 1.8))
+ ) {
+ var html = '';
+ $('body').html(html);
+ return false;
+ }
+ return true;
+};
+
+_.initOpeners = function() {
+
+ try {
+
+ // TinyMCE 3
+ if (_.opener.name == "tinymce") {
+ if (typeof tinyMCEPopup == "undefined")
+ _.opener.name = null;
+ else
+ _.opener.callBack = true;
+
+ // TinyMCE 4
+ } else if (_.opener.name == "tinymce4")
+ _.opener.callBack = true;
+
+ // CKEditor
+ else if (_.opener.name == "ckeditor") {
+ if (window.parent && window.parent.CKEDITOR)
+ _.opener.CKEditor.object = window.parent.CKEDITOR;
+ else if (window.opener && window.opener.CKEDITOR) {
+ _.opener.CKEditor.object = window.opener.CKEDITOR;
+ _.opener.callBack = true;
+ } else
+ _.opener.CKEditor = null;
+
+ // FCKeditor
+ } else if ((!_.opener.name || (_.opener.name == "fckeditor")) && window.opener && window.opener.SetUrl) {
+ _.opener.name = "fckeditor";
+ _.opener.callBack = true;
+ }
+
+ // Custom callback
+ if (!_.opener.callBack) {
+ if ((window.opener && window.opener.KCFinder && window.opener.KCFinder.callBack) ||
+ (window.parent && window.parent.KCFinder && window.parent.KCFinder.callBack)
+ )
+ _.opener.callBack = window.opener
+ ? window.opener.KCFinder.callBack
+ : window.parent.KCFinder.callBack;
+
+ if ((
+ window.opener &&
+ window.opener.KCFinder &&
+ window.opener.KCFinder.callBackMultiple
+ ) || (
+ window.parent &&
+ window.parent.KCFinder &&
+ window.parent.KCFinder.callBackMultiple
+ )
+ )
+ _.opener.callBackMultiple = window.opener
+ ? window.opener.KCFinder.callBackMultiple
+ : window.parent.KCFinder.callBackMultiple;
+ }
+
+ } catch(e) {}
+};
+
+_.initContent = function() {
+ $('div#folders').html(_.label("Loading folders..."));
+ $('div#files').html(_.label("Loading files..."));
+ $.ajax({
+ type: "get",
+ dataType: "json",
+ url: _.getURL("init"),
+ async: false,
+ success: function(data) {
+ if (_.check4errors(data))
+ return;
+ _.dirWritable = data.dirWritable;
+ $('#folders').html(_.buildTree(data.tree));
+ _.setTreeData(data.tree);
+ _.setTitle("KCFinder: /" + _.dir);
+ _.initFolders();
+ _.files = data.files ? data.files : [];
+ _.orderFiles();
+ },
+ error: function() {
+ $('div#folders').html(_.label("Unknown error."));
+ $('div#files').html(_.label("Unknown error."));
+ }
+ });
+};
+
+_.initResizer = function() {
+ var cursor = ($.agent.opera) ? 'move' : 'col-resize';
+ $('#resizer').css('cursor', cursor).draggable({
+ axis: 'x',
+ start: function() {
+ $(this).css({
+ opacity: "0.4",
+ filter: "alpha(opacity=40)"
+ });
+ $('#all').css('cursor', cursor);
+ },
+ stop: function() {
+ $(this).css({
+ opacity: "0",
+ filter: "alpha(opacity=0)"
+ });
+ $('#all').css('cursor', "");
+
+ var jLeft = $('#left'),
+ jRight = $('#right'),
+ jFiles = $('#files'),
+ jFolders = $('#folders'),
+ left = parseInt($(this).css('left')) + parseInt($(this).css('width')),
+ w = 0, r;
+
+ $('#toolbar a').each(function() {
+ if ($(this).css('display') != "none")
+ w += $(this).outerWidth(true);
+ });
+
+ r = $(window).width() - w;
+
+ if (left < 100)
+ left = 100;
+
+ if (left > r)
+ left = r;
+
+ var right = $(window).width() - left;
+
+ jLeft.css('width', left);
+ jRight.css('width', right);
+ jFiles.css('width', jRight.innerWidth() - jFiles.outerHSpace());
+
+ $('#resizer').css({
+ left: jLeft.outerWidth() - jFolders.outerRightSpace('m'),
+ width: jFolders.outerRightSpace('m') + jFiles.outerLeftSpace('m')
+ });
+
+ _.fixFilesHeight();
+ _.fixScrollRadius();
+ }
+ });
+};
+
+_.resize = function() {
+ var jLeft = $('#left'),
+ jRight = $('#right'),
+ jStatus = $('#status'),
+ jFolders = $('#folders'),
+ jFiles = $('#files'),
+ jResizer = $('#resizer'),
+ jWindow = $(window);
+
+ jLeft.css({
+ width: "25%",
+ height: jWindow.height() - jStatus.outerHeight()
+ });
+ jRight.css({
+ width: "75%",
+ height: jWindow.height() - jStatus.outerHeight()
+ });
+ $('#toolbar').css('height', $('#toolbar a').outerHeight());
+
+ jResizer.css('height', $(window).height());
+
+ jFolders.css('height', jLeft.outerHeight() - jFolders.outerVSpace());
+ _.fixFilesHeight();
+ jStatus.css('width', jLeft.outerWidth() + jRight.outerWidth() - jStatus.outerHSpace('p'));
+ jFiles.css('width', jRight.innerWidth() - jFiles.outerHSpace());
+ jResizer.css({
+ left: jLeft.outerWidth() - jFolders.outerRightSpace('m'),
+ width: jFolders.outerRightSpace('m') + jFiles.outerLeftSpace('m')
+ });
+ _.fixScrollRadius();
+};
+
+_.setTitle = function(title) {
+ document.title = title;
+ if (_.opener.name == "tinymce")
+ tinyMCEPopup.editor.windowManager.setTitle(window, title);
+ else if (_.opener.name == "tinymce4") {
+ var ifr = $('iframe[src*="browse.php?opener=tinymce4&"]', window.parent.document),
+ path = ifr.attr('src').split('browse.php?')[0];
+ ifr.parent().parent().find('div.mce-title').html('' + title + ' ');
+ }
+};
+
+_.fixFilesHeight = function() {
+ var jFiles = $('#files'),
+ jSettings = $('#settings');
+
+ jFiles.css('height',
+ $('#left').outerHeight() - $('#toolbar').outerHeight() - jFiles.outerVSpace() -
+ ((jSettings.css('display') != "none") ? jSettings.outerHeight() : 0)
+ );
+};
+
+_.fixScrollRadius = function() {
+ $('#folders').fixScrollbarRadius();
+ $('#files').fixScrollbarRadius();
+};
\ No newline at end of file
diff --git a/js/060.toolbar.js b/js/060.toolbar.js
new file mode 100644
index 0000000..f83a86e
--- /dev/null
+++ b/js/060.toolbar.js
@@ -0,0 +1,312 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Toolbar functionality
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.initToolbar = function() {
+ $('#toolbar').disableTextSelect();
+ $('#toolbar a').click(function() {
+ _.menu.hide();
+ });
+
+ if (!$.$.kuki.isSet('displaySettings'))
+ $.$.kuki.set('displaySettings', "off");
+
+ if ($.$.kuki.get('displaySettings') == "on") {
+ $('#toolbar a[href="kcact:settings"]').addClass('selected');
+ $('#settings').show();
+ _.resize();
+ $('#lang').transForm();
+ }
+
+ $('#toolbar a[href="kcact:settings"]').click(function () {
+ var jSettings = $('#settings');
+ if (jSettings.css('display') == "none") {
+ $(this).addClass('selected');
+ $.$.kuki.set('displaySettings', "on");
+ jSettings.show();
+ _.fixFilesHeight();
+ if (!jSettings.find('.tf-select #lang').get(0))
+ $('#lang').transForm();
+ } else {
+ $(this).removeClass('selected');
+ $.$.kuki.set('displaySettings', "off");
+ jSettings.hide();
+ _.fixFilesHeight();
+ }
+ return false;
+ });
+
+ $('#toolbar a[href="kcact:refresh"]').click(function() {
+ _.refresh();
+ return false;
+ });
+
+ $('#toolbar a[href="kcact:maximize"]').click(function() {
+ _.maximize(this);
+ return false;
+ });
+
+ $('#toolbar a[href="kcact:about"]').click(function() {
+ var html = '' +
+ '
';
+ if (_.support.check4Update)
+ html += '
' + _.label("Checking for new version...") + '
';
+ html +=
+ '
' +
+ '
Copyright ©2010-2014 Pavel Tzonkov
' +
+ '
';
+
+ var dlg = _.dialog(_.label("About"), html, {width: 301});
+
+ setTimeout(function() {
+ $.ajax({
+ dataType: "json",
+ url: _.getURL('check4Update'),
+ async: true,
+ success: function(data) {
+ if (!dlg.html().length)
+ return;
+ var span = $('#checkver');
+ span.removeClass('loading');
+ if (!data.version) {
+ span.html(_.label("Unable to connect!"));
+ return;
+ }
+ if (_.version < data.version)
+ span.html('' + _.label("Download version {version} now!", {version: data.version}) + ' ');
+ else
+ span.html(_.label("KCFinder is up to date!"));
+ },
+ error: function() {
+ if (!dlg.html().length)
+ return;
+ $('#checkver').removeClass('loading').html(_.label("Unable to connect!"));
+ }
+ });
+ }, 1000);
+
+ return false;
+ });
+
+ _.initUploadButton();
+};
+
+_.initUploadButton = function() {
+ var btn = $('#toolbar a[href="kcact:upload"]');
+ if (!_.access.files.upload) {
+ btn.hide();
+ return;
+ }
+ var top = btn.get(0).offsetTop,
+ width = btn.outerWidth(),
+ height = btn.outerHeight(),
+ jInput = $('#upload input');
+
+ $('#toolbar').prepend('
');
+ jInput.css('margin-left', "-" + (jInput.outerWidth() - width));
+ $('#upload').mouseover(function() {
+ $('#toolbar a[href="kcact:upload"]').addClass('hover');
+ }).mouseout(function() {
+ $('#toolbar a[href="kcact:upload"]').removeClass('hover');
+ });
+};
+
+_.uploadFile = function(form) {
+ if (!_.dirWritable) {
+ _.alert(_.label("Cannot write to upload folder."));
+ $('#upload').detach();
+ _.initUploadButton();
+ return;
+ }
+ form.elements[1].value = _.dir;
+ $('').prependTo(document.body);
+ $('#loading').html(_.label("Uploading file...")).show();
+ form.submit();
+ $('#uploadResponse').load(function() {
+ var response = $(this).contents().find('body').text();
+ $('#loading').hide();
+ response = response.split("\n");
+
+ var selected = [], errors = [];
+ $.each(response, function(i, row) {
+ if (row.substr(0, 1) == "/")
+ selected[selected.length] = row.substr(1, row.length - 1);
+ else
+ errors[errors.length] = row;
+ });
+ if (errors.length) {
+ errors = errors.join("\n");
+ if (errors.replace(/^\s+/g, "").replace(/\s+$/g, "").length)
+ _.alert(errors);
+ }
+ if (!selected.length)
+ selected = null;
+ _.refresh(selected);
+ $('#upload').detach();
+ setTimeout(function() {
+ $('#uploadResponse').detach();
+ }, 1);
+ _.initUploadButton();
+ });
+};
+
+_.maximize = function(button) {
+
+ // TINYMCE 3
+ if (_.opener.name == "tinymce") {
+
+ var par = window.parent.document,
+ ifr = $('iframe[src*="browse.php?opener=tinymce&"]', par),
+ id = parseInt(ifr.attr('id').replace(/^mce_(\d+)_ifr$/, "$1")),
+ win = $('#mce_' + id, par);
+
+ if ($(button).hasClass('selected')) {
+ $(button).removeClass('selected');
+ win.css({
+ left: _.maximizeMCE.left,
+ top: _.maximizeMCE.top,
+ width: _.maximizeMCE.width,
+ height: _.maximizeMCE.height
+ });
+ ifr.css({
+ width: _.maximizeMCE.width - _.maximizeMCE.Hspace,
+ height: _.maximizeMCE.height - _.maximizeMCE.Vspace
+ });
+
+ } else {
+ $(button).addClass('selected')
+ _.maximizeMCE = {
+ width: parseInt(win.css('width')),
+ height: parseInt(win.css('height')),
+ left: win.position().left,
+ top: win.position().top,
+ Hspace: parseInt(win.css('width')) - parseInt(ifr.css('width')),
+ Vspace: parseInt(win.css('height')) - parseInt(ifr.css('height'))
+ };
+ var width = $(window.top).width(),
+ height = $(window.top).height();
+ win.css({
+ left: $(window.parent).scrollLeft(),
+ top: $(window.parent).scrollTop(),
+ width: width,
+ height: height
+ });
+ ifr.css({
+ width: width - _.maximizeMCE.Hspace,
+ height: height - _.maximizeMCE.Vspace
+ });
+ }
+
+ // TINYMCE 4
+ } else if (_.opener.name == "tinymce4") {
+
+ var par = window.parent.document,
+ ifr = $('iframe[src*="browse.php?opener=tinymce4&"]', par).parent(),
+ win = ifr.parent();
+
+ if ($(button).hasClass('selected')) {
+ $(button).removeClass('selected');
+
+ win.css({
+ left: _.maximizeMCE4.left,
+ top: _.maximizeMCE4.top,
+ width: _.maximizeMCE4.width,
+ height: _.maximizeMCE4.height
+ });
+
+ ifr.css({
+ width: _.maximizeMCE4.width,
+ height: _.maximizeMCE4.height - _.maximizeMCE4.Vspace
+ });
+
+ } else {
+ $(button).addClass('selected');
+
+ _.maximizeMCE4 = {
+ width: parseInt(win.css('width')),
+ height: parseInt(win.css('height')),
+ left: win.position().left,
+ top: win.position().top,
+ Vspace: win.outerHeight(true) - ifr.outerHeight(true) - 1
+ };
+
+ var width = $(window.top).width(),
+ height = $(window.top).height();
+
+ win.css({
+ left: 0,
+ top: 0,
+ width: width,
+ height: height
+ });
+
+ ifr.css({
+ width: width,
+ height: height - _.maximizeMCE4.Vspace
+ });
+ }
+
+ // PUPUP WINDOW
+ } else if (window.opener) {
+ window.moveTo(0, 0);
+ width = screen.availWidth;
+ height = screen.availHeight;
+ if ($.agent.opera)
+ height -= 50;
+ window.resizeTo(width, height);
+
+ } else {
+ if (window.parent) {
+ var el = null;
+ $(window.parent.document).find('iframe').each(function() {
+ if (this.src.replace('/?', '?') == window.location.href.replace('/?', '?')) {
+ el = this;
+ return false;
+ }
+ });
+
+ // IFRAME
+ if (el !== null)
+ $(el).toggleFullscreen(window.parent.document);
+
+ // SELF WINDOW
+ else
+ $('body').toggleFullscreen();
+
+ } else
+ $('body').toggleFullscreen();
+ }
+};
+
+_.refresh = function(selected) {
+ _.fadeFiles();
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("chDir"),
+ data: {dir: _.dir},
+ async: false,
+ success: function(data) {
+ if (_.check4errors(data)) {
+ $('#files > div').css({opacity: "", filter: ""});
+ return;
+ }
+ _.dirWritable = data.dirWritable;
+ _.files = data.files ? data.files : [];
+ _.orderFiles(null, selected);
+ _.statusDir();
+ },
+ error: function() {
+ $('#files > div').css({opacity: "", filter: ""});
+ $('#files').html(_.label("Unknown error."));
+ }
+ });
+};
diff --git a/js/070.settings.js b/js/070.settings.js
new file mode 100644
index 0000000..5d6886b
--- /dev/null
+++ b/js/070.settings.js
@@ -0,0 +1,101 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Settings panel functionality
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.initSettings = function() {
+ $('#settings fieldset').disableTextSelect();
+
+ if (!_.shows.length)
+ $('#show input[type="checkbox"]').each(function(i) {
+ _.shows[i] = this.name;
+ });
+
+ var shows = _.shows;
+
+ if (!$.$.kuki.isSet('showname')) {
+ $.$.kuki.set('showname', "on");
+ $.each(shows, function (i, val) {
+ if (val != "name") $.$.kuki.set('show' + val, "off");
+ });
+ }
+
+ $('#show input[type="checkbox"]').click(function() {
+ $.$.kuki.set('show' + this.name, this.checked ? "on" : "off")
+ $('#files .file div.' + this.name).css('display', this.checked ? "block" : "none");
+ });
+
+ $.each(shows, function(i, val) {
+ $('#show input[name="' + val + '"]').get(0).checked = ($.$.kuki.get('show' + val) == "on") ? "checked" : "";
+ });
+
+ if (!_.orders.length)
+ $('#order input[type="radio"]').each(function(i) {
+ _.orders[i] = this.value;
+ })
+
+ var orders = _.orders;
+
+ if (!$.$.kuki.isSet('order'))
+ $.$.kuki.set('order', "name");
+
+ if (!$.$.kuki.isSet('orderDesc'))
+ $.$.kuki.set('orderDesc', "off");
+
+ $('#order input[value="' + $.$.kuki.get('order') + '"]').get(0).checked = true;
+ $('#order input[name="desc"]').get(0).checked = ($.$.kuki.get('orderDesc') == "on");
+
+ $('#order input[type="radio"]').click(function() {
+ $.$.kuki.set('order', this.value);
+ _.orderFiles();
+ });
+
+ $('#order input[name="desc"]').click(function() {
+ $.$.kuki.set('orderDesc', this.checked ? 'on' : "off");
+ _.orderFiles();
+ });
+
+ if (!$.$.kuki.isSet('view'))
+ $.$.kuki.set('view', "thumbs");
+
+ if ($.$.kuki.get('view') == "list")
+ $('#show').parent().hide();
+
+ $('#view input[value="' + $.$.kuki.get('view') + '"]').get(0).checked = true;
+
+ $('#view input').click(function() {
+ var view = this.value;
+ if ($.$.kuki.get('view') != view) {
+ $.$.kuki.set('view', view);
+ if (view == "list")
+ $('#show').parent().hide();
+ else
+ $('#show').parent().show();
+ }
+ _.fixFilesHeight();
+ _.refresh();
+ });
+ $('#settings fieldset, #settings input, #settings label').transForm();
+ _.initLangs();
+};
+
+
+_.initLangs = function() {
+ $.each(_.langs, function(id, lng) {
+ var opt = $(' ');
+ opt.val(id).text(lng);
+ if (id == _.lang)
+ opt.attr({selected: true});
+ $('#lang').append(opt);
+ });
+ $('#lang').change(function() {
+ window.location = _.getURL("browser", this.value) + "&theme=" + encodeURIComponent(_.theme);
+ });
+}
\ No newline at end of file
diff --git a/js/080.files.js b/js/080.files.js
new file mode 100644
index 0000000..f3b5507
--- /dev/null
+++ b/js/080.files.js
@@ -0,0 +1,249 @@
+/** This file is part of KCFinder project
+ *
+ * @desc File related functionality
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.initFiles = function() {
+ $(document).unbind('keydown').keydown(function(e) {
+ return !_.selectAll(e);
+ });
+ $('#files').unbind().scroll(function() {
+ _.menu.hide();
+ }).disableTextSelect();
+
+ $('.file').unbind().click(function(e) {
+ _.selectFile($(this), e);
+
+ }).rightClick(function(el, e) {
+ _.menuFile($(el), e);
+ }).dblclick(function() {
+ _.returnFile($(this));
+ });
+
+ if ($.mobile)
+ $('.file').on('taphold', function() {
+ _.menuFile($(this), {
+ pageX: $(this).offset().left,
+ pageY: $(this).offset().top + $(this).outerHeight()
+ });
+ });
+
+ $.each(_.shows, function(i, val) {
+ $('#files .file div.' + val).css('display', ($.$.kuki.get('show' + val) == "off") ? "none" : "block");
+ });
+ _.statusDir();
+};
+
+_.showFiles = function(callBack, selected) {
+ _.fadeFiles();
+ setTimeout(function() {
+ var c = $('
');
+
+ $.each(_.files, function(i, file) {
+ var f, icon,
+ stamp = file.size + "|" + file.mtime;
+
+ // List
+ if ($.$.kuki.get('view') == "list") {
+ if (!i) c.html('');
+
+ icon = $.$.getFileExtension(file.name);
+ if (file.thumb)
+ icon = ".image";
+ else if (!icon.length || !file.smallIcon)
+ icon = ".";
+ icon = "themes/" + _.theme + "/img/files/small/" + icon + ".png";
+
+ f = $(' ');
+ f.appendTo(c.find('table'));
+
+ // Thumbnails
+ } else {
+ if (file.thumb)
+ icon = _.getURL('thumb') + "&file=" + encodeURIComponent(file.name) + "&dir=" + encodeURIComponent(_.dir) + "&stamp=" + stamp;
+ else if (file.smallThumb) {
+ icon = _.uploadURL + "/" + _.dir + "/" + encodeURIComponent(file.name);
+ icon = $.$.escapeDirs(icon).replace(/\'/g, "%27");
+ } else {
+ icon = file.bigIcon ? $.$.getFileExtension(file.name) : ".";
+ if (!icon.length) icon = ".";
+ icon = "themes/" + _.theme + "/img/files/big/" + icon + ".png";
+ }
+ f = $('');
+ f.appendTo(c);
+ }
+
+ f.find('.thumb').css({backgroundImage: 'url("' + icon + '")'});
+ f.find('.name').text(file.name);
+ f.find('.time').html(file.date);
+ f.find('.size').html(_.humanSize(file.size));
+ f.data(file);
+
+ if ((file.name === selected) || $.$.inArray(file.name, selected))
+ f.addClass('selected');
+ });
+
+ c.css({opacity:'', filter:''});
+ $('#files').html(c);
+
+ if (callBack) callBack();
+ _.initFiles();
+ _.fixScrollRadius();
+ }, 200);
+};
+
+_.selectFile = function(file, e) {
+
+ // Click with Ctrl, Meta or Shift key
+ if (e.ctrlKey || e.metaKey || e.shiftKey) {
+
+ // Click with Shift key
+ if (e.shiftKey && !file.hasClass('selected')) {
+ var f = file.prev();
+ while (f.get(0) && !f.hasClass('selected')) {
+ f.addClass('selected');
+ f = f.prev();
+ }
+ }
+
+ file.toggleClass('selected');
+
+ // Update statusbar
+ var files = $('.file.selected').get(),
+ size = 0, data;
+ if (!files.length)
+ _.statusDir();
+ else {
+ $.each(files, function(i, cfile) {
+ size += $(cfile).data('size');
+ });
+ size = _.humanSize(size);
+ if (files.length > 1)
+ $('#fileinfo').html(files.length + " " + _.label("selected files") + " (" + size + ")");
+ else {
+ data = $(files[0]).data();
+ $('#fileinfo').text(data.name + " (" + _.humanSize(data.size) + ", " + data.date + ")");
+ }
+ }
+
+ // Normal click
+ } else {
+ data = file.data();
+ $('.file').removeClass('selected');
+ file.addClass('selected');
+ $('#fileinfo').text(data.name + " (" + _.humanSize(data.size) + ", " + data.date + ")");
+ }
+};
+
+_.selectAll = function(e) {
+ if ((!e.ctrlKey && !e.metaKey) || ((e.keyCode != 65) && (e.keyCode != 97))) // Ctrl-A
+ return false;
+
+ var files = $('.file'),
+ size = 0;
+
+ if (files.length) {
+
+ files.addClass('selected').each(function() {
+ size += $(this).data('size');
+ });
+
+ $('#fileinfo').html(files.length + " " + _.label("selected files") + " (" + _.humanSize(size) + ")");
+ }
+
+ return true;
+};
+
+_.returnFile = function(file) {
+
+ var button, win, fileURL = file.substr
+ ? file : _.uploadURL + "/" + _.dir + "/" + file.data('name');
+ fileURL = $.$.escapeDirs(fileURL);
+
+ if (_.opener.name == "ckeditor") {
+ _.opener.CKEditor.object.tools.callFunction(_.opener.CKEditor.funcNum, fileURL, "");
+ window.close();
+
+ } else if (_.opener.name == "fckeditor") {
+ window.opener.SetUrl(fileURL) ;
+ window.close() ;
+
+ } else if (_.opener.name == "tinymce") {
+ win = tinyMCEPopup.getWindowArg('window');
+ win.document.getElementById(tinyMCEPopup.getWindowArg('input')).value = fileURL;
+ if (win.getImageData) win.getImageData();
+ if (typeof(win.ImageDialog) != "undefined") {
+ if (win.ImageDialog.getImageData)
+ win.ImageDialog.getImageData();
+ if (win.ImageDialog.showPreviewImage)
+ win.ImageDialog.showPreviewImage(fileURL);
+ }
+ tinyMCEPopup.close();
+
+ } else if (_.opener.name == "tinymce4") {
+ win = (window.opener ? window.opener : window.parent);
+ $(win.document).find('#' + _.opener.TinyMCE.field).val(fileURL);
+ win.tinyMCE.activeEditor.windowManager.close();
+
+ } else if (_.opener.callBack) {
+
+ if (window.opener && window.opener.KCFinder) {
+ _.opener.callBack(fileURL);
+ window.close();
+ }
+
+ if (window.parent && window.parent.KCFinder) {
+ button = $('#toolbar a[href="kcact:maximize"]');
+ if (button.hasClass('selected'))
+ _.maximize(button);
+ _.opener.callBack(fileURL);
+ }
+
+ } else if (_.opener.callBackMultiple) {
+ if (window.opener && window.opener.KCFinder) {
+ _.opener.callBackMultiple([fileURL]);
+ window.close();
+ }
+
+ if (window.parent && window.parent.KCFinder) {
+ button = $('#toolbar a[href="kcact:maximize"]');
+ if (button.hasClass('selected'))
+ _.maximize(button);
+ _.opener.callBackMultiple([fileURL]);
+ }
+
+ }
+};
+
+_.returnFiles = function(files) {
+ if (_.opener.callBackMultiple && files.length) {
+ var rfiles = [];
+ $.each(files, function(i, file) {
+ rfiles[i] = _.uploadURL + "/" + _.dir + "/" + $(file).data('name');
+ rfiles[i] = $.$.escapeDirs(rfiles[i]);
+ });
+ _.opener.callBackMultiple(rfiles);
+ if (window.opener) window.close()
+ }
+};
+
+_.returnThumbnails = function(files) {
+ if (_.opener.callBackMultiple) {
+ var rfiles = [], j = 0;
+ $.each(files, function(i, file) {
+ if ($(file).data('thumb')) {
+ rfiles[j] = _.thumbsURL + "/" + _.dir + "/" + $(file).data('name');
+ rfiles[j] = $.$.escapeDirs(rfiles[j++]);
+ }
+ });
+ _.opener.callBackMultiple(rfiles);
+ if (window.opener) window.close()
+ }
+};
diff --git a/js/090.folders.js b/js/090.folders.js
new file mode 100644
index 0000000..792113f
--- /dev/null
+++ b/js/090.folders.js
@@ -0,0 +1,193 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Folder related functionality
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.initFolders = function() {
+ $('#folders').scroll(function() {
+ _.menu.hide();
+ }).disableTextSelect();
+ $('div.folder > a').unbind().click(function() {
+ _.menu.hide();
+ return false;
+ });
+ $('div.folder > a > span.brace').unbind().click(function() {
+ if ($(this).hasClass('opened') || $(this).hasClass('closed'))
+ _.expandDir($(this).parent());
+ });
+ $('div.folder > a > span.folder').unbind().click(function() {
+ _.changeDir($(this).parent());
+ }).rightClick(function(el, e) {
+ _.menuDir($(el).parent(), e);
+ });
+ if ($.mobile)
+ $('div.folder > a > span.folder').on('taphold', function() {
+ _.menuDir($(this).parent(), {
+ pageX: $(this).offset().left + 1,
+ pageY: $(this).offset().top + $(this).outerHeight()
+ });
+ });
+
+};
+
+_.setTreeData = function(data, path) {
+ if (!path)
+ path = "";
+ else if (path.length && (path.substr(path.length - 1, 1) != '/'))
+ path += "/";
+ path += data.name;
+ var selector = '#folders a[href="kcdir:/' + $.$.escapeDirs(path) + '"]';
+ $(selector).data({
+ name: data.name,
+ path: path,
+ readable: data.readable,
+ writable: data.writable,
+ removable: data.removable,
+ hasDirs: data.hasDirs
+ });
+ $(selector + ' span.folder').addClass(data.current ? 'current' : 'regular');
+ if (data.dirs && data.dirs.length) {
+ $(selector + ' span.brace').addClass('opened');
+ $.each(data.dirs, function(i, cdir) {
+ _.setTreeData(cdir, path + "/");
+ });
+ } else if (data.hasDirs)
+ $(selector + ' span.brace').addClass('closed');
+};
+
+_.buildTree = function(root, path) {
+ if (!path) path = "";
+ path += root.name;
+ var cdir, html = ' ' + $.$.htmlData(root.name) + ' ';
+ if (root.dirs) {
+ html += '
';
+ for (var i = 0; i < root.dirs.length; i++) {
+ cdir = root.dirs[i];
+ html += _.buildTree(cdir, path + "/");
+ }
+ html += '
';
+ }
+ html += '
';
+ return html;
+};
+
+_.expandDir = function(dir) {
+ var path = dir.data('path');
+ if (dir.children('.brace').hasClass('opened')) {
+ dir.parent().children('.folders').hide(500, function() {
+ if (path == _.dir.substr(0, path.length))
+ _.changeDir(dir);
+ _.fixScrollRadius();
+ });
+ dir.children('.brace').removeClass('opened').addClass('closed');
+ } else {
+ if (dir.parent().children('.folders').get(0)) {
+ dir.parent().children('.folders').show(500, function() {
+ _.fixScrollRadius();
+ });
+ dir.children('.brace').removeClass('closed').addClass('opened');
+ } else if (!$('#loadingDirs').get(0)) {
+ dir.parent().append('' + _.label("Loading folders...") + '
');
+ $('#loadingDirs').hide().show(200, function() {
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("expand"),
+ data: {dir: path},
+ async: false,
+ success: function(data) {
+ $('#loadingDirs').hide(200, function() {
+ $('#loadingDirs').detach();
+ });
+ if (_.check4errors(data))
+ return;
+
+ var html = "";
+ $.each(data.dirs, function(i, cdir) {
+ html += '';
+ });
+ if (html.length) {
+ dir.parent().append('' + html + '
');
+ var folders = $(dir.parent().children('.folders').first());
+ folders.hide();
+ $(folders).show(500, function() {
+ _.fixScrollRadius();
+ });
+ $.each(data.dirs, function(i, cdir) {
+ _.setTreeData(cdir, path);
+ });
+ }
+ if (data.dirs.length)
+ dir.children('.brace').removeClass('closed').addClass('opened');
+ else
+ dir.children('.brace').removeClass('opened closed');
+ _.initFolders();
+ _.initDropUpload();
+ _.fixScrollRadius();
+ },
+ error: function() {
+ $('#loadingDirs').detach();
+ _.alert(_.label("Unknown error."));
+ _.fixScrollRadius();
+ }
+ });
+ _.fixScrollRadius();
+ });
+ }
+ }
+};
+
+_.changeDir = function(dir) {
+ if (dir.children('span.folder').hasClass('regular')) {
+ $('div.folder > a > span.folder').removeClass('current regular').addClass('regular');
+ dir.children('span.folder').removeClass('regular').addClass('current');
+ $('#files').html(_.label("Loading files..."));
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("chDir"),
+ data: {dir: dir.data('path')},
+ async: false,
+ success: function(data) {
+ if (_.check4errors(data))
+ return;
+ _.files = data.files;
+ _.orderFiles();
+ _.dir = dir.data('path');
+ _.dirWritable = data.dirWritable;
+ _.setTitle("KCFinder: /" + _.dir);
+ _.statusDir();
+ _.initDropUpload();
+ },
+ error: function() {
+ $('#files').html(_.label("Unknown error."));
+ }
+ });
+ }
+};
+
+_.statusDir = function() {
+ var i = 0, size = 0;
+ for (; i < _.files.length; i++)
+ size += _.files[i].size;
+ size = _.humanSize(size);
+ $('#fileinfo').html(_.files.length + " " + _.label("files") + " (" + size + ")");
+};
+
+_.refreshDir = function(dir) {
+ var path = dir.data('path');
+ if (dir.children('.brace').hasClass('opened') || dir.children('.brace').hasClass('closed'))
+ dir.children('.brace').removeClass('opened').addClass('closed');
+ dir.parent().children('.folders').first().detach();
+ if (path == _.dir.substr(0, path.length))
+ _.changeDir(dir);
+ _.expandDir(dir);
+ return true;
+};
diff --git a/js/091.menus.js b/js/091.menus.js
new file mode 100644
index 0000000..b6f093d
--- /dev/null
+++ b/js/091.menus.js
@@ -0,0 +1,589 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Context menus
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.menu = {
+
+ init: function() {
+ $('#menu').html("").css('display', 'none');
+ },
+
+ addItem: function(href, label, callback, denied) {
+ if (typeof denied == "undefined")
+ denied = false;
+
+ $('#menu ul').append('' + label + ' ');
+
+ if (!denied && $.isFunction(callback))
+ $('#menu a[href="' + href + '"]').click(function() {
+ _.menu.hide();
+ return callback();
+ });
+ },
+
+ addDivider: function() {
+ if ($('#menu ul').html().length)
+ $('#menu ul').append("- ");
+ },
+
+ show: function(e) {
+ var dlg = $('#menu'),
+ ul = $('#menu ul');
+ if (ul.html().length) {
+ dlg.find('ul').first().menu();
+ if (typeof e != "undefined") {
+ var left = e.pageX,
+ top = e.pageY,
+ win = $(window);
+
+ if ((dlg.outerWidth() + left) > win.width())
+ left = win.width() - dlg.outerWidth();
+
+ if ((dlg.outerHeight() + top) > win.height())
+ top = win.height() - dlg.outerHeight();
+
+ dlg.hide().css({
+ left: left,
+ top: top,
+ width: ""
+ }).fadeIn('fast');
+ } else
+ dlg.fadeIn('fast');
+ } else
+ ul.detach();
+ },
+
+ hide: function() {
+ $('#clipboard').removeClass('selected');
+ $('div.folder > a > span.folder').removeClass('context');
+ $('#menu').hide().css('width', "").html("").data('title', null).unbind().click(function() {
+ return false;
+ });
+ $(document).unbind('keydown').keydown(function(e) {
+ return !_.selectAll(e);
+ });
+ }
+};
+
+// FILE CONTEXT MENU
+_.menuFile = function(file, e) {
+ _.menu.init();
+
+ var data = file.data(),
+ files = $('.file.selected').get();
+
+ // MULTIPLE FILES MENU
+ if (file.hasClass('selected') && files.length && (files.length > 1)) {
+ var thumb = false,
+ notWritable = 0,
+ cdata;
+
+ $.each(files, function(i, cfile) {
+ cdata = $(cfile).data();
+ if (cdata.thumb) thumb = true;
+ if (!data.writable) notWritable++;
+ });
+
+ if (_.opener.callBackMultiple) {
+
+ // SELECT FILES
+ _.menu.addItem("kcact:pick", _.label("Select"), function() {
+ _.returnFiles(files);
+ return false;
+ });
+
+ // SELECT THUMBNAILS
+ if (thumb)
+ _.menu.addItem("kcact:pick_thumb", _.label("Select Thumbnails"), function() {
+ _.returnThumbnails(files);
+ return false;
+ });
+ }
+
+ if (data.thumb || data.smallThumb || _.support.zip) {
+
+ _.menu.addDivider();
+
+ // VIEW IMAGE
+ if (data.thumb || data.smallThumb)
+ _.menu.addItem("kcact:view", _.label("View"), function() {
+ _.viewImage(data);
+ });
+
+ // DOWNLOAD
+ if (_.support.zip)
+ _.menu.addItem("kcact:download", _.label("Download"), function() {
+ var pfiles = [];
+ $.each(files, function(i, cfile) {
+ pfiles[i] = $(cfile).data('name');
+ });
+ _.post(_.getURL('downloadSelected'), {dir:_.dir, files:pfiles});
+ return false;
+ });
+ }
+
+ // ADD TO CLIPBOARD
+ if (_.access.files.copy || _.access.files.move) {
+ _.menu.addDivider();
+ _.menu.addItem("kcact:clpbrdadd", _.label("Add to Clipboard"), function() {
+ var msg = '';
+ $.each(files, function(i, cfile) {
+ var cdata = $(cfile).data(),
+ failed = false;
+ for (i = 0; i < _.clipboard.length; i++)
+ if ((_.clipboard[i].name == cdata.name) &&
+ (_.clipboard[i].dir == _.dir)
+ ) {
+ failed = true;
+ msg += cdata.name + ": " + _.label("This file is already added to the Clipboard.") + "\n";
+ break;
+ }
+
+ if (!failed) {
+ cdata.dir = _.dir;
+ _.clipboard[_.clipboard.length] = cdata;
+ }
+ });
+ _.initClipboard();
+ if (msg.length) _.alert(msg.substr(0, msg.length - 1));
+ return false;
+ });
+ }
+
+ // DELETE
+ if (_.access.files['delete']) {
+ _.menu.addDivider();
+ _.menu.addItem("kcact:rm", _.label("Delete"), function() {
+ if ($(this).hasClass('denied')) return false;
+ var failed = 0,
+ dfiles = [];
+ $.each(files, function(i, cfile) {
+ var cdata = $(cfile).data();
+ if (!cdata.writable)
+ failed++;
+ else
+ dfiles[dfiles.length] = _.dir + "/" + cdata.name;
+ });
+ if (failed == files.length) {
+ _.alert(_.label("The selected files are not removable."));
+ return false;
+ }
+
+ var go = function(callBack) {
+ _.fadeFiles();
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("rm_cbd"),
+ data: {files:dfiles},
+ async: false,
+ success: function(data) {
+ if (callBack) callBack();
+ _.check4errors(data);
+ _.refresh();
+ },
+ error: function() {
+ if (callBack) callBack();
+ $('#files > div').css({
+ opacity: "",
+ filter: ""
+ });
+ _.alert(_.label("Unknown error."));
+ }
+ });
+ };
+
+ if (failed)
+ _.confirm(
+ _.label("{count} selected files are not removable. Do you want to delete the rest?", {count:failed}),
+ go
+ );
+
+ else
+ _.confirm(
+ _.label("Are you sure you want to delete all selected files?"),
+ go
+ );
+
+ return false;
+ }, (notWritable == files.length));
+ }
+
+ _.menu.show(e);
+
+ // SINGLE FILE MENU
+ } else {
+ $('.file').removeClass('selected');
+ file.addClass('selected');
+ $('#fileinfo').text(data.name + " (" + _.humanSize(data.size) + ", " + data.date + ")");
+
+ if (_.opener.callBack || _.opener.callBackMultiple) {
+
+ // SELECT FILE
+ _.menu.addItem("kcact:pick", _.label("Select"), function() {
+ _.returnFile(file);
+ return false;
+ });
+
+ // SELECT THUMBNAIL
+ if (data.thumb)
+ _.menu.addItem("kcact:pick_thumb", _.label("Select Thumbnail"), function() {
+ _.returnFile(_.thumbsURL + "/" + _.dir + "/" + data.name);
+ return false;
+ });
+
+ _.menu.addDivider();
+ }
+
+ // VIEW IMAGE
+ if (data.thumb || data.smallThumb)
+ _.menu.addItem("kcact:view", _.label("View"), function() {
+ _.viewImage(data);
+ });
+
+ // DOWNLOAD
+ _.menu.addItem("kcact:download", _.label("Download"), function() {
+ $('#menu').html('');
+ $('#downloadForm input').get(0).value = _.dir;
+ $('#downloadForm input').get(1).value = data.name;
+ $('#downloadForm').submit();
+ return false;
+ });
+
+ // ADD TO CLIPBOARD
+ if (_.access.files.copy || _.access.files.move) {
+ _.menu.addDivider();
+ _.menu.addItem("kcact:clpbrdadd", _.label("Add to Clipboard"), function() {
+ for (i = 0; i < _.clipboard.length; i++)
+ if ((_.clipboard[i].name == data.name) &&
+ (_.clipboard[i].dir == _.dir)
+ ) {
+ _.alert(_.label("This file is already added to the Clipboard."));
+ return false;
+ }
+ var cdata = data;
+ cdata.dir = _.dir;
+ _.clipboard[_.clipboard.length] = cdata;
+ _.initClipboard();
+ return false;
+ });
+ }
+
+
+ if (_.access.files.rename || _.access.files['delete'])
+ _.menu.addDivider();
+
+ // RENAME
+ if (_.access.files.rename)
+ _.menu.addItem("kcact:mv", _.label("Rename..."), function() {
+ if (!data.writable) return false;
+ _.fileNameDialog(
+ {dir: _.dir, file: data.name},
+ 'newName', data.name, _.getURL("rename"), {
+ title: "New file name:",
+ errEmpty: "Please enter new file name.",
+ errSlash: "Unallowable characters in file name.",
+ errDot: "File name shouldn't begins with '.'"
+ },
+ _.refresh
+ );
+ return false;
+ }, !data.writable);
+
+ // DELETE
+ if (_.access.files['delete'])
+ _.menu.addItem("kcact:rm", _.label("Delete"), function() {
+ if (!data.writable) return false;
+ _.confirm(_.label("Are you sure you want to delete this file?"),
+ function(callBack) {
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("delete"),
+ data: {dir: _.dir, file: data.name},
+ async: false,
+ success: function(data) {
+ if (callBack) callBack();
+ _.clearClipboard();
+ if (_.check4errors(data))
+ return;
+ _.refresh();
+ },
+ error: function() {
+ if (callBack) callBack();
+ _.alert(_.label("Unknown error."));
+ }
+ });
+ }
+ );
+ return false;
+ }, !data.writable);
+
+ _.menu.show(e);
+ }
+
+};
+
+// FOLDER CONTEXT MENU
+_.menuDir = function(dir, e) {
+ _.menu.init();
+
+ var data = dir.data(),
+ html = '';
+
+ if (_.clipboard && _.clipboard.length) {
+
+ // COPY CLIPBOARD
+ if (_.access.files.copy)
+ _.menu.addItem("kcact:cpcbd", _.label("Copy {count} files", {count: _.clipboard.length}), function() {
+ _.copyClipboard(data.path);
+ return false;
+ }, !data.writable);
+
+ // MOVE CLIPBOARD
+ if (_.access.files.move)
+ _.menu.addItem("kcact:mvcbd", _.label("Move {count} files", {count: _.clipboard.length}), function() {
+ _.moveClipboard(data.path);
+ return false;
+ }, !data.writable);
+
+ if (_.access.files.copy || _.access.files.move)
+ _.menu.addDivider();
+ }
+
+ // REFRESH
+ _.menu.addItem("kcact:refresh", _.label("Refresh"), function() {
+ _.refreshDir(dir);
+ return false;
+ });
+
+ // DOWNLOAD
+ if (_.support.zip) {
+ _.menu.addDivider();
+ _.menu.addItem("kcact:download", _.label("Download"), function() {
+ _.post(_.getURL("downloadDir"), {dir:data.path});
+ return false;
+ });
+ }
+
+ if (_.access.dirs.create || _.access.dirs.rename || _.access.dirs['delete'])
+ _.menu.addDivider();
+
+ // NEW SUBFOLDER
+ if (_.access.dirs.create)
+ _.menu.addItem("kcact:mkdir", _.label("New Subfolder..."), function(e) {
+ if (!data.writable) return false;
+ _.fileNameDialog(
+ {dir: data.path},
+ "newDir", "", _.getURL("newDir"), {
+ title: "New folder name:",
+ errEmpty: "Please enter new folder name.",
+ errSlash: "Unallowable characters in folder name.",
+ errDot: "Folder name shouldn't begins with '.'"
+ }, function() {
+ _.refreshDir(dir);
+ _.initDropUpload();
+ if (!data.hasDirs) {
+ dir.data('hasDirs', true);
+ dir.children('span.brace').addClass('closed');
+ }
+ }
+ );
+ return false;
+ }, !data.writable);
+
+ // RENAME
+ if (_.access.dirs.rename)
+ _.menu.addItem("kcact:mvdir", _.label("Rename..."), function(e) {
+ if (!data.removable) return false;
+ _.fileNameDialog(
+ {dir: data.path},
+ "newName", data.name, _.getURL("renameDir"), {
+ title: "New folder name:",
+ errEmpty: "Please enter new folder name.",
+ errSlash: "Unallowable characters in folder name.",
+ errDot: "Folder name shouldn't begins with '.'"
+ }, function(dt) {
+ if (!dt.name) {
+ _.alert(_.label("Unknown error."));
+ return;
+ }
+ var currentDir = (data.path == _.dir);
+ dir.children('span.folder').text(dt.name);
+ dir.data('name', dt.name);
+ dir.data('path', $.$.dirname(data.path) + '/' + dt.name);
+ if (currentDir)
+ _.dir = dir.data('path');
+ _.initDropUpload();
+ },
+ true
+ );
+ return false;
+ }, !data.removable);
+
+ // DELETE
+ if (_.access.dirs['delete'])
+ _.menu.addItem("kcact:rmdir", _.label("Delete"), function() {
+ if (!data.removable) return false;
+ _.confirm(
+ _.label("Are you sure you want to delete this folder and all its content?"),
+ function(callBack) {
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("deleteDir"),
+ data: {dir: data.path},
+ async: false,
+ success: function(data) {
+ if (callBack) callBack();
+ if (_.check4errors(data))
+ return;
+ dir.parent().hide(500, function() {
+ var folders = dir.parent().parent();
+ var pDir = folders.parent().children('a').first();
+ dir.parent().detach();
+ if (!folders.children('div.folder').get(0)) {
+ pDir.children('span.brace').first().removeClass('opened closed');
+ pDir.parent().children('.folders').detach();
+ pDir.data('hasDirs', false);
+ }
+ if (pDir.data('path') == _.dir.substr(0, pDir.data('path').length))
+ _.changeDir(pDir);
+ _.initDropUpload();
+ });
+ },
+ error: function() {
+ if (callBack) callBack();
+ _.alert(_.label("Unknown error."));
+ }
+ });
+ }
+ );
+ return false;
+ }, !data.removable);
+
+ _.menu.show(e);
+
+ $('div.folder > a > span.folder').removeClass('context');
+ if (dir.children('span.folder').hasClass('regular'))
+ dir.children('span.folder').addClass('context');
+};
+
+// CLIPBOARD MENU
+_.openClipboard = function() {
+
+ if (!_.clipboard || !_.clipboard.length) return;
+
+ // CLOSE MENU
+ if ($('#menu a[href="kcact:clrcbd"]').html()) {
+ $('#clipboard').removeClass('selected');
+ _.menu.hide();
+ return;
+ }
+
+ setTimeout(function() {
+ _.menu.init();
+
+ var dlg = $('#menu'),
+ jStatus = $('#status'),
+ html = '';
+
+ // CLIPBOARD FILES
+ $.each(_.clipboard, function(i, val) {
+ var icon = $.$.getFileExtension(val.name);
+ if (val.thumb)
+ icon = ".image";
+ else if (!val.smallIcon || !icon.length)
+ icon = ".";
+ icon = "themes/" + _.theme + "/img/files/small/" + icon + ".png";
+ html += '
' + $.$.htmlData($.$.basename(val.name)) + ' ';
+ });
+ html += '
- ';
+ $('#menu ul').append(html);
+
+ // DOWNLOAD
+ if (_.support.zip)
+ _.menu.addItem("kcact:download", _.label("Download files"), function() {
+ _.downloadClipboard();
+ return false;
+ });
+
+ if (_.access.files.copy || _.access.files.move || _.access.files['delete'])
+ _.menu.addDivider();
+
+ // COPY
+ if (_.access.files.copy)
+ _.menu.addItem("kcact:cpcbd", _.label("Copy files here"), function() {
+ if (!_.dirWritable) return false;
+ _.copyClipboard(_.dir);
+ return false;
+ }, !_.dirWritable);
+
+ // MOVE
+ if (_.access.files.move)
+ _.menu.addItem("kcact:mvcbd", _.label("Move files here"), function() {
+ if (!_.dirWritable) return false;
+ _.moveClipboard(_.dir);
+ return false;
+ }, !_.dirWritable);
+
+ // DELETE
+ if (_.access.files['delete'])
+ _.menu.addItem("kcact:rmcbd", _.label("Delete files"), function() {
+ _.confirm(
+ _.label("Are you sure you want to delete all files in the Clipboard?"),
+ function(callBack) {
+ if (callBack) callBack();
+ _.deleteClipboard();
+ }
+ );
+ return false;
+ });
+
+ _.menu.addDivider();
+
+ // CLEAR CLIPBOARD
+ _.menu.addItem("kcact:clrcbd", _.label("Clear the Clipboard"), function() {
+ _.clearClipboard();
+ return false;
+ });
+
+ $('#clipboard').addClass('selected');
+ _.menu.show();
+
+ var left = $(window).width() - dlg.css({width: ""}).outerWidth(),
+ top = $(window).height() - dlg.outerHeight() - jStatus.outerHeight(),
+ lheight = top + dlg.outerTopSpace();
+
+ dlg.find('.list').css({
+ 'max-height': lheight,
+ 'overflow-y': "auto",
+ 'overflow-x': "hidden",
+ width: ""
+ });
+
+ top = $(window).height() - dlg.outerHeight(true) - jStatus.outerHeight(true);
+
+ dlg.css({
+ left: left - 5,
+ top: top
+ }).fadeIn("fast");
+
+ var a = dlg.find('.list').outerHeight(),
+ b = dlg.find('.list div').outerHeight();
+
+ if (b - a > 10) {
+ dlg.css({
+ left: parseInt(dlg.css('left')) - _.scrollbarWidth,
+ }).width(dlg.width() + _.scrollbarWidth);
+ }
+ }, 1);
+};
\ No newline at end of file
diff --git a/js/091.viewImage.js b/js/091.viewImage.js
new file mode 100644
index 0000000..db4861d
--- /dev/null
+++ b/js/091.viewImage.js
@@ -0,0 +1,223 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Image viewer
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.viewImage = function(data) {
+
+ var ts = new Date().getTime(),
+ dlg = false,
+ images = [],
+ min_h = 100,
+ w = $(window),
+ min_w, dd, dv, dh,
+
+ showImage = function(data) {
+ _.lock = true;
+
+ var url = $.$.escapeDirs(_.uploadURL + "/" + _.dir + "/" + data.name) + "?ts=" + ts,
+ img = new Image(),
+ i = $(img),
+
+ onImgLoad = function() {
+ _.lock = false;
+
+ $('#files .file').each(function() {
+ if ($(this).data('name') == data.name) {
+ _.ssImage = this;
+ return false;
+ }
+ });
+
+ i.hide().appendTo('body');
+
+ var w_w = w.width(),
+ w_h = w.height(),
+ o_w = i.width(),
+ o_h = i.height(),
+ i_w = o_w,
+ i_h = o_h,
+ openDlg = false,
+ t = $('
'),
+
+ goTo = function(i) {
+ if (!_.lock) {
+ var nimg = images[i];
+ _.currImg = i;
+ showImage(nimg);
+ }
+ },
+
+ nextFunc = function() {
+ goTo((_.currImg >= images.length - 1) ? 0 : (_.currImg + 1));
+ },
+
+ prevFunc = function() {
+ goTo((_.currImg ? _.currImg : images.length) - 1);
+ },
+
+ selectFunc = function(e) {
+ if (_.ssImage)
+ _.selectFile($(_.ssImage), e);
+ dlg.dialog('destroy').detach();
+ };
+
+ i.detach().appendTo(t);
+
+ if (!dlg) {
+ openDlg = true;
+
+ var closeFunc = function() {
+ dlg.dialog('destroy').detach();
+ },
+
+ focusFunc = function() {
+ setTimeout(function() {
+ dlg.find('input').get(0).focus();
+ }, 100);
+ };
+
+ dlg = _.dialog(".", "", {
+ draggable: false,
+ nopadding: true,
+ close: closeFunc,
+ show: false,
+ hide: false,
+ buttons: [
+ {
+ text: _.label("Previous"),
+ icons: {primary: "ui-icon-triangle-1-w"},
+ click: prevFunc
+
+ }, {
+ text: _.label("Next"),
+ icons: {secondary: "ui-icon-triangle-1-e"},
+ click: nextFunc
+
+ }, {
+ text: _.label("Select"),
+ icons: {primary: "ui-icon-check"},
+ click: selectFunc
+
+ }, {
+ text: _.label("Close"),
+ icons: {primary: "ui-icon-closethick"},
+ click: closeFunc
+ }
+ ]
+ });
+
+ dlg.click(nextFunc).css({overflow: "hidden"}).parent().css({width: "auto", height: "auto"});
+
+ dd = dlg.parent().click(focusFunc).rightClick(focusFunc).disableTextSelect().addClass('kcfImageViewer');
+ dv = dd.find('.ui-dialog-titlebar').outerHeight() + dd.find('.ui-dialog-buttonpane').outerHeight() + dd.outerVSpace('b');
+ dh = dd.outerHSpace('b');
+ min_w = dd.outerWidth() - dh;
+ }
+
+ var max_w = w_w - dh,
+ max_h = w_h - dv + 1,
+ top = 0,
+ left = 0,
+ width = o_w,
+ height = o_h;
+
+ // Too big
+ if ((o_w > max_w) || (o_h > max_h)) {
+
+ if ((max_h / max_w) < (o_h / o_w)) {
+ height = max_h;
+ width = (o_w * height) / o_h;
+
+ } else {
+ width = max_w;
+ height = (o_h * width) / o_w;
+ }
+
+ i_w = width;
+ i_h = height;
+
+ // Too small
+ } else if ((o_w < min_w) || (o_h < min_h)) {
+ width = (o_w < min_w) ? min_w : o_w;
+ height = (o_h < min_h) ? min_h : o_h;
+ left = (o_w < min_w) ? (min_w - o_w) / 2 : 0;
+ top = (o_h < min_h) ? (min_h - o_h) / 2 : 0;
+ }
+
+ var show = function() {
+ dlg.animate({width: width, height: height}, 150);
+ dlg.parent().animate({top: (w_h - height - dv) / 2, left: (w_w - width - dh) / 2}, 150, function() {
+ dlg.html(t.get(0)).append(' ');
+ dlg.find('input').keydown(function(e) {
+ if (!_.lock) {
+ if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey)
+ return;
+ var kc = e.keyCode;
+ if ((kc == 37)) prevFunc();
+ if ((kc == 39)) nextFunc();
+ if ((kc == 13) || (kc == 32)) selectFunc(e);
+ }
+ }).get(0).focus();
+ i.css({padding: top + "px 0 0 " + left + "px", width: i_w, height: i_h}).show();
+ dlg.children().first().css({width: width, height: height, display: "none"}).fadeIn(150, function() {
+ loadingStop();
+ var title = data.name + " (" + o_w + " x " + o_h + ")";
+ dlg.prev().find('.ui-dialog-title').css({width:width - dlg.prev().find('.ui-dialog-titlebar-close').outerWidth() - 20}).text(title).attr({title: title}).css({cursor: "default"});
+ });
+ });
+ }
+
+ if (openDlg)
+ show();
+ else
+ dlg.children().first().fadeOut(150, show);
+ },
+
+ loadingStart = function() {
+ if (dlg)
+ dlg.prev().addClass("loading").find('.ui-dialog-title').text(_.label("Loading image...")).css({width: "auto"});
+ else
+ $('#loading').text(_.label("Loading image...")).show();
+ },
+
+ loadingStop = function() {
+ if (dlg)
+ dlg.prev().removeClass("loading");
+ $('#loading').hide();
+ };
+
+ loadingStart();
+ img.src = url;
+
+ if (img.complete)
+ onImgLoad();
+ else {
+ img.onload = onImgLoad;
+ img.onerror = function() {
+ _.lock = false;
+ loadingStop();
+ _.alert(_.label("Unknown error."));
+ _.refresh();
+ };
+ }
+ };
+
+ $.each(_.files, function(i, file) {
+ i = images.length;
+ if (file.thumb || file.smallThumb)
+ images[i] = file;
+ if (file.name == data.name)
+ _.currImg = i;
+ });
+
+ showImage(data);
+ return false;
+};
diff --git a/js/100.clipboard.js b/js/100.clipboard.js
new file mode 100644
index 0000000..85f0b77
--- /dev/null
+++ b/js/100.clipboard.js
@@ -0,0 +1,216 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Clipboard functionality
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.initClipboard = function() {
+ if (!_.clipboard || !_.clipboard.length) return;
+
+ var size = 0,
+ jClipboard = $('#clipboard');
+
+ $.each(_.clipboard, function(i, val) {
+ size += val.size;
+ });
+ size = _.humanSize(size);
+ jClipboard.disableTextSelect().html('
');
+ var resize = function() {
+ jClipboard.css({
+ left: $(window).width() - jClipboard.outerWidth(),
+ top: $(window).height() - jClipboard.outerHeight()
+ });
+ };
+ resize();
+ jClipboard.show();
+ $(window).unbind().resize(function() {
+ _.resize();
+ resize();
+ });
+};
+
+_.removeFromClipboard = function(i) {
+ if (!_.clipboard || !_.clipboard[i]) return false;
+ if (_.clipboard.length == 1) {
+ _.clearClipboard();
+ _.menu.hide();
+ return;
+ }
+
+ if (i < _.clipboard.length - 1) {
+ var last = _.clipboard.slice(i + 1);
+ _.clipboard = _.clipboard.slice(0, i);
+ _.clipboard = _.clipboard.concat(last);
+ } else
+ _.clipboard.pop();
+
+ _.initClipboard();
+ _.menu.hide();
+ _.openClipboard();
+ return true;
+};
+
+_.copyClipboard = function(dir) {
+ if (!_.clipboard || !_.clipboard.length) return;
+ var files = [],
+ failed = 0;
+ for (i = 0; i < _.clipboard.length; i++)
+ if (_.clipboard[i].readable)
+ files[i] = _.clipboard[i].dir + "/" + _.clipboard[i].name;
+ else
+ failed++;
+ if (_.clipboard.length == failed) {
+ _.alert(_.label("The files in the Clipboard are not readable."));
+ return;
+ }
+ var go = function(callBack) {
+ if (dir == _.dir)
+ _.fadeFiles();
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("cp_cbd"),
+ data: {dir: dir, files: files},
+ async: false,
+ success: function(data) {
+ if (callBack) callBack();
+ _.check4errors(data);
+ _.clearClipboard();
+ if (dir == _.dir)
+ _.refresh();
+ },
+ error: function() {
+ if (callBack) callBack();
+ $('#files > div').css({
+ opacity: "",
+ filter: ""
+ });
+ _.alert(_.label("Unknown error."));
+ }
+ });
+ };
+
+ if (failed)
+ _.confirm(
+ _.label("{count} files in the Clipboard are not readable. Do you want to copy the rest?", {count:failed}),
+ go
+ )
+ else
+ go();
+
+};
+
+_.moveClipboard = function(dir) {
+ if (!_.clipboard || !_.clipboard.length) return;
+ var files = [],
+ failed = 0;
+ for (i = 0; i < _.clipboard.length; i++)
+ if (_.clipboard[i].readable && _.clipboard[i].writable)
+ files[i] = _.clipboard[i].dir + "/" + _.clipboard[i].name;
+ else
+ failed++;
+ if (_.clipboard.length == failed) {
+ _.alert(_.label("The files in the Clipboard are not movable."))
+ return;
+ }
+
+ var go = function(callBack) {
+ _.fadeFiles();
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("mv_cbd"),
+ data: {dir: dir, files: files},
+ async: false,
+ success: function(data) {
+ if (callBack) callBack();
+ _.check4errors(data);
+ _.clearClipboard();
+ _.refresh();
+ },
+ error: function() {
+ if (callBack) callBack();
+ $('#files > div').css({
+ opacity: "",
+ filter: ""
+ });
+ _.alert(_.label("Unknown error."));
+ }
+ });
+ };
+
+ if (failed)
+ _.confirm(
+ _.label("{count} files in the Clipboard are not movable. Do you want to move the rest?", {count: failed}),
+ go
+ );
+ else
+ go();
+};
+
+_.deleteClipboard = function() {
+ if (!_.clipboard || !_.clipboard.length) return;
+ var files = [],
+ failed = 0;
+ for (i = 0; i < _.clipboard.length; i++)
+ if (_.clipboard[i].readable && _.clipboard[i].writable)
+ files[i] = _.clipboard[i].dir + "/" + _.clipboard[i].name;
+ else
+ failed++;
+ if (_.clipboard.length == failed) {
+ _.alert(_.label("The files in the Clipboard are not removable."))
+ return;
+ }
+ var go = function(callBack) {
+ _.fadeFiles();
+ $.ajax({
+ type: "post",
+ dataType: "json",
+ url: _.getURL("rm_cbd"),
+ data: {files:files},
+ async: false,
+ success: function(data) {
+ if (callBack) callBack();
+ _.check4errors(data);
+ _.clearClipboard();
+ _.refresh();
+ },
+ error: function() {
+ if (callBack) callBack();
+ $('#files > div').css({
+ opacity: "",
+ filter: ""
+ });
+ _.alert(_.label("Unknown error."));
+ }
+ });
+ };
+ if (failed)
+ _.confirm(
+ _.label("{count} files in the Clipboard are not removable. Do you want to delete the rest?", {count: failed}),
+ go
+ );
+ else
+ go();
+};
+
+_.downloadClipboard = function() {
+ if (!_.clipboard || !_.clipboard.length) return;
+ var files = [];
+ for (i = 0; i < _.clipboard.length; i++)
+ if (_.clipboard[i].readable)
+ files[i] = _.clipboard[i].dir + "/" + _.clipboard[i].name;
+ if (files.length)
+ _.post(_.getURL('downloadClipboard'), {files:files});
+};
+
+_.clearClipboard = function() {
+ $('#clipboard').html("");
+ _.clipboard = [];
+};
diff --git a/js/110.dropUpload.js b/js/110.dropUpload.js
new file mode 100644
index 0000000..f518c62
--- /dev/null
+++ b/js/110.dropUpload.js
@@ -0,0 +1,165 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Upload files using drag and drop
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.initDropUpload = function() {
+
+ if (!_.access.files.upload)
+ return;
+
+ var files = $('#files'),
+ folders = $('#folders').find('div.folder > a'),
+ i, dlg, filesSize, uploaded, errors,
+
+ precheck = function(e) {
+ filesSize = uploaded = 0; errors = [];
+ var fs = e.dataTransfer.files;
+ for (i = 0; i < fs.length; i++)
+ filesSize += fs[i].size;
+
+ dlg = $('');
+
+ dlg.find('.bar.count').progressbar({max: fs.length, value: 0});
+ dlg.find('.bar.size').progressbar({max: filesSize, value: 0});
+ dlg.find('.info').css('padding', "5px 0").first().css('paddingTop', 0);
+ dlg.find('.info').last().css('paddingBottom', 0);
+
+ dlg = _.dialog(_.label("Uploading files"), dlg, {
+ closeOnEscape: false,
+ buttons: []
+ });
+
+ dlg.parent().css('paddingBottom', 0).find('.ui-dialog-titlebar button').css('visibility', 'hidden').get(0).disabled = true;
+
+ return true;
+ },
+
+ localOptions = {
+ param: "upload[]",
+ maxFilesize: _.dropUploadMaxFilesize,
+
+ begin: function(xhr, currentFile, count) {
+
+ dlg.find('.info.count').html(_.label("Uploading file {current} of {count}", {
+ current: currentFile,
+ count: count
+ }));
+
+ dlg.find('.info.size').html(_.label("Uploaded {uploaded} of {total}", {
+ uploaded: _.humanSize(uploaded),
+ total: _.humanSize(filesSize)
+ }));
+
+ dlg.find('.info.errors').html(_.label("Errors:") + " " + errors.length);
+ dlg.find('.bar.count').progressbar({value: currentFile});
+ dlg.find('.bar.size').progressbar({value: uploaded});
+ },
+
+ success: function(xhr, currentFile, count) {
+ uploaded += xhr.file.size;
+ var response = xhr.responseText;
+ if (response.substr(0, 1) != "/")
+ errors.push($.$.htmlData(response));
+ },
+
+ error: function(xhr, currentFile, count) {
+ uploaded += xhr.file.size;
+ errors.push($.$.htmlData(xhr.file.name + ": " + _.label("Failed to upload {filename}!", {
+ filename: xhr.file.name
+ })));
+ },
+
+ abort: function(xhr, currentFile, filesCount) {
+ uploaded += xhr.file.size;
+ errors.push($.$.htmlData(xhr.file.name + ": " + _.label("Failed to upload {filename}!", {
+ filename: xhr.file.name
+ })));
+ },
+
+ filesizeCallback: function(xhr, currentFile, filesCount) {
+ uploaded += xhr.file.size;
+ errors.push($.$.htmlData(xhr.file.name + ": " + _.label("The uploaded file exceeds {size} bytes.", {
+ size: _.dropUploadMaxFilesize
+ })));
+ },
+
+ finish: function() {
+ _.refresh();
+ dlg.find('.bar.size').progressbar({value: uploaded});
+ dlg.find('.info.size').html(_.label("Uploaded: {uploaded} of {total}", {
+ uploaded: _.humanSize(uploaded),
+ total: _.humanSize(filesSize)
+ }));
+ dlg.find('.info.errors').html(_.label("Errors:") + " " + errors.length);
+ var err = errors;
+ setTimeout(function() {
+ dlg.dialog('destroy').detach();
+ if (err.length)
+ _.alert(err.join(' '));
+ }, 500);
+ }
+ },
+
+ remoteOptions = {
+ ajax: {
+ success: function(data) {
+ _.refresh();
+ if (data.error) {
+ _.alert(data.error)
+ return;
+ }
+ },
+ error: function() {
+ _.refresh();
+ _.alert(_.label("Unknown error."));
+ },
+ abort: function() {
+ _.refresh();
+ }
+ }
+ },
+
+ url = "&dir=" + encodeURIComponent(_.dir);
+
+ files.shDropUpload($.extend(localOptions, {
+ url: _.getURL('upload') + url,
+ precheck: function(e) {
+ if (!$('#folders span.current').first().parent().data('writable')) {
+ _.alert(_.label("Cannot write to upload folder."));
+ return false;
+ }
+ return precheck(e);
+ }
+ }), $.extend(true, remoteOptions, {
+ ajax: {
+ url: _.getURL('dragUrl') + url
+ }
+ }));
+
+ folders.each(function() {
+ var folder = this,
+ url = "&dir=" + encodeURIComponent($(folder).data('path'));
+ $(folder).shDropUpload($.extend(localOptions, {
+ url: _.getURL('upload') + url,
+ precheck: function(e) {
+ if (!$(folder).data('writable')) {
+ _.alert(_.label("Cannot write to upload folder."));
+ return false;
+ }
+ return precheck(e);
+ }
+ }), $.extend(true, remoteOptions, {
+ ajax: {
+ url: _.getURL('dragUrl') + url
+ }
+ }));
+ });
+};
diff --git a/js/120.misc.js b/js/120.misc.js
new file mode 100644
index 0000000..c3a2c48
--- /dev/null
+++ b/js/120.misc.js
@@ -0,0 +1,132 @@
+/** This file is part of KCFinder project
+ *
+ * @desc Miscellaneous functionality
+ * @package KCFinder
+ * @version 3.12
+ * @author Pavel Tzonkov
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+_.orderFiles = function(callBack, selected) {
+ var order = $.$.kuki.get('order'),
+ desc = ($.$.kuki.get('orderDesc') == "on"),
+ a1, b1, arr;
+
+ if (!_.files || !_.files.sort)
+ _.files = [];
+
+ _.files = _.files.sort(function(a, b) {
+ if (!order) order = "name";
+
+ if (order == "date") {
+ a1 = a.mtime;
+ b1 = b.mtime;
+ } else if (order == "type") {
+ a1 = $.$.getFileExtension(a.name);
+ b1 = $.$.getFileExtension(b.name);
+ } else if (order == "size") {
+ a1 = a.size;
+ b1 = b.size;
+ } else {
+ a1 = a[order].toLowerCase();
+ b1 = b[order].toLowerCase();
+ }
+
+ if ((order == "size") || (order == "date")) {
+ if (a1 < b1) return desc ? 1 : -1;
+ if (a1 > b1) return desc ? -1 : 1;
+ }
+
+ if (a1 == b1) {
+ a1 = a.name.toLowerCase();
+ b1 = b.name.toLowerCase();
+ arr = [a1, b1];
+ arr = arr.sort();
+ return (arr[0] == a1) ? -1 : 1;
+ }
+
+ arr = [a1, b1];
+ arr = arr.sort();
+ if (arr[0] == a1) return desc ? 1 : -1;
+ return desc ? -1 : 1;
+ });
+
+ _.showFiles(callBack, selected);
+ _.initFiles();
+};
+
+_.humanSize = function(size) {
+ if (size < 1024) {
+ size = size.toString() + " B";
+ } else if (size < 1048576) {
+ size /= 1024;
+ size = parseInt(size).toString() + " KB";
+ } else if (size < 1073741824) {
+ size /= 1048576;
+ size = parseInt(size).toString() + " MB";
+ } else if (size < 1099511627776) {
+ size /= 1073741824;
+ size = parseInt(size).toString() + " GB";
+ } else {
+ size /= 1099511627776;
+ size = parseInt(size).toString() + " TB";
+ }
+ return size;
+};
+
+_.getURL = function(act, lang) {
+ if (!lang)
+ lang = _.lang;
+ var url = "browse.php?type=" + encodeURIComponent(_.type) + "&lng=" + encodeURIComponent(lang);
+ if (_.opener.name)
+ url += "&opener=" + encodeURIComponent(_.opener.name);
+ if (act)
+ url += "&act=" + encodeURIComponent(act);
+ if (_.cms)
+ url += "&cms=" + encodeURIComponent(_.cms);
+ return url;
+};
+
+_.label = function(index, data) {
+ var label = _.labels[index] ? _.labels[index] : index;
+ if (data)
+ $.each(data, function(key, val) {
+ label = label.replace("{" + key + "}", val);
+ });
+ return label;
+};
+
+_.check4errors = function(data) {
+ if (!data.error)
+ return false;
+ var msg = data.error.join
+ ? data.error.join("\n")
+ : data.error;
+ _.alert(msg);
+ return true;
+};
+
+_.post = function(url, data) {
+ var html = '';
+ $('#menu').html(html).show();
+ $('#postForm').get(0).submit();
+};
+
+_.fadeFiles = function() {
+ $('#files > div').css({
+ opacity: "0.4",
+ filter: "alpha(opacity=40)"
+ });
+};
diff --git a/js/browser/clipboard.js b/js/browser/clipboard.js
deleted file mode 100644
index c97af84..0000000
--- a/js/browser/clipboard.js
+++ /dev/null
@@ -1,299 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */?>
-
-browser.initClipboard = function() {
- if (!this.clipboard || !this.clipboard.length) return;
- var size = 0;
- $.each(this.clipboard, function(i, val) {
- size += parseInt(val.size);
- });
- size = this.humanSize(size);
- $('#clipboard').html('
');
- var resize = function() {
- $('#clipboard').css({
- left: $(window).width() - $('#clipboard').outerWidth() + 'px',
- top: $(window).height() - $('#clipboard').outerHeight() + 'px'
- });
- };
- resize();
- $('#clipboard').css('display', 'block');
- $(window).unbind();
- $(window).resize(function() {
- browser.resize();
- resize();
- });
-};
-
-browser.openClipboard = function() {
- if (!this.clipboard || !this.clipboard.length) return;
- if ($('.menu a[href="kcact:cpcbd"]').html()) {
- $('#clipboard').removeClass('selected');
- this.hideDialog();
- return;
- }
- var html = '';
-
- setTimeout(function() {
- $('#clipboard').addClass('selected');
- $('#dialog').html(html);
- $('.menu a[href="kcact:download"]').click(function() {
- browser.hideDialog();
- browser.downloadClipboard();
- return false;
- });
- $('.menu a[href="kcact:cpcbd"]').click(function() {
- if (!browser.dirWritable) return false;
- browser.hideDialog();
- browser.copyClipboard(browser.dir);
- return false;
- });
- $('.menu a[href="kcact:mvcbd"]').click(function() {
- if (!browser.dirWritable) return false;
- browser.hideDialog();
- browser.moveClipboard(browser.dir);
- return false;
- });
- $('.menu a[href="kcact:rmcbd"]').click(function() {
- browser.hideDialog();
- browser.confirm(
- browser.label("Are you sure you want to delete all files in the Clipboard?"),
- function(callBack) {
- if (callBack) callBack();
- browser.deleteClipboard();
- }
- );
- return false;
- });
- $('.menu a[href="kcact:clrcbd"]').click(function() {
- browser.hideDialog();
- browser.clearClipboard();
- return false;
- });
-
- var left = $(window).width() - $('#dialog').outerWidth();
- var top = $(window).height() - $('#dialog').outerHeight() - $('#clipboard').outerHeight();
- var lheight = top + _.outerTopSpace('#dialog');
- $('.menu .list').css('max-height', lheight + 'px');
- var top = $(window).height() - $('#dialog').outerHeight() - $('#clipboard').outerHeight();
- $('#dialog').css({
- left: (left - 4) + 'px',
- top: top + 'px'
- });
- $('#dialog').fadeIn();
- }, 1);
-};
-
-browser.removeFromClipboard = function(i) {
- if (!this.clipboard || !this.clipboard[i]) return false;
- if (this.clipboard.length == 1) {
- this.clearClipboard();
- this.hideDialog();
- return;
- }
-
- if (i < this.clipboard.length - 1) {
- var last = this.clipboard.slice(i + 1);
- this.clipboard = this.clipboard.slice(0, i);
- this.clipboard = this.clipboard.concat(last);
- } else
- this.clipboard.pop();
-
- this.initClipboard();
- this.hideDialog();
- this.openClipboard();
- return true;
-};
-
-browser.copyClipboard = function(dir) {
- if (!this.clipboard || !this.clipboard.length) return;
- var files = [];
- var failed = 0;
- for (i = 0; i < this.clipboard.length; i++)
- if (this.clipboard[i].readable)
- files[i] = this.clipboard[i].dir + '/' + this.clipboard[i].name;
- else
- failed++;
- if (this.clipboard.length == failed) {
- browser.alert(this.label("The files in the Clipboard are not readable."));
- return;
- }
- var go = function(callBack) {
- if (dir == browser.dir)
- browser.fadeFiles();
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('cp_cbd'),
- data: {dir: dir, files: files},
- async: false,
- success: function(data) {
- if (callBack) callBack();
- browser.check4errors(data);
- browser.clearClipboard();
- if (dir == browser.dir)
- browser.refresh();
- },
- error: function() {
- if (callBack) callBack();
- $('#files > div').css({
- opacity: '',
- filter: ''
- });
- browser.alert(browser.label("Unknown error."));
- }
- });
- };
-
- if (failed)
- browser.confirm(
- browser.label("{count} files in the Clipboard are not readable. Do you want to copy the rest?", {count:failed}),
- go
- )
- else
- go();
-
-};
-
-browser.moveClipboard = function(dir) {
- if (!this.clipboard || !this.clipboard.length) return;
- var files = [];
- var failed = 0;
- for (i = 0; i < this.clipboard.length; i++)
- if (this.clipboard[i].readable && this.clipboard[i].writable)
- files[i] = this.clipboard[i].dir + "/" + this.clipboard[i].name;
- else
- failed++;
- if (this.clipboard.length == failed) {
- browser.alert(this.label("The files in the Clipboard are not movable."))
- return;
- }
-
- var go = function(callBack) {
- browser.fadeFiles();
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('mv_cbd'),
- data: {dir: dir, files: files},
- async: false,
- success: function(data) {
- if (callBack) callBack();
- browser.check4errors(data);
- browser.clearClipboard();
- browser.refresh();
- },
- error: function() {
- if (callBack) callBack();
- $('#files > div').css({
- opacity: '',
- filter: ''
- });
- browser.alert(browser.label("Unknown error."));
- }
- });
- };
-
- if (failed)
- browser.confirm(
- browser.label("{count} files in the Clipboard are not movable. Do you want to move the rest?", {count: failed}),
- go
- );
- else
- go();
-};
-
-browser.deleteClipboard = function() {
- if (!this.clipboard || !this.clipboard.length) return;
- var files = [];
- var failed = 0;
- for (i = 0; i < this.clipboard.length; i++)
- if (this.clipboard[i].readable && this.clipboard[i].writable)
- files[i] = this.clipboard[i].dir + '/' + this.clipboard[i].name;
- else
- failed++;
- if (this.clipboard.length == failed) {
- browser.alert(this.label("The files in the Clipboard are not removable."))
- return;
- }
- var go = function(callBack) {
- browser.fadeFiles();
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('rm_cbd'),
- data: {files:files},
- async: false,
- success: function(data) {
- if (callBack) callBack();
- browser.check4errors(data);
- browser.clearClipboard();
- browser.refresh();
- },
- error: function() {
- if (callBack) callBack();
- $('#files > div').css({
- opacity: '',
- filter:''
- });
- browser.alert(browser.label("Unknown error."));
- }
- });
- };
- if (failed)
- browser.confirm(
- browser.label("{count} files in the Clipboard are not removable. Do you want to delete the rest?", {count: failed}),
- go
- );
- else
- go();
-};
-
-browser.downloadClipboard = function() {
- if (!this.clipboard || !this.clipboard.length) return;
- var files = [];
- for (i = 0; i < this.clipboard.length; i++)
- if (this.clipboard[i].readable)
- files[i] = this.clipboard[i].dir + '/' + this.clipboard[i].name;
- if (files.length)
- this.post(this.baseGetData('downloadClipboard'), {files:files});
-};
-
-browser.clearClipboard = function() {
- $('#clipboard').html('');
- this.clipboard = [];
-};
diff --git a/js/browser/dropUpload.js b/js/browser/dropUpload.js
deleted file mode 100644
index f7e28f8..0000000
--- a/js/browser/dropUpload.js
+++ /dev/null
@@ -1,231 +0,0 @@
-
-
-browser.initDropUpload = function() {
- if ((typeof(XMLHttpRequest) == 'undefined') ||
- (typeof(document.addEventListener) == 'undefined') ||
- (typeof(File) == 'undefined') ||
- (typeof(FileReader) == 'undefined')
- )
- return;
-
- if (!XMLHttpRequest.prototype.sendAsBinary) {
- XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
- var ords = Array.prototype.map.call(datastr, function(x) {
- return x.charCodeAt(0) & 0xff;
- });
- var ui8a = new Uint8Array(ords);
- this.send(ui8a.buffer);
- }
- }
-
- var uploadQueue = [],
- uploadInProgress = false,
- filesCount = 0,
- errors = [],
- files = $('#files'),
- folders = $('div.folder > a'),
- boundary = '------multipartdropuploadboundary' + (new Date).getTime(),
- currentFile,
-
- filesDragOver = function(e) {
- if (e.preventDefault) e.preventDefault();
- $('#files').addClass('drag');
- return false;
- },
-
- filesDragEnter = function(e) {
- if (e.preventDefault) e.preventDefault();
- return false;
- },
-
- filesDragLeave = function(e) {
- if (e.preventDefault) e.preventDefault();
- $('#files').removeClass('drag');
- return false;
- },
-
- filesDrop = function(e) {
- if (e.preventDefault) e.preventDefault();
- if (e.stopPropagation) e.stopPropagation();
- $('#files').removeClass('drag');
- if (!$('#folders span.current').first().parent().data('writable')) {
- browser.alert("Cannot write to upload folder.");
- return false;
- }
- filesCount += e.dataTransfer.files.length
- for (var i = 0; i < e.dataTransfer.files.length; i++) {
- var file = e.dataTransfer.files[i];
- file.thisTargetDir = browser.dir;
- uploadQueue.push(file);
- }
- processUploadQueue();
- return false;
- },
-
- folderDrag = function(e) {
- if (e.preventDefault) e.preventDefault();
- return false;
- },
-
- folderDrop = function(e, dir) {
- if (e.preventDefault) e.preventDefault();
- if (e.stopPropagation) e.stopPropagation();
- if (!$(dir).data('writable')) {
- browser.alert("Cannot write to upload folder.");
- return false;
- }
- filesCount += e.dataTransfer.files.length
- for (var i = 0; i < e.dataTransfer.files.length; i++) {
- var file = e.dataTransfer.files[i];
- file.thisTargetDir = $(dir).data('path');
- uploadQueue.push(file);
- }
- processUploadQueue();
- return false;
- };
-
- files.get(0).removeEventListener('dragover', filesDragOver, false);
- files.get(0).removeEventListener('dragenter', filesDragEnter, false);
- files.get(0).removeEventListener('dragleave', filesDragLeave, false);
- files.get(0).removeEventListener('drop', filesDrop, false);
-
- files.get(0).addEventListener('dragover', filesDragOver, false);
- files.get(0).addEventListener('dragenter', filesDragEnter, false);
- files.get(0).addEventListener('dragleave', filesDragLeave, false);
- files.get(0).addEventListener('drop', filesDrop, false);
-
- folders.each(function() {
- var folder = this,
-
- dragOver = function(e) {
- $(folder).children('span.folder').addClass('context');
- return folderDrag(e);
- },
-
- dragLeave = function(e) {
- $(folder).children('span.folder').removeClass('context');
- return folderDrag(e);
- },
-
- drop = function(e) {
- $(folder).children('span.folder').removeClass('context');
- return folderDrop(e, folder);
- };
-
- this.removeEventListener('dragover', dragOver, false);
- this.removeEventListener('dragenter', folderDrag, false);
- this.removeEventListener('dragleave', dragLeave, false);
- this.removeEventListener('drop', drop, false);
-
- this.addEventListener('dragover', dragOver, false);
- this.addEventListener('dragenter', folderDrag, false);
- this.addEventListener('dragleave', dragLeave, false);
- this.addEventListener('drop', drop, false);
- });
-
- function updateProgress(evt) {
- var progress = evt.lengthComputable
- ? Math.round((evt.loaded * 100) / evt.total) + '%'
- : Math.round(evt.loaded / 1024) + " KB";
- $('#loading').html(browser.label("Uploading file {number} of {count}... {progress}", {
- number: filesCount - uploadQueue.length,
- count: filesCount,
- progress: progress
- }));
- }
-
- function processUploadQueue() {
- if (uploadInProgress)
- return false;
-
- if (uploadQueue && uploadQueue.length) {
- var file = uploadQueue.shift();
- currentFile = file;
- $('#loading').html(browser.label("Uploading file {number} of {count}... {progress}", {
- number: filesCount - uploadQueue.length,
- count: filesCount,
- progress: ""
- }));
- $('#loading').css('display', 'inline');
-
- var reader = new FileReader();
- reader.thisFileName = file.name;
- reader.thisFileType = file.type;
- reader.thisFileSize = file.size;
- reader.thisTargetDir = file.thisTargetDir;
-
- reader.onload = function(evt) {
- uploadInProgress = true;
-
- var postbody = '--' + boundary + '\r\nContent-Disposition: form-data; name="upload[]"';
- if (evt.target.thisFileName)
- postbody += '; filename="' + _.utf8encode(evt.target.thisFileName) + '"';
- postbody += '\r\n';
- if (evt.target.thisFileSize)
- postbody += 'Content-Length: ' + evt.target.thisFileSize + '\r\n';
- postbody += 'Content-Type: ' + evt.target.thisFileType + '\r\n\r\n' + evt.target.result + '\r\n--' + boundary + '\r\nContent-Disposition: form-data; name="dir"\r\n\r\n' + _.utf8encode(evt.target.thisTargetDir) + '\r\n--' + boundary + '\r\n--' + boundary + '--\r\n';
-
- var xhr = new XMLHttpRequest();
- xhr.thisFileName = evt.target.thisFileName;
-
- if (xhr.upload) {
- xhr.upload.thisFileName = evt.target.thisFileName;
- xhr.upload.addEventListener("progress", updateProgress, false);
- }
- xhr.open('POST', browser.baseGetData('upload'), true);
- xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
- xhr.setRequestHeader('Content-Length', postbody.length);
-
- xhr.onload = function(e) {
- $('#loading').css('display', 'none');
- if (browser.dir == reader.thisTargetDir)
- browser.fadeFiles();
- uploadInProgress = false;
- processUploadQueue();
- if (xhr.responseText.substr(0, 1) != '/')
- errors[errors.length] = xhr.responseText;
- }
-
- xhr.sendAsBinary(postbody);
- };
-
- reader.onerror = function(evt) {
- $('#loading').css('display', 'none');
- uploadInProgress = false;
- processUploadQueue();
- errors[errors.length] = browser.label("Failed to upload {filename}!", {
- filename: evt.target.thisFileName
- });
- };
-
- reader.readAsBinaryString(file);
-
- } else {
- filesCount = 0;
- var loop = setInterval(function() {
- if (uploadInProgress) return;
- boundary = '------multipartdropuploadboundary' + (new Date).getTime();
- uploadQueue = [];
- clearInterval(loop);
- if (currentFile.thisTargetDir == browser.dir)
- browser.refresh();
- if (errors.length) {
- browser.alert(errors.join('\n'));
- errors = [];
- }
- }, 333);
- }
- }
-};
diff --git a/js/browser/files.js b/js/browser/files.js
deleted file mode 100644
index 2d7707c..0000000
--- a/js/browser/files.js
+++ /dev/null
@@ -1,610 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */?>
-
-browser.initFiles = function() {
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- return !browser.selectAll(e);
- });
- $('#files').unbind();
- $('#files').scroll(function() {
- browser.hideDialog();
- });
- $('.file').unbind();
- $('.file').click(function(e) {
- _.unselect();
- browser.selectFile($(this), e);
- });
- $('.file').rightClick(function(e) {
- _.unselect();
- browser.menuFile($(this), e);
- });
- $('.file').dblclick(function() {
- _.unselect();
- browser.returnFile($(this));
- });
- $('.file').mouseup(function() {
- _.unselect();
- });
- $('.file').mouseout(function() {
- _.unselect();
- });
- $.each(this.shows, function(i, val) {
- var display = (_.kuki.get('show' + val) == 'off')
- ? 'none' : 'block';
- $('#files .file div.' + val).css('display', display);
- });
- this.statusDir();
-};
-
-browser.showFiles = function(callBack, selected) {
- this.fadeFiles();
- setTimeout(function() {
- var html = '';
- $.each(browser.files, function(i, file) {
- var stamp = [];
- $.each(file, function(key, val) {
- stamp[stamp.length] = key + "|" + val;
- });
- stamp = _.md5(stamp.join('|'));
- if (_.kuki.get('view') == 'list') {
- if (!i) html += '';
- var icon = _.getFileExtension(file.name);
- if (file.thumb)
- icon = '.image';
- else if (!icon.length || !file.smallIcon)
- icon = '.';
- icon = 'themes/' + browser.theme + '/img/files/small/' + icon + '.png';
- html += '' +
- '' + _.htmlData(file.name) + ' ' +
- '' + file.date + ' ' +
- '' + browser.humanSize(file.size) + ' ' +
- ' ';
- if (i == browser.files.length - 1) html += '
';
- } else {
- if (file.thumb)
- var icon = browser.baseGetData('thumb') + '&file=' + encodeURIComponent(file.name) + '&dir=' + encodeURIComponent(browser.dir) + '&stamp=' + stamp;
- else if (file.smallThumb) {
- var icon = browser.uploadURL + '/' + browser.dir + '/' + file.name;
- icon = _.escapeDirs(icon).replace(/\'/g, "%27");
- } else {
- var icon = file.bigIcon ? _.getFileExtension(file.name) : '.';
- if (!icon.length) icon = '.';
- icon = 'themes/' + browser.theme + '/img/files/big/' + icon + '.png';
- }
- html += '' +
- '
' +
- '
' + _.htmlData(file.name) + '
' +
- '
' + file.date + '
' +
- '
' + browser.humanSize(file.size) + '
' +
- '
';
- }
- });
- $('#files').html('' + html + '
');
- $.each(browser.files, function(i, file) {
- var item = $('#files .file').get(i);
- $(item).data(file);
- if (_.inArray(file.name, selected) ||
- ((typeof selected != 'undefined') && !selected.push && (file.name == selected))
- )
- $(item).addClass('selected');
- });
- $('#files > div').css({opacity:'', filter:''});
- if (callBack) callBack();
- browser.initFiles();
- }, 200);
-};
-
-browser.selectFile = function(file, e) {
- if (e.ctrlKey || e.metaKey) {
- if (file.hasClass('selected'))
- file.removeClass('selected');
- else
- file.addClass('selected');
- var files = $('.file.selected').get();
- var size = 0;
- if (!files.length)
- this.statusDir();
- else {
- $.each(files, function(i, cfile) {
- size += parseInt($(cfile).data('size'));
- });
- size = this.humanSize(size);
- if (files.length > 1)
- $('#fileinfo').html(files.length + ' ' + this.label("selected files") + ' (' + size + ')');
- else {
- var data = $(files[0]).data();
- $('#fileinfo').html(data.name + ' (' + this.humanSize(data.size) + ', ' + data.date + ')');
- }
- }
- } else {
- var data = file.data();
- $('.file').removeClass('selected');
- file.addClass('selected');
- $('#fileinfo').html(data.name + ' (' + this.humanSize(data.size) + ', ' + data.date + ')');
- }
-};
-
-browser.selectAll = function(e) {
- if ((!e.ctrlKey && !e.metaKey) || ((e.keyCode != 65) && (e.keyCode != 97)))
- return false;
- var files = $('.file').get();
- if (files.length) {
- var size = 0;
- $.each(files, function(i, file) {
- if (!$(file).hasClass('selected'))
- $(file).addClass('selected');
- size += parseInt($(file).data('size'));
- });
- size = this.humanSize(size);
- $('#fileinfo').html(files.length + ' ' + this.label("selected files") + ' (' + size + ')');
- }
- return true;
-};
-
-browser.returnFile = function(file) {
-
- var fileURL = file.substr
- ? file : browser.uploadURL + '/' + browser.dir + '/' + file.data('name');
- fileURL = _.escapeDirs(fileURL);
-
- if (this.opener.CKEditor) {
- this.opener.CKEditor.object.tools.callFunction(this.opener.CKEditor.funcNum, fileURL, '');
- window.close();
-
- } else if (this.opener.FCKeditor) {
- window.opener.SetUrl(fileURL) ;
- window.close() ;
-
- } else if (this.opener.TinyMCE) {
- var win = tinyMCEPopup.getWindowArg('window');
- win.document.getElementById(tinyMCEPopup.getWindowArg('input')).value = fileURL;
- if (win.getImageData) win.getImageData();
- if (typeof(win.ImageDialog) != "undefined") {
- if (win.ImageDialog.getImageData)
- win.ImageDialog.getImageData();
- if (win.ImageDialog.showPreviewImage)
- win.ImageDialog.showPreviewImage(fileURL);
- }
- tinyMCEPopup.close();
-
- } else if (this.opener.callBack) {
-
- if (window.opener && window.opener.KCFinder) {
- this.opener.callBack(fileURL);
- window.close();
- }
-
- if (window.parent && window.parent.KCFinder) {
- var button = $('#toolbar a[href="kcact:maximize"]');
- if (button.hasClass('selected'))
- this.maximize(button);
- this.opener.callBack(fileURL);
- }
-
- } else if (this.opener.callBackMultiple) {
- if (window.opener && window.opener.KCFinder) {
- this.opener.callBackMultiple([fileURL]);
- window.close();
- }
-
- if (window.parent && window.parent.KCFinder) {
- var button = $('#toolbar a[href="kcact:maximize"]');
- if (button.hasClass('selected'))
- this.maximize(button);
- this.opener.callBackMultiple([fileURL]);
- }
-
- }
-};
-
-browser.returnFiles = function(files) {
- if (this.opener.callBackMultiple && files.length) {
- var rfiles = [];
- $.each(files, function(i, file) {
- rfiles[i] = browser.uploadURL + '/' + browser.dir + '/' + $(file).data('name');
- rfiles[i] = _.escapeDirs(rfiles[i]);
- });
- this.opener.callBackMultiple(rfiles);
- if (window.opener) window.close()
- }
-};
-
-browser.returnThumbnails = function(files) {
- if (this.opener.callBackMultiple) {
- var rfiles = [];
- var j = 0;
- $.each(files, function(i, file) {
- if ($(file).data('thumb')) {
- rfiles[j] = browser.thumbsURL + '/' + browser.dir + '/' + $(file).data('name');
- rfiles[j] = _.escapeDirs(rfiles[j++]);
- }
- });
- this.opener.callBackMultiple(rfiles);
- if (window.opener) window.close()
- }
-};
-
-browser.menuFile = function(file, e) {
- var data = file.data();
- var path = this.dir + '/' + data.name;
- var files = $('.file.selected').get();
- var html = '';
-
- if (file.hasClass('selected') && files.length && (files.length > 1)) {
- var thumb = false;
- var notWritable = 0;
- var cdata;
- $.each(files, function(i, cfile) {
- cdata = $(cfile).data();
- if (cdata.thumb) thumb = true;
- if (!data.writable) notWritable++;
- });
- if (this.opener.callBackMultiple) {
- html += '
' + this.label("Select") + ' ';
- if (thumb) html +=
- '
' + this.label("Select Thumbnails") + ' ';
- }
- if (data.thumb || data.smallThumb || this.support.zip) {
- html += (html.length ? '
' : '');
- if (data.thumb || data.smallThumb)
- html +='
' + this.label("View") + ' ';
- if (this.support.zip) html += (html.length ? '
' : '') +
- '
' + this.label("Download") + ' ';
- }
-
- if (this.access.files.copy || this.access.files.move)
- html += (html.length ? '
' : '') +
- '
' + this.label("Add to Clipboard") + ' ';
- if (this.access.files['delete'])
- html += (html.length ? '
' : '') +
- '
' + this.label("Delete") + ' ';
-
- if (html.length) {
- html = '';
- $('#dialog').html(html);
- this.showMenu(e);
- } else
- return;
-
- $('.menu a[href="kcact:pick"]').click(function() {
- browser.returnFiles(files);
- browser.hideDialog();
- return false;
- });
-
- $('.menu a[href="kcact:pick_thumb"]').click(function() {
- browser.returnThumbnails(files);
- browser.hideDialog();
- return false;
- });
-
- $('.menu a[href="kcact:download"]').click(function() {
- browser.hideDialog();
- var pfiles = [];
- $.each(files, function(i, cfile) {
- pfiles[i] = $(cfile).data('name');
- });
- browser.post(browser.baseGetData('downloadSelected'), {dir:browser.dir, files:pfiles});
- return false;
- });
-
- $('.menu a[href="kcact:clpbrdadd"]').click(function() {
- browser.hideDialog();
- var msg = '';
- $.each(files, function(i, cfile) {
- var cdata = $(cfile).data();
- var failed = false;
- for (i = 0; i < browser.clipboard.length; i++)
- if ((browser.clipboard[i].name == cdata.name) &&
- (browser.clipboard[i].dir == browser.dir)
- ) {
- failed = true
- msg += cdata.name + ": " + browser.label("This file is already added to the Clipboard.") + "\n";
- break;
- }
-
- if (!failed) {
- cdata.dir = browser.dir;
- browser.clipboard[browser.clipboard.length] = cdata;
- }
- });
- browser.initClipboard();
- if (msg.length) browser.alert(msg.substr(0, msg.length - 1));
- return false;
- });
-
- $('.menu a[href="kcact:rm"]').click(function() {
- if ($(this).hasClass('denied')) return false;
- browser.hideDialog();
- var failed = 0;
- var dfiles = [];
- $.each(files, function(i, cfile) {
- var cdata = $(cfile).data();
- if (!cdata.writable)
- failed++;
- else
- dfiles[dfiles.length] = browser.dir + "/" + cdata.name;
- });
- if (failed == files.length) {
- browser.alert(browser.label("The selected files are not removable."));
- return false;
- }
-
- var go = function(callBack) {
- browser.fadeFiles();
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('rm_cbd'),
- data: {files:dfiles},
- async: false,
- success: function(data) {
- if (callBack) callBack();
- browser.check4errors(data);
- browser.refresh();
- },
- error: function() {
- if (callBack) callBack();
- $('#files > div').css({
- opacity: '',
- filter: ''
- });
- browser.alert(browser.label("Unknown error."));
- }
- });
- };
-
- if (failed)
- browser.confirm(
- browser.label("{count} selected files are not removable. Do you want to delete the rest?", {count:failed}),
- go
- )
-
- else
- browser.confirm(
- browser.label("Are you sure you want to delete all selected files?"),
- go
- );
-
- return false;
- });
-
- } else {
- html += '';
-
- $('#dialog').html(html);
- this.showMenu(e);
-
- $('.menu a[href="kcact:pick"]').click(function() {
- browser.returnFile(file);
- browser.hideDialog();
- return false;
- });
-
- $('.menu a[href="kcact:pick_thumb"]').click(function() {
- var path = browser.thumbsURL + '/' + browser.dir + '/' + data.name;
- browser.returnFile(path);
- browser.hideDialog();
- return false;
- });
-
- $('.menu a[href="kcact:download"]').click(function() {
- var html = '
';
- $('#dialog').html(html);
- $('#downloadForm input').get(0).value = browser.dir;
- $('#downloadForm input').get(1).value = data.name;
- $('#downloadForm').submit();
- return false;
- });
-
- $('.menu a[href="kcact:clpbrdadd"]').click(function() {
- for (i = 0; i < browser.clipboard.length; i++)
- if ((browser.clipboard[i].name == data.name) &&
- (browser.clipboard[i].dir == browser.dir)
- ) {
- browser.hideDialog();
- browser.alert(browser.label("This file is already added to the Clipboard."));
- return false;
- }
- var cdata = data;
- cdata.dir = browser.dir;
- browser.clipboard[browser.clipboard.length] = cdata;
- browser.initClipboard();
- browser.hideDialog();
- return false;
- });
-
- $('.menu a[href="kcact:mv"]').click(function(e) {
- if (!data.writable) return false;
- browser.fileNameDialog(
- e, {dir: browser.dir, file: data.name},
- 'newName', data.name, browser.baseGetData('rename'), {
- title: "New file name:",
- errEmpty: "Please enter new file name.",
- errSlash: "Unallowable characters in file name.",
- errDot: "File name shouldn't begins with '.'"
- },
- function() {
- browser.refresh();
- }
- );
- return false;
- });
-
- $('.menu a[href="kcact:rm"]').click(function() {
- if (!data.writable) return false;
- browser.hideDialog();
- browser.confirm(browser.label("Are you sure you want to delete this file?"),
- function(callBack) {
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('delete'),
- data: {dir:browser.dir, file:data.name},
- async: false,
- success: function(data) {
- if (callBack) callBack();
- browser.clearClipboard();
- if (browser.check4errors(data))
- return;
- browser.refresh();
- },
- error: function() {
- if (callBack) callBack();
- browser.alert(browser.label("Unknown error."));
- }
- });
- }
- );
- return false;
- });
- }
-
- $('.menu a[href="kcact:view"]').click(function() {
- browser.hideDialog();
- var ts = new Date().getTime();
- var showImage = function(data) {
- url = _.escapeDirs(browser.uploadURL + '/' + browser.dir + '/' + data.name) + '?ts=' + ts,
- $('#loading').html(browser.label("Loading image..."));
- $('#loading').css('display', 'inline');
- var img = new Image();
- img.src = url;
- img.onerror = function() {
- browser.lock = false;
- $('#loading').css('display', 'none');
- browser.alert(browser.label("Unknown error."));
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- return !browser.selectAll(e);
- });
- browser.refresh();
- };
- var onImgLoad = function() {
- browser.lock = false;
- $('#files .file').each(function() {
- if ($(this).data('name') == data.name)
- browser.ssImage = this;
- });
- $('#loading').css('display', 'none');
- $('#dialog').html('
');
- $('#dialog img').attr({
- src: url,
- title: data.name
- }).fadeIn('fast', function() {
- var o_w = $('#dialog').outerWidth();
- var o_h = $('#dialog').outerHeight();
- var f_w = $(window).width() - 30;
- var f_h = $(window).height() - 30;
- if ((o_w > f_w) || (o_h > f_h)) {
- if ((f_w / f_h) > (o_w / o_h))
- f_w = parseInt((o_w * f_h) / o_h);
- else if ((f_w / f_h) < (o_w / o_h))
- f_h = parseInt((o_h * f_w) / o_w);
- $('#dialog img').attr({
- width: f_w,
- height: f_h
- });
- }
- $('#dialog').unbind('click');
- $('#dialog').click(function(e) {
- browser.hideDialog();
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- return !browser.selectAll(e);
- });
- if (browser.ssImage) {
- browser.selectFile($(browser.ssImage), e);
- }
- });
- browser.showDialog();
- var images = [];
- $.each(browser.files, function(i, file) {
- if (file.thumb || file.smallThumb)
- images[images.length] = file;
- });
- if (images.length)
- $.each(images, function(i, image) {
- if (image.name == data.name) {
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- if (images.length > 1) {
- if (!browser.lock && (e.keyCode == 37)) {
- var nimg = i
- ? images[i - 1]
- : images[images.length - 1];
- browser.lock = true;
- showImage(nimg);
- }
- if (!browser.lock && (e.keyCode == 39)) {
- var nimg = (i >= images.length - 1)
- ? images[0]
- : images[i + 1];
- browser.lock = true;
- showImage(nimg);
- }
- }
- if (e.keyCode == 27) {
- browser.hideDialog();
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- return !browser.selectAll(e);
- });
- }
- });
- }
- });
- });
- };
- if (img.complete)
- onImgLoad();
- else
- img.onload = onImgLoad;
- };
- showImage(data);
- return false;
- });
-};
diff --git a/js/browser/folders.js b/js/browser/folders.js
deleted file mode 100644
index e170cc4..0000000
--- a/js/browser/folders.js
+++ /dev/null
@@ -1,369 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */?>
-
-browser.initFolders = function() {
- $('#folders').scroll(function() {
- browser.hideDialog();
- });
- $('div.folder > a').unbind();
- $('div.folder > a').bind('click', function() {
- browser.hideDialog();
- return false;
- });
- $('div.folder > a > span.brace').unbind();
- $('div.folder > a > span.brace').click(function() {
- if ($(this).hasClass('opened') || $(this).hasClass('closed'))
- browser.expandDir($(this).parent());
- });
- $('div.folder > a > span.folder').unbind();
- $('div.folder > a > span.folder').click(function() {
- browser.changeDir($(this).parent());
- });
- $('div.folder > a > span.folder').rightClick(function(e) {
- _.unselect();
- browser.menuDir($(this).parent(), e);
- });
-
- if ($.browser.msie && $.browser.version &&
- (parseInt($.browser.version.substr(0, 1)) < 8)
- ) {
- var fls = $('div.folder').get();
- var body = $('body').get(0);
- var div;
- $.each(fls, function(i, folder) {
- div = document.createElement('div');
- div.style.display = 'inline';
- div.style.margin = div.style.border = div.style.padding = '0';
- div.innerHTML='
";
- body.appendChild(div);
- $(folder).css('width', $(div).innerWidth() + 'px');
- body.removeChild(div);
- });
- }
-};
-
-browser.setTreeData = function(data, path) {
- if (!path)
- path = '';
- else if (path.length && (path.substr(path.length - 1, 1) != '/'))
- path += '/';
- path += data.name;
- var selector = '#folders a[href="kcdir:/' + _.escapeDirs(path) + '"]';
- $(selector).data({
- name: data.name,
- path: path,
- readable: data.readable,
- writable: data.writable,
- removable: data.removable,
- hasDirs: data.hasDirs
- });
- $(selector + ' span.folder').addClass(data.current ? 'current' : 'regular');
- if (data.dirs && data.dirs.length) {
- $(selector + ' span.brace').addClass('opened');
- $.each(data.dirs, function(i, cdir) {
- browser.setTreeData(cdir, path + '/');
- });
- } else if (data.hasDirs)
- $(selector + ' span.brace').addClass('closed');
-};
-
-browser.buildTree = function(root, path) {
- if (!path) path = "";
- path += root.name;
- var html = '
' + _.htmlData(root.name) + ' ';
- if (root.dirs) {
- html += '
';
- for (var i = 0; i < root.dirs.length; i++) {
- cdir = root.dirs[i];
- html += browser.buildTree(cdir, path + '/');
- }
- html += '
';
- }
- html += '
';
- return html;
-};
-
-browser.expandDir = function(dir) {
- var path = dir.data('path');
- if (dir.children('.brace').hasClass('opened')) {
- dir.parent().children('.folders').hide(500, function() {
- if (path == browser.dir.substr(0, path.length))
- browser.changeDir(dir);
- });
- dir.children('.brace').removeClass('opened');
- dir.children('.brace').addClass('closed');
- } else {
- if (dir.parent().children('.folders').get(0)) {
- dir.parent().children('.folders').show(500);
- dir.children('.brace').removeClass('closed');
- dir.children('.brace').addClass('opened');
- } else if (!$('#loadingDirs').get(0)) {
- dir.parent().append('
' + this.label("Loading folders...") + '
');
- $('#loadingDirs').css('display', 'none');
- $('#loadingDirs').show(200, function() {
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('expand'),
- data: {dir:path},
- async: false,
- success: function(data) {
- $('#loadingDirs').hide(200, function() {
- $('#loadingDirs').detach();
- });
- if (browser.check4errors(data))
- return;
-
- var html = '';
- $.each(data.dirs, function(i, cdir) {
- html += '
';
- });
- if (html.length) {
- dir.parent().append('
' + html + '
');
- var folders = $(dir.parent().children('.folders').first());
- folders.css('display', 'none');
- $(folders).show(500);
- $.each(data.dirs, function(i, cdir) {
- browser.setTreeData(cdir, path);
- });
- }
- if (data.dirs.length) {
- dir.children('.brace').removeClass('closed');
- dir.children('.brace').addClass('opened');
- } else {
- dir.children('.brace').removeClass('opened');
- dir.children('.brace').removeClass('closed');
- }
- browser.initFolders();
- browser.initDropUpload();
- },
- error: function() {
- $('#loadingDirs').detach();
- browser.alert(browser.label("Unknown error."));
- }
- });
- });
- }
- }
-};
-
-browser.changeDir = function(dir) {
- if (dir.children('span.folder').hasClass('regular')) {
- $('div.folder > a > span.folder').removeClass('current');
- $('div.folder > a > span.folder').removeClass('regular');
- $('div.folder > a > span.folder').addClass('regular');
- dir.children('span.folder').removeClass('regular');
- dir.children('span.folder').addClass('current');
- $('#files').html(browser.label("Loading files..."));
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('chDir'),
- data: {dir:dir.data('path')},
- async: false,
- success: function(data) {
- if (browser.check4errors(data))
- return;
- browser.files = data.files;
- browser.orderFiles();
- browser.dir = dir.data('path');
- browser.dirWritable = data.dirWritable;
- var title = "KCFinder: /" + browser.dir;
- document.title = title;
- if (browser.opener.TinyMCE)
- tinyMCEPopup.editor.windowManager.setTitle(window, title);
- browser.statusDir();
- },
- error: function() {
- $('#files').html(browser.label("Unknown error."));
- }
- });
- }
-};
-
-browser.statusDir = function() {
- for (var i = 0, size = 0; i < this.files.length; i++)
- size += parseInt(this.files[i].size);
- size = this.humanSize(size);
- $('#fileinfo').html(this.files.length + ' ' + this.label("files") + ' (' + size + ')');
-};
-
-browser.menuDir = function(dir, e) {
- var data = dir.data();
- var html = '';
-
- $('#dialog').html(html);
- this.showMenu(e);
- $('div.folder > a > span.folder').removeClass('context');
- if (dir.children('span.folder').hasClass('regular'))
- dir.children('span.folder').addClass('context');
-
- if (this.clipboard && this.clipboard.length && data.writable) {
-
- $('.menu a[href="kcact:cpcbd"]').click(function() {
- browser.hideDialog();
- browser.copyClipboard(data.path);
- return false;
- });
-
- $('.menu a[href="kcact:mvcbd"]').click(function() {
- browser.hideDialog();
- browser.moveClipboard(data.path);
- return false;
- });
- }
-
- $('.menu a[href="kcact:refresh"]').click(function() {
- browser.hideDialog();
- browser.refreshDir(dir);
- return false;
- });
-
- $('.menu a[href="kcact:download"]').click(function() {
- browser.hideDialog();
- browser.post(browser.baseGetData('downloadDir'), {dir:data.path});
- return false;
- });
-
- $('.menu a[href="kcact:mkdir"]').click(function(e) {
- if (!data.writable) return false;
- browser.hideDialog();
- browser.fileNameDialog(
- e, {dir: data.path},
- 'newDir', '', browser.baseGetData('newDir'), {
- title: "New folder name:",
- errEmpty: "Please enter new folder name.",
- errSlash: "Unallowable characters in folder name.",
- errDot: "Folder name shouldn't begins with '.'"
- }, function() {
- browser.refreshDir(dir);
- browser.initDropUpload();
- if (!data.hasDirs) {
- dir.data('hasDirs', true);
- dir.children('span.brace').addClass('closed');
- }
- }
- );
- return false;
- });
-
- $('.menu a[href="kcact:mvdir"]').click(function(e) {
- if (!data.removable) return false;
- browser.hideDialog();
- browser.fileNameDialog(
- e, {dir: data.path},
- 'newName', data.name, browser.baseGetData('renameDir'), {
- title: "New folder name:",
- errEmpty: "Please enter new folder name.",
- errSlash: "Unallowable characters in folder name.",
- errDot: "Folder name shouldn't begins with '.'"
- }, function(dt) {
- if (!dt.name) {
- browser.alert(browser.label("Unknown error."));
- return;
- }
- var currentDir = (data.path == browser.dir);
- dir.children('span.folder').html(_.htmlData(dt.name));
- dir.data('name', dt.name);
- dir.data('path', _.dirname(data.path) + '/' + dt.name);
- if (currentDir)
- browser.dir = dir.data('path');
- browser.initDropUpload();
- },
- true
- );
- return false;
- });
-
- $('.menu a[href="kcact:rmdir"]').click(function() {
- if (!data.removable) return false;
- browser.hideDialog();
- browser.confirm(
- "Are you sure you want to delete this folder and all its content?",
- function(callBack) {
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('deleteDir'),
- data: {dir: data.path},
- async: false,
- success: function(data) {
- if (callBack) callBack();
- if (browser.check4errors(data))
- return;
- dir.parent().hide(500, function() {
- var folders = dir.parent().parent();
- var pDir = folders.parent().children('a').first();
- dir.parent().detach();
- if (!folders.children('div.folder').get(0)) {
- pDir.children('span.brace').first().removeClass('opened');
- pDir.children('span.brace').first().removeClass('closed');
- pDir.parent().children('.folders').detach();
- pDir.data('hasDirs', false);
- }
- if (pDir.data('path') == browser.dir.substr(0, pDir.data('path').length))
- browser.changeDir(pDir);
- browser.initDropUpload();
- });
- },
- error: function() {
- if (callBack) callBack();
- browser.alert(browser.label("Unknown error."));
- }
- });
- }
- );
- return false;
- });
-};
-
-browser.refreshDir = function(dir) {
- var path = dir.data('path');
- if (dir.children('.brace').hasClass('opened') || dir.children('.brace').hasClass('closed')) {
- dir.children('.brace').removeClass('opened');
- dir.children('.brace').addClass('closed');
- }
- dir.parent().children('.folders').first().detach();
- if (path == browser.dir.substr(0, path.length))
- browser.changeDir(dir);
- browser.expandDir(dir);
- return true;
-};
diff --git a/js/browser/init.js b/js/browser/init.js
deleted file mode 100644
index ab8df3d..0000000
--- a/js/browser/init.js
+++ /dev/null
@@ -1,187 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */?>
-
-browser.init = function() {
- if (!this.checkAgent()) return;
-
- $('body').click(function() {
- browser.hideDialog();
- });
- $('#shadow').click(function() {
- return false;
- });
- $('#dialog').unbind();
- $('#dialog').click(function() {
- return false;
- });
- $('#alert').unbind();
- $('#alert').click(function() {
- return false;
- });
- this.initOpeners();
- this.initSettings();
- this.initContent();
- this.initToolbar();
- this.initResizer();
- this.initDropUpload();
-};
-
-browser.checkAgent = function() {
- if (!$.browser.version ||
- ($.browser.msie && (parseInt($.browser.version) < 7) && !this.support.chromeFrame) ||
- ($.browser.opera && (parseInt($.browser.version) < 10)) ||
- ($.browser.mozilla && (parseFloat($.browser.version.replace(/^(\d+(\.\d+)?)([^\d].*)?$/, "$1")) < 1.8))
- ) {
- var html = '
';
- $('body').html(html);
- return false;
- }
- return true;
-};
-
-browser.initOpeners = function() {
- if (this.opener.TinyMCE && (typeof(tinyMCEPopup) == 'undefined'))
- this.opener.TinyMCE = null;
-
- if (this.opener.TinyMCE)
- this.opener.callBack = true;
-
- if ((!this.opener.name || (this.opener.name == 'fckeditor')) &&
- window.opener && window.opener.SetUrl
- ) {
- this.opener.FCKeditor = true;
- this.opener.callBack = true;
- }
-
- if (this.opener.CKEditor) {
- if (window.parent && window.parent.CKEDITOR)
- this.opener.CKEditor.object = window.parent.CKEDITOR;
- else if (window.opener && window.opener.CKEDITOR) {
- this.opener.CKEditor.object = window.opener.CKEDITOR;
- this.opener.callBack = true;
- } else
- this.opener.CKEditor = null;
- }
-
- if (!this.opener.CKEditor && !this.opener.FCKEditor && !this.TinyMCE) {
- if ((window.opener && window.opener.KCFinder && window.opener.KCFinder.callBack) ||
- (window.parent && window.parent.KCFinder && window.parent.KCFinder.callBack)
- )
- this.opener.callBack = window.opener
- ? window.opener.KCFinder.callBack
- : window.parent.KCFinder.callBack;
-
- if ((
- window.opener &&
- window.opener.KCFinder &&
- window.opener.KCFinder.callBackMultiple
- ) || (
- window.parent &&
- window.parent.KCFinder &&
- window.parent.KCFinder.callBackMultiple
- )
- )
- this.opener.callBackMultiple = window.opener
- ? window.opener.KCFinder.callBackMultiple
- : window.parent.KCFinder.callBackMultiple;
- }
-};
-
-browser.initContent = function() {
- $('div#folders').html(this.label("Loading folders..."));
- $('div#files').html(this.label("Loading files..."));
- $.ajax({
- type: 'GET',
- dataType: 'json',
- url: browser.baseGetData('init'),
- async: false,
- success: function(data) {
- if (browser.check4errors(data))
- return;
- browser.dirWritable = data.dirWritable;
- $('#folders').html(browser.buildTree(data.tree));
- browser.setTreeData(data.tree);
- browser.initFolders();
- browser.files = data.files ? data.files : [];
- browser.orderFiles();
- },
- error: function() {
- $('div#folders').html(browser.label("Unknown error."));
- $('div#files').html(browser.label("Unknown error."));
- }
- });
-};
-
-browser.initResizer = function() {
- var cursor = ($.browser.opera) ? 'move' : 'col-resize';
- $('#resizer').css('cursor', cursor);
- $('#resizer').drag('start', function() {
- $(this).css({opacity:'0.4', filter:'alpha(opacity:40)'});
- $('#all').css('cursor', cursor);
- });
- $('#resizer').drag(function(e) {
- var left = e.pageX - parseInt(_.nopx($(this).css('width')) / 2);
- left = (left >= 0) ? left : 0;
- left = (left + _.nopx($(this).css('width')) < $(window).width())
- ? left : $(window).width() - _.nopx($(this).css('width'));
- $(this).css('left', left);
- });
- var end = function() {
- $(this).css({opacity:'0', filter:'alpha(opacity:0)'});
- $('#all').css('cursor', '');
- var left = _.nopx($(this).css('left')) + _.nopx($(this).css('width'));
- var right = $(window).width() - left;
- $('#left').css('width', left + 'px');
- $('#right').css('width', right + 'px');
- _('files').style.width = $('#right').innerWidth() - _.outerHSpace('#files') + 'px';
- _('resizer').style.left = $('#left').outerWidth() - _.outerRightSpace('#folders', 'm') + 'px';
- _('resizer').style.width = _.outerRightSpace('#folders', 'm') + _.outerLeftSpace('#files', 'm') + 'px';
- browser.fixFilesHeight();
- };
- $('#resizer').drag('end', end);
- $('#resizer').mouseup(end);
-};
-
-browser.resize = function() {
- _('left').style.width = '25%';
- _('right').style.width = '75%';
- _('toolbar').style.height = $('#toolbar a').outerHeight() + "px";
- _('shadow').style.width = $(window).width() + 'px';
- _('shadow').style.height = _('resizer').style.height = $(window).height() + 'px';
- _('left').style.height = _('right').style.height =
- $(window).height() - $('#status').outerHeight() + 'px';
- _('folders').style.height =
- $('#left').outerHeight() - _.outerVSpace('#folders') + 'px';
- browser.fixFilesHeight();
- var width = $('#left').outerWidth() + $('#right').outerWidth();
- _('status').style.width = width + 'px';
- while ($('#status').outerWidth() > width)
- _('status').style.width = _.nopx(_('status').style.width) - 1 + 'px';
- while ($('#status').outerWidth() < width)
- _('status').style.width = _.nopx(_('status').style.width) + 1 + 'px';
- if ($.browser.msie && ($.browser.version.substr(0, 1) < 8))
- _('right').style.width = $(window).width() - $('#left').outerWidth() + 'px';
- _('files').style.width = $('#right').innerWidth() - _.outerHSpace('#files') + 'px';
- _('resizer').style.left = $('#left').outerWidth() - _.outerRightSpace('#folders', 'm') + 'px';
- _('resizer').style.width = _.outerRightSpace('#folders', 'm') + _.outerLeftSpace('#files', 'm') + 'px';
-};
-
-browser.fixFilesHeight = function() {
- _('files').style.height =
- $('#left').outerHeight() - $('#toolbar').outerHeight() - _.outerVSpace('#files') -
- (($('#settings').css('display') != "none") ? $('#settings').outerHeight() : 0) + 'px';
-};
diff --git a/js/browser/joiner.php b/js/browser/joiner.php
deleted file mode 100644
index f587098..0000000
--- a/js/browser/joiner.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */
-
-chdir(".."); // For compatibility
-chdir("..");
-require "lib/helper_httpCache.php";
-require "lib/helper_dir.php";
-$files = dir::content("js/browser", array(
- 'types' => "file",
- 'pattern' => '/^.*\.js$/'
-));
-
-foreach ($files as $file) {
- $fmtime = filemtime($file);
- if (!isset($mtime) || ($fmtime > $mtime))
- $mtime = $fmtime;
-}
-
-httpCache::checkMTime($mtime);
-header("Content-Type: text/javascript");
-foreach ($files as $file)
- require $file;
-
-?>
\ No newline at end of file
diff --git a/js/browser/misc.js b/js/browser/misc.js
deleted file mode 100644
index 5c1a6d8..0000000
--- a/js/browser/misc.js
+++ /dev/null
@@ -1,383 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */?>
-
-browser.drag = function(ev, dd) {
- var top = dd.offsetY,
- left = dd.offsetX;
- if (top < 0) top = 0;
- if (left < 0) left = 0;
- if (top + $(this).outerHeight() > $(window).height())
- top = $(window).height() - $(this).outerHeight();
- if (left + $(this).outerWidth() > $(window).width())
- left = $(window).width() - $(this).outerWidth();
- $(this).css({
- top: top,
- left: left
- });
-};
-
-browser.showDialog = function(e) {
- $('#dialog').css({left: 0, top: 0});
- this.shadow();
- if ($('#dialog div.box') && !$('#dialog div.title').get(0)) {
- var html = $('#dialog div.box').html();
- var title = $('#dialog').data('title') ? $('#dialog').data('title') : "";
- html = '
' + title + '
' + html;
- $('#dialog div.box').html(html);
- $('#dialog div.title span.close').mousedown(function() {
- $(this).addClass('clicked');
- });
- $('#dialog div.title span.close').mouseup(function() {
- $(this).removeClass('clicked');
- });
- $('#dialog div.title span.close').click(function() {
- browser.hideDialog();
- browser.hideAlert();
- });
- }
- $('#dialog').drag(browser.drag, {handle: '#dialog div.title'});
- $('#dialog').css('display', 'block');
-
- if (e) {
- var left = e.pageX - parseInt($('#dialog').outerWidth() / 2);
- var top = e.pageY - parseInt($('#dialog').outerHeight() / 2);
- if (left < 0) left = 0;
- if (top < 0) top = 0;
- if (($('#dialog').outerWidth() + left) > $(window).width())
- left = $(window).width() - $('#dialog').outerWidth();
- if (($('#dialog').outerHeight() + top) > $(window).height())
- top = $(window).height() - $('#dialog').outerHeight();
- $('#dialog').css({
- left: left + 'px',
- top: top + 'px'
- });
- } else
- $('#dialog').css({
- left: parseInt(($(window).width() - $('#dialog').outerWidth()) / 2) + 'px',
- top: parseInt(($(window).height() - $('#dialog').outerHeight()) / 2) + 'px'
- });
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- if (e.keyCode == 27)
- browser.hideDialog();
- });
-};
-
-browser.hideDialog = function() {
- this.unshadow();
- if ($('#clipboard').hasClass('selected'))
- $('#clipboard').removeClass('selected');
- $('#dialog').css('display', 'none');
- $('div.folder > a > span.folder').removeClass('context');
- $('#dialog').html('');
- $('#dialog').data('title', null);
- $('#dialog').unbind();
- $('#dialog').click(function() {
- return false;
- });
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- return !browser.selectAll(e);
- });
- browser.hideAlert();
-};
-
-browser.showAlert = function(shadow) {
- $('#alert').css({left: 0, top: 0});
- if (typeof shadow == 'undefined')
- shadow = true;
- if (shadow)
- this.shadow();
- var left = parseInt(($(window).width() - $('#alert').outerWidth()) / 2),
- top = parseInt(($(window).height() - $('#alert').outerHeight()) / 2);
- var wheight = $(window).height();
- if (top < 0)
- top = 0;
- $('#alert').css({
- left: left + 'px',
- top: top + 'px',
- display: 'block'
- });
- if ($('#alert').outerHeight() > wheight) {
- $('#alert div.message').css({
- height: wheight - $('#alert div.title').outerHeight() - $('#alert div.ok').outerHeight() - 20 + 'px'
- });
- }
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- if (e.keyCode == 27) {
- browser.hideDialog();
- browser.hideAlert();
- $(document).unbind('keydown');
- $(document).keydown(function(e) {
- return !browser.selectAll(e);
- });
- }
- });
-};
-
-browser.hideAlert = function(shadow) {
- if (typeof shadow == 'undefined')
- shadow = true;
- if (shadow)
- this.unshadow();
- $('#alert').css('display', 'none');
- $('#alert').html('');
- $('#alert').data('title', null);
-};
-
-browser.alert = function(msg, shadow) {
- msg = msg.replace(/\r?\n/g, "
");
- var title = $('#alert').data('title') ? $('#alert').data('title') : browser.label("Attention");
- $('#alert').html('
' + title + '
' + msg + '
' + browser.label("OK") + '
');
- $('#alert div.ok button').click(function() {
- browser.hideAlert(shadow);
- });
- $('#alert div.title span.close').mousedown(function() {
- $(this).addClass('clicked');
- });
- $('#alert div.title span.close').mouseup(function() {
- $(this).removeClass('clicked');
- });
- $('#alert div.title span.close').click(function() {
- browser.hideAlert(shadow);
- });
- $('#alert').drag(browser.drag, {handle: "#alert div.title"});
- browser.showAlert(shadow);
-};
-
-browser.confirm = function(question, callBack) {
- $('#dialog').data('title', browser.label("Question"));
- $('#dialog').html('
' + browser.label(question) + '
' + browser.label("No") + ' ' + browser.label("Yes") + '
');
- browser.showDialog();
- $('#dialog div.buttons button').first().click(function() {
- browser.hideDialog();
- });
- $('#dialog div.buttons button').last().click(function() {
- if (callBack)
- callBack(function() {
- browser.hideDialog();
- });
- else
- browser.hideDialog();
- });
- $('#dialog div.buttons button').get(1).focus();
-};
-
-browser.shadow = function() {
- $('#shadow').css('display', 'block');
-};
-
-browser.unshadow = function() {
- $('#shadow').css('display', 'none');
-};
-
-browser.showMenu = function(e) {
- var left = e.pageX;
- var top = e.pageY;
- if (($('#dialog').outerWidth() + left) > $(window).width())
- left = $(window).width() - $('#dialog').outerWidth();
- if (($('#dialog').outerHeight() + top) > $(window).height())
- top = $(window).height() - $('#dialog').outerHeight();
- $('#dialog').css({
- left: left + 'px',
- top: top + 'px',
- display: 'none'
- });
- $('#dialog').fadeIn();
-};
-
-browser.fileNameDialog = function(e, post, inputName, inputValue, url, labels, callBack, selectAll) {
- var html = '
';
- $('#dialog').html(html);
- $('#dialog').data('title', this.label(labels.title));
- $('#dialog input[name="' + inputName + '"]').attr('value', inputValue);
- $('#dialog').unbind();
- $('#dialog').click(function() {
- return false;
- });
- $('#dialog form').submit(function() {
- var name = this.elements[0];
- name.value = $.trim(name.value);
- if (name.value == '') {
- browser.alert(browser.label(labels.errEmpty), false);
- name.focus();
- return;
- } else if (/[\/\\]/g.test(name.value)) {
- browser.alert(browser.label(labels.errSlash), false);
- name.focus();
- return;
- } else if (name.value.substr(0, 1) == ".") {
- browser.alert(browser.label(labels.errDot), false);
- name.focus();
- return;
- }
- eval('post.' + inputName + ' = name.value;');
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: url,
- data: post,
- async: false,
- success: function(data) {
- if (browser.check4errors(data, false))
- return;
- if (callBack) callBack(data);
- browser.hideDialog();
- },
- error: function() {
- browser.alert(browser.label("Unknown error."), false);
- }
- });
- return false;
- });
- browser.showDialog(e);
- $('#dialog').css('display', 'block');
- $('#dialog input[type="submit"]').click(function() {
- return $('#dialog form').submit();
- });
- var field = $('#dialog input[type="text"]');
- var value = field.attr('value');
- if (!selectAll && /^(.+)\.[^\.]+$/ .test(value)) {
- value = value.replace(/^(.+)\.[^\.]+$/, "$1");
- _.selection(field.get(0), 0, value.length);
- } else {
- field.get(0).focus();
- field.get(0).select();
- }
-};
-
-browser.orderFiles = function(callBack, selected) {
- var order = _.kuki.get('order');
- var desc = (_.kuki.get('orderDesc') == 'on');
-
- if (!browser.files || !browser.files.sort)
- browser.files = [];
-
- browser.files = browser.files.sort(function(a, b) {
- var a1, b1, arr;
- if (!order) order = 'name';
-
- if (order == 'date') {
- a1 = a.mtime;
- b1 = b.mtime;
- } else if (order == 'type') {
- a1 = _.getFileExtension(a.name);
- b1 = _.getFileExtension(b.name);
- } else if (order == 'size') {
- a1 = a.size;
- b1 = b.size;
- } else
- eval('a1 = a.' + order + '.toLowerCase(); b1 = b.' + order + '.toLowerCase();');
-
- if ((order == 'size') || (order == 'date')) {
- if (a1 < b1) return desc ? 1 : -1;
- if (a1 > b1) return desc ? -1 : 1;
- }
-
- if (a1 == b1) {
- a1 = a.name.toLowerCase();
- b1 = b.name.toLowerCase();
- arr = [a1, b1];
- arr = arr.sort();
- return (arr[0] == a1) ? -1 : 1;
- }
-
- arr = [a1, b1];
- arr = arr.sort();
- if (arr[0] == a1) return desc ? 1 : -1;
- return desc ? -1 : 1;
- });
-
- browser.showFiles(callBack, selected);
- browser.initFiles();
-};
-
-browser.humanSize = function(size) {
- if (size < 1024) {
- size = size.toString() + ' B';
- } else if (size < 1048576) {
- size /= 1024;
- size = parseInt(size).toString() + ' KB';
- } else if (size < 1073741824) {
- size /= 1048576;
- size = parseInt(size).toString() + ' MB';
- } else if (size < 1099511627776) {
- size /= 1073741824;
- size = parseInt(size).toString() + ' GB';
- } else {
- size /= 1099511627776;
- size = parseInt(size).toString() + ' TB';
- }
- return size;
-};
-
-browser.baseGetData = function(act) {
- var data = 'browse.php?type=' + encodeURIComponent(this.type) + '&lng=' + this.lang;
- if (act)
- data += "&act=" + act;
- if (this.cms)
- data += "&cms=" + this.cms;
- return data;
-};
-
-browser.label = function(index, data) {
- var label = this.labels[index] ? this.labels[index] : index;
- if (data)
- $.each(data, function(key, val) {
- label = label.replace('{' + key + '}', val);
- });
- return label;
-};
-
-browser.check4errors = function(data, shadow) {
- if (!data.error)
- return false;
- var msg;
- if (data.error.join)
- msg = data.error.join("\n");
- else
- msg = data.error;
- browser.alert(msg, shadow);
- return true;
-};
-
-browser.post = function(url, data) {
- var html = '
';
- $('#dialog').html(html);
- $('#dialog').css('display', 'block');
- $('#postForm').get(0).submit();
-};
-
-browser.fadeFiles = function() {
- $('#files > div').css({
- opacity: '0.4',
- filter: 'alpha(opacity:40)'
- });
-};
diff --git a/js/browser/settings.js b/js/browser/settings.js
deleted file mode 100644
index 30f98b6..0000000
--- a/js/browser/settings.js
+++ /dev/null
@@ -1,102 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */?>
-
-browser.initSettings = function() {
-
- if (!this.shows.length) {
- var showInputs = $('#show input[type="checkbox"]').toArray();
- $.each(showInputs, function (i, input) {
- browser.shows[i] = input.name;
- });
- }
-
- var shows = this.shows;
-
- if (!_.kuki.isSet('showname')) {
- _.kuki.set('showname', 'on');
- $.each(shows, function (i, val) {
- if (val != "name") _.kuki.set('show' + val, 'off');
- });
- }
-
- $('#show input[type="checkbox"]').click(function() {
- var kuki = $(this).get(0).checked ? 'on' : 'off';
- _.kuki.set('show' + $(this).get(0).name, kuki)
- if ($(this).get(0).checked)
- $('#files .file div.' + $(this).get(0).name).css('display', 'block');
- else
- $('#files .file div.' + $(this).get(0).name).css('display', 'none');
- });
-
- $.each(shows, function(i, val) {
- var checked = (_.kuki.get('show' + val) == 'on') ? 'checked' : '';
- $('#show input[name="' + val + '"]').get(0).checked = checked;
- });
-
- if (!this.orders.length) {
- var orderInputs = $('#order input[type="radio"]').toArray();
- $.each(orderInputs, function (i, input) {
- browser.orders[i] = input.value;
- });
- }
-
- var orders = this.orders;
-
- if (!_.kuki.isSet('order'))
- _.kuki.set('order', 'name');
-
- if (!_.kuki.isSet('orderDesc'))
- _.kuki.set('orderDesc', 'off');
-
- $('#order input[value="' + _.kuki.get('order') + '"]').get(0).checked = true;
- $('#order input[name="desc"]').get(0).checked = (_.kuki.get('orderDesc') == 'on');
-
- $('#order input[type="radio"]').click(function() {
- _.kuki.set('order', $(this).get(0).value);
- browser.orderFiles();
- });
-
- $('#order input[name="desc"]').click(function() {
- _.kuki.set('orderDesc', $(this).get(0).checked ? 'on' : 'off');
- browser.orderFiles();
- });
-
- if (!_.kuki.isSet('view'))
- _.kuki.set('view', 'thumbs');
-
- if (_.kuki.get('view') == 'list') {
- $('#show input').each(function() { this.checked = true; });
- $('#show input').each(function() { this.disabled = true; });
- }
-
- $('#view input[value="' + _.kuki.get('view') + '"]').get(0).checked = true;
-
- $('#view input').click(function() {
- var view = $(this).attr('value');
- if (_.kuki.get('view') != view) {
- _.kuki.set('view', view);
- if (view == 'list') {
- $('#show input').each(function() { this.checked = true; });
- $('#show input').each(function() { this.disabled = true; });
- } else {
- $.each(browser.shows, function(i, val) {
- $('#show input[name="' + val + '"]').get(0).checked =
- (_.kuki.get('show' + val) == "on");
- });
- $('#show input').each(function() { this.disabled = false; });
- }
- }
- browser.refresh();
- });
-};
diff --git a/js/browser/toolbar.js b/js/browser/toolbar.js
deleted file mode 100644
index e3fc3d7..0000000
--- a/js/browser/toolbar.js
+++ /dev/null
@@ -1,329 +0,0 @@
-
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */?>
-
-browser.initToolbar = function() {
- $('#toolbar a').click(function() {
- browser.hideDialog();
- });
-
- if (!_.kuki.isSet('displaySettings'))
- _.kuki.set('displaySettings', 'off');
-
- if (_.kuki.get('displaySettings') == 'on') {
- $('#toolbar a[href="kcact:settings"]').addClass('selected');
- $('#settings').css('display', 'block');
- browser.resize();
- }
-
- $('#toolbar a[href="kcact:settings"]').click(function () {
- if ($('#settings').css('display') == 'none') {
- $(this).addClass('selected');
- _.kuki.set('displaySettings', 'on');
- $('#settings').css('display', 'block');
- browser.fixFilesHeight();
- } else {
- $(this).removeClass('selected');
- _.kuki.set('displaySettings', 'off');
- $('#settings').css('display', 'none');
- browser.fixFilesHeight();
- }
- return false;
- });
-
- $('#toolbar a[href="kcact:refresh"]').click(function() {
- browser.refresh();
- return false;
- });
-
- if (window.opener || this.opener.TinyMCE || $('iframe', window.parent.document).get(0))
- $('#toolbar a[href="kcact:maximize"]').click(function() {
- browser.maximize(this);
- return false;
- });
- else
- $('#toolbar a[href="kcact:maximize"]').css('display', 'none');
-
- $('#toolbar a[href="kcact:about"]').click(function() {
- var html = '
' +
- '
';
- if (browser.support.check4Update)
- html += '
' + browser.label("Checking for new version...") + '
';
- html +=
- '
' + browser.label("Licenses:") + ' GPLv2 & LGPLv2
' +
- '
Copyright ©2010-2014 Pavel Tzonkov
' +
- '
' + browser.label("OK") + ' ' +
- '
';
- $('#dialog').html(html);
- $('#dialog').data('title', browser.label("About"));
- browser.showDialog();
- var close = function() {
- browser.hideDialog();
- browser.unshadow();
- }
- $('#dialog button').click(close);
- var span = $('#checkver > span');
- setTimeout(function() {
- $.ajax({
- dataType: 'json',
- url: browser.baseGetData('check4Update'),
- async: true,
- success: function(data) {
- if (!$('#dialog').html().length)
- return;
- span.removeClass('loading');
- if (!data.version) {
- span.html(browser.label("Unable to connect!"));
- browser.showDialog();
- return;
- }
- if (browser.version < data.version)
- span.html('
' + browser.label("Download version {version} now!", {version: data.version}) + ' ');
- else
- span.html(browser.label("KCFinder is up to date!"));
- browser.showDialog();
- },
- error: function() {
- if (!$('#dialog').html().length)
- return;
- span.removeClass('loading');
- span.html(browser.label("Unable to connect!"));
- browser.showDialog();
- }
- });
- }, 1000);
- $('#dialog').unbind();
-
- return false;
- });
-
- this.initUploadButton();
-};
-
-browser.initUploadButton = function() {
- var btn = $('#toolbar a[href="kcact:upload"]');
- if (!this.access.files.upload) {
- btn.css('display', 'none');
- return;
- }
- var top = btn.get(0).offsetTop;
- var width = btn.outerWidth();
- var height = btn.outerHeight();
- $('#toolbar').prepend('
' +
- '' +
- '
');
- $('#upload input').css('margin-left', "-" + ($('#upload input').outerWidth() - width) + 'px');
- $('#upload').mouseover(function() {
- $('#toolbar a[href="kcact:upload"]').addClass('hover');
- });
- $('#upload').mouseout(function() {
- $('#toolbar a[href="kcact:upload"]').removeClass('hover');
- });
-};
-
-browser.uploadFile = function(form) {
- if (!this.dirWritable) {
- browser.alert(this.label("Cannot write to upload folder."));
- $('#upload').detach();
- browser.initUploadButton();
- return;
- }
- form.elements[1].value = browser.dir;
- $('
').prependTo(document.body);
- $('#loading').html(this.label("Uploading file..."));
- $('#loading').css('display', 'inline');
- form.submit();
- $('#uploadResponse').load(function() {
- var response = $(this).contents().find('body').html();
- $('#loading').css('display', 'none');
- response = response.split("\n");
- var selected = [], errors = [];
- $.each(response, function(i, row) {
- if (row.substr(0, 1) == '/')
- selected[selected.length] = row.substr(1, row.length - 1)
- else
- errors[errors.length] = row;
- });
- if (errors.length)
- browser.alert(errors.join("\n"));
- if (!selected.length)
- selected = null
- browser.refresh(selected);
- $('#upload').detach();
- setTimeout(function() {
- $('#uploadResponse').detach();
- }, 1);
- browser.initUploadButton();
- });
-};
-
-browser.maximize = function(button) {
- if (window.opener) {
- window.moveTo(0, 0);
- width = screen.availWidth;
- height = screen.availHeight;
- if ($.browser.opera)
- height -= 50;
- window.resizeTo(width, height);
-
- } else if (browser.opener.TinyMCE) {
- var win, ifr, id;
-
- $('iframe', window.parent.document).each(function() {
- if (/^mce_\d+_ifr$/.test($(this).attr('id'))) {
- id = parseInt($(this).attr('id').replace(/^mce_(\d+)_ifr$/, "$1"));
- win = $('#mce_' + id, window.parent.document);
- ifr = $('#mce_' + id + '_ifr', window.parent.document);
- }
- });
-
- if ($(button).hasClass('selected')) {
- $(button).removeClass('selected');
- win.css({
- left: browser.maximizeMCE.left + 'px',
- top: browser.maximizeMCE.top + 'px',
- width: browser.maximizeMCE.width + 'px',
- height: browser.maximizeMCE.height + 'px'
- });
- ifr.css({
- width: browser.maximizeMCE.width - browser.maximizeMCE.Hspace + 'px',
- height: browser.maximizeMCE.height - browser.maximizeMCE.Vspace + 'px'
- });
-
- } else {
- $(button).addClass('selected')
- browser.maximizeMCE = {
- width: _.nopx(win.css('width')),
- height: _.nopx(win.css('height')),
- left: win.position().left,
- top: win.position().top,
- Hspace: _.nopx(win.css('width')) - _.nopx(ifr.css('width')),
- Vspace: _.nopx(win.css('height')) - _.nopx(ifr.css('height'))
- };
- var width = $(window.parent).width();
- var height = $(window.parent).height();
- win.css({
- left: $(window.parent).scrollLeft() + 'px',
- top: $(window.parent).scrollTop() + 'px',
- width: width + 'px',
- height: height + 'px'
- });
- ifr.css({
- width: width - browser.maximizeMCE.Hspace + 'px',
- height: height - browser.maximizeMCE.Vspace + 'px'
- });
- }
-
- } else if ($('iframe', window.parent.document).get(0)) {
- var ifrm = $('iframe[name="' + window.name + '"]', window.parent.document);
- var parent = ifrm.parent();
- var width, height;
- if ($(button).hasClass('selected')) {
- $(button).removeClass('selected');
- if (browser.maximizeThread) {
- clearInterval(browser.maximizeThread);
- browser.maximizeThread = null;
- }
- if (browser.maximizeW) browser.maximizeW = null;
- if (browser.maximizeH) browser.maximizeH = null;
- $.each($('*', window.parent.document).get(), function(i, e) {
- e.style.display = browser.maximizeDisplay[i];
- });
- ifrm.css({
- display: browser.maximizeCSS.display,
- position: browser.maximizeCSS.position,
- left: browser.maximizeCSS.left,
- top: browser.maximizeCSS.top,
- width: browser.maximizeCSS.width,
- height: browser.maximizeCSS.height
- });
- $(window.parent).scrollLeft(browser.maximizeLest);
- $(window.parent).scrollTop(browser.maximizeTop);
-
- } else {
- $(button).addClass('selected');
- browser.maximizeCSS = {
- display: ifrm.css('display'),
- position: ifrm.css('position'),
- left: ifrm.css('left'),
- top: ifrm.css('top'),
- width: ifrm.outerWidth() + 'px',
- height: ifrm.outerHeight() + 'px'
- };
- browser.maximizeTop = $(window.parent).scrollTop();
- browser.maximizeLeft = $(window.parent).scrollLeft();
- browser.maximizeDisplay = [];
- $.each($('*', window.parent.document).get(), function(i, e) {
- browser.maximizeDisplay[i] = $(e).css('display');
- $(e).css('display', 'none');
- });
-
- ifrm.css('display', 'block');
- ifrm.parents().css('display', 'block');
- var resize = function() {
- width = $(window.parent).width();
- height = $(window.parent).height();
- if (!browser.maximizeW || (browser.maximizeW != width) ||
- !browser.maximizeH || (browser.maximizeH != height)
- ) {
- browser.maximizeW = width;
- browser.maximizeH = height;
- ifrm.css({
- width: width + 'px',
- height: height + 'px'
- });
- browser.resize();
- }
- }
- ifrm.css('position', 'absolute');
- if ((ifrm.offset().left == ifrm.position().left) &&
- (ifrm.offset().top == ifrm.position().top)
- )
- ifrm.css({left: '0', top: '0'});
- else
- ifrm.css({
- left: - ifrm.offset().left + 'px',
- top: - ifrm.offset().top + 'px'
- });
-
- resize();
- browser.maximizeThread = setInterval(resize, 250);
- }
- }
-};
-
-browser.refresh = function(selected) {
- this.fadeFiles();
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: browser.baseGetData('chDir'),
- data: {dir:browser.dir},
- async: false,
- success: function(data) {
- if (browser.check4errors(data))
- return;
- browser.dirWritable = data.dirWritable;
- browser.files = data.files ? data.files : [];
- browser.orderFiles(null, selected);
- browser.statusDir();
- },
- error: function() {
- $('#files > div').css({opacity:'', filter:''});
- $('#files').html(browser.label("Unknown error."));
- }
- });
-};
diff --git a/js/helper.js b/js/helper.js
deleted file mode 100644
index 264afb6..0000000
--- a/js/helper.js
+++ /dev/null
@@ -1,411 +0,0 @@
-/** This file is part of KCFinder project
- *
- * @desc Helper object
- * @package KCFinder
- * @version 2.52
- * @author Pavel Tzonkov
- * @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
- * @link http://kcfinder.sunhater.com
- */
-
-var _ = function(id) {
- return document.getElementById(id);
-};
-
-_.nopx = function(val) {
- return parseInt(val.replace(/^(\d+)px$/, "$1"));
-};
-
-_.unselect = function() {
- if (document.selection && document.selection.empty)
- document.selection.empty() ;
- else if (window.getSelection) {
- var sel = window.getSelection();
- if (sel && sel.removeAllRanges)
- sel.removeAllRanges();
- }
-};
-
-_.selection = function(field, start, end) {
- if (field.createTextRange) {
- var selRange = field.createTextRange();
- selRange.collapse(true);
- selRange.moveStart('character', start);
- selRange.moveEnd('character', end-start);
- selRange.select();
- } else if (field.setSelectionRange) {
- field.setSelectionRange(start, end);
- } else if (field.selectionStart) {
- field.selectionStart = start;
- field.selectionEnd = end;
- }
- field.focus();
-};
-
-_.htmlValue = function(value) {
- return value
- .replace(/\&/g, "&")
- .replace(/\"/g, """)
- .replace(/\'/g, "'");
-};
-
-_.htmlData = function(value) {
- return value
- .replace(/\&/g, "&")
- .replace(/\/g, ">")
- .replace(/\ /g, " ");
-}
-
-_.jsValue = function(value) {
- return value
- .replace(/\\/g, "\\\\")
- .replace(/\r?\n/, "\\\n")
- .replace(/\"/g, "\\\"")
- .replace(/\'/g, "\\'");
-};
-
-_.basename = function(path) {
- var expr = /^.*\/([^\/]+)\/?$/g;
- return expr.test(path)
- ? path.replace(expr, "$1")
- : path;
-};
-
-_.dirname = function(path) {
- var expr = /^(.*)\/[^\/]+\/?$/g;
- return expr.test(path)
- ? path.replace(expr, "$1")
- : '';
-};
-
-_.inArray = function(needle, arr) {
- if ((typeof arr == 'undefined') || !arr.length || !arr.push)
- return false;
- for (var i = 0; i < arr.length; i++)
- if (arr[i] == needle)
- return true;
- return false;
-};
-
-_.getFileExtension = function(filename, toLower) {
- if (typeof(toLower) == 'undefined') toLower = true;
- if (/^.*\.[^\.]*$/.test(filename)) {
- var ext = filename.replace(/^.*\.([^\.]*)$/, "$1");
- return toLower ? ext.toLowerCase(ext) : ext;
- } else
- return "";
-};
-
-_.escapeDirs = function(path) {
- var fullDirExpr = /^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/,
- prefix = "";
- if (fullDirExpr.test(path)) {
- var port = path.replace(fullDirExpr, "$4");
- prefix = path.replace(fullDirExpr, "$1://$2")
- if (port.length)
- prefix += ":" + port;
- prefix += "/";
- path = path.replace(fullDirExpr, "$5");
- }
-
- var dirs = path.split('/');
- var escapePath = '';
- for (var i = 0; i < dirs.length; i++)
- escapePath += encodeURIComponent(dirs[i]) + '/';
-
- return prefix + escapePath.substr(0, escapePath.length - 1);
-};
-
-_.outerSpace = function(selector, type, mbp) {
- if (!mbp) mbp = "mbp";
- var r = 0;
- if (/m/i.test(mbp)) {
- var m = _.nopx($(selector).css('margin-' + type));
- if (m) r += m;
- }
- if (/b/i.test(mbp)) {
- var b = _.nopx($(selector).css('border-' + type + '-width'));
- if (b) r += b;
- }
- if (/p/i.test(mbp)) {
- var p = _.nopx($(selector).css('padding-' + type));
- if (p) r += p;
- }
- return r;
-};
-
-_.outerLeftSpace = function(selector, mbp) {
- return _.outerSpace(selector, 'left', mbp);
-};
-
-_.outerTopSpace = function(selector, mbp) {
- return _.outerSpace(selector, 'top', mbp);
-};
-
-_.outerRightSpace = function(selector, mbp) {
- return _.outerSpace(selector, 'right', mbp);
-};
-
-_.outerBottomSpace = function(selector, mbp) {
- return _.outerSpace(selector, 'bottom', mbp);
-};
-
-_.outerHSpace = function(selector, mbp) {
- return (_.outerLeftSpace(selector, mbp) + _.outerRightSpace(selector, mbp));
-};
-
-_.outerVSpace = function(selector, mbp) {
- return (_.outerTopSpace(selector, mbp) + _.outerBottomSpace(selector, mbp));
-};
-
-_.kuki = {
- prefix: '',
- duration: 356,
- domain: '',
- path: '',
- secure: false,
-
- set: function(name, value, duration, domain, path, secure) {
- name = this.prefix + name;
- if (duration == null) duration = this.duration;
- if (secure == null) secure = this.secure;
- if ((domain == null) && this.domain) domain = this.domain;
- if ((path == null) && this.path) path = this.path;
- secure = secure ? true : false;
-
- var date = new Date();
- date.setTime(date.getTime() + (duration * 86400000));
- var expires = date.toGMTString();
-
- var str = name + '=' + value + '; expires=' + expires;
- if (domain != null) str += '; domain=' + domain;
- if (path != null) str += '; path=' + path;
- if (secure) str += '; secure';
-
- return (document.cookie = str) ? true : false;
- },
-
- get: function(name) {
- name = this.prefix + name;
- var nameEQ = name + '=';
- var kukis = document.cookie.split(';');
- var kuki;
-
- for (var i = 0; i < kukis.length; i++) {
- kuki = kukis[i];
- while (kuki.charAt(0) == ' ')
- kuki = kuki.substring(1, kuki.length);
-
- if (kuki.indexOf(nameEQ) == 0)
- return kuki.substring(nameEQ.length, kuki.length);
- }
-
- return null;
- },
-
- del: function(name) {
- return this.set(name, '', -1);
- },
-
- isSet: function(name) {
- return (this.get(name) != null);
- }
-};
-
-_.md5 = function(string) {
-
- var RotateLeft = function(lValue, iShiftBits) {
- return (lValue<>>(32-iShiftBits));
- };
-
- var AddUnsigned = function(lX,lY) {
- var lX4, lY4, lX8, lY8, lResult;
- lX8 = (lX & 0x80000000);
- lY8 = (lY & 0x80000000);
- lX4 = (lX & 0x40000000);
- lY4 = (lY & 0x40000000);
- lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
- if (lX4 & lY4)
- return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
- if (lX4 | lY4)
- return (lResult & 0x40000000)
- ? (lResult ^ 0xC0000000 ^ lX8 ^ lY8)
- : (lResult ^ 0x40000000 ^ lX8 ^ lY8);
- else
- return (lResult ^ lX8 ^ lY8);
- };
-
- var F = function(x, y, z) { return (x & y) | ((~x) & z); };
- var G = function(x, y, z) { return (x & z) | (y & (~z)); };
- var H = function(x, y, z) { return (x ^ y ^ z); };
- var I = function(x, y, z) { return (y ^ (x | (~z))); };
-
- var FF = function(a, b, c, d, x, s, ac) {
- a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
- return AddUnsigned(RotateLeft(a, s), b);
- };
-
- var GG = function(a, b, c, d, x, s, ac) {
- a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
- return AddUnsigned(RotateLeft(a, s), b);
- };
-
- var HH = function(a, b, c, d, x, s, ac) {
- a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
- return AddUnsigned(RotateLeft(a, s), b);
- };
-
- var II = function(a, b, c, d, x, s, ac) {
- a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
- return AddUnsigned(RotateLeft(a, s), b);
- };
-
- var ConvertToWordArray = function(string) {
- var lWordCount;
- var lMessageLength = string.length;
- var lNumberOfWords_temp1 = lMessageLength + 8;
- var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
- var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
- var lWordArray = [lNumberOfWords - 1];
- var lBytePosition = 0;
- var lByteCount = 0;
- while (lByteCount < lMessageLength) {
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
- lByteCount++;
- }
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
- lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
- lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
- return lWordArray;
- };
-
- var WordToHex = function(lValue) {
- var WordToHexValue = "", WordToHexValue_temp = "", lByte, lCount;
- for (lCount = 0; lCount <= 3; lCount++) {
- lByte = (lValue >>> (lCount * 8)) & 255;
- WordToHexValue_temp = "0" + lByte.toString(16);
- WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2,2);
- }
- return WordToHexValue;
- };
-
- var x = [];
- var k, AA, BB, CC, DD, a, b, c, d;
- var S11 = 7, S12 = 12, S13 = 17, S14 = 22;
- var S21 = 5, S22 = 9, S23 = 14, S24 = 20;
- var S31 = 4, S32 = 11, S33 = 16, S34 = 23;
- var S41 = 6, S42 = 10, S43 = 15, S44 = 21;
-
- string = _.utf8encode(string);
-
- x = ConvertToWordArray(string);
-
- a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
-
- for (k = 0; k < x.length; k += 16) {
- AA = a; BB = b; CC = c; DD = d;
- a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
- d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
- c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
- b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
- a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
- d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
- c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
- b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
- a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
- d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
- c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
- b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
- a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
- d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
- c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
- b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
- a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
- d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
- c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
- b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
- a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
- d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
- c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
- b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
- a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
- d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
- c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
- b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
- a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
- d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
- c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
- b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
- a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
- d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
- c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
- b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
- a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
- d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
- c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
- b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
- a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
- d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
- c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
- b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
- a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
- d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
- c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
- b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
- a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
- d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
- c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
- b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
- a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
- d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
- c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
- b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
- a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
- d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
- c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
- b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
- a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
- d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
- c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
- b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
- a = AddUnsigned(a, AA);
- b = AddUnsigned(b, BB);
- c = AddUnsigned(c, CC);
- d = AddUnsigned(d, DD);
- }
-
- var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
-
- return temp.toLowerCase();
-};
-
-_.utf8encode = function(string) {
- string = string.replace(/\r\n/g,"\n");
- var utftext = "";
-
- for (var n = 0; n < string.length; n++) {
-
- var c = string.charCodeAt(n);
-
- if (c < 128) {
- utftext += String.fromCharCode(c);
- } else if((c > 127) && (c < 2048)) {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- } else {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
-
- }
-
- return utftext;
-};
diff --git a/js/index.php b/js/index.php
new file mode 100644
index 0000000..962e48e
--- /dev/null
+++ b/js/index.php
@@ -0,0 +1,20 @@
+
+ * @copyright 2010-2014 KCFinder Project
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
+ * @link http://kcfinder.sunhater.com
+ */
+
+namespace kcfinder;
+
+chdir("..");
+require "core/autoload.php";
+$min = new minifier("js");
+$min->minify("cache/base.js");
diff --git a/js/jquery.drag.js b/js/jquery.drag.js
deleted file mode 100644
index 337995f..0000000
--- a/js/jquery.drag.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*!
- * jquery.event.drag - v 2.0.0
- * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
- * Open Source MIT License - http://threedubmedia.com/code/license
- */
-(function(f){f.fn.drag=function(b,a,d){var e=typeof b=="string"?b:"",k=f.isFunction(b)?b:f.isFunction(a)?a:null;if(e.indexOf("drag")!==0)e="drag"+e;d=(b==k?a:d)||{};return k?this.bind(e,d,k):this.trigger(e)};var i=f.event,h=i.special,c=h.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:false,drop:true,click:false},datakey:"dragdata",livekey:"livedrag",add:function(b){var a=f.data(this,c.datakey),d=b.data||{};a.related+=1;if(!a.live&&b.selector){a.live=true;i.add(this,"draginit."+ c.livekey,c.delegate)}f.each(c.defaults,function(e){if(d[e]!==undefined)a[e]=d[e]})},remove:function(){f.data(this,c.datakey).related-=1},setup:function(){if(!f.data(this,c.datakey)){var b=f.extend({related:0},c.defaults);f.data(this,c.datakey,b);i.add(this,"mousedown",c.init,b);this.attachEvent&&this.attachEvent("ondragstart",c.dontstart)}},teardown:function(){if(!f.data(this,c.datakey).related){f.removeData(this,c.datakey);i.remove(this,"mousedown",c.init);i.remove(this,"draginit",c.delegate);c.textselect(true); this.detachEvent&&this.detachEvent("ondragstart",c.dontstart)}},init:function(b){var a=b.data,d;if(!(a.which>0&&b.which!=a.which))if(!f(b.target).is(a.not))if(!(a.handle&&!f(b.target).closest(a.handle,b.currentTarget).length)){a.propagates=1;a.interactions=[c.interaction(this,a)];a.target=b.target;a.pageX=b.pageX;a.pageY=b.pageY;a.dragging=null;d=c.hijack(b,"draginit",a);if(a.propagates){if((d=c.flatten(d))&&d.length){a.interactions=[];f.each(d,function(){a.interactions.push(c.interaction(this,a))})}a.propagates= a.interactions.length;a.drop!==false&&h.drop&&h.drop.handler(b,a);c.textselect(false);i.add(document,"mousemove mouseup",c.handler,a);return false}}},interaction:function(b,a){return{drag:b,callback:new c.callback,droppable:[],offset:f(b)[a.relative?"position":"offset"]()||{top:0,left:0}}},handler:function(b){var a=b.data;switch(b.type){case !a.dragging&&"mousemove":if(Math.pow(b.pageX-a.pageX,2)+Math.pow(b.pageY-a.pageY,2)").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;ca ",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j =0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem
-)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c ",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML=" ",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="
";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/",""],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1>$2>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||
-b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1>$2>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/
-
-
-
+
+
+
+
+
@@ -75,7 +75,12 @@
+
+
+
+
+
diff --git a/tpl/tpl_css.php b/tpl/tpl_css.php
index dbf5d58..37df711 100644
--- a/tpl/tpl_css.php
+++ b/tpl/tpl_css.php
@@ -1,2 +1,6 @@
-
cms}" : "" ) ?>" rel="stylesheet" type="text/css" />
-
+
+
+
diff --git a/tpl/tpl_javascript.php b/tpl/tpl_javascript.php
index 0d8aeaa..208664f 100644
--- a/tpl/tpl_javascript.php
+++ b/tpl/tpl_javascript.php
@@ -1,45 +1,39 @@
-
-
-
-
-
+
+
-opener['TinyMCE']) && $this->opener['TinyMCE']): ?>
+opener['name'] == "tinymce"):
+?>
-
-config['theme']}/init.js")): ?>
-
-
+config['theme']}/js.php")):
+?>
+
+
diff --git a/upload.php b/upload.php
index cf667e7..5a86e60 100644
--- a/upload.php
+++ b/upload.php
@@ -4,16 +4,15 @@
*
* @desc Upload calling script
* @package KCFinder
- * @version 2.52
+ * @version 3.12
* @author Pavel Tzonkov
* @copyright 2010-2014 KCFinder Project
- * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
+ * @license http://opensource.org/licenses/GPL-3.0 GPLv3
+ * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
* @link http://kcfinder.sunhater.com
*/
-require "core/autoload.php";
-$uploader = new uploader();
+require "core/bootstrap.php";
+$uploader = "kcfinder\\uploader"; // To execute core/bootstrap.php on older
+$uploader = new $uploader(); // PHP versions (even PHP 4)
$uploader->upload();
-
-?>
\ No newline at end of file
diff --git a/upload/.htaccess b/upload/.htaccess
index 33c697e..48dd490 100644
--- a/upload/.htaccess
+++ b/upload/.htaccess
@@ -1,6 +1,21 @@
- php_value engine off
+ php_flag engine Off
- php_value engine off
+ php_flag engine Off
+
+ php_flag engine Off
+
+
+ Options -ExecCGI
+
+
+RemoveHandler .cgi .pl .py .pyc .pyo .phtml .php .php3 .php4 .php5 .php6 .pcgi .pcgi3 .pcgi4 .pcgi5 .pchi6 .inc
+RemoveType .cgi .pl .py .pyc .pyo .phtml .php .php3 .php4 .php5 .php6 .pcgi .pcgi3 .pcgi4 .pcgi5 .pchi6 .inc
+SetHandler None
+SetHandler default-handler
+
+# Remove both lines below if you want to render HTML files from the upload folder
+AddType text/plain .html
+AddType text/plain .htm