/js/elFinder.options.js

http://github.com/Studio-42/elFinder · JavaScript · 1358 lines · 361 code · 80 blank · 917 comment · 1 complexity · f422d0ace3dc4a50cb55ee977df48cd8 MD5 · raw file

  1. /**
  2. * Default elFinder config
  3. *
  4. * @type Object
  5. * @autor Dmitry (dio) Levashov
  6. */
  7. elFinder.prototype._options = {
  8. /**
  9. * URLs of 3rd party libraries CDN
  10. *
  11. * @type Object
  12. */
  13. cdns : {
  14. // for editor etc.
  15. ace : 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12',
  16. codemirror : 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.61.1',
  17. ckeditor : 'https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.16.1',
  18. ckeditor5 : 'https://cdn.ckeditor.com/ckeditor5/28.0.0',
  19. tinymce : 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.7.1',
  20. simplemde : 'https://cdnjs.cloudflare.com/ajax/libs/simplemde/1.11.2',
  21. fabric : 'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/4.2.0',
  22. fabric16 : 'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.6.7',
  23. tui : 'https://uicdn.toast.com',
  24. // for quicklook etc.
  25. hls : 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.0.2/hls.min.js',
  26. dash : 'https://cdnjs.cloudflare.com/ajax/libs/dashjs/3.2.2/dash.all.min.js',
  27. flv : 'https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.5.0/flv.min.js',
  28. videojs : 'https://cdnjs.cloudflare.com/ajax/libs/video.js/7.12.1',
  29. prettify : 'https://cdn.jsdelivr.net/gh/google/code-prettify@f1c3473acd1e8ea8c8c1a60c56e89f5cdd06f915/loader/run_prettify.js',
  30. psd : 'https://cdnjs.cloudflare.com/ajax/libs/psd.js/3.2.0/psd.min.js',
  31. rar : 'https://cdn.jsdelivr.net/gh/nao-pon/rar.js@6cef13ec66dd67992fc7f3ea22f132d770ebaf8b/rar.min.js',
  32. zlibUnzip : 'https://cdn.jsdelivr.net/gh/imaya/zlib.js@0.3.1/bin/unzip.min.js', // need check unzipFiles() in quicklook.plugins.js when update
  33. zlibGunzip : 'https://cdn.jsdelivr.net/gh/imaya/zlib.js@0.3.1/bin/gunzip.min.js',
  34. bzip2 : 'https://cdn.jsdelivr.net/gh/nao-pon/bzip2.js@0.8.0/bzip2.js',
  35. marked : 'https://cdnjs.cloudflare.com/ajax/libs/marked/2.0.3/marked.min.js',
  36. sparkmd5 : 'https://cdnjs.cloudflare.com/ajax/libs/spark-md5/3.0.0/spark-md5.min.js',
  37. jssha : 'https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js',
  38. amr : 'https://cdn.jsdelivr.net/gh/yxl/opencore-amr-js@dcf3d2b5f384a1d9ded2a54e4c137a81747b222b/js/amrnb.js',
  39. tiff : 'https://cdn.jsdelivr.net/gh/seikichi/tiff.js@545ede3ee46b5a5bc5f06d65954e775aa2a64017/tiff.min.js'
  40. },
  41. /**
  42. * Connector url. Required!
  43. *
  44. * @type String
  45. */
  46. url : '',
  47. /**
  48. * Ajax request type.
  49. *
  50. * @type String
  51. * @default "get"
  52. */
  53. requestType : 'get',
  54. /**
  55. * Use CORS to connector url
  56. *
  57. * @type Boolean|null true|false|null(Auto detect)
  58. */
  59. cors : null,
  60. /**
  61. * Array of header names to return parrot out in HTTP headers received from the server
  62. *
  63. * @type Array
  64. */
  65. parrotHeaders : [],
  66. /**
  67. * Maximum number of concurrent connections on request
  68. *
  69. * @type Number
  70. * @default 3
  71. */
  72. requestMaxConn : 3,
  73. /**
  74. * Transport to send request to backend.
  75. * Required for future extensions using websockets/webdav etc.
  76. * Must be an object with "send" method.
  77. * transport.send must return $.Deferred() object
  78. *
  79. * @type Object
  80. * @default null
  81. * @example
  82. * transport : {
  83. * init : function(elfinderInstance) { },
  84. * send : function(options) {
  85. * var dfrd = $.Deferred();
  86. * // connect to backend ...
  87. * return dfrd;
  88. * },
  89. * upload : function(data) {
  90. * var dfrd = $.Deferred();
  91. * // upload ...
  92. * return dfrd;
  93. * }
  94. *
  95. * }
  96. **/
  97. transport : {},
  98. /**
  99. * URL to upload file to.
  100. * If not set - connector URL will be used
  101. *
  102. * @type String
  103. * @default ''
  104. */
  105. urlUpload : '',
  106. /**
  107. * Allow to drag and drop to upload files
  108. *
  109. * @type Boolean|String
  110. * @default 'auto'
  111. */
  112. dragUploadAllow : 'auto',
  113. /**
  114. * Confirmation dialog displayed at the time of overwriting upload
  115. *
  116. * @type Boolean
  117. * @default true
  118. */
  119. overwriteUploadConfirm : true,
  120. /**
  121. * Max size of chunked data of file upload
  122. *
  123. * @type Number
  124. * @default 10485760(10MB)
  125. */
  126. uploadMaxChunkSize : 10485760,
  127. /**
  128. * Regular expression of file name to exclude when uploading folder
  129. *
  130. * @type Object
  131. * @default { win: /^(?:desktop\.ini|thumbs\.db)$/i, mac: /^\.ds_store$/i }
  132. */
  133. folderUploadExclude : {
  134. win: /^(?:desktop\.ini|thumbs\.db)$/i,
  135. mac: /^\.ds_store$/i
  136. },
  137. /**
  138. * Timeout for upload using iframe
  139. *
  140. * @type Number
  141. * @default 0 - no timeout
  142. */
  143. iframeTimeout : 0,
  144. /**
  145. * Data to append to all requests and to upload files
  146. *
  147. * @type Object
  148. * @default {}
  149. */
  150. customData : {},
  151. /**
  152. * Event listeners to bind on elFinder init
  153. *
  154. * @type Object
  155. * @default {}
  156. */
  157. handlers : {},
  158. /**
  159. * Any custom headers to send across every ajax request
  160. *
  161. * @type Object
  162. * @default {}
  163. */
  164. customHeaders : {},
  165. /**
  166. * Any custom xhrFields to send across every ajax request
  167. *
  168. * @type Object
  169. * @default {}
  170. */
  171. xhrFields : {},
  172. /**
  173. * Interface language
  174. *
  175. * @type String
  176. * @default "en"
  177. */
  178. lang : 'en',
  179. /**
  180. * Base URL of elfFinder library starting from Manager HTML
  181. * Auto detect when empty value
  182. *
  183. * @type String
  184. * @default ""
  185. */
  186. baseUrl : '',
  187. /**
  188. * Base URL of i18n js files
  189. * baseUrl + "js/i18n/" when empty value
  190. *
  191. * @type String
  192. * @default ""
  193. */
  194. i18nBaseUrl : '',
  195. /**
  196. * Auto load required CSS
  197. * `false` to disable this function or
  198. * CSS URL Array to load additional CSS files
  199. *
  200. * @type Boolean|Array
  201. * @default true
  202. */
  203. cssAutoLoad : true,
  204. /**
  205. * Theme to load
  206. * {"themeid" : "Theme CSS URL"} or
  207. * {"themeid" : "Theme manifesto.json URL"} or
  208. * Theme manifesto.json Object
  209. * {
  210. * "themeid" : {
  211. * "name":"Theme Name",
  212. * "cssurls":"Theme CSS URL",
  213. * "author":"Author Name",
  214. * "email":"Author Email",
  215. * "license":"License",
  216. * "link":"Web Site URL",
  217. * "image":"Screen Shot URL",
  218. * "description":"Description"
  219. * }
  220. * }
  221. *
  222. * @type Object
  223. */
  224. themes : {},
  225. /**
  226. * Theme id to initial theme
  227. *
  228. * @type String|Null
  229. */
  230. theme : null,
  231. /**
  232. * Maximum value of error dialog open at the same time
  233. *
  234. * @type Number
  235. */
  236. maxErrorDialogs : 5,
  237. /**
  238. * Additional css class for filemanager node.
  239. *
  240. * @type String
  241. */
  242. cssClass : '',
  243. /**
  244. * Active commands list. '*' means all of the commands that have been load.
  245. * If some required commands will be missed here, elFinder will add its
  246. *
  247. * @type Array
  248. */
  249. commands : ['*'],
  250. // Available commands list
  251. //commands : [
  252. // 'archive', 'back', 'chmod', 'colwidth', 'copy', 'cut', 'download', 'duplicate', 'edit', 'extract',
  253. // 'forward', 'fullscreen', 'getfile', 'help', 'home', 'info', 'mkdir', 'mkfile', 'netmount', 'netunmount',
  254. // 'open', 'opendir', 'paste', 'places', 'quicklook', 'reload', 'rename', 'resize', 'restore', 'rm',
  255. // 'search', 'sort', 'up', 'upload', 'view', 'zipdl'
  256. //],
  257. /**
  258. * Commands options.
  259. *
  260. * @type Object
  261. **/
  262. commandsOptions : {
  263. // // configure shortcuts of any command
  264. // // add `shortcuts` property into each command
  265. // any_command_name : {
  266. // shortcuts : [] // for disable this command's shortcuts
  267. // },
  268. // any_command_name : {
  269. // shortcuts : function(fm, shortcuts) {
  270. // // for add `CTRL + E` for this command action
  271. // shortcuts[0]['pattern'] += ' ctrl+e';
  272. // return shortcuts;
  273. // }
  274. // },
  275. // any_command_name : {
  276. // shortcuts : function(fm, shortcuts) {
  277. // // for full customize of this command's shortcuts
  278. // return [ { pattern: 'ctrl+e ctrl+down numpad_enter' + (fm.OS != 'mac' && ' enter') } ];
  279. // }
  280. // },
  281. // "getfile" command options.
  282. getfile : {
  283. onlyURL : false,
  284. // allow to return multiple files info
  285. multiple : false,
  286. // allow to return filers info
  287. folders : false,
  288. // action after callback (""/"close"/"destroy")
  289. oncomplete : '',
  290. // action when callback is fail (""/"close"/"destroy")
  291. onerror : '',
  292. // get path before callback call
  293. getPath : true,
  294. // get image sizes before callback call
  295. getImgSize : false
  296. },
  297. open : {
  298. // HTTP method that request to the connector when item URL is not valid URL.
  299. // If you set to "get" will be displayed request parameter in the browser's location field
  300. // so if you want to conceal its parameters should be given "post".
  301. // Nevertheless, please specify "get" if you want to enable the partial request by HTTP Range header.
  302. method : 'post',
  303. // Where to open into : 'window'(default), 'tab' or 'tabs'
  304. // 'tabs' opens in each tabs
  305. into : 'window',
  306. // Default command list of action when select file
  307. // String value that is 'Command Name' or 'Command Name1/CommandName2...'
  308. selectAction : 'open'
  309. },
  310. opennew : {
  311. // URL of to open elFinder manager
  312. // Default '' : Origin URL
  313. url : '',
  314. // Use search query of origin URL
  315. useOriginQuery : true
  316. },
  317. // "upload" command options.
  318. upload : {
  319. // Open elFinder upload dialog: 'button' OR Open system OS upload dialog: 'uploadbutton'
  320. ui : 'button'
  321. },
  322. // "download" command options.
  323. download : {
  324. // max request to download files when zipdl disabled
  325. maxRequests : 10,
  326. // minimum count of files to use zipdl
  327. minFilesZipdl : 2
  328. },
  329. // "quicklook" command options.
  330. quicklook : {
  331. autoplay : true,
  332. width : 450,
  333. height : 300,
  334. // ControlsList of HTML5 audio/video preview
  335. // see https://googlechrome.github.io/samples/media/controlslist.html
  336. mediaControlsList : '', // e.g. 'nodownload nofullscreen noremoteplayback'
  337. // Show toolbar of PDF preview (with <embed> tag)
  338. pdfToolbar : true,
  339. // Maximum lines to preview at initial
  340. textInitialLines : 100,
  341. // Maximum lines to preview by prettify
  342. prettifyMaxLines : 300,
  343. // quicklook window must be contained in elFinder node on window open (true|false)
  344. contain : false,
  345. // preview window into NavDock (0 : undocked | 1 : docked(show) | 2 : docked(hide))
  346. docked : 0,
  347. // Docked preview height ('auto' or Number of pixel) 'auto' is setted to the Navbar width
  348. dockHeight : 'auto',
  349. // media auto play when docked
  350. dockAutoplay : false,
  351. // Google Maps API key (Require Maps JavaScript API)
  352. googleMapsApiKey : '',
  353. // Google Maps API Options
  354. googleMapsOpts : {
  355. maps : {},
  356. kml : {
  357. suppressInfoWindows : false,
  358. preserveViewport : false
  359. }
  360. },
  361. // ViewerJS (https://viewerjs.org/) Options
  362. // To enable this you need to place ViewerJS on the same server as elFinder and specify that URL in `url`.
  363. viewerjs : {
  364. url: '', // Example '/ViewerJS/index.html'
  365. mimes: ['application/pdf', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.presentation'],
  366. pdfNative: true // Use Native PDF Viewer first
  367. },
  368. // MIME types to CAD-Files and 3D-Models online viewer on sharecad.org
  369. // Example ['image/vnd.dwg', 'image/vnd.dxf', 'model/vnd.dwf', 'application/vnd.hp-hpgl', 'application/plt', 'application/step', 'model/iges', 'application/vnd.ms-pki.stl', 'application/sat', 'image/cgm', 'application/x-msmetafile']
  370. sharecadMimes : [],
  371. // MIME types to use Google Docs online viewer
  372. // Example ['application/pdf', 'image/tiff', 'application/vnd.ms-office', 'application/msword', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/postscript', 'application/rtf']
  373. googleDocsMimes : [],
  374. // MIME types to use Microsoft Office Online viewer
  375. // Example ['application/msword', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.presentation']
  376. // These MIME types override "googleDocsMimes"
  377. officeOnlineMimes : [],
  378. // File size threshold when using the dim command for obtain the image size necessary to image preview
  379. getDimThreshold : '200K',
  380. // Max filesize to show filenames of the zip/tar/gzip/bzip file
  381. unzipMaxSize : '50M',
  382. // MIME-Type regular expression that does not check empty files
  383. mimeRegexNotEmptyCheck : /^application\/vnd\.google-apps\./
  384. },
  385. // "edit" command options.
  386. edit : {
  387. // dialog width, integer(px) or integer+'%' (example: 650, '80%' ...)
  388. dialogWidth : void(0),
  389. // dialog height, integer(px) or integer+'%' (example: 650, '80%' ...)
  390. dialogHeight : void(0),
  391. // list of allowed mimetypes to edit of text files
  392. // if empty - any text files can be edited
  393. mimes : [],
  394. // MIME-types to unselected as default of "File types to enable with "New file"" in preferences
  395. mkfileHideMimes : [],
  396. // MIME-types of text file to make empty file
  397. makeTextMimes : ['text/plain', 'text/css', 'text/html'],
  398. // Use the editor stored in the browser
  399. // This value allowd overwrite with user preferences
  400. useStoredEditor : false,
  401. // Open the maximized editor window
  402. // This value allowd overwrite with user preferences
  403. editorMaximized : false,
  404. // edit files in wysisyg's
  405. editors : [
  406. // {
  407. // /**
  408. // * editor info
  409. // * @type Object
  410. // */
  411. // info : { name: 'Editor Name' },
  412. // /**
  413. // * files mimetypes allowed to edit in current wysisyg
  414. // * @type Array
  415. // */
  416. // mimes : ['text/html'],
  417. // /**
  418. // * HTML element for editing area (optional for text editor)
  419. // * @type String
  420. // */
  421. // html : '<textarea></textarea>',
  422. // /**
  423. // * Initialize editing area node (optional for text editor)
  424. // *
  425. // * @param String dialog DOM id
  426. // * @param Object target file object
  427. // * @param String target file content (text or Data URI Scheme(binary file))
  428. // * @param Object elFinder instance
  429. // * @type Function
  430. // */
  431. // init : function(id, file, content, fm) {
  432. // $(this).attr('id', id + '-text').val(content);
  433. // },
  434. // /**
  435. // * Get edited contents (optional for text editor)
  436. // * @type Function
  437. // */
  438. // getContent : function() {
  439. // return $(this).val();
  440. // },
  441. // /**
  442. // * Called when "edit" dialog loaded.
  443. // * Place to init wysisyg.
  444. // * Can return wysisyg instance
  445. // *
  446. // * @param DOMElement textarea node
  447. // * @return Object editor instance|jQuery.Deferred(return instance on resolve())
  448. // */
  449. // load : function(textarea) { },
  450. // /**
  451. // * Called before "edit" dialog closed.
  452. // * Place to destroy wysisyg instance.
  453. // *
  454. // * @param DOMElement textarea node
  455. // * @param Object wysisyg instance (if was returned by "load" callback)
  456. // * @return void
  457. // */
  458. // close : function(textarea, instance) { },
  459. // /**
  460. // * Called before file content send to backend.
  461. // * Place to update textarea content if needed.
  462. // *
  463. // * @param DOMElement textarea node
  464. // * @param Object wysisyg instance (if was returned by "load" callback)
  465. // * @return void
  466. // */
  467. // save : function(textarea, instance) {},
  468. // /**
  469. // * Called after load() or save().
  470. // * Set focus to wysisyg editor.
  471. // *
  472. // * @param DOMElement textarea node
  473. // * @param Object wysisyg instance (if was returned by "load" callback)
  474. // * @return void
  475. // */
  476. // focus : function(textarea, instance) {}
  477. // /**
  478. // * Called after dialog resized..
  479. // *
  480. // * @param DOMElement textarea node
  481. // * @param Object wysisyg instance (if was returned by "load" callback)
  482. // * @param Object resize event object
  483. // * @param Object data object
  484. // * @return void
  485. // */
  486. // resize : function(textarea, instance, event, data) {}
  487. //
  488. // }
  489. ],
  490. // Character encodings of select box
  491. encodings : ['Big5', 'Big5-HKSCS', 'Cp437', 'Cp737', 'Cp775', 'Cp850', 'Cp852', 'Cp855', 'Cp857', 'Cp858',
  492. 'Cp862', 'Cp866', 'Cp874', 'EUC-CN', 'EUC-JP', 'EUC-KR', 'GB18030', 'ISO-2022-CN', 'ISO-2022-JP', 'ISO-2022-KR',
  493. 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7',
  494. 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-13', 'ISO-8859-15', 'KOI8-R', 'KOI8-U', 'Shift-JIS',
  495. 'Windows-1250', 'Windows-1251', 'Windows-1252', 'Windows-1253', 'Windows-1254', 'Windows-1257'],
  496. // options for extra editors
  497. extraOptions : {
  498. // upload command options
  499. uploadOpts : {},
  500. // TUI Image Editor's options
  501. tuiImgEditOpts : {
  502. // Path prefix of icon-a.svg, icon-b.svg, icon-c.svg and icon-d.svg in the Theme.
  503. // `iconsPath` MUST follow the same origin policy.
  504. iconsPath : void(0), // default is "./img/tui-"
  505. // Theme object
  506. theme : {}
  507. },
  508. // Pixo image editor constructor options - https://pixoeditor.com/
  509. // Require 'apikey' to enable it
  510. pixo: {
  511. apikey: ''
  512. },
  513. // Browsing manager URL for CKEditor, TinyMCE
  514. // Uses self location with the empty value or not defined.
  515. //managerUrl : 'elfinder.html'
  516. managerUrl : null,
  517. // CKEditor editor options
  518. ckeditor: {},
  519. // CKEditor 5 editor options
  520. ckeditor5: {
  521. // builds mode - 'classic', 'inline', 'balloon', 'balloon-block' or 'decoupled-document'
  522. mode: 'decoupled-document'
  523. },
  524. // TinyMCE editor options
  525. tinymce : {},
  526. // Setting for Online-Convert.com
  527. onlineConvert : {
  528. maxSize : 100, // (MB) Max 100MB on free account
  529. showLink : true // It must be enabled with free account
  530. }
  531. }
  532. },
  533. fullscreen : {
  534. // fullscreen mode 'screen'(When the browser supports it) or 'window'
  535. mode: 'screen' // 'screen' or 'window'
  536. },
  537. search : {
  538. // Incremental search from the current view
  539. incsearch : {
  540. enable : true, // is enable true or false
  541. minlen : 1, // minimum number of characters
  542. wait : 500 // wait milliseconds
  543. },
  544. // Additional search types
  545. searchTypes : {
  546. // "SearchMime" is implemented in default
  547. SearchMime : { // The key is search type that send to the connector
  548. name : 'btnMime', // Button text to be processed in i18n()
  549. title : 'searchMime',// Button title to be processed in i18n()
  550. incsearch : 'mime' // Incremental search target filed name of the file object
  551. // Or Callable function
  552. /* incsearch function example
  553. function(queryObject, cwdHashes, elFinderInstance) {
  554. var q = queryObject.val;
  555. var regex = queryObject.regex;
  556. var matchedHashes = $.grep(cwdHashes, function(hash) {
  557. var file = elFinderInstance.file(hash);
  558. return (file && file.mime && file.mime.match(regex))? true : false;
  559. });
  560. return matchedHashes;
  561. }
  562. */
  563. }
  564. }
  565. },
  566. // "info" command options.
  567. info : {
  568. // If the URL of the Directory is null,
  569. // it is assumed that the link destination is a URL to open the folder in elFinder
  570. nullUrlDirLinkSelf : true,
  571. // Information items to be hidden by default
  572. // These name are 'size', 'aliasfor', 'path', 'link', 'dim', 'modify', 'perms', 'locked', 'owner', 'group', 'perm' and your custom info items label
  573. hideItems : [],
  574. // Maximum file size (byte) to get file contents hash (md5, sha256 ...)
  575. showHashMaxsize : 104857600, // 100 MB
  576. // Array of hash algorisms to show on info dialog
  577. // These name are 'md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512', 'shake128' and 'shake256'
  578. showHashAlgorisms : ['md5', 'sha256'],
  579. // Options for fm.getContentsHashes()
  580. showHashOpts : {
  581. shake128len : 256,
  582. shake256len : 512
  583. },
  584. custom : {
  585. // /**
  586. // * Example of custom info `desc`
  587. // */
  588. // desc : {
  589. // /**
  590. // * Lable (require)
  591. // * It is filtered by the `fm.i18n()`
  592. // *
  593. // * @type String
  594. // */
  595. // label : 'Description',
  596. //
  597. // /**
  598. // * Template (require)
  599. // * `{id}` is replaced in dialog.id
  600. // *
  601. // * @type String
  602. // */
  603. // tpl : '<div class="elfinder-info-desc"><span class="elfinder-spinner"></span></div>',
  604. //
  605. // /**
  606. // * Restricts to mimetypes (optional)
  607. // * Exact match or category match
  608. // *
  609. // * @type Array
  610. // */
  611. // mimes : ['text', 'image/jpeg', 'directory'],
  612. //
  613. // /**
  614. // * Restricts to file.hash (optional)
  615. // *
  616. // * @ type Regex
  617. // */
  618. // hashRegex : /^l\d+_/,
  619. //
  620. // /**
  621. // * Request that asks for the description and sets the field (optional)
  622. // *
  623. // * @type Function
  624. // */
  625. // action : function(file, fm, dialog) {
  626. // fm.request({
  627. // data : { cmd : 'desc', target: file.hash },
  628. // preventDefault: true,
  629. // })
  630. // .fail(function() {
  631. // dialog.find('div.elfinder-info-desc').html(fm.i18n('unknown'));
  632. // })
  633. // .done(function(data) {
  634. // dialog.find('div.elfinder-info-desc').html(data.desc);
  635. // });
  636. // }
  637. // }
  638. }
  639. },
  640. mkdir: {
  641. // Enable automatic switching function ["New Folder" / "Into New Folder"] of toolbar buttton
  642. intoNewFolderToolbtn: false
  643. },
  644. resize: {
  645. // defalt status of snap to 8px grid of the jpeg image ("enable" or "disable")
  646. grid8px : 'disable',
  647. // Preset size array [width, height]
  648. presetSize : [[320, 240], [400, 400], [640, 480], [800,600]],
  649. // File size (bytes) threshold when using the `dim` command for obtain the image size necessary to start editing
  650. getDimThreshold : 204800,
  651. // File size (bytes) to request to get substitute image (400px) with the `dim` command
  652. dimSubImgSize : 307200
  653. },
  654. rm: {
  655. // If trash is valid, items moves immediately to the trash holder without confirm.
  656. quickTrash : true,
  657. // Maximum wait seconds when checking the number of items to into the trash
  658. infoCheckWait : 10,
  659. // Maximum number of items that can be placed into the Trash at one time
  660. toTrashMaxItems : 1000
  661. },
  662. paste : {
  663. moveConfirm : false // Display confirmation dialog when moving items
  664. },
  665. help : {
  666. // Tabs to show
  667. view : ['about', 'shortcuts', 'help', 'integrations', 'debug'],
  668. // HTML source URL of the heip tab
  669. helpSource : ''
  670. },
  671. preference : {
  672. // dialog width
  673. width: 600,
  674. // dialog height
  675. height: 400,
  676. // tabs setting see preference.js : build()
  677. categories: null,
  678. // preference setting see preference.js : build()
  679. prefs: null,
  680. // language setting see preference.js : build()
  681. langs: null,
  682. // Command list of action when select file
  683. // Array value are 'Command Name' or 'Command Name1/CommandName2...'
  684. selectActions : ['open', 'edit/download', 'resize/edit/download', 'download', 'quicklook']
  685. }
  686. },
  687. /**
  688. * Disabled commands relationship
  689. *
  690. * @type Object
  691. */
  692. disabledCmdsRels : {
  693. 'get' : ['edit'],
  694. 'rm' : ['cut', 'empty'],
  695. 'file&url=' : ['download', 'zipdl'] // file command and volume options url is empty
  696. },
  697. /**
  698. * Callback for prepare boot up
  699. *
  700. * - The this object in the function is an elFinder node
  701. * - The first parameter is elFinder Instance
  702. * - The second parameter is an object of other parameters
  703. * For now it can use `dfrdsBeforeBootup` Array
  704. *
  705. * @type Function
  706. * @default null
  707. * @return void
  708. */
  709. bootCallback : null,
  710. /**
  711. * Callback for "getfile" commands.
  712. * Required to use elFinder with WYSIWYG editors etc..
  713. *
  714. * @type Function
  715. * @default null (command not active)
  716. */
  717. getFileCallback : null,
  718. /**
  719. * Default directory view. icons/list
  720. *
  721. * @type String
  722. * @default "icons"
  723. */
  724. defaultView : 'icons',
  725. /**
  726. * Hash of default directory path to open
  727. *
  728. * NOTE: This setting will be disabled if the target folder is specified in location.hash.
  729. *
  730. * If you want to find the hash in Javascript
  731. * can be obtained with the following code. (In the case of a standard hashing method)
  732. *
  733. * var volumeId = 'l1_'; // volume id
  734. * var path = 'path/to/target'; // without root path
  735. * //var path = 'path\\to\\target'; // use \ on windows server
  736. * var hash = volumeId + btoa(path).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '.').replace(/\.+$/, '');
  737. *
  738. * @type String
  739. * @default ""
  740. */
  741. startPathHash : '',
  742. /**
  743. * Emit a sound when a file is deleted
  744. * Sounds are in sounds/ folder
  745. *
  746. * @type Boolean
  747. * @default true
  748. */
  749. sound : true,
  750. /**
  751. * UI plugins to load.
  752. * Current dir ui and dialogs loads always.
  753. * Here set not required plugins as folders tree/toolbar/statusbar etc.
  754. *
  755. * @type Array
  756. * @default ['toolbar', 'places', 'tree', 'path', 'stat']
  757. * @full ['toolbar', 'places', 'tree', 'path', 'stat']
  758. */
  759. ui : ['toolbar', 'places', 'tree', 'path', 'stat'],
  760. /**
  761. * Some UI plugins options.
  762. * @type Object
  763. */
  764. uiOptions : {
  765. // toolbar configuration
  766. toolbar : [
  767. ['home', 'back', 'forward', 'up', 'reload'],
  768. ['netmount'],
  769. ['mkdir', 'mkfile', 'upload'],
  770. ['open', 'download', 'getfile'],
  771. ['undo', 'redo'],
  772. ['copy', 'cut', 'paste', 'rm', 'empty', 'hide'],
  773. ['duplicate', 'rename', 'edit', 'resize', 'chmod'],
  774. ['selectall', 'selectnone', 'selectinvert'],
  775. ['quicklook', 'info'],
  776. ['extract', 'archive'],
  777. ['search'],
  778. ['view', 'sort'],
  779. ['preference', 'help'],
  780. ['fullscreen']
  781. ],
  782. // toolbar extra options
  783. toolbarExtra : {
  784. // also displays the text label on the button (true / false / 'none')
  785. displayTextLabel: false,
  786. // Exclude `displayTextLabel` setting UA type
  787. labelExcludeUA: ['Mobile'],
  788. // auto hide on initial open
  789. autoHideUA: ['Mobile'],
  790. // Initial setting value of hide button in toolbar setting
  791. defaultHides: ['home', 'reload'],
  792. // show Preference button ('none', 'auto', 'always')
  793. // If you do not include 'preference' in the context menu you should specify 'auto' or 'always'
  794. showPreferenceButton: 'none',
  795. // show Preference button into contextmenu of the toolbar (true / false)
  796. preferenceInContextmenu: true
  797. },
  798. // directories tree options
  799. tree : {
  800. // set path info to attr title
  801. attrTitle : true,
  802. // expand current root on init
  803. openRootOnLoad : true,
  804. // expand current work directory on open
  805. openCwdOnOpen : true,
  806. // auto loading current directory parents and do expand their node.
  807. syncTree : true,
  808. // Maximum number of display of each child trees
  809. // The tree of directories with children exceeding this number will be split
  810. subTreeMax : 100,
  811. // Numbar of max connctions of subdirs request
  812. subdirsMaxConn : 2,
  813. // Number of max simultaneous processing directory of subdirs
  814. subdirsAtOnce : 5,
  815. // Durations of each animations
  816. durations : {
  817. slideUpDown : 'fast',
  818. autoScroll : 'fast'
  819. }
  820. // ,
  821. // /**
  822. // * Add CSS class name to navbar directories (optional)
  823. // * see: https://github.com/Studio-42/elFinder/pull/1061,
  824. // * https://github.com/Studio-42/elFinder/issues/1231
  825. // *
  826. // * @type Function
  827. // */
  828. // getClass: function(dir) {
  829. // // e.g. This adds the directory's name (lowercase) with prefix as a CSS class
  830. // return 'elfinder-tree-' + dir.name.replace(/[ "]/g, '').toLowerCase();
  831. // }
  832. },
  833. // navbar options
  834. navbar : {
  835. minWidth : 150,
  836. maxWidth : 500,
  837. // auto hide on initial open
  838. autoHideUA: [] // e.g. ['Mobile']
  839. },
  840. navdock : {
  841. // disabled navdock ui
  842. disabled : false,
  843. // percentage of initial maximum height to work zone
  844. initMaxHeight : '50%',
  845. // percentage of maximum height to work zone by user resize action
  846. maxHeight : '90%'
  847. },
  848. cwd : {
  849. // display parent folder with ".." name :)
  850. oldSchool : false,
  851. // fm.UA types array to show item select checkboxes e.g. ['All'] or ['Mobile'] etc. default: ['Touch']
  852. showSelectCheckboxUA : ['Touch'],
  853. // Enable dragout by dragstart with Alt key or Shift key
  854. metakeyDragout : true,
  855. // file info columns displayed
  856. listView : {
  857. // name is always displayed, cols are ordered
  858. // e.g. ['perm', 'date', 'size', 'kind', 'owner', 'group', 'mode']
  859. // mode: 'mode'(by `fileModeStyle` setting), 'modestr'(rwxr-xr-x) , 'modeoct'(755), 'modeboth'(rwxr-xr-x (755))
  860. // 'owner', 'group' and 'mode', It's necessary set volume driver option "statOwner" to `true`
  861. // for custom, characters that can be used in the name is `a-z0-9_`
  862. columns : ['perm', 'date', 'size', 'kind'],
  863. // override this if you want custom columns name
  864. // example
  865. // columnsCustomName : {
  866. // date : 'Last modification',
  867. // kind : 'Mime type'
  868. // }
  869. columnsCustomName : {},
  870. // fixed list header colmun
  871. fixedHeader : true
  872. },
  873. // icons view setting
  874. iconsView : {
  875. // default icon size (0-3 in default CSS (cwd.css - elfinder-cwd-size[number]))
  876. size: 0,
  877. // number of maximum size (3 in default CSS (cwd.css - elfinder-cwd-size[number]))
  878. // uses in preference.js
  879. sizeMax: 3,
  880. // Name of each size
  881. sizeNames: {
  882. 0: 'viewSmall',
  883. 1: 'viewMedium',
  884. 2: 'viewLarge',
  885. 3: 'viewExtraLarge'
  886. }
  887. },
  888. // /**
  889. // * Add CSS class name to cwd directories (optional)
  890. // * see: https://github.com/Studio-42/elFinder/pull/1061,
  891. // * https://github.com/Studio-42/elFinder/issues/1231
  892. // *
  893. // * @type Function
  894. // */
  895. // ,
  896. // getClass: function(file) {
  897. // // e.g. This adds the directory's name (lowercase) with prefix as a CSS class
  898. // return 'elfinder-cwd-' + file.name.replace(/[ "]/g, '').toLowerCase();
  899. //}
  900. //,
  901. //// Template placeholders replacement rules for overwrite. see ui/cwd.js replacement
  902. //replacement : {
  903. // tooltip : function(f, fm) {
  904. // var list = fm.viewType == 'list', // current view type
  905. // query = fm.searchStatus.state == 2, // is in search results
  906. // title = fm.formatDate(f) + (f.size > 0 ? ' ('+fm.formatSize(f.size)+')' : ''),
  907. // info = '';
  908. // if (query && f.path) {
  909. // info = fm.escape(f.path.replace(/\/[^\/]*$/, ''));
  910. // } else {
  911. // info = f.tooltip? fm.escape(f.tooltip).replace(/\r/g, '&#13;') : '';
  912. // }
  913. // if (list) {
  914. // info += (info? '&#13;' : '') + fm.escape(f.name);
  915. // }
  916. // return info? info + '&#13;' + title : title;
  917. // }
  918. //}
  919. },
  920. path : {
  921. // Move to head of work zone without UI navbar
  922. toWorkzoneWithoutNavbar : true
  923. },
  924. dialog : {
  925. // Enable to auto focusing on mouse over in the target form element
  926. focusOnMouseOver : true
  927. },
  928. toast : {
  929. animate : {
  930. // to show
  931. showMethod: 'fadeIn', // fadeIn, slideDown, and show are built into jQuery
  932. showDuration: 300, // milliseconds
  933. showEasing: 'swing', // swing and linear are built into jQuery
  934. // timeout to hide
  935. timeOut: 3000,
  936. // to hide
  937. hideMethod: 'fadeOut',
  938. hideDuration: 1500,
  939. hideEasing: 'swing'
  940. }
  941. }
  942. },
  943. /**
  944. * MIME regex of send HTTP header "Content-Disposition: inline" or allow preview in quicklook
  945. * This option will overwrite by connector configuration
  946. *
  947. * @type String
  948. * @default '^(?:(?:image|video|audio)|text/plain|application/pdf$)'
  949. * @example
  950. * dispInlineRegex : '.', // is allow inline of all of MIME types
  951. * dispInlineRegex : '$^', // is not allow inline of all of MIME types
  952. */
  953. dispInlineRegex : '^(?:(?:image|video|audio)|application/(?:x-mpegURL|dash\+xml)|(?:text/plain|application/pdf)$)',
  954. /**
  955. * Display only required files by types
  956. *
  957. * @type Array
  958. * @default []
  959. * @example
  960. * onlyMimes : ["image"] - display all images
  961. * onlyMimes : ["image/png", "application/x-shockwave-flash"] - display png and flash
  962. */
  963. onlyMimes : [],
  964. /**
  965. * Custom files sort rules.
  966. * All default rules (name/size/kind/date/perm/mode/owner/group) set in elFinder._sortRules
  967. *
  968. * @type {Object}
  969. * @example
  970. * sortRules : {
  971. * name : function(file1, file2) { return file1.name.toLowerCase().localeCompare(file2.name.toLowerCase()); }
  972. * }
  973. */
  974. sortRules : {},
  975. /**
  976. * Default sort type.
  977. *
  978. * @type {String}
  979. */
  980. sortType : 'name',
  981. /**
  982. * Default sort order.
  983. *
  984. * @type {String}
  985. * @default "asc"
  986. */
  987. sortOrder : 'asc',
  988. /**
  989. * Display folders first?
  990. *
  991. * @type {Boolean}
  992. * @default true
  993. */
  994. sortStickFolders : true,
  995. /**
  996. * Sort also applies to the treeview (null: disable this feature)
  997. *
  998. * @type Boolean|null
  999. * @default false
  1000. */
  1001. sortAlsoTreeview : false,
  1002. /**
  1003. * If true - elFinder will formating dates itself,
  1004. * otherwise - backend date will be used.
  1005. *
  1006. * @type Boolean
  1007. */
  1008. clientFormatDate : true,
  1009. /**
  1010. * Show UTC dates.
  1011. * Required set clientFormatDate to true
  1012. *
  1013. * @type Boolean
  1014. */
  1015. UTCDate : false,
  1016. /**
  1017. * File modification datetime format.
  1018. * Value from selected language data is used by default.
  1019. * Set format here to overwrite it.
  1020. *
  1021. * @type String
  1022. * @default ""
  1023. */
  1024. dateFormat : '',
  1025. /**
  1026. * File modification datetime format in form "Yesterday 12:23:01".
  1027. * Value from selected language data is used by default.
  1028. * Set format here to overwrite it.
  1029. * Use $1 for "Today"/"Yesterday" placeholder
  1030. *
  1031. * @type String
  1032. * @default ""
  1033. * @example "$1 H:m:i"
  1034. */
  1035. fancyDateFormat : '',
  1036. /**
  1037. * Style of file mode at cwd-list, info dialog
  1038. * 'string' (ex. rwxr-xr-x) or 'octal' (ex. 755) or 'both' (ex. rwxr-xr-x (755))
  1039. *
  1040. * @type {String}
  1041. * @default 'both'
  1042. */
  1043. fileModeStyle : 'both',
  1044. /**
  1045. * elFinder width
  1046. *
  1047. * @type String|Number
  1048. * @default "auto"
  1049. */
  1050. width : 'auto',
  1051. /**
  1052. * elFinder node height
  1053. * Number: pixcel or String: Number + "%"
  1054. *
  1055. * @type Number | String
  1056. * @default 400
  1057. */
  1058. height : 400,
  1059. /**
  1060. * Do not resize the elFinder node itself on resize parent node
  1061. * Specify `true` when controlling with CSS such as Flexbox
  1062. *
  1063. * @type Boolean
  1064. * @default false
  1065. */
  1066. noResizeBySelf : false,
  1067. /**
  1068. * Base node object or selector
  1069. * Element which is the reference of the height percentage
  1070. *
  1071. * @type Object|String
  1072. * @default null | $(window) (if height is percentage)
  1073. **/
  1074. heightBase : null,
  1075. /**
  1076. * Make elFinder resizable if jquery ui resizable available
  1077. *
  1078. * @type Boolean
  1079. * @default true
  1080. */
  1081. resizable : true,
  1082. /**
  1083. * Timeout before open notifications dialogs
  1084. *
  1085. * @type Number
  1086. * @default 500 (.5 sec)
  1087. */
  1088. notifyDelay : 500,
  1089. /**
  1090. * Position CSS, Width of notifications dialogs
  1091. *
  1092. * @type Object
  1093. * @default {position: {}, width : null} - Apply CSS definition
  1094. * position: CSS object | null (null: position center & middle)
  1095. */
  1096. notifyDialog : {position : {}, width : null, canClose : false, hiddens : ['open']},
  1097. /**
  1098. * Dialog contained in the elFinder node
  1099. *
  1100. * @type Boolean
  1101. * @default false
  1102. */
  1103. dialogContained : false,
  1104. /**
  1105. * Allow shortcuts
  1106. *
  1107. * @type Boolean
  1108. * @default true
  1109. */
  1110. allowShortcuts : true,
  1111. /**
  1112. * Remeber last opened dir to open it after reload or in next session
  1113. *
  1114. * @type Boolean
  1115. * @default true
  1116. */
  1117. rememberLastDir : true,
  1118. /**
  1119. * Clear historys(elFinder) on reload(not browser) function
  1120. * Historys was cleared on Reload function on elFinder 2.0 (value is true)
  1121. *
  1122. * @type Boolean
  1123. * @default false
  1124. */
  1125. reloadClearHistory : false,
  1126. /**
  1127. * Use browser native history with supported browsers
  1128. *
  1129. * @type Boolean
  1130. * @default true
  1131. */
  1132. useBrowserHistory : true,
  1133. /**
  1134. * Lazy load config.
  1135. * How many files display at once?
  1136. *
  1137. * @type Number
  1138. * @default 50
  1139. */
  1140. showFiles : 50,
  1141. /**
  1142. * Lazy load config.
  1143. * Distance in px to cwd bottom edge to start display files
  1144. *
  1145. * @type Number
  1146. * @default 50
  1147. */
  1148. showThreshold : 50,
  1149. /**
  1150. * Additional rule to valid new file name.
  1151. * By default not allowed empty names or '..'
  1152. * This setting does not have a sense of security.
  1153. *
  1154. * @type false|RegExp|function
  1155. * @default false
  1156. * @example
  1157. * disable names with spaces:
  1158. * validName : /^[^\s]+$/,
  1159. */
  1160. validName : false,
  1161. /**
  1162. * Additional rule to filtering for browsing.
  1163. * This setting does not have a sense of security.
  1164. *
  1165. * The object `this` is elFinder instance object in this function
  1166. *
  1167. * @type false|RegExp|function
  1168. * @default false
  1169. * @example
  1170. * show only png and jpg files:
  1171. * fileFilter : /.*\.(png|jpg)$/i,
  1172. *
  1173. * show only image type files:
  1174. * fileFilter : function(file) { return file.mime && file.mime.match(/^image\//i); },
  1175. */
  1176. fileFilter : false,
  1177. /**
  1178. * Backup name suffix.
  1179. *
  1180. * @type String
  1181. * @default "~"
  1182. */
  1183. backupSuffix : '~',
  1184. /**
  1185. * Sync content interval
  1186. *
  1187. * @type Number
  1188. * @default 0 (do not sync)
  1189. */
  1190. sync : 0,
  1191. /**
  1192. * Sync start on load if sync value >= 1000
  1193. *
  1194. * @type Bool
  1195. * @default true
  1196. */
  1197. syncStart : true,
  1198. /**
  1199. * How many thumbnails create in one request
  1200. *
  1201. * @type Number
  1202. * @default 5
  1203. */
  1204. loadTmbs : 5,
  1205. /**
  1206. * Cookie option for browsersdoes not suppot localStorage
  1207. *
  1208. * @type Object
  1209. */
  1210. cookie : {
  1211. expires : 30,
  1212. domain : '',
  1213. path : '/',
  1214. secure : false,
  1215. samesite : 'lax'
  1216. },
  1217. /**
  1218. * Contextmenu config
  1219. *
  1220. * @type Object
  1221. */
  1222. contextmenu : {
  1223. // navbarfolder menu
  1224. navbar : ['open', 'opennew', 'download', '|', 'upload', 'mkdir', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', 'empty', 'hide', '|', 'rename', '|', 'archive', '|', 'places', 'info', 'chmod', 'netunmount'],
  1225. // current directory menu
  1226. cwd : ['undo', 'redo', '|', 'back', 'up', 'reload', '|', 'upload', 'mkdir', 'mkfile', 'paste', '|', 'empty', 'hide', '|', 'view', 'sort', 'selectall', 'colwidth', '|', 'places', 'info', 'chmod', 'netunmount', '|', 'fullscreen', '|', 'preference'],
  1227. // current directory file menu
  1228. files : ['getfile', '|' ,'open', 'opennew', 'download', 'opendir', 'quicklook', '|', 'upload', 'mkdir', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', 'empty', 'hide', '|', 'rename', 'edit', 'resize', '|', 'archive', 'extract', '|', 'selectall', 'selectinvert', '|', 'places', 'info', 'chmod', 'netunmount']
  1229. },
  1230. /**
  1231. * elFinder node enable always
  1232. * This value will set to `true` if <body> has elFinder node only
  1233. *
  1234. * @type Bool
  1235. * @default false
  1236. */
  1237. enableAlways : false,
  1238. /**
  1239. * elFinder node enable by mouse over
  1240. *
  1241. * @type Bool
  1242. * @default true
  1243. */
  1244. enableByMouseOver : true,
  1245. /**
  1246. * Show window close confirm dialog
  1247. * Value is which state to show
  1248. * 'hasNotifyDialog', 'editingFile', 'hasSelectedItem' and 'hasClipboardData'
  1249. *
  1250. * @type Array
  1251. * @default ['hasNotifyDialog', 'editingFile']
  1252. */
  1253. windowCloseConfirm : ['hasNotifyDialog', 'editingFile'],
  1254. /**
  1255. * Function decoding 'raw' string converted to unicode
  1256. * It is used instead of fm.decodeRawString(str)
  1257. *
  1258. * @type Null|Function
  1259. */
  1260. rawStringDecoder : typeof Encoding === 'object' && $.isFunction(Encoding.convert)? function(str) {
  1261. return Encoding.convert(str, {
  1262. to: 'UNICODE',
  1263. type: 'string'
  1264. });
  1265. } : null,
  1266. /**
  1267. * Debug config
  1268. *
  1269. * @type Array|String('auto')|Boolean(true|false)
  1270. */
  1271. debug : ['error', 'warning', 'event-destroy'],
  1272. /**
  1273. * Show toast messeges of backend warning (if found data `debug.backendErrors` in backend results)
  1274. *
  1275. * @type Boolean|Object (toast options)
  1276. */
  1277. toastBackendWarn : true
  1278. };