TAS-ALFA/admin-zone/ckeditor/kcfinder/cache/base.js

4534 lines
469 KiB
JavaScript
Raw Normal View History

2018-11-17 14:43:50 +01:00
/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e)
}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,c
},a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
(function(e,t){function i(t,i){var s,a,o,r=t.nodeName.toLowerCase();return"area"===r?(s=t.parentNode,a=s.name,t.href&&a&&"map"===s.nodeName.toLowerCase()?(o=e("img[usemap=#"+a+"]")[0],!!o&&n(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||i:i)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var s=0,a=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var n,s,a=e(this[0]);a.length&&a[0]!==document;){if(n=a.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(a.css("zIndex"),10),!isNaN(s)&&0!==s))return s;a=a.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){a.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(t,!s)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function s(t,i,n,s){return e.each(a,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var a="Width"===n?["Left","Right"]:["Top","Bottom"],o=n.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?r["inner"+n].call(this):this.each(function(){e(this).css(o,s(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?r["outer"+n].call(this,t):this.each(function(){e(this).css(o,s(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,n){var s,a=e.ui[t].prototype;for(s in n)a.plugins[s]=a.plugins[s]||[],a.plugins[s].push([i,n[s]])},call:function(e,t,i){var n,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;s.length>n;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=
return isNaN(t)?d:t},g=p(l[0]),m=Math.max(g,p(l[1]||"")),g=a?Math.max(g,a.getFullYear()):g,m=s?Math.min(m,s.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=g;g++)e.yearshtml+="<option value='"+g+"'"+(g===i?" selected='selected'":"")+">"+g+"</option>";e.yearshtml+="</select>",k+=e.yearshtml,e.yearshtml=null}return k+=this._get(e,"yearSuffix"),v&&(k+=(!n&&f&&_?"":"&#xa0;")+y),k+="</div>"},_adjustInstDate:function(e,t,i){var a=e.drawYear+("Y"===i?t:0),s=e.drawMonth+("M"===i?t:0),n=Math.min(e.selectedDay,this._getDaysInMonth(a,s))+("D"===i?t:0),r=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(a,s,n)));e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),s=i&&i>t?i:t;return a&&s>a?a:s},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,a){var s=this._getNumberOfMonths(e),n=this._daylightSavingAdjust(new Date(i,a+(0>t?t:s[0]*s[1]),1));return 0>t&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(e,n)},_isInRange:function(e,t){var i,a,s=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),r=null,o=null,u=this._get(e,"yearRange");return u&&(i=u.split(":"),a=(new Date).getFullYear(),r=parseInt(i[0],10),o=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(r+=a),i[1].match(/[+\-].*/)&&(o+=a)),(!s||t.getTime()>=s.getTime())&&(!n||t.getTime()<=n.getTime())&&(!r||t.getFullYear()>=r)&&(!o||o>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,a){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var s=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(a,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),s,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new i,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.10.4"})(jQuery);(function(e){var t={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.10.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using
Uniform v2.1.2
Copyright © 2009 Josh Pyles / Pixelmatrix Design LLC
http://pixelmatrixdesign.com
Requires jQuery 1.3 or newer
Much thanks to Thomas Reynolds and Buck Wilson for their help and advice on
this.
Disabling text selection is made possible by Mathias Bynens
<http://mathiasbynens.be/> and his noSelect plugin.
<https://github.com/mathiasbynens/jquery-noselect>, which is embedded.
Also, thanks to David Kaneda and Eugene Bond for their contributions to the
plugin.
Tyler Akins has also rewritten chunks of the plugin, helped close many issues,
and ensured version 2 got out the door.
License:
MIT License - http://www.opensource.org/licenses/mit-license.php
Enjoy!
*/
/*global jQuery, document, navigator*/
(function (wind, $, undef) {
"use strict";
/**
* Use .prop() if jQuery supports it, otherwise fall back to .attr()
*
* @param jQuery $el jQuery'd element on which we're calling attr/prop
* @param ... All other parameters are passed to jQuery's function
* @return The result from jQuery
*/
function attrOrProp($el) {
var args = Array.prototype.slice.call(arguments, 1);
if ($el.prop) {
// jQuery 1.6+
return $el.prop.apply($el, args);
}
// jQuery 1.5 and below
return $el.attr.apply($el, args);
}
/**
* For backwards compatibility with older jQuery libraries, only bind
* one thing at a time. Also, this function adds our namespace to
* events in one consistent location, shrinking the minified code.
*
* The properties on the events object are the names of the events
* that we are supposed to add to. It can be a space separated list.
* The namespace will be added automatically.
*
* @param jQuery $el
* @param Object options Uniform options for this element
* @param Object events Events to bind, properties are event names
*/
function bindMany($el, options, events) {
var name, namespaced;
for (name in events) {
if (events.hasOwnProperty(name)) {
namespaced = name.replace(/ |$/g, options.eventNamespace);
$el.bind(namespaced, events[name]);
}
}
}
/**
* Bind the hover, active, focus, and blur UI updates
*
* @param jQuery $el Original element
* @param jQuery $target Target for the events (our div/span)
* @param Object options Uniform options for the element $target
*/
function bindUi($el, $target, options) {
bindMany($el, options, {
focus: function () {
$target.addClass(options.focusClass);
},
blur: function () {
$target.removeClass(options.focusClass);
$target.removeClass(options.activeClass);
},
mouseenter: function () {
$target.addClass(options.hoverClass);
},
mouseleave: function () {
$target.removeClass(options.hoverClass);
$target.removeClass(options.activeClass);
},
"mousedown touchbegin": function () {
if (!$el.is(":disabled")) {
$target.addClass(options.activeClass);
}
},
"mouseup touchend": function () {
$target.removeClass(options.activeClass);
}
});
}
/**
* Remove the hover, focus, active classes.
*
* @param jQuery $el Element with classes
* @param Object options Uniform options for the element
*/
function classClearStandard($el, options) {
$el.removeClass(options.hoverClass + " " + options.focusClass + " " + options.activeClass);
}
/**
* Add or remove a class, depending on if it's "enabled"
*
* @param jQuery $el Element that has the class added/removed
* @param String className Class or classes to add/remove
* @param Boolean enabled True to add the class, false to remove
*/
function classUpdate($el, className, enabled) {
if (enabled) {
$el.addClass(className);
} else {
$el.removeClass(className);
}
}
/**
* Updating the "checked" property can be a little tricky. This
* changed in jQuery 1.6 and now we can pass booleans to .prop().
* Prior to that, one either adds an attribute ("checked=checked") or
* removes the attribute.
*
* @param jQuery $tag Our Uniform span/div
* @param jQuery $el Original form element
* @param Object options Uniform options for this element
*/
function classUpdateChecked($tag, $el, options) {
setTimeout(function() { // sunhater@sunhater.com
var c = "checked",
isChecked = $el.is(":" + c);
if ($el.prop) {
// jQuery 1.6+
$el.prop(c, isChecked);
} else {
// jQuery 1.5 and below
if (isChecked) {
$el.attr(c, c);
} else {
$el.removeAttr(c);
}
}
classUpdate($tag, options.checkedClass, isChecked);
}, 1);
}
/**
* Set or remove the "disabled" class for disabled elements, based on
* if the element is detected to be disabled.
*
* @param jQuery $tag Our Uniform span/div
* @param jQuery $el Original form element
* @param Object options Uniform options for this element
*/
function classUpdateDisabled($tag, $el, options) {
classUpdate($tag, options.disabledClass, $el.is(":disabled"));
}
/**
* Wrap an element inside of a container or put the container next
* to the element. See the code for examples of the different methods.
*
* Returns the container that was added to the HTML.
*
* @param jQuery $el Element to wrap
* @param jQuery $container Add this new container around/near $el
* @param String method One of "after", "before" or "wrap"
* @return $container after it has been cloned for adding to $el
*/
function divSpanWrap($el, $container, method) {
switch (method) {
case "after":
// Result: <element /> <container />
$el.after($container);
return $el.next();
case "before":
// Result: <container /> <element />
$el.before($container);
return $el.prev();
case "wrap":
// Result: <container> <element /> </container>
$el.wrap($container);
return $el.parent();
}
return null;
}
/**
* Create a div/span combo for uniforming an element
*
* @param jQuery $el Element to wrap
* @param Object options Options for the element, set by the user
* @param Object divSpanConfig Options for how we wrap the div/span
* @return Object Contains the div and span as properties
*/
function divSpan($el, options, divSpanConfig) {
var $div, $span, id;
if (!divSpanConfig) {
divSpanConfig = {};
}
divSpanConfig = $.extend({
bind: {},
divClass: null,
divWrap: "wrap",
spanClass: null,
spanHtml: null,
spanWrap: "wrap"
}, divSpanConfig);
$div = $('<div />');
$span = $('<span />');
// Automatically hide this div/span if the element is hidden.
// Do not hide if the element is hidden because a parent is hidden.
if (options.autoHide && $el.is(':hidden') && $el.css('display') === 'none') {
$div.hide();
}
if (divSpanConfig.divClass) {
$div.addClass(divSpanConfig.divClass);
}
if (options.wrapperClass) {
$div.addClass(options.wrapperClass);
}
if (divSpanConfig.spanClass) {
$span.addClass(divSpanConfig.spanClass);
}
id = attrOrProp($el, 'id');
if (options.useID && id) {
attrOrProp($div, 'id', options.idPrefix + '-' + id);
}
if (divSpanConfig.spanHtml) {
$span.html(divSpanConfig.spanHtml);
}
$div = divSpanWrap($el, $div, divSpanConfig.divWrap);
$span = divSpanWrap($el, $span, divSpanConfig.spanWrap);
classUpdateDisabled($div, $el, options);
return {
div: $div,
span: $span
};
}
/**
* Wrap an element with a span to apply a global wrapper class
*
* @param jQuery $el Element to wrap
* @param object options
* @return jQuery Wrapper element
*/
function wrapWithWrapperClass($el, options) {
var $span;
if (!options.wrapperClass) {
return null;
}
$span = $('<span />').addClass(options.wrapperClass);
$span = divSpanWrap($el, $span, "wrap");
return $span;
}
/**
* Test if high contrast mode is enabled.
*
* In high contrast mode, background images can not be set and
* they are always returned as 'none'.
*
* @return boolean True if in high contrast mode
*/
function highContrast() {
var c, $div, el, rgb;
// High contrast mode deals with white and black
rgb = 'rgb(120,2,153)';
$div = $('<div style="width:0;height:0;color:' + rgb + '">');
$('body').append($div);
el = $div.get(0);
// $div.css() will get the style definition, not
// the actually displaying style
if (wind.getComputedStyle) {
c = wind.getComputedStyle(el, '').color;
} else {
c = (el.currentStyle || el.style || {}).color;
}
$div.remove();
return c.replace(/ /g, '') !== rgb;
}
/**
* Change text into safe HTML
*
* @param String text
* @return String HTML version
*/
function htmlify(text) {
if (!text) {
return "";
}
return $('<span />').text(text).html();
}
/**
* If not MSIE, return false.
* If it is, return the version number.
*
* @return false|number
*/
function isMsie() {
return navigator.cpuClass && !navigator.product;
}
/**
* Return true if this version of IE allows styling
*
* @return boolean
*/
function isMsieSevenOrNewer() {
if (wind.XMLHttpRequest !== undefined) {
return true;
}
return false;
}
/**
* Test if the element is a multiselect
*
* @param jQuery $el Element
* @return boolean true/false
*/
function isMultiselect($el) {
var elSize;
if ($el[0].multiple) {
return true;
}
elSize = attrOrProp($el, "size");
if (!elSize || elSize <= 1) {
return false;
}
return true;
}
/**
* Meaningless utility function. Used mostly for improving minification.
*
* @return false
*/
function returnFalse() {
return false;
}
/**
* noSelect plugin, very slightly modified
* http://mths.be/noselect v1.0.3
*
* @param jQuery $elem Element that we don't want to select
* @param Object options Uniform options for the element
*/
function noSelect($elem, options) {
var none = 'none';
bindMany($elem, options, {
'selectstart dragstart mousedown': returnFalse
});
$elem.css({
MozUserSelect: none,
msUserSelect: none,
webkitUserSelect: none,
userSelect: none
});
}
/**
* Updates the filename tag based on the value of the real input
* element.
*
* @param jQuery $el Actual form element
* @param jQuery $filenameTag Span/div to update
* @param Object options Uniform options for this element
*/
function setFilename($el, $filenameTag, options) {
var filename = $el.val();
if (filename === "") {
filename = options.fileDefaultHtml;
} else {
filename = filename.split(/[\/\\]+/);
filename = filename[(filename.length - 1)];
}
$filenameTag.text(filename);
}
/**
* Function from jQuery to swap some CSS values, run a callback,
* then restore the CSS. Modified to pass JSLint and handle undefined
* values with 'use strict'.
*
* @param jQuery $el Element
* @param object newCss CSS values to swap out
* @param Function callback Function to run
*/
function swap($elements, newCss, callback) {
var restore, item;
restore = [];
$elements.each(function () {
var name;
for (name in newCss) {
if (Object.prototype.hasOwnProperty.call(newCss, name)) {
restore.push({
el: this,
name: name,
old: this.style[name]
});
this.style[name] = newCss[name];
}
}
});
callback();
while (restore.length) {
item = restore.pop();
item.el.style[item.name] = item.old;
}
}
/**
* The browser doesn't provide sizes of elements that are not visible.
* This will clone an element and add it to the DOM for calculations.
*
* @param jQuery $el
* @param String method
*/
function sizingInvisible($el, callback) {
var targets;
// We wish to target ourselves and any parents as long as
// they are not visible
targets = $el.parents();
targets.push($el[0]);
targets = targets.not(':visible');
swap(targets, {
visibility: "hidden",
display: "block",
position: "absolute"
}, callback);
}
/**
* Standard way to unwrap the div/span combination from an element
*
* @param jQuery $el Element that we wish to preserve
* @param Object options Uniform options for the element
* @return Function This generated function will perform the given work
*/
function unwrapUnwrapUnbindFunction($el, options) {
return function () {
$el.unwrap().unwrap().unbind(options.eventNamespace);
};
}
var allowStyling = true, // False if IE6 or other unsupported browsers
highContrastTest = false, // Was the high contrast test ran?
uniformHandlers = [ // Objects that take care of "unification"
{
// Buttons
match: function ($el) {
return $el.is("a, button, :submit, :reset, input[type='button']");
},
apply: function ($el, options) {
var $div, defaultSpanHtml, ds, getHtml, doingClickEvent;
defaultSpanHtml = options.submitDefaultHtml;
if ($el.is(":reset")) {
defaultSpanHtml = options.resetDefaultHtml;
}
if ($el.is("a, button")) {
// Use the HTML inside the tag
getHtml = function () {
return $el.html() || defaultSpanHtml;
};
} else {
// Use the value property of the element
getHtml = function () {
return htmlify(attrOrProp($el, "value")) || defaultSpanHtml;
};
}
ds = divSpan($el, options, {
divClass: options.buttonClass,
spanHtml: getHtml()
});
$div = ds.div;
bindUi($el, $div, options);
doingClickEvent = false;
bindMany($div, options, {
"click touchend": function () {
var ev, res, target, href;
if (doingClickEvent) {
return;
}
if ($el.is(':disabled')) {
return;
}
doingClickEvent = true;
if ($el[0].dispatchEvent) {
ev = document.createEvent("MouseEvents");
ev.initEvent("click", true, true);
res = $el[0].dispatchEvent(ev);
if ($el.is('a') && res) {
target = attrOrProp($el, 'target');
href = attrOrProp($el, 'href');
if (!target || target === '_self') {
document.location.href = href;
} else {
wind.open(href, target);
}
}
} else {
$el.click();
}
doingClickEvent = false;
}
});
noSelect($div, options);
return {
remove: function () {
// Move $el out
$div.after($el);
// Remove div and span
$div.remove();
// Unbind events
$el.unbind(options.eventNamespace);
return $el;
},
update: function () {
classClearStandard($div, options);
classUpdateDisabled($div, $el, options);
$el.detach();
ds.span.html(getHtml()).append($el);
}
};
}
},
{
// Checkboxes
match: function ($el) {
return $el.is(":checkbox");
},
apply: function ($el, options) {
var ds, $div, $span;
ds = divSpan($el, options, {
divClass: options.checkboxClass
});
$div = ds.div;
$span = ds.span;
// Add focus classes, toggling, active, etc.
bindUi($el, $div, options);
bindMany($el, options, {
"click touchend": function () {
classUpdateChecked($span, $el, options);
}
});
classUpdateChecked($span, $el, options);
return {
remove: unwrapUnwrapUnbindFunction($el, options),
update: function () {
classClearStandard($div, options);
$span.removeClass(options.checkedClass);
classUpdateChecked($span, $el, options);
classUpdateDisabled($div, $el, options);
}
};
}
},
{
// File selection / uploads
match: function ($el) {
return $el.is(":file");
},
apply: function ($el, options) {
var ds, $div, $filename, $button;
// The "span" is the button
ds = divSpan($el, options, {
divClass: options.fileClass,
spanClass: options.fileButtonClass,
spanHtml: options.fileButtonHtml,
spanWrap: "after"
});
$div = ds.div;
$button = ds.span;
$filename = $("<span />").html(options.fileDefaultHtml);
$filename.addClass(options.filenameClass);
$filename = divSpanWrap($el, $filename, "after");
// Set the size
if (!attrOrProp($el, "size")) {
attrOrProp($el, "size", $div.width() / 10);
}
// Actions
function filenameUpdate() {
setFilename($el, $filename, options);
}
bindUi($el, $div, options);
// Account for input saved across refreshes
filenameUpdate();
// IE7 doesn't fire onChange until blur or second fire.
if (isMsie()) {
// IE considers browser chrome blocking I/O, so it
// suspends tiemouts until after the file has
// been selected.
bindMany($el, options, {
click: function () {
$el.trigger("change");
setTimeout(filenameUpdate, 0);
}
});
} else {
// All other browsers behave properly
bindMany($el, options, {
change: filenameUpdate
});
}
noSelect($filename, options);
noSelect($button, options);
return {
remove: function () {
// Remove filename and button
$filename.remove();
$button.remove();
// Unwrap parent div, remove events
return $el.unwrap().unbind(options.eventNamespace);
},
update: function () {
classClearStandard($div, options);
setFilename($el, $filename, options);
classUpdateDisabled($div, $el, options);
}
};
}
},
{
// Input fields (text)
match: function ($el) {
if ($el.is("input")) {
var t = (" " + attrOrProp($el, "type") + " ").toLowerCase(),
allowed = " color date datetime datetime-local email month number password search tel text time url week ";
return allowed.indexOf(t) >= 0;
}
return false;
},
apply: function ($el, options) {
var elType, $wrapper;
elType = attrOrProp($el, "type");
$el.addClass(options.inputClass);
$wrapper = wrapWithWrapperClass($el, options);
bindUi($el, $el, options);
if (options.inputAddTypeAsClass) {
$el.addClass(elType);
}
return {
remove: function () {
$el.removeClass(options.inputClass);
if (options.inputAddTypeAsClass) {
$el.removeClass(elType);
}
if ($wrapper) {
$el.unwrap();
}
},
update: returnFalse
};
}
},
{
// Radio buttons
match: function ($el) {
return $el.is(":radio");
},
apply: function ($el, options) {
var ds, $div, $span;
ds = divSpan($el, options, {
divClass: options.radioClass
});
$div = ds.div;
$span = ds.span;
// Add classes for focus, handle active, checked
bindUi($el, $div, options);
bindMany($el, options, {
"click touchend": function () {
// Find all radios with the same name, then update
// them with $.uniform.update() so the right
// per-element options are used
$.uniform.update($(':radio[name="' + attrOrProp($el, "name") + '"]'));
}
});
classUpdateChecked($span, $el, options);
return {
remove: unwrapUnwrapUnbindFunction($el, options),
update: function () {
classClearStandard($div, options);
classUpdateChecked($span, $el, options);
classUpdateDisabled($div, $el, options);
}
};
}
},
{
// Select lists, but do not style multiselects here
match: function ($el) {
if ($el.is("select") && !isMultiselect($el)) {
return true;
}
return false;
},
apply: function ($el, options) {
var ds, $div, $span, origElemWidth;
if (options.selectAutoWidth) {
sizingInvisible($el, function () {
origElemWidth = $el.width();
});
}
ds = divSpan($el, options, {
divClass: options.selectClass,
spanHtml: ($el.find(":selected:first") || $el.find("option:first")).html(),
spanWrap: "before"
});
$div = ds.div;
$span = ds.span;
if (options.selectAutoWidth) {
// Use the width of the select and adjust the
// span and div accordingly
sizingInvisible($el, function () {
// Force "display: block" - related to bug #287
swap($([ $span[0], $div[0] ]), {
display: "block"
}, function () {
var spanPad;
spanPad = $span.outerWidth() - $span.width();
$div.width(origElemWidth + spanPad);
$span.width(origElemWidth);
});
});
} else {
// Force the select to fill the size of the div
$div.addClass('fixedWidth');
}
// Take care of events
bindUi($el, $div, options);
bindMany($el, options, {
change: function () {
$span.html($el.find(":selected").html());
$div.removeClass(options.activeClass);
},
"click touchend": function () {
// IE7 and IE8 may not update the value right
// until after click event - issue #238
var selHtml = $el.find(":selected").html();
if ($span.html() !== selHtml) {
// Change was detected
// Fire the change event on the select tag
$el.trigger('change');
}
},
keyup: function () {
$span.html($el.find(":selected").html());
}
});
noSelect($span, options);
return {
remove: function () {
// Remove sibling span
$span.remove();
// Unwrap parent div
$el.unwrap().unbind(options.eventNamespace);
return $el;
},
update: function () {
if (options.selectAutoWidth) {
// Easier to remove and reapply formatting
$.uniform.restore($el);
$el.uniform(options);
} else {
classClearStandard($div, options);
// Reset current selected text
$span.html($el.find(":selected").html());
classUpdateDisabled($div, $el, options);
}
}
};
}
},
{
// Select lists - multiselect lists only
match: function ($el) {
if ($el.is("select") && isMultiselect($el)) {
return true;
}
return false;
},
apply: function ($el, options) {
var $wrapper;
$el.addClass(options.selectMultiClass);
$wrapper = wrapWithWrapperClass($el, options);
bindUi($el, $el, options);
return {
remove: function () {
$el.removeClass(options.selectMultiClass);
if ($wrapper) {
$el.unwrap();
}
},
update: returnFalse
};
}
},
{
// Textareas
match: function ($el) {
return $el.is("textarea");
},
apply: function ($el, options) {
var $wrapper;
$el.addClass(options.textareaClass);
$wrapper = wrapWithWrapperClass($el, options);
bindUi($el, $el, options);
return {
remove: function () {
$el.removeClass(options.textareaClass);
if ($wrapper) {
$el.unwrap();
}
},
update: returnFalse
};
}
}
];
// IE6 can't be styled - can't set opacity on select
if (isMsie() && !isMsieSevenOrNewer()) {
allowStyling = false;
}
$.uniform = {
// Default options that can be overridden globally or when uniformed
// globally: $.uniform.defaults.fileButtonHtml = "Pick A File";
// on uniform: $('input').uniform({fileButtonHtml: "Pick a File"});
defaults: {
activeClass: "active",
autoHide: true,
buttonClass: "button",
checkboxClass: "checker",
checkedClass: "checked",
disabledClass: "disabled",
eventNamespace: ".uniform",
fileButtonClass: "action",
fileButtonHtml: "Choose File",
fileClass: "uploader",
fileDefaultHtml: "No file selected",
filenameClass: "filename",
focusClass: "focus",
hoverClass: "hover",
idPrefix: "uniform",
inputAddTypeAsClass: true,
inputClass: "uniform-input",
radioClass: "radio",
resetDefaultHtml: "Reset",
resetSelector: false, // We'll use our own function when you don't specify one
selectAutoWidth: true,
selectClass: "selector",
selectMultiClass: "uniform-multiselect",
submitDefaultHtml: "Submit", // Only text allowed
textareaClass: "uniform",
useID: true,
wrapperClass: null
},
// All uniformed elements - DOM objects
elements: []
};
$.fn.uniform = function (options) {
var el = this;
options = $.extend({}, $.uniform.defaults, options);
// If we are in high contrast mode, do not allow styling
if (!highContrastTest) {
highContrastTest = true;
if (highContrast()) {
allowStyling = false;
}
}
// Only uniform on browsers that work
if (!allowStyling) {
return this;
}
// Code for specifying a reset button
if (options.resetSelector) {
$(options.resetSelector).mouseup(function () {
wind.setTimeout(function () {
$.uniform.update(el);
}, 10);
});
}
return this.each(function () {
var $el = $(this), i, handler, callbacks;
// Avoid uniforming elements already uniformed - just update
if ($el.data("uniformed")) {
$.uniform.update($el);
return;
}
// See if we have any handler for this type of element
for (i = 0; i < uniformHandlers.length; i = i + 1) {
handler = uniformHandlers[i];
if (handler.match($el, options)) {
callbacks = handler.apply($el, options);
$el.data("uniformed", callbacks);
// Store element in our global array
$.uniform.elements.push($el.get(0));
return;
}
}
// Could not style this element
});
};
$.uniform.restore = $.fn.uniform.restore = function (elem) {
if (elem === undef) {
elem = $.uniform.elements;
}
$(elem).each(function () {
var $el = $(this), index, elementData;
elementData = $el.data("uniformed");
// Skip elements that are not uniformed
if (!elementData) {
return;
}
// Unbind events, remove additional markup that was added
elementData.remove();
// Remove item from list of uniformed elements
index = $.inArray(this, $.uniform.elements);
if (index >= 0) {
$.uniform.elements.splice(index, 1);
}
$el.removeData("uniformed");
});
};
$.uniform.update = $.fn.uniform.update = function (elem) {
if (elem === undef) {
elem = $.uniform.elements;
}
$(elem).each(function () {
var $el = $(this), elementData;
elementData = $el.data("uniformed");
// Skip elements that are not uniformed
if (!elementData) {
return;
}
elementData.update($el, elementData.options);
});
};
}(this, jQuery));/** This file is part of KCFinder project
*
* @desc My jQuery UI & Uniform fixes
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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;
};
$.fn.oldUniform = $.fn.uniform;
$.fn.uniform = function(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) {
var ret = $(this).oldUniform(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
$(this).each(function() {
var t = $(this);
if (!t.hasClass('sh-uniform')) {
t.addClass('sh-uniform');
// Fix upload filename width
if (t.is('input[type="file"]')) {
var f = t.parent().find('.filename');
f.css('width', f.innerWidth());
}
// Add an icon into select boxes
if (t.is('select') && !t.attr('multiple')) {
var p = t.parent(),
height = p.height(),
width = p.outerWidth(),
width2 = p.find('span').outerWidth();
$('<div></div>').addClass('ui-icon').css({
'float': "right",
marginTop: - parseInt((height / 2) + 8),
marginRight: - parseInt((width - width2) / 2) - 7
}).appendTo(p);
}
}
});
return ret;
};
})(jQuery);/** This file is part of KCFinder project
*
* @desc Right Click jQuery Plugin
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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) {
e.preventDefault();
$.clearSelection();
if ($.isFunction(func))
func(this, e);
});
});
return $(this);
};
})(jQuery);// @author Rich Adams <rich@richadams.me>
// 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);/** This file is part of KCFinder project
*
* @desc User Agent jQuery Plugin
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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);/** This file is part of KCFinder project
*
* @desc Helper functions integrated in jQuery
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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.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 if ($.agent.msie) { // IE
$(this).bind('selectstart', function() {
return false;
});
} else { //Opera, etc.
$(this).mousedown(function() {
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();
};
$.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, "&amp;")
.replace(/\"/g, "&quot;")
.replace(/\'/g, "&#39;");
},
htmlData: function(value) {
return value.toString()
.replace(/\&/g, "&amp;")
.replace(/\</g, "&lt;")
.replace(/\>/g, "&gt;")
.replace(/\ /g, "&nbsp;")
.replace(/\"/g, "&quot;")
.replace(/\'/g, "&#39;");
},
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);
/** This file is part of KCFinder project
*
* @desc Helper MD5 checksum function
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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<<iShiftBits) | (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);/** This file is part of KCFinder project
*
* @desc Base JavaScript object properties
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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
*/
var _ = {
opener: {},
support: {},
files: [],
clipboard: [],
labels: [],
shows: [],
orders: [],
cms: "",
scrollbarWidth: 20
};
/** This file is part of KCFinder project
*
* @desc Dialog boxes functionality
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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", "<br />\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 = $('<div></div>');
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('<button type="submit" style="width:0;height:0;padding:0;margin:0;border:0;visibility:hidden">Submit</button>');
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('<div style="float:left;padding:10px 0 0 10px">' + o.legend + '</div>');
if ($.agent && $.agent.firefox)
dlg.css('overflow-x', "hidden");
return dlg;
};
_.fileNameDialog = function(post, inputName, inputValue, url, labels, callBack, selectAll) {
var html = '<form method="post" action="javascript:;"><input name="' + inputName + '" type="text" /></form>',
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.uniform().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();
}
};/** This file is part of KCFinder project
*
* @desc Object initializations
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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 = $('<div></div>')
.css({width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000})
.prependTo('body').append('<div></div>').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 = '<div style="padding:10px">Your browser is not capable to display KCFinder. Please update your browser or install another one: <a href="http://www.mozilla.com/firefox/" target="_blank">Mozilla Firefox</a>, <a href="http://www.apple.com/safari" target="_blank">Apple Safari</a>, <a href="http://www.google.com/chrome" target="_blank">Google Chrome</a>, <a href="http://www.opera.com/browser" target="_blank">Opera</a>.';
if ($.agent.msie && !$.agent.opera)
html += ' You may also install <a href="http://www.google.com/chromeframe" target="_blank">Google Chrome Frame ActiveX plugin</a> to get Internet Explorer 6, 7, 8 working.';
html += '</div>';
$('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();
}
});
};
_.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();
var width = jLeft.outerWidth() + jRight.outerWidth();
jStatus.css('width', width);
while (jStatus.outerWidth() > width)
jStatus.css('width', parseInt(jStatus.css('width')) - 1);
while (jStatus.outerWidth() < width)
jStatus.css('width', parseInt(jStatus.css('width')) + 1);
jFiles.css('width', jRight.innerWidth() - jFiles.outerHSpace());
jResizer.css({
left: jLeft.outerWidth() - jFolders.outerRightSpace('m'),
width: jFolders.outerRightSpace('m') + jFiles.outerLeftSpace('m')
});
};
_.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('<span style="padding:0 0 0 28px;margin:-2px 0 -3px -6px;display:block;font-size:1em;font-weight:bold;background:url(' + path + 'themes/default/img/kcf_logo.png) left center no-repeat">' + title + '</span>');
}
};
_.fixFilesHeight = function() {
var jFiles = $('#files'),
jSettings = $('#settings');
jFiles.css('height',
$('#left').outerHeight() - $('#toolbar').outerHeight() - jFiles.outerVSpace() -
((jSettings.css('display') != "none") ? jSettings.outerHeight() : 0)
);
};
/** This file is part of KCFinder project
*
* @desc Toolbar functionality
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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();
}
$('#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();
} 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 = '<div class="box about">' +
'<div class="head"><a href="http://kcfinder.sunhater.com" target="_blank">KCFinder</a> ' + _.version + '</div>';
if (_.support.check4Update)
html += '<div id="checkver"><span class="loading"><span>' + _.label("Checking for new version...") + '</span></span></div>';
html +=
'<div>' + _.label("Licenses:") + ' <a href="http://opensource.org/licenses/GPL-3.0" target="_blank">GPLv3</a> & <a href="http://opensource.org/licenses/LGPL-3.0" target="_blank">LGPLv3</a></div>' +
'<div>Copyright &copy;2010-2014 Pavel Tzonkov</div>' +
'</div>';
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('<a href="http://kcfinder.sunhater.com/download" target="_blank">' + _.label("Download version {version} now!", {version: data.version}) + '</a>');
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('<div id="upload" style="top:' + top + 'px;width:' + width + 'px;height:' + height + 'px"><form enctype="multipart/form-data" method="post" target="uploadResponse" action="' + _.getURL('upload') + '"><input type="file" name="upload[]" onchange="_.uploadFile(this.form)" style="height:' + height + 'px" multiple="multiple" /><input type="hidden" name="dir" value="" /></form></div>');
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;
$('<iframe id="uploadResponse" name="uploadResponse" src="javascript:;"></iframe>').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."));
}
});
};
/** This file is part of KCFinder project
*
* @desc Settings panel functionality
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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').disableTextSelect();
$('#settings fieldset, #settings input, #settings label').uniform();
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();
});
};
/** This file is part of KCFinder project
*
* @desc File related functionality
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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 = $('<div></div>');
$.each(_.files, function(i, file) {
var f, icon,
stamp = file.size + "|" + file.mtime;
// List
if ($.$.kuki.get('view') == "list") {
if (!i) c.html('<table></table>');
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 = $('<tr class="file"><td class="name thumb"></td><td class="time"></td><td class="size"></td></tr>');
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 = $('<div class="file"><div class="thumb"></div><div class="name"></div><div class="time"></div><div class="size"></div></div>');
f.appendTo(c);
}
f.find('.thumb').css({backgroundImage: 'url("' + icon + '")'});
f.find('.name').html($.$.htmlData(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();
}, 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').html($.$.htmlData(data.name) + " (" + _.humanSize(data.size) + ", " + data.date + ")");
}
}
// Normal click
} else {
data = file.data();
$('.file').removeClass('selected');
file.addClass('selected');
$('#fileinfo').html($.$.htmlData(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()
}
};
/** This file is part of KCFinder project
*
* @desc Folder related functionality
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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 = '<div class="folder"><a href="kcdir:/' + $.$.escapeDirs(path) + '"><span class="brace">&nbsp;</span><span class="folder">' + $.$.htmlData(root.name) + '</span></a>';
if (root.dirs) {
html += '<div class="folders">';
for (var i = 0; i < root.dirs.length; i++) {
cdir = root.dirs[i];
html += _.buildTree(cdir, path + "/");
}
html += '</div>';
}
html += '</div>';
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);
});
dir.children('.brace').removeClass('opened').addClass('closed');
} else {
if (dir.parent().children('.folders').get(0)) {
dir.parent().children('.folders').show(500);
dir.children('.brace').removeClass('closed').addClass('opened');
} else if (!$('#loadingDirs').get(0)) {
dir.parent().append('<div id="loadingDirs">' + _.label("Loading folders...") + '</div>');
$('#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 += '<div class="folder"><a href="kcdir:/' + $.$.escapeDirs(path + '/' + cdir.name) + '"><span class="brace">&nbsp;</span><span class="folder">' + $.$.htmlData(cdir.name) + '</span></a></div>';
});
if (html.length) {
dir.parent().append('<div class="folders">' + html + '</div>');
var folders = $(dir.parent().children('.folders').first());
folders.hide();
$(folders).show(500);
$.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();
},
error: function() {
$('#loadingDirs').detach();
_.alert(_.label("Unknown error."));
}
});
});
}
}
};
_.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();
},
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;
};
/** This file is part of KCFinder project
*
* @desc Context menus
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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("<ul></ul>").css('display', 'none');
},
addItem: function(href, label, callback, denied) {
if (typeof denied == "undefined")
denied = false;
$('#menu ul').append('<li><a href="' + href + '"' + (denied ? ' class="denied"' : "") + '><span>' + label + '</span></a></li>');
if (!denied && $.isFunction(callback))
$('#menu a[href="' + href + '"]').click(function() {
_.menu.hide();
return callback();
});
},
addDivider: function() {
if ($('#menu ul').html().length)
$('#menu ul').append("<li>-</li>");
},
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').html($.$.htmlData(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('<form id="downloadForm" method="post" action="' + _.getURL('download') + '"><input type="hidden" name="dir" /><input type="hidden" name="file" /></form>');
$('#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 = '<ul>';
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').html($.$.htmlData(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 = '<li class="list"><div>';
// 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 += '<a title="' + _.label("Click to remove from the Clipboard") + '" onclick="_.removeFromClipboard(' + i + ')"' + ((i == 0) ? ' class="first"' : "") + '><span style="background-image:url(' + $.$.escapeDirs(icon) + ')">' + $.$.htmlData($.$.basename(val.name)) + '</span></a>';
});
html += '</div></li><li class="div-files">-</li>';
$('#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);
};/** This file is part of KCFinder project
*
* @desc Image viewer
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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 = [],
showImage = function(data) {
_.lock = true;
$('#loading').html(_.label("Loading image...")).show();
var url = $.$.escapeDirs(_.uploadURL + "/" + _.dir + "/" + data.name) + "?ts=" + ts,
img = new Image(),
i = $(img),
w = $(window),
d = $(document);
onImgLoad = function() {
_.lock = false;
$('#files .file').each(function() {
if ($(this).data('name') == data.name) {
_.ssImage = this;
return false;
}
});
i.hide().appendTo('body');
var o_w = i.width(),
o_h = i.height(),
i_w = o_w,
i_h = o_h,
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);
},
t = $('<div></div>');
i.detach().appendTo(t);
t.addClass("img");
if (!dlg) {
var ww = w.width() - 60,
closeFunc = function() {
d.unbind('keydown').keydown(function(e) {
return !_.selectAll(e);
});
dlg.dialog('destroy').detach();
};
if ((ww % 2)) ww++;
dlg = _.dialog($.$.htmlData(data.name), t.get(0), {
width: ww,
height: w.height() - 36,
position: [30, 30],
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: function(e) {
d.unbind('keydown').keydown(function(e) {
return !_.selectAll(e);
});
if (_.ssImage) {
_.selectFile($(_.ssImage), e);
}
dlg.dialog('destroy').detach();
}
}, {
text: _.label("Close"),
icons: {primary: "ui-icon-closethick"},
click: closeFunc
}
]
});
dlg.addClass('kcfImageViewer').css('overflow', "hidden").parent().find('.ui-dialog-buttonpane button').get(2).focus();
} else {
dlg.prev().find('.ui-dialog-title').html($.$.htmlData(data.name));
dlg.html(t.get(0));
}
dlg.unbind('click').click(nextFunc).disableTextSelect();
var d_w = dlg.innerWidth(),
d_h = dlg.innerHeight();
if ((o_w > d_w) || (o_h > d_h)) {
i_w = d_w;
i_h = d_h;
if ((d_w / d_h) > (o_w / o_h))
i_w = parseInt((o_w * d_h) / o_h);
else if ((d_w / d_h) < (o_w / o_h))
i_h = parseInt((o_h * d_w) / o_w);
}
i.css({
width: i_w,
height: i_h
}).show().parent().css({
display: "block",
margin: "0 auto",
width: i_w,
height: i_h,
marginTop: parseInt((d_h - i_h) / 2)
});
$('#loading').hide();
d.unbind('keydown').keydown(function(e) {
if (!_.lock) {
var kc = e.keyCode;
if ((kc == 37)) prevFunc();
if ((kc == 39)) nextFunc();
}
});
};
img.src = url;
if (img.complete)
onImgLoad();
else {
img.onload = onImgLoad;
img.onerror = function() {
_.lock = false;
$('#loading').hide();
_.alert(_.label("Unknown error."));
d.unbind('keydown').keydown(function(e) {
return !_.selectAll(e);
});
_.refresh();
};
}
};
$.each(_.files, function(i, file) {
var i = images.length;
if (file.thumb || file.smallThumb)
images[i] = file;
if (file.name == data.name)
_.currImg = i;
});
showImage(data);
return false;
};
/** This file is part of KCFinder project
*
* @desc Clipboard functionality
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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('<div title="' + _.label("Clipboard") + ' (' + _.clipboard.length + ' ' + _.label("files") + ', ' + size + ')" onclick="_.openClipboard()"></div>');
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 = [];
};
/** This file is part of KCFinder project
*
* @desc Upload files using drag and drop
* @package KCFinder
* @version 3.12
* @author Forum user (updated by 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 ((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;
}),
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')) {
_.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;
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')) {
_.alert(_.label("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(_.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(_.label("Uploading file {number} of {count}... {progress}", {
number: filesCount - uploadQueue.length,
count: filesCount,
progress: ""
})).show();
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', _.getURL('upload'), true);
xhr.setRequestHeader('Content-Type', "multipart/form-data; boundary=" + boundary);
//xhr.setRequestHeader('Content-Length', postbody.length);
xhr.onload = function(e) {
$('#loading').hide();
if (_.dir == reader.thisTargetDir)
_.fadeFiles();
uploadInProgress = false;
processUploadQueue();
if (xhr.responseText.substr(0, 1) != "/")
errors[errors.length] = xhr.responseText;
};
xhr.sendAsBinary(postbody);
};
reader.onerror = function(evt) {
$('#loading').hide();
uploadInProgress = false;
processUploadQueue();
errors[errors.length] = _.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 == _.dir)
_.refresh();
if (errors.length) {
errors = errors.join("\n");
if (errors.replace(/^\s+/g, "").replace(/\s+$/g, "").length)
_.alert(errors);
errors = [];
}
}, 333);
}
}
};
/** This file is part of KCFinder project
*
* @desc Miscellaneous functionality
* @package KCFinder
* @version 3.12
* @author Pavel Tzonkov <sunhater@sunhater.com>
* @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) {
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 = '<form id="postForm" method="post" action="' + url + '">';
$.each(data, function(key, val) {
if ($.isArray(val))
$.each(val, function(i, aval) {
html += '<input type="hidden" name="' + $.$.htmlValue(key) + '[]" value="' + $.$.htmlValue(aval) + '" />';
});
else
html += '<input type="hidden" name="' + $.$.htmlValue(key) + '" value="' + $.$.htmlValue(val) + '" />';
});
html += '</form>';
$('#menu').html(html).show();
$('#postForm').get(0).submit();
};
_.fadeFiles = function() {
$('#files > div').css({
opacity: "0.4",
filter: "alpha(opacity=40)"
});
};