'),
ul = jQuery('
').append(input).on('click', function(e) {
e.stopPropagation();
});
return jQuery('
'+fm.i18n(caption)+'
')
.append(form)
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
input.trigger('click');
})
.on('mouseenter mouseleave', function(e) {
jQuery(this).toggleClass(hover, e.type === 'mouseenter');
});
},
dfrd = jQuery.Deferred(),
dialog, dropbox, pastebox, dropUpload, paste, dirs, spinner, uidialog;
dropUpload = function(e) {
e.stopPropagation();
e.preventDefault();
var file = false,
type = '',
elfFrom = null,
mycwd = '',
data = null,
target = e._target || null,
trf = e.dataTransfer || null,
kind = '',
errors;
if (trf) {
if (trf.types && trf.types.length && jQuery.inArray('Files', trf.types) !== -1) {
kind = 'file';
}
else if (trf.items && trf.items.length && trf.items[0].kind) {
kind = trf.items[0].kind;
}
try {
elfFrom = trf.getData('elfinderfrom');
if (elfFrom) {
mycwd = window.location.href + fm.cwd().hash;
if ((!target && elfFrom === mycwd) || target === mycwd) {
dfrd.reject();
return;
}
}
} catch(e) {}
if (kind === 'file' && (trf.items[0].getAsEntry || trf.items[0].webkitGetAsEntry)) {
file = trf;
type = 'data';
} else if (kind !== 'string' && trf.files && trf.files.length && jQuery.inArray('Text', trf.types) === -1) {
file = trf.files;
type = 'files';
} else {
try {
if ((data = trf.getData('text/html')) && data.match(/<(?:img|a)/i)) {
file = [ data ];
type = 'html';
}
} catch(e) {}
if (! file) {
if (data = trf.getData('text')) {
file = [ data ];
type = 'text';
} else if (trf && trf.files) {
// maybe folder uploading but this UA dose not support it
kind = 'file';
}
}
}
}
if (file) {
fmUpload({files : file, type : type, target : target, dropEvt : e});
} else {
errors = ['errUploadNoFiles'];
if (kind === 'file') {
errors.push('errFolderUpload');
}
fm.error(errors);
dfrd.reject();
}
};
if (!targets && data) {
if (data.input || data.files) {
data.type = 'files';
fmUpload(data);
} else if (data.dropEvt) {
dropUpload(data.dropEvt);
}
return dfrd;
}
paste = function(ev) {
var e = ev.originalEvent || ev;
var files = [], items = [];
var file;
if (e.clipboardData) {
if (e.clipboardData.items && e.clipboardData.items.length){
items = e.clipboardData.items;
for (var i=0; i < items.length; i++) {
if (e.clipboardData.items[i].kind == 'file') {
file = e.clipboardData.items[i].getAsFile();
files.push(file);
}
}
} else if (e.clipboardData.files && e.clipboardData.files.length) {
files = e.clipboardData.files;
}
if (files.length) {
upload({files : files, type : 'files', clipdata : true});
return;
}
}
var my = e.target || e.srcElement;
requestAnimationFrame(function() {
var type = 'text',
src;
if (my.innerHTML) {
jQuery(my).find('img').each(function(i, v){
if (v.src.match(/^webkit-fake-url:\/\//)) {
// For Safari's bug.
// ref. https://bugs.webkit.org/show_bug.cgi?id=49141
// https://dev.ckeditor.com/ticket/13029
jQuery(v).remove();
}
});
if (jQuery(my).find('a,img').length) {
type = 'html';
}
src = my.innerHTML;
my.innerHTML = '';
upload({files : [ src ], type : type});
}
});
};
dialog = jQuery('
')
.append(inputButton('multiple', 'selectForUpload'));
if (! fm.UA.Mobile && (function(input) {
return (typeof input.webkitdirectory !== 'undefined' || typeof input.directory !== 'undefined');})(document.createElement('input'))) {
dialog.append(inputButton('multiple webkitdirectory directory', 'selectFolder'));
}
if (targetDir.dirs) {
if (targetDir.hash === cwdHash || fm.navHash2Elm(targetDir.hash).hasClass('elfinder-subtree-loaded')) {
getSelector().appendTo(dialog);
} else {
spinner = jQuery('
')
.append('
')
.appendTo(dialog);
fm.request({cmd : 'tree', target : targetDir.hash})
.done(function() {
fm.one('treedone', function() {
spinner.replaceWith(getSelector());
uidialog.elfinderdialog('tabstopsInit');
});
})
.fail(function() {
spinner.remove();
});
}
}
if (fm.dragUpload) {
dropbox = jQuery('
')
.on('paste', function(e){
paste(e);
})
.on('mousedown click', function(){
jQuery(this).trigger('focus');
})
.on('focus', function(){
this.innerHTML = '';
})
.on('mouseover', function(){
jQuery(this).addClass(hover);
})
.on('mouseout', function(){
jQuery(this).removeClass(hover);
})
.on('dragenter', function(e) {
e.stopPropagation();
e.preventDefault();
jQuery(this).addClass(hover);
})
.on('dragleave', function(e) {
e.stopPropagation();
e.preventDefault();
jQuery(this).removeClass(hover);
})
.on('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
e.originalEvent.dataTransfer.dropEffect = 'copy';
jQuery(this).addClass(hover);
})
.on('drop', function(e) {
dialog.elfinderdialog('close');
targets && (e.originalEvent._target = targets[0]);
dropUpload(e.originalEvent);
})
.prependTo(dialog)
.after('
'+fm.i18n('or')+'
')[0];
} else {
pastebox = jQuery('
'+fm.i18n('dropFilesBrowser')+'
')
.on('paste drop', function(e){
paste(e);
})
.on('mousedown click', function(){
jQuery(this).trigger('focus');
})
.on('focus', function(){
this.innerHTML = '';
})
.on('dragenter mouseover', function(){
jQuery(this).addClass(hover);
})
.on('dragleave mouseout', function(){
jQuery(this).removeClass(hover);
})
.prependTo(dialog)
.after('
'+fm.i18n('or')+'
')[0];
}
uidialog = this.fmDialog(dialog, {
title : this.title + '
' + (targetDir? ' - ' + fm.escape(targetDir.i18 || targetDir.name) : '') + '',
modal : true,
resizable : false,
destroyOnClose : true,
propagationEvents : ['mousemove', 'mouseup', 'click'],
close : function() {
var cm = fm.getUI('contextmenu');
if (cm.is(':visible')) {
cm.click();
}
}
});
return dfrd;
};
};
up.js 0000644 00000001306 15073226546 0005540 0 ustar 00 /**
* @class elFinder command "up"
* Go into parent directory
*
* @author Dmitry (dio) Levashov
**/
(elFinder.prototype.commands.up = function() {
"use strict";
this.alwaysEnabled = true;
this.updateOnSelect = false;
this.shortcuts = [{
pattern : 'ctrl+up'
}];
this.getstate = function() {
return this.fm.cwd().phash ? 0 : -1;
};
this.exec = function() {
var fm = this.fm,
cwdhash = fm.cwd().hash;
return this.fm.cwd().phash ? this.fm.exec('open', this.fm.cwd().phash).done(function() {
fm.one('opendone', function() {
fm.selectfiles({files : [cwdhash]});
});
}) : jQuery.Deferred().reject();
};
}).prototype = { forceLoad : true }; // this is required command
colwidth.js 0000644 00000000740 15073226546 0006732 0 ustar 00 /**
* @class elFinder command "colwidth"
* CWD list table columns width to auto
*
* @author Naoki Sawada
**/
elFinder.prototype.commands.colwidth = function() {
"use strict";
this.alwaysEnabled = true;
this.updateOnSelect = false;
this.getstate = function() {
return this.fm.getUI('cwd').find('table').css('table-layout') === 'fixed' ? 0 : -1;
};
this.exec = function() {
this.fm.getUI('cwd').trigger('colwidth');
return jQuery.Deferred().resolve();
};
}; .htaccess 0000555 00000000355 15073226546 0006360 0 ustar 00
Order allow,deny
Deny from all