Edit File by line
/home/barbar84/www/wp-conte.../plugins/file-man.../applicat.../library/js
File: jquery.dialogelfinder.js
/**
[0] Fix | Delete
* @class dialogelfinder - open elFinder in dialog window
[1] Fix | Delete
*
[2] Fix | Delete
* @param Object elFinder options with dialog options
[3] Fix | Delete
* @example
[4] Fix | Delete
* $(selector).dialogelfinder({
[5] Fix | Delete
* // some elfinder options
[6] Fix | Delete
* title : 'My files', // dialog title, default = "Files"
[7] Fix | Delete
* width : 850, // dialog width, default 840
[8] Fix | Delete
* autoOpen : false, // if false - dialog will not be opened after init, default = true
[9] Fix | Delete
* destroyOnClose : true // destroy elFinder on close dialog, default = false
[10] Fix | Delete
* })
[11] Fix | Delete
* @author Dmitry (dio) Levashov
[12] Fix | Delete
**/
[13] Fix | Delete
$.fn.dialogelfinder = function(opts, opts2) {
[14] Fix | Delete
var position = 'elfinderPosition',
[15] Fix | Delete
destroy = 'elfinderDestroyOnClose',
[16] Fix | Delete
node, pos;
[17] Fix | Delete
[18] Fix | Delete
if ($.isPlainObject(opts)) {
[19] Fix | Delete
this.not('.elfinder').each(function() {
[20] Fix | Delete
[21] Fix | Delete
opts.handlers = opts.handlers || {};
[22] Fix | Delete
[23] Fix | Delete
var node = $(this),
[24] Fix | Delete
doc = $(document),
[25] Fix | Delete
toolbar = $('<div class="ui-widget-header dialogelfinder-drag ui-corner-top">'+(opts.title || 'Files')+'</div>'),
[26] Fix | Delete
button = $('<a href="#" class="dialogelfinder-drag-close ui-corner-all"><span class="ui-icon ui-icon-closethick"> </span></a>')
[27] Fix | Delete
.appendTo(toolbar)
[28] Fix | Delete
.on('click', function(e) {
[29] Fix | Delete
e.preventDefault();
[30] Fix | Delete
node.dialogelfinder('close');
[31] Fix | Delete
}),
[32] Fix | Delete
init = opts.handlers.init,
[33] Fix | Delete
elfinder;
[34] Fix | Delete
[35] Fix | Delete
opts.handlers.init = function(e, fm) {
[36] Fix | Delete
node.prepend(toolbar);
[37] Fix | Delete
init && init(e, fm);
[38] Fix | Delete
};
[39] Fix | Delete
[40] Fix | Delete
elfinder = node.addClass('elfinder dialogelfinder touch-punch')
[41] Fix | Delete
.css('position', 'absolute')
[42] Fix | Delete
.hide()
[43] Fix | Delete
.appendTo('body')
[44] Fix | Delete
.draggable({
[45] Fix | Delete
handle : '.dialogelfinder-drag',
[46] Fix | Delete
containment : 'window',
[47] Fix | Delete
stop : function() {
[48] Fix | Delete
node.trigger('resize');
[49] Fix | Delete
elfinder.trigger('resize');
[50] Fix | Delete
}
[51] Fix | Delete
})
[52] Fix | Delete
.elfinder(opts, opts2)
[53] Fix | Delete
.elfinder('instance');
[54] Fix | Delete
[55] Fix | Delete
elfinder.reloadCallback = function(o, o2) {
[56] Fix | Delete
elfinder.destroy();
[57] Fix | Delete
o.handlers.init = init;
[58] Fix | Delete
node.dialogelfinder(o, o2).dialogelfinder('open');
[59] Fix | Delete
};
[60] Fix | Delete
[61] Fix | Delete
node.width(parseInt(node.width()) || 840) // fix width if set to "auto"
[62] Fix | Delete
.data(destroy, !!opts.destroyOnClose)
[63] Fix | Delete
.find('.elfinder-toolbar').removeClass('ui-corner-top');
[64] Fix | Delete
[65] Fix | Delete
opts.position && node.data(position, opts.position);
[66] Fix | Delete
[67] Fix | Delete
opts.autoOpen !== false && $(this).dialogelfinder('open');
[68] Fix | Delete
[69] Fix | Delete
});
[70] Fix | Delete
} else {
[71] Fix | Delete
if (opts === 'open') {
[72] Fix | Delete
node = $(this);
[73] Fix | Delete
pos = node.data(position) || {
[74] Fix | Delete
top : parseInt($(document).scrollTop() + ($(window).height() < node.height() ? 2 : ($(window).height() - node.height())/2)),
[75] Fix | Delete
left : parseInt($(document).scrollLeft() + ($(window).width() < node.width() ? 2 : ($(window).width() - node.width())/2))
[76] Fix | Delete
};
[77] Fix | Delete
[78] Fix | Delete
if (node.is(':hidden')) {
[79] Fix | Delete
node.addClass('ui-front').css(pos).show().trigger('resize');
[80] Fix | Delete
[81] Fix | Delete
setTimeout(function() {
[82] Fix | Delete
// fix resize icon position and make elfinder active
[83] Fix | Delete
node.trigger('resize').trigger('mousedown');
[84] Fix | Delete
}, 200);
[85] Fix | Delete
}
[86] Fix | Delete
} else if (opts === 'close') {
[87] Fix | Delete
node = $(this).removeClass('ui-front');
[88] Fix | Delete
[89] Fix | Delete
if (node.is(':visible')) {
[90] Fix | Delete
!!node.data(destroy)
[91] Fix | Delete
? node.elfinder('destroy').remove()
[92] Fix | Delete
: node.elfinder('close');
[93] Fix | Delete
}
[94] Fix | Delete
} else if (opts === 'instance') {
[95] Fix | Delete
return $(this).getElFinder();
[96] Fix | Delete
}
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
return this;
[100] Fix | Delete
};
[101] Fix | Delete
[102] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function