(function(){
if (jQuery.ui) {
if (jQuery.ui.ddmanager) {
var origin = jQuery.ui.ddmanager.prepareOffsets;
jQuery.ui.ddmanager.prepareOffsets = function( t, event ) {
var isOutView = function(elem) {
if (elem.is(':hidden')) {
return true;
}
var rect = elem[0].getBoundingClientRect();
return document.elementFromPoint(rect.left, rect.top) || document.elementFromPoint(rect.left + rect.width, rect.top + rect.height)? false : true;
};
if (event.type === 'mousedown' || t.options.elfRefresh) {
var i, d,
m = jQuery.ui.ddmanager.droppables[ t.options.scope ] || [],
l = m.length;
for ( i = 0; i < l; i++ ) {
d = m[ i ];
if (d.options.autoDisable && (!d.options.disabled || d.options.autoDisable > 1)) {
d.options.disabled = isOutView(d.element);
d.options.autoDisable = d.options.disabled? 2 : 1;
}
}
}
return origin( t, event );
};
}
}
})();
(function($, undefined) {
"use strict";
jQuery.ajaxTransport("+binary", function(options, originalOptions, jqXHR) {
if (window.FormData && ((options.dataType && (options.dataType == 'binary')) || (options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) || (window.Blob && options.data instanceof Blob))))) {
var callback;
return {
send: function( headers, complete ) {
var i,
dataType = options.responseType || "blob",
xhr = options.xhr();
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
if ( options.xhrFields ) {
for ( i in options.xhrFields ) {
xhr[ i ] = options.xhrFields[ i ];
}
}
if ( options.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( options.mimeType );
}
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
callback = function( type ) {
return function() {
if ( callback ) {
callback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = null;
if ( type === "abort" ) {
xhr.abort();
} else if ( type === "error" ) {
complete(
xhr.status,
xhr.statusText
);
} else {
var data = {};
data[options.dataType] = xhr.response;
complete(
xhr.status,
xhr.statusText,
data,
xhr.getAllResponseHeaders()
);
}
}
};
};
xhr.onload = callback();
xhr.onabort = xhr.onerror = xhr.ontimeout = callback( "error" );
callback = callback( "abort" );
try {
xhr.responseType = dataType;
xhr.send( options.data || null );
} catch ( e ) {
if ( callback ) {
throw e;
}
}
},
abort: function() {
if ( callback ) {
callback();
}
}
};
}
});
})(window.jQuery);
(function ($) {
jQuery.support.touch = 'ontouchend' in document;
if (!jQuery.support.touch) {
return;
}
var mouseProto = jQuery.ui.mouse.prototype,
_mouseInit = mouseProto._mouseInit,
_mouseDestroy = mouseProto._mouseDestroy,
touchHandled,
posX, posY;
function simulateMouseEvent (event, simulatedType) {
if (event.originalEvent.touches.length > 1) {
return;
}
if (! jQuery(event.currentTarget).hasClass('touch-punch-keep-default')) {
event.preventDefault();
}
var touch = event.originalEvent.changedTouches[0],
simulatedEvent = document.createEvent('MouseEvents');
simulatedEvent.initMouseEvent(
simulatedType,
true,
true,
window,
1,
touch.screenX,
touch.screenY,
touch.clientX,
touch.clientY,
false,
false,
false,
false,
0,
null
);
event.target.dispatchEvent(simulatedEvent);
}
mouseProto._touchStart = function (event) {
var self = this;
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
return;
}
posX = event.originalEvent.changedTouches[0].screenX.toFixed(0);
posY = event.originalEvent.changedTouches[0].screenY.toFixed(0);
touchHandled = true;
self._touchMoved = false;
simulateMouseEvent(event, 'mouseover');
simulateMouseEvent(event, 'mousemove');
simulateMouseEvent(event, 'mousedown');
};
mouseProto._touchMove = function (event) {
if (!touchHandled) {
return;
}
var x = event.originalEvent.changedTouches[0].screenX.toFixed(0);
var y = event.originalEvent.changedTouches[0].screenY.toFixed(0);
if (Math.abs(posX - x) <= 4 && Math.abs(posY - y) <= 4) {
return;
}
this._touchMoved = true;
simulateMouseEvent(event, 'mousemove');
};
mouseProto._touchEnd = function (event) {
if (!touchHandled) {
return;
}
simulateMouseEvent(event, 'mouseup');
simulateMouseEvent(event, 'mouseout');
if (!this._touchMoved) {
simulateMouseEvent(event, 'click');
}
touchHandled = false;
this._touchMoved = false;
};
mouseProto._mouseInit = function () {
var self = this;
if (self.element.hasClass('touch-punch')) {
self.element.on({
touchstart: jQuery.proxy(self, '_touchStart'),
touchmove: jQuery.proxy(self, '_touchMove'),
touchend: jQuery.proxy(self, '_touchEnd')
});
}
_mouseInit.call(self);
};
mouseProto._mouseDestroy = function () {
var self = this;
if (self.element.hasClass('touch-punch')) {
self.element.off({
touchstart: jQuery.proxy(self, '_touchStart'),
touchmove: jQuery.proxy(self, '_touchMove'),
touchend: jQuery.proxy(self, '_touchEnd')
});
}
_mouseDestroy.call(self);
};
})(jQuery);
jQuery.fn.elfinder = function(o, o2) {
if (o === 'instance') {
return this.getElFinder();
} else if (o === 'ondemand') {
}
return this.each(function() {
var cmd = typeof o === 'string' ? o : '',
bootCallback = typeof o2 === 'function'? o2 : void(0),
elfinder = this.elfinder,
opts, reloadCallback;
if (!elfinder) {
if (jQuery.isPlainObject(o)) {
new elFinder(this, o, bootCallback);
}
} else {
switch(cmd) {
case 'close':
case 'hide':
elfinder.hide();
break;
case 'open':
case 'show':
elfinder.show();
break;
case 'destroy':
elfinder.destroy();
break;
case 'reload':
case 'restart':
if (elfinder) {
opts = jQuery.extend(true, elfinder.options, jQuery.isPlainObject(o2)? o2 : {});
bootCallback = elfinder.bootCallback;
if (elfinder.reloadCallback && jQuery.isFunction(elfinder.reloadCallback)) {
elfinder.reloadCallback(opts, bootCallback);
} else {
elfinder.destroy();
new elFinder(this, opts, bootCallback);
}
}
break;
}
}
});
};
jQuery.fn.getElFinder = function() {
var instance;
this.each(function() {
if (this.elfinder) {
instance = this.elfinder;
return false;
}
});
return instance;
};
jQuery.fn.elfUiWidgetInstance = function(name) {
try {
return this[name]('instance');
} catch(e) {
var data = this.data('ui-' + name);
if (data && typeof data === 'object' && data.widgetFullName === 'ui-' + name) {
return data;
}
return null;
}
};
if (! jQuery.fn.scrollRight) {
jQuery.fn.extend({
scrollRight: function (val) {
var node = this.get(0);
if (val === undefined) {
return Math.max(0, node.scrollWidth - (node.scrollLeft + node.clientWidth));
}
return this.scrollLeft(node.scrollWidth - node.clientWidth - val);
}
});
}
if (! jQuery.fn.scrollBottom) {
jQuery.fn.extend({
scrollBottom: function(val) {
var node = this.get(0);
if (val === undefined) {
return Math.max(0, node.scrollHeight - (node.scrollTop + node.clientHeight));
}
return this.scrollTop(node.scrollHeight - node.clientHeight - val);
}
});
}