Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/js
File: jquery.elfinder.js
/*** jQuery UI droppable performance tune for elFinder ***/
[0] Fix | Delete
(function(){
[1] Fix | Delete
if (jQuery.ui) {
[2] Fix | Delete
if (jQuery.ui.ddmanager) {
[3] Fix | Delete
var origin = jQuery.ui.ddmanager.prepareOffsets;
[4] Fix | Delete
jQuery.ui.ddmanager.prepareOffsets = function( t, event ) {
[5] Fix | Delete
var isOutView = function(elem) {
[6] Fix | Delete
if (elem.is(':hidden')) {
[7] Fix | Delete
return true;
[8] Fix | Delete
}
[9] Fix | Delete
var rect = elem[0].getBoundingClientRect();
[10] Fix | Delete
return document.elementFromPoint(rect.left, rect.top) || document.elementFromPoint(rect.left + rect.width, rect.top + rect.height)? false : true;
[11] Fix | Delete
};
[12] Fix | Delete
[13] Fix | Delete
if (event.type === 'mousedown' || t.options.elfRefresh) {
[14] Fix | Delete
var i, d,
[15] Fix | Delete
m = jQuery.ui.ddmanager.droppables[ t.options.scope ] || [],
[16] Fix | Delete
l = m.length;
[17] Fix | Delete
for ( i = 0; i < l; i++ ) {
[18] Fix | Delete
d = m[ i ];
[19] Fix | Delete
if (d.options.autoDisable && (!d.options.disabled || d.options.autoDisable > 1)) {
[20] Fix | Delete
d.options.disabled = isOutView(d.element);
[21] Fix | Delete
d.options.autoDisable = d.options.disabled? 2 : 1;
[22] Fix | Delete
}
[23] Fix | Delete
}
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
// call origin function
[27] Fix | Delete
return origin( t, event );
[28] Fix | Delete
};
[29] Fix | Delete
}
[30] Fix | Delete
}
[31] Fix | Delete
})();
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
*
[35] Fix | Delete
* jquery.binarytransport
[36] Fix | Delete
*
[37] Fix | Delete
* @description. jQuery ajax transport for making binary data type requests.
[38] Fix | Delete
*
[39] Fix | Delete
*/
[40] Fix | Delete
[41] Fix | Delete
(function($, undefined) {
[42] Fix | Delete
"use strict";
[43] Fix | Delete
[44] Fix | Delete
// use this transport for "binary" data type
[45] Fix | Delete
jQuery.ajaxTransport("+binary", function(options, originalOptions, jqXHR) {
[46] Fix | Delete
// check for conditions and support for blob / arraybuffer response type
[47] Fix | Delete
if (window.FormData && ((options.dataType && (options.dataType == 'binary')) || (options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) || (window.Blob && options.data instanceof Blob))))) {
[48] Fix | Delete
var callback;
[49] Fix | Delete
[50] Fix | Delete
// Cross domain only allowed if supported through XMLHttpRequest
[51] Fix | Delete
return {
[52] Fix | Delete
send: function( headers, complete ) {
[53] Fix | Delete
var i,
[54] Fix | Delete
dataType = options.responseType || "blob",
[55] Fix | Delete
xhr = options.xhr();
[56] Fix | Delete
[57] Fix | Delete
xhr.open(
[58] Fix | Delete
options.type,
[59] Fix | Delete
options.url,
[60] Fix | Delete
options.async,
[61] Fix | Delete
options.username,
[62] Fix | Delete
options.password
[63] Fix | Delete
);
[64] Fix | Delete
[65] Fix | Delete
// Apply custom fields if provided
[66] Fix | Delete
if ( options.xhrFields ) {
[67] Fix | Delete
for ( i in options.xhrFields ) {
[68] Fix | Delete
xhr[ i ] = options.xhrFields[ i ];
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
// Override mime type if needed
[73] Fix | Delete
if ( options.mimeType && xhr.overrideMimeType ) {
[74] Fix | Delete
xhr.overrideMimeType( options.mimeType );
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
// X-Requested-With header
[78] Fix | Delete
// For cross-domain requests, seeing as conditions for a preflight are
[79] Fix | Delete
// akin to a jigsaw puzzle, we simply never set it to be sure.
[80] Fix | Delete
// (it can always be set on a per-request basis or even using ajaxSetup)
[81] Fix | Delete
// For same-domain requests, won't change header if already provided.
[82] Fix | Delete
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
[83] Fix | Delete
headers[ "X-Requested-With" ] = "XMLHttpRequest";
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
// Set headers
[87] Fix | Delete
for ( i in headers ) {
[88] Fix | Delete
xhr.setRequestHeader( i, headers[ i ] );
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
// Callback
[92] Fix | Delete
callback = function( type ) {
[93] Fix | Delete
return function() {
[94] Fix | Delete
if ( callback ) {
[95] Fix | Delete
callback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = null;
[96] Fix | Delete
[97] Fix | Delete
if ( type === "abort" ) {
[98] Fix | Delete
xhr.abort();
[99] Fix | Delete
} else if ( type === "error" ) {
[100] Fix | Delete
complete(
[101] Fix | Delete
xhr.status,
[102] Fix | Delete
xhr.statusText
[103] Fix | Delete
);
[104] Fix | Delete
} else {
[105] Fix | Delete
var data = {};
[106] Fix | Delete
data[options.dataType] = xhr.response;
[107] Fix | Delete
complete(
[108] Fix | Delete
xhr.status,
[109] Fix | Delete
xhr.statusText,
[110] Fix | Delete
data,
[111] Fix | Delete
xhr.getAllResponseHeaders()
[112] Fix | Delete
);
[113] Fix | Delete
}
[114] Fix | Delete
}
[115] Fix | Delete
};
[116] Fix | Delete
};
[117] Fix | Delete
[118] Fix | Delete
// Listen to events
[119] Fix | Delete
xhr.onload = callback();
[120] Fix | Delete
xhr.onabort = xhr.onerror = xhr.ontimeout = callback( "error" );
[121] Fix | Delete
[122] Fix | Delete
// Create the abort callback
[123] Fix | Delete
callback = callback( "abort" );
[124] Fix | Delete
[125] Fix | Delete
try {
[126] Fix | Delete
xhr.responseType = dataType;
[127] Fix | Delete
// Do send the request (this may raise an exception)
[128] Fix | Delete
xhr.send( options.data || null );
[129] Fix | Delete
} catch ( e ) {
[130] Fix | Delete
if ( callback ) {
[131] Fix | Delete
throw e;
[132] Fix | Delete
}
[133] Fix | Delete
}
[134] Fix | Delete
},
[135] Fix | Delete
[136] Fix | Delete
abort: function() {
[137] Fix | Delete
if ( callback ) {
[138] Fix | Delete
callback();
[139] Fix | Delete
}
[140] Fix | Delete
}
[141] Fix | Delete
};
[142] Fix | Delete
}
[143] Fix | Delete
});
[144] Fix | Delete
})(window.jQuery);
[145] Fix | Delete
[146] Fix | Delete
/*!
[147] Fix | Delete
* jQuery UI Touch Punch 0.2.3
[148] Fix | Delete
*
[149] Fix | Delete
* Copyright 2011–2014, Dave Furfero
[150] Fix | Delete
* Dual licensed under the MIT or GPL Version 2 licenses.
[151] Fix | Delete
*
[152] Fix | Delete
* Depends:
[153] Fix | Delete
* jquery.ui.widget.js
[154] Fix | Delete
* jquery.ui.mouse.js
[155] Fix | Delete
*/
[156] Fix | Delete
(function ($) {
[157] Fix | Delete
[158] Fix | Delete
// Detect touch support
[159] Fix | Delete
jQuery.support.touch = 'ontouchend' in document;
[160] Fix | Delete
[161] Fix | Delete
// Ignore browsers without touch support
[162] Fix | Delete
if (!jQuery.support.touch) {
[163] Fix | Delete
return;
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
var mouseProto = jQuery.ui.mouse.prototype,
[167] Fix | Delete
_mouseInit = mouseProto._mouseInit,
[168] Fix | Delete
_mouseDestroy = mouseProto._mouseDestroy,
[169] Fix | Delete
touchHandled,
[170] Fix | Delete
posX, posY;
[171] Fix | Delete
[172] Fix | Delete
/**
[173] Fix | Delete
* Simulate a mouse event based on a corresponding touch event
[174] Fix | Delete
* @param {Object} event A touch event
[175] Fix | Delete
* @param {String} simulatedType The corresponding mouse event
[176] Fix | Delete
*/
[177] Fix | Delete
function simulateMouseEvent (event, simulatedType) {
[178] Fix | Delete
[179] Fix | Delete
// Ignore multi-touch events
[180] Fix | Delete
if (event.originalEvent.touches.length > 1) {
[181] Fix | Delete
return;
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
if (! jQuery(event.currentTarget).hasClass('touch-punch-keep-default')) {
[185] Fix | Delete
event.preventDefault();
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
var touch = event.originalEvent.changedTouches[0],
[189] Fix | Delete
simulatedEvent = document.createEvent('MouseEvents');
[190] Fix | Delete
[191] Fix | Delete
// Initialize the simulated mouse event using the touch event's coordinates
[192] Fix | Delete
simulatedEvent.initMouseEvent(
[193] Fix | Delete
simulatedType, // type
[194] Fix | Delete
true, // bubbles
[195] Fix | Delete
true, // cancelable
[196] Fix | Delete
window, // view
[197] Fix | Delete
1, // detail
[198] Fix | Delete
touch.screenX, // screenX
[199] Fix | Delete
touch.screenY, // screenY
[200] Fix | Delete
touch.clientX, // clientX
[201] Fix | Delete
touch.clientY, // clientY
[202] Fix | Delete
false, // ctrlKey
[203] Fix | Delete
false, // altKey
[204] Fix | Delete
false, // shiftKey
[205] Fix | Delete
false, // metaKey
[206] Fix | Delete
0, // button
[207] Fix | Delete
null // relatedTarget
[208] Fix | Delete
);
[209] Fix | Delete
[210] Fix | Delete
// Dispatch the simulated event to the target element
[211] Fix | Delete
event.target.dispatchEvent(simulatedEvent);
[212] Fix | Delete
}
[213] Fix | Delete
[214] Fix | Delete
/**
[215] Fix | Delete
* Handle the jQuery UI widget's touchstart events
[216] Fix | Delete
* @param {Object} event The widget element's touchstart event
[217] Fix | Delete
*/
[218] Fix | Delete
mouseProto._touchStart = function (event) {
[219] Fix | Delete
[220] Fix | Delete
var self = this;
[221] Fix | Delete
[222] Fix | Delete
// Ignore the event if another widget is already being handled
[223] Fix | Delete
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
[224] Fix | Delete
return;
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
// Track element position to avoid "false" move
[228] Fix | Delete
posX = event.originalEvent.changedTouches[0].screenX.toFixed(0);
[229] Fix | Delete
posY = event.originalEvent.changedTouches[0].screenY.toFixed(0);
[230] Fix | Delete
[231] Fix | Delete
// Set the flag to prevent other widgets from inheriting the touch event
[232] Fix | Delete
touchHandled = true;
[233] Fix | Delete
[234] Fix | Delete
// Track movement to determine if interaction was a click
[235] Fix | Delete
self._touchMoved = false;
[236] Fix | Delete
[237] Fix | Delete
// Simulate the mouseover event
[238] Fix | Delete
simulateMouseEvent(event, 'mouseover');
[239] Fix | Delete
[240] Fix | Delete
// Simulate the mousemove event
[241] Fix | Delete
simulateMouseEvent(event, 'mousemove');
[242] Fix | Delete
[243] Fix | Delete
// Simulate the mousedown event
[244] Fix | Delete
simulateMouseEvent(event, 'mousedown');
[245] Fix | Delete
};
[246] Fix | Delete
[247] Fix | Delete
/**
[248] Fix | Delete
* Handle the jQuery UI widget's touchmove events
[249] Fix | Delete
* @param {Object} event The document's touchmove event
[250] Fix | Delete
*/
[251] Fix | Delete
mouseProto._touchMove = function (event) {
[252] Fix | Delete
[253] Fix | Delete
// Ignore event if not handled
[254] Fix | Delete
if (!touchHandled) {
[255] Fix | Delete
return;
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
// Ignore if it's a "false" move (position not changed)
[259] Fix | Delete
var x = event.originalEvent.changedTouches[0].screenX.toFixed(0);
[260] Fix | Delete
var y = event.originalEvent.changedTouches[0].screenY.toFixed(0);
[261] Fix | Delete
// Ignore if it's a "false" move (position not changed)
[262] Fix | Delete
if (Math.abs(posX - x) <= 4 && Math.abs(posY - y) <= 4) {
[263] Fix | Delete
return;
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
// Interaction was not a click
[267] Fix | Delete
this._touchMoved = true;
[268] Fix | Delete
[269] Fix | Delete
// Simulate the mousemove event
[270] Fix | Delete
simulateMouseEvent(event, 'mousemove');
[271] Fix | Delete
};
[272] Fix | Delete
[273] Fix | Delete
/**
[274] Fix | Delete
* Handle the jQuery UI widget's touchend events
[275] Fix | Delete
* @param {Object} event The document's touchend event
[276] Fix | Delete
*/
[277] Fix | Delete
mouseProto._touchEnd = function (event) {
[278] Fix | Delete
[279] Fix | Delete
// Ignore event if not handled
[280] Fix | Delete
if (!touchHandled) {
[281] Fix | Delete
return;
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
// Simulate the mouseup event
[285] Fix | Delete
simulateMouseEvent(event, 'mouseup');
[286] Fix | Delete
[287] Fix | Delete
// Simulate the mouseout event
[288] Fix | Delete
simulateMouseEvent(event, 'mouseout');
[289] Fix | Delete
[290] Fix | Delete
// If the touch interaction did not move, it should trigger a click
[291] Fix | Delete
if (!this._touchMoved) {
[292] Fix | Delete
[293] Fix | Delete
// Simulate the click event
[294] Fix | Delete
simulateMouseEvent(event, 'click');
[295] Fix | Delete
}
[296] Fix | Delete
[297] Fix | Delete
// Unset the flag to allow other widgets to inherit the touch event
[298] Fix | Delete
touchHandled = false;
[299] Fix | Delete
this._touchMoved = false;
[300] Fix | Delete
};
[301] Fix | Delete
[302] Fix | Delete
/**
[303] Fix | Delete
* A duck punch of the jQuery.ui.mouse _mouseInit method to support touch events.
[304] Fix | Delete
* This method extends the widget with bound touch event handlers that
[305] Fix | Delete
* translate touch events to mouse events and pass them to the widget's
[306] Fix | Delete
* original mouse event handling methods.
[307] Fix | Delete
*/
[308] Fix | Delete
mouseProto._mouseInit = function () {
[309] Fix | Delete
[310] Fix | Delete
var self = this;
[311] Fix | Delete
[312] Fix | Delete
if (self.element.hasClass('touch-punch')) {
[313] Fix | Delete
// Delegate the touch handlers to the widget's element
[314] Fix | Delete
self.element.on({
[315] Fix | Delete
touchstart: jQuery.proxy(self, '_touchStart'),
[316] Fix | Delete
touchmove: jQuery.proxy(self, '_touchMove'),
[317] Fix | Delete
touchend: jQuery.proxy(self, '_touchEnd')
[318] Fix | Delete
});
[319] Fix | Delete
}
[320] Fix | Delete
[321] Fix | Delete
// Call the original jQuery.ui.mouse init method
[322] Fix | Delete
_mouseInit.call(self);
[323] Fix | Delete
};
[324] Fix | Delete
[325] Fix | Delete
/**
[326] Fix | Delete
* Remove the touch event handlers
[327] Fix | Delete
*/
[328] Fix | Delete
mouseProto._mouseDestroy = function () {
[329] Fix | Delete
[330] Fix | Delete
var self = this;
[331] Fix | Delete
[332] Fix | Delete
if (self.element.hasClass('touch-punch')) {
[333] Fix | Delete
// Delegate the touch handlers to the widget's element
[334] Fix | Delete
self.element.off({
[335] Fix | Delete
touchstart: jQuery.proxy(self, '_touchStart'),
[336] Fix | Delete
touchmove: jQuery.proxy(self, '_touchMove'),
[337] Fix | Delete
touchend: jQuery.proxy(self, '_touchEnd')
[338] Fix | Delete
});
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
// Call the original jQuery.ui.mouse destroy method
[342] Fix | Delete
_mouseDestroy.call(self);
[343] Fix | Delete
};
[344] Fix | Delete
[345] Fix | Delete
})(jQuery);
[346] Fix | Delete
[347] Fix | Delete
jQuery.fn.elfinder = function(o, o2) {
[348] Fix | Delete
[349] Fix | Delete
if (o === 'instance') {
[350] Fix | Delete
return this.getElFinder();
[351] Fix | Delete
} else if (o === 'ondemand') {
[352] Fix | Delete
[353] Fix | Delete
}
[354] Fix | Delete
[355] Fix | Delete
return this.each(function() {
[356] Fix | Delete
[357] Fix | Delete
var cmd = typeof o === 'string' ? o : '',
[358] Fix | Delete
bootCallback = typeof o2 === 'function'? o2 : void(0),
[359] Fix | Delete
elfinder = this.elfinder,
[360] Fix | Delete
opts, reloadCallback;
[361] Fix | Delete
[362] Fix | Delete
if (!elfinder) {
[363] Fix | Delete
if (jQuery.isPlainObject(o)) {
[364] Fix | Delete
new elFinder(this, o, bootCallback);
[365] Fix | Delete
}
[366] Fix | Delete
} else {
[367] Fix | Delete
switch(cmd) {
[368] Fix | Delete
case 'close':
[369] Fix | Delete
case 'hide':
[370] Fix | Delete
elfinder.hide();
[371] Fix | Delete
break;
[372] Fix | Delete
[373] Fix | Delete
case 'open':
[374] Fix | Delete
case 'show':
[375] Fix | Delete
elfinder.show();
[376] Fix | Delete
break;
[377] Fix | Delete
[378] Fix | Delete
case 'destroy':
[379] Fix | Delete
elfinder.destroy();
[380] Fix | Delete
break;
[381] Fix | Delete
[382] Fix | Delete
case 'reload':
[383] Fix | Delete
case 'restart':
[384] Fix | Delete
if (elfinder) {
[385] Fix | Delete
opts = jQuery.extend(true, elfinder.options, jQuery.isPlainObject(o2)? o2 : {});
[386] Fix | Delete
bootCallback = elfinder.bootCallback;
[387] Fix | Delete
if (elfinder.reloadCallback && jQuery.isFunction(elfinder.reloadCallback)) {
[388] Fix | Delete
elfinder.reloadCallback(opts, bootCallback);
[389] Fix | Delete
} else {
[390] Fix | Delete
elfinder.destroy();
[391] Fix | Delete
new elFinder(this, opts, bootCallback);
[392] Fix | Delete
}
[393] Fix | Delete
}
[394] Fix | Delete
break;
[395] Fix | Delete
}
[396] Fix | Delete
}
[397] Fix | Delete
});
[398] Fix | Delete
};
[399] Fix | Delete
[400] Fix | Delete
jQuery.fn.getElFinder = function() {
[401] Fix | Delete
var instance;
[402] Fix | Delete
[403] Fix | Delete
this.each(function() {
[404] Fix | Delete
if (this.elfinder) {
[405] Fix | Delete
instance = this.elfinder;
[406] Fix | Delete
return false;
[407] Fix | Delete
}
[408] Fix | Delete
});
[409] Fix | Delete
[410] Fix | Delete
return instance;
[411] Fix | Delete
};
[412] Fix | Delete
[413] Fix | Delete
jQuery.fn.elfUiWidgetInstance = function(name) {
[414] Fix | Delete
try {
[415] Fix | Delete
return this[name]('instance');
[416] Fix | Delete
} catch(e) {
[417] Fix | Delete
// fallback for jQuery UI < 1.11
[418] Fix | Delete
var data = this.data('ui-' + name);
[419] Fix | Delete
if (data && typeof data === 'object' && data.widgetFullName === 'ui-' + name) {
[420] Fix | Delete
return data;
[421] Fix | Delete
}
[422] Fix | Delete
return null;
[423] Fix | Delete
}
[424] Fix | Delete
};
[425] Fix | Delete
[426] Fix | Delete
// function scrollRight
[427] Fix | Delete
if (! jQuery.fn.scrollRight) {
[428] Fix | Delete
jQuery.fn.extend({
[429] Fix | Delete
scrollRight: function (val) {
[430] Fix | Delete
var node = this.get(0);
[431] Fix | Delete
if (val === undefined) {
[432] Fix | Delete
return Math.max(0, node.scrollWidth - (node.scrollLeft + node.clientWidth));
[433] Fix | Delete
}
[434] Fix | Delete
return this.scrollLeft(node.scrollWidth - node.clientWidth - val);
[435] Fix | Delete
}
[436] Fix | Delete
});
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
// function scrollBottom
[440] Fix | Delete
if (! jQuery.fn.scrollBottom) {
[441] Fix | Delete
jQuery.fn.extend({
[442] Fix | Delete
scrollBottom: function(val) {
[443] Fix | Delete
var node = this.get(0);
[444] Fix | Delete
if (val === undefined) {
[445] Fix | Delete
return Math.max(0, node.scrollHeight - (node.scrollTop + node.clientHeight));
[446] Fix | Delete
}
[447] Fix | Delete
return this.scrollTop(node.scrollHeight - node.clientHeight - val);
[448] Fix | Delete
}
[449] Fix | Delete
});
[450] Fix | Delete
}
[451] Fix | Delete
[452] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function