File Manager - Version 4.1.1

Version Description

(14 December, 2016) =

  • Minor UI changes
Download this release

Release Info

Developer aihimel
Plugin Icon 128x128 File Manager
Version 4.1.1
Comparing to
See all releases

Code changes from version 4.1.0 to 4.1.1

BootStart/BootStart.php CHANGED
@@ -77,7 +77,7 @@ abstract class FM_BootStart{
77
  * @var object $options The object of the options class
78
  *
79
  * */
80
- protected $options;
81
 
82
  /**
83
  *
@@ -201,18 +201,21 @@ abstract class FM_BootStart{
201
  *
202
  * */
203
  public function admin_assets(){
 
 
 
204
 
205
  // Jquery UI CSS
206
- wp_enqueue_style( $this->__('jquery-ui-css'), $this->url('jquery-ui-1.11.4/jquery-ui.min.css') );
207
 
208
  // Jquery UI theme
209
- //~ wp_enqueue_style( $this->__('jquery-ui-css-theme'), $this->url('jquery-ui-1.11.4/jquery-ui.theme.min.css') );
210
 
211
  // elFinder CSS
212
  wp_enqueue_style( $this->__('elfinder-css'), $this->url('elFinder/css/elfinder.min.css') );
213
 
214
  // elFinder theme CSS
215
- wp_enqueue_style( $this->__('elfinder-theme-css'), $this->url('elFinder/css/theme.css') );
216
 
217
  // Including admin-style.css
218
  wp_enqueue_style( $this->__('admin-style'), $this->url('css/admin-style.css') );
@@ -221,10 +224,7 @@ abstract class FM_BootStart{
221
  wp_enqueue_script( $this->__('admin-script'), $this->url('js/admin-script.js'), array('jquery') );
222
 
223
  // elFinder Scripts depends on jQuery UI core, selectable, draggable, droppable, resizable, dialog and slider.
224
- wp_enqueue_script( $this->__('elfinder-script'), $this->url('elFinder/js/elfinder.full.js'), array('jquery', 'jquery-ui-core', 'jquery-ui-selectable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-dialog', 'jquery-ui-slider', ) );
225
-
226
- // Adding lightbox plugin for jquery
227
- wp_enqueue_script( $this->__('fmp-lightbox-js'), $this->url('lightbox/js/lightbox.min.js'), array( 'jquery' ) );
228
 
229
  }
230
 
@@ -493,3 +493,4 @@ abstract class FM_BootStart{
493
 
494
  }
495
  }
 
77
  * @var object $options The object of the options class
78
  *
79
  * */
80
+ public $options;
81
 
82
  /**
83
  *
201
  *
202
  * */
203
  public function admin_assets(){
204
+
205
+ $jquery_ui_url = $this->url('jquery-ui-1.11.4/jquery-ui.min.css');
206
+ $jquery_ui_url = apply_filters('fm_jquery_ui_theme_hook', $jquery_ui_url);
207
 
208
  // Jquery UI CSS
209
+ wp_enqueue_style( $this->__('jquery-ui-css'), $jquery_ui_url);
210
 
211
  // Jquery UI theme
212
+ //auto:: wp_enqueue_style( $this->__('jquery-ui-css-theme'), $this->url('jquery-ui-1.11.4/jquery-ui.theme.min.css') );
213
 
214
  // elFinder CSS
215
  wp_enqueue_style( $this->__('elfinder-css'), $this->url('elFinder/css/elfinder.min.css') );
216
 
217
  // elFinder theme CSS
218
+ if($this->url('jquery-ui-1.11.4/jquery-ui.min.css') == $jquery_ui_url ) wp_enqueue_style( $this->__('elfinder-theme-css'), $this->url('elFinder/css/theme.css') );
219
 
220
  // Including admin-style.css
221
  wp_enqueue_style( $this->__('admin-style'), $this->url('css/admin-style.css') );
224
  wp_enqueue_script( $this->__('admin-script'), $this->url('js/admin-script.js'), array('jquery') );
225
 
226
  // elFinder Scripts depends on jQuery UI core, selectable, draggable, droppable, resizable, dialog and slider.
227
+ wp_enqueue_script( $this->__('elfinder-script'), $this->url('elFinder/js/elfinder.full.js'), array('jquery', 'jquery-ui-core', 'jquery-ui-selectable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-dialog', 'jquery-ui-slider', 'jquery-ui-tabs') );
 
 
 
228
 
229
  }
230
 
493
 
494
  }
495
  }
496
+
css/admin-style.css CHANGED
@@ -473,3 +473,75 @@ input[type=radio]
473
  background: rgb(28, 184, 65);
474
  cursor: pointer;
475
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  background: rgb(28, 184, 65);
474
  cursor: pointer;
475
  }
476
+
477
+ /**
478
+ * File edit full screen
479
+ * */
480
+ div.ui-dialog:nth-child(7){
481
+ width: 760px !important;
482
+ top: 10px !important;
483
+ left: 10px !important;
484
+ }
485
+
486
+ .elfinder-file-edit{
487
+ height: 475px;
488
+ }
489
+ /**--------------------------------------------------**/
490
+
491
+ /**
492
+ * File preview fullscreen problem fix
493
+ **/
494
+
495
+ div.ui-helper-reset:nth-child(9){
496
+ position: absolute !important;
497
+ width: 760px !important;
498
+ height: auto !important;
499
+ top: 150px !important;
500
+ left: 190px !important;
501
+ }
502
+
503
+ .elfinder-quicklook-preview{
504
+ height: 510px;
505
+ }
506
+
507
+ div.elfinder-quicklook-navbar-icon:nth-child(2){
508
+ display: none;
509
+ }
510
+ /**------------------------------------**/
511
+
512
+ /**
513
+ *
514
+ * Designing Logo
515
+ *
516
+ * */
517
+ .fm-logo{
518
+ width: 50px;
519
+ height: auto;
520
+ position: relative;
521
+ top: 15px;
522
+ left: -15px;
523
+ }
524
+
525
+ /**
526
+ *
527
+ * File manager main view cross button hidden
528
+ *
529
+ * */
530
+ span.ui-icon:nth-child(4){
531
+ display: none !important;
532
+ }
533
+
534
+
535
+ /**
536
+ *
537
+ * Themepack style
538
+ *
539
+ * */
540
+ .fmtp_theme_screenshot{
541
+ max-width: 100px;
542
+ }
543
+
544
+ .fmtp_theme_wrapper{
545
+ display: inline-block;
546
+ width: 19%;
547
+ }
elFinder/LICENSE.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ elFinder is issued under a 3-clauses BSD license.
2
+
3
+ Copyright (c) 2009-2016, Studio 42
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+
12
+ 3. Neither the name of the Studio 42 Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL "STUDIO 42" OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
15
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elFinder/README.md CHANGED
@@ -1,6 +1,5 @@
1
  elFinder
2
  ========
3
-
4
  <pre>
5
  _ ______ _ _
6
  | | ____(_) | |
@@ -14,6 +13,11 @@ elFinder is an open-source file manager for web, written in JavaScript using
14
  jQuery UI. Creation is inspired by simplicity and convenience of Finder program
15
  used in Mac OS X operating system.
16
 
 
 
 
 
 
17
  Contents
18
  --------
19
  * [Branches](#branches)
@@ -67,11 +71,12 @@ Features
67
  **2.1.x**
68
  * More High performance server backend and light client UI
69
  * Connector plugin
 
70
  * [AutoResize](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/AutoResize/plugin.php) : Auto resize on file upload.
71
  * [Normalizer](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Normalizer/plugin.php) : UTF-8 Normalizer of file-name and file-path etc.
72
  * [Sanitizer](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Sanitizer/plugin.php) : Sanitizer of file-name and file-path etc.
73
  * [Watermark](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Watermark/plugin.php) : Print watermark on file upload.
74
- * Folder upload with Chrome
75
  * Chunked file upload
76
  * Upload directly to the folder
77
  * Upload form URL (or list)
@@ -81,9 +86,15 @@ Features
81
  * Supports custom information in info dialog
82
  * Configuable columns of list view
83
  * Supports custom CSS class function of tree view
 
84
 
85
  Requirements
86
  ------------
 
 
 
 
 
87
 
88
  ### Client
89
  * Modern browser. elFinder was tested in Firefox 12, Internet Explorer 8+,
@@ -91,7 +102,7 @@ Requirements
91
 
92
  ### Server
93
  * Any web server
94
- * PHP 5.2+ (for thumbnails - mogrify utility or GD/Imagick module)
95
 
96
  Installation
97
  ------------
@@ -110,11 +121,14 @@ Installation
110
  2. Rename `/php/connector.minimal.php-dist` to `/php/connector.minimal.php`
111
  3. Load `/elfinder.src.html` in your browser to run elFinder
112
 
 
 
 
113
  Downloads
114
  ------------
115
- **Stable releases**
116
- + [elFinder 2.1.6](https://github.com/Studio-42/elFinder/archive/2.1.6.zip)
117
- + [elFinder 2.0.5](https://github.com/Studio-42/elFinder/archive/2.0.5.zip)
118
 
119
  **Nightly builds**
120
  + [elFinder 2.1.x (Nightly)](https://github.com/Studio-42/elFinder/archive/2.1.zip)
@@ -123,19 +137,15 @@ Downloads
123
  Demo sites
124
  ------------
125
  **2.1.x Nightly**
126
- + http://studio-42.github.io/elFinder/ (with CORS)
127
- + http://hypweb.net/elFinder-nightly/demo/2.1/
128
-
129
- **2.0**
130
- + http://elfinder.org/ (rc1)
131
- + http://hypweb.net/elFinder-nightly/demo/2.0/ (2.0.x Nightly)
132
 
133
  FAQs
134
  ------------
135
  ### Which version of elFinder should I use?
136
- * **2.0.x** if you want to use 2.0 with legacy connectors.
137
 
138
- * **2.1.x** if you want to try the experimental (*bleeding edge, but connector is PHP only*).
139
 
140
  ### Should I use elFinder builds (compressed) or source (uncompressed)?
141
 
@@ -153,10 +163,11 @@ You can create or modify the language file to use translation tool. Please refer
153
 
154
  3rd party connectors
155
  --------------------
 
 
156
  * [Python](https://github.com/Studio-42/elfinder-python)
157
- * [Django](https://github.com/mikery/django-elfinder)
158
  * [Ruby/Rails](https://github.com/phallstrom/el_finder)
159
- * [Java Servlet](https://github.com/Studio-42/elfinder-servlet)
160
  * [Laravel](https://github.com/barryvdh/laravel-elfinder)
161
 
162
  3rd party Volume Drivers
@@ -167,6 +178,8 @@ You can create or modify the language file to use translation tool. Please refer
167
  --------------------
168
  * [lokothodida/elfinder-theme-moono](https://github.com/lokothodida/elfinder-theme-moono)
169
  * [lokothodida/elfinder-theme-windows-10](https://github.com/lokothodida/elfinder-theme-windows-10)
 
 
170
 
171
  Support
172
  -------
@@ -174,7 +187,6 @@ Support
174
  * [Homepage](http://elfinder.org)
175
  * [Wiki](https://github.com/Studio-42/elFinder/wiki)
176
  * [Issues](https://github.com/Studio-42/elFinder/issues)
177
- * [Forum](http://elfinder.org/forum/)
178
  * <dev@std42.ru>
179
 
180
 
@@ -194,29 +206,4 @@ License
194
 
195
  elFinder is issued under a 3-clauses BSD license.
196
 
197
- <pre>
198
- Copyright (c) 2009-2012, Studio 42
199
- All rights reserved.
200
-
201
- Redistribution and use in source and binary forms, with or without
202
- modification, are permitted provided that the following conditions are met:
203
- * Redistributions of source code must retain the above copyright
204
- notice, this list of conditions and the following disclaimer.
205
- * Redistributions in binary form must reproduce the above copyright
206
- notice, this list of conditions and the following disclaimer in the
207
- documentation and/or other materials provided with the distribution.
208
- * Neither the name of the Studio 42 Ltd. nor the
209
- names of its contributors may be used to endorse or promote products
210
- derived from this software without specific prior written permission.
211
-
212
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
213
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
214
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
215
- DISCLAIMED. IN NO EVENT SHALL "STUDIO 42" BE LIABLE FOR ANY DIRECT, INDIRECT,
216
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
217
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
218
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
219
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
220
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
221
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
222
- </pre>
1
  elFinder
2
  ========
 
3
  <pre>
4
  _ ______ _ _
5
  | | ____(_) | |
13
  jQuery UI. Creation is inspired by simplicity and convenience of Finder program
14
  used in Mac OS X operating system.
15
 
16
+ [![Download now!](http://studio-42.github.io/elFinder/images/download-icon.png)](https://github.com/Studio-42/elFinder/releases/latest)
17
+ [![Packagist License](https://poser.pugx.org/studio-42/elfinder/license.png)](http://choosealicense.com/licenses/bsd-3-clause/)
18
+ [![Latest Stable Version](https://poser.pugx.org/studio-42/elfinder/version.png)](https://packagist.org/packages/studio-42/elfinder)
19
+ [![Total Downloads](https://poser.pugx.org/studio-42/elfinder/d/total.png)](https://packagist.org/packages/studio-42/elfinder)
20
+
21
  Contents
22
  --------
23
  * [Branches](#branches)
71
  **2.1.x**
72
  * More High performance server backend and light client UI
73
  * Connector plugin
74
+ * [AutoRotate](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/AutoRotate/plugin.php) : Auto rotation on file upload of JPEG file by EXIF Orientation.
75
  * [AutoResize](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/AutoResize/plugin.php) : Auto resize on file upload.
76
  * [Normalizer](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Normalizer/plugin.php) : UTF-8 Normalizer of file-name and file-path etc.
77
  * [Sanitizer](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Sanitizer/plugin.php) : Sanitizer of file-name and file-path etc.
78
  * [Watermark](https://github.com/Studio-42/elFinder/blob/2.1-src/php/plugins/Watermark/plugin.php) : Print watermark on file upload.
79
+ * Folder upload with Chrome, Firefox and Edge
80
  * Chunked file upload
81
  * Upload directly to the folder
82
  * Upload form URL (or list)
86
  * Supports custom information in info dialog
87
  * Configuable columns of list view
88
  * Supports custom CSS class function of tree view
89
+ * For more details, see the [Changelog](https://github.com/Studio-42/elFinder/blob/master/Changelog)
90
 
91
  Requirements
92
  ------------
93
+ ### jQuery / jQuery UI
94
+ * jQuery 1.8.0+
95
+ * jQuery UI 1.9.0+
96
+
97
+ **However, we recommend newest version.**
98
 
99
  ### Client
100
  * Modern browser. elFinder was tested in Firefox 12, Internet Explorer 8+,
102
 
103
  ### Server
104
  * Any web server
105
+ * PHP 5.2+ (Recommend PHP 5.4 or higher) And for thumbnails - GD / Imagick module / convert(imagemagick) require
106
 
107
  Installation
108
  ------------
121
  2. Rename `/php/connector.minimal.php-dist` to `/php/connector.minimal.php`
122
  3. Load `/elfinder.src.html` in your browser to run elFinder
123
 
124
+ ### Installer
125
+ - [Setup elFinder 2.1.x nightly with Composer](https://github.com/Studio-42/elFinder/tree/gh-pages/tools/installer/setup_with_composer)
126
+
127
  Downloads
128
  ------------
129
+ **Stable releases** ([Changelog](https://github.com/Studio-42/elFinder/blob/master/Changelog))
130
+ + [elFinder 2.1.18](https://github.com/Studio-42/elFinder/archive/2.1.18.zip)
131
+ + [elFinder 2.0.7](https://github.com/Studio-42/elFinder/archive/2.0.7.zip)
132
 
133
  **Nightly builds**
134
  + [elFinder 2.1.x (Nightly)](https://github.com/Studio-42/elFinder/archive/2.1.zip)
137
  Demo sites
138
  ------------
139
  **2.1.x Nightly**
140
+ + https://studio-42.github.io/elFinder/ (with CORS)
141
+ + https://hypweb.net/elFinder-nightly/demo/2.1/
 
 
 
 
142
 
143
  FAQs
144
  ------------
145
  ### Which version of elFinder should I use?
146
+ * **2.0.x** if you do not need 2.1 of the advanced features.
147
 
148
+ * **2.1.x** if you want to try the experimental (*bleeding edge, but API 2.1 connector is PHP only*). It is also available from the connector on the API 1.x and 2.0.
149
 
150
  ### Should I use elFinder builds (compressed) or source (uncompressed)?
151
 
163
 
164
  3rd party connectors
165
  --------------------
166
+ * [ASP.NET](https://github.com/leniel/elFinder.Net)
167
+ * [Java Servlet](https://github.com/trustsystems/elfinder-java-connector)
168
  * [Python](https://github.com/Studio-42/elfinder-python)
 
169
  * [Ruby/Rails](https://github.com/phallstrom/el_finder)
170
+ * [Django](https://github.com/mikery/django-elfinder)
171
  * [Laravel](https://github.com/barryvdh/laravel-elfinder)
172
 
173
  3rd party Volume Drivers
178
  --------------------
179
  * [lokothodida/elfinder-theme-moono](https://github.com/lokothodida/elfinder-theme-moono)
180
  * [lokothodida/elfinder-theme-windows-10](https://github.com/lokothodida/elfinder-theme-windows-10)
181
+ * [StudioJunkyard/elfinder-boostrap-theme](https://github.com/StudioJunkyard/LibreICONS/tree/master/themes/elFinder)
182
+ * [RobiNN1/elFinder-Material-Theme](https://github.com/RobiNN1/elFinder-Material-Theme)
183
 
184
  Support
185
  -------
187
  * [Homepage](http://elfinder.org)
188
  * [Wiki](https://github.com/Studio-42/elFinder/wiki)
189
  * [Issues](https://github.com/Studio-42/elFinder/issues)
 
190
  * <dev@std42.ru>
191
 
192
 
206
 
207
  elFinder is issued under a 3-clauses BSD license.
208
 
209
+ * [License terms](https://github.com/Studio-42/elFinder/blob/master/LICENSE.md)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
elFinder/css/elfinder.full.css CHANGED
@@ -1,10 +1,10 @@
1
  /*!
2
  * elFinder - file manager for web
3
- * Version 2.1.6 (2016-01-19)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
- * Licensed under a 3 clauses BSD license
8
  */
9
 
10
  /* File: /css/commands.css */
@@ -15,8 +15,28 @@
15
  /********************** COMMAND "RESIZE" ****************************/
16
  .elfinder-dialog-resize { margin-top:.3em; }
17
  .elfinder-resize-type { float:left; margin-bottom: .4em; }
18
- .elfinder-resize-control { padding-top:3em; }
19
- .elfinder-resize-control input[type=text] { border:1px solid #aaa; text-align: right; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  .elfinder-resize-preview {
21
  width:400px;
22
  height:400px;
@@ -25,8 +45,9 @@
25
  border:1px solid #aaa;
26
  float:right;
27
  position:relative;
28
- overflow:auto;
29
- /* z-index:100;*/
 
30
  }
31
 
32
  .elfinder-resize-handle { position:relative;}
@@ -122,20 +143,44 @@
122
  background:url(../img/progress.gif) center bottom repeat-x;
123
  }
124
 
125
- .elfinder-resize-row { margin-bottom:7px; position:relative;}
126
 
127
  .elfinder-resize-label { float:left; width:80px; padding-top: 3px; }
128
 
129
- .elfinder-resize-reset {
130
- width:16px;
131
- height:16px;
132
- /* border:1px solid #111;*/
133
- position:absolute;
134
- margin-top:-8px;
 
 
 
 
135
  }
136
 
137
- .elfinder-dialog .elfinder-dialog-resize .ui-resizable-e { height:100%; width:10px; }
138
- .elfinder-dialog .elfinder-dialog-resize .ui-resizable-s { width:100%; height:10px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  .elfinder-dialog .elfinder-dialog-resize .ui-resizable-se {
140
  background:transparent;
141
  bottom:0;
@@ -143,7 +188,40 @@
143
  margin-right:-7px;
144
  margin-bottom:-7px;
145
  }
 
 
 
 
 
 
 
 
 
 
 
 
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  .elfinder-dialog-resize .ui-icon-grip-solid-vertical {
148
  position:absolute;
149
  top:50%;
@@ -159,23 +237,50 @@
159
  margin-bottom:-11px;;
160
  }
161
 
162
- .elfinder-resize-row .elfinder-buttonset { float:right; }
 
 
163
 
164
- .elfinder-resize-rotate-slider {
165
- float: left;
 
 
 
 
 
 
 
 
 
 
166
  width: 195px;
167
- margin: 7px;
 
 
 
 
 
168
  }
169
 
170
  /********************** COMMAND "EDIT" ****************************/
171
  /* edit text file textarea */
172
  .elfinder-file-edit {
173
- width:99%;
174
  height:99%;
175
  margin:0;
176
  padding:2px;
177
  border:1px solid #ccc;
 
 
 
 
178
  }
 
 
 
 
 
 
179
 
180
  /********************** COMMAND "SORT" ****************************/
181
  /* for list table header sort triangle icon */
@@ -184,13 +289,17 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td {
184
  }
185
  div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
186
  position: absolute;
187
- top: 0.4em;
188
  left: 0;
189
  right: 0;
190
  margin: auto 0px auto auto;
191
  }
192
-
193
-
 
 
 
 
194
  /********************** COMMAND "HELP" ****************************/
195
  /* help dialog */
196
  .elfinder-help { margin-bottom:.5em; }
@@ -275,16 +384,131 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
275
  top:45px;
276
  }
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
 
 
 
 
 
 
279
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
 
281
  /* File: /css/common.css */
282
  /*********************************************/
283
  /* COMMON ELFINDER STUFFS */
284
  /*********************************************/
285
 
 
 
 
 
 
286
  /* common container */
287
- .elfinder { padding:0; position:relative; display:block; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
 
289
  /* right to left enviroment */
290
  .elfinder-rtl { text-align:right; direction:rtl; }
@@ -319,6 +543,9 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
319
  /* write only */
320
  .elfinder-wo .elfinder-perms { background-position:0 -80px;}
321
 
 
 
 
322
  /* locked */
323
  .elfinder-lock {
324
  background-position:0 -656px;
@@ -326,10 +553,13 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
326
 
327
  /* drag helper */
328
  .elfinder-drag-helper {
 
 
329
  width:70px;
330
  height:60px;
331
  padding:0 0 0 25px;
332
  z-index:100000;
 
333
  }
334
  .elfinder-drag-helper.html5-native {
335
  position: absolute;
@@ -378,9 +608,12 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
378
  /* icon in drag helper */
379
  .elfinder-drag-helper .elfinder-cwd-icon { margin:0 0 0 -24px; float:left; }
380
 
381
- /* transparent overlay >_< */
382
- /*.elfinder-overlay { opacity: 0; filter:Alpha(Opacity=0); }*/
383
- .elfinder-overlay { position: absolute; }
 
 
 
384
 
385
  /* panels under/below cwd (for search field etc) */
386
  .elfinder .elfinder-panel {
@@ -394,27 +627,57 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
394
  -khtml-user-drag: element;
395
  }
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
 
398
  /* File: /css/contextmenu.css */
399
  /* menu and submenu */
400
- .elfinder-contextmenu,
401
- .elfinder-contextmenu-sub {
402
- display:none;
403
  position:absolute;
404
  border:1px solid #aaa;
405
  background:#fff;
406
  color:#555;
407
  padding:4px 0;
 
 
408
  }
409
 
410
  /* submenu */
411
- .elfinder-contextmenu-sub { top:5px; }
412
  /* submenu in rtl/ltr enviroment */
413
- .elfinder-contextmenu-ltr .elfinder-contextmenu-sub { margin-left:-5px; }
414
- .elfinder-contextmenu-rtl .elfinder-contextmenu-sub { margin-right:-5px; }
415
 
416
  /* menu item */
417
- .elfinder-contextmenu-item {
 
 
 
 
 
 
 
 
 
 
 
418
  position:relative;
419
  display:block;
420
  padding:4px 30px;
@@ -422,34 +685,50 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
422
  white-space:nowrap;
423
  cursor:default;
424
  }
425
- .elfinder-contextmenu-item .ui-icon {
 
 
 
426
  width:16px;
427
  height:16px;
428
  position:absolute;
429
- left:2px;
 
430
  top:50%;
431
  margin-top:-8px;
432
- display:none;
433
  }
434
- .elfinder-contextmenu-item.elfinder-touch {
435
- padding:12px 30px;
 
 
 
 
 
 
436
  }
437
 
438
- /* text in item */
439
- .elfinder-contextmenu .elfinder-contextmenu-item span { display:block; }
440
-
 
 
 
 
 
441
 
 
 
442
 
443
  /* submenu item in rtl/ltr enviroment */
444
- .elfinder-contextmenu-ltr .elfinder-contextmenu-item { text-align:left; }
445
- .elfinder-contextmenu-rtl .elfinder-contextmenu-item { text-align:right; }
446
- .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextmenu-item { padding-left:12px; }
447
- .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextmenu-item { padding-right:12px; }
448
 
449
  /* command/submenu icon */
450
- .elfinder-contextmenu-extra-icon,
451
- .elfinder-contextmenu-arrow,
452
- .elfinder-contextmenu-icon {
453
  position:absolute;
454
  top:50%;
455
  margin-top:-8px;
@@ -457,25 +736,25 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
457
  }
458
 
459
  /* command icon in rtl/ltr enviroment */
460
- .elfinder-contextmenu-ltr .elfinder-contextmenu-icon { left:8px; }
461
- .elfinder-contextmenu-rtl .elfinder-contextmenu-icon { right:8px; }
462
- .elfinder-contextmenu-ltr .elfinder-contextmenu-extra-icon { right:8px; }
463
- .elfinder-contextmenu-rtl .elfinder-contextmenu-extra-icon { left:8px; }
464
 
465
  /* arrow icon */
466
- .elfinder-contextmenu-arrow {
467
  width:16px;
468
  height:16px;
469
  background:url('../img/arrows-normal.png') 5px 4px no-repeat;
470
  }
471
 
472
  /* arrow icon in rtl/ltr enviroment */
473
- .elfinder-contextmenu-ltr .elfinder-contextmenu-arrow { right:5px; }
474
- .elfinder-contextmenu-rtl .elfinder-contextmenu-arrow { left:5px; background-position: 0 -10px; }
475
 
476
  /* command extra icon's <a>, <span> tag */
477
- .elfinder-contextmenu-extra-icon a,
478
- .elfinder-contextmenu-extra-icon span {
479
  display: inline-block;
480
  width: 100%;
481
  height: 100%;
@@ -487,15 +766,19 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
487
  }
488
 
489
  /* disable ui border/bg image on hover */
490
- .elfinder-contextmenu .ui-state-hover { border:0 solid; background-image:none;}
491
 
492
  /* separator */
493
- .elfinder-contextmenu-separator {
494
  height:0px;
495
  border-top:1px solid #ccc;
496
  margin:0 1px;
497
  }
498
 
 
 
 
 
499
  /* File: /css/cwd.css */
500
  /******************************************************************/
501
  /* CURRENT DIRECTORY STYLES */
@@ -518,16 +801,6 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
518
  margin:0;
519
  -ms-touch-action: auto;
520
  touch-action: auto;
521
- -moz-user-select: -moz-none;
522
- -khtml-user-select: none;
523
- -webkit-user-select: none;
524
- user-select: none;
525
- -webkit-tap-highlight-color:rgba(0,0,0,0);
526
- -webkit-touch-callout:none;
527
- user-select: none;
528
- -webkit-user-select: none;
529
- -moz-user-select: none;
530
- -khtml-user-select: none;
531
  }
532
 
533
  /* container active on dropenter */
@@ -547,12 +820,69 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
547
  text-align: center;
548
  white-space: pre-wrap;
549
  opacity: 0.6;
 
550
  font-weight: bold;
551
  }
552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
 
554
  /************************** ICONS VIEW ********************************/
555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  /* file container */
557
  .elfinder-cwd-view-icons .elfinder-cwd-file {
558
  width:120px;
@@ -561,9 +891,19 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
561
  cursor:default;
562
  border:none;
563
  /* overflow:hidden;*/
564
- /* position:relative;*/
565
  }
566
 
 
 
 
 
 
 
 
 
 
 
567
  /* ltr/rtl enviroment */
568
  .elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file { float:left; margin:0 3px 12px 0; }
569
  .elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file { float:right; margin:0 0 5px 3px; }
@@ -582,18 +922,24 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
582
 
583
  /* file name place */
584
  .elfinder-cwd-view-icons .elfinder-cwd-filename {
585
- text-align:center;
586
- max-height:32px;
587
- white-space:pre-wrap;
588
- word-break:normal;
589
- overflow:hidden;
590
- text-overflow:ellipsis;
591
- -o-text-overflow:ellipsis;
592
- margin:3px 1px 0 1px;
593
- padding:1px;
594
  -moz-border-radius: 8px;
595
  -webkit-border-radius: 8px;
596
  border-radius: 8px;
 
 
 
 
 
 
597
  }
598
 
599
  /* permissions/symlink markers */
@@ -613,23 +959,221 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
613
  background-clip: padding-box;
614
  }
615
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616
  /* "opened folder" icon on dragover */
617
  .elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon { background-position: 0 -100px; }
 
 
 
 
618
 
619
  /* mimetypes icons */
620
  .elfinder-cwd-icon-directory { background-position:0 -50px; }
 
 
621
  .elfinder-cwd-icon-application { background-position:0 -150px; }
 
 
 
622
  .elfinder-cwd-icon-x-empty,
623
  .elfinder-cwd-icon-text { background-position:0 -200px; }
 
 
 
 
624
  .elfinder-cwd-icon-image,
625
  .elfinder-cwd-icon-vnd-adobe-photoshop,
626
  .elfinder-cwd-icon-postscript { background-position:0 -250px; }
 
 
627
  .elfinder-cwd-icon-audio { background-position:0 -300px; }
 
628
  .elfinder-cwd-icon-video,
629
  .elfinder-cwd-icon-flash-video { background-position:0 -350px; }
 
 
 
630
  .elfinder-cwd-icon-rtf,
631
  .elfinder-cwd-icon-rtfd { background-position: 0 -401px; }
 
 
632
  .elfinder-cwd-icon-pdf { background-position: 0 -450px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
633
  .elfinder-cwd-icon-ms-excel,
634
  .elfinder-cwd-icon-msword,
635
  .elfinder-cwd-icon-vnd-ms-excel,
@@ -670,15 +1214,41 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
670
  .elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template,
671
  .elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document,
672
  .elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template { background-position: 0 -500px; }
 
 
673
  .elfinder-cwd-icon-html { background-position: 0 -550px; }
 
 
674
  .elfinder-cwd-icon-css { background-position: 0 -600px; }
 
 
 
675
  .elfinder-cwd-icon-javascript,
676
  .elfinder-cwd-icon-x-javascript { background-position: 0 -650px; }
 
 
677
  .elfinder-cwd-icon-x-perl { background-position: 0 -700px; }
 
 
678
  .elfinder-cwd-icon-x-python { background-position: 0 -750px; }
 
 
679
  .elfinder-cwd-icon-x-ruby { background-position: 0 -800px; }
 
 
 
 
680
  .elfinder-cwd-icon-x-sh,
681
  .elfinder-cwd-icon-x-shellscript { background-position: 0 -850px; }
 
 
 
 
 
 
 
 
 
682
  .elfinder-cwd-icon-x-c,
683
  .elfinder-cwd-icon-x-csrc,
684
  .elfinder-cwd-icon-x-chdr,
@@ -687,23 +1257,44 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
687
  .elfinder-cwd-icon-x-c--hdr,
688
  .elfinder-cwd-icon-x-java,
689
  .elfinder-cwd-icon-x-java-source { background-position: 0 -900px; }
 
 
690
  .elfinder-cwd-icon-x-php { background-position: 0 -950px; }
 
 
691
  .elfinder-cwd-icon-xml { background-position: 0 -1000px; }
 
 
 
 
 
692
  .elfinder-cwd-icon-zip,
693
  .elfinder-cwd-icon-x-zip,
694
  .elfinder-cwd-icon-x-xz,
695
  .elfinder-cwd-icon-x-7z-compressed { background-position: 0 -1050px; }
 
 
 
696
  .elfinder-cwd-icon-x-gzip,
697
  .elfinder-cwd-icon-x-tar { background-position: 0 -1100px; }
 
 
 
698
  .elfinder-cwd-icon-x-bzip,
699
  .elfinder-cwd-icon-x-bzip2 { background-position: 0 -1150px; }
 
 
 
700
  .elfinder-cwd-icon-x-rar,
701
  .elfinder-cwd-icon-x-rar-compressed { background-position: 0 -1200px; }
 
 
702
  .elfinder-cwd-icon-x-shockwave-flash { background-position: 0 -1250px; }
 
703
  .elfinder-cwd-icon-group { background-position:0 -1300px;}
704
 
705
  /* textfield inside icon */
706
- .elfinder-cwd input { width:100%; border:0px solid; margin:0; padding:0; }
707
  .elfinder-cwd-view-icons input {text-align:center; }
708
  .elfinder-cwd-view-icons textarea {
709
  width: 100%;
@@ -722,6 +1313,10 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
722
 
723
  /*.elfinder-cwd-view-list { padding:0 0 4px 0; }*/
724
 
 
 
 
 
725
  .elfinder-cwd table {
726
  width: 100%;
727
  border-collapse: separate;
@@ -730,12 +1325,64 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
730
  border-spacing: 0;
731
  box-sizing: padding-box;
732
  padding: 2px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734
  .elfinder .elfinder-cwd table thead tr { border-left:0 solid; border-top:0 solid; border-right:0 solid; }
735
 
736
  .elfinder .elfinder-cwd table thead td {
737
  padding: 4px 14px;
738
  }
 
 
 
 
 
 
 
739
  .elfinder .elfinder-cwd table thead td.ui-state-active {
740
  background: #ebf1f6;
741
  background: -moz-linear-gradient(top, #ebf1f6 0%, #abd3ee 50%, #89c3eb 51%, #d5ebfb 100%);
@@ -756,15 +1403,32 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
756
  border:0 solid;
757
  }
758
 
 
 
 
 
759
  .elfinder .elfinder-cwd table td div {
760
  box-sizing: content-box;
761
  }
762
 
763
- .elfinder .elfinder-cwd tr.elfinder-touch td {
 
 
 
 
 
 
 
 
 
764
  padding: 10px 12px;
765
  }
766
 
767
- .elfinder .elfinder-cwd tr.elfinder-cwd-file.elfinder-touch td {
 
 
 
 
768
  padding: 13px 12px;
769
  }
770
 
@@ -778,17 +1442,23 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
778
  /* filename container */
779
  .elfinder-cwd-view-list .elfinder-cwd-file-wrapper { width:97%; position:relative; }
780
  /* filename container in ltr/rtl enviroment */
781
- .elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-file-wrapper { padding-left:23px; }
782
- .elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-file-wrapper { padding-right:23px; }
 
 
783
 
784
  /* premissions/symlink marker */
785
  .elfinder-cwd-view-list .elfinder-perms,
786
  .elfinder-cwd-view-list .elfinder-lock,
787
- .elfinder-cwd-view-list .elfinder-symlink { top:50%; margin-top:-6px; }
 
 
 
 
788
  /* markers in ltr/rtl enviroment */
789
- .elfinder-ltr .elfinder-cwd-view-list .elfinder-perms { left:7px; }
790
- .elfinder-ltr .elfinder-cwd-view-list .elfinder-lock { left:9px; top:0px; }
791
- .elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink { left:-7px; }
792
 
793
  /* file icon */
794
  .elfinder-cwd-view-list td .elfinder-cwd-icon {
@@ -802,6 +1472,38 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
802
  /* icon in ltr/rtl enviroment */
803
  .elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon { left:0; }
804
  .elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon { right:0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805
  /* File: /css/dialog.css */
806
  /*********************************************/
807
  /* DIALOGS STYLES */
@@ -814,6 +1516,15 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
814
  left:auto;
815
  right:auto;
816
  }
 
 
 
 
 
 
 
 
 
817
 
818
  /* titlebar */
819
  .std42-dialog .ui-dialog-titlebar {
@@ -829,26 +1540,138 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
829
  font-weight:normal;
830
  padding:.2em 1em;
831
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
832
 
833
- .std42-dialog .ui-dialog-titlebar-close,
834
- .std42-dialog .ui-dialog-titlebar-close:hover { padding:1px; }
 
 
 
 
 
 
 
 
835
 
836
  .elfinder-rtl .elfinder-dialog .ui-dialog-titlebar { text-align:right; }
837
- .elfinder-rtl .elfinder-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close { right:auto; left:.3em; }
838
 
839
  /* content */
840
  .std42-dialog .ui-dialog-content {
841
  padding:.3em .5em;
 
 
 
 
 
 
 
 
842
  }
843
 
844
  /* buttons */
845
  .std42-dialog .ui-dialog-buttonpane {
846
- border:0 solid;
847
- margin:0;
848
- padding:.5em .7em;
 
849
  }
 
850
 
851
- .std42-dialog .ui-dialog-buttonpane button { margin:0 0 0 .4em; padding:0; outline:0px solid; }
852
  .std42-dialog .ui-dialog-buttonpane button span { padding:2px 9px; }
853
  .std42-dialog .ui-dialog-buttonpane button span.ui-icon { padding: 2px; }
854
 
@@ -862,13 +1685,13 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
862
  position:absolute;
863
  width:32px;
864
  height:32px;
865
- left:12px;
866
  top:50%;
867
  margin-top:-15px;
868
  background:url("../img/dialogs.png") 0 0 no-repeat;
869
  }
870
 
871
- .elfinder-rtl .elfinder-dialog-icon { left:auto; right:12px;}
872
 
873
 
874
 
@@ -895,8 +1718,8 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
895
  overflow:hidden;
896
  }
897
 
898
- .elfinder-ltr .elfinder-notify { padding-left:30px; }
899
- .elfinder-rtl .elfinder-notify { padding-right:30px; }
900
 
901
  .elfinder-notify:last-child { border:0 solid; }
902
 
@@ -938,6 +1761,7 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
938
  .elfinder-dialog-icon-download { background-position: 0 -260px; }
939
  .elfinder-dialog-icon-save { background-position: 0 -295px; }
940
  .elfinder-dialog-icon-rename { background-position: 0 -330px; }
 
941
  .elfinder-dialog-icon-archive,
942
  .elfinder-dialog-icon-extract { background-position: 0 -365px; }
943
  .elfinder-dialog-icon-search { background-position: 0 -402px; }
@@ -947,15 +1771,21 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
947
  .elfinder-dialog-icon-netunmount,
948
  .elfinder-dialog-icon-chmod,
949
  .elfinder-dialog-icon-preupload,
 
950
  .elfinder-dialog-icon-dim { background-position: 0 -434px; }
951
 
952
  /*********************** CONFIRM DIALOG **************************/
953
 
954
- .elfinder-dialog-confirm-applyall { padding-top:3px; }
 
 
 
 
 
955
 
956
  .elfinder-dialog-confirm .elfinder-dialog-icon { background-position:0 -32px; }
957
 
958
-
959
 
960
  /*********************** FILE INFO DIALOG **************************/
961
 
@@ -997,15 +1827,27 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
997
  }
998
 
999
  .elfinder-netmount-tb { margin:0 auto; }
 
1000
  .elfinder-netmount-tb input { border:1px solid #ccc; }
 
 
 
 
 
 
 
1001
  /*********************** UPLOAD DIALOG **************************/
1002
 
1003
  .elfinder-upload-dropbox {
 
1004
  text-align:center;
1005
- padding:2em 0;
 
1006
  border:3px dashed #aaa;
1007
- height: 1em;
 
1008
  overflow: hidden;
 
1009
  }
1010
 
1011
  .elfinder-upload-dropbox.ui-state-hover {
@@ -1091,7 +1933,7 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1091
  display: none;
1092
  }
1093
  /* File: /css/fonts.css */
1094
- .elfinder-contextmenu .elfinder-contextmenu-item span { font-size:.76em; }
1095
 
1096
  .elfinder-cwd-view-icons .elfinder-cwd-filename { font-size:.7em; }
1097
  .elfinder-cwd-view-list td { font-size:.7em; }
@@ -1112,6 +1954,7 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1112
  .elfinder-button-search input { font-size:.8em; }
1113
  .elfinder-statusbar div { font-size:.7em; }
1114
  .elfinder-drag-num { font-size:12px; }
 
1115
 
1116
 
1117
  /* File: /css/navbar.css */
@@ -1127,19 +1970,7 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1127
  border-top:0 solid;
1128
  border-bottom:0 solid;
1129
  overflow:auto;
1130
- display:none;
1131
  position:relative;
1132
- -moz-user-select: none;
1133
- -khtml-user-select: none;
1134
- -webkit-user-select: none;
1135
- user-select: none;
1136
- -webkit-tap-highlight-color:rgba(0,0,0,0);
1137
- /* border:1px solid #111;*/
1138
- -webkit-touch-callout:none;
1139
- user-select: none;
1140
- -webkit-user-select: none;
1141
- -moz-user-select: none;
1142
- -khtml-user-select: none;
1143
  }
1144
 
1145
 
@@ -1168,7 +1999,7 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1168
  border:1px solid transparent;
1169
  cursor:default;
1170
  }
1171
- .elfinder-navbar-dir.elfinder-touch {
1172
  padding: 12px 12px;
1173
  }
1174
 
@@ -1188,6 +2019,26 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1188
  background-repeat:no-repeat;
1189
  /* border:1px solid #111;*/
1190
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1191
 
1192
  .ui-state-active .elfinder-navbar-arrow { background-image:url("../img/arrows-active.png"); }
1193
 
@@ -1195,8 +2046,8 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1195
  .elfinder-navbar-collapsed .elfinder-navbar-arrow { display:block; }
1196
 
1197
  /* arrow ltr/rtl enviroment */
1198
- .elfinder-ltr .elfinder-navbar-collapsed .elfinder-navbar-arrow { background-position: 0 4px; left:0; }
1199
- .elfinder-rtl .elfinder-navbar-collapsed .elfinder-navbar-arrow { background-position: 0 -10px; right:0; }
1200
  .elfinder-ltr .elfinder-navbar-expanded .elfinder-navbar-arrow,
1201
  .elfinder-rtl .elfinder-navbar-expanded .elfinder-navbar-arrow { background-position:0 -21px; }
1202
 
@@ -1222,19 +2073,20 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1222
  .elfinder-places .elfinder-navbar-root .elfinder-navbar-icon { background-position:0 -704px; }
1223
 
1224
  /* root icon of each volume */
1225
- .elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon { background-image:url("../img/volume_icon_local.png"); }
1226
- .elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon { background-image:url("../img/volume_icon_ftp.png"); }
1227
- .elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon { background-image:url("../img/volume_icon_sql.png"); }
1228
- .elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon { background-image:url("../img/volume_icon_dropbox.png"); }
 
 
 
 
1229
 
1230
  /* icon in active/hove/dropactive state */
1231
  .ui-state-active .elfinder-navbar-icon,
1232
  .elfinder-droppable-active .elfinder-navbar-icon,
1233
  .ui-state-hover .elfinder-navbar-icon { background-position:0 -32px; }
1234
 
1235
- /* subdirs tree */
1236
- .elfinder-navbar-subtree { display:none; }
1237
-
1238
  /* ltr/rtl enviroment */
1239
  .elfinder-ltr .elfinder-navbar-subtree { margin-left:12px; }
1240
  .elfinder-rtl .elfinder-navbar-subtree { margin-right:12px; }
@@ -1254,17 +2106,22 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1254
  .elfinder-ltr .elfinder-navbar-spinner { left:0; margin-left:-2px; }
1255
  .elfinder-rtl .elfinder-navbar-spinner { right:0; margin-right:-2px; }
1256
 
 
 
 
 
 
1257
  /* permissions marker */
1258
- .elfinder-navbar .elfinder-perms { top:50%; margin-top:-8px; }
1259
 
1260
  /* locked marker */
1261
  .elfinder-navbar .elfinder-lock { top:-2px; }
1262
 
1263
  /* permissions/symlink markers ltr/rtl enviroment */
1264
- .elfinder-ltr .elfinder-navbar .elfinder-perms { left: 18px; }
1265
- .elfinder-rtl .elfinder-navbar .elfinder-perms { right: 18px; }
1266
- .elfinder-ltr .elfinder-navbar .elfinder-lock { left: 18px; }
1267
- .elfinder-rtl .elfinder-navbar .elfinder-lock { right: 18px; }
1268
  .elfinder-ltr .elfinder-navbar .elfinder-symlink { left: 8px; }
1269
  .elfinder-rtl .elfinder-navbar .elfinder-symlink { right: 8px; }
1270
 
@@ -1289,12 +2146,32 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1289
  /*border:1px solid #8cafed;*/
1290
  }
1291
 
1292
-
1293
-
1294
-
1295
-
1296
-
1297
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1298
  /* File: /css/places.css */
1299
  /*********************************************/
1300
  /* PLACES STYLES */
@@ -1305,7 +2182,6 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1305
  top: 50%;
1306
  margin-top: -9px;
1307
  cursor: pointer;
1308
- display: none;
1309
  }
1310
  .elfinder-ltr .elfinder-places-root-icon {
1311
  right: 10px;
@@ -1327,7 +2203,6 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1327
  .elfinder-quicklook {
1328
  position:absolute;
1329
  background:url("../img/quicklook-bg.png");
1330
- display:none;
1331
  overflow:hidden;
1332
  border-radius:7px;
1333
  -moz-border-radius:7px;
@@ -1335,31 +2210,60 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1335
  padding:20px 0 40px 0;
1336
  }
1337
 
1338
- .elfinder-quicklook .ui-resizable-se {
 
 
 
 
1339
  width:14px;
1340
  height:14px;
1341
  right:5px;
1342
  bottom:3px;
1343
- background:url("../img/toolbar.png") 0 -496px no-repeat;}
 
 
 
 
1344
 
1345
  /* quicklook fullscreen window */
1346
- .elfinder-quicklook-fullscreen {
 
 
 
 
 
 
 
 
 
 
1347
  border-radius:0;
1348
  -moz-border-radius:0;
1349
  -webkit-border-radius:0;
1350
  -webkit-background-clip: padding-box;
1351
- /* background-clip:padding-box;*/
1352
  padding:0;
1353
  background:#000;
1354
- z-index:90000;
1355
  display:block;
1356
  }
1357
  /* hide titlebar in fullscreen mode */
1358
- .elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar { display:none; }
 
1359
 
1360
  /* hide preview border in fullscreen mode */
1361
  .elfinder-quicklook-fullscreen .elfinder-quicklook-preview { border:0 solid ;}
1362
 
 
 
 
 
 
 
 
 
 
 
 
 
1363
  /* quicklook titlebar */
1364
  .elfinder-quicklook-titlebar {
1365
  text-align:center;
@@ -1378,6 +2282,10 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1378
  cursor:move;
1379
  }
1380
 
 
 
 
 
1381
  /* window title */
1382
  .elfinder-quicklook-title {
1383
  color:#fff;
@@ -1386,6 +2294,10 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1386
  padding:2px 0;
1387
  }
1388
 
 
 
 
 
1389
  /* icon "close" in titlebar */
1390
  .elfinder-quicklook-titlebar .ui-icon {
1391
  position:absolute;
@@ -1397,15 +2309,23 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1397
  cursor:default;
1398
  }
1399
 
 
 
 
 
1400
  /* main part of quicklook window */
1401
  .elfinder-quicklook-preview {
1402
- overflow:hidden;
1403
  position:relative;
1404
  border:0 solid;
1405
  border-left:1px solid transparent;
1406
  border-right:1px solid transparent;
1407
  height:100%;
1408
  }
 
 
 
 
1409
 
1410
  /* wrapper for file info/icon */
1411
  .elfinder-quicklook-info-wrapper {
@@ -1471,6 +2391,8 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1471
  padding:5px;
1472
  border:1px solid #eee;
1473
  background:#000;
 
 
1474
  }
1475
 
1476
  /* show close icon in fullscreen mode */
@@ -1531,22 +2453,44 @@ div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
1531
  background:#fff;
1532
  color:#222;
1533
  overflow:auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1534
  }
1535
 
1536
  /* text preview */
1537
  pre.elfinder-quicklook-preview-text {
 
 
1538
  margin:0;
1539
  padding:3px 9px;
 
1540
  }
1541
 
1542
  /* html/pdf preview */
1543
  .elfinder-quicklook-preview-html,
1544
- .elfinder-quicklook-preview-pdf {
 
1545
  width:100%;
1546
  height:100%;
1547
  background:#fff;
1548
- border:0 solid;
1549
  margin:0;
 
 
1550
  }
1551
 
1552
  /* swf preview container */
@@ -1575,18 +2519,14 @@ embed.elfinder-quicklook-preview-audio {
1575
  height:100%;
1576
  }
1577
 
1578
-
1579
-
1580
-
1581
-
1582
-
1583
-
1584
-
1585
-
1586
-
1587
-
1588
-
1589
-
1590
 
1591
  /* File: /css/statusbar.css */
1592
  /******************************************************************/
@@ -1603,15 +2543,21 @@ embed.elfinder-quicklook-preview-audio {
1603
  border-right:0 solid transparent;
1604
  border-bottom:0 solid transparent;
1605
  border-left:0 solid transparent;
1606
-
1607
- -webkit-touch-callout:none;
1608
- user-select: none;
1609
- -webkit-user-select: none;
1610
- -moz-user-select: none;
1611
- -khtml-user-select: none;
1612
  }
1613
 
1614
- .elfinder-statusbar a { text-decoration:none; }
 
 
 
 
 
 
 
 
 
 
 
 
1615
 
1616
 
1617
 
@@ -1621,11 +2567,56 @@ embed.elfinder-quicklook-preview-audio {
1621
  white-space:nowrap;
1622
  overflow:hidden;
1623
  text-overflow:ellipsis;
1624
- -o-text-overflow:ellipsis;
1625
  }
1626
  .elfinder-ltr .elfinder-path { float:left; }
1627
  .elfinder-rtl .elfinder-path { float:right; }
1628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1629
  /* total/selected size in statusbar */
1630
  .elfinder-stat-size { white-space:nowrap; }
1631
  .elfinder-ltr .elfinder-stat-size { float:right; }
@@ -1633,6 +2624,83 @@ embed.elfinder-quicklook-preview-audio {
1633
 
1634
  .elfinder-stat-selected { white-space:nowrap; overflow:hidden; }
1635
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1636
  /* File: /css/toolbar.css */
1637
  /*********************************************/
1638
  /* TOOLBAR STYLES */
@@ -1660,7 +2728,7 @@ embed.elfinder-quicklook-preview-audio {
1660
 
1661
  /* button */
1662
  .elfinder .elfinder-button {
1663
- width:16px;
1664
  height:16px;
1665
  margin:0;
1666
  padding:4px;
@@ -1671,6 +2739,12 @@ embed.elfinder-quicklook-preview-audio {
1671
  -webkit-box-sizing: content-box;
1672
  -moz-box-sizing: content-box;
1673
  box-sizing: content-box;
 
 
 
 
 
 
1674
  }
1675
 
1676
  .elfinder .ui-icon-search { cursor:pointer;}
@@ -1704,9 +2778,14 @@ embed.elfinder-quicklook-preview-audio {
1704
  width:0;
1705
  }
1706
 
 
 
 
 
1707
  /* change icon opacity^ not button */
1708
  .elfinder .elfinder-button.ui-state-disabled { opacity:1; filter:Alpha(Opacity=100);}
1709
- .elfinder .elfinder-button.ui-state-disabled .elfinder-button-icon { opacity:.4; filter:Alpha(Opacity=40);}
 
1710
 
1711
  /* rtl enviroment */
1712
  .elfinder-rtl .elfinder-buttonset { float:right; }
@@ -1715,15 +2794,33 @@ embed.elfinder-quicklook-preview-audio {
1715
  .elfinder-button-icon {
1716
  width:16px;
1717
  height:16px;
1718
- display:block;
 
1719
  background:url('../img/toolbar.png') no-repeat;
1720
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1721
 
1722
  /* buttons icons */
1723
  .elfinder-button-icon-home { background-position: 0 0; }
1724
  .elfinder-button-icon-back { background-position: 0 -112px; }
1725
  .elfinder-button-icon-forward { background-position: 0 -128px; }
1726
  .elfinder-button-icon-up { background-position: 0 -144px; }
 
1727
  .elfinder-button-icon-opendir { background-position: 0 -32px; }
1728
  .elfinder-button-icon-reload { background-position: 0 -160px; }
1729
  .elfinder-button-icon-open { background-position: 0 -176px; }
@@ -1758,6 +2855,10 @@ embed.elfinder-quicklook-preview-audio {
1758
  .elfinder-button-icon-chmod { background-position: 0 -48px; }
1759
  .elfinder-button-icon-accept { background-position: 0 -736px; }
1760
  .elfinder-button-icon-opendir { background-position: 0 -32px; }
 
 
 
 
1761
 
1762
  /* button with dropdown menu*/
1763
  .elfinder .elfinder-menubutton { overflow:visible; }
@@ -1773,6 +2874,10 @@ embed.elfinder-quicklook-preview-audio {
1773
  padding:3px 0;
1774
  }
1775
 
 
 
 
 
1776
  /* menu item */
1777
  .elfinder-button-menu-item {
1778
  white-space:nowrap;
@@ -1780,6 +2885,9 @@ embed.elfinder-quicklook-preview-audio {
1780
  padding:5px 19px;
1781
  position:relative;
1782
  }
 
 
 
1783
 
1784
  /* fix hover ui class */
1785
  .elfinder-button-menu .ui-state-hover { border:0 solid; }
@@ -1797,8 +2905,8 @@ embed.elfinder-quicklook-preview-audio {
1797
  }
1798
 
1799
  .elfinder-button-menu-item-selected .ui-icon { display:block; }
1800
- .elfinder-button-menu-item-selected-asc .ui-icon-arrowthick-1-n { display:none; }
1801
- .elfinder-button-menu-item-selected-desc .ui-icon-arrowthick-1-s { display:none; }
1802
 
1803
  /* hack for upload button */
1804
  .elfinder-button form {
@@ -1828,6 +2936,7 @@ embed.elfinder-quicklook-preview-audio {
1828
  font-size: 8pt;
1829
  text-align: center;
1830
  width: 100%;
 
1831
  }
1832
 
1833
  .elfinder .elfinder-button-search .elfinder-button-menu div {
@@ -1858,17 +2967,28 @@ embed.elfinder-quicklook-preview-audio {
1858
  outline:0px solid;
1859
  }
1860
 
 
 
 
 
 
 
 
1861
  .elfinder-rtl .elfinder-button-search input { direction:rtl; }
1862
 
 
1863
  /* icons */
1864
  .elfinder-button-search .ui-icon {
1865
  position:absolute;
1866
  height:18px;
1867
  top: 50%;
1868
- margin:-9px 4px 0 4px;
1869
  opacity: .6;
1870
  filter:Alpha(Opacity=60);
1871
  }
 
 
 
1872
 
1873
  /* search/close icons */
1874
  .elfinder-ltr .elfinder-button-search .ui-icon-search { left:0;}
@@ -1876,8 +2996,19 @@ embed.elfinder-quicklook-preview-audio {
1876
  .elfinder-ltr .elfinder-button-search .ui-icon-close { right:0;}
1877
  .elfinder-rtl .elfinder-button-search .ui-icon-close { left:0;}
1878
 
1879
-
1880
-
1881
-
1882
-
 
 
 
 
 
 
 
 
 
 
 
1883
 
1
  /*!
2
  * elFinder - file manager for web
3
+ * Version 2.1.18 (2016-11-21)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
+ * Licensed under a 3-clauses BSD license
8
  */
9
 
10
  /* File: /css/commands.css */
15
  /********************** COMMAND "RESIZE" ****************************/
16
  .elfinder-dialog-resize { margin-top:.3em; }
17
  .elfinder-resize-type { float:left; margin-bottom: .4em; }
18
+ .elfinder-resize-control { float: left; }
19
+ .elfinder-resize-control input[type=text] {
20
+ border:1px solid #aaa;
21
+ text-align: right;
22
+ width: 4em;
23
+ }
24
+ .elfinder-resize-control input.elfinder-resize-bg {
25
+ text-align: center;
26
+ width: 5em;
27
+ direction: ltr;
28
+ }
29
+ .elfinder-dialog-resize .elfinder-resize-imgrotate,
30
+ .elfinder-dialog-resize .elfinder-resize-pallet {
31
+ cursor: pointer;
32
+ }
33
+ .elfinder-dialog-resize .elfinder-resize-picking {
34
+ cursor: crosshair;
35
+ }
36
+ .elfinder-dialog-resize .elfinder-resize-grid8 + button {
37
+ padding-top: 2px;
38
+ padding-bottom: 2px;
39
+ }
40
  .elfinder-resize-preview {
41
  width:400px;
42
  height:400px;
45
  border:1px solid #aaa;
46
  float:right;
47
  position:relative;
48
+ overflow:hidden;
49
+ text-align: left;
50
+ direction: ltr;
51
  }
52
 
53
  .elfinder-resize-handle { position:relative;}
143
  background:url(../img/progress.gif) center bottom repeat-x;
144
  }
145
 
146
+ .elfinder-resize-row { margin-bottom:9px; position:relative;}
147
 
148
  .elfinder-resize-label { float:left; width:80px; padding-top: 3px; }
149
 
150
+ .elfinder-resize-checkbox-label { border: 1px solid transparent; }
151
+
152
+ .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls {
153
+ margin: -20px 5px 0 5px;
154
+ }
155
+ .elfinder-ltr .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls {
156
+ float: right;
157
+ }
158
+ .elfinder-rtl .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls {
159
+ float: left;
160
  }
161
 
162
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-e,
163
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-w {
164
+ height:100%;
165
+ width:10px;
166
+ }
167
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-s,
168
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-n {
169
+ width:100%;
170
+ height:10px;
171
+ }
172
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-e { margin-right: -7px; }
173
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-w { margin-left: -7px; }
174
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-s { margin-bottom: -7px; }
175
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-n { margin-top: -7px; }
176
+
177
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-se,
178
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw,
179
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne,
180
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw {
181
+ width: 10px;
182
+ height: 10px;
183
+ }
184
  .elfinder-dialog .elfinder-dialog-resize .ui-resizable-se {
185
  background:transparent;
186
  bottom:0;
188
  margin-right:-7px;
189
  margin-bottom:-7px;
190
  }
191
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw {
192
+ margin-left: -7px;
193
+ margin-bottom: -7px;
194
+ }
195
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne {
196
+ margin-right:-7px;
197
+ margin-top:-7px;
198
+ }
199
+ .elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw {
200
+ margin-left: -7px;
201
+ margin-top: -7px;
202
+ }
203
 
204
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-s,
205
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-n {
206
+ height: 20px;
207
+ }
208
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-e,
209
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-w {
210
+ width: 20px;
211
+ }
212
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-se,
213
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw,
214
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne,
215
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw {
216
+ width: 30px;
217
+ height: 30px;
218
+ }
219
+ .elfinder-touch .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-preview .ui-resizable-se {
220
+ width: 30px;
221
+ height: 30px;
222
+ zoom: 1;
223
+ margin: 0;
224
+ }
225
  .elfinder-dialog-resize .ui-icon-grip-solid-vertical {
226
  position:absolute;
227
  top:50%;
237
  margin-bottom:-11px;;
238
  }
239
 
240
+ .elfinder-dialog-resize .elfinder-resize-row .ui-buttonset {
241
+ float:right;
242
+ }
243
 
244
+ .elfinder-dialog-resize .elfinder-resize-degree input,
245
+ .elfinder-dialog-resize .elfinder-resize-quality input {
246
+ width: 2.5em;
247
+ }
248
+ .elfinder-dialog-resize .elfinder-resize-degree button.ui-button {
249
+ padding: 6px 8px;
250
+ }
251
+ .elfinder-dialog-resize button.ui-button span {
252
+ padding: 0;
253
+ }
254
+
255
+ .ui-widget-content .elfinder-dialog-resize .elfinder-resize-rotate-slider {
256
  width: 195px;
257
+ margin: 10px 7px;
258
+ background-color: #fafafa;
259
+ }
260
+
261
+ .elfinder-dialog-resize .elfinder-resize-type span.ui-checkboxradio-icon {
262
+ display: none;
263
  }
264
 
265
  /********************** COMMAND "EDIT" ****************************/
266
  /* edit text file textarea */
267
  .elfinder-file-edit {
268
+ width:100%;
269
  height:99%;
270
  margin:0;
271
  padding:2px;
272
  border:1px solid #ccc;
273
+ box-sizing: border-box;
274
+ }
275
+ .elfinder-touch .elfinder-file-edit {
276
+ font-size: 16px;
277
  }
278
+ /* bottom margen for softkeyboard on fullscreen mode */
279
+ .elfinder-touch.elfinder-fullscreen-native textarea.elfinder-file-edit {
280
+ padding-bottom: 20em;
281
+ margin-bottom: -20em;
282
+ }
283
+
284
 
285
  /********************** COMMAND "SORT" ****************************/
286
  /* for list table header sort triangle icon */
289
  }
290
  div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
291
  position: absolute;
292
+ top: 4px;
293
  left: 0;
294
  right: 0;
295
  margin: auto 0px auto auto;
296
  }
297
+ .elfinder-touch div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
298
+ top: 7px;
299
+ }
300
+ .elfinder-rtl div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon {
301
+ margin: auto auto auto 0px;
302
+ }
303
  /********************** COMMAND "HELP" ****************************/
304
  /* help dialog */
305
  .elfinder-help { margin-bottom:.5em; }
384
  top:45px;
385
  }
386
 
387
+ .elfinder-help-debug {
388
+ height:auto;
389
+ padding:0;
390
+ margin:0;
391
+ overflow:none;
392
+ border: none;
393
+ }
394
+
395
+ .elfinder-help-debug .ui-tabs-panel {
396
+ height:310px;
397
+ padding: 0;
398
+ margin: 0;
399
+ overflow:auto;
400
+ }
401
+
402
+ .elfinder-help-debug fieldset {
403
+ margin-bottom: 10px;
404
+ border-color: #778899;
405
+ border-radius: 10px;
406
+ }
407
+
408
+ .elfinder-help-debug legend {
409
+ font-size: 1.2em;
410
+ font-weight: bold;
411
+ color: #2e8b57;
412
+ }
413
+
414
+ .elfinder-help-debug dl {
415
+ margin: 0;
416
+ }
417
+
418
+ .elfinder-help-debug dt {
419
+ color: #778899;
420
+ }
421
 
422
+ .elfinder-help-debug dt:before {
423
+ content: "[";
424
+ }
425
+ .elfinder-help-debug dt:after {
426
+ content: "]";
427
+ }
428
 
429
+ .elfinder-help-debug dd {
430
+ margin-left: 1em;
431
+ }
432
+
433
+ .elfinder-help-debug dd span {
434
+ /*font-size: 1.2em;*/
435
+ }
436
+
437
+ /********************** COMMAND "INFO" ****************************/
438
+ .elfinder-info-title .elfinder-cwd-bgurl:after {
439
+ left: -28px;
440
+ }
441
+ .elfinder-info-title .elfinder-cwd-icon-video:after {
442
+ left: -7px;
443
+ }
444
+
445
+ /********************** COMMAND "UPLOAD" ****************************/
446
+ .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect {
447
+ position: absolute;
448
+ bottom: 2px;
449
+ width: 16px;
450
+ height: 16px;
451
+ padding: 10px;
452
+ border: none;
453
+ overflow: hidden;
454
+ cursor: pointer;
455
+ }
456
+ .elfinder-ltr .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect {
457
+ left: 2px;
458
+ }
459
+ .elfinder-rtl .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect {
460
+ right: 2px;
461
+ }
462
 
463
  /* File: /css/common.css */
464
  /*********************************************/
465
  /* COMMON ELFINDER STUFFS */
466
  /*********************************************/
467
 
468
+ /* for old jQuery UI */
469
+ .ui-front {
470
+ z-index: 100;
471
+ }
472
+
473
  /* common container */
474
+ .elfinder {
475
+ padding: 0;
476
+ position:relative;
477
+ display:block;
478
+ font-size: 18px;
479
+ font-family: Verdana,Arial,Helvetica,sans-serif;
480
+ }
481
+
482
+ /* in lazy execution status */
483
+ .elfinder.elfinder-processing * {
484
+ cursor: progress !important
485
+ }
486
+ .elfinder.elfinder-processing.elfinder-touch .elfinder-workzone:after {
487
+ position: absolute;
488
+ top: 0;
489
+ width: 100%;
490
+ height: 3px;
491
+ content: '';
492
+ left: 0;
493
+ background-image: url(../img/progress.gif);
494
+ opacity: .6;
495
+ pointer-events: none;
496
+ }
497
+
498
+ /* for disable select of Touch devices */
499
+ .elfinder *:not(input):not(textarea):not(select):not([contenteditable=true]),
500
+ .elfinder-contextmenu *:not(input):not(textarea):not(select):not([contenteditable=true]) {
501
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
502
+ /*-webkit-touch-callout:none;*/
503
+ -webkit-user-select: none;
504
+ -moz-user-select: none;
505
+ -khtml-user-select: none;
506
+ user-select: none;
507
+ }
508
+
509
+ .elfinder .overflow-scrolling-touch {
510
+ -webkit-overflow-scrolling: touch;
511
+ }
512
 
513
  /* right to left enviroment */
514
  .elfinder-rtl { text-align:right; direction:rtl; }
543
  /* write only */
544
  .elfinder-wo .elfinder-perms { background-position:0 -80px;}
545
 
546
+ /* volume type group */
547
+ .elfinder-group .elfinder-perms { background-position:0 0px;}
548
+
549
  /* locked */
550
  .elfinder-lock {
551
  background-position:0 -656px;
553
 
554
  /* drag helper */
555
  .elfinder-drag-helper {
556
+ top: 0px;
557
+ left: 0px;
558
  width:70px;
559
  height:60px;
560
  padding:0 0 0 25px;
561
  z-index:100000;
562
+ will-change: left, top;
563
  }
564
  .elfinder-drag-helper.html5-native {
565
  position: absolute;
608
  /* icon in drag helper */
609
  .elfinder-drag-helper .elfinder-cwd-icon { margin:0 0 0 -24px; float:left; }
610
 
611
+ /* transparent overlay */
612
+ .elfinder-overlay {
613
+ position: absolute;
614
+ opacity: .2;
615
+ filter: Alpha(Opacity=20);
616
+ }
617
 
618
  /* panels under/below cwd (for search field etc) */
619
  .elfinder .elfinder-panel {
627
  -khtml-user-drag: element;
628
  }
629
 
630
+ /* for place holder to content editable elements */
631
+ .elfinder [contentEditable=true]:empty:not(:focus):before {
632
+ content:attr(data-ph);
633
+ }
634
+
635
+ /* bottom tray */
636
+ .elfinder div.elfinder-bottomtray {
637
+ position: fixed;
638
+ bottom: 0;
639
+ max-width:100%;
640
+ opacity: .8;
641
+ }
642
+ .elfinder.elfinder-ltr div.elfinder-bottomtray {
643
+ left: 0;
644
+ }
645
+ .elfinder.elfinder-rtl div.elfinder-bottomtray {
646
+ right: 0;
647
+ }
648
 
649
  /* File: /css/contextmenu.css */
650
  /* menu and submenu */
651
+ .elfinder .elfinder-contextmenu,
652
+ .elfinder .elfinder-contextmenu-sub {
 
653
  position:absolute;
654
  border:1px solid #aaa;
655
  background:#fff;
656
  color:#555;
657
  padding:4px 0;
658
+ top: 0;
659
+ left: 0;
660
  }
661
 
662
  /* submenu */
663
+ .elfinder .elfinder-contextmenu-sub { top:5px; }
664
  /* submenu in rtl/ltr enviroment */
665
+ .elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub { margin-left:-5px; }
666
+ .elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub { margin-right:-5px; }
667
 
668
  /* menu item */
669
+ .elfinder .elfinder-contextmenu-header {
670
+ margin-top: -4px;
671
+ padding: 0 .5em .2ex;
672
+ border: none;
673
+ text-align: center;
674
+ }
675
+ .elfinder .elfinder-contextmenu-header span {
676
+ font-weight: normal;
677
+ font-size: 0.8em;
678
+ font-weight: bolder;
679
+ }
680
+ .elfinder .elfinder-contextmenu-item {
681
  position:relative;
682
  display:block;
683
  padding:4px 30px;
685
  white-space:nowrap;
686
  cursor:default;
687
  }
688
+ .elfinder .elfinder-contextmenu-item.ui-state-active {
689
+ border: none;
690
+ }
691
+ .elfinder .elfinder-contextmenu-item .ui-icon {
692
  width:16px;
693
  height:16px;
694
  position:absolute;
695
+ left:auto;
696
+ right:auto;
697
  top:50%;
698
  margin-top:-8px;
 
699
  }
700
+ .elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item .ui-icon {
701
+ left: 2px;
702
+ }
703
+ .elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item .ui-icon {
704
+ right: 2px;
705
+ }
706
+ .elfinder-touch .elfinder-contextmenu-item {
707
+ padding:12px 38px;
708
  }
709
 
710
+ /* root icon of each volume */
711
+ .elfinder-navbar-root-local.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_local.png"); }
712
+ .elfinder-navbar-root-ftp.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_ftp.png"); }
713
+ .elfinder-navbar-root-sql.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_sql.png"); }
714
+ .elfinder-navbar-root-dropbox.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_dropbox.png"); }
715
+ .elfinder-navbar-root-googledrive.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_googledrive.png"); }
716
+ .elfinder-navbar-root-onedrive.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_onedrive.png"); }
717
+ .elfinder-navbar-root-box.elfinder-contextmenu-icon { background-image:url("../img/volume_icon_box.png"); }
718
 
719
+ /* text in item */
720
+ .elfinder .elfinder-contextmenu .elfinder-contextmenu-item span { display:block; }
721
 
722
  /* submenu item in rtl/ltr enviroment */
723
+ .elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item { text-align:left; }
724
+ .elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item { text-align:right; }
725
+ .elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextmenu-item { padding-left:12px; }
726
+ .elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextmenu-item { padding-right:12px; }
727
 
728
  /* command/submenu icon */
729
+ .elfinder .elfinder-contextmenu-extra-icon,
730
+ .elfinder .elfinder-contextmenu-arrow,
731
+ .elfinder .elfinder-contextmenu-icon {
732
  position:absolute;
733
  top:50%;
734
  margin-top:-8px;
736
  }
737
 
738
  /* command icon in rtl/ltr enviroment */
739
+ .elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-icon { left:8px; }
740
+ .elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-icon { right:8px; }
741
+ .elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-extra-icon { right:8px; }
742
+ .elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-extra-icon { left:8px; }
743
 
744
  /* arrow icon */
745
+ .elfinder .elfinder-contextmenu-arrow {
746
  width:16px;
747
  height:16px;
748
  background:url('../img/arrows-normal.png') 5px 4px no-repeat;
749
  }
750
 
751
  /* arrow icon in rtl/ltr enviroment */
752
+ .elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-arrow { right:5px; }
753
+ .elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-arrow { left:5px; background-position: 0 -10px; }
754
 
755
  /* command extra icon's <a>, <span> tag */
756
+ .elfinder .elfinder-contextmenu-extra-icon a,
757
+ .elfinder .elfinder-contextmenu-extra-icon span {
758
  display: inline-block;
759
  width: 100%;
760
  height: 100%;
766
  }
767
 
768
  /* disable ui border/bg image on hover */
769
+ .elfinder .elfinder-contextmenu .ui-state-hover { border:0 solid; background-image:none;}
770
 
771
  /* separator */
772
+ .elfinder .elfinder-contextmenu-separator {
773
  height:0px;
774
  border-top:1px solid #ccc;
775
  margin:0 1px;
776
  }
777
 
778
+ /* for CSS style priority to ui-state-disabled - "background-image: none" */
779
+ .elfinder .elfinder-button-icon.ui-state-disabled {
780
+ background-image: url('../img/toolbar.png') !important;
781
+ }
782
  /* File: /css/cwd.css */
783
  /******************************************************************/
784
  /* CURRENT DIRECTORY STYLES */
801
  margin:0;
802
  -ms-touch-action: auto;
803
  touch-action: auto;
 
 
 
 
 
 
 
 
 
 
804
  }
805
 
806
  /* container active on dropenter */
820
  text-align: center;
821
  white-space: pre-wrap;
822
  opacity: 0.6;
823
+ filter: Alpha(Opacity=60);
824
  font-weight: bold;
825
  }
826
 
827
+ .elfinder-cwd-file .elfinder-cwd-select {
828
+ position: absolute;
829
+ top: 0px;
830
+ left: 0px;
831
+ width: 30px;
832
+ height: 30px;
833
+ background-color: transparent;
834
+ opacity: .4;
835
+ filter:Alpha(Opacity=40);
836
+ }
837
+
838
+ .elfinder-cwd-file.ui-selected .elfinder-cwd-select {
839
+ opacity: .8;
840
+ filter:Alpha(Opacity=80);
841
+ }
842
+ .elfinder-rtl .elfinder-cwd-file .elfinder-cwd-select {
843
+ left: auto;
844
+ right: 0px;
845
+ }
846
+
847
+ .elfinder .elfinder-cwd-selectall {
848
+ position: absolute;
849
+ width: 30px;
850
+ height: 30px;
851
+ top: 0px;
852
+ opacity: .8;
853
+ filter:Alpha(Opacity=80);
854
+ }
855
+
856
+ .elfinder .elfinder-workzone.elfinder-cwd-wrapper-empty .elfinder-cwd-selectall {
857
+ display: none;
858
+ }
859
 
860
  /************************** ICONS VIEW ********************************/
861
 
862
+ .elfinder-ltr .elfinder-workzone .elfinder-cwd-selectall {
863
+ text-align: right;
864
+ right: 18px;
865
+ left: auto;
866
+ }
867
+
868
+ .elfinder-rtl .elfinder-workzone .elfinder-cwd-selectall {
869
+ text-align: left;
870
+ right: auto;
871
+ left: 18px;
872
+ }
873
+
874
+ .elfinder-ltr.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall {
875
+ right: 0px;
876
+ }
877
+
878
+ .elfinder-rtl.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall {
879
+ left: 0px;
880
+ }
881
+
882
+ .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select.ui-state-hover {
883
+ background-color: transparent;
884
+ }
885
+
886
  /* file container */
887
  .elfinder-cwd-view-icons .elfinder-cwd-file {
888
  width:120px;
891
  cursor:default;
892
  border:none;
893
  /* overflow:hidden;*/
894
+ position:relative;
895
  }
896
 
897
+ /*.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select {
898
+ top: 0px;
899
+ left: 0px;
900
+ }*/
901
+
902
+ /*.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select {
903
+ left: auto;
904
+ right: 7px;
905
+ }*/
906
+
907
  /* ltr/rtl enviroment */
908
  .elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file { float:left; margin:0 3px 12px 0; }
909
  .elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file { float:right; margin:0 0 5px 3px; }
922
 
923
  /* file name place */
924
  .elfinder-cwd-view-icons .elfinder-cwd-filename {
925
+ text-align: center;
926
+ max-height: 2.4em;
927
+ line-height: 1.2em;
928
+ white-space: pre-line;
929
+ overflow: hidden;
930
+ text-overflow: ellipsis;
931
+ -o-text-overflow: ellipsis;
932
+ margin: 3px 1px 0 1px;
933
+ padding: 1px;
934
  -moz-border-radius: 8px;
935
  -webkit-border-radius: 8px;
936
  border-radius: 8px;
937
+ /* for webkit CSS3 */
938
+ word-break: break-word;
939
+ overflow-wrap: break-word;
940
+ display: -webkit-box;
941
+ -webkit-line-clamp: 2;
942
+ -webkit-box-orient: vertical;
943
  }
944
 
945
  /* permissions/symlink markers */
959
  background-clip: padding-box;
960
  }
961
 
962
+ /* volume icon of root in folder */
963
+ .elfinder-navbar-root-local .elfinder-cwd-icon,
964
+ .elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon,
965
+ .elfinder-cwd-view-list .elfinder-navbar-root-local td .elfinder-cwd-icon {
966
+ background-image:url("../img/volume_icon_local.png");
967
+ background-position:0 0;
968
+ background-size: contain;
969
+ }
970
+ .elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon {
971
+ background-position:1px -1px;
972
+ }
973
+ .elfinder-navbar-root-ftp .elfinder-cwd-icon,
974
+ .elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon,
975
+ .elfinder-cwd-view-list .elfinder-navbar-root-ftp td .elfinder-cwd-icon {
976
+ background-image:url("../img/volume_icon_ftp.png");
977
+ background-position:0 0;
978
+ background-size: contain;
979
+ }
980
+ .elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon {
981
+ background-position:1px -1px;
982
+ }
983
+ .elfinder-navbar-root-sql .elfinder-cwd-icon,
984
+ .elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon,
985
+ .elfinder-cwd-view-list .elfinder-navbar-root-sql td .elfinder-cwd-icon {
986
+ background-image:url("../img/volume_icon_sql.png");
987
+ background-position:0 0;
988
+ background-size: contain;
989
+ }
990
+ .elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon {
991
+ background-position:1px -1px;
992
+ }
993
+ .elfinder-navbar-root-dropbox .elfinder-cwd-icon,
994
+ .elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon,
995
+ .elfinder-cwd-view-list .elfinder-navbar-root-dropbox td .elfinder-cwd-icon {
996
+ background-image:url("../img/volume_icon_dropbox.png");
997
+ background-position:0 0;
998
+ background-size: contain;
999
+ }
1000
+ .elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon {
1001
+ background-position:1px -1px;
1002
+ }
1003
+ .elfinder-navbar-root-googledrive .elfinder-cwd-icon,
1004
+ .elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon,
1005
+ .elfinder-cwd-view-list .elfinder-navbar-root-googledrive td .elfinder-cwd-icon {
1006
+ background-image:url("../img/volume_icon_googledrive.png");
1007
+ background-position:0 0;
1008
+ background-size: contain;
1009
+ }
1010
+ .elfinder-navbar-root-onedrive .elfinder-cwd-icon,
1011
+ .elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon,
1012
+ .elfinder-cwd-view-list .elfinder-navbar-root-onedrive td .elfinder-cwd-icon {
1013
+ background-image:url("../img/volume_icon_onedrive.png");
1014
+ background-position:0 0;
1015
+ background-size: contain;
1016
+ }
1017
+ .elfinder-navbar-root-box .elfinder-cwd-icon,
1018
+ .elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon,
1019
+ .elfinder-cwd-view-list .elfinder-navbar-root-box td .elfinder-cwd-icon {
1020
+ background-image:url("../img/volume_icon_box.png");
1021
+ background-position:0 0;
1022
+ background-size: contain;
1023
+ }
1024
+ .elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon,
1025
+ .elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon,
1026
+ .elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon {
1027
+ background-position:1px -1px;
1028
+ }
1029
+ .elfinder-navbar-root-network .elfinder-cwd-icon,
1030
+ .elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon,
1031
+ .elfinder-cwd-view-list .elfinder-navbar-root-network td .elfinder-cwd-icon {
1032
+ background-image:url("../img/toolbar.png");
1033
+ background-position: 0 86%;
1034
+ background-size: cover;
1035
+ }
1036
+ .elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon {
1037
+ background-position:1px -1px;
1038
+ }
1039
+
1040
+ /* thumbnail image */
1041
+ .elfinder-cwd-icon.elfinder-cwd-bgurl {
1042
+ background-position: center center;
1043
+ background-repeat: no-repeat;
1044
+ -moz-background-size: contain;
1045
+ background-size: contain;
1046
+ }
1047
+ /* thumbnail self */
1048
+ .elfinder-cwd-icon.elfinder-cwd-bgurl.elfinder-cwd-bgself {
1049
+ -moz-background-size: cover;
1050
+ background-size: cover;
1051
+ }
1052
+ /* thumbnail crop*/
1053
+ .elfinder-cwd-icon.elfinder-cwd-bgurl {
1054
+ -moz-background-size: cover;
1055
+ background-size: cover;
1056
+ }
1057
+ .elfinder-cwd-bgurl:after {
1058
+ content: ' ';
1059
+ position: relative;
1060
+ display: inline-block;
1061
+ top: 36px;
1062
+ left: -38px;
1063
+ width: 48px;
1064
+ height: 48px;
1065
+ background: url('../img/icons-big.png') 0 0 no-repeat;
1066
+ background-size: auto !important;
1067
+ opacity: .8;
1068
+ filter: Alpha(Opacity=60);
1069
+ -webkit-transform-origin: 54px -24px;
1070
+ -webkit-transform: scale(.6);
1071
+ -moz-transform-origin: 54px -24px;
1072
+ -moz-transform: scale(.6);
1073
+ -ms-transform-origin: 54px -24px;
1074
+ -ms-transform: scale(.6);
1075
+ -o-transform-origin: 54px -24px;
1076
+ -o-transform: scale(.6);
1077
+ transform-origin: 54px -24px;
1078
+ transform: scale(.6);
1079
+ }
1080
+ /* thumbnail image overlay none */
1081
+ .elfinder-cwd-icon-image:after {
1082
+ content: none;
1083
+ }
1084
+ /* thumbnail image video overlay */
1085
+ .elfinder-cwd-icon-video:after {
1086
+ top: 32px;
1087
+ left: -26px;
1088
+ height: 25px;
1089
+ width: 22px;
1090
+ background-position: 0px -373px;
1091
+ -webkit-transform: scale(1);
1092
+ -moz-transform: scale(1);
1093
+ -ms-transform: scale(1);
1094
+ -o-transform: scale(1);
1095
+ transform: scale(1);
1096
+ }
1097
+
1098
  /* "opened folder" icon on dragover */
1099
  .elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon { background-position: 0 -100px; }
1100
+ .elfinder-cwd .elfinder-droppable-active {
1101
+ outline: 2px solid #8cafed;
1102
+ outline-offset: -2px;
1103
+ }
1104
 
1105
  /* mimetypes icons */
1106
  .elfinder-cwd-icon-directory { background-position:0 -50px; }
1107
+
1108
+ .elfinder-cwd-icon-application:after,
1109
  .elfinder-cwd-icon-application { background-position:0 -150px; }
1110
+
1111
+ .elfinder-cwd-icon-x-empty:after,
1112
+ .elfinder-cwd-icon-text:after,
1113
  .elfinder-cwd-icon-x-empty,
1114
  .elfinder-cwd-icon-text { background-position:0 -200px; }
1115
+
1116
+ .elfinder-cwd-icon-image:after,
1117
+ .elfinder-cwd-icon-vnd-adobe-photoshop:after,
1118
+ .elfinder-cwd-icon-postscript:after,
1119
  .elfinder-cwd-icon-image,
1120
  .elfinder-cwd-icon-vnd-adobe-photoshop,
1121
  .elfinder-cwd-icon-postscript { background-position:0 -250px; }
1122
+
1123
+ .elfinder-cwd-icon-audio:after,
1124
  .elfinder-cwd-icon-audio { background-position:0 -300px; }
1125
+
1126
  .elfinder-cwd-icon-video,
1127
  .elfinder-cwd-icon-flash-video { background-position:0 -350px; }
1128
+
1129
+ .elfinder-cwd-icon-rtf:after,
1130
+ .elfinder-cwd-icon-rtfd:after,
1131
  .elfinder-cwd-icon-rtf,
1132
  .elfinder-cwd-icon-rtfd { background-position: 0 -401px; }
1133
+
1134
+ .elfinder-cwd-icon-pdf:after,
1135
  .elfinder-cwd-icon-pdf { background-position: 0 -450px; }
1136
+
1137
+ .elfinder-cwd-icon-ms-excel:after,
1138
+ .elfinder-cwd-icon-msword:after,
1139
+ .elfinder-cwd-icon-vnd-ms-excel:after,
1140
+ .elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12:after,
1141
+ .elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12:after,
1142
+ .elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12:after,
1143
+ .elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12:after,
1144
+ .elfinder-cwd-icon-vnd-ms-office:after,
1145
+ .elfinder-cwd-icon-vnd-ms-powerpoint:after,
1146
+ .elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12:after,
1147
+ .elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12:after,
1148
+ .elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12:after,
1149
+ .elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12:after,
1150
+ .elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12:after,
1151
+ .elfinder-cwd-icon-vnd-ms-word:after,
1152
+ .elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12:after,
1153
+ .elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12:after,
1154
+ .elfinder-cwd-icon-vnd-oasis-opendocument-chart:after,
1155
+ .elfinder-cwd-icon-vnd-oasis-opendocument-database:after,
1156
+ .elfinder-cwd-icon-vnd-oasis-opendocument-formula:after,
1157
+ .elfinder-cwd-icon-vnd-oasis-opendocument-graphics:after,
1158
+ .elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template:after,
1159
+ .elfinder-cwd-icon-vnd-oasis-opendocument-image:after,
1160
+ .elfinder-cwd-icon-vnd-oasis-opendocument-presentation:after,
1161
+ .elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template:after,
1162
+ .elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet:after,
1163
+ .elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template:after,
1164
+ .elfinder-cwd-icon-vnd-oasis-opendocument-text:after,
1165
+ .elfinder-cwd-icon-vnd-oasis-opendocument-text-master:after,
1166
+ .elfinder-cwd-icon-vnd-oasis-opendocument-text-template:after,
1167
+ .elfinder-cwd-icon-vnd-oasis-opendocument-text-web:after,
1168
+ .elfinder-cwd-icon-vnd-openofficeorg-extension:after,
1169
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation:after,
1170
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide:after,
1171
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow:after,
1172
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template:after,
1173
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet:after,
1174
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template:after,
1175
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document:after,
1176
+ .elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template:after,
1177
  .elfinder-cwd-icon-ms-excel,
1178
  .elfinder-cwd-icon-msword,
1179
  .elfinder-cwd-icon-vnd-ms-excel,
1214
  .elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template,
1215
  .elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document,
1216
  .elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template { background-position: 0 -500px; }
1217
+
1218
+ .elfinder-cwd-icon-html:after,
1219
  .elfinder-cwd-icon-html { background-position: 0 -550px; }
1220
+
1221
+ .elfinder-cwd-icon-css:after,
1222
  .elfinder-cwd-icon-css { background-position: 0 -600px; }
1223
+
1224
+ .elfinder-cwd-icon-javascript:after,
1225
+ .elfinder-cwd-icon-x-javascript:after,
1226
  .elfinder-cwd-icon-javascript,
1227
  .elfinder-cwd-icon-x-javascript { background-position: 0 -650px; }
1228
+
1229
+ .elfinder-cwd-icon-x-perl:after,
1230
  .elfinder-cwd-icon-x-perl { background-position: 0 -700px; }
1231
+
1232
+ .elfinder-cwd-icon-x-python:after,
1233
  .elfinder-cwd-icon-x-python { background-position: 0 -750px; }
1234
+
1235
+ .elfinder-cwd-icon-x-ruby:after,
1236
  .elfinder-cwd-icon-x-ruby { background-position: 0 -800px; }
1237
+
1238
+
1239
+ .elfinder-cwd-icon-x-sh:after,
1240
+ .elfinder-cwd-icon-x-shellscript:after,
1241
  .elfinder-cwd-icon-x-sh,
1242
  .elfinder-cwd-icon-x-shellscript { background-position: 0 -850px; }
1243
+
1244
+ .elfinder-cwd-icon-x-c:after,
1245
+ .elfinder-cwd-icon-x-csrc:after,
1246
+ .elfinder-cwd-icon-x-chdr:after,
1247
+ .elfinder-cwd-icon-x-c--:after,
1248
+ .elfinder-cwd-icon-x-c--src:after,
1249
+ .elfinder-cwd-icon-x-c--hdr:after,
1250
+ .elfinder-cwd-icon-x-java:after,
1251
+ .elfinder-cwd-icon-x-java-source:after,
1252
  .elfinder-cwd-icon-x-c,
1253
  .elfinder-cwd-icon-x-csrc,
1254
  .elfinder-cwd-icon-x-chdr,
1257
  .elfinder-cwd-icon-x-c--hdr,
1258
  .elfinder-cwd-icon-x-java,
1259
  .elfinder-cwd-icon-x-java-source { background-position: 0 -900px; }
1260
+
1261
+ .elfinder-cwd-icon-x-php:after,
1262
  .elfinder-cwd-icon-x-php { background-position: 0 -950px; }
1263
+
1264
+ .elfinder-cwd-icon-xml:after,
1265
  .elfinder-cwd-icon-xml { background-position: 0 -1000px; }
1266
+
1267
+ .elfinder-cwd-icon-zip:after,
1268
+ .elfinder-cwd-icon-x-zip:after,
1269
+ .elfinder-cwd-icon-x-xz:after,
1270
+ .elfinder-cwd-icon-x-7z-compressed:after,
1271
  .elfinder-cwd-icon-zip,
1272
  .elfinder-cwd-icon-x-zip,
1273
  .elfinder-cwd-icon-x-xz,
1274
  .elfinder-cwd-icon-x-7z-compressed { background-position: 0 -1050px; }
1275
+
1276
+ .elfinder-cwd-icon-x-gzip:after,
1277
+ .elfinder-cwd-icon-x-tar:after,
1278
  .elfinder-cwd-icon-x-gzip,
1279
  .elfinder-cwd-icon-x-tar { background-position: 0 -1100px; }
1280
+
1281
+ .elfinder-cwd-icon-x-bzip:after,
1282
+ .elfinder-cwd-icon-x-bzip2:after,
1283
  .elfinder-cwd-icon-x-bzip,
1284
  .elfinder-cwd-icon-x-bzip2 { background-position: 0 -1150px; }
1285
+
1286
+ .elfinder-cwd-icon-x-rar:after,
1287
+ .elfinder-cwd-icon-x-rar-compressed:after,
1288
  .elfinder-cwd-icon-x-rar,
1289
  .elfinder-cwd-icon-x-rar-compressed { background-position: 0 -1200px; }
1290
+
1291
+ .elfinder-cwd-icon-x-shockwave-flash:after,
1292
  .elfinder-cwd-icon-x-shockwave-flash { background-position: 0 -1250px; }
1293
+
1294
  .elfinder-cwd-icon-group { background-position:0 -1300px;}
1295
 
1296
  /* textfield inside icon */
1297
+ .elfinder-cwd-filename input { width:100%; border:none; margin:0; padding:0; }
1298
  .elfinder-cwd-view-icons input {text-align:center; }
1299
  .elfinder-cwd-view-icons textarea {
1300
  width: 100%;
1313
 
1314
  /*.elfinder-cwd-view-list { padding:0 0 4px 0; }*/
1315
 
1316
+ .elfinder-cwd-wrapper.elfinder-cwd-fixheader .elfinder-cwd::after {
1317
+ display: none;
1318
+ }
1319
+
1320
  .elfinder-cwd table {
1321
  width: 100%;
1322
  border-collapse: separate;
1325
  border-spacing: 0;
1326
  box-sizing: padding-box;
1327
  padding: 2px;
1328
+ position: relative;
1329
+ }
1330
+
1331
+ .elfinder-cwd-wrapper-list.elfinder-cwd-fixheader {
1332
+ position: absolute;
1333
+ overflow: hidden;
1334
+ }
1335
+
1336
+ .elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before {
1337
+ content: '';
1338
+ position: absolute;
1339
+ width: 100%;
1340
+ top: 0;
1341
+ height: 3px;
1342
+ background-color: white;
1343
  }
1344
+ .elfinder-droppable-active + .elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before {
1345
+ background-color: #8cafed;
1346
+ }
1347
+
1348
+ .elfinder .elfinder-workzone div.elfinder-cwd-fixheader table {
1349
+ table-layout: fixed;
1350
+ }
1351
+
1352
+ .elfinder .elfinder-cwd table tbody.elfinder-cwd-fixheader {
1353
+ position: relative;
1354
+ }
1355
+
1356
+ .elfinder-ltr .elfinder-cwd thead .elfinder-cwd-selectall {
1357
+ text-align: left;
1358
+ right: auto;
1359
+ left: 0px;
1360
+ padding-top: 3px;
1361
+ }
1362
+
1363
+ .elfinder-rtl .elfinder-cwd thead .elfinder-cwd-selectall {
1364
+ text-align: right;
1365
+ right: 0px;
1366
+ left: auto;
1367
+ padding-top: 3px;
1368
+ }
1369
+
1370
+ .elfinder-touch .elfinder-cwd thead .elfinder-cwd-selectall {
1371
+ padding-top: 5px;
1372
+ }
1373
+
1374
  .elfinder .elfinder-cwd table thead tr { border-left:0 solid; border-top:0 solid; border-right:0 solid; }
1375
 
1376
  .elfinder .elfinder-cwd table thead td {
1377
  padding: 4px 14px;
1378
  }
1379
+ .elfinder-ltr .elfinder-cwd.elfinder-has-checkbox table thead td:first-child {
1380
+ padding: 4px 14px 4px 22px;
1381
+ }
1382
+ .elfinder-rtl .elfinder-cwd.elfinder-has-checkbox table thead td:first-child {
1383
+ padding: 4px 22px 4px 14px;
1384
+ }
1385
+
1386
  .elfinder .elfinder-cwd table thead td.ui-state-active {
1387
  background: #ebf1f6;
1388
  background: -moz-linear-gradient(top, #ebf1f6 0%, #abd3ee 50%, #89c3eb 51%, #d5ebfb 100%);
1403
  border:0 solid;
1404
  }
1405
 
1406
+ .elfinder .elfinder-cwd table tbody td:first-child {
1407
+ position: relative
1408
+ }
1409
+
1410
  .elfinder .elfinder-cwd table td div {
1411
  box-sizing: content-box;
1412
  }
1413
 
1414
+ tr.elfinder-cwd-file td .elfinder-cwd-select {
1415
+ width: 40px;
1416
+ padding-top: 3px;
1417
+ }
1418
+
1419
+ .elfinder-touch tr.elfinder-cwd-file td .elfinder-cwd-select {
1420
+ padding-top: 10px;
1421
+ }
1422
+
1423
+ .elfinder-touch .elfinder-cwd tr td {
1424
  padding: 10px 12px;
1425
  }
1426
 
1427
+ .elfinder-touch .elfinder-cwd table thead td {
1428
+ padding: 8px 14px;
1429
+ }
1430
+
1431
+ .elfinder-touch .elfinder-cwd tr.elfinder-cwd-file td {
1432
  padding: 13px 12px;
1433
  }
1434
 
1442
  /* filename container */
1443
  .elfinder-cwd-view-list .elfinder-cwd-file-wrapper { width:97%; position:relative; }
1444
  /* filename container in ltr/rtl enviroment */
1445
+ .elfinder-ltr .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper { margin-left: 8px; }
1446
+ .elfinder-rtl .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper { margin-right: 8px; }
1447
+ .elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-filename { padding-left:23px; }
1448
+ .elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-filename { padding-right:23px; }
1449
 
1450
  /* premissions/symlink marker */
1451
  .elfinder-cwd-view-list .elfinder-perms,
1452
  .elfinder-cwd-view-list .elfinder-lock,
1453
+ .elfinder-cwd-view-list .elfinder-symlink {
1454
+ margin-top:-6px;
1455
+ opacity: .6;
1456
+ filter:Alpha(Opacity=60);
1457
+ }
1458
  /* markers in ltr/rtl enviroment */
1459
+ .elfinder-ltr .elfinder-cwd-view-list .elfinder-perms { left:8px; bottom:-4px; }
1460
+ .elfinder-ltr .elfinder-cwd-view-list .elfinder-lock { left:10px; top:0px; }
1461
+ .elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink { left:-7px; bottom:-4px; }
1462
 
1463
  /* file icon */
1464
  .elfinder-cwd-view-list td .elfinder-cwd-icon {
1472
  /* icon in ltr/rtl enviroment */
1473
  .elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon { left:0; }
1474
  .elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon { right:0; }
1475
+
1476
+ /* thumbnail image video overlay */
1477
+ .elfinder-cwd-view-list .elfinder-cwd-icon.elfinder-cwd-icon-video.elfinder-cwd-bgurl:after {
1478
+ content: none;
1479
+ }
1480
+
1481
+ /* table header resize handle */
1482
+ .elfinder-cwd-view-list thead td .ui-resizable-handle {
1483
+ height: 100%;
1484
+ top: 3px;
1485
+ }
1486
+ .elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-handle {
1487
+ top: -5px;
1488
+ margin: 10px;
1489
+ }
1490
+ .elfinder-cwd-view-list thead td .ui-resizable-e {
1491
+ right: -7px;
1492
+ }
1493
+ .elfinder-cwd-view-list thead td .ui-resizable-w {
1494
+ left: -7px;
1495
+ }
1496
+ .elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-e {
1497
+ right: -16px;
1498
+ }
1499
+ .elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-w {
1500
+ left: -16px;
1501
+ }
1502
+
1503
+ /* empty message */
1504
+ .elfinder-cwd-wrapper-empty .elfinder-cwd-view-list.elfinder-cwd:after {
1505
+ margin-top: 0;
1506
+ }
1507
  /* File: /css/dialog.css */
1508
  /*********************************************/
1509
  /* DIALOGS STYLES */
1516
  left:auto;
1517
  right:auto;
1518
  }
1519
+ .std42-dialog.elfinder-dialog-minimized {
1520
+ overFlow: hidden;
1521
+ position: relative;
1522
+ float: left;
1523
+ width: auto;
1524
+ }
1525
+ .elfinder-rtl .std42-dialog.elfinder-dialog-minimized {
1526
+ float: right;
1527
+ }
1528
 
1529
  /* titlebar */
1530
  .std42-dialog .ui-dialog-titlebar {
1540
  font-weight:normal;
1541
  padding:.2em 1em;
1542
  }
1543
+ .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar {
1544
+ padding: 0 .5em;
1545
+ height: 20px;
1546
+ }
1547
+ .elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar {
1548
+ padding:.3em .5em;
1549
+ }
1550
+ .std42-dialog.ui-draggable-disabled .ui-dialog-titlebar {
1551
+ cursor: default;
1552
+ }
1553
+
1554
+ .std42-dialog .ui-dialog-titlebar .ui-widget-header {
1555
+ border : none;
1556
+ cursor: pointer;
1557
+ }
1558
+
1559
+ .std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title {
1560
+ display: inherit;
1561
+ word-break: break-all;
1562
+ }
1563
+ .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title {
1564
+ display: list-item;
1565
+ display: -moz-inline-box;
1566
+ white-space: nowrap;
1567
+ word-break: normal;
1568
+ overflow: hidden;
1569
+ word-wrap: normal;
1570
+ overflow-wrap: normal;
1571
+ max-width: -webkit-calc(100% - 24px);
1572
+ max-width: -moz-calc(100% - 24px);
1573
+ max-width: calc(100% - 24px);
1574
+ }
1575
+ .elfinder-touch .std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title {
1576
+ padding-top: .15em;
1577
+ }
1578
+ .elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title {
1579
+ max-width: -webkit-calc(100% - 36px);
1580
+ max-width: -moz-calc(100% - 36px);
1581
+ max-width: calc(100% - 36px);
1582
+ }
1583
+
1584
+ .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button {
1585
+ position: relative;
1586
+ float: left;
1587
+ top: 10px;
1588
+ left: -10px;
1589
+ right: 10px;
1590
+ width: 20px;
1591
+ height: 20px;
1592
+ padding:1px;
1593
+ margin: -10px 1px 0 1px;
1594
+ background-color: transparent;
1595
+ background-image: none;
1596
+ }
1597
+ .elfinder-touch .std42-dialog/*:not(.elfinder-dialog-minimized)*/ .ui-dialog-titlebar .elfinder-titlebar-button {
1598
+ transform: scale(1.1);
1599
+ zoom: 1.1;
1600
+ margin-left: 5px;
1601
+ margin-right: 5px;
1602
+ }
1603
+ .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right {
1604
+ float: right;
1605
+ left: 10px;
1606
+ right: -10px;
1607
+ }
1608
+ .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon {
1609
+ width: 17px;
1610
+ height: 17px;
1611
+ border-width: 1px;
1612
+ border-color: transparent;
1613
+ opacity: .7;
1614
+ filter:Alpha(Opacity=70);
1615
+ -moz-border-radius: 8px;
1616
+ -webkit-border-radius: 8px;
1617
+ border-radius: 8px;
1618
+ }
1619
+ .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon {
1620
+ opacity: 1;
1621
+ filter:Alpha(Opacity=100);
1622
+ }
1623
+ .std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:hover .ui-icon,
1624
+ .elfinder-mobile .std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close .ui-icon {
1625
+ background-color: #ff6252;
1626
+ border-color: #e5695d;
1627
+ }
1628
+ .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize:hover .ui-icon,
1629
+ .elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize .ui-icon {
1630
+ background-color: #ffbc00;
1631
+ border-color: #e3a40b;
1632
+ }
1633
+ .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full:hover .ui-icon,
1634
+ .elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full .ui-icon {
1635
+ background-color: #26c82f;
1636
+ border-color: #13ae10;
1637
+ }
1638
 
1639
+ /* resize handle for touch devices */
1640
+ .elfinder-touch .std42-dialog.ui-dialog:not(ui-resizable-disabled) .ui-resizable-se {
1641
+ width: 12px;
1642
+ height: 12px;
1643
+ zoom: 1.5;
1644
+ right: -7px;
1645
+ bottom: -7px;
1646
+ margin: 3px 7px 7px 3px;
1647
+ background-position: -64px -224px;
1648
+ }
1649
 
1650
  .elfinder-rtl .elfinder-dialog .ui-dialog-titlebar { text-align:right; }
 
1651
 
1652
  /* content */
1653
  .std42-dialog .ui-dialog-content {
1654
  padding:.3em .5em;
1655
+ box-sizing: border-box;
1656
+ }
1657
+ .elfinder .std42-dialog .ui-dialog-content,
1658
+ .elfinder .std42-dialog .ui-dialog-content * {
1659
+ -webkit-user-select: auto;
1660
+ -moz-user-select: text;
1661
+ -khtml-user-select: text;
1662
+ user-select: text;
1663
  }
1664
 
1665
  /* buttons */
1666
  .std42-dialog .ui-dialog-buttonpane {
1667
+ border: 0 solid;
1668
+ margin: 0;
1669
+ padding: .5em;
1670
+ text-align: right;
1671
  }
1672
+ .elfinder-rtl .std42-dialog .ui-dialog-buttonpane { text-align: left; }
1673
 
1674
+ .std42-dialog .ui-dialog-buttonpane button { margin:.7em 0 0 .4em; padding: .2em; outline:0px solid; }
1675
  .std42-dialog .ui-dialog-buttonpane button span { padding:2px 9px; }
1676
  .std42-dialog .ui-dialog-buttonpane button span.ui-icon { padding: 2px; }
1677
 
1685
  position:absolute;
1686
  width:32px;
1687
  height:32px;
1688
+ left:10px;
1689
  top:50%;
1690
  margin-top:-15px;
1691
  background:url("../img/dialogs.png") 0 0 no-repeat;
1692
  }
1693
 
1694
+ .elfinder-rtl .elfinder-dialog-icon { left:auto; right:10px;}
1695
 
1696
 
1697
 
1718
  overflow:hidden;
1719
  }
1720
 
1721
+ .elfinder-ltr .elfinder-notify { padding-left:36px; }
1722
+ .elfinder-rtl .elfinder-notify { padding-right:36px; }
1723
 
1724
  .elfinder-notify:last-child { border:0 solid; }
1725
 
1761
  .elfinder-dialog-icon-download { background-position: 0 -260px; }
1762
  .elfinder-dialog-icon-save { background-position: 0 -295px; }
1763
  .elfinder-dialog-icon-rename { background-position: 0 -330px; }
1764
+ .elfinder-dialog-icon-zipdl,
1765
  .elfinder-dialog-icon-archive,
1766
  .elfinder-dialog-icon-extract { background-position: 0 -365px; }
1767
  .elfinder-dialog-icon-search { background-position: 0 -402px; }
1771
  .elfinder-dialog-icon-netunmount,
1772
  .elfinder-dialog-icon-chmod,
1773
  .elfinder-dialog-icon-preupload,
1774
+ .elfinder-dialog-icon-url,
1775
  .elfinder-dialog-icon-dim { background-position: 0 -434px; }
1776
 
1777
  /*********************** CONFIRM DIALOG **************************/
1778
 
1779
+ .elfinder-dialog-confirm-applyall {
1780
+ padding: 0 1em;
1781
+ margin: 0;
1782
+ }
1783
+ .elfinder-ltr .elfinder-dialog-confirm-applyall { text-align: left; }
1784
+ .elfinder-rtl .elfinder-dialog-confirm-applyall { text-align: right; }
1785
 
1786
  .elfinder-dialog-confirm .elfinder-dialog-icon { background-position:0 -32px; }
1787
 
1788
+ .elfinder-dialog-confirm .ui-dialog-buttonset { width: auto; }
1789
 
1790
  /*********************** FILE INFO DIALOG **************************/
1791
 
1827
  }
1828
 
1829
  .elfinder-netmount-tb { margin:0 auto; }
1830
+ .elfinder-netmount-tb select,
1831
  .elfinder-netmount-tb input { border:1px solid #ccc; }
1832
+ .elfinder-netmount-tb .elfinder-button-icon { cursor: pointer; }
1833
+
1834
+ button.elfinder-info-button {
1835
+ margin: -3.5px 0;
1836
+ cursor: pointer;
1837
+ }
1838
+
1839
  /*********************** UPLOAD DIALOG **************************/
1840
 
1841
  .elfinder-upload-dropbox {
1842
+ display: table-cell;
1843
  text-align:center;
1844
+ vertical-align: middle;
1845
+ padding:0.5em;
1846
  border:3px dashed #aaa;
1847
+ width: 9999px;
1848
+ height: 80px;
1849
  overflow: hidden;
1850
+ word-break: keep-all;
1851
  }
1852
 
1853
  .elfinder-upload-dropbox.ui-state-hover {
1933
  display: none;
1934
  }
1935
  /* File: /css/fonts.css */
1936
+ .elfinder-contextmenu .elfinder-contextmenu-item span { font-size:.72em; }
1937
 
1938
  .elfinder-cwd-view-icons .elfinder-cwd-filename { font-size:.7em; }
1939
  .elfinder-cwd-view-list td { font-size:.7em; }
1954
  .elfinder-button-search input { font-size:.8em; }
1955
  .elfinder-statusbar div { font-size:.7em; }
1956
  .elfinder-drag-num { font-size:12px; }
1957
+ .elfinder-toast { font-size:.76em; }
1958
 
1959
 
1960
  /* File: /css/navbar.css */
1970
  border-top:0 solid;
1971
  border-bottom:0 solid;
1972
  overflow:auto;
 
1973
  position:relative;
 
 
 
 
 
 
 
 
 
 
 
1974
  }
1975
 
1976
 
1999
  border:1px solid transparent;
2000
  cursor:default;
2001
  }
2002
+ .elfinder-touch .elfinder-navbar-dir {
2003
  padding: 12px 12px;
2004
  }
2005
 
2019
  background-repeat:no-repeat;
2020
  /* border:1px solid #111;*/
2021
  }
2022
+ .elfinder-ltr .elfinder-navbar-arrow {
2023
+ left: 0;
2024
+ }
2025
+ .elfinder-ltr .elfinder-navbar-arrow {
2026
+ right:0;
2027
+ }
2028
+ .elfinder-touch .elfinder-navbar-arrow {
2029
+ zoom: 1.4;
2030
+ -moz-transform-origin: top left;
2031
+ -moz-transform: scale(1.4);
2032
+ margin-bottom: 7px;
2033
+ }
2034
+ .elfinder-ltr.elfinder-touch .elfinder-navbar-arrow {
2035
+ left: -3px;
2036
+ margin-right: 20px;
2037
+ }
2038
+ .elfinder-rtl.elfinder-touch .elfinder-navbar-arrow {
2039
+ right: -3px;
2040
+ margin-left: 20px;
2041
+ }
2042
 
2043
  .ui-state-active .elfinder-navbar-arrow { background-image:url("../img/arrows-active.png"); }
2044
 
2046
  .elfinder-navbar-collapsed .elfinder-navbar-arrow { display:block; }
2047
 
2048
  /* arrow ltr/rtl enviroment */
2049
+ .elfinder-ltr .elfinder-navbar-collapsed .elfinder-navbar-arrow { background-position: 0 4px;}
2050
+ .elfinder-rtl .elfinder-navbar-collapsed .elfinder-navbar-arrow { background-position: 0 -10px; }
2051
  .elfinder-ltr .elfinder-navbar-expanded .elfinder-navbar-arrow,
2052
  .elfinder-rtl .elfinder-navbar-expanded .elfinder-navbar-arrow { background-position:0 -21px; }
2053
 
2073
  .elfinder-places .elfinder-navbar-root .elfinder-navbar-icon { background-position:0 -704px; }
2074
 
2075
  /* root icon of each volume */
2076
+ .elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon { background-image:url("../img/volume_icon_local.png"); background-position:0 0; }
2077
+ .elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon { background-image:url("../img/volume_icon_ftp.png"); background-position:0 0; }
2078
+ .elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon { background-image:url("../img/volume_icon_sql.png"); background-position:0 0; }
2079
+ .elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon { background-image:url("../img/volume_icon_dropbox.png"); background-position:0 0; }
2080
+ .elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon { background-image:url("../img/volume_icon_googledrive.png"); background-position:0 0; }
2081
+ .elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon { background-image:url("../img/volume_icon_onedrive.png"); background-position:0 0; }
2082
+ .elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon { background-image:url("../img/volume_icon_box.png"); background-position:0 0; }
2083
+ .elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon { background-image:url("../img/toolbar.png"); background-position: 0 -688px; }
2084
 
2085
  /* icon in active/hove/dropactive state */
2086
  .ui-state-active .elfinder-navbar-icon,
2087
  .elfinder-droppable-active .elfinder-navbar-icon,
2088
  .ui-state-hover .elfinder-navbar-icon { background-position:0 -32px; }
2089
 
 
 
 
2090
  /* ltr/rtl enviroment */
2091
  .elfinder-ltr .elfinder-navbar-subtree { margin-left:12px; }
2092
  .elfinder-rtl .elfinder-navbar-subtree { margin-right:12px; }
2106
  .elfinder-ltr .elfinder-navbar-spinner { left:0; margin-left:-2px; }
2107
  .elfinder-rtl .elfinder-navbar-spinner { right:0; margin-right:-2px; }
2108
 
2109
+ /* marker */
2110
+ .elfinder-navbar .elfinder-perms,
2111
+ .elfinder-navbar .elfinder-lock,
2112
+ .elfinder-navbar .elfinder-symlink { opacity: .6; filter:Alpha(Opacity=60); }
2113
+
2114
  /* permissions marker */
2115
+ .elfinder-navbar .elfinder-perms { bottom:-1px; margin-top:-8px; }
2116
 
2117
  /* locked marker */
2118
  .elfinder-navbar .elfinder-lock { top:-2px; }
2119
 
2120
  /* permissions/symlink markers ltr/rtl enviroment */
2121
+ .elfinder-ltr .elfinder-navbar .elfinder-perms { left: 20px; }
2122
+ .elfinder-rtl .elfinder-navbar .elfinder-perms { right: 20px; }
2123
+ .elfinder-ltr .elfinder-navbar .elfinder-lock { left: 20px; }
2124
+ .elfinder-rtl .elfinder-navbar .elfinder-lock { right: 20px; }
2125
  .elfinder-ltr .elfinder-navbar .elfinder-symlink { left: 8px; }
2126
  .elfinder-rtl .elfinder-navbar .elfinder-symlink { right: 8px; }
2127
 
2146
  /*border:1px solid #8cafed;*/
2147
  }
2148
 
2149
+ /* navbar swipe handle */
2150
+ .elfinder-navbar-swipe-handle {
2151
+ position: absolute;
2152
+ top: 0px;
2153
+ height: 100%;
2154
+ width: 50px;
2155
+ pointer-events: none;
2156
+ }
2157
+ .elfinder-ltr .elfinder-navbar-swipe-handle {
2158
+ left: 0px;
2159
+ background: linear-gradient(to right,
2160
+ rgba(221,228,235,1) 0,
2161
+ rgba(221,228,235,0.8) 5px,
2162
+ rgba(216,223,230,0.3) 8px,
2163
+ rgba(0,0,0,0.1) 95%,
2164
+ rgba(0,0,0,0) 100%);
2165
+ }
2166
+ .elfinder-rtl .elfinder-navbar-swipe-handle {
2167
+ right: 0px;
2168
+ background: linear-gradient(to left,
2169
+ rgba(221,228,235,1) 0,
2170
+ rgba(221,228,235,0.8) 5px,
2171
+ rgba(216,223,230,0.3) 8px,
2172
+ rgba(0,0,0,0.1) 95%,
2173
+ rgba(0,0,0,0) 100%);
2174
+ }
2175
  /* File: /css/places.css */
2176
  /*********************************************/
2177
  /* PLACES STYLES */
2182
  top: 50%;
2183
  margin-top: -9px;
2184
  cursor: pointer;
 
2185
  }
2186
  .elfinder-ltr .elfinder-places-root-icon {
2187
  right: 10px;
2203
  .elfinder-quicklook {
2204
  position:absolute;
2205
  background:url("../img/quicklook-bg.png");
 
2206
  overflow:hidden;
2207
  border-radius:7px;
2208
  -moz-border-radius:7px;
2210
  padding:20px 0 40px 0;
2211
  }
2212
 
2213
+ .elfinder-quicklook.elfinder-touch {
2214
+ padding:30px 0 40px 0;
2215
+ }
2216
+
2217
+ .elfinder-quicklook .ui-resizable-se {
2218
  width:14px;
2219
  height:14px;
2220
  right:5px;
2221
  bottom:3px;
2222
+ background:url("../img/toolbar.png") 0 -496px no-repeat;
2223
+ }
2224
+ .elfinder-quicklook.elfinder-touch .ui-resizable-se {
2225
+ zoom: 1.5;
2226
+ }
2227
 
2228
  /* quicklook fullscreen window */
2229
+ .elfinder-quicklook.elfinder-quicklook-fullscreen {
2230
+ position:fixed;
2231
+ top:0;
2232
+ right:0;
2233
+ bottom:0;
2234
+ left:0;
2235
+ margin:0;
2236
+ box-sizing:border-box;
2237
+ width:100%;
2238
+ height:100%;
2239
+ object-fit:contain;
2240
  border-radius:0;
2241
  -moz-border-radius:0;
2242
  -webkit-border-radius:0;
2243
  -webkit-background-clip: padding-box;
 
2244
  padding:0;
2245
  background:#000;
 
2246
  display:block;
2247
  }
2248
  /* hide titlebar in fullscreen mode */
2249
+ .elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar,
2250
+ .elfinder-quicklook-fullscreen.elfinder-quicklook .ui-resizable-handle { display:none; }
2251
 
2252
  /* hide preview border in fullscreen mode */
2253
  .elfinder-quicklook-fullscreen .elfinder-quicklook-preview { border:0 solid ;}
2254
 
2255
+ /*.elfinder-quicklook-fullscreen iframe {
2256
+ height: 100%;
2257
+ }*/
2258
+
2259
+ .elfinder-quicklook-cover {
2260
+ width: 100%;
2261
+ height: 100%;
2262
+ top: 0;
2263
+ left: 0;
2264
+ position: absolute;
2265
+ }
2266
+
2267
  /* quicklook titlebar */
2268
  .elfinder-quicklook-titlebar {
2269
  text-align:center;
2282
  cursor:move;
2283
  }
2284
 
2285
+ .elfinder-touch .elfinder-quicklook-titlebar {
2286
+ height: 30px;
2287
+ }
2288
+
2289
  /* window title */
2290
  .elfinder-quicklook-title {
2291
  color:#fff;
2294
  padding:2px 0;
2295
  }
2296
 
2297
+ .elfinder-touch .elfinder-quicklook-title {
2298
+ padding: 8px 0;
2299
+ }
2300
+
2301
  /* icon "close" in titlebar */
2302
  .elfinder-quicklook-titlebar .ui-icon {
2303
  position:absolute;
2309
  cursor:default;
2310
  }
2311
 
2312
+ .elfinder-touch .elfinder-quicklook-titlebar .ui-icon {
2313
+ zoom: 1.5;
2314
+ }
2315
+
2316
  /* main part of quicklook window */
2317
  .elfinder-quicklook-preview {
2318
+ overflow: hidden;
2319
  position:relative;
2320
  border:0 solid;
2321
  border-left:1px solid transparent;
2322
  border-right:1px solid transparent;
2323
  height:100%;
2324
  }
2325
+ .elfinder-quicklook-preview.elfinder-overflow-auto {
2326
+ overflow: auto;
2327
+ -webkit-overflow-scrolling: touch;
2328
+ }
2329
 
2330
  /* wrapper for file info/icon */
2331
  .elfinder-quicklook-info-wrapper {
2391
  padding:5px;
2392
  border:1px solid #eee;
2393
  background:#000;
2394
+ opacity: 0.4;
2395
+ filter: Alpha(Opacity=40);
2396
  }
2397
 
2398
  /* show close icon in fullscreen mode */
2453
  background:#fff;
2454
  color:#222;
2455
  overflow:auto;
2456
+ -webkit-overflow-scrolling: touch;
2457
+ }
2458
+
2459
+ /* archive files preview wrapper */
2460
+ .elfinder-quicklook-preview-archive-wrapper {
2461
+ width: 100%;
2462
+ height:100%;
2463
+ background:#fff;
2464
+ color:#222;
2465
+ font-size: 1.5ex;
2466
+ overflow:auto;
2467
+ -webkit-overflow-scrolling: touch
2468
+ }
2469
+
2470
+ /* archive files preview header */
2471
+ .elfinder-quicklook-preview-archive-wrapper strong {
2472
+ padding: 0 5px;
2473
  }
2474
 
2475
  /* text preview */
2476
  pre.elfinder-quicklook-preview-text {
2477
+ width: auto;
2478
+ height: auto;
2479
  margin:0;
2480
  padding:3px 9px;
2481
+ border: none;
2482
  }
2483
 
2484
  /* html/pdf preview */
2485
  .elfinder-quicklook-preview-html,
2486
+ .elfinder-quicklook-preview-pdf,
2487
+ .elfinder-quicklook-preview-iframe {
2488
  width:100%;
2489
  height:100%;
2490
  background:#fff;
 
2491
  margin:0;
2492
+ border: none;
2493
+ display: block;
2494
  }
2495
 
2496
  /* swf preview container */
2519
  height:100%;
2520
  }
2521
 
2522
+ /* allow user select */
2523
+ .elfinder .elfinder-quicklook .elfinder-quicklook-info *,
2524
+ .elfinder .elfinder-quicklook .elfinder-quicklook-preview * {
2525
+ -webkit-user-select: auto;
2526
+ -moz-user-select: text;
2527
+ -khtml-user-select: text;
2528
+ user-select: text;
2529
+ }
 
 
 
 
2530
 
2531
  /* File: /css/statusbar.css */
2532
  /******************************************************************/
2543
  border-right:0 solid transparent;
2544
  border-bottom:0 solid transparent;
2545
  border-left:0 solid transparent;
 
 
 
 
 
 
2546
  }
2547
 
2548
+ .elfinder-statusbar span {
2549
+ cursor: pointer;
2550
+ /*display: inline-block;*/
2551
+ vertical-align: bottom;
2552
+ overflow: hidden;
2553
+ text-overflow: ellipsis;
2554
+ -o-text-overflow: ellipsis;
2555
+ text-overflow: "..";
2556
+ -o-text-overflow: "..";
2557
+ }
2558
+ .elfinder-statusbar span.ui-state-hover,
2559
+ .elfinder-statusbar span.ui-state-active { border: none; }
2560
+ .elfinder-statusbar span.elfinder-path-cwd { cursor: default; }
2561
 
2562
 
2563
 
2567
  white-space:nowrap;
2568
  overflow:hidden;
2569
  text-overflow:ellipsis;
2570
+ -o-text-overflow:ellipsis;
2571
  }
2572
  .elfinder-ltr .elfinder-path { float:left; }
2573
  .elfinder-rtl .elfinder-path { float:right; }
2574
 
2575
+ /* path in workzone (case of swipe to navbar close) */
2576
+ .elfinder-workzone-path {
2577
+ position: relative;
2578
+ }
2579
+ .elfinder-workzone-path .elfinder-path {
2580
+ position: relative;
2581
+ font-size: .75em;
2582
+ font-weight: normal;
2583
+ float: none;
2584
+ max-width: none;
2585
+ overflow-x: scroll;
2586
+ text-overflow: initial;
2587
+ -o-text-overflow: initial;
2588
+ }
2589
+ .elfinder-ltr .elfinder-workzone-path .elfinder-path {
2590
+ margin-left: 24px;
2591
+ }
2592
+ .elfinder-rtl .elfinder-workzone-path .elfinder-path {
2593
+ margin-right: 24px;
2594
+ }
2595
+ .elfinder-workzone-path .elfinder-path span {
2596
+ display: inline-block;
2597
+ padding: 5px 3px;
2598
+ }
2599
+ .elfinder-workzone-path .elfinder-path span.elfinder-path-cwd {
2600
+ font-weight: bold;
2601
+ }
2602
+ .elfinder-workzone-path .elfinder-path span.ui-state-hover,
2603
+ .elfinder-workzone-path .elfinder-path span.ui-state-active { border: none; }
2604
+
2605
+ .elfinder-workzone-path .elfinder-path-roots {
2606
+ position: absolute;
2607
+ top: 0;
2608
+ width: 24px;
2609
+ height: 20px;
2610
+ padding: 2px;
2611
+ border: none;
2612
+ overflow: hidden;
2613
+ }
2614
+ .elfinder-ltr .elfinder-workzone-path .elfinder-path-roots {
2615
+ left: 0;
2616
+ }
2617
+ .elfinder-rtl .elfinder-workzone-path .elfinder-path-roots {
2618
+ right: 0;
2619
+ }
2620
  /* total/selected size in statusbar */
2621
  .elfinder-stat-size { white-space:nowrap; }
2622
  .elfinder-ltr .elfinder-stat-size { float:right; }
2624
 
2625
  .elfinder-stat-selected { white-space:nowrap; overflow:hidden; }
2626
 
2627
+ /* File: /css/toast.css */
2628
+ /*
2629
+ * CSS for Toastr
2630
+ * Copyright 2012-2015
2631
+ * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
2632
+ * All Rights Reserved.
2633
+ * Use, reproduction, distribution, and modification of this code is subject to the terms and
2634
+ * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
2635
+ *
2636
+ * ARIA Support: Greta Krafsig
2637
+ *
2638
+ * Project: https://github.com/CodeSeven/toastr
2639
+ */
2640
+
2641
+ .elfinder .elfinder-toast {
2642
+ position: absolute;
2643
+ top: 12px;
2644
+ right: 12px;
2645
+ max-width: 90%;
2646
+ cursor: default;
2647
+ }
2648
+
2649
+ .elfinder .elfinder-toast > div {
2650
+ position: relative;
2651
+ pointer-events: auto;
2652
+ overflow: hidden;
2653
+ margin: 0 0 6px;
2654
+ padding: 8px 16px 8px 50px;
2655
+ -moz-border-radius: 3px 3px 3px 3px;
2656
+ -webkit-border-radius: 3px 3px 3px 3px;
2657
+ border-radius: 3px 3px 3px 3px;
2658
+ background-position: 15px center;
2659
+ background-repeat: no-repeat;
2660
+ -moz-box-shadow: 0 0 12px #999999;
2661
+ -webkit-box-shadow: 0 0 12px #999999;
2662
+ box-shadow: 0 0 12px #999999;
2663
+ color: #FFFFFF;
2664
+ opacity: 0.9;
2665
+ filter: alpha(opacity=90);
2666
+ background-color: #030303;
2667
+ text-align: center;
2668
+ }
2669
+
2670
+ .elfinder .elfinder-toast > .toast-info {
2671
+ background-color: #2F96B4;
2672
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important;
2673
+ }
2674
+ .elfinder .elfinder-toast > .toast-error {
2675
+ background-color: #BD362F;
2676
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important;
2677
+ }
2678
+ .elfinder .elfinder-toast > .toast-success {
2679
+ background-color: #51A351;
2680
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important;
2681
+ }
2682
+ .elfinder .elfinder-toast > .toast-warning {
2683
+ background-color: #F89406;
2684
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important;
2685
+ }
2686
+
2687
+
2688
+ .elfinder .elfinder-toast > div button.ui-button {
2689
+ background-image: none;
2690
+ margin-top: 8px;
2691
+ padding: .5em .8em;
2692
+ }
2693
+
2694
+ .elfinder .elfinder-toast > .toast-success button.ui-button {
2695
+ background-color: green;
2696
+ color: #FFF;
2697
+ }
2698
+
2699
+ .elfinder .elfinder-toast > .toast-success button.ui-button.ui-state-hover {
2700
+ background-color: #add6ad;
2701
+ color: #254b25;
2702
+ }
2703
+
2704
  /* File: /css/toolbar.css */
2705
  /*********************************************/
2706
  /* TOOLBAR STYLES */
2728
 
2729
  /* button */
2730
  .elfinder .elfinder-button {
2731
+ /*width:16px;*/
2732
  height:16px;
2733
  margin:0;
2734
  padding:4px;
2739
  -webkit-box-sizing: content-box;
2740
  -moz-box-sizing: content-box;
2741
  box-sizing: content-box;
2742
+ line-height: 1;
2743
+ cursor: default;
2744
+ }
2745
+ .elfinder-touch .elfinder-button {
2746
+ /*width:20px;*/
2747
+ height:20px;
2748
  }
2749
 
2750
  .elfinder .ui-icon-search { cursor:pointer;}
2778
  width:0;
2779
  }
2780
 
2781
+ .elfinder-touch .elfinder-toolbar-button-separator {
2782
+ height:20px;
2783
+ }
2784
+
2785
  /* change icon opacity^ not button */
2786
  .elfinder .elfinder-button.ui-state-disabled { opacity:1; filter:Alpha(Opacity=100);}
2787
+ .elfinder .elfinder-button.ui-state-disabled .elfinder-button-icon,
2788
+ .elfinder .elfinder-button.ui-state-disabled .elfinder-button-text { opacity:.4; filter:Alpha(Opacity=40);}
2789
 
2790
  /* rtl enviroment */
2791
  .elfinder-rtl .elfinder-buttonset { float:right; }
2794
  .elfinder-button-icon {
2795
  width:16px;
2796
  height:16px;
2797
+ /*display:block;*/
2798
+ display:inline-block;
2799
  background:url('../img/toolbar.png') no-repeat;
2800
  }
2801
+ .elfinder-button-text {
2802
+ position: relative;
2803
+ display: inline-block;
2804
+ top: -4px;
2805
+ margin: 0 2px;
2806
+ font-size: 12px;
2807
+ }
2808
+
2809
+ .elfinder-touch .elfinder-button-icon {
2810
+ zoom: 1.25;
2811
+ -moz-transform-origin: top left;
2812
+ -moz-transform: scale(1.25);
2813
+ }
2814
+ .elfinder-touch .elfinder-button-text {
2815
+ top: -5px;
2816
+ }
2817
 
2818
  /* buttons icons */
2819
  .elfinder-button-icon-home { background-position: 0 0; }
2820
  .elfinder-button-icon-back { background-position: 0 -112px; }
2821
  .elfinder-button-icon-forward { background-position: 0 -128px; }
2822
  .elfinder-button-icon-up { background-position: 0 -144px; }
2823
+ .elfinder-button-icon-dir { background-position: 0 -16px; }
2824
  .elfinder-button-icon-opendir { background-position: 0 -32px; }
2825
  .elfinder-button-icon-reload { background-position: 0 -160px; }
2826
  .elfinder-button-icon-open { background-position: 0 -176px; }
2855
  .elfinder-button-icon-chmod { background-position: 0 -48px; }
2856
  .elfinder-button-icon-accept { background-position: 0 -736px; }
2857
  .elfinder-button-icon-opendir { background-position: 0 -32px; }
2858
+ .elfinder-button-icon-menu { background-position: 0 -752px; }
2859
+ .elfinder-button-icon-colwidth { background-position: 0 -768px; }
2860
+ .elfinder-button-icon-fullscreen { background-position: 0 -784px; }
2861
+ .elfinder-button-icon-unfullscreen{ background-position: 0 -800px; }
2862
 
2863
  /* button with dropdown menu*/
2864
  .elfinder .elfinder-menubutton { overflow:visible; }
2874
  padding:3px 0;
2875
  }
2876
 
2877
+ .elfinder-touch .elfinder-button-menu {
2878
+ top:35px;
2879
+ }
2880
+
2881
  /* menu item */
2882
  .elfinder-button-menu-item {
2883
  white-space:nowrap;
2885
  padding:5px 19px;
2886
  position:relative;
2887
  }
2888
+ .elfinder-touch .elfinder-button-menu-item {
2889
+ padding: 12px 19px
2890
+ }
2891
 
2892
  /* fix hover ui class */
2893
  .elfinder-button-menu .ui-state-hover { border:0 solid; }
2905
  }
2906
 
2907
  .elfinder-button-menu-item-selected .ui-icon { display:block; }
2908
+ .elfinder-button-menu-item-selected-asc .ui-icon-arrowthick-1-s { display:none; }
2909
+ .elfinder-button-menu-item-selected-desc .ui-icon-arrowthick-1-n { display:none; }
2910
 
2911
  /* hack for upload button */
2912
  .elfinder-button form {
2936
  font-size: 8pt;
2937
  text-align: center;
2938
  width: 100%;
2939
+ overflow: hidden;
2940
  }
2941
 
2942
  .elfinder .elfinder-button-search .elfinder-button-menu div {
2967
  outline:0px solid;
2968
  }
2969
 
2970
+ .elfinder-button-search input::-ms-clear {
2971
+ display: none;
2972
+ }
2973
+ .elfinder-touch .elfinder-button-search input {
2974
+ height:28px;
2975
+ line-height: 28px;
2976
+ }
2977
  .elfinder-rtl .elfinder-button-search input { direction:rtl; }
2978
 
2979
+
2980
  /* icons */
2981
  .elfinder-button-search .ui-icon {
2982
  position:absolute;
2983
  height:18px;
2984
  top: 50%;
2985
+ margin:-8px 4px 0 4px;
2986
  opacity: .6;
2987
  filter:Alpha(Opacity=60);
2988
  }
2989
+ .elfinder-button-search .ui-checkboxradio-icon {
2990
+ display: none;
2991
+ }
2992
 
2993
  /* search/close icons */
2994
  .elfinder-ltr .elfinder-button-search .ui-icon-search { left:0;}
2996
  .elfinder-ltr .elfinder-button-search .ui-icon-close { right:0;}
2997
  .elfinder-rtl .elfinder-button-search .ui-icon-close { left:0;}
2998
 
2999
+ /* toolbar swipe handle */
3000
+ .elfinder-toolbar-swipe-handle {
3001
+ position: absolute;
3002
+ top: 0px;
3003
+ left: 0px;
3004
+ height: 50px;
3005
+ width: 100%;
3006
+ pointer-events: none;
3007
+ background: linear-gradient(to bottom,
3008
+ rgba(221,228,235,1) 0,
3009
+ rgba(221,228,235,0.8) 2px,
3010
+ rgba(216,223,230,0.3) 5px,
3011
+ rgba(0,0,0,0.1) 95%,
3012
+ rgba(0,0,0,0) 100%);
3013
+ }
3014
 
elFinder/css/elfinder.min.css CHANGED
@@ -1,9 +1,9 @@
1
  /*!
2
  * elFinder - file manager for web
3
- * Version 2.1.6 (2016-01-19)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
- * Licensed under a 3 clauses BSD license
8
  */
9
- .elfinder-dialog-resize{margin-top:.3em}.elfinder-resize-type{float:left;margin-bottom:.4em}.elfinder-resize-control{padding-top:3em}.elfinder-resize-control input[type=text]{border:1px solid #aaa;text-align:right}.elfinder-resize-preview{width:400px;height:400px;padding:10px;background:#fff;border:1px solid #aaa;float:right;position:relative;overflow:auto}.elfinder-resize-handle{position:relative}.elfinder-resize-handle-hline,.elfinder-resize-handle-vline{position:absolute;background-image:url("../img/crop.gif")}.elfinder-resize-handle-hline{width:100%;height:1px!important;background-repeat:repeat-x}.elfinder-resize-handle-vline{width:1px!important;height:100%;background-repeat:repeat-y}.elfinder-resize-handle-hline-top{top:0;left:0}.elfinder-resize-handle-hline-bottom{bottom:0;left:0}.elfinder-resize-handle-vline-left{top:0;left:0}.elfinder-resize-handle-vline-right{top:0;right:0}.elfinder-resize-handle-point{position:absolute;width:8px;height:8px;border:1px solid #777;background:0 0}.elfinder-resize-handle-point-n{top:0;left:50%;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-ne{top:0;right:0;margin-top:-5px;margin-right:-5px}.elfinder-resize-handle-point-e{top:50%;right:0;margin-top:-5px;margin-right:-5px}.elfinder-resize-handle-point-se{bottom:0;right:0;margin-bottom:-5px;margin-right:-5px}.elfinder-resize-handle-point-s{bottom:0;left:50%;margin-bottom:-5px;margin-left:-5px}.elfinder-resize-handle-point-sw{bottom:0;left:0;margin-bottom:-5px;margin-left:-5px}.elfinder-resize-handle-point-w{top:50%;left:0;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-nw{top:0;left:0;margin-top:-5px;margin-left:-5px}.elfinder-resize-spinner{position:absolute;width:200px;height:30px;top:50%;margin-top:-25px;left:50%;margin-left:-100px;text-align:center;background:url(../img/progress.gif) center bottom repeat-x}.elfinder-resize-row{margin-bottom:7px;position:relative}.elfinder-resize-label{float:left;width:80px;padding-top:3px}.elfinder-resize-reset{width:16px;height:16px;position:absolute;margin-top:-8px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e{height:100%;width:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{width:100%;height:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se{background:0 0;bottom:0;right:0;margin-right:-7px;margin-bottom:-7px}.elfinder-dialog-resize .ui-icon-grip-solid-vertical{position:absolute;top:50%;right:0;margin-top:-8px;margin-right:-11px}.elfinder-dialog-resize .ui-icon-grip-solid-horizontal{position:absolute;left:50%;bottom:0;margin-left:-8px;margin-bottom:-11px}.elfinder-resize-row .elfinder-buttonset{float:right}.elfinder-resize-rotate-slider{float:left;width:195px;margin:7px}.elfinder-file-edit{width:99%;height:99%;margin:0;padding:2px;border:1px solid #ccc}div.elfinder-cwd-wrapper-list tr.ui-state-default td{position:relative}div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon{position:absolute;top:.4em;left:0;right:0;margin:auto 0 auto auto}.elfinder-help{margin-bottom:.5em}.elfinder-help .ui-tabs-panel{padding:.5em}.elfinder-dialog .ui-tabs .ui-tabs-nav li a{padding:.2em 1em}.elfinder-help-shortcuts{height:300px;padding:1em;margin:.5em 0;overflow:auto}.elfinder-help-shortcut{white-space:nowrap;clear:both}.elfinder-help-shortcut-pattern{float:left;width:160px}.elfinder-help-logo{width:100px;height:96px;float:left;margin-right:1em;background:url('../img/logo.png') center center no-repeat}.elfinder-help h3{font-size:1.5em;margin:.2em 0 .3em}.elfinder-help-separator{clear:both;padding:.5em}.elfinder-help-link{padding:2px}.elfinder-help .ui-priority-secondary{font-size:.9em}.elfinder-help .ui-priority-primary{margin-bottom:7px}.elfinder-help-team{clear:both;text-align:right;border-bottom:1px solid #ccc;margin:.5em 0;font-size:.9em}.elfinder-help-team div{float:left}.elfinder-help-license{font-size:.9em}.elfinder-help-disabled{font-weight:700;text-align:center;margin:90px 0}.elfinder-help .elfinder-dont-panic{display:block;border:1px solid transparent;width:200px;height:200px;margin:30px auto;text-decoration:none;text-align:center;position:relative;background:#d90004;-moz-box-shadow:5px 5px 9px #111;-webkit-box-shadow:5px 5px 9px #111;box-shadow:5px 5px 9px #111;background:-moz-radial-gradient(80px 80px,circle farthest-corner,#d90004 35%,#960004 100%);background:-webkit-gradient(radial,80 80,60,80 80,120,from(#d90004),to(#960004));-moz-border-radius:100px;-webkit-border-radius:100px;border-radius:100px;outline:none}.elfinder-help .elfinder-dont-panic span{font-size:3em;font-weight:700;text-align:center;color:#fff;position:absolute;left:0;top:45px}.elfinder{padding:0;position:relative;display:block}.elfinder-rtl{text-align:right;direction:rtl}.elfinder-workzone{padding:0;position:relative;overflow:hidden}.elfinder-lock,.elfinder-perms,.elfinder-symlink{position:absolute;width:16px;height:16px;background-image:url(../img/toolbar.png);background-repeat:no-repeat;background-position:0 -528px}.elfinder-na .elfinder-perms{background-position:0 -96px}.elfinder-ro .elfinder-perms{background-position:0 -64px}.elfinder-wo .elfinder-perms{background-position:0 -80px}.elfinder-lock{background-position:0 -656px}.elfinder-drag-helper{width:70px;height:60px;padding:0 0 0 25px;z-index:100000}.elfinder-drag-helper.html5-native{position:absolute;top:-1000px;left:-1000px}.elfinder-drag-helper-icon-status{position:absolute;width:16px;height:16px;left:42px;top:60px;background:url('../img/toolbar.png') 0 -96px no-repeat;display:block}.elfinder-drag-helper-move .elfinder-drag-helper-icon-status{background-position:0 -720px}.elfinder-drag-helper-plus .elfinder-drag-helper-icon-status{background-position:0 -544px}.elfinder-drag-num{position:absolute;top:0;left:0;width:16px;height:14px;text-align:center;padding-top:2px;font-weight:700;color:#fff;background-color:red;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-drag-helper .elfinder-cwd-icon{margin:0 0 0 -24px;float:left}.elfinder-overlay{position:absolute}.elfinder .elfinder-panel{position:relative;background-image:none;padding:7px 12px}[draggable=true]{-khtml-user-drag:element}.elfinder-contextmenu,.elfinder-contextmenu-sub{display:none;position:absolute;border:1px solid #aaa;background:#fff;color:#555;padding:4px 0}.elfinder-contextmenu-sub{top:5px}.elfinder-contextmenu-ltr .elfinder-contextmenu-sub{margin-left:-5px}.elfinder-contextmenu-rtl .elfinder-contextmenu-sub{margin-right:-5px}.elfinder-contextmenu-item{position:relative;display:block;padding:4px 30px;text-decoration:none;white-space:nowrap;cursor:default}.elfinder-contextmenu-item .ui-icon{width:16px;height:16px;position:absolute;left:2px;top:50%;margin-top:-8px;display:none}.elfinder-contextmenu-item.elfinder-touch{padding:12px 30px}.elfinder-contextmenu .elfinder-contextmenu-item span{display:block}.elfinder-contextmenu-ltr .elfinder-contextmenu-item{text-align:left}.elfinder-contextmenu-rtl .elfinder-contextmenu-item{text-align:right}.elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-left:12px}.elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-right:12px}.elfinder-contextmenu-extra-icon,.elfinder-contextmenu-arrow,.elfinder-contextmenu-icon{position:absolute;top:50%;margin-top:-8px;overflow:hidden}.elfinder-contextmenu-ltr .elfinder-contextmenu-icon{left:8px}.elfinder-contextmenu-rtl .elfinder-contextmenu-icon,.elfinder-contextmenu-ltr .elfinder-contextmenu-extra-icon{right:8px}.elfinder-contextmenu-rtl .elfinder-contextmenu-extra-icon{left:8px}.elfinder-contextmenu-arrow{width:16px;height:16px;background:url('../img/arrows-normal.png') 5px 4px no-repeat}.elfinder-contextmenu-ltr .elfinder-contextmenu-arrow{right:5px}.elfinder-contextmenu-rtl .elfinder-contextmenu-arrow{left:5px;background-position:0 -10px}.elfinder-contextmenu-extra-icon a,.elfinder-contextmenu-extra-icon span{display:inline-block;width:100%;height:100%;padding:20px;margin:0;color:transparent!important;text-decoration:none;cursor:pointer}.elfinder-contextmenu .ui-state-hover{border:0 solid;background-image:none}.elfinder-contextmenu-separator{height:0;border-top:1px solid #ccc;margin:0 1px}.elfinder-cwd-wrapper{overflow:auto;position:relative;padding:2px;margin:0}.elfinder-cwd-wrapper-list{padding:0}.elfinder-cwd{position:relative;cursor:default;padding:0;margin:0;-ms-touch-action:auto;touch-action:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none}.elfinder .elfinder-cwd-wrapper.elfinder-droppable-active{outline:2px solid #8cafed;outline-offset:-2px}.elfinder-cwd-wrapper-empty .elfinder-cwd:after{display:block;position:absolute;top:40%;left:0;right:0;margin-top:-2em;line-height:1.5em;text-align:center;white-space:pre-wrap;opacity:.6;font-weight:700}.elfinder-cwd-view-icons .elfinder-cwd-file{width:120px;height:80px;padding-bottom:2px;cursor:default;border:none}.elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file{float:left;margin:0 3px 12px 0}.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file{float:right;margin:0 0 5px 3px}.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover{border:0 solid}.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper{width:52px;height:52px;margin:1px auto;padding:2px;position:relative}.elfinder-cwd-view-icons .elfinder-cwd-filename{text-align:center;max-height:32px;white-space:pre-wrap;word-break:normal;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;margin:3px 1px 0;padding:1px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-cwd-view-icons .elfinder-perms{bottom:4px;right:2px}.elfinder-cwd-view-icons .elfinder-lock{top:-3px;right:-2px}.elfinder-cwd-view-icons .elfinder-symlink{bottom:6px;left:0}.elfinder-cwd-icon{display:block;width:48px;height:48px;margin:0 auto;background:url('../img/icons-big.png') 0 0 no-repeat;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box}.elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon{background-position:0 -100px}.elfinder-cwd-icon-directory{background-position:0 -50px}.elfinder-cwd-icon-application{background-position:0 -150px}.elfinder-cwd-icon-x-empty,.elfinder-cwd-icon-text{background-position:0 -200px}.elfinder-cwd-icon-image,.elfinder-cwd-icon-vnd-adobe-photoshop,.elfinder-cwd-icon-postscript{background-position:0 -250px}.elfinder-cwd-icon-audio{background-position:0 -300px}.elfinder-cwd-icon-video,.elfinder-cwd-icon-flash-video{background-position:0 -350px}.elfinder-cwd-icon-rtf,.elfinder-cwd-icon-rtfd{background-position:0 -401px}.elfinder-cwd-icon-pdf{background-position:0 -450px}.elfinder-cwd-icon-ms-excel,.elfinder-cwd-icon-msword,.elfinder-cwd-icon-vnd-ms-excel,.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-office,.elfinder-cwd-icon-vnd-ms-powerpoint,.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-word,.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12,.elfinder-cwd-icon-vnd-oasis-opendocument-chart,.elfinder-cwd-icon-vnd-oasis-opendocument-database,.elfinder-cwd-icon-vnd-oasis-opendocument-formula,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template,.elfinder-cwd-icon-vnd-oasis-opendocument-image,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template,.elfinder-cwd-icon-vnd-oasis-opendocument-text,.elfinder-cwd-icon-vnd-oasis-opendocument-text-master,.elfinder-cwd-icon-vnd-oasis-opendocument-text-template,.elfinder-cwd-icon-vnd-oasis-opendocument-text-web,.elfinder-cwd-icon-vnd-openofficeorg-extension,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template{background-position:0 -500px}.elfinder-cwd-icon-html{background-position:0 -550px}.elfinder-cwd-icon-css{background-position:0 -600px}.elfinder-cwd-icon-javascript,.elfinder-cwd-icon-x-javascript{background-position:0 -650px}.elfinder-cwd-icon-x-perl{background-position:0 -700px}.elfinder-cwd-icon-x-python{background-position:0 -750px}.elfinder-cwd-icon-x-ruby{background-position:0 -800px}.elfinder-cwd-icon-x-sh,.elfinder-cwd-icon-x-shellscript{background-position:0 -850px}.elfinder-cwd-icon-x-c,.elfinder-cwd-icon-x-csrc,.elfinder-cwd-icon-x-chdr,.elfinder-cwd-icon-x-c--,.elfinder-cwd-icon-x-c--src,.elfinder-cwd-icon-x-c--hdr,.elfinder-cwd-icon-x-java,.elfinder-cwd-icon-x-java-source{background-position:0 -900px}.elfinder-cwd-icon-x-php{background-position:0 -950px}.elfinder-cwd-icon-xml{background-position:0 -1000px}.elfinder-cwd-icon-zip,.elfinder-cwd-icon-x-zip,.elfinder-cwd-icon-x-xz,.elfinder-cwd-icon-x-7z-compressed{background-position:0 -1050px}.elfinder-cwd-icon-x-gzip,.elfinder-cwd-icon-x-tar{background-position:0 -1100px}.elfinder-cwd-icon-x-bzip,.elfinder-cwd-icon-x-bzip2{background-position:0 -1150px}.elfinder-cwd-icon-x-rar,.elfinder-cwd-icon-x-rar-compressed{background-position:0 -1200px}.elfinder-cwd-icon-x-shockwave-flash{background-position:0 -1250px}.elfinder-cwd-icon-group{background-position:0 -1300px}.elfinder-cwd input{width:100%;border:0 solid;margin:0;padding:0}.elfinder-cwd-view-icons input{text-align:center}.elfinder-cwd-view-icons textarea{width:100%;border:0 solid;margin:0;padding:0;text-align:center;overflow:hidden;resize:none}.elfinder-cwd-view-icons{text-align:center}.elfinder-cwd table{width:100%;border-collapse:separate;border:0 solid;margin:0 0 10px;border-spacing:0;box-sizing:padding-box;padding:2px}.elfinder .elfinder-cwd table thead tr{border-left:0 solid;border-top:0 solid;border-right:0 solid}.elfinder .elfinder-cwd table thead td{padding:4px 14px}.elfinder .elfinder-cwd table thead td.ui-state-active{background:#ebf1f6;background:-moz-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ebf1f6),color-stop(50%,#abd3ee),color-stop(51%,#89c3eb),color-stop(100%,#d5ebfb));background:-webkit-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-o-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-ms-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:linear-gradient(to bottom,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebf1f6', endColorstr='#d5ebfb',GradientType=0 )}.elfinder .elfinder-cwd table td{padding:4px 12px;white-space:pre;overflow:hidden;text-align:right;cursor:default;border:0 solid}.elfinder .elfinder-cwd table td div{box-sizing:content-box}.elfinder .elfinder-cwd tr.elfinder-touch td{padding:10px 12px}.elfinder .elfinder-cwd tr.elfinder-cwd-file.elfinder-touch td{padding:13px 12px}.elfinder-ltr .elfinder-cwd table td{text-align:right}.elfinder-ltr .elfinder-cwd table td:first-child{text-align:left}.elfinder-rtl .elfinder-cwd table td{text-align:left}.elfinder-rtl .elfinder-cwd table td:first-child{text-align:right}.elfinder-odd-row{background:#eee}.elfinder-cwd-view-list .elfinder-cwd-file-wrapper{width:97%;position:relative}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-file-wrapper{padding-left:23px}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-file-wrapper{padding-right:23px}.elfinder-cwd-view-list .elfinder-perms,.elfinder-cwd-view-list .elfinder-lock,.elfinder-cwd-view-list .elfinder-symlink{top:50%;margin-top:-6px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-perms{left:7px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-lock{left:9px;top:0}.elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink{left:-7px}.elfinder-cwd-view-list td .elfinder-cwd-icon{width:16px;height:16px;position:absolute;top:50%;margin-top:-8px;background-image:url(../img/icons-small.png)}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon{left:0}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon{right:0}.std42-dialog{padding:0;position:absolute;left:auto;right:auto}.std42-dialog .ui-dialog-titlebar{border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent;-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;font-weight:400;padding:.2em 1em}.std42-dialog .ui-dialog-titlebar-close,.std42-dialog .ui-dialog-titlebar-close:hover{padding:1px}.elfinder-rtl .elfinder-dialog .ui-dialog-titlebar{text-align:right}.elfinder-rtl .elfinder-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close{right:auto;left:.3em}.std42-dialog .ui-dialog-content{padding:.3em .5em}.std42-dialog .ui-dialog-buttonpane{border:0 solid;margin:0;padding:.5em .7em}.std42-dialog .ui-dialog-buttonpane button{margin:0 0 0 .4em;padding:0;outline:0 solid}.std42-dialog .ui-dialog-buttonpane button span{padding:2px 9px}.std42-dialog .ui-dialog-buttonpane button span.ui-icon{padding:2px}.elfinder-dialog .ui-resizable-e,.elfinder-dialog .ui-resizable-s{width:0;height:0}.std42-dialog .ui-button input{cursor:pointer}.elfinder-dialog-icon{position:absolute;width:32px;height:32px;left:12px;top:50%;margin-top:-15px;background:url("../img/dialogs.png") 0 0 no-repeat}.elfinder-rtl .elfinder-dialog-icon{left:auto;right:12px}.elfinder-dialog-error .ui-dialog-content,.elfinder-dialog-confirm .ui-dialog-content{padding-left:56px;min-height:35px}.elfinder-rtl .elfinder-dialog-error .ui-dialog-content,.elfinder-rtl .elfinder-dialog-confirm .ui-dialog-content{padding-left:0;padding-right:56px}.elfinder-dialog-notify .ui-dialog-titlebar-close{display:none}.elfinder-dialog-notify .ui-dialog-content{padding:0}.elfinder-notify{border-bottom:1px solid #ccc;position:relative;padding:.5em;text-align:center;overflow:hidden}.elfinder-ltr .elfinder-notify{padding-left:30px}.elfinder-rtl .elfinder-notify{padding-right:30px}.elfinder-notify:last-child{border:0 solid}.elfinder-notify-progressbar{width:180px;height:8px;border:1px solid #aaa;background:#f5f5f5;margin:5px auto;overflow:hidden}.elfinder-notify-progress{width:100%;height:8px;background:url(../img/progress.gif) center center repeat-x}.elfinder-notify-progressbar,.elfinder-notify-progress{-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.elfinder-dialog-icon-open,.elfinder-dialog-icon-readdir,.elfinder-dialog-icon-file,.elfinder-dialog-icon-reload{background-position:0 -225px}.elfinder-dialog-icon-mkdir{background-position:0 -64px}.elfinder-dialog-icon-mkfile{background-position:0 -96px}.elfinder-dialog-icon-copy,.elfinder-dialog-icon-prepare,.elfinder-dialog-icon-move{background-position:0 -128px}.elfinder-dialog-icon-upload,.elfinder-dialog-icon-chunkmerge{background-position:0 -160px}.elfinder-dialog-icon-rm{background-position:0 -192px}.elfinder-dialog-icon-download{background-position:0 -260px}.elfinder-dialog-icon-save{background-position:0 -295px}.elfinder-dialog-icon-rename{background-position:0 -330px}.elfinder-dialog-icon-archive,.elfinder-dialog-icon-extract{background-position:0 -365px}.elfinder-dialog-icon-search{background-position:0 -402px}.elfinder-dialog-icon-resize,.elfinder-dialog-icon-loadimg,.elfinder-dialog-icon-netmount,.elfinder-dialog-icon-netunmount,.elfinder-dialog-icon-chmod,.elfinder-dialog-icon-preupload,.elfinder-dialog-icon-dim{background-position:0 -434px}.elfinder-dialog-confirm-applyall{padding-top:3px}.elfinder-dialog-confirm .elfinder-dialog-icon{background-position:0 -32px}.elfinder-info-title .elfinder-cwd-icon{float:left;width:48px;height:48px;margin-right:1em}.elfinder-rtl .elfinder-info-title .elfinder-cwd-icon{float:right;margin-right:0;margin-left:1em}.elfinder-info-title strong{display:block;padding:.3em 0 .5em}.elfinder-info-tb{min-width:200px;border:0 solid;margin:1em .2em}.elfinder-info-tb td{white-space:nowrap;padding:2px}.elfinder-info-tb tr td:first-child{text-align:right}.elfinder-info-tb span{float:left}.elfinder-info-tb a{outline:none;text-decoration:underline}.elfinder-info-tb a:hover{text-decoration:none}.elfinder-info-spinner{width:14px;height:14px;float:left;background:url("../img/spinner-mini.gif") center center no-repeat;margin:0 5px}.elfinder-netmount-tb{margin:0 auto}.elfinder-netmount-tb input{border:1px solid #ccc}.elfinder-upload-dropbox{text-align:center;padding:2em 0;border:3px dashed #aaa;height:1em;overflow:hidden}.elfinder-upload-dropbox.ui-state-hover{background:#dfdfdf;border:3px dashed #555}.elfinder-upload-dialog-or{margin:.3em 0;text-align:center}.elfinder-upload-dialog-wrapper{text-align:center}.elfinder-upload-dialog-wrapper .ui-button{position:relative;overflow:hidden}.elfinder-upload-dialog-wrapper .ui-button form{position:absolute;right:0;top:0;opacity:0;filter:Alpha(Opacity=0)}.elfinder-upload-dialog-wrapper .ui-button form input{padding:0 20px;font-size:3em}.dialogelfinder .dialogelfinder-drag{border-left:0 solid;border-top:0 solid;border-right:0 solid;font-weight:400;padding:2px 12px;cursor:move;position:relative;text-align:left}.elfinder-rtl .dialogelfinder-drag{text-align:right}.dialogelfinder-drag-close{position:absolute;top:50%;margin-top:-8px}.elfinder-ltr .dialogelfinder-drag-close{right:12px}.elfinder-rtl .dialogelfinder-drag-close{left:12px}.elfinder-rm-title{margin-bottom:.5ex}.elfinder-rm-title .elfinder-cwd-icon{float:left;width:48px;height:48px;margin-right:1em}.elfinder-rtl .elfinder-rm-title .elfinder-cwd-icon{float:right;margin-right:0;margin-left:1em}.elfinder-rm-title strong{display:block;white-space:pre-wrap;word-break:normal;overflow:hidden;text-overflow:ellipsis}.elfinder-rm-title+br{display:none}.elfinder-contextmenu .elfinder-contextmenu-item span{font-size:.76em}.elfinder-cwd-view-icons .elfinder-cwd-filename,.elfinder-cwd-view-list td{font-size:.7em}.std42-dialog .ui-dialog-titlebar{font-size:.82em}.std42-dialog .ui-dialog-content{font-size:.72em}.std42-dialog .ui-dialog-buttonpane{font-size:.76em}.elfinder-info-tb{font-size:.9em}.elfinder-upload-dropbox,.elfinder-upload-dialog-or{font-size:1.2em}.dialogelfinder .dialogelfinder-drag{font-size:.9em}.elfinder .elfinder-navbar{font-size:.72em}.elfinder-place-drag .elfinder-navbar-dir{font-size:.9em}.elfinder-quicklook-title{font-size:.7em}.elfinder-quicklook-info-data{font-size:.72em}.elfinder-quicklook-preview-text-wrapper{font-size:.9em}.elfinder-button-menu-item{font-size:.72em}.elfinder-button-search input{font-size:.8em}.elfinder-statusbar div{font-size:.7em}.elfinder-drag-num{font-size:12px}.elfinder .elfinder-navbar{width:230px;padding:3px 5px;background-image:none;border-top:0 solid;border-bottom:0 solid;overflow:auto;display:none;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none}.elfinder-ltr .elfinder-navbar{float:left;border-left:0 solid}.elfinder-rtl .elfinder-navbar{float:right;border-right:0 solid}.elfinder-ltr .ui-resizable-e{margin-left:10px}.elfinder-tree{display:table;width:100%;margin:0 0 .5em;-webkit-tap-highlight-color:rgba(0,0,0,0)}.elfinder-navbar-dir{position:relative;display:block;white-space:nowrap;padding:3px 12px;margin:0;outline:0 solid;border:1px solid transparent;cursor:default}.elfinder-navbar-dir.elfinder-touch{padding:12px}.elfinder-ltr .elfinder-navbar-dir{padding-left:35px}.elfinder-rtl .elfinder-navbar-dir{padding-right:35px}.elfinder-navbar-arrow{width:12px;height:14px;position:absolute;display:none;top:50%;margin-top:-8px;background-image:url("../img/arrows-normal.png");background-repeat:no-repeat}.ui-state-active .elfinder-navbar-arrow{background-image:url("../img/arrows-active.png")}.elfinder-navbar-collapsed .elfinder-navbar-arrow{display:block}.elfinder-ltr .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 4px;left:0}.elfinder-rtl .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 -10px;right:0}.elfinder-ltr .elfinder-navbar-expanded .elfinder-navbar-arrow,.elfinder-rtl .elfinder-navbar-expanded .elfinder-navbar-arrow{background-position:0 -21px}.elfinder-navbar-icon{width:16px;height:16px;position:absolute;top:50%;margin-top:-8px;background-image:url("../img/toolbar.png");background-repeat:no-repeat;background-position:0 -16px}.elfinder-ltr .elfinder-navbar-icon{left:14px}.elfinder-rtl .elfinder-navbar-icon{right:14px}.elfinder-tree .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 0}.elfinder-places .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 -704px}.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon{background-image:url("../img/volume_icon_local.png")}.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon{background-image:url("../img/volume_icon_ftp.png")}.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon{background-image:url("../img/volume_icon_sql.png")}.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon{background-image:url("../img/volume_icon_dropbox.png")}.ui-state-active .elfinder-navbar-icon,.elfinder-droppable-active .elfinder-navbar-icon,.ui-state-hover .elfinder-navbar-icon{background-position:0 -32px}.elfinder-navbar-subtree{display:none}.elfinder-ltr .elfinder-navbar-subtree{margin-left:12px}.elfinder-rtl .elfinder-navbar-subtree{margin-right:12px}.elfinder-navbar-spinner{width:14px;height:14px;position:absolute;display:block;top:50%;margin-top:-7px;background:url("../img/spinner-mini.gif") center center no-repeat}.elfinder-ltr .elfinder-navbar-spinner{left:0;margin-left:-2px}.elfinder-rtl .elfinder-navbar-spinner{right:0;margin-right:-2px}.elfinder-navbar .elfinder-perms{top:50%;margin-top:-8px}.elfinder-navbar .elfinder-lock{top:-2px}.elfinder-ltr .elfinder-navbar .elfinder-perms{left:18px}.elfinder-rtl .elfinder-navbar .elfinder-perms{right:18px}.elfinder-ltr .elfinder-navbar .elfinder-lock{left:18px}.elfinder-rtl .elfinder-navbar .elfinder-lock{right:18px}.elfinder-ltr .elfinder-navbar .elfinder-symlink{left:8px}.elfinder-rtl .elfinder-navbar .elfinder-symlink{right:8px}.elfinder-navbar input{width:100%;border:0 solid;margin:0;padding:0}.elfinder-navbar .ui-resizable-handle{width:12px;background:url('../img/resize.png') center center no-repeat}.elfinder-nav-handle-icon{position:absolute;top:50%;margin:-8px 2px 0;opacity:.5;filter:Alpha(Opacity=50)}.elfinder-places{border:none;margin:0;padding:0}.elfinder-navbar-root .elfinder-places-root-icon{position:absolute;top:50%;margin-top:-9px;cursor:pointer;display:none}.elfinder-ltr .elfinder-places-root-icon{right:10px}.elfinder-rtl .elfinder-places-root-icon{left:10px}.elfinder-navbar-expanded .elfinder-places-root-icon{display:block}.elfinder-place-drag{font-size:.8em}.elfinder-quicklook{position:absolute;background:url("../img/quicklook-bg.png");display:none;overflow:hidden;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;padding:20px 0 40px}.elfinder-quicklook .ui-resizable-se{width:14px;height:14px;right:5px;bottom:3px;background:url("../img/toolbar.png") 0 -496px no-repeat}.elfinder-quicklook-fullscreen{border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;-webkit-background-clip:padding-box;padding:0;background:#000;z-index:90000;display:block}.elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar{display:none}.elfinder-quicklook-fullscreen .elfinder-quicklook-preview{border:0 solid}.elfinder-quicklook-titlebar{text-align:center;background:#777;position:absolute;left:0;top:0;width:100%;height:20px;-moz-border-radius-topleft:7px;-webkit-border-top-left-radius:7px;border-top-left-radius:7px;-moz-border-radius-topright:7px;-webkit-border-top-right-radius:7px;border-top-right-radius:7px;cursor:move}.elfinder-quicklook-title{color:#fff;white-space:nowrap;overflow:hidden;padding:2px 0}.elfinder-quicklook-titlebar .ui-icon{position:absolute;left:4px;top:50%;margin-top:-8px;width:16px;height:16px;cursor:default}.elfinder-quicklook-preview{overflow:hidden;position:relative;border:0 solid;border-left:1px solid transparent;border-right:1px solid transparent;height:100%}.elfinder-quicklook-info-wrapper{position:absolute;width:100%;left:0;top:50%;margin-top:-50px}.elfinder-quicklook-info{padding:0 12px 0 112px}.elfinder-quicklook-info .elfinder-quicklook-info-data:first-child{color:#fff;font-weight:700;padding-bottom:.5em}.elfinder-quicklook-info-data{padding-bottom:.2em;color:#fff}.elfinder-quicklook .elfinder-cwd-icon{position:absolute;left:32px;top:50%;margin-top:-20px}.elfinder-quicklook-preview img{display:block;margin:0 auto}.elfinder-quicklook-navbar{position:absolute;left:50%;bottom:4px;width:140px;height:32px;padding:0;margin-left:-70px;border:1px solid transparent;border-radius:19px;-moz-border-radius:19px;-webkit-border-radius:19px}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar{width:188px;margin-left:-94px;padding:5px;border:1px solid #eee;background:#000}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-icon-close,.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-separator{display:inline}.elfinder-quicklook-navbar-icon{width:32px;height:32px;margin:0 7px;float:left;background:url("../img/quicklook-icons.png") 0 0 no-repeat}.elfinder-quicklook-navbar-icon-fullscreen{background-position:0 -64px}.elfinder-quicklook-navbar-icon-fullscreen-off{background-position:0 -96px}.elfinder-quicklook-navbar-icon-prev{background-position:0 0}.elfinder-quicklook-navbar-icon-next{background-position:0 -32px}.elfinder-quicklook-navbar-icon-close{background-position:0 -128px;display:none}.elfinder-quicklook-navbar-separator{width:1px;height:32px;float:left;border-left:1px solid #fff;display:none}.elfinder-quicklook-preview-text-wrapper{width:100%;height:100%;background:#fff;color:#222;overflow:auto}pre.elfinder-quicklook-preview-text{margin:0;padding:3px 9px}.elfinder-quicklook-preview-html,.elfinder-quicklook-preview-pdf{width:100%;height:100%;background:#fff;border:0 solid;margin:0}.elfinder-quicklook-preview-flash{width:100%;height:100%}.elfinder-quicklook-preview-audio{width:100%;position:absolute;bottom:0;left:0}embed.elfinder-quicklook-preview-audio{height:30px;background:0 0}.elfinder-quicklook-preview-video{width:100%;height:100%}.elfinder-statusbar{text-align:center;font-weight:400;padding:.2em .5em;border-right:0 solid transparent;border-bottom:0 solid transparent;border-left:0 solid transparent;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none}.elfinder-statusbar a{text-decoration:none}.elfinder-path{max-width:30%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.elfinder-ltr .elfinder-path{float:left}.elfinder-rtl .elfinder-path{float:right}.elfinder-stat-size{white-space:nowrap}.elfinder-ltr .elfinder-stat-size{float:right}.elfinder-rtl .elfinder-stat-size{float:left}.elfinder-stat-selected{white-space:nowrap;overflow:hidden}.elfinder-toolbar{padding:4px 0 3px;border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent}.elfinder-buttonset{margin:1px 4px;float:left;background:0 0;padding:0;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}.elfinder .elfinder-button{width:16px;height:16px;margin:0;padding:4px;float:left;overflow:hidden;position:relative;border:0 solid;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.elfinder .ui-icon-search{cursor:pointer}.elfinder-button:first-child{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.elfinder-button:last-child{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.elfinder-toolbar-button-separator{float:left;padding:0;height:24px;border-top:0 solid;border-right:0 solid;border-bottom:0 solid;width:0}.elfinder .elfinder-button.ui-state-disabled{opacity:1;filter:Alpha(Opacity=100)}.elfinder .elfinder-button.ui-state-disabled .elfinder-button-icon{opacity:.4;filter:Alpha(Opacity=40)}.elfinder-rtl .elfinder-buttonset{float:right}.elfinder-button-icon{width:16px;height:16px;display:block;background:url('../img/toolbar.png') no-repeat}.elfinder-button-icon-home{background-position:0 0}.elfinder-button-icon-back{background-position:0 -112px}.elfinder-button-icon-forward{background-position:0 -128px}.elfinder-button-icon-up{background-position:0 -144px}.elfinder-button-icon-reload{background-position:0 -160px}.elfinder-button-icon-open{background-position:0 -176px}.elfinder-button-icon-mkdir{background-position:0 -192px}.elfinder-button-icon-mkfile{background-position:0 -208px}.elfinder-button-icon-rm{background-position:0 -224px}.elfinder-button-icon-copy{background-position:0 -240px}.elfinder-button-icon-cut{background-position:0 -256px}.elfinder-button-icon-paste{background-position:0 -272px}.elfinder-button-icon-getfile{background-position:0 -288px}.elfinder-button-icon-duplicate{background-position:0 -304px}.elfinder-button-icon-rename{background-position:0 -320px}.elfinder-button-icon-edit{background-position:0 -336px}.elfinder-button-icon-quicklook{background-position:0 -352px}.elfinder-button-icon-upload{background-position:0 -368px}.elfinder-button-icon-download{background-position:0 -384px}.elfinder-button-icon-info{background-position:0 -400px}.elfinder-button-icon-extract{background-position:0 -416px}.elfinder-button-icon-archive{background-position:0 -432px}.elfinder-button-icon-view{background-position:0 -448px}.elfinder-button-icon-view-list{background-position:0 -464px}.elfinder-button-icon-help{background-position:0 -480px}.elfinder-button-icon-resize{background-position:0 -512px}.elfinder-button-icon-link{background-position:0 -528px}.elfinder-button-icon-search{background-position:0 -561px}.elfinder-button-icon-sort{background-position:0 -577px}.elfinder-button-icon-rotate-r{background-position:0 -625px}.elfinder-button-icon-rotate-l{background-position:0 -641px}.elfinder-button-icon-netmount{background-position:0 -688px}.elfinder-button-icon-netunmount{background-position:0 -96px}.elfinder-button-icon-places{background-position:0 -704px}.elfinder-button-icon-chmod{background-position:0 -48px}.elfinder-button-icon-accept{background-position:0 -736px}.elfinder-button-icon-opendir{background-position:0 -32px}.elfinder .elfinder-menubutton{overflow:visible}.elfinder-button-icon-spinner{background:url("../img/spinner-mini.gif") center center no-repeat}.elfinder-button-menu{position:absolute;left:0;top:25px;padding:3px 0}.elfinder-button-menu-item{white-space:nowrap;cursor:default;padding:5px 19px;position:relative}.elfinder-button-menu .ui-state-hover{border:0 solid}.elfinder-button-menu-item-separated{border-top:1px solid #ccc}.elfinder-button-menu-item .ui-icon{width:16px;height:16px;position:absolute;left:2px;top:50%;margin-top:-8px;display:none}.elfinder-button-menu-item-selected .ui-icon{display:block}.elfinder-button-menu-item-selected-asc .ui-icon-arrowthick-1-n,.elfinder-button-menu-item-selected-desc .ui-icon-arrowthick-1-s{display:none}.elfinder-button form{position:absolute;top:0;right:0;opacity:0;filter:Alpha(Opacity=0);cursor:pointer}.elfinder .elfinder-button form input{background:0 0;cursor:default}.elfinder .elfinder-button-search{border:0 solid;background:0 0;padding:0;margin:1px 4px;height:auto;min-height:26px;float:right;width:202px;overflow:visible}.elfinder .elfinder-button-search .elfinder-button-menu{font-size:8pt;text-align:center;width:100%}.elfinder .elfinder-button-search .elfinder-button-menu div{margin-left:auto;margin-right:auto;margin-bottom:5px}.elfinder .elfinder-button-search .elfinder-button-menu div .ui-state-hover{border:1px solid}.elfinder-ltr .elfinder-button-search{float:right;margin-right:10px}.elfinder-rtl .elfinder-button-search{float:left;margin-left:10px}.elfinder-button-search input{width:160px;height:22px;padding:0 20px;line-height:22px;border:1px solid #aaa;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;outline:0 solid}.elfinder-rtl .elfinder-button-search input{direction:rtl}.elfinder-button-search .ui-icon{position:absolute;height:18px;top:50%;margin:-9px 4px 0;opacity:.6;filter:Alpha(Opacity=60)}.elfinder-ltr .elfinder-button-search .ui-icon-search{left:0}.elfinder-rtl .elfinder-button-search .ui-icon-search,.elfinder-ltr .elfinder-button-search .ui-icon-close{right:0}.elfinder-rtl .elfinder-button-search .ui-icon-close{left:0}
1
  /*!
2
  * elFinder - file manager for web
3
+ * Version 2.1.18 (2016-11-21)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
+ * Licensed under a 3-clauses BSD license
8
  */
9
+ .elfinder-dialog-resize{margin-top:.3em}.elfinder-resize-type{float:left;margin-bottom:.4em}.elfinder-resize-control{float:left}.elfinder-resize-control input[type=text]{border:1px solid #aaa;text-align:right;width:4em}.elfinder-resize-control input.elfinder-resize-bg{text-align:center;width:5em;direction:ltr}.elfinder-dialog-resize .elfinder-resize-imgrotate,.elfinder-dialog-resize .elfinder-resize-pallet{cursor:pointer}.elfinder-dialog-resize .elfinder-resize-picking{cursor:crosshair}.elfinder-dialog-resize .elfinder-resize-grid8+button{padding-top:2px;padding-bottom:2px}.elfinder-resize-preview{width:400px;height:400px;padding:10px;background:#fff;border:1px solid #aaa;float:right;position:relative;overflow:hidden;text-align:left;direction:ltr}.elfinder .elfinder-cwd table tbody.elfinder-cwd-fixheader,.elfinder-resize-handle,div.elfinder-cwd-wrapper-list tr.ui-state-default td{position:relative}.elfinder-resize-handle-hline,.elfinder-resize-handle-vline{position:absolute;background-image:url(../img/crop.gif)}.elfinder-resize-handle-hline{width:100%;height:1px!important;background-repeat:repeat-x}.elfinder-resize-handle-vline{width:1px!important;height:100%;background-repeat:repeat-y}.elfinder-resize-handle-hline-top{top:0;left:0}.elfinder-resize-handle-hline-bottom{bottom:0;left:0}.elfinder-resize-handle-vline-left{top:0;left:0}.elfinder-resize-handle-vline-right{top:0;right:0}.elfinder-resize-handle-point{position:absolute;width:8px;height:8px;border:1px solid #777;background:0 0}.elfinder-resize-handle-point-n{top:0;left:50%;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-e,.elfinder-resize-handle-point-ne{top:0;right:0;margin-top:-5px;margin-right:-5px}.elfinder-resize-handle-point-e{top:50%}.elfinder-resize-handle-point-se{bottom:0;right:0;margin-bottom:-5px;margin-right:-5px}.elfinder-resize-handle-point-s,.elfinder-resize-handle-point-sw{bottom:0;left:50%;margin-bottom:-5px;margin-left:-5px}.elfinder-resize-handle-point-sw{left:0}.elfinder-resize-handle-point-nw,.elfinder-resize-handle-point-w{top:50%;left:0;margin-top:-5px;margin-left:-5px}.elfinder-resize-handle-point-nw{top:0}.elfinder-resize-spinner{position:absolute;width:200px;height:30px;top:50%;margin-top:-25px;left:50%;margin-left:-100px;text-align:center;background:url(../img/progress.gif) center bottom repeat-x}.elfinder-resize-row{margin-bottom:9px;position:relative}.elfinder-resize-label{float:left;width:80px;padding-top:3px}.elfinder-resize-checkbox-label{border:1px solid transparent}.elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls{margin:-20px 5px 0}.elfinder-ltr .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls{float:right}.elfinder-help-team div,.elfinder-info-tb span,.elfinder-rtl .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-whctrls{float:left}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-w{height:100%;width:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-n,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{width:100%;height:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-e{margin-right:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-w{margin-left:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{margin-bottom:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-n{margin-top:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se,.elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw{width:10px;height:10px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-se{background:0 0;bottom:0;right:0;margin-right:-7px;margin-bottom:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw{margin-left:-7px;margin-bottom:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne{margin-right:-7px;margin-top:-7px}.elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw{margin-left:-7px;margin-top:-7px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-n,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-s{height:20px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-e,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-w{width:20px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-ne,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-nw,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-se,.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .ui-resizable-sw{width:30px;height:30px}.elfinder-touch .elfinder-dialog .elfinder-dialog-resize .elfinder-resize-preview .ui-resizable-se{width:30px;height:30px;zoom:1;margin:0}.elfinder-dialog-resize .ui-icon-grip-solid-vertical{position:absolute;top:50%;right:0;margin-top:-8px;margin-right:-11px}.elfinder-dialog-resize .ui-icon-grip-solid-horizontal{position:absolute;left:50%;bottom:0;margin-left:-8px;margin-bottom:-11px}.elfinder-dialog-resize .elfinder-resize-row .ui-buttonset{float:right}.elfinder-dialog-resize .elfinder-resize-degree input,.elfinder-dialog-resize .elfinder-resize-quality input{width:2.5em}.elfinder-dialog-resize .elfinder-resize-degree button.ui-button{padding:6px 8px}.elfinder-dialog-resize button.ui-button span{padding:0}.ui-widget-content .elfinder-dialog-resize .elfinder-resize-rotate-slider{width:195px;margin:10px 7px;background-color:#fafafa}.elfinder-dialog-resize .elfinder-resize-type span.ui-checkboxradio-icon{display:none}.elfinder-file-edit{width:100%;height:99%;margin:0;padding:2px;border:1px solid #ccc;box-sizing:border-box}.elfinder-touch .elfinder-file-edit{font-size:16px}.elfinder-touch.elfinder-fullscreen-native textarea.elfinder-file-edit{padding-bottom:20em;margin-bottom:-20em}div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon{position:absolute;top:4px;left:0;right:0;margin:auto 0 auto auto}.elfinder-touch div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon{top:7px}.elfinder-rtl div.elfinder-cwd-wrapper-list tr.ui-state-default td span.ui-icon{margin:auto auto auto 0}.elfinder-help{margin-bottom:.5em}.elfinder-help .ui-tabs-panel{padding:.5em}.elfinder-dialog .ui-tabs .ui-tabs-nav li a{padding:.2em 1em}.elfinder-help-shortcuts{height:300px;padding:1em;margin:.5em 0;overflow:auto}.elfinder-help-shortcut{white-space:nowrap;clear:both}.elfinder-help-shortcut-pattern{float:left;width:160px}.elfinder-help-logo{width:100px;height:96px;float:left;margin-right:1em;background:url(../img/logo.png) center center no-repeat}.elfinder-help h3{font-size:1.5em;margin:.2em 0 .3em}.elfinder-help-separator{clear:both;padding:.5em}.elfinder-help-link,.std42-dialog .ui-dialog-buttonpane button span.ui-icon{padding:2px}.elfinder-help .ui-priority-secondary{font-size:.9em}.elfinder-help .ui-priority-primary{margin-bottom:7px}.elfinder-help-team{clear:both;text-align:right;border-bottom:1px solid #ccc;margin:.5em 0;font-size:.9em}.elfinder-help-license{font-size:.9em}.elfinder-help-disabled{font-weight:700;text-align:center;margin:90px 0}.elfinder-help .elfinder-dont-panic{display:block;border:1px solid transparent;width:200px;height:200px;margin:30px auto;text-decoration:none;text-align:center;position:relative;background:#d90004;-moz-box-shadow:5px 5px 9px #111;-webkit-box-shadow:5px 5px 9px #111;box-shadow:5px 5px 9px #111;background:-moz-radial-gradient(80px 80px,circle farthest-corner,#d90004 35%,#960004 100%);background:-webkit-gradient(radial,80 80,60,80 80,120,from(#d90004),to(#960004));-moz-border-radius:100px;-webkit-border-radius:100px;border-radius:100px;outline:none}.elfinder-help .elfinder-dont-panic span{font-size:3em;font-weight:700;text-align:center;color:#fff;position:absolute;left:0;top:45px}.elfinder-help-debug{height:auto;padding:0;margin:0;overflow:none;border:none}.elfinder-help-debug .ui-tabs-panel{height:310px;padding:0;margin:0;overflow:auto}.elfinder-help-debug fieldset{margin-bottom:10px;border-color:#789;border-radius:10px}.elfinder-help-debug legend{font-size:1.2em;font-weight:700;color:#2e8b57}.elfinder-help-debug dl{margin:0}.elfinder-help-debug dt{color:#789}.elfinder-help-debug dt:before{content:"["}.elfinder-help-debug dt:after{content:"]"}.elfinder-help-debug dd{margin-left:1em}.elfinder-info-title .elfinder-cwd-bgurl:after{left:-28px}.elfinder-info-title .elfinder-cwd-icon-video:after{left:-7px}.elfinder-upload-dialog-wrapper .elfinder-upload-dirselect{position:absolute;bottom:2px;width:16px;height:16px;padding:10px;border:none;overflow:hidden;cursor:pointer}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item .ui-icon,.elfinder-ltr .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect{left:2px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item .ui-icon,.elfinder-rtl .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect{right:2px}.ui-front{z-index:100}.elfinder{padding:0;position:relative;display:block;font-size:18px;font-family:Verdana,Arial,Helvetica,sans-serif}.elfinder.elfinder-processing *{cursor:progress!important}.elfinder.elfinder-processing.elfinder-touch .elfinder-workzone:after{position:absolute;top:0;width:100%;height:3px;content:'';left:0;background-image:url(../img/progress.gif);opacity:.6;pointer-events:none}.elfinder :not(input):not(textarea):not(select):not([contenteditable=true]),.elfinder-contextmenu :not(input):not(textarea):not(select):not([contenteditable=true]){-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none}.elfinder .overflow-scrolling-touch{-webkit-overflow-scrolling:touch}.elfinder-rtl{text-align:right;direction:rtl}.elfinder-workzone{padding:0;position:relative;overflow:hidden}.elfinder-lock,.elfinder-perms,.elfinder-symlink{position:absolute;width:16px;height:16px;background-image:url(../img/toolbar.png);background-repeat:no-repeat}.elfinder-perms,.elfinder-symlink{background-position:0 -528px}.elfinder-na .elfinder-perms{background-position:0 -96px}.elfinder-ro .elfinder-perms{background-position:0 -64px}.elfinder-wo .elfinder-perms{background-position:0 -80px}.elfinder-group .elfinder-perms{background-position:0 0}.elfinder-lock{background-position:0 -656px}.elfinder-drag-helper{top:0;left:0;width:70px;height:60px;padding:0 0 0 25px;z-index:100000;will-change:left,top}.elfinder-drag-helper.html5-native{position:absolute;top:-1000px;left:-1000px}.elfinder-drag-helper-icon-status{position:absolute;width:16px;height:16px;left:42px;top:60px;background:url(../img/toolbar.png) 0 -96px no-repeat;display:block}.elfinder-drag-helper-move .elfinder-drag-helper-icon-status{background-position:0 -720px}.elfinder-drag-helper-plus .elfinder-drag-helper-icon-status{background-position:0 -544px}.elfinder-drag-num{position:absolute;top:0;left:0;width:16px;height:14px;text-align:center;padding-top:2px;font-weight:700;color:#fff;background-color:red;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-drag-helper .elfinder-cwd-icon{margin:0 0 0 -24px;float:left}.elfinder-overlay{position:absolute;opacity:.2;filter:Alpha(Opacity=20)}.elfinder .elfinder-panel{position:relative;background-image:none;padding:7px 12px}[draggable=true]{-khtml-user-drag:element}.elfinder [contentEditable=true]:empty:not(:focus):before{content:attr(data-ph)}.elfinder div.elfinder-bottomtray{position:fixed;bottom:0;max-width:100%;opacity:.8}.elfinder.elfinder-ltr div.elfinder-bottomtray{left:0}.elfinder.elfinder-rtl div.elfinder-bottomtray{right:0}.elfinder .elfinder-contextmenu,.elfinder .elfinder-contextmenu-sub{position:absolute;border:1px solid #aaa;background:#fff;color:#555;padding:4px 0;top:0;left:0}.elfinder .elfinder-contextmenu-sub{top:5px}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub{margin-left:-5px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub{margin-right:-5px}.elfinder .elfinder-contextmenu-header{margin-top:-4px;padding:0 .5em .2ex;border:none;text-align:center}.elfinder .elfinder-contextmenu-header span{font-size:.8em;font-weight:bolder}.elfinder .elfinder-contextmenu-item{position:relative;display:block;padding:4px 30px;text-decoration:none;white-space:nowrap;cursor:default}.elfinder .elfinder-contextmenu-item.ui-state-active{border:none}.elfinder .elfinder-contextmenu-item .ui-icon{width:16px;height:16px;position:absolute;left:auto;right:auto;top:50%;margin-top:-8px}.elfinder-touch .elfinder-contextmenu-item{padding:12px 38px}.elfinder-navbar-root-local.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_local.png)}.elfinder-navbar-root-ftp.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_ftp.png)}.elfinder-navbar-root-sql.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_sql.png)}.elfinder-navbar-root-dropbox.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_dropbox.png)}.elfinder-navbar-root-googledrive.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_googledrive.png)}.elfinder-navbar-root-onedrive.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_onedrive.png)}.elfinder-navbar-root-box.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_box.png)}.elfinder .elfinder-contextmenu .elfinder-contextmenu-item span{display:block}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-item{text-align:left}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item{text-align:right}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-left:12px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-right:12px}.elfinder .elfinder-contextmenu-arrow,.elfinder .elfinder-contextmenu-extra-icon,.elfinder .elfinder-contextmenu-icon{position:absolute;top:50%;margin-top:-8px;overflow:hidden}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-icon{left:8px}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-extra-icon,.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-icon{right:8px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-extra-icon{left:8px}.elfinder .elfinder-contextmenu-arrow{width:16px;height:16px;background:url(../img/arrows-normal.png) 5px 4px no-repeat}.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-arrow{right:5px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-arrow{left:5px;background-position:0 -10px}.elfinder .elfinder-contextmenu-extra-icon a,.elfinder .elfinder-contextmenu-extra-icon span{display:inline-block;width:100%;height:100%;padding:20px;margin:0;color:transparent!important;text-decoration:none;cursor:pointer}.elfinder .elfinder-contextmenu .ui-state-hover{border:0 solid;background-image:none}.elfinder .elfinder-contextmenu-separator{height:0;border-top:1px solid #ccc;margin:0 1px}.elfinder .elfinder-button-icon.ui-state-disabled{background-image:url(../img/toolbar.png)!important}.elfinder-cwd-wrapper{overflow:auto;position:relative;padding:2px;margin:0}.elfinder-cwd-wrapper-list{padding:0}.elfinder-cwd{position:relative;cursor:default;padding:0;margin:0;-ms-touch-action:auto;touch-action:auto}.elfinder .elfinder-cwd-wrapper.elfinder-droppable-active{outline:2px solid #8cafed;outline-offset:-2px}.elfinder-cwd-wrapper-empty .elfinder-cwd:after{display:block;position:absolute;top:40%;left:0;right:0;margin-top:-2em;line-height:1.5em;text-align:center;white-space:pre-wrap;opacity:.6;filter:Alpha(Opacity=60);font-weight:700}.elfinder-cwd-file .elfinder-cwd-select{position:absolute;top:0;left:0;width:30px;height:30px;background-color:transparent;opacity:.4;filter:Alpha(Opacity=40)}.elfinder-cwd-file.ui-selected .elfinder-cwd-select{opacity:.8;filter:Alpha(Opacity=80)}.elfinder-rtl .elfinder-cwd-file .elfinder-cwd-select{left:auto;right:0}.elfinder .elfinder-cwd-selectall{position:absolute;width:30px;height:30px;top:0;opacity:.8;filter:Alpha(Opacity=80)}.elfinder .elfinder-workzone.elfinder-cwd-wrapper-empty .elfinder-cwd-selectall{display:none}.elfinder-ltr .elfinder-workzone .elfinder-cwd-selectall{text-align:right;right:18px;left:auto}.elfinder-rtl .elfinder-workzone .elfinder-cwd-selectall{text-align:left;right:auto;left:18px}.elfinder-ltr.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall{right:0}.elfinder-rtl.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall{left:0}.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select.ui-state-hover{background-color:transparent}.elfinder-cwd-view-icons .elfinder-cwd-file{width:120px;height:80px;padding-bottom:2px;cursor:default;border:none;position:relative}.elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file{float:left;margin:0 3px 12px 0}.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file{float:right;margin:0 0 5px 3px}.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover{border:0 solid}.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper{width:52px;height:52px;margin:1px auto;padding:2px;position:relative}.elfinder-cwd-view-icons .elfinder-cwd-filename{text-align:center;max-height:2.4em;line-height:1.2em;white-space:pre-line;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;margin:3px 1px 0;padding:1px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;word-break:break-word;overflow-wrap:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.elfinder-cwd-view-icons .elfinder-perms{bottom:4px;right:2px}.elfinder-cwd-view-icons .elfinder-lock{top:-3px;right:-2px}.elfinder-cwd-view-icons .elfinder-symlink{bottom:6px;left:0}.elfinder-cwd-icon{display:block;width:48px;height:48px;margin:0 auto;background:url(../img/icons-big.png) 0 0 no-repeat;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box}.elfinder-cwd-view-list .elfinder-navbar-root-local td .elfinder-cwd-icon,.elfinder-navbar-root-local .elfinder-cwd-icon{background-image:url(../img/volume_icon_local.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_local.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-ftp td .elfinder-cwd-icon,.elfinder-navbar-root-ftp .elfinder-cwd-icon{background-image:url(../img/volume_icon_ftp.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_ftp.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-sql td .elfinder-cwd-icon,.elfinder-navbar-root-sql .elfinder-cwd-icon{background-image:url(../img/volume_icon_sql.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_sql.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-dropbox td .elfinder-cwd-icon,.elfinder-navbar-root-dropbox .elfinder-cwd-icon{background-image:url(../img/volume_icon_dropbox.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_dropbox.png);background-size:contain;background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-googledrive td .elfinder-cwd-icon,.elfinder-navbar-root-googledrive .elfinder-cwd-icon{background-image:url(../img/volume_icon_googledrive.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_googledrive.png);background-size:contain}.elfinder-cwd-view-list .elfinder-navbar-root-onedrive td .elfinder-cwd-icon,.elfinder-navbar-root-onedrive .elfinder-cwd-icon{background-image:url(../img/volume_icon_onedrive.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_onedrive.png);background-size:contain}.elfinder-cwd-view-list .elfinder-navbar-root-box td .elfinder-cwd-icon,.elfinder-navbar-root-box .elfinder-cwd-icon{background-image:url(../img/volume_icon_box.png);background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/volume_icon_box.png);background-size:contain}.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon,.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon,.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-network td .elfinder-cwd-icon,.elfinder-navbar-root-network .elfinder-cwd-icon{background-image:url(../img/toolbar.png);background-position:0 86%;background-size:cover}.elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon{background-image:url(../img/toolbar.png);background-size:cover;background-position:1px -1px}.elfinder-cwd-icon.elfinder-cwd-bgurl{background-position:center center;background-repeat:no-repeat}.elfinder-cwd-icon.elfinder-cwd-bgurl,.elfinder-cwd-icon.elfinder-cwd-bgurl.elfinder-cwd-bgself{-moz-background-size:cover;background-size:cover}.elfinder-cwd-bgurl:after{content:' ';position:relative;display:inline-block;top:36px;left:-38px;width:48px;height:48px;background:url(../img/icons-big.png) 0 0 no-repeat;background-size:auto!important;opacity:.8;filter:Alpha(Opacity=60);-webkit-transform-origin:54px -24px;-webkit-transform:scale(.6);-moz-transform-origin:54px -24px;-moz-transform:scale(.6);-ms-transform-origin:54px -24px;-ms-transform:scale(.6);-o-transform-origin:54px -24px;-o-transform:scale(.6);transform-origin:54px -24px;transform:scale(.6)}.elfinder-cwd-icon-image:after,.elfinder-cwd-view-list .elfinder-cwd-icon.elfinder-cwd-icon-video.elfinder-cwd-bgurl:after{content:none}.elfinder-cwd-icon-video:after{top:32px;left:-26px;height:25px;width:22px;background-position:0 -373px;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}.elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon{background-position:0 -100px}.elfinder-cwd .elfinder-droppable-active{outline:2px solid #8cafed;outline-offset:-2px}.elfinder-cwd-icon-directory{background-position:0 -50px}.elfinder-cwd-icon-application,.elfinder-cwd-icon-application:after{background-position:0 -150px}.elfinder-cwd-icon-text,.elfinder-cwd-icon-text:after,.elfinder-cwd-icon-x-empty,.elfinder-cwd-icon-x-empty:after{background-position:0 -200px}.elfinder-cwd-icon-image,.elfinder-cwd-icon-image:after,.elfinder-cwd-icon-postscript,.elfinder-cwd-icon-postscript:after,.elfinder-cwd-icon-vnd-adobe-photoshop,.elfinder-cwd-icon-vnd-adobe-photoshop:after{background-position:0 -250px}.elfinder-cwd-icon-audio,.elfinder-cwd-icon-audio:after{background-position:0 -300px}.elfinder-cwd-icon-flash-video,.elfinder-cwd-icon-video{background-position:0 -350px}.elfinder-cwd-icon-rtf,.elfinder-cwd-icon-rtf:after,.elfinder-cwd-icon-rtfd,.elfinder-cwd-icon-rtfd:after{background-position:0 -401px}.elfinder-cwd-icon-pdf,.elfinder-cwd-icon-pdf:after{background-position:0 -450px}.elfinder-cwd-icon-ms-excel,.elfinder-cwd-icon-ms-excel:after,.elfinder-cwd-icon-msword,.elfinder-cwd-icon-msword:after,.elfinder-cwd-icon-vnd-ms-excel,.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-excel:after,.elfinder-cwd-icon-vnd-ms-office,.elfinder-cwd-icon-vnd-ms-office:after,.elfinder-cwd-icon-vnd-ms-powerpoint,.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-powerpoint:after,.elfinder-cwd-icon-vnd-ms-word,.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12,.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12:after,.elfinder-cwd-icon-vnd-ms-word:after,.elfinder-cwd-icon-vnd-oasis-opendocument-chart,.elfinder-cwd-icon-vnd-oasis-opendocument-chart:after,.elfinder-cwd-icon-vnd-oasis-opendocument-database,.elfinder-cwd-icon-vnd-oasis-opendocument-database:after,.elfinder-cwd-icon-vnd-oasis-opendocument-formula,.elfinder-cwd-icon-vnd-oasis-opendocument-formula:after,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-graphics:after,.elfinder-cwd-icon-vnd-oasis-opendocument-image,.elfinder-cwd-icon-vnd-oasis-opendocument-image:after,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-presentation:after,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text,.elfinder-cwd-icon-vnd-oasis-opendocument-text-master,.elfinder-cwd-icon-vnd-oasis-opendocument-text-master:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text-template,.elfinder-cwd-icon-vnd-oasis-opendocument-text-template:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text-web,.elfinder-cwd-icon-vnd-oasis-opendocument-text-web:after,.elfinder-cwd-icon-vnd-oasis-opendocument-text:after,.elfinder-cwd-icon-vnd-openofficeorg-extension,.elfinder-cwd-icon-vnd-openofficeorg-extension:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document:after,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template,.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template:after{background-position:0 -500px}.elfinder-cwd-icon-html,.elfinder-cwd-icon-html:after{background-position:0 -550px}.elfinder-cwd-icon-css,.elfinder-cwd-icon-css:after{background-position:0 -600px}.elfinder-cwd-icon-javascript,.elfinder-cwd-icon-javascript:after,.elfinder-cwd-icon-x-javascript,.elfinder-cwd-icon-x-javascript:after{background-position:0 -650px}.elfinder-cwd-icon-x-perl,.elfinder-cwd-icon-x-perl:after{background-position:0 -700px}.elfinder-cwd-icon-x-python,.elfinder-cwd-icon-x-python:after{background-position:0 -750px}.elfinder-cwd-icon-x-ruby,.elfinder-cwd-icon-x-ruby:after{background-position:0 -800px}.elfinder-cwd-icon-x-sh,.elfinder-cwd-icon-x-sh:after,.elfinder-cwd-icon-x-shellscript,.elfinder-cwd-icon-x-shellscript:after{background-position:0 -850px}.elfinder-cwd-icon-x-c,.elfinder-cwd-icon-x-c--,.elfinder-cwd-icon-x-c--:after,.elfinder-cwd-icon-x-c--hdr,.elfinder-cwd-icon-x-c--hdr:after,.elfinder-cwd-icon-x-c--src,.elfinder-cwd-icon-x-c--src:after,.elfinder-cwd-icon-x-c:after,.elfinder-cwd-icon-x-chdr,.elfinder-cwd-icon-x-chdr:after,.elfinder-cwd-icon-x-csrc,.elfinder-cwd-icon-x-csrc:after,.elfinder-cwd-icon-x-java,.elfinder-cwd-icon-x-java-source,.elfinder-cwd-icon-x-java-source:after,.elfinder-cwd-icon-x-java:after{background-position:0 -900px}.elfinder-cwd-icon-x-php,.elfinder-cwd-icon-x-php:after{background-position:0 -950px}.elfinder-cwd-icon-xml,.elfinder-cwd-icon-xml:after{background-position:0 -1000px}.elfinder-cwd-icon-x-7z-compressed,.elfinder-cwd-icon-x-7z-compressed:after,.elfinder-cwd-icon-x-xz,.elfinder-cwd-icon-x-xz:after,.elfinder-cwd-icon-x-zip,.elfinder-cwd-icon-x-zip:after,.elfinder-cwd-icon-zip,.elfinder-cwd-icon-zip:after{background-position:0 -1050px}.elfinder-cwd-icon-x-gzip,.elfinder-cwd-icon-x-gzip:after,.elfinder-cwd-icon-x-tar,.elfinder-cwd-icon-x-tar:after{background-position:0 -1100px}.elfinder-cwd-icon-x-bzip,.elfinder-cwd-icon-x-bzip2,.elfinder-cwd-icon-x-bzip2:after,.elfinder-cwd-icon-x-bzip:after{background-position:0 -1150px}.elfinder-cwd-icon-x-rar,.elfinder-cwd-icon-x-rar-compressed,.elfinder-cwd-icon-x-rar-compressed:after,.elfinder-cwd-icon-x-rar:after{background-position:0 -1200px}.elfinder-cwd-icon-x-shockwave-flash,.elfinder-cwd-icon-x-shockwave-flash:after{background-position:0 -1250px}.elfinder-cwd-icon-group{background-position:0 -1300px}.elfinder-cwd-filename input{width:100%;border:none;margin:0;padding:0}.elfinder-cwd-view-icons,.elfinder-cwd-view-icons input{text-align:center}.elfinder-cwd-view-icons textarea{width:100%;border:0 solid;margin:0;padding:0;text-align:center;overflow:hidden;resize:none}.elfinder-cwd-wrapper.elfinder-cwd-fixheader .elfinder-cwd::after{display:none}.elfinder-cwd table{width:100%;border-collapse:separate;border:0 solid;margin:0 0 10px;border-spacing:0;box-sizing:padding-box;padding:2px;position:relative}.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader{position:absolute;overflow:hidden}.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before{content:'';position:absolute;width:100%;top:0;height:3px;background-color:#fff}.elfinder-droppable-active+.elfinder-cwd-wrapper-list.elfinder-cwd-fixheader:before{background-color:#8cafed}.elfinder .elfinder-workzone div.elfinder-cwd-fixheader table{table-layout:fixed}.elfinder-ltr .elfinder-cwd thead .elfinder-cwd-selectall{text-align:left;right:auto;left:0;padding-top:3px}.elfinder-rtl .elfinder-cwd thead .elfinder-cwd-selectall{text-align:right;right:0;left:auto;padding-top:3px}.elfinder-touch .elfinder-cwd thead .elfinder-cwd-selectall{padding-top:5px}.elfinder .elfinder-cwd table thead tr{border-left:0 solid;border-top:0 solid;border-right:0 solid}.elfinder .elfinder-cwd table thead td{padding:4px 14px}.elfinder-ltr .elfinder-cwd.elfinder-has-checkbox table thead td:first-child{padding:4px 14px 4px 22px}.elfinder-rtl .elfinder-cwd.elfinder-has-checkbox table thead td:first-child{padding:4px 22px 4px 14px}.elfinder .elfinder-cwd table thead td.ui-state-active{background:#ebf1f6;background:-moz-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ebf1f6),color-stop(50%,#abd3ee),color-stop(51%,#89c3eb),color-stop(100%,#d5ebfb));background:-webkit-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-o-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:-ms-linear-gradient(top,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);background:linear-gradient(to bottom,#ebf1f6 0%,#abd3ee 50%,#89c3eb 51%,#d5ebfb 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebf1f6', endColorstr='#d5ebfb',GradientType=0 )}.elfinder .elfinder-cwd table td{padding:4px 12px;white-space:pre;overflow:hidden;text-align:right;cursor:default;border:0 solid}.elfinder .elfinder-cwd table tbody td:first-child{position:relative}.elfinder .elfinder-cwd table td div{box-sizing:content-box}tr.elfinder-cwd-file td .elfinder-cwd-select{width:40px;padding-top:3px}.elfinder-touch tr.elfinder-cwd-file td .elfinder-cwd-select{padding-top:10px}.elfinder-touch .elfinder-cwd tr td{padding:10px 12px}.elfinder-touch .elfinder-cwd table thead td{padding:8px 14px}.elfinder-touch .elfinder-cwd tr.elfinder-cwd-file td{padding:13px 12px}.elfinder-ltr .elfinder-cwd table td{text-align:right}.elfinder-ltr .elfinder-cwd table td:first-child{text-align:left}.elfinder-rtl .elfinder-cwd table td{text-align:left}.elfinder-info-tb tr td:first-child,.elfinder-rtl .elfinder-cwd table td:first-child{text-align:right}.elfinder-odd-row{background:#eee}.elfinder-cwd-view-list .elfinder-cwd-file-wrapper{width:97%;position:relative}.elfinder-ltr .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper{margin-left:8px}.elfinder-rtl .elfinder-cwd-view-list.elfinder-has-checkbox .elfinder-cwd-file-wrapper{margin-right:8px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-filename{padding-left:23px}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-filename{padding-right:23px}.elfinder-cwd-view-list .elfinder-lock,.elfinder-cwd-view-list .elfinder-perms,.elfinder-cwd-view-list .elfinder-symlink{margin-top:-6px;opacity:.6;filter:Alpha(Opacity=60)}.elfinder-ltr .elfinder-cwd-view-list .elfinder-perms{left:8px;bottom:-4px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-lock{left:10px;top:0}.elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink{left:-7px;bottom:-4px}.elfinder-cwd-view-list td .elfinder-cwd-icon{width:16px;height:16px;position:absolute;top:50%;margin-top:-8px;background-image:url(../img/icons-small.png)}.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon{left:0}.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon{right:0}.elfinder-cwd-view-list thead td .ui-resizable-handle{height:100%;top:3px}.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-handle{top:-5px;margin:10px}.elfinder-cwd-view-list thead td .ui-resizable-e{right:-7px}.elfinder-cwd-view-list thead td .ui-resizable-w{left:-7px}.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-e{right:-16px}.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-w{left:-16px}.elfinder-cwd-wrapper-empty .elfinder-cwd-view-list.elfinder-cwd:after{margin-top:0}.std42-dialog{padding:0;position:absolute;left:auto;right:auto}.std42-dialog.elfinder-dialog-minimized{overFlow:hidden;position:relative;float:left;width:auto}.elfinder-rtl .std42-dialog.elfinder-dialog-minimized{float:right}.std42-dialog .ui-dialog-titlebar{border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent;-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;font-weight:400;padding:.2em 1em}.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar{padding:0 .5em;height:20px}.elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar{padding:.3em .5em}.std42-dialog.ui-draggable-disabled .ui-dialog-titlebar{cursor:default}.std42-dialog .ui-dialog-titlebar .ui-widget-header{border:none;cursor:pointer}.std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title{display:inherit;word-break:break-all}.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title{display:list-item;display:-moz-inline-box;white-space:nowrap;word-break:normal;overflow:hidden;word-wrap:normal;overflow-wrap:normal;max-width:-webkit-calc(100% - 24px);max-width:-moz-calc(100% - 24px);max-width:calc(100% - 24px)}.elfinder-touch .std42-dialog .ui-dialog-titlebar span.elfinder-dialog-title{padding-top:.15em}.elfinder-touch .std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar span.elfinder-dialog-title{max-width:-webkit-calc(100% - 36px);max-width:-moz-calc(100% - 36px);max-width:calc(100% - 36px)}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button{position:relative;float:left;top:10px;left:-10px;right:10px;width:20px;height:20px;padding:1px;margin:-10px 1px 0;background-color:transparent;background-image:none}.elfinder-touch .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button{transform:scale(1.1);zoom:1.1;margin-left:5px;margin-right:5px}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right{float:right;left:10px;right:-10px}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon{width:17px;height:17px;border-width:1px;border-color:transparent;opacity:.7;filter:Alpha(Opacity=70);-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon{opacity:1;filter:Alpha(Opacity=100)}.elfinder-mobile .std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close .ui-icon,.std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:hover .ui-icon{background-color:#ff6252;border-color:#e5695d}.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize .ui-icon,.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize:hover .ui-icon{background-color:#ffbc00;border-color:#e3a40b}.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full .ui-icon,.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full:hover .ui-icon{background-color:#26c82f;border-color:#13ae10}.elfinder-touch .std42-dialog.ui-dialog:not(ui-resizable-disabled) .ui-resizable-se{width:12px;height:12px;zoom:1.5;right:-7px;bottom:-7px;margin:3px 7px 7px 3px;background-position:-64px -224px}.elfinder-rtl .elfinder-dialog .ui-dialog-titlebar{text-align:right}.std42-dialog .ui-dialog-content{padding:.3em .5em;box-sizing:border-box}.elfinder .std42-dialog .ui-dialog-content,.elfinder .std42-dialog .ui-dialog-content *{-webkit-user-select:auto;-moz-user-select:text;-khtml-user-select:text;user-select:text}.std42-dialog .ui-dialog-buttonpane{border:0 solid;margin:0;padding:.5em;text-align:right}.elfinder-rtl .std42-dialog .ui-dialog-buttonpane{text-align:left}.std42-dialog .ui-dialog-buttonpane button{margin:.7em 0 0 .4em;padding:.2em;outline:0 solid}.std42-dialog .ui-dialog-buttonpane button span{padding:2px 9px}.elfinder-dialog .ui-resizable-e,.elfinder-dialog .ui-resizable-s{width:0;height:0}.std42-dialog .ui-button input{cursor:pointer}.elfinder-dialog-icon{position:absolute;width:32px;height:32px;left:10px;top:50%;margin-top:-15px;background:url(../img/dialogs.png) 0 0 no-repeat}.elfinder-rtl .elfinder-dialog-icon{left:auto;right:10px}.elfinder-dialog-confirm .ui-dialog-content,.elfinder-dialog-error .ui-dialog-content{padding-left:56px;min-height:35px}.elfinder-rtl .elfinder-dialog-confirm .ui-dialog-content,.elfinder-rtl .elfinder-dialog-error .ui-dialog-content{padding-left:0;padding-right:56px}.elfinder-dialog-notify .ui-dialog-titlebar-close,.elfinder-rm-title+br{display:none}.elfinder-dialog-notify .ui-dialog-content{padding:0}.elfinder-notify{border-bottom:1px solid #ccc;position:relative;padding:.5em;text-align:center;overflow:hidden}.elfinder-ltr .elfinder-notify{padding-left:36px}.elfinder-rtl .elfinder-notify{padding-right:36px}.elfinder-notify:last-child{border:0 solid}.elfinder-notify-progressbar{width:180px;height:8px;border:1px solid #aaa;background:#f5f5f5;margin:5px auto;overflow:hidden}.elfinder-notify-progress{width:100%;height:8px;background:url(../img/progress.gif) center center repeat-x}.elfinder-notify-progress,.elfinder-notify-progressbar{-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.elfinder-dialog-icon-file,.elfinder-dialog-icon-open,.elfinder-dialog-icon-readdir,.elfinder-dialog-icon-reload{background-position:0 -225px}.elfinder-dialog-icon-mkdir{background-position:0 -64px}.elfinder-dialog-icon-mkfile{background-position:0 -96px}.elfinder-dialog-icon-copy,.elfinder-dialog-icon-move,.elfinder-dialog-icon-prepare{background-position:0 -128px}.elfinder-dialog-icon-chunkmerge,.elfinder-dialog-icon-upload{background-position:0 -160px}.elfinder-dialog-icon-rm{background-position:0 -192px}.elfinder-dialog-icon-download{background-position:0 -260px}.elfinder-dialog-icon-save{background-position:0 -295px}.elfinder-dialog-icon-rename{background-position:0 -330px}.elfinder-dialog-icon-archive,.elfinder-dialog-icon-extract,.elfinder-dialog-icon-zipdl{background-position:0 -365px}.elfinder-dialog-icon-search{background-position:0 -402px}.elfinder-dialog-icon-chmod,.elfinder-dialog-icon-dim,.elfinder-dialog-icon-loadimg,.elfinder-dialog-icon-netmount,.elfinder-dialog-icon-netunmount,.elfinder-dialog-icon-preupload,.elfinder-dialog-icon-resize,.elfinder-dialog-icon-url{background-position:0 -434px}.elfinder-dialog-confirm-applyall{padding:0 1em;margin:0}.elfinder-ltr .elfinder-dialog-confirm-applyall{text-align:left}.elfinder-rtl .elfinder-dialog-confirm-applyall{text-align:right}.elfinder-dialog-confirm .elfinder-dialog-icon{background-position:0 -32px}.elfinder-dialog-confirm .ui-dialog-buttonset{width:auto}.elfinder-info-title .elfinder-cwd-icon{float:left;width:48px;height:48px;margin-right:1em}.elfinder-rtl .elfinder-info-title .elfinder-cwd-icon,.elfinder-rtl .elfinder-rm-title .elfinder-cwd-icon{float:right;margin-right:0;margin-left:1em}.elfinder-info-title strong{display:block;padding:.3em 0 .5em}.elfinder-info-tb{min-width:200px;border:0 solid;margin:1em .2em}.elfinder-info-tb td{white-space:nowrap;padding:2px}.elfinder-info-tb a{outline:none;text-decoration:underline}.elfinder-info-tb a:hover{text-decoration:none}.elfinder-info-spinner{width:14px;height:14px;float:left;background:url(../img/spinner-mini.gif) center center no-repeat;margin:0 5px}.elfinder-netmount-tb{margin:0 auto}.elfinder-netmount-tb input,.elfinder-netmount-tb select{border:1px solid #ccc}.elfinder-netmount-tb .elfinder-button-icon{cursor:pointer}button.elfinder-info-button{margin:-3.5px 0;cursor:pointer}.elfinder-upload-dropbox{display:table-cell;text-align:center;vertical-align:middle;padding:.5em;border:3px dashed #aaa;width:9999px;height:80px;overflow:hidden;word-break:keep-all}.elfinder-upload-dropbox.ui-state-hover{background:#dfdfdf;border:3px dashed #555}.elfinder-upload-dialog-or{margin:.3em 0;text-align:center}.elfinder-upload-dialog-wrapper{text-align:center}.elfinder-upload-dialog-wrapper .ui-button{position:relative;overflow:hidden}.elfinder-upload-dialog-wrapper .ui-button form{position:absolute;right:0;top:0;opacity:0;filter:Alpha(Opacity=0)}.elfinder-upload-dialog-wrapper .ui-button form input{padding:0 20px;font-size:3em}.dialogelfinder .dialogelfinder-drag{border-left:0 solid;border-top:0 solid;border-right:0 solid;font-weight:400;padding:2px 12px;cursor:move;position:relative;text-align:left}.elfinder-rtl .dialogelfinder-drag{text-align:right}.dialogelfinder-drag-close{position:absolute;top:50%;margin-top:-8px}.elfinder-ltr .dialogelfinder-drag-close{right:12px}.elfinder-rtl .dialogelfinder-drag-close{left:12px}.elfinder-rm-title{margin-bottom:.5ex}.elfinder-rm-title .elfinder-cwd-icon{float:left;width:48px;height:48px;margin-right:1em}.elfinder-rm-title strong{display:block;white-space:pre-wrap;word-break:normal;overflow:hidden;text-overflow:ellipsis}.elfinder-contextmenu .elfinder-contextmenu-item span{font-size:.72em}.elfinder-cwd-view-icons .elfinder-cwd-filename,.elfinder-cwd-view-list td{font-size:.7em}.std42-dialog .ui-dialog-titlebar{font-size:.82em}.std42-dialog .ui-dialog-content{font-size:.72em}.std42-dialog .ui-dialog-buttonpane{font-size:.76em}.dialogelfinder .dialogelfinder-drag,.elfinder-info-tb{font-size:.9em}.elfinder-upload-dialog-or,.elfinder-upload-dropbox{font-size:1.2em}.elfinder .elfinder-navbar{font-size:.72em}.elfinder-place-drag .elfinder-navbar-dir{font-size:.9em}.elfinder-quicklook-title,.elfinder-statusbar div{font-size:.7em}.elfinder-quicklook-info-data{font-size:.72em}.elfinder-quicklook-preview-text-wrapper{font-size:.9em}.elfinder-button-menu-item{font-size:.72em}.elfinder-button-search input{font-size:.8em}.elfinder-drag-num{font-size:12px}.elfinder-toast{font-size:.76em}.elfinder .elfinder-navbar{width:230px;padding:3px 5px;background-image:none;border-top:0 solid;border-bottom:0 solid;overflow:auto;position:relative}.elfinder-ltr .elfinder-navbar{float:left;border-left:0 solid}.elfinder-rtl .elfinder-navbar{float:right;border-right:0 solid}.elfinder-ltr .ui-resizable-e{margin-left:10px}.elfinder-tree{display:table;width:100%;margin:0 0 .5em;-webkit-tap-highlight-color:rgba(0,0,0,0)}.elfinder-navbar-dir{position:relative;display:block;white-space:nowrap;padding:3px 12px;margin:0;outline:0 solid;border:1px solid transparent;cursor:default}.elfinder-touch .elfinder-navbar-dir{padding:12px}.elfinder-ltr .elfinder-navbar-dir{padding-left:35px}.elfinder-rtl .elfinder-navbar-dir{padding-right:35px}.elfinder-navbar-arrow{width:12px;height:14px;position:absolute;display:none;top:50%;margin-top:-8px;background-image:url(../img/arrows-normal.png);background-repeat:no-repeat}.elfinder-ltr .elfinder-navbar-arrow{left:0;right:0}.elfinder-touch .elfinder-navbar-arrow{zoom:1.4;-moz-transform-origin:top left;-moz-transform:scale(1.4);margin-bottom:7px}.elfinder-ltr.elfinder-touch .elfinder-navbar-arrow{left:-3px;margin-right:20px}.elfinder-rtl.elfinder-touch .elfinder-navbar-arrow{right:-3px;margin-left:20px}.ui-state-active .elfinder-navbar-arrow{background-image:url(../img/arrows-active.png)}.elfinder-navbar-collapsed .elfinder-navbar-arrow{display:block}.elfinder-ltr .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 4px}.elfinder-rtl .elfinder-navbar-collapsed .elfinder-navbar-arrow{background-position:0 -10px}.elfinder-ltr .elfinder-navbar-expanded .elfinder-navbar-arrow,.elfinder-rtl .elfinder-navbar-expanded .elfinder-navbar-arrow{background-position:0 -21px}.elfinder-navbar-icon{width:16px;height:16px;position:absolute;top:50%;margin-top:-8px;background-image:url(../img/toolbar.png);background-repeat:no-repeat;background-position:0 -16px}.elfinder-ltr .elfinder-navbar-icon{left:14px}.elfinder-rtl .elfinder-navbar-icon{right:14px}.elfinder-tree .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 0}.elfinder-places .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 -704px}.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon{background-image:url(../img/volume_icon_local.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon{background-image:url(../img/volume_icon_ftp.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon{background-image:url(../img/volume_icon_sql.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon{background-image:url(../img/volume_icon_dropbox.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon{background-image:url(../img/volume_icon_googledrive.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon{background-image:url(../img/volume_icon_onedrive.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon{background-image:url(../img/volume_icon_box.png);background-position:0 0}.elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon{background-image:url(../img/toolbar.png);background-position:0 -688px}.elfinder-droppable-active .elfinder-navbar-icon,.ui-state-active .elfinder-navbar-icon,.ui-state-hover .elfinder-navbar-icon{background-position:0 -32px}.elfinder-ltr .elfinder-navbar-subtree{margin-left:12px}.elfinder-rtl .elfinder-navbar-subtree{margin-right:12px}.elfinder-navbar-spinner{width:14px;height:14px;position:absolute;display:block;top:50%;margin-top:-7px;background:url(../img/spinner-mini.gif) center center no-repeat}.elfinder-ltr .elfinder-navbar-spinner{left:0;margin-left:-2px}.elfinder-rtl .elfinder-navbar-spinner{right:0;margin-right:-2px}.elfinder-navbar .elfinder-lock,.elfinder-navbar .elfinder-perms,.elfinder-navbar .elfinder-symlink{opacity:.6;filter:Alpha(Opacity=60)}.elfinder-navbar .elfinder-perms{bottom:-1px;margin-top:-8px}.elfinder-navbar .elfinder-lock{top:-2px}.elfinder-ltr .elfinder-navbar .elfinder-perms{left:20px}.elfinder-rtl .elfinder-navbar .elfinder-perms{right:20px}.elfinder-ltr .elfinder-navbar .elfinder-lock{left:20px}.elfinder-rtl .elfinder-navbar .elfinder-lock{right:20px}.elfinder-ltr .elfinder-navbar .elfinder-symlink{left:8px}.elfinder-rtl .elfinder-navbar .elfinder-symlink{right:8px}.elfinder-navbar input{width:100%;border:0 solid;margin:0;padding:0}.elfinder-navbar .ui-resizable-handle{width:12px;background:url(../img/resize.png) center center no-repeat}.elfinder-nav-handle-icon{position:absolute;top:50%;margin:-8px 2px 0;opacity:.5;filter:Alpha(Opacity=50)}.elfinder-places{border:none;margin:0;padding:0}.elfinder-navbar-swipe-handle{position:absolute;top:0;height:100%;width:50px;pointer-events:none}.elfinder-ltr .elfinder-navbar-swipe-handle{left:0;background:linear-gradient(to right,#dde4eb 0,rgba(221,228,235,.8) 5px,rgba(216,223,230,.3) 8px,rgba(0,0,0,.1) 95%,rgba(0,0,0,0) 100%)}.elfinder-rtl .elfinder-navbar-swipe-handle{right:0;background:linear-gradient(to left,#dde4eb 0,rgba(221,228,235,.8) 5px,rgba(216,223,230,.3) 8px,rgba(0,0,0,.1) 95%,rgba(0,0,0,0) 100%)}.elfinder-navbar-root .elfinder-places-root-icon{position:absolute;top:50%;margin-top:-9px;cursor:pointer}.elfinder-ltr .elfinder-places-root-icon{right:10px}.elfinder-rtl .elfinder-places-root-icon{left:10px}.elfinder-navbar-expanded .elfinder-places-root-icon{display:block}.elfinder-place-drag{font-size:.8em}.elfinder-quicklook{position:absolute;background:url(../img/quicklook-bg.png);overflow:hidden;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;padding:20px 0 40px}.elfinder-quicklook.elfinder-touch{padding:30px 0 40px}.elfinder-quicklook .ui-resizable-se{width:14px;height:14px;right:5px;bottom:3px;background:url(../img/toolbar.png) 0 -496px no-repeat}.elfinder-quicklook.elfinder-touch .ui-resizable-se{zoom:1.5}.elfinder-quicklook.elfinder-quicklook-fullscreen{position:fixed;top:0;right:0;bottom:0;left:0;margin:0;box-sizing:border-box;width:100%;height:100%;object-fit:contain;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;-webkit-background-clip:padding-box;padding:0;background:#000;display:block}.elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar,.elfinder-quicklook-fullscreen.elfinder-quicklook .ui-resizable-handle{display:none}.elfinder-quicklook-fullscreen .elfinder-quicklook-preview{border:0 solid}.elfinder-quicklook-cover,.elfinder-quicklook-titlebar{width:100%;height:100%;top:0;left:0;position:absolute}.elfinder-quicklook-titlebar{text-align:center;background:#777;height:20px;-moz-border-radius-topleft:7px;-webkit-border-top-left-radius:7px;border-top-left-radius:7px;-moz-border-radius-topright:7px;-webkit-border-top-right-radius:7px;border-top-right-radius:7px;cursor:move}.elfinder-touch .elfinder-quicklook-titlebar{height:30px}.elfinder-quicklook-title{color:#fff;white-space:nowrap;overflow:hidden;padding:2px 0}.elfinder-touch .elfinder-quicklook-title{padding:8px 0}.elfinder-quicklook-titlebar .ui-icon{position:absolute;left:4px;top:50%;margin-top:-8px;width:16px;height:16px;cursor:default}.elfinder-touch .elfinder-quicklook-titlebar .ui-icon{zoom:1.5}.elfinder-quicklook-preview{overflow:hidden;position:relative;border:0 solid;border-left:1px solid transparent;border-right:1px solid transparent;height:100%}.elfinder-quicklook-preview.elfinder-overflow-auto{overflow:auto;-webkit-overflow-scrolling:touch}.elfinder-quicklook-info-wrapper{position:absolute;width:100%;left:0;top:50%;margin-top:-50px}.elfinder-quicklook-info{padding:0 12px 0 112px}.elfinder-quicklook-info .elfinder-quicklook-info-data:first-child{color:#fff;font-weight:700;padding-bottom:.5em}.elfinder-quicklook-info-data{padding-bottom:.2em;color:#fff}.elfinder-quicklook .elfinder-cwd-icon{position:absolute;left:32px;top:50%;margin-top:-20px}.elfinder-quicklook-preview img{display:block;margin:0 auto}.elfinder-quicklook-navbar{position:absolute;left:50%;bottom:4px;width:140px;height:32px;padding:0;margin-left:-70px;border:1px solid transparent;border-radius:19px;-moz-border-radius:19px;-webkit-border-radius:19px}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar{width:188px;margin-left:-94px;padding:5px;border:1px solid #eee;background:#000;opacity:.4;filter:Alpha(Opacity=40)}.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-icon-close,.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-separator{display:inline}.elfinder-quicklook-navbar-icon{width:32px;height:32px;margin:0 7px;float:left;background:url(../img/quicklook-icons.png) 0 0 no-repeat}.elfinder-quicklook-navbar-icon-fullscreen{background-position:0 -64px}.elfinder-quicklook-navbar-icon-fullscreen-off{background-position:0 -96px}.elfinder-quicklook-navbar-icon-prev{background-position:0 0}.elfinder-quicklook-navbar-icon-next{background-position:0 -32px}.elfinder-quicklook-navbar-icon-close{background-position:0 -128px;display:none}.elfinder-quicklook-navbar-separator{width:1px;height:32px;float:left;border-left:1px solid #fff;display:none}.elfinder-quicklook-preview-archive-wrapper,.elfinder-quicklook-preview-text-wrapper{width:100%;height:100%;background:#fff;color:#222;overflow:auto;-webkit-overflow-scrolling:touch}.elfinder-quicklook-preview-archive-wrapper{font-size:1.5ex}.elfinder-quicklook-preview-archive-wrapper strong{padding:0 5px}pre.elfinder-quicklook-preview-text{width:auto;height:auto;margin:0;padding:3px 9px;border:none}.elfinder-quicklook-preview-html,.elfinder-quicklook-preview-iframe,.elfinder-quicklook-preview-pdf{width:100%;height:100%;background:#fff;margin:0;border:none;display:block}.elfinder-quicklook-preview-flash{width:100%;height:100%}.elfinder-quicklook-preview-audio{width:100%;position:absolute;bottom:0;left:0}embed.elfinder-quicklook-preview-audio{height:30px;background:0 0}.elfinder-quicklook-preview-video{width:100%;height:100%}.elfinder .elfinder-quicklook .elfinder-quicklook-info *,.elfinder .elfinder-quicklook .elfinder-quicklook-preview *{-webkit-user-select:auto;-moz-user-select:text;-khtml-user-select:text;user-select:text}.elfinder-statusbar{text-align:center;font-weight:400;padding:.2em .5em;border-right:0 solid transparent;border-bottom:0 solid transparent;border-left:0 solid transparent}.elfinder-statusbar span{cursor:pointer;vertical-align:bottom;overflow:hidden;text-overflow:"..";-o-text-overflow:".."}.elfinder-statusbar span.ui-state-active,.elfinder-statusbar span.ui-state-hover{border:none}.elfinder-statusbar span.elfinder-path-cwd{cursor:default}.elfinder-path{max-width:30%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.elfinder-ltr .elfinder-path{float:left}.elfinder-rtl .elfinder-path{float:right}.elfinder-workzone-path{position:relative}.elfinder-workzone-path .elfinder-path{position:relative;font-size:.75em;font-weight:400;float:none;max-width:none;overflow-x:scroll;text-overflow:initial;-o-text-overflow:initial}.elfinder-ltr .elfinder-workzone-path .elfinder-path{margin-left:24px}.elfinder-rtl .elfinder-workzone-path .elfinder-path{margin-right:24px}.elfinder-workzone-path .elfinder-path span{display:inline-block;padding:5px 3px}.elfinder-workzone-path .elfinder-path span.elfinder-path-cwd{font-weight:700}.elfinder-workzone-path .elfinder-path span.ui-state-active,.elfinder-workzone-path .elfinder-path span.ui-state-hover{border:none}.elfinder-workzone-path .elfinder-path-roots{position:absolute;top:0;width:24px;height:20px;padding:2px;border:none;overflow:hidden}.elfinder-ltr .elfinder-workzone-path .elfinder-path-roots{left:0}.elfinder-rtl .elfinder-workzone-path .elfinder-path-roots{right:0}.elfinder-stat-size{white-space:nowrap}.elfinder-ltr .elfinder-stat-size{float:right}.elfinder-rtl .elfinder-stat-size{float:left}.elfinder-stat-selected{white-space:nowrap;overflow:hidden}.elfinder .elfinder-toast{position:absolute;top:12px;right:12px;max-width:90%;cursor:default}.elfinder .elfinder-toast>div{position:relative;pointer-events:auto;overflow:hidden;margin:0 0 6px;padding:8px 16px 8px 50px;-moz-border-radius:3px 3px 3px 3px;-webkit-border-radius:3px 3px 3px 3px;border-radius:3px 3px 3px 3px;background-position:15px center;background-repeat:no-repeat;-moz-box-shadow:0 0 12px #999;-webkit-box-shadow:0 0 12px #999;box-shadow:0 0 12px #999;color:#fff;opacity:.9;filter:alpha(opacity=90);background-color:#030303;text-align:center}.elfinder .elfinder-toast>.toast-info{background-color:#2f96b4;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=)!important}.elfinder .elfinder-toast>.toast-error{background-color:#bd362f;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=)!important}.elfinder .elfinder-toast>.toast-success{background-color:#51a351;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==)!important}.elfinder .elfinder-toast>.toast-warning{background-color:#f89406;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=)!important}.elfinder .elfinder-toast>div button.ui-button{background-image:none;margin-top:8px;padding:.5em .8em}.elfinder .elfinder-toast>.toast-success button.ui-button{background-color:green;color:#fff}.elfinder .elfinder-toast>.toast-success button.ui-button.ui-state-hover{background-color:#add6ad;color:#254b25}.elfinder-toolbar{padding:4px 0 3px;border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent}.elfinder-buttonset{margin:1px 4px;float:left;background:0 0;padding:0;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}.elfinder .elfinder-button{height:16px;margin:0;padding:4px;float:left;overflow:hidden;position:relative;border:0 solid;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;line-height:1;cursor:default}.elfinder-touch .elfinder-button{height:20px}.elfinder .ui-icon-search{cursor:pointer}.elfinder-button:first-child{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.elfinder-button:last-child{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.elfinder-toolbar-button-separator{float:left;padding:0;height:24px;border-top:0 solid;border-right:0 solid;border-bottom:0 solid;width:0}.elfinder-touch .elfinder-toolbar-button-separator{height:20px}.elfinder .elfinder-button.ui-state-disabled{opacity:1;filter:Alpha(Opacity=100)}.elfinder .elfinder-button.ui-state-disabled .elfinder-button-icon,.elfinder .elfinder-button.ui-state-disabled .elfinder-button-text{opacity:.4;filter:Alpha(Opacity=40)}.elfinder-rtl .elfinder-buttonset{float:right}.elfinder-button-icon{width:16px;height:16px;display:inline-block;background:url(../img/toolbar.png) no-repeat}.elfinder-button-text{position:relative;display:inline-block;top:-4px;margin:0 2px;font-size:12px}.elfinder-touch .elfinder-button-icon{zoom:1.25;-moz-transform-origin:top left;-moz-transform:scale(1.25)}.elfinder-touch .elfinder-button-text{top:-5px}.elfinder-button-icon-home{background-position:0 0}.elfinder-button-icon-back{background-position:0 -112px}.elfinder-button-icon-forward{background-position:0 -128px}.elfinder-button-icon-up{background-position:0 -144px}.elfinder-button-icon-dir{background-position:0 -16px}.elfinder-button-icon-reload{background-position:0 -160px}.elfinder-button-icon-open{background-position:0 -176px}.elfinder-button-icon-mkdir{background-position:0 -192px}.elfinder-button-icon-mkfile{background-position:0 -208px}.elfinder-button-icon-rm{background-position:0 -224px}.elfinder-button-icon-copy{background-position:0 -240px}.elfinder-button-icon-cut{background-position:0 -256px}.elfinder-button-icon-paste{background-position:0 -272px}.elfinder-button-icon-getfile{background-position:0 -288px}.elfinder-button-icon-duplicate{background-position:0 -304px}.elfinder-button-icon-rename{background-position:0 -320px}.elfinder-button-icon-edit{background-position:0 -336px}.elfinder-button-icon-quicklook{background-position:0 -352px}.elfinder-button-icon-upload{background-position:0 -368px}.elfinder-button-icon-download{background-position:0 -384px}.elfinder-button-icon-info{background-position:0 -400px}.elfinder-button-icon-extract{background-position:0 -416px}.elfinder-button-icon-archive{background-position:0 -432px}.elfinder-button-icon-view{background-position:0 -448px}.elfinder-button-icon-view-list{background-position:0 -464px}.elfinder-button-icon-help{background-position:0 -480px}.elfinder-button-icon-resize{background-position:0 -512px}.elfinder-button-icon-link{background-position:0 -528px}.elfinder-button-icon-search{background-position:0 -561px}.elfinder-button-icon-sort{background-position:0 -577px}.elfinder-button-icon-rotate-r{background-position:0 -625px}.elfinder-button-icon-rotate-l{background-position:0 -641px}.elfinder-button-icon-netmount{background-position:0 -688px}.elfinder-button-icon-netunmount{background-position:0 -96px}.elfinder-button-icon-places{background-position:0 -704px}.elfinder-button-icon-chmod{background-position:0 -48px}.elfinder-button-icon-accept{background-position:0 -736px}.elfinder-button-icon-opendir{background-position:0 -32px}.elfinder-button-icon-menu{background-position:0 -752px}.elfinder-button-icon-colwidth{background-position:0 -768px}.elfinder-button-icon-fullscreen{background-position:0 -784px}.elfinder-button-icon-unfullscreen{background-position:0 -800px}.elfinder .elfinder-menubutton{overflow:visible}.elfinder-button-icon-spinner{background:url(../img/spinner-mini.gif) center center no-repeat}.elfinder-button-menu{position:absolute;left:0;top:25px;padding:3px 0}.elfinder-touch .elfinder-button-menu{top:35px}.elfinder-button-menu-item{white-space:nowrap;cursor:default;padding:5px 19px;position:relative}.elfinder-touch .elfinder-button-menu-item{padding:12px 19px}.elfinder-button-menu .ui-state-hover{border:0 solid}.elfinder-button-menu-item-separated{border-top:1px solid #ccc}.elfinder-button-menu-item .ui-icon{width:16px;height:16px;position:absolute;left:2px;top:50%;margin-top:-8px;display:none}.elfinder-button-menu-item-selected .ui-icon{display:block}.elfinder-button-menu-item-selected-asc .ui-icon-arrowthick-1-s,.elfinder-button-menu-item-selected-desc .ui-icon-arrowthick-1-n{display:none}.elfinder-button form{position:absolute;top:0;right:0;opacity:0;filter:Alpha(Opacity=0);cursor:pointer}.elfinder .elfinder-button form input{background:0 0;cursor:default}.elfinder .elfinder-button-search{border:0 solid;background:0 0;padding:0;margin:1px 4px;height:auto;min-height:26px;float:right;width:202px;overflow:visible}.elfinder .elfinder-button-search .elfinder-button-menu{font-size:8pt;text-align:center;width:100%;overflow:hidden}.elfinder .elfinder-button-search .elfinder-button-menu div{margin-left:auto;margin-right:auto;margin-bottom:5px}.elfinder .elfinder-button-search .elfinder-button-menu div .ui-state-hover{border:1px solid}.elfinder-ltr .elfinder-button-search{float:right;margin-right:10px}.elfinder-rtl .elfinder-button-search{float:left;margin-left:10px}.elfinder-button-search input{width:160px;height:22px;padding:0 20px;line-height:22px;border:1px solid #aaa;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;outline:0 solid}.elfinder-button-search input::-ms-clear{display:none}.elfinder-touch .elfinder-button-search input{height:28px;line-height:28px}.elfinder-rtl .elfinder-button-search input{direction:rtl}.elfinder-button-search .ui-icon{position:absolute;height:18px;top:50%;margin:-8px 4px 0;opacity:.6;filter:Alpha(Opacity=60)}.elfinder-button-search .ui-checkboxradio-icon{display:none}.elfinder-ltr .elfinder-button-search .ui-icon-search{left:0}.elfinder-ltr .elfinder-button-search .ui-icon-close,.elfinder-rtl .elfinder-button-search .ui-icon-search{right:0}.elfinder-rtl .elfinder-button-search .ui-icon-close{left:0}.elfinder-toolbar-swipe-handle{position:absolute;top:0;left:0;height:50px;width:100%;pointer-events:none;background:linear-gradient(to bottom,#dde4eb 0,rgba(221,228,235,.8) 2px,rgba(216,223,230,.3) 5px,rgba(0,0,0,.1) 95%,rgba(0,0,0,0) 100%)}
elFinder/css/theme.css CHANGED
@@ -5,6 +5,13 @@
5
  * @author Dmitry (dio) Levashov
6
  **/
7
 
 
 
 
 
 
 
 
8
  /* dialogs */
9
  .std42-dialog, .std42-dialog .ui-widget-content { background-color:#ededed; background-image:none; background-clip: content-box; }
10
 
@@ -16,6 +23,8 @@
16
  /* disabled elfinder */
17
  .elfinder-disabled .elfinder-navbar .ui-state-active { background: #dadada; border-color:#aaa; color:#fff; }
18
 
 
 
19
 
20
  /* current directory */
21
  /* selected file in "icons" view */
@@ -47,11 +56,13 @@
47
  .std42-dialog .elfinder-help, .std42-dialog .elfinder-help .ui-widget-content { background:#fff;}
48
 
49
  /* contextmenu */
 
50
  .elfinder-contextmenu .ui-state-hover { background: #3875d7; color:#fff; }
51
  .elfinder-contextmenu .ui-state-hover .elfinder-contextmenu-arrow { background-image:url('../img/arrows-active.png'); }
52
 
53
-
54
-
55
-
56
-
57
-
 
5
  * @author Dmitry (dio) Levashov
6
  **/
7
 
8
+ /* input textarea */
9
+ .elfinder input,
10
+ .elfinder textarea {
11
+ color: #000;
12
+ background-color: #FFF;
13
+ }
14
+
15
  /* dialogs */
16
  .std42-dialog, .std42-dialog .ui-widget-content { background-color:#ededed; background-image:none; background-clip: content-box; }
17
 
23
  /* disabled elfinder */
24
  .elfinder-disabled .elfinder-navbar .ui-state-active { background: #dadada; border-color:#aaa; color:#fff; }
25
 
26
+ /* workzone */
27
+ .elfinder-workzone { background:#fff; }
28
 
29
  /* current directory */
30
  /* selected file in "icons" view */
56
  .std42-dialog .elfinder-help, .std42-dialog .elfinder-help .ui-widget-content { background:#fff;}
57
 
58
  /* contextmenu */
59
+ .elfinder-contextmenu .ui-state-active { background: #6293df; color:#fff; }
60
  .elfinder-contextmenu .ui-state-hover { background: #3875d7; color:#fff; }
61
  .elfinder-contextmenu .ui-state-hover .elfinder-contextmenu-arrow { background-image:url('../img/arrows-active.png'); }
62
 
63
+ /* dialog */
64
+ .elfinder .ui-dialog input:text.ui-state-hover,
65
+ .elfinder .ui-dialog textarea.ui-state-hover {
66
+ background-image: none;
67
+ background-color: inherit;
68
+ }
elFinder/elFinder.php CHANGED
@@ -1,16 +1,7 @@
 
1
  <?php
2
- /**
3
- *
4
- * Security check. No one can access without Wordpress itself
5
- *
6
- * */
7
- defined('ABSPATH') or die();
8
 
9
- // Including necessary files
10
- include_once( 'php' . DS . 'elFinderConnector.class.php' );
11
- include_once( 'php' . DS . 'elFinder.class.php' );
12
- include_once( 'php' . DS . 'elFinderVolumeDriver.class.php' );
13
- include_once( 'php' . DS . 'elFinderVolumeLocalFileSystem.class.php' );
14
 
15
  /**
16
  *
1
+ <?php if(!defined('ABSPATH')) die(); // Security check?>
2
  <?php
 
 
 
 
 
 
3
 
4
+ include_once( 'php' . DS . 'autoload.php' );
 
 
 
 
5
 
6
  /**
7
  *
elFinder/img/arrows-active.png CHANGED
Binary file
elFinder/img/arrows-normal.png CHANGED
Binary file
elFinder/img/dialogs.png CHANGED
Binary file
elFinder/img/icons-big.png CHANGED
Binary file
elFinder/img/icons-small.png CHANGED
Binary file
elFinder/img/logo.png CHANGED
Binary file
elFinder/img/quicklook-bg.png CHANGED
Binary file
elFinder/img/quicklook-icons.png CHANGED
Binary file
elFinder/img/resize.png CHANGED
Binary file
elFinder/img/toolbar.png CHANGED
Binary file
elFinder/img/volume_icon_box.png ADDED
Binary file
elFinder/img/volume_icon_dropbox.png CHANGED
Binary file
elFinder/img/volume_icon_ftp.png CHANGED
Binary file
elFinder/img/volume_icon_googledrive.png ADDED
Binary file
elFinder/img/volume_icon_local.png CHANGED
Binary file
elFinder/img/volume_icon_onedrive.png ADDED
Binary file
elFinder/img/volume_icon_sql.png CHANGED
Binary file
elFinder/js/elfinder.full.js CHANGED
@@ -1,10 +1,10 @@
1
  /*!
2
  * elFinder - file manager for web
3
- * Version 2.1.6 (2016-01-19)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
- * Licensed under a 3 clauses BSD license
8
  */
9
  (function($) {
10
 
@@ -20,7 +20,7 @@
20
  **/
21
  window.elFinder = function(node, opts) {
22
  //this.time('load');
23
-
24
  var self = this,
25
 
26
  /**
@@ -58,7 +58,7 @@ window.elFinder = function(node, opts) {
58
  *
59
  * @type String
60
  **/
61
- namespace = 'elfinder-'+(id || Math.random().toString().substr(2, 7)),
62
 
63
  /**
64
  * Mousedown event
@@ -100,7 +100,7 @@ window.elFinder = function(node, opts) {
100
  *
101
  * @type Array
102
  **/
103
- events = ['enable', 'disable', 'load', 'open', 'reload', 'select', 'add', 'remove', 'change', 'dblclick', 'getfile', 'lockfiles', 'unlockfiles', 'dragstart', 'dragstop'],
104
 
105
  /**
106
  * Rules to validate data from backend
@@ -133,6 +133,7 @@ window.elFinder = function(node, opts) {
133
  uploadOverwrite : true,
134
  uploadMaxSize : 0,
135
  jpgQuality : 100,
 
136
  tmb : false // old API
137
  },
138
 
@@ -187,6 +188,13 @@ window.elFinder = function(node, opts) {
187
  **/
188
  queue = [],
189
 
 
 
 
 
 
 
 
190
  /**
191
  * Commands prototype
192
  *
@@ -215,33 +223,41 @@ window.elFinder = function(node, opts) {
215
  * @type String
216
  * @default ./sounds/
217
  **/
218
- soundPath = PLUGINS_URL+'/file-manager/elFinder/sounds/',
219
 
220
  beeper = $(document.createElement('audio')).hide().appendTo('body')[0],
221
 
222
  syncInterval,
 
223
 
224
  uiCmdMapPrev = '',
225
 
226
  open = function(data) {
227
- var volumeid, contextmenu, emptyDirs = {}, stayDirs = {};
228
-
229
- self.commandMap = (data.options.uiCmdMap && Object.keys(data.options.uiCmdMap).length)? data.options.uiCmdMap : {};
 
230
 
231
- // support volume driver option `uiCmdMap`
232
- if (uiCmdMapPrev !== JSON.stringify(self.commandMap)) {
233
- uiCmdMapPrev = JSON.stringify(self.commandMap);
234
- if (Object.keys(self.commandMap).length) {
235
- // for contextmenu
236
- contextmenu = self.getUI('contextmenu');
237
- if (!contextmenu.data('cmdMaps')) {
238
- contextmenu.data('cmdMaps', {});
239
- }
240
- volumeid = data.cwd? data.cwd.volumeid : null;
241
- if (volumeid && !contextmenu.data('cmdMaps')[volumeid]) {
242
- contextmenu.data('cmdMaps')[volumeid] = self.commandMap;
 
 
 
 
243
  }
244
  }
 
 
245
  }
246
 
247
  if (data.init) {
@@ -250,11 +266,19 @@ window.elFinder = function(node, opts) {
250
  } else {
251
  // remove only files from prev cwd
252
  // and collapsed directory (included 100+ directories) to empty for perfomance tune in DnD
253
- $.each(Object.keys(files), function(n, i) {
 
 
 
 
 
 
 
 
254
  var isDir = (files[i].mime === 'directory'),
255
  phash = files[i].phash,
256
- collapsed = self.res('class', 'navcollapse'),
257
  pnav;
 
258
  if (
259
  (!isDir
260
  || emptyDirs[phash]
@@ -263,25 +287,45 @@ window.elFinder = function(node, opts) {
263
  && $('#'+self.navHash2Id(phash)).next('.elfinder-navbar-subtree').children().length > 100
264
  )
265
  )
266
- && (isDir || phash === cwd)
267
  && $.inArray(i, remember) === -1
268
  ) {
269
  if (isDir && !emptyDirs[phash]) {
270
  emptyDirs[phash] = true;
 
 
 
271
  }
272
  delete files[i];
273
  } else if (isDir) {
274
  stayDirs[phash] = true;
275
  }
 
 
 
 
 
 
 
 
 
 
 
 
276
  });
277
- $.each(Object.keys(emptyDirs), function(n, i) {
278
- var rmClass = 'elfinder-subtree-loaded ' + self.res('class', 'navexpand');
279
- $('#'+self.navHash2Id(i))
280
- .removeClass(rmClass)
281
- .next('.elfinder-navbar-subtree').empty();
 
 
 
 
282
  });
283
  }
284
 
 
285
  cwd = data.cwd.hash;
286
  cache(data.files);
287
  if (!files[cwd]) {
@@ -299,25 +343,42 @@ window.elFinder = function(node, opts) {
299
  * @return void
300
  **/
301
  cache = function(data) {
302
- var l = data.length, f, i;
 
 
 
303
 
304
  for (i = 0; i < l; i++) {
305
  f = data[i];
306
  if (f.name && f.hash && f.mime) {
307
- if (!f.phash) {
308
- var name = 'volume_'+f.name,
309
- i18 = self.i18n(name);
310
-
311
- if (name != i18) {
312
- f.i18 = i18;
 
 
 
 
 
 
 
 
 
 
 
313
  }
314
-
315
- // set disabledCmds, tmbUrls for each volume
316
- if (f.volumeid) {
317
- f.disabled && (self.disabledCmds[f.volumeid] = f.disabled);
318
- self.tmbUrls[f.volumeid] = self.option('tmbUrl');
 
 
319
  }
320
  }
 
321
  files[f.hash] = f;
322
  }
323
  }
@@ -331,7 +392,8 @@ window.elFinder = function(node, opts) {
331
  */
332
  execShortcut = function(e) {
333
  var code = e.keyCode,
334
- ctrlKey = !!(e.ctrlKey || e.metaKey);
 
335
 
336
  if (enabled) {
337
 
@@ -341,7 +403,7 @@ window.elFinder = function(node, opts) {
341
  && shortcut.shiftKey == e.shiftKey
342
  && shortcut.ctrlKey == ctrlKey
343
  && shortcut.altKey == e.altKey) {
344
- e.preventDefault()
345
  e.stopPropagation();
346
  shortcut.callback(e, self);
347
  self.debug('shortcut-exec', i+' : '+shortcut.description);
@@ -349,20 +411,48 @@ window.elFinder = function(node, opts) {
349
  });
350
 
351
  // prevent tab out of elfinder
352
- if (code == 9 && !$(e.target).is(':input')) {
353
  e.preventDefault();
354
  }
355
 
356
- // cancel copy or cut by [Esc] key
357
- if (code == 27 && self.clipboard().length) {
358
- self.clipboard([]);
 
 
 
 
 
 
 
 
 
 
359
  }
360
 
361
  }
362
  },
363
  date = new Date(),
364
  utc,
365
- i18n
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  ;
367
 
368
 
@@ -393,38 +483,6 @@ window.elFinder = function(node, opts) {
393
  * @type Array
394
  **/
395
  this.netDrivers = [];
396
- /**
397
- * User os. Required to bind native shortcuts for open/rename
398
- *
399
- * @type String
400
- **/
401
- this.OS = navigator.userAgent.indexOf('Mac') !== -1 ? 'mac' : navigator.userAgent.indexOf('Win') !== -1 ? 'win' : 'other';
402
-
403
- /**
404
- * User browser UA.
405
- * jQuery.browser: version deprecated: 1.3, removed: 1.9
406
- *
407
- * @type Object
408
- **/
409
- this.UA = (function(){
410
- var webkit = !document.uniqueID && !window.opera && !window.sidebar && window.localStorage && typeof window.orientation == "undefined";
411
- return {
412
- // Browser IE <= IE 6
413
- ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined",
414
- // Browser IE <= IE 7
415
- ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined",
416
- // Browser IE <= IE 8
417
- ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined",
418
- IE:document.uniqueID,
419
- Firefox:window.sidebar,
420
- Opera:window.opera,
421
- Webkit:webkit,
422
- Chrome:webkit && window.chrome,
423
- Safari:webkit && !window.chrome,
424
- Mobile:typeof window.orientation != "undefined",
425
- Touch:typeof window.ontouchstart != "undefined"
426
- };
427
- })();
428
 
429
  /**
430
  * Configuration options
@@ -433,6 +491,13 @@ window.elFinder = function(node, opts) {
433
  **/
434
  this.options = $.extend(true, {}, this._options, opts||{});
435
 
 
 
 
 
 
 
 
436
  if (opts.ui) {
437
  this.options.ui = opts.ui;
438
  }
@@ -452,6 +517,17 @@ window.elFinder = function(node, opts) {
452
  this.options.uiOptions.cwd.listView.columnsCustomName = opts.uiOptions.cwd.listView.columnsCustomName;
453
  }
454
 
 
 
 
 
 
 
 
 
 
 
 
455
  // configure for CORS
456
  (function(){
457
  var parseUrl = document.createElement('a'),
@@ -462,6 +538,7 @@ window.elFinder = function(node, opts) {
462
  parseUploadUrl.href = opts.urlUpload;
463
  }
464
  if (window.location.host !== parseUrl.host || (parseUploadUrl && (window.location.host !== parseUploadUrl.host))) {
 
465
  if (!$.isPlainObject(self.options.customHeaders)) {
466
  self.options.customHeaders = {};
467
  }
@@ -482,7 +559,7 @@ window.elFinder = function(node, opts) {
482
  * @type String
483
  * @default "get"
484
  **/
485
- this.requestType = /^(get|post)$/i.test(this.options.requestType) ? this.options.requestType.toLowerCase() : 'get',
486
 
487
  /**
488
  * Any data to send across every ajax request
@@ -508,6 +585,15 @@ window.elFinder = function(node, opts) {
508
  */
509
  this.xhrFields = $.isPlainObject(this.options.xhrFields) ? this.options.xhrFields : {};
510
 
 
 
 
 
 
 
 
 
 
511
  /**
512
  * ID. Required to create unique cookie name
513
  *
@@ -618,7 +704,32 @@ window.elFinder = function(node, opts) {
618
  *
619
  * @type String
620
  **/
621
- this.cssClass = 'ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-'+(this.direction == 'rtl' ? 'rtl' : 'ltr')+' '+this.options.cssClass;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
622
 
623
  /**
624
  * Method to store/fetch data
@@ -627,7 +738,16 @@ window.elFinder = function(node, opts) {
627
  **/
628
  this.storage = (function() {
629
  try {
630
- return 'localStorage' in window && window['localStorage'] !== null ? self.localStorage : self.cookie;
 
 
 
 
 
 
 
 
 
631
  } catch (e) {
632
  return self.cookie;
633
  }
@@ -640,14 +760,20 @@ window.elFinder = function(node, opts) {
640
  this.sortOrder = this.storage('sortOrder') || this.options.sortOrder || 'asc';
641
 
642
  this.sortStickFolders = this.storage('sortStickFolders');
643
-
644
  if (this.sortStickFolders === null) {
645
  this.sortStickFolders = !!this.options.sortStickFolders;
646
  } else {
647
  this.sortStickFolders = !!this.sortStickFolders
648
  }
649
 
650
- this.sortRules = $.extend(true, {}, this._sortRules, this.options.sortsRules);
 
 
 
 
 
 
 
651
 
652
  $.each(this.sortRules, function(name, method) {
653
  if (typeof method != 'function') {
@@ -670,169 +796,218 @@ window.elFinder = function(node, opts) {
670
  *
671
  * @type jQuery | null
672
  **/
673
- this.draggingUiHelper = null,
674
 
675
- /**
676
- * Base draggable options
677
- *
678
- * @type Object
679
- **/
680
- this.draggable = {
681
- appendTo : 'body',
682
- addClasses : true,
683
- delay : 30,
684
- distance : 8,
685
- revert : true,
686
- refreshPositions : false,
687
- cursor : 'crosshair',
688
- cursorAt : {left : 50, top : 47},
689
- start : function(e, ui) {
690
- var targets = $.map(ui.helper.data('files')||[], function(h) { return h || null ;}),
691
- locked = false,
692
- cnt, h;
693
- self.draggingUiHelper = ui.helper;
694
- cnt = targets.length;
695
- while (cnt--) {
696
- h = targets[cnt];
697
- if (files[h].locked) {
698
- locked = true;
699
- ui.helper.data('locked', true);
700
- break;
701
- }
702
- }
703
- !locked && self.trigger('lockfiles', {files : targets});
704
-
705
- },
706
- drag : function(e, ui) {
707
- var helper = ui.helper;
708
- if (helper.data('refreshPositions') && $(this).draggable('instance')) {
709
- if (helper.data('refreshPositions') > 0) {
710
- $(this).draggable('option', { refreshPositions : true });
711
- helper.data('refreshPositions', -1);
712
- } else {
713
- $(this).draggable('option', { refreshPositions : false });
714
- helper.data('refreshPositions', null);
715
- }
716
- }
717
- },
718
- stop : function(e, ui) {
719
- var files;
720
- $(this).draggable('instance') && $(this).draggable('option', { refreshPositions : false });
721
- self.draggingUiHelper = null;
722
- self.trigger('focus').trigger('dragstop');
723
- if (! ui.helper.data('droped')) {
724
- files = $.map(ui.helper.data('files')||[], function(h) { return h || null ;});
725
- self.trigger('unlockfiles', {files : files});
726
- self.trigger('selectfiles', {files : files});
727
- }
728
- },
729
- helper : function(e, ui) {
730
- var element = this.id ? $(this) : $(this).parents('[id]:first'),
731
- helper = $('<div class="elfinder-drag-helper"><span class="elfinder-drag-helper-icon-status"/></div>'),
732
- icon = function(f) {
733
- var mime = f.mime, i;
734
- i = '<div class="elfinder-cwd-icon '+self.mime2class(mime)+' ui-corner-all"/>';
735
- if (f.tmb && f.tmb !== 1) {
736
- i = $(i).css('background', "url('"+self.option('tmbUrl')+f.tmb+"') center center no-repeat").get(0).outerHTML;
737
- }
738
- return i;
739
- },
740
- hashes, l, ctr;
741
-
742
- self.draggingUiHelper && self.draggingUiHelper.stop(true, true);
743
-
744
- self.trigger('dragstart', {target : element[0], originalEvent : e});
745
-
746
- hashes = element.hasClass(self.res('class', 'cwdfile'))
747
- ? self.selected()
748
- : [self.navId2Hash(element.attr('id'))];
749
-
750
- helper.append(icon(files[hashes[0]])).data('files', hashes).data('locked', false).data('droped', false).data('namespace', self.namespace).data('dropover', 0);
751
 
752
- if ((l = hashes.length) > 1) {
753
- helper.append(icon(files[hashes[l-1]]) + '<span class="elfinder-drag-num">'+l+'</span>');
754
- }
755
-
756
- $(document).on(keydown + ' keyup.' + namespace, function(e){
757
- var chk = (e.shiftKey||e.ctrlKey||e.metaKey);
758
- if (ctr !== chk) {
759
- ctr = chk;
760
- if (helper.is(':visible') && helper.data('dropover') && ! helper.data('droped')) {
761
- helper.toggleClass('elfinder-drag-helper-plus', helper.data('locked')? true : ctr);
762
- self.trigger(ctr? 'unlockfiles' : 'lockfiles', {files : hashes, helper: helper});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
  }
764
  }
765
- });
766
-
767
- return helper;
768
- }
769
- };
770
 
771
- /**
772
- * Base droppable options
773
- *
774
- * @type Object
775
- **/
776
- this.droppable = {
777
- greedy : true,
778
- tolerance : 'pointer',
779
- accept : '.elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename',
780
- hoverClass : this.res('class', 'adroppable'),
781
- autoDisable: true, // elFinder original, see jquery.elfinder.js
782
- drop : function(e, ui) {
783
- var dst = $(this),
784
- targets = $.map(ui.helper.data('files')||[], function(h) { return h || null }),
785
- result = [],
786
- dups = [],
787
- faults = [],
788
- isCopy = ui.helper.hasClass('elfinder-drag-helper-plus'),
789
- c = 'class',
790
- cnt, hash, i, h;
791
-
792
- if (ui.helper.data('namespace') !== self.namespace) {
793
- return false;
794
- }
795
- if (dst.hasClass(self.res(c, 'cwdfile'))) {
796
- hash = self.cwdId2Hash(dst.attr('id'));
797
- } else if (dst.hasClass(self.res(c, 'navdir'))) {
798
- hash = self.navId2Hash(dst.attr('id'));
799
  } else {
800
- hash = cwd;
 
 
801
  }
802
-
803
- cnt = targets.length;
804
-
805
- while (cnt--) {
806
- h = targets[cnt];
807
- // ignore drop into itself or in own location
808
- if (h != hash && files[h].phash != hash) {
809
- result.push(h);
810
  } else {
811
- ((isCopy && h !== hash && files[hash].write)? dups : faults).push(h);
 
812
  }
813
  }
 
 
 
 
814
 
815
- if (faults.length) {
816
- return false;
 
 
 
 
 
 
817
  }
 
818
 
819
- ui.helper.data('droped', true);
 
820
 
821
- if (dups.length) {
822
- ui.helper.hide();
823
- self.exec('duplicate', dups);
824
- }
 
 
 
 
 
 
 
 
 
 
825
 
826
- if (result.length) {
827
- ui.helper.hide();
828
- self.clipboard(result, !isCopy);
829
- self.exec('paste', hash, void 0, hash).always(function(){
830
- self.trigger('unlockfiles', {files : targets});
831
- });
832
- self.trigger('drop', {files : targets});
 
 
 
 
 
833
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
834
  }
835
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836
 
837
  /**
838
  * Return true if filemanager is active
@@ -840,8 +1015,8 @@ window.elFinder = function(node, opts) {
840
  * @return Boolean
841
  **/
842
  this.enabled = function() {
843
- return node.is(':visible') && enabled;
844
- }
845
 
846
  /**
847
  * Return true if filemanager is visible
@@ -849,18 +1024,44 @@ window.elFinder = function(node, opts) {
849
  * @return Boolean
850
  **/
851
  this.visible = function() {
852
- return node.is(':visible');
 
 
 
 
 
 
 
 
 
 
853
  }
854
 
855
  /**
856
  * Return root dir hash for current working directory
857
  *
 
 
858
  * @return String
859
  */
860
- this.root = function(hash) {
861
- var dir = files[hash || cwd], i;
 
 
 
 
 
 
 
 
 
 
 
 
 
862
 
863
- while (dir && dir.phash) {
 
864
  dir = files[dir.phash]
865
  }
866
  if (dir) {
@@ -875,7 +1076,7 @@ window.elFinder = function(node, opts) {
875
  }
876
 
877
  return '';
878
- }
879
 
880
  /**
881
  * Return current working directory info
@@ -884,17 +1085,29 @@ window.elFinder = function(node, opts) {
884
  */
885
  this.cwd = function() {
886
  return files[cwd] || {};
887
- }
888
 
889
  /**
890
  * Return required cwd option
891
  *
892
  * @param String option name
 
893
  * @return mixed
894
  */
895
- this.option = function(name) {
896
- return cwdOptions[name]||'';
897
- }
 
 
 
 
 
 
 
 
 
 
 
898
 
899
  /**
900
  * Return file data from current dir or tree by it's hash
@@ -903,7 +1116,7 @@ window.elFinder = function(node, opts) {
903
  * @return Object
904
  */
905
  this.file = function(hash) {
906
- return files[hash];
907
  };
908
 
909
  /**
@@ -913,7 +1126,7 @@ window.elFinder = function(node, opts) {
913
  */
914
  this.files = function() {
915
  return $.extend(true, {}, files);
916
- }
917
 
918
  /**
919
  * Return list of file parents hashes include file hash
@@ -930,40 +1143,104 @@ window.elFinder = function(node, opts) {
930
  hash = dir.phash;
931
  }
932
  return parents;
933
- }
934
 
935
  this.path2array = function(hash, i18) {
936
  var file,
937
  path = [];
938
 
939
- while (hash && (file = files[hash]) && file.hash) {
940
- path.unshift(i18 && file.i18 ? file.i18 : file.name);
941
- hash = file.phash;
 
 
 
 
 
942
  }
943
 
944
  return path;
945
- }
946
 
947
  /**
948
- * Return file path
949
  *
950
  * @param Object file
951
- * @return String
 
 
952
  */
953
- this.path = function(hash, i18) {
954
- return files[hash] && files[hash].path
955
  ? files[hash].path
956
  : this.path2array(hash, i18).join(cwdOptions.separator);
957
- }
958
-
959
- /**
960
- * Return file url if set
961
- *
962
- * @param String file hash
963
- * @return String
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  */
965
  this.url = function(hash) {
966
- var file = files[hash];
 
967
 
968
  if (!file || !file.read) {
969
  return '';
@@ -987,8 +1264,10 @@ window.elFinder = function(node, opts) {
987
  return file.url;
988
  }
989
 
990
- if (cwdOptions.url) {
991
- return cwdOptions.url + $.map(this.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/')
 
 
992
  }
993
 
994
  var params = $.extend({}, this.customData, {
@@ -1000,7 +1279,7 @@ window.elFinder = function(node, opts) {
1000
  params.current = file.phash;
1001
  }
1002
  return this.options.url + (this.options.url.indexOf('?') === -1 ? '?' : '&') + $.param(params, true);
1003
- }
1004
 
1005
  /**
1006
  * Convert from relative URL to abstract URL based on current URL
@@ -1012,26 +1291,29 @@ window.elFinder = function(node, opts) {
1012
  if (url.match(/^http/i)) {
1013
  return url;
1014
  }
 
 
 
1015
  var root = window.location.protocol + '//' + window.location.host,
1016
  reg = /[^\/]+\/\.\.\//,
1017
  ret;
1018
  if (url.substr(0, 1) === '/') {
1019
  ret = root + url;
1020
  } else {
1021
- ret = root + window.location.pathname + url;
1022
  }
1023
  ret = ret.replace('/./', '/');
1024
  while(reg.test(ret)) {
1025
  ret = ret.replace(reg, '');
1026
  }
1027
  return ret;
1028
- }
1029
 
1030
  /**
1031
  * Return file url for open in elFinder
1032
  *
1033
  * @param String file hash
1034
- * @param Bool for download link
1035
  * @return String
1036
  */
1037
  this.openUrl = function(hash, download) {
@@ -1047,7 +1329,7 @@ window.elFinder = function(node, opts) {
1047
  if (file.url != 1) {
1048
  return file.url;
1049
  }
1050
- } else if (cwdOptions.url) {
1051
  return cwdOptions.url + $.map(this.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/');
1052
  }
1053
  }
@@ -1066,31 +1348,43 @@ window.elFinder = function(node, opts) {
1066
  });
1067
 
1068
  return url;
1069
- }
1070
 
1071
  /**
1072
  * Return thumbnail url
1073
  *
1074
- * @param String file hash
1075
  * @return String
1076
  */
1077
- this.tmb = function(hash) {
1078
- var file = files[hash],
1079
- geturl = function(hash){
1080
- var turl = cwdOptions['tmbUrl'];
1081
- $.each(self.tmbUrls, function(i, u){
1082
- if (hash.indexOf(i) === 0) {
1083
- turl = self.tmbUrls[i];
1084
- return false;
1085
- }
1086
- });
1087
- return turl;
1088
- },
1089
- tmbUrl = (self.tmbUrls._search && hash.indexOf(self.cwd().volumeid) !== 0)? geturl(hash) : cwdOptions['tmbUrl'],
1090
- url = file && file.tmb && file.tmb != 1 ? tmbUrl + file.tmb : '';
 
 
 
 
 
 
 
 
 
 
 
 
1091
 
1092
- return url;
1093
- }
1094
 
1095
  /**
1096
  * Return selected files hashes
@@ -1099,7 +1393,7 @@ window.elFinder = function(node, opts) {
1099
  **/
1100
  this.selected = function() {
1101
  return selected.slice(0);
1102
- }
1103
 
1104
  /**
1105
  * Return selected files info
@@ -1136,7 +1430,7 @@ window.elFinder = function(node, opts) {
1136
  */
1137
  this.validResponse = function(cmd, data) {
1138
  return data.error || this.rules[this.rules[cmd] ? cmd : 'defaults'](data);
1139
- }
1140
 
1141
  /**
1142
  * Return bytes from ini formated size
@@ -1147,6 +1441,9 @@ window.elFinder = function(node, opts) {
1147
  this.returnBytes = function(val) {
1148
  var last;
1149
  if (isNaN(val)) {
 
 
 
1150
  // for ex. 1mb, 1KB
1151
  val = val.replace(/b$/i, '');
1152
  last = val.charAt(val.length - 1).toLowerCase();
@@ -1176,26 +1473,33 @@ window.elFinder = function(node, opts) {
1176
  * @todo
1177
  * @return $.Deferred
1178
  */
1179
- this.request = function(options) {
1180
  var self = this,
1181
  o = this.options,
1182
  dfrd = $.Deferred(),
1183
  // request data
1184
- data = $.extend({}, o.customData, {mimes : o.onlyMimes}, options.data || options),
1185
  // command name
1186
  cmd = data.cmd,
 
1187
  // call default fail callback (display error dialog) ?
1188
- deffail = !(options.preventDefault || options.preventFail),
1189
  // call default success callback ?
1190
- defdone = !(options.preventDefault || options.preventDone),
1191
  // options for notify dialog
1192
- notify = $.extend({}, options.notify),
 
 
1193
  // do not normalize data - return as is
1194
- raw = !!options.raw,
1195
  // sync files on request fail
1196
- syncOnFail = options.syncOnFail,
1197
- // open notify dialog timeout
1198
- timeout,
 
 
 
 
1199
  // request options
1200
  options = $.extend({
1201
  url : o.url,
@@ -1207,7 +1511,7 @@ window.elFinder = function(node, opts) {
1207
  data : data,
1208
  headers : this.customHeaders,
1209
  xhrFields: this.xhrFields
1210
- }, options.options || {}),
1211
  /**
1212
  * Default success handler.
1213
  * Call default data handlers and fire event with command name.
@@ -1216,24 +1520,29 @@ window.elFinder = function(node, opts) {
1216
  * @return void
1217
  **/
1218
  done = function(data) {
1219
-
1220
- // My custom code
1221
- console.log(data);
1222
-
1223
  data.warning && self.error(data.warning);
1224
 
1225
- cmd == 'open' && open($.extend(true, {}, data));
1226
-
1227
- // fire some event to update cache/ui
1228
- data.removed && data.removed.length && self.remove(data);
1229
- data.added && data.added.length && self.add(data);
1230
- data.changed && data.changed.length && self.change(data);
1231
-
1232
- // fire event with command name
1233
- self.trigger(cmd, data);
1234
-
1235
- // force update content
1236
- data.sync && self.sync();
 
 
 
 
 
 
 
 
 
1237
  },
1238
  /**
1239
  * Request error handler. Reject dfrd with correct error message.
@@ -1243,10 +1552,6 @@ window.elFinder = function(node, opts) {
1243
  * @return void
1244
  **/
1245
  error = function(xhr, status) {
1246
-
1247
- // My custom code
1248
- console.log(status);
1249
-
1250
  var error;
1251
 
1252
  switch (status) {
@@ -1258,14 +1563,26 @@ window.elFinder = function(node, opts) {
1258
  break;
1259
  case 'parsererror':
1260
  error = ['errResponse', 'errDataNotJSON'];
 
 
 
 
 
 
1261
  break;
1262
  default:
1263
  if (xhr.status == 403) {
1264
- error = ['errConnect', 'errAccess'];
1265
  } else if (xhr.status == 404) {
1266
- error = ['errConnect', 'errNotFound'];
1267
  } else {
1268
- error = 'errConnect';
 
 
 
 
 
 
1269
  }
1270
  }
1271
 
@@ -1279,56 +1596,85 @@ window.elFinder = function(node, opts) {
1279
  * @return void
1280
  **/
1281
  success = function(response) {
1282
-
1283
- // My custom code
1284
- console.log(response);
1285
- //~ alert(response);
1286
  // Set currrent request command name
1287
  self.currentReqCmd = cmd;
1288
 
1289
  if (raw) {
 
1290
  return dfrd.resolve(response);
1291
  }
1292
 
1293
  if (!response) {
1294
- return dfrd.reject(['errResponse', 'errDataEmpty'], xhr);
1295
  } else if (!$.isPlainObject(response)) {
1296
- return dfrd.reject(['errResponse', 'errDataNotJSON'], xhr);
1297
  } else if (response.error) {
1298
- return dfrd.reject(response.error, xhr);
1299
  } else if (!self.validResponse(cmd, response)) {
1300
- return dfrd.reject('errResponse', xhr);
1301
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1302
 
1303
- response = self.normalize(response);
 
 
 
 
 
 
 
 
 
 
 
1304
 
1305
- if (!self.api) {
1306
- self.api = response.api || 1;
1307
- self.newAPI = self.api >= 2;
1308
- self.oldAPI = !self.newAPI;
1309
- }
1310
-
1311
- if (response.options) {
1312
- cwdOptions = $.extend({}, cwdOptions, response.options);
1313
- }
1314
 
1315
- if (response.netDrivers) {
1316
- self.netDrivers = response.netDrivers;
1317
- }
1318
 
1319
- if (cmd == 'open' && !!data.init) {
1320
- self.uplMaxSize = self.returnBytes(response.uplMaxSize);
1321
- self.uplMaxFile = !!response.uplMaxFile? parseInt(response.uplMaxFile) : 20;
1322
- }
1323
 
1324
- dfrd.resolve(response);
1325
- response.debug && self.debug('backend-debug', response.debug);
 
 
 
 
 
 
 
1326
  },
1327
  xhr, _xhr,
1328
  abort = function(e){
1329
  if (e.type == 'autosync') {
1330
  if (e.data.action != 'stop') return;
1331
- } else {
1332
  if (!e.data.added || !e.data.added.length) {
1333
  return;
1334
  }
@@ -1342,24 +1688,29 @@ window.elFinder = function(node, opts) {
1342
  }
1343
  };
1344
 
1345
- defdone && dfrd.done(done);
1346
- dfrd.fail(function(error) {
1347
  if (error) {
1348
  deffail ? self.error(error) : self.debug('error', self.i18n(error));
1349
  }
 
1350
  })
1351
-
1352
  if (!cmd) {
 
1353
  return dfrd.reject('errCmdReq');
1354
- }
1355
-
1356
- if (syncOnFail) {
1357
- dfrd.fail(function(error) {
1358
- error && self.sync();
1359
- });
1360
  }
1361
 
 
1362
  if (notify.type && notify.cnt) {
 
 
 
1363
  timeout = setTimeout(function() {
1364
  self.notify(notify);
1365
  dfrd.always(function() {
@@ -1374,28 +1725,55 @@ window.elFinder = function(node, opts) {
1374
  }
1375
 
1376
  // quiet abort not completed "open" requests
1377
- if (cmd == 'open') {
1378
  while ((_xhr = queue.pop())) {
1379
  if (_xhr.state() == 'pending') {
1380
  _xhr.quiet = true;
1381
  _xhr.abort();
1382
  }
1383
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1384
  }
1385
 
1386
  delete options.preventFail
1387
 
1388
- xhr = this.transport.send(options).fail(error).done(success);
1389
 
1390
- // add "open" xhr into queue
1391
- if (cmd == 'open' || (cmd == 'info' && data.compare)) {
1392
  queue.unshift(xhr);
1393
- self.bind(self.cmdsToAdd + ' autosync', abort);
 
1394
  dfrd.always(function() {
1395
  var ndx = $.inArray(xhr, queue);
1396
- self.unbind(self.cmdsToAdd + ' autosync', abort);
1397
  ndx !== -1 && queue.splice(ndx, 1);
1398
  });
 
 
 
 
 
 
 
1399
  }
1400
 
1401
  // abort pending xhr on window unload or elFinder destroy
@@ -1410,10 +1788,12 @@ window.elFinder = function(node, opts) {
1410
  /**
1411
  * Compare current files cache with new files and return diff
1412
  *
1413
- * @param Array new files
 
 
1414
  * @return Object
1415
  */
1416
- this.diff = function(incoming, onlydir) {
1417
  var raw = {},
1418
  added = [],
1419
  removed = [],
@@ -1434,8 +1814,8 @@ window.elFinder = function(node, opts) {
1434
 
1435
  // find removed
1436
  $.each(files, function(hash, f) {
1437
- if (!onlydir || f.phash === onlydir) {
1438
- !raw[hash] && removed.push(hash);
1439
  }
1440
  });
1441
 
@@ -1447,9 +1827,11 @@ window.elFinder = function(node, opts) {
1447
  added.push(file);
1448
  } else {
1449
  $.each(file, function(prop) {
1450
- if (file[prop] != origin[prop]) {
1451
- changed.push(file)
1452
- return false;
 
 
1453
  }
1454
  });
1455
  }
@@ -1474,7 +1856,7 @@ window.elFinder = function(node, opts) {
1474
  removed : removed,
1475
  changed : changed
1476
  };
1477
- }
1478
 
1479
  /**
1480
  * Sync content
@@ -1499,36 +1881,92 @@ window.elFinder = function(node, opts) {
1499
  },
1500
  comp = compare(),
1501
  dfrd = $.Deferred().done(function() { self.trigger('sync'); }),
1502
- opts1 = {
1503
  data : {cmd : 'open', reload : 1, target : cwd, tree : (! onlydir && this.ui.tree) ? 1 : 0, compare : comp},
1504
  preventDefault : true
1505
- },
1506
- opts2 = {
1507
- data : {cmd : 'parents', target : cwd},
1508
- preventDefault : true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1509
  };
1510
 
1511
- $.when(
1512
- this.request(opts1),
1513
- onlydir? null : this.request(opts2)
1514
- )
1515
- .fail(function(error) {
1516
- dfrd.reject(error);
1517
- error && self.request({
1518
- data : {cmd : 'open', target : (self.lastDir('') || self.root()), tree : 1, init : 1},
1519
- notify : {type : 'open', cnt : 1, hideCnt : true}
 
1520
  });
 
 
 
 
 
 
 
 
 
 
 
 
1521
  })
1522
- .done(function(odata, pdata) {
 
 
1523
  if (odata.cwd.compare) {
1524
  if (comp === odata.cwd.compare) {
1525
  return dfrd.reject();
1526
  }
1527
  }
1528
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1529
  var diff = self.diff(odata.files.concat(pdata && pdata.tree ? pdata.tree : []), onlydir);
1530
 
1531
- diff.added.push(odata.cwd)
1532
  diff.removed.length && self.remove(diff);
1533
  diff.added.length && self.add(diff);
1534
  diff.changed.length && self.change(diff);
@@ -1539,11 +1977,11 @@ window.elFinder = function(node, opts) {
1539
  });
1540
 
1541
  return dfrd;
1542
- }
1543
 
1544
  this.upload = function(files) {
1545
- return this.transport.upload(files, this);
1546
- }
1547
 
1548
  /**
1549
  * Attach listener to events
@@ -1571,17 +2009,23 @@ window.elFinder = function(node, opts) {
1571
 
1572
  /**
1573
  * Remove event listener if exists
 
1574
  *
1575
- * @param String event name
1576
  * @param Function callback
1577
  * @return elFinder
1578
  */
1579
  this.unbind = function(event, callback) {
1580
- var l = listeners[('' + event).toLowerCase()] || [],
1581
- i = l.indexOf(callback);
1582
-
1583
- i > -1 && l.splice(i, 1);
1584
- //delete callback; // need this?
 
 
 
 
 
1585
  callback = null
1586
  return this;
1587
  };
@@ -1591,28 +2035,37 @@ window.elFinder = function(node, opts) {
1591
  *
1592
  * @param String event type
1593
  * @param Object data to send across event
 
1594
  * @return elFinder
1595
  */
1596
- this.trigger = function(event, data) {
1597
  var event = event.toLowerCase(),
1598
  isopen = (event === 'open'),
1599
  handlers = listeners[event] || [], i, l, jst;
1600
 
1601
  this.debug('event-'+event, data);
1602
 
1603
- if (isopen) {
1604
  // for performance tuning
1605
  jst = JSON.stringify(data);
1606
  }
1607
- if (handlers.length) {
1608
  event = $.Event(event);
 
 
 
1609
 
1610
- l = handlers.length;
1611
  for (i = 0; i < l; i++) {
 
 
 
 
1612
  // only callback has argument
1613
  if (handlers[i].length) {
1614
- // to avoid data modifications. remember about "sharing" passing arguments in js :)
1615
- event.data = isopen? JSON.parse(jst) : $.extend(true, {}, data);
 
 
1616
  }
1617
 
1618
  try {
@@ -1628,7 +2081,17 @@ window.elFinder = function(node, opts) {
1628
  }
1629
  }
1630
  return this;
1631
- }
 
 
 
 
 
 
 
 
 
 
1632
 
1633
  /**
1634
  * Bind keybord shortcut to keydown event
@@ -1655,7 +2118,7 @@ window.elFinder = function(node, opts) {
1655
  parts = pattern.split('+');
1656
  code = (code = parts.pop()).length == 1
1657
  ? code > 0 ? code : code.charCodeAt(0)
1658
- : $.ui.keyCode[code];
1659
 
1660
  if (code && !shortcuts[pattern]) {
1661
  shortcuts[pattern] = {
@@ -1672,7 +2135,7 @@ window.elFinder = function(node, opts) {
1672
  }
1673
  }
1674
  return this;
1675
- }
1676
 
1677
  /**
1678
  * Registered shortcuts
@@ -1701,7 +2164,7 @@ window.elFinder = function(node, opts) {
1701
  * @return Array
1702
  */
1703
  this.clipboard = function(hashes, cut) {
1704
- var map = function() { return $.map(clipboard, function(f) { return f.hash }); }
1705
 
1706
  if (hashes !== void(0)) {
1707
  clipboard.length && this.trigger('unlockfiles', {files : map()});
@@ -1731,7 +2194,7 @@ window.elFinder = function(node, opts) {
1731
 
1732
  // return copy of clipboard instead of refrence
1733
  return clipboard.slice(0, clipboard.length);
1734
- }
1735
 
1736
  /**
1737
  * Return true if command enabled
@@ -1741,20 +2204,18 @@ window.elFinder = function(node, opts) {
1741
  * @return Boolean
1742
  */
1743
  this.isCommandEnabled = function(name, dstHash) {
1744
- var disabled;
1745
- if (dstHash && self.root(dstHash) !== cwd) {
1746
- $.each(self.disabledCmds, function(i, v){
1747
- if (dstHash.indexOf(i, 0) == 0) {
1748
- disabled = v;
1749
- return false;
1750
- }
1751
- });
1752
- }
1753
- if (!disabled) {
1754
  disabled = cwdOptions.disabled;
1755
  }
1756
  return this._commands[name] ? $.inArray(name, disabled) === -1 : false;
1757
- }
1758
 
1759
  /**
1760
  * Exec command and return result;
@@ -1767,12 +2228,15 @@ window.elFinder = function(node, opts) {
1767
  */
1768
  this.exec = function(cmd, files, opts, dstHash) {
1769
  if (cmd === 'open') {
 
 
 
1770
  this.autoSync('stop');
1771
  }
1772
  return this._commands[cmd] && this.isCommandEnabled(cmd, dstHash)
1773
  ? this._commands[cmd].exec(files, opts)
1774
  : $.Deferred().reject('No such command');
1775
- }
1776
 
1777
  /**
1778
  * Create and return dialog.
@@ -1782,12 +2246,29 @@ window.elFinder = function(node, opts) {
1782
  * @return jQuery
1783
  */
1784
  this.dialog = function(content, options) {
1785
- var dialog = $('<div/>').append(content).appendTo(node).elfinderdialog(options);
1786
- this.bind('resize', function(){
1787
- dialog.elfinderdialog('posInit');
1788
- });
 
 
 
 
 
 
 
1789
  return dialog;
1790
- }
 
 
 
 
 
 
 
 
 
 
1791
 
1792
  /**
1793
  * Return UI widget or node
@@ -1797,11 +2278,17 @@ window.elFinder = function(node, opts) {
1797
  */
1798
  this.getUI = function(ui) {
1799
  return this.ui[ui] || node;
1800
- }
1801
 
1802
- this.command = function(name) {
 
 
 
 
 
 
1803
  return name === void(0) ? this._commands : this._commands[name];
1804
- }
1805
 
1806
  /**
1807
  * Resize elfinder node
@@ -1813,7 +2300,7 @@ window.elFinder = function(node, opts) {
1813
  this.resize = function(w, h) {
1814
  node.css('width', w).height(h).trigger('resize');
1815
  this.trigger('resize', {width : node.width(), height : node.height()});
1816
- }
1817
 
1818
  /**
1819
  * Restore elfinder node size
@@ -1822,16 +2309,71 @@ window.elFinder = function(node, opts) {
1822
  */
1823
  this.restoreSize = function() {
1824
  this.resize(width, height);
1825
- }
1826
 
1827
  this.show = function() {
1828
  node.show();
1829
  this.enable().trigger('show');
1830
- }
1831
 
1832
  this.hide = function() {
 
 
 
 
1833
  this.disable().trigger('hide');
1834
  node.hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1835
  }
1836
 
1837
  /**
@@ -1841,17 +2383,24 @@ window.elFinder = function(node, opts) {
1841
  **/
1842
  this.destroy = function() {
1843
  if (node && node[0].elfinder) {
1844
- this.autoSync('stop');
 
1845
  this.trigger('destroy').disable();
 
 
1846
  listeners = {};
1847
  shortcuts = {};
1848
- $(document).add(node).off('.'+this.namespace);
1849
- self.trigger = function() { }
1850
- node.children().remove();
1851
- node.append(prevContent.contents()).removeClass(this.cssClass).attr('style', prevStyle);
 
 
1852
  node[0].elfinder = null;
 
 
1853
  }
1854
- }
1855
 
1856
  /**
1857
  * Start or stop auto sync
@@ -1859,7 +2408,7 @@ window.elFinder = function(node, opts) {
1859
  * @param String|Bool stop
1860
  * @return void
1861
  */
1862
- this.autoSync = function(stop) {
1863
  var sync;
1864
  if (self.options.sync >= 1000) {
1865
  if (syncInterval) {
@@ -1867,9 +2416,17 @@ window.elFinder = function(node, opts) {
1867
  syncInterval = null;
1868
  self.trigger('autosync', {action : 'stop'});
1869
  }
1870
- if (stop || !self.options.syncStart) {
1871
- return;
 
 
 
1872
  }
 
 
 
 
 
1873
  // run interval sync
1874
  sync = function(start){
1875
  var timeout;
@@ -1878,10 +2435,10 @@ window.elFinder = function(node, opts) {
1878
  timeout = Math.max(self.options.sync, cwdOptions.syncMinMs);
1879
  syncInterval && clearTimeout(syncInterval);
1880
  syncInterval = setTimeout(function() {
1881
- var dosync = true, hash = cwd;
1882
- if (cwdOptions.syncChkAsTs) {
1883
  self.request({
1884
- data : {cmd : 'info', targets : [hash], compare : files[hash].ts, reload : 1},
1885
  preventDefault : true
1886
  })
1887
  .done(function(data){
@@ -1889,7 +2446,7 @@ window.elFinder = function(node, opts) {
1889
  dosync = true;
1890
  if (data.compare) {
1891
  ts = data.compare;
1892
- if (files[hash] && ts == files[hash].ts) {
1893
  dosync = false;
1894
  }
1895
  }
@@ -1905,9 +2462,15 @@ window.elFinder = function(node, opts) {
1905
  sync();
1906
  }
1907
  })
1908
- .fail(function(error){
1909
- if (error && error != 'errConnect') {
1910
  self.error(error);
 
 
 
 
 
 
1911
  } else {
1912
  syncInterval = setTimeout(function() {
1913
  sync();
@@ -1926,10 +2489,309 @@ window.elFinder = function(node, opts) {
1926
  }
1927
  };
1928
 
1929
- /************* init stuffs ****************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1930
 
1931
- // check jquery ui
1932
- if (!($.fn.selectable && $.fn.draggable && $.fn.droppable)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1933
  return alert(this.i18n('errJqui'));
1934
  }
1935
 
@@ -1951,14 +2813,18 @@ window.elFinder = function(node, opts) {
1951
  'F6' : 117,
1952
  'F7' : 118,
1953
  'F8' : 119,
1954
- 'F9' : 120
 
 
 
 
1955
  });
1956
 
1957
  this.dragUpload = false;
1958
  this.xhrUpload = (typeof XMLHttpRequestUpload != 'undefined' || typeof XMLHttpRequestEventTarget != 'undefined') && typeof File != 'undefined' && typeof FormData != 'undefined';
1959
 
1960
  // configure transport object
1961
- this.transport = {}
1962
 
1963
  if (typeof(this.options.transport) == 'object') {
1964
  this.transport = this.options.transport;
@@ -1982,6 +2848,56 @@ window.elFinder = function(node, opts) {
1982
  this.transport.upload = $.proxy(this.uploads.iframe, this);
1983
  }
1984
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1985
  /**
1986
  * Alias for this.trigger('error', {error : 'message'})
1987
  *
@@ -1989,14 +2905,15 @@ window.elFinder = function(node, opts) {
1989
  * @return elFinder
1990
  **/
1991
  this.error = function() {
1992
- var arg = arguments[0];
 
1993
  return arguments.length == 1 && typeof(arg) == 'function'
1994
  ? self.bind('error', arg)
1995
- : self.trigger('error', {error : arg});
1996
- }
1997
 
1998
  // create bind/trigger aliases for build-in events
1999
- $.each(['enable', 'disable', 'load', 'open', 'reload', 'select', 'add', 'remove', 'change', 'dblclick', 'getfile', 'lockfiles', 'unlockfiles', 'selectfiles', 'unselectfiles', 'dragstart', 'dragstop', 'search', 'searchend', 'viewchange'], function(i, name) {
2000
  self[name] = function() {
2001
  var arg = arguments[0];
2002
  return arguments.length == 1 && typeof(arg) == 'function'
@@ -2023,7 +2940,20 @@ window.elFinder = function(node, opts) {
2023
  selected = [];
2024
  })
2025
  .select(function(e) {
2026
- selected = $.map(e.data.selected || e.data.value|| [], function(hash) { return files[hash] ? hash : null; });
 
 
 
 
 
 
 
 
 
 
 
 
 
2027
  })
2028
  .error(function(e) {
2029
  var opts = {
@@ -2033,9 +2963,13 @@ window.elFinder = function(node, opts) {
2033
  destroyOnClose : true,
2034
  buttons : {}
2035
  };
2036
-
2037
  opts.buttons[self.i18n(self.i18n('btnClose'))] = function() { $(this).elfinderdialog('close'); };
2038
 
 
 
 
 
2039
  self.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-error"/>'+self.i18n(e.data.error), opts);
2040
  })
2041
  .bind('tree parents', function(e) {
@@ -2049,7 +2983,7 @@ window.elFinder = function(node, opts) {
2049
  })
2050
  })
2051
  .add(function(e) {
2052
- cache(e.data.added||[]);
2053
  })
2054
  .change(function(e) {
2055
  $.each(e.data.changed||[], function(i, file) {
@@ -2066,11 +3000,15 @@ window.elFinder = function(node, opts) {
2066
  })
2067
  .remove(function(e) {
2068
  var removed = e.data.removed||[],
2069
- l = removed.length,
 
2070
  rm = function(hash) {
2071
- var file = files[hash];
2072
  if (file) {
2073
- if (file.mime == 'directory' && file.dirs) {
 
 
 
2074
  $.each(files, function(h, f) {
2075
  f.phash == hash && rm(h);
2076
  });
@@ -2079,17 +3017,25 @@ window.elFinder = function(node, opts) {
2079
  }
2080
  };
2081
 
 
 
 
2082
  while (l--) {
2083
  rm(removed[l]);
2084
  }
2085
 
2086
  })
 
 
 
 
2087
  .bind('search', function(e) {
2088
- cache(e.data.files);
2089
- self.tmbUrls._search = true;
2090
  })
2091
  .bind('searchend', function() {
2092
- self.tmbUrls._search = false;
 
2093
  })
2094
  .bind('rm', function(e) {
2095
  var play = beeper.canPlayType && beeper.canPlayType('audio/wav; codecs="1"');
@@ -2112,26 +3058,43 @@ window.elFinder = function(node, opts) {
2112
  this.history = new this.history(this);
2113
 
2114
  // in getFileCallback set - change default actions on double click/enter/ctrl+enter
2115
- if (typeof(this.options.getFileCallback) == 'function' && this.commands.getfile) {
2116
- this.bind('dblclick', function(e) {
2117
- e.preventDefault();
2118
- self.exec('getfile').fail(function() {
2119
- self.exec('open');
 
 
2120
  });
2121
- });
2122
- this.shortcut({
2123
- pattern : 'enter',
2124
- description : this.i18n('cmdgetfile'),
2125
- callback : function() { self.exec('getfile').fail(function() { self.exec(self.OS == 'mac' ? 'rename' : 'open') }) }
2126
- })
2127
- .shortcut({
2128
- pattern : 'ctrl+enter',
2129
- description : this.i18n(this.OS == 'mac' ? 'cmdrename' : 'cmdopen'),
2130
- callback : function() { self.exec(self.OS == 'mac' ? 'rename' : 'open') }
2131
- });
2132
-
2133
- }
 
2134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2135
  /**
2136
  * Loaded commands
2137
  *
@@ -2142,18 +3105,44 @@ window.elFinder = function(node, opts) {
2142
  if (!$.isArray(this.options.commands)) {
2143
  this.options.commands = [];
2144
  }
2145
- // check required commands
2146
- $.each(['open', 'reload', 'back', 'forward', 'up', 'home', 'info', 'quicklook', 'getfile', 'help'], function(i, cmd) {
2147
- $.inArray(cmd, self.options.commands) === -1 && self.options.commands.push(cmd);
2148
- });
2149
-
2150
  // load commands
2151
- $.each(this.options.commands, function(i, name) {
2152
- var cmd = self.commands[name];
2153
- if ($.isFunction(cmd) && !self._commands[name]) {
2154
- cmd.prototype = base;
 
 
 
 
 
 
 
 
 
 
2155
  self._commands[name] = new cmd();
2156
- self._commands[name].setup(name, self.options.commandsOptions[name]||{});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2157
  }
2158
  });
2159
 
@@ -2165,18 +3154,13 @@ window.elFinder = function(node, opts) {
2165
  this.commandMap = {};
2166
 
2167
  /**
2168
- * Disabled commands Array of each volume
2169
- *
2170
- * @type Object
2171
- */
2172
- this.disabledCmds = {};
2173
-
2174
- /**
2175
- * tmbUrls Array of each volume
2176
  *
2177
  * @type Object
2178
  */
2179
- this.tmbUrls = {};
2180
 
2181
  // prepare node
2182
  node.addClass(this.cssClass)
@@ -2205,15 +3189,42 @@ window.elFinder = function(node, opts) {
2205
  cwd : $('<div/>').appendTo(node).elfindercwd(this, this.options.uiOptions.cwd || {}),
2206
  // notification dialog window
2207
  notify : this.dialog('', {
2208
- cssClass : 'elfinder-dialog-notify',
2209
- position : this.options.notifyDialog.position,
2210
- resizable : false,
2211
- autoOpen : false,
2212
- title : '&nbsp;',
2213
- width : parseInt(this.options.notifyDialog.width)
 
2214
  }),
2215
- statusbar : $('<div class="ui-widget-header ui-helper-clearfix ui-corner-bottom elfinder-statusbar"/>').hide().appendTo(node)
2216
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2217
 
2218
  // load required ui
2219
  $.each(this.options.ui || [], function(i, ui) {
@@ -2221,7 +3232,9 @@ window.elFinder = function(node, opts) {
2221
  opts = self.options.uiOptions[ui] || {};
2222
 
2223
  if (!self.ui[ui] && $.fn[name]) {
2224
- self.ui[ui] = $('<'+(opts.tag || 'div')+'/>').appendTo(node)[name](self, opts);
 
 
2225
  }
2226
  });
2227
 
@@ -2232,9 +3245,11 @@ window.elFinder = function(node, opts) {
2232
 
2233
  // make node resizable
2234
  this.options.resizable
2235
- && !this.UA.Touch
2236
  && $.fn.resizable
2237
  && node.resizable({
 
 
 
2238
  handles : 'se',
2239
  minWidth : 300,
2240
  minHeight : 200
@@ -2258,13 +3273,13 @@ window.elFinder = function(node, opts) {
2258
  // attach events to document
2259
  $(document)
2260
  // disable elfinder on click outside elfinder
2261
- .on('click.'+this.namespace, function(e) { enabled && !$(e.target).closest(node).length && self.disable(); })
2262
  // exec shortcuts
2263
  .on(keydown+' '+keypress, execShortcut);
2264
 
2265
  // attach events to window
2266
  self.options.useBrowserHistory && $(window)
2267
- .on('popstate', function(ev) {
2268
  var target = ev.originalEvent.state && ev.originalEvent.state.thash;
2269
  target && !$.isEmptyObject(self.files()) && self.request({
2270
  data : {cmd : 'open', target : target, onhistory : 1},
@@ -2285,14 +3300,31 @@ window.elFinder = function(node, opts) {
2285
  self.trigger('fail').disable().lastDir('');
2286
  listeners = {};
2287
  shortcuts = {};
2288
- $(document).add(node).off('.'+this.namespace);
2289
  self.trigger = function() { };
2290
  })
2291
  .done(function(data) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2292
  self.load().debug('api', self.api);
2293
- data = $.extend(true, {}, data);
2294
  open(data);
2295
  self.trigger('open', data);
 
 
 
 
2296
  });
2297
 
2298
  // update ui's size after init
@@ -2302,22 +3334,37 @@ window.elFinder = function(node, opts) {
2302
 
2303
  (function(){
2304
  var tm;
2305
- $(window).on('resize', function(){
2306
- tm && clearTimeout(tm);
2307
- tm = setTimeout(function() {
2308
- self.trigger('resize', {width : node.width(), height : node.height()});
2309
- }, 200);
 
 
2310
  })
2311
- .on('beforeunload',function(){
2312
- if (self.ui.notify.children().length) {
2313
- return self.i18n('ntfsmth');
 
 
 
 
 
 
 
 
 
 
 
 
 
2314
  }
2315
  self.trigger('unload');
2316
  });
2317
  })();
2318
 
2319
  // bind window onmessage for CORS
2320
- $(window).on('message', function(e){
2321
  var res = e.originalEvent || null,
2322
  obj, data;
2323
  if (res && self.uploadURL.indexOf(res.origin) === 0) {
@@ -2326,6 +3373,9 @@ window.elFinder = function(node, opts) {
2326
  data = obj.data || null;
2327
  if (data) {
2328
  if (data.error) {
 
 
 
2329
  self.error(data.error);
2330
  } else {
2331
  data.warning && self.error(data.warning);
@@ -2334,6 +3384,7 @@ window.elFinder = function(node, opts) {
2334
  data.changed && data.changed.length && self.change(data);
2335
  if (obj.bind) {
2336
  self.trigger(obj.bind, data);
 
2337
  }
2338
  data.sync && self.sync();
2339
  }
@@ -2344,67 +3395,132 @@ window.elFinder = function(node, opts) {
2344
  }
2345
  });
2346
 
2347
- if (self.dragUpload) {
2348
- node[0].addEventListener('dragenter', function(e) {
2349
- if (e.target.nodeName !== 'TEXTAREA' && e.target.nodeName !== 'INPUT') {
2350
- e.preventDefault();
2351
- e.stopPropagation();
2352
- }
2353
- }, false);
2354
- node[0].addEventListener('dragleave', function(e) {
2355
- if (e.target.nodeName !== 'TEXTAREA' && e.target.nodeName !== 'INPUT') {
2356
- e.preventDefault();
2357
- e.stopPropagation();
2358
- }
2359
- }, false);
2360
- node[0].addEventListener('dragover', function(e) {
2361
- if (e.target.nodeName !== 'TEXTAREA' && e.target.nodeName !== 'INPUT') {
2362
- e.preventDefault();
2363
- e.stopPropagation();
2364
- e.dataTransfer.dropEffect = 'none';
2365
- }
2366
- }, false);
2367
- node[0].addEventListener('drop', function(e) {
2368
- if (e.target.nodeName !== 'TEXTAREA' && e.target.nodeName !== 'INPUT') {
2369
- e.stopPropagation();
2370
- e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
2371
  }
2372
- }, false);
 
2373
 
 
2374
  // add event listener for HTML5 DnD upload
2375
  (function() {
2376
- var ent = 'native-drag-enter',
 
 
 
2377
  disable = 'native-drag-disable',
2378
  c = 'class',
2379
  navdir = self.res(c, 'navdir'),
2380
  droppable = self.res(c, 'droppable'),
2381
- collapsed = self.res(c, 'navcollapse'),
2382
- expanded = self.res(c, 'navexpand'),
2383
  dropover = self.res(c, 'adroppable'),
2384
  arrow = self.res(c, 'navarrow'),
2385
- clDropActive = self.res(c, 'adroppable');
2386
- node.on('dragenter', '.native-droppable', function(e){
2387
- if (e.originalEvent.dataTransfer) {
2388
- var $elm = $(e.currentTarget),
2389
- id = e.currentTarget.id || null,
2390
- cwd = null,
2391
- elfFrom;
2392
- if (!id) { // target is cwd
2393
- cwd = self.cwd();
2394
- $elm.data(disable, false);
2395
- try {
2396
- $.each(e.originalEvent.dataTransfer.types, function(i, v){
2397
- if (v.substr(0, 13) === 'elfinderfrom:') {
2398
- elfFrom = v.substr(13).toLowerCase();
2399
- }
2400
- });
2401
- } catch(e) {}
2402
- } else {
2403
- if (!$elm.data(ent) && $elm.hasClass(navdir) && $elm.is('.'+collapsed+':not(.'+expanded+')')) {
2404
- setTimeout(function() {
2405
- $elm.is('.'+collapsed+'.'+dropover) && $elm.children('.'+arrow).click();
2406
- }, 500);
2407
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2408
  }
2409
  if (!cwd || (cwd.write && (!elfFrom || elfFrom !== (window.location.href + cwd.hash).toLowerCase()))) {
2410
  e.preventDefault();
@@ -2438,7 +3554,7 @@ window.elFinder = function(node, opts) {
2438
  }
2439
  })
2440
  .on('drop', '.native-droppable', function(e){
2441
- if (e.originalEvent.dataTransfer) {
2442
  var $elm = $(e.currentTarget)
2443
  id;
2444
  e.preventDefault();
@@ -2450,14 +3566,132 @@ window.elFinder = function(node, opts) {
2450
  id = self.cwd().hash;
2451
  }
2452
  e.originalEvent._target = id;
2453
- self.directUploadTarget = id;
2454
- self.exec('upload', {dropEvt: e.originalEvent, target: id});
2455
- self.directUploadTarget = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2456
  }
2457
  });
2458
  })();
2459
  }
2460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2461
  // self.timeEnd('load');
2462
 
2463
  }
@@ -2474,6 +3708,41 @@ elFinder.prototype = {
2474
  res : function(type, id) {
2475
  return this.resources[type] && this.resources[type][id];
2476
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2477
 
2478
  /**
2479
  * Current request command
@@ -2674,7 +3943,7 @@ elFinder.prototype = {
2674
  }
2675
 
2676
  try {
2677
- data = $.parseJSON(text);
2678
  } catch (e) {
2679
  return {error : ['errResponse', 'errDataNotJSON']};
2680
  }
@@ -2705,7 +3974,7 @@ elFinder.prototype = {
2705
  }
2706
  },
2707
  check = function() {
2708
- var renames = [], existed = [], exists = [], i, c;
2709
 
2710
  var confirm = function(ndx) {
2711
  var last = ndx == exists.length-1,
@@ -2718,7 +3987,7 @@ elFinder.prototype = {
2718
  callback : function(all) {
2719
  !last && !all
2720
  ? confirm(++ndx)
2721
- : dfrd.resolve(renames);
2722
  }
2723
  },
2724
  reject : {
@@ -2737,14 +4006,14 @@ elFinder.prototype = {
2737
 
2738
  !last && !all
2739
  ? confirm(++ndx)
2740
- : dfrd.resolve(renames);
2741
  }
2742
  },
2743
  cancel : {
2744
  label : 'btnCancel',
2745
  callback : function() {
2746
  cancel();
2747
- dfrd.resolve(renames);
2748
  }
2749
  },
2750
  buttons : [
@@ -2762,7 +4031,7 @@ elFinder.prototype = {
2762
  }
2763
  !last && !all
2764
  ? confirm(++ndx)
2765
- : dfrd.resolve(renames);
2766
  }
2767
  }
2768
  ]
@@ -2773,26 +4042,58 @@ elFinder.prototype = {
2773
  fm.confirm(opts);
2774
  };
2775
 
 
 
 
 
 
 
2776
  names = $.map(files, function(file, i) { return file.name? {i: i, name: file.name} : null ;});
2777
 
2778
  name = $.map(names, function(item) { return item.name;});
2779
  fm.request({
2780
- data : {cmd : 'upload', target : target, name : name , FILES : ''},
2781
  notify : {type : 'preupload', cnt : 1, hideCnt : true},
2782
  preventFail : true
2783
  })
2784
  .done(function(data) {
 
2785
  if (data) {
2786
  if (data.error) {
2787
  cancel();
2788
  } else {
2789
- if (data.name) {
2790
- existed = data.name || [];
2791
- exists = $.map(names, function(name){ return $.inArray(name.name, existed) !== -1 ? name : null ;});
2792
- }
2793
- if (data.list && target == fm.cwd().hash
2794
- && data.list.length != $.map(fm.files(), function(file) { return file.phash == target ? file.name : null ;}).length) {
2795
- fm.sync();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2796
  }
2797
  }
2798
  }
@@ -2808,7 +4109,7 @@ elFinder.prototype = {
2808
  error && fm.error(error);
2809
  });
2810
  };
2811
- if (fm.option('uploadOverwrite') && typeof files[0] == 'object') {
2812
  check();
2813
  return dfrd;
2814
  } else {
@@ -2828,91 +4129,58 @@ elFinder.prototype = {
2828
  entries = [],
2829
  processing = 0,
2830
  items,
 
2831
 
2832
  readEntries = function(dirReader) {
2833
  var toArray = function(list) {
2834
  return Array.prototype.slice.call(list || []);
2835
  };
2836
- var readFile = function(fileEntry, callback) {
2837
- var dfrd = $.Deferred();
2838
- if (typeof fileEntry == 'undefined') {
2839
- dfrd.reject('empty');
2840
- } else if (fileEntry.isFile) {
2841
- fileEntry.file(function (file) {
2842
- dfrd.resolve(file);
2843
- }, function(e){
2844
- dfrd.reject();
2845
- });
2846
- } else {
2847
- dfrd.reject('dirctory');
2848
- }
2849
- return dfrd.promise();
2850
- };
2851
-
2852
- dirReader.readEntries(function (results) {
2853
- if (!results.length) {
2854
- var len = entries.length - 1;
2855
- var read = function(i) {
2856
- readFile(entries[i]).done(function(file){
2857
- if (! (fm.OS == 'win' && file.name.match(/^(?:desktop\.ini|thumbs\.db)$/i))
2858
- &&
2859
- ! (fm.OS == 'mac' && file.name.match(/^\.ds_store$/i))) {
2860
- paths.push(entries[i].fullPath);
2861
- files.push(file);
2862
- }
2863
- }).fail(function(e){
2864
- if (e == 'dirctory') {
2865
- // dirctory
2866
- dirctorys.push(entries[i]);
2867
- } else if (e == 'empty') {
2868
- // dirctory is empty
2869
- } else {
2870
- // why fail?
2871
- }
2872
- }).always(function(){
2873
- processing--;
2874
- if (i < len) {
2875
- processing++;
2876
- read(++i);
2877
- }
2878
- });
2879
- };
2880
- processing++;
2881
- read(0);
2882
- processing--;
2883
- } else {
2884
- entries = entries.concat(toArray(results));
2885
- readEntries(dirReader);
2886
- }
2887
- });
2888
  },
2889
 
2890
- doScan = function(items, isEntry) {
2891
- var dirReader, entry;
2892
- entries = [];
 
 
 
2893
  var length = items.length;
2894
  for (var i = 0; i < length; i++) {
2895
- if (! isEntry) {
2896
- entry = !!items[i].getAsEntry? items[i].getAsEntry() : items[i].webkitGetAsEntry();
2897
- } else {
2898
- entry = items[i];
2899
- }
2900
  if (entry) {
2901
  if (entry.isFile) {
2902
  processing++;
2903
  entry.file(function (file) {
2904
- paths.push('');
2905
- files.push(file);
 
 
 
 
2906
  processing--;
2907
  });
2908
  } else if (entry.isDirectory) {
2909
- if (processing > 0) {
2910
- dirctorys.push(entry);
2911
- } else {
2912
- processing = 0;
2913
- dirReader = entry.createReader();
2914
  processing++;
2915
- readEntries(dirReader);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2916
  }
2917
  }
2918
  }
@@ -2923,20 +4191,28 @@ elFinder.prototype = {
2923
  return item.getAsEntry? item.getAsEntry() : item.webkitGetAsEntry();
2924
  });
2925
  if (items.length > 0) {
2926
- fm.uploads.checkExists(items, target, fm).done(function(renames){
2927
  var notifyto, dfds = [];
2928
- if (fm.option('uploadOverwrite')) {
2929
  items = $.map(items, function(item){
2930
- var i, bak, file, dfd;
2931
  if (item.isDirectory) {
2932
  i = $.inArray(item.name, renames);
2933
  if (i !== -1) {
2934
  renames.splice(i, 1);
2935
  bak = fm.uniqueName(item.name + fm.options.backupSuffix , null, '');
2936
- file = fm.fileByName(item.name, target);
2937
- fm.lockfiles({files : [file.hash]});
 
 
 
 
 
 
 
 
2938
  dfd = fm.request({
2939
- data : {cmd : 'rename', target : file.hash, name : bak},
2940
  notify : {type : 'rename', cnt : 1}
2941
  })
2942
  .fail(function(error) {
@@ -2944,7 +4220,7 @@ elFinder.prototype = {
2944
  fm.sync();
2945
  })
2946
  .always(function() {
2947
- fm.unlockfiles({files : [file.hash]})
2948
  });
2949
  dfds.push(dfd);
2950
  }
@@ -2957,19 +4233,14 @@ elFinder.prototype = {
2957
  notifyto = setTimeout(function() {
2958
  fm.notify({type : 'readdir', cnt : 1, hideCnt: true});
2959
  }, fm.options.notifyDelay);
2960
- doScan(items, true);
2961
  setTimeout(function wait() {
2962
  if (processing > 0) {
2963
  setTimeout(wait, 10);
2964
  } else {
2965
- if (dirctorys.length > 0) {
2966
- doScan([dirctorys.shift()], true);
2967
- setTimeout(wait, 10);
2968
- } else {
2969
- notifyto && clearTimeout(notifyto);
2970
- fm.notify({type : 'readdir', cnt : -1});
2971
- dfrd.resolve([files, paths, renames]);
2972
- }
2973
  }
2974
  }, 10);
2975
  } else {
@@ -2986,16 +4257,16 @@ elFinder.prototype = {
2986
  var check = [];
2987
  var str = data.files[0];
2988
  if (data.type == 'html') {
2989
- var tmp = $("<html/>").append($.parseHTML(str)),
2990
  atag;
2991
- $('img[src]', tmp).each(function(){
2992
  var url, purl,
2993
  self = $(this),
2994
  pa = self.closest('a');
2995
  if (pa && pa.attr('href') && pa.attr('href').match(/\.(?:jpe?g|gif|bmp|png)/i)) {
2996
  purl = pa.attr('href');
2997
  }
2998
- url = self.attr('src');
2999
  if (url) {
3000
  if (purl) {
3001
  $.inArray(purl, ret) == -1 && ret.push(purl);
@@ -3035,85 +4306,110 @@ elFinder.prototype = {
3035
  // upload transport using XMLHttpRequest
3036
  xhr : function(data, fm) {
3037
  var self = fm ? fm : this,
 
3038
  xhr = new XMLHttpRequest(),
3039
  notifyto = null, notifyto2 = null,
3040
  dataChecked = data.checked,
3041
  isDataType = (data.isDataType || data.type == 'data'),
 
 
 
 
 
 
3042
  retry = 0,
3043
- cancelBtn = 'div.elfinder-notify-upload div.elfinder-notify-cancel button',
3044
  dfrd = $.Deferred()
3045
  .fail(function(error) {
3046
- var file = files.length? (isDataType? files[0][0] : files[0]) : {};
3047
- if (file._cid) {
3048
- formData = new FormData();
3049
- files = [{_chunkfail: true}];
3050
- formData.append('chunk', file._chunk);
3051
- formData.append('cid' , file._cid);
3052
- isDataType = false;
3053
- send(files);
 
 
 
3054
  }
 
3055
  files = null;
3056
  error && self.error(error);
3057
  })
3058
  .done(function(data) {
3059
  xhr = null;
 
3060
  files = null;
3061
  if (data) {
 
3062
  data.warning && self.error(data.warning);
3063
  data.removed && self.remove(data);
3064
  data.added && self.add(data);
3065
  data.changed && self.change(data);
3066
  self.trigger('upload', data);
 
3067
  data.sync && self.sync();
 
3068
  }
3069
  })
3070
  .always(function() {
 
 
 
3071
  notifyto && clearTimeout(notifyto);
3072
  notifyto2 && clearTimeout(notifyto2);
3073
  dataChecked && !data.multiupload && checkNotify() && self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});
3074
- chunkMerge && self.ui.notify.children('.elfinder-notify-chunkmerge').length && self.notify({type : 'chunkmerge', cnt : -1});
3075
- self.ui.notify.off('click', cancelBtn, fnAbort);
3076
- $(document).off('keydown', fnAbort);
3077
  }),
3078
  formData = new FormData(),
3079
- target = (data.target || self.cwd().hash),
3080
  files = data.input ? data.input.files : self.uploads.checkFile(data, self, target),
3081
  cnt = data.checked? (isDataType? files[0].length : files.length) : files.length,
3082
  loaded = 0, prev,
3083
  filesize = 0,
3084
  notify = false,
 
 
3085
  abort = false,
3086
  checkNotify = function() {
3087
- return notify = (notify || self.ui.notify.children('.elfinder-notify-upload').length);
 
 
 
 
 
 
 
 
 
 
 
 
 
3088
  },
3089
  startNotify = function(size) {
3090
  if (!size) size = filesize;
3091
  return setTimeout(function() {
3092
  notify = true;
3093
- self.notify({type : 'upload', cnt : cnt, progress : loaded - prev, size : size, cancel: true});
 
 
 
 
3094
  prev = loaded;
 
 
 
 
 
3095
  }, self.options.notifyDelay);
3096
  },
3097
- fnAbort = function(e) {
3098
- if (e.type == 'keydown' && e.keyCode != $.ui.keyCode.ESCAPE) {
3099
- return;
3100
- }
3101
- e.preventDefault();
3102
- e.stopPropagation();
3103
- abort = true;
3104
- xhr.abort();
3105
- dfrd.reject();
3106
- self.sync();
3107
- },
3108
  renames = (data.renames || null),
 
3109
  chunkMerge = false;
3110
 
3111
- // regist abort event
3112
- self.ui.notify.one('click', cancelBtn, fnAbort);
3113
- $(document).on('keydown', fnAbort);
3114
- $(window).on('unload', function(e){
3115
- (dfrd.state() == 'pending') && dfrd.reject();
3116
- });
3117
 
3118
  !chunkMerge && (prev = loaded);
3119
 
@@ -3122,7 +4418,35 @@ elFinder.prototype = {
3122
  }
3123
 
3124
  xhr.addEventListener('error', function() {
3125
- dfrd.reject('errConnect');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3126
  }, false);
3127
 
3128
  xhr.addEventListener('abort', function() {
@@ -3148,25 +4472,9 @@ elFinder.prototype = {
3148
  }
3149
 
3150
  if (error) {
3151
- if (chunkMerge || retry++ > 3) {
3152
- var file = isDataType? files[0][0] : files[0];
3153
- if (file._cid) {
3154
- formData = new FormData();
3155
- files = [{_chunkfail: true}];
3156
- formData.append('chunk', file._chunk);
3157
- formData.append('cid' , file._cid);
3158
- formData.append('range', file._range);
3159
- isDataType = false;
3160
- send(files);
3161
- return;
3162
- }
3163
- return dfrd.reject(error);
3164
- } else {
3165
- filesize = 0;
3166
- xhr.open('POST', self.uploadURL, true);
3167
- xhr.send(formData);
3168
- return;
3169
- }
3170
  }
3171
 
3172
  loaded = filesize;
@@ -3180,8 +4488,9 @@ elFinder.prototype = {
3180
  // chunked upload commit
3181
  if (res._chunkmerged) {
3182
  formData = new FormData();
3183
- var _file = [{_chunkmerged: res._chunkmerged, _name: res._name}];
3184
  chunkMerge = true;
 
3185
  notifyto2 = setTimeout(function() {
3186
  self.notify({type : 'chunkmerge', cnt : 1});
3187
  }, self.options.notifyDelay);
@@ -3191,11 +4500,12 @@ elFinder.prototype = {
3191
 
3192
  res._multiupload = data.multiupload? true : false;
3193
  if (res.error) {
3194
- if (res._chunkfailure) {
 
3195
  abort = true;
3196
  self.uploads.xhrUploading = false;
3197
  notifyto && clearTimeout(notifyto);
3198
- if (self.ui.notify.children('.elfinder-notify-upload').length) {
3199
  self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});
3200
  dfrd.reject(res.error);
3201
  } else {
@@ -3255,6 +4565,11 @@ elFinder.prototype = {
3255
  self.notify({type : 'upload', cnt : 0, progress : curr, size : 0});
3256
  prev = loaded;
3257
  }
 
 
 
 
 
3258
  }
3259
  }, false);
3260
 
@@ -3267,93 +4582,110 @@ elFinder.prototype = {
3267
  maxFileSize,
3268
  totalSize = 0,
3269
  chunked = [],
3270
- chunkID = +new Date(),
3271
  BYTES_PER_CHUNK = Math.min((fm.uplMaxSize? fm.uplMaxSize : 2097152) - 8190, fm.options.uploadMaxChunkSize), // uplMaxSize margin 8kb or options.uploadMaxChunkSize
3272
- blobSlice = false,
3273
  blobSize, i, start, end, chunks, blob, chunk, added, done, last, failChunk,
3274
  multi = function(files, num){
3275
- var sfiles = [], cid;
3276
  if (!abort) {
3277
  while(files.length && sfiles.length < num) {
3278
  sfiles.push(files.shift());
3279
  }
3280
- }
3281
- if (sfiles.length) {
3282
- for (var i=0; i < sfiles.length; i++) {
3283
- if (abort) {
3284
- break;
3285
- }
3286
- cid = isDataType? (sfiles[i][0][0]._cid || null) : (sfiles[i][0]._cid || null);
3287
- if (!!failChunk[cid]) {
3288
- last--;
3289
- continue;
3290
- }
3291
- fm.exec('upload', {
3292
- type: data.type,
3293
- isDataType: isDataType,
3294
- files: sfiles[i],
3295
- checked: true,
3296
- target: target,
3297
- renames: renames,
3298
- multiupload: true})
3299
- .fail(function(error) {
3300
- if (cid) {
3301
- failChunk[cid] = true;
3302
  }
3303
- //error && self.error(error);
3304
- })
3305
- .always(function(e) {
3306
- if (e && e.added) added = $.merge(added, e.added);
3307
- if (last <= ++done) {
3308
- fm.trigger('multiupload', {added: added});
3309
- notifyto && clearTimeout(notifyto);
3310
- if (checkNotify()) {
3311
- self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});
3312
- }
3313
  }
3314
- multi(files, 1); // Next one
3315
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3316
  }
3317
- } else {
3318
- self.uploads.xhrUploading = false;
3319
  if (abort) {
3320
  notifyto && clearTimeout(notifyto);
3321
- if (checkNotify()) {
3322
- self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});
3323
- }
3324
- if (cid) {
3325
  failChunk[cid] = true;
3326
  }
 
 
 
 
3327
  }
3328
- dfrd.resolve();
3329
  }
3330
  },
3331
  check = function(){
3332
  if (!self.uploads.xhrUploading) {
3333
  self.uploads.xhrUploading = true;
3334
- multi(sfiles, 3); // Max connection: 3
3335
  } else {
3336
  setTimeout(function(){ check(); }, 100);
3337
  }
3338
  };
3339
 
3340
  if (! dataChecked && (isDataType || data.type == 'files')) {
3341
- maxFileSize = fm.option('uploadMaxSize')? fm.option('uploadMaxSize') : 0;
 
 
3342
  for (i=0; i < files.length; i++) {
3343
  blob = files[i];
3344
  blobSize = blob.size;
3345
  if (blobSlice === false) {
3346
- if ('slice' in blob) {
3347
- blobSlice = 'slice';
3348
- } else if ('mozSlice' in blob) {
3349
- blobSlice = 'mozSlice';
3350
- } else if ('webkitSlice' in blob) {
3351
- blobSlice = 'webkitSlice';
3352
- } else {
3353
- blobSlice = '';
 
3354
  }
3355
  }
3356
 
 
3357
  if ((maxFileSize && blobSize > maxFileSize) || (!blobSlice && fm.uplMaxSize && blobSize > fm.uplMaxSize)) {
3358
  self.error(self.i18n('errUploadFile', blob.name) + ' ' + self.i18n('errUploadFileSize'));
3359
  cnt--;
@@ -3361,6 +4693,14 @@ elFinder.prototype = {
3361
  continue;
3362
  }
3363
 
 
 
 
 
 
 
 
 
3364
  if (blobSlice && blobSize > BYTES_PER_CHUNK) {
3365
  start = 0;
3366
  end = BYTES_PER_CHUNK;
@@ -3371,7 +4711,7 @@ elFinder.prototype = {
3371
  chunked[chunkID] = 0;
3372
  while(start <= blobSize) {
3373
  chunk = blob[blobSlice](start, end);
3374
- chunk._chunk = blob.name + '.' + ++chunks + '_' + total + '.part';
3375
  chunk._cid = chunkID;
3376
  chunk._range = start + ',' + chunk.size + ',' + blobSize;
3377
  chunked[chunkID]++;
@@ -3404,6 +4744,9 @@ elFinder.prototype = {
3404
  total--;
3405
  } else {
3406
  total += chunks;
 
 
 
3407
  }
3408
  continue;
3409
  }
@@ -3471,6 +4814,7 @@ elFinder.prototype = {
3471
  }
3472
 
3473
  xhr.open('POST', self.uploadURL, true);
 
3474
 
3475
  // set request headers
3476
  if (fm.customHeaders) {
@@ -3490,12 +4834,17 @@ elFinder.prototype = {
3490
 
3491
  formData.append('cmd', 'upload');
3492
  formData.append(self.newAPI ? 'target' : 'current', target);
3493
- if (renames) {
3494
- $.each(renames, function(i, v){
3495
  formData.append('renames[]', v);
3496
  });
3497
  formData.append('suffix', fm.options.backupSuffix);
3498
  }
 
 
 
 
 
3499
  $.each(self.options.customData, function(key, val) {
3500
  formData.append(key, val);
3501
  });
@@ -3507,6 +4856,8 @@ elFinder.prototype = {
3507
  if (file._chunkmerged) {
3508
  formData.append('chunk', file._chunkmerged);
3509
  formData.append('upload[]', file._name);
 
 
3510
  } else {
3511
  if (file._chunkfail) {
3512
  formData.append('upload[]', 'chunkfail');
@@ -3519,6 +4870,10 @@ elFinder.prototype = {
3519
  formData.append('cid' , file._cid);
3520
  formData.append('range', file._range);
3521
  }
 
 
 
 
3522
  }
3523
  });
3524
 
@@ -3528,23 +4883,6 @@ elFinder.prototype = {
3528
  });
3529
  }
3530
 
3531
-
3532
- xhr.onreadystatechange = function() {
3533
- if (xhr.readyState == 4 && xhr.status == 0) {
3534
- if (abort) {
3535
- dfrd.reject();
3536
- } else {
3537
- var errors = ['errAbort'];
3538
- // ff bug while send zero sized file
3539
- // for safari - send directory
3540
- if (!isDataType && data.files && $.map(data.files, function(f){return f.size === 0? f : null;}).length) {
3541
- errors.push('errFolderUpload');
3542
- }
3543
- dfrd.reject(errors);
3544
- }
3545
- }
3546
- };
3547
-
3548
  xhr.send(formData);
3549
 
3550
  return true;
@@ -3554,10 +4892,12 @@ elFinder.prototype = {
3554
  if (files.length > 0) {
3555
  if (renames == null) {
3556
  renames = [];
 
3557
  self.uploads.checkExists(files, target, fm).done(
3558
- function(res){
3559
- if (fm.option('uploadOverwrite')) {
3560
  renames = res;
 
3561
  files = $.map(files, function(file){return !file._remove? file : null ;});
3562
  }
3563
  cnt = files.length;
@@ -3582,14 +4922,53 @@ elFinder.prototype = {
3582
  if (dataChecked) {
3583
  send(files[0], files[1]);
3584
  } else {
3585
- files.done(function(result){
3586
  renames = [];
3587
  cnt = result[0].length;
3588
  if (cnt) {
3589
- renames = result[2];
3590
- send(result[0], result[1]);
3591
- } else {
3592
- dfrd.reject(['errUploadNoFiles']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3593
  }
3594
  }).fail(function(){
3595
  dfrd.reject();
@@ -3608,16 +4987,8 @@ elFinder.prototype = {
3608
  dfrd = $.Deferred()
3609
  .fail(function(error) {
3610
  error && self.error(error);
3611
- })
3612
- .done(function(data) {
3613
- data.warning && self.error(data.warning);
3614
- data.removed && self.remove(data);
3615
- data.added && self.add(data);
3616
- data.changed && self.change(data);
3617
- self.trigger('upload', data);
3618
- data.sync && self.sync();
3619
  }),
3620
- name = 'iframe-'+self.namespace+(++self.iframeCnt),
3621
  form = $('<form action="'+self.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+name+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),
3622
  msie = this.UA.IE,
3623
  // clear timeouts, close notification dialog, remove form/iframe
@@ -3636,11 +5007,9 @@ elFinder.prototype = {
3636
  .on('load', function() {
3637
  iframe.off('load')
3638
  .on('load', function() {
3639
- //var data = self.parseUploadData(iframe.contents().text());
3640
-
3641
  onload();
3642
- dfrd.reject();
3643
- //data.error ? dfrd.reject(data.error) : dfrd.resolve(data);
3644
  });
3645
 
3646
  // notify dialog
@@ -3663,6 +5032,7 @@ elFinder.prototype = {
3663
  names = [],
3664
  dfds = [],
3665
  renames = [],
 
3666
  cnt, notify, notifyto, abortto;
3667
 
3668
  if (files && files.length) {
@@ -3671,12 +5041,13 @@ elFinder.prototype = {
3671
  });
3672
  cnt = 1;
3673
  } else if (input && $(input).is(':file') && $(input).val()) {
3674
- if (fm.option('uploadOverwrite')) {
3675
  names = input.files? input.files : [{ name: $(input).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/, '$1') }];
3676
  //names = $.map(names, function(file){return file.name? { name: file.name } : null ;});
3677
  dfds.push(self.uploads.checkExists(names, target, self).done(
3678
- function(res){
3679
  renames = res;
 
3680
  cnt = $.map(names, function(file){return !file._remove? file : null ;}).length;
3681
  if (cnt != names.length) {
3682
  cnt = 0;
@@ -3701,17 +5072,22 @@ elFinder.prototype = {
3701
 
3702
  if (renames.length > 0) {
3703
  $.each(renames, function(i, rename) {
3704
- form.append('<input type="hidden" name="renames[]" value="'+rename+'"/>');
3705
  });
3706
  form.append('<input type="hidden" name="suffix" value="'+fm.options.backupSuffix+'"/>');
3707
  }
 
 
 
 
 
3708
 
3709
  $.each(self.options.onlyMimes||[], function(i, mime) {
3710
- form.append('<input type="hidden" name="mimes[]" value="'+mime+'"/>');
3711
  });
3712
 
3713
  $.each(self.options.customData, function(key, val) {
3714
- form.append('<input type="hidden" name="'+key+'" value="'+val+'"/>');
3715
  });
3716
 
3717
  form.appendTo('body');
@@ -3733,10 +5109,10 @@ elFinder.prototype = {
3733
  */
3734
  one : function(event, callback) {
3735
  var self = this,
3736
- h = $.proxy(callback, function(event) {
3737
- setTimeout(function() {self.unbind(event.type, h);}, 3);
3738
- return callback.apply(this, arguments);
3739
- });
3740
  return this.bind(event, h);
3741
  },
3742
 
@@ -3750,7 +5126,7 @@ elFinder.prototype = {
3750
  localStorage : function(key, val) {
3751
  var s = window.localStorage,
3752
  oldkey = 'elfinder-'+key+this.id, // old key of elFinder < 2.1.6
3753
- retval, oldval;
3754
 
3755
  // new key of elFinder >= 2.1.6
3756
  key = window.location.pathname+'-elfinder-'+key+this.id;
@@ -3765,15 +5141,28 @@ elFinder.prototype = {
3765
  }
3766
 
3767
  if (val !== void(0)) {
 
 
 
 
3768
  try {
3769
  s.setItem(key, val);
3770
  } catch (e) {
3771
- s.clear();
3772
- s.setItem(key, val);
 
 
 
 
3773
  }
3774
  retval = s.getItem(key);
3775
  }
3776
 
 
 
 
 
 
3777
  return retval;
3778
  },
3779
 
@@ -3785,7 +5174,7 @@ elFinder.prototype = {
3785
  * @return String
3786
  */
3787
  cookie : function(name, value) {
3788
- var d, o, c, i;
3789
 
3790
  name = 'elfinder-'+name+this.id;
3791
 
@@ -3796,7 +5185,13 @@ elFinder.prototype = {
3796
  for (i=0; i<c.length; i++) {
3797
  c[i] = $.trim(c[i]);
3798
  if (c[i].substring(0, name.length) == name) {
3799
- return decodeURIComponent(c[i].substring(name.length));
 
 
 
 
 
 
3800
  }
3801
  }
3802
  }
@@ -3807,6 +5202,11 @@ elFinder.prototype = {
3807
  if (value === null) {
3808
  value = '';
3809
  o.expires = -1;
 
 
 
 
 
3810
  }
3811
  if (typeof(o.expires) == 'number') {
3812
  d = new Date();
@@ -3869,18 +5269,103 @@ elFinder.prototype = {
3869
  * @return Object
3870
  */
3871
  normalize : function(data) {
3872
- var filter = function(file) {
3873
-
3874
- if (file && file.hash && file.name && file.mime) {
3875
- if (file.mime == 'application/x-empty') {
3876
- file.mime = 'text/plain';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3877
  }
3878
- return file;
3879
- }
3880
- return null;
3881
- };
3882
 
3883
 
 
 
 
 
 
 
3884
  if (data.files) {
3885
  data.files = $.map(data.files, filter);
3886
  }
@@ -3906,40 +5391,23 @@ elFinder.prototype = {
3906
  * @param {String} sort order
3907
  * @param {Boolean} show folder first
3908
  */
3909
- setSort : function(type, order, stickFolders) {
3910
  this.storage('sortType', (this.sortType = this.sortRules[type] ? type : 'name'));
3911
  this.storage('sortOrder', (this.sortOrder = /asc|desc/.test(order) ? order : 'asc'));
3912
  this.storage('sortStickFolders', (this.sortStickFolders = !!stickFolders) ? 1 : '');
 
3913
  this.trigger('sortchange');
3914
  },
3915
 
3916
  _sortRules : {
3917
  name : function(file1, file2) {
3918
- var n1 = file1.name.toLowerCase(),
3919
- n2 = file2.name.toLowerCase(),
3920
- e1 = '',
3921
- e2 = '',
3922
- so = elFinder.prototype.naturalCompare,
3923
- m, ret;
3924
- if (m = n1.match(/^(.+)(\.[0-9a-z.]+)$/)) {
3925
- n1 = m[1];
3926
- e1 = m[2];
3927
- }
3928
- if (m = n2.match(/^(.+)(\.[0-9a-z.]+)$/)) {
3929
- n2 = m[1];
3930
- e2 = m[2];
3931
- }
3932
- ret = so(n1, n2);
3933
- if (ret == 0 && (e1 || e2) && e1 != e2) {
3934
- ret = so(e1, e2);
3935
- }
3936
- return ret;
3937
  },
3938
  size : function(file1, file2) {
3939
  var size1 = parseInt(file1.size) || 0,
3940
  size2 = parseInt(file2.size) || 0;
3941
 
3942
- return size1 == size2 ? 0 : size1 > size2 ? 1 : -1;
3943
  },
3944
  kind : function(file1, file2) {
3945
  return elFinder.prototype.naturalCompare(file1.mime, file2.mime);
@@ -3948,10 +5416,38 @@ elFinder.prototype = {
3948
  var date1 = file1.ts || file1.date,
3949
  date2 = file2.ts || file2.date;
3950
 
3951
- return date1 == date2 ? 0 : date1 > date2 ? 1 : -1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3952
  }
3953
  },
3954
 
 
 
 
 
 
 
 
3955
  /**
3956
  * Compare strings for natural sort
3957
  *
@@ -4085,7 +5581,7 @@ elFinder.prototype = {
4085
 
4086
  res = asc ? sort(file1, file2) : sort(file2, file1);
4087
 
4088
- return type != 'name' && res == 0
4089
  ? res = asc ? rules.name(file1, file2) : rules.name(file2, file1)
4090
  : res;
4091
  },
@@ -4112,22 +5608,28 @@ elFinder.prototype = {
4112
  * cnt : 3,
4113
  * hideCnt : false, // true for not show count
4114
  * progress : 10, // progress bar percents (use cnt : 0 to update progress bar)
4115
- * cancel : false // show cancel button (should regist event at each caller @see this.uploads.xhr)
4116
  * })
4117
  * @return elFinder
4118
  */
4119
  notify : function(opts) {
4120
  var type = opts.type,
4121
- msg = this.messages['ntf'+type] ? this.i18n('ntf'+type) : this.i18n('ntfsmth'),
4122
  ndialog = this.ui.notify,
4123
  notify = ndialog.children('.elfinder-notify-'+type),
4124
- ntpl = '<div class="elfinder-notify elfinder-notify-{type}"><span class="elfinder-dialog-icon elfinder-dialog-icon-{type}"/><span class="elfinder-notify-msg">{msg}</span> <span class="elfinder-notify-cnt"/><div class="elfinder-notify-progressbar"><div class="elfinder-notify-progress"/></div><div class="elfinder-notify-cancel"/></div></div>',
 
4125
  delta = opts.cnt,
4126
  size = (typeof opts.size != 'undefined')? parseInt(opts.size) : null,
4127
  progress = (typeof opts.progress != 'undefined' && opts.progress >= 0) ? opts.progress : null,
4128
  cancel = opts.cancel,
4129
  clhover = 'ui-state-hover',
4130
- cnt, total, prc, button;
 
 
 
 
 
4131
 
4132
  if (!type) {
4133
  return this;
@@ -4149,13 +5651,41 @@ elFinder.prototype = {
4149
  });
4150
  notify.children('div.elfinder-notify-cancel').append(button);
4151
  }
 
 
4152
  }
4153
 
4154
  cnt = delta + parseInt(notify.data('cnt'));
4155
 
4156
  if (cnt > 0) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4157
  !opts.hideCnt && notify.children('.elfinder-notify-cnt').text('('+cnt+')');
4158
- ndialog.is(':hidden') && ndialog.elfinderdialog('open');
4159
  notify.data('cnt', cnt);
4160
 
4161
  if ((progress != null)
@@ -4179,8 +5709,7 @@ elFinder.prototype = {
4179
  }
4180
 
4181
  } else {
4182
- notify.remove();
4183
- !ndialog.children().length && ndialog.elfinderdialog('close');
4184
  }
4185
 
4186
  return this;
@@ -4237,14 +5766,14 @@ elFinder.prototype = {
4237
  options.buttons[this.i18n(opts.accept.label)] = function() {
4238
  opts.accept.callback(!!(checkbox && checkbox.prop('checked')))
4239
  complete = true;
4240
- $(this).elfinderdialog('close')
4241
  };
4242
 
4243
  if (opts.reject) {
4244
  options.buttons[this.i18n(opts.reject.label)] = function() {
4245
  opts.reject.callback(!!(checkbox && checkbox.prop('checked')))
4246
  complete = true;
4247
- $(this).elfinderdialog('close')
4248
  };
4249
  }
4250
 
@@ -4259,25 +5788,15 @@ elFinder.prototype = {
4259
  }
4260
 
4261
  options.buttons[this.i18n(opts.cancel.label)] = function() {
4262
- $(this).elfinderdialog('close')
4263
  };
4264
 
4265
  if (opts.all) {
4266
- if (opts.reject) {
4267
- options.width = 370;
4268
- }
4269
  options.create = function() {
 
4270
  checkbox = $('<input type="checkbox" />');
4271
- $(this).next().children().before($('<label>'+apply+'</label>').prepend(checkbox));
4272
- }
4273
-
4274
- options.open = function() {
4275
- var pane = $(this).next(),
4276
- width = parseInt(pane.children(':first').outerWidth() + pane.children(':last').outerWidth());
4277
-
4278
- if (width > parseInt(pane.width())) {
4279
- $(this).closest('.elfinder-dialog').width(width+30);
4280
- }
4281
  }
4282
  }
4283
 
@@ -4340,25 +5859,29 @@ elFinder.prototype = {
4340
  }
4341
  return m;
4342
  },
4343
- i, j, m;
4344
-
4345
- for (i = 0; i< arguments.length; i++) {
 
 
 
 
4346
  m = arguments[i];
4347
 
4348
- if (typeof m == 'string') {
4349
- input.push(message(m));
4350
- } else if ($.isArray(m)) {
4351
  for (j = 0; j < m.length; j++) {
4352
- if (typeof m[j] == 'string') {
4353
- input.push(message(m[j]));
4354
- } else if (m[j] instanceof jQuery) {
4355
  // jQuery object is HTML element
4356
  input.push(m[j]);
 
 
4357
  }
4358
  }
4359
  } else if (m instanceof jQuery) {
4360
  // jQuery object is HTML element
4361
  input.push(m[j]);
 
 
4362
  }
4363
  }
4364
 
@@ -4370,14 +5893,14 @@ elFinder.prototype = {
4370
  m = input[i];
4371
  if (typeof m == 'string') {
4372
  // translate message
4373
- m = messages[m] || self.escape(m);
4374
  // replace placeholders in message
4375
  m = m.replace(/\$(\d+)/g, function(match, placeholder) {
4376
  placeholder = i + parseInt(placeholder);
4377
  if (placeholder > 0 && input[placeholder]) {
4378
  ignore.push(placeholder)
4379
  }
4380
- return self.escape(input[placeholder]) || '';
4381
  });
4382
  } else {
4383
  // get HTML from jQuery object
@@ -4411,13 +5934,21 @@ elFinder.prototype = {
4411
  * @return String
4412
  */
4413
  mime2kind : function(f) {
4414
- var mime = typeof(f) == 'object' ? f.mime : f, kind;
 
 
4415
 
4416
- if (f.alias && f.mime != 'symlink-broken') {
 
4417
  kind = 'Alias';
4418
  } else if (this.kinds[mime]) {
4419
- kind = this.kinds[mime];
4420
- } else {
 
 
 
 
 
4421
  if (mime.indexOf('text') === 0) {
4422
  kind = 'Text';
4423
  } else if (mime.indexOf('image') === 0) {
@@ -4481,8 +6012,8 @@ elFinder.prototype = {
4481
  case 'G': return h;
4482
  case 'g': return g;
4483
  case 'h': return g > 9 ? g : '0'+g;
4484
- case 'a': return h > 12 ? 'pm' : 'am';
4485
- case 'A': return h > 12 ? 'PM' : 'AM';
4486
  case 'i': return i > 9 ? i : '0'+i;
4487
  case 's': return s > 9 ? s : '0'+s;
4488
  }
@@ -4515,6 +6046,11 @@ elFinder.prototype = {
4515
  } else if (!o.write) {
4516
  c = 'elfinder-ro';
4517
  }
 
 
 
 
 
4518
  return c;
4519
  },
4520
 
@@ -4651,6 +6187,264 @@ elFinder.prototype = {
4651
  }
4652
  },
4653
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4654
  navHash2Id : function(hash) {
4655
  return this.navPrefix + hash;
4656
  },
@@ -4667,6 +6461,18 @@ elFinder.prototype = {
4667
  return typeof(id) == 'string' ? id.substr(this.cwdPrefix.length) : false;
4668
  },
4669
 
 
 
 
 
 
 
 
 
 
 
 
 
4670
  log : function(m) { window.console && window.console.log && window.console.log(m); return this; },
4671
 
4672
  debug : function(type, m) {
@@ -4675,6 +6481,11 @@ elFinder.prototype = {
4675
  if (d == 'all' || d === true || ($.isArray(d) && $.inArray(type, d) != -1)) {
4676
  window.console && window.console.log && window.console.log('elfinder debug: ['+type+'] ['+this.id+']', m);
4677
  }
 
 
 
 
 
4678
  return this;
4679
  },
4680
  time : function(l) { window.console && window.console.time && window.console.time(l); },
@@ -4733,7 +6544,7 @@ if (!Object.keys) {
4733
  *
4734
  * @type String
4735
  **/
4736
- elFinder.prototype.version = '2.1.6';
4737
 
4738
 
4739
 
@@ -4743,56 +6554,259 @@ elFinder.prototype.version = '2.1.6';
4743
 
4744
  /*** jQuery UI droppable performance tune for elFinder ***/
4745
  (function(){
4746
- if ($.ui && $.ui.ddmanager) {
4747
- var origin = $.ui.ddmanager.prepareOffsets;
4748
- $.ui.ddmanager.prepareOffsets = function( t, event ) {
4749
- var isOutView = function(elem) {
4750
- if (elem.is(':hidden')) {
4751
- return true;
 
 
 
 
4752
  }
4753
- var rect = elem[0].getBoundingClientRect();
4754
- return document.elementFromPoint(rect.left, rect.top)? false : true;
4755
- }
4756
-
4757
- if (event.type === 'mousedown') {
4758
- var i, d,
4759
- m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
4760
- l = m.length;
4761
- for ( i = 0; i < l; i++ ) {
4762
- d = m[ i ];
4763
- if (d.options.autoDisable && (!d.options.disabled || d.options.autoDisable > 1)) {
4764
- d.options.disabled = isOutView(d.element);
4765
- d.options.autoDisable = d.options.disabled? 2 : 1;
4766
  }
4767
  }
4768
- }
4769
-
4770
- // call origin function
4771
- return origin( t, event );
4772
- };
4773
  }
4774
  })();
4775
 
4776
- $.fn.elfinder = function(o) {
4777
-
4778
- if (o == 'instance') {
4779
- return this.getElFinder();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4780
  }
4781
-
4782
- return this.each(function() {
4783
-
4784
- var cmd = typeof(o) == 'string' ? o : '';
4785
- if (!this.elfinder) {
4786
- new elFinder(this, typeof(o) == 'object' ? o : {})
4787
- }
4788
-
4789
- switch(cmd) {
4790
- case 'close':
4791
- case 'hide':
4792
- this.elfinder.hide();
4793
- break;
4794
-
4795
- case 'open':
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4796
  case 'show':
4797
  this.elfinder.show();
4798
  break;
@@ -4803,7 +6817,7 @@ $.fn.elfinder = function(o) {
4803
  }
4804
 
4805
  })
4806
- }
4807
 
4808
  $.fn.getElFinder = function() {
4809
  var instance;
@@ -4816,7 +6830,20 @@ $.fn.getElFinder = function() {
4816
  });
4817
 
4818
  return instance;
4819
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
4820
 
4821
 
4822
  /*
@@ -4888,6 +6915,14 @@ elFinder.prototype._options = {
4888
  */
4889
  dragUploadAllow : 'auto',
4890
 
 
 
 
 
 
 
 
 
4891
  /**
4892
  * Max size of chunked data of file upload
4893
  *
@@ -4952,17 +6987,19 @@ elFinder.prototype._options = {
4952
  cssClass : '',
4953
 
4954
  /**
4955
- * Active commands list
4956
  * If some required commands will be missed here, elFinder will add its
4957
  *
4958
  * @type Array
4959
  */
4960
- commands : [
4961
- 'open', 'opendir', 'reload', 'home', 'up', 'back', 'forward', 'getfile', 'quicklook',
4962
- 'download', 'rm', 'duplicate', 'rename', 'mkdir', 'mkfile', 'upload', 'copy',
4963
- 'cut', 'paste', 'edit', 'extract', 'archive', 'search', 'info', 'view', 'help',
4964
- 'resize', 'sort', 'netmount', 'netunmount', 'places', 'chmod'
4965
- ],
 
 
4966
 
4967
  /**
4968
  * Commands options.
@@ -4996,16 +7033,36 @@ elFinder.prototype._options = {
4996
  // allow to return filers info
4997
  folders : false,
4998
  // action after callback (""/"close"/"destroy")
4999
- oncomplete : ''
 
 
 
 
 
 
 
 
 
 
 
5000
  },
5001
  // "upload" command options.
5002
  upload : {
5003
- ui : 'uploadbutton'
 
 
 
 
 
5004
  },
5005
  // "quicklook" command options.
5006
  quicklook : {
5007
  autoplay : true,
5008
- jplayer : 'extensions/jplayer'
 
 
 
 
5009
  },
5010
  // "quicklook" command options.
5011
  edit : {
@@ -5060,6 +7117,14 @@ elFinder.prototype._options = {
5060
  // }
5061
  ]
5062
  },
 
 
 
 
 
 
 
 
5063
  // "info" command options.
5064
  info : {
5065
  nullUrlDirLinkSelf : true,
@@ -5119,56 +7184,11 @@ elFinder.prototype._options = {
5119
  // }
5120
  }
5121
  },
5122
-
5123
- netmount: {
5124
- ftp: {
5125
- inputs: {
5126
- host : $('<input type="text"/>'),
5127
- port : $('<input type="text" placeholder="21"/>'),
5128
- path : $('<input type="text" value="/"/>'),
5129
- user : $('<input type="text"/>'),
5130
- pass : $('<input type="password"/>'),
5131
- encoding : $('<input type="text" placeholder="Optional"/>'),
5132
- locale : $('<input type="text" placeholder="Optional"/>')
5133
- }
5134
- },
5135
- dropbox: {
5136
- inputs: {
5137
- host : $('<span><span class="elfinder-info-spinner"/></span></span><input type="hidden"/>'),
5138
- path : $('<input type="text" value="/"/>'),
5139
- user : $('<input type="hidden"/>'),
5140
- pass : $('<input type="hidden"/>')
5141
- },
5142
- select: function(fm){
5143
- var self = this;
5144
- if (self.inputs.host.find('span').length) {
5145
- fm.request({
5146
- data : {cmd : 'netmount', protocol: 'dropbox', host: 'dropbox.com', user: 'init', pass: 'init', options: {url: fm.uploadURL, id: fm.id}},
5147
- preventDefault : true
5148
- }).done(function(data){
5149
- self.inputs.host.find('span').removeClass("elfinder-info-spinner");
5150
- self.inputs.host.find('span').html(data.body.replace(/\{msg:([^}]+)\}/g, function(whole,s1){return fm.i18n(s1,'Dropbox.com');}));
5151
- }).fail(function(){});
5152
- }
5153
- },
5154
- done: function(fm, data){
5155
- var self = this;
5156
- if (data.mode == 'makebtn') {
5157
- self.inputs.host.find('span').removeClass("elfinder-info-spinner");
5158
- self.inputs.host.find('input').hover(function(){$(this).toggleClass("ui-state-hover");});
5159
- self.inputs.host[1].value = "";
5160
- } else {
5161
- self.inputs.host.find('span').removeClass("elfinder-info-spinner");
5162
- self.inputs.host.find('span').html("Dropbox.com");
5163
- self.inputs.host[1].value = "dropbox";
5164
- self.inputs.user.val("done");
5165
- self.inputs.pass.val("done");
5166
- }
5167
- }
5168
- }
5169
  },
5170
-
5171
- help : {view : ['about', 'shortcuts', 'help']}
5172
  },
5173
 
5174
  /**
@@ -5191,6 +7211,14 @@ elFinder.prototype._options = {
5191
  /**
5192
  * Hash of default directory path to open
5193
  *
 
 
 
 
 
 
 
 
5194
  * @type String
5195
  * @default ""
5196
  */
@@ -5228,7 +7256,17 @@ elFinder.prototype._options = {
5228
  ['extract', 'archive'],
5229
  ['search'],
5230
  ['view', 'sort'],
5231
- ['help']
 
 
 
 
 
 
 
 
 
 
5232
  ],
5233
  // directories tree options
5234
  tree : {
@@ -5241,30 +7279,37 @@ elFinder.prototype._options = {
5241
  // ,
5242
  // /**
5243
  // * Add CSS class name to navbar directories (optional)
5244
- // * see: https://github.com/Studio-42/elFinder/pull/1061
 
5245
  // *
5246
  // * @type Function
5247
  // */
5248
  // getClass: function(dir) {
5249
- // // ex. This adds the directory's name (lowercase) with prefix as a CSS class
5250
  // return 'elfinder-tree-' + dir.name.replace(/[ "]/g, '').toLowerCase();
5251
  // }
5252
  },
5253
  // navbar options
5254
  navbar : {
5255
  minWidth : 150,
5256
- maxWidth : 500
 
 
5257
  },
5258
  cwd : {
5259
  // display parent folder with ".." name :)
5260
  oldSchool : false,
5261
 
 
 
 
5262
  // file info columns displayed
5263
  listView : {
5264
  // name is always displayed, cols are ordered
5265
- // ex. ['perm', 'date', 'size', 'kind', 'owner', 'group', 'mode']
5266
  // mode: 'mode'(by `fileModeStyle` setting), 'modestr'(rwxr-xr-x) , 'modeoct'(755), 'modeboth'(rwxr-xr-x (755))
5267
  // 'owner', 'group' and 'mode', It's necessary set volume driver option "statOwner" to `true`
 
5268
  columns : ['perm', 'date', 'size', 'kind'],
5269
  // override this if you want custom columns name
5270
  // example
@@ -5272,9 +7317,43 @@ elFinder.prototype._options = {
5272
  // date : 'Last modification',
5273
  // kind : 'Mime type'
5274
  // }
5275
- columnsCustomName : {}
5276
-
 
5277
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5278
  }
5279
  },
5280
 
@@ -5291,7 +7370,7 @@ elFinder.prototype._options = {
5291
 
5292
  /**
5293
  * Custom files sort rules.
5294
- * All default rules (name/size/kind/date) set in elFinder._sortRules
5295
  *
5296
  * @type {Object}
5297
  * @example
@@ -5324,6 +7403,14 @@ elFinder.prototype._options = {
5324
  */
5325
  sortStickFolders : true,
5326
 
 
 
 
 
 
 
 
 
5327
  /**
5328
  * If true - elFinder will formating dates itself,
5329
  * otherwise - backend date will be used.
@@ -5383,7 +7470,7 @@ elFinder.prototype._options = {
5383
  * elFinder height
5384
  *
5385
  * @type Number
5386
- * @default "auto"
5387
  */
5388
  height : 400,
5389
 
@@ -5452,7 +7539,7 @@ elFinder.prototype._options = {
5452
  * @type Number
5453
  * @default 50
5454
  */
5455
- showFiles : 30,
5456
 
5457
  /**
5458
  * Lazy load config.
@@ -5527,13 +7614,53 @@ elFinder.prototype._options = {
5527
  */
5528
  contextmenu : {
5529
  // navbarfolder menu
5530
- navbar : ['open', '|', 'upload', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'rename', '|', 'places', 'info', 'chmod', 'netunmount'],
5531
  // current directory menu
5532
- cwd : ['reload', 'back', '|', 'upload', 'mkdir', 'mkfile', 'paste', '|', 'sort', '|', 'info'],
5533
  // current directory file menu
5534
- files : ['getfile', '|' ,'open', 'opendir', 'quicklook', '|', 'download', 'upload', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'edit', 'rename', 'resize', '|', 'archive', 'extract', '|', 'places', 'info', 'chmod']
5535
  },
5536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5537
  /**
5538
  * Debug config
5539
  *
@@ -5541,7 +7668,71 @@ elFinder.prototype._options = {
5541
  */
5542
  // debug : true
5543
  debug : ['error', 'warning', 'event-destroy']
5544
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5545
 
5546
 
5547
  /*
@@ -5659,7 +7850,8 @@ elFinder.prototype.history = function(fm) {
5659
  })
5660
  .reload(fm.options.reloadClearHistory && reset);
5661
 
5662
- }
 
5663
 
5664
  /*
5665
  * File: /js/elFinder.command.js
@@ -5687,6 +7879,14 @@ elFinder.prototype.command = function(fm) {
5687
  */
5688
  this.name = '';
5689
 
 
 
 
 
 
 
 
 
5690
  /**
5691
  * Short command description
5692
  *
@@ -5694,6 +7894,14 @@ elFinder.prototype.command = function(fm) {
5694
  */
5695
  this.title = '';
5696
 
 
 
 
 
 
 
 
 
5697
  /**
5698
  * Current command state
5699
  *
@@ -5735,7 +7943,7 @@ elFinder.prototype.command = function(fm) {
5735
  this._handlers = {
5736
  enable : function() { this.update(void(0), this.value); },
5737
  disable : function() { this.update(-1, this.value); },
5738
- 'open reload load' : function() {
5739
  this._disabled = !(this.alwaysEnabled || this.fm.isCommandEnabled(this.name));
5740
  this.update(void(0), this.value)
5741
  this.change();
@@ -5775,7 +7983,8 @@ elFinder.prototype.command = function(fm) {
5775
  fm = this.fm, i, s, sc;
5776
 
5777
  this.name = name;
5778
- this.title = fm.messages['cmd'+name] ? fm.i18n('cmd'+name) : name,
 
5779
  this.options = $.extend({}, this.options, opts);
5780
  this.listeners = [];
5781
 
@@ -5805,7 +8014,7 @@ elFinder.prototype.command = function(fm) {
5805
 
5806
  if (this.disableOnSearch) {
5807
  fm.bind('search searchend', function(e) {
5808
- self._disabled = e.type == 'search';
5809
  self.update(void(0), self.value);
5810
  });
5811
  }
@@ -5944,9 +8153,7 @@ elFinder.prototype.command = function(fm) {
5944
  ? $.map($.isArray(hashes) ? hashes : [hashes], function(hash) { return fm.file(hash) || null })
5945
  : fm.selectedFiles();
5946
  }
5947
- }
5948
-
5949
-
5950
 
5951
 
5952
  /*
@@ -5980,7 +8187,8 @@ elFinder.prototype.resources = {
5980
  navexpand : 'elfinder-navbar-expanded',
5981
  treedir : 'elfinder-tree-dir',
5982
  placedir : 'elfinder-place-dir',
5983
- searchbtn : 'elfinder-button-search'
 
5984
  },
5985
  tpl : {
5986
  perms : '<span class="elfinder-perms"/>',
@@ -5988,8 +8196,8 @@ elFinder.prototype.resources = {
5988
  symlink : '<span class="elfinder-symlink"/>',
5989
  navicon : '<span class="elfinder-nav-icon"/>',
5990
  navspinner : '<span class="elfinder-navbar-spinner"/>',
5991
- navdir : '<div class="elfinder-navbar-wrapper"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree"/></div>',
5992
- placedir : '<div class="elfinder-navbar-wrapper"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}" title="{title}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree"/></div>'
5993
 
5994
  },
5995
 
@@ -6014,42 +8222,83 @@ elFinder.prototype.resources = {
6014
  make : function() {
6015
  var fm = this.fm,
6016
  cmd = this.name,
6017
- cwd = fm.getUI('cwd'),
6018
- tarea= (fm.storage('view') != 'list'),
 
 
 
 
 
 
 
6019
  rest = function(){
 
 
 
 
 
 
6020
  if (tarea) {
6021
- node.zIndex('').css('position', '');
6022
  nnode.css('max-height', '');
6023
- } else {
6024
- pnode.css('width', '');
6025
- pnode.parent('td').css('overflow', '');
6026
  }
6027
  }, colwidth,
6028
  dfrd = $.Deferred()
6029
  .fail(function(error) {
6030
- rest();
6031
- cwd.trigger('unselectall');
 
 
 
 
 
6032
  error && fm.error(error);
6033
  })
6034
  .always(function() {
6035
- input.remove();
6036
- node.remove();
6037
  fm.enable();
 
6038
  }),
6039
  id = 'tmp_'+parseInt(Math.random()*100000),
6040
- phash = fm.cwd().hash,
6041
  date = new Date(),
6042
  file = {
6043
  hash : id,
6044
- name : fm.uniqueName(this.prefix),
 
6045
  mime : this.mime,
6046
  read : true,
6047
  write : true,
6048
- date : 'Today '+date.getHours()+':'+date.getMinutes()
 
6049
  },
6050
  data = this.data || {},
6051
- node = cwd.trigger('create.'+fm.namespace, file).find('#'+fm.cwdHash2Id(id)),
 
 
 
 
 
6052
  nnode, pnode,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6053
  input = $(tarea? '<textarea/>' : '<input type="text"/>')
6054
  .on('keyup text', function(){
6055
  if (tarea) {
@@ -6064,7 +8313,6 @@ elFinder.prototype.resources = {
6064
  })
6065
  .keydown(function(e) {
6066
  e.stopImmediatePropagation();
6067
-
6068
  if (e.keyCode == $.ui.keyCode.ESCAPE) {
6069
  dfrd.reject();
6070
  } else if (e.keyCode == $.ui.keyCode.ENTER) {
@@ -6077,9 +8325,10 @@ elFinder.prototype.resources = {
6077
  .blur(function() {
6078
  var name = $.trim(input.val()),
6079
  parent = input.parent(),
6080
- valid = true;
 
6081
 
6082
- if (parent.length) {
6083
 
6084
  if (fm.options.validName && fm.options.validName.test) {
6085
  try {
@@ -6089,70 +8338,165 @@ elFinder.prototype.resources = {
6089
  }
6090
  }
6091
  if (!name || name === '..' || !valid) {
6092
- fm.error('errInvName');
 
6093
  return false;
6094
  }
6095
  if (fm.fileByName(name, phash)) {
6096
- fm.error(['errExists', name]);
 
6097
  return false;
6098
  }
6099
 
6100
- rest();
6101
- parent.html(fm.escape(name));
6102
 
6103
- fm.lockfiles({files : [id]});
 
 
 
6104
 
6105
- fm.request({
6106
- data : $.extend({cmd : cmd, name : name, target : phash}, data || {}),
6107
- notify : {type : cmd, cnt : 1},
6108
- preventFail : true,
6109
- syncOnFail : true
6110
- })
6111
- .fail(function(error) {
6112
- dfrd.reject(error);
6113
- })
6114
- .done(function(data) {
6115
- dfrd.resolve(data);
6116
- if (data.added && data.added[0]) {
6117
- var newItem = cwd.find('#'+fm.cwdHash2Id(data.added[0].hash));
6118
- if (newItem.length) {
6119
- newItem.trigger('scrolltoview');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6120
  }
6121
- }
6122
- });
 
 
 
6123
  }
6124
- });
6125
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6126
 
6127
- if (this.disabled() || !node.length) {
6128
  return dfrd.reject();
6129
  }
6130
 
6131
- fm.disable();
6132
- nnode = node.find('.elfinder-cwd-filename');
6133
- pnode = nnode.parent();
6134
- if (tarea) {
6135
- node.zIndex((node.parent().zIndex()) + 1).css('position', 'relative');
6136
- nnode.css('max-height', 'none');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6137
  } else {
6138
- colwidth = pnode.width();
6139
- pnode.width(colwidth - 15);
6140
- pnode.parent('td').css('overflow', 'visible');
 
 
 
 
 
 
 
 
 
6141
  }
6142
- nnode.empty('').append(input.val(file.name));
 
 
6143
  input.trigger('keyup');
6144
- input.select().focus();
6145
- input[0].setSelectionRange && input[0].setSelectionRange(0, file.name.replace(/\..+$/, '').length);
6146
 
6147
  return dfrd;
6148
 
6149
-
6150
-
6151
  }
 
 
 
 
 
 
 
6152
 
 
 
 
 
6153
  }
6154
- }
6155
-
6156
 
6157
 
6158
  /*
@@ -6182,7 +8526,7 @@ $.fn.dialogelfinder = function(opts) {
6182
 
6183
  var doc = $(document),
6184
  toolbar = $('<div class="ui-widget-header dialogelfinder-drag ui-corner-top">'+(opts.title || 'Files')+'</div>'),
6185
- button = $('<a href="#" class="dialogelfinder-drag-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>')
6186
  .appendTo(toolbar)
6187
  .click(function(e) {
6188
  e.preventDefault();
@@ -6193,8 +8537,14 @@ $.fn.dialogelfinder = function(opts) {
6193
  .css('position', 'absolute')
6194
  .hide()
6195
  .appendTo('body')
6196
- .draggable({ handle : '.dialogelfinder-drag',
6197
- containment : 'window' })
 
 
 
 
 
 
6198
  .elfinder(opts)
6199
  .prepend(toolbar),
6200
  elfinder = node.elfinder('instance');
@@ -6215,20 +8565,10 @@ $.fn.dialogelfinder = function(opts) {
6215
  pos = node.data(position) || {
6216
  top : parseInt($(document).scrollTop() + ($(window).height() < node.height() ? 2 : ($(window).height() - node.height())/2)),
6217
  left : parseInt($(document).scrollLeft() + ($(window).width() < node.width() ? 2 : ($(window).width() - node.width())/2))
6218
- },
6219
- zindex = 100;
6220
 
6221
  if (node.is(':hidden')) {
6222
-
6223
- $('body').find(':visible').each(function() {
6224
- var $this = $(this), z;
6225
-
6226
- if (this !== node[0] && $this.css('position') == 'absolute' && (z = parseInt($this.zIndex())) > zindex) {
6227
- zindex = z + 1;
6228
- }
6229
- });
6230
-
6231
- node.zIndex(zindex).css(pos).show().trigger('resize');
6232
 
6233
  setTimeout(function() {
6234
  // fix resize icon position and make elfinder active
@@ -6236,7 +8576,7 @@ $.fn.dialogelfinder = function(opts) {
6236
  }, 200);
6237
  }
6238
  } else if (opts == 'close') {
6239
- var node = $(this);
6240
 
6241
  if (node.is(':visible')) {
6242
  !!node.data(destroy)
@@ -6251,7 +8591,6 @@ $.fn.dialogelfinder = function(opts) {
6251
  };
6252
 
6253
 
6254
-
6255
  /*
6256
  * File: /js/i18n/elfinder.en.js
6257
  */
@@ -6259,7 +8598,7 @@ $.fn.dialogelfinder = function(opts) {
6259
  /**
6260
  * English translation
6261
  * @author Troex Nevelin <troex@fury.scancode.ru>
6262
- * @version 2016-01-18
6263
  */
6264
  if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object') {
6265
  elFinder.prototype.i18.en = {
@@ -6355,6 +8694,8 @@ if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object'
6355
  'errConvUTF8' : 'Not convertible to UTF-8', // from v2.1 added 08.04.2014
6356
  'errFolderUpload' : 'Try Google Chrome, If you\'d like to upload the folder.', // from v2.1 added 26.6.2015
6357
  'errSearchTimeout' : 'Timed out while searching "$1". Search result is partial.', // from v2.1 added 12.1.2016
 
 
6358
 
6359
  /******************************* commands names ********************************/
6360
  'cmdarchive' : 'Create archive',
@@ -6371,6 +8712,7 @@ if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object'
6371
  'cmdhome' : 'Home',
6372
  'cmdinfo' : 'Get info',
6373
  'cmdmkdir' : 'New folder',
 
6374
  'cmdmkfile' : 'New text file',
6375
  'cmdopen' : 'Open',
6376
  'cmdpaste' : 'Paste',
@@ -6389,6 +8731,9 @@ if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object'
6389
  'cmdplaces' : 'To Places', // added 28.12.2014
6390
  'cmdchmod' : 'Change mode', // from v2.1 added 20.6.2015
6391
  'cmdopendir' : 'Open a folder', // from v2.1 added 13.1.2016
 
 
 
6392
 
6393
  /*********************************** buttons ***********************************/
6394
  'btnClose' : 'Close',
@@ -6437,6 +8782,9 @@ if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object'
6437
  'ntfurl' : 'Getting URL of link', // from v2.1 added 11.03.2014
6438
  'ntfchmod' : 'Changing file mode', // from v2.1 added 20.6.2015
6439
  'ntfpreupload': 'Verifying upload file name', // from v2.1 added 31.11.2015
 
 
 
6440
 
6441
  /************************************ dates **********************************/
6442
  'dateUnknown' : 'unknown',
@@ -6487,6 +8835,11 @@ if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object'
6487
  'sortsize' : 'by size',
6488
  'sortdate' : 'by date',
6489
  'sortFoldersFirst' : 'Folders first',
 
 
 
 
 
6490
 
6491
  /********************************** new items **********************************/
6492
  'untitled file.txt' : 'NewFile.txt', // added 10.11.2015
@@ -6574,7 +8927,7 @@ if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object'
6574
  'pass' : 'Password', // added 18.04.2012
6575
  'confirmUnmount' : 'Are you unmount $1?', // from v2.1 added 30.04.2012
6576
  'dropFilesBrowser': 'Drop or Paste files from browser', // from v2.1 added 30.05.2012
6577
- 'dropPasteFiles' : 'Drop or Paste files here', // from v2.1 added 07.04.2014
6578
  'encoding' : 'Encoding', // from v2.1 added 19.12.2014
6579
  'locale' : 'Locale', // from v2.1 added 19.12.2014
6580
  'searchTarget' : 'Target: $1', // from v2.1 added 22.5.2015
@@ -6591,9 +8944,37 @@ if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object'
6591
  'quality' : 'Quality', // from v2.1.6 added 5.1.2016
6592
  'autoSync' : 'Auto sync', // from v2.1.6 added 10.1.2016
6593
  'moveUp' : 'Move up', // from v2.1.6 added 18.1.2016
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6594
 
6595
  /********************************** mimetypes **********************************/
6596
  'kindUnknown' : 'Unknown',
 
6597
  'kindFolder' : 'Folder',
6598
  'kindAlias' : 'Alias',
6599
  'kindAliasBroken' : 'Broken alias',
@@ -6698,9 +9079,10 @@ $.fn.elfinderbutton = function(cmd) {
6698
  item = 'elfinder-button-menu-item',
6699
  selected = 'elfinder-button-menu-item-selected',
6700
  menu,
 
6701
  button = $(this).addClass('ui-state-default elfinder-button')
6702
  .attr('title', cmd.title)
6703
- .append('<span class="elfinder-button-icon elfinder-button-icon-'+cmd.name+'"/>')
6704
  .hover(function(e) { !button.hasClass(disabled) && button[e.type == 'mouseleave' ? 'removeClass' : 'addClass'](hover) /**button.toggleClass(hover);*/ })
6705
  .click(function(e) {
6706
  if (!button.hasClass(disabled)) {
@@ -6719,14 +9101,15 @@ $.fn.elfinderbutton = function(cmd) {
6719
  menu.hide();
6720
  };
6721
 
 
 
6722
  // if command has variants create menu
6723
  if ($.isArray(cmd.variants)) {
6724
  button.addClass('elfinder-menubutton');
6725
 
6726
- menu = $('<div class="ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>')
6727
  .hide()
6728
  .appendTo(button)
6729
- .zIndex(12+button.zIndex())
6730
  .on('mouseenter mouseleave', '.'+item, function() { $(this).toggleClass(hover) })
6731
  .on('click', '.'+item, function(e) {
6732
  e.preventDefault();
@@ -6756,7 +9139,7 @@ $.fn.elfinderbutton = function(cmd) {
6756
  })
6757
  .change();
6758
  });
6759
- }
6760
 
6761
 
6762
  /*
@@ -6771,67 +9154,311 @@ $.fn.elfinderbutton = function(cmd) {
6771
  $.fn.elfindercontextmenu = function(fm) {
6772
 
6773
  return this.each(function() {
6774
- var self = $(this),
6775
- cmItem = 'elfinder-contextmenu-item',
6776
  smItem = 'elfinder-contextsubmenu-item',
6777
  exIcon = 'elfinder-contextmenu-extra-icon',
6778
- menu = self.addClass('ui-helper-reset ui-widget ui-state-default ui-corner-all elfinder-contextmenu elfinder-contextmenu-'+fm.direction)
 
 
 
 
 
 
 
 
 
6779
  .hide()
6780
- .appendTo('body')
 
 
 
 
 
6781
  .on('mouseenter mouseleave', '.'+cmItem, function(e) {
6782
- $(this).toggleClass('ui-state-hover', e.type === 'mouseenter');
 
 
 
6783
  })
6784
  .on('mouseenter mouseleave', '.'+exIcon, function(e) {
6785
  $(this).parent().toggleClass('ui-state-hover', e.type === 'mouseleave');
6786
  })
6787
- .on('contextmenu', function(){return false;}),
6788
- subpos = fm.direction == 'ltr' ? 'left' : 'right',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6789
  types = $.extend({}, fm.options.contextmenu),
6790
- clItem = cmItem + (fm.UA.Touch ? ' elfinder-touch' : ''),
6791
- tpl = '<div class="'+clItem+'"><span class="elfinder-button-icon {icon} elfinder-contextmenu-icon"/><span>{label}</span></div>',
6792
- item = function(label, icon, callback) {
6793
- return $(tpl.replace('{icon}', icon ? 'elfinder-button-icon-'+icon : '').replace('{label}', label))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6794
  .click(function(e) {
6795
  e.stopPropagation();
6796
  e.preventDefault();
6797
  callback();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6798
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6799
  },
6800
 
6801
- open = function(x, y) {
6802
- var win = $(window),
6803
- width = menu.outerWidth(),
6804
  height = menu.outerHeight(),
6805
- wwidth = win.width(),
6806
- wheight = win.height(),
6807
- scrolltop = win.scrollTop(),
6808
- scrollleft = win.scrollLeft(),
6809
- m = fm.UA.Touch? 10 : 0,
6810
- css = {
6811
- top : y - scrolltop + m + height < wheight ? y + m : (y - m - height > 0 ? y - m - height : y + m),
6812
- left : x - scrollleft + m + width < wwidth ? x + m : x - m - width,
6813
- 'z-index' : 100 + fm.getUI('workzone').zIndex()
6814
- };
 
 
 
 
6815
 
6816
- menu.css(css)
6817
- .show();
 
 
 
 
6818
 
6819
- css = {'z-index' : css['z-index']+10};
6820
  css[subpos] = parseInt(menu.width());
6821
  menu.find('.elfinder-contextmenu-sub').css(css);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6822
  },
6823
 
6824
  close = function() {
6825
- menu.hide().empty();
6826
- fm.trigger('closecontextmenu');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6827
  },
6828
 
6829
  create = function(type, targets) {
6830
- var sep = false,
6831
- cmdMap = {}, disabled = [], isCwd = (targets[0].indexOf(fm.cwd().volumeid, 0) === 0);
6832
-
6833
- if (self.data('cmdMaps')) {
6834
- $.each(self.data('cmdMaps'), function(i, v){
 
 
 
6835
  if (targets[0].indexOf(i, 0) == 0) {
6836
  cmdMap = v;
6837
  return false;
@@ -6839,116 +9466,190 @@ $.fn.elfindercontextmenu = function(fm) {
6839
  });
6840
  }
6841
  if (!isCwd) {
6842
- if (fm.disabledCmds) {
6843
- $.each(fm.disabledCmds, function(i, v){
6844
- if (targets[0].indexOf(i, 0) == 0) {
6845
- disabled = v;
6846
- return false;
6847
- }
6848
- });
6849
  }
6850
  }
 
 
 
 
 
 
 
 
 
 
6851
 
 
6852
  $.each(types[type]||[], function(i, name) {
6853
- var cmd, node, submenu, hover, _disabled;
6854
 
6855
- if (name == '|' && sep) {
6856
- menu.append('<div class="elfinder-contextmenu-separator"/>');
6857
- sep = false;
 
6858
  return;
6859
  }
6860
 
6861
  if (cmdMap[name]) {
6862
  name = cmdMap[name];
6863
  }
6864
- cmd = fm.command(name);
6865
 
6866
- if (cmd && !isCwd) {
6867
- _disabled = cmd._disabled;
6868
  cmd._disabled = !(cmd.alwaysEnabled || (fm._commands[name] ? $.inArray(name, disabled) === -1 : false));
 
 
 
 
 
 
 
6869
  }
6870
 
6871
  if (cmd && cmd.getstate(targets) != -1) {
6872
- targets._type = type;
6873
  if (cmd.variants) {
6874
  if (!cmd.variants.length) {
6875
  return;
6876
  }
6877
- node = item(cmd.title, cmd.name, function(){})
6878
- .on('touchend', function(e){
6879
- node.data('touching', true);
6880
- setTimeout(function(){node.data('touching', false);}, 50);
6881
- })
6882
- .on('click touchend', '.'+smItem, function(e){
6883
- e.stopPropagation();
6884
- if (node.data('touching')) {
6885
- node.data('touching', false);
6886
- $(this).removeClass('ui-state-hover');
6887
- e.preventDefault();
6888
- } else if (e.type == 'click') {
6889
- menu.hide();
6890
- cmd.exec(targets, $(this).data('exec'));
6891
- }
6892
- });
6893
 
6894
- submenu = $('<div class="ui-corner-all elfinder-contextmenu-sub"/>')
 
6895
  .appendTo(node.append('<span class="elfinder-contextmenu-arrow"/>'));
6896
 
6897
- hover = function(){
6898
- var win = $(window),
6899
- baseleft = $(node).offset().left,
6900
- basetop = $(node).offset().top,
6901
- basewidth = $(node).outerWidth(),
6902
- width = submenu.outerWidth(),
6903
- height = submenu.outerHeight(),
6904
- wwidth = win.scrollLeft() + win.width(),
6905
- wheight = win.scrollTop() + win.height(),
6906
- margin = 5, x, y, over;
6907
-
6908
- over = (baseleft + basewidth + width + margin) - wwidth;
6909
- x = (over > 0)? basewidth - over : basewidth;
6910
- over = (basetop + 5 + height + margin) - wheight;
6911
- y = (over > 0)? 5 - over : 5;
6912
-
6913
- var css = {
6914
- left : x,
6915
- top : y
6916
- };
6917
- submenu.css(css).toggle();
 
 
 
 
 
 
 
 
 
6918
  };
6919
 
6920
- node.addClass('elfinder-contextmenu-group').hover(function(){ hover(); });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6921
 
6922
  $.each(cmd.variants, function(i, variant) {
6923
  submenu.append(
6924
- $('<div class="'+clItem+' '+smItem+'"><span>'+variant[1]+'</span></div>').data('exec', variant[0])
 
6925
  );
6926
  });
6927
 
6928
  } else {
6929
- node = item(cmd.title, cmd.name, function() {
6930
- close();
6931
- cmd.exec(targets);
 
 
6932
  });
6933
  if (cmd.extra && cmd.extra.node) {
6934
- node.append(
6935
- $('<span class="elfinder-button-icon elfinder-button-icon-'+(cmd.extra.icon || '')+' elfinder-contextmenu-extra-icon"/>')
6936
- .append(cmd.extra.node)
6937
- );
6938
  } else {
6939
  node.remove('.elfinder-contextmenu-extra-icon');
6940
  }
6941
  }
6942
 
6943
- menu.append(node)
 
 
 
 
 
 
 
6944
  sep = true;
 
6945
  }
6946
 
6947
- cmd && !isCwd && (cmd._disabled = _disabled);
 
 
 
 
 
 
 
 
 
 
6948
  });
 
6949
  },
6950
 
6951
  createFromRaw = function(raw) {
 
6952
  $.each(raw, function(i, data) {
6953
  var node;
6954
 
@@ -6956,18 +9657,30 @@ $.fn.elfindercontextmenu = function(fm) {
6956
  menu.append('<div class="elfinder-contextmenu-separator"/>');
6957
  } else if (data.label && typeof data.callback == 'function') {
6958
  node = item(data.label, data.icon, function() {
6959
- !data.remain && close();
6960
- data.callback();
6961
- });
 
 
6962
  menu.append(node);
6963
  }
6964
  });
6965
- };
 
 
 
6966
 
6967
  fm.one('load', function() {
 
 
6968
  fm.bind('contextmenu', function(e) {
6969
- var data = e.data;
 
 
6970
 
 
 
 
6971
  close();
6972
 
6973
  if (data.type && data.targets) {
@@ -6976,20 +9689,66 @@ $.fn.elfindercontextmenu = function(fm) {
6976
  createFromRaw(data.raw);
6977
  }
6978
 
6979
- menu.children().length && open(data.x, data.y);
 
 
 
 
 
 
 
 
 
 
 
6980
  })
6981
  .one('destroy', function() { menu.remove(); })
6982
- .bind('disable select', function(){
6983
- // 'mouseEvInternal' for Firefox's bug (maybe)
6984
- !self.data('mouseEvInternal') && close();
6985
- self.data('mouseEvInternal', false);
6986
  })
6987
  .getUI().click(close);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6988
  });
6989
 
6990
  });
6991
 
6992
- }
6993
 
6994
 
6995
  /*
@@ -7116,7 +9875,12 @@ $.fn.elfindercwd = function(fm, options) {
7116
  */
7117
  query = '',
7118
 
7119
- lastSearch = [],
 
 
 
 
 
7120
 
7121
  /**
7122
  * Parents hashes of cwd
@@ -7124,24 +9888,64 @@ $.fn.elfindercwd = function(fm, options) {
7124
  * @type Array
7125
  */
7126
  cwdParents = [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7127
 
 
 
 
 
 
 
 
 
 
 
 
 
7128
  customColsBuild = function() {
7129
- var customCols = '';
7130
- var columns = fm.options.uiOptions.cwd.listView.columns;
7131
- for (var i = 0; i < columns.length; i++) {
7132
- customCols += '<td>{' + columns[i] + '}</td>';
7133
  }
7134
- return customCols;
7135
  },
7136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7137
  /**
7138
  * File templates
7139
  *
7140
  * @type Object
7141
  **/
7142
  templates = {
7143
- icon : '<div id="{id}" class="'+clFile+(fm.UA.Touch ? ' '+'elfinder-touch' : '')+' {permsclass} {dirclass} ui-corner-all" title="{tooltip}"><div class="elfinder-cwd-file-wrapper ui-corner-all"><div class="elfinder-cwd-icon {mime} ui-corner-all" unselectable="on" {style}/>{marker}</div><div class="elfinder-cwd-filename" title="{nametitle}">{name}</div></div>',
7144
- row : '<tr id="{id}" class="'+clFile+(fm.UA.Touch ? ' '+'elfinder-touch' : '')+' {permsclass} {dirclass}" title="{tooltip}"><td><div class="elfinder-cwd-file-wrapper"><span class="elfinder-cwd-icon {mime}"/>{marker}<span class="elfinder-cwd-filename">{name}</span></div></td>'+customColsBuild()+'</tr>',
7145
  },
7146
 
7147
  permsTpl = fm.res('tpl', 'perms'),
@@ -7160,12 +9964,12 @@ $.fn.elfindercwd = function(fm, options) {
7160
  return fm.cwdHash2Id(f.hash);
7161
  },
7162
  name : function(f) {
7163
- name = fm.escape(f.name);
7164
  !list && (name = name.replace(/([_.])/g, '&#8203;$1'));
7165
  return name;
7166
  },
7167
  nametitle : function(f) {
7168
- return fm.escape(f.name);
7169
  },
7170
  permsclass : function(f) {
7171
  return fm.perms2class(f);
@@ -7174,13 +9978,20 @@ $.fn.elfindercwd = function(fm, options) {
7174
  return fm.formatPermissions(f);
7175
  },
7176
  dirclass : function(f) {
7177
- return f.mime == 'directory' ? 'directory' : '';
 
 
 
 
 
 
 
7178
  },
7179
  mime : function(f) {
7180
  return fm.mime2class(f.mime);
7181
  },
7182
  size : function(f) {
7183
- return fm.formatSize(f.size);
7184
  },
7185
  date : function(f) {
7186
  return fm.formatDate(f);
@@ -7211,6 +10022,9 @@ $.fn.elfindercwd = function(fm, options) {
7211
  } else {
7212
  info = f.tooltip? fm.escape(f.tooltip).replace(/\r/g, '&#13;') : '';
7213
  }
 
 
 
7214
  return info? info + '&#13;' + title : title;
7215
  }
7216
  },
@@ -7223,11 +10037,18 @@ $.fn.elfindercwd = function(fm, options) {
7223
  **/
7224
  itemhtml = function(f) {
7225
  return templates[list ? 'row' : 'icon']
7226
- .replace(/\{([a-z]+)\}/g, function(s, e) {
7227
- return replacement[e] ? replacement[e](f) : (f[e] ? f[e] : '');
7228
  });
7229
  },
7230
 
 
 
 
 
 
 
 
7231
  /**
7232
  * Flag. Required for msie to avoid unselect files on dragstart
7233
  *
@@ -7297,12 +10118,16 @@ $.fn.elfindercwd = function(fm, options) {
7297
  }
7298
  // !append && unselectAll();
7299
  } else {
7300
- // there are no selected file - select first/last one
7301
- n = cwd.find('[id]:not(.'+clDisabled+'):not(.elfinder-cwd-parent):'+(prev ? 'last' : 'first'));
 
 
 
 
7302
  }
7303
 
7304
  if (n && n.length && !n.hasClass('elfinder-cwd-parent')) {
7305
- if (append) {
7306
  // append new files to selected
7307
  n = s.add(s[prev ? 'prevUntil' : 'nextUntil']('#'+n.attr('id'))).add(n);
7308
  } else {
@@ -7327,9 +10152,20 @@ $.fn.elfindercwd = function(fm, options) {
7327
  selectAll = function() {
7328
  var phash = fm.cwd().hash;
7329
 
7330
- cwd.find('[id]:not(.'+clSelected+'):not(.elfinder-cwd-parent)').trigger(evtSelect);
7331
- selectedFiles = $.map(fm.files(), function(f) { return f.phash == phash ? f.hash : null ;});
7332
- trigger();
 
 
 
 
 
 
 
 
 
 
 
7333
  },
7334
 
7335
  /**
@@ -7338,10 +10174,18 @@ $.fn.elfindercwd = function(fm, options) {
7338
  * @return void
7339
  */
7340
  unselectAll = function() {
7341
- selectLock = false;
7342
- selectedFiles = [];
7343
- cwd.find('[id].'+clSelected).trigger(evtUnselect);
 
 
 
 
 
 
7344
  trigger();
 
 
7345
  },
7346
 
7347
  /**
@@ -7353,12 +10197,24 @@ $.fn.elfindercwd = function(fm, options) {
7353
  return selectedFiles;
7354
  },
7355
 
 
 
 
 
 
 
 
7356
  /**
7357
  * Fire elfinder "select" event and pass selected files to it
7358
  *
7359
  * @return void
7360
  */
7361
  trigger = function() {
 
 
 
 
 
7362
  fm.trigger('select', {selected : selectedFiles});
7363
  },
7364
 
@@ -7368,17 +10224,20 @@ $.fn.elfindercwd = function(fm, options) {
7368
  * @param DOMElement file/dir node
7369
  * @return void
7370
  */
7371
- scrollToView = function(o) {
7372
  var ftop = o.position().top,
7373
  fheight = o.outerHeight(true),
7374
  wtop = wrapper.scrollTop(),
7375
- wheight = wrapper.innerHeight();
 
7376
 
7377
- if (ftop + fheight > wtop + wheight) {
7378
- wrapper.scrollTop(parseInt(ftop + fheight - wheight));
7379
  } else if (ftop < wtop) {
7380
  wrapper.scrollTop(ftop);
7381
  }
 
 
7382
  },
7383
 
7384
  /**
@@ -7388,6 +10247,13 @@ $.fn.elfindercwd = function(fm, options) {
7388
  **/
7389
  buffer = [],
7390
 
 
 
 
 
 
 
 
7391
  /**
7392
  * Return index of elements with required hash in buffer
7393
  *
@@ -7410,7 +10276,7 @@ $.fn.elfindercwd = function(fm, options) {
7410
  *
7411
  * @type String
7412
  **/
7413
- scrollEvent = 'scroll.'+fm.namespace,
7414
 
7415
  /**
7416
  * jQuery UI selectable option
@@ -7421,10 +10287,57 @@ $.fn.elfindercwd = function(fm, options) {
7421
  filter : fileSelector,
7422
  stop : trigger,
7423
  delay : 250,
 
 
7424
  selected : function(e, ui) { $(ui.selected).trigger(evtSelect); },
7425
  unselected : function(e, ui) { $(ui.unselected).trigger(evtUnselect); }
7426
  },
7427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7428
  /**
7429
  * Cwd scroll event handler.
7430
  * Lazy load - append to cwd not shown files
@@ -7432,91 +10345,229 @@ $.fn.elfindercwd = function(fm, options) {
7432
  * @return void
7433
  */
7434
  render = function() {
7435
- var go = function(){
7436
- var html = [],
7437
- dirs = false,
7438
- ltmb = [],
7439
- atmb = {},
7440
- last = buffer._last || cwd.find('[id]:last'),
7441
- top = !last.length,
7442
- place = buffer._place || (list ? cwd.children('table').children('tbody') : cwd),
7443
- chk, files;
7444
-
7445
- // check draging scroll bar
7446
- top && (wrapper._top = 0);
7447
- if (!!wrapper._mousedown && wrapper._top != wrapper.scrollTop()) {
7448
- wrapper._top = wrapper.scrollTop();
7449
- setTimeout(function(){
7450
- go();
7451
- }, 50);
7452
- return;
7453
- }
7454
-
7455
- delete buffer._timer;
7456
-
7457
- if (!buffer.length) {
7458
- bottomMarker.hide();
7459
- return wrapper.off(scrollEvent);
7460
- }
7461
-
7462
- //progress.show();
7463
- while ((!last.length || (chk = last.position().top - (wrapper.height() + wrapper.scrollTop() + fm.options.showThreshold)) <= 0)
7464
- && (files = buffer.splice(0, fm.options.showFiles - (chk || 0) / (buffer._hpi || 1))).length) {
7465
-
7466
  html = $.map(files, function(f) {
7467
  if (f.hash && f.name) {
7468
  if (f.mime == 'directory') {
7469
  dirs = true;
7470
  }
7471
- if (f.tmb) {
7472
- f.tmb === 1 ? ltmb.push(f.hash) : (atmb[f.hash] = f.tmb);
7473
- }
 
7474
  return itemhtml(f);
7475
  }
7476
  return null;
7477
  });
7478
 
7479
- (top || !buffer.length) && bottomMarker.hide();
7480
- place.append(html.join(''));
7481
- last = cwd.find('[id]:last');
7482
- // scroll top on dir load to avoid scroll after page reload
7483
- top && wrapper.scrollTop(0);
7484
- (top || !buffer._hpi) && bottomMarkerShow(place, files.length);
7485
- if (top) { break; }
7486
- }
7487
-
7488
- // cache last
7489
- buffer._last = last;
7490
-
7491
- // load/attach thumbnails
7492
- attachThumbnails(atmb);
7493
- ltmb.length && loadThumbnails(ltmb);
7494
-
7495
- // make directory droppable
7496
- dirs && !mobile && makeDroppable();
7497
-
7498
- if (selectedFiles.length) {
7499
- place.find('[id]:not(.'+clSelected+'):not(.elfinder-cwd-parent)').each(function() {
7500
- var id = fm.cwdId2Hash(this.id);
7501
-
7502
- $.inArray(id, selectedFiles) !== -1 && $(this).trigger(evtSelect);
7503
- });
7504
- }
7505
- };
7506
-
7507
- // stop while scrolling
7508
- buffer._timer && clearTimeout(buffer._timer);
7509
- // first time to go()
7510
- !buffer._timer && go();
7511
- // regist next go()
7512
- buffer._timer = setTimeout(function(){
7513
- go();
7514
- }, 100);
7515
- },
7516
-
7517
- /**
7518
- * Droppable options for cwd.
7519
- * Drop target is `wrapper`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7520
  * Do not add class on childs file over
7521
  *
7522
  * @type Object
@@ -7530,9 +10581,10 @@ $.fn.elfindercwd = function(fm, options) {
7530
  e.stopPropagation();
7531
  helper.data('dropover', helper.data('dropover') + 1);
7532
  dst.data('dropover', true);
7533
- if (helper.data('namespace') !== fm.namespace) {
7534
  dst.removeClass(clDropActive);
7535
- return false;
 
7536
  }
7537
  if (dst.hasClass(fm.res(c, 'cwdfile'))) {
7538
  hash = fm.cwdId2Hash(dst.attr('id'));
@@ -7573,6 +10625,10 @@ $.fn.elfindercwd = function(fm, options) {
7573
  deactivate : function() {
7574
  $(this).removeData('dropover')
7575
  .removeClass(clDropActive);
 
 
 
 
7576
  }
7577
  }),
7578
 
@@ -7581,14 +10637,40 @@ $.fn.elfindercwd = function(fm, options) {
7581
  *
7582
  * @return void
7583
  */
7584
- makeDroppable = function() {
7585
- var targets = cwd.find('.directory:not(.'+clDroppable+',.elfinder-na,.elfinder-ro)');
 
 
7586
  if (fm.isCommandEnabled('paste')) {
7587
  targets.droppable(droppable);
7588
  }
7589
  if (fm.isCommandEnabled('upload')) {
7590
  targets.addClass('native-droppable');
7591
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7592
  },
7593
 
7594
  /**
@@ -7597,66 +10679,151 @@ $.fn.elfindercwd = function(fm, options) {
7597
  * required for old api to stop loading thumbnails.
7598
  *
7599
  * @param Object file hash -> thumbnail map
7600
- * @return Boolean
 
7601
  */
7602
- attachThumbnails = function(images) {
7603
- var url = fm.option('tmbUrl'),
7604
- ret = true,
7605
- ndx;
7606
-
7607
- $.each(images, function(hash, tmb) {
7608
- var node = $('#'+fm.cwdHash2Id(hash));
7609
-
7610
- if (node.length) {
7611
-
7612
- (function(node, tmb) {
7613
- $('<img/>')
7614
- .load(function() { node.find('.elfinder-cwd-icon').css('background', "url('"+tmb+"') center center no-repeat"); })
7615
- .attr('src', tmb);
7616
- })(node, fm.tmbUrls._search? fm.tmb(hash) : (url + tmb));
7617
- } else {
7618
- ret = false;
7619
- if ((ndx = index(hash)) != -1) {
7620
- buffer[ndx].tmb = tmb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7621
  }
7622
- }
7623
- });
7624
- return ret;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7625
  },
7626
 
7627
  /**
7628
  * Load thumbnails from backend.
7629
  *
7630
- * @param Array|Boolean files hashes list for new api | true for old api
7631
  * @return void
7632
  */
7633
- loadThumbnails = function(files) {
7634
- var tmbs = [];
 
 
 
 
 
 
 
 
 
 
7635
 
7636
  if (fm.oldAPI) {
7637
  fm.request({
7638
  data : {cmd : 'tmb', current : fm.cwd().hash},
7639
  preventFail : true
7640
- })
7641
- .done(function(data) {
7642
- if (attachThumbnails(data.images||[]) && data.tmb) {
7643
- loadThumbnails();
7644
- }
7645
- });
7646
- return;
7647
- }
7648
-
7649
- tmbs = tmbs = files.splice(0, tmbNum);
7650
- if (tmbs.length) {
7651
- fm.request({
7652
- data : {cmd : 'tmb', targets : tmbs},
7653
- preventFail : true
7654
  })
7655
  .done(function(data) {
7656
- if (attachThumbnails(data.images||[])) {
7657
- loadThumbnails(files);
 
 
 
 
7658
  }
 
 
 
7659
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7660
  }
7661
  },
7662
 
@@ -7666,12 +10833,11 @@ $.fn.elfindercwd = function(fm, options) {
7666
  * @param Array new files
7667
  * @return void
7668
  */
7669
- add = function(files) {
7670
  var place = list ? cwd.find('tbody') : cwd,
7671
  l = files.length,
7672
- ltmb = [],
7673
  atmb = {},
7674
- dirs = false,
7675
  findNode = function(file) {
7676
  var pointer = cwd.find('[id]:first'), file2;
7677
 
@@ -7693,39 +10859,68 @@ $.fn.elfindercwd = function(fm, options) {
7693
  }
7694
  return l || -1;
7695
  },
7696
- file, hash, node, ndx;
7697
-
7698
- l && wrapper.removeClass('elfinder-cwd-wrapper-empty');
7699
-
7700
- while (l--) {
7701
- file = files[l];
7702
- hash = file.hash;
7703
-
7704
- if ($('#'+fm.cwdHash2Id(hash)).length) {
7705
- continue;
7706
- }
 
 
 
7707
 
7708
- if ((node = findNode(file)) && node.length) {
7709
- node.before(itemhtml(file));
7710
- } else if ((ndx = findIndex(file)) >= 0) {
7711
- buffer.splice(ndx, 0, file);
7712
- } else {
7713
- place.append(itemhtml(file));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7714
  }
7715
-
7716
- if ($('#'+fm.cwdHash2Id(hash)).length) {
7717
- if (file.mime == 'directory') {
7718
- dirs = true;
7719
- } else if (file.tmb) {
7720
- file.tmb === 1 ? ltmb.push(hash) : (atmb[hash] = file.tmb);
 
7721
  }
 
 
 
7722
  }
7723
  }
7724
-
7725
- bottomMarkerShow(place);
7726
- attachThumbnails(atmb);
7727
- ltmb.length && loadThumbnails(ltmb);
7728
- dirs && !mobile && makeDroppable();
7729
  },
7730
 
7731
  /**
@@ -7741,8 +10936,8 @@ $.fn.elfindercwd = function(fm, options) {
7741
  if (!fm.cwd().hash && fm.currentReqCmd !== 'open') {
7742
  $.each(cwdParents.reverse(), function(i, h) {
7743
  if (fm.files()[h]) {
7744
- fm.one(fm.currentReqCmd, function() {
7745
- fm.exec('open', h);
7746
  });
7747
  return false;
7748
  }
@@ -7755,6 +10950,7 @@ $.fn.elfindercwd = function(fm, options) {
7755
  if ((n = $('#'+fm.cwdHash2Id(hash))).length) {
7756
  try {
7757
  n.remove();
 
7758
  } catch(e) {
7759
  fm.debug('error', e);
7760
  }
@@ -7763,12 +10959,7 @@ $.fn.elfindercwd = function(fm, options) {
7763
  }
7764
  }
7765
 
7766
- // refresh cwd if empty for a bug of browser (ex. Android Chrome 43.0.2357.93)
7767
- if (cwd.children().length < 1) {
7768
- wrapper.addClass('elfinder-cwd-wrapper-empty');
7769
- cwd.hide();
7770
- setTimeout(function(){ cwd.show(); }, 0);
7771
- }
7772
  },
7773
 
7774
  msg = {
@@ -7785,92 +10976,242 @@ $.fn.elfindercwd = function(fm, options) {
7785
  customColsNameBuild = function() {
7786
  var name = '',
7787
  customColsName = '',
7788
- columns = fm.options.uiOptions.cwd.listView.columns,
7789
- names = $.extend({}, msg, fm.options.uiOptions.cwd.listView.columnsCustomName);
7790
- for (var i = 0; i < columns.length; i++) {
7791
- if (typeof names[columns[i]] !== 'undefined') {
7792
- name = names[columns[i]];
7793
  } else {
7794
- name = fm.i18n(columns[i]);
7795
  }
7796
- customColsName +='<td class="elfinder-cwd-view-th-'+columns[i]+'">'+name+'</td>';
7797
  }
7798
  return customColsName;
7799
  },
7800
 
7801
  bottomMarkerShow = function(place, cnt) {
7802
- var ph;
7803
  place = place || (list ? cwd.find('tbody') : cwd);
7804
 
7805
  if (buffer.length > 0) {
7806
  place.css({height: 'auto'});
7807
  ph = place.height();
7808
- cnt && (buffer._hpi = ph / cnt);
7809
- bottomMarker.css({top: (buffer._hpi * buffer.length + ph) + 'px'}).show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7810
  }
7811
  },
7812
 
7813
  /**
7814
  * Update directory content
7815
  *
7816
- * @param Array files
7817
  * @return void
7818
  */
7819
- content = function(files, any) {
7820
- var phash = fm.cwd().hash;
7821
 
7822
- cwdParents = fm.parents(phash);
7823
-
7824
- unselectAll();
 
7825
 
 
7826
  try {
7827
  // to avoid problem with draggable
7828
  cwd.empty();
7829
  } catch (e) {
7830
  cwd.html('');
7831
  }
 
 
 
 
 
 
7832
 
7833
  cwd.removeClass('elfinder-cwd-view-icons elfinder-cwd-view-list')
7834
- .addClass('elfinder-cwd-view-'+(list ? 'list' :'icons'));
7835
- cwd.css('height', 'auto');
 
7836
  bottomMarker.hide();
7837
 
7838
- wrapper[list ? 'addClass' : 'removeClass']('elfinder-cwd-wrapper-list');
7839
- wrapper._padding = parseInt(wrapper.css('padding-top')) + parseInt(wrapper.css('padding-bottom'));
 
 
 
7840
 
7841
- list && cwd.html('<table><thead><tr class="ui-state-default'+(fm.UA.Touch? ' elfinder-touch' : '')+'"><td class="elfinder-cwd-view-th-name">'+msg.name+'</td>'+customColsNameBuild()+'</tr></thead><tbody/></table>');
7842
-
7843
- buffer = $.map(files, function(f) { return any || f.phash == phash ? f : null; });
7844
-
7845
- buffer = fm.sortFiles(buffer);
7846
-
7847
- wrapper[(!any && buffer.length < 1) ? 'addClass' : 'removeClass']('elfinder-cwd-wrapper-empty').on(scrollEvent, render).trigger(scrollEvent);
7848
-
7849
- phash = fm.cwd().phash;
7850
-
7851
- if (options.oldSchool && phash && !query) {
7852
- var parent = $.extend(true, {}, fm.file(phash), {name : '..', mime : 'directory'});
7853
- parent = $(itemhtml(parent))
7854
- .addClass('elfinder-cwd-parent')
7855
- .bind('mousedown click mouseup touchstart touchmove touchend dblclick mouseenter', function(e) {
7856
- e.preventDefault();
7857
- e.stopPropagation();
7858
- })
7859
- .dblclick(function() {
7860
- fm.exec('open', fm.cwdId2Hash(this.id));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7861
  });
 
7862
 
7863
- (list ? cwd.find('tbody') : cwd).prepend(parent);
7864
- }
7865
-
7866
- // set droppable
7867
- if (any || !fm.cwd().write) {
7868
- wrapper.removeClass('native-droppable')
7869
- .droppable('disable');
7870
- } else {
7871
- wrapper[fm.isCommandEnabled('upload')? 'addClass' : 'removeClass']('native-droppable');
7872
- wrapper.droppable('enable');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7873
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7874
  },
7875
 
7876
  /**
@@ -7883,30 +11224,48 @@ $.fn.elfindercwd = function(fm, options) {
7883
  .attr('unselectable', 'on')
7884
  // fix ui.selectable bugs and add shift+click support
7885
  .on('click.'+fm.namespace, fileSelector, function(e) {
7886
- var p = this.id ? $(this) : $(this).parents('[id]:first'),
7887
- prev = p.prevAll('.'+clSelected+':first'),
7888
- next = p.nextAll('.'+clSelected+':first'),
7889
- pl = prev.length,
7890
- nl = next.length,
 
7891
  sib;
7892
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7893
  if (cwd.data('longtap')) {
7894
  e.stopPropagation();
7895
  return;
7896
  }
7897
 
7898
- e.stopImmediatePropagation();
7899
-
 
 
 
 
7900
  if (e.shiftKey && (pl || nl)) {
7901
  sib = pl ? p.prevUntil('#'+prev.attr('id')) : p.nextUntil('#'+next.attr('id'));
7902
  sib.add(p).trigger(evtSelect);
7903
  } else if (e.ctrlKey || e.metaKey) {
7904
  p.trigger(p.hasClass(clSelected) ? evtUnselect : evtSelect);
7905
  } else {
7906
- if (p.data('touching') && p.hasClass(clSelected)) {
7907
- p.data('touching', null);
7908
  fm.dblclick({file : fm.cwdId2Hash(this.id)});
7909
- unselectAll();
7910
  return;
7911
  } else {
7912
  unselectAll();
@@ -7922,45 +11281,60 @@ $.fn.elfindercwd = function(fm, options) {
7922
  })
7923
  // for touch device
7924
  .on('touchstart.'+fm.namespace, fileSelector, function(e) {
7925
- e.stopPropagation();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7926
  if (e.target.nodeName == 'INPUT' || e.target.nodeName == 'TEXTAREA') {
7927
  return;
7928
  }
7929
- var p = this.id ? $(this) : $(this).parents('[id]:first'),
7930
- sel = p.prevAll('.'+clSelected+':first').length +
7931
- p.nextAll('.'+clSelected+':first').length;
7932
  cwd.data('longtap', null);
7933
  p.addClass(clHover)
7934
- .data('touching', true)
7935
- .data('tmlongtap', setTimeout(function(){
7936
  // long tap
7937
  cwd.data('longtap', true);
7938
- if (p.hasClass(clSelected) && sel > 0) {
7939
- p.trigger(evtUnselect);
7940
  trigger();
7941
- } else {
7942
- if (e.target.nodeName != 'TD' || fm.selected().length > 0) {
7943
- p.trigger(evtSelect);
7944
- trigger();
7945
- fm.trigger('contextmenu', {
7946
- 'type' : 'files',
7947
- 'targets' : fm.selected(),
7948
- 'x' : e.originalEvent.touches[0].pageX,
7949
- 'y' : e.originalEvent.touches[0].pageY
7950
- });
7951
- }
7952
  }
7953
  }, 500));
7954
  })
7955
  .on('touchmove.'+fm.namespace+' touchend.'+fm.namespace, fileSelector, function(e) {
7956
- e.stopPropagation();
7957
- if (e.target.nodeName == 'INPUT' || e.target.nodeName == 'TEXTAREA') {
7958
  return;
7959
  }
7960
  var p = this.id ? $(this) : $(this).parents('[id]:first');
7961
  clearTimeout(p.data('tmlongtap'));
7962
- if (e.type == 'touchmove') {
 
7963
  p.removeClass(clHover);
 
 
 
 
7964
  }
7965
  })
7966
  // attach draggable
@@ -7968,7 +11342,7 @@ $.fn.elfindercwd = function(fm, options) {
7968
  var $this = $(this), helper = null,
7969
  target = list ? $this : $this.children('div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename');
7970
 
7971
- if (!mobile && !$this.hasClass(clTmp) && !target.hasClass(clDraggable+' '+clDisabled)) {
7972
  target.on('mousedown', function(e) {
7973
  // shiftKey + drag start for HTML5 native drag function
7974
  if (e.shiftKey && !fm.UA.IE && cwd.data('selectable')) {
@@ -7978,11 +11352,11 @@ $.fn.elfindercwd = function(fm, options) {
7978
  cwd.selectable(selectableOption).data('selectable', true);
7979
  }, 10);
7980
  }
7981
- target.draggable('option', 'disabled', e.shiftKey);
7982
  if (e.shiftKey) {
7983
  target.attr('draggable', 'true');
7984
  } else {
7985
- target.attr('draggable', 'false')
7986
  .draggable('option', 'cursorAt', {left: 50 - parseInt($(e.currentTarget).css('margin-left')), top: 47});
7987
  }
7988
  })
@@ -7997,10 +11371,10 @@ $.fn.elfindercwd = function(fm, options) {
7997
  murl = null,
7998
  files = [],
7999
  icon = function(f) {
8000
- var mime = f.mime, i;
8001
  i = '<div class="elfinder-cwd-icon '+fm.mime2class(mime)+' ui-corner-all"/>';
8002
- if (f.tmb && f.tmb !== 1) {
8003
- i = $(i).css('background', "url('"+fm.option('tmbUrl')+f.tmb+"') center center no-repeat").get(0).outerHTML;
8004
  }
8005
  return i;
8006
  }, l, geturl = [];
@@ -8074,14 +11448,17 @@ $.fn.elfindercwd = function(fm, options) {
8074
  })
8075
  // add hover class to selected file
8076
  .on(evtSelect, fileSelector, function(e) {
8077
- var $this = $(this),
8078
  id = fm.cwdId2Hash($this.attr('id'));
8079
 
8080
  if (!selectLock && !$this.hasClass(clDisabled)) {
8081
- $this.addClass(clSelected).children().addClass(clHover);
 
8082
  if ($.inArray(id, selectedFiles) === -1) {
8083
  selectedFiles.push(id);
8084
  }
 
 
8085
  }
8086
  })
8087
  // remove hover class from unselected file
@@ -8091,9 +11468,14 @@ $.fn.elfindercwd = function(fm, options) {
8091
  ndx;
8092
 
8093
  if (!selectLock) {
8094
- $(this).removeClass(clSelected).children().removeClass(clHover);
 
 
 
 
8095
  ndx = $.inArray(id, selectedFiles);
8096
  if (ndx !== -1) {
 
8097
  selectedFiles.splice(ndx, 1);
8098
  }
8099
  }
@@ -8103,7 +11485,7 @@ $.fn.elfindercwd = function(fm, options) {
8103
  .on(evtDisable, fileSelector, function() {
8104
  var $this = $(this).removeClass(clHover+' '+clSelected).addClass(clDisabled),
8105
  child = $this.children(),
8106
- target = (list ? $this : child);
8107
 
8108
  child.removeClass(clHover+' '+clSelected);
8109
 
@@ -8113,13 +11495,13 @@ $.fn.elfindercwd = function(fm, options) {
8113
  // if any files was not removed/moved - unlock its
8114
  .on(evtEnable, fileSelector, function() {
8115
  var $this = $(this).removeClass(clDisabled),
8116
- target = list ? $this : $this.children();
8117
 
8118
  $this.hasClass(clDroppable) && $this.droppable('enable');
8119
  target.hasClass(clDraggable) && target.draggable('enable');
8120
  })
8121
  .on('scrolltoview', fileSelector, function() {
8122
- scrollToView($(this));
8123
  })
8124
  .on('mouseenter.'+fm.namespace+' mouseleave.'+fm.namespace, fileSelector, function(e) {
8125
  fm.trigger('hover', {hash : fm.cwdId2Hash($(this).attr('id')), type : e.type});
@@ -8131,9 +11513,8 @@ $.fn.elfindercwd = function(fm, options) {
8131
  if (file.length && (e.target.nodeName != 'TD' || $.inArray(fm.cwdId2Hash(file.get(0).id), fm.selected()) > -1)) {
8132
  e.stopPropagation();
8133
  e.preventDefault();
8134
- if (!file.hasClass(clDisabled) && !file.data('touching')) {
8135
  if (!file.hasClass(clSelected)) {
8136
- // cwd.trigger('unselectall');
8137
  unselectAll();
8138
  file.trigger(evtSelect);
8139
  trigger();
@@ -8148,29 +11529,26 @@ $.fn.elfindercwd = function(fm, options) {
8148
  }
8149
 
8150
  }
8151
- // e.preventDefault();
8152
-
8153
-
8154
  })
8155
  // unselect all on cwd click
8156
  .on('click.'+fm.namespace, function(e) {
8157
- if (cwd.data('longtap')) {
8158
- e.stopPropagation();
8159
- return;
8160
  }
8161
- !e.shiftKey && !e.ctrlKey && !e.metaKey && unselectAll();
8162
  })
8163
-
8164
- // make files selectable
8165
- .selectable(selectableOption)
8166
- .data('selectable', true)
8167
  // prepend fake file/dir
8168
  .on('create.'+fm.namespace, function(e, file) {
8169
  var parent = list ? cwd.find('tbody') : cwd,
8170
  p = parent.find('.elfinder-cwd-parent'),
8171
- file = $(itemhtml(file)).addClass(clTmp);
 
 
8172
 
8173
- unselectAll();
 
 
 
 
8174
 
8175
  if (p.length) {
8176
  p.after(file);
@@ -8178,53 +11556,67 @@ $.fn.elfindercwd = function(fm, options) {
8178
  parent.prepend(file);
8179
  }
8180
 
8181
- cwd.parent().scrollTop(0);
 
8182
  })
8183
  // unselect all selected files
8184
  .on('unselectall', unselectAll)
8185
  .on('selectfile', function(e, id) {
8186
  $('#'+fm.cwdHash2Id(id)).trigger(evtSelect);
8187
  trigger();
 
 
 
 
 
 
 
 
8188
  }),
8189
  wrapper = $('<div class="elfinder-cwd-wrapper"/>')
8190
  // make cwd itself droppable for folders from nav panel
8191
  .droppable($.extend({}, droppable, {autoDisable: false}))
8192
- .on('contextmenu', function(e) {
8193
- e.preventDefault();
8194
- fm.trigger('contextmenu', {
8195
- 'type' : 'cwd',
8196
- 'targets' : [fm.cwd().hash],
8197
- 'x' : e.pageX,
8198
- 'y' : e.pageY
8199
- });
8200
-
8201
- })
8202
- // for touch device
8203
- .on('touchstart.'+fm.namespace, function(e) {
8204
- var p = $(this);
8205
- cwd.data('longtap', null);
8206
- p.data('touching', true);
8207
- p.data('tmlongtap', setTimeout(function(){
8208
- // long tap
8209
- cwd.data('longtap', true);
8210
- fm.trigger('contextmenu', {
8211
- 'type' : 'cwd',
8212
- 'targets' : [fm.cwd().hash],
8213
- 'x' : e.originalEvent.touches[0].pageX,
8214
- 'y' : e.originalEvent.touches[0].pageY
8215
- });
8216
- }, 500));
8217
- })
8218
- .on('touchmove.'+fm.namespace+' touchend.'+fm.namespace, function(e) {
8219
- clearTimeout($(this).data('tmlongtap'));
8220
- })
8221
- .on('mousedown', function(){wrapper._mousedown = true;})
8222
- .on('mouseup', function(){wrapper._mousedown = false;}),
8223
 
8224
  bottomMarker = $('<div>&nbsp;</div>')
8225
  .css({position: 'absolute', width: '1px', height: '1px'})
8226
  .hide(),
8227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8228
  restm = null,
8229
  resize = function(init) {
8230
  var initHeight = function() {
@@ -8243,94 +11635,269 @@ $.fn.elfindercwd = function(fm, options) {
8243
  var wph, cwdoh;
8244
  // fix cwd height if it less then wrapper
8245
  cwd.css('height', 'auto');
8246
- wph = wrapper[0].clientHeight - parseInt(wrapper.css('padding-top')) - parseInt(wrapper.css('padding-bottom')),
8247
  cwdoh = cwd.outerHeight(true);
8248
  if (cwdoh < wph) {
8249
  cwd.height(wph);
8250
  }
8251
  }, 20);
 
 
8252
  },
8253
 
8254
  // elfinder node
8255
  parent = $(this).parent().resize(resize),
8256
 
8257
  // workzone node
8258
- wz = parent.children('.elfinder-workzone').append(wrapper.append(this).append(bottomMarker))
8259
- ;
 
8260
 
 
 
8261
 
8262
- // for iOS5 bug
8263
- $('body').on('touchstart touchmove touchend', function(e){});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8264
 
8265
  fm
8266
  .one('init', function(){
8267
  var style = document.createElement('style'),
8268
- sheet;
8269
  document.head.appendChild(style);
8270
  sheet = style.sheet;
8271
  sheet.insertRule('.elfinder-cwd-wrapper-empty .elfinder-cwd:after{ content:"'+fm.i18n('emptyFolder')+'" }', 0);
8272
- sheet.insertRule('.ui-droppable.elfinder-cwd-wrapper-empty .elfinder-cwd:after{ content:"'+fm.i18n('emptyFolder'+(mobile? 'LTap' : 'Drop'))+'" }', 1);
8273
- sheet.insertRule('.ui-droppable.elfinder-cwd-wrapper-empty.ui-droppable-disabled .elfinder-cwd:after{ content:"'+fm.i18n('emptyFolder')+'" }', 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8274
  })
8275
- .bind('open', function(e) {
8276
- content(e.data.files);
 
 
 
 
 
 
 
8277
  resize();
8278
  })
8279
  .bind('search', function(e) {
8280
- lastSearch = e.data.files;
8281
- content(lastSearch, true);
8282
- wrapper.addClass('elfinder-search-result');
 
8283
  fm.autoSync('stop');
8284
  resize();
8285
  })
8286
  .bind('searchend', function(e) {
8287
- lastSearch = [];
8288
- if (query) {
8289
  query = '';
 
 
 
8290
  if (!e.data || !e.data.noupdate) {
8291
- content(fm.files());
8292
  }
8293
  }
8294
- wrapper.removeClass('elfinder-search-result');
8295
  fm.autoSync();
8296
  resize();
8297
  })
8298
  .bind('searchstart', function(e) {
 
8299
  query = e.data.query;
8300
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8301
  .bind('sortchange', function() {
8302
- content(query ? lastSearch : fm.files(), !!query);
 
 
 
 
 
 
 
8303
  })
8304
  .bind('viewchange', function() {
8305
- var sel = fm.selected(),
8306
- l = fm.storage('view') == 'list';
8307
 
8308
  if (l != list) {
8309
  list = l;
8310
- content(query ? lastSearch : fm.files(), !!query);
 
8311
 
8312
- $.each(sel, function(i, h) {
8313
- selectFile(h);
8314
- });
8315
- trigger();
 
8316
  }
8317
  resize();
8318
  })
8319
- .bind('resize', function() {
8320
- var place = list ? cwd.find('tbody') : cwd;
 
8321
  resize(true);
8322
- bottomMarkerShow(place, place.find('[id]').length);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8323
  })
8324
- .bind('add', function() {
8325
- resize();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8326
  })
8327
  .add(function(e) {
8328
  var phash = fm.cwd().hash,
8329
- files = query
8330
- ? $.map(e.data.added || [], function(f) { return f.name.indexOf(query) === -1 ? null : f ;})
 
8331
  : $.map(e.data.added || [], function(f) { return f.phash == phash ? f : null; })
8332
  ;
8333
  add(files);
 
 
8334
  })
8335
  .change(function(e) {
8336
  var phash = fm.cwd().hash,
@@ -8341,14 +11908,14 @@ $.fn.elfindercwd = function(fm, options) {
8341
  $.each(e.data.changed || [], function(i, file) {
8342
  remove([file.hash]);
8343
  if (file.name.indexOf(query) !== -1) {
8344
- add([file]);
8345
  $.inArray(file.hash, sel) !== -1 && selectFile(file.hash);
8346
  }
8347
  });
8348
  } else {
8349
  $.each($.map(e.data.changed || [], function(f) { return f.phash == phash ? f : null; }), function(i, file) {
8350
  remove([file.hash]);
8351
- add([file]);
8352
  $.inArray(file.hash, sel) !== -1 && selectFile(file.hash);
8353
  });
8354
  }
@@ -8356,8 +11923,19 @@ $.fn.elfindercwd = function(fm, options) {
8356
  trigger();
8357
  })
8358
  .remove(function(e) {
 
8359
  remove(e.data.removed || []);
8360
  trigger();
 
 
 
 
 
 
 
 
 
 
8361
  })
8362
  // select dragged file if no selected, disable selectable
8363
  .dragstart(function(e) {
@@ -8391,16 +11969,34 @@ $.fn.elfindercwd = function(fm, options) {
8391
  files = e.data.files || [],
8392
  l = files.length,
8393
  helper = e.data.helper || $(),
8394
- parents, ctr;
8395
 
8396
  if (l > 0) {
8397
  parents = fm.parents(files[0]);
8398
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8399
  if (!helper.data('locked')) {
8400
  while (l--) {
8401
  $('#'+fm.cwdHash2Id(files[l])).trigger(event);
8402
  }
8403
- trigger();
8404
  }
8405
  if (wrapper.data('dropover') && parents.indexOf(wrapper.data('dropover')) !== -1) {
8406
  ctr = e.type !== 'lockfiles';
@@ -8415,7 +12011,7 @@ $.fn.elfindercwd = function(fm, options) {
8415
 
8416
  unselectAll();
8417
 
8418
- $.each(e.data.added || [], function(i, file) {
8419
  file && file.phash == phash && selectFile(file.hash);
8420
  });
8421
  trigger();
@@ -8448,6 +12044,33 @@ $.fn.elfindercwd = function(fm, options) {
8448
  scrollToView(cwd.find('[id]:last').trigger(evtSelect)) ;
8449
  trigger();
8450
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8451
  });
8452
 
8453
  });
@@ -8455,7 +12078,7 @@ $.fn.elfindercwd = function(fm, options) {
8455
  // fm.timeEnd('cwdLoad')
8456
 
8457
  return this;
8458
- }
8459
 
8460
 
8461
  /*
@@ -8467,81 +12090,252 @@ $.fn.elfindercwd = function(fm, options) {
8467
  *
8468
  * @author Dmitry (dio) Levashov
8469
  **/
8470
- $.fn.elfinderdialog = function(opts) {
8471
- var dialog;
 
8472
 
8473
- if (typeof(opts) == 'string' && (dialog = this.closest('.ui-dialog')).length) {
8474
- if (opts == 'open') {
8475
- dialog.css('display') == 'none' && dialog.fadeIn(120, function() {
8476
- dialog.trigger('open');
8477
- });
8478
- } else if (opts == 'close') {
8479
- dialog.css('display') != 'none' && dialog.hide().trigger('close');
8480
- } else if (opts == 'destroy') {
8481
- dialog.hide().remove();
8482
- } else if (opts == 'toTop') {
8483
- dialog.trigger('totop');
8484
- } else if (opts == 'posInit') {
8485
- dialog.trigger('posinit');
8486
  }
8487
  }
8488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8489
  opts = $.extend({}, $.fn.elfinderdialog.defaults, opts);
8490
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8491
  this.filter(':not(.ui-dialog-content)').each(function() {
8492
  var self = $(this).addClass('ui-dialog-content ui-widget-content'),
8493
- parent = self.parent(),
8494
  clactive = 'elfinder-dialog-active',
8495
  cldialog = 'elfinder-dialog',
8496
  clnotify = 'elfinder-dialog-notify',
8497
  clhover = 'ui-state-hover',
 
 
8498
  id = parseInt(Math.random()*1000000),
8499
- overlay = parent.children('.elfinder-overlay'),
8500
  buttonset = $('<div class="ui-dialog-buttonset"/>'),
8501
  buttonpane = $('<div class=" ui-helper-clearfix ui-dialog-buttonpane ui-widget-content"/>')
8502
  .append(buttonset),
8503
- platformWin = (window.navigator.platform.indexOf('Win') != -1),
8504
-
8505
- dialog = $('<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable std42-dialog '+cldialog+' '+opts.cssClass+'"/>')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8506
  .hide()
8507
  .append(self)
8508
- .appendTo(parent)
8509
  .draggable({
8510
  handle : '.ui-dialog-titlebar',
8511
  containment : 'document',
8512
  stop : function(e, ui){
8513
  dialog.css({height : opts.height});
 
8514
  }
8515
  })
8516
  .css({
8517
  width : opts.width,
8518
- height : opts.height//,
8519
- //maxWidth: opts.maxWidth? opts.maxWidth : $(window).width()-10,
8520
- //maxHeight: opts.maxHeight? opts.maxHeight : $(window).height()-20
8521
  })
8522
- .mousedown(function(e) {
8523
- e.stopPropagation();
8524
-
8525
- $(document).mousedown();
8526
-
8527
- if (!dialog.hasClass(clactive)) {
8528
- parent.find('.'+cldialog+':visible').removeClass(clactive);
8529
- dialog.addClass(clactive).zIndex(maxZIndex() + 1);
8530
  }
8531
  })
8532
  .on('open', function() {
8533
- var d = $(this),
8534
- maxWinWidth = (d.outerWidth() > parent.width()-10)? parent.width()-10 : null;
8535
 
8536
  maxWinWidth && d.css({width: maxWinWidth, left: '5px'});
8537
-
8538
- dialog.trigger('totop');
8539
-
8540
- typeof(opts.open) == 'function' && $.proxy(opts.open, self[0])();
8541
 
8542
  if (!dialog.hasClass(clnotify)) {
8543
-
8544
- parent.find('.'+cldialog+':visible').not('.'+clnotify).each(function() {
8545
  var d = $(this),
8546
  top = parseInt(d.css('top')),
8547
  left = parseInt(d.css('left')),
@@ -8557,141 +12351,198 @@ $.fn.elfinderdialog = function(opts) {
8557
  }
8558
  });
8559
  }
8560
- })
8561
- .on('close', function() {
8562
- var dialogs = parent.find('.elfinder-dialog:visible'),
8563
- z = maxZIndex();
8564
 
8565
- $(this).data('modal') && overlay.elfinderoverlay('hide');
8566
 
8567
- // get focus to next dialog
8568
- if (dialogs.length) {
8569
- dialogs.each(function() {
8570
- var d = $(this);
8571
- if (d.zIndex() >= z) {
8572
- d.trigger('totop');
8573
- return false;
 
 
 
8574
  }
8575
  })
8576
- } else {
8577
- // return focus to parent
8578
- setTimeout(function() {
8579
- parent.mousedown().click();
8580
- }, 10);
8581
-
 
 
 
 
 
8582
  }
8583
 
 
 
8584
  if (typeof(opts.close) == 'function') {
8585
  $.proxy(opts.close, self[0])();
8586
  } else if (opts.destroyOnClose) {
8587
  dialog.hide().remove();
8588
  }
 
 
 
 
 
 
 
 
 
 
 
8589
  })
8590
  .on('totop', function() {
8591
- $(this).mousedown().find('.ui-button:'+(platformWin? 'first':'last')).focus().end().find(':text:first').focus();
8592
- $(this).data('modal') && overlay.is(':hidden') && overlay.elfinderoverlay('show');
8593
- overlay.zIndex($(this).zIndex());
 
 
 
 
 
 
8594
  })
8595
  .on('posinit', function() {
8596
  var css = opts.position;
8597
- if (!css) {
8598
  css = {
8599
- top : Math.max(0, parseInt((parent.height() - dialog.outerHeight())/2 - 42))+'px',
8600
- left : Math.max(0, parseInt((parent.width() - dialog.outerWidth())/2))+'px'
8601
  };
8602
  }
8603
- dialog.css(css);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8604
  })
8605
- .data({modal: opts.modal}),
8606
- maxZIndex = function() {
8607
- var z = parent.zIndex() + 10;
8608
- parent.find('.'+cldialog+':visible').each(function() {
8609
- var _z;
8610
- if (this != dialog[0]) {
8611
- _z = $(this).zIndex();
8612
- if (_z > z) {
8613
- z = _z;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8614
  }
 
 
8615
  }
8616
- })
8617
- return z;
8618
- },
8619
- top
8620
  ;
8621
 
8622
  dialog.trigger('posinit');
8623
 
8624
- if (opts.closeOnEscape) {
8625
- $(document).on('keyup.'+id, function(e) {
8626
- if (e.keyCode == $.ui.keyCode.ESCAPE && dialog.hasClass(clactive)) {
8627
- self.elfinderdialog('close');
8628
- $(document).off('keyup.'+id);
8629
- }
8630
- })
8631
- }
8632
- dialog.prepend(
8633
- $('<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">'+opts.title+'</div>')
8634
- .prepend($('<a href="#" class="ui-dialog-titlebar-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>')
8635
- .mousedown(function(e) {
8636
- e.preventDefault();
8637
- self.elfinderdialog('close');
8638
- }))
8639
 
8640
- );
8641
-
8642
 
8643
-
8644
  $.each(opts.buttons, function(name, cb) {
8645
- var button = $('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+name+'</span></button>')
8646
- .click($.proxy(cb, self[0]))
8647
- .hover(function(e) {
8648
- if (opts.btnHoverFocus) {
8649
- $(this)[e.type == 'mouseenter' ? 'focus' : 'blur']();
8650
- } else {
8651
- $(this).toggleClass(clhover, e.type == 'mouseenter');
8652
- }
8653
- })
8654
- .focus(function() { $(this).addClass(clhover) })
8655
- .blur(function() { $(this).removeClass(clhover) })
8656
- .keydown(function(e) {
8657
- var next;
8658
-
8659
- if (e.keyCode == $.ui.keyCode.ENTER) {
8660
- $(this).click();
8661
- } else if (e.keyCode == $.ui.keyCode.TAB || e.keyCode == $.ui.keyCode.RIGHT) {
8662
- e.preventDefault();
8663
- next = $(this).next('.ui-button');
8664
- next.length ? next.focus() : $(this).parent().children('.ui-button:first').focus();
8665
- } else if (e.keyCode == $.ui.keyCode.LEFT) {
8666
- e.preventDefault();
8667
- next = $(this).prev('.ui-button');
8668
- next.length ? next.focus() : $(this).parent().children('.ui-button:last').focus()
8669
- }
8670
- })
8671
  if (platformWin) {
8672
  buttonset.append(button);
8673
  } else {
8674
  buttonset.prepend(button);
8675
  }
8676
- })
 
 
 
 
 
 
 
 
 
 
8677
 
8678
- buttonset.children().length && dialog.append(buttonpane);
 
 
 
 
8679
  if (opts.resizable && $.fn.resizable) {
8680
  dialog.resizable({
8681
- minWidth : opts.minWidth,
8682
- minHeight : opts.minHeight,
8683
- alsoResize : this
8684
- });
 
 
 
 
 
 
 
 
 
 
 
8685
  }
8686
 
8687
  typeof(opts.create) == 'function' && $.proxy(opts.create, this)();
8688
 
 
 
8689
  opts.autoOpen && self.elfinderdialog('open');
8690
 
8691
  });
8692
 
8693
  return this;
8694
- }
8695
 
8696
  $.fn.elfinderdialog.defaults = {
8697
  cssClass : '',
@@ -8707,8 +12558,58 @@ $.fn.elfinderdialog.defaults = {
8707
  width : 320,
8708
  height : 'auto',
8709
  minWidth : 200,
8710
- minHeight : 110
8711
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8712
 
8713
  /*
8714
  * File: /js/ui/navbar.js
@@ -8722,71 +12623,95 @@ $.fn.elfinderdialog.defaults = {
8722
  $.fn.elfindernavbar = function(fm, opts) {
8723
 
8724
  this.not('.elfinder-navbar').each(function() {
8725
- var nav = $(this).addClass('ui-state-default elfinder-navbar'),
8726
- parent = nav.parent()
8727
- .resize(function() {
8728
- nav.height(wz.height() - delta);
8729
- }),
8730
  wz = parent.children('.elfinder-workzone').append(nav),
8731
  delta = nav.outerHeight() - nav.height(),
8732
  ltr = fm.direction == 'ltr',
8733
- handle;
 
 
 
 
 
 
 
8734
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8735
 
8736
- if ($.fn.resizable) {
8737
  handle = nav.resizable({
8738
  handles : ltr ? 'e' : 'w',
8739
  minWidth : opts.minWidth || 150,
8740
- maxWidth : opts.maxWidth || 500
8741
- })
8742
- .on('resize scroll', function() {
8743
- var offset = (fm.UA.Opera && nav.scrollLeft())? 20 : 2;
8744
- handle.css({
8745
- top : parseInt(nav.scrollTop())+'px',
8746
- left : ltr ? 'auto' : parseInt(nav.scrollLeft() + offset),
8747
- right: ltr ? parseInt(nav.scrollLeft() - offset) * -1 : 'auto'
8748
- });
8749
- })
8750
- .find('.ui-resizable-handle').zIndex(nav.zIndex() + 10);
8751
-
8752
- if (fm.UA.Touch) {
8753
- var toggle = function(){
8754
- if (handle.data('closed')) {
8755
- handle.data('closed', false).css({backgroundColor: 'transparent'});
8756
- nav.css({width: handle.data('width')}).trigger('resize');
8757
- } else {
8758
- handle.data('closed', true).css({backgroundColor: 'inherit'});
8759
- nav.css({width: 8});
8760
  }
8761
- handle.data({startX: null, endX: null});
8762
- };
8763
- handle.data({closed: false, width: nav.width()})
8764
- .on('touchstart', function(e){
8765
- handle.data('startX', e.originalEvent.touches[0].pageX);
8766
  })
8767
- .on('touchmove', function(e){
8768
- var x = e.originalEvent.touches[0].pageX;
8769
- var sx = handle.data('startX');
8770
- var open = ltr? (sx && sx < x) : (sx > x);
8771
- var close = ltr? (sx > x) : (sx && sx < x);
8772
- (open || close) && toggle();
8773
- })
8774
- .on('touchend', function(e){
8775
- handle.data('startX') && toggle();
8776
- });
8777
- if (fm.UA.Mobile) {
8778
- handle.data('defWidth', nav.width());
8779
- $(window).on('resize', function(e){
8780
- var hw = nav.parent().width() / 2;
8781
- if (handle.data('defWidth') > hw) {
8782
- nav.width(hw);
8783
- } else {
8784
- nav.width(handle.data('defWidth'));
8785
  }
8786
- handle.data('width', nav.width());
8787
- });
8788
- }
8789
- }
8790
 
8791
  fm.one('open', function() {
8792
  setTimeout(function() {
@@ -8794,6 +12719,24 @@ $.fn.elfindernavbar = function(fm, opts) {
8794
  }, 150);
8795
  });
8796
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8797
  });
8798
 
8799
  return this;
@@ -8807,9 +12750,11 @@ $.fn.elfindernavbar = function(fm, opts) {
8807
 
8808
  $.fn.elfinderoverlay = function(opts) {
8809
 
 
 
8810
  this.filter(':not(.elfinder-overlay)').each(function() {
8811
  opts = $.extend({}, opts);
8812
- $(this).addClass('ui-widget-overlay elfinder-overlay')
8813
  .hide()
8814
  .mousedown(function(e) {
8815
  e.preventDefault();
@@ -8827,10 +12772,10 @@ $.fn.elfinderoverlay = function(opts) {
8827
  cnt = o.data('cnt') + 1,
8828
  show = o.data('show');
8829
 
 
8830
  o.data('cnt', cnt);
8831
 
8832
  if (o.is(':hidden')) {
8833
- o.zIndex(o.parent().zIndex()+1);
8834
  o.show();
8835
  show();
8836
  }
@@ -8843,14 +12788,15 @@ $.fn.elfinderoverlay = function(opts) {
8843
 
8844
  o.data('cnt', cnt);
8845
 
8846
- if (cnt == 0 && o.is(':visible')) {
8847
  o.hide();
8848
- hide();
8849
  }
8850
  }
8851
 
8852
  return this;
8853
- }
 
8854
 
8855
  /*
8856
  * File: /js/ui/panel.js
@@ -8871,7 +12817,8 @@ $.fn.elfinderpanel = function(fm) {
8871
  })
8872
  })
8873
  })
8874
- }
 
8875
 
8876
  /*
8877
  * File: /js/ui/path.js
@@ -8889,12 +12836,16 @@ $.fn.elfinderpath = function(fm) {
8889
  var query = '',
8890
  target = '',
8891
  mimes = [],
 
 
 
 
8892
  path = $(this).addClass('elfinder-path').html('&nbsp;')
8893
- .on('click', 'a', function(e) {
8894
- var hash = $(this).attr('href').substr(5);
8895
-
8896
  e.preventDefault();
8897
  if (hash != fm.cwd().hash) {
 
8898
  if (query) {
8899
  fm.exec('search', query, { target: hash, mime: mimes.join(' ') });
8900
  } else {
@@ -8902,7 +12853,88 @@ $.fn.elfinderpath = function(fm) {
8902
  }
8903
  }
8904
  })
8905
- .prependTo(fm.getUI('statusbar').show())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8906
 
8907
  fm.bind('open searchend parents', function() {
8908
  var dirs = [];
@@ -8911,11 +12943,15 @@ $.fn.elfinderpath = function(fm) {
8911
  target = '';
8912
  mimes = [];
8913
 
8914
- $.each(fm.parents(fm.cwd().hash), function(i, hash) {
8915
- dirs.push('<a href="#elf_'+hash+'">'+fm.escape(fm.file(hash).name)+'</a>');
8916
- });
8917
-
8918
- path.html(dirs.join(fm.option('separator')));
 
 
 
 
8919
  })
8920
  .bind('searchstart', function(e) {
8921
  if (e.data) {
@@ -8928,17 +12964,35 @@ $.fn.elfinderpath = function(fm) {
8928
  var dirs = [],
8929
  html = '';
8930
  if (target) {
8931
- $.each(fm.parents(target), function(i, hash) {
8932
- dirs.push('<a href="#elf_'+hash+'">'+fm.escape(fm.file(hash).name)+'</a>');
8933
- });
8934
- html = dirs.join(fm.option('separator'));
8935
  } else {
8936
  html = fm.i18n('btnAll');
8937
  }
8938
- path.html(fm.i18n('searcresult') + ': ' + html);
8939
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8940
  });
8941
- }
 
8942
 
8943
  /*
8944
  * File: /js/ui/places.js
@@ -8985,17 +13039,20 @@ $.fn.elfinderplaces = function(fm, opts) {
8985
  * @return void
8986
  **/
8987
  save = function() {
8988
- var hashes = [], data = [];
8989
 
8990
  hashes = $.map(subtree.children().find('[id]'), function(n) {
8991
  return id2hash(n.id);
8992
  });
8993
- $.each(hashes.reverse(), function(i, h) {
8994
- data.push(h + '#' + dirs[h].name);
8995
- });
8996
-
 
 
 
8997
 
8998
- fm.storage(key, data.join(','));
8999
  },
9000
  /**
9001
  * Return node for given dir object
@@ -9005,9 +13062,9 @@ $.fn.elfinderplaces = function(fm, opts) {
9005
  **/
9006
  create = function(dir, hash) {
9007
  return $(tpl.replace(/\{id\}/, hash2id(dir? dir.hash : hash))
9008
- .replace(/\{name\}/, fm.escape(dir? dir.name : hash))
9009
- .replace(/\{cssclass\}/, dir? (fm.UA.Touch ? 'elfinder-touch ' : '')+fm.perms2class(dir) : '')
9010
- .replace(/\{permissions\}/, (dir && (!dir.read || !dir.write))? ptpl : '')
9011
  .replace(/\{title\}/, (dir && dir.path)? fm.escape(dir.path) : '')
9012
  .replace(/\{symlink\}/, '')
9013
  .replace(/\{style\}/, ''));
@@ -9031,13 +13088,11 @@ $.fn.elfinderplaces = function(fm, opts) {
9031
  }
9032
 
9033
  node = create(dir, hash);
9034
- if (dir.notfound) {
9035
- node.addClass('ui-state-disabled');
9036
- }
9037
 
9038
  dirs[hash] = dir;
9039
  subtree.prepend(node);
9040
  root.addClass(collapsed);
 
9041
 
9042
  return true;
9043
  },
@@ -9048,7 +13103,7 @@ $.fn.elfinderplaces = function(fm, opts) {
9048
  * @return String removed name
9049
  **/
9050
  remove = function(hash) {
9051
- var name = null, tgt;
9052
 
9053
  if (dirs[hash]) {
9054
  delete dirs[hash];
@@ -9056,7 +13111,9 @@ $.fn.elfinderplaces = function(fm, opts) {
9056
  if (tgt.length) {
9057
  name = tgt.text();
9058
  tgt.parent().remove();
9059
- if (!subtree.children().length) {
 
 
9060
  root.removeClass(collapsed);
9061
  places.removeClass(expanded);
9062
  subtree.slideToggle(false);
@@ -9112,9 +13169,6 @@ $.fn.elfinderplaces = function(fm, opts) {
9112
  node = create(dir, hash);
9113
 
9114
  if (tgt.length > 0) {
9115
- if (dir.notfound) {
9116
- node.addClass('ui-state-disabled');
9117
- }
9118
  tgt.parent().replaceWith(node);
9119
  dirs[hash] = dir;
9120
  return true
@@ -9149,7 +13203,7 @@ $.fn.elfinderplaces = function(fm, opts) {
9149
  if (subtree.children().length) {
9150
  $.each(subtree.children(), function() {
9151
  var current = $(this);
9152
- if (dir.name.localeCompare(current.children('.'+navdir).text()) < 0) {
9153
  ret = !node.insertBefore(current);
9154
  return ret;
9155
  }
@@ -9162,6 +13216,15 @@ $.fn.elfinderplaces = function(fm, opts) {
9162
  });
9163
  save();
9164
  },
 
 
 
 
 
 
 
 
 
9165
  /**
9166
  * Node - wrapper for places root
9167
  *
@@ -9185,55 +13248,17 @@ $.fn.elfinderplaces = function(fm, opts) {
9185
  if (root.hasClass(collapsed)) {
9186
  places.toggleClass(expanded);
9187
  subtree.slideToggle();
9188
- fm.storage('placesState', places.hasClass(expanded)? 1 : 0);
9189
- }
9190
- })
9191
- .append(
9192
- // sort button
9193
- $('<span class="elfinder-button-icon elfinder-button-icon-sort elfinder-places-root-icon" title="'+fm.i18n('cmdsort')+'"/>')
9194
- .on('click', function(e) {
9195
- e.stopPropagation();
9196
- subtree.empty();
9197
- sort();
9198
- }
9199
- )
9200
- ),
9201
- /**
9202
- * Container for dirs
9203
- *
9204
- * @type jQuery
9205
- **/
9206
- subtree = wrapper.children('.'+fm.res(c, 'navsubtree'))
9207
- .sortable({
9208
- appendTo : 'body',
9209
- revert : false,
9210
- helper : function(e) {
9211
- var dir = $(e.target).parent();
9212
-
9213
- dir.children().removeClass('ui-state-hover');
9214
-
9215
- return $('<div class="ui-widget elfinder-place-drag elfinder-'+fm.direction+'"/>')
9216
- .append($('<div class="elfinder-navbar"/>').show().append(dir.clone()));
9217
-
9218
- },
9219
- stop : function(e, ui) {
9220
- var target = $(ui.item[0]),
9221
- top = places.offset().top,
9222
- left = places.offset().left,
9223
- width = places.width(),
9224
- height = places.height(),
9225
- x = e.pageX,
9226
- y = e.pageY;
9227
-
9228
- if (!(x > left && x < left+width && y > top && y < y+height)) {
9229
- remove(id2hash(target.children(':first').attr('id')));
9230
- save();
9231
- }
9232
- },
9233
- update : function(e, ui) {
9234
- save();
9235
  }
9236
- }),
 
 
 
 
 
 
 
 
9237
  /**
9238
  * Main places container
9239
  *
@@ -9252,7 +13277,7 @@ $.fn.elfinderplaces = function(fm, opts) {
9252
  e.stopPropagation();
9253
  return;
9254
  }
9255
- fm.exec('open', p.attr('id').substr(6));
9256
  })
9257
  .on('contextmenu', '.'+navdir+':not(.'+clroot+')', function(e) {
9258
  var self = $(this),
@@ -9289,25 +13314,31 @@ $.fn.elfinderplaces = function(fm, opts) {
9289
  tolerance : 'pointer',
9290
  accept : '.elfinder-cwd-file-wrapper,.elfinder-tree-dir,.elfinder-cwd-file',
9291
  hoverClass : fm.res('class', 'adroppable'),
 
 
 
9292
  over : function(e, ui) {
9293
  var helper = ui.helper,
9294
  dir = $.map(helper.data('files'), function(h) { return (fm.file(h).mime === 'directory' && !dirs[h])? h : null});
9295
  e.stopPropagation();
9296
  helper.data('dropover', helper.data('dropover') + 1);
9297
- if (dir.length > 0) {
9298
- helper.addClass('elfinder-drag-helper-plus');
9299
- } else {
9300
- $(this).removeClass(dropover);
 
 
 
9301
  }
9302
- fm.trigger('unlockfiles', {files : helper.data('files'), helper: helper});
9303
  },
9304
  out : function(e, ui) {
9305
- var helper = ui.helper;
 
9306
  e.stopPropagation();
9307
- helper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus').data('dropover', Math.max(helper.data('dropover') - 1, 0));
9308
  $(this).removeData('dropover')
9309
  .removeClass(dropover);
9310
- fm.trigger('unlockfiles', {files : helper.data('files'), helper: helper});
9311
  },
9312
  drop : function(e, ui) {
9313
  var helper = ui.helper,
@@ -9328,6 +13359,9 @@ $.fn.elfinderplaces = function(fm, opts) {
9328
  })
9329
  // for touch device
9330
  .on('touchstart', '.'+navdir+':not(.'+clroot+')', function(e) {
 
 
 
9331
  var hash = $(this).attr('id').substr(6),
9332
  p = $(this)
9333
  .addClass(hover)
@@ -9353,6 +13387,40 @@ $.fn.elfinderplaces = function(fm, opts) {
9353
  }
9354
  });
9355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9356
  // "on regist" for command exec
9357
  $(this).on('regist', function(e, files){
9358
  var added = false;
@@ -9378,11 +13446,29 @@ $.fn.elfinderplaces = function(fm, opts) {
9378
  places.show().parent().show();
9379
 
9380
  dirs = {};
9381
- dat = $.map((fm.storage(key) || '').split(','), function(hash) { return hash || null;});
9382
- $.each(dat, function(i, d) {
9383
- var dir = d.split('#')
9384
- dirs[dir[0]] = dir[1]? dir[1] : { hash: dir[0], name: dir[0] };
9385
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9386
 
9387
  hashes = Object.keys(dirs);
9388
  if (hashes.length) {
@@ -9399,7 +13485,7 @@ $.fn.elfinderplaces = function(fm, opts) {
9399
  exists[hash] = f;
9400
  });
9401
  $.each(dirs, function(h, f) {
9402
- add(exists[h] || { hash: h, name: f, mime: 'directory', notfound: true });
9403
  });
9404
  if (fm.storage('placesState') > 0) {
9405
  root.click();
@@ -9462,7 +13548,7 @@ $.fn.elfinderplaces = function(fm, opts) {
9462
  }
9463
  changed && save();
9464
  })
9465
- .bind('sync', function() {
9466
  var hashes = Object.keys(dirs);
9467
  if (hashes.length) {
9468
  root.prepend(spinner);
@@ -9485,15 +13571,18 @@ $.fn.elfinderplaces = function(fm, opts) {
9485
  });
9486
  $.each(dirs, function(h, f) {
9487
  if (!f.notfound != !!exists[h]) {
9488
- if (f.phash === cwd || (exists[h] && exists[h].mime !== 'directory')) {
9489
  if (remove(h)) {
9490
  updated = true;
9491
  }
9492
  } else {
9493
- if (update(exists[h] || { hash: h, name: f.name, mime: 'directory', notfound: true })) {
9494
  updated = true;
9495
  }
9496
  }
 
 
 
9497
  }
9498
  });
9499
  updated && save();
@@ -9507,7 +13596,7 @@ $.fn.elfinderplaces = function(fm, opts) {
9507
  })
9508
 
9509
  });
9510
- }
9511
 
9512
 
9513
  /*
@@ -9523,12 +13612,14 @@ $.fn.elfindersearchbutton = function(cmd) {
9523
  return this.each(function() {
9524
  var result = false,
9525
  fm = cmd.fm,
 
9526
  id = function(name){return fm.namespace + name},
9527
  toolbar= fm.getUI('toolbar'),
9528
  btnCls = fm.res('class', 'searchbtn'),
9529
  button = $(this).hide().addClass('ui-widget-content elfinder-button '+btnCls),
9530
  search = function() {
9531
- opts.slideUp();
 
9532
  var val = $.trim(input.val()),
9533
  from = !$('#' + id('SearchFromAll')).prop('checked'),
9534
  mime = $('#' + id('SearchMime')).prop('checked');
@@ -9547,6 +13638,8 @@ $.fn.elfindersearchbutton = function(cmd) {
9547
  cmd.exec(val, from, mime).done(function() {
9548
  result = true;
9549
  input.focus();
 
 
9550
  });
9551
 
9552
  } else {
@@ -9554,53 +13647,96 @@ $.fn.elfindersearchbutton = function(cmd) {
9554
  }
9555
  },
9556
  abort = function() {
9557
- opts.slideUp();
9558
- input.val('');
9559
- if (result) {
9560
  result = false;
9561
- fm.trigger('searchend');
 
 
 
9562
  }
9563
  },
 
9564
  input = $('<input type="text" size="42"/>')
9565
- .focus(function(){
9566
- opts.slideDown();
 
9567
  })
9568
- .blur(function(){
9569
- if (!opts.data('infocus')) {
9570
- opts.slideUp();
9571
- } else {
9572
- opts.data('infocus', false);
 
 
9573
  }
9574
  })
9575
  .appendTo(button)
9576
  // to avoid fm shortcuts on arrows
9577
- .keypress(function(e) {
9578
  e.stopPropagation();
9579
  })
9580
- .keydown(function(e) {
9581
  e.stopPropagation();
9582
 
9583
- e.keyCode == 13 && search();
9584
 
9585
- if (e.keyCode== 27) {
9586
  e.preventDefault();
9587
  abort();
9588
  }
9589
  }),
9590
- opts = $('<div class="ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>')
9591
- .append($('<div class="buttonset"/>')
9592
- .append($('<input id="'+id('SearchFromCwd')+'" name="serchfrom" type="radio" checked="checked"/><label for="'+id('SearchFromCwd')+'">'+fm.i18n('btnCwd')+'</label>'))
9593
- .append($('<input id="'+id('SearchFromVol')+'" name="serchfrom" type="radio"/><label for="'+id('SearchFromVol')+'">'+fm.i18n('btnVolume')+'</label>'))
9594
- .append($('<input id="'+id('SearchFromAll')+'" name="serchfrom" type="radio"/><label for="'+id('SearchFromAll')+'">'+fm.i18n('btnAll')+'</label>'))
9595
- )
9596
- .append($('<div class="buttonset"/>')
9597
- .append($('<input id="'+id('SearchName')+'" name="serchcol" type="radio" checked="checked"/><label for="'+id('SearchName')+'">'+fm.i18n('btnFileName')+'</label>'))
9598
- .append($('<input id="'+id('SearchMime')+'" name="serchcol" type="radio"/><label for="'+id('SearchMime')+'">'+fm.i18n('btnMime')+'</label>'))
9599
- )
9600
- .hide()
9601
- .zIndex(12+button.zIndex())
9602
- .css('overflow', 'hidden')
9603
- .appendTo(button);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9604
 
9605
  $('<span class="ui-icon ui-icon-search" title="'+cmd.title+'"/>')
9606
  .appendTo(button)
@@ -9610,25 +13746,10 @@ $.fn.elfindersearchbutton = function(cmd) {
9610
  .appendTo(button)
9611
  .click(abort);
9612
 
9613
- $(function(){
9614
- opts.find('div.buttonset').buttonset();
9615
- //opts.find('div.button input').button();
9616
- $('#'+id('SearchFromAll')).next('label').attr('title', fm.i18n('searchTarget', fm.i18n('btnAll')));
9617
- $('#'+id('SearchMime')).next('label').attr('title', fm.i18n('searchMime'));
9618
- opts.find('input')
9619
- .on('mousedown', function(){
9620
- opts.data('infocus', true);
9621
- })
9622
- .on('click', function(){
9623
- $.trim(input.val()) && search();
9624
- });
9625
- });
9626
-
9627
  // wait when button will be added to DOM
9628
- toolbar.on('load', function(){
9629
  var parent = button.parent();
9630
  if (parent.length) {
9631
- toolbar.children('.'+btnCls).remove();
9632
  toolbar.prepend(button.show());
9633
  parent.remove();
9634
  // position icons for ie7
@@ -9639,11 +13760,41 @@ $.fn.elfindersearchbutton = function(cmd) {
9639
  left : parseInt(button.width())-icon.outerWidth(true)
9640
  });
9641
  }
9642
- fm.resize();
9643
  }
9644
  });
9645
 
9646
  fm
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9647
  .select(function() {
9648
  input.blur();
9649
  })
@@ -9666,12 +13817,15 @@ $.fn.elfindersearchbutton = function(cmd) {
9666
  .shortcut({
9667
  pattern : 'ctrl+f f3',
9668
  description : cmd.title,
9669
- callback : function() { input.select().focus(); }
 
 
9670
  });
9671
 
9672
  });
9673
  };
9674
 
 
9675
  /*
9676
  * File: /js/ui/sortbutton.js
9677
  */
@@ -9693,9 +13847,10 @@ $.fn.elfindersortbutton = function(cmd) {
9693
  selected = item+'-selected',
9694
  asc = selected+'-asc',
9695
  desc = selected+'-desc',
 
9696
  button = $(this).addClass('ui-state-default elfinder-button elfinder-menubutton elfiner-button-'+name)
9697
  .attr('title', cmd.title)
9698
- .append('<span class="elfinder-button-icon elfinder-button-icon-'+name+'"/>')
9699
  .hover(function(e) { !button.hasClass(disabled) && button.toggleClass(hover); })
9700
  .click(function(e) {
9701
  if (!button.hasClass(disabled)) {
@@ -9704,10 +13859,9 @@ $.fn.elfindersortbutton = function(cmd) {
9704
  menu.slideToggle(100);
9705
  }
9706
  }),
9707
- menu = $('<div class="ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>')
9708
  .hide()
9709
  .appendTo(button)
9710
- .zIndex(12+button.zIndex())
9711
  .on('mouseenter mouseleave', '.'+item, function() { $(this).toggleClass(hover) })
9712
  .on('click', '.'+item, function(e) {
9713
  e.preventDefault();
@@ -9715,15 +13869,17 @@ $.fn.elfindersortbutton = function(cmd) {
9715
  hide();
9716
  }),
9717
  update = function() {
9718
- menu.children(':not(:last)').removeClass(selected+' '+asc+' '+desc)
9719
  .filter('[rel="'+fm.sortType+'"]')
9720
  .addClass(selected+' '+(fm.sortOrder == 'asc' ? asc : desc));
9721
 
9722
- menu.children(':last').toggleClass(selected, fm.sortStickFolders);
 
9723
  },
9724
  hide = function() { menu.hide(); };
9725
 
9726
-
 
9727
  $.each(fm.sortRules, function(name, value) {
9728
  menu.append($('<div class="'+item+'" rel="'+name+'"><span class="ui-icon ui-icon-arrowthick-1-n"/><span class="ui-icon ui-icon-arrowthick-1-s"/>'+fm.i18n('sort'+name)+'</div>').data('type', name));
9729
  });
@@ -9734,15 +13890,24 @@ $.fn.elfindersortbutton = function(cmd) {
9734
  cmd.exec([], {
9735
  type : type,
9736
  order : type == fm.sortType ? fm.sortOrder == 'asc' ? 'desc' : 'asc' : fm.sortOrder,
9737
- stick : fm.sortStickFolders
 
9738
  });
9739
- })
9740
 
9741
- $('<div class="'+item+' '+item+'-separated"><span class="ui-icon ui-icon-check"/>'+fm.i18n('sortFoldersFirst')+'</div>')
9742
  .appendTo(menu)
9743
  .click(function() {
9744
- cmd.exec([], {type : fm.sortType, order : fm.sortOrder, stick : !fm.sortStickFolders});
9745
- });
 
 
 
 
 
 
 
 
9746
 
9747
  fm.bind('disable select', hide).getUI().click(hide);
9748
 
@@ -9761,9 +13926,7 @@ $.fn.elfindersortbutton = function(cmd) {
9761
 
9762
  });
9763
 
9764
- }
9765
-
9766
-
9767
 
9768
 
9769
  /*
@@ -9785,8 +13948,8 @@ $.fn.elfinderstat = function(fm) {
9785
  e.preventDefault();
9786
  fm.exec('opendir', [ hash ]);
9787
  }),
9788
- titlesize = fm.i18n('size').toLowerCase(),
9789
- titleitems = fm.i18n('items').toLowerCase(),
9790
  titlesel = fm.i18n('selected'),
9791
  setstat = function(files, cwd) {
9792
  var c = 0,
@@ -9798,7 +13961,10 @@ $.fn.elfinderstat = function(fm) {
9798
  s += parseInt(file.size)||0;
9799
  }
9800
  })
9801
- size.html(titleitems+': '+c+', '+titlesize+': '+fm.formatSize(s));
 
 
 
9802
  },
9803
  search = false;
9804
 
@@ -9841,10 +14007,96 @@ $.fn.elfinderstat = function(fm) {
9841
 
9842
  sel.html(c ? titlesel+': '+c+', '+titlesize+': '+fm.formatSize(s) : '&nbsp;');
9843
  })
9844
-
 
 
 
 
 
9845
  ;
9846
  })
9847
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9848
 
9849
  /*
9850
  * File: /js/ui/toolbar.js
@@ -9859,81 +14111,231 @@ $.fn.elfindertoolbar = function(fm, opts) {
9859
  this.not('.elfinder-toolbar').each(function() {
9860
  var commands = fm._commands,
9861
  self = $(this).addClass('ui-helper-clearfix ui-widget-header ui-corner-top elfinder-toolbar'),
9862
- panels = opts || [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9863
  dispre = null,
9864
  uiCmdMapPrev = '',
9865
- l, i, cmd, panel, button;
9866
 
9867
- self.prev().length && self.parent().prepend(this);
9868
-
9869
- var render = function(disabled){
9870
- var name;
9871
- self.empty();
9872
- l = panels.length;
9873
- while (l--) {
9874
- if (panels[l]) {
9875
- panel = $('<div class="ui-widget-content ui-corner-all elfinder-buttonset"/>');
9876
- i = panels[l].length;
9877
- while (i--) {
9878
- name = panels[l][i];
9879
- if ((!disabled || $.inArray(name, disabled) === -1) && (cmd = commands[name])) {
9880
- button = 'elfinder'+cmd.options.ui;
9881
- $.fn[button] && panel.prepend($('<div/>')[button](cmd));
 
 
 
 
 
9882
  }
9883
- }
9884
-
9885
- panel.children().length && self.prepend(panel);
9886
- panel.children(':gt(0)').before('<span class="ui-widget-content elfinder-toolbar-button-separator"/>');
9887
-
 
 
9888
  }
9889
- }
9890
-
9891
- self.children().length? self.show() : self.hide();
9892
- self.trigger('load');
9893
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9894
 
9895
  render();
9896
 
9897
  fm.bind('open sync', function(){
9898
- var repCmds = [],
9899
- disabled = fm.option('disabled');
9900
 
9901
  if (!dispre || dispre.toString() !== disabled.sort().toString()) {
9902
  render(disabled && disabled.length? disabled : null);
 
9903
  }
9904
  dispre = disabled.concat().sort();
9905
 
9906
- if (uiCmdMapPrev !== JSON.stringify(fm.commandMap)) {
9907
  uiCmdMapPrev = JSON.stringify(fm.commandMap);
 
 
 
 
 
 
 
 
 
9908
  if (Object.keys(fm.commandMap).length) {
9909
  $.each(fm.commandMap, function(from, to){
9910
  var cmd = fm._commands[to],
9911
- button = cmd? 'elfinder'+cmd.options.ui : null;
 
9912
  if (button && $.fn[button]) {
9913
- repCmds.push(from);
9914
- var btn = $('div.elfinder-buttonset div.elfinder-button').has('span.elfinder-button-icon-'+from);
9915
- if (btn.length && !btn.next().has('span.elfinder-button-icon-'+to).length) {
9916
- btn.after($('<div/>')[button](fm._commands[to]).data('origin', from));
9917
- btn.hide();
 
 
 
 
 
 
 
 
 
 
9918
  }
9919
  }
9920
  });
9921
  }
9922
- // reset toolbar
9923
- $.each($('div.elfinder-button'), function(){
9924
- var origin = $(this).data('origin');
9925
- if (origin && $.inArray(origin, repCmds) == -1) {
9926
- $('span.elfinder-button-icon-'+$(this).data('origin')).parent().show();
9927
- $(this).remove();
9928
- }
9929
- });
9930
  }
9931
-
9932
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9933
  });
9934
 
9935
  return this;
9936
- }
 
9937
 
9938
  /*
9939
  * File: /js/ui/tree.js
@@ -10063,6 +14465,13 @@ $.fn.elfindertree = function(fm, opts) {
10063
  */
10064
  droppable = fm.res(c, 'droppable'),
10065
 
 
 
 
 
 
 
 
10066
  /**
10067
  * Un-disabled cmd `paste` volume's root wrapper class
10068
  *
@@ -10100,16 +14509,22 @@ $.fn.elfindertree = function(fm, opts) {
10100
  e.stopPropagation();
10101
  helper.data('dropover', helper.data('dropover') + 1);
10102
  dst.data('dropover', true);
10103
- if (ui.helper.data('namespace') !== fm.namespace) {
10104
  dst.removeClass(cl);
10105
- return false;
 
10106
  }
10107
- dst.addClass(hover)
10108
  if (dst.is('.'+collapsed+':not(.'+expanded+')')) {
10109
  dst.data('expandTimer', setTimeout(function() {
10110
- dst.children('.'+arrow).click();
10111
  }, 500));
10112
  }
 
 
 
 
 
10113
  hash = fm.navId2Hash(dst.attr('id'));
10114
  dst.data('dropover', hash);
10115
  $.each(ui.helper.data('files'), function(i, h) {
@@ -10142,7 +14557,9 @@ $.fn.elfindertree = function(fm, opts) {
10142
  $(this).removeData('dropover')
10143
  .removeClass(hover+' '+dropover);
10144
  },
10145
- drop : function(e, ui) { insideNavbar(e.clientX) && drop.call(this, e, ui); }
 
 
10146
  }),
10147
 
10148
  spinner = $(fm.res('tpl', 'navspinner')),
@@ -10183,7 +14600,7 @@ $.fn.elfindertree = function(fm, opts) {
10183
  replace = {
10184
  id : function(dir) { return fm.navHash2Id(dir.hash) },
10185
  cssclass : function(dir) {
10186
- var cname = (fm.UA.Touch ? 'elfinder-touch ' : '')+(dir.phash ? '' : root)+' '+navdir+' '+fm.perms2class(dir);
10187
  dir.dirs && !dir.link && (cname += ' ' + collapsed);
10188
  opts.getClass && (cname += ' ' + opts.getClass(dir));
10189
  dir.csscls && (cname += ' ' + fm.escape(dir.csscls));
@@ -10191,7 +14608,7 @@ $.fn.elfindertree = function(fm, opts) {
10191
  },
10192
  permissions : function(dir) { return !dir.read || !dir.write ? ptpl : ''; },
10193
  symlink : function(dir) { return dir.alias ? stpl : ''; },
10194
- style : function(dir) { return dir.icon ? 'style="background-image:url(\''+fm.escape(dir.icon)+'\')"' : ''; }
10195
  },
10196
 
10197
  /**
@@ -10238,14 +14655,13 @@ $.fn.elfindertree = function(fm, opts) {
10238
  */
10239
  findSibling = function(subtree, dir) {
10240
  var node = subtree.children(':first'),
10241
- info, compare;
10242
 
10243
- compare = fm.naturalCompare;
10244
  while (node.length) {
10245
  info = fm.file(fm.navId2Hash(node.children('[id]').attr('id')));
10246
 
10247
  if ((info = fm.file(fm.navId2Hash(node.children('[id]').attr('id'))))
10248
- && compare(dir.name, info.name) < 0) {
10249
  return node;
10250
  }
10251
  node = node.next();
@@ -10262,16 +14678,19 @@ $.fn.elfindertree = function(fm, opts) {
10262
  updateTree = function(dirs) {
10263
  var length = dirs.length,
10264
  orphans = [],
10265
- i = dirs.length,
10266
- dir, html, parent, sibling, init, atonce = {}, base;
 
 
10267
 
10268
  var firstVol = true; // check for netmount volume
10269
  while (i--) {
10270
  dir = dirs[i];
10271
 
10272
- if ($('#'+fm.navHash2Id(dir.hash)).length) {
10273
  continue;
10274
  }
 
10275
 
10276
  if ((parent = findSubtree(dir.phash)).length) {
10277
  if (dir.phash && ((init = !parent.children().length) || (sibling = findSibling(parent, dir)).length)) {
@@ -10281,13 +14700,16 @@ $.fn.elfindertree = function(fm, opts) {
10281
  }
10282
  atonce[dir.phash].push(dir);
10283
  } else {
10284
- sibling.before(itemhtml(dir));
 
 
10285
  }
10286
  } else {
10287
- parent[firstVol || dir.phash ? 'append' : 'prepend'](itemhtml(dir));
 
10288
  firstVol = false;
10289
- if (!dir.phash) {
10290
- base = $('#'+fm.navHash2Id(dir.hash)).parent();
10291
  if (!dir.disabled || dir.disabled.length < 1) {
10292
  base.addClass(pastable+' '+uploadable);
10293
  } else {
@@ -10299,6 +14721,7 @@ $.fn.elfindertree = function(fm, opts) {
10299
  }
10300
  }
10301
  }
 
10302
  }
10303
  } else {
10304
  orphans.push(dir);
@@ -10315,16 +14738,16 @@ $.fn.elfindertree = function(fm, opts) {
10315
  html.push(itemhtml(d));
10316
  });
10317
  parent.append(html.join(''));
 
10318
  });
10319
  }
10320
 
10321
  if (orphans.length && orphans.length < length) {
10322
- return updateTree(orphans);
 
10323
  }
10324
 
10325
- if (length && !mobile) {
10326
- updateDroppable();
10327
- }
10328
 
10329
  },
10330
 
@@ -10333,7 +14756,20 @@ $.fn.elfindertree = function(fm, opts) {
10333
  *
10334
  */
10335
  compare = function(dir1, dir2) {
10336
- return fm.naturalCompare(dir1.name, dir2.name);
 
 
 
 
 
 
 
 
 
 
 
 
 
10337
  },
10338
 
10339
  /**
@@ -10341,20 +14777,35 @@ $.fn.elfindertree = function(fm, opts) {
10341
  *
10342
  * @return void
10343
  */
10344
- autoScroll = function() {
10345
- var current = $('#'+fm.navHash2Id(fm.cwd().hash));
10346
-
10347
- if (current.length) {
10348
- var parent = tree.parent().stop(false, true),
10349
- top = parent.offset().top,
10350
- treeH = parent.height(),
10351
- bottom = top + treeH - current.outerHeight(),
10352
- tgtTop = current.offset().top;
10353
 
10354
- if (tgtTop < top || tgtTop > bottom) {
10355
- parent.animate({ scrollTop : parent.scrollTop() + tgtTop - top - treeH / 3 }, { duration : 'fast' });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10356
  }
10357
- }
 
10358
  },
10359
 
10360
  /**
@@ -10364,12 +14815,64 @@ $.fn.elfindertree = function(fm, opts) {
10364
  * @param {Boolean} do not expand cwd
10365
  * @return void
10366
  */
10367
- sync = function(noCwd, dirs) {
10368
  var cwd = fm.cwd(),
10369
  cwdhash = cwd.hash,
10370
  current = $('#'+fm.navHash2Id(cwdhash)),
10371
  noCwd = noCwd || false,
10372
  dirs = dirs || [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10373
  rootNode, dir, link, subs, subsLen, cnt;
10374
 
10375
  if (openRoot) {
@@ -10384,48 +14887,97 @@ $.fn.elfindertree = function(fm, opts) {
10384
  }
10385
 
10386
  if (opts.syncTree || !current.length) {
10387
- if (current.length) {
10388
- if (!noCwd) {
10389
  current.addClass(loaded);
10390
  if (openCwd && current.hasClass(collapsed)) {
10391
  current.addClass(expanded).next('.'+subtree).slideDown();
10392
  }
10393
  }
10394
- subs = current.parentsUntil('.'+root).filter('.'+subtree);
10395
- subsLen = subs.length;
10396
- cnt = 1;
10397
- subs.show().prev(selNavdir).addClass(expanded, function(){
10398
- !noCwd && subsLen == cnt++ && autoScroll();
10399
- });
10400
- !subsLen && !noCwd && autoScroll();
 
 
10401
  return;
10402
  }
10403
  if (fm.newAPI) {
10404
  dir = fm.file(cwdhash);
10405
- if (dir && dir.phash) {
10406
  link = $('#'+fm.navHash2Id(dir.phash));
10407
  if (link.length && link.hasClass(loaded)) {
10408
- updateTree([dir]);
10409
- sync(noCwd);
 
 
10410
  return;
10411
  }
10412
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10413
  link = cwd.root? $('#'+fm.navHash2Id(cwd.root)) : null;
10414
  if (link) {
10415
  spinner.insertBefore(link.children('.'+arrow));
10416
  link.removeClass(collapsed);
10417
  }
10418
- fm.request({
10419
- data : {cmd : 'parents', target : cwdhash},
10420
- preventFail : true
10421
- })
10422
  .done(function(data) {
10423
- dirs = $.merge(dirs, filter(data.tree));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10424
  updateTree(dirs);
10425
  updateArrows(dirs, loaded);
10426
- cwdhash == fm.cwd().hash && sync(noCwd);
 
 
 
 
 
 
10427
  })
10428
- .always(function(data) {
10429
  if (link) {
10430
  spinner.remove();
10431
  link.addClass(collapsed+' '+loaded);
@@ -10441,13 +14993,20 @@ $.fn.elfindertree = function(fm, opts) {
10441
  *
10442
  * @return void
10443
  */
10444
- updateDroppable = function(target) {
10445
  var limit = 100,
10446
  next;
10447
 
10448
  if (!target) {
10449
- tree.find('div.'+uploadable).find(selNavdir+':not(.elfinder-ro,.elfinder-na)').addClass('native-droppable');
10450
- target = tree.find('div.'+pastable).find(selNavdir+':not(.'+droppable+',.elfinder-ro,.elfinder-na)');
 
 
 
 
 
 
 
10451
  }
10452
 
10453
  if (target.length > limit) {
@@ -10458,7 +15017,7 @@ $.fn.elfindertree = function(fm, opts) {
10458
  target.droppable(droppableopts);
10459
 
10460
  if (next) {
10461
- setTimeout(function(){
10462
  updateDroppable(next);
10463
  }, 20);
10464
  }
@@ -10481,7 +15040,9 @@ $.fn.elfindertree = function(fm, opts) {
10481
 
10482
  $.each(dirs, function(i, dir) {
10483
  $('#'+fm.navHash2Id(dir.phash)+sel)
10484
- .filter(function() { return $(this).next('.'+subtree).children().length > 0 })
 
 
10485
  .addClass(cls);
10486
  })
10487
  },
@@ -10504,9 +15065,25 @@ $.fn.elfindertree = function(fm, opts) {
10504
  link.toggleClass(hover, enter);
10505
  }
10506
  })
10507
- // add/remove dropover css class
10508
- .on('dropover dropout drop', selNavdir, function(e) {
10509
- $(this)[e.type == 'dropover' ? 'addClass' : 'removeClass'](dropover+' '+hover);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10510
  })
10511
  // open dir or open subfolders in tree
10512
  .on('click', selNavdir, function(e) {
@@ -10519,17 +15096,22 @@ $.fn.elfindertree = function(fm, opts) {
10519
  return;
10520
  }
10521
 
10522
- fm.trigger('searchend', { noupdate: true });
10523
-
10524
  if (hash != fm.cwd().hash && !link.hasClass(disabled)) {
10525
- fm.exec('open', hash);
10526
- } else if (link.hasClass(collapsed)) {
10527
- link.children('.'+arrow).click();
 
 
 
 
 
10528
  }
10529
  })
10530
  // for touch device
10531
  .on('touchstart', selNavdir, function(e) {
10532
- e.stopPropagation();
 
 
10533
  var evt = e.originalEvent,
10534
  p = $(this)
10535
  .addClass(hover)
@@ -10546,7 +15128,6 @@ $.fn.elfindertree = function(fm, opts) {
10546
  }, 500));
10547
  })
10548
  .on('touchmove touchend', selNavdir, function(e) {
10549
- e.stopPropagation();
10550
  clearTimeout($(this).data('tmlongtap'));
10551
  if (e.type == 'touchmove') {
10552
  $(this).removeClass(hover);
@@ -10557,28 +15138,33 @@ $.fn.elfindertree = function(fm, opts) {
10557
  var arrow = $(this),
10558
  link = arrow.parent(selNavdir),
10559
  stree = link.next('.'+subtree),
 
10560
  slideTH = 30, cnt;
10561
 
10562
  e.stopPropagation();
10563
 
10564
  if (link.hasClass(loaded)) {
10565
  link.toggleClass(expanded);
10566
- cnt = link.hasClass(expanded)? stree.children().length + stree.find('div.elfinder-navbar-subtree[style*=block]').children().length : stree.find('div:visible').length;
10567
- if (cnt > slideTH) {
10568
- stree.toggle();
10569
- fm.draggingUiHelper && fm.draggingUiHelper.data('refreshPositions', 1);
10570
- } else {
10571
- stree.stop(true, true).slideToggle('normal', function(){
10572
  fm.draggingUiHelper && fm.draggingUiHelper.data('refreshPositions', 1);
10573
- });
10574
- }
 
 
 
 
 
 
10575
  } else {
10576
  spinner.insertBefore(arrow);
10577
  link.removeClass(collapsed);
10578
 
10579
  fm.request({cmd : 'tree', target : fm.navId2Hash(link.attr('id'))})
10580
  .done(function(data) {
10581
- updateTree(filter(data.tree));
10582
 
10583
  if (stree.children().length) {
10584
  link.addClass(collapsed+' '+expanded);
@@ -10596,8 +15182,12 @@ $.fn.elfindertree = function(fm, opts) {
10596
  .always(function(data) {
10597
  spinner.remove();
10598
  link.addClass(loaded);
 
 
 
10599
  });
10600
  }
 
10601
  })
10602
  .on('contextmenu', selNavdir, function(e) {
10603
  var self = $(this);
@@ -10619,11 +15209,30 @@ $.fn.elfindertree = function(fm, opts) {
10619
  fm.bind('closecontextmenu', function() {
10620
  self.removeClass('ui-state-hover');
10621
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10622
  }),
10623
  // move tree into navbar
10624
- navbar = fm.getUI('navbar').append(tree).show()
10625
-
10626
- ;
 
 
 
10627
 
10628
  fm.open(function(e) {
10629
  var data = e.data,
@@ -10632,22 +15241,33 @@ $.fn.elfindertree = function(fm, opts) {
10632
 
10633
  data.init && tree.empty();
10634
 
 
 
 
 
 
10635
  if (dirs.length) {
10636
- if (!contextmenu.data('cmdMaps')) {
10637
- contextmenu.data('cmdMaps', {});
10638
- }
10639
- updateTree(dirs);
10640
- updateArrows(dirs, loaded);
10641
- // support volume driver option `uiCmdMap`
10642
- $.each(dirs, function(k, v){
10643
- if (v.volumeid) {
10644
- if (v.uiCmdMap && Object.keys(v.uiCmdMap).length && !contextmenu.data('cmdMaps')[v.volumeid]) {
10645
- contextmenu.data('cmdMaps')[v.volumeid] = v.uiCmdMap;
10646
- }
10647
  }
 
 
 
 
 
 
 
 
 
 
 
 
10648
  });
10649
- }
10650
- sync(false, dirs);
 
 
10651
  })
10652
  // add new dirs
10653
  .add(function(e) {
@@ -10663,11 +15283,13 @@ $.fn.elfindertree = function(fm, opts) {
10663
  var dirs = filter(e.data.changed),
10664
  length = dirs.length,
10665
  l = length,
10666
- dir, node, tmp, realParent, reqParent, realSibling, reqSibling, isExpanded, isLoaded;
 
10667
 
10668
  while (l--) {
10669
  dir = dirs[l];
10670
  if ((node = $('#'+fm.navHash2Id(dir.hash))).length) {
 
10671
  if (dir.phash) {
10672
  realParent = node.closest('.'+subtree);
10673
  reqParent = findSubtree(dir.phash);
@@ -10679,13 +15301,14 @@ $.fn.elfindertree = function(fm, opts) {
10679
  }
10680
 
10681
  if (reqParent[0] !== realParent[0] || realSibling.get(0) !== reqSibling.get(0)) {
10682
- reqSibling.length ? reqSibling.before(node) : reqParent.append(node);
10683
  }
10684
  }
10685
  isExpanded = node.hasClass(expanded);
10686
  isLoaded = node.hasClass(loaded);
10687
  tmp = $(itemhtml(dir));
10688
  node.replaceWith(tmp.children(selNavdir));
 
10689
 
10690
  if (dir.dirs
10691
  && (isExpanded || isLoaded)
@@ -10694,11 +15317,11 @@ $.fn.elfindertree = function(fm, opts) {
10694
  isExpanded && node.addClass(expanded);
10695
  isLoaded && node.addClass(loaded);
10696
  }
 
10697
  }
10698
  }
10699
 
10700
- sync();
10701
- length && !mobile && updateDroppable();
10702
  })
10703
  // remove dirs
10704
  .remove(function(e) {
@@ -10735,12 +15358,23 @@ $.fn.elfindertree = function(fm, opts) {
10735
  dir[lock ? 'addClass' : 'removeClass'](disabled);
10736
  }
10737
  });
 
 
 
 
 
 
 
 
 
 
 
10738
  });
10739
 
10740
  });
10741
 
10742
  return this;
10743
- }
10744
 
10745
 
10746
  /*
@@ -10776,7 +15410,7 @@ $.fn.elfinderuploadbutton = function(cmd) {
10776
  })
10777
  .change();
10778
  });
10779
- }
10780
 
10781
 
10782
  /*
@@ -10797,10 +15431,13 @@ $.fn.elfinderviewbutton = function(cmd) {
10797
  var icons = cmd.value == 'icons';
10798
 
10799
  icon.toggleClass('elfinder-button-icon-view-list', icons);
10800
- button.attr('title', cmd.fm.i18n(icons ? 'viewlist' : 'viewicons'));
 
 
10801
  });
10802
  });
10803
- }
 
10804
 
10805
  /*
10806
  * File: /js/ui/workzone.js
@@ -10816,26 +15453,36 @@ $.fn.elfinderworkzone = function(fm) {
10816
  this.not('.'+cl).each(function() {
10817
  var wz = $(this).addClass(cl),
10818
  wdelta = wz.outerHeight(true) - wz.height(),
10819
- parent = wz.parent();
10820
-
10821
- parent.add(window).on('resize', function() {
10822
- var height = parent.height();
10823
-
10824
- parent.children(':visible:not(.'+cl+')').each(function() {
10825
- var ch = $(this);
10826
-
10827
- if (ch.css('position') != 'absolute' && ch.css('position') != 'fixed') {
10828
- height -= ch.outerHeight(true);
10829
- }
10830
- });
 
 
 
 
10831
 
10832
- wz.height(height - wdelta);
10833
- });
 
 
 
 
 
 
 
 
10834
  });
10835
  return this;
10836
- }
10837
-
10838
-
10839
 
10840
 
10841
  /*
@@ -10856,7 +15503,7 @@ elFinder.prototype.commands.archive = function() {
10856
 
10857
  this.variants = [];
10858
 
10859
- this.disableOnSearch = true;
10860
 
10861
  /**
10862
  * Update mimes on open/reload
@@ -10871,23 +15518,33 @@ elFinder.prototype.commands.archive = function() {
10871
  self.change();
10872
  });
10873
 
10874
- this.getstate = function() {
10875
- return !this._disabled && mimes.length && (fm.selected().length || (dfrd && dfrd.state() == 'pending')) && fm.cwd().write ? 0 : -1;
 
 
 
 
 
 
 
 
 
 
10876
  }
10877
 
10878
  this.exec = function(hashes, type) {
10879
  var files = this.files(hashes),
10880
  cnt = files.length,
10881
  mime = type || mimes[0],
10882
- cwd = fm.cwd(),
10883
  error = ['errArchive', 'errPerm', 'errCreatingTempDir', 'errFtpDownloadFile', 'errFtpUploadFile', 'errFtpMkdir', 'errArchiveExec', 'errExtractExec', 'errRm'],
10884
- i, makeDfrd;
10885
 
10886
  dfrd = $.Deferred().fail(function(error) {
10887
  error && fm.error(error);
10888
  });
10889
 
10890
- if (!(this.enabled() && cnt && mimes.length && $.inArray(mime, mimes) !== -1)) {
10891
  return dfrd.reject();
10892
  }
10893
 
@@ -10902,14 +15559,26 @@ elFinder.prototype.commands.archive = function() {
10902
  }
10903
 
10904
  self.mime = mime;
10905
- self.prefix = ((cnt > 1)? 'Archive' : files[0].name) + '.' + fm.option('archivers')['createext'][mime];
10906
  self.data = {targets : self.hashes(hashes), type : mime};
10907
- makeDfrd = $.proxy(fm.res('mixin', 'make'), self)();
10908
- dfrd.reject();
10909
- return makeDfrd;
 
 
 
 
 
 
 
 
 
 
 
10910
  }
10911
 
10912
- }
 
10913
 
10914
  /*
10915
  * File: /js/commands/back.js
@@ -10921,7 +15590,7 @@ elFinder.prototype.commands.archive = function() {
10921
  *
10922
  * @author Dmitry (dio) Levashov
10923
  **/
10924
- elFinder.prototype.commands.back = function() {
10925
  this.alwaysEnabled = true;
10926
  this.updateOnSelect = false;
10927
  this.shortcuts = [{
@@ -10936,7 +15605,8 @@ elFinder.prototype.commands.back = function() {
10936
  return this.fm.history.back();
10937
  }
10938
 
10939
- }
 
10940
 
10941
  /*
10942
  * File: /js/commands/chmod.js
@@ -10951,7 +15621,6 @@ elFinder.prototype.commands.back = function() {
10951
  */
10952
  elFinder.prototype.commands.chmod = function() {
10953
  this.updateOnSelect = false;
10954
- var self = this;
10955
  var fm = this.fm,
10956
  level = {
10957
  0 : 'owner',
@@ -10993,7 +15662,7 @@ elFinder.prototype.commands.chmod = function() {
10993
  if (sel.length == 0) {
10994
  sel = [ fm.cwd().hash ];
10995
  }
10996
- return !this._disabled && self.checkstate(this.files(sel)) ? 0 : -1;
10997
  };
10998
 
10999
  this.checkstate = function(sel) {
@@ -11194,9 +15863,7 @@ elFinder.prototype.commands.chmod = function() {
11194
  title = tpl.groupTitle.replace('{items}', fm.i18n('items')).replace('{num}', cnt);
11195
  } else {
11196
  title = tpl.itemTitle.replace('{name}', file.name).replace('{kind}', fm.mime2kind(file));
11197
- if (file.tmb) {
11198
- tmb = fm.option('tmbUrl')+file.tmb;
11199
- }
11200
  }
11201
 
11202
  dataTable = makeDataTable(makeperm(files), files.length == 1? files[0] : {});
@@ -11209,15 +15876,15 @@ elFinder.prototype.commands.chmod = function() {
11209
  // load thumbnail
11210
  if (tmb) {
11211
  $('<img/>')
11212
- .on('load', function() { dialog.find('.elfinder-cwd-icon').css('background', 'url("'+tmb+'") center center no-repeat'); })
11213
- .attr('src', tmb);
11214
  }
11215
 
11216
  $('#' + id + '-table-perm :checkbox').on('click', function(){setperm('perm');});
11217
  $('#' + id + '-perm').on('keydown', function(e) {
11218
  var c = e.keyCode;
11219
  e.stopPropagation();
11220
- if (c == 13) {
11221
  save();
11222
  return;
11223
  }
@@ -11235,6 +15902,30 @@ elFinder.prototype.commands.chmod = function() {
11235
  };
11236
 
11237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11238
  /*
11239
  * File: /js/commands/copy.js
11240
  */
@@ -11256,7 +15947,7 @@ elFinder.prototype.commands.copy = function() {
11256
  var sel = this.files(sel),
11257
  cnt = sel.length;
11258
 
11259
- return !this._disabled && cnt && $.map(sel, function(f) { return f.phash && f.read ? f : null }).length == cnt ? 0 : -1;
11260
  }
11261
 
11262
  this.exec = function(hashes) {
@@ -11267,7 +15958,7 @@ elFinder.prototype.commands.copy = function() {
11267
  });
11268
 
11269
  $.each(this.files(hashes), function(i, file) {
11270
- if (!(file.read && file.phash)) {
11271
  return !dfrd.reject(['errCopy', file.name, 'errPerm']);
11272
  }
11273
  });
@@ -11275,7 +15966,8 @@ elFinder.prototype.commands.copy = function() {
11275
  return dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(fm.clipboard(this.hashes(hashes)));
11276
  }
11277
 
11278
- }
 
11279
 
11280
  /*
11281
  * File: /js/commands/cut.js
@@ -11289,6 +15981,7 @@ elFinder.prototype.commands.copy = function() {
11289
  * @author Dmitry (dio) Levashov
11290
  */
11291
  elFinder.prototype.commands.cut = function() {
 
11292
 
11293
  this.shortcuts = [{
11294
  pattern : 'ctrl+x shift+insert'
@@ -11298,18 +15991,17 @@ elFinder.prototype.commands.cut = function() {
11298
  var sel = this.files(sel),
11299
  cnt = sel.length;
11300
 
11301
- return !this._disabled && cnt && $.map(sel, function(f) { return f.phash && f.read && !f.locked ? f : null }).length == cnt ? 0 : -1;
11302
  }
11303
 
11304
  this.exec = function(hashes) {
11305
- var fm = this.fm,
11306
- dfrd = $.Deferred()
11307
  .fail(function(error) {
11308
  fm.error(error);
11309
  });
11310
 
11311
  $.each(this.files(hashes), function(i, file) {
11312
- if (!(file.read && file.phash) ) {
11313
  return !dfrd.reject(['errCopy', file.name, 'errPerm']);
11314
  }
11315
  if (file.locked) {
@@ -11320,7 +16012,8 @@ elFinder.prototype.commands.cut = function() {
11320
  return dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(fm.clipboard(this.hashes(hashes), true));
11321
  }
11322
 
11323
- }
 
11324
 
11325
  /*
11326
  * File: /js/commands/download.js
@@ -11333,25 +16026,82 @@ elFinder.prototype.commands.cut = function() {
11333
  *
11334
  * @author Dmitry (dio) Levashov, dio@std42.ru
11335
  **/
 
11336
  elFinder.prototype.commands.download = function() {
11337
  var self = this,
11338
  fm = this.fm,
11339
- filter = function(hashes) {
11340
- return $.map(self.files(hashes), function(f) { return f.mime == 'directory' ? null : f; });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11341
  };
11342
 
 
 
11343
  this.shortcuts = [{
11344
  pattern : 'shift+enter'
11345
  }];
11346
 
11347
- this.getstate = function() {
11348
- var sel = this.fm.selected(),
11349
- cnt = sel.length;
 
 
 
 
11350
 
11351
- return !this._disabled && cnt && ((!fm.UA.IE && !fm.UA.Mobile) || cnt == 1) && cnt == filter(sel).length ? 0 : -1;
 
 
 
 
 
11352
  };
11353
 
11354
- this.fm.bind('contextmenu', function(e){
11355
  var fm = self.fm,
11356
  helper = null,
11357
  targets, file, link,
@@ -11363,23 +16113,17 @@ elFinder.prototype.commands.download = function() {
11363
  .attr({href: link, target: '_blank', title: fm.i18n('link')})
11364
  .text(file.name)
11365
  .on('mousedown click touchstart touchmove touchend contextmenu', function(e){
11366
- var cm = fm.getUI('contextmenu');
11367
  e.stopPropagation();
11368
- // 'mouseEvInternal' for Firefox's bug (maybe)
11369
- cm.data('mouseEvInternal', true);
11370
- setTimeout(function(){
11371
- cm.data('mouseEvInternal', false);
11372
- }, 500);
11373
  })
11374
  .on('dragstart', function(e) {
11375
  var dt = e.dataTransfer || e.originalEvent.dataTransfer || null;
11376
  helper = null;
11377
  if (dt) {
11378
  var icon = function(f) {
11379
- var mime = f.mime, i;
11380
  i = '<div class="elfinder-cwd-icon '+fm.mime2class(mime)+' ui-corner-all"/>';
11381
- if (f.tmb && f.tmb !== 1) {
11382
- i = $(i).css('background', "url('"+fm.option('tmbUrl')+f.tmb+"') center center no-repeat").get(0).outerHTML;
11383
  }
11384
  return i;
11385
  };
@@ -11411,9 +16155,12 @@ elFinder.prototype.commands.download = function() {
11411
  self.extra = {
11412
  icon: 'link',
11413
  node: $('<a/>')
11414
- .attr({href: '#', title: fm.i18n('link'), draggable: 'false'})
11415
  .text(file.name)
11416
- .on('click', function(e){
 
 
 
11417
  var parent = node.parent();
11418
  e.stopPropagation();
11419
  e.preventDefault();
@@ -11423,10 +16170,10 @@ elFinder.prototype.commands.download = function() {
11423
  preventDefault : true
11424
  })
11425
  .always(function(data) {
 
11426
  if (data.url) {
11427
  var rfile = fm.file(file.hash);
11428
  rfile.url = data.url;
11429
- parent.removeClass('elfinder-button-icon-spinner');
11430
  node.replaceWith(getExtra(file).node);
11431
  } else {
11432
  parent.addClass('ui-state-disabled');
@@ -11438,7 +16185,7 @@ elFinder.prototype.commands.download = function() {
11438
  node = self.extra.node;
11439
  node.ready(function(){
11440
  setTimeout(function(){
11441
- node.parent().addClass('ui-state-disabled');
11442
  }, 10);
11443
  });
11444
  }
@@ -11446,58 +16193,164 @@ elFinder.prototype.commands.download = function() {
11446
  }
11447
  });
11448
 
11449
-
11450
  this.exec = function(hashes) {
11451
- var fm = this.fm,
 
11452
  base = fm.options.url,
11453
- files = filter(hashes),
11454
  dfrd = $.Deferred(),
11455
  iframes = '',
11456
  cdata = '',
11457
- i, url;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11458
 
11459
- if (this.disabled()) {
11460
  return dfrd.reject();
11461
  }
11462
 
11463
- var url,
11464
- link = $('<a>').hide().appendTo($('body')),
11465
- html5dl = (typeof link.get(0).download === 'string');
11466
- for (i = 0; i < files.length; i++) {
11467
- url = fm.openUrl(files[i].hash, true);
11468
- if (html5dl) {
11469
- link.attr('href', url)
11470
- .attr('download', files[i].name)
11471
- .attr('target', '_blank')
11472
- .get(0).click();
 
 
 
 
 
 
11473
  } else {
11474
- if (fm.UA.Mobile) {
11475
- setTimeout(function(){
11476
- if (! window.open(url)) {
11477
- fm.error('errPopup');
11478
- }
11479
- }, 100);
 
 
 
 
 
 
 
 
 
 
11480
  } else {
11481
- iframes += '<iframe class="downloader" id="downloader-' + files[i].hash+'" style="display:none" src="'+url+'"/>';
 
 
 
 
 
 
 
 
11482
  }
11483
  }
 
 
 
 
 
 
 
 
 
 
 
 
11484
  }
11485
- link.remove();
11486
- $(iframes)
11487
- .appendTo('body')
11488
- .ready(function() {
11489
- setTimeout(function() {
11490
- $(iframes).each(function() {
11491
- $('#' + $(this).attr('id')).remove();
11492
- });
11493
- }, fm.UA.Firefox? (20000 + (10000 * i)) : 1000); // give mozilla 20 sec + 10 sec for each file to be saved
11494
- });
11495
- fm.trigger('download', {files : files});
11496
- return dfrd.resolve(hashes);
11497
  };
11498
 
11499
  };
11500
 
 
11501
  /*
11502
  * File: /js/commands/duplicate.js
11503
  */
@@ -11516,7 +16369,7 @@ elFinder.prototype.commands.duplicate = function() {
11516
  var sel = this.files(sel),
11517
  cnt = sel.length;
11518
 
11519
- return !this._disabled && cnt && fm.cwd().write && $.map(sel, function(f) { return f.phash && f.read ? f : null }).length == cnt ? 0 : -1;
11520
  }
11521
 
11522
  this.exec = function(hashes) {
@@ -11529,7 +16382,7 @@ elFinder.prototype.commands.duplicate = function() {
11529
  }),
11530
  args = [];
11531
 
11532
- if (!cnt || this._disabled) {
11533
  return dfrd.reject();
11534
  }
11535
 
@@ -11546,11 +16399,25 @@ elFinder.prototype.commands.duplicate = function() {
11546
  return fm.request({
11547
  data : {cmd : 'duplicate', targets : this.hashes(hashes)},
11548
  notify : {type : 'copy', cnt : cnt}
 
 
 
 
 
 
 
 
 
 
 
 
 
11549
  });
11550
 
11551
  }
11552
 
11553
- }
 
11554
 
11555
  /*
11556
  * File: /js/commands/edit.js
@@ -11596,7 +16463,7 @@ elFinder.prototype.commands.edit = function() {
11596
  dialog = function(id, file, content) {
11597
 
11598
  var dfrd = $.Deferred(),
11599
- ta = $('<textarea class="elfinder-file-edit" rows="20" id="'+id+'-ta">'+fm.escape(content)+'</textarea>'),
11600
  old = ta.val(),
11601
  save = function() {
11602
  ta.editor && ta.editor.save(ta[0], ta.editor.instance);
@@ -11608,6 +16475,7 @@ elFinder.prototype.commands.edit = function() {
11608
  dfrd.reject();
11609
  ta.elfinderdialog('close');
11610
  };
 
11611
  ta.editor && ta.editor.save(ta[0], ta.editor.instance);
11612
  if (rtrim(old) !== rtrim(ta.val())) {
11613
  old = ta.val();
@@ -11638,6 +16506,7 @@ elFinder.prototype.commands.edit = function() {
11638
  title : fm.escape(file.name),
11639
  width : self.options.dialogWidth || 450,
11640
  buttons : {},
 
11641
  btnHoverFocus : false,
11642
  closeOnEscape : false,
11643
  close : function() {
@@ -11738,7 +16607,7 @@ elFinder.prototype.commands.edit = function() {
11738
  value, start;
11739
 
11740
  e.stopPropagation();
11741
- if (code == 9) {
11742
  e.preventDefault();
11743
  // insert tab on tab press
11744
  if (this.setSelectionRange) {
@@ -11752,11 +16621,11 @@ elFinder.prototype.commands.edit = function() {
11752
 
11753
  if (e.ctrlKey || e.metaKey) {
11754
  // close on ctrl+w/q
11755
- if (code == 81 || code == 87) {
11756
  e.preventDefault();
11757
  cancel();
11758
  }
11759
- if (code == 83) {
11760
  e.preventDefault();
11761
  save();
11762
  }
@@ -11769,7 +16638,11 @@ elFinder.prototype.commands.edit = function() {
11769
  opts.buttons[fm.i18n('btnSaveClose')] = savecl;
11770
  opts.buttons[fm.i18n('btnCancel')] = cancel;
11771
 
11772
- fm.dialog(ta, opts).attr('id', id);
 
 
 
 
11773
  return dfrd.promise();
11774
  },
11775
 
@@ -11880,10 +16753,6 @@ elFinder.prototype.commands.edit = function() {
11880
  list = [],
11881
  file;
11882
 
11883
- if (this.disabled()) {
11884
- return $.Deferred().reject();
11885
- }
11886
-
11887
  while ((file = files.shift())) {
11888
  list.push(edit(file));
11889
  }
@@ -11895,6 +16764,7 @@ elFinder.prototype.commands.edit = function() {
11895
 
11896
  };
11897
 
 
11898
  /*
11899
  * File: /js/commands/extract.js
11900
  */
@@ -11922,7 +16792,11 @@ elFinder.prototype.commands.extract = function() {
11922
  // Update mimes list on open/reload
11923
  fm.bind('open reload', function() {
11924
  mimes = fm.option('archivers')['extract'] || [];
11925
- self.variants = [['makedir', fm.i18n('cmdmkdir')], ['intohere', fm.i18n('btnCwd')]];
 
 
 
 
11926
  self.change();
11927
  });
11928
 
@@ -12093,34 +16967,80 @@ elFinder.prototype.commands.extract = function() {
12093
  return dfrd;
12094
  }
12095
 
12096
- }
 
12097
 
12098
  /*
12099
  * File: /js/commands/forward.js
12100
  */
12101
 
12102
  /**
12103
- * @class elFinder command "forward"
12104
- * Open next visited folder
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12105
  *
12106
- * @author Dmitry (dio) Levashov
12107
  **/
12108
- elFinder.prototype.commands.forward = function() {
12109
- this.alwaysEnabled = true;
12110
- this.updateOnSelect = true;
12111
- this.shortcuts = [{
12112
- pattern : 'ctrl+right'
12113
- }];
12114
-
 
 
 
 
 
 
 
 
 
 
 
12115
  this.getstate = function() {
12116
- return this.fm.history.canForward() ? 0 : -1;
12117
  }
12118
 
12119
  this.exec = function() {
12120
- return this.fm.history.forward();
12121
- }
 
 
12122
 
12123
- }
 
 
 
 
12124
 
12125
  /*
12126
  * File: /js/commands/getfile.js
@@ -12133,14 +17053,14 @@ elFinder.prototype.commands.forward = function() {
12133
  *
12134
  * @author Dmitry (dio) Levashov, dio@std42.ru
12135
  **/
12136
- elFinder.prototype.commands.getfile = function() {
12137
  var self = this,
12138
  fm = this.fm,
12139
  filter = function(files) {
12140
  var o = self.options;
12141
 
12142
  files = $.map(files, function(file) {
12143
- return file.mime != 'directory' || o.folders ? file : null;
12144
  });
12145
 
12146
  return o.multiple || files.length == 1 ? files : [];
@@ -12166,13 +17086,26 @@ elFinder.prototype.commands.getfile = function() {
12166
  tmb = fm.option('tmbUrl'),
12167
  dfrd = $.Deferred()
12168
  .done(function(data) {
 
 
 
 
 
 
 
 
 
12169
  fm.trigger('getfile', {files : data});
12170
- self.callback(data, fm);
12171
 
12172
- if (opts.oncomplete == 'close') {
12173
- fm.hide();
12174
- } else if (opts.oncomplete == 'destroy') {
12175
- fm.destroy();
 
 
 
 
 
12176
  }
12177
  }),
12178
  result = function(file) {
@@ -12183,10 +17116,6 @@ elFinder.prototype.commands.getfile = function() {
12183
  req = [],
12184
  i, file, dim;
12185
 
12186
- if (this.getstate(hashes) == -1) {
12187
- return dfrd.reject();
12188
- }
12189
-
12190
  for (i = 0; i < cnt; i++) {
12191
  file = files[i];
12192
  if (file.mime == 'directory' && !opts.folders) {
@@ -12208,29 +17137,50 @@ elFinder.prototype.commands.getfile = function() {
12208
  } else {
12209
  file.url = fm.url(file.hash);
12210
  }
12211
- file.path = fm.path(file.hash);
12212
- if (file.tmb && file.tmb != 1) {
12213
- file.tmb = tmb + file.tmb;
12214
- }
12215
- if (!file.width && !file.height) {
12216
- if (file.dim) {
12217
- dim = file.dim.split('x');
12218
- file.width = dim[0];
12219
- file.height = dim[1];
12220
- } else if (file.mime.indexOf('image') !== -1) {
12221
- req.push(fm.request({
12222
- data : {cmd : 'dim', target : file.hash},
12223
- notify : {type : 'dim', cnt : 1, hideCnt : true},
12224
- preventDefault : true
12225
- })
12226
- .done(function(data) {
12227
- if (data.dim) {
12228
- var dim = data.dim.split('x');
12229
- var rfile = fm.file(this.hash);
12230
- rfile.width = this.width = dim[0];
12231
- rfile.height = this.height = dim[1];
12232
- }
12233
- }.bind(file)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12234
  }
12235
  }
12236
  }
@@ -12245,7 +17195,8 @@ elFinder.prototype.commands.getfile = function() {
12245
  return dfrd.resolve(result(files));
12246
  }
12247
 
12248
- }
 
12249
 
12250
  /*
12251
  * File: /js/commands/help.js
@@ -12257,7 +17208,7 @@ elFinder.prototype.commands.getfile = function() {
12257
  *
12258
  * @author Dmitry (dio) Levashov
12259
  **/
12260
- elFinder.prototype.commands.help = function() {
12261
  var fm = this.fm,
12262
  self = this,
12263
  linktpl = '<div class="elfinder-help-link"> <a href="{url}">{link}</a></div>',
@@ -12271,7 +17222,7 @@ elFinder.prototype.commands.help = function() {
12271
  prim = 'ui-priority-primary',
12272
  sec = 'ui-priority-secondary',
12273
  lic = 'elfinder-help-license',
12274
- tab = '<li class="ui-state-default ui-corner-top"><a href="#{id}">{title}</a></li>',
12275
  html = ['<div class="ui-tabs ui-widget ui-widget-content ui-corner-all elfinder-help">',
12276
  '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'],
12277
  stpl = '<div class="elfinder-help-shortcut"><div class="elfinder-help-shortcut-pattern">{pattern}</div> {descrip}</div>',
@@ -12279,10 +17230,10 @@ elFinder.prototype.commands.help = function() {
12279
 
12280
 
12281
  about = function() {
12282
- html.push('<div id="about" class="ui-tabs-panel ui-widget-content ui-corner-bottom"><div class="elfinder-help-logo"/>');
12283
  html.push('<h3>elFinder</h3>');
12284
  html.push('<div class="'+prim+'">'+fm.i18n('webfm')+'</div>');
12285
- html.push('<div class="'+sec+'">'+fm.i18n('ver')+': '+fm.version+', '+fm.i18n('protocolver')+': <span id="apiver"></span></div>');
12286
  html.push('<div class="'+sec+'">jQuery/jQuery UI: '+$().jquery+'/'+$.ui.version+'</div>');
12287
 
12288
  html.push(sep);
@@ -12301,21 +17252,25 @@ elFinder.prototype.commands.help = function() {
12301
  html.push(atpl[r](author, 'Alexey Sukhotin &lt;strogg@yandex.ru&gt;')[r](work, fm.i18n('contributor')));
12302
  html.push(atpl[r](author, 'Naoki Sawada &lt;hypweb@gmail.com&gt;')[r](work, fm.i18n('contributor')));
12303
 
12304
- fm.i18[fm.lang].translator && html.push(atpl[r](author, fm.i18[fm.lang].translator)[r](work, fm.i18n('translator')+' ('+fm.i18[fm.lang].language+')'));
 
 
 
 
12305
 
12306
  html.push(sep);
12307
  html.push('<div class="'+lic+'">'+fm.i18n('icons')+': Pixelmixer, <a href="http://p.yusukekamiyamane.com" target="_blank">Fugue</a></div>');
12308
 
12309
  html.push(sep);
12310
  html.push('<div class="'+lic+'">Licence: BSD Licence</div>');
12311
- html.push('<div class="'+lic+'">Copyright © 2009-2015, Studio 42</div>');
12312
  html.push('<div class="'+lic+'">„ …'+fm.i18n('dontforget')+' ”</div>');
12313
  html.push('</div>');
12314
  },
12315
  shortcuts = function() {
12316
  var sh = fm.shortcuts();
12317
  // shortcuts tab
12318
- html.push('<div id="shortcuts" class="ui-tabs-panel ui-widget-content ui-corner-bottom">');
12319
 
12320
  if (sh.length) {
12321
  html.push('<div class="ui-widget-content elfinder-help-shortcuts">');
@@ -12334,27 +17289,81 @@ elFinder.prototype.commands.help = function() {
12334
  },
12335
  help = function() {
12336
  // help tab
12337
- html.push('<div id="help" class="ui-tabs-panel ui-widget-content ui-corner-bottom">');
12338
- html.push('<a href="http://elfinder.org/forum/" target="_blank" class="elfinder-dont-panic"><span>DON\'T PANIC</span></a>');
12339
  html.push('</div>');
12340
  // end help
12341
  },
12342
- content = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12343
 
12344
  this.alwaysEnabled = true;
12345
  this.updateOnSelect = false;
12346
- this.state = 0;
12347
 
12348
  this.shortcuts = [{
12349
  pattern : 'f1',
12350
  description : this.title
12351
  }];
12352
 
12353
- setTimeout(function() {
12354
- var parts = self.options.view || ['about', 'shortcuts', 'help'];
 
12355
 
12356
  $.each(parts, function(i, title) {
12357
- html.push(tab[r](/\{id\}/, title)[r](/\{title\}/, fm.i18n(title)));
12358
  });
12359
 
12360
  html.push('</ul>');
@@ -12362,6 +17371,7 @@ elFinder.prototype.commands.help = function() {
12362
  $.inArray('about', parts) !== -1 && about();
12363
  $.inArray('shortcuts', parts) !== -1 && shortcuts();
12364
  $.inArray('help', parts) !== -1 && help();
 
12365
 
12366
  html.push('</div>');
12367
  content = $(html.join(''));
@@ -12379,28 +17389,45 @@ elFinder.prototype.commands.help = function() {
12379
 
12380
  if (!link.hasClass('ui-tabs-selected')) {
12381
  link.parent().addClass('ui-tabs-selected ui-state-active').siblings().removeClass('ui-tabs-selected').removeClass('ui-state-active');
12382
- content.find('.ui-tabs-panel').hide().filter(link.attr('href')).show();
12383
  }
12384
 
12385
  })
12386
  .filter(':first').click();
12387
 
12388
- }, 200);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12389
 
12390
  this.getstate = function() {
12391
  return 0;
12392
  };
12393
 
12394
  this.exec = function() {
12395
- if (!this.dialog) {
12396
- content.find('#apiver').text(this.fm.api);
12397
- this.dialog = this.fm.dialog(content, {title : this.title, width : 530, autoOpen : false, destroyOnClose : false});
12398
- }
12399
-
12400
  this.dialog.elfinderdialog('open').find('.ui-tabs-nav li a:first').click();
12401
  };
12402
 
12403
- };
12404
 
12405
 
12406
  /*
@@ -12408,7 +17435,7 @@ elFinder.prototype.commands.help = function() {
12408
  */
12409
 
12410
 
12411
- elFinder.prototype.commands.home = function() {
12412
  this.title = 'Home';
12413
  this.alwaysEnabled = true;
12414
  this.updateOnSelect = false;
@@ -12429,7 +17456,8 @@ elFinder.prototype.commands.home = function() {
12429
  }
12430
 
12431
 
12432
- }
 
12433
 
12434
  /*
12435
  * File: /js/commands/info.js
@@ -12441,10 +17469,11 @@ elFinder.prototype.commands.home = function() {
12441
  *
12442
  * @author Dmitry (dio) Levashov, dio@std42.ru
12443
  **/
12444
- elFinder.prototype.commands.info = function() {
12445
  var m = 'msg',
12446
  fm = this.fm,
12447
  spclass = 'elfinder-info-spinner',
 
12448
  msg = {
12449
  calc : fm.i18n('calc'),
12450
  size : fm.i18n('size'),
@@ -12458,17 +17487,19 @@ elFinder.prototype.commands.info = function() {
12458
  kind : fm.i18n('kind'),
12459
  files : fm.i18n('files'),
12460
  folders : fm.i18n('folders'),
 
12461
  items : fm.i18n('items'),
12462
  yes : fm.i18n('yes'),
12463
  no : fm.i18n('no'),
12464
  link : fm.i18n('link'),
12465
  owner : fm.i18n('owner'),
12466
  group : fm.i18n('group'),
12467
- perm : fm.i18n('perm')
 
12468
  };
12469
 
12470
  this.tpl = {
12471
- main : '<div class="ui-helper-clearfix elfinder-info-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}</div><table class="elfinder-info-tb">{content}</table>',
12472
  itemTitle : '<strong>{name}</strong><span class="elfinder-info-kind">{kind}</span>',
12473
  groupTitle : '<strong>{items}: {num}</strong>',
12474
  row : '<tr><td>{label} : </td><td>{value}</td></tr>',
@@ -12506,17 +17537,132 @@ elFinder.prototype.commands.info = function() {
12506
  view = tpl.main,
12507
  l = '{label}',
12508
  v = '{value}',
 
12509
  opts = {
12510
  title : this.title,
12511
  width : 'auto',
12512
- close : function() { $(this).elfinderdialog('destroy'); }
 
 
 
 
 
 
 
 
 
12513
  },
12514
  count = [],
12515
  replSpinner = function(msg, name) { dialog.find('.'+spclass+'-'+name).parent().html(msg); },
12516
  id = fm.namespace+'-info-'+$.map(files, function(f) { return f.hash; }).join('-'),
12517
  dialog = fm.getUI().find('#'+id),
12518
  customActions = [],
12519
- size, tmb, file, title, dcnt;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12520
 
12521
  if (!cnt) {
12522
  return $.Deferred().reject();
@@ -12531,12 +17677,10 @@ elFinder.prototype.commands.info = function() {
12531
  if (cnt == 1) {
12532
  file = files[0];
12533
 
12534
- view = view.replace('{class}', fm.mime2class(file.mime));
12535
- title = tpl.itemTitle.replace('{name}', fm.escape(file.i18 || file.name)).replace('{kind}', fm.mime2kind(file));
12536
 
12537
- if (file.tmb) {
12538
- tmb = fm.option('tmbUrl')+file.tmb;
12539
- }
12540
 
12541
  if (!file.read) {
12542
  size = msg.unknown;
@@ -12549,26 +17693,23 @@ elFinder.prototype.commands.info = function() {
12549
 
12550
  content.push(row.replace(l, msg.size).replace(v, size));
12551
  file.alias && content.push(row.replace(l, msg.aliasfor).replace(v, file.alias));
12552
- content.push(row.replace(l, msg.path).replace(v, fm.escape(fm.path(file.hash, true))));
 
 
 
 
 
 
 
 
 
 
 
12553
  if (file.read) {
12554
  var href,
12555
  name_esc = fm.escape(file.name);
12556
  if (file.url == '1') {
12557
- content.push(row.replace(l, msg.link).replace(v, tpl.spinner.replace('{text}', msg.modify).replace('{name}', 'url')));
12558
- fm.request({
12559
- data : {cmd : 'url', target : file.hash},
12560
- preventDefault : true
12561
- })
12562
- .fail(function() {
12563
- replSpinner(name_esc, 'url');
12564
- })
12565
- .done(function(data) {
12566
- replSpinner('<a href="'+data.url+'" target="_blank">'+name_esc+'</a>' || name_esc, 'url');
12567
- if (data.url) {
12568
- var rfile = fm.file(file.hash);
12569
- rfile.url = data.url;
12570
- }
12571
- });
12572
  } else {
12573
  if (o.nullUrlDirLinkSelf && file.mime == 'directory' && file.url === null) {
12574
  var loc = window.location;
@@ -12587,7 +17728,7 @@ elFinder.prototype.commands.info = function() {
12587
  content.push(row.replace(l, msg.dim).replace(v, file.width+'x'+file.height));
12588
  } else {
12589
  content.push(row.replace(l, msg.dim).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'dim')));
12590
- fm.request({
12591
  data : {cmd : 'dim', target : file.hash},
12592
  preventDefault : true
12593
  })
@@ -12602,7 +17743,7 @@ elFinder.prototype.commands.info = function() {
12602
  rfile.width = dim[0];
12603
  rfile.height = dim[1];
12604
  }
12605
- });
12606
  }
12607
  }
12608
 
@@ -12649,7 +17790,9 @@ elFinder.prototype.commands.info = function() {
12649
  content.push(row.replace(l, msg.kind).replace(v, msg.files));
12650
  content.push(row.replace(l, msg.size).replace(v, fm.formatSize(size)));
12651
  } else {
12652
- content.push(row.replace(l, msg.kind).replace(v, dcnt == cnt ? msg.folders : msg.folders+' '+dcnt+', '+msg.files+' '+(cnt-dcnt)));
 
 
12653
  content.push(row.replace(l, msg.size).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'size')));
12654
  count = $.map(files, function(f) { return f.hash; });
12655
 
@@ -12661,26 +17804,38 @@ elFinder.prototype.commands.info = function() {
12661
  dialog = fm.dialog(view, opts);
12662
  dialog.attr('id', id);
12663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12664
  // load thumbnail
12665
  if (tmb) {
12666
  $('<img/>')
12667
- .load(function() { dialog.find('.elfinder-cwd-icon').css('background', 'url("'+tmb+'") center center no-repeat'); })
12668
- .attr('src', tmb);
12669
  }
12670
 
12671
  // send request to count total size
12672
  if (count.length) {
12673
- fm.request({
12674
- data : {cmd : 'size', targets : count},
12675
- preventDefault : true
12676
- })
12677
- .fail(function() {
12678
- replSpinner(msg.unknown, 'size');
12679
- })
12680
- .done(function(data) {
12681
- var size = parseInt(data.size);
12682
- replSpinner(size >= 0 ? fm.formatSize(size) : msg.unknown, 'size');
12683
- });
12684
  }
12685
 
12686
  // call custom actions
@@ -12696,7 +17851,7 @@ elFinder.prototype.commands.info = function() {
12696
 
12697
  };
12698
 
12699
- };
12700
 
12701
 
12702
  /*
@@ -12710,21 +17865,55 @@ elFinder.prototype.commands.info = function() {
12710
  * @author Dmitry (dio) Levashov
12711
  **/
12712
  elFinder.prototype.commands.mkdir = function() {
 
 
 
 
 
12713
  this.disableOnSearch = true;
12714
  this.updateOnSelect = false;
12715
  this.mime = 'directory';
12716
  this.prefix = 'untitled folder';
12717
- this.exec = $.proxy(this.fm.res('mixin', 'make'), this);
 
 
 
 
 
 
 
12718
 
12719
  this.shortcuts = [{
12720
  pattern : 'ctrl+shift+n'
12721
  }];
 
 
 
 
 
 
12722
 
12723
- this.getstate = function() {
12724
- return !this._disabled && this.fm.cwd().write ? 0 : -1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12725
  }
12726
 
12727
- }
12728
 
12729
 
12730
  /*
@@ -12748,7 +17937,7 @@ elFinder.prototype.commands.mkfile = function() {
12748
  return !this._disabled && this.fm.cwd().write ? 0 : -1;
12749
  }
12750
 
12751
- }
12752
 
12753
 
12754
  /*
@@ -12762,7 +17951,8 @@ elFinder.prototype.commands.mkfile = function() {
12762
  * @author Dmitry (dio) Levashov
12763
  **/
12764
  elFinder.prototype.commands.netmount = function() {
12765
- var self = this;
 
12766
 
12767
  this.alwaysEnabled = true;
12768
  this.updateOnSelect = false;
@@ -12784,45 +17974,61 @@ elFinder.prototype.commands.netmount = function() {
12784
  dfrd = $.Deferred(),
12785
  o = self.options,
12786
  create = function() {
12787
- var inputs = {
12788
- protocol : $('<select/>').change(function(){
 
 
 
12789
  var protocol = this.value;
12790
  content.find('.elfinder-netmount-tr').hide();
12791
  content.find('.elfinder-netmount-tr-'+protocol).show();
 
12792
  if (typeof o[protocol].select == 'function') {
12793
- o[protocol].select(fm);
12794
  }
 
 
 
12795
  })
 
12796
  },
12797
  opts = {
12798
  title : fm.i18n('netMountDialogTitle'),
12799
  resizable : false,
12800
  modal : true,
12801
  destroyOnClose : true,
 
 
 
 
12802
  close : function() {
12803
- delete self.dialog;
12804
  dfrd.state() == 'pending' && dfrd.reject();
 
12805
  },
12806
  buttons : {}
12807
  },
12808
- content = $('<table class="elfinder-info-tb elfinder-netmount-tb"/>'),
12809
  hidden = $('<div/>'),
12810
  dialog;
12811
 
12812
- content.append($('<tr/>').append($('<td>'+fm.i18n('protocol')+'</td>')).append($('<td/>').append(inputs.protocol)));
 
12813
 
12814
  $.each(self.drivers, function(i, protocol) {
12815
- inputs.protocol.append('<option value="'+protocol+'">'+fm.i18n(protocol)+'</option>');
12816
- $.each(o[protocol].inputs, function(name, input) {
12817
- input.attr('name', name);
12818
- if (input.attr('type') != 'hidden') {
12819
- input.addClass('ui-corner-all elfinder-netmount-inputs-'+protocol);
12820
- content.append($('<tr/>').addClass('elfinder-netmount-tr elfinder-netmount-tr-'+protocol).append($('<td>'+fm.i18n(name)+'</td>')).append($('<td/>').append(input)));
12821
- } else {
12822
- input.addClass('elfinder-netmount-inputs-'+protocol);
12823
- hidden.append(input);
12824
- }
12825
- });
 
 
 
12826
  });
12827
 
12828
  content.append(hidden);
@@ -12830,8 +18036,9 @@ elFinder.prototype.commands.netmount = function() {
12830
  content.find('.elfinder-netmount-tr').hide();
12831
 
12832
  opts.buttons[fm.i18n('btnMount')] = function() {
12833
- var protocol = inputs.protocol.val();
12834
- var data = {cmd : 'netmount', protocol: protocol};
 
12835
  $.each(content.find('input.elfinder-netmount-inputs-'+protocol), function(name, input) {
12836
  var val;
12837
  if (typeof input.val == 'function') {
@@ -12850,43 +18057,70 @@ elFinder.prototype.commands.netmount = function() {
12850
 
12851
  fm.request({data : data, notify : {type : 'netmount', cnt : 1, hideCnt : true}})
12852
  .done(function(data) {
12853
- data.added && data.added.length && fm.exec('open', data.added[0].hash);
 
 
 
 
 
 
 
 
 
 
 
 
 
12854
  dfrd.resolve();
12855
  })
12856
- .fail(function(error) { dfrd.reject(error); });
 
 
 
 
 
 
12857
 
12858
- self.dialog.elfinderdialog('close');
12859
  };
12860
 
12861
  opts.buttons[fm.i18n('btnCancel')] = function() {
12862
  self.dialog.elfinderdialog('close');
12863
  };
12864
 
 
 
12865
  dialog = fm.dialog(content, opts);
 
12866
  dialog.ready(function(){
12867
  inputs.protocol.change();
12868
  dialog.elfinderdialog('posInit');
12869
  });
12870
  return dialog;
12871
- }
12872
- ;
12873
 
12874
- fm.bind('netmount', function(e) {
12875
- var d = e.data || null;
12876
- if (d && d.protocol) {
12877
- if (o[d.protocol] && typeof o[d.protocol].done == 'function') {
12878
- o[d.protocol].done(fm, d);
12879
- }
12880
- }
12881
- });
12882
-
12883
  if (!self.dialog) {
12884
  self.dialog = create();
 
 
12885
  }
12886
 
12887
  return dfrd.promise();
12888
  }
12889
 
 
 
 
 
 
 
 
 
 
 
 
 
12890
  }
12891
 
12892
  elFinder.prototype.commands.netunmount = function() {
@@ -12928,6 +18162,9 @@ elFinder.prototype.commands.netunmount = function() {
12928
  accept : {
12929
  label : 'btnUnmount',
12930
  callback : function() {
 
 
 
12931
  fm.request({
12932
  data : {cmd : 'netmount', protocol : 'netunmount', host: drive.netkey, user : drive.hash, pass : 'dum'},
12933
  notify : {type : 'netunmount', cnt : 1, hideCnt : true},
@@ -12937,17 +18174,20 @@ elFinder.prototype.commands.netunmount = function() {
12937
  dfrd.reject(error);
12938
  })
12939
  .done(function(data) {
12940
- var chDrive = (fm.root() == drive.hash);
12941
- data.removed = [ drive.hash ];
12942
- fm.remove(data);
12943
  if (chDrive) {
12944
- var files = fm.files();
12945
- for (var i in files) {
12946
- if (fm.file(i).mime == 'directory') {
12947
- fm.exec('open', i);
12948
- break;
 
 
 
 
12949
  }
12950
  }
 
12951
  }
12952
  dfrd.resolve();
12953
  });
@@ -12976,7 +18216,7 @@ elFinder.prototype.commands.netunmount = function() {
12976
  *
12977
  * @author Dmitry (dio) Levashov
12978
  **/
12979
- elFinder.prototype.commands.open = function() {
12980
  this.alwaysEnabled = true;
12981
 
12982
  this._handlers = {
@@ -12993,8 +18233,8 @@ elFinder.prototype.commands.open = function() {
12993
  cnt = sel.length;
12994
 
12995
  return cnt == 1
12996
- ? 0
12997
- : (cnt && !this.fm.UA.Mobile) ? ($.map(sel, function(file) { return file.mime == 'directory' ? null : file}).length == cnt ? 0 : -1) : -1
12998
  }
12999
 
13000
  this.exec = function(hashes, opts) {
@@ -13003,6 +18243,7 @@ elFinder.prototype.commands.open = function() {
13003
  files = this.files(hashes),
13004
  cnt = files.length,
13005
  thash = (typeof opts == 'object')? opts.thash : false,
 
13006
  file, url, s, w, imgW, imgH, winW, winH, reg, link, html5dl, inline;
13007
 
13008
  if (!cnt && !thash) {
@@ -13018,7 +18259,8 @@ elFinder.prototype.commands.open = function() {
13018
  : fm.request({
13019
  data : {cmd : 'open', target : thash || file.hash},
13020
  notify : {type : 'open', cnt : 1, hideCnt : true},
13021
- syncOnFail : true
 
13022
  });
13023
  }
13024
 
@@ -13029,101 +18271,133 @@ elFinder.prototype.commands.open = function() {
13029
  return dfrd.reject();
13030
  }
13031
 
13032
-
13033
- try {
13034
- reg = new RegExp(fm.option('dispInlineRegex'));
13035
- } catch(e) {
13036
- reg = false;
13037
- }
13038
-
13039
- // open files
13040
- link = $('<a>').hide().appendTo($('body')),
13041
- html5dl = (typeof link.get(0).download === 'string');
13042
- cnt = files.length;
13043
- while (cnt--) {
13044
- file = files[cnt];
13045
-
13046
- if (!file.read) {
13047
- return dfrd.reject(['errOpen', file.name, 'errPerm']);
13048
- }
13049
-
13050
- inline = (reg && file.mime.match(reg));
13051
- url = fm.openUrl(file.hash, !inline);
13052
- if (fm.UA.Mobile || !inline) {
13053
- if (html5dl) {
13054
- !inline && link.attr('download', file.name);
13055
- link.attr('href', url)
13056
- .attr('target', '_blank')
13057
- .get(0).click();
13058
- } else {
13059
- var wnd = window.open(url);
13060
- if (!wnd) {
13061
- return dfrd.reject('errPopup');
13062
- }
13063
  }
13064
- } else {
13065
 
13066
- // set window size for image if set
13067
- imgW = winW = Math.round(2 * $(window).width() / 3);
13068
- imgH = winH = Math.round(2 * $(window).height() / 3);
13069
- if (parseInt(file.width) && parseInt(file.height)) {
13070
- imgW = parseInt(file.width);
13071
- imgH = parseInt(file.height);
13072
- } else if (file.dim) {
13073
- s = file.dim.split('x');
13074
- imgW = parseInt(s[0]);
13075
- imgH = parseInt(s[1]);
13076
- }
13077
- if (winW >= imgW && winH >= imgH) {
13078
- winW = imgW;
13079
- winH = imgH;
13080
  } else {
13081
- if ((imgW - winW) > (imgH - winH)) {
13082
- winH = Math.round(imgH * (winW / imgW));
 
 
 
 
 
 
 
 
 
 
 
 
 
13083
  } else {
13084
- winW = Math.round(imgW * (winH / imgH));
 
 
 
 
13085
  }
13086
- }
13087
- w = 'width='+winW+',height='+winH;
13088
-
13089
- if (url.indexOf(fm.options.url) === 0) {
13090
- url = '';
13091
- }
13092
- var wnd = window.open(url, 'new_window', w + ',top=50,left=50,scrollbars=yes,resizable=yes');
13093
- if (!wnd) {
13094
- return dfrd.reject('errPopup');
13095
- }
13096
-
13097
- if (url === '') {
13098
- var form = document.createElement("form");
13099
- form.action = fm.options.url;
13100
- form.method = 'POST';
13101
- form.target = 'new_window';
13102
- form.style.display = 'none';
13103
- var params = $.extend({}, fm.options.customData, {
13104
- cmd: 'file',
13105
- target: file.hash
13106
- });
13107
- $.each(params, function(key, val)
13108
- {
13109
- var input = document.createElement("input");
13110
- input.name = key;
13111
- input.value = val;
13112
- form.appendChild(input);
13113
- });
 
 
 
 
13114
 
13115
- document.body.appendChild(form);
13116
- form.submit();
13117
  }
13118
- wnd.focus();
13119
-
13120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13121
  }
13122
- link.remove();
13123
- return dfrd.resolve(hashes);
13124
  }
13125
 
13126
- }
 
13127
 
13128
  /*
13129
  * File: /js/commands/opendir.js
@@ -13141,12 +18415,12 @@ elFinder.prototype.commands.opendir = function() {
13141
  this.getstate = function() {
13142
  var sel = this.fm.selected(),
13143
  cnt = sel.length,
13144
- cwdWrapper;
13145
  if (cnt !== 1) {
13146
  return -1;
13147
  }
13148
- cwdWrapper = this.fm.getUI('cwd').parent();
13149
- return cwdWrapper.hasClass('elfinder-search-result')? 0 : -1;
13150
  }
13151
 
13152
  this.exec = function(hashes) {
@@ -13161,28 +18435,17 @@ elFinder.prototype.commands.opendir = function() {
13161
  }
13162
 
13163
  hash = files[0].phash;
13164
- if (!fm.file(hash)) {
13165
- // parents check
13166
- pcheck = fm.request({
13167
- data : {cmd : 'parents', target : hash},
13168
- syncOnFail : false
13169
- });
13170
- }
13171
- // open folder
13172
- $.when(pcheck)
13173
- .done(function(data){
13174
- fm.trigger('searchend', { noupdate: true });
13175
- fm.request({
13176
- data : {cmd : 'open', target : hash},
13177
- notify : {type : 'open', cnt : 1, hideCnt : true},
13178
- syncOnFail : false
13179
- });
13180
  });
13181
 
13182
  return dfrd;
13183
  }
13184
 
13185
- }
13186
 
13187
 
13188
  /*
@@ -13251,6 +18514,7 @@ elFinder.prototype.commands.paste = function() {
13251
  paste = function(files) {
13252
  var dfrd = $.Deferred(),
13253
  existed = [],
 
13254
  intersect = function(files, names) {
13255
  var ret = [],
13256
  i = files.length;
@@ -13328,7 +18592,43 @@ elFinder.prototype.commands.paste = function() {
13328
  })
13329
  },
13330
  valid = function(names) {
13331
- existed = intersect(files, names);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13332
  existed.length ? confirm(0) : paste(files);
13333
  },
13334
  paste = function(files) {
@@ -13349,32 +18649,52 @@ elFinder.prototype.commands.paste = function() {
13349
  }
13350
 
13351
  src = files[0].phash;
13352
- files = $.map(files, function(f) { return f.hash});
13353
 
13354
  fm.request({
13355
- data : {cmd : 'paste', dst : dst.hash, targets : files, cut : cut ? 1 : 0, src : src, renames : renames, suffix : fm.options.backupSuffix},
13356
  notify : {type : cut ? 'move' : 'copy', cnt : cnt}
13357
  })
13358
  .done(function(data) {
 
13359
  dfrd.resolve(data);
13360
  if (data && data.added && data.added[0]) {
13361
- var newItem = fm.getUI('cwd').find('#'+fm.cwdHash2Id(data.added[0].hash));
13362
- if (newItem.length) {
13363
- newItem.trigger('scrolltoview');
13364
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13365
  }
13366
  })
13367
  .always(function() {
13368
  fm.unlockfiles({files : files});
13369
  });
13370
- }
13371
- ;
13372
 
13373
  if (!fm.isCommandEnabled(self.name, dst.hash) || !files.length) {
13374
  return dfrd.resolve();
13375
  }
13376
 
13377
-
13378
  if (fm.oldAPI) {
13379
  paste(files);
13380
  } else {
@@ -13382,16 +18702,16 @@ elFinder.prototype.commands.paste = function() {
13382
  if (!fm.option('copyOverwrite')) {
13383
  paste(files);
13384
  } else {
13385
-
13386
  dst.hash == fm.cwd().hash
13387
- ? valid($.map(fm.files(), function(file) { return file.phash == dst.hash ? file.name : null }))
13388
  : fm.request({
13389
- data : {cmd : 'ls', target : dst.hash},
13390
  notify : {type : 'prepare', cnt : 1, hideCnt : true},
13391
  preventFail : true
13392
  })
13393
  .always(function(data) {
13394
- valid(data.list || [])
13395
  });
13396
  }
13397
  }
@@ -13413,7 +18733,7 @@ elFinder.prototype.commands.paste = function() {
13413
 
13414
  $.each(files, function(i, file) {
13415
  if (!file.read) {
13416
- return !dfrd.reject([error, files[0].name, 'errPerm']);
13417
  }
13418
 
13419
  if (cut && file.locked) {
@@ -13424,6 +18744,10 @@ elFinder.prototype.commands.paste = function() {
13424
  return !dfrd.reject(['errCopyInItself', file.name]);
13425
  }
13426
 
 
 
 
 
13427
  fparents = fm.parents(file.hash);
13428
  fparents.pop();
13429
  if ($.inArray(dst.hash, fparents) !== -1) {
@@ -13456,7 +18780,8 @@ elFinder.prototype.commands.paste = function() {
13456
  });
13457
  }
13458
 
13459
- }
 
13460
 
13461
  /*
13462
  * File: /js/commands/places.js
@@ -13494,6 +18819,7 @@ elFinder.prototype.commands.places = function() {
13494
 
13495
  };
13496
 
 
13497
  /*
13498
  * File: /js/commands/quicklook.js
13499
  */
@@ -13504,7 +18830,7 @@ elFinder.prototype.commands.places = function() {
13504
  *
13505
  * @author Dmitry (dio) Levashov
13506
  **/
13507
- elFinder.prototype.commands.quicklook = function() {
13508
  var self = this,
13509
  fm = self.fm,
13510
  /**
@@ -13565,12 +18891,15 @@ elFinder.prototype.commands.quicklook = function() {
13565
  * @return void
13566
  **/
13567
  closedCss = function(node) {
 
 
 
13568
  return {
13569
  opacity : 0,
13570
- width : 20,//node.width(),
13571
- height : fm.view == 'list' ? 1 : 20,
13572
- top : node.offset().top+'px',
13573
- left : node.offset().left+'px'
13574
  }
13575
  },
13576
  /**
@@ -13580,14 +18909,15 @@ elFinder.prototype.commands.quicklook = function() {
13580
  **/
13581
  openedCss = function() {
13582
  var win = $(window);
 
13583
  var w = Math.min(width, $(window).width()-10);
13584
  var h = Math.min(height, $(window).height()-80);
13585
  return {
13586
  opacity : 1,
13587
  width : w,
13588
  height : h,
13589
- top : parseInt((win.height() - h - 60)/2 + win.scrollTop()),
13590
- left : parseInt((win.width() - w)/2 + win.scrollLeft())
13591
  }
13592
  },
13593
 
@@ -13628,76 +18958,144 @@ elFinder.prototype.commands.quicklook = function() {
13628
  * @type jQuery
13629
  **/
13630
  cwd,
 
 
 
 
 
 
13631
  title = $('<div class="elfinder-quicklook-title"/>'),
13632
  icon = $('<div/>'),
13633
  info = $('<div class="elfinder-quicklook-info"/>'),//.hide(),
 
13634
  fsicon = $('<div class="'+navicon+' '+navicon+'-fullscreen"/>')
13635
- .mousedown(function(e) {
 
 
 
 
13636
  var win = self.window,
13637
  full = win.hasClass(fullscreen),
13638
- scroll = 'scroll.'+fm.namespace,
13639
- $window = $(window);
13640
 
13641
  e.stopPropagation();
 
13642
 
13643
  if (full) {
13644
- win.css(win.data('position')).unbind('mousemove');
13645
- $window.unbind(scroll).trigger(self.resize).unbind(self.resize);
13646
- navbar.unbind('mouseenter').unbind('mousemove');
 
 
 
 
13647
  } else {
13648
- win.data('position', {
 
13649
  left : win.css('left'),
13650
  top : win.css('top'),
13651
  width : win.width(),
13652
- height : win.height()
 
13653
  })
13654
- .css({
13655
- width : '100%',
13656
- height : '100%'
13657
- });
13658
 
13659
- $(window).bind(scroll, function() {
13660
- win.css({
13661
- left : parseInt($(window).scrollLeft())+'px',
13662
- top : parseInt($(window).scrollTop()) +'px'
13663
- })
13664
- })
13665
- .bind(self.resize, function(e) {
13666
- self.preview.trigger('changesize');
13667
- })
13668
- .trigger(scroll)
13669
  .trigger(self.resize);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13670
 
13671
- win.bind('mousemove', function(e) {
13672
- navbar.stop(true, true).show().delay(3000).fadeOut('slow');
13673
- })
13674
- .mousemove();
13675
-
13676
- navbar.mouseenter(function() {
13677
- navbar.stop(true, true).show();
13678
- })
13679
- .mousemove(function(e) {
13680
- e.stopPropagation();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13681
  });
13682
  }
13683
- navbar.attr('style', '').draggable(full ? 'destroy' : {});
13684
- win.toggleClass(fullscreen);
13685
  $(this).toggleClass(navicon+'-fullscreen-off');
13686
  var collection = win;
13687
- if(parent.is('.ui-resizable')) {
13688
  collection = collection.add(parent);
13689
  };
13690
- $.fn.resizable && !fm.UA.Touch && collection.resizable(full ? 'enable' : 'disable').removeClass('ui-state-disabled');
 
 
13691
  }),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13692
 
 
 
13693
  navbar = $('<div class="elfinder-quicklook-navbar"/>')
13694
- .append($('<div class="'+navicon+' '+navicon+'-prev"/>').mousedown(function() { navtrigger(37); }))
13695
  .append(fsicon)
13696
- .append($('<div class="'+navicon+' '+navicon+'-next"/>').mousedown(function() { navtrigger(39); }))
13697
  .append('<div class="elfinder-quicklook-navbar-separator"/>')
13698
- .append($('<div class="'+navicon+' '+navicon+'-close"/>').mousedown(function() { self.window.trigger('close'); }))
13699
- ;
 
13700
 
 
13701
  this.resize = 'resize.'+fm.namespace;
13702
  this.info = $('<div class="elfinder-quicklook-info-wrapper"/>')
13703
  .append(icon)
@@ -13705,26 +19103,37 @@ elFinder.prototype.commands.quicklook = function() {
13705
 
13706
  this.preview = $('<div class="elfinder-quicklook-preview ui-helper-clearfix"/>')
13707
  // clean info/icon
13708
- .bind('change', function(e) {
 
 
 
13709
  self.info.attr('style', '').hide();
13710
  icon.removeAttr('class').attr('style', '');
13711
  info.html('');
13712
-
13713
  })
13714
  // update info/icon
13715
- .bind('update', function(e) {
13716
  var fm = self.fm,
13717
  preview = self.preview,
13718
  file = e.file,
13719
  tpl = '<div class="elfinder-quicklook-info-data">{value}</div>',
13720
  tmb;
13721
 
13722
- if (file) {
13723
  !file.read && e.stopImmediatePropagation();
13724
  self.window.data('hash', file.hash);
13725
- self.preview.unbind('changesize').trigger('change').children().remove();
13726
  title.html(fm.escape(file.name));
13727
 
 
 
 
 
 
 
 
 
 
13728
  info.html(
13729
  tpl.replace(/\{value\}/, fm.escape(file.name))
13730
  + tpl.replace(/\{value\}/, fm.mime2kind(file))
@@ -13733,17 +19142,20 @@ elFinder.prototype.commands.quicklook = function() {
13733
  )
13734
  icon.addClass('elfinder-cwd-icon ui-corner-all '+fm.mime2class(file.mime));
13735
 
13736
- if (file.tmb) {
13737
  $('<img/>')
13738
  .hide()
13739
  .appendTo(self.preview)
13740
- .load(function() {
13741
- icon.css('background', 'url("'+tmb+'") center center no-repeat');
13742
  $(this).remove();
13743
  })
13744
- .attr('src', (tmb = fm.tmb(file.hash)));
13745
  }
13746
  self.info.delay(100).fadeIn(10);
 
 
 
13747
  } else {
13748
  e.stopImmediatePropagation();
13749
  }
@@ -13752,37 +19164,45 @@ elFinder.prototype.commands.quicklook = function() {
13752
 
13753
 
13754
 
13755
- this.window = $('<div class="ui-helper-reset ui-widget elfinder-quicklook" style="position:absolute"/>')
13756
- .click(function(e) { e.stopPropagation(); })
 
 
13757
  .append(
13758
  $('<div class="elfinder-quicklook-titlebar"/>')
13759
- .append(title)
13760
- .append($('<span class="ui-icon ui-icon-circle-close"/>').mousedown(function(e) {
 
13761
  e.stopPropagation();
13762
  self.window.trigger('close');
13763
- }))
13764
- )
13765
- .append(this.preview.add(navbar))
13766
- .append(self.info.hide())
 
 
13767
  .draggable({handle : 'div.elfinder-quicklook-titlebar'})
13768
- .bind('open', function(e) {
13769
  var win = self.window,
13770
  file = self.value,
13771
  node;
13772
 
13773
- if (self.closed() && file && (node = cwd.find('#'+fm.cwdHash2Id(file.hash))).length) {
 
13774
  navbar.attr('style', '');
13775
  state = animated;
13776
  node.trigger('scrolltoview');
 
13777
  win.css(closedCss(node))
13778
  .show()
13779
  .animate(openedCss(), 550, function() {
13780
  state = opened;
13781
  self.update(1, self.value);
 
13782
  });
13783
  }
13784
  })
13785
- .bind('close', function(e) {
13786
  var win = self.window,
13787
  preview = self.preview.trigger('change'),
13788
  file = self.value,
@@ -13795,9 +19215,10 @@ elFinder.prototype.commands.quicklook = function() {
13795
 
13796
  };
13797
 
 
13798
  if (self.opened()) {
13799
  state = animated;
13800
- win.hasClass(fullscreen) && fsicon.mousedown()
13801
  node.length
13802
  ? win.animate(closedCss(node), 500, close)
13803
  : close();
@@ -13823,7 +19244,7 @@ elFinder.prototype.commands.quicklook = function() {
13823
  select : function() { this.update(void(0), this.fm.selectedFiles()[0]); },
13824
  error : function() { self.window.is(':visible') && self.window.data('hash', '').trigger('close'); },
13825
  'searchshow searchhide' : function() { this.opened() && this.window.trigger('close'); }
13826
- }
13827
 
13828
  this.shortcuts = [{
13829
  pattern : 'space'
@@ -13834,15 +19255,14 @@ elFinder.prototype.commands.quicklook = function() {
13834
  ogg : support('audio/ogg; codecs="vorbis"'),
13835
  mp3 : support('audio/mpeg;'),
13836
  wav : support('audio/wav; codecs="1"'),
13837
- m4a : support('audio/x-m4a;') || support('audio/aac;')
13838
  },
13839
  video : {
13840
  ogg : support('video/ogg; codecs="theora"'),
13841
  webm : support('video/webm; codecs="vp8, vorbis"'),
13842
  mp4 : support('video/mp4; codecs="avc1.42E01E"') || support('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')
13843
  }
13844
- }
13845
-
13846
 
13847
  /**
13848
  * Return true if quickLoock window is visible and not animated
@@ -13851,7 +19271,7 @@ elFinder.prototype.commands.quicklook = function() {
13851
  **/
13852
  this.closed = function() {
13853
  return state == closed;
13854
- }
13855
 
13856
  /**
13857
  * Return true if quickLoock window is hidden
@@ -13860,7 +19280,7 @@ elFinder.prototype.commands.quicklook = function() {
13860
  **/
13861
  this.opened = function() {
13862
  return state == opened;
13863
- }
13864
 
13865
  /**
13866
  * Init command.
@@ -13872,7 +19292,7 @@ elFinder.prototype.commands.quicklook = function() {
13872
  var o = this.options,
13873
  win = this.window,
13874
  preview = this.preview,
13875
- i, p;
13876
 
13877
  width = o.width > 0 ? parseInt(o.width) : 450;
13878
  height = o.height > 0 ? parseInt(o.height) : 300;
@@ -13881,14 +19301,18 @@ elFinder.prototype.commands.quicklook = function() {
13881
  parent = fm.getUI();
13882
  cwd = fm.getUI('cwd');
13883
 
13884
- win.appendTo('body').zIndex(100 + parent.zIndex());
 
 
 
 
13885
 
13886
  // close window on escape
13887
  $(document).keydown(function(e) {
13888
- e.keyCode == 27 && self.opened() && win.trigger('close')
13889
  })
13890
 
13891
- if ($.fn.resizable && !fm.UA.Touch) {
13892
  win.resizable({
13893
  handles : 'se',
13894
  minWidth : 350,
@@ -13903,37 +19327,76 @@ elFinder.prototype.commands.quicklook = function() {
13903
 
13904
  self.change(function() {
13905
  if (self.opened()) {
13906
- self.value ? preview.trigger($.Event('update', {file : self.value})) : win.trigger('close');
 
 
 
 
 
 
 
 
 
13907
  }
13908
  });
13909
 
 
 
 
 
 
 
 
 
 
 
 
 
13910
  $.each(fm.commands.quicklook.plugins || [], function(i, plugin) {
13911
  if (typeof(plugin) == 'function') {
13912
  new plugin(self)
13913
  }
13914
  });
 
 
 
 
13915
 
13916
- preview.bind('update', function() {
13917
- self.info.show();
13918
- });
 
 
 
 
 
 
 
 
 
13919
  });
13920
 
13921
- }
 
 
 
13922
 
13923
  this.getstate = function() {
13924
- return this.fm.selected().length == 1 ? state == opened ? 1 : 0 : -1;
13925
- }
 
 
 
13926
 
13927
  this.exec = function() {
13928
  this.enabled() && this.window.trigger(this.opened() ? 'close' : 'open');
13929
- }
13930
 
13931
  this.hideinfo = function() {
13932
- this.info.stop(true).hide();
13933
- }
13934
-
13935
- }
13936
 
 
13937
 
13938
 
13939
  /*
@@ -13949,7 +19412,7 @@ elFinder.prototype.commands.quicklook.plugins = [
13949
  * @param elFinder.commands.quicklook
13950
  **/
13951
  function(ql) {
13952
- var mimes = ['image/jpeg', 'image/png', 'image/gif'],
13953
  preview = ql.preview;
13954
 
13955
  // what kind of images we can display
@@ -13961,23 +19424,38 @@ elFinder.prototype.commands.quicklook.plugins = [
13961
  }
13962
  });
13963
 
13964
- preview.bind('update', function(e) {
13965
- var file = e.file,
13966
- img;
 
13967
 
13968
- if ($.inArray(file.mime, mimes) !== -1) {
13969
  // this is our file - stop event propagation
13970
  e.stopImmediatePropagation();
13971
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13972
  img = $('<img/>')
13973
  .hide()
13974
  .appendTo(preview)
13975
- .load(function() {
13976
  // timeout - because of strange safari bug -
13977
  // sometimes cant get image height 0_o
13978
  setTimeout(function() {
13979
  var prop = (img.width()/img.height()).toFixed(2);
13980
- preview.bind('changesize', function() {
13981
  var pw = parseInt(preview.width()),
13982
  ph = parseInt(preview.height()),
13983
  w, h;
@@ -13994,13 +19472,17 @@ elFinder.prototype.commands.quicklook.plugins = [
13994
  })
13995
  .trigger('changesize');
13996
 
 
13997
  // hide info/icon
13998
  ql.hideinfo();
13999
  //show image
14000
  img.fadeIn(100);
14001
  }, 1)
14002
  })
14003
- .attr('src', ql.fm.openUrl(file.hash));
 
 
 
14004
  }
14005
 
14006
  });
@@ -14016,16 +19498,18 @@ elFinder.prototype.commands.quicklook.plugins = [
14016
  preview = ql.preview,
14017
  fm = ql.fm;
14018
 
14019
- preview.bind('update', function(e) {
14020
- var file = e.file, jqxhr;
14021
 
14022
- if ($.inArray(file.mime, mimes) !== -1) {
14023
  e.stopImmediatePropagation();
14024
 
 
 
14025
  // stop loading on change file if not loaded yet
14026
  preview.one('change', function() {
14027
  jqxhr.state() == 'pending' && jqxhr.reject();
14028
- });
14029
 
14030
  jqxhr = fm.request({
14031
  data : {cmd : 'get', target : file.hash, current : file.phash, conv : 1},
@@ -14033,10 +19517,13 @@ elFinder.prototype.commands.quicklook.plugins = [
14033
  })
14034
  .done(function(data) {
14035
  ql.hideinfo();
14036
- doc = $('<iframe class="elfinder-quicklook-preview-html"/>').appendTo(preview)[0].contentWindow.document;
14037
  doc.open();
14038
  doc.write(data.content);
14039
  doc.close();
 
 
 
14040
  });
14041
  }
14042
  })
@@ -14053,14 +19540,16 @@ elFinder.prototype.commands.quicklook.plugins = [
14053
  preview = ql.preview;
14054
 
14055
 
14056
- preview.bind('update', function(e) {
14057
  var file = e.file,
14058
  mime = file.mime,
14059
- jqxhr;
14060
 
14061
  if (mime.indexOf('text/') === 0 || $.inArray(mime, mimes) !== -1) {
14062
  e.stopImmediatePropagation();
14063
 
 
 
14064
  // stop loading on change file if not loadin yet
14065
  preview.one('change', function() {
14066
  jqxhr.state() == 'pending' && jqxhr.reject();
@@ -14073,6 +19562,9 @@ elFinder.prototype.commands.quicklook.plugins = [
14073
  .done(function(data) {
14074
  ql.hideinfo();
14075
  $('<div class="elfinder-quicklook-preview-text-wrapper"><pre class="elfinder-quicklook-preview-text">'+fm.escape(data.content)+'</pre></div>').appendTo(preview);
 
 
 
14076
  });
14077
  }
14078
  });
@@ -14101,19 +19593,19 @@ elFinder.prototype.commands.quicklook.plugins = [
14101
  });
14102
  }
14103
 
14104
- active && preview.bind('update', function(e) {
14105
  var file = e.file, node;
14106
 
14107
- if (file.mime == mime) {
14108
  e.stopImmediatePropagation();
14109
  preview.one('change', function() {
14110
- node.unbind('load').remove();
14111
- });
14112
 
14113
  node = $('<iframe class="elfinder-quicklook-preview-pdf"/>')
14114
  .hide()
14115
  .appendTo(preview)
14116
- .load(function() {
14117
  ql.hideinfo();
14118
  node.show();
14119
  })
@@ -14144,14 +19636,15 @@ elFinder.prototype.commands.quicklook.plugins = [
14144
  });
14145
  });
14146
 
14147
- active && preview.bind('update', function(e) {
14148
  var file = e.file,
14149
  node;
14150
 
14151
- if (file.mime == mime) {
14152
  e.stopImmediatePropagation();
14153
  ql.hideinfo();
14154
- preview.append((node = $('<embed class="elfinder-quicklook-preview-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+fm.url(file.hash)+'" quality="high" type="application/x-shockwave-flash" />')));
 
14155
  }
14156
  });
14157
  },
@@ -14178,11 +19671,16 @@ elFinder.prototype.commands.quicklook.plugins = [
14178
  'audio/x-mp4' : 'm4a',
14179
  'audio/ogg' : 'ogg'
14180
  },
14181
- node;
 
 
14182
 
14183
- preview.bind('update', function(e) {
14184
  var file = e.file,
14185
- type = mimes[file.mime];
 
 
 
14186
 
14187
  if (ql.support.audio[type]) {
14188
  e.stopImmediatePropagation();
@@ -14190,9 +19688,13 @@ elFinder.prototype.commands.quicklook.plugins = [
14190
  node = $('<audio class="elfinder-quicklook-preview-audio" controls preload="auto" autobuffer><source src="'+ql.fm.openUrl(file.hash)+'" /></audio>')
14191
  .appendTo(preview);
14192
  autoplay && node[0].play();
 
 
 
14193
  }
14194
- }).bind('change', function() {
14195
  if (node && node.parent().length) {
 
14196
  node[0].pause();
14197
  node.remove();
14198
  node= null;
@@ -14211,15 +19713,30 @@ elFinder.prototype.commands.quicklook.plugins = [
14211
  mimes = {
14212
  'video/mp4' : 'mp4',
14213
  'video/x-m4v' : 'mp4',
 
14214
  'video/ogg' : 'ogg',
14215
  'application/ogg' : 'ogg',
14216
  'video/webm' : 'webm'
14217
  },
14218
- node;
 
 
14219
 
14220
- preview.bind('update', function(e) {
14221
  var file = e.file,
14222
- type = mimes[file.mime];
 
 
 
 
 
 
 
 
 
 
 
 
14223
 
14224
  if (ql.support.video[type]) {
14225
  e.stopImmediatePropagation();
@@ -14227,10 +19744,13 @@ elFinder.prototype.commands.quicklook.plugins = [
14227
  ql.hideinfo();
14228
  node = $('<video class="elfinder-quicklook-preview-video" controls preload="auto" autobuffer><source src="'+ql.fm.openUrl(file.hash)+'" /></video>').appendTo(preview);
14229
  autoplay && node[0].play();
14230
-
 
 
14231
  }
14232
- }).bind('change', function() {
14233
  if (node && node.parent().length) {
 
14234
  node[0].pause();
14235
  node.remove();
14236
  node= null;
@@ -14246,7 +19766,9 @@ elFinder.prototype.commands.quicklook.plugins = [
14246
  function(ql) {
14247
  var preview = ql.preview,
14248
  mimes = [],
14249
- node;
 
 
14250
 
14251
  $.each(navigator.plugins, function(i, plugins) {
14252
  $.each(plugins, function(i, plugin) {
@@ -14254,27 +19776,280 @@ elFinder.prototype.commands.quicklook.plugins = [
14254
  });
14255
  });
14256
 
14257
- preview.bind('update', function(e) {
14258
  var file = e.file,
14259
  mime = file.mime,
14260
- video;
 
 
 
14261
 
14262
  if ($.inArray(file.mime, mimes) !== -1) {
14263
  e.stopImmediatePropagation();
14264
  (video = mime.indexOf('video/') === 0) && ql.hideinfo();
14265
  node = $('<embed src="'+ql.fm.openUrl(file.hash)+'" type="'+mime+'" class="elfinder-quicklook-preview-'+(video ? 'video' : 'audio')+'"/>')
14266
  .appendTo(preview);
 
 
 
14267
  }
14268
- }).bind('change', function() {
14269
  if (node && node.parent().length) {
 
14270
  node.remove();
14271
  node= null;
14272
  }
14273
  });
14274
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14275
  }
14276
-
14277
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14278
 
14279
  /*
14280
  * File: /js/commands/reload.js
@@ -14286,7 +20061,7 @@ elFinder.prototype.commands.quicklook.plugins = [
14286
  *
14287
  * @author Dmitry (dio) Levashov
14288
  **/
14289
- elFinder.prototype.commands.reload = function() {
14290
  var self = this,
14291
  search = false;
14292
 
@@ -14310,27 +20085,25 @@ elFinder.prototype.commands.reload = function() {
14310
  this.fm.bind('contextmenu', function(e){
14311
  var fm = self.fm;
14312
  if (fm.options.sync >= 1000) {
14313
- var node;
14314
  self.extra = {
14315
  icon: 'accept',
14316
  node: $('<span/>')
14317
  .attr({title: fm.i18n('autoSync')})
14318
- .on('click', function(e){
 
 
 
14319
  e.stopPropagation();
14320
  e.preventDefault();
14321
- node.parent()
14322
  .toggleClass('ui-state-disabled', fm.options.syncStart)
14323
  .parent().removeClass('ui-state-hover');
14324
  fm.options.syncStart = !fm.options.syncStart;
14325
  fm.autoSync(fm.options.syncStart? null : 'stop');
 
 
14326
  })
14327
  };
14328
- node = self.extra.node;
14329
- node.ready(function(){
14330
- setTimeout(function(){
14331
- node.parent().toggleClass('ui-state-disabled', !fm.options.syncStart);
14332
- }, 10);
14333
- });
14334
  }
14335
  });
14336
 
@@ -14352,7 +20125,8 @@ elFinder.prototype.commands.reload = function() {
14352
  }
14353
  };
14354
 
14355
- };
 
14356
 
14357
  /*
14358
  * File: /js/commands/rename.js
@@ -14376,24 +20150,31 @@ elFinder.prototype.commands.rename = function() {
14376
  return !this._disabled && sel.length == 1 && sel[0].phash && !sel[0].locked ? 0 : -1;
14377
  };
14378
 
14379
- this.exec = function(hashes) {
14380
  var fm = this.fm,
14381
  cwd = fm.getUI('cwd'),
14382
  sel = hashes || (fm.selected().length? fm.selected() : false) || [fm.cwd().hash],
14383
  cnt = sel.length,
14384
  file = fm.file(sel.shift()),
14385
  filename = '.elfinder-cwd-filename',
14386
- type = (hashes && hashes._type)? hashes._type : (fm.selected().length? 'files' : 'navbar'),
14387
- navbar = (type === 'navbar'),
14388
  incwd = (fm.cwd().hash == file.hash),
 
 
 
14389
  tarea = (type === 'files' && fm.storage('view') != 'list'),
14390
  rest = function(){
 
 
 
 
 
 
14391
  if (tarea) {
14392
- pnode.zIndex('').css('position', '');
14393
  node.css('max-height', '');
14394
  } else if (!navbar) {
14395
- pnode.css('width', '');
14396
- pnode.parent('td').css('overflow', '');
14397
  }
14398
  }, colwidth,
14399
  dfrd = $.Deferred()
@@ -14402,12 +20183,11 @@ elFinder.prototype.commands.rename = function() {
14402
  })
14403
  .fail(function(error) {
14404
  var parent = input.parent(),
14405
- name = fm.escape(file.name);
14406
 
14407
  if (tarea) {
14408
  name = name.replace(/([_.])/g, '&#8203;$1');
14409
  }
14410
- rest();
14411
  if (navbar) {
14412
  input.replaceWith(name);
14413
  } else {
@@ -14415,7 +20195,8 @@ elFinder.prototype.commands.rename = function() {
14415
  input.remove();
14416
  parent.html(name);
14417
  } else {
14418
- cwd.find('#'+fm.cwdHash2Id(file.hash)).find(filename).html(name);
 
14419
  setTimeout(function() {
14420
  cwd.find('#'+fm.cwdHash2Id(file.hash)).click();
14421
  }, 50);
@@ -14425,8 +20206,71 @@ elFinder.prototype.commands.rename = function() {
14425
  error && fm.error(error);
14426
  })
14427
  .always(function() {
 
 
14428
  fm.enable();
14429
  }),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14430
  input = $(tarea? '<textarea/>' : '<input type="text"/>')
14431
  .on('keyup text', function(){
14432
  if (tarea) {
@@ -14439,99 +20283,67 @@ elFinder.prototype.commands.rename = function() {
14439
  }
14440
  }
14441
  })
14442
- .keydown(function(e) {
14443
- e.stopPropagation();
14444
  e.stopImmediatePropagation();
14445
  if (e.keyCode == $.ui.keyCode.ESCAPE) {
14446
  dfrd.reject();
14447
  } else if (e.keyCode == $.ui.keyCode.ENTER) {
 
14448
  input.blur();
14449
  }
14450
  })
14451
- .mousedown(function(e) {
14452
- e.stopPropagation();
14453
- })
14454
- .click(function(e) { // for touch device
14455
  e.stopPropagation();
 
 
 
14456
  })
14457
- .dblclick(function(e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14458
  e.stopPropagation();
14459
- e.preventDefault();
14460
- })
14461
- .blur(function() {
14462
- var name = $.trim(input.val()),
14463
- parent = input.parent(),
14464
- valid = true;
14465
-
14466
- if (pnode.length) {
14467
- if (input[0].setSelectionRange) {
14468
- input[0].setSelectionRange(0, 0)
14469
- }
14470
- if (name == file.name) {
14471
- return dfrd.reject();
14472
- }
14473
- if (fm.options.validName && fm.options.validName.test) {
14474
- try {
14475
- valid = fm.options.validName.test(name);
14476
- } catch(e) {
14477
- valid = false;
14478
- }
14479
- }
14480
- if (!name || name === '..' || !valid) {
14481
- fm.error('errInvName');
14482
- return false;
14483
- }
14484
- if (fm.fileByName(name, file.phash)) {
14485
- fm.error(['errExists', name]);
14486
- return false;
14487
- }
14488
-
14489
- rest();
14490
- (navbar? pnode : node).html(fm.escape(name));
14491
- fm.lockfiles({files : [file.hash]});
14492
- fm.request({
14493
- data : {cmd : 'rename', target : file.hash, name : name},
14494
- notify : {type : 'rename', cnt : 1}
14495
- })
14496
- .fail(function(error) {
14497
- dfrd.reject();
14498
- fm.sync();
14499
- })
14500
- .done(function(data) {
14501
- dfrd.resolve(data);
14502
- if (!navbar && data && data.added && data.added[0]) {
14503
- var newItem = cwd.find('#'+fm.cwdHash2Id(data.added[0].hash));
14504
- if (newItem.length) {
14505
- newItem.trigger('scrolltoview');
14506
- }
14507
- }
14508
- })
14509
- .always(function() {
14510
- fm.unlockfiles({files : [file.hash]})
14511
- });
14512
-
14513
- }
14514
- }),
14515
- node = navbar? $('#'+fm.navHash2Id(file.hash)).contents().filter(function(){ return this.nodeType==3 && $(this).parent().attr('id') === fm.navHash2Id(file.hash); })
14516
- : cwd.find('#'+fm.cwdHash2Id(file.hash)).find(filename),
14517
- name = file.name.replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/ig, ''),
14518
- pnode = node.parent();
14519
 
 
 
14520
  if (navbar) {
14521
  node.replaceWith(input.val(file.name));
14522
  } else {
14523
  if (tarea) {
14524
- pnode.zIndex((pnode.zIndex()) + 1).css('position', 'relative');
14525
  node.css('max-height', 'none');
14526
  } else if (!navbar) {
14527
  colwidth = pnode.width();
14528
- pnode.width(colwidth - 15);
14529
- pnode.parent('td').css('overflow', 'visible');
14530
  }
14531
  node.empty().append(input.val(file.name));
14532
  }
14533
 
14534
- if (cnt > 1 || this.getstate([file.hash]) < 0) {
14535
  return dfrd.reject();
14536
  }
14537
 
@@ -14549,14 +20361,12 @@ elFinder.prototype.commands.rename = function() {
14549
 
14550
  input.trigger('keyup');
14551
 
14552
- input.select().focus();
14553
-
14554
- input[0].setSelectionRange && input[0].setSelectionRange(0, name.length);
14555
 
14556
  return dfrd;
14557
  };
14558
 
14559
- }
14560
 
14561
 
14562
  /*
@@ -14581,78 +20391,163 @@ elFinder.prototype.commands.resize = function() {
14581
  return !this._disabled && sel.length == 1 && sel[0].read && sel[0].write && sel[0].mime.indexOf('image/') !== -1 ? 0 : -1;
14582
  };
14583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14584
  this.exec = function(hashes) {
14585
- var fm = this.fm,
 
14586
  files = this.files(hashes),
14587
  dfrd = $.Deferred(),
 
 
 
 
14588
 
14589
  open = function(file, id) {
14590
  var isJpeg = (file.mime === 'image/jpeg'),
14591
- dialog = $('<div class="elfinder-dialog-resize"/>'),
14592
  input = '<input type="text" size="5"/>',
14593
  row = '<div class="elfinder-resize-row"/>',
14594
  label = '<div class="elfinder-resize-label"/>',
14595
- control = $('<div class="elfinder-resize-control"/>'),
14596
- preview = $('<div class="elfinder-resize-preview"/>'),
 
 
 
 
 
 
 
14597
  spinner = $('<div class="elfinder-resize-spinner">'+fm.i18n('ntfloadimg')+'</div>'),
14598
- rhandle = $('<div class="elfinder-resize-handle"/>'),
14599
- rhandlec = $('<div class="elfinder-resize-handle"/>'),
14600
  uiresize = $('<div class="elfinder-resize-uiresize"/>'),
14601
  uicrop = $('<div class="elfinder-resize-uicrop"/>'),
14602
- uibuttonset = '<div class="ui-widget-content ui-corner-all elfinder-buttonset"/>',
14603
- uibutton = '<div class="ui-state-default elfinder-button"/>',
14604
- uiseparator = '<span class="ui-widget-content elfinder-toolbar-button-separator"/>',
14605
- uirotate = $('<div class="elfinder-resize-rotate"/>'),
14606
- uideg270 = $(uibutton).attr('title',fm.i18n('rotate-cw')).append($('<span class="elfinder-button-icon elfinder-button-icon-rotate-l"/>')
14607
- .click(function(){
14608
- rdegree = rdegree - 90;
14609
- rotate.update(rdegree);
14610
- })),
14611
- uideg90 = $(uibutton).attr('title',fm.i18n('rotate-ccw')).append($('<span class="elfinder-button-icon elfinder-button-icon-rotate-r"/>')
14612
- .click(function(){
14613
- rdegree = rdegree + 90;
14614
- rotate.update(rdegree);
14615
- })),
14616
  uiprop = $('<span />'),
14617
- reset = $('<div class="ui-state-default ui-corner-all elfinder-resize-reset"><span class="ui-icon ui-icon-arrowreturnthick-1-w"/></div>'),
 
 
 
 
 
 
 
 
 
14618
  uitype = $('<div class="elfinder-resize-type"/>')
14619
- .append('<input type="radio" name="type" id="'+id+'-resize" value="resize" checked="checked" /><label for="'+id+'-resize">'+fm.i18n('resize')+'</label>')
14620
- .append('<input type="radio" name="type" id="'+id+'-crop" value="crop" /><label for="'+id+'-crop">'+fm.i18n('crop')+'</label>')
14621
- .append('<input type="radio" name="type" id="'+id+'-rotate" value="rotate" /><label for="'+id+'-rotate">'+fm.i18n('rotate')+'</label>'),
14622
- type = $('input', uitype).attr('disabled', 'disabled')
 
14623
  .change(function() {
14624
- var val = $('input:checked', uitype).val();
14625
 
14626
  resetView();
14627
  resizable(true);
14628
  croppable(true);
14629
  rotateable(true);
14630
 
14631
- if (val == 'resize') {
14632
  uiresize.show();
14633
  uirotate.hide();
14634
  uicrop.hide();
14635
  resizable();
 
14636
  }
14637
- else if (val == 'crop') {
14638
  uirotate.hide();
14639
  uiresize.hide();
14640
  uicrop.show();
14641
  croppable();
14642
- } else if (val == 'rotate') {
 
14643
  uiresize.hide();
14644
  uicrop.hide();
14645
  uirotate.show();
14646
  rotateable();
14647
  }
14648
  }),
14649
- constr = $('<input type="checkbox" checked="checked"/>')
14650
- .change(function() {
14651
- cratio = !!constr.prop('checked');
14652
- resize.fixHeight();
14653
- resizable(true);
14654
- resizable();
14655
- }),
14656
  width = $(input)
14657
  .change(function() {
14658
  var w = parseInt(width.val()),
@@ -14675,9 +20570,9 @@ elFinder.prototype.commands.resize = function() {
14675
  }),
14676
  pointX = $(input).change(function(){crop.updateView();}),
14677
  pointY = $(input).change(function(){crop.updateView();}),
14678
- offsetX = $(input).change(function(){crop.updateView();}),
14679
- offsetY = $(input).change(function(){crop.updateView();}),
14680
- quality = isJpeg?
14681
  $(input).val(fm.option('jpgQuality'))
14682
  .addClass('quality')
14683
  .on('blur', function(){
@@ -14689,7 +20584,7 @@ elFinder.prototype.commands.resize = function() {
14689
  .change(function() {
14690
  rotate.update();
14691
  }),
14692
- uidegslider = $('<div class="elfinder-resize-rotate-slider"/>')
14693
  .slider({
14694
  min: 0,
14695
  max: 360,
@@ -14703,60 +20598,326 @@ elFinder.prototype.commands.resize = function() {
14703
  slide: function(event, ui) {
14704
  rotate.update(ui.value, false);
14705
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14706
  }),
 
 
 
 
 
 
 
 
 
 
14707
  ratio = 1,
14708
  prop = 1,
14709
  owidth = 0,
14710
  oheight = 0,
14711
  cratio = true,
 
14712
  pwidth = 0,
14713
  pheight = 0,
14714
  rwidth = 0,
14715
  rheight = 0,
14716
  rdegree = 0,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14717
  img = $('<img/>')
14718
- .load(function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14719
  spinner.remove();
14720
 
14721
- owidth = img.width();
14722
- oheight = img.height();
14723
  ratio = owidth/oheight;
14724
- resize.updateView(owidth, oheight);
14725
 
14726
  rhandle.append(img.show()).show();
14727
  width.val(owidth);
14728
  height.val(oheight);
14729
-
14730
- var r_scale = Math.min(pwidth, pheight) / Math.sqrt(Math.pow(owidth, 2) + Math.pow(oheight, 2));
14731
- rwidth = owidth * r_scale;
14732
- rheight = oheight * r_scale;
14733
-
14734
- type.button('enable');
14735
- control.find('input,select').removeAttr('disabled')
14736
- .filter(':text').keydown(function(e) {
14737
- var c = e.keyCode, i;
14738
-
14739
- e.stopPropagation();
14740
-
14741
- if ((c >= 37 && c <= 40)
14742
- || c == $.ui.keyCode.BACKSPACE
14743
- || c == $.ui.keyCode.DELETE
14744
- || (c == 65 && (e.ctrlKey||e.metaKey))
14745
- || c == 27) {
14746
- return;
14747
- }
14748
-
14749
- if (c == 9) {
14750
- i = $(this).parent()[e.shiftKey ? 'prevAll' : 'nextAll']('div.elfinder-resize-row').children(':text');
14751
 
14752
- if (i.length) {
14753
- i[0].focus();
14754
- } else {
14755
- $(this).parent().parent().find(':text:' + (e.shiftKey ? 'last' : 'first')).focus();
14756
- }
14757
- }
14758
-
14759
- if (c == 13) {
 
14760
  fm.confirm({
14761
  title : $('input:checked', uitype).val(),
14762
  text : 'confirmReq',
@@ -14768,37 +20929,51 @@ elFinder.prototype.commands.resize = function() {
14768
  },
14769
  cancel : {
14770
  label : 'btnCancel',
14771
- callback : function(){}
 
 
14772
  }
14773
  });
14774
  return;
14775
  }
14776
-
14777
- if (!((c >= 48 && c <= 57) || (c >= 96 && c <= 105))) {
14778
- e.preventDefault();
 
 
 
 
14779
  }
14780
  })
14781
- .filter(':first').focus();
14782
 
 
14783
  resizable();
14784
-
14785
- reset.hover(function() { reset.toggleClass('ui-state-hover'); }).click(resetView);
14786
-
14787
  })
14788
- .error(function() {
14789
  spinner.text('Unable to load image').css('background', 'transparent');
14790
  }),
14791
  basec = $('<div/>'),
14792
  imgc = $('<img/>'),
14793
  coverc = $('<div/>'),
14794
- imgr = $('<img/>'),
14795
- round = function(v) {
14796
- return isJpeg? Math.round(v/8)*8 : Math.round(v);
 
 
 
 
 
14797
  },
14798
  resetView = function() {
14799
  width.val(owidth);
14800
  height.val(oheight);
14801
  resize.updateView(owidth, oheight);
 
 
 
 
 
14802
  },
14803
  resize = {
14804
  update : function() {
@@ -14831,7 +21006,7 @@ elFinder.prototype.commands.resize = function() {
14831
  var w, h;
14832
  if (cratio) {
14833
  w = width.val();
14834
- h = Math.round(w/ratio);
14835
  resize.updateView(w, h);
14836
  height.val(h);
14837
  }
@@ -14839,31 +21014,38 @@ elFinder.prototype.commands.resize = function() {
14839
  },
14840
  crop = {
14841
  update : function() {
14842
- offsetX.val(round((rhandlec.data('w')||rhandlec.width())/prop));
14843
- offsetY.val(round((rhandlec.data('h')||rhandlec.height())/prop));
14844
- pointX.val(Math.round(((rhandlec.data('x')||rhandlec.offset().left)-imgc.offset().left)/prop));
14845
- pointY.val(Math.round(((rhandlec.data('y')||rhandlec.offset().top)-imgc.offset().top)/prop));
14846
  },
14847
- updateView : function() {
14848
- var x = parseInt(pointX.val()) * prop + imgc.offset().left;
14849
- var y = parseInt(pointY.val()) * prop + imgc.offset().top;
14850
- var w = offsetX.val() * prop;
14851
- var h = offsetY.val() * prop;
 
 
 
 
 
 
 
 
14852
  rhandlec.data({x: x, y: y, w: w, h: h})
14853
- .width(Math.round(w))
14854
- .height(Math.round(h))
14855
- .offset({left: Math.round(x), top: Math.round(y)});
14856
- coverc.width(rhandlec.width())
14857
- .height(rhandlec.height());
14858
  },
14859
- resize_update : function() {
14860
- rhandlec.data({w: null, h: null});
14861
  crop.update();
14862
- coverc.width(rhandlec.width())
14863
- .height(rhandlec.height());
14864
  },
14865
- drag_update : function() {
14866
- rhandlec.data({x: null, y: null});
14867
  crop.update();
14868
  }
14869
  },
@@ -14976,6 +21158,7 @@ elFinder.prototype.commands.resize = function() {
14976
  resize : resize.update,
14977
  stop : resize.fixHeight
14978
  });
 
14979
  }
14980
  }
14981
  },
@@ -14987,33 +21170,23 @@ elFinder.prototype.commands.resize = function() {
14987
  basec.hide();
14988
  }
14989
  else {
14990
- basec.show()
14991
- .width(img.width())
14992
- .height(img.height());
14993
-
14994
- imgc
14995
- .width(img.width())
14996
- .height(img.height());
14997
-
14998
- coverc
14999
- .width(img.width())
15000
- .height(img.height());
15001
 
15002
  rhandlec
15003
- .width(imgc.width())
15004
- .height(imgc.height())
15005
- .offset(imgc.offset())
15006
  .resizable({
15007
  containment : basec,
 
15008
  resize : crop.resize_update,
15009
  handles : 'all'
15010
  })
15011
  .draggable({
15012
  handle : coverc,
15013
  containment : imgc,
15014
- drag : crop.drag_update
 
15015
  });
15016
 
 
15017
  crop.update();
15018
  }
15019
  }
@@ -15024,20 +21197,14 @@ elFinder.prototype.commands.resize = function() {
15024
  imgr.hide();
15025
  }
15026
  else {
15027
- imgr.show()
15028
- .width(rwidth)
15029
- .height(rheight)
15030
- .css('margin-top', (pheight-rheight)/2 + 'px')
15031
- .css('margin-left', (pwidth-rwidth)/2 + 'px');
15032
 
15033
  }
15034
  }
15035
  },
15036
  save = function() {
15037
- var w, h, x, y, d, q;
15038
- var mode = $('input:checked', uitype).val();
15039
-
15040
- //width.add(height).change(); // may be unnecessary
15041
 
15042
  if (mode == 'resize') {
15043
  w = parseInt(width.val()) || 0;
@@ -15055,8 +21222,9 @@ elFinder.prototype.commands.resize = function() {
15055
  return fm.error('Invalid rotate degree');
15056
  }
15057
  if (d == 0 || d == 360) {
15058
- return fm.error('Image dose not rotated');
15059
  }
 
15060
  }
15061
  q = quality? parseInt(quality.val()) : 0;
15062
 
@@ -15067,79 +21235,144 @@ elFinder.prototype.commands.resize = function() {
15067
  }
15068
 
15069
  if (w == owidth && h == oheight) {
15070
- return fm.error('Image size not changed');
15071
  }
15072
 
15073
  }
15074
 
15075
  dialog.elfinderdialog('close');
15076
 
15077
- fm.request({
15078
- data : {
15079
- cmd : 'resize',
15080
- target : file.hash,
15081
- width : w,
15082
- height : h,
15083
- x : x,
15084
- y : y,
15085
- degree : d,
15086
- quality: q,
15087
- mode : mode
15088
- },
15089
- notify : {type : 'resize', cnt : 1}
15090
- })
15091
- .fail(function(error) {
15092
- dfrd.reject(error);
15093
- })
15094
- .done(function() {
15095
- dfrd.resolve();
15096
- });
15097
-
15098
  },
15099
  buttons = {},
15100
  hline = 'elfinder-resize-handle-hline',
15101
  vline = 'elfinder-resize-handle-vline',
15102
  rpoint = 'elfinder-resize-handle-point',
15103
- src = fm.url(file.hash)
15104
- ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15105
 
 
 
 
 
 
15106
  imgr.mousedown( rotate.start );
15107
  $(document).mouseup( rotate.stop );
15108
 
15109
  uiresize.append(
15110
- $(row).append($(label).text(fm.i18n('width')), width, reset),
15111
- $(row).append($(label).text(fm.i18n('height')), height),
15112
- $(row).append($('<label/>').text(fm.i18n('aspectRatio')).prepend(constr)),
15113
  (quality? $(row).append($(label).text(fm.i18n('quality')), quality, $('<span/>').text(' (1-100)')) : $()),
 
15114
  $(row).append($(label).text(fm.i18n('scale')), uiprop)
15115
  );
15116
-
15117
- uicrop.append(
15118
- $(row).append($(label).text('X'), pointX),
15119
- $(row).append($(label).text('Y')).append(pointY),
15120
- $(row).append($(label).text(fm.i18n('width')), offsetX),
15121
- $(row).append($(label).text(fm.i18n('height')), offsetY),
15122
- (quality? $(row).append($(label).text(fm.i18n('quality')), quality.clone(true), $('<span/>').text(' (1-100)')) : $())
15123
- );
15124
-
15125
- uirotate.append(
15126
- $(row).append(
15127
- $(label).text(fm.i18n('rotate')),
15128
- degree,
15129
- $('<span/>').text(fm.i18n('degree')),
15130
- $(uibuttonset).append(uideg270, $(uiseparator), uideg90)
15131
- ),
15132
- $(row).css('height', '20px').append(uidegslider),
15133
- (quality? $(row).append($(label).text(fm.i18n('quality')), quality.clone(true), $('<span/>').text(' (1-100)')) : $())
15134
- );
15135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15136
 
15137
  dialog.append(uitype).on('resize', function(e){
15138
  e.stopPropagation();
15139
  });
15140
 
15141
- control.append($(row), uiresize, uicrop.hide(), uirotate.hide())
15142
- .find('input,select').attr('disabled', 'disabled');
 
 
 
15143
 
15144
  rhandle.append('<div class="'+hline+' '+hline+'-top"/>',
15145
  '<div class="'+hline+' '+hline+'-bottom"/>',
@@ -15151,23 +21384,25 @@ elFinder.prototype.commands.resize = function() {
15151
 
15152
  preview.append(spinner).append(rhandle.hide()).append(img.hide());
15153
 
15154
- rhandlec.css('position', 'absolute')
15155
- .append('<div class="'+hline+' '+hline+'-top"/>',
15156
- '<div class="'+hline+' '+hline+'-bottom"/>',
15157
- '<div class="'+vline+' '+vline+'-left"/>',
15158
- '<div class="'+vline+' '+vline+'-right"/>',
15159
- '<div class="'+rpoint+' '+rpoint+'-n"/>',
15160
- '<div class="'+rpoint+' '+rpoint+'-e"/>',
15161
- '<div class="'+rpoint+' '+rpoint+'-s"/>',
15162
- '<div class="'+rpoint+' '+rpoint+'-w"/>',
15163
- '<div class="'+rpoint+' '+rpoint+'-ne"/>',
15164
- '<div class="'+rpoint+' '+rpoint+'-se"/>',
15165
- '<div class="'+rpoint+' '+rpoint+'-sw"/>',
15166
- '<div class="'+rpoint+' '+rpoint+'-nw"/>');
15167
-
15168
- preview.append(basec.css('position', 'absolute').hide().append(imgc, rhandlec.append(coverc)));
15169
-
15170
- preview.append(imgr.hide());
 
 
15171
 
15172
  preview.css('overflow', 'hidden');
15173
 
@@ -15176,31 +21411,36 @@ elFinder.prototype.commands.resize = function() {
15176
  buttons[fm.i18n('btnApply')] = save;
15177
  buttons[fm.i18n('btnCancel')] = function() { dialog.elfinderdialog('close'); };
15178
 
15179
- fm.dialog(dialog, {
 
 
15180
  title : fm.escape(file.name),
15181
- width : 650,
15182
  resizable : false,
15183
- destroyOnClose : true,
15184
  buttons : buttons,
15185
  open : function() {
15186
- var dw = dialog.width() - 20;
15187
- (preview.width() > dw) && preview.width(dw);
15188
- preview.zIndex(1+$(this).parent().zIndex());
15189
- pwidth = preview.width() - (rhandle.outerWidth() - rhandle.width());
15190
- pheight = preview.height() - (rhandle.outerHeight() - rhandle.height());
15191
  img.attr('src', src + (src.indexOf('?') === -1 ? '?' : '&')+'_='+Math.random());
15192
  imgc.attr('src', img.attr('src'));
15193
  imgr.attr('src', img.attr('src'));
 
 
 
 
 
 
 
 
 
15194
  }
15195
- }).attr('id', id);
15196
 
15197
  // for IE < 9 dialog mising at open second+ time.
15198
  if (fm.UA.ltIE8) {
15199
  $('.elfinder-dialog').css('filter', '');
15200
  }
15201
 
15202
- reset.css('left', width.position().left + width.width() + 12);
15203
-
15204
  coverc.css({ 'opacity': 0.2, 'background-color': '#fff', 'position': 'absolute'}),
15205
  rhandlec.css('cursor', 'move');
15206
  rhandlec.find('.elfinder-resize-handle-point').css({
@@ -15209,10 +21449,12 @@ elFinder.prototype.commands.resize = function() {
15209
  'border-color':'#000'
15210
  });
15211
 
15212
- imgr.css('cursor', 'pointer');
15213
-
15214
- uitype.buttonset();
15215
 
 
 
15216
  },
15217
 
15218
  id, dialog
@@ -15414,7 +21656,7 @@ elFinder.prototype.commands.rm = function() {
15414
  this.getstate = function(sel) {
15415
  var fm = this.fm;
15416
  sel = sel || fm.selected();
15417
- return !this._disabled && sel.length && $.map(sel, function(h) { var f = fm.file(h); return f && f.phash && !f.locked ? h : null }).length == sel.length
15418
  ? 0 : -1;
15419
  }
15420
 
@@ -15431,12 +21673,12 @@ elFinder.prototype.commands.rm = function() {
15431
  tpl = '<div class="ui-helper-clearfix elfinder-rm-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}<div class="elfinder-rm-desc">{desc}</div></div>',
15432
  targets, text, f, fname, size, tmb, descs, dialog;
15433
 
15434
- if (!cnt || this._disabled) {
15435
  return dfrd.reject();
15436
  }
15437
 
15438
  $.each(files, function(i, file) {
15439
- if (!file.phash) {
15440
  return !dfrd.reject(['errRm', file.name, 'errPerm']);
15441
  }
15442
  if (file.locked) {
@@ -15468,9 +21710,7 @@ elFinder.prototype.commands.rm = function() {
15468
  text = [$(tpl.replace('{class}', 'elfinder-cwd-icon-group').replace('{title}', '<strong>' + fm.i18n('items')+ ': ' + cnt + '</strong>').replace('{desc}', descs.join('<br>')))];
15469
  } else {
15470
  f = files[0];
15471
- if (f.tmb) {
15472
- tmb = fm.option('tmbUrl')+f.tmb;
15473
- }
15474
  if (f.size) {
15475
  descs.push(fm.i18n('size')+': '+fm.formatSize(f.size));
15476
  }
@@ -15509,7 +21749,11 @@ elFinder.prototype.commands.rm = function() {
15509
  label : 'btnCancel',
15510
  callback : function() {
15511
  fm.unlockfiles({files : targets});
15512
- fm.selectfiles({files : targets});
 
 
 
 
15513
  dfrd.reject();
15514
  }
15515
  }
@@ -15517,15 +21761,16 @@ elFinder.prototype.commands.rm = function() {
15517
  // load thumbnail
15518
  if (tmb) {
15519
  $('<img/>')
15520
- .load(function() { dialog.find('.elfinder-cwd-icon').css('background', 'url("'+tmb+'") center center no-repeat'); })
15521
- .attr('src', tmb);
15522
  }
15523
  }
15524
 
15525
  return dfrd;
15526
  }
15527
 
15528
- }
 
15529
 
15530
  /*
15531
  * File: /js/commands/search.js
@@ -15560,7 +21805,10 @@ elFinder.prototype.commands.search = function() {
15560
  * @return $.Deferred
15561
  **/
15562
  this.exec = function(q, target, mime) {
15563
- var fm = this.fm;
 
 
 
15564
 
15565
  if (typeof q == 'string' && q) {
15566
  if (typeof target == 'object') {
@@ -15568,20 +21816,98 @@ elFinder.prototype.commands.search = function() {
15568
  target = target.target || '';
15569
  }
15570
  target = target? target : '';
15571
- mime = mime? $.trim(mime).replace(',', ' ').split(' ') : [];
15572
- $.each(mime, function(){ return $.trim(this); });
 
 
 
 
 
 
 
 
 
 
15573
  fm.trigger('searchstart', {query : q, target : target, mimes : mime});
15574
 
15575
- return fm.request({
15576
- data : {cmd : 'search', q : q, target : target, mimes : mime},
15577
- notify : {type : 'search', cnt : 1, hideCnt : true}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15578
  });
15579
  }
15580
  fm.getUI('toolbar').find('.'+fm.res('class', 'searchbtn')+' :text').focus();
15581
  return $.Deferred().reject();
15582
  }
15583
 
15584
- }
 
15585
 
15586
  /*
15587
  * File: /js/commands/sort.js
@@ -15595,8 +21921,41 @@ elFinder.prototype.commands.search = function() {
15595
  **/
15596
  elFinder.prototype.commands.sort = function() {
15597
  var self = this,
15598
- fm = self.fm,
15599
- timer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15600
 
15601
  /**
15602
  * Command options
@@ -15605,50 +21964,48 @@ elFinder.prototype.commands.sort = function() {
15605
  */
15606
  this.options = {ui : 'sortbutton'};
15607
 
15608
- fm.bind('open sortchange', function() {
15609
- self.variants = [];
15610
- $.each(fm.sortRules, function(name, value) {
15611
- var sort = {
15612
- type : name,
15613
- order : name == fm.sortType ? fm.sortOrder == 'asc' ? 'desc' : 'asc' : fm.sortOrder
15614
- };
15615
- var arr = name == fm.sortType ? (sort.order == 'asc'? 'n' : 's') : '';
15616
- self.variants.push([sort, (arr? '<span class="ui-icon ui-icon-arrowthick-1-'+arr+'"></span>' : '') + '&nbsp;' + fm.i18n('sort'+name)]);
15617
  });
15618
- });
15619
-
15620
- fm.bind('open sortchange viewchange search searchend', function() {
15621
- timer && clearTimeout(timer);
15622
- timer = setTimeout(function(){
15623
- var cols = $(fm.cwd).find('div.elfinder-cwd-wrapper-list table');
15624
- if (cols.length) {
15625
- $.each(fm.sortRules, function(name, value) {
15626
- var td = cols.find('thead tr td.elfinder-cwd-view-th-'+name);
15627
- if (td.length) {
15628
- var current = ( name == fm.sortType),
15629
- sort = {
15630
- type : name,
15631
- order : current ? fm.sortOrder == 'asc' ? 'desc' : 'asc' : fm.sortOrder
15632
- },arr;
15633
- if (current) {
15634
- td.addClass('ui-state-active');
15635
- arr = fm.sortOrder == 'asc' ? 'n' : 's';
15636
- $('<span class="ui-icon ui-icon-triangle-1-'+arr+'"/>').appendTo(td);
15637
- }
15638
- $(td).on('click', function(e){
15639
- e.stopPropagation();
15640
- self.exec([], sort);
15641
- })
15642
- .hover(function() {
15643
- $(this).addClass('ui-state-hover');
15644
- },function() {
15645
- $(this).removeClass('ui-state-hover');
15646
- });
15647
  }
15648
-
15649
- });
15650
- }
15651
- }, 100);
 
 
 
 
 
 
 
 
 
 
 
 
 
15652
  });
15653
 
15654
  this.getstate = function() {
@@ -15660,15 +22017,19 @@ elFinder.prototype.commands.sort = function() {
15660
  sort = $.extend({
15661
  type : fm.sortType,
15662
  order : fm.sortOrder,
15663
- stick : fm.sortStickFolders
 
15664
  }, sortopt);
15665
 
15666
- this.fm.setSort(sort.type, sort.order, sort.stick);
15667
- return $.Deferred().resolve();
 
 
15668
  };
15669
 
15670
  };
15671
 
 
15672
  /*
15673
  * File: /js/commands/up.js
15674
  */
@@ -15679,7 +22040,7 @@ elFinder.prototype.commands.sort = function() {
15679
  *
15680
  * @author Dmitry (dio) Levashov
15681
  **/
15682
- elFinder.prototype.commands.up = function() {
15683
  this.alwaysEnabled = true;
15684
  this.updateOnSelect = false;
15685
 
@@ -15692,10 +22053,17 @@ elFinder.prototype.commands.up = function() {
15692
  }
15693
 
15694
  this.exec = function() {
15695
- return this.fm.cwd().phash ? this.fm.exec('open', this.fm.cwd().phash) : $.Deferred().reject();
 
 
 
 
 
 
15696
  }
15697
 
15698
- }
 
15699
 
15700
  /*
15701
  * File: /js/commands/upload.js
@@ -15727,7 +22095,7 @@ elFinder.prototype.commands.upload = function() {
15727
  **/
15728
  this.getstate = function(sel) {
15729
  var fm = this.fm, f,
15730
- sel = fm.directUploadTarget? [fm.directUploadTarget] : (sel || [fm.cwd().hash]);
15731
  if (!this._disabled && sel.length == 1) {
15732
  f = fm.file(sel[0]);
15733
  }
@@ -15737,20 +22105,53 @@ elFinder.prototype.commands.upload = function() {
15737
 
15738
  this.exec = function(data) {
15739
  var fm = this.fm,
15740
- targets = data && (data instanceof Array)? data : null,
15741
- check = !targets && data && data.target? [ data.target ] : targets,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15742
  fmUpload = function(data) {
15743
  fm.upload(data)
15744
  .fail(function(error) {
15745
  dfrd.reject(error);
15746
  })
15747
  .done(function(data) {
15748
- var cwd = fm.getUI('cwd');
 
15749
  dfrd.resolve(data);
15750
- if (data && data.added && data.added[0]) {
15751
- var newItem = cwd.find('#'+fm.cwdHash2Id(data.added[0].hash));
15752
  if (newItem.length) {
15753
  newItem.trigger('scrolltoview');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15754
  }
15755
  }
15756
  });
@@ -15762,12 +22163,58 @@ elFinder.prototype.commands.upload = function() {
15762
  }
15763
  fmUpload(data);
15764
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15765
  dfrd = $.Deferred(),
15766
- dialog, input, button, dropbox, pastebox, dropUpload, paste;
15767
-
15768
- if (this.getstate(check) < 0) {
15769
- return dfrd.reject();
15770
- }
15771
 
15772
  dropUpload = function(e) {
15773
  e.stopPropagation();
@@ -15777,34 +22224,50 @@ elFinder.prototype.commands.upload = function() {
15777
  elfFrom = null,
15778
  mycwd = '',
15779
  data = null,
15780
- target = e._target || null;
15781
- try { elfFrom = e.dataTransfer.getData('elfinderfrom'); } catch(e) {}
15782
- if (elfFrom) {
15783
- mycwd = window.location.href + fm.cwd().hash;
15784
- if ((!target && elfFrom === mycwd) || target === mycwd) {
15785
- dfrd.reject();
15786
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15787
  }
15788
  }
15789
- try{
15790
- data = e.dataTransfer.getData('text/html');
15791
- } catch(e) {}
15792
- if (data) {
15793
- file = [ data ];
15794
- type = 'html';
15795
- } else if (e.dataTransfer && e.dataTransfer.items && e.dataTransfer.items.length) {
15796
- file = e.dataTransfer;
15797
- type = 'data';
15798
- } else if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length) {
15799
- file = e.dataTransfer.files;
15800
- type = 'files';
15801
- } else if (data = e.dataTransfer.getData('text')) {
15802
- file = [ data ];
15803
- type = 'text';
15804
- }
15805
  if (file) {
15806
  fmUpload({files : file, type : type, target : target});
15807
  } else {
 
 
 
 
 
15808
  dfrd.reject();
15809
  }
15810
  };
@@ -15867,8 +22330,15 @@ elFinder.prototype.commands.upload = function() {
15867
  e.originalEvent.dataTransfer.dropEffect = 'copy';
15868
  });
15869
 
15870
- button = $('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+fm.i18n('selectForUpload')+'</span></div>')
15871
  .append($('<form/>').append(input))
 
 
 
 
 
 
 
15872
  .hover(function() {
15873
  button.toggleClass(hover)
15874
  });
@@ -15876,25 +22346,28 @@ elFinder.prototype.commands.upload = function() {
15876
  dialog = $('<div class="elfinder-upload-dialog-wrapper"/>')
15877
  .append(button);
15878
 
15879
- pastebox = $('<div class="ui-corner-all elfinder-upload-dropbox" contenteditable="true">'+fm.i18n('dropFilesBrowser')+'</div>')
15880
- .on('paste drop', function(e){
15881
- paste(e);
15882
- })
15883
- .on('mousedown click', function(){
15884
- $(this).focus();
15885
- })
15886
- .on('focus', function(){
15887
- this.innerHTML = '';
15888
- })
15889
- .on('dragenter mouseover', function(){
15890
- pastebox.addClass(hover);
15891
- })
15892
- .on('dragleave mouseout', function(){
15893
- pastebox.removeClass(hover);
15894
- });
 
 
 
15895
 
15896
  if (fm.dragUpload) {
15897
- dropbox = $('<div class="ui-corner-all elfinder-upload-dropbox" contenteditable="true">'+fm.i18n('dropPasteFiles')+'</div>')
15898
  .on('paste', function(e){
15899
  paste(e);
15900
  })
@@ -15910,43 +22383,54 @@ elFinder.prototype.commands.upload = function() {
15910
  .on('mouseout', function(){
15911
  $(this).removeClass(hover);
15912
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15913
  .prependTo(dialog)
15914
  .after('<div class="elfinder-upload-dialog-or">'+fm.i18n('or')+'</div>')[0];
15915
 
15916
- dropbox.addEventListener('dragenter', function(e) {
15917
- e.stopPropagation();
15918
- e.preventDefault();
15919
- $(dropbox).addClass(hover);
15920
- }, false);
15921
-
15922
- dropbox.addEventListener('dragleave', function(e) {
15923
- e.stopPropagation();
15924
- e.preventDefault();
15925
- $(dropbox).removeClass(hover);
15926
- }, false);
15927
-
15928
- dropbox.addEventListener('dragover', function(e) {
15929
- e.stopPropagation();
15930
- e.preventDefault();
15931
- e.dataTransfer.dropEffect = 'copy';
15932
- $(dropbox).addClass(hover);
15933
- }, false);
15934
-
15935
- dropbox.addEventListener('drop', function(e) {
15936
- dialog.elfinderdialog('close');
15937
- targets && (e._target = targets[0]);
15938
- dropUpload(e);
15939
- }, false);
15940
-
15941
  } else {
15942
- pastebox
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15943
  .prependTo(dialog)
15944
  .after('<div class="elfinder-upload-dialog-or">'+fm.i18n('or')+'</div>')[0];
15945
 
15946
  }
15947
 
15948
- fm.dialog(dialog, {
15949
- title : this.title + (targets? ' - ' + fm.escape(fm.file(targets[0]).name) : ''),
15950
  modal : true,
15951
  resizable : false,
15952
  destroyOnClose : true
@@ -15957,6 +22441,7 @@ elFinder.prototype.commands.upload = function() {
15957
 
15958
  };
15959
 
 
15960
  /*
15961
  * File: /js/commands/view.js
15962
  */
@@ -15968,7 +22453,8 @@ elFinder.prototype.commands.upload = function() {
15968
  * @author Dmitry (dio) Levashov
15969
  **/
15970
  elFinder.prototype.commands.view = function() {
15971
- this.value = this.fm.viewType;
 
15972
  this.alwaysEnabled = true;
15973
  this.updateOnSelect = false;
15974
 
@@ -15979,10 +22465,15 @@ elFinder.prototype.commands.view = function() {
15979
  }
15980
 
15981
  this.exec = function() {
15982
- var value = this.fm.storage('view', this.value == 'list' ? 'icons' : 'list');
15983
- this.fm.viewchange();
15984
- this.update(void(0), value);
 
 
 
 
15985
  }
15986
 
15987
- }
 
15988
  })(jQuery);
1
  /*!
2
  * elFinder - file manager for web
3
+ * Version 2.1.18 (2016-11-21)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
+ * Licensed under a 3-clauses BSD license
8
  */
9
  (function($) {
10
 
20
  **/
21
  window.elFinder = function(node, opts) {
22
  //this.time('load');
23
+
24
  var self = this,
25
 
26
  /**
58
  *
59
  * @type String
60
  **/
61
+ namespace = 'elfinder-' + (id ? id : Math.random().toString().substr(2, 7)),
62
 
63
  /**
64
  * Mousedown event
100
  *
101
  * @type Array
102
  **/
103
+ events = ['enable', 'disable', 'load', 'open', 'reload', 'select', 'add', 'remove', 'change', 'dblclick', 'getfile', 'lockfiles', 'unlockfiles', 'selectfiles', 'unselectfiles', 'dragstart', 'dragstop', 'search', 'searchend', 'viewchange'],
104
 
105
  /**
106
  * Rules to validate data from backend
133
  uploadOverwrite : true,
134
  uploadMaxSize : 0,
135
  jpgQuality : 100,
136
+ tmbCrop : false,
137
  tmb : false // old API
138
  },
139
 
188
  **/
189
  queue = [],
190
 
191
+ /**
192
+ * Queue for only cwd requests e.g. `tmb`
193
+ *
194
+ * @type Array
195
+ **/
196
+ cwdQueue = [],
197
+
198
  /**
199
  * Commands prototype
200
  *
223
  * @type String
224
  * @default ./sounds/
225
  **/
226
+ soundPath = './sounds/',
227
 
228
  beeper = $(document.createElement('audio')).hide().appendTo('body')[0],
229
 
230
  syncInterval,
231
+ autoSyncStop = 0,
232
 
233
  uiCmdMapPrev = '',
234
 
235
  open = function(data) {
236
+ // NOTES: Do not touch data object
237
+
238
+ var volumeid, contextmenu, emptyDirs = {}, stayDirs = {},
239
+ rmClass, hashes, calc, gc, collapsed, prevcwd;
240
 
241
+ if (self.api >= 2.1) {
242
+ self.commandMap = (data.options.uiCmdMap && Object.keys(data.options.uiCmdMap).length)? data.options.uiCmdMap : {};
243
+
244
+ // support volume driver option `uiCmdMap`
245
+ if (uiCmdMapPrev !== JSON.stringify(self.commandMap)) {
246
+ uiCmdMapPrev = JSON.stringify(self.commandMap);
247
+ if (Object.keys(self.commandMap).length) {
248
+ // for contextmenu
249
+ contextmenu = self.getUI('contextmenu');
250
+ if (!contextmenu.data('cmdMaps')) {
251
+ contextmenu.data('cmdMaps', {});
252
+ }
253
+ volumeid = data.cwd? data.cwd.volumeid : null;
254
+ if (volumeid && !contextmenu.data('cmdMaps')[volumeid]) {
255
+ contextmenu.data('cmdMaps')[volumeid] = self.commandMap;
256
+ }
257
  }
258
  }
259
+ } else {
260
+ self.options.sync = 0;
261
  }
262
 
263
  if (data.init) {
266
  } else {
267
  // remove only files from prev cwd
268
  // and collapsed directory (included 100+ directories) to empty for perfomance tune in DnD
269
+ prevcwd = cwd;
270
+ rmClass = 'elfinder-subtree-loaded ' + self.res('class', 'navexpand');
271
+ collapsed = self.res('class', 'navcollapse');
272
+ hashes = Object.keys(files);
273
+ calc = function(n, i) {
274
+ if (!files[i]) {
275
+ return true;
276
+ }
277
+
278
  var isDir = (files[i].mime === 'directory'),
279
  phash = files[i].phash,
 
280
  pnav;
281
+
282
  if (
283
  (!isDir
284
  || emptyDirs[phash]
287
  && $('#'+self.navHash2Id(phash)).next('.elfinder-navbar-subtree').children().length > 100
288
  )
289
  )
290
+ && (isDir || phash !== cwd)
291
  && $.inArray(i, remember) === -1
292
  ) {
293
  if (isDir && !emptyDirs[phash]) {
294
  emptyDirs[phash] = true;
295
+ $('#'+self.navHash2Id(phash))
296
+ .removeClass(rmClass)
297
+ .next('.elfinder-navbar-subtree').empty();
298
  }
299
  delete files[i];
300
  } else if (isDir) {
301
  stayDirs[phash] = true;
302
  }
303
+ };
304
+ gc = function() {
305
+ if (hashes.length) {
306
+ $.each(hashes.splice(0, 100), calc);
307
+ if (hashes.length) {
308
+ setTimeout(gc, 20);
309
+ }
310
+ }
311
+ };
312
+
313
+ self.trigger('filesgc').one('filesgc', function() {
314
+ hashes = [];
315
  });
316
+
317
+ self.one('opendone', function() {
318
+ if (prevcwd !== cwd) {
319
+ if (! node.data('lazycnt')) {
320
+ gc();
321
+ } else {
322
+ self.one('lazydone', gc);
323
+ }
324
+ }
325
  });
326
  }
327
 
328
+ self.sorters = [];
329
  cwd = data.cwd.hash;
330
  cache(data.files);
331
  if (!files[cwd]) {
343
  * @return void
344
  **/
345
  cache = function(data) {
346
+ var defsorter = { name: true, perm: true, date: true, size: true, kind: true },
347
+ sorterChk = (self.sorters.length === 0),
348
+ l = data.length,
349
+ f, i;
350
 
351
  for (i = 0; i < l; i++) {
352
  f = data[i];
353
  if (f.name && f.hash && f.mime) {
354
+ if (sorterChk && f.phash === cwd) {
355
+ $.each(self.sortRules, function(key) {
356
+ if (defsorter[key] || typeof f[key] !== 'undefined' || (key === 'mode' && typeof f.perm !== 'undefined')) {
357
+ self.sorters.push(key);
358
+ }
359
+ });
360
+ sorterChk = false;
361
+ }
362
+
363
+ // make or update of leaf roots cache
364
+ if (f.isroot && f.phash) {
365
+ if (! self.leafRoots[f.phash]) {
366
+ self.leafRoots[f.phash] = [ f.hash ];
367
+ } else {
368
+ if ($.inArray(f.hash, self.leafRoots[f.phash]) === -1) {
369
+ self.leafRoots[f.phash].push(f.hash);
370
+ }
371
  }
372
+ if (files[f.phash]) {
373
+ if (! files[f.phash].dirs) {
374
+ files[f.phash].dirs = 1;
375
+ }
376
+ if (f.ts && (files[f.phash].ts || 0) < f.ts) {
377
+ files[f.phash].ts = f.ts;
378
+ }
379
  }
380
  }
381
+
382
  files[f.hash] = f;
383
  }
384
  }
392
  */
393
  execShortcut = function(e) {
394
  var code = e.keyCode,
395
+ ctrlKey = !!(e.ctrlKey || e.metaKey),
396
+ ddm;
397
 
398
  if (enabled) {
399
 
403
  && shortcut.shiftKey == e.shiftKey
404
  && shortcut.ctrlKey == ctrlKey
405
  && shortcut.altKey == e.altKey) {
406
+ e.preventDefault();
407
  e.stopPropagation();
408
  shortcut.callback(e, self);
409
  self.debug('shortcut-exec', i+' : '+shortcut.description);
411
  });
412
 
413
  // prevent tab out of elfinder
414
+ if (code == $.ui.keyCode.TAB && !$(e.target).is(':input')) {
415
  e.preventDefault();
416
  }
417
 
418
+ // cancel any actions by [Esc] key
419
+ if (e.type === 'keydown' && code == $.ui.keyCode.ESCAPE) {
420
+ // copy or cut
421
+ if (! node.find('.ui-widget:visible').length) {
422
+ self.clipboard().length && self.clipboard([]);
423
+ }
424
+ // dragging
425
+ if ($.ui.ddmanager) {
426
+ ddm = $.ui.ddmanager.current;
427
+ ddm && ddm.helper && ddm.cancel();
428
+ }
429
+ // button menus
430
+ node.find('.ui-widget.elfinder-button-menu').hide();
431
  }
432
 
433
  }
434
  },
435
  date = new Date(),
436
  utc,
437
+ i18n,
438
+ inFrame = (window.parent !== window),
439
+ parentIframe = (function() {
440
+ var pifm, ifms;
441
+ if (inFrame) {
442
+ try {
443
+ ifms = $('iframe', window.parent.document);
444
+ if (ifms.length) {
445
+ $.each(ifms, function(i, ifm) {
446
+ if (ifm.contentWindow === window) {
447
+ pifm = $(ifm);
448
+ return false;
449
+ }
450
+ });
451
+ }
452
+ } catch(e) {}
453
+ }
454
+ return pifm;
455
+ })();
456
  ;
457
 
458
 
483
  * @type Array
484
  **/
485
  this.netDrivers = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
 
487
  /**
488
  * Configuration options
491
  **/
492
  this.options = $.extend(true, {}, this._options, opts||{});
493
 
494
+ /**
495
+ * Volume option to set the properties of the root Stat
496
+ *
497
+ * @type Array
498
+ */
499
+ this.optionProperties = ['icon', 'csscls', 'tmbUrl', 'uiCmdMap', 'netkey'];
500
+
501
  if (opts.ui) {
502
  this.options.ui = opts.ui;
503
  }
517
  this.options.uiOptions.cwd.listView.columnsCustomName = opts.uiOptions.cwd.listView.columnsCustomName;
518
  }
519
 
520
+ if (! inFrame && ! this.options.enableAlways && $('body').children().length === 2) { // only node and beeper
521
+ this.options.enableAlways = true;
522
+ }
523
+
524
+ /**
525
+ * Is elFinder over CORS
526
+ *
527
+ * @type Boolean
528
+ **/
529
+ this.isCORS = false;
530
+
531
  // configure for CORS
532
  (function(){
533
  var parseUrl = document.createElement('a'),
538
  parseUploadUrl.href = opts.urlUpload;
539
  }
540
  if (window.location.host !== parseUrl.host || (parseUploadUrl && (window.location.host !== parseUploadUrl.host))) {
541
+ self.isCORS = true;
542
  if (!$.isPlainObject(self.options.customHeaders)) {
543
  self.options.customHeaders = {};
544
  }
559
  * @type String
560
  * @default "get"
561
  **/
562
+ this.requestType = /^(get|post)$/i.test(this.options.requestType) ? this.options.requestType.toLowerCase() : 'get';
563
 
564
  /**
565
  * Any data to send across every ajax request
585
  */
586
  this.xhrFields = $.isPlainObject(this.options.xhrFields) ? this.options.xhrFields : {};
587
 
588
+ /**
589
+ * command names for into queue for only cwd requests
590
+ * these commands aborts before `open` request
591
+ *
592
+ * @type Array
593
+ * @default ['tmb']
594
+ */
595
+ this.abortCmdsOnOpen = this.options.abortCmdsOnOpen || ['tmb'];
596
+
597
  /**
598
  * ID. Required to create unique cookie name
599
  *
704
  *
705
  * @type String
706
  **/
707
+ this.cssClass = 'ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-'
708
+ +(this.direction == 'rtl' ? 'rtl' : 'ltr')
709
+ +(this.UA.Touch? (' elfinder-touch' + (this.options.resizable ? ' touch-punch' : '')) : '')
710
+ +(this.UA.Mobile? ' elfinder-mobile' : '')
711
+ +' '+this.options.cssClass;
712
+
713
+ /**
714
+ * elFinder node z-index (auto detect on elFinder load)
715
+ *
716
+ * @type null | Number
717
+ **/
718
+ this.zIndex;
719
+
720
+ /**
721
+ * Current search status
722
+ *
723
+ * @type Object
724
+ */
725
+ this.searchStatus = {
726
+ state : 0, // 0: search ended, 1: search started, 2: in search result
727
+ query : '',
728
+ target : '',
729
+ mime : '',
730
+ mixed : false, // in multi volumes search
731
+ ininc : false // in incremental search
732
+ };
733
 
734
  /**
735
  * Method to store/fetch data
738
  **/
739
  this.storage = (function() {
740
  try {
741
+ if ('localStorage' in window && window['localStorage'] !== null) {
742
+ if (self.UA.Safari) {
743
+ // check for Mac/iOS safari private browsing mode
744
+ window.localStorage.setItem('elfstoragecheck', 1);
745
+ window.localStorage.removeItem('elfstoragecheck');
746
+ }
747
+ return self.localStorage;
748
+ } else {
749
+ return self.cookie;
750
+ }
751
  } catch (e) {
752
  return self.cookie;
753
  }
760
  this.sortOrder = this.storage('sortOrder') || this.options.sortOrder || 'asc';
761
 
762
  this.sortStickFolders = this.storage('sortStickFolders');
 
763
  if (this.sortStickFolders === null) {
764
  this.sortStickFolders = !!this.options.sortStickFolders;
765
  } else {
766
  this.sortStickFolders = !!this.sortStickFolders
767
  }
768
 
769
+ this.sortAlsoTreeview = this.storage('sortAlsoTreeview');
770
+ if (this.sortAlsoTreeview === null) {
771
+ this.sortAlsoTreeview = !!this.options.sortAlsoTreeview;
772
+ } else {
773
+ this.sortAlsoTreeview = !!this.sortAlsoTreeview
774
+ }
775
+
776
+ this.sortRules = $.extend(true, {}, this._sortRules, this.options.sortRules);
777
 
778
  $.each(this.sortRules, function(name, method) {
779
  if (typeof method != 'function') {
796
  *
797
  * @type jQuery | null
798
  **/
799
+ this.draggingUiHelper = null;
800
 
801
+ // draggable closure
802
+ (function() {
803
+ var ltr, wzRect, wzBottom, nodeStyle,
804
+ keyEvt = keydown + 'draggable' + ' keyup.' + namespace + 'draggable';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805
 
806
+ /**
807
+ * Base draggable options
808
+ *
809
+ * @type Object
810
+ **/
811
+ self.draggable = {
812
+ appendTo : node,
813
+ addClasses : false,
814
+ distance : 4,
815
+ revert : true,
816
+ refreshPositions : false,
817
+ cursor : 'crosshair',
818
+ cursorAt : {left : 50, top : 47},
819
+ scroll : false,
820
+ start : function(e, ui) {
821
+ var helper = ui.helper,
822
+ targets = $.map(helper.data('files')||[], function(h) { return h || null ;}),
823
+ locked = false,
824
+ cnt, h;
825
+
826
+ // fix node size
827
+ nodeStyle = node.attr('style');
828
+ node.width(node.width()).height(node.height());
829
+
830
+ // set var for drag()
831
+ ltr = (self.direction === 'ltr');
832
+ wzRect = self.getUI('workzone').data('rectangle');
833
+ wzBottom = wzRect.top + wzRect.height;
834
+
835
+ self.draggingUiHelper = helper;
836
+ cnt = targets.length;
837
+ while (cnt--) {
838
+ h = targets[cnt];
839
+ if (files[h].locked) {
840
+ locked = true;
841
+ helper.data('locked', true);
842
+ break;
843
  }
844
  }
845
+ !locked && self.trigger('lockfiles', {files : targets});
 
 
 
 
846
 
847
+ helper.data('autoScrTm', setInterval(function() {
848
+ if (helper.data('autoScr')) {
849
+ self.autoScroll[helper.data('autoScr')](helper.data('autoScrVal'));
850
+ }
851
+ }, 50));
852
+ },
853
+ drag : function(e, ui) {
854
+ var helper = ui.helper,
855
+ autoUp;
856
+
857
+ if ((autoUp = wzRect.top > e.pageY) || wzBottom < e.pageY) {
858
+ if (wzRect.cwdEdge > e.pageX) {
859
+ helper.data('autoScr', (ltr? 'navbar' : 'cwd') + (autoUp? 'Up' : 'Down'));
860
+ } else {
861
+ helper.data('autoScr', (ltr? 'cwd' : 'navbar') + (autoUp? 'Up' : 'Down'));
862
+ }
863
+ helper.data('autoScrVal', Math.pow((autoUp? wzRect.top - e.pageY : e.pageY - wzBottom), 1.3));
 
 
 
 
 
 
 
 
 
 
 
864
  } else {
865
+ if (helper.data('autoScr')) {
866
+ helper.data('refreshPositions', 1).data('autoScr', null);
867
+ }
868
  }
869
+ if (helper.data('refreshPositions') && $(this).elfUiWidgetInstance('draggable')) {
870
+ if (helper.data('refreshPositions') > 0) {
871
+ $(this).draggable('option', { refreshPositions : true, elfRefresh : true });
872
+ helper.data('refreshPositions', -1);
 
 
 
 
873
  } else {
874
+ $(this).draggable('option', { refreshPositions : false, elfRefresh : false });
875
+ helper.data('refreshPositions', null);
876
  }
877
  }
878
+ },
879
+ stop : function(e, ui) {
880
+ var helper = ui.helper,
881
+ files;
882
 
883
+ $(document).off(keyEvt);
884
+ $(this).elfUiWidgetInstance('draggable') && $(this).draggable('option', { refreshPositions : false });
885
+ self.draggingUiHelper = null;
886
+ self.trigger('focus').trigger('dragstop');
887
+ if (! helper.data('droped')) {
888
+ files = $.map(helper.data('files')||[], function(h) { return h || null ;});
889
+ self.trigger('unlockfiles', {files : files});
890
+ self.trigger('selectfiles', {files : files});
891
  }
892
+ self.enable();
893
 
894
+ // restore node style
895
+ node.attr('style', nodeStyle);
896
 
897
+ helper.data('autoScrTm') && clearInterval(helper.data('autoScrTm'));
898
+ },
899
+ helper : function(e, ui) {
900
+ var element = this.id ? $(this) : $(this).parents('[id]:first'),
901
+ helper = $('<div class="elfinder-drag-helper"><span class="elfinder-drag-helper-icon-status"/></div>'),
902
+ icon = function(f) {
903
+ var mime = f.mime, i, tmb = self.tmb(f);
904
+ i = '<div class="elfinder-cwd-icon '+self.mime2class(mime)+' ui-corner-all"/>';
905
+ if (tmb) {
906
+ i = $(i).addClass(tmb.className).css('background-image', "url('"+tmb.url+"')").get(0).outerHTML;
907
+ }
908
+ return i;
909
+ },
910
+ hashes, l, ctr;
911
 
912
+ self.draggingUiHelper && self.draggingUiHelper.stop(true, true);
913
+
914
+ self.trigger('dragstart', {target : element[0], originalEvent : e});
915
+
916
+ hashes = element.hasClass(self.res('class', 'cwdfile'))
917
+ ? self.selected()
918
+ : [self.navId2Hash(element.attr('id'))];
919
+
920
+ helper.append(icon(files[hashes[0]])).data('files', hashes).data('locked', false).data('droped', false).data('namespace', namespace).data('dropover', 0);
921
+
922
+ if ((l = hashes.length) > 1) {
923
+ helper.append(icon(files[hashes[l-1]]) + '<span class="elfinder-drag-num">'+l+'</span>');
924
  }
925
+
926
+ $(document).on(keyEvt, function(e){
927
+ var chk = (e.shiftKey||e.ctrlKey||e.metaKey);
928
+ if (ctr !== chk) {
929
+ ctr = chk;
930
+ if (helper.is(':visible') && helper.data('dropover') && ! helper.data('droped')) {
931
+ helper.toggleClass('elfinder-drag-helper-plus', helper.data('locked')? true : ctr);
932
+ self.trigger(ctr? 'unlockfiles' : 'lockfiles', {files : hashes, helper: helper});
933
+ }
934
+ }
935
+ });
936
+
937
+ return helper;
938
  }
939
  };
940
+ })();
941
+
942
+ /**
943
+ * Base droppable options
944
+ *
945
+ * @type Object
946
+ **/
947
+ this.droppable = {
948
+ greedy : true,
949
+ tolerance : 'pointer',
950
+ accept : '.elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename',
951
+ hoverClass : this.res('class', 'adroppable'),
952
+ classes : { // Deprecated hoverClass jQueryUI>=1.12.0
953
+ 'ui-droppable-hover': this.res('class', 'adroppable')
954
+ },
955
+ autoDisable: true, // elFinder original, see jquery.elfinder.js
956
+ drop : function(e, ui) {
957
+ var dst = $(this),
958
+ targets = $.map(ui.helper.data('files')||[], function(h) { return h || null }),
959
+ result = [],
960
+ dups = [],
961
+ faults = [],
962
+ isCopy = ui.helper.hasClass('elfinder-drag-helper-plus'),
963
+ c = 'class',
964
+ cnt, hash, i, h;
965
+
966
+ if (typeof e.button === 'undefined' || ui.helper.data('namespace') !== namespace || ! self.insideWorkzone(e.pageX, e.pageY)) {
967
+ return false;
968
+ }
969
+ if (dst.hasClass(self.res(c, 'cwdfile'))) {
970
+ hash = self.cwdId2Hash(dst.attr('id'));
971
+ } else if (dst.hasClass(self.res(c, 'navdir'))) {
972
+ hash = self.navId2Hash(dst.attr('id'));
973
+ } else {
974
+ hash = cwd;
975
+ }
976
+
977
+ cnt = targets.length;
978
+
979
+ while (cnt--) {
980
+ h = targets[cnt];
981
+ // ignore drop into itself or in own location
982
+ if (h != hash && files[h].phash != hash) {
983
+ result.push(h);
984
+ } else {
985
+ ((isCopy && h !== hash && files[hash].write)? dups : faults).push(h);
986
+ }
987
+ }
988
+
989
+ if (faults.length) {
990
+ return false;
991
+ }
992
+
993
+ ui.helper.data('droped', true);
994
+
995
+ if (dups.length) {
996
+ ui.helper.hide();
997
+ self.exec('duplicate', dups);
998
+ }
999
+
1000
+ if (result.length) {
1001
+ ui.helper.hide();
1002
+ self.clipboard(result, !isCopy);
1003
+ self.exec('paste', hash, void 0, hash).always(function(){
1004
+ self.clipboard([]);
1005
+ self.trigger('unlockfiles', {files : targets});
1006
+ });
1007
+ self.trigger('drop', {files : targets});
1008
+ }
1009
+ }
1010
+ };
1011
 
1012
  /**
1013
  * Return true if filemanager is active
1015
  * @return Boolean
1016
  **/
1017
  this.enabled = function() {
1018
+ return enabled && this.visible();
1019
+ };
1020
 
1021
  /**
1022
  * Return true if filemanager is visible
1024
  * @return Boolean
1025
  **/
1026
  this.visible = function() {
1027
+ return node[0].elfinder && node.is(':visible');
1028
+ };
1029
+
1030
+ /**
1031
+ * Return file is root?
1032
+ *
1033
+ * @param Object target file object
1034
+ * @return Boolean
1035
+ */
1036
+ this.isRoot = function(file) {
1037
+ return (file.isroot || ! file.phash)? true : false;
1038
  }
1039
 
1040
  /**
1041
  * Return root dir hash for current working directory
1042
  *
1043
+ * @param String target hash
1044
+ * @param Boolean include fake parent (optional)
1045
  * @return String
1046
  */
1047
+ this.root = function(hash, fake) {
1048
+ hash = hash || cwd;
1049
+ var dir, i;
1050
+
1051
+ if (! fake) {
1052
+ $.each(self.roots, function(id, rhash) {
1053
+ if (hash.indexOf(id) === 0) {
1054
+ dir = rhash;
1055
+ return false;
1056
+ }
1057
+ });
1058
+ if (dir) {
1059
+ return dir;
1060
+ }
1061
+ }
1062
 
1063
+ dir = files[hash];
1064
+ while (dir && dir.phash && (fake || ! dir.isroot)) {
1065
  dir = files[dir.phash]
1066
  }
1067
  if (dir) {
1076
  }
1077
 
1078
  return '';
1079
+ };
1080
 
1081
  /**
1082
  * Return current working directory info
1085
  */
1086
  this.cwd = function() {
1087
  return files[cwd] || {};
1088
+ };
1089
 
1090
  /**
1091
  * Return required cwd option
1092
  *
1093
  * @param String option name
1094
+ * @param String target hash (optional)
1095
  * @return mixed
1096
  */
1097
+ this.option = function(name, target) {
1098
+ if (target && cwd !== target) {
1099
+ var res = '';
1100
+ $.each(self.volOptions, function(id, opt) {
1101
+ if (target.indexOf(id) === 0) {
1102
+ res = opt[name] || '';
1103
+ return false;
1104
+ }
1105
+ });
1106
+ return res;
1107
+ } else {
1108
+ return cwdOptions[name] || '';
1109
+ }
1110
+ };
1111
 
1112
  /**
1113
  * Return file data from current dir or tree by it's hash
1116
  * @return Object
1117
  */
1118
  this.file = function(hash) {
1119
+ return hash? files[hash] : void(0);
1120
  };
1121
 
1122
  /**
1126
  */
1127
  this.files = function() {
1128
  return $.extend(true, {}, files);
1129
+ };
1130
 
1131
  /**
1132
  * Return list of file parents hashes include file hash
1143
  hash = dir.phash;
1144
  }
1145
  return parents;
1146
+ };
1147
 
1148
  this.path2array = function(hash, i18) {
1149
  var file,
1150
  path = [];
1151
 
1152
+ while (hash) {
1153
+ if ((file = files[hash]) && file.hash) {
1154
+ path.unshift(i18 && file.i18 ? file.i18 : file.name);
1155
+ hash = file.isroot? null : file.phash;
1156
+ } else {
1157
+ path = [];
1158
+ break;
1159
+ }
1160
  }
1161
 
1162
  return path;
1163
+ };
1164
 
1165
  /**
1166
+ * Return file path or Get path async with jQuery.Deferred
1167
  *
1168
  * @param Object file
1169
+ * @param Boolean i18
1170
+ * @param Object asyncOpt
1171
+ * @return String|jQuery.Deferred
1172
  */
1173
+ this.path = function(hash, i18, asyncOpt) {
1174
+ var path = files[hash] && files[hash].path
1175
  ? files[hash].path
1176
  : this.path2array(hash, i18).join(cwdOptions.separator);
1177
+ if (! asyncOpt || ! files[hash]) {
1178
+ return path;
1179
+ } else {
1180
+ asyncOpt = $.extend({notify: {type : 'parents', cnt : 1, hideCnt : true}}, asyncOpt);
1181
+
1182
+ var dfd = $.Deferred(),
1183
+ notify = asyncOpt.notify,
1184
+ noreq = false,
1185
+ req = function() {
1186
+ self.request({
1187
+ data : {cmd : 'parents', target : files[hash].phash},
1188
+ notify : notify,
1189
+ preventFail : true
1190
+ })
1191
+ .done(done)
1192
+ .fail(function() {
1193
+ dfd.reject();
1194
+ });
1195
+ },
1196
+ done = function() {
1197
+ self.one('parentsdone', function() {
1198
+ path = self.path(hash, i18);
1199
+ if (path === '' && noreq) {
1200
+ //retry with request
1201
+ noreq = false;
1202
+ req();
1203
+ } else {
1204
+ if (notify) {
1205
+ clearTimeout(ntftm);
1206
+ notify.cnt = -(parseInt(notify.cnt || 0));
1207
+ self.notify(notify);
1208
+ }
1209
+ dfd.resolve(path);
1210
+ }
1211
+ });
1212
+ },
1213
+ ntftm;
1214
+
1215
+ if (path) {
1216
+ return dfd.resolve(path);
1217
+ } else {
1218
+ if (self.ui['tree']) {
1219
+ // try as no request
1220
+ if (notify) {
1221
+ ntftm = setTimeout(function() {
1222
+ self.notify(notify);
1223
+ }, self.notifyDelay);
1224
+ }
1225
+ noreq = true;
1226
+ done(true);
1227
+ } else {
1228
+ req();
1229
+ }
1230
+ return dfd;
1231
+ }
1232
+ }
1233
+ };
1234
+
1235
+ /**
1236
+ * Return file url if set
1237
+ *
1238
+ * @param String file hash
1239
+ * @return String
1240
  */
1241
  this.url = function(hash) {
1242
+ var file = files[hash],
1243
+ baseUrl;
1244
 
1245
  if (!file || !file.read) {
1246
  return '';
1264
  return file.url;
1265
  }
1266
 
1267
+ baseUrl = (file.hash.indexOf(self.cwd().volumeid) === 0)? cwdOptions.url : this.option('url', file.hash);
1268
+
1269
+ if (baseUrl) {
1270
+ return baseUrl + $.map(this.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/')
1271
  }
1272
 
1273
  var params = $.extend({}, this.customData, {
1279
  params.current = file.phash;
1280
  }
1281
  return this.options.url + (this.options.url.indexOf('?') === -1 ? '?' : '&') + $.param(params, true);
1282
+ };
1283
 
1284
  /**
1285
  * Convert from relative URL to abstract URL based on current URL
1291
  if (url.match(/^http/i)) {
1292
  return url;
1293
  }
1294
+ if (url.substr(0,2) === '//') {
1295
+ return window.location.protocol + url;
1296
+ }
1297
  var root = window.location.protocol + '//' + window.location.host,
1298
  reg = /[^\/]+\/\.\.\//,
1299
  ret;
1300
  if (url.substr(0, 1) === '/') {
1301
  ret = root + url;
1302
  } else {
1303
+ ret = root + window.location.pathname.replace(/\/[^\/]+$/, '/') + url;
1304
  }
1305
  ret = ret.replace('/./', '/');
1306
  while(reg.test(ret)) {
1307
  ret = ret.replace(reg, '');
1308
  }
1309
  return ret;
1310
+ };
1311
 
1312
  /**
1313
  * Return file url for open in elFinder
1314
  *
1315
  * @param String file hash
1316
+ * @param Boolean for download link
1317
  * @return String
1318
  */
1319
  this.openUrl = function(hash, download) {
1329
  if (file.url != 1) {
1330
  return file.url;
1331
  }
1332
+ } else if (cwdOptions.url && file.hash.indexOf(self.cwd().volumeid) === 0) {
1333
  return cwdOptions.url + $.map(this.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/');
1334
  }
1335
  }
1348
  });
1349
 
1350
  return url;
1351
+ };
1352
 
1353
  /**
1354
  * Return thumbnail url
1355
  *
1356
+ * @param Object file object
1357
  * @return String
1358
  */
1359
+ this.tmb = function(file) {
1360
+ var tmbUrl, tmbCrop,
1361
+ cls = 'elfinder-cwd-bgurl',
1362
+ url = '';
1363
+
1364
+ if ($.isPlainObject(file)) {
1365
+ if (self.searchStatus.state && file.hash.indexOf(self.cwd().volumeid) !== 0) {
1366
+ tmbUrl = self.option('tmbUrl', file.hash);
1367
+ tmbCrop = self.option('tmbCrop', file.hash);
1368
+ } else {
1369
+ tmbUrl = cwdOptions['tmbUrl'];
1370
+ tmbCrop = cwdOptions['tmbCrop'];
1371
+ }
1372
+ if (tmbCrop) {
1373
+ cls += ' elfinder-cwd-bgurl-crop';
1374
+ }
1375
+ if (tmbUrl === 'self' && file.mime.indexOf('image/') === 0) {
1376
+ url = self.openUrl(file.hash);
1377
+ cls += ' elfinder-cwd-bgself';
1378
+ } else if ((self.oldAPI || tmbUrl) && file && file.tmb && file.tmb != 1) {
1379
+ url = tmbUrl + file.tmb;
1380
+ }
1381
+ if (url) {
1382
+ return { url: url, className: cls };
1383
+ }
1384
+ }
1385
 
1386
+ return false;
1387
+ };
1388
 
1389
  /**
1390
  * Return selected files hashes
1393
  **/
1394
  this.selected = function() {
1395
  return selected.slice(0);
1396
+ };
1397
 
1398
  /**
1399
  * Return selected files info
1430
  */
1431
  this.validResponse = function(cmd, data) {
1432
  return data.error || this.rules[this.rules[cmd] ? cmd : 'defaults'](data);
1433
+ };
1434
 
1435
  /**
1436
  * Return bytes from ini formated size
1441
  this.returnBytes = function(val) {
1442
  var last;
1443
  if (isNaN(val)) {
1444
+ if (! val) {
1445
+ val = '';
1446
+ }
1447
  // for ex. 1mb, 1KB
1448
  val = val.replace(/b$/i, '');
1449
  last = val.charAt(val.length - 1).toLowerCase();
1473
  * @todo
1474
  * @return $.Deferred
1475
  */
1476
+ this.request = function(opts) {
1477
  var self = this,
1478
  o = this.options,
1479
  dfrd = $.Deferred(),
1480
  // request data
1481
+ data = $.extend({}, o.customData, {mimes : o.onlyMimes}, opts.data || opts),
1482
  // command name
1483
  cmd = data.cmd,
1484
+ isOpen = (cmd === 'open'),
1485
  // call default fail callback (display error dialog) ?
1486
+ deffail = !(opts.preventDefault || opts.preventFail),
1487
  // call default success callback ?
1488
+ defdone = !(opts.preventDefault || opts.preventDone),
1489
  // options for notify dialog
1490
+ notify = $.extend({}, opts.notify),
1491
+ // make cancel button
1492
+ cancel = !!opts.cancel,
1493
  // do not normalize data - return as is
1494
+ raw = !!opts.raw,
1495
  // sync files on request fail
1496
+ syncOnFail = opts.syncOnFail,
1497
+ // use lazy()
1498
+ lazy = !!opts.lazy,
1499
+ // prepare function before done()
1500
+ prepare = opts.prepare,
1501
+ // open notify dialog timeout
1502
+ timeout,
1503
  // request options
1504
  options = $.extend({
1505
  url : o.url,
1511
  data : data,
1512
  headers : this.customHeaders,
1513
  xhrFields: this.xhrFields
1514
+ }, opts.options || {}),
1515
  /**
1516
  * Default success handler.
1517
  * Call default data handlers and fire event with command name.
1520
  * @return void
1521
  **/
1522
  done = function(data) {
 
 
 
 
1523
  data.warning && self.error(data.warning);
1524
 
1525
+ isOpen && open(data);
1526
+
1527
+ self.lazy(function() {
1528
+ // fire some event to update cache/ui
1529
+ data.removed && data.removed.length && self.remove(data);
1530
+ data.added && data.added.length && self.add(data);
1531
+ data.changed && data.changed.length && self.change(data);
1532
+ }).then(function() {
1533
+ // fire event with command name
1534
+ return self.lazy(function() {
1535
+ self.trigger(cmd, data);
1536
+ });
1537
+ }).then(function() {
1538
+ // fire event with command name + 'done'
1539
+ return self.lazy(function() {
1540
+ self.trigger(cmd + 'done');
1541
+ });
1542
+ }).then(function() {
1543
+ // force update content
1544
+ data.sync && self.sync();
1545
+ });
1546
  },
1547
  /**
1548
  * Request error handler. Reject dfrd with correct error message.
1552
  * @return void
1553
  **/
1554
  error = function(xhr, status) {
 
 
 
 
1555
  var error;
1556
 
1557
  switch (status) {
1563
  break;
1564
  case 'parsererror':
1565
  error = ['errResponse', 'errDataNotJSON'];
1566
+ if (xhr.responseText) {
1567
+ self.debug('backend-debug', { debug: {phpErrors: [ xhr.responseText] }});
1568
+ if (! cwd) {
1569
+ xhr.responseText && error.push(xhr.responseText);
1570
+ }
1571
+ }
1572
  break;
1573
  default:
1574
  if (xhr.status == 403) {
1575
+ error = ['errConnect', 'errAccess', 'HTTP error ' + xhr.status];
1576
  } else if (xhr.status == 404) {
1577
+ error = ['errConnect', 'errNotFound', 'HTTP error ' + xhr.status];
1578
  } else {
1579
+ if (xhr.status == 414 && options.type === 'get') {
1580
+ // retry by POST method
1581
+ options.type = 'post';
1582
+ dfrd.xhr = xhr = self.transport.send(options).fail(error).done(success);
1583
+ return;
1584
+ }
1585
+ error = xhr.quiet ? '' : ['errConnect', 'HTTP error ' + xhr.status];
1586
  }
1587
  }
1588
 
1596
  * @return void
1597
  **/
1598
  success = function(response) {
 
 
 
 
1599
  // Set currrent request command name
1600
  self.currentReqCmd = cmd;
1601
 
1602
  if (raw) {
1603
+ response && response.debug && self.debug('backend-debug', response);
1604
  return dfrd.resolve(response);
1605
  }
1606
 
1607
  if (!response) {
1608
+ return dfrd.reject(['errResponse', 'errDataEmpty'], xhr, response);
1609
  } else if (!$.isPlainObject(response)) {
1610
+ return dfrd.reject(['errResponse', 'errDataNotJSON'], xhr, response);
1611
  } else if (response.error) {
1612
+ return dfrd.reject(response.error, xhr, response);
1613
  } else if (!self.validResponse(cmd, response)) {
1614
+ return dfrd.reject('errResponse', xhr, response);
1615
  }
1616
+
1617
+ var resolve = function() {
1618
+ var pushLeafRoots = function(name) {
1619
+ if (self.leafRoots[data.target] && response[name]) {
1620
+ $.each(self.leafRoots[data.target], function(i, h) {
1621
+ var root;
1622
+ if (root = self.file(h)) {
1623
+ response[name].push(root);
1624
+ }
1625
+ });
1626
+ }
1627
+ };
1628
+
1629
+ if (isOpen) {
1630
+ pushLeafRoots('files');
1631
+ } else if (cmd === 'tree') {
1632
+ pushLeafRoots('tree');
1633
+ }
1634
+
1635
+ response = self.normalize(response);
1636
 
1637
+ if (!self.api) {
1638
+ self.api = response.api || 1;
1639
+ if (self.api == '2.0' && typeof response.options.uploadMaxSize !== 'undefined') {
1640
+ self.api = '2.1';
1641
+ }
1642
+ self.newAPI = self.api >= 2;
1643
+ self.oldAPI = !self.newAPI;
1644
+ }
1645
+
1646
+ if (response.options) {
1647
+ cwdOptions = $.extend({}, cwdOptions, response.options);
1648
+ }
1649
 
1650
+ if (response.netDrivers) {
1651
+ self.netDrivers = response.netDrivers;
1652
+ }
 
 
 
 
 
 
1653
 
1654
+ if (response.maxTargets) {
1655
+ self.maxTargets = response.maxTargets;
1656
+ }
1657
 
1658
+ if (isOpen && !!data.init) {
1659
+ self.uplMaxSize = self.returnBytes(response.uplMaxSize);
1660
+ self.uplMaxFile = !!response.uplMaxFile? parseInt(response.uplMaxFile) : 20;
1661
+ }
1662
 
1663
+ if (typeof prepare === 'function') {
1664
+ prepare(response);
1665
+ }
1666
+
1667
+ dfrd.resolve(response);
1668
+ response.debug && self.debug('backend-debug', response);
1669
+ };
1670
+
1671
+ lazy? self.lazy(resolve) : resolve();
1672
  },
1673
  xhr, _xhr,
1674
  abort = function(e){
1675
  if (e.type == 'autosync') {
1676
  if (e.data.action != 'stop') return;
1677
+ } else if (e.type != 'unload' && e.type != 'destroy' && e.type != 'openxhrabort') {
1678
  if (!e.data.added || !e.data.added.length) {
1679
  return;
1680
  }
1688
  }
1689
  };
1690
 
1691
+ dfrd.fail(function(error, xhr, response) {
1692
+ self.trigger(cmd + 'fail', response);
1693
  if (error) {
1694
  deffail ? self.error(error) : self.debug('error', self.i18n(error));
1695
  }
1696
+ syncOnFail && self.sync();
1697
  })
1698
+
1699
  if (!cmd) {
1700
+ syncOnFail = false;
1701
  return dfrd.reject('errCmdReq');
1702
+ }
1703
+
1704
+ if (self.maxTargets && data.targets && data.targets.length > self.maxTargets) {
1705
+ syncOnFail = false;
1706
+ return dfrd.reject(['errMaxTargets', self.maxTargets]);
 
1707
  }
1708
 
1709
+ defdone && dfrd.done(done);
1710
  if (notify.type && notify.cnt) {
1711
+ if (cancel) {
1712
+ notify.cancel = dfrd;
1713
+ }
1714
  timeout = setTimeout(function() {
1715
  self.notify(notify);
1716
  dfrd.always(function() {
1725
  }
1726
 
1727
  // quiet abort not completed "open" requests
1728
+ if (isOpen) {
1729
  while ((_xhr = queue.pop())) {
1730
  if (_xhr.state() == 'pending') {
1731
  _xhr.quiet = true;
1732
  _xhr.abort();
1733
  }
1734
  }
1735
+ if (cwd !== data.target) {
1736
+ while ((_xhr = cwdQueue.pop())) {
1737
+ if (_xhr.state() == 'pending') {
1738
+ _xhr.quiet = true;
1739
+ _xhr.abort();
1740
+ }
1741
+ }
1742
+ }
1743
+ }
1744
+
1745
+ // trigger abort autoSync for commands to add the item
1746
+ if ($.inArray(cmd, (self.cmdsToAdd + ' autosync').split(' ')) !== -1) {
1747
+ if (cmd !== 'autosync') {
1748
+ self.autoSync('stop');
1749
+ dfrd.always(function() {
1750
+ self.autoSync();
1751
+ });
1752
+ }
1753
+ self.trigger('openxhrabort');
1754
  }
1755
 
1756
  delete options.preventFail
1757
 
1758
+ dfrd.xhr = xhr = this.transport.send(options).fail(error).done(success);
1759
 
1760
+ if (isOpen || (data.compare && cmd === 'info')) {
1761
+ // add autoSync xhr into queue
1762
  queue.unshift(xhr);
1763
+ // bind abort()
1764
+ data.compare && self.bind(self.cmdsToAdd + ' autosync openxhrabort', abort);
1765
  dfrd.always(function() {
1766
  var ndx = $.inArray(xhr, queue);
1767
+ data.compare && self.unbind(self.cmdsToAdd + ' autosync openxhrabort', abort);
1768
  ndx !== -1 && queue.splice(ndx, 1);
1769
  });
1770
+ } else if ($.inArray(cmd, this.abortCmdsOnOpen) !== -1) {
1771
+ // add "open" xhr, only cwd xhr into queue
1772
+ cwdQueue.unshift(xhr);
1773
+ dfrd.always(function() {
1774
+ var ndx = $.inArray(xhr, cwdQueue);
1775
+ ndx !== -1 && cwdQueue.splice(ndx, 1);
1776
+ });
1777
  }
1778
 
1779
  // abort pending xhr on window unload or elFinder destroy
1788
  /**
1789
  * Compare current files cache with new files and return diff
1790
  *
1791
+ * @param Array new files
1792
+ * @param String target folder hash
1793
+ * @param Array exclude properties to compare
1794
  * @return Object
1795
  */
1796
+ this.diff = function(incoming, onlydir, excludeProps) {
1797
  var raw = {},
1798
  added = [],
1799
  removed = [],
1814
 
1815
  // find removed
1816
  $.each(files, function(hash, f) {
1817
+ if (! raw[hash] && (! onlydir || f.phash === onlydir)) {
1818
+ removed.push(hash);
1819
  }
1820
  });
1821
 
1827
  added.push(file);
1828
  } else {
1829
  $.each(file, function(prop) {
1830
+ if (! excludeProps || $.inArray(prop, excludeProps) === -1) {
1831
+ if (file[prop] !== origin[prop]) {
1832
+ changed.push(file)
1833
+ return false;
1834
+ }
1835
  }
1836
  });
1837
  }
1856
  removed : removed,
1857
  changed : changed
1858
  };
1859
+ };
1860
 
1861
  /**
1862
  * Sync content
1881
  },
1882
  comp = compare(),
1883
  dfrd = $.Deferred().done(function() { self.trigger('sync'); }),
1884
+ opts = [this.request({
1885
  data : {cmd : 'open', reload : 1, target : cwd, tree : (! onlydir && this.ui.tree) ? 1 : 0, compare : comp},
1886
  preventDefault : true
1887
+ })],
1888
+ exParents = function() {
1889
+ var parents = [],
1890
+ curRoot = self.file(self.root(cwd)),
1891
+ curId = curRoot? curRoot.volumeid : null,
1892
+ phash = self.cwd().phash,
1893
+ isroot,pdir;
1894
+
1895
+ while(phash) {
1896
+ if (pdir = self.file(phash)) {
1897
+ if (phash.indexOf(curId) !== 0) {
1898
+ if (! self.isRoot(pdir)) {
1899
+ parents.push( {target: phash, cmd: 'tree'} );
1900
+ }
1901
+ parents.push( {target: phash, cmd: 'parents'} );
1902
+ curRoot = self.file(self.root(phash));
1903
+ curId = curRoot? curRoot.volumeid : null;
1904
+ }
1905
+ phash = pdir.phash;
1906
+ } else {
1907
+ phash = null;
1908
+ }
1909
+ }
1910
+ return parents;
1911
  };
1912
 
1913
+ if (! onlydir) {
1914
+ (cwd !== this.root()) && opts.push(this.request({
1915
+ data : {cmd : 'parents', target : cwd},
1916
+ preventDefault : true
1917
+ }));
1918
+ $.each(exParents(), function(i, data) {
1919
+ opts.push(self.request({
1920
+ data : {cmd : data.cmd, target : data.target},
1921
+ preventDefault : true
1922
+ }));
1923
  });
1924
+ }
1925
+ $.when.apply($, opts)
1926
+ .fail(function(error, xhr) {
1927
+ if (! polling || $.inArray('errOpen', error) !== -1) {
1928
+ dfrd.reject(error);
1929
+ error && self.request({
1930
+ data : {cmd : 'open', target : (self.lastDir('') || self.root()), tree : 1, init : 1},
1931
+ notify : {type : 'open', cnt : 1, hideCnt : true}
1932
+ });
1933
+ } else {
1934
+ dfrd.reject((error && xhr.status != 0)? error : void 0);
1935
+ }
1936
  })
1937
+ .done(function(odata) {
1938
+ var pdata, argLen, i;
1939
+
1940
  if (odata.cwd.compare) {
1941
  if (comp === odata.cwd.compare) {
1942
  return dfrd.reject();
1943
  }
1944
  }
1945
 
1946
+ // for 2nd and more requests
1947
+ pdata = {tree : []};
1948
+
1949
+ // results marge of 2nd and more requests
1950
+ argLen = arguments.length;
1951
+ if (argLen > 1) {
1952
+ for(i = 1; i < argLen; i++) {
1953
+ if (arguments[i].tree && arguments[i].tree.length) {
1954
+ pdata.tree.push.apply(pdata.tree, arguments[i].tree);
1955
+ }
1956
+ }
1957
+ }
1958
+
1959
+ if (self.api < 2.1) {
1960
+ pdata.tree = (pdata.tree || []).push(odata.cwd);
1961
+ }
1962
+
1963
+ // data normalize
1964
+ odata = self.normalize(odata);
1965
+ pdata = self.normalize(pdata);
1966
+
1967
  var diff = self.diff(odata.files.concat(pdata && pdata.tree ? pdata.tree : []), onlydir);
1968
 
1969
+ diff.added.push(odata.cwd);
1970
  diff.removed.length && self.remove(diff);
1971
  diff.added.length && self.add(diff);
1972
  diff.changed.length && self.change(diff);
1977
  });
1978
 
1979
  return dfrd;
1980
+ };
1981
 
1982
  this.upload = function(files) {
1983
+ return this.transport.upload(files, this);
1984
+ };
1985
 
1986
  /**
1987
  * Attach listener to events
2009
 
2010
  /**
2011
  * Remove event listener if exists
2012
+ * To un-bind to multiply events at once, separate events names by space
2013
  *
2014
+ * @param String event(s) name(s)
2015
  * @param Function callback
2016
  * @return elFinder
2017
  */
2018
  this.unbind = function(event, callback) {
2019
+ var i, l, ci;
2020
+
2021
+ event = ('' + event).toLowerCase().split(/\s+/);
2022
+
2023
+ for (i = 0; i < event.length; i++) {
2024
+ l = listeners[event[i]] || [];
2025
+ ci = $.inArray(callback, l);
2026
+ ci > -1 && l.splice(ci, 1);
2027
+ }
2028
+
2029
  callback = null
2030
  return this;
2031
  };
2035
  *
2036
  * @param String event type
2037
  * @param Object data to send across event
2038
+ * @param Boolean allow modify data (call by reference of data)
2039
  * @return elFinder
2040
  */
2041
+ this.trigger = function(event, data, allowModify) {
2042
  var event = event.toLowerCase(),
2043
  isopen = (event === 'open'),
2044
  handlers = listeners[event] || [], i, l, jst;
2045
 
2046
  this.debug('event-'+event, data);
2047
 
2048
+ if (isopen && !allowModify) {
2049
  // for performance tuning
2050
  jst = JSON.stringify(data);
2051
  }
2052
+ if (l = handlers.length) {
2053
  event = $.Event(event);
2054
+ if (allowModify) {
2055
+ event.data = data;
2056
+ }
2057
 
 
2058
  for (i = 0; i < l; i++) {
2059
+ if (! handlers[i]) {
2060
+ // probably un-binded this handler
2061
+ continue;
2062
+ }
2063
  // only callback has argument
2064
  if (handlers[i].length) {
2065
+ if (!allowModify) {
2066
+ // to avoid data modifications. remember about "sharing" passing arguments in js :)
2067
+ event.data = isopen? JSON.parse(jst) : $.extend(true, {}, data);
2068
+ }
2069
  }
2070
 
2071
  try {
2081
  }
2082
  }
2083
  return this;
2084
+ };
2085
+
2086
+ /**
2087
+ * Get event listeners
2088
+ *
2089
+ * @param String event type
2090
+ * @return Array listed event functions
2091
+ */
2092
+ this.getListeners = function(event) {
2093
+ return event? listeners[event.toLowerCase()] : listeners;
2094
+ };
2095
 
2096
  /**
2097
  * Bind keybord shortcut to keydown event
2118
  parts = pattern.split('+');
2119
  code = (code = parts.pop()).length == 1
2120
  ? code > 0 ? code : code.charCodeAt(0)
2121
+ : (code > 0 ? code : $.ui.keyCode[code]);
2122
 
2123
  if (code && !shortcuts[pattern]) {
2124
  shortcuts[pattern] = {
2135
  }
2136
  }
2137
  return this;
2138
+ };
2139
 
2140
  /**
2141
  * Registered shortcuts
2164
  * @return Array
2165
  */
2166
  this.clipboard = function(hashes, cut) {
2167
+ var map = function() { return $.map(clipboard, function(f) { return f.hash }); };
2168
 
2169
  if (hashes !== void(0)) {
2170
  clipboard.length && this.trigger('unlockfiles', {files : map()});
2194
 
2195
  // return copy of clipboard instead of refrence
2196
  return clipboard.slice(0, clipboard.length);
2197
+ };
2198
 
2199
  /**
2200
  * Return true if command enabled
2204
  * @return Boolean
2205
  */
2206
  this.isCommandEnabled = function(name, dstHash) {
2207
+ var disabled,
2208
+ cvid = self.cwd().volumeid || '';
2209
+ if (dstHash && (! cvid || dstHash.indexOf(cvid) !== 0)) {
2210
+ disabled = self.option('disabled', dstHash);
2211
+ if (! disabled) {
2212
+ disabled = [];
2213
+ }
2214
+ } else {
 
 
2215
  disabled = cwdOptions.disabled;
2216
  }
2217
  return this._commands[name] ? $.inArray(name, disabled) === -1 : false;
2218
+ };
2219
 
2220
  /**
2221
  * Exec command and return result;
2228
  */
2229
  this.exec = function(cmd, files, opts, dstHash) {
2230
  if (cmd === 'open') {
2231
+ if (this.searchStatus.state || this.searchStatus.ininc) {
2232
+ this.trigger('searchend', { noupdate: true });
2233
+ }
2234
  this.autoSync('stop');
2235
  }
2236
  return this._commands[cmd] && this.isCommandEnabled(cmd, dstHash)
2237
  ? this._commands[cmd].exec(files, opts)
2238
  : $.Deferred().reject('No such command');
2239
+ };
2240
 
2241
  /**
2242
  * Create and return dialog.
2246
  * @return jQuery
2247
  */
2248
  this.dialog = function(content, options) {
2249
+ var dialog = $('<div/>').append(content).appendTo(node).elfinderdialog(options, this),
2250
+ dnode = dialog.closest('.ui-dialog'),
2251
+ resize = function(){
2252
+ ! dialog.data('draged') && dialog.is(':visible') && dialog.elfinderdialog('posInit');
2253
+ };
2254
+ if (dnode.length) {
2255
+ self.bind('resize', resize);
2256
+ dnode.on('remove', function() {
2257
+ self.unbind('resize', resize);
2258
+ });
2259
+ }
2260
  return dialog;
2261
+ };
2262
+
2263
+ /**
2264
+ * Create and return toast.
2265
+ *
2266
+ * @param Object toast options - see ui/toast.js
2267
+ * @return jQuery
2268
+ */
2269
+ this.toast = function(options) {
2270
+ return $('<div class="ui-front"/>').appendTo(this.ui.toast).elfindertoast(options || {}, this);
2271
+ };
2272
 
2273
  /**
2274
  * Return UI widget or node
2278
  */
2279
  this.getUI = function(ui) {
2280
  return this.ui[ui] || node;
2281
+ };
2282
 
2283
+ /**
2284
+ * Return elFinder.command instance or instances array
2285
+ *
2286
+ * @param String command name
2287
+ * @return Object | Array
2288
+ */
2289
+ this.getCommand = function(name) {
2290
  return name === void(0) ? this._commands : this._commands[name];
2291
+ };
2292
 
2293
  /**
2294
  * Resize elfinder node
2300
  this.resize = function(w, h) {
2301
  node.css('width', w).height(h).trigger('resize');
2302
  this.trigger('resize', {width : node.width(), height : node.height()});
2303
+ };
2304
 
2305
  /**
2306
  * Restore elfinder node size
2309
  */
2310
  this.restoreSize = function() {
2311
  this.resize(width, height);
2312
+ };
2313
 
2314
  this.show = function() {
2315
  node.show();
2316
  this.enable().trigger('show');
2317
+ };
2318
 
2319
  this.hide = function() {
2320
+ if (this.options.enableAlways) {
2321
+ prevEnabled = enabled;
2322
+ enabled = false;
2323
+ }
2324
  this.disable().trigger('hide');
2325
  node.hide();
2326
+ };
2327
+
2328
+ /**
2329
+ * Lazy execution function
2330
+ *
2331
+ * @param Object function
2332
+ * @param Number delay
2333
+ * @param Object options
2334
+ * @return Object jQuery.Deferred
2335
+ */
2336
+ this.lazy = function(func, delay, opts) {
2337
+ var busy = function(state) {
2338
+ var cnt = node.data('lazycnt'),
2339
+ repaint;
2340
+
2341
+ if (state) {
2342
+ repaint = node.data('lazyrepaint')? false : opts.repaint;
2343
+ if (! cnt) {
2344
+ node.data('lazycnt', 1)
2345
+ .addClass('elfinder-processing');
2346
+ } else {
2347
+ node.data('lazycnt', ++cnt);
2348
+ }
2349
+ if (repaint) {
2350
+ node.data('lazyrepaint', true).css('display'); // force repaint
2351
+ }
2352
+ } else {
2353
+ if (cnt && cnt > 1) {
2354
+ node.data('lazycnt', --cnt);
2355
+ } else {
2356
+ repaint = node.data('lazyrepaint');
2357
+ node.data('lazycnt', 0)
2358
+ .removeData('lazyrepaint')
2359
+ .removeClass('elfinder-processing');
2360
+ repaint && node.css('display'); // force repaint;
2361
+ self.trigger('lazydone');
2362
+ }
2363
+ }
2364
+ },
2365
+ dfd = $.Deferred();
2366
+
2367
+ delay = delay || 0;
2368
+ opts = opts || {};
2369
+ busy(true);
2370
+
2371
+ setTimeout(function() {
2372
+ dfd.resolve(func.call(dfd));
2373
+ busy(false);
2374
+ }, delay);
2375
+
2376
+ return dfd;
2377
  }
2378
 
2379
  /**
2383
  **/
2384
  this.destroy = function() {
2385
  if (node && node[0].elfinder) {
2386
+ this.options.syncStart = false;
2387
+ this.autoSync('forcestop');
2388
  this.trigger('destroy').disable();
2389
+ clipboard = [];
2390
+ selected = [];
2391
  listeners = {};
2392
  shortcuts = {};
2393
+ $(window).off('.' + namespace);
2394
+ $(document).off('.' + namespace);
2395
+ self.trigger = function(){}
2396
+ node.off();
2397
+ node.removeData();
2398
+ node.empty();
2399
  node[0].elfinder = null;
2400
+ $(beeper).remove();
2401
+ node.append(prevContent.contents()).removeClass(this.cssClass).attr('style', prevStyle);
2402
  }
2403
+ };
2404
 
2405
  /**
2406
  * Start or stop auto sync
2408
  * @param String|Bool stop
2409
  * @return void
2410
  */
2411
+ this.autoSync = function(mode) {
2412
  var sync;
2413
  if (self.options.sync >= 1000) {
2414
  if (syncInterval) {
2416
  syncInterval = null;
2417
  self.trigger('autosync', {action : 'stop'});
2418
  }
2419
+
2420
+ if (mode === 'stop') {
2421
+ ++autoSyncStop;
2422
+ } else {
2423
+ autoSyncStop = Math.max(0, --autoSyncStop);
2424
  }
2425
+
2426
+ if (autoSyncStop || mode === 'forcestop' || ! self.options.syncStart) {
2427
+ return;
2428
+ }
2429
+
2430
  // run interval sync
2431
  sync = function(start){
2432
  var timeout;
2435
  timeout = Math.max(self.options.sync, cwdOptions.syncMinMs);
2436
  syncInterval && clearTimeout(syncInterval);
2437
  syncInterval = setTimeout(function() {
2438
+ var dosync = true, hash = cwd, cts;
2439
+ if (cwdOptions.syncChkAsTs && (cts = files[hash].ts)) {
2440
  self.request({
2441
+ data : {cmd : 'info', targets : [hash], compare : cts, reload : 1},
2442
  preventDefault : true
2443
  })
2444
  .done(function(data){
2446
  dosync = true;
2447
  if (data.compare) {
2448
  ts = data.compare;
2449
+ if (ts == cts) {
2450
  dosync = false;
2451
  }
2452
  }
2462
  sync();
2463
  }
2464
  })
2465
+ .fail(function(error, xhr){
2466
+ if (error && xhr.status != 0) {
2467
  self.error(error);
2468
+ if ($.inArray('errOpen', error) !== -1) {
2469
+ self.request({
2470
+ data : {cmd : 'open', target : (self.lastDir('') || self.root()), tree : 1, init : 1},
2471
+ notify : {type : 'open', cnt : 1, hideCnt : true}
2472
+ });
2473
+ }
2474
  } else {
2475
  syncInterval = setTimeout(function() {
2476
  sync();
2489
  }
2490
  };
2491
 
2492
+ /**
2493
+ * Return bool is inside work zone of specific point
2494
+ *
2495
+ * @param Number event.pageX
2496
+ * @param Number event.pageY
2497
+ * @return Bool
2498
+ */
2499
+ this.insideWorkzone = function(x, y, margin) {
2500
+ var rectangle = this.getUI('workzone').data('rectangle');
2501
+
2502
+ margin = margin || 1;
2503
+ if (x < rectangle.left + margin
2504
+ || x > rectangle.left + rectangle.width + margin
2505
+ || y < rectangle.top + margin
2506
+ || y > rectangle.top + rectangle.height + margin) {
2507
+ return false;
2508
+ }
2509
+ return true;
2510
+ };
2511
 
2512
+ /**
2513
+ * Target ui node move to last of children of elFinder node fot to show front
2514
+ *
2515
+ * @param Object target Target jQuery node object
2516
+ */
2517
+ this.toFront = function(target) {
2518
+ var lastnode = node.children(':last');
2519
+ target = $(target);
2520
+ if (lastnode.get(0) !== target.get(0)) {
2521
+ lastnode.after(target);
2522
+ }
2523
+ };
2524
+
2525
+ /**
2526
+ * Return css object for maximize
2527
+ *
2528
+ * @return Object
2529
+ */
2530
+ this.getMaximizeCss = function() {
2531
+ return {
2532
+ width : '100%',
2533
+ height : '100%',
2534
+ margin : 0,
2535
+ padding : 0,
2536
+ top : 0,
2537
+ left : 0,
2538
+ display : 'block',
2539
+ position: 'fixed',
2540
+ zIndex : Math.max(self.zIndex? (self.zIndex + 1) : 0 , 1000)
2541
+ };
2542
+ };
2543
+
2544
+ // Closure for togglefullscreen
2545
+ (function() {
2546
+ // check is in iframe
2547
+ if (inFrame && self.UA.Fullscreen) {
2548
+ self.UA.Fullscreen = false;
2549
+ if (parentIframe && typeof parentIframe.attr('allowfullscreen') !== 'undefined') {
2550
+ self.UA.Fullscreen = true;
2551
+ }
2552
+ }
2553
+
2554
+ var orgStyle, bodyOvf, resizeTm, fullElm, exitFull, toFull,
2555
+ cls = 'elfinder-fullscreen',
2556
+ clsN = 'elfinder-fullscreen-native',
2557
+ checkDialog = function() {
2558
+ var t = 0,
2559
+ l = 0;
2560
+ $.each(node.children('.ui-dialog,.ui-draggable'), function(i, d) {
2561
+ var $d = $(d),
2562
+ pos = $d.position();
2563
+
2564
+ if (pos.top < 0) {
2565
+ $d.css('top', t);
2566
+ t += 20;
2567
+ }
2568
+ if (pos.left < 0) {
2569
+ $d.css('left', l);
2570
+ l += 20;
2571
+ }
2572
+ });
2573
+ },
2574
+ funcObj = self.UA.Fullscreen? {
2575
+ // native full screen mode
2576
+
2577
+ fullElm: function() {
2578
+ return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || null;
2579
+ },
2580
+
2581
+ exitFull: function() {
2582
+ if (document.exitFullscreen) {
2583
+ return document.exitFullscreen();
2584
+ } else if (document.webkitExitFullscreen) {
2585
+ return document.webkitExitFullscreen();
2586
+ } else if (document.mozCancelFullScreen) {
2587
+ return document.mozCancelFullScreen();
2588
+ } else if (document.msExitFullscreen) {
2589
+ return document.msExitFullscreen();
2590
+ }
2591
+ },
2592
+
2593
+ toFull: function(elem) {
2594
+ if (elem.requestFullscreen) {
2595
+ return elem.requestFullscreen();
2596
+ } else if (elem.webkitRequestFullscreen) {
2597
+ return elem.webkitRequestFullscreen();
2598
+ } else if (elem.mozRequestFullScreen) {
2599
+ return elem.mozRequestFullScreen();
2600
+ } else if (elem.msRequestFullscreen) {
2601
+ return elem.msRequestFullscreen();
2602
+ }
2603
+ return false;
2604
+ }
2605
+ } : {
2606
+ // node element maximize mode
2607
+
2608
+ fullElm: function() {
2609
+ var full;
2610
+ if (node.hasClass(cls)) {
2611
+ return node.get(0);
2612
+ } else {
2613
+ full = node.find('.' + cls);
2614
+ if (full.length) {
2615
+ return full.get(0);
2616
+ }
2617
+ }
2618
+ return null;
2619
+ },
2620
+
2621
+ exitFull: function() {
2622
+ var elm;
2623
+
2624
+ $(window).off('resize.' + namespace, resize);
2625
+ if (bodyOvf !== void(0)) {
2626
+ $('body').css('overflow', bodyOvf);
2627
+ }
2628
+ bodyOvf = void(0);
2629
+
2630
+ if (orgStyle) {
2631
+ elm = orgStyle.elm;
2632
+ restoreStyle(elm);
2633
+ $(elm).trigger('resize', {fullscreen: 'off'});
2634
+ }
2635
+
2636
+ $(window).trigger('resize');
2637
+ },
2638
+
2639
+ toFull: function(elem) {
2640
+ bodyOvf = $('body').css('overflow') || '';
2641
+ $('body').css('overflow', 'hidden');
2642
+
2643
+ $(elem).css(self.getMaximizeCss())
2644
+ .addClass(cls)
2645
+ .trigger('resize', {fullscreen: 'on'});
2646
+
2647
+ checkDialog();
2648
+
2649
+ $(window).on('resize.' + namespace, resize).trigger('resize');
2650
+
2651
+ return true;
2652
+ }
2653
+ },
2654
+ restoreStyle = function(elem) {
2655
+ if (orgStyle && orgStyle.elm == elem) {
2656
+ $(elem).removeClass(cls + ' ' + clsN).attr('style', orgStyle.style);
2657
+ orgStyle = null;
2658
+ }
2659
+ },
2660
+ resize = function(e) {
2661
+ var elm;
2662
+ if (e.target === window) {
2663
+ resizeTm && clearTimeout(resizeTm);
2664
+ resizeTm = setTimeout(function() {
2665
+ if (elm = funcObj.fullElm()) {
2666
+ $(elm).trigger('resize', {fullscreen: 'on'});
2667
+ }
2668
+ }, 100);
2669
+ }
2670
+ };
2671
+
2672
+ $(document).on('fullscreenchange.' + namespace + ' webkitfullscreenchange.' + namespace + ' mozfullscreenchange.' + namespace + ' MSFullscreenChange.' + namespace, function(e){
2673
+ if (self.UA.Fullscreen) {
2674
+ var elm = funcObj.fullElm(),
2675
+ win = $(window);
2676
+
2677
+ resizeTm && clearTimeout(resizeTm);
2678
+ if (elm === null) {
2679
+ win.off('resize.' + namespace, resize);
2680
+ if (orgStyle) {
2681
+ elm = orgStyle.elm;
2682
+ restoreStyle(elm);
2683
+ $(elm).trigger('resize', {fullscreen: 'off'});
2684
+ }
2685
+ } else {
2686
+ $(elm).addClass(cls + ' ' + clsN)
2687
+ .attr('style', 'width:100%; height:100%; margin:0; padding:0;')
2688
+ .trigger('resize', {fullscreen: 'on'});
2689
+ win.on('resize.' + namespace, resize);
2690
+ checkDialog();
2691
+ }
2692
+ win.trigger('resize');
2693
+ }
2694
+ });
2695
+
2696
+ /**
2697
+ * Toggle Full Scrren Mode
2698
+ *
2699
+ * @param Object target
2700
+ * @param Bool full
2701
+ * @return Object | Null DOM node object of current full scrren
2702
+ */
2703
+ self.toggleFullscreen = function(target, full) {
2704
+ var elm = $(target).get(0),
2705
+ curElm = null;
2706
+
2707
+ curElm = funcObj.fullElm();
2708
+ if (curElm) {
2709
+ if (curElm == elm) {
2710
+ if (full === true) {
2711
+ return curElm;
2712
+ }
2713
+ } else {
2714
+ if (full === false) {
2715
+ return curElm;
2716
+ }
2717
+ }
2718
+ funcObj.exitFull();
2719
+ return null;
2720
+ } else {
2721
+ if (full === false) {
2722
+ return null;
2723
+ }
2724
+ }
2725
+
2726
+ orgStyle = {elm: elm, style: $(elm).attr('style')};
2727
+ if (funcObj.toFull(elm) !== false) {
2728
+ return elm;
2729
+ } else {
2730
+ orgStyle = null;
2731
+ return null;
2732
+ }
2733
+ };
2734
+ })();
2735
+
2736
+ // Closure for toggleMaximize
2737
+ (function(){
2738
+ var cls = 'elfinder-maximized',
2739
+ resizeTm,
2740
+ resize = function(e) {
2741
+ if (e.target === window && e.data && e.data.elm) {
2742
+ resizeTm && clearTimeout(resizeTm);
2743
+ resizeTm = setTimeout(function() {
2744
+ e.data.elm.trigger('resize', {maximize: 'on'});
2745
+ }, 100);
2746
+ }
2747
+ },
2748
+ exitMax = function(elm) {
2749
+ $(window).off('resize.' + namespace, resize);
2750
+ $('body').css('overflow', elm.data('bodyOvf'));
2751
+ elm.removeClass(cls)
2752
+ .attr('style', elm.data('orgStyle'))
2753
+ .removeData('bodyOvf')
2754
+ .removeData('orgStyle');
2755
+ elm.trigger('resize', {maximize: 'off'});
2756
+ },
2757
+ toMax = function(elm) {
2758
+ elm.data('bodyOvf', $('body').css('overflow') || '')
2759
+ .data('orgStyle', elm.attr('style'))
2760
+ .addClass(cls)
2761
+ .css(self.getMaximizeCss());
2762
+ $('body').css('overflow', 'hidden');
2763
+ $(window).on('resize.' + namespace, {elm: elm}, resize).trigger('resize');
2764
+ };
2765
+
2766
+ /**
2767
+ * Toggle Maximize target node
2768
+ *
2769
+ * @param Object target
2770
+ * @param Bool max
2771
+ * @return void
2772
+ */
2773
+ self.toggleMaximize = function(target, max) {
2774
+ var elm = $(target),
2775
+ maximized = elm.hasClass(cls);
2776
+
2777
+ if (maximized) {
2778
+ if (max === true) {
2779
+ return;
2780
+ }
2781
+ exitMax(elm);
2782
+ } else {
2783
+ if (max === false) {
2784
+ return;
2785
+ }
2786
+ toMax(elm);
2787
+ }
2788
+ };
2789
+ })();
2790
+
2791
+ /************* init stuffs ****************/
2792
+
2793
+ // check jquery ui
2794
+ if (!($.fn.selectable && $.fn.draggable && $.fn.droppable)) {
2795
  return alert(this.i18n('errJqui'));
2796
  }
2797
 
2813
  'F6' : 117,
2814
  'F7' : 118,
2815
  'F8' : 119,
2816
+ 'F9' : 120,
2817
+ 'F10' : 121,
2818
+ 'F11' : 122,
2819
+ 'F12' : 123,
2820
+ 'CONTEXTMENU' : 93
2821
  });
2822
 
2823
  this.dragUpload = false;
2824
  this.xhrUpload = (typeof XMLHttpRequestUpload != 'undefined' || typeof XMLHttpRequestEventTarget != 'undefined') && typeof File != 'undefined' && typeof FormData != 'undefined';
2825
 
2826
  // configure transport object
2827
+ this.transport = {};
2828
 
2829
  if (typeof(this.options.transport) == 'object') {
2830
  this.transport = this.options.transport;
2848
  this.transport.upload = $.proxy(this.uploads.iframe, this);
2849
  }
2850
 
2851
+ /**
2852
+ * Decoding 'raw' string converted to unicode
2853
+ *
2854
+ * @param String str
2855
+ * @return String
2856
+ */
2857
+ this.decodeRawString = $.isFunction(this.options.rawStringDecoder)? this.options.rawStringDecoder : function(str) {
2858
+ var charCodes = function(str) {
2859
+ var i, len, arr;
2860
+ for (i=0,len=str.length,arr=[]; i<len; i++) {
2861
+ arr.push(str.charCodeAt(i));
2862
+ }
2863
+ return arr;
2864
+ },
2865
+ scalarValues = function(arr) {
2866
+ var scalars = [], i, len, c;
2867
+ if (typeof arr === 'string') {arr = charCodes(arr);}
2868
+ for (i=0,len=arr.length; c=arr[i],i<len; i++) {
2869
+ if (c >= 0xd800 && c <= 0xdbff) {
2870
+ scalars.push((c & 1023) + 64 << 10 | arr[++i] & 1023);
2871
+ } else {
2872
+ scalars.push(c);
2873
+ }
2874
+ }
2875
+ return scalars;
2876
+ },
2877
+ decodeUTF8 = function(arr) {
2878
+ var i, len, c, str, char = String.fromCharCode;
2879
+ for (i=0,len=arr.length,str=""; c=arr[i],i<len; i++) {
2880
+ if (c <= 0x7f) {
2881
+ str += char(c);
2882
+ } else if (c <= 0xdf && c >= 0xc2) {
2883
+ str += char((c&31)<<6 | arr[++i]&63);
2884
+ } else if (c <= 0xef && c >= 0xe0) {
2885
+ str += char((c&15)<<12 | (arr[++i]&63)<<6 | arr[++i]&63);
2886
+ } else if (c <= 0xf7 && c >= 0xf0) {
2887
+ str += char(
2888
+ 0xd800 | ((c&7)<<8 | (arr[++i]&63)<<2 | arr[++i]>>>4&3) - 64,
2889
+ 0xdc00 | (arr[i++]&15)<<6 | arr[i]&63
2890
+ );
2891
+ } else {
2892
+ str += char(0xfffd);
2893
+ }
2894
+ }
2895
+ return str;
2896
+ };
2897
+
2898
+ return decodeUTF8(scalarValues(str));
2899
+ };
2900
+
2901
  /**
2902
  * Alias for this.trigger('error', {error : 'message'})
2903
  *
2905
  * @return elFinder
2906
  **/
2907
  this.error = function() {
2908
+ var arg = arguments[0],
2909
+ opts = arguments[1] || null;
2910
  return arguments.length == 1 && typeof(arg) == 'function'
2911
  ? self.bind('error', arg)
2912
+ : (arg === true? this : self.trigger('error', {error : arg, opts : opts}));
2913
+ };
2914
 
2915
  // create bind/trigger aliases for build-in events
2916
+ $.each(events, function(i, name) {
2917
  self[name] = function() {
2918
  var arg = arguments[0];
2919
  return arguments.length == 1 && typeof(arg) == 'function'
2940
  selected = [];
2941
  })
2942
  .select(function(e) {
2943
+ var cnt = 0,
2944
+ unselects = [];
2945
+ selected = $.map(e.data.selected || e.data.value|| [], function(hash) {
2946
+ if (unselects.length || (self.maxTargets && ++cnt > self.maxTargets)) {
2947
+ unselects.push(hash);
2948
+ return null;
2949
+ } else {
2950
+ return files[hash] ? hash : null;
2951
+ }
2952
+ });
2953
+ if (unselects.length) {
2954
+ self.trigger('unselectfiles', {files: unselects, inselect: true});
2955
+ self.toast({mode: 'warning', msg: self.i18n(['errMaxTargets', self.maxTargets])});
2956
+ }
2957
  })
2958
  .error(function(e) {
2959
  var opts = {
2963
  destroyOnClose : true,
2964
  buttons : {}
2965
  };
2966
+
2967
  opts.buttons[self.i18n(self.i18n('btnClose'))] = function() { $(this).elfinderdialog('close'); };
2968
 
2969
+ if (e.data.opts && $.isPlainObject(e.data.opts)) {
2970
+ $.extend(opts, e.data.opts);
2971
+ }
2972
+
2973
  self.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-error"/>'+self.i18n(e.data.error), opts);
2974
  })
2975
  .bind('tree parents', function(e) {
2983
  })
2984
  })
2985
  .add(function(e) {
2986
+ cache(e.data.added || []);
2987
  })
2988
  .change(function(e) {
2989
  $.each(e.data.changed||[], function(i, file) {
3000
  })
3001
  .remove(function(e) {
3002
  var removed = e.data.removed||[],
3003
+ l = removed.length,
3004
+ roots = {},
3005
  rm = function(hash) {
3006
+ var file = files[hash], i;
3007
  if (file) {
3008
+ if (file.mime === 'directory') {
3009
+ if (roots[hash]) {
3010
+ delete self.roots[roots[hash]];
3011
+ }
3012
  $.each(files, function(h, f) {
3013
  f.phash == hash && rm(h);
3014
  });
3017
  }
3018
  };
3019
 
3020
+ $.each(self.roots, function(k, v) {
3021
+ roots[v] = k;
3022
+ });
3023
  while (l--) {
3024
  rm(removed[l]);
3025
  }
3026
 
3027
  })
3028
+ .bind('searchstart', function(e) {
3029
+ $.extend(self.searchStatus, e.data);
3030
+ self.searchStatus.state = 1;
3031
+ })
3032
  .bind('search', function(e) {
3033
+ self.searchStatus.state = 2;
3034
+ cache(e.data.files || []);
3035
  })
3036
  .bind('searchend', function() {
3037
+ self.searchStatus.state = 0;
3038
+ self.searchStatus.mixed = false;
3039
  })
3040
  .bind('rm', function(e) {
3041
  var play = beeper.canPlayType && beeper.canPlayType('audio/wav; codecs="1"');
3058
  this.history = new this.history(this);
3059
 
3060
  // in getFileCallback set - change default actions on double click/enter/ctrl+enter
3061
+ if (this.commands.getfile) {
3062
+ if (typeof(this.options.getFileCallback) == 'function') {
3063
+ this.bind('dblclick', function(e) {
3064
+ e.preventDefault();
3065
+ self.exec('getfile').fail(function() {
3066
+ self.exec('open');
3067
+ });
3068
  });
3069
+ this.shortcut({
3070
+ pattern : 'enter',
3071
+ description : this.i18n('cmdgetfile'),
3072
+ callback : function() { self.exec('getfile').fail(function() { self.exec(self.OS == 'mac' ? 'rename' : 'open') }) }
3073
+ })
3074
+ .shortcut({
3075
+ pattern : 'ctrl+enter',
3076
+ description : this.i18n(this.OS == 'mac' ? 'cmdrename' : 'cmdopen'),
3077
+ callback : function() { self.exec(self.OS == 'mac' ? 'rename' : 'open') }
3078
+ });
3079
+ } else {
3080
+ this.options.getFileCallback = null;
3081
+ }
3082
+ }
3083
 
3084
+ /**
3085
+ * Root hashed
3086
+ *
3087
+ * @type Object
3088
+ */
3089
+ this.roots = {};
3090
+
3091
+ /**
3092
+ * leaf roots
3093
+ *
3094
+ * @type Object
3095
+ */
3096
+ this.leafRoots = {};
3097
+
3098
  /**
3099
  * Loaded commands
3100
  *
3105
  if (!$.isArray(this.options.commands)) {
3106
  this.options.commands = [];
3107
  }
3108
+
3109
+ if ($.inArray('*', this.options.commands) !== -1) {
3110
+ this.options.commands = Object.keys(this.commands);
3111
+ }
3112
+
3113
  // load commands
3114
+ $.each(this.commands, function(name, cmd) {
3115
+ var proto = $.extend({}, cmd.prototype),
3116
+ extendsCmd, opts;
3117
+ if ($.isFunction(cmd) && !self._commands[name] && (cmd.prototype.forceLoad || $.inArray(name, self.options.commands) !== -1)) {
3118
+ extendsCmd = cmd.prototype.extendsCmd || '';
3119
+ if (extendsCmd) {
3120
+ if ($.isFunction(self.commands[extendsCmd])) {
3121
+ cmd.prototype = $.extend({}, base, new self.commands[extendsCmd](), cmd.prototype);
3122
+ } else {
3123
+ return true;
3124
+ }
3125
+ } else {
3126
+ cmd.prototype = $.extend({}, base, cmd.prototype);
3127
+ }
3128
  self._commands[name] = new cmd();
3129
+ cmd.prototype = proto;
3130
+ opts = self.options.commandsOptions[name] || {};
3131
+ if (extendsCmd && self.options.commandsOptions[extendsCmd]) {
3132
+ opts = $.extend(true, {}, self.options.commandsOptions[extendsCmd], opts);
3133
+ }
3134
+ self._commands[name].setup(name, opts);
3135
+ // setup linked commands
3136
+ if (self._commands[name].linkedCmds.length) {
3137
+ $.each(self._commands[name].linkedCmds, function(i, n) {
3138
+ var lcmd = self.commands[n];
3139
+ if ($.isFunction(lcmd) && !self._commands[n]) {
3140
+ lcmd.prototype = base;
3141
+ self._commands[n] = new lcmd();
3142
+ self._commands[n].setup(n, self.options.commandsOptions[n]||{});
3143
+ }
3144
+ });
3145
+ }
3146
  }
3147
  });
3148
 
3154
  this.commandMap = {};
3155
 
3156
  /**
3157
+ * cwd options of each volume
3158
+ * key: volumeid
3159
+ * val: options object
 
 
 
 
 
3160
  *
3161
  * @type Object
3162
  */
3163
+ this.volOptions = {};
3164
 
3165
  // prepare node
3166
  node.addClass(this.cssClass)
3189
  cwd : $('<div/>').appendTo(node).elfindercwd(this, this.options.uiOptions.cwd || {}),
3190
  // notification dialog window
3191
  notify : this.dialog('', {
3192
+ cssClass : 'elfinder-dialog-notify',
3193
+ position : this.options.notifyDialog.position,
3194
+ resizable : false,
3195
+ autoOpen : false,
3196
+ closeOnEscape : false,
3197
+ title : '&nbsp;',
3198
+ width : parseInt(this.options.notifyDialog.width)
3199
  }),
3200
+ statusbar : $('<div class="ui-widget-header ui-helper-clearfix ui-corner-bottom elfinder-statusbar"/>').hide().appendTo(node),
3201
+ toast : $('<div class="elfinder-toast"/>').appendTo(node),
3202
+ bottomtray : $('<div class="elfinder-bottomtray">').appendTo(node)
3203
+ };
3204
+
3205
+ /**
3206
+ * UI Auto Hide Functions
3207
+ * Each auto hide function mast be call to `fm.trigger('uiautohide')` at end of process
3208
+ *
3209
+ * @type Array
3210
+ **/
3211
+ this.uiAutoHide = [];
3212
+
3213
+ // trigger `uiautohide`
3214
+ this.one('open', function() {
3215
+ if (self.uiAutoHide.length) {
3216
+ setTimeout(function() {
3217
+ self.trigger('uiautohide');
3218
+ }, 500);
3219
+ }
3220
+ });
3221
+
3222
+ // Auto Hide Functions sequential processing start
3223
+ this.bind('uiautohide', function() {
3224
+ if (self.uiAutoHide.length) {
3225
+ self.uiAutoHide.shift()();
3226
+ }
3227
+ });
3228
 
3229
  // load required ui
3230
  $.each(this.options.ui || [], function(i, ui) {
3232
  opts = self.options.uiOptions[ui] || {};
3233
 
3234
  if (!self.ui[ui] && $.fn[name]) {
3235
+ // regist to self.ui before make instance
3236
+ self.ui[ui] = $('<'+(opts.tag || 'div')+'/>').appendTo(node);
3237
+ self.ui[ui][name](self, opts);
3238
  }
3239
  });
3240
 
3245
 
3246
  // make node resizable
3247
  this.options.resizable
 
3248
  && $.fn.resizable
3249
  && node.resizable({
3250
+ resize : function(e, ui) {
3251
+ self.resize(ui.size.width, ui.size.height);
3252
+ },
3253
  handles : 'se',
3254
  minWidth : 300,
3255
  minHeight : 200
3273
  // attach events to document
3274
  $(document)
3275
  // disable elfinder on click outside elfinder
3276
+ .on('click.'+namespace, function(e) { enabled && ! self.options.enableAlways && !$(e.target).closest(node).length && self.disable(); })
3277
  // exec shortcuts
3278
  .on(keydown+' '+keypress, execShortcut);
3279
 
3280
  // attach events to window
3281
  self.options.useBrowserHistory && $(window)
3282
+ .on('popstate.' + namespace, function(ev) {
3283
  var target = ev.originalEvent.state && ev.originalEvent.state.thash;
3284
  target && !$.isEmptyObject(self.files()) && self.request({
3285
  data : {cmd : 'open', target : target, onhistory : 1},
3300
  self.trigger('fail').disable().lastDir('');
3301
  listeners = {};
3302
  shortcuts = {};
3303
+ $(document).add(node).off('.'+namespace);
3304
  self.trigger = function() { };
3305
  })
3306
  .done(function(data) {
3307
+ // detect elFinder node z-index
3308
+ var ni = node.css('z-index');
3309
+ if (ni && ni !== 'auto' && ni !== 'inherit') {
3310
+ self.zIndex = ni;
3311
+ } else {
3312
+ node.parents().each(function(i, n) {
3313
+ var z = $(n).css('z-index');
3314
+ if (z !== 'auto' && z !== 'inherit' && (z = parseInt(z))) {
3315
+ self.zIndex = z;
3316
+ return false;
3317
+ }
3318
+ });
3319
+ }
3320
+
3321
  self.load().debug('api', self.api);
 
3322
  open(data);
3323
  self.trigger('open', data);
3324
+
3325
+ if (inFrame && self.options.enableAlways) {
3326
+ $(window).focus();
3327
+ }
3328
  });
3329
 
3330
  // update ui's size after init
3334
 
3335
  (function(){
3336
  var tm;
3337
+ $(window).on('resize.' + namespace, function(e){
3338
+ if (e.target === this) {
3339
+ tm && clearTimeout(tm);
3340
+ tm = setTimeout(function() {
3341
+ self.trigger('resize', {width : node.width(), height : node.height()});
3342
+ }, 100);
3343
+ }
3344
  })
3345
+ .on('beforeunload.' + namespace,function(e){
3346
+ var msg, cnt;
3347
+ if (node.is(':visible')) {
3348
+ if (self.ui.notify.children().length && $.inArray('hasNotifyDialog', self.options.windowCloseConfirm) !== -1) {
3349
+ msg = self.i18n('ntfsmth');
3350
+ } else if (node.find('.'+self.res('class', 'editing')).length && $.inArray('editingFile', self.options.windowCloseConfirm) !== -1) {
3351
+ msg = self.i18n('editingFile');
3352
+ } else if ((cnt = Object.keys(self.selected()).length) && $.inArray('hasSelectedItem', self.options.windowCloseConfirm) !== -1) {
3353
+ msg = self.i18n('hasSelected', ''+cnt);
3354
+ } else if ((cnt = Object.keys(self.clipboard()).length) && $.inArray('hasClipboardData', self.options.windowCloseConfirm) !== -1) {
3355
+ msg = self.i18n('hasClipboard', ''+cnt);
3356
+ }
3357
+ if (msg) {
3358
+ e.returnValue = msg;
3359
+ return msg;
3360
+ }
3361
  }
3362
  self.trigger('unload');
3363
  });
3364
  })();
3365
 
3366
  // bind window onmessage for CORS
3367
+ $(window).on('message.' + namespace, function(e){
3368
  var res = e.originalEvent || null,
3369
  obj, data;
3370
  if (res && self.uploadURL.indexOf(res.origin) === 0) {
3373
  data = obj.data || null;
3374
  if (data) {
3375
  if (data.error) {
3376
+ if (obj.bind) {
3377
+ self.trigger(obj.bind+'fail', data);
3378
+ }
3379
  self.error(data.error);
3380
  } else {
3381
  data.warning && self.error(data.warning);
3384
  data.changed && data.changed.length && self.change(data);
3385
  if (obj.bind) {
3386
  self.trigger(obj.bind, data);
3387
+ self.trigger(obj.bind+'done');
3388
  }
3389
  data.sync && self.sync();
3390
  }
3395
  }
3396
  });
3397
 
3398
+ // elFinder enable always
3399
+ if (self.options.enableAlways) {
3400
+ $(window).on('focus.' + namespace, function(e){
3401
+ (e.target === this) && self.enable();
3402
+ });
3403
+ if (inFrame) {
3404
+ $(window.top).on('focus.' + namespace, function() {
3405
+ if (self.enable() && (! parentIframe || parentIframe.is(':visible'))) {
3406
+ setTimeout(function() {
3407
+ $(window).focus();
3408
+ }, 10);
3409
+ }
3410
+ });
3411
+ }
3412
+ } else if (inFrame) {
3413
+ $(window).on('blur.' + namespace, function(e){
3414
+ enabled && e.target === this && self.disable();
3415
+ });
3416
+ }
3417
+
3418
+ (function() {
3419
+ var navbar = self.getUI('navbar'),
3420
+ cwd = self.getUI('cwd').parent();
3421
+
3422
+ self.autoScroll = {
3423
+ navbarUp : function(v) {
3424
+ navbar.scrollTop(Math.max(0, navbar.scrollTop() - v));
3425
+ },
3426
+ navbarDown : function(v) {
3427
+ navbar.scrollTop(navbar.scrollTop() + v);
3428
+ },
3429
+ cwdUp : function(v) {
3430
+ cwd.scrollTop(Math.max(0, cwd.scrollTop() - v));
3431
+ },
3432
+ cwdDown : function(v) {
3433
+ cwd.scrollTop(cwd.scrollTop() + v);
3434
  }
3435
+ };
3436
+ })();
3437
 
3438
+ if (self.dragUpload) {
3439
  // add event listener for HTML5 DnD upload
3440
  (function() {
3441
+ var isin = function(e) {
3442
+ return (e.target.nodeName !== 'TEXTAREA' && e.target.nodeName !== 'INPUT' && $(e.target).closest('div.ui-dialog-content').length === 0);
3443
+ },
3444
+ ent = 'native-drag-enter',
3445
  disable = 'native-drag-disable',
3446
  c = 'class',
3447
  navdir = self.res(c, 'navdir'),
3448
  droppable = self.res(c, 'droppable'),
 
 
3449
  dropover = self.res(c, 'adroppable'),
3450
  arrow = self.res(c, 'navarrow'),
3451
+ clDropActive = self.res(c, 'adroppable'),
3452
+ wz = self.getUI('workzone'),
3453
+ ltr = (self.direction === 'ltr'),
3454
+ clearTm = function() {
3455
+ autoScrTm && clearTimeout(autoScrTm);
3456
+ autoScrTm = null;
3457
+ },
3458
+ wzRect, autoScrFn, autoScrTm;
3459
+
3460
+ node.on('dragenter', function(e) {
3461
+ clearTm();
3462
+ if (isin(e)) {
3463
+ e.preventDefault();
3464
+ e.stopPropagation();
3465
+ wzRect = wz.data('rectangle');
3466
+ }
3467
+ })
3468
+ .on('dragleave', function(e) {
3469
+ clearTm();
3470
+ if (isin(e)) {
3471
+ e.preventDefault();
3472
+ e.stopPropagation();
3473
+ }
3474
+ })
3475
+ .on('dragover', function(e) {
3476
+ var autoUp;
3477
+ if (isin(e)) {
3478
+ e.preventDefault();
3479
+ e.stopPropagation();
3480
+ e.originalEvent.dataTransfer.dropEffect = 'none';
3481
+ if (! autoScrTm) {
3482
+ autoScrTm = setTimeout(function() {
3483
+ var wzBottom = wzRect.top + wzRect.height,
3484
+ fn;
3485
+ if ((autoUp = e.pageY < wzRect.top) || e.pageY > wzBottom ) {
3486
+ if (wzRect.cwdEdge > e.pageX) {
3487
+ fn = (ltr? 'navbar' : 'cwd') + (autoUp? 'Up' : 'Down');
3488
+ } else {
3489
+ fn = (ltr? 'cwd' : 'navbar') + (autoUp? 'Up' : 'Down');
3490
+ }
3491
+ self.autoScroll[fn](Math.pow((autoUp? wzRect.top - e.pageY : e.pageY - wzBottom), 1.3));
3492
+ }
3493
+ autoScrTm = null;
3494
+ }, 20);
3495
+ }
3496
+ } else {
3497
+ clearTm();
3498
+ }
3499
+ })
3500
+ .on('drop', function(e) {
3501
+ clearTm();
3502
+ if (isin(e)) {
3503
+ e.stopPropagation();
3504
+ e.preventDefault();
3505
+ }
3506
+ });
3507
+
3508
+ node.on('dragenter', '.native-droppable', function(e){
3509
+ if (e.originalEvent.dataTransfer) {
3510
+ var $elm = $(e.currentTarget),
3511
+ id = e.currentTarget.id || null,
3512
+ cwd = null,
3513
+ elfFrom;
3514
+ if (!id) { // target is cwd
3515
+ cwd = self.cwd();
3516
+ $elm.data(disable, false);
3517
+ try {
3518
+ $.each(e.originalEvent.dataTransfer.types, function(i, v){
3519
+ if (v.substr(0, 13) === 'elfinderfrom:') {
3520
+ elfFrom = v.substr(13).toLowerCase();
3521
+ }
3522
+ });
3523
+ } catch(e) {}
3524
  }
3525
  if (!cwd || (cwd.write && (!elfFrom || elfFrom !== (window.location.href + cwd.hash).toLowerCase()))) {
3526
  e.preventDefault();
3554
  }
3555
  })
3556
  .on('drop', '.native-droppable', function(e){
3557
+ if (e.originalEvent && e.originalEvent.dataTransfer) {
3558
  var $elm = $(e.currentTarget)
3559
  id;
3560
  e.preventDefault();
3566
  id = self.cwd().hash;
3567
  }
3568
  e.originalEvent._target = id;
3569
+ self.exec('upload', {dropEvt: e.originalEvent, target: id}, void 0, id);
3570
+ }
3571
+ });
3572
+ })();
3573
+ }
3574
+
3575
+ // Swipe on the touch devices to show/hide of toolbar or navbar
3576
+ if (self.UA.Touch) {
3577
+ (function() {
3578
+ var lastX, lastY, nodeOffset, nodeWidth, nodeTop, navbarW, toolbarH,
3579
+ navbar = self.getUI('navbar'),
3580
+ toolbar = self.getUI('toolbar'),
3581
+ moveOn = function(e) {
3582
+ e.preventDefault();
3583
+ },
3584
+ moveOff = function() {
3585
+ $(document).off('touchmove', moveOn);
3586
+ },
3587
+ handleW, handleH = 50;
3588
+
3589
+ node.on('touchstart touchmove touchend', function(e) {
3590
+ if (e.type === 'touchend') {
3591
+ lastX = false;
3592
+ lastY = false;
3593
+ moveOff();
3594
+ return;
3595
+ }
3596
+
3597
+ var touches = e.originalEvent.touches || [{}],
3598
+ x = touches[0].pageX || null,
3599
+ y = touches[0].pageY || null,
3600
+ ltr = (self.direction === 'ltr'),
3601
+ navbarMode, treeWidth, swipeX, moveX, toolbarT, mode;
3602
+
3603
+ if (x === null || y === null || (e.type === 'touchstart' && touches.length > 1)) {
3604
+ return;
3605
+ }
3606
+
3607
+ if (e.type === 'touchstart') {
3608
+ nodeOffset = node.offset();
3609
+ nodeWidth = node.width();
3610
+ if (navbar) {
3611
+ lastX = false;
3612
+ if (navbar.is(':hidden')) {
3613
+ if (! handleW) {
3614
+ handleW = Math.max(50, nodeWidth / 10)
3615
+ }
3616
+ if ((ltr? (x - nodeOffset.left) : (nodeWidth + nodeOffset.left - x)) < handleW) {
3617
+ lastX = x;
3618
+ }
3619
+ } else {
3620
+ navbarW = navbar.width();
3621
+ treeWidth = Math.max.apply(Math, $.map(navbar.children('.elfinder-tree'), function(c){return $(c).width();}));
3622
+ if (ltr) {
3623
+ swipeX = (x < nodeOffset.left + navbarW && treeWidth - navbar.scrollLeft() - 5 <= navbarW);
3624
+ } else {
3625
+ swipeX = (x > nodeOffset.left + nodeWidth - navbarW && treeWidth + navbar.scrollLeft() - 5 <= navbarW);
3626
+ }
3627
+ if (swipeX) {
3628
+ handleW = Math.max(50, nodeWidth / 10);
3629
+ lastX = x;
3630
+ } else {
3631
+ lastX = false;
3632
+ }
3633
+ }
3634
+ }
3635
+ if (toolbar) {
3636
+ toolbarH = toolbar.height();
3637
+ nodeTop = nodeOffset.top;
3638
+ if (y - nodeTop < (toolbar.is(':hidden')? handleH : (toolbarH + 30))) {
3639
+ lastY = y;
3640
+ $(document).on('touchmove.' + namespace, moveOn);
3641
+ setTimeout(function() {
3642
+ moveOff();
3643
+ }, 500);
3644
+ } else {
3645
+ lastY = false;
3646
+ }
3647
+ }
3648
+ } else {
3649
+ if (navbar && lastX !== false) {
3650
+ navbarMode = (ltr? (lastX > x) : (lastX < x))? 'navhide' : 'navshow';
3651
+ moveX = Math.abs(lastX - x);
3652
+ if (navbarMode === 'navhide' && moveX > navbarW * .6
3653
+ || (moveX > (navbarMode === 'navhide'? navbarW / 3 : 45)
3654
+ && (navbarMode === 'navshow'
3655
+ || (ltr? x < nodeOffset.left + 20 : x > nodeOffset.left + nodeWidth - 20)
3656
+ ))
3657
+ ) {
3658
+ self.getUI('navbar').trigger(navbarMode, {handleW: handleW});
3659
+ lastX = false;
3660
+ }
3661
+ }
3662
+ if (toolbar && lastY !== false ) {
3663
+ toolbarT = toolbar.offset().top;
3664
+ if (Math.abs(lastY - y) > Math.min(45, toolbarH / 3)) {
3665
+ mode = (lastY > y)? 'slideUp' : 'slideDown';
3666
+ if (mode === 'slideDown' || toolbarT + 20 > y) {
3667
+ if (toolbar.is(mode === 'slideDown' ? ':hidden' : ':visible')) {
3668
+ toolbar.stop(true, true).trigger('toggle', {duration: 100, handleH: handleH});
3669
+ moveOff();
3670
+ }
3671
+ lastY = false;
3672
+ }
3673
+ }
3674
+ }
3675
  }
3676
  });
3677
  })();
3678
  }
3679
 
3680
+ // return focus to the window on click (elFInder in the frame)
3681
+ if (inFrame) {
3682
+ node.on('click', function(e) {
3683
+ $(window).focus();
3684
+ });
3685
+ }
3686
+
3687
+ // elFinder to enable by mouse over
3688
+ if (this.options.enableByMouseOver) {
3689
+ node.on('mouseenter', function(e) {
3690
+ (inFrame) && $(window).focus();
3691
+ ! self.enabled() && self.enable();
3692
+ });
3693
+ }
3694
+
3695
  // self.timeEnd('load');
3696
 
3697
  }
3708
  res : function(type, id) {
3709
  return this.resources[type] && this.resources[type][id];
3710
  },
3711
+
3712
+ /**
3713
+ * User os. Required to bind native shortcuts for open/rename
3714
+ *
3715
+ * @type String
3716
+ **/
3717
+ OS : navigator.userAgent.indexOf('Mac') !== -1 ? 'mac' : navigator.userAgent.indexOf('Win') !== -1 ? 'win' : 'other',
3718
+
3719
+ /**
3720
+ * User browser UA.
3721
+ * jQuery.browser: version deprecated: 1.3, removed: 1.9
3722
+ *
3723
+ * @type Object
3724
+ **/
3725
+ UA : (function(){
3726
+ var webkit = !document.uniqueID && !window.opera && !window.sidebar && window.localStorage && 'WebkitAppearance' in document.documentElement.style;
3727
+ return {
3728
+ // Browser IE <= IE 6
3729
+ ltIE6 : typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined",
3730
+ // Browser IE <= IE 7
3731
+ ltIE7 : typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined",
3732
+ // Browser IE <= IE 8
3733
+ ltIE8 : typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined",
3734
+ IE : document.uniqueID,
3735
+ Firefox : window.sidebar,
3736
+ Opera : window.opera,
3737
+ Webkit : webkit,
3738
+ Chrome : webkit && window.chrome,
3739
+ Safari : webkit && !window.chrome,
3740
+ Mobile : typeof window.orientation != "undefined",
3741
+ Touch : typeof window.ontouchstart != "undefined",
3742
+ iOS : navigator.platform.match(/^iP(?:[ao]d|hone)/),
3743
+ Fullscreen : (typeof (document.exitFullscreen || document.webkitExitFullscreen || document.mozCancelFullScreen || document.msExitFullscreen) !== 'undefined')
3744
+ };
3745
+ })(),
3746
 
3747
  /**
3748
  * Current request command
3943
  }
3944
 
3945
  try {
3946
+ data = JSON.parse(text);
3947
  } catch (e) {
3948
  return {error : ['errResponse', 'errDataNotJSON']};
3949
  }
3974
  }
3975
  },
3976
  check = function() {
3977
+ var renames = [], hashes = {}, existed = [], exists = [], i, c;
3978
 
3979
  var confirm = function(ndx) {
3980
  var last = ndx == exists.length-1,
3987
  callback : function(all) {
3988
  !last && !all
3989
  ? confirm(++ndx)
3990
+ : dfrd.resolve(renames, hashes);
3991
  }
3992
  },
3993
  reject : {
4006
 
4007
  !last && !all
4008
  ? confirm(++ndx)
4009
+ : dfrd.resolve(renames, hashes);
4010
  }
4011
  },
4012
  cancel : {
4013
  label : 'btnCancel',
4014
  callback : function() {
4015
  cancel();
4016
+ dfrd.resolve(renames, hashes);
4017
  }
4018
  },
4019
  buttons : [
4031
  }
4032
  !last && !all
4033
  ? confirm(++ndx)
4034
+ : dfrd.resolve(renames, hashes);
4035
  }
4036
  }
4037
  ]
4042
  fm.confirm(opts);
4043
  };
4044
 
4045
+ if (! fm.file(target).read) {
4046
+ // for dropbox type
4047
+ dfrd.resolve([]);
4048
+ return;
4049
+ }
4050
+
4051
  names = $.map(files, function(file, i) { return file.name? {i: i, name: file.name} : null ;});
4052
 
4053
  name = $.map(names, function(item) { return item.name;});
4054
  fm.request({
4055
+ data : {cmd : 'ls', target : target, intersect : name},
4056
  notify : {type : 'preupload', cnt : 1, hideCnt : true},
4057
  preventFail : true
4058
  })
4059
  .done(function(data) {
4060
+ var existedArr, cwdItems;
4061
  if (data) {
4062
  if (data.error) {
4063
  cancel();
4064
  } else {
4065
+ if (fm.options.overwriteUploadConfirm && ! fm.UA.iOS && fm.option('uploadOverwrite', target)) {
4066
+ if (data.list) {
4067
+ if ($.isArray(data.list)) {
4068
+ existed = data.list || [];
4069
+ } else {
4070
+ existedArr = [];
4071
+ existed = $.map(data.list, function(n) {
4072
+ if (typeof n === 'string') {
4073
+ return n;
4074
+ } else {
4075
+ // support to >=2.1.11 plugin Normalizer, Sanitizer
4076
+ existedArr = existedArr.concat(n);
4077
+ return null;
4078
+ }
4079
+ });
4080
+ if (existedArr.length) {
4081
+ existed = existed.concat(existedArr);
4082
+ }
4083
+ hashes = data.list;
4084
+ }
4085
+ exists = $.map(names, function(name){
4086
+ return $.inArray(name.name, existed) !== -1 ? name : null ;
4087
+ });
4088
+ if (existed.length && target == fm.cwd().hash) {
4089
+ cwdItems = $.map(fm.files(), function(file) { return (file.phash == target) ? file.name : null; } );
4090
+ if ($.map(existed, function(n) {
4091
+ return $.inArray(n, cwdItems) === -1? true : null;
4092
+ }).length){
4093
+ fm.sync();
4094
+ }
4095
+ }
4096
+ }
4097
  }
4098
  }
4099
  }
4109
  error && fm.error(error);
4110
  });
4111
  };
4112
+ if (fm.api >= 2.1 && typeof files[0] == 'object') {
4113
  check();
4114
  return dfrd;
4115
  } else {
4129
  entries = [],
4130
  processing = 0,
4131
  items,
4132
+ mkdirs = [],
4133
 
4134
  readEntries = function(dirReader) {
4135
  var toArray = function(list) {
4136
  return Array.prototype.slice.call(list || []);
4137
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4138
  },
4139
 
4140
+ doScan = function(items) {
4141
+ var dirReader, entry,
4142
+ entries = [],
4143
+ toArray = function(list) {
4144
+ return Array.prototype.slice.call(list || [], 0);
4145
+ };
4146
  var length = items.length;
4147
  for (var i = 0; i < length; i++) {
4148
+ entry = items[i];
 
 
 
 
4149
  if (entry) {
4150
  if (entry.isFile) {
4151
  processing++;
4152
  entry.file(function (file) {
4153
+ if (! (fm.OS == 'win' && file.name.match(/^(?:desktop\.ini|thumbs\.db)$/i))
4154
+ &&
4155
+ ! (fm.OS == 'mac' && file.name.match(/^\.ds_store$/i))) {
4156
+ paths.push(entry.fullPath || '');
4157
+ files.push(file);
4158
+ }
4159
  processing--;
4160
  });
4161
  } else if (entry.isDirectory) {
4162
+ if (fm.api >= 2.1) {
 
 
 
 
4163
  processing++;
4164
+ mkdirs.push(entry.fullPath);
4165
+ dirReader = entry.createReader();
4166
+ var entries = [];
4167
+ // Call the reader.readEntries() until no more results are returned.
4168
+ var readEntries = function() {
4169
+ dirReader.readEntries (function(results) {
4170
+ if (!results.length) {
4171
+ for (var i = 0; i < entries.length; i++) {
4172
+ doScan([entries[i]]);
4173
+ }
4174
+ processing--;
4175
+ } else {
4176
+ entries = entries.concat(toArray(results));
4177
+ readEntries();
4178
+ }
4179
+ }, function(){
4180
+ processing--;
4181
+ });
4182
+ };
4183
+ readEntries(); // Start reading dirs.
4184
  }
4185
  }
4186
  }
4191
  return item.getAsEntry? item.getAsEntry() : item.webkitGetAsEntry();
4192
  });
4193
  if (items.length > 0) {
4194
+ fm.uploads.checkExists(items, target, fm).done(function(renames, hashes){
4195
  var notifyto, dfds = [];
4196
+ if (fm.options.overwriteUploadConfirm && ! fm.UA.iOS && fm.option('uploadOverwrite', target)) {
4197
  items = $.map(items, function(item){
4198
+ var i, bak, hash, dfd, hi;
4199
  if (item.isDirectory) {
4200
  i = $.inArray(item.name, renames);
4201
  if (i !== -1) {
4202
  renames.splice(i, 1);
4203
  bak = fm.uniqueName(item.name + fm.options.backupSuffix , null, '');
4204
+ $.each(hashes, function(h, name) {
4205
+ if (item.name == name) {
4206
+ hash = h;
4207
+ return false;
4208
+ }
4209
+ });
4210
+ if (! hash) {
4211
+ hash = fm.fileByName(item.name, target).hash;
4212
+ }
4213
+ fm.lockfiles({files : [hash]});
4214
  dfd = fm.request({
4215
+ data : {cmd : 'rename', target : hash, name : bak},
4216
  notify : {type : 'rename', cnt : 1}
4217
  })
4218
  .fail(function(error) {
4220
  fm.sync();
4221
  })
4222
  .always(function() {
4223
+ fm.unlockfiles({files : [hash]})
4224
  });
4225
  dfds.push(dfd);
4226
  }
4233
  notifyto = setTimeout(function() {
4234
  fm.notify({type : 'readdir', cnt : 1, hideCnt: true});
4235
  }, fm.options.notifyDelay);
4236
+ doScan(items);
4237
  setTimeout(function wait() {
4238
  if (processing > 0) {
4239
  setTimeout(wait, 10);
4240
  } else {
4241
+ notifyto && clearTimeout(notifyto);
4242
+ fm.notify({type : 'readdir', cnt : -1});
4243
+ dfrd.resolve([files, paths, renames, hashes, mkdirs]);
 
 
 
 
 
4244
  }
4245
  }, 10);
4246
  } else {
4257
  var check = [];
4258
  var str = data.files[0];
4259
  if (data.type == 'html') {
4260
+ var tmp = $("<html/>").append($.parseHTML(str.replace(/ src=/ig, ' _elfsrc='))),
4261
  atag;
4262
+ $('img[_elfsrc]', tmp).each(function(){
4263
  var url, purl,
4264
  self = $(this),
4265
  pa = self.closest('a');
4266
  if (pa && pa.attr('href') && pa.attr('href').match(/\.(?:jpe?g|gif|bmp|png)/i)) {
4267
  purl = pa.attr('href');
4268
  }
4269
+ url = self.attr('_elfsrc');
4270
  if (url) {
4271
  if (purl) {
4272
  $.inArray(purl, ret) == -1 && ret.push(purl);
4306
  // upload transport using XMLHttpRequest
4307
  xhr : function(data, fm) {
4308
  var self = fm ? fm : this,
4309
+ node = self.getUI(),
4310
  xhr = new XMLHttpRequest(),
4311
  notifyto = null, notifyto2 = null,
4312
  dataChecked = data.checked,
4313
  isDataType = (data.isDataType || data.type == 'data'),
4314
+ target = (data.target || self.cwd().hash),
4315
+ chunkEnable = (self.option('uploadMaxConn', target) != -1),
4316
+ multiMax = Math.min(5, Math.max(1, self.option('uploadMaxConn', target))),
4317
+ timeout = 30000, // 30 sec
4318
+ retryWait = 10000, // 10 sec
4319
+ retryMax = 18, // 10 sec * 18 = 180 sec (Max 3 mins)
4320
  retry = 0,
 
4321
  dfrd = $.Deferred()
4322
  .fail(function(error) {
4323
+ if (self.uploads.xhrUploading) {
4324
+ setTimeout(function() { self.sync(); }, 5000);
4325
+ var file = files.length? (isDataType? files[0][0] : files[0]) : {};
4326
+ if (file._cid) {
4327
+ formData = new FormData();
4328
+ files = [{_chunkfail: true}];
4329
+ formData.append('chunk', file._chunk);
4330
+ formData.append('cid' , file._cid);
4331
+ isDataType = false;
4332
+ send(files);
4333
+ }
4334
  }
4335
+ self.uploads.xhrUploading = false;
4336
  files = null;
4337
  error && self.error(error);
4338
  })
4339
  .done(function(data) {
4340
  xhr = null;
4341
+ self.uploads.xhrUploading = false;
4342
  files = null;
4343
  if (data) {
4344
+ self.currentReqCmd = 'upload';
4345
  data.warning && self.error(data.warning);
4346
  data.removed && self.remove(data);
4347
  data.added && self.add(data);
4348
  data.changed && self.change(data);
4349
  self.trigger('upload', data);
4350
+ self.trigger('uploaddone');
4351
  data.sync && self.sync();
4352
+ data.debug && fm.debug('backend-debug', data);
4353
  }
4354
  })
4355
  .always(function() {
4356
+ // unregist fnAbort function
4357
+ node.off('uploadabort', fnAbort);
4358
+ $(window).off('unload', fnAbort);
4359
  notifyto && clearTimeout(notifyto);
4360
  notifyto2 && clearTimeout(notifyto2);
4361
  dataChecked && !data.multiupload && checkNotify() && self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});
4362
+ chunkMerge && notifyElm.children('.elfinder-notify-chunkmerge').length && self.notify({type : 'chunkmerge', cnt : -1});
 
 
4363
  }),
4364
  formData = new FormData(),
 
4365
  files = data.input ? data.input.files : self.uploads.checkFile(data, self, target),
4366
  cnt = data.checked? (isDataType? files[0].length : files.length) : files.length,
4367
  loaded = 0, prev,
4368
  filesize = 0,
4369
  notify = false,
4370
+ notifyElm = self.ui.notify,
4371
+ cancelBtn = true,
4372
  abort = false,
4373
  checkNotify = function() {
4374
+ return notify = (notify || notifyElm.children('.elfinder-notify-upload').length);
4375
+ },
4376
+ fnAbort = function() {
4377
+ abort = true;
4378
+ if (xhr) {
4379
+ xhr.quiet = true;
4380
+ xhr.abort();
4381
+ }
4382
+ if (checkNotify()) {
4383
+ self.notify({type : 'upload', cnt : notifyElm.children('.elfinder-notify-upload').data('cnt') * -1, progress : 0, size : 0});
4384
+ }
4385
+ },
4386
+ cancelToggle = function(show) {
4387
+ notifyElm.children('.elfinder-notify-upload').children('.elfinder-notify-cancel')[show? 'show':'hide']();
4388
  },
4389
  startNotify = function(size) {
4390
  if (!size) size = filesize;
4391
  return setTimeout(function() {
4392
  notify = true;
4393
+ self.notify({type : 'upload', cnt : cnt, progress : loaded - prev, size : size,
4394
+ cancel: function() {
4395
+ node.trigger('uploadabort');
4396
+ }
4397
+ });
4398
  prev = loaded;
4399
+ if (data.multiupload) {
4400
+ cancelBtn && cancelToggle(true);
4401
+ } else {
4402
+ cancelToggle(cancelBtn && loaded < size);
4403
+ }
4404
  }, self.options.notifyDelay);
4405
  },
 
 
 
 
 
 
 
 
 
 
 
4406
  renames = (data.renames || null),
4407
+ hashes = (data.hashes || null),
4408
  chunkMerge = false;
4409
 
4410
+ // regist fnAbort function
4411
+ node.one('uploadabort', fnAbort);
4412
+ $(window).one('unload.' + fm.namespace, fnAbort);
 
 
 
4413
 
4414
  !chunkMerge && (prev = loaded);
4415
 
4418
  }
4419
 
4420
  xhr.addEventListener('error', function() {
4421
+ if (xhr.status == 0) {
4422
+ if (abort) {
4423
+ dfrd.reject();
4424
+ } else {
4425
+ // ff bug while send zero sized file
4426
+ // for safari - send directory
4427
+ if (!isDataType && data.files && $.map(data.files, function(f){return f.size === (self.UA.Safari? 1802 : 0)? f : null;}).length) {
4428
+ errors.push('errFolderUpload');
4429
+ dfrd.reject(['errAbort', 'errFolderUpload']);
4430
+ } else {
4431
+ if (retry++ <= retryMax) {
4432
+ setTimeout(function() {
4433
+ if (! abort) {
4434
+ filesize = 0;
4435
+ xhr.open('POST', self.uploadURL, true);
4436
+ xhr.timeout = timeout;
4437
+ xhr.send(formData);
4438
+ }
4439
+ }, retryWait);
4440
+ } else {
4441
+ node.trigger('uploadabort');
4442
+ dfrd.reject(['errAbort']);
4443
+ }
4444
+ }
4445
+ }
4446
+ } else {
4447
+ node.trigger('uploadabort');
4448
+ dfrd.reject('errConnect');
4449
+ }
4450
  }, false);
4451
 
4452
  xhr.addEventListener('abort', function() {
4472
  }
4473
 
4474
  if (error) {
4475
+ node.trigger('uploadabort');
4476
+ var file = isDataType? files[0][0] : files[0];
4477
+ return dfrd.reject(file._cid? null : error);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4478
  }
4479
 
4480
  loaded = filesize;
4488
  // chunked upload commit
4489
  if (res._chunkmerged) {
4490
  formData = new FormData();
4491
+ var _file = [{_chunkmerged: res._chunkmerged, _name: res._name, _mtime: res._mtime}];
4492
  chunkMerge = true;
4493
+ node.off('uploadabort', fnAbort);
4494
  notifyto2 = setTimeout(function() {
4495
  self.notify({type : 'chunkmerge', cnt : 1});
4496
  }, self.options.notifyDelay);
4500
 
4501
  res._multiupload = data.multiupload? true : false;
4502
  if (res.error) {
4503
+ self.trigger('uploadfail', res);
4504
+ if (res._chunkfailure || res._multiupload) {
4505
  abort = true;
4506
  self.uploads.xhrUploading = false;
4507
  notifyto && clearTimeout(notifyto);
4508
+ if (notifyElm.children('.elfinder-notify-upload').length) {
4509
  self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});
4510
  dfrd.reject(res.error);
4511
  } else {
4565
  self.notify({type : 'upload', cnt : 0, progress : curr, size : 0});
4566
  prev = loaded;
4567
  }
4568
+
4569
+ if (! data.multiupload && loaded >= filesize) {
4570
+ cancelBtn = false;
4571
+ cancelToggle(false);
4572
+ }
4573
  }
4574
  }, false);
4575
 
4582
  maxFileSize,
4583
  totalSize = 0,
4584
  chunked = [],
4585
+ chunkID = new Date().getTime().toString().substr(-9), // for take care of the 32bit backend system
4586
  BYTES_PER_CHUNK = Math.min((fm.uplMaxSize? fm.uplMaxSize : 2097152) - 8190, fm.options.uploadMaxChunkSize), // uplMaxSize margin 8kb or options.uploadMaxChunkSize
4587
+ blobSlice = chunkEnable? false : '',
4588
  blobSize, i, start, end, chunks, blob, chunk, added, done, last, failChunk,
4589
  multi = function(files, num){
4590
+ var sfiles = [], cid, sfilesLen = 0, cancelChk;
4591
  if (!abort) {
4592
  while(files.length && sfiles.length < num) {
4593
  sfiles.push(files.shift());
4594
  }
4595
+ sfilesLen = sfiles.length;
4596
+ if (sfilesLen) {
4597
+ cancelChk = sfilesLen;
4598
+ for (var i=0; i < sfilesLen; i++) {
4599
+ if (abort) {
4600
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4601
  }
4602
+ cid = isDataType? (sfiles[i][0][0]._cid || null) : (sfiles[i][0]._cid || null);
4603
+ if (!!failChunk[cid]) {
4604
+ last--;
4605
+ continue;
 
 
 
 
 
 
4606
  }
4607
+ fm.exec('upload', {
4608
+ type: data.type,
4609
+ isDataType: isDataType,
4610
+ files: sfiles[i],
4611
+ checked: true,
4612
+ target: target,
4613
+ renames: renames,
4614
+ hashes: hashes,
4615
+ multiupload: true}, void 0, target)
4616
+ .fail(function(error) {
4617
+ if (error && error === 'No such command') {
4618
+ abort = true;
4619
+ fm.error(['errUpload', 'errPerm']);
4620
+ }
4621
+ if (cid) {
4622
+ failChunk[cid] = true;
4623
+ }
4624
+ })
4625
+ .always(function(e) {
4626
+ if (e && e.added) added = $.merge(added, e.added);
4627
+ if (last <= ++done) {
4628
+ fm.trigger('multiupload', {added: added});
4629
+ notifyto && clearTimeout(notifyto);
4630
+ if (checkNotify()) {
4631
+ self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});
4632
+ }
4633
+ }
4634
+ if (files.length) {
4635
+ multi(files, 1); // Next one
4636
+ } else {
4637
+ if (--cancelChk <= 1) {
4638
+ cancelBtn = false;
4639
+ cancelToggle(false);
4640
+ }
4641
+ }
4642
+ });
4643
+ }
4644
  }
4645
+ }
4646
+ if (sfiles.length < 1 || abort) {
4647
  if (abort) {
4648
  notifyto && clearTimeout(notifyto);
4649
+ if (cid) {
 
 
 
4650
  failChunk[cid] = true;
4651
  }
4652
+ dfrd.reject();
4653
+ } else {
4654
+ dfrd.resolve();
4655
+ self.uploads.xhrUploading = false;
4656
  }
 
4657
  }
4658
  },
4659
  check = function(){
4660
  if (!self.uploads.xhrUploading) {
4661
  self.uploads.xhrUploading = true;
4662
+ multi(sfiles, multiMax); // Max connection: 3
4663
  } else {
4664
  setTimeout(function(){ check(); }, 100);
4665
  }
4666
  };
4667
 
4668
  if (! dataChecked && (isDataType || data.type == 'files')) {
4669
+ if (! (maxFileSize = fm.option('uploadMaxSize', target))) {
4670
+ maxFileSize = 0;
4671
+ }
4672
  for (i=0; i < files.length; i++) {
4673
  blob = files[i];
4674
  blobSize = blob.size;
4675
  if (blobSlice === false) {
4676
+ blobSlice = '';
4677
+ if (self.api >= 2.1) {
4678
+ if ('slice' in blob) {
4679
+ blobSlice = 'slice';
4680
+ } else if ('mozSlice' in blob) {
4681
+ blobSlice = 'mozSlice';
4682
+ } else if ('webkitSlice' in blob) {
4683
+ blobSlice = 'webkitSlice';
4684
+ }
4685
  }
4686
  }
4687
 
4688
+ // file size check
4689
  if ((maxFileSize && blobSize > maxFileSize) || (!blobSlice && fm.uplMaxSize && blobSize > fm.uplMaxSize)) {
4690
  self.error(self.i18n('errUploadFile', blob.name) + ' ' + self.i18n('errUploadFileSize'));
4691
  cnt--;
4693
  continue;
4694
  }
4695
 
4696
+ // file mime check
4697
+ if (blob.type && ! self.uploadMimeCheck(blob.type, target)) {
4698
+ self.error(self.i18n('errUploadFile', blob.name) + ' ' + self.i18n('errUploadMime') + ' (' + self.escape(blob.type) + ')');
4699
+ cnt--;
4700
+ total--;
4701
+ continue;
4702
+ }
4703
+
4704
  if (blobSlice && blobSize > BYTES_PER_CHUNK) {
4705
  start = 0;
4706
  end = BYTES_PER_CHUNK;
4711
  chunked[chunkID] = 0;
4712
  while(start <= blobSize) {
4713
  chunk = blob[blobSlice](start, end);
4714
+ chunk._chunk = blob.name + '.' + (++chunks) + '_' + total + '.part';
4715
  chunk._cid = chunkID;
4716
  chunk._range = start + ',' + chunk.size + ',' + blobSize;
4717
  chunked[chunkID]++;
4744
  total--;
4745
  } else {
4746
  total += chunks;
4747
+ size = 0;
4748
+ fcnt = 1;
4749
+ c++;
4750
  }
4751
  continue;
4752
  }
4814
  }
4815
 
4816
  xhr.open('POST', self.uploadURL, true);
4817
+ xhr.timeout = timeout;
4818
 
4819
  // set request headers
4820
  if (fm.customHeaders) {
4834
 
4835
  formData.append('cmd', 'upload');
4836
  formData.append(self.newAPI ? 'target' : 'current', target);
4837
+ if (renames && renames.length) {
4838
+ $.each(renames, function(i, v) {
4839
  formData.append('renames[]', v);
4840
  });
4841
  formData.append('suffix', fm.options.backupSuffix);
4842
  }
4843
+ if (hashes) {
4844
+ $.each(hashes, function(i, v) {
4845
+ formData.append('hashes['+ i +']', v);
4846
+ });
4847
+ }
4848
  $.each(self.options.customData, function(key, val) {
4849
  formData.append(key, val);
4850
  });
4856
  if (file._chunkmerged) {
4857
  formData.append('chunk', file._chunkmerged);
4858
  formData.append('upload[]', file._name);
4859
+ formData.append('mtime[]', file._mtime);
4860
+ xhr.timeout = 0;
4861
  } else {
4862
  if (file._chunkfail) {
4863
  formData.append('upload[]', 'chunkfail');
4870
  formData.append('cid' , file._cid);
4871
  formData.append('range', file._range);
4872
  }
4873
+ formData.append('mtime[]', file.lastModified? Math.round(file.lastModified/1000) : 0);
4874
+ }
4875
+ if (fm.UA.iOS) {
4876
+ formData.append('overwrite', 0);
4877
  }
4878
  });
4879
 
4883
  });
4884
  }
4885
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4886
  xhr.send(formData);
4887
 
4888
  return true;
4892
  if (files.length > 0) {
4893
  if (renames == null) {
4894
  renames = [];
4895
+ hashes = {};
4896
  self.uploads.checkExists(files, target, fm).done(
4897
+ function(res, res2){
4898
+ if (fm.options.overwriteUploadConfirm && ! fm.UA.iOS && fm.option('uploadOverwrite', target)) {
4899
  renames = res;
4900
+ hashes = res2;
4901
  files = $.map(files, function(file){return !file._remove? file : null ;});
4902
  }
4903
  cnt = files.length;
4922
  if (dataChecked) {
4923
  send(files[0], files[1]);
4924
  } else {
4925
+ files.done(function(result) { // result: [files, paths, renames, hashes, mkdirs]
4926
  renames = [];
4927
  cnt = result[0].length;
4928
  if (cnt) {
4929
+ if (result[4] && result[4].length) {
4930
+ // ensure directories
4931
+ fm.request({
4932
+ data : {cmd : 'mkdir', target : target, dirs : result[4]},
4933
+ notify : {type : 'mkdir', cnt : result[4].length}
4934
+ })
4935
+ .fail(function(error) {
4936
+ error = error || ['errUnknown'];
4937
+ if (error[0] === 'errCmdParams') {
4938
+ multiMax = 1;
4939
+ } else {
4940
+ multiMax = 0;
4941
+ dfrd.reject(error);
4942
+ }
4943
+ })
4944
+ .done(function(data) {
4945
+ if (data.hashes) {
4946
+ result[1] = $.map(result[1], function(p) {
4947
+ p = p.replace(/\/[^\/]*$/, '');
4948
+ if (p === '') {
4949
+ return target;
4950
+ } else {
4951
+ return data.hashes[p];
4952
+ }
4953
+ });
4954
+ }
4955
+ })
4956
+ .always(function(data) {
4957
+ if (multiMax) {
4958
+ renames = result[2];
4959
+ hashes = result[3];
4960
+ send(result[0], result[1]);
4961
+ }
4962
+ });
4963
+ return;
4964
+ } else {
4965
+ result[1] = $.map(result[1], function() { return target; });
4966
+ }
4967
+ renames = result[2];
4968
+ hashes = result[3];
4969
+ send(result[0], result[1]);
4970
+ } else {
4971
+ dfrd.reject(['errUploadNoFiles']);
4972
  }
4973
  }).fail(function(){
4974
  dfrd.reject();
4987
  dfrd = $.Deferred()
4988
  .fail(function(error) {
4989
  error && self.error(error);
 
 
 
 
 
 
 
 
4990
  }),
4991
+ name = 'iframe-'+fm.namespace+(++self.iframeCnt),
4992
  form = $('<form action="'+self.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+name+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),
4993
  msie = this.UA.IE,
4994
  // clear timeouts, close notification dialog, remove form/iframe
5007
  .on('load', function() {
5008
  iframe.off('load')
5009
  .on('load', function() {
 
 
5010
  onload();
5011
+ // data will be processed in callback response or window onmessage
5012
+ dfrd.resolve();
5013
  });
5014
 
5015
  // notify dialog
5032
  names = [],
5033
  dfds = [],
5034
  renames = [],
5035
+ hashes = {},
5036
  cnt, notify, notifyto, abortto;
5037
 
5038
  if (files && files.length) {
5041
  });
5042
  cnt = 1;
5043
  } else if (input && $(input).is(':file') && $(input).val()) {
5044
+ if (fm.options.overwriteUploadConfirm && ! fm.UA.iOS && fm.option('uploadOverwrite', target)) {
5045
  names = input.files? input.files : [{ name: $(input).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/, '$1') }];
5046
  //names = $.map(names, function(file){return file.name? { name: file.name } : null ;});
5047
  dfds.push(self.uploads.checkExists(names, target, self).done(
5048
+ function(res, res2){
5049
  renames = res;
5050
+ hashes = res2;
5051
  cnt = $.map(names, function(file){return !file._remove? file : null ;}).length;
5052
  if (cnt != names.length) {
5053
  cnt = 0;
5072
 
5073
  if (renames.length > 0) {
5074
  $.each(renames, function(i, rename) {
5075
+ form.append('<input type="hidden" name="renames[]" value="'+self.escape(rename)+'"/>');
5076
  });
5077
  form.append('<input type="hidden" name="suffix" value="'+fm.options.backupSuffix+'"/>');
5078
  }
5079
+ if (hashes) {
5080
+ $.each(renames, function(i, v) {
5081
+ form.append('<input type="hidden" name="['+i+']" value="'+self.escape(v)+'"/>');
5082
+ });
5083
+ }
5084
 
5085
  $.each(self.options.onlyMimes||[], function(i, mime) {
5086
+ form.append('<input type="hidden" name="mimes[]" value="'+self.escape(mime)+'"/>');
5087
  });
5088
 
5089
  $.each(self.options.customData, function(key, val) {
5090
+ form.append('<input type="hidden" name="'+key+'" value="'+self.escape(val)+'"/>');
5091
  });
5092
 
5093
  form.appendTo('body');
5109
  */
5110
  one : function(event, callback) {
5111
  var self = this,
5112
+ h = function(e, f) {
5113
+ setTimeout(function() {self.unbind(event, h);}, 3);
5114
+ return callback.apply(self.getListeners(e.type), arguments);
5115
+ };
5116
  return this.bind(event, h);
5117
  },
5118
 
5126
  localStorage : function(key, val) {
5127
  var s = window.localStorage,
5128
  oldkey = 'elfinder-'+key+this.id, // old key of elFinder < 2.1.6
5129
+ retval, oldval,t;
5130
 
5131
  // new key of elFinder >= 2.1.6
5132
  key = window.location.pathname+'-elfinder-'+key+this.id;
5141
  }
5142
 
5143
  if (val !== void(0)) {
5144
+ t = typeof val;
5145
+ if (t !== 'string' && t !== 'number') {
5146
+ val = JSON.stringify(val);
5147
+ }
5148
  try {
5149
  s.setItem(key, val);
5150
  } catch (e) {
5151
+ try {
5152
+ s.clear();
5153
+ s.setItem(key, val);
5154
+ } catch (e) {
5155
+ self.debug('error', e.toString());
5156
+ }
5157
  }
5158
  retval = s.getItem(key);
5159
  }
5160
 
5161
+ if (retval && (retval.substr(0,1) === '{' || retval.substr(0,1) === '[')) {
5162
+ try {
5163
+ return JSON.parse(retval);
5164
+ } catch(e) {}
5165
+ }
5166
  return retval;
5167
  },
5168
 
5174
  * @return String
5175
  */
5176
  cookie : function(name, value) {
5177
+ var d, o, c, i, retval, t;
5178
 
5179
  name = 'elfinder-'+name+this.id;
5180
 
5185
  for (i=0; i<c.length; i++) {
5186
  c[i] = $.trim(c[i]);
5187
  if (c[i].substring(0, name.length) == name) {
5188
+ retval = decodeURIComponent(c[i].substring(name.length));
5189
+ if (retval.substr(0,1) === '{' || retval.substr(0,1) === '[') {
5190
+ try {
5191
+ return JSON.parse(retval);
5192
+ } catch(e) {}
5193
+ }
5194
+ return retval;
5195
  }
5196
  }
5197
  }
5202
  if (value === null) {
5203
  value = '';
5204
  o.expires = -1;
5205
+ } else {
5206
+ t = typeof value;
5207
+ if (t !== 'string' && t !== 'number') {
5208
+ value = JSON.stringify(value);
5209
+ }
5210
  }
5211
  if (typeof(o.expires) == 'number') {
5212
  d = new Date();
5269
  * @return Object
5270
  */
5271
  normalize : function(data) {
5272
+ var self = this,
5273
+ filter = function(file) {
5274
+ var vid, targetOptions;
5275
+
5276
+ if (file && file.hash && file.name && file.mime) {
5277
+ if (file.mime == 'application/x-empty') {
5278
+ file.mime = 'text/plain';
5279
+ }
5280
+
5281
+ if (! file.phash || file.mime === 'directory') {
5282
+ // set options, tmbUrls for each volume
5283
+ if (file.volumeid) {
5284
+ vid = file.volumeid;
5285
+
5286
+ if (self.isRoot(file)) {
5287
+ if (! self.volOptions[vid]) {
5288
+ self.volOptions[vid] = {};
5289
+ }
5290
+
5291
+ targetOptions = self.volOptions[vid];
5292
+
5293
+ if (file.options) {
5294
+ // >= v.2.1.14 has file.options
5295
+ targetOptions = $.extend(targetOptions, file.options);
5296
+ }
5297
+
5298
+ // for compat <= v2.1.13
5299
+ if (file.disabled) {
5300
+ targetOptions.disabled = file.disabled;
5301
+ }
5302
+ if (file.tmbUrl) {
5303
+ targetOptions.tmbUrl = file.tmbUrl;
5304
+ }
5305
+
5306
+ // set immediate properties
5307
+ $.each(self.optionProperties, function(i, k) {
5308
+ if (targetOptions[k]) {
5309
+ file[k] = targetOptions[k];
5310
+ }
5311
+ });
5312
+ self.roots[vid] = file.hash;
5313
+ }
5314
+
5315
+ if (prevId !== vid) {
5316
+ prevId = vid;
5317
+ i18nFolderName = self.option('i18nFolderName', vid);
5318
+ }
5319
+ }
5320
+
5321
+ // volume root i18n name
5322
+ if (! file.i18 && self.isRoot(file)) {
5323
+ name = 'volume_' + file.name,
5324
+ i18 = self.i18n(false, name);
5325
+
5326
+ if (name !== i18) {
5327
+ file.i18 = i18;
5328
+ }
5329
+ }
5330
+
5331
+ // i18nFolderName
5332
+ if (i18nFolderName && ! file.i18) {
5333
+ name = 'folder_' + file.name,
5334
+ i18 = self.i18n(false, name);
5335
+
5336
+ if (name !== i18) {
5337
+ file.i18 = i18;
5338
+ }
5339
+ }
5340
+
5341
+ if (self.leafRoots[file.hash]) {
5342
+ // has leaf root to `dirs: 1`
5343
+ if (! file.dirs) {
5344
+ file.dirs = 1;
5345
+ }
5346
+ // set ts
5347
+ $.each(self.leafRoots[file.hash], function() {
5348
+ var f = self.file(this);
5349
+ if (f && f.ts && (file.ts || 0) < f.ts) {
5350
+ file.ts = f.ts;
5351
+ }
5352
+ });
5353
+ }
5354
+ }
5355
+
5356
+ return file;
5357
  }
5358
+ return null;
5359
+ },
5360
+ name, i18, i18nFolderName, prevId;
 
5361
 
5362
 
5363
+ if (data.cwd) {
5364
+ if (data.cwd.volumeid && data.options && Object.keys(data.options).length) {
5365
+ self.volOptions[data.cwd.volumeid] = data.options;
5366
+ }
5367
+ data.cwd = filter(data.cwd);
5368
+ }
5369
  if (data.files) {
5370
  data.files = $.map(data.files, filter);
5371
  }
5391
  * @param {String} sort order
5392
  * @param {Boolean} show folder first
5393
  */
5394
+ setSort : function(type, order, stickFolders, alsoTreeview) {
5395
  this.storage('sortType', (this.sortType = this.sortRules[type] ? type : 'name'));
5396
  this.storage('sortOrder', (this.sortOrder = /asc|desc/.test(order) ? order : 'asc'));
5397
  this.storage('sortStickFolders', (this.sortStickFolders = !!stickFolders) ? 1 : '');
5398
+ this.storage('sortAlsoTreeview', (this.sortAlsoTreeview = !!alsoTreeview) ? 1 : '');
5399
  this.trigger('sortchange');
5400
  },
5401
 
5402
  _sortRules : {
5403
  name : function(file1, file2) {
5404
+ return elFinder.prototype.naturalCompare(file1.i18 || file1.name, file2.i18 || file2.name);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5405
  },
5406
  size : function(file1, file2) {
5407
  var size1 = parseInt(file1.size) || 0,
5408
  size2 = parseInt(file2.size) || 0;
5409
 
5410
+ return size1 === size2 ? 0 : size1 > size2 ? 1 : -1;
5411
  },
5412
  kind : function(file1, file2) {
5413
  return elFinder.prototype.naturalCompare(file1.mime, file2.mime);
5416
  var date1 = file1.ts || file1.date,
5417
  date2 = file2.ts || file2.date;
5418
 
5419
+ return date1 === date2 ? 0 : date1 > date2 ? 1 : -1
5420
+ },
5421
+ perm : function(file1, file2) {
5422
+ var val = function(file) { return (file.write? 2 : 0) + (file.read? 1 : 0); },
5423
+ v1 = val(file1),
5424
+ v2 = val(file2);
5425
+ return v1 === v2 ? 0 : v1 > v2 ? 1 : -1
5426
+ },
5427
+ mode : function(file1, file2) {
5428
+ var v1 = file1.mode || (file1.perm || ''),
5429
+ v2 = file2.mode || (file2.perm || '');
5430
+ return elFinder.prototype.naturalCompare(v1, v2);
5431
+ },
5432
+ owner : function(file1, file2) {
5433
+ var v1 = file1.owner || '',
5434
+ v2 = file2.owner || '';
5435
+ return elFinder.prototype.naturalCompare(v1, v2);
5436
+ },
5437
+ group : function(file1, file2) {
5438
+ var v1 = file1.group || '',
5439
+ v2 = file2.group || '';
5440
+ return elFinder.prototype.naturalCompare(v1, v2);
5441
  }
5442
  },
5443
 
5444
+ /**
5445
+ * Valid sort rule names
5446
+ *
5447
+ * @type Array
5448
+ */
5449
+ sorters : [],
5450
+
5451
  /**
5452
  * Compare strings for natural sort
5453
  *
5581
 
5582
  res = asc ? sort(file1, file2) : sort(file2, file1);
5583
 
5584
+ return type !== 'name' && res === 0
5585
  ? res = asc ? rules.name(file1, file2) : rules.name(file2, file1)
5586
  : res;
5587
  },
5608
  * cnt : 3,
5609
  * hideCnt : false, // true for not show count
5610
  * progress : 10, // progress bar percents (use cnt : 0 to update progress bar)
5611
+ * cancel : callback // callback function for cancel button
5612
  * })
5613
  * @return elFinder
5614
  */
5615
  notify : function(opts) {
5616
  var type = opts.type,
5617
+ msg = this.i18n((typeof opts.msg !== 'undefined')? opts.msg : (this.messages['ntf'+type] ? 'ntf'+type : 'ntfsmth')),
5618
  ndialog = this.ui.notify,
5619
  notify = ndialog.children('.elfinder-notify-'+type),
5620
+ button = notify.children('div.elfinder-notify-cancel').children('button'),
5621
+ ntpl = '<div class="elfinder-notify elfinder-notify-{type}"><span class="elfinder-dialog-icon elfinder-dialog-icon-{type}"/><span class="elfinder-notify-msg">{msg}</span> <span class="elfinder-notify-cnt"/><div class="elfinder-notify-progressbar"><div class="elfinder-notify-progress"/></div><div class="elfinder-notify-cancel"/></div>',
5622
  delta = opts.cnt,
5623
  size = (typeof opts.size != 'undefined')? parseInt(opts.size) : null,
5624
  progress = (typeof opts.progress != 'undefined' && opts.progress >= 0) ? opts.progress : null,
5625
  cancel = opts.cancel,
5626
  clhover = 'ui-state-hover',
5627
+ close = function() {
5628
+ notify._esc && $(document).off('keydown', notify._esc);
5629
+ notify.remove();
5630
+ !ndialog.children().length && ndialog.elfinderdialog('close');
5631
+ },
5632
+ cnt, total, prc;
5633
 
5634
  if (!type) {
5635
  return this;
5651
  });
5652
  notify.children('div.elfinder-notify-cancel').append(button);
5653
  }
5654
+ } else if (typeof opts.msg !== 'undefined') {
5655
+ notify.children('span.elfinder-notify-msg').html(msg);
5656
  }
5657
 
5658
  cnt = delta + parseInt(notify.data('cnt'));
5659
 
5660
  if (cnt > 0) {
5661
+ if (cancel && button.length) {
5662
+ if ($.isFunction(cancel) || (typeof cancel === 'object' && cancel.promise)) {
5663
+ notify._esc = function(e) {
5664
+ if (e.type == 'keydown' && e.keyCode != $.ui.keyCode.ESCAPE) {
5665
+ return;
5666
+ }
5667
+ e.preventDefault();
5668
+ e.stopPropagation();
5669
+ close();
5670
+ if (cancel.promise) {
5671
+ if (cancel.xhr) {
5672
+ cancel.xhr.quiet = true;
5673
+ cancel.xhr.abort();
5674
+ }
5675
+ cancel.reject();
5676
+ } else {
5677
+ cancel(e);
5678
+ }
5679
+ };
5680
+ button.on('click', function(e) {
5681
+ notify._esc(e);
5682
+ });
5683
+ $(document).on('keydown.' + this.namespace, notify._esc);
5684
+ }
5685
+ }
5686
+
5687
  !opts.hideCnt && notify.children('.elfinder-notify-cnt').text('('+cnt+')');
5688
+ ndialog.is(':hidden') && ndialog.elfinderdialog('open', this);
5689
  notify.data('cnt', cnt);
5690
 
5691
  if ((progress != null)
5709
  }
5710
 
5711
  } else {
5712
+ close();
 
5713
  }
5714
 
5715
  return this;
5766
  options.buttons[this.i18n(opts.accept.label)] = function() {
5767
  opts.accept.callback(!!(checkbox && checkbox.prop('checked')))
5768
  complete = true;
5769
+ $(this).elfinderdialog('close');
5770
  };
5771
 
5772
  if (opts.reject) {
5773
  options.buttons[this.i18n(opts.reject.label)] = function() {
5774
  opts.reject.callback(!!(checkbox && checkbox.prop('checked')))
5775
  complete = true;
5776
+ $(this).elfinderdialog('close');
5777
  };
5778
  }
5779
 
5788
  }
5789
 
5790
  options.buttons[this.i18n(opts.cancel.label)] = function() {
5791
+ $(this).elfinderdialog('close');
5792
  };
5793
 
5794
  if (opts.all) {
 
 
 
5795
  options.create = function() {
5796
+ var base = $('<div class="elfinder-dialog-confirm-applyall"/>');
5797
  checkbox = $('<input type="checkbox" />');
5798
+ $(this).next().find('.ui-dialog-buttonset')
5799
+ .prepend(base.append($('<label>'+apply+'</label>').prepend(checkbox)));
 
 
 
 
 
 
 
 
5800
  }
5801
  }
5802
 
5859
  }
5860
  return m;
5861
  },
5862
+ i, j, m, escFunc, start = 0;
5863
+
5864
+ if (arguments.length && arguments[0] === false) {
5865
+ escFunc = function(m){ return m; };
5866
+ start = 1;
5867
+ }
5868
+ for (i = start; i< arguments.length; i++) {
5869
  m = arguments[i];
5870
 
5871
+ if ($.isArray(m)) {
 
 
5872
  for (j = 0; j < m.length; j++) {
5873
+ if (m[j] instanceof jQuery) {
 
 
5874
  // jQuery object is HTML element
5875
  input.push(m[j]);
5876
+ } else if (typeof m[j] !== 'undefined'){
5877
+ input.push(message('' + m[j]));
5878
  }
5879
  }
5880
  } else if (m instanceof jQuery) {
5881
  // jQuery object is HTML element
5882
  input.push(m[j]);
5883
+ } else if (typeof m !== 'undefined'){
5884
+ input.push(message('' + m));
5885
  }
5886
  }
5887
 
5893
  m = input[i];
5894
  if (typeof m == 'string') {
5895
  // translate message
5896
+ m = messages[m] || (escFunc? escFunc(m) : self.escape(m));
5897
  // replace placeholders in message
5898
  m = m.replace(/\$(\d+)/g, function(match, placeholder) {
5899
  placeholder = i + parseInt(placeholder);
5900
  if (placeholder > 0 && input[placeholder]) {
5901
  ignore.push(placeholder)
5902
  }
5903
+ return escFunc? escFunc(input[placeholder]) : self.escape(input[placeholder]);
5904
  });
5905
  } else {
5906
  // get HTML from jQuery object
5934
  * @return String
5935
  */
5936
  mime2kind : function(f) {
5937
+ var isObj = typeof(f) == 'object' ? true : false,
5938
+ mime = isObj ? f.mime : f,
5939
+ kind;
5940
 
5941
+
5942
+ if (isObj && f.alias && mime != 'symlink-broken') {
5943
  kind = 'Alias';
5944
  } else if (this.kinds[mime]) {
5945
+ if (isObj && mime === 'directory' && (! f.phash || f.isroot)) {
5946
+ kind = 'Root';
5947
+ } else {
5948
+ kind = this.kinds[mime];
5949
+ }
5950
+ }
5951
+ if (! kind) {
5952
  if (mime.indexOf('text') === 0) {
5953
  kind = 'Text';
5954
  } else if (mime.indexOf('image') === 0) {
6012
  case 'G': return h;
6013
  case 'g': return g;
6014
  case 'h': return g > 9 ? g : '0'+g;
6015
+ case 'a': return h >= 12 ? 'pm' : 'am';
6016
+ case 'A': return h >= 12 ? 'PM' : 'AM';
6017
  case 'i': return i > 9 ? i : '0'+i;
6018
  case 's': return s > 9 ? s : '0'+s;
6019
  }
6046
  } else if (!o.write) {
6047
  c = 'elfinder-ro';
6048
  }
6049
+
6050
+ if (o.type) {
6051
+ c += ' elfinder-' + this.escape(o.type);
6052
+ }
6053
+
6054
  return c;
6055
  },
6056
 
6187
  }
6188
  },
6189
 
6190
+ /**
6191
+ * Return boolean that uploadable MIME type into target folder
6192
+ *
6193
+ * @param String mime MIME type
6194
+ * @param String target target folder hash
6195
+ * @return Bool
6196
+ */
6197
+ uploadMimeCheck : function(mime, target) {
6198
+ target = target || this.cwd().hash;
6199
+ var res = true, // default is allow
6200
+ mimeChecker = this.option('uploadMime', target),
6201
+ allow,
6202
+ deny,
6203
+ check = function(checker) {
6204
+ var ret = false;
6205
+ if (typeof checker === 'string' && checker.toLowerCase() === 'all') {
6206
+ ret = true;
6207
+ } else if ($.isArray(checker) && checker.length) {
6208
+ $.each(checker, function(i, v) {
6209
+ v = v.toLowerCase();
6210
+ if (v === 'all' || mime.indexOf(v) === 0) {
6211
+ ret = true;
6212
+ return false;
6213
+ }
6214
+ });
6215
+ }
6216
+ return ret;
6217
+ };
6218
+ if (mime && $.isPlainObject(mimeChecker)) {
6219
+ mime = mime.toLowerCase();
6220
+ allow = check(mimeChecker.allow);
6221
+ deny = check(mimeChecker.deny);
6222
+ if (mimeChecker.firstOrder === 'allow') {
6223
+ res = false; // default is deny
6224
+ if (! deny && allow === true) { // match only allow
6225
+ res = true;
6226
+ }
6227
+ } else {
6228
+ res = true; // default is allow
6229
+ if (deny === true && ! allow) { // match only deny
6230
+ res = false;
6231
+ }
6232
+ }
6233
+ }
6234
+ return res;
6235
+ },
6236
+
6237
+ /**
6238
+ * call chained sequence of async deferred functions
6239
+ *
6240
+ * @param Array tasks async functions
6241
+ * @return Object jQuery.Deferred
6242
+ */
6243
+ sequence : function(tasks) {
6244
+ var l = tasks.length,
6245
+ chain = function(task, idx) {
6246
+ ++idx;
6247
+ if (tasks[idx]) {
6248
+ return chain(task.then(tasks[idx]), idx);
6249
+ } else {
6250
+ return task;
6251
+ }
6252
+ };
6253
+ if (l > 1) {
6254
+ return chain(tasks[0](), 0);
6255
+ } else {
6256
+ return tasks[0]();
6257
+ }
6258
+ },
6259
+
6260
+ /**
6261
+ * Reload contents of target URL for clear browser cache
6262
+ *
6263
+ * @param String url target URL
6264
+ * @return Object jQuery.Deferred
6265
+ */
6266
+ reloadContents : function(url) {
6267
+ var dfd = $.Deferred(),
6268
+ ifm;
6269
+ try {
6270
+ ifm = $('<iframe width="1" height="1" scrolling="no" frameborder="no" style="position:absolute; top:-1px; left:-1px" crossorigin="use-credentials">')
6271
+ .attr('src', url)
6272
+ .one('load', function() {
6273
+ var ifm = $(this);
6274
+ try {
6275
+ this.contentDocument.location.reload(true);
6276
+ ifm.one('load', function() {
6277
+ ifm.remove();
6278
+ dfd.resolve();
6279
+ });
6280
+ } catch(e) {
6281
+ ifm.attr('src', '').attr('src', url).one('load', function() {
6282
+ ifm.remove();
6283
+ dfd.resolve();
6284
+ });
6285
+ }
6286
+ })
6287
+ .appendTo('body');
6288
+ } catch(e) {
6289
+ ifm && ifm.remove();
6290
+ dfd.reject();
6291
+ }
6292
+ return dfd;
6293
+ },
6294
+
6295
+ /**
6296
+ * Make netmount option for OAuth2
6297
+ *
6298
+ * @param String protocol
6299
+ * @param String name
6300
+ * @param String host
6301
+ * @param Boolean noOffline
6302
+ *
6303
+ * @return Object
6304
+ */
6305
+ makeNetmountOptionOauth : function(protocol, name, host, noOffline) {
6306
+ return {
6307
+ vars : {},
6308
+ name : name,
6309
+ inputs: {
6310
+ offline : $('<input type="checkbox"/>').on('change', function() {
6311
+ $(this).parents('table.elfinder-netmount-tb').find('select:first').trigger('change', 'reset');
6312
+ }),
6313
+ host : $('<span><span class="elfinder-info-spinner"/></span><input type="hidden"/>'),
6314
+ path : $('<input type="text" value="root"/>'),
6315
+ user : $('<input type="hidden"/>'),
6316
+ pass : $('<input type="hidden"/>')
6317
+ },
6318
+ select: function(fm, ev, data){
6319
+ var f = this.inputs,
6320
+ oline = f.offline,
6321
+ f0 = $(f.host[0]),
6322
+ data = data || null;
6323
+ this.vars.mbtn = f.host.closest('.ui-dialog').children('.ui-dialog-buttonpane:first').find('button.elfinder-btncnt-0');
6324
+ if (! f0.data('inrequest')
6325
+ && (f0.find('span.elfinder-info-spinner').length
6326
+ || data === 'reset'
6327
+ || (data === 'winfocus' && ! f0.siblings('span.elfinder-button-icon-reload').length))
6328
+ )
6329
+ {
6330
+ if (oline.parent().children().length === 1) {
6331
+ f.path.parent().prev().html(fm.i18n('folderId'));
6332
+ oline.attr('title', fm.i18n('offlineAccess'));
6333
+ oline.uniqueId().after($('<label/>').attr('for', oline.attr('id')).html(' '+fm.i18n('offlineAccess')));
6334
+ }
6335
+ f0.data('inrequest', true).empty().addClass('elfinder-info-spinner')
6336
+ .parent().find('span.elfinder-button-icon').remove();
6337
+ fm.request({
6338
+ data : {cmd : 'netmount', protocol: protocol, host: host, user: 'init', options: {id: fm.id, offline: oline.prop('checked')? 1:0, pass: f.host[1].value}},
6339
+ preventDefault : true
6340
+ }).done(function(data){
6341
+ f0.removeClass("elfinder-info-spinner").html(data.body.replace(/\{msg:([^}]+)\}/g, function(whole,s1){return fm.i18n(s1, host);}));
6342
+ });
6343
+ noOffline && oline.closest('tr').hide();
6344
+ } else {
6345
+ oline.closest('tr')[(noOffline || f.user.val())? 'hide':'show']();
6346
+ f0.data('funcexpup') && f0.data('funcexpup')();
6347
+ }
6348
+ this.vars.mbtn[$(f.host[1]).val()? 'show':'hide']();
6349
+ },
6350
+ done: function(fm, data){
6351
+ var f = this.inputs,
6352
+ p = this.protocol,
6353
+ f0 = $(f.host[0]),
6354
+ f1 = $(f.host[1]),
6355
+ expires = '&nbsp;';
6356
+
6357
+ noOffline && f.offline.closest('tr').hide();
6358
+ if (data.mode == 'makebtn') {
6359
+ f0.removeClass('elfinder-info-spinner').removeData('expires').removeData('funcexpup');
6360
+ f.host.find('input').hover(function(){$(this).toggleClass('ui-state-hover');});
6361
+ f1.val('');
6362
+ f.path.val('root').next().remove();
6363
+ f.user.val('');
6364
+ f.pass.val('');
6365
+ ! noOffline && f.offline.closest('tr').show();
6366
+ this.vars.mbtn.hide();
6367
+ } else {
6368
+ if (data.expires) {
6369
+ expires = '()';
6370
+ f0.data('expires', data.expires);
6371
+ }
6372
+ f0.html(host + expires).removeClass('elfinder-info-spinner');
6373
+ if (data.expires) {
6374
+ f0.data('funcexpup', function() {
6375
+ var rem = Math.floor((f0.data('expires') - (+new Date()) / 1000) / 60);
6376
+ if (rem < 3) {
6377
+ f0.parent().children('.elfinder-button-icon-reload').click();
6378
+ } else {
6379
+ f0.text(f0.text().replace(/\(.*\)/, '('+fm.i18n(['minsLeft', rem])+')'));
6380
+ setTimeout(function() {
6381
+ if (f0.is(':visible')) {
6382
+ f0.data('funcexpup')();
6383
+ }
6384
+ }, 60000);
6385
+ }
6386
+ });
6387
+ f0.data('funcexpup')();
6388
+ }
6389
+ if (data.reset) {
6390
+ p.trigger('change', 'reset');
6391
+ return;
6392
+ }
6393
+ f0.parent().append($('<span class="elfinder-button-icon elfinder-button-icon-reload" title="'+fm.i18n('reAuth')+'">')
6394
+ .on('click', function() {
6395
+ f1.val('reauth');
6396
+ p.trigger('change', 'reset');
6397
+ }));
6398
+ f1.val(protocol);
6399
+ this.vars.mbtn.show();
6400
+ if (data.folders) {
6401
+ f.path.next().remove().end().after(
6402
+ $('<div/>').append(
6403
+ $('<select class="ui-corner-all" style="max-width:200px;">').append(
6404
+ $($.map(data.folders, function(n,i){return '<option value="'+(i+'').trim()+'">'+fm.escape(n)+'</option>'}).join(''))
6405
+ ).on('change', function(){f.path.val($(this).val());})
6406
+ )
6407
+ );
6408
+ }
6409
+ f.user.val('done');
6410
+ f.pass.val('done');
6411
+ f.offline.closest('tr').hide();
6412
+ }
6413
+ f0.removeData('inrequest');
6414
+ },
6415
+ fail: function(fm, err){
6416
+ $(this.inputs.host[0]).removeData('inrequest');
6417
+ this.protocol.trigger('change', 'reset');
6418
+ }
6419
+ };
6420
+ },
6421
+
6422
+ /**
6423
+ * Find cwd's nodes from files
6424
+ *
6425
+ * @param Array files
6426
+ * @param Object opts {firstOnly: true|false}
6427
+ */
6428
+ findCwdNodes : function(files, opts) {
6429
+ var self = this,
6430
+ cwd = this.getUI('cwd'),
6431
+ cwdHash = this.cwd().hash,
6432
+ newItem = $();
6433
+
6434
+ opts = opts || {};
6435
+
6436
+ $.each(files, function(i, f) {
6437
+ if (f.phash === cwdHash) {
6438
+ newItem = newItem.add(cwd.find('#'+self.cwdHash2Id(f.hash)));
6439
+ if (opts.firstOnly) {
6440
+ return false;
6441
+ }
6442
+ }
6443
+ });
6444
+
6445
+ return newItem;
6446
+ },
6447
+
6448
  navHash2Id : function(hash) {
6449
  return this.navPrefix + hash;
6450
  },
6461
  return typeof(id) == 'string' ? id.substr(this.cwdPrefix.length) : false;
6462
  },
6463
 
6464
+ isInWindow : function(elem, nochkHide) {
6465
+ if (! nochkHide && elem.is(':hidden')) {
6466
+ return false;
6467
+ }
6468
+ var elm, rect;
6469
+ if (! (elm = elem.get(0))) {
6470
+ return false;
6471
+ }
6472
+ rect = elm.getBoundingClientRect();
6473
+ return document.elementFromPoint(rect.left, rect.top)? true : false;
6474
+ },
6475
+
6476
  log : function(m) { window.console && window.console.log && window.console.log(m); return this; },
6477
 
6478
  debug : function(type, m) {
6481
  if (d == 'all' || d === true || ($.isArray(d) && $.inArray(type, d) != -1)) {
6482
  window.console && window.console.log && window.console.log('elfinder debug: ['+type+'] ['+this.id+']', m);
6483
  }
6484
+
6485
+ if (type === 'backend-debug') {
6486
+ this.trigger('backenddebug', m);
6487
+ }
6488
+
6489
  return this;
6490
  },
6491
  time : function(l) { window.console && window.console.time && window.console.time(l); },
6544
  *
6545
  * @type String
6546
  **/
6547
+ elFinder.prototype.version = '2.1.18';
6548
 
6549
 
6550
 
6554
 
6555
  /*** jQuery UI droppable performance tune for elFinder ***/
6556
  (function(){
6557
+ if ($.ui) {
6558
+ if ($.ui.ddmanager) {
6559
+ var origin = $.ui.ddmanager.prepareOffsets;
6560
+ $.ui.ddmanager.prepareOffsets = function( t, event ) {
6561
+ var isOutView = function(elem) {
6562
+ if (elem.is(':hidden')) {
6563
+ return true;
6564
+ }
6565
+ var rect = elem[0].getBoundingClientRect();
6566
+ return document.elementFromPoint(rect.left, rect.top)? false : true;
6567
  }
6568
+
6569
+ if (event.type === 'mousedown' || t.options.elfRefresh) {
6570
+ var i, d,
6571
+ m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
6572
+ l = m.length;
6573
+ for ( i = 0; i < l; i++ ) {
6574
+ d = m[ i ];
6575
+ if (d.options.autoDisable && (!d.options.disabled || d.options.autoDisable > 1)) {
6576
+ d.options.disabled = isOutView(d.element);
6577
+ d.options.autoDisable = d.options.disabled? 2 : 1;
6578
+ }
 
 
6579
  }
6580
  }
6581
+
6582
+ // call origin function
6583
+ return origin( t, event );
6584
+ };
6585
+ }
6586
  }
6587
  })();
6588
 
6589
+ /*!
6590
+ * jQuery UI Touch Punch 0.2.3
6591
+ *
6592
+ * Copyright 2011–2014, Dave Furfero
6593
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6594
+ *
6595
+ * Depends:
6596
+ * jquery.ui.widget.js
6597
+ * jquery.ui.mouse.js
6598
+ */
6599
+ (function ($) {
6600
+
6601
+ // Detect touch support
6602
+ $.support.touch = 'ontouchend' in document;
6603
+
6604
+ // Ignore browsers without touch support
6605
+ if (!$.support.touch) {
6606
+ return;
6607
+ }
6608
+
6609
+ var mouseProto = $.ui.mouse.prototype,
6610
+ _mouseInit = mouseProto._mouseInit,
6611
+ _mouseDestroy = mouseProto._mouseDestroy,
6612
+ touchHandled,
6613
+ posX, posY;
6614
+
6615
+ /**
6616
+ * Simulate a mouse event based on a corresponding touch event
6617
+ * @param {Object} event A touch event
6618
+ * @param {String} simulatedType The corresponding mouse event
6619
+ */
6620
+ function simulateMouseEvent (event, simulatedType) {
6621
+
6622
+ // Ignore multi-touch events
6623
+ if (event.originalEvent.touches.length > 1) {
6624
+ return;
6625
  }
6626
+
6627
+ if (! $(event.currentTarget).hasClass('touch-punch-keep-default')) {
6628
+ event.preventDefault();
6629
+ }
6630
+
6631
+ var touch = event.originalEvent.changedTouches[0],
6632
+ simulatedEvent = document.createEvent('MouseEvents');
6633
+
6634
+ // Initialize the simulated mouse event using the touch event's coordinates
6635
+ simulatedEvent.initMouseEvent(
6636
+ simulatedType, // type
6637
+ true, // bubbles
6638
+ true, // cancelable
6639
+ window, // view
6640
+ 1, // detail
6641
+ touch.screenX, // screenX
6642
+ touch.screenY, // screenY
6643
+ touch.clientX, // clientX
6644
+ touch.clientY, // clientY
6645
+ false, // ctrlKey
6646
+ false, // altKey
6647
+ false, // shiftKey
6648
+ false, // metaKey
6649
+ 0, // button
6650
+ null // relatedTarget
6651
+ );
6652
+
6653
+ // Dispatch the simulated event to the target element
6654
+ event.target.dispatchEvent(simulatedEvent);
6655
+ }
6656
+
6657
+ /**
6658
+ * Handle the jQuery UI widget's touchstart events
6659
+ * @param {Object} event The widget element's touchstart event
6660
+ */
6661
+ mouseProto._touchStart = function (event) {
6662
+
6663
+ var self = this;
6664
+
6665
+ // Ignore the event if another widget is already being handled
6666
+ if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
6667
+ return;
6668
+ }
6669
+
6670
+ // Track element position to avoid "false" move
6671
+ posX = event.originalEvent.changedTouches[0].screenX.toFixed(0);
6672
+ posY = event.originalEvent.changedTouches[0].screenY.toFixed(0);
6673
+
6674
+ // Set the flag to prevent other widgets from inheriting the touch event
6675
+ touchHandled = true;
6676
+
6677
+ // Track movement to determine if interaction was a click
6678
+ self._touchMoved = false;
6679
+
6680
+ // Simulate the mouseover event
6681
+ simulateMouseEvent(event, 'mouseover');
6682
+
6683
+ // Simulate the mousemove event
6684
+ simulateMouseEvent(event, 'mousemove');
6685
+
6686
+ // Simulate the mousedown event
6687
+ simulateMouseEvent(event, 'mousedown');
6688
+ };
6689
+
6690
+ /**
6691
+ * Handle the jQuery UI widget's touchmove events
6692
+ * @param {Object} event The document's touchmove event
6693
+ */
6694
+ mouseProto._touchMove = function (event) {
6695
+
6696
+ // Ignore event if not handled
6697
+ if (!touchHandled) {
6698
+ return;
6699
+ }
6700
+
6701
+ // Ignore if it's a "false" move (position not changed)
6702
+ var x = event.originalEvent.changedTouches[0].screenX.toFixed(0);
6703
+ var y = event.originalEvent.changedTouches[0].screenY.toFixed(0);
6704
+ // Ignore if it's a "false" move (position not changed)
6705
+ if (Math.abs(posX - x) <= 2 && Math.abs(posY - y) <= 2) {
6706
+ return;
6707
+ }
6708
+
6709
+ // Interaction was not a click
6710
+ this._touchMoved = true;
6711
+
6712
+ // Simulate the mousemove event
6713
+ simulateMouseEvent(event, 'mousemove');
6714
+ };
6715
+
6716
+ /**
6717
+ * Handle the jQuery UI widget's touchend events
6718
+ * @param {Object} event The document's touchend event
6719
+ */
6720
+ mouseProto._touchEnd = function (event) {
6721
+
6722
+ // Ignore event if not handled
6723
+ if (!touchHandled) {
6724
+ return;
6725
+ }
6726
+
6727
+ // Simulate the mouseup event
6728
+ simulateMouseEvent(event, 'mouseup');
6729
+
6730
+ // Simulate the mouseout event
6731
+ simulateMouseEvent(event, 'mouseout');
6732
+
6733
+ // If the touch interaction did not move, it should trigger a click
6734
+ if (!this._touchMoved) {
6735
+
6736
+ // Simulate the click event
6737
+ simulateMouseEvent(event, 'click');
6738
+ }
6739
+
6740
+ // Unset the flag to allow other widgets to inherit the touch event
6741
+ touchHandled = false;
6742
+ this._touchMoved = false;
6743
+ };
6744
+
6745
+ /**
6746
+ * A duck punch of the $.ui.mouse _mouseInit method to support touch events.
6747
+ * This method extends the widget with bound touch event handlers that
6748
+ * translate touch events to mouse events and pass them to the widget's
6749
+ * original mouse event handling methods.
6750
+ */
6751
+ mouseProto._mouseInit = function () {
6752
+
6753
+ var self = this;
6754
+
6755
+ if (self.element.hasClass('touch-punch')) {
6756
+ // Delegate the touch handlers to the widget's element
6757
+ self.element.bind({
6758
+ touchstart: $.proxy(self, '_touchStart'),
6759
+ touchmove: $.proxy(self, '_touchMove'),
6760
+ touchend: $.proxy(self, '_touchEnd')
6761
+ });
6762
+ }
6763
+
6764
+ // Call the original $.ui.mouse init method
6765
+ _mouseInit.call(self);
6766
+ };
6767
+
6768
+ /**
6769
+ * Remove the touch event handlers
6770
+ */
6771
+ mouseProto._mouseDestroy = function () {
6772
+
6773
+ var self = this;
6774
+
6775
+ if (self.element.hasClass('touch-punch')) {
6776
+ // Delegate the touch handlers to the widget's element
6777
+ self.element.unbind({
6778
+ touchstart: $.proxy(self, '_touchStart'),
6779
+ touchmove: $.proxy(self, '_touchMove'),
6780
+ touchend: $.proxy(self, '_touchEnd')
6781
+ });
6782
+ }
6783
+
6784
+ // Call the original $.ui.mouse destroy method
6785
+ _mouseDestroy.call(self);
6786
+ };
6787
+
6788
+ })(jQuery);
6789
+
6790
+ $.fn.elfinder = function(o) {
6791
+
6792
+ if (o == 'instance') {
6793
+ return this.getElFinder();
6794
+ }
6795
+
6796
+ return this.each(function() {
6797
+
6798
+ var cmd = typeof(o) == 'string' ? o : '';
6799
+ if (!this.elfinder) {
6800
+ new elFinder(this, typeof(o) == 'object' ? o : {});
6801
+ }
6802
+
6803
+ switch(cmd) {
6804
+ case 'close':
6805
+ case 'hide':
6806
+ this.elfinder.hide();
6807
+ break;
6808
+
6809
+ case 'open':
6810
  case 'show':
6811
  this.elfinder.show();
6812
  break;
6817
  }
6818
 
6819
  })
6820
+ };
6821
 
6822
  $.fn.getElFinder = function() {
6823
  var instance;
6830
  });
6831
 
6832
  return instance;
6833
+ };
6834
+
6835
+ $.fn.elfUiWidgetInstance = function(name) {
6836
+ try {
6837
+ return this[name]('instance');
6838
+ } catch(e) {
6839
+ // fallback for jQuery UI < 1.11
6840
+ var data = this.data('ui-' + name);
6841
+ if (data && typeof data === 'object' && data.widgetFullName === 'ui-' + name) {
6842
+ return data;
6843
+ }
6844
+ return null;
6845
+ }
6846
+ };
6847
 
6848
 
6849
  /*
6915
  */
6916
  dragUploadAllow : 'auto',
6917
 
6918
+ /**
6919
+ * Confirmation dialog displayed at the time of overwriting upload
6920
+ *
6921
+ * @type Boolean
6922
+ * @default true
6923
+ */
6924
+ overwriteUploadConfirm : true,
6925
+
6926
  /**
6927
  * Max size of chunked data of file upload
6928
  *
6987
  cssClass : '',
6988
 
6989
  /**
6990
+ * Active commands list. '*' means all of the commands that have been load.
6991
  * If some required commands will be missed here, elFinder will add its
6992
  *
6993
  * @type Array
6994
  */
6995
+ commands : ['*'],
6996
+ // Available commands list
6997
+ //commands : [
6998
+ // 'archive', 'back', 'chmod', 'colwidth', 'copy', 'cut', 'download', 'duplicate',
6999
+ // 'edit', 'extract', 'forward', 'fullscreen', 'getfile', 'help', 'home', 'info',
7000
+ // 'mkdir', 'mkfile', 'netmount', 'netunmount', 'open', 'opendir', 'paste', 'places',
7001
+ // 'quicklook', 'reload', 'rename', 'resize', 'rm', 'search', 'sort', 'up', 'upload', 'view'
7002
+ //],
7003
 
7004
  /**
7005
  * Commands options.
7033
  // allow to return filers info
7034
  folders : false,
7035
  // action after callback (""/"close"/"destroy")
7036
+ oncomplete : '',
7037
+ // get path before callback call
7038
+ getPath : true,
7039
+ // get image sizes before callback call
7040
+ getImgSize : false
7041
+ },
7042
+ open : {
7043
+ // HTTP method that request to the connector when item URL is not valid URL.
7044
+ // If you set to "get" will be displayed request parameter in the browser's location field
7045
+ // so if you want to conceal its parameters should be given "post".
7046
+ // Nevertheless, please specify "get" if you want to enable the partial request by HTTP Range header.
7047
+ method : 'post'
7048
  },
7049
  // "upload" command options.
7050
  upload : {
7051
+ // Open elFinder upload dialog: 'button' OR Open system OS upload dialog: 'uploadbutton'
7052
+ ui : 'button'
7053
+ },
7054
+ // "download" command options.
7055
+ download : {
7056
+ maxRequests : 10
7057
  },
7058
  // "quicklook" command options.
7059
  quicklook : {
7060
  autoplay : true,
7061
+ width : 450,
7062
+ height : 300,
7063
+ // MIME types to use Google Docs online viewer
7064
+ // 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']
7065
+ googleDocsMimes : []
7066
  },
7067
  // "quicklook" command options.
7068
  edit : {
7117
  // }
7118
  ]
7119
  },
7120
+ search : {
7121
+ // Incremental search from the current view
7122
+ incsearch : {
7123
+ enable : true, // is enable true or false
7124
+ minlen : 1, // minimum number of characters
7125
+ wait : 500 // wait milliseconds
7126
+ }
7127
+ },
7128
  // "info" command options.
7129
  info : {
7130
  nullUrlDirLinkSelf : true,
7184
  // }
7185
  }
7186
  },
7187
+ mkdir: {
7188
+ // Enable automatic switching function ["New Folder" / "Into New Folder"] of toolbar buttton
7189
+ intoNewFolderToolbtn: false,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7190
  },
7191
+ help : {view : ['about', 'shortcuts', 'help', 'debug']}
 
7192
  },
7193
 
7194
  /**
7211
  /**
7212
  * Hash of default directory path to open
7213
  *
7214
+ * If you want to find the hash in Javascript
7215
+ * can be obtained with the following code. (In the case of a standard hashing method)
7216
+ *
7217
+ * var volumeId = 'l1_'; // volume id
7218
+ * var path = 'path/to/target'; // without root path
7219
+ * //var path = 'path\\to\\target'; // use \ on windows server
7220
+ * var hash = volumeId + btoa(path).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '.').replace(/\.+$/, '');
7221
+ *
7222
  * @type String
7223
  * @default ""
7224
  */
7256
  ['extract', 'archive'],
7257
  ['search'],
7258
  ['view', 'sort'],
7259
+ ['help'],
7260
+ ['fullscreen'],
7261
+ // extra options
7262
+ {
7263
+ // also displays the text label on the button (true / false)
7264
+ displayTextLabel: false,
7265
+ // Exclude `displayTextLabel` setting UA type
7266
+ labelExcludeUA: ['Mobile'],
7267
+ // auto hide on initial open
7268
+ autoHideUA: ['Mobile']
7269
+ }
7270
  ],
7271
  // directories tree options
7272
  tree : {
7279
  // ,
7280
  // /**
7281
  // * Add CSS class name to navbar directories (optional)
7282
+ // * see: https://github.com/Studio-42/elFinder/pull/1061,
7283
+ // * https://github.com/Studio-42/elFinder/issues/1231
7284
  // *
7285
  // * @type Function
7286
  // */
7287
  // getClass: function(dir) {
7288
+ // // e.g. This adds the directory's name (lowercase) with prefix as a CSS class
7289
  // return 'elfinder-tree-' + dir.name.replace(/[ "]/g, '').toLowerCase();
7290
  // }
7291
  },
7292
  // navbar options
7293
  navbar : {
7294
  minWidth : 150,
7295
+ maxWidth : 500,
7296
+ // auto hide on initial open
7297
+ autoHideUA: [] // e.g. ['Mobile']
7298
  },
7299
  cwd : {
7300
  // display parent folder with ".." name :)
7301
  oldSchool : false,
7302
 
7303
+ // fm.UA types array to show item select checkboxes e.g. ['All'] or ['Mobile'] etc. default: ['Touch']
7304
+ showSelectCheckboxUA : ['Touch'],
7305
+
7306
  // file info columns displayed
7307
  listView : {
7308
  // name is always displayed, cols are ordered
7309
+ // e.g. ['perm', 'date', 'size', 'kind', 'owner', 'group', 'mode']
7310
  // mode: 'mode'(by `fileModeStyle` setting), 'modestr'(rwxr-xr-x) , 'modeoct'(755), 'modeboth'(rwxr-xr-x (755))
7311
  // 'owner', 'group' and 'mode', It's necessary set volume driver option "statOwner" to `true`
7312
+ // for custom, characters that can be used in the name is `a-z0-9_`
7313
  columns : ['perm', 'date', 'size', 'kind'],
7314
  // override this if you want custom columns name
7315
  // example
7317
  // date : 'Last modification',
7318
  // kind : 'Mime type'
7319
  // }
7320
+ columnsCustomName : {},
7321
+ // fixed list header colmun
7322
+ fixedHeader : true
7323
  }
7324
+
7325
+ // /**
7326
+ // * Add CSS class name to cwd directories (optional)
7327
+ // * see: https://github.com/Studio-42/elFinder/pull/1061,
7328
+ // * https://github.com/Studio-42/elFinder/issues/1231
7329
+ // *
7330
+ // * @type Function
7331
+ // */
7332
+ // ,
7333
+ // getClass: function(file) {
7334
+ // // e.g. This adds the directory's name (lowercase) with prefix as a CSS class
7335
+ // return 'elfinder-cwd-' + file.name.replace(/[ "]/g, '').toLowerCase();
7336
+ //}
7337
+
7338
+ //,
7339
+ //// Template placeholders replacement rules for overwrite. see ui/cwd.js replacement
7340
+ //replacement : {
7341
+ // tooltip : function(f, fm) {
7342
+ // var list = fm.viewType == 'list', // current view type
7343
+ // query = fm.searchStatus.state == 2, // is in search results
7344
+ // title = fm.formatDate(f) + (f.size > 0 ? ' ('+fm.formatSize(f.size)+')' : ''),
7345
+ // info = '';
7346
+ // if (query && f.path) {
7347
+ // info = fm.escape(f.path.replace(/\/[^\/]*$/, ''));
7348
+ // } else {
7349
+ // info = f.tooltip? fm.escape(f.tooltip).replace(/\r/g, '&#13;') : '';
7350
+ // }
7351
+ // if (list) {
7352
+ // info += (info? '&#13;' : '') + fm.escape(f.name);
7353
+ // }
7354
+ // return info? info + '&#13;' + title : title;
7355
+ // }
7356
+ //}
7357
  }
7358
  },
7359
 
7370
 
7371
  /**
7372
  * Custom files sort rules.
7373
+ * All default rules (name/size/kind/date/perm/mode/owner/group) set in elFinder._sortRules
7374
  *
7375
  * @type {Object}
7376
  * @example
7403
  */
7404
  sortStickFolders : true,
7405
 
7406
+ /**
7407
+ * Sort also applies to the treeview
7408
+ *
7409
+ * @type {Boolean}
7410
+ * @default false
7411
+ */
7412
+ sortAlsoTreeview : false,
7413
+
7414
  /**
7415
  * If true - elFinder will formating dates itself,
7416
  * otherwise - backend date will be used.
7470
  * elFinder height
7471
  *
7472
  * @type Number
7473
+ * @default 400
7474
  */
7475
  height : 400,
7476
 
7539
  * @type Number
7540
  * @default 50
7541
  */
7542
+ showFiles : 50,
7543
 
7544
  /**
7545
  * Lazy load config.
7614
  */
7615
  contextmenu : {
7616
  // navbarfolder menu
7617
+ navbar : ['open', 'download', '|', 'upload', 'mkdir', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'rename', '|', 'archive', '|', 'places', 'info', 'chmod', 'netunmount'],
7618
  // current directory menu
7619
+ cwd : ['reload', 'back', '|', 'upload', 'mkdir', 'mkfile', 'paste', '|', 'view', 'sort', 'colwidth', '|', 'info', '|', 'fullscreen'],
7620
  // current directory file menu
7621
+ files : ['getfile', '|' ,'open', 'download', 'opendir', 'quicklook', '|', 'upload', 'mkdir', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'edit', 'rename', 'resize', '|', 'archive', 'extract', '|', 'places', 'info', 'chmod', 'netunmount']
7622
  },
7623
 
7624
+ /**
7625
+ * elFinder node enable always
7626
+ * This value will set to `true` if <body> has elFinder node only
7627
+ *
7628
+ * @type Bool
7629
+ * @default false
7630
+ */
7631
+ enableAlways : false,
7632
+
7633
+ /**
7634
+ * elFinder node enable by mouse over
7635
+ *
7636
+ * @type Bool
7637
+ * @default true
7638
+ */
7639
+ enableByMouseOver : true,
7640
+
7641
+ /**
7642
+ * Show window close confirm dialog
7643
+ * Value is which state to show
7644
+ * 'hasNotifyDialog', 'editingFile', 'hasSelectedItem' and 'hasClipboardData'
7645
+ *
7646
+ * @type Array
7647
+ * @default ['hasNotifyDialog', 'editingFile']
7648
+ */
7649
+ windowCloseConfirm : ['hasNotifyDialog', 'editingFile'],
7650
+
7651
+ /**
7652
+ * Function decoding 'raw' string converted to unicode
7653
+ * It is used instead of fm.decodeRawString(str)
7654
+ *
7655
+ * @type Null|Function
7656
+ */
7657
+ rawStringDecoder : typeof Encoding === 'object' && $.isFunction(Encoding.convert)? function(str) {
7658
+ return Encoding.convert(str, {
7659
+ to: 'UNICODE',
7660
+ type: 'string'
7661
+ });
7662
+ } : null,
7663
+
7664
  /**
7665
  * Debug config
7666
  *
7668
  */
7669
  // debug : true
7670
  debug : ['error', 'warning', 'event-destroy']
7671
+ };
7672
+
7673
+
7674
+ /*
7675
+ * File: /js/elFinder.options.netmount.js
7676
+ */
7677
+
7678
+ /**
7679
+ * Default elFinder config of commandsOptions.netmount
7680
+ *
7681
+ * @type Object
7682
+ */
7683
+
7684
+ elFinder.prototype._options.commandsOptions.netmount = {
7685
+ ftp: {
7686
+ name : 'FTP',
7687
+ inputs: {
7688
+ host : $('<input type="text"/>'),
7689
+ port : $('<input type="text" placeholder="21"/>'),
7690
+ path : $('<input type="text" value="/"/>'),
7691
+ user : $('<input type="text"/>'),
7692
+ pass : $('<input type="password"/>'),
7693
+ encoding : $('<input type="text" placeholder="Optional"/>'),
7694
+ locale : $('<input type="text" placeholder="Optional"/>')
7695
+ }
7696
+ },
7697
+ dropbox: {
7698
+ name : 'Dropbox.com',
7699
+ inputs: {
7700
+ host : $('<span><span class="elfinder-info-spinner"/></span></span><input type="hidden"/>'),
7701
+ path : $('<input type="text" value="/"/>'),
7702
+ user : $('<input type="hidden"/>'),
7703
+ pass : $('<input type="hidden"/>')
7704
+ },
7705
+ select: function(fm){
7706
+ var self = this;
7707
+ if (self.inputs.host.find('span').length) {
7708
+ fm.request({
7709
+ data : {cmd : 'netmount', protocol: 'dropbox', host: 'dropbox.com', user: 'init', pass: 'init', options: {url: fm.uploadURL, id: fm.id}},
7710
+ preventDefault : true
7711
+ }).done(function(data){
7712
+ self.inputs.host.find('span').removeClass("elfinder-info-spinner");
7713
+ self.inputs.host.find('span').html(data.body.replace(/\{msg:([^}]+)\}/g, function(whole,s1){return fm.i18n(s1,'Dropbox.com');}));
7714
+ }).fail(function(){});
7715
+ }
7716
+ },
7717
+ done: function(fm, data){
7718
+ var self = this;
7719
+ if (data.mode == 'makebtn') {
7720
+ self.inputs.host.find('span').removeClass("elfinder-info-spinner");
7721
+ self.inputs.host.find('input').hover(function(){$(this).toggleClass("ui-state-hover");});
7722
+ self.inputs.host[1].value = "";
7723
+ } else {
7724
+ self.inputs.host.find('span').removeClass("elfinder-info-spinner");
7725
+ self.inputs.host.find('span').html("Dropbox.com");
7726
+ self.inputs.host[1].value = "dropbox";
7727
+ self.inputs.user.val("done");
7728
+ self.inputs.pass.val("done");
7729
+ }
7730
+ }
7731
+ },
7732
+ googledrive: elFinder.prototype.makeNetmountOptionOauth('googledrive', 'Google Drive', 'Google'),
7733
+ onedrive: elFinder.prototype.makeNetmountOptionOauth('onedrive', 'One Drive', 'OneDrive'),
7734
+ box: elFinder.prototype.makeNetmountOptionOauth('box', 'Box', 'Box', true)
7735
+ };
7736
 
7737
 
7738
  /*
7850
  })
7851
  .reload(fm.options.reloadClearHistory && reset);
7852
 
7853
+ };
7854
+
7855
 
7856
  /*
7857
  * File: /js/elFinder.command.js
7879
  */
7880
  this.name = '';
7881
 
7882
+ /**
7883
+ * Command icon class name with out 'elfinder-button-icon-'
7884
+ * Use this.name if it is empty
7885
+ *
7886
+ * @type String
7887
+ */
7888
+ this.className = '';
7889
+
7890
  /**
7891
  * Short command description
7892
  *
7894
  */
7895
  this.title = '';
7896
 
7897
+ /**
7898
+ * Linked(Child) commands name
7899
+ * They are loaded together when tthis command is loaded.
7900
+ *
7901
+ * @type Array
7902
+ */
7903
+ this.linkedCmds = [];
7904
+
7905
  /**
7906
  * Current command state
7907
  *
7943
  this._handlers = {
7944
  enable : function() { this.update(void(0), this.value); },
7945
  disable : function() { this.update(-1, this.value); },
7946
+ 'open reload load sync' : function() {
7947
  this._disabled = !(this.alwaysEnabled || this.fm.isCommandEnabled(this.name));
7948
  this.update(void(0), this.value)
7949
  this.change();
7983
  fm = this.fm, i, s, sc;
7984
 
7985
  this.name = name;
7986
+ this.title = fm.messages['cmd'+name] ? fm.i18n('cmd'+name)
7987
+ : ((this.extendsCmd && fm.messages['cmd'+this.extendsCmd]) ? fm.i18n('cmd'+this.extendsCmd) : name),
7988
  this.options = $.extend({}, this.options, opts);
7989
  this.listeners = [];
7990
 
8014
 
8015
  if (this.disableOnSearch) {
8016
  fm.bind('search searchend', function(e) {
8017
+ self._disabled = e.type === 'search'? true : ! (this.alwaysEnabled || fm.isCommandEnabled(name));
8018
  self.update(void(0), self.value);
8019
  });
8020
  }
8153
  ? $.map($.isArray(hashes) ? hashes : [hashes], function(hash) { return fm.file(hash) || null })
8154
  : fm.selectedFiles();
8155
  }
8156
+ };
 
 
8157
 
8158
 
8159
  /*
8187
  navexpand : 'elfinder-navbar-expanded',
8188
  treedir : 'elfinder-tree-dir',
8189
  placedir : 'elfinder-place-dir',
8190
+ searchbtn : 'elfinder-button-search',
8191
+ editing : 'elfinder-to-editing'
8192
  },
8193
  tpl : {
8194
  perms : '<span class="elfinder-perms"/>',
8196
  symlink : '<span class="elfinder-symlink"/>',
8197
  navicon : '<span class="elfinder-nav-icon"/>',
8198
  navspinner : '<span class="elfinder-navbar-spinner"/>',
8199
+ navdir : '<div class="elfinder-navbar-wrapper"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree" style="display:none"/></div>',
8200
+ placedir : '<div class="elfinder-navbar-wrapper"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}" title="{title}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree" style="display:none"/></div>'
8201
 
8202
  },
8203
 
8222
  make : function() {
8223
  var fm = this.fm,
8224
  cmd = this.name,
8225
+ wz = fm.getUI('workzone'),
8226
+ org = (this.origin && this.origin === 'navbar')? 'tree' : 'cwd',
8227
+ ui = fm.getUI(org),
8228
+ tree = (org === 'tree'),
8229
+ find = tree? 'navHash2Id' : 'cwdHash2Id',
8230
+ tarea= (! tree && fm.storage('view') != 'list'),
8231
+ sel = fm.selected(),
8232
+ move = this.move || false,
8233
+ empty= wz.hasClass('elfinder-cwd-wrapper-empty'),
8234
  rest = function(){
8235
+ if (!overlay.is(':hidden')) {
8236
+ overlay.addClass('ui-front')
8237
+ .elfinderoverlay('hide')
8238
+ .off('click', cancel);
8239
+ }
8240
+ node.removeClass('ui-front').css('position', '');
8241
  if (tarea) {
 
8242
  nnode.css('max-height', '');
8243
+ } else if (pnode) {
8244
+ pnode.css('width', '')
8245
+ .parent('td').css('overflow', '');
8246
  }
8247
  }, colwidth,
8248
  dfrd = $.Deferred()
8249
  .fail(function(error) {
8250
+ dstCls && dst.attr('class', dstCls);
8251
+ empty && wz.addClass('elfinder-cwd-wrapper-empty');
8252
+ if (sel) {
8253
+ move && fm.trigger('unlockfiles', {files: sel});
8254
+ fm.clipboard([]);
8255
+ fm.trigger('selectfiles', { files: sel })
8256
+ }
8257
  error && fm.error(error);
8258
  })
8259
  .always(function() {
8260
+ rest();
8261
+ cleanup();
8262
  fm.enable();
8263
+ fm.trigger('resMixinMake');
8264
  }),
8265
  id = 'tmp_'+parseInt(Math.random()*100000),
8266
+ phash = tree? fm.file(sel[0]).hash : fm.cwd().hash,
8267
  date = new Date(),
8268
  file = {
8269
  hash : id,
8270
+ phash : phash,
8271
+ name : fm.uniqueName(this.prefix, phash),
8272
  mime : this.mime,
8273
  read : true,
8274
  write : true,
8275
+ date : 'Today '+date.getHours()+':'+date.getMinutes(),
8276
+ move : move
8277
  },
8278
  data = this.data || {},
8279
+ node = ui.trigger('create.'+fm.namespace, file).find('#'+fm[find](id))
8280
+ .on('unselect.'+fm.namespace, function() {
8281
+ setTimeout(function() {
8282
+ input && input.blur();
8283
+ }, 50);
8284
+ }),
8285
  nnode, pnode,
8286
+ overlay = fm.getUI('overlay'),
8287
+ cleanup = function() {
8288
+ fm.unbind('resize', resize);
8289
+ input.remove();
8290
+ if (tree) {
8291
+ node.closest('.elfinder-navbar-wrapper').remove();
8292
+ }
8293
+ node.remove();
8294
+ },
8295
+ cancel = function(e) {
8296
+ if (! inError) {
8297
+ cleanup();
8298
+ e.stopPropagation();
8299
+ dfrd.reject();
8300
+ }
8301
+ },
8302
  input = $(tarea? '<textarea/>' : '<input type="text"/>')
8303
  .on('keyup text', function(){
8304
  if (tarea) {
8313
  })
8314
  .keydown(function(e) {
8315
  e.stopImmediatePropagation();
 
8316
  if (e.keyCode == $.ui.keyCode.ESCAPE) {
8317
  dfrd.reject();
8318
  } else if (e.keyCode == $.ui.keyCode.ENTER) {
8325
  .blur(function() {
8326
  var name = $.trim(input.val()),
8327
  parent = input.parent(),
8328
+ valid = true,
8329
+ cut;
8330
 
8331
+ if (!inError && parent.length) {
8332
 
8333
  if (fm.options.validName && fm.options.validName.test) {
8334
  try {
8338
  }
8339
  }
8340
  if (!name || name === '..' || !valid) {
8341
+ inError = true;
8342
+ fm.error('errInvName', {modal: true, close: select});
8343
  return false;
8344
  }
8345
  if (fm.fileByName(name, phash)) {
8346
+ inError = true;
8347
+ fm.error(['errExists', name], {modal: true, close: select});
8348
  return false;
8349
  }
8350
 
8351
+ cut = (sel && move)? fm.exec('cut', sel) : null;
 
8352
 
8353
+ $.when(cut)
8354
+ .done(function() {
8355
+ rest();
8356
+ input.hide().before($('<span>').text(name));
8357
 
8358
+ fm.lockfiles({files : [id]});
8359
+
8360
+ fm.request({
8361
+ data : $.extend({cmd : cmd, name : name, target : phash}, data || {}),
8362
+ notify : {type : cmd, cnt : 1},
8363
+ preventFail : true,
8364
+ syncOnFail : true
8365
+ })
8366
+ .fail(function(error) {
8367
+ fm.unlockfiles({files : [id]});
8368
+ inError = true;
8369
+ input.show().prev().remove();
8370
+ fm.error(error, {modal: true, close: select});
8371
+ })
8372
+ .done(function(data) {
8373
+ dfrd.resolve(data);
8374
+ if (data && data.added && data.added[0]) {
8375
+ var item = data.added[0],
8376
+ dirhash = item.hash,
8377
+ newItem = ui.find('#'+fm[find](dirhash));
8378
+ if (sel && move) {
8379
+ fm.one(cmd+'done', function() {
8380
+ fm.exec('paste', dirhash);
8381
+ });
8382
+ }
8383
+ fm.one(cmd+'done', function() {
8384
+ var acts = {
8385
+ 'directory' : { cmd: 'open', msg: 'cmdopendir' },
8386
+ 'text/plain': { cmd: 'edit', msg: 'cmdedit' },
8387
+ 'default' : { cmd: 'open', msg: 'cmdopen' }
8388
+ },
8389
+ act, extNode;
8390
+ newItem = ui.find('#'+fm[find](item.hash));
8391
+ if (data.added.length === 1) {
8392
+ act = acts[item.mime] || acts.default;
8393
+ extNode = $('<div/>').append(
8394
+ $('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all elfinder-tabstop"><span class="ui-button-text">'
8395
+ +fm.i18n(act.msg)
8396
+ +'</span></button>')
8397
+ .on('mouseenter mouseleave', function(e) {
8398
+ $(this).toggleClass('ui-state-hover', e.type == 'mouseenter');
8399
+ })
8400
+ .on('click', function() {
8401
+ fm.exec(act.cmd, item.hash);
8402
+ })
8403
+ );
8404
+ }
8405
+ if (newItem.length) {
8406
+ newItem.trigger('scrolltoview');
8407
+ ! move && extNode && fm.toast({msg: fm.i18n(['complete', fm.i18n('cmd'+cmd)]), extNode: extNode});
8408
+ } else {
8409
+ fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})});
8410
+ ! move && fm.toast({msg: fm.i18n(['complete', fm.i18n('cmd'+cmd)]), extNode: extNode});
8411
+ }
8412
+ });
8413
  }
8414
+ });
8415
+ })
8416
+ .fail(function() {
8417
+ dfrd.reject();
8418
+ });
8419
  }
8420
+ }),
8421
+ select = function() {
8422
+ var name = input.val().replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/ig, '');
8423
+ inError = false;
8424
+ if (fm.UA.Mobile) {
8425
+ overlay.on('click', cancel)
8426
+ .removeClass('ui-front').elfinderoverlay('show');
8427
+ }
8428
+ input.select().focus();
8429
+ input[0].setSelectionRange && input[0].setSelectionRange(0, name.length);
8430
+ },
8431
+ resize = function() {
8432
+ node.trigger('scrolltoview');
8433
+ },
8434
+ inError = false,
8435
+ // for tree
8436
+ dst, dstCls, collapsed, expanded, arrow, subtree;
8437
 
8438
+ if ((! tree && this.disabled()) || !node.length) {
8439
  return dfrd.reject();
8440
  }
8441
 
8442
+ if (tree) {
8443
+ dst = $('#'+fm[find](phash));
8444
+ collapsed = fm.res('class', 'navcollapse');
8445
+ expanded = fm.res('class', 'navexpand');
8446
+ arrow = fm.res('class', 'navarrow');
8447
+ subtree = fm.res('class', 'navsubtree');
8448
+
8449
+ node.closest('.'+subtree).show();
8450
+ if (! dst.hasClass(collapsed)) {
8451
+ dstCls = dst.attr('class');
8452
+ dst.addClass(collapsed+' '+expanded+' elfinder-subtree-loaded');
8453
+ }
8454
+ if (dst.is('.'+collapsed+':not(.'+expanded+')')) {
8455
+ dst.children('.'+arrow).click().data('dfrd').done(function() {
8456
+ if (input.val() === file.name) {
8457
+ input.val(fm.uniqueName(this.prefix, phash)).select().focus();
8458
+ }
8459
+ }.bind(this));
8460
+ }
8461
+ nnode = node.contents().filter(function(){ return this.nodeType==3 && $(this).parent().attr('id') === fm.navHash2Id(file.hash); });
8462
+ nnode.replaceWith(input.val(file.name));
8463
  } else {
8464
+ empty && wz.removeClass('elfinder-cwd-wrapper-empty');
8465
+ nnode = node.find('.elfinder-cwd-filename');
8466
+ pnode = nnode.parent();
8467
+ node.css('position', 'relative').addClass('ui-front');
8468
+ if (tarea) {
8469
+ nnode.css('max-height', 'none');
8470
+ } else {
8471
+ colwidth = pnode.width();
8472
+ pnode.width(colwidth - 15)
8473
+ .parent('td').css('overflow', 'visible');
8474
+ }
8475
+ nnode.empty('').append(input.val(file.name));
8476
  }
8477
+
8478
+ fm.bind('resize', resize);
8479
+
8480
  input.trigger('keyup');
8481
+ select();
 
8482
 
8483
  return dfrd;
8484
 
 
 
8485
  }
8486
+ },
8487
+ blink: function(elm, mode) {
8488
+ var acts = {
8489
+ slowonce : function(){elm.hide().delay(250).fadeIn(750).delay(500).fadeOut(3500);},
8490
+ lookme : function(){elm.show().fadeOut(500).fadeIn(750);}
8491
+ }, func;
8492
+ mode = mode || 'slowonce';
8493
 
8494
+ func = acts[mode] || acts['lookme'];
8495
+
8496
+ elm.stop(true, true);
8497
+ func();
8498
  }
8499
+ };
 
8500
 
8501
 
8502
  /*
8526
 
8527
  var doc = $(document),
8528
  toolbar = $('<div class="ui-widget-header dialogelfinder-drag ui-corner-top">'+(opts.title || 'Files')+'</div>'),
8529
+ button = $('<a href="#" class="dialogelfinder-drag-close ui-corner-all"><span class="ui-icon ui-icon-closethick"> </span></a>')
8530
  .appendTo(toolbar)
8531
  .click(function(e) {
8532
  e.preventDefault();
8537
  .css('position', 'absolute')
8538
  .hide()
8539
  .appendTo('body')
8540
+ .draggable({
8541
+ handle : '.dialogelfinder-drag',
8542
+ containment : 'window',
8543
+ stop : function() {
8544
+ node.trigger('resize');
8545
+ elfinder.trigger('resize');
8546
+ }
8547
+ })
8548
  .elfinder(opts)
8549
  .prepend(toolbar),
8550
  elfinder = node.elfinder('instance');
8565
  pos = node.data(position) || {
8566
  top : parseInt($(document).scrollTop() + ($(window).height() < node.height() ? 2 : ($(window).height() - node.height())/2)),
8567
  left : parseInt($(document).scrollLeft() + ($(window).width() < node.width() ? 2 : ($(window).width() - node.width())/2))
8568
+ };
 
8569
 
8570
  if (node.is(':hidden')) {
8571
+ node.addClass('ui-front').css(pos).show().trigger('resize');
 
 
 
 
 
 
 
 
 
8572
 
8573
  setTimeout(function() {
8574
  // fix resize icon position and make elfinder active
8576
  }, 200);
8577
  }
8578
  } else if (opts == 'close') {
8579
+ var node = $(this).removeClass('ui-front');
8580
 
8581
  if (node.is(':visible')) {
8582
  !!node.data(destroy)
8591
  };
8592
 
8593
 
 
8594
  /*
8595
  * File: /js/i18n/elfinder.en.js
8596
  */
8598
  /**
8599
  * English translation
8600
  * @author Troex Nevelin <troex@fury.scancode.ru>
8601
+ * @version 2016-11-13
8602
  */
8603
  if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object') {
8604
  elFinder.prototype.i18.en = {
8694
  'errConvUTF8' : 'Not convertible to UTF-8', // from v2.1 added 08.04.2014
8695
  'errFolderUpload' : 'Try Google Chrome, If you\'d like to upload the folder.', // from v2.1 added 26.6.2015
8696
  'errSearchTimeout' : 'Timed out while searching "$1". Search result is partial.', // from v2.1 added 12.1.2016
8697
+ 'errReauthRequire' : 'Re-authorization is required.', // from v2.1.10 added 24.3.2016
8698
+ 'errMaxTargets' : 'Max number of selectable items is $1.', // from v2.1.17 added 17.10.2016
8699
 
8700
  /******************************* commands names ********************************/
8701
  'cmdarchive' : 'Create archive',
8712
  'cmdhome' : 'Home',
8713
  'cmdinfo' : 'Get info',
8714
  'cmdmkdir' : 'New folder',
8715
+ 'cmdmkdirin' : 'Into New Folder', // from v2.1.7 added 19.2.2016
8716
  'cmdmkfile' : 'New text file',
8717
  'cmdopen' : 'Open',
8718
  'cmdpaste' : 'Paste',
8731
  'cmdplaces' : 'To Places', // added 28.12.2014
8732
  'cmdchmod' : 'Change mode', // from v2.1 added 20.6.2015
8733
  'cmdopendir' : 'Open a folder', // from v2.1 added 13.1.2016
8734
+ 'cmdcolwidth' : 'Reset column width', // from v2.1.13 added 12.06.2016
8735
+ 'cmdfullscreen': 'Full Screen', // from v2.1.15 added 03.08.2016
8736
+ 'cmdmove' : 'Move', // from v2.1.15 added 21.08.2016
8737
 
8738
  /*********************************** buttons ***********************************/
8739
  'btnClose' : 'Close',
8782
  'ntfurl' : 'Getting URL of link', // from v2.1 added 11.03.2014
8783
  'ntfchmod' : 'Changing file mode', // from v2.1 added 20.6.2015
8784
  'ntfpreupload': 'Verifying upload file name', // from v2.1 added 31.11.2015
8785
+ 'ntfzipdl' : 'Creating a file for download', // from v2.1.7 added 23.1.2016
8786
+ 'ntfparents' : 'Getting path infomation', // from v2.1.17 added 2.11.2016
8787
+ 'ntfchunkmerge': 'Processing the uploaded file', // from v2.1.17 added 2.11.2016
8788
 
8789
  /************************************ dates **********************************/
8790
  'dateUnknown' : 'unknown',
8835
  'sortsize' : 'by size',
8836
  'sortdate' : 'by date',
8837
  'sortFoldersFirst' : 'Folders first',
8838
+ 'sortperm' : 'by permission', // from v2.1.13 added 13.06.2016
8839
+ 'sortmode' : 'by mode', // from v2.1.13 added 13.06.2016
8840
+ 'sortowner' : 'by owner', // from v2.1.13 added 13.06.2016
8841
+ 'sortgroup' : 'by group', // from v2.1.13 added 13.06.2016
8842
+ 'sortAlsoTreeview' : 'Also Treeview', // from v2.1.15 added 01.08.2016
8843
 
8844
  /********************************** new items **********************************/
8845
  'untitled file.txt' : 'NewFile.txt', // added 10.11.2015
8927
  'pass' : 'Password', // added 18.04.2012
8928
  'confirmUnmount' : 'Are you unmount $1?', // from v2.1 added 30.04.2012
8929
  'dropFilesBrowser': 'Drop or Paste files from browser', // from v2.1 added 30.05.2012
8930
+ 'dropPasteFiles' : 'Drop files, Paste URLs or images(clipboard) here', // from v2.1 added 07.04.2014
8931
  'encoding' : 'Encoding', // from v2.1 added 19.12.2014
8932
  'locale' : 'Locale', // from v2.1 added 19.12.2014
8933
  'searchTarget' : 'Target: $1', // from v2.1 added 22.5.2015
8944
  'quality' : 'Quality', // from v2.1.6 added 5.1.2016
8945
  'autoSync' : 'Auto sync', // from v2.1.6 added 10.1.2016
8946
  'moveUp' : 'Move up', // from v2.1.6 added 18.1.2016
8947
+ 'getLink' : 'Get URL link', // from v2.1.7 added 9.2.2016
8948
+ 'selectedItems' : 'Selected items ($1)', // from v2.1.7 added 2.19.2016
8949
+ 'folderId' : 'Folder ID', // from v2.1.10 added 3.25.2016
8950
+ 'offlineAccess' : 'Allow offline access', // from v2.1.10 added 3.25.2016
8951
+ 'reAuth' : 'To re-authenticate', // from v2.1.10 added 3.25.2016
8952
+ 'nowLoading' : 'Now loading...', // from v2.1.12 added 4.26.2016
8953
+ 'openMulti' : 'Open multiple files', // from v2.1.12 added 5.14.2016
8954
+ 'openMultiConfirm': 'You are trying to open the $1 files. Are you sure you want to open in browser?', // from v2.1.12 added 5.14.2016
8955
+ 'emptySearch' : 'Search results is empty in search target.', // from v2.1.12 added 5.16.2016
8956
+ 'editingFile' : 'It is editing a file.', // from v2.1.13 added 6.3.2016
8957
+ 'hasSelected' : 'You have selected $1 items.', // from v2.1.13 added 6.3.2016
8958
+ 'hasClipboard' : 'You have $1 items in the clipboard.', // from v2.1.13 added 6.3.2016
8959
+ 'incSearchOnly' : 'Incremental search is only from the current view.', // from v2.1.13 added 6.30.2016
8960
+ 'reinstate' : 'Reinstate', // from v2.1.15 added 3.8.2016
8961
+ 'complete' : '$1 complete', // from v2.1.15 added 21.8.2016
8962
+ 'contextmenu' : 'Context menu', // from v2.1.15 added 9.9.2016
8963
+ 'pageTurning' : 'Page turning', // from v2.1.15 added 10.9.2016
8964
+ 'volumeRoots' : 'Volume roots', // from v2.1.16 added 16.9.2016
8965
+ 'reset' : 'Reset', // from v2.1.16 added 1.10.2016
8966
+ 'bgcolor' : 'Background color', // from v2.1.16 added 1.10.2016
8967
+ 'colorPicker' : 'Color picker', // from v2.1.16 added 1.10.2016
8968
+ '8pxgrid' : '8px Grid', // from v2.1.16 added 4.10.2016
8969
+ 'enabled' : 'Enabled', // from v2.1.16 added 4.10.2016
8970
+ 'disabled' : 'Disabled', // from v2.1.16 added 4.10.2016
8971
+ 'emptyIncSearch' : 'Search results is empty in current view.\\APress [Enter] to expand search target.', // from v2.1.16 added 5.10.2016
8972
+ 'textLabel' : 'Text lable', // from v2.1.17 added 13.10.2016
8973
+ 'minsLeft' : '$1 mins left', // from v2.1.17 added 13.11.2016
8974
 
8975
  /********************************** mimetypes **********************************/
8976
  'kindUnknown' : 'Unknown',
8977
+ 'kindRoot' : 'Volume Root', // from v2.1.16 added 16.10.2016
8978
  'kindFolder' : 'Folder',
8979
  'kindAlias' : 'Alias',
8980
  'kindAliasBroken' : 'Broken alias',
9079
  item = 'elfinder-button-menu-item',
9080
  selected = 'elfinder-button-menu-item-selected',
9081
  menu,
9082
+ text = $('<span class="elfinder-button-text">'+cmd.title+'</span>'),
9083
  button = $(this).addClass('ui-state-default elfinder-button')
9084
  .attr('title', cmd.title)
9085
+ .append('<span class="elfinder-button-icon elfinder-button-icon-' + (cmd.className? cmd.className : cmd.name) + '"/>', text)
9086
  .hover(function(e) { !button.hasClass(disabled) && button[e.type == 'mouseleave' ? 'removeClass' : 'addClass'](hover) /**button.toggleClass(hover);*/ })
9087
  .click(function(e) {
9088
  if (!button.hasClass(disabled)) {
9101
  menu.hide();
9102
  };
9103
 
9104
+ text.hide();
9105
+
9106
  // if command has variants create menu
9107
  if ($.isArray(cmd.variants)) {
9108
  button.addClass('elfinder-menubutton');
9109
 
9110
+ menu = $('<div class="ui-front ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>')
9111
  .hide()
9112
  .appendTo(button)
 
9113
  .on('mouseenter mouseleave', '.'+item, function() { $(this).toggleClass(hover) })
9114
  .on('click', '.'+item, function(e) {
9115
  e.preventDefault();
9139
  })
9140
  .change();
9141
  });
9142
+ };
9143
 
9144
 
9145
  /*
9154
  $.fn.elfindercontextmenu = function(fm) {
9155
 
9156
  return this.each(function() {
9157
+ var cmItem = 'elfinder-contextmenu-item',
 
9158
  smItem = 'elfinder-contextsubmenu-item',
9159
  exIcon = 'elfinder-contextmenu-extra-icon',
9160
+ dragOpt = {
9161
+ distance: 8,
9162
+ start: function() {
9163
+ menu.data('touching') && menu.find('.ui-state-hover').removeClass('ui-state-hover');
9164
+ },
9165
+ stop: function() {
9166
+ menu.data('draged', true);
9167
+ }
9168
+ },
9169
+ menu = $(this).addClass('touch-punch ui-helper-reset ui-front ui-widget ui-state-default ui-corner-all elfinder-contextmenu elfinder-contextmenu-'+fm.direction)
9170
  .hide()
9171
+ .on('touchstart', function(e) {
9172
+ menu.data('touching', true);
9173
+ })
9174
+ .on('touchend', function(e) {
9175
+ menu.removeData('touching');
9176
+ })
9177
  .on('mouseenter mouseleave', '.'+cmItem, function(e) {
9178
+ $(this).toggleClass('ui-state-hover', (e.type === 'mouseenter' || (! menu.data('draged') && menu.data('submenuKeep'))? true : false));
9179
+ if (menu.data('draged') && menu.data('submenuKeep')) {
9180
+ menu.find('.elfinder-contextmenu-sub:visible').parent().addClass('ui-state-hover');
9181
+ }
9182
  })
9183
  .on('mouseenter mouseleave', '.'+exIcon, function(e) {
9184
  $(this).parent().toggleClass('ui-state-hover', e.type === 'mouseleave');
9185
  })
9186
+ .on('mouseenter mouseleave', '.'+cmItem+',.'+smItem, function(e) {
9187
+ var setIndex = function(target, sub) {
9188
+ $.each(sub? subnodes : nodes, function(i, n) {
9189
+ if (target[0] === n) {
9190
+ (sub? subnodes : nodes)._cur = i;
9191
+ if (sub) {
9192
+ subselected = target;
9193
+ } else {
9194
+ selected = target;
9195
+ }
9196
+ return false;
9197
+ }
9198
+ });
9199
+ };
9200
+ if (e.originalEvent) {
9201
+ var target = $(this);
9202
+ if (e.type === 'mouseenter') {
9203
+ // mouseenter
9204
+ if (target.hasClass(smItem)) {
9205
+ // submenu
9206
+ if (subselected) {
9207
+ subselected.removeClass('ui-state-hover');
9208
+ }
9209
+ subnodes = selected.find('div.'+smItem);
9210
+ setIndex(target, true);
9211
+ } else {
9212
+ // menu
9213
+ if (selected) {
9214
+ selected.removeClass('ui-state-hover');
9215
+ }
9216
+ setIndex(target);
9217
+ }
9218
+ } else {
9219
+ // mouseleave
9220
+ if (target.hasClass(smItem)) {
9221
+ //submenu
9222
+ subselected = null;
9223
+ subnodes = null;
9224
+ } else {
9225
+ // menu
9226
+ if (selected) {
9227
+ selected.removeClass('ui-state-hover');
9228
+ }
9229
+ (function(sel) {
9230
+ setTimeout(function() {
9231
+ if (sel === selected) {
9232
+ selected = null;
9233
+ }
9234
+ }, 250);
9235
+ })(selected);
9236
+ }
9237
+ }
9238
+ }
9239
+ })
9240
+ .on('contextmenu', function(){return false;})
9241
+ .on('mouseup', function() {
9242
+ setTimeout(function() {
9243
+ menu.removeData('draged');
9244
+ }, 100);
9245
+ })
9246
+ .draggable(dragOpt),
9247
+ subpos = fm.direction == 'ltr' ? 'left' : 'right',
9248
  types = $.extend({}, fm.options.contextmenu),
9249
+ tpl = '<div class="'+cmItem+'{className}"><span class="elfinder-button-icon {icon} elfinder-contextmenu-icon"{style}/><span>{label}</span></div>',
9250
+ item = function(label, icon, callback, opts) {
9251
+ var className = '',
9252
+ style = '',
9253
+ iconClass = '';
9254
+ if (opts) {
9255
+ if (opts.className) {
9256
+ className = ' ' + opts.className;
9257
+ }
9258
+ if (opts.iconClass) {
9259
+ iconClass = opts.iconClass;
9260
+ icon = '';
9261
+ }
9262
+ if (opts.iconImg) {
9263
+ style = ' style="background:url(\''+fm.escape(opts.iconImg)+'\') 0 0 no-repeat;background-size:contain;"';
9264
+ }
9265
+ }
9266
+ return $(tpl.replace('{icon}', icon ? 'elfinder-button-icon-'+icon : (iconClass? iconClass : ''))
9267
+ .replace('{label}', label)
9268
+ .replace('{style}', style)
9269
+ .replace('{className}', className))
9270
  .click(function(e) {
9271
  e.stopPropagation();
9272
  e.preventDefault();
9273
  callback();
9274
+ });
9275
+ },
9276
+ base, cwd,
9277
+ nodes, selected, subnodes, subselected, autoSyncStop,
9278
+
9279
+ autoToggle = function() {
9280
+ var evTouchStart = 'touchstart.contextmenuAutoToggle';
9281
+ menu.data('hideTm') && clearTimeout(menu.data('hideTm'));
9282
+ if (menu.is(':visible')) {
9283
+ menu.on('touchstart', function(e) {
9284
+ if (e.originalEvent.touches.length > 1) {
9285
+ return;
9286
+ }
9287
+ menu.stop().show();
9288
+ menu.data('hideTm') && clearTimeout(menu.data('hideTm'));
9289
  })
9290
+ .data('hideTm', setTimeout(function() {
9291
+ cwd.find('.elfinder-cwd-file').off(evTouchStart);
9292
+ cwd.find('.elfinder-cwd-file.ui-selected')
9293
+ .one(evTouchStart, function(e) {
9294
+ if (e.originalEvent.touches.length > 1) {
9295
+ return;
9296
+ }
9297
+ var tgt = $(e.target);
9298
+ if (menu.first().length && !tgt.is('input:checkbox') && !tgt.hasClass('elfinder-cwd-select')) {
9299
+ open(e.originalEvent.touches[0].pageX, e.originalEvent.touches[0].pageY);
9300
+ return false;
9301
+ }
9302
+ cwd.find('.elfinder-cwd-file').off(evTouchStart);
9303
+ })
9304
+ .one('unselect.'+fm.namespace, function() {
9305
+ cwd.find('.elfinder-cwd-file').off(evTouchStart);
9306
+ });
9307
+ menu.fadeOut({
9308
+ duration: 300,
9309
+ fail: function() {
9310
+ menu.css('opacity', '1').show();
9311
+ }
9312
+ });
9313
+ }, 4500));
9314
+ }
9315
+ },
9316
+
9317
+ keyEvts = function(e) {
9318
+ var code = e.keyCode,
9319
+ ESC = $.ui.keyCode.ESCAPE,
9320
+ ENT = $.ui.keyCode.ENTER,
9321
+ LEFT = $.ui.keyCode.LEFT,
9322
+ RIGHT = $.ui.keyCode.RIGHT,
9323
+ UP = $.ui.keyCode.UP,
9324
+ DOWN = $.ui.keyCode.DOWN,
9325
+ subent = fm.direction === 'ltr'? RIGHT : LEFT,
9326
+ sublev = subent === RIGHT? LEFT : RIGHT;
9327
+
9328
+ if ($.inArray(code, [ESC, ENT, LEFT, RIGHT, UP, DOWN]) !== -1) {
9329
+ e.preventDefault();
9330
+ e.stopPropagation();
9331
+ e.stopImmediatePropagation();
9332
+ if (code == ESC || code === sublev) {
9333
+ if (selected && subnodes && subselected) {
9334
+ subselected.trigger('mouseleave');
9335
+ selected.addClass('ui-state-hover');
9336
+ subnodes = null;
9337
+ subselected = null;
9338
+ } else {
9339
+ code == ESC && close();
9340
+ }
9341
+ } else if (code == UP || code == DOWN) {
9342
+ if (subnodes) {
9343
+ if (subselected) {
9344
+ subselected.trigger('mouseleave');
9345
+ }
9346
+ if (code == DOWN && (! subselected || subnodes.length <= ++subnodes._cur)) {
9347
+ subnodes._cur = 0;
9348
+ } else if (code == UP && (! subselected || --subnodes._cur < 0)) {
9349
+ subnodes._cur = subnodes.length - 1;
9350
+ }
9351
+ subselected = subnodes.eq(subnodes._cur).trigger('mouseenter');
9352
+ } else {
9353
+ subnodes = null;
9354
+ if (selected) {
9355
+ selected.trigger('mouseleave');
9356
+ }
9357
+ if (code == DOWN && (! selected || nodes.length <= ++nodes._cur)) {
9358
+ nodes._cur = 0;
9359
+ } else if (code == UP && (! selected || --nodes._cur < 0)) {
9360
+ nodes._cur = nodes.length - 1;
9361
+ }
9362
+ selected = nodes.eq(nodes._cur).addClass('ui-state-hover');
9363
+ }
9364
+ } else if (selected && (code == ENT || code === subent)) {
9365
+ if (selected.hasClass('elfinder-contextmenu-group')) {
9366
+ if (subselected) {
9367
+ code == ENT && subselected.click();
9368
+ } else {
9369
+ selected.trigger('mouseenter');
9370
+ subnodes = selected.find('div.'+smItem);
9371
+ subnodes._cur = 0;
9372
+ subselected = subnodes.first().addClass('ui-state-hover');
9373
+ }
9374
+ } else {
9375
+ code == ENT && selected.click();
9376
+ }
9377
+ }
9378
+ }
9379
  },
9380
 
9381
+ open = function(x, y, css) {
9382
+ var width = menu.outerWidth(),
 
9383
  height = menu.outerHeight(),
9384
+ bstyle = base.attr('style'),
9385
+ bpos = base.offset(),
9386
+ bwidth = base.width(),
9387
+ bheight = base.height(),
9388
+ mw = fm.UA.Mobile? 40 : 2,
9389
+ mh = fm.UA.Mobile? 20 : 2,
9390
+ x = x - (bpos? bpos.left : 0),
9391
+ y = y - (bpos? bpos.top : 0),
9392
+ css = $.extend(css || {}, {
9393
+ top : Math.max(0, y + mh + height < bheight ? y + mh : y - (y + height - bheight)),
9394
+ left : Math.max(0, (x < width + mw || x + mw + width < bwidth)? x + mw : x - mw - width),
9395
+ opacity : '1'
9396
+ }),
9397
+ evts;
9398
 
9399
+ autoSyncStop = true;
9400
+ fm.autoSync('stop');
9401
+ fm.toFront(menu);
9402
+ base.width(bwidth);
9403
+ menu.stop().removeAttr('style').css(css).show();
9404
+ base.attr('style', bstyle);
9405
 
 
9406
  css[subpos] = parseInt(menu.width());
9407
  menu.find('.elfinder-contextmenu-sub').css(css);
9408
+ if (fm.UA.iOS) {
9409
+ $('div.elfinder div.overflow-scrolling-touch').css('-webkit-overflow-scrolling', 'auto');
9410
+ }
9411
+
9412
+ selected = null;
9413
+ subnodes = null;
9414
+ subselected = null;
9415
+ $(document).on('keydown.' + fm.namespace, keyEvts);
9416
+ evts = $._data(document).events;
9417
+ if (evts && evts.keydown) {
9418
+ evts.keydown.unshift(evts.keydown.pop());
9419
+ }
9420
+
9421
+ fm.UA.Mobile && autoToggle();
9422
  },
9423
 
9424
  close = function() {
9425
+ $(document).off('keydown.' + fm.namespace, keyEvts);
9426
+ currentType = null;
9427
+
9428
+ if (menu.is(':visible') || menu.children().length) {
9429
+ menu.removeAttr('style').hide().empty().removeData('submenuKeep');
9430
+ try {
9431
+ if (! menu.draggable('instance')) {
9432
+ menu.draggable(dragOpt);
9433
+ }
9434
+ } catch(e) {
9435
+ if (! menu.hasClass('ui-draggable')) {
9436
+ menu.draggable(dragOpt);
9437
+ }
9438
+ }
9439
+ if (menu.data('prevNode')) {
9440
+ menu.data('prevNode').after(menu);
9441
+ menu.removeData('prevNode');
9442
+ }
9443
+ fm.trigger('closecontextmenu');
9444
+ if (fm.UA.iOS) {
9445
+ $('div.elfinder div.overflow-scrolling-touch').css('-webkit-overflow-scrolling', 'touch');
9446
+ }
9447
+ }
9448
+
9449
+ autoSyncStop && fm.searchStatus.state < 1 && ! fm.searchStatus.ininc && fm.autoSync();
9450
+ autoSyncStop = false;
9451
  },
9452
 
9453
  create = function(type, targets) {
9454
+ var sep = false,
9455
+ insSep = false,
9456
+ cmdMap = {}, disabled = [], isCwd = (targets[0].indexOf(fm.cwd().volumeid, 0) === 0),
9457
+ selcnt = 0;
9458
+
9459
+ currentType = type;
9460
+ if (menu.data('cmdMaps')) {
9461
+ $.each(menu.data('cmdMaps'), function(i, v){
9462
  if (targets[0].indexOf(i, 0) == 0) {
9463
  cmdMap = v;
9464
  return false;
9466
  });
9467
  }
9468
  if (!isCwd) {
9469
+ disabled = fm.option('disabled', targets[0]);
9470
+ if (! disabled) {
9471
+ disabled = [];
 
 
 
 
9472
  }
9473
  }
9474
+ if (type === 'navbar') {
9475
+ fm.select({selected: targets, origin: 'navbar'});
9476
+ }
9477
+
9478
+ selcnt = fm.selected().length;
9479
+ if (selcnt > 1) {
9480
+ menu.append('<div class="ui-corner-top ui-widget-header elfinder-contextmenu-header"><span>'
9481
+ + fm.i18n('selectedItems', ''+selcnt)
9482
+ + '</span></div>');
9483
+ }
9484
 
9485
+ nodes = $();
9486
  $.each(types[type]||[], function(i, name) {
9487
+ var cmd, node, submenu, hover;
9488
 
9489
+ if (name === '|') {
9490
+ if (sep) {
9491
+ insSep = true;
9492
+ }
9493
  return;
9494
  }
9495
 
9496
  if (cmdMap[name]) {
9497
  name = cmdMap[name];
9498
  }
9499
+ cmd = fm.getCommand(name);
9500
 
9501
+ if (cmd && !isCwd && (!fm.searchStatus.state || !cmd.disableOnSearch)) {
9502
+ cmd.__disabled = cmd._disabled;
9503
  cmd._disabled = !(cmd.alwaysEnabled || (fm._commands[name] ? $.inArray(name, disabled) === -1 : false));
9504
+ $.each(cmd.linkedCmds, function(i, n) {
9505
+ var c;
9506
+ if (c = fm.getCommand(n)) {
9507
+ c.__disabled = c._disabled;
9508
+ c._disabled = !(c.alwaysEnabled || (fm._commands[n] ? $.inArray(n, disabled) === -1 : false));
9509
+ }
9510
+ });
9511
  }
9512
 
9513
  if (cmd && cmd.getstate(targets) != -1) {
 
9514
  if (cmd.variants) {
9515
  if (!cmd.variants.length) {
9516
  return;
9517
  }
9518
+ node = item(cmd.title, cmd.className? cmd.className : cmd.name, function(){});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9519
 
9520
+ submenu = $('<div class="ui-front ui-corner-all elfinder-contextmenu-sub"/>')
9521
+ .hide()
9522
  .appendTo(node.append('<span class="elfinder-contextmenu-arrow"/>'));
9523
 
9524
+ hover = function(show){
9525
+ if (! show) {
9526
+ submenu.hide();
9527
+ } else {
9528
+ var bstyle = base.attr('style');
9529
+ base.width(base.width());
9530
+ submenu.css({ left: 'auto', right: 'auto' });
9531
+ var nodeOffset = node.offset(),
9532
+ nodeleft = nodeOffset.left,
9533
+ nodetop = nodeOffset.top,
9534
+ nodewidth = node.outerWidth(),
9535
+ width = submenu.outerWidth(true),
9536
+ height = submenu.outerHeight(true),
9537
+ baseOffset = base.offset(),
9538
+ wwidth = baseOffset.left + base.width(),
9539
+ wheight = baseOffset.top + base.height(),
9540
+ x, y, over;
9541
+
9542
+ over = (nodeleft + nodewidth + width) - wwidth;
9543
+ x = (nodeleft > width && over > 0)? (fm.UA.Mobile? 10 - width : nodewidth - over) : nodewidth;
9544
+ if (subpos === 'right' && nodeleft < width) {
9545
+ x = fm.UA.Mobile? 30 - nodewidth : nodewidth - (width - nodeleft);
9546
+ }
9547
+ over = (nodetop + 5 + height) - wheight;
9548
+ y = (over > 0 && nodetop < wheight)? 5 - over : (over > 0? 30 - height : 5);
9549
+
9550
+ menu.find('.elfinder-contextmenu-sub:visible').hide().parent().removeClass('ui-state-hover');
9551
+ submenu.css({ top : y }).css(subpos, x).show();
9552
+ base.attr('style', bstyle);
9553
+ }
9554
  };
9555
 
9556
+ node.addClass('elfinder-contextmenu-group')
9557
+ .on('touchstart', '.elfinder-contextmenu-sub', function(e) {
9558
+ node.data('touching', true);
9559
+ })
9560
+ .on('mouseleave', '.elfinder-contextmenu-sub', function(e) {
9561
+ if (! menu.data('draged')) {
9562
+ menu.removeData('submenuKeep');
9563
+ }
9564
+ })
9565
+ .on('click', '.'+smItem, function(e){
9566
+ var opts;
9567
+ e.stopPropagation();
9568
+ if (! menu.data('draged')) {
9569
+ menu.hide();
9570
+ opts = $(this).data('exec');
9571
+ if ($.isPlainObject(opts)) {
9572
+ opts._currentType = type;
9573
+ }
9574
+ close();
9575
+ cmd.exec(targets, opts);
9576
+ }
9577
+ })
9578
+ .on('touchend', function(e) {
9579
+ menu.data('submenuKeep', true);
9580
+ })
9581
+ .on('mouseenter mouseleave', function(e){
9582
+ if (e.type === 'mouseleave') {
9583
+ if (! menu.data('submenuKeep')) {
9584
+ node.data('timer', setTimeout(function() {
9585
+ node.removeData('timer');
9586
+ hover(false);
9587
+ }, 250));
9588
+ }
9589
+ } else {
9590
+ if (node.data('timer')) {
9591
+ clearTimeout(node.data('timer'));
9592
+ node.removeData('timer');
9593
+ }
9594
+ if (! node.data('touching')) {
9595
+ hover(true);
9596
+ }
9597
+ }
9598
+ node.removeData('touching');
9599
+ });
9600
 
9601
  $.each(cmd.variants, function(i, variant) {
9602
  submenu.append(
9603
+ variant === '|' ? '<div class="elfinder-contextmenu-separator"/>' :
9604
+ $('<div class="'+cmItem+' '+smItem+'"><span>'+variant[1]+'</span></div>').data('exec', variant[0])
9605
  );
9606
  });
9607
 
9608
  } else {
9609
+ node = item(cmd.title, cmd.className? cmd.className : cmd.name, function() {
9610
+ if (! menu.data('draged')) {
9611
+ close();
9612
+ cmd.exec(targets, {_currentType: type});
9613
+ }
9614
  });
9615
  if (cmd.extra && cmd.extra.node) {
9616
+ $('<span class="elfinder-button-icon elfinder-button-icon-'+(cmd.extra.icon || '')+' elfinder-contextmenu-extra-icon"/>')
9617
+ .append(cmd.extra.node).appendTo(node);
9618
+ $(cmd.extra.node).trigger('ready');
 
9619
  } else {
9620
  node.remove('.elfinder-contextmenu-extra-icon');
9621
  }
9622
  }
9623
 
9624
+ if (cmd.extendsCmd) {
9625
+ node.children('span.elfinder-button-icon').addClass('elfinder-button-icon-' + cmd.extendsCmd);
9626
+ }
9627
+
9628
+ if (insSep) {
9629
+ menu.append('<div class="elfinder-contextmenu-separator"/>');
9630
+ }
9631
+ menu.append(node);
9632
  sep = true;
9633
+ insSep = false;
9634
  }
9635
 
9636
+ if (cmd && typeof cmd.__disabled !== 'undefined') {
9637
+ cmd._disabled = cmd.__disabled;
9638
+ delete cmd.__disabled;
9639
+ $.each(cmd.linkedCmds, function(i, n) {
9640
+ var c;
9641
+ if (c = fm.getCommand(n)) {
9642
+ c._disabled = c.__disabled;
9643
+ delete c.__disabled;
9644
+ }
9645
+ });
9646
+ }
9647
  });
9648
+ nodes = menu.children('div.'+cmItem);
9649
  },
9650
 
9651
  createFromRaw = function(raw) {
9652
+ currentType = 'raw';
9653
  $.each(raw, function(i, data) {
9654
  var node;
9655
 
9657
  menu.append('<div class="elfinder-contextmenu-separator"/>');
9658
  } else if (data.label && typeof data.callback == 'function') {
9659
  node = item(data.label, data.icon, function() {
9660
+ if (! menu.data('draged')) {
9661
+ !data.remain && close();
9662
+ data.callback();
9663
+ }
9664
+ }, data.options || null);
9665
  menu.append(node);
9666
  }
9667
  });
9668
+ nodes = menu.children('div.'+cmItem);
9669
+ },
9670
+
9671
+ currentType = null;
9672
 
9673
  fm.one('load', function() {
9674
+ base = fm.getUI();
9675
+ cwd = fm.getUI('cwd');
9676
  fm.bind('contextmenu', function(e) {
9677
+ var data = e.data,
9678
+ css = {},
9679
+ prevNode;
9680
 
9681
+ if (!data.type || data.type !== 'files') {
9682
+ cwd.trigger('unselectall');
9683
+ }
9684
  close();
9685
 
9686
  if (data.type && data.targets) {
9689
  createFromRaw(data.raw);
9690
  }
9691
 
9692
+ if (menu.children().length) {
9693
+ prevNode = data.prevNode || null;
9694
+ if (prevNode) {
9695
+ menu.data('prevNode', menu.prev());
9696
+ prevNode.after(menu);
9697
+ }
9698
+ if (data.fitHeight) {
9699
+ css = {maxHeight: Math.min(fm.getUI().height(), $(window).height()), overflowY: 'auto'};
9700
+ menu.draggable('destroy').removeClass('ui-draggable');
9701
+ }
9702
+ open(data.x, data.y, css);
9703
+ }
9704
  })
9705
  .one('destroy', function() { menu.remove(); })
9706
+ .bind('disable', close)
9707
+ .bind('select', function(){
9708
+ (currentType === 'files') && close();
 
9709
  })
9710
  .getUI().click(close);
9711
+ })
9712
+ .shortcut({
9713
+ pattern : fm.OS === 'mac' ? 'ctrl+m' : 'contextmenu shift+f10',
9714
+ description : 'contextmenu',
9715
+ callback : function(e) {
9716
+ e.stopPropagation();
9717
+ e.preventDefault();
9718
+ $(document).one('contextmenu.' + fm.namespace, function(e) {
9719
+ e.preventDefault();
9720
+ e.stopPropagation();
9721
+ });
9722
+ var sel = fm.selected(),
9723
+ type, targets, pos, elm;
9724
+
9725
+ if (sel.length) {
9726
+ type = 'files';
9727
+ targets = sel;
9728
+ elm = $('#'+fm.cwdHash2Id(sel[0]));
9729
+ } else {
9730
+ type = 'cwd';
9731
+ targets = [ fm.cwd().hash ];
9732
+ pos = fm.getUI('workzone').offset();
9733
+ }
9734
+ if (! elm || ! elm.length) {
9735
+ elm = fm.getUI('workzone');
9736
+ }
9737
+ pos = elm.offset();
9738
+ pos.top += (elm.height() / 2);
9739
+ pos.left += (elm.width() / 2);
9740
+ fm.trigger('contextmenu', {
9741
+ 'type' : type,
9742
+ 'targets' : targets,
9743
+ 'x' : pos.left,
9744
+ 'y' : pos.top
9745
+ });
9746
+ }
9747
  });
9748
 
9749
  });
9750
 
9751
+ };
9752
 
9753
 
9754
  /*
9875
  */
9876
  query = '',
9877
 
9878
+ /**
9879
+ * Currect clipboard(cut) hashes as object key
9880
+ *
9881
+ * @type Object
9882
+ */
9883
+ clipCuts = {},
9884
 
9885
  /**
9886
  * Parents hashes of cwd
9888
  * @type Array
9889
  */
9890
  cwdParents = [],
9891
+
9892
+ /**
9893
+ * cwd current hashes
9894
+ *
9895
+ * @type Array
9896
+ */
9897
+ cwdHashes = [],
9898
+
9899
+ /**
9900
+ * incsearch current hashes
9901
+ *
9902
+ * @type Array
9903
+ */
9904
+ incHashes = void 0,
9905
 
9906
+ /**
9907
+ * Custom columns name and order
9908
+ *
9909
+ * @type Array
9910
+ */
9911
+ customCols = [],
9912
+
9913
+ /**
9914
+ * Custom columns builder
9915
+ *
9916
+ * @type Function
9917
+ */
9918
  customColsBuild = function() {
9919
+ var cols = '';
9920
+ for (var i = 0; i < customCols.length; i++) {
9921
+ cols += '<td class="elfinder-col-'+customCols[i]+'">{' + customCols[i] + '}</td>';
 
9922
  }
9923
+ return cols;
9924
  },
9925
 
9926
+ /**
9927
+ * Make template.row from customCols
9928
+ *
9929
+ * @type Function
9930
+ */
9931
+ makeTemplateRow = function() {
9932
+ return '<tr id="{id}" class="'+clFile+' {permsclass} {dirclass}" title="{tooltip}"{css}><td class="elfinder-col-name"><div class="elfinder-cwd-file-wrapper"><span class="elfinder-cwd-icon {mime}"{style}/>{marker}<span class="elfinder-cwd-filename">{name}</span></div>'+selectCheckbox+'</td>'+customColsBuild()+'</tr>';
9933
+ },
9934
+
9935
+ selectCheckbox = ($.map(options.showSelectCheckboxUA, function(t) {return (fm.UA[t] || t.match(/^all$/i))? true : null;}).length)? '<div class="elfinder-cwd-select"><input type="checkbox"></div>' : '',
9936
+
9937
+ colResizing = false,
9938
+
9939
+ colWidth = null,
9940
+
9941
  /**
9942
  * File templates
9943
  *
9944
  * @type Object
9945
  **/
9946
  templates = {
9947
+ icon : '<div id="{id}" class="'+clFile+' {permsclass} {dirclass} ui-corner-all" title="{tooltip}"><div class="elfinder-cwd-file-wrapper ui-corner-all"><div class="elfinder-cwd-icon {mime} ui-corner-all" unselectable="on"{style}/>{marker}</div><div class="elfinder-cwd-filename" title="{nametitle}">{name}</div>'+selectCheckbox+'</div>',
9948
+ row : '',
9949
  },
9950
 
9951
  permsTpl = fm.res('tpl', 'perms'),
9964
  return fm.cwdHash2Id(f.hash);
9965
  },
9966
  name : function(f) {
9967
+ var name = fm.escape(f.i18 || f.name);
9968
  !list && (name = name.replace(/([_.])/g, '&#8203;$1'));
9969
  return name;
9970
  },
9971
  nametitle : function(f) {
9972
+ return fm.escape(f.i18 || f.name);
9973
  },
9974
  permsclass : function(f) {
9975
  return fm.perms2class(f);
9978
  return fm.formatPermissions(f);
9979
  },
9980
  dirclass : function(f) {
9981
+ var cName = f.mime == 'directory' ? 'directory' : '';
9982
+ f.isroot && (cName += ' isroot');
9983
+ f.csscls && (cName += ' ' + fm.escape(f.csscls));
9984
+ options.getClass && (cName += ' ' + options.getClass(f));
9985
+ return cName;
9986
+ },
9987
+ style : function(f) {
9988
+ return f.icon? 'style="background:url(\''+fm.escape(f.icon)+'\') 0 0 no-repeat;background-size:contain;"' : '';
9989
  },
9990
  mime : function(f) {
9991
  return fm.mime2class(f.mime);
9992
  },
9993
  size : function(f) {
9994
+ return (f.mime === 'directory' && !f.size)? '-' : fm.formatSize(f.size);
9995
  },
9996
  date : function(f) {
9997
  return fm.formatDate(f);
10022
  } else {
10023
  info = f.tooltip? fm.escape(f.tooltip).replace(/\r/g, '&#13;') : '';
10024
  }
10025
+ if (list) {
10026
+ info += (info? '&#13;' : '') + fm.escape(f.i18 || f.name);
10027
+ }
10028
  return info? info + '&#13;' + title : title;
10029
  }
10030
  },
10037
  **/
10038
  itemhtml = function(f) {
10039
  return templates[list ? 'row' : 'icon']
10040
+ .replace(/\{([a-z0-9_]+)\}/g, function(s, e) {
10041
+ return replacement[e] ? replacement[e](f, fm) : (f[e] ? f[e] : '');
10042
  });
10043
  },
10044
 
10045
+ /**
10046
+ * jQueery node that will be selected next
10047
+ *
10048
+ * @type Object jQuery node
10049
+ */
10050
+ selectedNext = $(),
10051
+
10052
  /**
10053
  * Flag. Required for msie to avoid unselect files on dragstart
10054
  *
10118
  }
10119
  // !append && unselectAll();
10120
  } else {
10121
+ if (selectedNext.length) {
10122
+ n = prev? selectedNext.prev() : selectedNext;
10123
+ } else {
10124
+ // there are no selected file - select first/last one
10125
+ n = cwd.find('[id]:not(.'+clDisabled+'):not(.elfinder-cwd-parent):'+(prev ? 'last' : 'first'));
10126
+ }
10127
  }
10128
 
10129
  if (n && n.length && !n.hasClass('elfinder-cwd-parent')) {
10130
+ if (s && append) {
10131
  // append new files to selected
10132
  n = s.add(s[prev ? 'prevUntil' : 'nextUntil']('#'+n.attr('id'))).add(n);
10133
  } else {
10152
  selectAll = function() {
10153
  var phash = fm.cwd().hash;
10154
 
10155
+ selectCheckbox && selectAllCheckbox.find('input').prop('checked', true);
10156
+ fm.lazy(function() {
10157
+ var files;
10158
+ cwd.find('[id]:not(.'+clSelected+'):not(.elfinder-cwd-parent)').trigger(evtSelect);
10159
+ if (fm.maxTargets && (incHashes || cwdHashes).length > fm.maxTargets) {
10160
+ files = $.map(incHashes || cwdHashes, function(hash) { return fm.file(hash) || null });
10161
+ files = fm.sortFiles(files);
10162
+ selectedFiles = $.map(files, function(f) { return f.hash; });
10163
+ } else {
10164
+ selectedFiles = (incHashes || cwdHashes).concat();
10165
+ }
10166
+ trigger();
10167
+ selectCheckbox && selectAllCheckbox.data('pending', false);
10168
+ }, 0, {repaint: true});
10169
  },
10170
 
10171
  /**
10174
  * @return void
10175
  */
10176
  unselectAll = function() {
10177
+ selectCheckbox && selectAllCheckbox.find('input').prop('checked', false);
10178
+ if (selectedFiles.length) {
10179
+ selectLock = false;
10180
+ selectedFiles = [];
10181
+ cwd.find('[id].'+clSelected).trigger(evtUnselect);
10182
+ selectCheckbox && cwd.find('input:checkbox').prop('checked', false);
10183
+ } else {
10184
+ fm.select({selected: []});
10185
+ }
10186
  trigger();
10187
+ selectCheckbox && selectAllCheckbox.data('pending', false);
10188
+ cwd.removeClass('elfinder-cwd-allselected');
10189
  },
10190
 
10191
  /**
10197
  return selectedFiles;
10198
  },
10199
 
10200
+ /**
10201
+ * Last selected node id
10202
+ *
10203
+ * @type String|Void
10204
+ */
10205
+ lastSelect = void 0,
10206
+
10207
  /**
10208
  * Fire elfinder "select" event and pass selected files to it
10209
  *
10210
  * @return void
10211
  */
10212
  trigger = function() {
10213
+ if (selectCheckbox) {
10214
+ var all = (selectedFiles.length === cwdHashes.length);
10215
+ selectAllCheckbox.find('input').prop('checked', all);
10216
+ cwd[all? 'addClass' : 'removeClass']('elfinder-cwd-allselected');
10217
+ }
10218
  fm.trigger('select', {selected : selectedFiles});
10219
  },
10220
 
10224
  * @param DOMElement file/dir node
10225
  * @return void
10226
  */
10227
+ scrollToView = function(o, blink) {
10228
  var ftop = o.position().top,
10229
  fheight = o.outerHeight(true),
10230
  wtop = wrapper.scrollTop(),
10231
+ wheight = wrapper.get(0).clientHeight,
10232
+ thheight = tableHeader? tableHeader.outerHeight(true) : 0;
10233
 
10234
+ if (ftop + thheight + fheight > wtop + wheight) {
10235
+ wrapper.scrollTop(parseInt(ftop + thheight + fheight - wheight));
10236
  } else if (ftop < wtop) {
10237
  wrapper.scrollTop(ftop);
10238
  }
10239
+ list && wrapper.scrollLeft(0);
10240
+ !!blink && fm.resources.blink(o, 'lookme');
10241
  },
10242
 
10243
  /**
10247
  **/
10248
  buffer = [],
10249
 
10250
+ /**
10251
+ * Extra data of buffer
10252
+ *
10253
+ * @type Object
10254
+ **/
10255
+ bufferExt = {},
10256
+
10257
  /**
10258
  * Return index of elements with required hash in buffer
10259
  *
10276
  *
10277
  * @type String
10278
  **/
10279
+ scrollEvent = 'elfscrstop',
10280
 
10281
  /**
10282
  * jQuery UI selectable option
10287
  filter : fileSelector,
10288
  stop : trigger,
10289
  delay : 250,
10290
+ appendTo : 'body',
10291
+ autoRefresh: false,
10292
  selected : function(e, ui) { $(ui.selected).trigger(evtSelect); },
10293
  unselected : function(e, ui) { $(ui.unselected).trigger(evtUnselect); }
10294
  },
10295
 
10296
+ /**
10297
+ * display parent folder with ".." name
10298
+ *
10299
+ * @param String phash
10300
+ * @return void
10301
+ */
10302
+ oldSchool = function(phash) {
10303
+ var phash = fm.cwd().phash,
10304
+ pdir = fm.file(phash) || null,
10305
+ set = function(pdir) {
10306
+ if (pdir) {
10307
+ parent = $(itemhtml($.extend(true, {}, pdir, {name : '..', mime : 'directory'})))
10308
+ .addClass('elfinder-cwd-parent')
10309
+ .bind('mousedown click mouseup touchstart touchmove touchend dblclick mouseenter', function(e) {
10310
+ e.preventDefault();
10311
+ e.stopPropagation();
10312
+ })
10313
+ .dblclick(function() {
10314
+ fm.exec('open', fm.cwdId2Hash(this.id));
10315
+ }
10316
+ );
10317
+ (list ? cwd.find('tbody') : cwd).prepend(parent);
10318
+ }
10319
+ };
10320
+ if (pdir) {
10321
+ set(pdir);
10322
+ } else {
10323
+ if (fm.getUI('tree').hasClass('elfinder-tree')) {
10324
+ fm.one('parents', function() {
10325
+ set(fm.file(phash) || null);
10326
+ });
10327
+ } else {
10328
+ fm.request({
10329
+ data : {cmd : 'parents', target : fm.cwd().hash},
10330
+ preventFail : true
10331
+ })
10332
+ .done(function(data) {
10333
+ set(fm.file(phash) || null);
10334
+ });
10335
+ }
10336
+ }
10337
+ },
10338
+
10339
+ showFiles = fm.options.showFiles,
10340
+
10341
  /**
10342
  * Cwd scroll event handler.
10343
  * Lazy load - append to cwd not shown files
10345
  * @return void
10346
  */
10347
  render = function() {
10348
+ var place = (list ? cwd.children('table').children('tbody') : cwd),
10349
+ chk,
10350
+ phash,
10351
+ proc = false,
10352
+ // created document fragment for jQuery >= 1.12, 2.2, 3.0
10353
+ // see Studio-42/elFinder#1544 @ github
10354
+ docFlag = $.htmlPrefilter? true : false,
10355
+ tempDom = docFlag? $(document.createDocumentFragment()) : $('<div/>'),
10356
+ go = function(over){
10357
+ var over = over || null,
10358
+ html = [],
10359
+ dirs = false,
10360
+ atmb = {},
10361
+ stmb = (fm.option('tmbUrl') === 'self'),
10362
+ files, locks, selected;
10363
+
10364
+ files = buffer.splice(0, showFiles + (over || 0) / (bufferExt.hpi || 1));
10365
+ bufferExt.renderd += files.length;
10366
+ if (! buffer.length) {
10367
+ bottomMarker.hide();
10368
+ wrapper.off(scrollEvent, render);
10369
+ }
10370
+
10371
+ locks = [];
 
 
 
 
 
 
 
10372
  html = $.map(files, function(f) {
10373
  if (f.hash && f.name) {
10374
  if (f.mime == 'directory') {
10375
  dirs = true;
10376
  }
10377
+ if (f.tmb || (stmb && f.mime.indexOf('image/') === 0)) {
10378
+ atmb[f.hash] = f.tmb;
10379
+ }
10380
+ clipCuts[f.hash] && locks.push(f.hash);
10381
  return itemhtml(f);
10382
  }
10383
  return null;
10384
  });
10385
 
10386
+ // html into temp node
10387
+ tempDom.empty().append(html.join(''));
10388
+
10389
+ // make directory droppable
10390
+ dirs && !mobile && makeDroppable(tempDom);
10391
+
10392
+ // check selected items
10393
+ selected = [];
10394
+ if (selectedFiles.length) {
10395
+ tempDom.find('[id]:not(.'+clSelected+'):not(.elfinder-cwd-parent)').each(function() {
10396
+ $.inArray(fm.cwdId2Hash(this.id), selectedFiles) !== -1 && selected.push($(this));
10397
+ });
10398
+ }
10399
+
10400
+ // append to cwd
10401
+ place.append(docFlag? tempDom : tempDom.children());
10402
+
10403
+ // trigger select
10404
+ if (selected.length) {
10405
+ $.each(selected, function(i, n) { n.trigger(evtSelect); });
10406
+ trigger();
10407
+ }
10408
+
10409
+ locks.length && fm.trigger('lockfiles', {files: locks});
10410
+ !bufferExt.hpi && bottomMarkerShow(place, files.length);
10411
+
10412
+ if (list) {
10413
+ // show thead
10414
+ cwd.find('thead').show();
10415
+ // fixed table header
10416
+ fixTableHeader({fitWidth: ! colWidth});
10417
+ }
10418
+
10419
+ if (Object.keys(atmb).length) {
10420
+ if (Object.keys(bufferExt.attachTmbs).length < 1) {
10421
+ wrapper.off(scrollEvent, attachThumbnails).on(scrollEvent, attachThumbnails);
10422
+ fm.unbind('resize', attachThumbnails).bind('resize', attachThumbnails);
10423
+ }
10424
+ $.extend(bufferExt.attachTmbs, atmb);
10425
+ attachThumbnails(atmb);
10426
+ }
10427
+
10428
+ wrapper.trigger(scrollEvent);
10429
+ };
10430
+
10431
+ if (! bufferExt.renderd) {
10432
+ // first time to go()
10433
+ proc = true;
10434
+ // scroll top on dir load to avoid scroll after page reload
10435
+ wrapper.scrollTop(0);
10436
+ phash = fm.cwd().phash;
10437
+ go();
10438
+ if (options.oldSchool && phash && !query) {
10439
+ oldSchool(phash);
10440
+ }
10441
+ if (list) {
10442
+ colWidth && setColwidth();
10443
+ fixTableHeader({fitWidth: true});
10444
+ }
10445
+ bufferExt.itemH = (list? place.find('tr:first') : place.find('[id]:first')).outerHeight(true);
10446
+ fm.trigger('cwdrender');
10447
+ proc = false;
10448
+ } else if (! proc) {
10449
+ // next go()
10450
+ if ((chk = (wrapper.height() + wrapper.scrollTop() + fm.options.showThreshold + bufferExt.row) - (bufferExt.renderd * bufferExt.hpi)) > 0) {
10451
+ proc = true;
10452
+ fm.lazy(function() {
10453
+ go(chk);
10454
+ proc = false;
10455
+ });
10456
+ }
10457
+ }
10458
+ },
10459
+
10460
+ // fixed table header jQuery object
10461
+ tableHeader = null,
10462
+
10463
+ // To fixed table header colmun
10464
+ fixTableHeader = function(opts) {
10465
+ if (! options.listView.fixedHeader) {
10466
+ return;
10467
+ }
10468
+ var setPos = function() {
10469
+ var val, pos;
10470
+
10471
+ if (fm.direction === 'ltr') {
10472
+ val = wrapper.scrollLeft() * -1;
10473
+ pos = 'left';
10474
+ } else {
10475
+ val = wrapper.scrollLeft();
10476
+ pos = 'right';
10477
+ }
10478
+ if (base.css(pos) !== val) {
10479
+ base.css(pos, val);
10480
+ }
10481
+ },
10482
+ opts = opts || {},
10483
+ cnt, base, table, thead, tbody, hheight, htr, btr, htd, btd, htw, btw, init;
10484
+
10485
+ tbody = cwd.find('tbody');
10486
+ btr = tbody.children('tr:first');
10487
+ if (btr.length) {
10488
+ table = tbody.parent();
10489
+ if (! tableHeader) {
10490
+ init = true;
10491
+ tbody.addClass('elfinder-cwd-fixheader');
10492
+ thead = cwd.find('thead').attr('id', fm.namespace+'-cwd-thead');
10493
+ htr = thead.children('tr:first');
10494
+ hheight = htr.outerHeight(true);
10495
+ cwd.css('margin-top', hheight - parseInt(table.css('padding-top')));
10496
+ base = $('<div/>').addClass(cwd.attr('class')).append($('<table/>').append(thead));
10497
+ tableHeader = $('<div/>').addClass(wrapper.attr('class') + ' elfinder-cwd-fixheader')
10498
+ .removeClass('ui-droppable native-droppable')
10499
+ .css(wrapper.position())
10500
+ .css('height', hheight)
10501
+ .append(base);
10502
+ if (fm.direction === 'rtl') {
10503
+ tableHeader.css('right', (fm.getUI().width() - wrapper.width()) + 'px');
10504
+ }
10505
+ setPos();
10506
+ wrapper.after(tableHeader)
10507
+ .on('scroll.fixheader resize.fixheader', function(e) {
10508
+ setPos();
10509
+ if (e.type === 'resize') {
10510
+ e.stopPropagation();
10511
+ fixTableHeader();
10512
+ }
10513
+ });
10514
+ } else {
10515
+ thead = $('#'+fm.namespace+'-cwd-thead');
10516
+ htr = thead.children('tr:first');
10517
+ }
10518
+
10519
+ if (init || opts.fitWidth || Math.abs(btr.outerWidth() - htr.outerWidth()) > 2) {
10520
+ cnt = customCols.length + 1;
10521
+ for (var i = 0; i < cnt; i++) {
10522
+ htd = htr.children('td:eq('+i+')');
10523
+ btd = btr.children('td:eq('+i+')');
10524
+ htw = htd.width();
10525
+ btw = btd.width();
10526
+ if (typeof htd.data('delta') === 'undefined') {
10527
+ htd.data('delta', (htd.outerWidth() - htw) - (btd.outerWidth() - btw));
10528
+ }
10529
+ btw -= htd.data('delta');
10530
+ if (! init && ! opts.fitWidth && htw === btw) {
10531
+ break;
10532
+ }
10533
+ htd.css('width', btw + 'px');
10534
+ }
10535
+ }
10536
+
10537
+ tableHeader.data('widthTimer') && clearTimeout(tableHeader.data('widthTimer'));
10538
+ tableHeader.data('widthTimer', setTimeout(function() {
10539
+ if (tableHeader) {
10540
+ if (fm.direction === 'rtl') {
10541
+ tableHeader.css('right', (fm.getUI().width() - wrapper.width()) + 'px');
10542
+ }
10543
+ tableHeader.css(wrapper.position()).css('width', cwd.outerWidth() + 'px');
10544
+ }
10545
+ }, 10));
10546
+ }
10547
+ },
10548
+
10549
+ // Set colmun width
10550
+ setColwidth = function() {
10551
+ if (list && colWidth) {
10552
+ var cl = 'elfinder-cwd-colwidth',
10553
+ first = cwd.find('tr[id]:first'),
10554
+ former;
10555
+ if (! first.hasClass(cl)) {
10556
+ former = cwd.find('tr.'+cl);
10557
+ former.removeClass(cl).find('td').css('width', '');
10558
+ first.addClass(cl);
10559
+ cwd.find('table:first').css('table-layout', 'fixed');
10560
+ $.each($.merge(['name'], customCols), function(i, k) {
10561
+ var w = colWidth[k] || first.find('td.elfinder-col-'+k).width();
10562
+ first.find('td.elfinder-col-'+k).width(w);
10563
+ });
10564
+ }
10565
+ }
10566
+ },
10567
+
10568
+ /**
10569
+ * Droppable options for cwd.
10570
+ * Drop target is `wrapper`
10571
  * Do not add class on childs file over
10572
  *
10573
  * @type Object
10581
  e.stopPropagation();
10582
  helper.data('dropover', helper.data('dropover') + 1);
10583
  dst.data('dropover', true);
10584
+ if (helper.data('namespace') !== fm.namespace || ! fm.insideWorkzone(e.pageX, e.pageY)) {
10585
  dst.removeClass(clDropActive);
10586
+ helper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus');
10587
+ return;
10588
  }
10589
  if (dst.hasClass(fm.res(c, 'cwdfile'))) {
10590
  hash = fm.cwdId2Hash(dst.attr('id'));
10625
  deactivate : function() {
10626
  $(this).removeData('dropover')
10627
  .removeClass(clDropActive);
10628
+ },
10629
+ drop : function(e, ui) {
10630
+ unselectAll();
10631
+ fm.droppable.drop.call(this, e, ui);
10632
  }
10633
  }),
10634
 
10637
  *
10638
  * @return void
10639
  */
10640
+ makeDroppable = function(place) {
10641
+ place = place? place : (list ? cwd.find('tbody') : cwd);
10642
+ var targets = place.children('.directory:not(.'+clDroppable+',.elfinder-na,.elfinder-ro)');
10643
+
10644
  if (fm.isCommandEnabled('paste')) {
10645
  targets.droppable(droppable);
10646
  }
10647
  if (fm.isCommandEnabled('upload')) {
10648
  targets.addClass('native-droppable');
10649
  }
10650
+
10651
+ place.children('.isroot').each(function(i, n) {
10652
+ var $n = $(n),
10653
+ hash = fm.cwdId2Hash(n.id);
10654
+
10655
+ if (fm.isCommandEnabled('paste', hash)) {
10656
+ if (! $n.hasClass(clDroppable+',elfinder-na,elfinder-ro')) {
10657
+ $n.droppable(droppable);
10658
+ }
10659
+ } else {
10660
+ if ($n.hasClass(clDroppable)) {
10661
+ $n.droppable('destroy');
10662
+ }
10663
+ }
10664
+ if (fm.isCommandEnabled('upload', hash)) {
10665
+ if (! $n.hasClass('native-droppable,elfinder-na,elfinder-ro')) {
10666
+ $n.addClass('native-droppable');
10667
+ }
10668
+ } else {
10669
+ if ($n.hasClass('native-droppable')) {
10670
+ $n.removeClass('native-droppable');
10671
+ }
10672
+ }
10673
+ });
10674
  },
10675
 
10676
  /**
10679
  * required for old api to stop loading thumbnails.
10680
  *
10681
  * @param Object file hash -> thumbnail map
10682
+ * @param Bool reload
10683
+ * @return void
10684
  */
10685
+ attachThumbnails = function(image, reload) {
10686
+ var url = fm.option('tmbUrl'),
10687
+ done = [],
10688
+ attach = function(node, tmb) {
10689
+ $('<img/>')
10690
+ .on('load', function() {
10691
+ node.find('.elfinder-cwd-icon').addClass(tmb.className).css('background-image', "url('"+tmb.url+"')");
10692
+ })
10693
+ .attr('src', tmb.url);
10694
+ },
10695
+ chk = function(hash, tmb) {
10696
+ var node = $('#'+fm.cwdHash2Id(hash)),
10697
+ file, tmbObj, reloads = [];
10698
+
10699
+ if (node.length) {
10700
+ if (fm.isInWindow(node, true)) {
10701
+ if (tmb != '1') {
10702
+ file = fm.file(hash);
10703
+ if (file.tmb !== tmb) {
10704
+ file.tmb = tmb;
10705
+ }
10706
+ tmbObj = fm.tmb(file);
10707
+ if (reload) {
10708
+ fm.reloadContents(tmbObj.url).done(function() {
10709
+ node.find('.elfinder-cwd-icon').addClass(tmbObj.className).css('background-image', "url('"+tmbObj.url+"')");
10710
+ });
10711
+ } else {
10712
+ attach(node, tmbObj);
10713
+ }
10714
+ } else {
10715
+ if (reload) {
10716
+ reloads.push(hash);
10717
+ } else {
10718
+ bufferExt.getTmbs.push(hash);
10719
+ }
10720
+ }
10721
+ done.push(hash);
10722
+ }
10723
  }
10724
+
10725
+ $.each(done, function(i, h) {
10726
+ delete bufferExt.attachTmbs[h];
10727
+ });
10728
+ if (reload) {
10729
+ loadThumbnails(reloads);
10730
+ } else if (bufferExt.getTmbs.length) {
10731
+ loadThumbnails();
10732
+ }
10733
+ if (Object.keys(bufferExt.attachTmbs).length < 1 && bufferExt.getTmbs.length < 1) {
10734
+ wrapper.off(scrollEvent, attachThumbnails);
10735
+ fm.unbind('resize', attachThumbnails);
10736
+ }
10737
+ };
10738
+
10739
+ if ($.isPlainObject(image) && Object.keys(image).length) {
10740
+ $.extend(bufferExt.attachTmbs, image);
10741
+ $.each(image, chk);
10742
+ } else {
10743
+ bufferExt.attachThumbTm && clearTimeout(bufferExt.attachThumbTm);
10744
+ bufferExt.attachThumbTm = setTimeout(function() {
10745
+ $.each(bufferExt.attachTmbs, chk);
10746
+ }, 0);
10747
+ }
10748
  },
10749
 
10750
  /**
10751
  * Load thumbnails from backend.
10752
  *
10753
+ * @param Array|void reloads hashes list for reload thumbnail items
10754
  * @return void
10755
  */
10756
+ loadThumbnails = function(reloads) {
10757
+ var tmbs = [],
10758
+ reload = false;
10759
+
10760
+ // do not parallel request
10761
+ if (bufferExt.gettingTmb && ! reloads) {
10762
+ return;
10763
+ }
10764
+
10765
+ if (! reloads) {
10766
+ bufferExt.gettingTmb = true;
10767
+ }
10768
 
10769
  if (fm.oldAPI) {
10770
  fm.request({
10771
  data : {cmd : 'tmb', current : fm.cwd().hash},
10772
  preventFail : true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10773
  })
10774
  .done(function(data) {
10775
+ bufferExt.gettingTmb = false;
10776
+ if (data.images && Object.keys(data.images).length) {
10777
+ attachThumbnails(data.images);
10778
+ }
10779
+ if (data.tmb) {
10780
+ loadThumbnails();
10781
  }
10782
+ })
10783
+ .fail(function() {
10784
+ bufferExt.gettingTmb = false;
10785
  });
10786
+ return;
10787
+ }
10788
+
10789
+ if (reloads) {
10790
+ reload = true;
10791
+ tmbs = reloads.splice(0, tmbNum);
10792
+ } else {
10793
+ tmbs = bufferExt.getTmbs.splice(0, tmbNum);
10794
+ }
10795
+ if (tmbs.length) {
10796
+ if (reload || fm.isInWindow($('#'+fm.cwdHash2Id(tmbs[0])), true) || fm.isInWindow($('#'+fm.cwdHash2Id(tmbs[tmbs.length-1])), true)) {
10797
+ fm.request({
10798
+ data : {cmd : 'tmb', targets : tmbs},
10799
+ preventFail : true
10800
+ })
10801
+ .done(function(data) {
10802
+ bufferExt.gettingTmb = false;
10803
+ if (data.images && Object.keys(data.images).length) {
10804
+ attachThumbnails(data.images, reload);
10805
+ }
10806
+ if (reload) {
10807
+ if (reloads.length) {
10808
+ loadThumbnails(reloads);
10809
+ }
10810
+ } else {
10811
+ if (bufferExt.getTmbs.length) {
10812
+ loadThumbnails();
10813
+ }
10814
+ }
10815
+ })
10816
+ .fail(function() {
10817
+ bufferExt.gettingTmb = false;
10818
+ });
10819
+ } else {
10820
+ // out of window tmb get later
10821
+ $.each(tmbs, function(i, h) {
10822
+ bufferExt.attachTmbs[h] = '1';
10823
+ });
10824
+ bufferExt.gettingTmb = false;
10825
+ attachThumbnails();
10826
+ }
10827
  }
10828
  },
10829
 
10833
  * @param Array new files
10834
  * @return void
10835
  */
10836
+ add = function(files, mode) {
10837
  var place = list ? cwd.find('tbody') : cwd,
10838
  l = files.length,
 
10839
  atmb = {},
10840
+ ltmb = {},
10841
  findNode = function(file) {
10842
  var pointer = cwd.find('[id]:first'), file2;
10843
 
10859
  }
10860
  return l || -1;
10861
  },
10862
+ // created document fragment for jQuery >= 1.12, 2.2, 3.0
10863
+ // see Studio-42/elFinder#1544 @ github
10864
+ docFlag = $.htmlPrefilter? true : false,
10865
+ tempDom = docFlag? $(document.createDocumentFragment()) : $('<div/>'),
10866
+ file, hash, node, nodes, ndx;
10867
+
10868
+ if (l > showFiles) {
10869
+ // re-render for performance tune
10870
+ content();
10871
+ selectedFiles = files.concat();
10872
+ trigger();
10873
+ } else {
10874
+ // add the item immediately
10875
+ l && wz.removeClass('elfinder-cwd-wrapper-empty');
10876
 
10877
+ while (l--) {
10878
+ file = files[l];
10879
+ hash = file.hash;
10880
+
10881
+ if ($('#'+fm.cwdHash2Id(hash)).length) {
10882
+ continue;
10883
+ }
10884
+
10885
+ if ((node = findNode(file)) && ! node.length) {
10886
+ node = null;
10887
+ }
10888
+ if (! node && (ndx = findIndex(file)) >= 0) {
10889
+ buffer.splice(ndx, 0, file);
10890
+ } else {
10891
+ tempDom.empty().append(itemhtml(file));
10892
+ (file.mime === 'directory') && !mobile && makeDroppable(tempDom);
10893
+ nodes = docFlag? tempDom : tempDom.children();
10894
+ if (node) {
10895
+ node.before(nodes);
10896
+ } else {
10897
+ place.append(nodes);
10898
+ }
10899
+ }
10900
+
10901
+ if ($('#'+fm.cwdHash2Id(hash)).length) {
10902
+ if (file.mime !== 'directory' && file.tmb) {
10903
+ if (file.tmb == 1) {
10904
+ ltmb[hash] = file.tmb;
10905
+ } else {
10906
+ atmb[hash] = file.tmb;
10907
+ }
10908
+ }
10909
+ }
10910
  }
10911
+
10912
+ setColwidth();
10913
+ bottomMarkerShow(place);
10914
+ if (Object.keys(atmb).length || Object.keys(ltmb).length) {
10915
+ if (Object.keys(bufferExt.attachTmbs).length < 1) {
10916
+ wrapper.off(scrollEvent, attachThumbnails).on(scrollEvent, attachThumbnails);
10917
+ fm.unbind('resize', attachThumbnails).bind('resize', attachThumbnails);
10918
  }
10919
+ $.extend(bufferExt.attachTmbs, atmb, ltmb);
10920
+ Object.keys(atmb).length && attachThumbnails(atmb, (mode === 'change' && fm.currentReqCmd === 'resize')? true : false);
10921
+ Object.keys(ltmb).length && attachThumbnails(ltmb);
10922
  }
10923
  }
 
 
 
 
 
10924
  },
10925
 
10926
  /**
10936
  if (!fm.cwd().hash && fm.currentReqCmd !== 'open') {
10937
  $.each(cwdParents.reverse(), function(i, h) {
10938
  if (fm.files()[h]) {
10939
+ fm.one(fm.currentReqCmd + 'done', function(e, fm) {
10940
+ !fm.cwd().hash && fm.exec('open', h);
10941
  });
10942
  return false;
10943
  }
10950
  if ((n = $('#'+fm.cwdHash2Id(hash))).length) {
10951
  try {
10952
  n.remove();
10953
+ --bufferExt.renderd;
10954
  } catch(e) {
10955
  fm.debug('error', e);
10956
  }
10959
  }
10960
  }
10961
 
10962
+ setColwidth();
 
 
 
 
 
10963
  },
10964
 
10965
  msg = {
10976
  customColsNameBuild = function() {
10977
  var name = '',
10978
  customColsName = '',
10979
+ names = $.extend({}, msg, options.listView.columnsCustomName);
10980
+ for (var i = 0; i < customCols.length; i++) {
10981
+ if (typeof names[customCols[i]] !== 'undefined') {
10982
+ name = names[customCols[i]];
 
10983
  } else {
10984
+ name = fm.i18n(customCols[i]);
10985
  }
10986
+ customColsName +='<td class="elfinder-cwd-view-th-'+customCols[i]+' sortable-item">'+name+'</td>';
10987
  }
10988
  return customColsName;
10989
  },
10990
 
10991
  bottomMarkerShow = function(place, cnt) {
10992
+ var ph, col = 1;
10993
  place = place || (list ? cwd.find('tbody') : cwd);
10994
 
10995
  if (buffer.length > 0) {
10996
  place.css({height: 'auto'});
10997
  ph = place.height();
10998
+ if (cnt) {
10999
+ if (! list) {
11000
+ col = Math.floor(place.width()/place.find('[id]:first').width());
11001
+ cnt = Math.ceil(cnt/col) * col;
11002
+ }
11003
+ bufferExt.hpi = ph / cnt;
11004
+ bufferExt.row = bufferExt.hpi * col;
11005
+ }
11006
+ bottomMarker.css({top: (bufferExt.hpi * buffer.length + ph) + 'px'}).show();
11007
+ }
11008
+ },
11009
+
11010
+ wrapperContextMenu = {
11011
+ contextmenu : function(e) {
11012
+ e.preventDefault();
11013
+ fm.trigger('contextmenu', {
11014
+ 'type' : 'cwd',
11015
+ 'targets' : [fm.cwd().hash],
11016
+ 'x' : e.pageX,
11017
+ 'y' : e.pageY
11018
+ });
11019
+ },
11020
+ touchstart : function(e) {
11021
+ if (e.originalEvent.touches.length > 1) {
11022
+ return;
11023
+ }
11024
+ cwd.data('longtap', null);
11025
+ wrapper.data('touching', {x: e.originalEvent.touches[0].pageX, y: e.originalEvent.touches[0].pageY});
11026
+ if (e.target === this || e.target === cwd.get(0)) {
11027
+ cwd.data('tmlongtap', setTimeout(function(){
11028
+ // long tap
11029
+ cwd.data('longtap', true);
11030
+ fm.trigger('contextmenu', {
11031
+ 'type' : 'cwd',
11032
+ 'targets' : [fm.cwd().hash],
11033
+ 'x' : wrapper.data('touching').x,
11034
+ 'y' : wrapper.data('touching').y
11035
+ });
11036
+ }, 500));
11037
+ }
11038
+ },
11039
+ touchend : function(e) {
11040
+ if (e.type === 'touchmove') {
11041
+ if (! wrapper.data('touching') ||
11042
+ ( Math.abs(wrapper.data('touching').x - e.originalEvent.touches[0].pageX)
11043
+ + Math.abs(wrapper.data('touching').y - e.originalEvent.touches[0].pageY)) > 4) {
11044
+ wrapper.data('touching', null);
11045
+ }
11046
+ }
11047
+ clearTimeout(cwd.data('tmlongtap'));
11048
+ },
11049
+ click : function(e) {
11050
+ if (cwd.data('longtap')) {
11051
+ e.preventDefault();
11052
+ e.stopPropagation();
11053
+ }
11054
  }
11055
  },
11056
 
11057
  /**
11058
  * Update directory content
11059
  *
 
11060
  * @return void
11061
  */
11062
+ content = function() {
11063
+ var phash, emptyMethod, thtr;
11064
 
11065
+ wz.append(selectAllCheckbox).removeClass('elfinder-cwd-wrapper-empty elfinder-search-result elfinder-incsearch-result');
11066
+ if (fm.searchStatus.state > 1 || fm.searchStatus.ininc) {
11067
+ wz.addClass('elfinder-search-result' + (fm.searchStatus.ininc? ' elfinder-incsearch-result' : ''));
11068
+ }
11069
 
11070
+ selectedNext = $();
11071
  try {
11072
  // to avoid problem with draggable
11073
  cwd.empty();
11074
  } catch (e) {
11075
  cwd.html('');
11076
  }
11077
+
11078
+ if (tableHeader) {
11079
+ wrapper.off('scroll.fixheader resize.fixheader');
11080
+ tableHeader.remove();
11081
+ tableHeader = null;
11082
+ }
11083
 
11084
  cwd.removeClass('elfinder-cwd-view-icons elfinder-cwd-view-list')
11085
+ .addClass('elfinder-cwd-view-'+(list ? 'list' :'icons'))
11086
+ .attr('style', '')
11087
+ .css('height', 'auto');
11088
  bottomMarker.hide();
11089
 
11090
+ wrapper[list ? 'addClass' : 'removeClass']('elfinder-cwd-wrapper-list')
11091
+ ._padding = parseInt(wrapper.css('padding-top')) + parseInt(wrapper.css('padding-bottom'));
11092
+ if (fm.UA.iOS) {
11093
+ wrapper.removeClass('overflow-scrolling-touch').addClass('overflow-scrolling-touch');
11094
+ }
11095
 
11096
+ if (list) {
11097
+ cwd.html('<table><thead/><tbody/></table>');
11098
+ thtr = $('<tr class="ui-state-default"><td class="elfinder-cwd-view-th-name">'+msg.name+'</td>'+customColsNameBuild()+'</tr>');
11099
+ cwd.find('thead').hide().append(
11100
+ thtr
11101
+ .on('contextmenu.'+fm.namespace, wrapperContextMenu.contextmenu)
11102
+ .on('touchstart.'+fm.namespace, 'td', wrapperContextMenu.touchstart)
11103
+ .on('touchmove.'+fm.namespace+' touchend.'+fm.namespace+' mouseup.'+fm.namespace, 'td', wrapperContextMenu.touchend)
11104
+ .on('click.'+fm.namespace,'td', wrapperContextMenu.click)
11105
+ ).find('td:first').append(selectAllCheckbox);
11106
+
11107
+ if ($.fn.sortable) {
11108
+ thtr.addClass('touch-punch touch-punch-keep-default')
11109
+ .sortable({
11110
+ axis: 'x',
11111
+ distance: 8,
11112
+ items: '> .sortable-item',
11113
+ start: function(e, ui) {
11114
+ $(ui.item[0]).data('dragging', true);
11115
+ ui.placeholder
11116
+ .width(ui.helper.removeClass('ui-state-hover').width())
11117
+ .removeClass('ui-state-active')
11118
+ .addClass('ui-state-hover')
11119
+ .css('visibility', 'visible');
11120
+ },
11121
+ update: function(e, ui){
11122
+ var target = $(ui.item[0]).attr('class').split(' ')[0].replace('elfinder-cwd-view-th-', ''),
11123
+ prev, done;
11124
+ customCols = $.map($(this).children(), function(n) {
11125
+ var name = $(n).attr('class').split(' ')[0].replace('elfinder-cwd-view-th-', '');
11126
+ if (! done) {
11127
+ if (target === name) {
11128
+ done = true;
11129
+ } else {
11130
+ prev = name;
11131
+ }
11132
+ }
11133
+ return (name === 'name')? null : name;
11134
+ });
11135
+ templates.row = makeTemplateRow();
11136
+ fm.storage('cwdCols', customCols);
11137
+ prev = '.elfinder-col-'+prev+':first';
11138
+ target = '.elfinder-col-'+target+':first';
11139
+ fm.lazy(function() {
11140
+ cwd.find('tbody tr').each(function() {
11141
+ var $this = $(this);
11142
+ $this.children(prev).after($this.children(target));
11143
+ });
11144
+ });
11145
+ },
11146
+ stop: function(e, ui) {
11147
+ setTimeout(function() {
11148
+ $(ui.item[0]).removeData('dragging');
11149
+ }, 100);
11150
+ }
11151
  });
11152
+ }
11153
 
11154
+ if ($.fn.resizable) {
11155
+ thtr.find('td').addClass('touch-punch').resizable({
11156
+ handles: fm.direction === 'ltr'? 'e' : 'w',
11157
+ start: function(e, ui) {
11158
+ var target = cwd.find('td.elfinder-col-'
11159
+ + ui.element.attr('class').split(' ')[0].replace('elfinder-cwd-view-th-', '')
11160
+ + ':first');
11161
+
11162
+ ui.element
11163
+ .data('resizeTarget', target)
11164
+ .data('targetWidth', target.width());
11165
+ colResizing = true;
11166
+ if (cwd.find('table').css('table-layout') !== 'fixed') {
11167
+ cwd.find('tbody tr:first td').each(function() {
11168
+ $(this).width($(this).width());
11169
+ });
11170
+ cwd.find('table').css('table-layout', 'fixed');
11171
+ }
11172
+ },
11173
+ resize: function(e, ui) {
11174
+ ui.element.data('resizeTarget').width(ui.element.data('targetWidth') - (ui.originalSize.width - ui.size.width));
11175
+ },
11176
+ stop : function() {
11177
+ colResizing = false;
11178
+ fixTableHeader({fitWidth: true});
11179
+ colWidth = {};
11180
+ cwd.find('tbody tr:first td').each(function() {
11181
+ var name = $(this).attr('class').split(' ')[0].replace('elfinder-col-', '');
11182
+ colWidth[name] = $(this).width();
11183
+ });
11184
+ fm.storage('cwdColWidth', colWidth);
11185
+ }
11186
+ })
11187
+ .find('.ui-resizable-handle').addClass('ui-icon ui-icon-grip-dotted-vertical');
11188
+ }
11189
  }
11190
+
11191
+ fm.lazy(function() {
11192
+ buffer = $.map(incHashes || cwdHashes, function(hash) { return fm.file(hash) || null });
11193
+
11194
+ buffer = fm.sortFiles(buffer);
11195
+ bufferExt = {
11196
+ renderd: 0,
11197
+ attachTmbs: {},
11198
+ getTmbs: [],
11199
+ lazyOpts: { tm : 0 }
11200
+ };
11201
+
11202
+ wz[(buffer.length < 1) ? 'addClass' : 'removeClass']('elfinder-cwd-wrapper-empty');
11203
+ wrapper.off(scrollEvent, render).on(scrollEvent, render).trigger(scrollEvent);
11204
+
11205
+ // set droppable
11206
+ if (!fm.cwd().write) {
11207
+ wrapper.removeClass('native-droppable')
11208
+ .droppable('disable')
11209
+ .removeClass('ui-state-disabled'); // for old jQueryUI see https://bugs.jqueryui.com/ticket/5974
11210
+ } else {
11211
+ wrapper[fm.isCommandEnabled('upload')? 'addClass' : 'removeClass']('native-droppable');
11212
+ wrapper.droppable('enable');
11213
+ }
11214
+ });
11215
  },
11216
 
11217
  /**
11224
  .attr('unselectable', 'on')
11225
  // fix ui.selectable bugs and add shift+click support
11226
  .on('click.'+fm.namespace, fileSelector, function(e) {
11227
+ var p = this.id ? $(this) : $(this).parents('[id]:first'),
11228
+ tgt = $(e.target),
11229
+ prev,
11230
+ next,
11231
+ pl,
11232
+ nl,
11233
  sib;
11234
 
11235
+ if (selectCheckbox && (tgt.is('input:checkbox') || tgt.hasClass('elfinder-cwd-select'))) {
11236
+ e.stopPropagation();
11237
+ e.preventDefault();
11238
+ if (! wrapper.data('touching')) {
11239
+ p.trigger(p.hasClass(clSelected) ? evtUnselect : evtSelect);
11240
+ trigger();
11241
+ }
11242
+ setTimeout(function() {
11243
+ tgt.prop('checked', p.hasClass(clSelected));
11244
+ }, 10);
11245
+
11246
+ return false;
11247
+ }
11248
+
11249
  if (cwd.data('longtap')) {
11250
  e.stopPropagation();
11251
  return;
11252
  }
11253
 
11254
+ if (e.shiftKey) {
11255
+ prev = p.prevAll(lastSelect || '.'+clSelected+':first');
11256
+ next = p.nextAll(lastSelect || '.'+clSelected+':first');
11257
+ pl = prev.length;
11258
+ nl = next.length;
11259
+ }
11260
  if (e.shiftKey && (pl || nl)) {
11261
  sib = pl ? p.prevUntil('#'+prev.attr('id')) : p.nextUntil('#'+next.attr('id'));
11262
  sib.add(p).trigger(evtSelect);
11263
  } else if (e.ctrlKey || e.metaKey) {
11264
  p.trigger(p.hasClass(clSelected) ? evtUnselect : evtSelect);
11265
  } else {
11266
+ if (wrapper.data('touching') && p.hasClass(clSelected)) {
11267
+ wrapper.data('touching', null);
11268
  fm.dblclick({file : fm.cwdId2Hash(this.id)});
 
11269
  return;
11270
  } else {
11271
  unselectAll();
11281
  })
11282
  // for touch device
11283
  .on('touchstart.'+fm.namespace, fileSelector, function(e) {
11284
+ if (e.originalEvent.touches.length > 1) {
11285
+ return;
11286
+ }
11287
+ var p = this.id ? $(this) : $(this).parents('[id]:first'),
11288
+ tgt = $(e.target),
11289
+ sel;
11290
+
11291
+ wrapper.data('touching', {x: e.originalEvent.touches[0].pageX, y: e.originalEvent.touches[0].pageY});
11292
+ if (selectCheckbox && (tgt.is('input:checkbox') || tgt.hasClass('elfinder-cwd-select'))) {
11293
+ setTimeout(function() {
11294
+ if (wrapper.data('touching')) {
11295
+ p.trigger(p.hasClass(clSelected) ? evtUnselect : evtSelect);
11296
+ trigger();
11297
+ }
11298
+ }, 150);
11299
+ return;
11300
+ }
11301
+
11302
  if (e.target.nodeName == 'INPUT' || e.target.nodeName == 'TEXTAREA') {
11303
  return;
11304
  }
11305
+
11306
+ sel = p.prevAll('.'+clSelected+':first').length +
11307
+ p.nextAll('.'+clSelected+':first').length;
11308
  cwd.data('longtap', null);
11309
  p.addClass(clHover)
11310
+ .data('tmlongtap', setTimeout(function(){
 
11311
  // long tap
11312
  cwd.data('longtap', true);
11313
+ if (e.target.nodeName != 'TD' || fm.selected().length > 0) {
11314
+ p.trigger(evtSelect);
11315
  trigger();
11316
+ fm.trigger('contextmenu', {
11317
+ 'type' : 'files',
11318
+ 'targets' : fm.selected(),
11319
+ 'x' : e.originalEvent.touches[0].pageX,
11320
+ 'y' : e.originalEvent.touches[0].pageY
11321
+ });
 
 
 
 
 
11322
  }
11323
  }, 500));
11324
  })
11325
  .on('touchmove.'+fm.namespace+' touchend.'+fm.namespace, fileSelector, function(e) {
11326
+ if (e.target.nodeName == 'INPUT' || e.target.nodeName == 'TEXTAREA' || $(e.target).hasClass('elfinder-cwd-select')) {
 
11327
  return;
11328
  }
11329
  var p = this.id ? $(this) : $(this).parents('[id]:first');
11330
  clearTimeout(p.data('tmlongtap'));
11331
+ if (e.type === 'touchmove') {
11332
+ wrapper.data('touching', null);
11333
  p.removeClass(clHover);
11334
+ } else if (wrapper.data('touching') && !cwd.data('longtap') && p.hasClass(clSelected)) {
11335
+ e.preventDefault();
11336
+ wrapper.data('touching', null);
11337
+ fm.dblclick({file : fm.cwdId2Hash(this.id)});
11338
  }
11339
  })
11340
  // attach draggable
11342
  var $this = $(this), helper = null,
11343
  target = list ? $this : $this.children('div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename');
11344
 
11345
+ if (!mobile && !$this.hasClass(clTmp) && !target.hasClass(clDraggable) && !target.hasClass(clDisabled)) {
11346
  target.on('mousedown', function(e) {
11347
  // shiftKey + drag start for HTML5 native drag function
11348
  if (e.shiftKey && !fm.UA.IE && cwd.data('selectable')) {
11352
  cwd.selectable(selectableOption).data('selectable', true);
11353
  }, 10);
11354
  }
11355
+ target.draggable('option', 'disabled', e.shiftKey).removeClass('ui-state-disabled');
11356
  if (e.shiftKey) {
11357
  target.attr('draggable', 'true');
11358
  } else {
11359
+ target.removeAttr('draggable')
11360
  .draggable('option', 'cursorAt', {left: 50 - parseInt($(e.currentTarget).css('margin-left')), top: 47});
11361
  }
11362
  })
11371
  murl = null,
11372
  files = [],
11373
  icon = function(f) {
11374
+ var mime = f.mime, i, tmb = fm.tmb(f);
11375
  i = '<div class="elfinder-cwd-icon '+fm.mime2class(mime)+' ui-corner-all"/>';
11376
+ if (tmb) {
11377
+ i = $(i).addClass(tmb.className).css('background-image', "url('"+tmb.url+"')").get(0).outerHTML;
11378
  }
11379
  return i;
11380
  }, l, geturl = [];
11448
  })
11449
  // add hover class to selected file
11450
  .on(evtSelect, fileSelector, function(e) {
11451
+ var $this = $(this),
11452
  id = fm.cwdId2Hash($this.attr('id'));
11453
 
11454
  if (!selectLock && !$this.hasClass(clDisabled)) {
11455
+ lastSelect = '#'+ this.id;
11456
+ $this.addClass(clSelected).children().addClass(clHover).find('input:checkbox').prop('checked', true);;
11457
  if ($.inArray(id, selectedFiles) === -1) {
11458
  selectedFiles.push(id);
11459
  }
11460
+ // will be selected next
11461
+ selectedNext = cwd.find('[id].'+clSelected+':last').next();
11462
  }
11463
  })
11464
  // remove hover class from unselected file
11468
  ndx;
11469
 
11470
  if (!selectLock) {
11471
+ $this.removeClass(clSelected).children().removeClass(clHover).find('input:checkbox').prop('checked', false);
11472
+ if (cwd.hasClass('elfinder-cwd-allselected')) {
11473
+ selectCheckbox && selectAllCheckbox.children('input').prop('checked', false);
11474
+ cwd.removeClass('elfinder-cwd-allselected');
11475
+ }
11476
  ndx = $.inArray(id, selectedFiles);
11477
  if (ndx !== -1) {
11478
+ lastSelect = void 0;
11479
  selectedFiles.splice(ndx, 1);
11480
  }
11481
  }
11485
  .on(evtDisable, fileSelector, function() {
11486
  var $this = $(this).removeClass(clHover+' '+clSelected).addClass(clDisabled),
11487
  child = $this.children(),
11488
+ target = (list ? $this : child.find('div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename'));
11489
 
11490
  child.removeClass(clHover+' '+clSelected);
11491
 
11495
  // if any files was not removed/moved - unlock its
11496
  .on(evtEnable, fileSelector, function() {
11497
  var $this = $(this).removeClass(clDisabled),
11498
+ target = list ? $this : $this.children('div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename');
11499
 
11500
  $this.hasClass(clDroppable) && $this.droppable('enable');
11501
  target.hasClass(clDraggable) && target.draggable('enable');
11502
  })
11503
  .on('scrolltoview', fileSelector, function() {
11504
+ scrollToView($(this), true);
11505
  })
11506
  .on('mouseenter.'+fm.namespace+' mouseleave.'+fm.namespace, fileSelector, function(e) {
11507
  fm.trigger('hover', {hash : fm.cwdId2Hash($(this).attr('id')), type : e.type});
11513
  if (file.length && (e.target.nodeName != 'TD' || $.inArray(fm.cwdId2Hash(file.get(0).id), fm.selected()) > -1)) {
11514
  e.stopPropagation();
11515
  e.preventDefault();
11516
+ if (!file.hasClass(clDisabled) && !wrapper.data('touching')) {
11517
  if (!file.hasClass(clSelected)) {
 
11518
  unselectAll();
11519
  file.trigger(evtSelect);
11520
  trigger();
11529
  }
11530
 
11531
  }
 
 
 
11532
  })
11533
  // unselect all on cwd click
11534
  .on('click.'+fm.namespace, function(e) {
11535
+ if (e.target === this && ! cwd.data('longtap')) {
11536
+ !e.shiftKey && !e.ctrlKey && !e.metaKey && unselectAll();
 
11537
  }
 
11538
  })
 
 
 
 
11539
  // prepend fake file/dir
11540
  .on('create.'+fm.namespace, function(e, file) {
11541
  var parent = list ? cwd.find('tbody') : cwd,
11542
  p = parent.find('.elfinder-cwd-parent'),
11543
+ lock = file.move || false,
11544
+ file = $(itemhtml(file)).addClass(clTmp),
11545
+ selected = fm.selected();
11546
 
11547
+ if (selected.length) {
11548
+ lock && fm.trigger('lockfiles', {files: selected});
11549
+ } else {
11550
+ unselectAll();
11551
+ }
11552
 
11553
  if (p.length) {
11554
  p.after(file);
11556
  parent.prepend(file);
11557
  }
11558
 
11559
+ setColwidth();
11560
+ wrapper.scrollTop(0).scrollLeft(0);
11561
  })
11562
  // unselect all selected files
11563
  .on('unselectall', unselectAll)
11564
  .on('selectfile', function(e, id) {
11565
  $('#'+fm.cwdHash2Id(id)).trigger(evtSelect);
11566
  trigger();
11567
+ })
11568
+ .on('colwidth', function() {
11569
+ if (list) {
11570
+ cwd.find('table').css('table-layout', '')
11571
+ .find('td').css('width', '');
11572
+ fixTableHeader({fitWidth: true});
11573
+ fm.storage('cwdColWidth', colWidth = null);
11574
+ }
11575
  }),
11576
  wrapper = $('<div class="elfinder-cwd-wrapper"/>')
11577
  // make cwd itself droppable for folders from nav panel
11578
  .droppable($.extend({}, droppable, {autoDisable: false}))
11579
+ .on('contextmenu.'+fm.namespace, wrapperContextMenu.contextmenu)
11580
+ .on('touchstart.'+fm.namespace, wrapperContextMenu.touchstart)
11581
+ .on('touchmove.'+fm.namespace+' touchend.'+fm.namespace, wrapperContextMenu.touchend)
11582
+ .on('click.'+fm.namespace, wrapperContextMenu.click)
11583
+ .on('scroll.'+fm.namespace, function() {
11584
+ bufferExt.seltm && clearTimeout(bufferExt.seltm);
11585
+ bufferExt.scrtm && clearTimeout(bufferExt.scrtm);
11586
+ if (bufferExt.scrtm && Math.abs((bufferExt.scrolltop || 0) - (bufferExt.scrolltop = $(this).scrollTop())) < 2) {
11587
+ bufferExt.scrtm = 0;
11588
+ wrapper.trigger(scrollEvent);
11589
+ } else {
11590
+ bufferExt.scrtm = setTimeout(function() {
11591
+ bufferExt.scrtm = 0;
11592
+ wrapper.trigger(scrollEvent);
11593
+ }, 100);
11594
+ }
11595
+ }),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11596
 
11597
  bottomMarker = $('<div>&nbsp;</div>')
11598
  .css({position: 'absolute', width: '1px', height: '1px'})
11599
  .hide(),
11600
 
11601
+ selectAllCheckbox = selectCheckbox? $('<div class="elfinder-cwd-selectall"><input type="checkbox"/></div>')
11602
+ .attr('title', fm.i18n('selectall'))
11603
+ .on('touchstart mousedown click', function(e) {
11604
+ e.stopPropagation();
11605
+ e.preventDefault();
11606
+ if ($(this).data('pending') || e.type === 'click') {
11607
+ return false;
11608
+ }
11609
+ selectAllCheckbox.data('pending', true);
11610
+ if (cwd.hasClass('elfinder-cwd-allselected')) {
11611
+ selectAllCheckbox.find('input').prop('checked', false);
11612
+ setTimeout(function() {
11613
+ unselectAll();
11614
+ }, 10);
11615
+ } else {
11616
+ selectAll();
11617
+ }
11618
+ }) : $(),
11619
+
11620
  restm = null,
11621
  resize = function(init) {
11622
  var initHeight = function() {
11635
  var wph, cwdoh;
11636
  // fix cwd height if it less then wrapper
11637
  cwd.css('height', 'auto');
11638
+ wph = wrapper[0].clientHeight - parseInt(wrapper.css('padding-top')) - parseInt(wrapper.css('padding-bottom')) - parseInt(cwd.css('margin-top')),
11639
  cwdoh = cwd.outerHeight(true);
11640
  if (cwdoh < wph) {
11641
  cwd.height(wph);
11642
  }
11643
  }, 20);
11644
+
11645
+ list && ! colResizing && fixTableHeader();
11646
  },
11647
 
11648
  // elfinder node
11649
  parent = $(this).parent().resize(resize),
11650
 
11651
  // workzone node
11652
+ wz = parent.children('.elfinder-workzone').append(wrapper.append(this).append(bottomMarker)),
11653
+
11654
+ winScrTm;
11655
 
11656
+ // setup by options
11657
+ replacement = $.extend(replacement, options.replacement || {});
11658
 
11659
+ try {
11660
+ colWidth = fm.storage('cwdColWidth')? fm.storage('cwdColWidth') : null;
11661
+ } catch(e) {
11662
+ colWidth = null;
11663
+ }
11664
+
11665
+ // setup costomCols
11666
+ if (customCols = fm.storage('cwdCols')) {
11667
+ customCols = $.map(customCols, function(n) {
11668
+ return (options.listView.columns.indexOf(n) !== -1)? n : null;
11669
+ });
11670
+ if (options.listView.columns.length > customCols.length) {
11671
+ $.each(options.listView.columns, function(i, n) {
11672
+ if (customCols.indexOf(n) === -1) {
11673
+ customCols.push(n);
11674
+ }
11675
+ });
11676
+ }
11677
+ } else {
11678
+ customCols = options.listView.columns;
11679
+ }
11680
+ templates.row = makeTemplateRow();
11681
+
11682
+ if (mobile) {
11683
+ // for iOS5 bug
11684
+ $('body').on('touchstart touchmove touchend', function(e){});
11685
+ }
11686
+
11687
+ selectCheckbox && cwd.addClass('elfinder-has-checkbox');
11688
+
11689
+ $(window).on('scroll.'+fm.namespace, function() {
11690
+ winScrTm && clearTimeout(winScrTm);
11691
+ winScrTm = setTimeout(function() {
11692
+ wrapper.trigger(scrollEvent);
11693
+ }, 50);
11694
+ });
11695
+
11696
+ $(document).on('keydown.'+fm.namespace, function(e) {
11697
+ if (e.keyCode == $.ui.keyCode.ESCAPE) {
11698
+ if (! fm.getUI().find('.ui-widget:visible').length) {
11699
+ unselectAll();
11700
+ }
11701
+ }
11702
+ });
11703
 
11704
  fm
11705
  .one('init', function(){
11706
  var style = document.createElement('style'),
11707
+ sheet, selRefresh, node, base, resizeTm;
11708
  document.head.appendChild(style);
11709
  sheet = style.sheet;
11710
  sheet.insertRule('.elfinder-cwd-wrapper-empty .elfinder-cwd:after{ content:"'+fm.i18n('emptyFolder')+'" }', 0);
11711
+ sheet.insertRule('.elfinder-cwd-wrapper-empty .ui-droppable .elfinder-cwd:after{ content:"'+fm.i18n('emptyFolder'+(mobile? 'LTap' : 'Drop'))+'" }', 1);
11712
+ sheet.insertRule('.elfinder-cwd-wrapper-empty .ui-droppable-disabled .elfinder-cwd:after{ content:"'+fm.i18n('emptyFolder')+'" }', 2);
11713
+ sheet.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result .elfinder-cwd:after{ content:"'+fm.i18n('emptySearch')+'" }', 3);
11714
+ sheet.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result.elfinder-incsearch-result .elfinder-cwd:after{ content:"'+fm.i18n('emptyIncSearch')+'" }', 3);
11715
+ if (! mobile) {
11716
+ // make files selectable
11717
+ cwd.selectable(selectableOption)
11718
+ .data('selectable', true);
11719
+ selRefresh = function() {
11720
+ if (cwd.data('selectable')) {
11721
+ bufferExt.seltm && clearTimeout(bufferExt.seltm);
11722
+ bufferExt.seltm = 0;
11723
+ cwd.selectable('enable').selectable('refresh');
11724
+ }
11725
+ };
11726
+ wrapper.on(scrollEvent, function() {
11727
+ cwd.off('mousedown', selRefresh).one('mousedown', selRefresh);
11728
+ bufferExt.seltm = setTimeout(function() {
11729
+ cwd.off('mousedown', selRefresh);
11730
+ selRefresh();
11731
+ }, 2000);
11732
+ });
11733
+ base = $('<div style="position:absolute"/>');
11734
+ node = fm.getUI();
11735
+ node.on('resize', function(e, data) {
11736
+ var offset;
11737
+ if (data && data.fullscreen) {
11738
+ offset = node.offset();
11739
+ if (data.fullscreen === 'on') {
11740
+ base.css({top:offset.top * -1 , left:offset.left * -1 }).appendTo(node);
11741
+ selectableOption.appendTo = base;
11742
+ } else {
11743
+ base.detach();
11744
+ selectableOption.appendTo = 'body';
11745
+ }
11746
+ cwd.selectable('option', {appendTo : selectableOption.appendTo});
11747
+ }
11748
+ selRefresh();
11749
+ });
11750
+ }
11751
  })
11752
+ .bind('open add remove searchend', function() {
11753
+ var phash = fm.cwd().hash;
11754
+ cwdHashes = $.map(fm.files(), function(f) { return f.phash == phash ? f.hash : null ;});
11755
+ })
11756
+ .bind('open', function() {
11757
+ cwdParents = fm.parents(fm.cwd().hash);
11758
+ incHashes = void 0;
11759
+ unselectAll();
11760
+ content();
11761
  resize();
11762
  })
11763
  .bind('search', function(e) {
11764
+ cwdHashes = $.map(e.data.files, function(f) { return f.hash; });
11765
+ incHashes = void 0;
11766
+ fm.searchStatus.ininc = false;
11767
+ content();
11768
  fm.autoSync('stop');
11769
  resize();
11770
  })
11771
  .bind('searchend', function(e) {
11772
+ if (query || incHashes) {
 
11773
  query = '';
11774
+ if (incHashes) {
11775
+ fm.trigger('incsearchend', e.data);
11776
+ }
11777
  if (!e.data || !e.data.noupdate) {
11778
+ content();
11779
  }
11780
  }
 
11781
  fm.autoSync();
11782
  resize();
11783
  })
11784
  .bind('searchstart', function(e) {
11785
+ unselectAll();
11786
  query = e.data.query;
11787
  })
11788
+ .bind('incsearchstart', function(e) {
11789
+ selectedFiles = [];
11790
+ fm.lazy(function() {
11791
+ // incremental search
11792
+ query = e.data.query || '';
11793
+ if (query) {
11794
+ var regex = new RegExp(query.replace(/([\\*\;\.\?\[\]\{\}\(\)\^\$\-\|])/g, '\\$1'), 'i');
11795
+ incHashes = $.map(cwdHashes, function(hash) {
11796
+ var file = fm.file(hash);
11797
+ return (file && (file.name.match(regex) || (file.i18 && file.i18.match(regex))))? file.hash : null;
11798
+ });
11799
+ fm.trigger('incsearch', { hashes: incHashes, query: query })
11800
+ .searchStatus.ininc = true;
11801
+ content();
11802
+ fm.autoSync('stop');
11803
+ } else {
11804
+ fm.trigger('incsearchend');
11805
+ }
11806
+ resize();
11807
+ });
11808
+ })
11809
+ .bind('incsearchend', function(e) {
11810
+ query = '';
11811
+ fm.searchStatus.ininc = false;
11812
+ incHashes = void 0;
11813
+ if (!e.data || !e.data.noupdate) {
11814
+ content();
11815
+ }
11816
+ fm.autoSync();
11817
+ })
11818
  .bind('sortchange', function() {
11819
+ var lastScrollLeft = wrapper.scrollLeft();
11820
+
11821
+ content();
11822
+ fm.one('cwdrender', function() {
11823
+ wrapper.scrollLeft(lastScrollLeft);
11824
+ selectedFiles.length && trigger();
11825
+ resize();
11826
+ });
11827
  })
11828
  .bind('viewchange', function() {
11829
+ var l = fm.storage('view') == 'list',
11830
+ allsel = cwd.hasClass('elfinder-cwd-allselected');
11831
 
11832
  if (l != list) {
11833
  list = l;
11834
+ fm.viewType = list? 'list' : 'icons';
11835
+ content();
11836
 
11837
+ if (allsel) {
11838
+ cwd.addClass('elfinder-cwd-allselected');
11839
+ selectAllCheckbox.find('input').prop('checked', true);
11840
+ }
11841
+ selectedFiles.length && trigger();
11842
  }
11843
  resize();
11844
  })
11845
+ .bind('wzresize', function() {
11846
+ var place = list ? cwd.find('tbody') : cwd,
11847
+ cwdOffset;
11848
  resize(true);
11849
+ if (bufferExt.hpi) {
11850
+ bottomMarkerShow(place, place.find('[id]').length);
11851
+ }
11852
+
11853
+ cwdOffset = cwd.offset();
11854
+ wz.data('rectangle', $.extend(
11855
+ {
11856
+ width: wz.width(),
11857
+ height: wz.height(),
11858
+ cwdEdge: (fm.direction === 'ltr')? cwdOffset.left : cwdOffset.left + cwd.width()
11859
+ },
11860
+ wz.offset())
11861
+ );
11862
+
11863
+ bufferExt.itemH = (list? place.find('tr:first') : place.find('[id]:first')).outerHeight(true);
11864
  })
11865
+ .bind('changeclipboard', function(e) {
11866
+ clipCuts = {};
11867
+ if (e.data && e.data.clipboard && e.data.clipboard.length) {
11868
+ $.each(e.data.clipboard, function(i, f) {
11869
+ if (f.cut) {
11870
+ clipCuts[f.hash] = true;
11871
+ }
11872
+ });
11873
+ }
11874
+ })
11875
+ .bind('resMixinMake', function() {
11876
+ setColwidth();
11877
+ })
11878
+ .bind('tmbreload', function(e) {
11879
+ var imgs = {},
11880
+ files = (e.data && e.data.files)? e.data.files : null;
11881
+
11882
+ $.each(files, function(i, f) {
11883
+ if (f.tmb && f.tmb != '1') {
11884
+ imgs[f.hash] = f.tmb;
11885
+ }
11886
+ });
11887
+ if (Object.keys(imgs).length) {
11888
+ attachThumbnails(imgs, true);
11889
+ }
11890
  })
11891
  .add(function(e) {
11892
  var phash = fm.cwd().hash,
11893
+ regex = query? new RegExp(query.replace(/([\\*\;\.\?\[\]\{\}\(\)\^\$\-\|])/g, '\\$1'), 'i') : null,
11894
+ files = regex
11895
+ ? $.map(e.data.added || [], function(f) { return (! fm.searchStatus.ininc || f.phash == phash) && (f.name.match(regex) || (f.i18 && f.i18.match(regex)))? f : null ;})
11896
  : $.map(e.data.added || [], function(f) { return f.phash == phash ? f : null; })
11897
  ;
11898
  add(files);
11899
+ list && resize();
11900
+ wrapper.trigger(scrollEvent);
11901
  })
11902
  .change(function(e) {
11903
  var phash = fm.cwd().hash,
11908
  $.each(e.data.changed || [], function(i, file) {
11909
  remove([file.hash]);
11910
  if (file.name.indexOf(query) !== -1) {
11911
+ add([file], 'change');
11912
  $.inArray(file.hash, sel) !== -1 && selectFile(file.hash);
11913
  }
11914
  });
11915
  } else {
11916
  $.each($.map(e.data.changed || [], function(f) { return f.phash == phash ? f : null; }), function(i, file) {
11917
  remove([file.hash]);
11918
+ add([file], 'change');
11919
  $.inArray(file.hash, sel) !== -1 && selectFile(file.hash);
11920
  });
11921
  }
11923
  trigger();
11924
  })
11925
  .remove(function(e) {
11926
+ var place = list ? cwd.find('tbody') : cwd;
11927
  remove(e.data.removed || []);
11928
  trigger();
11929
+ if (buffer.length < 1 && place.children().length < 1) {
11930
+ wz.addClass('elfinder-cwd-wrapper-empty');
11931
+ selectCheckbox && selectAllCheckbox.find('input').prop('checked', false);
11932
+ bottomMarker.hide();
11933
+ wrapper.off(scrollEvent, render);
11934
+ resize();
11935
+ } else {
11936
+ bottomMarkerShow(place);
11937
+ wrapper.trigger(scrollEvent);
11938
+ }
11939
  })
11940
  // select dragged file if no selected, disable selectable
11941
  .dragstart(function(e) {
11969
  files = e.data.files || [],
11970
  l = files.length,
11971
  helper = e.data.helper || $(),
11972
+ parents, ctr, add, sels;
11973
 
11974
  if (l > 0) {
11975
  parents = fm.parents(files[0]);
11976
  }
11977
+ if (event === evtSelect || event === evtUnselect) {
11978
+ add = (event === evtSelect),
11979
+ sels = add? selectedFiles.concat() : selectedFiles;
11980
+ $.each(files, function(i, hash) {
11981
+ var idx = $.inArray(hash, sels),
11982
+ all = cwd.hasClass('elfinder-cwd-allselected');
11983
+ if (idx === -1) {
11984
+ add && selectedFiles.push(hash);
11985
+ } else {
11986
+ if (all) {
11987
+ selectCheckbox && selectAllCheckbox.children('input').prop('checked', false);
11988
+ cwd.removeClass('elfinder-cwd-allselected');
11989
+ all = false;
11990
+ }
11991
+ ! add && selectedFiles.splice(idx, 1);
11992
+ }
11993
+ });
11994
+ }
11995
  if (!helper.data('locked')) {
11996
  while (l--) {
11997
  $('#'+fm.cwdHash2Id(files[l])).trigger(event);
11998
  }
11999
+ ! e.data.inselect && trigger();
12000
  }
12001
  if (wrapper.data('dropover') && parents.indexOf(wrapper.data('dropover')) !== -1) {
12002
  ctr = e.type !== 'lockfiles';
12011
 
12012
  unselectAll();
12013
 
12014
+ $.each((e.data.added || []).concat(e.data.changed || []), function(i, file) {
12015
  file && file.phash == phash && selectFile(file.hash);
12016
  });
12017
  trigger();
12044
  scrollToView(cwd.find('[id]:last').trigger(evtSelect)) ;
12045
  trigger();
12046
  }
12047
+ })
12048
+ .shortcut({
12049
+ pattern : 'page_up',
12050
+ description : 'pageTurning',
12051
+ callback : function(e) {
12052
+ if (bufferExt.itemH) {
12053
+ wrapper.scrollTop(
12054
+ Math.round(
12055
+ wrapper.scrollTop()
12056
+ - (Math.floor((wrapper.height() + (list? bufferExt.itemH * -1 : 16)) / bufferExt.itemH)) * bufferExt.itemH
12057
+ )
12058
+ );
12059
+ }
12060
+ }
12061
+ }).shortcut({
12062
+ pattern : 'page_down',
12063
+ description : 'pageTurning',
12064
+ callback : function(e) {
12065
+ if (bufferExt.itemH) {
12066
+ wrapper.scrollTop(
12067
+ Math.round(
12068
+ wrapper.scrollTop()
12069
+ + (Math.floor((wrapper.height() + (list? bufferExt.itemH * -1 : 16)) / bufferExt.itemH)) * bufferExt.itemH
12070
+ )
12071
+ );
12072
+ }
12073
+ }
12074
  });
12075
 
12076
  });
12078
  // fm.timeEnd('cwdLoad')
12079
 
12080
  return this;
12081
+ };
12082
 
12083
 
12084
  /*
12090
  *
12091
  * @author Dmitry (dio) Levashov
12092
  **/
12093
+ $.fn.elfinderdialog = function(opts, fm) {
12094
+ var platformWin = (window.navigator.platform.indexOf('Win') != -1),
12095
+ dialog, elfNode;
12096
 
12097
+ if (fm && fm.ui) {
12098
+ elfNode = fm.getUI();
12099
+ } else {
12100
+ elfNode = this.closest('.elfinder');
12101
+ if (! fm) {
12102
+ fm = elfNode.elfinder('instance');
 
 
 
 
 
 
 
12103
  }
12104
  }
12105
 
12106
+ if (typeof opts === 'string') {
12107
+ if ((dialog = this.closest('.ui-dialog')).length) {
12108
+ if (opts == 'open') {
12109
+ dialog.css('display') == 'none' && dialog.fadeIn(120, function() {
12110
+ dialog.trigger('open');
12111
+ });
12112
+ } else if (opts == 'close' || opts == 'destroy') {
12113
+ dialog.stop(true);
12114
+ dialog.css('display') != 'none' && dialog.hide().trigger('close');
12115
+ opts == 'destroy' && dialog.remove();
12116
+ } else if (opts == 'toTop') {
12117
+ dialog.trigger('totop');
12118
+ } else if (opts == 'posInit') {
12119
+ dialog.trigger('posinit');
12120
+ } else if (opts == 'tabstopsInit') {
12121
+ dialog.trigger('tabstopsInit');
12122
+ }
12123
+ }
12124
+ return this;
12125
+ }
12126
+
12127
  opts = $.extend({}, $.fn.elfinderdialog.defaults, opts);
12128
+
12129
+ if (opts.allowMinimize && opts.allowMinimize === 'auto') {
12130
+ opts.allowMinimize = this.find('textarea,input').length? true : false;
12131
+ }
12132
+ if (opts.headerBtnPos && opts.headerBtnPos === 'auto') {
12133
+ opts.headerBtnPos = platformWin? 'right' : 'left';
12134
+ }
12135
+ if (opts.headerBtnOrder && opts.headerBtnOrder === 'auto') {
12136
+ opts.headerBtnOrder = platformWin? 'close:maximize:minimize' : 'close:minimize:maximize';
12137
+ }
12138
+
12139
+ if (opts.modal && opts.allowMinimize) {
12140
+ opts.allowMinimize = false;
12141
+ }
12142
+
12143
  this.filter(':not(.ui-dialog-content)').each(function() {
12144
  var self = $(this).addClass('ui-dialog-content ui-widget-content'),
 
12145
  clactive = 'elfinder-dialog-active',
12146
  cldialog = 'elfinder-dialog',
12147
  clnotify = 'elfinder-dialog-notify',
12148
  clhover = 'ui-state-hover',
12149
+ cltabstop = 'elfinder-tabstop',
12150
+ cl1stfocus = 'elfinder-focus',
12151
  id = parseInt(Math.random()*1000000),
12152
+ titlebar = $('<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span class="elfinder-dialog-title">'+opts.title+'</span></div>'),
12153
  buttonset = $('<div class="ui-dialog-buttonset"/>'),
12154
  buttonpane = $('<div class=" ui-helper-clearfix ui-dialog-buttonpane ui-widget-content"/>')
12155
  .append(buttonset),
12156
+ btnWidth = 0,
12157
+ btnCnt = 0,
12158
+ tabstops = $(),
12159
+ tabstopsInit = function() {
12160
+ tabstops = dialog.find('.'+cltabstop);
12161
+ if (tabstops.length) {
12162
+ tabstops.attr('tabindex', '-1');
12163
+ if (! tabstops.filter('.'+cl1stfocus).length) {
12164
+ buttonset.children('.'+cltabstop+':'+(platformWin? 'first' : 'last')).addClass(cl1stfocus);
12165
+ }
12166
+ }
12167
+ },
12168
+ tabstopNext = function(cur) {
12169
+ var elms = tabstops.filter(':visible'),
12170
+ node = cur? null : elms.filter('.'+cl1stfocus+':first');
12171
+
12172
+ if (! node || ! node.length) {
12173
+ node = elms.first();
12174
+ }
12175
+ if (cur) {
12176
+ $.each(elms, function(i, elm) {
12177
+ if (elm === cur && elms[i+1]) {
12178
+ node = elms.eq(i+1);
12179
+ return false;
12180
+ }
12181
+ });
12182
+ }
12183
+ return node;
12184
+ },
12185
+ tabstopPrev = function(cur) {
12186
+ var elms = tabstops.filter(':visible'),
12187
+ node = elms.last();
12188
+ $.each(elms, function(i, elm) {
12189
+ if (elm === cur && elms[i-1]) {
12190
+ node = elms.eq(i-1);
12191
+ return false;
12192
+ }
12193
+ });
12194
+ return node;
12195
+ },
12196
+ makeHeaderBtn = function() {
12197
+ $.each(opts.headerBtnOrder.split(':').reverse(), function(i, v) {
12198
+ headerBtns[v] && headerBtns[v]();
12199
+ })
12200
+ if (platformWin) {
12201
+ titlebar.children('.elfinder-titlebar-button').addClass('elfinder-titlebar-button-right');
12202
+ }
12203
+ },
12204
+ headerBtns = {
12205
+ close: function() {
12206
+ titlebar.prepend($('<span class="ui-widget-header ui-dialog-titlebar-close ui-corner-all elfinder-titlebar-button"><span class="ui-icon ui-icon-closethick"/></span>')
12207
+ .on('mousedown', function(e) {
12208
+ e.preventDefault();
12209
+ e.stopPropagation();
12210
+ self.elfinderdialog('close');
12211
+ })
12212
+ );
12213
+ },
12214
+ maximize: function() {
12215
+ if (opts.allowMaximize) {
12216
+ dialog.on('resize', function(e, data) {
12217
+ var full, elm;
12218
+ if (data && data.maximize) {
12219
+ elm = titlebar.find('.elfinder-titlebar-full');
12220
+ full = (data.maximize === 'on');
12221
+ elm.children('span.ui-icon')
12222
+ .toggleClass('ui-icon-plusthick', ! full)
12223
+ .toggleClass('ui-icon-arrowreturnthick-1-s', full);
12224
+ if (full) {
12225
+ try {
12226
+ dialog.hasClass('ui-draggable') && dialog.draggable('disable');
12227
+ dialog.hasClass('ui-resizable') && dialog.resizable('disable');
12228
+ } catch(e) {}
12229
+ if (typeof elm.data('style') === 'undefined') {
12230
+ elm.data('style', self.attr('style') || '');
12231
+ }
12232
+ self.css('width', '100%').css('height', dialog.height() - dialog.children('.ui-dialog-titlebar').outerHeight(true) - buttonpane.outerHeight(true));
12233
+ } else {
12234
+ self.attr('style', elm.data('style'));
12235
+ elm.removeData('style');
12236
+ try {
12237
+ dialog.hasClass('ui-draggable') && dialog.draggable('enable');
12238
+ dialog.hasClass('ui-resizable') && dialog.resizable('enable');
12239
+ } catch(e) {}
12240
+ }
12241
+ }
12242
+ });
12243
+ titlebar.prepend($('<span class="ui-widget-header ui-corner-all elfinder-titlebar-button elfinder-titlebar-full"><span class="ui-icon ui-icon-plusthick"/></span>')
12244
+ .on('mousedown', function(e) {
12245
+ e.preventDefault();
12246
+ e.stopPropagation();
12247
+ fm.toggleMaximize(dialog);
12248
+ })
12249
+ );
12250
+ }
12251
+
12252
+ },
12253
+ minimize: function() {
12254
+ if (opts.allowMinimize) {
12255
+ titlebar.on('dblclick', function(e) {
12256
+ $(this).children('.elfinder-titlebar-minimize').trigger('mousedown');
12257
+ })
12258
+ .prepend($('<span class="ui-widget-header ui-corner-all elfinder-titlebar-button elfinder-titlebar-minimize"><span class="ui-icon ui-icon-minusthick"/></span>')
12259
+ .on('mousedown', function(e) {
12260
+ var $this = $(this),
12261
+ pos, w;
12262
+
12263
+ e.preventDefault();
12264
+ e.stopPropagation();
12265
+ if (typeof $this.data('style') !== 'undefined') {
12266
+ elfNode.append(dialog);
12267
+ dialog.attr('style', $this.data('style'))
12268
+ .removeClass('elfinder-dialog-minimized')
12269
+ .off('mousedown.minimize');
12270
+ $this.removeData('style').show();
12271
+ titlebar.children('.elfinder-titlebar-full').show();
12272
+ dialog.children('.ui-widget-content').slideDown('fast', function() {
12273
+ if (this === dialog.children('.ui-widget-content:first').get(0)) {
12274
+ if (! dialog.hasClass('elfinder-maximized')) {
12275
+ try {
12276
+ dialog.hasClass('ui-draggable') && dialog.draggable('enable');
12277
+ dialog.hasClass('ui-resizable') && dialog.resizable('enable');
12278
+ } catch(e) {}
12279
+ }
12280
+ dialog.trigger('resize', { minimize: false });
12281
+ }
12282
+ });
12283
+ } else {
12284
+ try {
12285
+ dialog.hasClass('ui-draggable') && dialog.draggable('disable');
12286
+ dialog.hasClass('ui-resizable') && dialog.resizable('disable');
12287
+ } catch(e) {}
12288
+ $this.data('style', dialog.attr('style') || '').hide();
12289
+ titlebar.children('.elfinder-titlebar-full').hide();
12290
+ w = dialog.width();
12291
+ dialog.children('.ui-widget-content').slideUp('fast', function() {
12292
+ if (this === dialog.children('.ui-widget-content:first').get(0)) {
12293
+ dialog.attr('style', '').css({ maxWidth: w})
12294
+ .addClass('elfinder-dialog-minimized')
12295
+ .one('mousedown.minimize', function(e) {
12296
+ $this.trigger('mousedown');
12297
+ })
12298
+ .appendTo(fm.getUI('bottomtray'));
12299
+ dialog.trigger('resize', { minimize: true });
12300
+ }
12301
+ });
12302
+ }
12303
+ })
12304
+ );
12305
+ }
12306
+ }
12307
+ },
12308
+ dialog = $('<div class="ui-front ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable std42-dialog touch-punch '+cldialog+' '+opts.cssClass+'"/>')
12309
  .hide()
12310
  .append(self)
12311
+ .appendTo(elfNode)
12312
  .draggable({
12313
  handle : '.ui-dialog-titlebar',
12314
  containment : 'document',
12315
  stop : function(e, ui){
12316
  dialog.css({height : opts.height});
12317
+ self.data('draged', true);
12318
  }
12319
  })
12320
  .css({
12321
  width : opts.width,
12322
+ height : opts.height
 
 
12323
  })
12324
+ .on('mousedown', function(e) {
12325
+ if (! dialog.hasClass('ui-front')) {
12326
+ setTimeout(function() {
12327
+ dialog.is(':visible:not(.elfinder-dialog-minimized)') && dialog.trigger('totop');
12328
+ }, 10);
 
 
 
12329
  }
12330
  })
12331
  .on('open', function() {
12332
+ var d = $(this),
12333
+ maxWinWidth = (d.outerWidth() > elfNode.width()-10)? elfNode.width()-10 : null;
12334
 
12335
  maxWinWidth && d.css({width: maxWinWidth, left: '5px'});
 
 
 
 
12336
 
12337
  if (!dialog.hasClass(clnotify)) {
12338
+ elfNode.children('.'+cldialog+':visible:not(.'+clnotify+')').each(function() {
 
12339
  var d = $(this),
12340
  top = parseInt(d.css('top')),
12341
  left = parseInt(d.css('left')),
12351
  }
12352
  });
12353
  }
 
 
 
 
12354
 
12355
+ dialog.data('modal') && fm.getUI('overlay').elfinderoverlay('show');
12356
 
12357
+ dialog.trigger('totop');
12358
+
12359
+ typeof(opts.open) == 'function' && $.proxy(opts.open, self[0])();
12360
+
12361
+ fm.UA.Mobile && tabstopNext().focus();
12362
+
12363
+ if (opts.closeOnEscape) {
12364
+ $(document).on('keyup.'+id, function(e) {
12365
+ if (e.keyCode == $.ui.keyCode.ESCAPE && dialog.hasClass(clactive)) {
12366
+ self.elfinderdialog('close');
12367
  }
12368
  })
12369
+ }
12370
+ })
12371
+ .on('close', function() {
12372
+ var dialogs;
12373
+
12374
+ if (opts.closeOnEscape) {
12375
+ $(document).off('keyup.'+id);
12376
+ }
12377
+
12378
+ if (opts.allowMaximize) {
12379
+ fm.toggleMaximize(dialog, false);
12380
  }
12381
 
12382
+ dialog.data('modal') && fm.getUI('overlay').elfinderoverlay('hide');
12383
+
12384
  if (typeof(opts.close) == 'function') {
12385
  $.proxy(opts.close, self[0])();
12386
  } else if (opts.destroyOnClose) {
12387
  dialog.hide().remove();
12388
  }
12389
+
12390
+ // get focus to next dialog
12391
+ dialogs = elfNode.children('.'+cldialog+':visible');
12392
+ if (dialogs.length) {
12393
+ dialogs.filter(':last').trigger('totop');
12394
+ } else {
12395
+ setTimeout(function() {
12396
+ // return focus to elfNode
12397
+ fm.enable();
12398
+ }, 20);
12399
+ }
12400
  })
12401
  .on('totop', function() {
12402
+ if (dialog.hasClass('elfinder-dialog-minimized')) {
12403
+ titlebar.children('.elfinder-titlebar-minimize').trigger('mousedown');
12404
+ }
12405
+
12406
+ fm.toFront(dialog);
12407
+ elfNode.children('.'+cldialog).removeClass(clactive+' ui-front');
12408
+ dialog.addClass(clactive+' ui-front');
12409
+
12410
+ ! fm.UA.Mobile && tabstopNext().focus();
12411
  })
12412
  .on('posinit', function() {
12413
  var css = opts.position;
12414
+ if (! css && ! dialog.data('resizing')) {
12415
  css = {
12416
+ top : Math.max(0, parseInt((elfNode.height() - dialog.outerHeight())/2 - 42))+'px',
12417
+ left : Math.max(0, parseInt((elfNode.width() - dialog.outerWidth())/2))+'px'
12418
  };
12419
  }
12420
+ css && dialog.css(css);
12421
+ })
12422
+ .on('resize', function(e, data) {
12423
+ if (typeof(opts.resize) === 'function') {
12424
+ $.proxy(opts.resize, self[0])(e, data);
12425
+ }
12426
+ })
12427
+ .on('tabstopsInit', tabstopsInit)
12428
+ .on('focus', '.'+cltabstop, function() {
12429
+ $(this).addClass(clhover).parent('label').addClass(clhover);
12430
+ this.id && $(this).parent().find('label[for='+this.id+']').addClass(clhover);
12431
+ })
12432
+ .on('blur', '.'+cltabstop, function() {
12433
+ $(this).removeClass(clhover).parent('label').removeClass(clhover);
12434
+ this.id && $(this).parent().find('label[for='+this.id+']').removeClass(clhover);
12435
+ })
12436
+ .on('mouseenter mouseleave', '.'+cltabstop, function(e) {
12437
+ var $this = $(this);
12438
+ if (opts.btnHoverFocus) {
12439
+ if (e.type == 'mouseenter') {
12440
+ $this.focus();
12441
+ }
12442
+ } else {
12443
+ $this.toggleClass(clhover, e.type == 'mouseenter');
12444
+ }
12445
  })
12446
+ .on('keydown', '.'+cltabstop, function(e) {
12447
+ var $this = $(this);
12448
+ if ($this.is(':focus')) {
12449
+ e.stopPropagation();
12450
+ if (e.keyCode == $.ui.keyCode.ENTER) {
12451
+ e.preventDefault();
12452
+ $this.click();
12453
+ } else if ((e.keyCode == $.ui.keyCode.TAB && e.shiftKey) || e.keyCode == $.ui.keyCode.LEFT || e.keyCode == $.ui.keyCode.UP) {
12454
+ if ($this.is('input:text') && (!(e.ctrlKey || e.metaKey) && e.keyCode == $.ui.keyCode.LEFT)) {
12455
+ return;
12456
+ }
12457
+ if ($this.is('select') && e.keyCode != $.ui.keyCode.TAB) {
12458
+ return;
12459
+ }
12460
+ if ($this.is('textarea') && !(e.ctrlKey || e.metaKey)) {
12461
+ return;
12462
+ }
12463
+ e.preventDefault();
12464
+ tabstopPrev(this).focus();
12465
+ } else if (e.keyCode == $.ui.keyCode.TAB || e.keyCode == $.ui.keyCode.RIGHT || e.keyCode == $.ui.keyCode.DOWN) {
12466
+ if ($this.is('input:text') && (!(e.ctrlKey || e.metaKey) && e.keyCode == $.ui.keyCode.RIGHT)) {
12467
+ return;
12468
+ }
12469
+ if ($this.is('select') && e.keyCode != $.ui.keyCode.TAB) {
12470
+ return;
12471
+ }
12472
+ if ($this.is('textarea') && !(e.ctrlKey || e.metaKey)) {
12473
+ return;
12474
  }
12475
+ e.preventDefault();
12476
+ tabstopNext(this).focus();
12477
  }
12478
+ }
12479
+ })
12480
+ .data({modal: opts.modal})
 
12481
  ;
12482
 
12483
  dialog.trigger('posinit');
12484
 
12485
+ dialog.prepend(titlebar);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12486
 
12487
+ makeHeaderBtn();
 
12488
 
 
12489
  $.each(opts.buttons, function(name, cb) {
12490
+ var button = $('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only '
12491
+ +'elfinder-btncnt-'+(btnCnt++)+' '
12492
+ +cltabstop
12493
+ +'"><span class="ui-button-text">'+name+'</span></button>')
12494
+ .on('click', $.proxy(cb, self[0]));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12495
  if (platformWin) {
12496
  buttonset.append(button);
12497
  } else {
12498
  buttonset.prepend(button);
12499
  }
12500
+ });
12501
+
12502
+ if (buttonset.children().length) {
12503
+ dialog.append(buttonpane);
12504
+
12505
+ dialog.show();
12506
+ buttonpane.find('button').each(function(i, btn) {
12507
+ btnWidth += $(btn).outerWidth(true);
12508
+ });
12509
+ dialog.hide();
12510
+ btnWidth += 20;
12511
 
12512
+ if (dialog.width() < btnWidth) {
12513
+ dialog.width(btnWidth);
12514
+ }
12515
+ }
12516
+
12517
  if (opts.resizable && $.fn.resizable) {
12518
  dialog.resizable({
12519
+ minWidth : opts.minWidth,
12520
+ minHeight : opts.minHeight,
12521
+ alsoResize : this,
12522
+ start : function() {
12523
+ if (dialog.data('resizing') !== true && dialog.data('resizing')) {
12524
+ clearTimeout(dialog.data('resizing'));
12525
+ }
12526
+ dialog.data('resizing', true);
12527
+ },
12528
+ stop : function() {
12529
+ dialog.data('resizing', setTimeout(function() {
12530
+ dialog.data('resizing', false);
12531
+ }, 200));
12532
+ }
12533
+ });
12534
  }
12535
 
12536
  typeof(opts.create) == 'function' && $.proxy(opts.create, this)();
12537
 
12538
+ tabstopsInit();
12539
+
12540
  opts.autoOpen && self.elfinderdialog('open');
12541
 
12542
  });
12543
 
12544
  return this;
12545
+ };
12546
 
12547
  $.fn.elfinderdialog.defaults = {
12548
  cssClass : '',
12558
  width : 320,
12559
  height : 'auto',
12560
  minWidth : 200,
12561
+ minHeight : 110,
12562
+ allowMinimize : 'auto',
12563
+ allowMaximize : false,
12564
+ headerBtnPos : 'auto',
12565
+ headerBtnOrder : 'auto'
12566
+ };
12567
+
12568
+
12569
+ /*
12570
+ * File: /js/ui/fullscreenbutton.js
12571
+ */
12572
+
12573
+ /**
12574
+ * @class elFinder toolbar button to switch full scrren mode.
12575
+ *
12576
+ * @author Naoki Sawada
12577
+ **/
12578
+
12579
+ $.fn.elfinderfullscreenbutton = function(cmd) {
12580
+ return this.each(function() {
12581
+ var button = $(this).elfinderbutton(cmd),
12582
+ icon = button.children('.elfinder-button-icon');
12583
+ cmd.change(function() {
12584
+ var fullscreen = cmd.value;
12585
+ icon.toggleClass('elfinder-button-icon-unfullscreen', fullscreen);
12586
+ button.attr('title', fullscreen? cmd.fm.i18n('reinstate') : cmd.fm.i18n('cmdfullscreen'));
12587
+ cmd.className = fullscreen? 'unfullscreen' : '';
12588
+ cmd.title = cmd.fm.i18n(fullscreen ? 'reinstate' : 'cmdfullscreen');
12589
+ });
12590
+ });
12591
+ };
12592
+
12593
+
12594
+ /*
12595
+ * File: /js/ui/mkdirbutton.js
12596
+ */
12597
+
12598
+ /**
12599
+ * @class elFinder toolbar button to switch mkdir mode.
12600
+ *
12601
+ * @author Naoki Sawada
12602
+ **/
12603
+ $.fn.elfindermkdirbutton = function(cmd) {
12604
+ return this.each(function() {
12605
+ var button = $(this).elfinderbutton(cmd);
12606
+
12607
+ cmd.change(function() {
12608
+ button.attr('title', cmd.value);
12609
+ });
12610
+ });
12611
+ };
12612
+
12613
 
12614
  /*
12615
  * File: /js/ui/navbar.js
12623
  $.fn.elfindernavbar = function(fm, opts) {
12624
 
12625
  this.not('.elfinder-navbar').each(function() {
12626
+ var nav = $(this).hide().addClass('ui-state-default elfinder-navbar'),
12627
+ parent = nav.parent(),
 
 
 
12628
  wz = parent.children('.elfinder-workzone').append(nav),
12629
  delta = nav.outerHeight() - nav.height(),
12630
  ltr = fm.direction == 'ltr',
12631
+ handle, swipeHandle, autoHide, setWidth,
12632
+ setWzRect = function() {
12633
+ var cwd = fm.getUI('cwd'),
12634
+ wz = fm.getUI('workzone'),
12635
+ wzRect = wz.data('rectangle'),
12636
+ cwdOffset = cwd.offset();
12637
+ wz.data('rectangle', $.extend(wzRect, { cwdEdge: (fm.direction === 'ltr')? cwdOffset.left : cwdOffset.left + cwd.width() }));
12638
+ };
12639
 
12640
+ fm.bind('wzresize', function() {
12641
+ nav.height(wz.height() - delta);
12642
+ });
12643
+
12644
+ if (fm.UA.Touch) {
12645
+ autoHide = fm.storage('autoHide') || {};
12646
+ if (typeof autoHide.navbar === 'undefined') {
12647
+ autoHide.navbar = (opts.autoHideUA && opts.autoHideUA.length > 0 && $.map(opts.autoHideUA, function(v){ return fm.UA[v]? true : null; }).length);
12648
+ fm.storage('autoHide', autoHide);
12649
+ }
12650
+
12651
+ if (autoHide.navbar) {
12652
+ fm.one('init', function() {
12653
+ fm.uiAutoHide.push(function(){ nav.stop(true, true).trigger('navhide', { duration: 'slow', init: true }); });
12654
+ });
12655
+ }
12656
+
12657
+ fm.bind('load', function() {
12658
+ swipeHandle = $('<div class="elfinder-navbar-swipe-handle"/>').hide().appendTo(wz);
12659
+ if (swipeHandle.css('pointer-events') !== 'none') {
12660
+ swipeHandle.remove();
12661
+ swipeHandle = null;
12662
+ }
12663
+ });
12664
+
12665
+ nav.on('navshow navhide', function(e, data) {
12666
+ var mode = (e.type === 'navshow')? 'show' : 'hide',
12667
+ duration = (data && data.duration)? data.duration : 'fast',
12668
+ handleW = (data && data.handleW)? data.handleW : Math.max(50, fm.getUI().width() / 10);
12669
+ nav.stop(true, true)[mode](duration, function() {
12670
+ if (mode === 'show') {
12671
+ swipeHandle && swipeHandle.stop(true, true).hide();
12672
+ } else {
12673
+ if (swipeHandle) {
12674
+ swipeHandle.width(handleW? handleW : '');
12675
+ fm.resources.blink(swipeHandle, 'slowonce');
12676
+ }
12677
+ }
12678
+ fm.trigger('navbar'+ mode).getUI('cwd').trigger('resize');
12679
+ data.init && fm.trigger('uiautohide');
12680
+ setWzRect();
12681
+ });
12682
+ autoHide.navbar = (mode !== 'show');
12683
+ fm.storage('autoHide', $.extend(fm.storage('autoHide'), {navbar: autoHide.navbar}));
12684
+ });
12685
+ }
12686
 
12687
+ if ($.fn.resizable && ! fm.UA.Mobile) {
12688
  handle = nav.resizable({
12689
  handles : ltr ? 'e' : 'w',
12690
  minWidth : opts.minWidth || 150,
12691
+ maxWidth : opts.maxWidth || 500,
12692
+ stop : function(e, ui) {
12693
+ fm.storage('navbarWidth', ui.size.width);
12694
+ setWzRect();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12695
  }
 
 
 
 
 
12696
  })
12697
+ .on('resize scroll', function(e) {
12698
+ if (! ltr && e.type === 'resize') {
12699
+ nav.css('left', 0);
12700
+ }
12701
+ clearTimeout($(this).data('posinit'));
12702
+ $(this).data('posinit', setTimeout(function() {
12703
+ var offset = (fm.UA.Opera && nav.scrollLeft())? 20 : 2;
12704
+ handle.css({
12705
+ top : parseInt(nav.scrollTop())+'px',
12706
+ left : ltr ? 'auto' : parseInt(nav.scrollLeft() + offset),
12707
+ right: ltr ? parseInt(nav.scrollLeft() - offset) * -1 : 'auto'
12708
+ });
12709
+ if (e.type === 'resize') {
12710
+ fm.getUI('cwd').trigger('resize');
 
 
 
 
12711
  }
12712
+ }, 50));
12713
+ })
12714
+ .find('.ui-resizable-handle').addClass('ui-front');
 
12715
 
12716
  fm.one('open', function() {
12717
  setTimeout(function() {
12719
  }, 150);
12720
  });
12721
  }
12722
+
12723
+ if (setWidth = fm.storage('navbarWidth')) {
12724
+ nav.width(setWidth);
12725
+ } else {
12726
+ if (fm.UA.Mobile) {
12727
+ nav.data('defWidth', nav.width());
12728
+ $(window).on('resize.' + fm.namespace, function(e){
12729
+ setWidth = nav.parent().width() / 2;
12730
+ if (nav.data('defWidth') > setWidth) {
12731
+ nav.width(setWidth);
12732
+ } else {
12733
+ nav.width(nav.data('defWidth'));
12734
+ }
12735
+ nav.data('width', nav.width());
12736
+ });
12737
+ }
12738
+ }
12739
+
12740
  });
12741
 
12742
  return this;
12750
 
12751
  $.fn.elfinderoverlay = function(opts) {
12752
 
12753
+ var fm = this.parent().elfinder('instance');
12754
+
12755
  this.filter(':not(.elfinder-overlay)').each(function() {
12756
  opts = $.extend({}, opts);
12757
+ $(this).addClass('ui-front ui-widget-overlay elfinder-overlay')
12758
  .hide()
12759
  .mousedown(function(e) {
12760
  e.preventDefault();
12772
  cnt = o.data('cnt') + 1,
12773
  show = o.data('show');
12774
 
12775
+ fm.toFront(o);
12776
  o.data('cnt', cnt);
12777
 
12778
  if (o.is(':hidden')) {
 
12779
  o.show();
12780
  show();
12781
  }
12788
 
12789
  o.data('cnt', cnt);
12790
 
12791
+ if (cnt <= 0) {
12792
  o.hide();
12793
+ hide();
12794
  }
12795
  }
12796
 
12797
  return this;
12798
+ };
12799
+
12800
 
12801
  /*
12802
  * File: /js/ui/panel.js
12817
  })
12818
  })
12819
  })
12820
+ };
12821
+
12822
 
12823
  /*
12824
  * File: /js/ui/path.js
12836
  var query = '',
12837
  target = '',
12838
  mimes = [],
12839
+ place = 'statusbar',
12840
+ clHover= fm.res('class', 'hover'),
12841
+ prefix = 'path' + (elFinder.prototype.uniqueid? elFinder.prototype.uniqueid : '') + '-',
12842
+ wzbase = $('<div class="ui-widget-header ui-helper-clearfix elfinder-workzone-path"/>'),
12843
  path = $(this).addClass('elfinder-path').html('&nbsp;')
12844
+ .on('mousedown', 'span.elfinder-path-dir', function(e) {
12845
+ var hash = $(this).attr('id').substr(prefix.length);
 
12846
  e.preventDefault();
12847
  if (hash != fm.cwd().hash) {
12848
+ $(this).addClass(clHover);
12849
  if (query) {
12850
  fm.exec('search', query, { target: hash, mime: mimes.join(' ') });
12851
  } else {
12853
  }
12854
  }
12855
  })
12856
+ .prependTo(fm.getUI('statusbar').show()),
12857
+ roots = $('<div class="elfinder-path-roots"/>').on('click', function(e) {
12858
+ e.stopPropagation();
12859
+ e.preventDefault();
12860
+
12861
+ var roots = $.map(fm.roots, function(h) { return fm.file(h)}),
12862
+ raw = [];
12863
+
12864
+ $.each(roots, function(i, f) {
12865
+ if (! f.phash && fm.root(fm.cwd().hash, true) !== f.hash) {
12866
+ raw.push({
12867
+ label : fm.escape(f.i18 || f.name),
12868
+ icon : 'home',
12869
+ remain : true,
12870
+ callback : function() { fm.exec('open', f.hash); },
12871
+ options : {
12872
+ iconClass : f.csscls || '',
12873
+ iconImg : f.icon || ''
12874
+ }
12875
+ });
12876
+ }
12877
+ });
12878
+ fm.trigger('contextmenu', {
12879
+ raw: raw,
12880
+ x: e.pageX,
12881
+ y: e.pageY
12882
+ });
12883
+ }).append('<span class="elfinder-button-icon elfinder-button-icon-menu" />').appendTo(wzbase),
12884
+ render = function(cwd) {
12885
+ var dirs = [];
12886
+ $.each(fm.parents(cwd), function(i, hash) {
12887
+ var c = (cwd === hash)? 'elfinder-path-dir elfinder-path-cwd' : 'elfinder-path-dir',
12888
+ f = fm.file(hash),
12889
+ name = fm.escape(f.i18 || f.name);
12890
+ dirs.push('<span id="'+prefix+hash+'" class="'+c+'" title="'+name+'">'+name+'</span>');
12891
+ });
12892
+ return dirs.join('<span class="elfinder-path-other">'+fm.option('separator')+'</span>');
12893
+ },
12894
+ toWorkzone = function() {
12895
+ var prev;
12896
+ path.children('span.elfinder-path-dir').attr('style', '');
12897
+ prev = fm.direction === 'ltr'? $('#'+prefix + fm.cwd().hash).prevAll('span.elfinder-path-dir:first') : $();
12898
+ path.scrollLeft(prev.length? prev.position().left : 0);
12899
+ },
12900
+ fit = function() {
12901
+ var dirs = path.children('span.elfinder-path-dir'),
12902
+ cnt = dirs.length,
12903
+ m, bg = 0, ids;
12904
+
12905
+ if (place === 'workzone' || cnt < 2) {
12906
+ dirs.attr('style', '');
12907
+ return;
12908
+ }
12909
+ path.width(path.css('max-width'));
12910
+ dirs.css({maxWidth: (100/cnt)+'%', display: 'inline-block'});
12911
+ m = path.width() - 9;
12912
+ path.children('span.elfinder-path-other').each(function() {
12913
+ m -= $(this).width();
12914
+ });
12915
+ ids = [];
12916
+ dirs.each(function(i) {
12917
+ var dir = $(this),
12918
+ w = dir.width();
12919
+ m -= w;
12920
+ if (w < this.scrollWidth) {
12921
+ ids.push(i);
12922
+ }
12923
+ });
12924
+ path.width('');
12925
+ if (ids.length) {
12926
+ if (m > 0) {
12927
+ m = m / ids.length;
12928
+ $.each(ids, function(i, k) {
12929
+ var d = $(dirs[k]);
12930
+ d.css('max-width', d.width() + m);
12931
+ });
12932
+ }
12933
+ dirs.last().attr('style', '');
12934
+ } else {
12935
+ dirs.attr('style', '');
12936
+ }
12937
+ };
12938
 
12939
  fm.bind('open searchend parents', function() {
12940
  var dirs = [];
12943
  target = '';
12944
  mimes = [];
12945
 
12946
+ path.html(render(fm.cwd().hash));
12947
+ if (Object.keys(fm.roots).length > 1) {
12948
+ path.css('margin', '');
12949
+ roots.show();
12950
+ } else {
12951
+ path.css('margin', 0);
12952
+ roots.hide();
12953
+ }
12954
+ fit();
12955
  })
12956
  .bind('searchstart', function(e) {
12957
  if (e.data) {
12964
  var dirs = [],
12965
  html = '';
12966
  if (target) {
12967
+ html = render(target);
 
 
 
12968
  } else {
12969
  html = fm.i18n('btnAll');
12970
  }
12971
+ path.html('<span class="elfinder-path-other">'+fm.i18n('searcresult') + ': </span>' + html);
12972
+ fit();
12973
+ })
12974
+ // on swipe to navbar show/hide
12975
+ .bind('navbarshow navbarhide', function(e) {
12976
+ var wz = fm.getUI('workzone');
12977
+ if (e.type === 'navbarshow') {
12978
+ wz.height(wz.height() + wzbase.outerHeight());
12979
+ path.prependTo(fm.getUI('statusbar'));
12980
+ wzbase.detach();
12981
+ place = 'statusbar';
12982
+ fm.unbind('open', toWorkzone);
12983
+ } else {
12984
+ wzbase.append(path).insertBefore(wz);
12985
+ wz.height(wz.height() - wzbase.outerHeight());
12986
+ place = 'workzone';
12987
+ toWorkzone();
12988
+ fm.bind('open', toWorkzone);
12989
+ }
12990
+ fm.trigger('uiresize');
12991
+ })
12992
+ .bind('resize', fit);
12993
  });
12994
+ };
12995
+
12996
 
12997
  /*
12998
  * File: /js/ui/places.js
13039
  * @return void
13040
  **/
13041
  save = function() {
13042
+ var hashes = [], data = {};
13043
 
13044
  hashes = $.map(subtree.children().find('[id]'), function(n) {
13045
  return id2hash(n.id);
13046
  });
13047
+ if (hashes.length) {
13048
+ $.each(hashes.reverse(), function(i, h) {
13049
+ data[h] = dirs[h];
13050
+ });
13051
+ } else {
13052
+ data = null;
13053
+ }
13054
 
13055
+ fm.storage(key, data);
13056
  },
13057
  /**
13058
  * Return node for given dir object
13062
  **/
13063
  create = function(dir, hash) {
13064
  return $(tpl.replace(/\{id\}/, hash2id(dir? dir.hash : hash))
13065
+ .replace(/\{name\}/, fm.escape(dir? dir.i18 || dir.name : hash))
13066
+ .replace(/\{cssclass\}/, dir? (fm.perms2class(dir) + (dir.notfound? ' elfinder-na' : '') + (dir.csscls? ' '+dir.csscls : '')) : '')
13067
+ .replace(/\{permissions\}/, (dir && (!dir.read || !dir.write || dir.notfound))? ptpl : '')
13068
  .replace(/\{title\}/, (dir && dir.path)? fm.escape(dir.path) : '')
13069
  .replace(/\{symlink\}/, '')
13070
  .replace(/\{style\}/, ''));
13088
  }
13089
 
13090
  node = create(dir, hash);
 
 
 
13091
 
13092
  dirs[hash] = dir;
13093
  subtree.prepend(node);
13094
  root.addClass(collapsed);
13095
+ sortBtn.toggle(subtree.children().length > 1);
13096
 
13097
  return true;
13098
  },
13103
  * @return String removed name
13104
  **/
13105
  remove = function(hash) {
13106
+ var name = null, tgt, cnt;
13107
 
13108
  if (dirs[hash]) {
13109
  delete dirs[hash];
13111
  if (tgt.length) {
13112
  name = tgt.text();
13113
  tgt.parent().remove();
13114
+ cnt = subtree.children().length;
13115
+ sortBtn.toggle(cnt > 1);
13116
+ if (! cnt) {
13117
  root.removeClass(collapsed);
13118
  places.removeClass(expanded);
13119
  subtree.slideToggle(false);
13169
  node = create(dir, hash);
13170
 
13171
  if (tgt.length > 0) {
 
 
 
13172
  tgt.parent().replaceWith(node);
13173
  dirs[hash] = dir;
13174
  return true
13203
  if (subtree.children().length) {
13204
  $.each(subtree.children(), function() {
13205
  var current = $(this);
13206
+ if ((dir.i18 || dir.name).localeCompare(current.children('.'+navdir).text()) < 0) {
13207
  ret = !node.insertBefore(current);
13208
  return ret;
13209
  }
13216
  });
13217
  save();
13218
  },
13219
+ // sort button
13220
+ sortBtn = $('<span class="elfinder-button-icon elfinder-button-icon-sort elfinder-places-root-icon" title="'+fm.i18n('cmdsort')+'"/>')
13221
+ .hide()
13222
+ .on('click', function(e) {
13223
+ e.stopPropagation();
13224
+ subtree.empty();
13225
+ sort();
13226
+ }
13227
+ ),
13228
  /**
13229
  * Node - wrapper for places root
13230
  *
13248
  if (root.hasClass(collapsed)) {
13249
  places.toggleClass(expanded);
13250
  subtree.slideToggle();
13251
+ fm.storage('placesState', places.hasClass(expanded)? 1 : 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13252
  }
13253
+ })
13254
+ .append(sortBtn),
13255
+ /**
13256
+ * Container for dirs
13257
+ *
13258
+ * @type jQuery
13259
+ **/
13260
+ subtree = wrapper.children('.'+fm.res(c, 'navsubtree')),
13261
+
13262
  /**
13263
  * Main places container
13264
  *
13277
  e.stopPropagation();
13278
  return;
13279
  }
13280
+ ! p.hasClass('elfinder-na') && fm.exec('open', p.attr('id').substr(6));
13281
  })
13282
  .on('contextmenu', '.'+navdir+':not(.'+clroot+')', function(e) {
13283
  var self = $(this),
13314
  tolerance : 'pointer',
13315
  accept : '.elfinder-cwd-file-wrapper,.elfinder-tree-dir,.elfinder-cwd-file',
13316
  hoverClass : fm.res('class', 'adroppable'),
13317
+ classes : { // Deprecated hoverClass jQueryUI>=1.12.0
13318
+ 'ui-droppable-hover': fm.res('class', 'adroppable')
13319
+ },
13320
  over : function(e, ui) {
13321
  var helper = ui.helper,
13322
  dir = $.map(helper.data('files'), function(h) { return (fm.file(h).mime === 'directory' && !dirs[h])? h : null});
13323
  e.stopPropagation();
13324
  helper.data('dropover', helper.data('dropover') + 1);
13325
+ if (fm.insideWorkzone(e.pageX, e.pageY)) {
13326
+ if (dir.length > 0) {
13327
+ helper.addClass('elfinder-drag-helper-plus');
13328
+ fm.trigger('unlockfiles', {files : helper.data('files'), helper: helper});
13329
+ } else {
13330
+ $(this).removeClass(dropover);
13331
+ }
13332
  }
 
13333
  },
13334
  out : function(e, ui) {
13335
+ var helper = ui.helper,
13336
+ ctr = (e.shiftKey||e.ctrlKey||e.metaKey);
13337
  e.stopPropagation();
13338
+ helper.toggleClass('elfinder-drag-helper-move elfinder-drag-helper-plus', helper.data('locked')? true : ctr).data('dropover', Math.max(helper.data('dropover') - 1, 0));
13339
  $(this).removeData('dropover')
13340
  .removeClass(dropover);
13341
+ fm.trigger(ctr? 'unlockfiles' : 'lockfiles', {files : helper.data('files'), helper: helper});
13342
  },
13343
  drop : function(e, ui) {
13344
  var helper = ui.helper,
13359
  })
13360
  // for touch device
13361
  .on('touchstart', '.'+navdir+':not(.'+clroot+')', function(e) {
13362
+ if (e.originalEvent.touches.length > 1) {
13363
+ return;
13364
+ }
13365
  var hash = $(this).attr('id').substr(6),
13366
  p = $(this)
13367
  .addClass(hover)
13387
  }
13388
  });
13389
 
13390
+ if ($.fn.sortable) {
13391
+ subtree.addClass('touch-punch')
13392
+ .sortable({
13393
+ appendTo : fm.getUI(),
13394
+ revert : false,
13395
+ helper : function(e) {
13396
+ var dir = $(e.target).parent();
13397
+
13398
+ dir.children().removeClass('ui-state-hover');
13399
+
13400
+ return $('<div class="ui-widget elfinder-place-drag elfinder-'+fm.direction+'"/>')
13401
+ .append($('<div class="elfinder-navbar"/>').show().append(dir.clone()));
13402
+
13403
+ },
13404
+ stop : function(e, ui) {
13405
+ var target = $(ui.item[0]),
13406
+ top = places.offset().top,
13407
+ left = places.offset().left,
13408
+ width = places.width(),
13409
+ height = places.height(),
13410
+ x = e.pageX,
13411
+ y = e.pageY;
13412
+
13413
+ if (!(x > left && x < left+width && y > top && y < y+height)) {
13414
+ remove(id2hash(target.children(':first').attr('id')));
13415
+ save();
13416
+ }
13417
+ },
13418
+ update : function(e, ui) {
13419
+ save();
13420
+ }
13421
+ });
13422
+ }
13423
+
13424
  // "on regist" for command exec
13425
  $(this).on('regist', function(e, files){
13426
  var added = false;
13446
  places.show().parent().show();
13447
 
13448
  dirs = {};
13449
+ dat = fm.storage(key);
13450
+ if (typeof dat === 'string') {
13451
+ // old data type elFinder <= 2.1.12
13452
+ dat = $.map(dat.split(','), function(hash) { return hash || null;});
13453
+ $.each(dat, function(i, d) {
13454
+ var dir = d.split('#')
13455
+ dirs[dir[0]] = dir[1]? dir[1] : dir[0];
13456
+ });
13457
+ } else if ($.isPlainObject(dat)) {
13458
+ dirs = dat;
13459
+ }
13460
+ // allow modify `dirs`
13461
+ /**
13462
+ * example for preset places
13463
+ *
13464
+ * elfinderInstance.bind('placesload', function(e, fm) {
13465
+ * //if (fm.storage(e.data.storageKey) === null) { // for first time only
13466
+ * if (!fm.storage(e.data.storageKey)) { // for empty places
13467
+ * e.data.dirs[targetHash] = fallbackName; // preset folder
13468
+ * }
13469
+ * }
13470
+ **/
13471
+ fm.trigger('placesload', {dirs: dirs, storageKey: key}, true);
13472
 
13473
  hashes = Object.keys(dirs);
13474
  if (hashes.length) {
13485
  exists[hash] = f;
13486
  });
13487
  $.each(dirs, function(h, f) {
13488
+ add(exists[h] || $.extend({notfound: true}, f));
13489
  });
13490
  if (fm.storage('placesState') > 0) {
13491
  root.click();
13548
  }
13549
  changed && save();
13550
  })
13551
+ .bind('sync netmount', function(e) {
13552
  var hashes = Object.keys(dirs);
13553
  if (hashes.length) {
13554
  root.prepend(spinner);
13571
  });
13572
  $.each(dirs, function(h, f) {
13573
  if (!f.notfound != !!exists[h]) {
13574
+ if ((f.phash === cwd && e.type !== 'netmount') || (exists[h] && exists[h].mime !== 'directory')) {
13575
  if (remove(h)) {
13576
  updated = true;
13577
  }
13578
  } else {
13579
+ if (update(exists[h] || $.extend({notfound: true}, f))) {
13580
  updated = true;
13581
  }
13582
  }
13583
+ } else if (exists[h] && exists[h].phash != cwd) {
13584
+ // update permission of except cwd
13585
+ update(exists[h]);
13586
  }
13587
  });
13588
  updated && save();
13596
  })
13597
 
13598
  });
13599
+ };
13600
 
13601
 
13602
  /*
13612
  return this.each(function() {
13613
  var result = false,
13614
  fm = cmd.fm,
13615
+ isopts = cmd.options.incsearch || { enable: false },
13616
  id = function(name){return fm.namespace + name},
13617
  toolbar= fm.getUI('toolbar'),
13618
  btnCls = fm.res('class', 'searchbtn'),
13619
  button = $(this).hide().addClass('ui-widget-content elfinder-button '+btnCls),
13620
  search = function() {
13621
+ input.data('inctm') && clearTimeout(input.data('inctm'));
13622
+ opts && opts.slideUp();
13623
  var val = $.trim(input.val()),
13624
  from = !$('#' + id('SearchFromAll')).prop('checked'),
13625
  mime = $('#' + id('SearchMime')).prop('checked');
13638
  cmd.exec(val, from, mime).done(function() {
13639
  result = true;
13640
  input.focus();
13641
+ }).fail(function() {
13642
+ abort();
13643
  });
13644
 
13645
  } else {
13647
  }
13648
  },
13649
  abort = function() {
13650
+ input.data('inctm') && clearTimeout(input.data('inctm'));
13651
+ input.val('').blur();
13652
+ if (result || incVal) {
13653
  result = false;
13654
+ incVal = '';
13655
+ fm.lazy(function() {
13656
+ fm.trigger('searchend');
13657
+ });
13658
  }
13659
  },
13660
+ incVal = '',
13661
  input = $('<input type="text" size="42"/>')
13662
+ .on('focus', function() {
13663
+ incVal = '';
13664
+ opts && opts.slideDown();
13665
  })
13666
+ .on('blur', function(){
13667
+ if (opts) {
13668
+ if (!opts.data('infocus')) {
13669
+ opts.slideUp();
13670
+ } else {
13671
+ opts.data('infocus', false);
13672
+ }
13673
  }
13674
  })
13675
  .appendTo(button)
13676
  // to avoid fm shortcuts on arrows
13677
+ .on('keypress', function(e) {
13678
  e.stopPropagation();
13679
  })
13680
+ .on('keydown', function(e) {
13681
  e.stopPropagation();
13682
 
13683
+ e.keyCode == $.ui.keyCode.ENTER && search();
13684
 
13685
+ if (e.keyCode == $.ui.keyCode.ESCAPE) {
13686
  e.preventDefault();
13687
  abort();
13688
  }
13689
  }),
13690
+ opts;
13691
+
13692
+ if (isopts.enable) {
13693
+ isopts.minlen = isopts.minlen || 2;
13694
+ isopts.wait = isopts.wait || 500;
13695
+ input
13696
+ .attr('title', fm.i18n('incSearchOnly'))
13697
+ .on('compositionstart', function() {
13698
+ input.data('composing', true);
13699
+ })
13700
+ .on('compositionend', function() {
13701
+ input.removeData('composing');
13702
+ input.trigger('input'); // for IE, edge
13703
+ })
13704
+ .on('input', function() {
13705
+ if (! input.data('composing')) {
13706
+ input.data('inctm') && clearTimeout(input.data('inctm'));
13707
+ input.data('inctm', setTimeout(function() {
13708
+ var val = input.val();
13709
+ if (val.length === 0 || val.length >= isopts.minlen) {
13710
+ (incVal !== val) && fm.trigger('incsearchstart', { query: val });
13711
+ incVal = val;
13712
+ if (val === '' && fm.searchStatus.state > 1 && fm.searchStatus.query) {
13713
+ input.val(fm.searchStatus.query).select();
13714
+ }
13715
+ }
13716
+ }, isopts.wait));
13717
+ }
13718
+ });
13719
+
13720
+ if (fm.UA.ltIE8) {
13721
+ input.on('keydown', function(e) {
13722
+ if (e.keyCode === 229) {
13723
+ input.data('imetm') && clearTimeout(input.data('imetm'));
13724
+ input.data('composing', true);
13725
+ input.data('imetm', setTimeout(function() {
13726
+ input.removeData('composing');
13727
+ }, 100));
13728
+ }
13729
+ })
13730
+ .on('keyup', function(e) {
13731
+ input.data('imetm') && clearTimeout(input.data('imetm'));
13732
+ if (input.data('composing')) {
13733
+ e.keyCode === $.ui.keyCode.ENTER && input.trigger('compositionend');
13734
+ } else {
13735
+ input.trigger('input');
13736
+ }
13737
+ });
13738
+ }
13739
+ }
13740
 
13741
  $('<span class="ui-icon ui-icon-search" title="'+cmd.title+'"/>')
13742
  .appendTo(button)
13746
  .appendTo(button)
13747
  .click(abort);
13748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13749
  // wait when button will be added to DOM
13750
+ fm.bind('toolbarload', function(){
13751
  var parent = button.parent();
13752
  if (parent.length) {
 
13753
  toolbar.prepend(button.show());
13754
  parent.remove();
13755
  // position icons for ie7
13760
  left : parseInt(button.width())-icon.outerWidth(true)
13761
  });
13762
  }
 
13763
  }
13764
  });
13765
 
13766
  fm
13767
+ .one('open', function() {
13768
+ opts = (fm.api < 2.1)? null : $('<div class="ui-front ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>')
13769
+ .append(
13770
+ $('<div class="buttonset"/>')
13771
+ .append(
13772
+ $('<input id="'+id('SearchFromCwd')+'" name="serchfrom" type="radio" checked="checked"/><label for="'+id('SearchFromCwd')+'">'+fm.i18n('btnCwd')+'</label>'),
13773
+ $('<input id="'+id('SearchFromVol')+'" name="serchfrom" type="radio"/><label for="'+id('SearchFromVol')+'">'+fm.i18n('btnVolume')+'</label>'),
13774
+ $('<input id="'+id('SearchFromAll')+'" name="serchfrom" type="radio"/><label for="'+id('SearchFromAll')+'">'+fm.i18n('btnAll')+'</label>')
13775
+ ),
13776
+ $('<div class="buttonset"/>')
13777
+ .append(
13778
+ $('<input id="'+id('SearchName')+'" name="serchcol" type="radio" checked="checked"/><label for="'+id('SearchName')+'">'+fm.i18n('btnFileName')+'</label>'),
13779
+ $('<input id="'+id('SearchMime')+'" name="serchcol" type="radio"/><label for="'+id('SearchMime')+'">'+fm.i18n('btnMime')+'</label>')
13780
+ )
13781
+ )
13782
+ .hide()
13783
+ .appendTo(button);
13784
+ if (opts) {
13785
+ opts.find('div.buttonset').buttonset();
13786
+ $('#'+id('SearchFromAll')).next('label').attr('title', fm.i18n('searchTarget', fm.i18n('btnAll')));
13787
+ $('#'+id('SearchMime')).next('label').attr('title', fm.i18n('searchMime'));
13788
+ opts.on('mousedown', 'div.buttonset', function(e){
13789
+ e.stopPropagation();
13790
+ opts.data('infocus', true);
13791
+ })
13792
+ .on('click', 'input', function(e) {
13793
+ e.stopPropagation();
13794
+ $.trim(input.val()) && search();
13795
+ });
13796
+ }
13797
+ })
13798
  .select(function() {
13799
  input.blur();
13800
  })
13817
  .shortcut({
13818
  pattern : 'ctrl+f f3',
13819
  description : cmd.title,
13820
+ callback : function() {
13821
+ input.select().focus();
13822
+ }
13823
  });
13824
 
13825
  });
13826
  };
13827
 
13828
+
13829
  /*
13830
  * File: /js/ui/sortbutton.js
13831
  */
13847
  selected = item+'-selected',
13848
  asc = selected+'-asc',
13849
  desc = selected+'-desc',
13850
+ text = $('<span class="elfinder-button-text">'+cmd.title+'</span>'),
13851
  button = $(this).addClass('ui-state-default elfinder-button elfinder-menubutton elfiner-button-'+name)
13852
  .attr('title', cmd.title)
13853
+ .append('<span class="elfinder-button-icon elfinder-button-icon-'+name+'"/>', text)
13854
  .hover(function(e) { !button.hasClass(disabled) && button.toggleClass(hover); })
13855
  .click(function(e) {
13856
  if (!button.hasClass(disabled)) {
13859
  menu.slideToggle(100);
13860
  }
13861
  }),
13862
+ menu = $('<div class="ui-front ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>')
13863
  .hide()
13864
  .appendTo(button)
 
13865
  .on('mouseenter mouseleave', '.'+item, function() { $(this).toggleClass(hover) })
13866
  .on('click', '.'+item, function(e) {
13867
  e.preventDefault();
13869
  hide();
13870
  }),
13871
  update = function() {
13872
+ menu.children('[rel]').removeClass(selected+' '+asc+' '+desc)
13873
  .filter('[rel="'+fm.sortType+'"]')
13874
  .addClass(selected+' '+(fm.sortOrder == 'asc' ? asc : desc));
13875
 
13876
+ menu.children('.elfinder-sort-stick').toggleClass(selected, fm.sortStickFolders);
13877
+ menu.children('.elfinder-sort-tree').toggleClass(selected, fm.sortAlsoTreeview);
13878
  },
13879
  hide = function() { menu.hide(); };
13880
 
13881
+ text.hide();
13882
+
13883
  $.each(fm.sortRules, function(name, value) {
13884
  menu.append($('<div class="'+item+'" rel="'+name+'"><span class="ui-icon ui-icon-arrowthick-1-n"/><span class="ui-icon ui-icon-arrowthick-1-s"/>'+fm.i18n('sort'+name)+'</div>').data('type', name));
13885
  });
13890
  cmd.exec([], {
13891
  type : type,
13892
  order : type == fm.sortType ? fm.sortOrder == 'asc' ? 'desc' : 'asc' : fm.sortOrder,
13893
+ stick : fm.sortStickFolders,
13894
+ tree : fm.sortAlsoTreeview
13895
  });
13896
+ });
13897
 
13898
+ $('<div class="'+item+' '+item+'-separated elfinder-sort-ext elfinder-sort-stick"><span class="ui-icon ui-icon-check"/>'+fm.i18n('sortFoldersFirst')+'</div>')
13899
  .appendTo(menu)
13900
  .click(function() {
13901
+ cmd.exec([], {type : fm.sortType, order : fm.sortOrder, stick : !fm.sortStickFolders, tree : fm.sortAlsoTreeview});
13902
+ });
13903
+
13904
+ if ($.fn.elfindertree && $.inArray('tree', fm.options.ui) !== -1) {
13905
+ $('<div class="'+item+' '+item+'-separated elfinder-sort-ext elfinder-sort-tree"><span class="ui-icon ui-icon-check"/>'+fm.i18n('sortAlsoTreeview')+'</div>')
13906
+ .appendTo(menu)
13907
+ .click(function() {
13908
+ cmd.exec([], {type : fm.sortType, order : fm.sortOrder, stick : fm.sortStickFolders, tree : !fm.sortAlsoTreeview});
13909
+ });
13910
+ }
13911
 
13912
  fm.bind('disable select', hide).getUI().click(hide);
13913
 
13926
 
13927
  });
13928
 
13929
+ };
 
 
13930
 
13931
 
13932
  /*
13948
  e.preventDefault();
13949
  fm.exec('opendir', [ hash ]);
13950
  }),
13951
+ titlesize = fm.i18n('size'),
13952
+ titleitems = fm.i18n('items'),
13953
  titlesel = fm.i18n('selected'),
13954
  setstat = function(files, cwd) {
13955
  var c = 0,
13961
  s += parseInt(file.size)||0;
13962
  }
13963
  })
13964
+ size.html(titleitems+': <span class="elfinder-stat-incsearch"></span>'+c+', '+titlesize+': '+fm.formatSize(s));
13965
+ },
13966
+ setIncsearchStat = function(data) {
13967
+ size.find('span.elfinder-stat-incsearch').html(data? data.hashes.length + ' / ' : '');
13968
  },
13969
  search = false;
13970
 
14007
 
14008
  sel.html(c ? titlesel+': '+c+', '+titlesize+': '+fm.formatSize(s) : '&nbsp;');
14009
  })
14010
+ .bind('incsearch', function(e) {
14011
+ setIncsearchStat(e.data);
14012
+ })
14013
+ .bind('incsearchend', function() {
14014
+ setIncsearchStat();
14015
+ })
14016
  ;
14017
  })
14018
+ };
14019
+
14020
+
14021
+ /*
14022
+ * File: /js/ui/toast.js
14023
+ */
14024
+
14025
+ /**
14026
+ * @class elFinder toast
14027
+ *
14028
+ * This was created inspired by the toastr. Thanks to developers of toastr.
14029
+ * CodeSeven/toastr: http://johnpapa.net <https://github.com/CodeSeven/toastr>
14030
+ *
14031
+ * @author Naoki Sawada
14032
+ **/
14033
+ $.fn.elfindertoast = function(opts, fm) {
14034
+ var defOpts = {
14035
+ mode: 'success',
14036
+ msg: '',
14037
+ showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
14038
+ showDuration: 300,
14039
+ showEasing: 'swing', //swing and linear are built into jQuery
14040
+ onShown: undefined,
14041
+ hideMethod: 'fadeOut',
14042
+ hideDuration: 1500,
14043
+ hideEasing: 'swing',
14044
+ onHidden: undefined,
14045
+ timeOut: 3000,
14046
+ extNode: undefined
14047
+ };
14048
+ return this.each(function() {
14049
+ opts = $.extend({}, defOpts, opts || {});
14050
+
14051
+ var self = $(this),
14052
+ show = function(notm) {
14053
+ self.stop();
14054
+ self[opts.showMethod]({
14055
+ duration: opts.showDuration,
14056
+ easing: opts.showEasing,
14057
+ complete: function() {
14058
+ opts.onShown && opts.onShown();
14059
+ if (!notm && opts.timeOut) {
14060
+ rmTm = setTimeout(rm, opts.timeOut);
14061
+ }
14062
+ }
14063
+ });
14064
+ },
14065
+ rm = function() {
14066
+ self[opts.hideMethod]({
14067
+ duration: opts.hideDuration,
14068
+ easing: opts.hideEasing,
14069
+ complete: function() {
14070
+ opts.onHidden && opts.onHidden();
14071
+ self.remove();
14072
+ }
14073
+ });
14074
+ },
14075
+ rmTm;
14076
+
14077
+ self.on('click', function(e) {
14078
+ e.stopPropagation();
14079
+ e.preventDefault();
14080
+ self.stop().remove();
14081
+ }).on('mouseenter mouseleave', function(e) {
14082
+ if (opts.timeOut) {
14083
+ rmTm && clearTimeout(rmTm);
14084
+ rmTm = null;
14085
+ if (e.type === 'mouseenter') {
14086
+ show(true);
14087
+ } else {
14088
+ rmTm = setTimeout(rm, opts.timeOut);
14089
+ }
14090
+ }
14091
+ }).hide().addClass('toast-' + opts.mode).append($('<div class="elfinder-toast-msg"/>').html(opts.msg));
14092
+
14093
+ if (opts.extNode) {
14094
+ self.append(opts.extNode);
14095
+ }
14096
+
14097
+ show();
14098
+ });
14099
+ };
14100
 
14101
  /*
14102
  * File: /js/ui/toolbar.js
14111
  this.not('.elfinder-toolbar').each(function() {
14112
  var commands = fm._commands,
14113
  self = $(this).addClass('ui-helper-clearfix ui-widget-header ui-corner-top elfinder-toolbar'),
14114
+ options = {
14115
+ // default options
14116
+ displayTextLabel: false,
14117
+ labelExcludeUA: ['Mobile'],
14118
+ autoHideUA: ['Mobile']
14119
+ },
14120
+ filter = function(opts) {
14121
+ return $.map(opts, function(v) {
14122
+ if ($.isPlainObject(v)) {
14123
+ options = $.extend(options, v);
14124
+ return null;
14125
+ }
14126
+ return [v];
14127
+ });
14128
+ },
14129
+ render = function(disabled){
14130
+ var name;
14131
+
14132
+ $.each(buttons, function(i, b) { b.detach(); });
14133
+ self.empty();
14134
+ l = panels.length;
14135
+ while (l--) {
14136
+ if (panels[l]) {
14137
+ panel = $('<div class="ui-widget-content ui-corner-all elfinder-buttonset"/>');
14138
+ i = panels[l].length;
14139
+ while (i--) {
14140
+ name = panels[l][i];
14141
+ if ((!disabled || $.inArray(name, disabled) === -1) && (cmd = commands[name])) {
14142
+ button = 'elfinder'+cmd.options.ui;
14143
+ if (! buttons[name] && $.fn[button]) {
14144
+ buttons[name] = $('<div/>')[button](cmd);
14145
+ }
14146
+ if (buttons[name]) {
14147
+ textLabel && buttons[name].find('.elfinder-button-text').show();
14148
+ panel.prepend(buttons[name]);
14149
+ }
14150
+ }
14151
+ }
14152
+
14153
+ panel.children().length && self.prepend(panel);
14154
+ panel.children(':gt(0)').before('<span class="ui-widget-content elfinder-toolbar-button-separator"/>');
14155
+
14156
+ }
14157
+ }
14158
+
14159
+ (! self.data('swipeClose') && self.children().length)? self.show() : self.hide();
14160
+ fm.trigger('toolbarload').trigger('uiresize');
14161
+ },
14162
+ buttons = {},
14163
+ panels = filter(opts || []),
14164
  dispre = null,
14165
  uiCmdMapPrev = '',
14166
+ l, i, cmd, panel, button, swipeHandle, autoHide, textLabel;
14167
 
14168
+ // correction of options.displayTextLabel
14169
+ textLabel = fm.storage('toolbarTextLabel');
14170
+ if (typeof textLabel === 'undefined') {
14171
+ textLabel = (options.displayTextLabel && (! options.labelExcludeUA || ! options.labelExcludeUA.length || ! $.map(options.labelExcludeUA, function(v){ return fm.UA[v]? true : null; }).length));
14172
+ } else {
14173
+ textLabel = (textLabel == 1);
14174
+ }
14175
+
14176
+ // add contextmenu
14177
+ self.on('contextmenu', function(e) {
14178
+ e.stopPropagation();
14179
+ e.preventDefault();
14180
+ fm.trigger('contextmenu', {
14181
+ raw: [{
14182
+ label : fm.i18n('textLabel'),
14183
+ icon : 'accept',
14184
+ callback : function() {
14185
+ textLabel = ! textLabel;
14186
+ self.height('').find('.elfinder-button-text')[textLabel? 'show':'hide']();
14187
+ fm.trigger('uiresize').storage('toolbarTextLabel', textLabel? '1' : '0');
14188
  }
14189
+ }],
14190
+ x: e.pageX,
14191
+ y: e.pageY
14192
+ });
14193
+ }).on('touchstart', function(e) {
14194
+ if (e.originalEvent.touches.length > 1) {
14195
+ return;
14196
  }
14197
+ self.data('tmlongtap') && clearTimeout(self.data('tmlongtap'));
14198
+ self.removeData('longtap')
14199
+ .data('longtap', {x: e.originalEvent.touches[0].pageX, y: e.originalEvent.touches[0].pageY})
14200
+ .data('tmlongtap', setTimeout(function() {
14201
+ self.removeData('longtapTm')
14202
+ .trigger({
14203
+ type: 'contextmenu',
14204
+ pageX: self.data('longtap').x,
14205
+ pageY: self.data('longtap').y
14206
+ })
14207
+ .data('longtap', {longtap: true});
14208
+ }, 500));
14209
+ }).on('touchmove touchend', function(e) {
14210
+ if (self.data('tmlongtap')) {
14211
+ if (e.type === 'touchend' ||
14212
+ ( Math.abs(self.data('longtap').x - e.originalEvent.touches[0].pageX)
14213
+ + Math.abs(self.data('longtap').y - e.originalEvent.touches[0].pageY)) > 4)
14214
+ clearTimeout(self.data('tmlongtap'));
14215
+ self.removeData('longtapTm');
14216
+ }
14217
+ }).on('click', function(e) {
14218
+ if (self.data('longtap') && self.data('longtap').longtap) {
14219
+ e.stopImmediatePropagation();
14220
+ e.preventDefault();
14221
+ }
14222
+ }).on('touchend click', '.elfinder-button', function(e) {
14223
+ if (self.data('longtap') && self.data('longtap').longtap) {
14224
+ e.stopImmediatePropagation();
14225
+ e.preventDefault();
14226
+ }
14227
+ });
14228
+
14229
+ self.prev().length && self.parent().prepend(this);
14230
 
14231
  render();
14232
 
14233
  fm.bind('open sync', function(){
14234
+ var disabled = fm.option('disabled'),
14235
+ doRender;
14236
 
14237
  if (!dispre || dispre.toString() !== disabled.sort().toString()) {
14238
  render(disabled && disabled.length? disabled : null);
14239
+ doRender = true;
14240
  }
14241
  dispre = disabled.concat().sort();
14242
 
14243
+ if (doRender || uiCmdMapPrev !== JSON.stringify(fm.commandMap)) {
14244
  uiCmdMapPrev = JSON.stringify(fm.commandMap);
14245
+ if (! doRender) {
14246
+ // reset toolbar
14247
+ $.each($('div.elfinder-button'), function(){
14248
+ var origin = $(this).data('origin');
14249
+ if (origin) {
14250
+ $(this).after(origin).detach();
14251
+ }
14252
+ });
14253
+ }
14254
  if (Object.keys(fm.commandMap).length) {
14255
  $.each(fm.commandMap, function(from, to){
14256
  var cmd = fm._commands[to],
14257
+ button = cmd? 'elfinder'+cmd.options.ui : null,
14258
+ btn;
14259
  if (button && $.fn[button]) {
14260
+ btn = buttons[from];
14261
+ if (btn) {
14262
+ if (! buttons[to] && $.fn[button]) {
14263
+ buttons[to] = $('<div/>')[button](fm._commands[to]);
14264
+ if (buttons[to]) {
14265
+ textLabel && buttons[to].find('.elfinder-button-text').show();
14266
+ if (cmd.extendsCmd) {
14267
+ buttons[to].children('span.elfinder-button-icon').addClass('elfinder-button-icon-' + cmd.extendsCmd)
14268
+ };
14269
+ }
14270
+ }
14271
+ if (buttons[to]) {
14272
+ btn.after(buttons[to]);
14273
+ buttons[to].data('origin', btn.detach());
14274
+ }
14275
  }
14276
  }
14277
  });
14278
  }
 
 
 
 
 
 
 
 
14279
  }
 
14280
  });
14281
+
14282
+ if (fm.UA.Touch) {
14283
+ autoHide = fm.storage('autoHide') || {};
14284
+ if (typeof autoHide.toolbar === 'undefined') {
14285
+ autoHide.toolbar = (options.autoHideUA && options.autoHideUA.length > 0 && $.map(options.autoHideUA, function(v){ return fm.UA[v]? true : null; }).length);
14286
+ fm.storage('autoHide', autoHide);
14287
+ }
14288
+
14289
+ if (autoHide.toolbar) {
14290
+ fm.one('init', function() {
14291
+ fm.uiAutoHide.push(function(){ self.stop(true, true).trigger('toggle', { duration: 500, init: true }); });
14292
+ });
14293
+ }
14294
+
14295
+ fm.bind('load', function() {
14296
+ swipeHandle = $('<div class="elfinder-toolbar-swipe-handle"/>').hide().appendTo(fm.getUI());
14297
+ if (swipeHandle.css('pointer-events') !== 'none') {
14298
+ swipeHandle.remove();
14299
+ swipeHandle = null;
14300
+ }
14301
+ });
14302
+
14303
+ self.on('toggle', function(e, data) {
14304
+ var wz = fm.getUI('workzone'),
14305
+ toshow= self.is(':hidden'),
14306
+ wzh = wz.height(),
14307
+ h = self.height(),
14308
+ tbh = self.outerHeight(true),
14309
+ delta = tbh - h,
14310
+ opt = $.extend({
14311
+ step: function(now) {
14312
+ wz.height(wzh + (toshow? (now + delta) * -1 : h - now));
14313
+ fm.trigger('resize');
14314
+ },
14315
+ always: function() {
14316
+ self.css('height', '');
14317
+ fm.trigger('uiresize');
14318
+ if (swipeHandle) {
14319
+ if (toshow) {
14320
+ swipeHandle.stop(true, true).hide();
14321
+ } else {
14322
+ swipeHandle.height(data.handleH? data.handleH : '');
14323
+ fm.resources.blink(swipeHandle, 'slowonce');
14324
+ }
14325
+ }
14326
+ data.init && fm.trigger('uiautohide');
14327
+ }
14328
+ }, data);
14329
+ self.data('swipeClose', ! toshow).stop(true, true).animate({height : 'toggle'}, opt);
14330
+ autoHide.toolbar = !toshow;
14331
+ fm.storage('autoHide', $.extend(fm.storage('autoHide'), {toolbar: autoHide.toolbar}));
14332
+ });
14333
+ }
14334
  });
14335
 
14336
  return this;
14337
+ };
14338
+
14339
 
14340
  /*
14341
  * File: /js/ui/tree.js
14465
  */
14466
  droppable = fm.res(c, 'droppable'),
14467
 
14468
+ /**
14469
+ * root wrapper class
14470
+ *
14471
+ * @type String
14472
+ */
14473
+ wrapperRoot = 'elfinder-navbar-wrapper-root',
14474
+
14475
  /**
14476
  * Un-disabled cmd `paste` volume's root wrapper class
14477
  *
14509
  e.stopPropagation();
14510
  helper.data('dropover', helper.data('dropover') + 1);
14511
  dst.data('dropover', true);
14512
+ if (ui.helper.data('namespace') !== fm.namespace || ! insideNavbar(e.clientX) || ! fm.insideWorkzone(e.pageX, e.pageY)) {
14513
  dst.removeClass(cl);
14514
+ helper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus');
14515
+ return;
14516
  }
14517
+ dst.addClass(hover);
14518
  if (dst.is('.'+collapsed+':not(.'+expanded+')')) {
14519
  dst.data('expandTimer', setTimeout(function() {
14520
+ dst.is('.'+collapsed+'.'+hover) && dst.children('.'+arrow).click();
14521
  }, 500));
14522
  }
14523
+ if (dst.is('.elfinder-ro,.elfinder-na')) {
14524
+ dst.removeClass(dropover);
14525
+ helper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus');
14526
+ return;
14527
+ }
14528
  hash = fm.navId2Hash(dst.attr('id'));
14529
  dst.data('dropover', hash);
14530
  $.each(ui.helper.data('files'), function(i, h) {
14557
  $(this).removeData('dropover')
14558
  .removeClass(hover+' '+dropover);
14559
  },
14560
+ drop : function(e, ui) {
14561
+ insideNavbar(e.clientX) && drop.call(this, e, ui);
14562
+ }
14563
  }),
14564
 
14565
  spinner = $(fm.res('tpl', 'navspinner')),
14600
  replace = {
14601
  id : function(dir) { return fm.navHash2Id(dir.hash) },
14602
  cssclass : function(dir) {
14603
+ var cname = (dir.phash && ! dir.isroot ? '' : root)+' '+navdir+' '+fm.perms2class(dir);
14604
  dir.dirs && !dir.link && (cname += ' ' + collapsed);
14605
  opts.getClass && (cname += ' ' + opts.getClass(dir));
14606
  dir.csscls && (cname += ' ' + fm.escape(dir.csscls));
14608
  },
14609
  permissions : function(dir) { return !dir.read || !dir.write ? ptpl : ''; },
14610
  symlink : function(dir) { return dir.alias ? stpl : ''; },
14611
+ style : function(dir) { return dir.icon ? 'style="background:url(\''+fm.escape(dir.icon)+'\') 0 0 no-repeat;background-size:contain;"' : ''; }
14612
  },
14613
 
14614
  /**
14655
  */
14656
  findSibling = function(subtree, dir) {
14657
  var node = subtree.children(':first'),
14658
+ info;
14659
 
 
14660
  while (node.length) {
14661
  info = fm.file(fm.navId2Hash(node.children('[id]').attr('id')));
14662
 
14663
  if ((info = fm.file(fm.navId2Hash(node.children('[id]').attr('id'))))
14664
+ && compare(dir, info) < 0) {
14665
  return node;
14666
  }
14667
  node = node.next();
14678
  updateTree = function(dirs) {
14679
  var length = dirs.length,
14680
  orphans = [],
14681
+ i = length,
14682
+ tgts = $(),
14683
+ done = {},
14684
+ dir, html, parent, sibling, init, atonce = {}, base, node;
14685
 
14686
  var firstVol = true; // check for netmount volume
14687
  while (i--) {
14688
  dir = dirs[i];
14689
 
14690
+ if (done[dir.hash] || $('#'+fm.navHash2Id(dir.hash)).length) {
14691
  continue;
14692
  }
14693
+ done[dir.hash] = true;
14694
 
14695
  if ((parent = findSubtree(dir.phash)).length) {
14696
  if (dir.phash && ((init = !parent.children().length) || (sibling = findSibling(parent, dir)).length)) {
14700
  }
14701
  atonce[dir.phash].push(dir);
14702
  } else {
14703
+ node = itemhtml(dir);
14704
+ sibling.before(node);
14705
+ ! mobile && (tgts = tgts.add(node));
14706
  }
14707
  } else {
14708
+ node = itemhtml(dir);
14709
+ parent[firstVol || dir.phash ? 'append' : 'prepend'](node);
14710
  firstVol = false;
14711
+ if (!dir.phash || dir.isroot) {
14712
+ base = $('#'+fm.navHash2Id(dir.hash)).parent().addClass(wrapperRoot);
14713
  if (!dir.disabled || dir.disabled.length < 1) {
14714
  base.addClass(pastable+' '+uploadable);
14715
  } else {
14721
  }
14722
  }
14723
  }
14724
+ ! mobile && updateDroppable(null, base);
14725
  }
14726
  } else {
14727
  orphans.push(dir);
14738
  html.push(itemhtml(d));
14739
  });
14740
  parent.append(html.join(''));
14741
+ ! mobile && fm.lazy(function() { updateDroppable(null, parent); });
14742
  });
14743
  }
14744
 
14745
  if (orphans.length && orphans.length < length) {
14746
+ updateTree(orphans);
14747
+ return;
14748
  }
14749
 
14750
+ ! mobile && tgts.length && fm.lazy(function() { updateDroppable(tgts); });
 
 
14751
 
14752
  },
14753
 
14756
  *
14757
  */
14758
  compare = function(dir1, dir2) {
14759
+ if (! fm.sortAlsoTreeview) {
14760
+ return fm.sortRules.name(dir1, dir2);
14761
+ } else {
14762
+ var asc = fm.sortOrder == 'asc',
14763
+ type = fm.sortType,
14764
+ rules = fm.sortRules,
14765
+ res;
14766
+
14767
+ res = asc? rules[fm.sortType](dir1, dir2) : rules[fm.sortType](dir2, dir1);
14768
+
14769
+ return type !== 'name' && res === 0
14770
+ ? res = asc ? rules.name(dir1, dir2) : rules.name(dir2, dir1)
14771
+ : res;
14772
+ }
14773
  },
14774
 
14775
  /**
14777
  *
14778
  * @return void
14779
  */
14780
+ autoScroll = function(target) {
14781
+ var self = $(this),
14782
+ dfrd = $.Deferred();
14783
+ self.data('autoScrTm') && clearTimeout(self.data('autoScrTm'));
14784
+ self.data('autoScrTm', setTimeout(function() {
14785
+ var current = $('#'+(target || fm.navHash2Id(fm.cwd().hash)));
 
 
 
14786
 
14787
+ if (current.length) {
14788
+ var parent = tree.parent().stop(false, true),
14789
+ top = parent.offset().top,
14790
+ treeH = parent.height(),
14791
+ bottom = top + treeH - current.outerHeight(),
14792
+ tgtTop = current.offset().top;
14793
+
14794
+ if (tgtTop < top || tgtTop > bottom) {
14795
+ parent.animate({
14796
+ scrollTop : parent.scrollTop() + tgtTop - top - treeH / 3
14797
+ }, {
14798
+ duration : 'fast',
14799
+ complete : function() { dfrd.resolve(); }
14800
+ });
14801
+ } else {
14802
+ dfrd.resolve();
14803
+ }
14804
+ } else {
14805
+ dfrd.reject();
14806
  }
14807
+ }, 100));
14808
+ return dfrd;
14809
  },
14810
 
14811
  /**
14815
  * @param {Boolean} do not expand cwd
14816
  * @return void
14817
  */
14818
+ sync = function(noCwd, dirs, init, open) {
14819
  var cwd = fm.cwd(),
14820
  cwdhash = cwd.hash,
14821
  current = $('#'+fm.navHash2Id(cwdhash)),
14822
  noCwd = noCwd || false,
14823
  dirs = dirs || [],
14824
+ open = open || inOpen,
14825
+ reqCmd = 'parents',
14826
+ reqs = [],
14827
+ getCmd = function(target) {
14828
+ var pnode = fm.file(target);
14829
+ return (pnode && (pnode.isroot || ! pnode.phash))? 'tree' : 'parents';
14830
+ },
14831
+ reqPush = function(cmd, target) {
14832
+ var link, spinner;
14833
+ if (! registed[cmd + target]) {
14834
+ if (cmd === 'tree' && target !== cwdhash) {
14835
+ link = $('#'+fm.navHash2Id(target));
14836
+ if (link.length) {
14837
+ spinner = $(fm.res('tpl', 'navspinner')).insertBefore(link.children('.'+arrow));
14838
+ link.removeClass(collapsed);
14839
+ }
14840
+ }
14841
+ registed[cmd + target] = true;
14842
+ reqs.push(fm.request({
14843
+ data : {
14844
+ cmd : cmd,
14845
+ target : target
14846
+ },
14847
+ preventFail : true
14848
+ }).done(function() {
14849
+ $('#'+fm.navHash2Id(cmd === 'tree'? target : fm.root(target))).addClass(loaded);
14850
+ }).always(function() {
14851
+ if (spinner) {
14852
+ spinner.remove();
14853
+ link.addClass(collapsed+' '+expanded).next('.'+subtree).show();
14854
+ }
14855
+ }));
14856
+ }
14857
+ },
14858
+ setReqs = function(target) {
14859
+ var proot = fm.root(target),
14860
+ phash, cmd, reqTarget;
14861
+
14862
+ while (proot) {
14863
+ if (proot && (proot = fm.file(proot)) && (phash = proot.phash) && phash.indexOf(proot.volumeid) !== 0) {
14864
+ cmd = getCmd(phash);
14865
+ if (cmd === 'parents') {
14866
+ reqPush('tree', phash);
14867
+ }
14868
+ reqPush(cmd, phash);
14869
+ proot = fm.root(phash);
14870
+ } else {
14871
+ proot = null;
14872
+ }
14873
+ }
14874
+ },
14875
+ registed = {},
14876
  rootNode, dir, link, subs, subsLen, cnt;
14877
 
14878
  if (openRoot) {
14887
  }
14888
 
14889
  if (opts.syncTree || !current.length) {
14890
+ if (current.length && (noCwd || ! init || ! cwd.isroot)) {
14891
+ if (!noCwd || init) {
14892
  current.addClass(loaded);
14893
  if (openCwd && current.hasClass(collapsed)) {
14894
  current.addClass(expanded).next('.'+subtree).slideDown();
14895
  }
14896
  }
14897
+ if (open || !noCwd) {
14898
+ subs = current.parentsUntil('.'+root).filter('.'+subtree);
14899
+ subsLen = subs.length;
14900
+ cnt = 1;
14901
+ subs.show().prev(selNavdir).addClass(expanded, function(){
14902
+ !noCwd && subsLen == cnt++ && autoScroll();
14903
+ });
14904
+ !subsLen && !noCwd && autoScroll();
14905
+ }
14906
  return;
14907
  }
14908
  if (fm.newAPI) {
14909
  dir = fm.file(cwdhash);
14910
+ if (dir && dir.phash && ! dir.isroot) {
14911
  link = $('#'+fm.navHash2Id(dir.phash));
14912
  if (link.length && link.hasClass(loaded)) {
14913
+ fm.lazy(function() {
14914
+ updateTree([dir]);
14915
+ sync(noCwd, [], false, open);
14916
+ });
14917
  return;
14918
  }
14919
  }
14920
+ if (! noCwd) {
14921
+ if (cwd.isroot && cwd.phash) {
14922
+ if (getCmd(cwd.phash) === 'tree') {
14923
+ reqCmd = 'tree';
14924
+ } else {
14925
+ reqCmd = 'parents';
14926
+ }
14927
+ setReqs(cwdhash);
14928
+ cwdhash = cwd.phash;
14929
+ } else {
14930
+ if (cwd.phash) {
14931
+ setReqs(cwd.phash);
14932
+ } else {
14933
+ reqCmd = null;
14934
+ }
14935
+ }
14936
+ }
14937
+
14938
+ reqCmd && reqPush(reqCmd, cwdhash);
14939
+
14940
  link = cwd.root? $('#'+fm.navHash2Id(cwd.root)) : null;
14941
  if (link) {
14942
  spinner.insertBefore(link.children('.'+arrow));
14943
  link.removeClass(collapsed);
14944
  }
14945
+ $.when.apply($, reqs)
 
 
 
14946
  .done(function(data) {
14947
+ var treeDirs, argLen, i;
14948
+ if (! data) {
14949
+ data = { tree : [] };
14950
+ }
14951
+ if (fm.api < 2.1) {
14952
+ data.tree.push(cwd);
14953
+ }
14954
+ argLen = arguments.length;
14955
+ if (argLen > 1) {
14956
+ for(i = 1; i < argLen; i++) {
14957
+ if (arguments[i].tree && arguments[i].tree.length) {
14958
+ data.tree.push.apply(data.tree, arguments[i].tree);
14959
+ }
14960
+ }
14961
+ }
14962
+
14963
+ treeDirs = filter(data.tree);
14964
+ if (cwd.isroot && cwd.hash === cwdhash && ! treeDirs.length) {
14965
+ // root's phash was not found
14966
+ delete cwd.isroot;
14967
+ delete cwd.phash;
14968
+ }
14969
+ dirs = JSON.parse(JSON.stringify($.merge(dirs, treeDirs)));
14970
  updateTree(dirs);
14971
  updateArrows(dirs, loaded);
14972
+
14973
+ // leaf root sync
14974
+ if (!noCwd && cwd.isroot && $('#'+fm.navHash2Id(cwd.hash).length)) {
14975
+ sync(true, [], init, open);
14976
+ }
14977
+
14978
+ cwdhash == cwd.hash && fm.visible() && sync(noCwd, [], false, open);
14979
  })
14980
+ .always(function() {
14981
  if (link) {
14982
  spinner.remove();
14983
  link.addClass(collapsed+' '+loaded);
14993
  *
14994
  * @return void
14995
  */
14996
+ updateDroppable = function(target, node) {
14997
  var limit = 100,
14998
  next;
14999
 
15000
  if (!target) {
15001
+ if (!node || node.closest('div.'+wrapperRoot).hasClass(uploadable)) {
15002
+ (node || tree.find('div.'+uploadable)).find(selNavdir+':not(.elfinder-ro,.elfinder-na)').addClass('native-droppable');
15003
+ }
15004
+ if (!node || node.closest('div.'+wrapperRoot).hasClass(pastable)) {
15005
+ //target = (node || tree.find('div.'+pastable)).find(selNavdir+':not(.'+droppable+',.elfinder-ro,.elfinder-na)');
15006
+ target = (node || tree.find('div.'+pastable)).find(selNavdir+':not(.'+droppable+')');
15007
+ } else {
15008
+ target = $();
15009
+ }
15010
  }
15011
 
15012
  if (target.length > limit) {
15017
  target.droppable(droppableopts);
15018
 
15019
  if (next) {
15020
+ fm.lazy(function() {
15021
  updateDroppable(next);
15022
  }, 20);
15023
  }
15040
 
15041
  $.each(dirs, function(i, dir) {
15042
  $('#'+fm.navHash2Id(dir.phash)+sel)
15043
+ .filter(function() { return $.map($(this).next('.'+subtree).children(), function(n) {
15044
+ return ($(n).children().hasClass(root))? null : n;
15045
+ }).length > 0 })
15046
  .addClass(cls);
15047
  })
15048
  },
15065
  link.toggleClass(hover, enter);
15066
  }
15067
  })
15068
+ // native drag enter
15069
+ .on('dragenter', selNavdir, function(e) {
15070
+ if (e.originalEvent.dataTransfer) {
15071
+ var dst = $(this);
15072
+ dst.addClass(hover);
15073
+ if (dst.is('.'+collapsed+':not(.'+expanded+')')) {
15074
+ dst.data('expandTimer', setTimeout(function() {
15075
+ dst.is('.'+collapsed+'.'+hover) && dst.children('.'+arrow).click();
15076
+ }, 500));
15077
+ }
15078
+ }
15079
+ })
15080
+ // native drag leave
15081
+ .on('dragleave', selNavdir, function(e) {
15082
+ if (e.originalEvent.dataTransfer) {
15083
+ var dst = $(this);
15084
+ dst.data('expandTimer') && clearTimeout(dst.data('expandTimer'));
15085
+ dst.removeClass(hover);
15086
+ }
15087
  })
15088
  // open dir or open subfolders in tree
15089
  .on('click', selNavdir, function(e) {
15096
  return;
15097
  }
15098
 
 
 
15099
  if (hash != fm.cwd().hash && !link.hasClass(disabled)) {
15100
+ fm.exec('open', hash).done(function() {
15101
+ fm.select({selected: [hash], origin: 'tree'});
15102
+ });
15103
+ } else {
15104
+ if (link.hasClass(collapsed)) {
15105
+ link.children('.'+arrow).click();
15106
+ }
15107
+ fm.select({selected: [hash], origin: 'tree'});
15108
  }
15109
  })
15110
  // for touch device
15111
  .on('touchstart', selNavdir, function(e) {
15112
+ if (e.originalEvent.touches.length > 1) {
15113
+ return;
15114
+ }
15115
  var evt = e.originalEvent,
15116
  p = $(this)
15117
  .addClass(hover)
15128
  }, 500));
15129
  })
15130
  .on('touchmove touchend', selNavdir, function(e) {
 
15131
  clearTimeout($(this).data('tmlongtap'));
15132
  if (e.type == 'touchmove') {
15133
  $(this).removeClass(hover);
15138
  var arrow = $(this),
15139
  link = arrow.parent(selNavdir),
15140
  stree = link.next('.'+subtree),
15141
+ dfrd = $.Deferred(),
15142
  slideTH = 30, cnt;
15143
 
15144
  e.stopPropagation();
15145
 
15146
  if (link.hasClass(loaded)) {
15147
  link.toggleClass(expanded);
15148
+ fm.lazy(function() {
15149
+ cnt = link.hasClass(expanded)? stree.children().length + stree.find('div.elfinder-navbar-subtree[style*=block]').children().length : stree.find('div:visible').length;
15150
+ if (cnt > slideTH) {
15151
+ stree.toggle();
 
 
15152
  fm.draggingUiHelper && fm.draggingUiHelper.data('refreshPositions', 1);
15153
+ } else {
15154
+ stree.stop(true, true).slideToggle('normal', function(){
15155
+ fm.draggingUiHelper && fm.draggingUiHelper.data('refreshPositions', 1);
15156
+ });
15157
+ }
15158
+ }).always(function() {
15159
+ dfrd.resolve();
15160
+ });
15161
  } else {
15162
  spinner.insertBefore(arrow);
15163
  link.removeClass(collapsed);
15164
 
15165
  fm.request({cmd : 'tree', target : fm.navId2Hash(link.attr('id'))})
15166
  .done(function(data) {
15167
+ updateTree(JSON.parse(JSON.stringify(filter(data.tree))));
15168
 
15169
  if (stree.children().length) {
15170
  link.addClass(collapsed+' '+expanded);
15182
  .always(function(data) {
15183
  spinner.remove();
15184
  link.addClass(loaded);
15185
+ fm.one('treedone', function() {
15186
+ dfrd.resolve();
15187
+ });
15188
  });
15189
  }
15190
+ arrow.data('dfrd', dfrd);
15191
  })
15192
  .on('contextmenu', selNavdir, function(e) {
15193
  var self = $(this);
15209
  fm.bind('closecontextmenu', function() {
15210
  self.removeClass('ui-state-hover');
15211
  });
15212
+ })
15213
+ .on('scrolltoview', selNavdir, function() {
15214
+ var self = $(this);
15215
+ autoScroll(self.attr('id')).done(function() {
15216
+ fm.resources.blink(self, 'lookme');
15217
+ });
15218
+ })
15219
+ // prepend fake dir
15220
+ .on('create.'+fm.namespace, function(e, item) {
15221
+ var pdir = findSubtree(item.phash),
15222
+ lock = item.move || false,
15223
+ dir = $(itemhtml(item)).addClass('elfinder-navbar-wrapper-tmp'),
15224
+ selected = fm.selected();
15225
+
15226
+ lock && selected.length && fm.trigger('lockfiles', {files: selected});
15227
+ pdir.prepend(dir);
15228
  }),
15229
  // move tree into navbar
15230
+ navbar = fm.getUI('navbar').append(tree).show(),
15231
+
15232
+ prevSortTreeview = fm.sortAlsoTreeview,
15233
+
15234
+ // is in open event procedure
15235
+ inOpen = false;
15236
 
15237
  fm.open(function(e) {
15238
  var data = e.data,
15241
 
15242
  data.init && tree.empty();
15243
 
15244
+ if (fm.UA.iOS) {
15245
+ navbar.removeClass('overflow-scrolling-touch').addClass('overflow-scrolling-touch');
15246
+ }
15247
+
15248
+ inOpen = true;
15249
  if (dirs.length) {
15250
+ fm.lazy(function() {
15251
+ if (!contextmenu.data('cmdMaps')) {
15252
+ contextmenu.data('cmdMaps', {});
 
 
 
 
 
 
 
 
15253
  }
15254
+ updateTree(dirs);
15255
+ updateArrows(dirs, loaded);
15256
+ // support volume driver option `uiCmdMap`
15257
+ $.each(dirs, function(k, v){
15258
+ if (v.volumeid) {
15259
+ if (v.uiCmdMap && Object.keys(v.uiCmdMap).length && !contextmenu.data('cmdMaps')[v.volumeid]) {
15260
+ contextmenu.data('cmdMaps')[v.volumeid] = v.uiCmdMap;
15261
+ }
15262
+ }
15263
+ });
15264
+ sync(false, dirs, data.init);
15265
+ inOpen = false;
15266
  });
15267
+ } else {
15268
+ sync(false, dirs, data.init);
15269
+ inOpen = false;
15270
+ }
15271
  })
15272
  // add new dirs
15273
  .add(function(e) {
15283
  var dirs = filter(e.data.changed),
15284
  length = dirs.length,
15285
  l = length,
15286
+ tgts = $(),
15287
+ dir, node, tmp, realParent, reqParent, realSibling, reqSibling, isExpanded, isLoaded, parent;
15288
 
15289
  while (l--) {
15290
  dir = dirs[l];
15291
  if ((node = $('#'+fm.navHash2Id(dir.hash))).length) {
15292
+ parent = node.parent();
15293
  if (dir.phash) {
15294
  realParent = node.closest('.'+subtree);
15295
  reqParent = findSubtree(dir.phash);
15301
  }
15302
 
15303
  if (reqParent[0] !== realParent[0] || realSibling.get(0) !== reqSibling.get(0)) {
15304
+ reqSibling.length ? reqSibling.before(parent) : reqParent.append(parent);
15305
  }
15306
  }
15307
  isExpanded = node.hasClass(expanded);
15308
  isLoaded = node.hasClass(loaded);
15309
  tmp = $(itemhtml(dir));
15310
  node.replaceWith(tmp.children(selNavdir));
15311
+ ! mobile && updateDroppable(null, parent);
15312
 
15313
  if (dir.dirs
15314
  && (isExpanded || isLoaded)
15317
  isExpanded && node.addClass(expanded);
15318
  isLoaded && node.addClass(loaded);
15319
  }
15320
+
15321
  }
15322
  }
15323
 
15324
+ sync(true);
 
15325
  })
15326
  // remove dirs
15327
  .remove(function(e) {
15358
  dir[lock ? 'addClass' : 'removeClass'](disabled);
15359
  }
15360
  });
15361
+ })
15362
+ .bind('sortchange', function() {
15363
+ if (fm.sortAlsoTreeview || prevSortTreeview !== fm.sortAlsoTreeview) {
15364
+ var dirs = filter(fm.files());
15365
+
15366
+ prevSortTreeview = fm.sortAlsoTreeview;
15367
+
15368
+ tree.empty();
15369
+ updateTree(dirs);
15370
+ sync();
15371
+ }
15372
  });
15373
 
15374
  });
15375
 
15376
  return this;
15377
+ };
15378
 
15379
 
15380
  /*
15410
  })
15411
  .change();
15412
  });
15413
+ };
15414
 
15415
 
15416
  /*
15431
  var icons = cmd.value == 'icons';
15432
 
15433
  icon.toggleClass('elfinder-button-icon-view-list', icons);
15434
+ cmd.className = icons? 'view-list' : '';
15435
+ cmd.title = cmd.fm.i18n(icons ? 'viewlist' : 'viewicons');
15436
+ button.attr('title', cmd.title);
15437
  });
15438
  });
15439
+ };
15440
+
15441
 
15442
  /*
15443
  * File: /js/ui/workzone.js
15453
  this.not('.'+cl).each(function() {
15454
  var wz = $(this).addClass(cl),
15455
  wdelta = wz.outerHeight(true) - wz.height(),
15456
+ prevH = Math.round(wz.height()),
15457
+ parent = wz.parent(),
15458
+ fitsize = function() {
15459
+ var height = parent.height() - wdelta,
15460
+ ovf = parent.css('overflow'),
15461
+ curH = Math.round(wz.height());
15462
+
15463
+ parent.css('overflow', 'hidden')
15464
+ .children(':visible:not(.'+cl+')').each(function() {
15465
+ var ch = $(this);
15466
+
15467
+ if (ch.css('position') != 'absolute' && ch.css('position') != 'fixed') {
15468
+ height -= ch.outerHeight(true);
15469
+ }
15470
+ });
15471
+ parent.css('overflow', ovf);
15472
 
15473
+ height = Math.max(0, Math.round(height));
15474
+ if (prevH !== height || curH !== height) {
15475
+ prevH = Math.round(wz.height());
15476
+ wz.height(height);
15477
+ fm.trigger('wzresize');
15478
+ }
15479
+ };
15480
+
15481
+ parent.add(window).on('resize.' + fm.namespace, fitsize);
15482
+ fm.bind('uiresize', fitsize);
15483
  });
15484
  return this;
15485
+ };
 
 
15486
 
15487
 
15488
  /*
15503
 
15504
  this.variants = [];
15505
 
15506
+ this.disableOnSearch = false;
15507
 
15508
  /**
15509
  * Update mimes on open/reload
15518
  self.change();
15519
  });
15520
 
15521
+ this.getstate = function(sel) {
15522
+ var sel = this.files(sel),
15523
+ cnt = sel.length,
15524
+ chk = (cnt && ! fm.isRoot(sel[0]) && (fm.file(sel[0].phash) || {}).write && ! $.map(sel, function(f){ return f.read ? null : true }).length),
15525
+ cwdId;
15526
+
15527
+ if (chk && fm.searchStatus.state > 1) {
15528
+ cwdId = fm.cwd().volumeid;
15529
+ chk = (cnt === $.map(sel, function(f) { return f.read && f.hash.indexOf(cwdId) === 0 ? f : null; }).length);
15530
+ }
15531
+
15532
+ return chk && !this._disabled && mimes.length && (cnt || (dfrd && dfrd.state() == 'pending')) ? 0 : -1;
15533
  }
15534
 
15535
  this.exec = function(hashes, type) {
15536
  var files = this.files(hashes),
15537
  cnt = files.length,
15538
  mime = type || mimes[0],
15539
+ cwd = fm.file(files[0].phash) || null,
15540
  error = ['errArchive', 'errPerm', 'errCreatingTempDir', 'errFtpDownloadFile', 'errFtpUploadFile', 'errFtpMkdir', 'errArchiveExec', 'errExtractExec', 'errRm'],
15541
+ i, open;
15542
 
15543
  dfrd = $.Deferred().fail(function(error) {
15544
  error && fm.error(error);
15545
  });
15546
 
15547
+ if (! (cnt && mimes.length && $.inArray(mime, mimes) !== -1)) {
15548
  return dfrd.reject();
15549
  }
15550
 
15559
  }
15560
 
15561
  self.mime = mime;
15562
+ self.prefix = ((cnt > 1)? 'Archive' : files[0].name) + (fm.option('archivers')['createext']? '.' + fm.option('archivers')['createext'][mime] : '');
15563
  self.data = {targets : self.hashes(hashes), type : mime};
15564
+
15565
+ if (fm.cwd().hash !== cwd.hash) {
15566
+ open = fm.exec('open', cwd.hash).done(function() {
15567
+ fm.one('cwdrender', function() {
15568
+ fm.selectfiles({files : hashes});
15569
+ dfrd = $.proxy(fm.res('mixin', 'make'), self)();
15570
+ });
15571
+ });
15572
+ } else {
15573
+ fm.selectfiles({files : hashes});
15574
+ dfrd = $.proxy(fm.res('mixin', 'make'), self)();
15575
+ }
15576
+
15577
+ return dfrd;
15578
  }
15579
 
15580
+ };
15581
+
15582
 
15583
  /*
15584
  * File: /js/commands/back.js
15590
  *
15591
  * @author Dmitry (dio) Levashov
15592
  **/
15593
+ (elFinder.prototype.commands.back = function() {
15594
  this.alwaysEnabled = true;
15595
  this.updateOnSelect = false;
15596
  this.shortcuts = [{
15605
  return this.fm.history.back();
15606
  }
15607
 
15608
+ }).prototype = { forceLoad : true }; // this is required command
15609
+
15610
 
15611
  /*
15612
  * File: /js/commands/chmod.js
15621
  */
15622
  elFinder.prototype.commands.chmod = function() {
15623
  this.updateOnSelect = false;
 
15624
  var fm = this.fm,
15625
  level = {
15626
  0 : 'owner',
15662
  if (sel.length == 0) {
15663
  sel = [ fm.cwd().hash ];
15664
  }
15665
+ return !this._disabled && this.checkstate(this.files(sel)) ? 0 : -1;
15666
  };
15667
 
15668
  this.checkstate = function(sel) {
15863
  title = tpl.groupTitle.replace('{items}', fm.i18n('items')).replace('{num}', cnt);
15864
  } else {
15865
  title = tpl.itemTitle.replace('{name}', file.name).replace('{kind}', fm.mime2kind(file));
15866
+ tmb = fm.tmb(file);
 
 
15867
  }
15868
 
15869
  dataTable = makeDataTable(makeperm(files), files.length == 1? files[0] : {});
15876
  // load thumbnail
15877
  if (tmb) {
15878
  $('<img/>')
15879
+ .on('load', function() { dialog.find('.elfinder-cwd-icon').addClass(tmb.className).css('background-image', "url('"+tmb.url+"')"); })
15880
+ .attr('src', tmb.url);
15881
  }
15882
 
15883
  $('#' + id + '-table-perm :checkbox').on('click', function(){setperm('perm');});
15884
  $('#' + id + '-perm').on('keydown', function(e) {
15885
  var c = e.keyCode;
15886
  e.stopPropagation();
15887
+ if (c == $.ui.keyCode.ENTER) {
15888
  save();
15889
  return;
15890
  }
15902
  };
15903
 
15904
 
15905
+ /*
15906
+ * File: /js/commands/colwidth.js
15907
+ */
15908
+
15909
+ /**
15910
+ * @class elFinder command "colwidth"
15911
+ * CWD list table columns width to auto
15912
+ *
15913
+ * @author Naoki Sawada
15914
+ **/
15915
+ elFinder.prototype.commands.colwidth = function() {
15916
+ this.alwaysEnabled = true;
15917
+ this.updateOnSelect = false;
15918
+
15919
+ this.getstate = function() {
15920
+ return this.fm.getUI('cwd').find('table').css('table-layout') === 'fixed' ? 0 : -1;
15921
+ }
15922
+
15923
+ this.exec = function() {
15924
+ this.fm.getUI('cwd').trigger('colwidth');
15925
+ }
15926
+
15927
+ };
15928
+
15929
  /*
15930
  * File: /js/commands/copy.js
15931
  */
15947
  var sel = this.files(sel),
15948
  cnt = sel.length;
15949
 
15950
+ return !this._disabled && cnt && $.map(sel, function(f) { return f.read ? f : null }).length == cnt ? 0 : -1;
15951
  }
15952
 
15953
  this.exec = function(hashes) {
15958
  });
15959
 
15960
  $.each(this.files(hashes), function(i, file) {
15961
+ if (! file.read) {
15962
  return !dfrd.reject(['errCopy', file.name, 'errPerm']);
15963
  }
15964
  });
15966
  return dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(fm.clipboard(this.hashes(hashes)));
15967
  }
15968
 
15969
+ };
15970
+
15971
 
15972
  /*
15973
  * File: /js/commands/cut.js
15981
  * @author Dmitry (dio) Levashov
15982
  */
15983
  elFinder.prototype.commands.cut = function() {
15984
+ var fm = this.fm;
15985
 
15986
  this.shortcuts = [{
15987
  pattern : 'ctrl+x shift+insert'
15991
  var sel = this.files(sel),
15992
  cnt = sel.length;
15993
 
15994
+ return !this._disabled && cnt && $.map(sel, function(f) { return f.read && ! f.locked && ! fm.isRoot(f) ? f : null }).length == cnt ? 0 : -1;
15995
  }
15996
 
15997
  this.exec = function(hashes) {
15998
+ var dfrd = $.Deferred()
 
15999
  .fail(function(error) {
16000
  fm.error(error);
16001
  });
16002
 
16003
  $.each(this.files(hashes), function(i, file) {
16004
+ if (!(file.read && ! file.locked && ! fm.isRoot(file)) ) {
16005
  return !dfrd.reject(['errCopy', file.name, 'errPerm']);
16006
  }
16007
  if (file.locked) {
16012
  return dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(fm.clipboard(this.hashes(hashes), true));
16013
  }
16014
 
16015
+ };
16016
+
16017
 
16018
  /*
16019
  * File: /js/commands/download.js
16026
  *
16027
  * @author Dmitry (dio) Levashov, dio@std42.ru
16028
  **/
16029
+ elFinder.prototype.commands.zipdl = function() {};
16030
  elFinder.prototype.commands.download = function() {
16031
  var self = this,
16032
  fm = this.fm,
16033
+ zipOn = false,
16034
+ mixed = false,
16035
+ filter = function(hashes, inExec) {
16036
+ var czipdl = (fm.api > 2)? fm.getCommand('zipdl') : null,
16037
+ volumeid, mixedCmd;
16038
+
16039
+ if (czipdl !== null) {
16040
+ if (fm.searchStatus.state > 1) {
16041
+ mixed = fm.searchStatus.mixed;
16042
+ } else if (fm.leafRoots[fm.cwd().hash]) {
16043
+ volumeid = fm.cwd().volumeid;
16044
+ $.each(hashes, function(i, h) {
16045
+ if (h.indexOf(volumeid) !== 0) {
16046
+ mixed = true;
16047
+ return false;
16048
+ }
16049
+ });
16050
+ }
16051
+ zipOn = (fm.isCommandEnabled('zipdl', hashes[0]));
16052
+ }
16053
+
16054
+ if (mixed) {
16055
+ mixedCmd = czipdl? 'zipdl' : 'download';
16056
+ hashes = $.map(hashes, function(h) {
16057
+ var f = fm.file(h),
16058
+ res = (! f || (! czipdl && f.mime === 'directory') || ! fm.isCommandEnabled(mixedCmd, h))? null : h;
16059
+ if (f && inExec && ! res) {
16060
+ $('#' + fm.cwdHash2Id(f.hash)).trigger('unselect');
16061
+ }
16062
+ return res;
16063
+ });
16064
+ if (! hashes.length) {
16065
+ return [];
16066
+ }
16067
+ } else {
16068
+ if (!fm.isCommandEnabled('download', hashes[0])) {
16069
+ return [];
16070
+ }
16071
+ }
16072
+
16073
+ return $.map(self.files(hashes), function(f) {
16074
+ var res = (! f.read || (! zipOn && f.mime == 'directory')) ? null : f;
16075
+ if (inExec && ! res) {
16076
+ $('#' + fm.cwdHash2Id(f.hash)).trigger('unselect');
16077
+ }
16078
+ return res;
16079
+ });
16080
  };
16081
 
16082
+ this.linkedCmds = ['zipdl'];
16083
+
16084
  this.shortcuts = [{
16085
  pattern : 'shift+enter'
16086
  }];
16087
 
16088
+ this.getstate = function(sel) {
16089
+ var sel = this.hashes(sel),
16090
+ cnt = sel.length,
16091
+ maxReq = this.options.maxRequests || 10,
16092
+ czipdl = (fm.api > 2)? fm.getCommand('zipdl') : null,
16093
+ mixed = false,
16094
+ croot = '';
16095
 
16096
+ if (cnt < 1) {
16097
+ return -1;
16098
+ }
16099
+ cnt = filter(sel).length;
16100
+
16101
+ return (cnt && (zipOn || (cnt <= maxReq && ((!fm.UA.IE && !fm.UA.Mobile) || cnt == 1))) ? 0 : -1);
16102
  };
16103
 
16104
+ fm.bind('contextmenu', function(e){
16105
  var fm = self.fm,
16106
  helper = null,
16107
  targets, file, link,
16113
  .attr({href: link, target: '_blank', title: fm.i18n('link')})
16114
  .text(file.name)
16115
  .on('mousedown click touchstart touchmove touchend contextmenu', function(e){
 
16116
  e.stopPropagation();
 
 
 
 
 
16117
  })
16118
  .on('dragstart', function(e) {
16119
  var dt = e.dataTransfer || e.originalEvent.dataTransfer || null;
16120
  helper = null;
16121
  if (dt) {
16122
  var icon = function(f) {
16123
+ var mime = f.mime, i, tmb = fm.tmb(f);
16124
  i = '<div class="elfinder-cwd-icon '+fm.mime2class(mime)+' ui-corner-all"/>';
16125
+ if (tmb) {
16126
+ i = $(i).addClass(tmb.className).css('background-image', "url('"+tmb.url+"')").get(0).outerHTML;
16127
  }
16128
  return i;
16129
  };
16155
  self.extra = {
16156
  icon: 'link',
16157
  node: $('<a/>')
16158
+ .attr({href: '#', title: fm.i18n('getLink'), draggable: 'false'})
16159
  .text(file.name)
16160
+ .on('click touchstart', function(e){
16161
+ if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) {
16162
+ return;
16163
+ }
16164
  var parent = node.parent();
16165
  e.stopPropagation();
16166
  e.preventDefault();
16170
  preventDefault : true
16171
  })
16172
  .always(function(data) {
16173
+ parent.removeClass('elfinder-button-icon-spinner');
16174
  if (data.url) {
16175
  var rfile = fm.file(file.hash);
16176
  rfile.url = data.url;
 
16177
  node.replaceWith(getExtra(file).node);
16178
  } else {
16179
  parent.addClass('ui-state-disabled');
16185
  node = self.extra.node;
16186
  node.ready(function(){
16187
  setTimeout(function(){
16188
+ node.parent().addClass('ui-state-disabled').css('pointer-events', 'auto');
16189
  }, 10);
16190
  });
16191
  }
16193
  }
16194
  });
16195
 
 
16196
  this.exec = function(hashes) {
16197
+ var hashes = this.hashes(hashes),
16198
+ fm = this.fm,
16199
  base = fm.options.url,
16200
+ files = filter(hashes, true),
16201
  dfrd = $.Deferred(),
16202
  iframes = '',
16203
  cdata = '',
16204
+ targets = {},
16205
+ i, url,
16206
+ linkdl = false,
16207
+ getTask = function(hashes) {
16208
+ return function() {
16209
+ var dfd = $.Deferred(),
16210
+ root = fm.file(fm.root(hashes[0])),
16211
+ volName = root? ' ('+(root.i18 || root.name)+')' : '';
16212
+ fm.request({
16213
+ data : {cmd : 'zipdl', targets : hashes},
16214
+ notify : {type : 'zipdl', cnt : 1, hideCnt : true, msg : fm.i18n('ntfzipdl') + volName},
16215
+ cancel : true,
16216
+ preventDefault : true
16217
+ }).done(function(e) {
16218
+ var zipdl, dialog, btn = {}, dllink, form, iframe,
16219
+ uniq = 'dlw' + (+new Date());
16220
+ if (e.error) {
16221
+ fm.error(e.error);
16222
+ dfd.resolve();
16223
+ } else if (e.zipdl) {
16224
+ zipdl = e.zipdl;
16225
+ if (linkdl || (!html5dl && fm.UA.Mobile)) {
16226
+ url = fm.options.url + (fm.options.url.indexOf('?') === -1 ? '?' : '&')
16227
+ + 'cmd=zipdl&download=1';
16228
+ $.each([hashes[0], zipdl.file, zipdl.name, zipdl.mime], function(key, val) {
16229
+ url += '&targets%5B%5D='+encodeURIComponent(val);
16230
+ });
16231
+ $.each(fm.options.customData, function(key, val) {
16232
+ url += '&'+encodeURIComponent(key)+'='+encodeURIComponent(val);
16233
+ });
16234
+ url += '&'+encodeURIComponent(zipdl.name);
16235
+ dllink = $('<a/>')
16236
+ .attr('href', url)
16237
+ .attr('download', encodeURIComponent(zipdl.name))
16238
+ .attr('target', '_blank')
16239
+ .on('click', function() {
16240
+ dfd.resolve();
16241
+ dialog.elfinderdialog('destroy');
16242
+ })
16243
+ .append('<span class="elfinder-button-icon elfinder-button-icon-download"></span>'+fm.escape(zipdl.name));
16244
+ btn[fm.i18n('btnCancel')] = function() {
16245
+ dialog.elfinderdialog('destroy');
16246
+ };
16247
+ dialog = fm.dialog(dllink, {
16248
+ title: fm.i18n('link'),
16249
+ buttons: btn,
16250
+ width: '200px',
16251
+ destroyOnClose: true,
16252
+ close: function() {
16253
+ (dfd.state() !== 'resolved') && dfd.resolve();
16254
+ }
16255
+ });
16256
+ } else {
16257
+ form = $('<form action="'+fm.options.url+'" method="post" target="'+uniq+'" style="display:none"/>')
16258
+ .append('<input type="hidden" name="cmd" value="zipdl"/>')
16259
+ .append('<input type="hidden" name="download" value="1"/>');
16260
+ $.each([hashes[0], zipdl.file, zipdl.name, zipdl.mime], function(key, val) {
16261
+ form.append('<input type="hidden" name="targets[]" value="'+fm.escape(val)+'"/>');
16262
+ });
16263
+ $.each(fm.options.customData, function(key, val) {
16264
+ form.append('<input type="hidden" name="'+key+'" value="'+fm.escape(val)+'"/>');
16265
+ });
16266
+ form.attr('target', uniq).appendTo('body');
16267
+ iframe = $('<iframe style="display:none" name="'+uniq+'">')
16268
+ .appendTo('body')
16269
+ .ready(function() {
16270
+ form.submit().remove();
16271
+ dfd.resolve();
16272
+ setTimeout(function() {
16273
+ iframe.remove();
16274
+ }, fm.UA.Firefox? 20000 : 1000); // give mozilla 20 sec file to be saved
16275
+ });
16276
+ }
16277
+ }
16278
+ }).fail(function(error) {
16279
+ error && fm.error(error);
16280
+ dfd.resolve();
16281
+ });
16282
+ return dfd.promise();
16283
+ };
16284
+ },
16285
+ link, html5dl;
16286
 
16287
+ if (!files.length) {
16288
  return dfrd.reject();
16289
  }
16290
 
16291
+ link = $('<a>').hide().appendTo($('body'));
16292
+ html5dl = (typeof link.get(0).download === 'string');
16293
+
16294
+ if (zipOn && (files.length > 1 || files[0].mime === 'directory')) {
16295
+ link.remove();
16296
+ if (mixed) {
16297
+ linkdl = fm.UA.Mobile;
16298
+ targets = {};
16299
+ $.each(files, function(i, f) {
16300
+ var p = f.hash.split('_', 2);
16301
+ if (! targets[p[0]]) {
16302
+ targets[p[0]] = [ f.hash ];
16303
+ } else {
16304
+ targets[p[0]].push(f.hash);
16305
+ }
16306
+ });
16307
  } else {
16308
+ targets = [ $.map(files, function(f) { return f.hash; }) ];
16309
+ }
16310
+ dfrd = fm.sequence($.map(targets, function(t) { return getTask(t); })).always(
16311
+ function() {
16312
+ fm.trigger('download', {files : files});
16313
+ }
16314
+ );
16315
+ return dfrd;
16316
+ } else {
16317
+ for (i = 0; i < files.length; i++) {
16318
+ url = fm.openUrl(files[i].hash, true);
16319
+ if (html5dl) {
16320
+ link.attr('href', url)
16321
+ .attr('download', encodeURIComponent(files[i].name))
16322
+ .attr('target', '_blank')
16323
+ .get(0).click();
16324
  } else {
16325
+ if (fm.UA.Mobile) {
16326
+ setTimeout(function(){
16327
+ if (! window.open(url)) {
16328
+ fm.error('errPopup');
16329
+ }
16330
+ }, 100);
16331
+ } else {
16332
+ iframes += '<iframe class="downloader" id="downloader-' + files[i].hash+'" style="display:none" src="'+url+'"/>';
16333
+ }
16334
  }
16335
  }
16336
+ link.remove();
16337
+ $(iframes)
16338
+ .appendTo('body')
16339
+ .ready(function() {
16340
+ setTimeout(function() {
16341
+ $(iframes).each(function() {
16342
+ $('#' + $(this).attr('id')).remove();
16343
+ });
16344
+ }, fm.UA.Firefox? (20000 + (10000 * i)) : 1000); // give mozilla 20 sec + 10 sec for each file to be saved
16345
+ });
16346
+ fm.trigger('download', {files : files});
16347
+ return dfrd.resolve();
16348
  }
 
 
 
 
 
 
 
 
 
 
 
 
16349
  };
16350
 
16351
  };
16352
 
16353
+
16354
  /*
16355
  * File: /js/commands/duplicate.js
16356
  */
16369
  var sel = this.files(sel),
16370
  cnt = sel.length;
16371
 
16372
+ return !this._disabled && cnt && fm.cwd().write && $.map(sel, function(f) { return f.read && f.phash === fm.cwd().hash && ! fm.isRoot(f)? f : null }).length == cnt ? 0 : -1;
16373
  }
16374
 
16375
  this.exec = function(hashes) {
16382
  }),
16383
  args = [];
16384
 
16385
+ if (! cnt) {
16386
  return dfrd.reject();
16387
  }
16388
 
16399
  return fm.request({
16400
  data : {cmd : 'duplicate', targets : this.hashes(hashes)},
16401
  notify : {type : 'copy', cnt : cnt}
16402
+ }).done(function(data) {
16403
+ var newItem;
16404
+ if (data && data.added && data.added[0]) {
16405
+ fm.one('duplicatedone', function() {
16406
+ newItem = fm.findCwdNodes(data.added);
16407
+ if (newItem.length) {
16408
+ newItem.trigger('scrolltoview');
16409
+ } else {
16410
+ fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})});
16411
+ fm.toast({msg: fm.i18n(['complete', fm.i18n('cmdduplicate')])});
16412
+ }
16413
+ });
16414
+ }
16415
  });
16416
 
16417
  }
16418
 
16419
+ };
16420
+
16421
 
16422
  /*
16423
  * File: /js/commands/edit.js
16463
  dialog = function(id, file, content) {
16464
 
16465
  var dfrd = $.Deferred(),
16466
+ ta = $('<textarea class="elfinder-file-edit '+fm.res('class', 'editing')+'" rows="20" id="'+id+'-ta">'+fm.escape(content)+'</textarea>'),
16467
  old = ta.val(),
16468
  save = function() {
16469
  ta.editor && ta.editor.save(ta[0], ta.editor.instance);
16475
  dfrd.reject();
16476
  ta.elfinderdialog('close');
16477
  };
16478
+ fm.toggleMaximize($(this).closest('.ui-dialog'), false);
16479
  ta.editor && ta.editor.save(ta[0], ta.editor.instance);
16480
  if (rtrim(old) !== rtrim(ta.val())) {
16481
  old = ta.val();
16506
  title : fm.escape(file.name),
16507
  width : self.options.dialogWidth || 450,
16508
  buttons : {},
16509
+ allowMaximize : true,
16510
  btnHoverFocus : false,
16511
  closeOnEscape : false,
16512
  close : function() {
16607
  value, start;
16608
 
16609
  e.stopPropagation();
16610
+ if (code == $.ui.keyCode.TAB) {
16611
  e.preventDefault();
16612
  // insert tab on tab press
16613
  if (this.setSelectionRange) {
16621
 
16622
  if (e.ctrlKey || e.metaKey) {
16623
  // close on ctrl+w/q
16624
+ if (code == 'Q'.charCodeAt(0) || code == 'W'.charCodeAt(0)) {
16625
  e.preventDefault();
16626
  cancel();
16627
  }
16628
+ if (code == 'S'.charCodeAt(0)) {
16629
  e.preventDefault();
16630
  save();
16631
  }
16638
  opts.buttons[fm.i18n('btnSaveClose')] = savecl;
16639
  opts.buttons[fm.i18n('btnCancel')] = cancel;
16640
 
16641
+ fm.dialog(ta, opts)
16642
+ .attr('id', id)
16643
+ .on('keydown keyup keypress', function(e) {
16644
+ e.stopPropagation();
16645
+ });
16646
  return dfrd.promise();
16647
  },
16648
 
16753
  list = [],
16754
  file;
16755
 
 
 
 
 
16756
  while ((file = files.shift())) {
16757
  list.push(edit(file));
16758
  }
16764
 
16765
  };
16766
 
16767
+
16768
  /*
16769
  * File: /js/commands/extract.js
16770
  */
16792
  // Update mimes list on open/reload
16793
  fm.bind('open reload', function() {
16794
  mimes = fm.option('archivers')['extract'] || [];
16795
+ if (fm.api > 2) {
16796
+ self.variants = [['makedir', fm.i18n('cmdmkdir')], ['intohere', fm.i18n('btnCwd')]];
16797
+ } else {
16798
+ self.variants = [['intohere', fm.i18n('btnCwd')]];
16799
+ }
16800
  self.change();
16801
  });
16802
 
16967
  return dfrd;
16968
  }
16969
 
16970
+ };
16971
+
16972
 
16973
  /*
16974
  * File: /js/commands/forward.js
16975
  */
16976
 
16977
  /**
16978
+ * @class elFinder command "forward"
16979
+ * Open next visited folder
16980
+ *
16981
+ * @author Dmitry (dio) Levashov
16982
+ **/
16983
+ (elFinder.prototype.commands.forward = function() {
16984
+ this.alwaysEnabled = true;
16985
+ this.updateOnSelect = true;
16986
+ this.shortcuts = [{
16987
+ pattern : 'ctrl+right'
16988
+ }];
16989
+
16990
+ this.getstate = function() {
16991
+ return this.fm.history.canForward() ? 0 : -1;
16992
+ }
16993
+
16994
+ this.exec = function() {
16995
+ return this.fm.history.forward();
16996
+ }
16997
+
16998
+ }).prototype = { forceLoad : true }; // this is required command
16999
+
17000
+
17001
+ /*
17002
+ * File: /js/commands/fullscreen.js
17003
+ */
17004
+
17005
+ /**
17006
+ * @class elFinder command "fullscreen"
17007
+ * elFinder node to full scrren mode
17008
  *
17009
+ * @author Naoki Sawada
17010
  **/
17011
+
17012
+ elFinder.prototype.commands.fullscreen = function() {
17013
+ var self = this,
17014
+ fm = this.fm,
17015
+ update = function(e, data) {
17016
+ if (data && data.fullscreen) {
17017
+ self.update(void(0), (data.fullscreen === 'on'));
17018
+ }
17019
+ };
17020
+
17021
+ this.alwaysEnabled = true;
17022
+ this.updateOnSelect = false;
17023
+ this.value = false;
17024
+
17025
+ this.options = {
17026
+ ui : 'fullscreenbutton',
17027
+ };
17028
+
17029
  this.getstate = function() {
17030
+ return 0;
17031
  }
17032
 
17033
  this.exec = function() {
17034
+ var node = fm.getUI().get(0),
17035
+ fullNode = fm.toggleFullscreen(node);
17036
+ self.update(void(0), (fullNode === node));
17037
+ };
17038
 
17039
+ fm.bind('init', function() {
17040
+ fm.getUI().off('resize.' + fm.namespace, update).on('resize.' + fm.namespace, update);
17041
+ });
17042
+ };
17043
+
17044
 
17045
  /*
17046
  * File: /js/commands/getfile.js
17053
  *
17054
  * @author Dmitry (dio) Levashov, dio@std42.ru
17055
  **/
17056
+ (elFinder.prototype.commands.getfile = function() {
17057
  var self = this,
17058
  fm = this.fm,
17059
  filter = function(files) {
17060
  var o = self.options;
17061
 
17062
  files = $.map(files, function(file) {
17063
+ return (file.mime != 'directory' || o.folders) && file.read ? file : null;
17064
  });
17065
 
17066
  return o.multiple || files.length == 1 ? files : [];
17086
  tmb = fm.option('tmbUrl'),
17087
  dfrd = $.Deferred()
17088
  .done(function(data) {
17089
+ var res,
17090
+ done = function() {
17091
+ if (opts.oncomplete == 'close') {
17092
+ fm.hide();
17093
+ } else if (opts.oncomplete == 'destroy') {
17094
+ fm.destroy();
17095
+ }
17096
+ };
17097
+
17098
  fm.trigger('getfile', {files : data});
 
17099
 
17100
+ res = self.callback(data, fm);
17101
+
17102
+ if (typeof res === 'object' && typeof res.done === 'function') {
17103
+ res.done(done)
17104
+ .fail(function(error) {
17105
+ error && fm.error(error);
17106
+ });
17107
+ } else {
17108
+ done();
17109
  }
17110
  }),
17111
  result = function(file) {
17116
  req = [],
17117
  i, file, dim;
17118
 
 
 
 
 
17119
  for (i = 0; i < cnt; i++) {
17120
  file = files[i];
17121
  if (file.mime == 'directory' && !opts.folders) {
17137
  } else {
17138
  file.url = fm.url(file.hash);
17139
  }
17140
+ if (! opts.onlyURL) {
17141
+ if (opts.getPath) {
17142
+ file.path = fm.path(file.hash);
17143
+ if (file.path === '' && file.phash) {
17144
+ // get parents
17145
+ (function() {
17146
+ var dfd = $.Deferred();
17147
+ req.push(dfd);
17148
+ fm.path(file.hash, false, {})
17149
+ .done(function(path) {
17150
+ file.path = path;
17151
+ })
17152
+ .fail(function() {
17153
+ file.path = '';
17154
+ })
17155
+ .always(function() {
17156
+ dfd.resolve();
17157
+ });
17158
+ })();
17159
+ }
17160
+ }
17161
+ if (file.tmb && file.tmb != 1) {
17162
+ file.tmb = tmb + file.tmb;
17163
+ }
17164
+ if (!file.width && !file.height) {
17165
+ if (file.dim) {
17166
+ dim = file.dim.split('x');
17167
+ file.width = dim[0];
17168
+ file.height = dim[1];
17169
+ } else if (opts.getImgSize && file.mime.indexOf('image') !== -1) {
17170
+ req.push(fm.request({
17171
+ data : {cmd : 'dim', target : file.hash},
17172
+ notify : {type : 'dim', cnt : 1, hideCnt : true},
17173
+ preventDefault : true
17174
+ })
17175
+ .done(function(data) {
17176
+ if (data.dim) {
17177
+ var dim = data.dim.split('x');
17178
+ var rfile = fm.file(this.hash);
17179
+ rfile.width = this.width = dim[0];
17180
+ rfile.height = this.height = dim[1];
17181
+ }
17182
+ }.bind(file)));
17183
+ }
17184
  }
17185
  }
17186
  }
17195
  return dfrd.resolve(result(files));
17196
  }
17197
 
17198
+ }).prototype = { forceLoad : true }; // this is required command
17199
+
17200
 
17201
  /*
17202
  * File: /js/commands/help.js
17208
  *
17209
  * @author Dmitry (dio) Levashov
17210
  **/
17211
+ (elFinder.prototype.commands.help = function() {
17212
  var fm = this.fm,
17213
  self = this,
17214
  linktpl = '<div class="elfinder-help-link"> <a href="{url}">{link}</a></div>',
17222
  prim = 'ui-priority-primary',
17223
  sec = 'ui-priority-secondary',
17224
  lic = 'elfinder-help-license',
17225
+ tab = '<li class="ui-state-default ui-corner-top elfinder-help-tab-{id}"><a href="#'+fm.namespace+'-help-{id}">{title}</a></li>',
17226
  html = ['<div class="ui-tabs ui-widget ui-widget-content ui-corner-all elfinder-help">',
17227
  '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'],
17228
  stpl = '<div class="elfinder-help-shortcut"><div class="elfinder-help-shortcut-pattern">{pattern}</div> {descrip}</div>',
17230
 
17231
 
17232
  about = function() {
17233
+ html.push('<div id="'+fm.namespace+'-help-about" class="ui-tabs-panel ui-widget-content ui-corner-bottom"><div class="elfinder-help-logo"/>');
17234
  html.push('<h3>elFinder</h3>');
17235
  html.push('<div class="'+prim+'">'+fm.i18n('webfm')+'</div>');
17236
+ html.push('<div class="'+sec+'">'+fm.i18n('ver')+': '+fm.version+', '+fm.i18n('protocolver')+': <span class="apiver"></span></div>');
17237
  html.push('<div class="'+sec+'">jQuery/jQuery UI: '+$().jquery+'/'+$.ui.version+'</div>');
17238
 
17239
  html.push(sep);
17252
  html.push(atpl[r](author, 'Alexey Sukhotin &lt;strogg@yandex.ru&gt;')[r](work, fm.i18n('contributor')));
17253
  html.push(atpl[r](author, 'Naoki Sawada &lt;hypweb@gmail.com&gt;')[r](work, fm.i18n('contributor')));
17254
 
17255
+ if (fm.i18[fm.lang].translator) {
17256
+ $.each(fm.i18[fm.lang].translator.split(', '), function() {
17257
+ html.push(atpl[r](author, $.trim(this))[r](work, fm.i18n('translator')+' ('+fm.i18[fm.lang].language+')'));
17258
+ });
17259
+ }
17260
 
17261
  html.push(sep);
17262
  html.push('<div class="'+lic+'">'+fm.i18n('icons')+': Pixelmixer, <a href="http://p.yusukekamiyamane.com" target="_blank">Fugue</a></div>');
17263
 
17264
  html.push(sep);
17265
  html.push('<div class="'+lic+'">Licence: BSD Licence</div>');
17266
+ html.push('<div class="'+lic+'">Copyright © 2009-2016, Studio 42</div>');
17267
  html.push('<div class="'+lic+'">„ …'+fm.i18n('dontforget')+' ”</div>');
17268
  html.push('</div>');
17269
  },
17270
  shortcuts = function() {
17271
  var sh = fm.shortcuts();
17272
  // shortcuts tab
17273
+ html.push('<div id="'+fm.namespace+'-help-shortcuts" class="ui-tabs-panel ui-widget-content ui-corner-bottom">');
17274
 
17275
  if (sh.length) {
17276
  html.push('<div class="ui-widget-content elfinder-help-shortcuts">');
17289
  },
17290
  help = function() {
17291
  // help tab
17292
+ html.push('<div id="'+fm.namespace+'-help-help" class="ui-tabs-panel ui-widget-content ui-corner-bottom">');
17293
+ html.push('<a href="https://github.com/Studio-42/elFinder/wiki" target="_blank" class="elfinder-dont-panic"><span>DON\'T PANIC</span></a>');
17294
  html.push('</div>');
17295
  // end help
17296
  },
17297
+ debug = function() {
17298
+ // debug tab
17299
+ html.push('<div id="'+fm.namespace+'-help-debug" class="ui-tabs-panel ui-widget-content ui-corner-bottom">');
17300
+ html.push('<div class="ui-widget-content elfinder-help-debug"><ul></ul></div>');
17301
+ html.push('</div>');
17302
+ // end debug
17303
+ },
17304
+ debugRender = function() {
17305
+ var render = function(elm, obj) {
17306
+ $.each(obj, function(k, v) {
17307
+ elm.append($('<dt/>').text(k));
17308
+ if (typeof v === 'undefined') {
17309
+ elm.append($('<dd/>').append($('<span/>').text('undfined')));
17310
+ } else if (typeof v === 'object' && !v) {
17311
+ elm.append($('<dd/>').append($('<span/>').text('null')));
17312
+ } else if (typeof v === 'object' && ($.isPlainObject(v) || v.length)) {
17313
+ elm.append( $('<dd/>').append(render($('<dl/>'), v)));
17314
+ } else {
17315
+ elm.append($('<dd/>').append($('<span/>').text((v && typeof v === 'object')? '[]' : (v? v : '""'))));
17316
+ }
17317
+ });
17318
+ return elm;
17319
+ },
17320
+ cnt = debugUL.children('li').length,
17321
+ targetL, target, tabId,
17322
+ info;
17323
+
17324
+ if (self.debug.options || self.debug.debug) {
17325
+ if (cnt >= 5) {
17326
+ debugUL.children('li:last').remove();
17327
+ debugDIV.children('div:last').remove();
17328
+ }
17329
+
17330
+ tabId = fm.namespace + '-help-debug-' + (+new Date());
17331
+ targetL = $('<li/>').html('<a href="#'+tabId+'">'+self.debug.debug.cmd+'</a>').prependTo(debugUL);
17332
+ target = $('<div id="'+tabId+'"/>');
17333
+
17334
+ if (self.debug.debug) {
17335
+ info = $('<fieldset>').append($('<legend/>').text('debug'), render($('<dl/>'), self.debug.debug));
17336
+ target.append(info);
17337
+ }
17338
+ if (self.debug.options) {
17339
+ info = $('<fieldset>').append($('<legend/>').text('options'), render($('<dl/>'), self.debug.options));
17340
+ target.append(info);
17341
+ }
17342
+
17343
+ debugUL.after(target);
17344
+
17345
+ debugDIV.tabs('refresh');
17346
+ debugUL.find('a:first').on('click', function(e) {e.stopPropagation();}).click();
17347
+ }
17348
+ },
17349
+ content = '',
17350
+ debugDIV, debugUL;
17351
 
17352
  this.alwaysEnabled = true;
17353
  this.updateOnSelect = false;
17354
+ this.state = -1;
17355
 
17356
  this.shortcuts = [{
17357
  pattern : 'f1',
17358
  description : this.title
17359
  }];
17360
 
17361
+ fm.one('load', function() {
17362
+ var parts = self.options.view || ['about', 'shortcuts', 'help', 'debug'],
17363
+ tabDebug;
17364
 
17365
  $.each(parts, function(i, title) {
17366
+ html.push(tab[r](/\{id\}/g, title)[r](/\{title\}/, fm.i18n(title)));
17367
  });
17368
 
17369
  html.push('</ul>');
17371
  $.inArray('about', parts) !== -1 && about();
17372
  $.inArray('shortcuts', parts) !== -1 && shortcuts();
17373
  $.inArray('help', parts) !== -1 && help();
17374
+ $.inArray('debug', parts) !== -1 && debug();
17375
 
17376
  html.push('</div>');
17377
  content = $(html.join(''));
17389
 
17390
  if (!link.hasClass('ui-tabs-selected')) {
17391
  link.parent().addClass('ui-tabs-selected ui-state-active').siblings().removeClass('ui-tabs-selected').removeClass('ui-state-active');
17392
+ content.children('.ui-tabs-panel').hide().filter(link.attr('href')).show();
17393
  }
17394
 
17395
  })
17396
  .filter(':first').click();
17397
 
17398
+ // debug
17399
+ tabDebug = content.find('.elfinder-help-tab-debug').hide();
17400
+ debugDIV = content.find('#'+fm.namespace+'-help-debug').children('div:first').tabs();
17401
+ debugUL = debugDIV.children('ul:first');
17402
+
17403
+ self.debug = {};
17404
+
17405
+ fm.bind('backenddebug', function(e) {
17406
+ // CAUTION: DO NOT TOUCH `e.data`
17407
+ if (e.data && e.data.debug) {
17408
+ tabDebug.show();
17409
+ self.debug = { options : e.data.options, debug : $.extend({ cmd : fm.currentReqCmd }, e.data.debug) };
17410
+ if (self.dialog/* && self.dialog.is(':visible')*/) {
17411
+ debugRender();
17412
+ }
17413
+ }
17414
+ });
17415
+
17416
+ content.find('#'+fm.namespace+'-help-about').find('.apiver').text(fm.api);
17417
+ self.dialog = fm.dialog(content, {title : self.title, width : 530, autoOpen : false, destroyOnClose : false});
17418
+
17419
+ self.state = 0;
17420
+ });
17421
 
17422
  this.getstate = function() {
17423
  return 0;
17424
  };
17425
 
17426
  this.exec = function() {
 
 
 
 
 
17427
  this.dialog.elfinderdialog('open').find('.ui-tabs-nav li a:first').click();
17428
  };
17429
 
17430
+ }).prototype = { forceLoad : true }; // this is required command
17431
 
17432
 
17433
  /*
17435
  */
17436
 
17437
 
17438
+ (elFinder.prototype.commands.home = function() {
17439
  this.title = 'Home';
17440
  this.alwaysEnabled = true;
17441
  this.updateOnSelect = false;
17456
  }
17457
 
17458
 
17459
+ }).prototype = { forceLoad : true }; // this is required command
17460
+
17461
 
17462
  /*
17463
  * File: /js/commands/info.js
17469
  *
17470
  * @author Dmitry (dio) Levashov, dio@std42.ru
17471
  **/
17472
+ (elFinder.prototype.commands.info = function() {
17473
  var m = 'msg',
17474
  fm = this.fm,
17475
  spclass = 'elfinder-info-spinner',
17476
+ btnclass = 'elfinder-info-button',
17477
  msg = {
17478
  calc : fm.i18n('calc'),
17479
  size : fm.i18n('size'),
17487
  kind : fm.i18n('kind'),
17488
  files : fm.i18n('files'),
17489
  folders : fm.i18n('folders'),
17490
+ roots : fm.i18n('volumeRoots'),
17491
  items : fm.i18n('items'),
17492
  yes : fm.i18n('yes'),
17493
  no : fm.i18n('no'),
17494
  link : fm.i18n('link'),
17495
  owner : fm.i18n('owner'),
17496
  group : fm.i18n('group'),
17497
+ perm : fm.i18n('perm'),
17498
+ getlink : fm.i18n('getLink')
17499
  };
17500
 
17501
  this.tpl = {
17502
+ main : '<div class="ui-helper-clearfix elfinder-info-title {dirclass}"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}</div><table class="elfinder-info-tb">{content}</table>',
17503
  itemTitle : '<strong>{name}</strong><span class="elfinder-info-kind">{kind}</span>',
17504
  groupTitle : '<strong>{items}: {num}</strong>',
17505
  row : '<tr><td>{label} : </td><td>{value}</td></tr>',
17537
  view = tpl.main,
17538
  l = '{label}',
17539
  v = '{value}',
17540
+ reqs = [],
17541
  opts = {
17542
  title : this.title,
17543
  width : 'auto',
17544
+ close : function() {
17545
+ $(this).elfinderdialog('destroy');
17546
+ $.each(reqs, function(i, req) {
17547
+ var xhr = (req && req.xhr)? req.xhr : null;
17548
+ if (xhr && xhr.state() == 'pending') {
17549
+ xhr.quiet = true;
17550
+ xhr.abort();
17551
+ }
17552
+ });
17553
+ }
17554
  },
17555
  count = [],
17556
  replSpinner = function(msg, name) { dialog.find('.'+spclass+'-'+name).parent().html(msg); },
17557
  id = fm.namespace+'-info-'+$.map(files, function(f) { return f.hash; }).join('-'),
17558
  dialog = fm.getUI().find('#'+id),
17559
  customActions = [],
17560
+ getSize = function(targets) {
17561
+ var getLeafRoots = function(file) {
17562
+ var targets = [];
17563
+ if (file.mime === 'directory') {
17564
+ $.each(fm.leafRoots, function(hash, roots) {
17565
+ var phash;
17566
+ if (hash === file.hash) {
17567
+ targets.push.apply(targets, roots);
17568
+ } else {
17569
+ phash = (fm.file(hash) || {}).phash;
17570
+ while(phash) {
17571
+ if (phash === file.hash) {
17572
+ targets.push.apply(targets, roots);
17573
+ }
17574
+ phash = (fm.file(phash) || {}).phash;
17575
+ }
17576
+ }
17577
+ });
17578
+ }
17579
+ return targets;
17580
+ },
17581
+ checkPhash = function(hash) {
17582
+ var dfd = $.Deferred(),
17583
+ dir = fm.file(hash),
17584
+ target = dir? dir.phash : hash;
17585
+ if (target && ! fm.file(target)) {
17586
+ fm.request({
17587
+ data : {
17588
+ cmd : 'parents',
17589
+ target : target
17590
+ },
17591
+ preventFail : true
17592
+ }).done(function() {
17593
+ fm.one('parentsdone', function() {
17594
+ dfd.resolve();
17595
+ });
17596
+ }).fail(function() {
17597
+ dfd.resolve();
17598
+ });
17599
+ } else {
17600
+ dfd.resolve();
17601
+ }
17602
+ return dfd;
17603
+ },
17604
+ cache = function() {
17605
+ var dfd = $.Deferred(),
17606
+ cnt = Object.keys(fm.leafRoots).length;
17607
+
17608
+ if (cnt > 0) {
17609
+ $.each(fm.leafRoots, function(hash) {
17610
+ checkPhash(hash).done(function() {
17611
+ --cnt;
17612
+ if (cnt < 1) {
17613
+ dfd.resolve();
17614
+ }
17615
+ });
17616
+ });
17617
+ } else {
17618
+ dfd.resolve();
17619
+ }
17620
+ return dfd;
17621
+ };
17622
+
17623
+ fm.autoSync('stop');
17624
+ cache().done(function() {
17625
+ var files = [], grps = {}, dfds = [];
17626
+
17627
+ $.each(targets, function() {
17628
+ files.push.apply(files, getLeafRoots(fm.file(this)));
17629
+ });
17630
+ targets.push.apply(targets, files);
17631
+
17632
+ $.each(targets, function() {
17633
+ var root = fm.root(this);
17634
+ if (! grps[root]) {
17635
+ grps[root] = [ this ];
17636
+ } else {
17637
+ grps[root].push(this);
17638
+ }
17639
+ });
17640
+
17641
+ $.each(grps, function() {
17642
+ dfds.push(fm.request({
17643
+ data : {cmd : 'size', targets : this},
17644
+ preventDefault : true
17645
+ }));
17646
+ });
17647
+ reqs.push.apply(reqs, dfds);
17648
+
17649
+ $.when.apply($, dfds).fail(function() {
17650
+ replSpinner(msg.unknown, 'size');
17651
+ }).done(function() {
17652
+ var size = 0,
17653
+ argLen = arguments.length,
17654
+ i;
17655
+
17656
+ for (i = 0; i < argLen; i++) {
17657
+ size += parseInt(arguments[i].size);
17658
+ }
17659
+ replSpinner(size >= 0 ? fm.formatSize(size) : msg.unknown, 'size');
17660
+ });
17661
+
17662
+ fm.autoSync();
17663
+ });
17664
+ },
17665
+ size, tmb, file, title, dcnt, rdcnt, path;
17666
 
17667
  if (!cnt) {
17668
  return $.Deferred().reject();
17677
  if (cnt == 1) {
17678
  file = files[0];
17679
 
17680
+ view = view.replace('{dirclass}', file.csscls? fm.escape(file.csscls) : '').replace('{class}', fm.mime2class(file.mime));
17681
+ title = tpl.itemTitle.replace('{name}', fm.escape(file.i18 || file.name)).replace('{kind}', '<span title="'+fm.escape(file.mime)+'">'+fm.mime2kind(file)+'</span>');
17682
 
17683
+ tmb = fm.tmb(file);
 
 
17684
 
17685
  if (!file.read) {
17686
  size = msg.unknown;
17693
 
17694
  content.push(row.replace(l, msg.size).replace(v, size));
17695
  file.alias && content.push(row.replace(l, msg.aliasfor).replace(v, file.alias));
17696
+ if (path = fm.path(file.hash, true)) {
17697
+ content.push(row.replace(l, msg.path).replace(v, fm.escape(path)));
17698
+ } else {
17699
+ content.push(row.replace(l, msg.path).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'path')));
17700
+ reqs.push(fm.path(file.hash, true, {notify: null})
17701
+ .fail(function() {
17702
+ replSpinner(msg.unknown, 'path');
17703
+ })
17704
+ .done(function(path) {
17705
+ replSpinner(path, 'path');
17706
+ }));
17707
+ }
17708
  if (file.read) {
17709
  var href,
17710
  name_esc = fm.escape(file.name);
17711
  if (file.url == '1') {
17712
+ content.push(row.replace(l, msg.link).replace(v, '<button class="'+btnclass+' '+spclass+'-url">'+msg.getlink+'</button>'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17713
  } else {
17714
  if (o.nullUrlDirLinkSelf && file.mime == 'directory' && file.url === null) {
17715
  var loc = window.location;
17728
  content.push(row.replace(l, msg.dim).replace(v, file.width+'x'+file.height));
17729
  } else {
17730
  content.push(row.replace(l, msg.dim).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'dim')));
17731
+ reqs.push(fm.request({
17732
  data : {cmd : 'dim', target : file.hash},
17733
  preventDefault : true
17734
  })
17743
  rfile.width = dim[0];
17744
  rfile.height = dim[1];
17745
  }
17746
+ }));
17747
  }
17748
  }
17749
 
17790
  content.push(row.replace(l, msg.kind).replace(v, msg.files));
17791
  content.push(row.replace(l, msg.size).replace(v, fm.formatSize(size)));
17792
  } else {
17793
+ rdcnt = $.map(files, function(f) { return f.mime === 'directory' && (! f.phash || f.isroot)? 1 : null ; }).length;
17794
+ dcnt -= rdcnt;
17795
+ content.push(row.replace(l, msg.kind).replace(v, (rdcnt === cnt || dcnt === cnt)? msg[rdcnt? 'roots' : 'folders'] : $.map({roots: rdcnt, folders: dcnt, files: cnt - rdcnt - dcnt}, function(c, t) { return c? msg[t]+' '+c : null}).join(', ')));
17796
  content.push(row.replace(l, msg.size).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'size')));
17797
  count = $.map(files, function(f) { return f.hash; });
17798
 
17804
  dialog = fm.dialog(view, opts);
17805
  dialog.attr('id', id);
17806
 
17807
+ if (file && file.url == '1') {
17808
+ dialog.on('click', '.'+spclass+'-url', function(){
17809
+ $(this).parent().html(tpl.spinner.replace('{text}', fm.i18n('ntfurl')).replace('{name}', 'url'));
17810
+ fm.request({
17811
+ data : {cmd : 'url', target : file.hash},
17812
+ preventDefault : true
17813
+ })
17814
+ .fail(function() {
17815
+ replSpinner(name_esc, 'url');
17816
+ })
17817
+ .done(function(data) {
17818
+ if (data.url) {
17819
+ replSpinner('<a href="'+data.url+'" target="_blank">'+name_esc+'</a>' || name_esc, 'url');
17820
+ var rfile = fm.file(file.hash);
17821
+ rfile.url = data.url;
17822
+ } else {
17823
+ replSpinner(name_esc, 'url');
17824
+ }
17825
+ });
17826
+ });
17827
+ }
17828
+
17829
  // load thumbnail
17830
  if (tmb) {
17831
  $('<img/>')
17832
+ .on('load', function() { dialog.find('.elfinder-cwd-icon').addClass(tmb.className).css('background-image', "url('"+tmb.url+"')"); })
17833
+ .attr('src', tmb.url);
17834
  }
17835
 
17836
  // send request to count total size
17837
  if (count.length) {
17838
+ getSize(count);
 
 
 
 
 
 
 
 
 
 
17839
  }
17840
 
17841
  // call custom actions
17851
 
17852
  };
17853
 
17854
+ }).prototype = { forceLoad : true }; // this is required command
17855
 
17856
 
17857
  /*
17865
  * @author Dmitry (dio) Levashov
17866
  **/
17867
  elFinder.prototype.commands.mkdir = function() {
17868
+ var fm = this.fm,
17869
+ self = this,
17870
+ curOrg;
17871
+
17872
+ this.value = '';
17873
  this.disableOnSearch = true;
17874
  this.updateOnSelect = false;
17875
  this.mime = 'directory';
17876
  this.prefix = 'untitled folder';
17877
+ this.exec = function(contextSel) {
17878
+ this.origin = curOrg? curOrg : 'cwd';
17879
+ if (! contextSel && ! this.options.intoNewFolderToolbtn) {
17880
+ fm.getUI('cwd').trigger('unselectall');
17881
+ }
17882
+ this.move = (this.origin !== 'navbar' && fm.selected().length)? true : false;
17883
+ return $.proxy(fm.res('mixin', 'make'), self)();
17884
+ }
17885
 
17886
  this.shortcuts = [{
17887
  pattern : 'ctrl+shift+n'
17888
  }];
17889
+
17890
+ this.init = function() {
17891
+ if (this.options.intoNewFolderToolbtn) {
17892
+ this.options.ui = 'mkdirbutton';
17893
+ }
17894
+ }
17895
 
17896
+ fm.bind('select', function(e) {
17897
+ var sel = (e.data && e.data.selected)? e.data.selected : [];
17898
+
17899
+ curOrg = sel.length? (e.data.origin || '') : '';
17900
+ self.title = (sel.length && (curOrg !== 'navbar'))? fm.i18n('cmdmkdirin') : fm.i18n('cmdmkdir');
17901
+ self.update(void(0), self.title);
17902
+ });
17903
+
17904
+ this.getstate = function(sel) {
17905
+ var cwd = fm.cwd(),
17906
+ sel = (curOrg === 'navbar' || (sel && sel[0] != cwd.hash))? this.files(sel || fm.selected()) : [],
17907
+ cnt = sel.length;
17908
+
17909
+ if (curOrg === 'navbar') {
17910
+ return !this._disabled && cnt && sel[0].write && sel[0].read? 0 : -1;
17911
+ } else {
17912
+ return !this._disabled && cwd.write && (!cnt || $.map(sel, function(f) { return f.read && ! f.locked? f : null }).length == cnt)? 0 : -1;
17913
+ }
17914
  }
17915
 
17916
+ };
17917
 
17918
 
17919
  /*
17937
  return !this._disabled && this.fm.cwd().write ? 0 : -1;
17938
  }
17939
 
17940
+ };
17941
 
17942
 
17943
  /*
17951
  * @author Dmitry (dio) Levashov
17952
  **/
17953
  elFinder.prototype.commands.netmount = function() {
17954
+ var self = this,
17955
+ content;
17956
 
17957
  this.alwaysEnabled = true;
17958
  this.updateOnSelect = false;
17974
  dfrd = $.Deferred(),
17975
  o = self.options,
17976
  create = function() {
17977
+ var winFocus = function() {
17978
+ inputs.protocol.trigger('change', 'winfocus');
17979
+ },
17980
+ inputs = {
17981
+ protocol : $('<select/>').on('change', function(e, data){
17982
  var protocol = this.value;
17983
  content.find('.elfinder-netmount-tr').hide();
17984
  content.find('.elfinder-netmount-tr-'+protocol).show();
17985
+ dialogNode.children('.ui-dialog-buttonpane:first').find('button').show();
17986
  if (typeof o[protocol].select == 'function') {
17987
+ o[protocol].select(fm, e, data);
17988
  }
17989
+ setTimeout(function() {
17990
+ content.find('input:text.elfinder-tabstop:visible:first').focus();
17991
+ }, 20);
17992
  })
17993
+ .addClass('ui-corner-all')
17994
  },
17995
  opts = {
17996
  title : fm.i18n('netMountDialogTitle'),
17997
  resizable : false,
17998
  modal : true,
17999
  destroyOnClose : true,
18000
+ open : function() {
18001
+ $(window).on('focus.'+fm.namespace, winFocus);
18002
+ inputs.protocol.change();
18003
+ },
18004
  close : function() {
18005
+ //delete self.dialog;
18006
  dfrd.state() == 'pending' && dfrd.reject();
18007
+ $(window).off('focus.'+fm.namespace, winFocus);
18008
  },
18009
  buttons : {}
18010
  },
 
18011
  hidden = $('<div/>'),
18012
  dialog;
18013
 
18014
+ content = $('<table class="elfinder-info-tb elfinder-netmount-tb"/>')
18015
+ .append($('<tr/>').append($('<td>'+fm.i18n('protocol')+'</td>')).append($('<td/>').append(inputs.protocol)));
18016
 
18017
  $.each(self.drivers, function(i, protocol) {
18018
+ if (o[protocol]) {
18019
+ inputs.protocol.append('<option value="'+protocol+'">'+fm.i18n(o[protocol].name || protocol)+'</option>');
18020
+ $.each(o[protocol].inputs, function(name, input) {
18021
+ input.attr('name', name);
18022
+ if (input.attr('type') != 'hidden') {
18023
+ input.addClass('ui-corner-all elfinder-netmount-inputs-'+protocol);
18024
+ content.append($('<tr/>').addClass('elfinder-netmount-tr elfinder-netmount-tr-'+protocol).append($('<td>'+fm.i18n(name)+'</td>')).append($('<td/>').append(input)));
18025
+ } else {
18026
+ input.addClass('elfinder-netmount-inputs-'+protocol);
18027
+ hidden.append(input);
18028
+ }
18029
+ });
18030
+ o[protocol].protocol = inputs.protocol;
18031
+ }
18032
  });
18033
 
18034
  content.append(hidden);
18036
  content.find('.elfinder-netmount-tr').hide();
18037
 
18038
  opts.buttons[fm.i18n('btnMount')] = function() {
18039
+ var protocol = inputs.protocol.val(),
18040
+ data = {cmd : 'netmount', protocol: protocol},
18041
+ cur = o[protocol];
18042
  $.each(content.find('input.elfinder-netmount-inputs-'+protocol), function(name, input) {
18043
  var val;
18044
  if (typeof input.val == 'function') {
18057
 
18058
  fm.request({data : data, notify : {type : 'netmount', cnt : 1, hideCnt : true}})
18059
  .done(function(data) {
18060
+ var pdir;
18061
+ if (data.added && data.added.length) {
18062
+ if (data.added[0].phash) {
18063
+ if (pdir = fm.file(data.added[0].phash)) {
18064
+ if (! pdir.dirs) {
18065
+ pdir.dirs = 1;
18066
+ fm.change({ changed: [ pdir ] });
18067
+ }
18068
+ }
18069
+ }
18070
+ fm.one('netmountdone', function() {
18071
+ fm.exec('open', data.added[0].hash);
18072
+ });
18073
+ }
18074
  dfrd.resolve();
18075
  })
18076
+ .fail(function(error) {
18077
+ //self.dialog.elfinderdialog('open');
18078
+ if (cur.fail && typeof cur.fail == 'function') {
18079
+ cur.fail(fm, error);
18080
+ }
18081
+ dfrd.reject(error);
18082
+ });
18083
 
18084
+ self.dialog.elfinderdialog('close');
18085
  };
18086
 
18087
  opts.buttons[fm.i18n('btnCancel')] = function() {
18088
  self.dialog.elfinderdialog('close');
18089
  };
18090
 
18091
+ content.find('select,input').addClass('elfinder-tabstop');
18092
+
18093
  dialog = fm.dialog(content, opts);
18094
+ dialogNode = dialog.closest('.ui-dialog');
18095
  dialog.ready(function(){
18096
  inputs.protocol.change();
18097
  dialog.elfinderdialog('posInit');
18098
  });
18099
  return dialog;
18100
+ },
18101
+ dialogNode;
18102
 
 
 
 
 
 
 
 
 
 
18103
  if (!self.dialog) {
18104
  self.dialog = create();
18105
+ } else {
18106
+ self.dialog.elfinderdialog('open');
18107
  }
18108
 
18109
  return dfrd.promise();
18110
  }
18111
 
18112
+ self.fm.bind('netmount', function(e) {
18113
+ var d = e.data || null,
18114
+ o = self.options;
18115
+ if (d && d.protocol) {
18116
+ if (o[d.protocol] && typeof o[d.protocol].done == 'function') {
18117
+ o[d.protocol].done(self.fm, d);
18118
+ content.find('select,input').addClass('elfinder-tabstop');
18119
+ self.dialog.elfinderdialog('tabstopsInit');
18120
+ }
18121
+ }
18122
+ });
18123
+
18124
  }
18125
 
18126
  elFinder.prototype.commands.netunmount = function() {
18162
  accept : {
18163
  label : 'btnUnmount',
18164
  callback : function() {
18165
+ var chDrive = (fm.root() == drive.hash),
18166
+ base = $('#'+fm.navHash2Id(drive.hash)).parent(),
18167
+ navTo = (base.next().length? base.next() : base.prev()).find('.elfinder-navbar-root');
18168
  fm.request({
18169
  data : {cmd : 'netmount', protocol : 'netunmount', host: drive.netkey, user : drive.hash, pass : 'dum'},
18170
  notify : {type : 'netunmount', cnt : 1, hideCnt : true},
18174
  dfrd.reject(error);
18175
  })
18176
  .done(function(data) {
18177
+ var open = fm.root();
 
 
18178
  if (chDrive) {
18179
+ if (navTo.length) {
18180
+ open = fm.navId2Hash(navTo[0].id);
18181
+ } else {
18182
+ var files = fm.files();
18183
+ for (var i in files) {
18184
+ if (fm.file(i).mime == 'directory') {
18185
+ open = i;
18186
+ break;
18187
+ }
18188
  }
18189
  }
18190
+ fm.exec('open', open);
18191
  }
18192
  dfrd.resolve();
18193
  });
18216
  *
18217
  * @author Dmitry (dio) Levashov
18218
  **/
18219
+ (elFinder.prototype.commands.open = function() {
18220
  this.alwaysEnabled = true;
18221
 
18222
  this._handlers = {
18233
  cnt = sel.length;
18234
 
18235
  return cnt == 1
18236
+ ? (sel[0].read? 0 : -1)
18237
+ : (cnt && !this.fm.UA.Mobile) ? ($.map(sel, function(file) { return file.mime == 'directory' || ! file.read ? null : file}).length == cnt ? 0 : -1) : -1
18238
  }
18239
 
18240
  this.exec = function(hashes, opts) {
18243
  files = this.files(hashes),
18244
  cnt = files.length,
18245
  thash = (typeof opts == 'object')? opts.thash : false,
18246
+ opts = this.options,
18247
  file, url, s, w, imgW, imgH, winW, winH, reg, link, html5dl, inline;
18248
 
18249
  if (!cnt && !thash) {
18259
  : fm.request({
18260
  data : {cmd : 'open', target : thash || file.hash},
18261
  notify : {type : 'open', cnt : 1, hideCnt : true},
18262
+ syncOnFail : true,
18263
+ lazy : false
18264
  });
18265
  }
18266
 
18271
  return dfrd.reject();
18272
  }
18273
 
18274
+ var doOpen = function() {
18275
+ try {
18276
+ reg = new RegExp(fm.option('dispInlineRegex'));
18277
+ } catch(e) {
18278
+ reg = false;
18279
+ }
18280
+
18281
+ // open files
18282
+ link = $('<a>').hide().appendTo($('body')),
18283
+ html5dl = (typeof link.get(0).download === 'string');
18284
+ cnt = files.length;
18285
+ while (cnt--) {
18286
+ file = files[cnt];
18287
+
18288
+ if (!file.read) {
18289
+ return dfrd.reject(['errOpen', file.name, 'errPerm']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18290
  }
 
18291
 
18292
+ inline = (reg && file.mime.match(reg));
18293
+ url = fm.openUrl(file.hash, !inline);
18294
+ if (fm.UA.Mobile || !inline) {
18295
+ if (html5dl) {
18296
+ !inline && link.attr('download', file.name);
18297
+ link.attr('href', url)
18298
+ .attr('target', '_blank')
18299
+ .get(0).click();
18300
+ } else {
18301
+ var wnd = window.open(url);
18302
+ if (!wnd) {
18303
+ return dfrd.reject('errPopup');
18304
+ }
18305
+ }
18306
  } else {
18307
+
18308
+ // set window size for image if set
18309
+ imgW = winW = Math.round(2 * $(window).width() / 3);
18310
+ imgH = winH = Math.round(2 * $(window).height() / 3);
18311
+ if (parseInt(file.width) && parseInt(file.height)) {
18312
+ imgW = parseInt(file.width);
18313
+ imgH = parseInt(file.height);
18314
+ } else if (file.dim) {
18315
+ s = file.dim.split('x');
18316
+ imgW = parseInt(s[0]);
18317
+ imgH = parseInt(s[1]);
18318
+ }
18319
+ if (winW >= imgW && winH >= imgH) {
18320
+ winW = imgW;
18321
+ winH = imgH;
18322
  } else {
18323
+ if ((imgW - winW) > (imgH - winH)) {
18324
+ winH = Math.round(imgH * (winW / imgW));
18325
+ } else {
18326
+ winW = Math.round(imgW * (winH / imgH));
18327
+ }
18328
  }
18329
+ w = 'width='+winW+',height='+winH;
18330
+
18331
+ if (url.indexOf(fm.options.url) === 0) {
18332
+ url = '';
18333
+ }
18334
+ var wnd = window.open(url, 'new_window', w + ',top=50,left=50,scrollbars=yes,resizable=yes');
18335
+ if (!wnd) {
18336
+ return dfrd.reject('errPopup');
18337
+ }
18338
+
18339
+ if (url === '') {
18340
+ var form = document.createElement("form");
18341
+ form.action = fm.options.url;
18342
+ form.method = typeof opts.method === 'string' && opts.method.toLowerCase() === 'get'? 'GET' : 'POST';
18343
+ form.target = 'new_window';
18344
+ form.style.display = 'none';
18345
+ var params = $.extend({}, fm.options.customData, {
18346
+ cmd: 'file',
18347
+ target: file.hash
18348
+ });
18349
+ $.each(params, function(key, val)
18350
+ {
18351
+ var input = document.createElement("input");
18352
+ input.name = key;
18353
+ input.value = val;
18354
+ form.appendChild(input);
18355
+ });
18356
+
18357
+ document.body.appendChild(form);
18358
+ form.submit();
18359
+ }
18360
+ wnd.focus();
18361
 
 
 
18362
  }
 
 
18363
  }
18364
+ link.remove();
18365
+ return dfrd.resolve(hashes);
18366
+ }
18367
+
18368
+ if (cnt > 1) {
18369
+ fm.confirm({
18370
+ title: 'openMulti',
18371
+ text : ['openMultiConfirm', cnt + ''],
18372
+ accept : {
18373
+ label : 'cmdopen',
18374
+ callback : function() { doOpen(); }
18375
+ },
18376
+ cancel : {
18377
+ label : 'btnCancel',
18378
+ callback : function() {
18379
+ dfrd.reject();
18380
+ }
18381
+ },
18382
+ buttons : (fm.getCommand('zipdl') && fm.isCommandEnabled('zipdl', fm.cwd().hash))? [
18383
+ {
18384
+ label : 'cmddownload',
18385
+ callback : function() {
18386
+ fm.exec('download', hashes);
18387
+ dfrd.reject();
18388
+ }
18389
+ }
18390
+ ] : []
18391
+ });
18392
+ } else {
18393
+ doOpen();
18394
  }
18395
+
18396
+ return dfrd;
18397
  }
18398
 
18399
+ }).prototype = { forceLoad : true }; // this is required command
18400
+
18401
 
18402
  /*
18403
  * File: /js/commands/opendir.js
18415
  this.getstate = function() {
18416
  var sel = this.fm.selected(),
18417
  cnt = sel.length,
18418
+ wz;
18419
  if (cnt !== 1) {
18420
  return -1;
18421
  }
18422
+ wz = this.fm.getUI('workzone');
18423
+ return wz.hasClass('elfinder-search-result')? 0 : -1;
18424
  }
18425
 
18426
  this.exec = function(hashes) {
18435
  }
18436
 
18437
  hash = files[0].phash;
18438
+ fm.trigger('searchend', { noupdate: true });
18439
+ fm.request({
18440
+ data : {cmd : 'open', target : hash},
18441
+ notify : {type : 'open', cnt : 1, hideCnt : true},
18442
+ syncOnFail : false
 
 
 
 
 
 
 
 
 
 
 
18443
  });
18444
 
18445
  return dfrd;
18446
  }
18447
 
18448
+ };
18449
 
18450
 
18451
  /*
18514
  paste = function(files) {
18515
  var dfrd = $.Deferred(),
18516
  existed = [],
18517
+ hashes = {},
18518
  intersect = function(files, names) {
18519
  var ret = [],
18520
  i = files.length;
18592
  })
18593
  },
18594
  valid = function(names) {
18595
+ var exists = {}, existedArr;
18596
+ if (names) {
18597
+ if ($.isArray(names)) {
18598
+ if (names.length) {
18599
+ if (typeof names[0] == 'string') {
18600
+ // elFinder <= 2.1.6 command `is` results
18601
+ existed = intersect(files, names);
18602
+ } else {
18603
+ $.each(names, function(i, v) {
18604
+ exists[v.name] = v.hash;
18605
+ });
18606
+ existed = intersect(files, $.map(exists, function(h, n) { return n; }));
18607
+ $.each(files, function(i, file) {
18608
+ if (exists[file.name]) {
18609
+ hashes[exists[file.name]] = file.name;
18610
+ }
18611
+ });
18612
+ }
18613
+ }
18614
+ } else {
18615
+ existedArr = [];
18616
+ existed = $.map(names, function(n) {
18617
+ if (typeof n === 'string') {
18618
+ return n;
18619
+ } else {
18620
+ // support to >=2.1.11 plugin Normalizer, Sanitizer
18621
+ existedArr = existedArr.concat(n);
18622
+ return null;
18623
+ }
18624
+ });
18625
+ if (existedArr.length) {
18626
+ existed = existed.concat(existedArr);
18627
+ }
18628
+ existed = intersect(files, existed);
18629
+ hashes = names;
18630
+ }
18631
+ }
18632
  existed.length ? confirm(0) : paste(files);
18633
  },
18634
  paste = function(files) {
18649
  }
18650
 
18651
  src = files[0].phash;
18652
+ files = $.map(files, function(f) { return f.hash; });
18653
 
18654
  fm.request({
18655
+ data : {cmd : 'paste', dst : dst.hash, targets : files, cut : cut ? 1 : 0, src : src, renames : renames, hashes : hashes, suffix : fm.options.backupSuffix},
18656
  notify : {type : cut ? 'move' : 'copy', cnt : cnt}
18657
  })
18658
  .done(function(data) {
18659
+ var newItem, node;
18660
  dfrd.resolve(data);
18661
  if (data && data.added && data.added[0]) {
18662
+ fm.one('pastedone', function() {
18663
+ newItem = fm.findCwdNodes(data.added);
18664
+ if (newItem.length) {
18665
+ newItem.trigger('scrolltoview');
18666
+ } else {
18667
+ if (dst.hash !== fm.cwd().hash) {
18668
+ node = $('<div/>').append(
18669
+ $('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all"><span class="ui-button-text">'+fm.i18n('cmdopendir')+'</span></button>')
18670
+ .on('mouseenter mouseleave', function(e) {
18671
+ $(this).toggleClass('ui-state-hover', e.type == 'mouseenter');
18672
+ }).on('click', function() {
18673
+ fm.exec('open', dst.hash).done(function() {
18674
+ fm.one('opendone', function() {
18675
+ fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})});
18676
+ });
18677
+ });
18678
+ })
18679
+ );
18680
+ } else {
18681
+ fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})});
18682
+ }
18683
+ fm.toast({msg: fm.i18n(['complete', fm.i18n('cmd' + (cut ? 'move' : 'copy'))]), extNode: node});
18684
+ }
18685
+ });
18686
  }
18687
  })
18688
  .always(function() {
18689
  fm.unlockfiles({files : files});
18690
  });
18691
+ },
18692
+ internames;
18693
 
18694
  if (!fm.isCommandEnabled(self.name, dst.hash) || !files.length) {
18695
  return dfrd.resolve();
18696
  }
18697
 
 
18698
  if (fm.oldAPI) {
18699
  paste(files);
18700
  } else {
18702
  if (!fm.option('copyOverwrite')) {
18703
  paste(files);
18704
  } else {
18705
+ internames = $.map(files, function(f) { return f.name});
18706
  dst.hash == fm.cwd().hash
18707
+ ? valid($.map(fm.files(), function(file) { return file.phash == dst.hash ? {hash: file.hash, name: file.name} : null }))
18708
  : fm.request({
18709
+ data : {cmd : 'ls', target : dst.hash, intersect : internames},
18710
  notify : {type : 'prepare', cnt : 1, hideCnt : true},
18711
  preventFail : true
18712
  })
18713
  .always(function(data) {
18714
+ valid(data.list);
18715
  });
18716
  }
18717
  }
18733
 
18734
  $.each(files, function(i, file) {
18735
  if (!file.read) {
18736
+ return !dfrd.reject([error, file.name, 'errPerm']);
18737
  }
18738
 
18739
  if (cut && file.locked) {
18744
  return !dfrd.reject(['errCopyInItself', file.name]);
18745
  }
18746
 
18747
+ if (file.mime && file.mime !== 'directory' && ! fm.uploadMimeCheck(file.mime, dst.hash)) {
18748
+ return !dfrd.reject([error, file.name, 'errUploadMime']);
18749
+ }
18750
+
18751
  fparents = fm.parents(file.hash);
18752
  fparents.pop();
18753
  if ($.inArray(dst.hash, fparents) !== -1) {
18780
  });
18781
  }
18782
 
18783
+ };
18784
+
18785
 
18786
  /*
18787
  * File: /js/commands/places.js
18819
 
18820
  };
18821
 
18822
+
18823
  /*
18824
  * File: /js/commands/quicklook.js
18825
  */
18830
  *
18831
  * @author Dmitry (dio) Levashov
18832
  **/
18833
+ (elFinder.prototype.commands.quicklook = function() {
18834
  var self = this,
18835
  fm = self.fm,
18836
  /**
18891
  * @return void
18892
  **/
18893
  closedCss = function(node) {
18894
+ var elf = fm.getUI().offset(),
18895
+ base = node.find('.elfinder-cwd-file-wrapper'),
18896
+ baseOffset = base.offset();
18897
  return {
18898
  opacity : 0,
18899
+ width : base.width(),
18900
+ height : base.height(),
18901
+ top : baseOffset.top - elf.top,
18902
+ left : baseOffset.left - elf.left
18903
  }
18904
  },
18905
  /**
18909
  **/
18910
  openedCss = function() {
18911
  var win = $(window);
18912
+ var elf = fm.getUI().offset();
18913
  var w = Math.min(width, $(window).width()-10);
18914
  var h = Math.min(height, $(window).height()-80);
18915
  return {
18916
  opacity : 1,
18917
  width : w,
18918
  height : h,
18919
+ top : parseInt((win.height() - h - 60) / 2 + win.scrollTop() - elf.top),
18920
+ left : parseInt((win.width() - w) / 2 + win.scrollLeft() - elf.left)
18921
  }
18922
  },
18923
 
18958
  * @type jQuery
18959
  **/
18960
  cwd,
18961
+ navdrag = false,
18962
+ navmove = false,
18963
+ navtm = null,
18964
+ leftKey = $.ui.keyCode.LEFT,
18965
+ rightKey = $.ui.keyCode.RIGHT,
18966
+ coverEv = 'mousemove touchstart ' + ('onwheel' in document? 'wheel' : 'onmousewheel' in document? 'mousewheel' : 'DOMMouseScroll'),
18967
  title = $('<div class="elfinder-quicklook-title"/>'),
18968
  icon = $('<div/>'),
18969
  info = $('<div class="elfinder-quicklook-info"/>'),//.hide(),
18970
+ cover = $('<div class="ui-front elfinder-quicklook-cover"/>'),
18971
  fsicon = $('<div class="'+navicon+' '+navicon+'-fullscreen"/>')
18972
+ .on('click touchstart', function(e) {
18973
+ if (navmove) {
18974
+ return;
18975
+ }
18976
+
18977
  var win = self.window,
18978
  full = win.hasClass(fullscreen),
18979
+ $window = $(window),
18980
+ resize = function() { self.preview.trigger('changesize'); };
18981
 
18982
  e.stopPropagation();
18983
+ e.preventDefault();
18984
 
18985
  if (full) {
18986
+ navStyle = '';
18987
+ navShow();
18988
+ win.toggleClass(fullscreen)
18989
+ .css(win.data('position'));
18990
+ $window.trigger(self.resize).off(self.resize, resize);
18991
+ navbar.off('mouseenter mouseleave');
18992
+ cover.off(coverEv);
18993
  } else {
18994
+ win.toggleClass(fullscreen)
18995
+ .data('position', {
18996
  left : win.css('left'),
18997
  top : win.css('top'),
18998
  width : win.width(),
18999
+ height : win.height(),
19000
+ display: 'block'
19001
  })
19002
+ .removeAttr('style');
 
 
 
19003
 
19004
+ $(window).on(self.resize, resize)
 
 
 
 
 
 
 
 
 
19005
  .trigger(self.resize);
19006
+
19007
+ cover.on(coverEv, function(e) {
19008
+ if (! navdrag) {
19009
+ if (e.type === 'mousemove' || e.type === 'touchstart') {
19010
+ navShow();
19011
+ navtm = setTimeout(function() {
19012
+ if (fm.UA.Mobile || navbar.parent().find('.elfinder-quicklook-navbar:hover').length < 1) {
19013
+ navbar.fadeOut('slow', function() {
19014
+ cover.show();
19015
+ });
19016
+ }
19017
+ }, 3000);
19018
+ }
19019
+ if (cover.is(':visible')) {
19020
+ coverHide();
19021
+ cover.data('tm', setTimeout(function() {
19022
+ cover.show();
19023
+ }, 3000));
19024
+ }
19025
+ }
19026
+ }).show().trigger('mousemove');
19027
 
19028
+ navbar.on('mouseenter mouseleave', function(e) {
19029
+ if (! navdrag) {
19030
+ if (e.type === 'mouseenter') {
19031
+ navShow();
19032
+ } else {
19033
+ cover.trigger('mousemove');
19034
+ }
19035
+ }
19036
+ });
19037
+ }
19038
+ if (fm.zIndex) {
19039
+ win.css('z-index', fm.zIndex + 1);
19040
+ }
19041
+ if (fm.UA.Mobile) {
19042
+ navbar.attr('style', navStyle);
19043
+ } else {
19044
+ navbar.attr('style', navStyle).draggable(full ? 'destroy' : {
19045
+ start: function() {
19046
+ navdrag = true;
19047
+ navmove = true;
19048
+ cover.show();
19049
+ navShow();
19050
+ },
19051
+ stop: function() {
19052
+ navdrag = false;
19053
+ navStyle = self.navbar.attr('style');
19054
+ setTimeout(function() {
19055
+ navmove = false;
19056
+ }, 20);
19057
+ }
19058
  });
19059
  }
 
 
19060
  $(this).toggleClass(navicon+'-fullscreen-off');
19061
  var collection = win;
19062
+ if (parent.is('.ui-resizable')) {
19063
  collection = collection.add(parent);
19064
  };
19065
+ $.fn.resizable && collection.resizable(full ? 'enable' : 'disable').removeClass('ui-state-disabled');
19066
+
19067
+ win.trigger('viewchange');
19068
  }),
19069
+
19070
+ navShow = function() {
19071
+ if (self.window.hasClass(fullscreen)) {
19072
+ navtm && clearTimeout(navtm);
19073
+ navtm = null;
19074
+ // if use `show()` it make infinite loop with old jQuery (jQuery/jQuery UI: 1.8.0/1.9.0)
19075
+ // see #1478 https://github.com/Studio-42/elFinder/issues/1478
19076
+ navbar.stop(true, true).css('display', 'block');
19077
+ coverHide();
19078
+ }
19079
+ },
19080
+
19081
+ coverHide = function() {
19082
+ cover.data('tm') && clearTimeout(cover.data('tm'));
19083
+ cover.removeData('tm');
19084
+ cover.hide();
19085
+ },
19086
 
19087
+ prev = $('<div class="'+navicon+' '+navicon+'-prev"/>').on('click touchstart', function(e) { ! navmove && navtrigger(leftKey); return false; }),
19088
+ next = $('<div class="'+navicon+' '+navicon+'-next"/>').on('click touchstart', function(e) { ! navmove && navtrigger(rightKey); return false; }),
19089
  navbar = $('<div class="elfinder-quicklook-navbar"/>')
19090
+ .append(prev)
19091
  .append(fsicon)
19092
+ .append(next)
19093
  .append('<div class="elfinder-quicklook-navbar-separator"/>')
19094
+ .append($('<div class="'+navicon+' '+navicon+'-close"/>').on('click touchstart', function(e) { ! navmove && self.window.trigger('close'); return false; }))
19095
+ ,
19096
+ navStyle = '';
19097
 
19098
+ (this.navbar = navbar)._show = navShow;
19099
  this.resize = 'resize.'+fm.namespace;
19100
  this.info = $('<div class="elfinder-quicklook-info-wrapper"/>')
19101
  .append(icon)
19103
 
19104
  this.preview = $('<div class="elfinder-quicklook-preview ui-helper-clearfix"/>')
19105
  // clean info/icon
19106
+ .on('change', function() {
19107
+ navShow();
19108
+ navbar.attr('style', navStyle);
19109
+ self.preview.attr('style', '').removeClass('elfinder-overflow-auto');
19110
  self.info.attr('style', '').hide();
19111
  icon.removeAttr('class').attr('style', '');
19112
  info.html('');
 
19113
  })
19114
  // update info/icon
19115
+ .on('update', function(e) {
19116
  var fm = self.fm,
19117
  preview = self.preview,
19118
  file = e.file,
19119
  tpl = '<div class="elfinder-quicklook-info-data">{value}</div>',
19120
  tmb;
19121
 
19122
+ if (file && (e.forceUpdate || self.window.data('hash') !== file.hash)) {
19123
  !file.read && e.stopImmediatePropagation();
19124
  self.window.data('hash', file.hash);
19125
+ self.preview.off('changesize').trigger('change').children().remove();
19126
  title.html(fm.escape(file.name));
19127
 
19128
+ prev.css('visibility', '');
19129
+ next.css('visibility', '');
19130
+ if (file.hash === fm.cwdId2Hash(cwd.find('[id]:first').attr('id'))) {
19131
+ prev.css('visibility', 'hidden');
19132
+ }
19133
+ if (file.hash === fm.cwdId2Hash(cwd.find('[id]:last').attr('id'))) {
19134
+ next.css('visibility', 'hidden');
19135
+ }
19136
+
19137
  info.html(
19138
  tpl.replace(/\{value\}/, fm.escape(file.name))
19139
  + tpl.replace(/\{value\}/, fm.mime2kind(file))
19142
  )
19143
  icon.addClass('elfinder-cwd-icon ui-corner-all '+fm.mime2class(file.mime));
19144
 
19145
+ if (file.read && (tmb = fm.tmb(file))) {
19146
  $('<img/>')
19147
  .hide()
19148
  .appendTo(self.preview)
19149
+ .on('load', function() {
19150
+ icon.addClass(tmb.className).css('background-image', "url('"+tmb.url+"')");
19151
  $(this).remove();
19152
  })
19153
+ .attr('src', tmb.url);
19154
  }
19155
  self.info.delay(100).fadeIn(10);
19156
+ if (self.window.hasClass(fullscreen)) {
19157
+ cover.trigger('mousemove');
19158
+ }
19159
  } else {
19160
  e.stopImmediatePropagation();
19161
  }
19164
 
19165
 
19166
 
19167
+ this.window = $('<div class="ui-front ui-helper-reset ui-widget elfinder-quicklook touch-punch" style="position:absolute"/>')
19168
+ .hide()
19169
+ .addClass(fm.UA.Touch? 'elfinder-touch' : '')
19170
+ .on('click', function(e) { e.stopPropagation(); })
19171
  .append(
19172
  $('<div class="elfinder-quicklook-titlebar"/>')
19173
+ .append(
19174
+ title,
19175
+ $('<span class="ui-icon ui-icon-circle-close"/>').mousedown(function(e) {
19176
  e.stopPropagation();
19177
  self.window.trigger('close');
19178
+ })),
19179
+ this.preview,
19180
+ self.info.hide(),
19181
+ cover.hide(),
19182
+ navbar
19183
+ )
19184
  .draggable({handle : 'div.elfinder-quicklook-titlebar'})
19185
+ .on('open', function(e) {
19186
  var win = self.window,
19187
  file = self.value,
19188
  node;
19189
 
19190
+ if (self.closed() && file && (node = $('#'+fm.cwdHash2Id(file.hash))).length) {
19191
+ navStyle = '';
19192
  navbar.attr('style', '');
19193
  state = animated;
19194
  node.trigger('scrolltoview');
19195
+ coverHide();
19196
  win.css(closedCss(node))
19197
  .show()
19198
  .animate(openedCss(), 550, function() {
19199
  state = opened;
19200
  self.update(1, self.value);
19201
+ navShow();
19202
  });
19203
  }
19204
  })
19205
+ .on('close', function(e) {
19206
  var win = self.window,
19207
  preview = self.preview.trigger('change'),
19208
  file = self.value,
19215
 
19216
  };
19217
 
19218
+ win.data('hash', '');
19219
  if (self.opened()) {
19220
  state = animated;
19221
+ win.hasClass(fullscreen) && fsicon.click();
19222
  node.length
19223
  ? win.animate(closedCss(node), 500, close)
19224
  : close();
19244
  select : function() { this.update(void(0), this.fm.selectedFiles()[0]); },
19245
  error : function() { self.window.is(':visible') && self.window.data('hash', '').trigger('close'); },
19246
  'searchshow searchhide' : function() { this.opened() && this.window.trigger('close'); }
19247
+ };
19248
 
19249
  this.shortcuts = [{
19250
  pattern : 'space'
19255
  ogg : support('audio/ogg; codecs="vorbis"'),
19256
  mp3 : support('audio/mpeg;'),
19257
  wav : support('audio/wav; codecs="1"'),
19258
+ m4a : support('audio/mp4;') || support('audio/x-m4a;') || support('audio/aac;')
19259
  },
19260
  video : {
19261
  ogg : support('video/ogg; codecs="theora"'),
19262
  webm : support('video/webm; codecs="vp8, vorbis"'),
19263
  mp4 : support('video/mp4; codecs="avc1.42E01E"') || support('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')
19264
  }
19265
+ };
 
19266
 
19267
  /**
19268
  * Return true if quickLoock window is visible and not animated
19271
  **/
19272
  this.closed = function() {
19273
  return state == closed;
19274
+ };
19275
 
19276
  /**
19277
  * Return true if quickLoock window is hidden
19280
  **/
19281
  this.opened = function() {
19282
  return state == opened;
19283
+ };
19284
 
19285
  /**
19286
  * Init command.
19292
  var o = this.options,
19293
  win = this.window,
19294
  preview = this.preview,
19295
+ i, p, curCwd;
19296
 
19297
  width = o.width > 0 ? parseInt(o.width) : 450;
19298
  height = o.height > 0 ? parseInt(o.height) : 300;
19301
  parent = fm.getUI();
19302
  cwd = fm.getUI('cwd');
19303
 
19304
+ if (fm.zIndex) {
19305
+ win.css('z-index', fm.zIndex + 1);
19306
+ }
19307
+
19308
+ win.appendTo(parent);
19309
 
19310
  // close window on escape
19311
  $(document).keydown(function(e) {
19312
+ e.keyCode == $.ui.keyCode.ESCAPE && self.opened() && win.trigger('close')
19313
  })
19314
 
19315
+ if ($.fn.resizable) {
19316
  win.resizable({
19317
  handles : 'se',
19318
  minWidth : 350,
19327
 
19328
  self.change(function() {
19329
  if (self.opened()) {
19330
+ setTimeout(function() {
19331
+ if (self.value) {
19332
+ preview.trigger($.Event('update', {file : self.value}))
19333
+ } else {
19334
+ navtrigger(rightKey);
19335
+ setTimeout(function() {
19336
+ ! self.value && win.trigger('close');
19337
+ }, 10);
19338
+ }
19339
+ }, 10);
19340
  }
19341
  });
19342
 
19343
+ preview.on('update', function(data) {
19344
+ if (fm.searchStatus.mixed && fm.searchStatus.state > 1) {
19345
+ // set current volume dispInlineRegex
19346
+ try {
19347
+ self.dispInlineRegex = new RegExp(fm.option('dispInlineRegex', data.file.hash));
19348
+ } catch(e) {
19349
+ self.dispInlineRegex = /.*/;
19350
+ }
19351
+ }
19352
+ self.info.show();
19353
+ });
19354
+
19355
  $.each(fm.commands.quicklook.plugins || [], function(i, plugin) {
19356
  if (typeof(plugin) == 'function') {
19357
  new plugin(self)
19358
  }
19359
  });
19360
+ });
19361
+
19362
+ fm.bind('open',function() {
19363
+ var prevCwd = curCwd;
19364
 
19365
+ // change cwd
19366
+ curCwd = fm.cwd().hash;
19367
+ if (self.opened() && prevCwd !== curCwd) {
19368
+ win.trigger('close');
19369
+ }
19370
+
19371
+ // set current volume dispInlineRegex
19372
+ try {
19373
+ self.dispInlineRegex = new RegExp(fm.option('dispInlineRegex'));
19374
+ } catch(e) {
19375
+ self.dispInlineRegex = /.*/;
19376
+ }
19377
  });
19378
 
19379
+ fm.bind('destroy', function() {
19380
+ self.window.remove();
19381
+ });
19382
+ };
19383
 
19384
  this.getstate = function() {
19385
+ var fm = this.fm,
19386
+ sel = fm.selected(),
19387
+ chk = sel.length === 1 && $('#'+fm.cwdHash2Id(sel[0])).length;
19388
+ return chk? state == opened ? 1 : 0 : -1;
19389
+ };
19390
 
19391
  this.exec = function() {
19392
  this.enabled() && this.window.trigger(this.opened() ? 'close' : 'open');
19393
+ };
19394
 
19395
  this.hideinfo = function() {
19396
+ this.info.stop(true, true).hide();
19397
+ };
 
 
19398
 
19399
+ }).prototype = { forceLoad : true }; // this is required command
19400
 
19401
 
19402
  /*
19412
  * @param elFinder.commands.quicklook
19413
  **/
19414
  function(ql) {
19415
+ var mimes = ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp'],
19416
  preview = ql.preview;
19417
 
19418
  // what kind of images we can display
19424
  }
19425
  });
19426
 
19427
+ preview.on('update', function(e) {
19428
+ var fm = ql.fm,
19429
+ file = e.file,
19430
+ url, img, loading, m;
19431
 
19432
+ if (ql.dispInlineRegex.test(file.mime) && $.inArray(file.mime, mimes) !== -1) {
19433
  // this is our file - stop event propagation
19434
  e.stopImmediatePropagation();
19435
 
19436
+ loading = $('<div class="elfinder-quicklook-info-data"> '+fm.i18n('nowLoading')+'<span class="elfinder-info-spinner"></div>').appendTo(ql.info.find('.elfinder-quicklook-info'));
19437
+
19438
+ url = fm.openUrl(file.hash);
19439
+ if (url.indexOf('?') === -1) {
19440
+ url += '?_=';
19441
+ } else {
19442
+ if (m = url.match(/[\?&](_+)=/)) {
19443
+ url += '&' + '_'.repeat(m[1].length + 1) + '=';
19444
+ } else {
19445
+ url += '&_=';
19446
+ }
19447
+ }
19448
+ url += (file.ts || +new Date);
19449
+
19450
  img = $('<img/>')
19451
  .hide()
19452
  .appendTo(preview)
19453
+ .on('load', function() {
19454
  // timeout - because of strange safari bug -
19455
  // sometimes cant get image height 0_o
19456
  setTimeout(function() {
19457
  var prop = (img.width()/img.height()).toFixed(2);
19458
+ preview.on('changesize', function() {
19459
  var pw = parseInt(preview.width()),
19460
  ph = parseInt(preview.height()),
19461
  w, h;
19472
  })
19473
  .trigger('changesize');
19474
 
19475
+ loading.remove();
19476
  // hide info/icon
19477
  ql.hideinfo();
19478
  //show image
19479
  img.fadeIn(100);
19480
  }, 1)
19481
  })
19482
+ .on('error', function() {
19483
+ loading.remove();
19484
+ })
19485
+ .attr('src', url);
19486
  }
19487
 
19488
  });
19498
  preview = ql.preview,
19499
  fm = ql.fm;
19500
 
19501
+ preview.on('update', function(e) {
19502
+ var file = e.file, jqxhr, loading;
19503
 
19504
+ if (ql.dispInlineRegex.test(file.mime) && $.inArray(file.mime, mimes) !== -1) {
19505
  e.stopImmediatePropagation();
19506
 
19507
+ loading = $('<div class="elfinder-quicklook-info-data"> '+fm.i18n('nowLoading')+'<span class="elfinder-info-spinner"></div>').appendTo(ql.info.find('.elfinder-quicklook-info'));
19508
+
19509
  // stop loading on change file if not loaded yet
19510
  preview.one('change', function() {
19511
  jqxhr.state() == 'pending' && jqxhr.reject();
19512
+ }).addClass('elfinder-overflow-auto');
19513
 
19514
  jqxhr = fm.request({
19515
  data : {cmd : 'get', target : file.hash, current : file.phash, conv : 1},
19517
  })
19518
  .done(function(data) {
19519
  ql.hideinfo();
19520
+ var doc = $('<iframe class="elfinder-quicklook-preview-html"/>').appendTo(preview)[0].contentWindow.document;
19521
  doc.open();
19522
  doc.write(data.content);
19523
  doc.close();
19524
+ })
19525
+ .always(function() {
19526
+ loading.remove();
19527
  });
19528
  }
19529
  })
19540
  preview = ql.preview;
19541
 
19542
 
19543
+ preview.on('update', function(e) {
19544
  var file = e.file,
19545
  mime = file.mime,
19546
+ jqxhr, loading;
19547
 
19548
  if (mime.indexOf('text/') === 0 || $.inArray(mime, mimes) !== -1) {
19549
  e.stopImmediatePropagation();
19550
 
19551
+ loading = $('<div class="elfinder-quicklook-info-data"> '+fm.i18n('nowLoading')+'<span class="elfinder-info-spinner"></div>').appendTo(ql.info.find('.elfinder-quicklook-info'));
19552
+
19553
  // stop loading on change file if not loadin yet
19554
  preview.one('change', function() {
19555
  jqxhr.state() == 'pending' && jqxhr.reject();
19562
  .done(function(data) {
19563
  ql.hideinfo();
19564
  $('<div class="elfinder-quicklook-preview-text-wrapper"><pre class="elfinder-quicklook-preview-text">'+fm.escape(data.content)+'</pre></div>').appendTo(preview);
19565
+ })
19566
+ .always(function() {
19567
+ loading.remove();
19568
  });
19569
  }
19570
  });
19593
  });
19594
  }
19595
 
19596
+ active && preview.on('update', function(e) {
19597
  var file = e.file, node;
19598
 
19599
+ if (ql.dispInlineRegex.test(file.mime) && file.mime == mime) {
19600
  e.stopImmediatePropagation();
19601
  preview.one('change', function() {
19602
+ node.off('load').remove();
19603
+ }).addClass('elfinder-overflow-auto');
19604
 
19605
  node = $('<iframe class="elfinder-quicklook-preview-pdf"/>')
19606
  .hide()
19607
  .appendTo(preview)
19608
+ .on('load', function() {
19609
  ql.hideinfo();
19610
  node.show();
19611
  })
19636
  });
19637
  });
19638
 
19639
+ active && preview.on('update', function(e) {
19640
  var file = e.file,
19641
  node;
19642
 
19643
+ if (ql.dispInlineRegex.test(file.mime) && file.mime == mime) {
19644
  e.stopImmediatePropagation();
19645
  ql.hideinfo();
19646
+ node = $('<embed class="elfinder-quicklook-preview-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+fm.url(file.hash)+'" quality="high" type="application/x-shockwave-flash" wmode="transparent" />')
19647
+ .appendTo(preview);
19648
  }
19649
  });
19650
  },
19671
  'audio/x-mp4' : 'm4a',
19672
  'audio/ogg' : 'ogg'
19673
  },
19674
+ node,
19675
+ win = ql.window,
19676
+ navi = ql.navbar;
19677
 
19678
+ preview.on('update', function(e) {
19679
  var file = e.file,
19680
+ type = mimes[file.mime],
19681
+ setNavi = function() {
19682
+ navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : '');
19683
+ };
19684
 
19685
  if (ql.support.audio[type]) {
19686
  e.stopImmediatePropagation();
19688
  node = $('<audio class="elfinder-quicklook-preview-audio" controls preload="auto" autobuffer><source src="'+ql.fm.openUrl(file.hash)+'" /></audio>')
19689
  .appendTo(preview);
19690
  autoplay && node[0].play();
19691
+
19692
+ win.on('viewchange.audio', setNavi);
19693
+ setNavi();
19694
  }
19695
+ }).on('change', function() {
19696
  if (node && node.parent().length) {
19697
+ win.off('viewchange.audio');
19698
  node[0].pause();
19699
  node.remove();
19700
  node= null;
19713
  mimes = {
19714
  'video/mp4' : 'mp4',
19715
  'video/x-m4v' : 'mp4',
19716
+ 'video/quicktime' : 'mp4',
19717
  'video/ogg' : 'ogg',
19718
  'application/ogg' : 'ogg',
19719
  'video/webm' : 'webm'
19720
  },
19721
+ node,
19722
+ win = ql.window,
19723
+ navi = ql.navbar;
19724
 
19725
+ preview.on('update', function(e) {
19726
  var file = e.file,
19727
+ type = mimes[file.mime],
19728
+ setNavi = function() {
19729
+ if (ql.fm.UA.iOS) {
19730
+ if (win.hasClass('elfinder-quicklook-fullscreen')) {
19731
+ preview.css('height', '-webkit-calc(100% - 50px)');
19732
+ navi._show();
19733
+ } else {
19734
+ preview.css('height', '');
19735
+ }
19736
+ } else {
19737
+ navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : '');
19738
+ }
19739
+ };
19740
 
19741
  if (ql.support.video[type]) {
19742
  e.stopImmediatePropagation();
19744
  ql.hideinfo();
19745
  node = $('<video class="elfinder-quicklook-preview-video" controls preload="auto" autobuffer><source src="'+ql.fm.openUrl(file.hash)+'" /></video>').appendTo(preview);
19746
  autoplay && node[0].play();
19747
+
19748
+ win.on('viewchange.video', setNavi);
19749
+ setNavi();
19750
  }
19751
+ }).on('change', function() {
19752
  if (node && node.parent().length) {
19753
+ win.off('viewchange.video');
19754
  node[0].pause();
19755
  node.remove();
19756
  node= null;
19766
  function(ql) {
19767
  var preview = ql.preview,
19768
  mimes = [],
19769
+ node,
19770
+ win = ql.window,
19771
+ navi = ql.navbar;
19772
 
19773
  $.each(navigator.plugins, function(i, plugins) {
19774
  $.each(plugins, function(i, plugin) {
19776
  });
19777
  });
19778
 
19779
+ preview.on('update', function(e) {
19780
  var file = e.file,
19781
  mime = file.mime,
19782
+ video,
19783
+ setNavi = function() {
19784
+ navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : '');
19785
+ };
19786
 
19787
  if ($.inArray(file.mime, mimes) !== -1) {
19788
  e.stopImmediatePropagation();
19789
  (video = mime.indexOf('video/') === 0) && ql.hideinfo();
19790
  node = $('<embed src="'+ql.fm.openUrl(file.hash)+'" type="'+mime+'" class="elfinder-quicklook-preview-'+(video ? 'video' : 'audio')+'"/>')
19791
  .appendTo(preview);
19792
+
19793
+ win.on('viewchange.embed', setNavi);
19794
+ setNavi();
19795
  }
19796
+ }).on('change', function() {
19797
  if (node && node.parent().length) {
19798
+ win.off('viewchange.embed');
19799
  node.remove();
19800
  node= null;
19801
  }
19802
  });
19803
+
19804
+ },
19805
+
19806
+ /**
19807
+ * Archive(zip|gzip|tar) preview plugin using https://github.com/imaya/zlib.js
19808
+ *
19809
+ * @param elFinder.commands.quicklook
19810
+ **/
19811
+ function(ql) {
19812
+ var mimes = ['application/zip', 'application/x-gzip', 'application/x-tar'],
19813
+ preview = ql.preview,
19814
+ fm = ql.fm;
19815
+
19816
+ if (typeof Uint8Array !== 'undefined' && elFinder.Zlib) {
19817
+ preview.on('update', function(e) {
19818
+ var file = e.file,
19819
+ doc, xhr, loading;
19820
+
19821
+ if ($.inArray(file.mime, mimes) !== -1) {
19822
+ // this is our file - stop event propagation
19823
+ e.stopImmediatePropagation();
19824
+
19825
+ loading = $('<div class="elfinder-quicklook-info-data"> '+fm.i18n('nowLoading')+'<span class="elfinder-info-spinner"></div>').appendTo(ql.info.find('.elfinder-quicklook-info'));
19826
+
19827
+ // stop loading on change file if not loaded yet
19828
+ preview.one('change', function() {
19829
+ loading.remove();
19830
+ xhr && xhr.readyState < 4 && xhr.abort();
19831
+ });
19832
+
19833
+ xhr = new XMLHttpRequest();
19834
+ xhr.onload = function(e) {
19835
+ var filenames = [], header, unzip, tar, tarlen, offset, h, name, prefix, size, dbs, toStr;
19836
+ if (this.readyState === 4 && this.response) {
19837
+ setTimeout(function() {
19838
+ try {
19839
+ if (file.mime === 'application/zip') {
19840
+ unzip = new elFinder.Zlib.Unzip(new Uint8Array(xhr.response));
19841
+ filenames = unzip.getFilenames();
19842
+ } else {
19843
+ if (file.mime === 'application/x-gzip') {
19844
+ unzip = new elFinder.Zlib.Gunzip(new Uint8Array(xhr.response));
19845
+ tar = unzip.decompress();
19846
+ } else {
19847
+ tar = new Uint8Array(xhr.response);
19848
+ }
19849
+ tarlen = tar.length;
19850
+ offset = 0;
19851
+ toStr = function(arr) {
19852
+ return String.fromCharCode.apply(null, arr).replace(/\0+$/, '');
19853
+ };
19854
+ while (offset < tarlen && tar[offset] !== 0) {
19855
+ h = tar.subarray(offset, offset + 512);
19856
+ name = toStr(h.subarray(0, 100));
19857
+ if (prefix = toStr(h.subarray(345, 500))) {
19858
+ name = prefix + name;
19859
+ }
19860
+ size = parseInt(toStr(h.subarray(124, 136)), 8);
19861
+ dbs = Math.ceil(size / 512) * 512;
19862
+ if (name === '././@LongLink') {
19863
+ name = toStr(tar.subarray(offset + 512, offset + 512 + dbs));
19864
+ }
19865
+ (name !== 'pax_global_header') && filenames.push(name);
19866
+ offset = offset + 512 + dbs;
19867
+ }
19868
+ }
19869
+ } catch (e) {
19870
+ loading.remove();
19871
+ fm.debug('error', e);
19872
+ }
19873
+ if (filenames && filenames.length) {
19874
+ filenames = $.map(filenames, function(str) {
19875
+ return fm.decodeRawString(str);
19876
+ });
19877
+ filenames.sort();
19878
+ loading.remove();
19879
+ header = '<strong>'+fm.escape(file.mime)+'</strong> ('+fm.formatSize(file.size)+')'+'<hr/>'
19880
+ doc = $('<div class="elfinder-quicklook-preview-archive-wrapper">'+header+'<pre class="elfinder-quicklook-preview-text">'+fm.escape(filenames.join("\n"))+'</pre></div>').appendTo(preview);
19881
+ ql.hideinfo();
19882
+ }
19883
+ }, 70);
19884
+ } else {
19885
+ loading.remove();
19886
+ }
19887
+ }
19888
+ xhr.open('GET', fm.openUrl(file.hash, fm.xhrFields.withCredentials || false), true);
19889
+ xhr.responseType = 'arraybuffer';
19890
+ // set request headers
19891
+ if (fm.customHeaders) {
19892
+ $.each(fm.customHeaders, function(key) {
19893
+ xhr.setRequestHeader(key, this);
19894
+ });
19895
+ }
19896
+ // set xhrFields
19897
+ if (fm.xhrFields) {
19898
+ $.each(fm.xhrFields, function(key) {
19899
+ if (key in xhr) {
19900
+ xhr[key] = this;
19901
+ }
19902
+ });
19903
+ }
19904
+ xhr.send();
19905
+ }
19906
+ });
19907
+ }
19908
+ },
19909
+
19910
+ /**
19911
+ * Any supported files preview plugin using Google docs online viewer
19912
+ *
19913
+ * @param elFinder.commands.quicklook
19914
+ **/
19915
+ function(ql) {
19916
+ var fm = ql.fm,
19917
+ mimes = ql.options.googleDocsMimes || [],
19918
+ preview = ql.preview,
19919
+ win = ql.window,
19920
+ navi = ql.navbar,
19921
+ node;
19922
+
19923
+ preview.on('update', function(e) {
19924
+ var win = ql.window,
19925
+ file = e.file,
19926
+ setNavi = function() {
19927
+ navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '56px' : '');
19928
+ },
19929
+ loading;
19930
+
19931
+ if ($.inArray(file.mime, mimes) !== -1) {
19932
+ if (file.url == '1') {
19933
+ $('<div class="elfinder-quicklook-info-data"><button class="elfinder-info-button">'+fm.i18n('getLink')+'</button></div>').appendTo(ql.info.find('.elfinder-quicklook-info'))
19934
+ .on('click', function() {
19935
+ var self = $(this);
19936
+ self.html('<span class="elfinder-info-spinner">');
19937
+ fm.request({
19938
+ data : {cmd : 'url', target : file.hash},
19939
+ preventDefault : true
19940
+ })
19941
+ .always(function() {
19942
+ self.html('');
19943
+ })
19944
+ .done(function(data) {
19945
+ var rfile = fm.file(file.hash);
19946
+ file.url = rfile.url = data.url || '';
19947
+ if (file.url) {
19948
+ preview.trigger({
19949
+ type: 'update',
19950
+ file: file,
19951
+ forceUpdate: true
19952
+ });
19953
+ }
19954
+ });
19955
+ });
19956
+ }
19957
+ if (file.url !== '' && file.url != '1') {
19958
+ e.stopImmediatePropagation();
19959
+ preview.one('change', function() {
19960
+ win.off('viewchange.googledocs');
19961
+ loading.remove();
19962
+ node.off('load').remove();
19963
+ node = null;
19964
+ }).addClass('elfinder-overflow-auto');
19965
+
19966
+ loading = $('<div class="elfinder-quicklook-info-data"> '+fm.i18n('nowLoading')+'<span class="elfinder-info-spinner"></div>').appendTo(ql.info.find('.elfinder-quicklook-info'));
19967
+
19968
+ node = $('<iframe class="elfinder-quicklook-preview-iframe"/>')
19969
+ .css('background-color', 'transparent')
19970
+ .appendTo(preview)
19971
+ .on('load', function() {
19972
+ ql.hideinfo();
19973
+ loading.remove();
19974
+ $(this).css('background-color', '#fff').show();
19975
+ })
19976
+ .attr('src', '//docs.google.com/gview?embedded=true&url=' + encodeURIComponent(fm.convAbsUrl(fm.url(file.hash))));
19977
+
19978
+ win.on('viewchange.googledocs', setNavi);
19979
+ setNavi();
19980
+ }
19981
+ }
19982
+
19983
+ });
19984
  }
19985
+
19986
+ ];
19987
+
19988
+ try {
19989
+ (function(){
19990
+
19991
+ /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function m(a){throw a;}var q=void 0,u,aa=this;function v(a,b){var c=a.split("."),d=aa;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var f;c.length&&(f=c.shift());)!c.length&&b!==q?d[f]=b:d=d[f]?d[f]:d[f]={}};var w="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;new (w?Uint8Array:Array)(256);var x;for(x=0;256>x;++x)for(var y=x,ba=7,y=y>>>1;y;y>>>=1)--ba;var z=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,
19992
+ 2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,
19993
+ 2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,
19994
+ 2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,
19995
+ 3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,
19996
+ 936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],B=w?new Uint32Array(z):z;function C(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,f,h,k,e,g,l,p,s,r,A;for(s=0;s<b;++s)a[s]>c&&(c=a[s]),a[s]<d&&(d=a[s]);f=1<<c;h=new (w?Uint32Array:Array)(f);k=1;e=0;for(g=2;k<=c;){for(s=0;s<b;++s)if(a[s]===k){l=0;p=e;for(r=0;r<k;++r)l=l<<1|p&1,p>>=1;A=k<<16|s;for(r=l;r<f;r+=g)h[r]=A;++e}++k;e<<=1;g<<=1}return[h,c,d]};var D=[],E;for(E=0;288>E;E++)switch(!0){case 143>=E:D.push([E+48,8]);break;case 255>=E:D.push([E-144+400,9]);break;case 279>=E:D.push([E-256+0,7]);break;case 287>=E:D.push([E-280+192,8]);break;default:m("invalid literal: "+E)}
19997
+ var ca=function(){function a(a){switch(!0){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,
19998
+ a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:m("invalid length: "+a)}}var b=[],c,d;for(c=3;258>=c;c++)d=a(c),b[c]=d[2]<<24|d[1]<<
19999
+ 16|d[0];return b}();w&&new Uint32Array(ca);function F(a,b){this.l=[];this.m=32768;this.d=this.f=this.c=this.t=0;this.input=w?new Uint8Array(a):a;this.u=!1;this.n=G;this.L=!1;if(b||!(b={}))b.index&&(this.c=b.index),b.bufferSize&&(this.m=b.bufferSize),b.bufferType&&(this.n=b.bufferType),b.resize&&(this.L=b.resize);switch(this.n){case H:this.a=32768;this.b=new (w?Uint8Array:Array)(32768+this.m+258);break;case G:this.a=0;this.b=new (w?Uint8Array:Array)(this.m);this.e=this.X;this.B=this.S;this.q=this.W;break;default:m(Error("invalid inflate mode"))}}
20000
+ var H=0,G=1;
20001
+ F.prototype.r=function(){for(;!this.u;){var a=I(this,3);a&1&&(this.u=!0);a>>>=1;switch(a){case 0:var b=this.input,c=this.c,d=this.b,f=this.a,h=b.length,k=q,e=q,g=d.length,l=q;this.d=this.f=0;c+1>=h&&m(Error("invalid uncompressed block header: LEN"));k=b[c++]|b[c++]<<8;c+1>=h&&m(Error("invalid uncompressed block header: NLEN"));e=b[c++]|b[c++]<<8;k===~e&&m(Error("invalid uncompressed block header: length verify"));c+k>b.length&&m(Error("input buffer is broken"));switch(this.n){case H:for(;f+k>d.length;){l=
20002
+ g-f;k-=l;if(w)d.set(b.subarray(c,c+l),f),f+=l,c+=l;else for(;l--;)d[f++]=b[c++];this.a=f;d=this.e();f=this.a}break;case G:for(;f+k>d.length;)d=this.e({H:2});break;default:m(Error("invalid inflate mode"))}if(w)d.set(b.subarray(c,c+k),f),f+=k,c+=k;else for(;k--;)d[f++]=b[c++];this.c=c;this.a=f;this.b=d;break;case 1:this.q(da,ea);break;case 2:fa(this);break;default:m(Error("unknown BTYPE: "+a))}}return this.B()};
20003
+ var J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=w?new Uint16Array(J):J,L=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],M=w?new Uint16Array(L):L,ga=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],O=w?new Uint8Array(ga):ga,ha=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ia=w?new Uint16Array(ha):ha,ja=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,
20004
+ 12,12,13,13],P=w?new Uint8Array(ja):ja,Q=new (w?Uint8Array:Array)(288),R,la;R=0;for(la=Q.length;R<la;++R)Q[R]=143>=R?8:255>=R?9:279>=R?7:8;var da=C(Q),S=new (w?Uint8Array:Array)(30),T,ma;T=0;for(ma=S.length;T<ma;++T)S[T]=5;var ea=C(S);function I(a,b){for(var c=a.f,d=a.d,f=a.input,h=a.c,k=f.length,e;d<b;)h>=k&&m(Error("input buffer is broken")),c|=f[h++]<<d,d+=8;e=c&(1<<b)-1;a.f=c>>>b;a.d=d-b;a.c=h;return e}
20005
+ function U(a,b){for(var c=a.f,d=a.d,f=a.input,h=a.c,k=f.length,e=b[0],g=b[1],l,p;d<g&&!(h>=k);)c|=f[h++]<<d,d+=8;l=e[c&(1<<g)-1];p=l>>>16;a.f=c>>p;a.d=d-p;a.c=h;return l&65535}
20006
+ function fa(a){function b(a,b,c){var d,e=this.K,f,g;for(g=0;g<a;)switch(d=U(this,b),d){case 16:for(f=3+I(this,2);f--;)c[g++]=e;break;case 17:for(f=3+I(this,3);f--;)c[g++]=0;e=0;break;case 18:for(f=11+I(this,7);f--;)c[g++]=0;e=0;break;default:e=c[g++]=d}this.K=e;return c}var c=I(a,5)+257,d=I(a,5)+1,f=I(a,4)+4,h=new (w?Uint8Array:Array)(K.length),k,e,g,l;for(l=0;l<f;++l)h[K[l]]=I(a,3);if(!w){l=f;for(f=h.length;l<f;++l)h[K[l]]=0}k=C(h);e=new (w?Uint8Array:Array)(c);g=new (w?Uint8Array:Array)(d);a.K=
20007
+ 0;a.q(C(b.call(a,c,k,e)),C(b.call(a,d,k,g)))}u=F.prototype;u.q=function(a,b){var c=this.b,d=this.a;this.C=a;for(var f=c.length-258,h,k,e,g;256!==(h=U(this,a));)if(256>h)d>=f&&(this.a=d,c=this.e(),d=this.a),c[d++]=h;else{k=h-257;g=M[k];0<O[k]&&(g+=I(this,O[k]));h=U(this,b);e=ia[h];0<P[h]&&(e+=I(this,P[h]));d>=f&&(this.a=d,c=this.e(),d=this.a);for(;g--;)c[d]=c[d++-e]}for(;8<=this.d;)this.d-=8,this.c--;this.a=d};
20008
+ u.W=function(a,b){var c=this.b,d=this.a;this.C=a;for(var f=c.length,h,k,e,g;256!==(h=U(this,a));)if(256>h)d>=f&&(c=this.e(),f=c.length),c[d++]=h;else{k=h-257;g=M[k];0<O[k]&&(g+=I(this,O[k]));h=U(this,b);e=ia[h];0<P[h]&&(e+=I(this,P[h]));d+g>f&&(c=this.e(),f=c.length);for(;g--;)c[d]=c[d++-e]}for(;8<=this.d;)this.d-=8,this.c--;this.a=d};
20009
+ u.e=function(){var a=new (w?Uint8Array:Array)(this.a-32768),b=this.a-32768,c,d,f=this.b;if(w)a.set(f.subarray(32768,a.length));else{c=0;for(d=a.length;c<d;++c)a[c]=f[c+32768]}this.l.push(a);this.t+=a.length;if(w)f.set(f.subarray(b,b+32768));else for(c=0;32768>c;++c)f[c]=f[b+c];this.a=32768;return f};
20010
+ u.X=function(a){var b,c=this.input.length/this.c+1|0,d,f,h,k=this.input,e=this.b;a&&("number"===typeof a.H&&(c=a.H),"number"===typeof a.Q&&(c+=a.Q));2>c?(d=(k.length-this.c)/this.C[2],h=258*(d/2)|0,f=h<e.length?e.length+h:e.length<<1):f=e.length*c;w?(b=new Uint8Array(f),b.set(e)):b=e;return this.b=b};
20011
+ u.B=function(){var a=0,b=this.b,c=this.l,d,f=new (w?Uint8Array:Array)(this.t+(this.a-32768)),h,k,e,g;if(0===c.length)return w?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);h=0;for(k=c.length;h<k;++h){d=c[h];e=0;for(g=d.length;e<g;++e)f[a++]=d[e]}h=32768;for(k=this.a;h<k;++h)f[a++]=b[h];this.l=[];return this.buffer=f};
20012
+ u.S=function(){var a,b=this.a;w?this.L?(a=new Uint8Array(b),a.set(this.b.subarray(0,b))):a=this.b.subarray(0,b):(this.b.length>b&&(this.b.length=b),a=this.b);return this.buffer=a};function V(a){a=a||{};this.files=[];this.v=a.comment}V.prototype.M=function(a){this.j=a};V.prototype.s=function(a){var b=a[2]&65535|2;return b*(b^1)>>8&255};V.prototype.k=function(a,b){a[0]=(B[(a[0]^b)&255]^a[0]>>>8)>>>0;a[1]=(6681*(20173*(a[1]+(a[0]&255))>>>0)>>>0)+1>>>0;a[2]=(B[(a[2]^a[1]>>>24)&255]^a[2]>>>8)>>>0};V.prototype.U=function(a){var b=[305419896,591751049,878082192],c,d;w&&(b=new Uint32Array(b));c=0;for(d=a.length;c<d;++c)this.k(b,a[c]&255);return b};function W(a,b){b=b||{};this.input=w&&a instanceof Array?new Uint8Array(a):a;this.c=0;this.ca=b.verify||!1;this.j=b.password}var na={P:0,N:8},X=[80,75,1,2],Y=[80,75,3,4],Z=[80,75,5,6];function oa(a,b){this.input=a;this.offset=b}
20013
+ oa.prototype.parse=function(){var a=this.input,b=this.offset;(a[b++]!==X[0]||a[b++]!==X[1]||a[b++]!==X[2]||a[b++]!==X[3])&&m(Error("invalid file header signature"));this.version=a[b++];this.ja=a[b++];this.$=a[b++]|a[b++]<<8;this.I=a[b++]|a[b++]<<8;this.A=a[b++]|a[b++]<<8;this.time=a[b++]|a[b++]<<8;this.V=a[b++]|a[b++]<<8;this.p=(a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24)>>>0;this.z=(a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24)>>>0;this.J=(a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24)>>>0;this.h=a[b++]|a[b++]<<
20014
+ 8;this.g=a[b++]|a[b++]<<8;this.F=a[b++]|a[b++]<<8;this.fa=a[b++]|a[b++]<<8;this.ha=a[b++]|a[b++]<<8;this.ga=a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24;this.aa=(a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24)>>>0;this.filename=String.fromCharCode.apply(null,w?a.subarray(b,b+=this.h):a.slice(b,b+=this.h));this.Y=w?a.subarray(b,b+=this.g):a.slice(b,b+=this.g);this.v=w?a.subarray(b,b+this.F):a.slice(b,b+this.F);this.length=b-this.offset};function pa(a,b){this.input=a;this.offset=b}var qa={O:1,da:8,ea:2048};
20015
+ pa.prototype.parse=function(){var a=this.input,b=this.offset;(a[b++]!==Y[0]||a[b++]!==Y[1]||a[b++]!==Y[2]||a[b++]!==Y[3])&&m(Error("invalid local file header signature"));this.$=a[b++]|a[b++]<<8;this.I=a[b++]|a[b++]<<8;this.A=a[b++]|a[b++]<<8;this.time=a[b++]|a[b++]<<8;this.V=a[b++]|a[b++]<<8;this.p=(a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24)>>>0;this.z=(a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24)>>>0;this.J=(a[b++]|a[b++]<<8|a[b++]<<16|a[b++]<<24)>>>0;this.h=a[b++]|a[b++]<<8;this.g=a[b++]|a[b++]<<8;this.filename=
20016
+ String.fromCharCode.apply(null,w?a.subarray(b,b+=this.h):a.slice(b,b+=this.h));this.Y=w?a.subarray(b,b+=this.g):a.slice(b,b+=this.g);this.length=b-this.offset};
20017
+ function $(a){var b=[],c={},d,f,h,k;if(!a.i){if(a.o===q){var e=a.input,g;if(!a.D)a:{var l=a.input,p;for(p=l.length-12;0<p;--p)if(l[p]===Z[0]&&l[p+1]===Z[1]&&l[p+2]===Z[2]&&l[p+3]===Z[3]){a.D=p;break a}m(Error("End of Central Directory Record not found"))}g=a.D;(e[g++]!==Z[0]||e[g++]!==Z[1]||e[g++]!==Z[2]||e[g++]!==Z[3])&&m(Error("invalid signature"));a.ia=e[g++]|e[g++]<<8;a.ka=e[g++]|e[g++]<<8;a.la=e[g++]|e[g++]<<8;a.ba=e[g++]|e[g++]<<8;a.R=(e[g++]|e[g++]<<8|e[g++]<<16|e[g++]<<24)>>>0;a.o=(e[g++]|
20018
+ e[g++]<<8|e[g++]<<16|e[g++]<<24)>>>0;a.w=e[g++]|e[g++]<<8;a.v=w?e.subarray(g,g+a.w):e.slice(g,g+a.w)}d=a.o;h=0;for(k=a.ba;h<k;++h)f=new oa(a.input,d),f.parse(),d+=f.length,b[h]=f,c[f.filename]=h;a.R<d-a.o&&m(Error("invalid file header size"));a.i=b;a.G=c}}u=W.prototype;u.Z=function(){var a=[],b,c,d;this.i||$(this);d=this.i;b=0;for(c=d.length;b<c;++b)a[b]=d[b].filename;return a};
20019
+ u.r=function(a,b){var c;this.G||$(this);c=this.G[a];c===q&&m(Error(a+" not found"));var d;d=b||{};var f=this.input,h=this.i,k,e,g,l,p,s,r,A;h||$(this);h[c]===q&&m(Error("wrong index"));e=h[c].aa;k=new pa(this.input,e);k.parse();e+=k.length;g=k.z;if(0!==(k.I&qa.O)){!d.password&&!this.j&&m(Error("please set password"));s=this.T(d.password||this.j);r=e;for(A=e+12;r<A;++r)ra(this,s,f[r]);e+=12;g-=12;r=e;for(A=e+g;r<A;++r)f[r]=ra(this,s,f[r])}switch(k.A){case na.P:l=w?this.input.subarray(e,e+g):this.input.slice(e,
20020
+ e+g);break;case na.N:l=(new F(this.input,{index:e,bufferSize:k.J})).r();break;default:m(Error("unknown compression type"))}if(this.ca){var t=q,n,N="number"===typeof t?t:t=0,ka=l.length;n=-1;for(N=ka&7;N--;++t)n=n>>>8^B[(n^l[t])&255];for(N=ka>>3;N--;t+=8)n=n>>>8^B[(n^l[t])&255],n=n>>>8^B[(n^l[t+1])&255],n=n>>>8^B[(n^l[t+2])&255],n=n>>>8^B[(n^l[t+3])&255],n=n>>>8^B[(n^l[t+4])&255],n=n>>>8^B[(n^l[t+5])&255],n=n>>>8^B[(n^l[t+6])&255],n=n>>>8^B[(n^l[t+7])&255];p=(n^4294967295)>>>0;k.p!==p&&m(Error("wrong crc: file=0x"+
20021
+ k.p.toString(16)+", data=0x"+p.toString(16)))}return l};u.M=function(a){this.j=a};function ra(a,b,c){c^=a.s(b);a.k(b,c);return c}u.k=V.prototype.k;u.T=V.prototype.U;u.s=V.prototype.s;v("Zlib.Unzip",W);v("Zlib.Unzip.prototype.decompress",W.prototype.r);v("Zlib.Unzip.prototype.getFilenames",W.prototype.Z);v("Zlib.Unzip.prototype.setPassword",W.prototype.M);}).call(this);
20022
+
20023
+ /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function n(e){throw e;}var q=void 0,aa=this;function r(e,c){var d=e.split("."),b=aa;!(d[0]in b)&&b.execScript&&b.execScript("var "+d[0]);for(var a;d.length&&(a=d.shift());)!d.length&&c!==q?b[a]=c:b=b[a]?b[a]:b[a]={}};var u="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;new (u?Uint8Array:Array)(256);var v;for(v=0;256>v;++v)for(var w=v,ba=7,w=w>>>1;w;w>>>=1)--ba;function x(e,c,d){var b,a="number"===typeof c?c:c=0,f="number"===typeof d?d:e.length;b=-1;for(a=f&7;a--;++c)b=b>>>8^z[(b^e[c])&255];for(a=f>>3;a--;c+=8)b=b>>>8^z[(b^e[c])&255],b=b>>>8^z[(b^e[c+1])&255],b=b>>>8^z[(b^e[c+2])&255],b=b>>>8^z[(b^e[c+3])&255],b=b>>>8^z[(b^e[c+4])&255],b=b>>>8^z[(b^e[c+5])&255],b=b>>>8^z[(b^e[c+6])&255],b=b>>>8^z[(b^e[c+7])&255];return(b^4294967295)>>>0}
20024
+ var A=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,
20025
+ 2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,
20026
+ 2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,
20027
+ 2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,
20028
+ 3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,
20029
+ 936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],z=u?new Uint32Array(A):A;function B(){}B.prototype.getName=function(){return this.name};B.prototype.getData=function(){return this.data};B.prototype.H=function(){return this.I};r("Zlib.GunzipMember",B);r("Zlib.GunzipMember.prototype.getName",B.prototype.getName);r("Zlib.GunzipMember.prototype.getData",B.prototype.getData);r("Zlib.GunzipMember.prototype.getMtime",B.prototype.H);function D(e){var c=e.length,d=0,b=Number.POSITIVE_INFINITY,a,f,g,k,m,p,t,h,l,y;for(h=0;h<c;++h)e[h]>d&&(d=e[h]),e[h]<b&&(b=e[h]);a=1<<d;f=new (u?Uint32Array:Array)(a);g=1;k=0;for(m=2;g<=d;){for(h=0;h<c;++h)if(e[h]===g){p=0;t=k;for(l=0;l<g;++l)p=p<<1|t&1,t>>=1;y=g<<16|h;for(l=p;l<a;l+=m)f[l]=y;++k}++g;k<<=1;m<<=1}return[f,d,b]};var E=[],F;for(F=0;288>F;F++)switch(!0){case 143>=F:E.push([F+48,8]);break;case 255>=F:E.push([F-144+400,9]);break;case 279>=F:E.push([F-256+0,7]);break;case 287>=F:E.push([F-280+192,8]);break;default:n("invalid literal: "+F)}
20030
+ var ca=function(){function e(a){switch(!0){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,
20031
+ a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:n("invalid length: "+a)}}var c=[],d,b;for(d=3;258>=d;d++)b=e(d),c[d]=b[2]<<24|b[1]<<
20032
+ 16|b[0];return c}();u&&new Uint32Array(ca);function G(e,c){this.i=[];this.j=32768;this.d=this.f=this.c=this.n=0;this.input=u?new Uint8Array(e):e;this.o=!1;this.k=H;this.z=!1;if(c||!(c={}))c.index&&(this.c=c.index),c.bufferSize&&(this.j=c.bufferSize),c.bufferType&&(this.k=c.bufferType),c.resize&&(this.z=c.resize);switch(this.k){case I:this.a=32768;this.b=new (u?Uint8Array:Array)(32768+this.j+258);break;case H:this.a=0;this.b=new (u?Uint8Array:Array)(this.j);this.e=this.F;this.q=this.B;this.l=this.D;break;default:n(Error("invalid inflate mode"))}}
20033
+ var I=0,H=1;
20034
+ G.prototype.g=function(){for(;!this.o;){var e=J(this,3);e&1&&(this.o=!0);e>>>=1;switch(e){case 0:var c=this.input,d=this.c,b=this.b,a=this.a,f=c.length,g=q,k=q,m=b.length,p=q;this.d=this.f=0;d+1>=f&&n(Error("invalid uncompressed block header: LEN"));g=c[d++]|c[d++]<<8;d+1>=f&&n(Error("invalid uncompressed block header: NLEN"));k=c[d++]|c[d++]<<8;g===~k&&n(Error("invalid uncompressed block header: length verify"));d+g>c.length&&n(Error("input buffer is broken"));switch(this.k){case I:for(;a+g>b.length;){p=
20035
+ m-a;g-=p;if(u)b.set(c.subarray(d,d+p),a),a+=p,d+=p;else for(;p--;)b[a++]=c[d++];this.a=a;b=this.e();a=this.a}break;case H:for(;a+g>b.length;)b=this.e({t:2});break;default:n(Error("invalid inflate mode"))}if(u)b.set(c.subarray(d,d+g),a),a+=g,d+=g;else for(;g--;)b[a++]=c[d++];this.c=d;this.a=a;this.b=b;break;case 1:this.l(da,ea);break;case 2:fa(this);break;default:n(Error("unknown BTYPE: "+e))}}return this.q()};
20036
+ var K=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],L=u?new Uint16Array(K):K,N=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],O=u?new Uint16Array(N):N,P=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Q=u?new Uint8Array(P):P,R=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ga=u?new Uint16Array(R):R,ha=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,
20037
+ 13,13],U=u?new Uint8Array(ha):ha,V=new (u?Uint8Array:Array)(288),W,ia;W=0;for(ia=V.length;W<ia;++W)V[W]=143>=W?8:255>=W?9:279>=W?7:8;var da=D(V),X=new (u?Uint8Array:Array)(30),Y,ja;Y=0;for(ja=X.length;Y<ja;++Y)X[Y]=5;var ea=D(X);function J(e,c){for(var d=e.f,b=e.d,a=e.input,f=e.c,g=a.length,k;b<c;)f>=g&&n(Error("input buffer is broken")),d|=a[f++]<<b,b+=8;k=d&(1<<c)-1;e.f=d>>>c;e.d=b-c;e.c=f;return k}
20038
+ function Z(e,c){for(var d=e.f,b=e.d,a=e.input,f=e.c,g=a.length,k=c[0],m=c[1],p,t;b<m&&!(f>=g);)d|=a[f++]<<b,b+=8;p=k[d&(1<<m)-1];t=p>>>16;e.f=d>>t;e.d=b-t;e.c=f;return p&65535}
20039
+ function fa(e){function c(a,c,b){var d,e=this.w,f,g;for(g=0;g<a;)switch(d=Z(this,c),d){case 16:for(f=3+J(this,2);f--;)b[g++]=e;break;case 17:for(f=3+J(this,3);f--;)b[g++]=0;e=0;break;case 18:for(f=11+J(this,7);f--;)b[g++]=0;e=0;break;default:e=b[g++]=d}this.w=e;return b}var d=J(e,5)+257,b=J(e,5)+1,a=J(e,4)+4,f=new (u?Uint8Array:Array)(L.length),g,k,m,p;for(p=0;p<a;++p)f[L[p]]=J(e,3);if(!u){p=a;for(a=f.length;p<a;++p)f[L[p]]=0}g=D(f);k=new (u?Uint8Array:Array)(d);m=new (u?Uint8Array:Array)(b);e.w=
20040
+ 0;e.l(D(c.call(e,d,g,k)),D(c.call(e,b,g,m)))}G.prototype.l=function(e,c){var d=this.b,b=this.a;this.r=e;for(var a=d.length-258,f,g,k,m;256!==(f=Z(this,e));)if(256>f)b>=a&&(this.a=b,d=this.e(),b=this.a),d[b++]=f;else{g=f-257;m=O[g];0<Q[g]&&(m+=J(this,Q[g]));f=Z(this,c);k=ga[f];0<U[f]&&(k+=J(this,U[f]));b>=a&&(this.a=b,d=this.e(),b=this.a);for(;m--;)d[b]=d[b++-k]}for(;8<=this.d;)this.d-=8,this.c--;this.a=b};
20041
+ G.prototype.D=function(e,c){var d=this.b,b=this.a;this.r=e;for(var a=d.length,f,g,k,m;256!==(f=Z(this,e));)if(256>f)b>=a&&(d=this.e(),a=d.length),d[b++]=f;else{g=f-257;m=O[g];0<Q[g]&&(m+=J(this,Q[g]));f=Z(this,c);k=ga[f];0<U[f]&&(k+=J(this,U[f]));b+m>a&&(d=this.e(),a=d.length);for(;m--;)d[b]=d[b++-k]}for(;8<=this.d;)this.d-=8,this.c--;this.a=b};
20042
+ G.prototype.e=function(){var e=new (u?Uint8Array:Array)(this.a-32768),c=this.a-32768,d,b,a=this.b;if(u)e.set(a.subarray(32768,e.length));else{d=0;for(b=e.length;d<b;++d)e[d]=a[d+32768]}this.i.push(e);this.n+=e.length;if(u)a.set(a.subarray(c,c+32768));else for(d=0;32768>d;++d)a[d]=a[c+d];this.a=32768;return a};
20043
+ G.prototype.F=function(e){var c,d=this.input.length/this.c+1|0,b,a,f,g=this.input,k=this.b;e&&("number"===typeof e.t&&(d=e.t),"number"===typeof e.A&&(d+=e.A));2>d?(b=(g.length-this.c)/this.r[2],f=258*(b/2)|0,a=f<k.length?k.length+f:k.length<<1):a=k.length*d;u?(c=new Uint8Array(a),c.set(k)):c=k;return this.b=c};
20044
+ G.prototype.q=function(){var e=0,c=this.b,d=this.i,b,a=new (u?Uint8Array:Array)(this.n+(this.a-32768)),f,g,k,m;if(0===d.length)return u?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);f=0;for(g=d.length;f<g;++f){b=d[f];k=0;for(m=b.length;k<m;++k)a[e++]=b[k]}f=32768;for(g=this.a;f<g;++f)a[e++]=c[f];this.i=[];return this.buffer=a};
20045
+ G.prototype.B=function(){var e,c=this.a;u?this.z?(e=new Uint8Array(c),e.set(this.b.subarray(0,c))):e=this.b.subarray(0,c):(this.b.length>c&&(this.b.length=c),e=this.b);return this.buffer=e};function $(e){this.input=e;this.c=0;this.m=[];this.s=!1}$.prototype.G=function(){this.s||this.g();return this.m.slice()};
20046
+ $.prototype.g=function(){for(var e=this.input.length;this.c<e;){var c=new B,d=q,b=q,a=q,f=q,g=q,k=q,m=q,p=q,t=q,h=this.input,l=this.c;c.u=h[l++];c.v=h[l++];(31!==c.u||139!==c.v)&&n(Error("invalid file signature:"+c.u+","+c.v));c.p=h[l++];switch(c.p){case 8:break;default:n(Error("unknown compression method: "+c.p))}c.h=h[l++];p=h[l++]|h[l++]<<8|h[l++]<<16|h[l++]<<24;c.I=new Date(1E3*p);c.O=h[l++];c.N=h[l++];0<(c.h&4)&&(c.J=h[l++]|h[l++]<<8,l+=c.J);if(0<(c.h&8)){m=[];for(k=0;0<(g=h[l++]);)m[k++]=String.fromCharCode(g);
20047
+ c.name=m.join("")}if(0<(c.h&16)){m=[];for(k=0;0<(g=h[l++]);)m[k++]=String.fromCharCode(g);c.K=m.join("")}0<(c.h&2)&&(c.C=x(h,0,l)&65535,c.C!==(h[l++]|h[l++]<<8)&&n(Error("invalid header crc16")));d=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24;h.length-l-4-4<512*d&&(f=d);b=new G(h,{index:l,bufferSize:f});c.data=a=b.g();l=b.c;c.L=t=(h[l++]|h[l++]<<8|h[l++]<<16|h[l++]<<24)>>>0;x(a,q,q)!==t&&n(Error("invalid CRC-32 checksum: 0x"+x(a,q,q).toString(16)+" / 0x"+t.toString(16)));c.M=
20048
+ d=(h[l++]|h[l++]<<8|h[l++]<<16|h[l++]<<24)>>>0;(a.length&4294967295)!==d&&n(Error("invalid input size: "+(a.length&4294967295)+" / "+d));this.m.push(c);this.c=l}this.s=!0;var y=this.m,s,M,S=0,T=0,C;s=0;for(M=y.length;s<M;++s)T+=y[s].data.length;if(u){C=new Uint8Array(T);for(s=0;s<M;++s)C.set(y[s].data,S),S+=y[s].data.length}else{C=[];for(s=0;s<M;++s)C[s]=y[s].data;C=Array.prototype.concat.apply([],C)}return C};r("Zlib.Gunzip",$);r("Zlib.Gunzip.prototype.decompress",$.prototype.g);r("Zlib.Gunzip.prototype.getMembers",$.prototype.G);}).call(this);
20049
+
20050
+ }).bind(elFinder)();
20051
+
20052
+ } catch(e) {};
20053
 
20054
  /*
20055
  * File: /js/commands/reload.js
20061
  *
20062
  * @author Dmitry (dio) Levashov
20063
  **/
20064
+ (elFinder.prototype.commands.reload = function() {
20065
  var self = this,
20066
  search = false;
20067
 
20085
  this.fm.bind('contextmenu', function(e){
20086
  var fm = self.fm;
20087
  if (fm.options.sync >= 1000) {
 
20088
  self.extra = {
20089
  icon: 'accept',
20090
  node: $('<span/>')
20091
  .attr({title: fm.i18n('autoSync')})
20092
+ .on('click touchstart', function(e){
20093
+ if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) {
20094
+ return;
20095
+ }
20096
  e.stopPropagation();
20097
  e.preventDefault();
20098
+ $(this).parent()
20099
  .toggleClass('ui-state-disabled', fm.options.syncStart)
20100
  .parent().removeClass('ui-state-hover');
20101
  fm.options.syncStart = !fm.options.syncStart;
20102
  fm.autoSync(fm.options.syncStart? null : 'stop');
20103
+ }).on('ready', function(){
20104
+ $(this).parent().toggleClass('ui-state-disabled', !fm.options.syncStart).css('pointer-events', 'auto');
20105
  })
20106
  };
 
 
 
 
 
 
20107
  }
20108
  });
20109
 
20125
  }
20126
  };
20127
 
20128
+ }).prototype = { forceLoad : true }; // this is required command
20129
+
20130
 
20131
  /*
20132
  * File: /js/commands/rename.js
20150
  return !this._disabled && sel.length == 1 && sel[0].phash && !sel[0].locked ? 0 : -1;
20151
  };
20152
 
20153
+ this.exec = function(hashes, opts) {
20154
  var fm = this.fm,
20155
  cwd = fm.getUI('cwd'),
20156
  sel = hashes || (fm.selected().length? fm.selected() : false) || [fm.cwd().hash],
20157
  cnt = sel.length,
20158
  file = fm.file(sel.shift()),
20159
  filename = '.elfinder-cwd-filename',
20160
+ opts = opts || {},
 
20161
  incwd = (fm.cwd().hash == file.hash),
20162
+ type = opts._currentType? opts._currentType : (incwd? 'navbar' : 'files'),
20163
+ navbar = (type === 'navbar'),
20164
+ target = $('#'+fm[navbar? 'navHash2Id' : 'cwdHash2Id'](file.hash)),
20165
  tarea = (type === 'files' && fm.storage('view') != 'list'),
20166
  rest = function(){
20167
+ if (!overlay.is(':hidden')) {
20168
+ overlay.addClass('ui-front')
20169
+ .elfinderoverlay('hide')
20170
+ .off('click', cancel);
20171
+ }
20172
+ pnode.removeClass('ui-front').css('position', '');
20173
  if (tarea) {
 
20174
  node.css('max-height', '');
20175
  } else if (!navbar) {
20176
+ pnode.css('width', '')
20177
+ .parent('td').css('overflow', '');
20178
  }
20179
  }, colwidth,
20180
  dfrd = $.Deferred()
20183
  })
20184
  .fail(function(error) {
20185
  var parent = input.parent(),
20186
+ name = fm.escape(file.i18 || file.name);
20187
 
20188
  if (tarea) {
20189
  name = name.replace(/([_.])/g, '&#8203;$1');
20190
  }
 
20191
  if (navbar) {
20192
  input.replaceWith(name);
20193
  } else {
20195
  input.remove();
20196
  parent.html(name);
20197
  } else {
20198
+ //cwd.find('#'+fm.cwdHash2Id(file.hash)).find(filename).html(name);
20199
+ target.find(filename).html(name);
20200
  setTimeout(function() {
20201
  cwd.find('#'+fm.cwdHash2Id(file.hash)).click();
20202
  }, 50);
20206
  error && fm.error(error);
20207
  })
20208
  .always(function() {
20209
+ rest();
20210
+ fm.unbind('resize', resize);
20211
  fm.enable();
20212
  }),
20213
+ blur = function() {
20214
+ var name = $.trim(input.val()),
20215
+ parent = input.parent(),
20216
+ valid = true;
20217
+
20218
+ if (!inError && pnode.length) {
20219
+
20220
+ input.off('blur');
20221
+
20222
+ if (input[0].setSelectionRange) {
20223
+ input[0].setSelectionRange(0, 0)
20224
+ }
20225
+ if (name == file.name) {
20226
+ return dfrd.reject();
20227
+ }
20228
+ if (fm.options.validName && fm.options.validName.test) {
20229
+ try {
20230
+ valid = fm.options.validName.test(name);
20231
+ } catch(e) {
20232
+ valid = false;
20233
+ }
20234
+ }
20235
+ if (!name || name === '..' || !valid) {
20236
+ inError = true;
20237
+ fm.error('errInvName', {modal: true, close: select});
20238
+ return false;
20239
+ }
20240
+ if (fm.fileByName(name, file.phash)) {
20241
+ inError = true;
20242
+ fm.error(['errExists', name], {modal: true, close: select});
20243
+ return false;
20244
+ }
20245
+
20246
+ rest();
20247
+
20248
+ (navbar? input : node).html(fm.escape(name));
20249
+ fm.lockfiles({files : [file.hash]});
20250
+ fm.request({
20251
+ data : {cmd : 'rename', target : file.hash, name : name},
20252
+ notify : {type : 'rename', cnt : 1}
20253
+ })
20254
+ .fail(function(error) {
20255
+ dfrd.reject();
20256
+ if (! error || ! $.isArray(error) || error[0] !== 'errRename') {
20257
+ fm.sync();
20258
+ }
20259
+ })
20260
+ .done(function(data) {
20261
+ dfrd.resolve(data);
20262
+ if (!navbar && data && data.added && data.added[0]) {
20263
+ var newItem = fm.findCwdNodes(data.added);
20264
+ if (newItem.length) {
20265
+ newItem.trigger('scrolltoview');
20266
+ }
20267
+ }
20268
+ })
20269
+ .always(function() {
20270
+ fm.unlockfiles({files : [file.hash]})
20271
+ });
20272
+ }
20273
+ },
20274
  input = $(tarea? '<textarea/>' : '<input type="text"/>')
20275
  .on('keyup text', function(){
20276
  if (tarea) {
20283
  }
20284
  }
20285
  })
20286
+ .on('keydown', function(e) {
 
20287
  e.stopImmediatePropagation();
20288
  if (e.keyCode == $.ui.keyCode.ESCAPE) {
20289
  dfrd.reject();
20290
  } else if (e.keyCode == $.ui.keyCode.ENTER) {
20291
+ e.preventDefault();
20292
  input.blur();
20293
  }
20294
  })
20295
+ .on('mousedown click dblclick', function(e) {
20296
+ // click for touch device
 
 
20297
  e.stopPropagation();
20298
+ if (e.type === 'dblclick') {
20299
+ e.preventDefault();
20300
+ }
20301
  })
20302
+ .on('blur', blur),
20303
+ select = function() {
20304
+ var name = input.val().replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/ig, '');
20305
+ if (inError) {
20306
+ inError = false;
20307
+ input.on('blur', blur);
20308
+ }
20309
+ if (fm.UA.Mobile) {
20310
+ overlay.on('click', cancel)
20311
+ .removeClass('ui-front').elfinderoverlay('show');
20312
+ }
20313
+ input.select().focus();
20314
+ input[0].setSelectionRange && input[0].setSelectionRange(0, name.length);
20315
+ },
20316
+ node = navbar? target.contents().filter(function(){ return this.nodeType==3 && $(this).parent().attr('id') === fm.navHash2Id(file.hash); })
20317
+ : target.find(filename),
20318
+ pnode = node.parent(),
20319
+ overlay = fm.getUI('overlay'),
20320
+ cancel = function(e) {
20321
+ if (! inError) {
20322
  e.stopPropagation();
20323
+ dfrd.reject();
20324
+ }
20325
+ },
20326
+ resize = function() {
20327
+ target.trigger('scrolltoview');
20328
+ },
20329
+ inError = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20330
 
20331
+ pnode.addClass('ui-front').css('position', 'relative');
20332
+ fm.bind('resize', resize);
20333
  if (navbar) {
20334
  node.replaceWith(input.val(file.name));
20335
  } else {
20336
  if (tarea) {
 
20337
  node.css('max-height', 'none');
20338
  } else if (!navbar) {
20339
  colwidth = pnode.width();
20340
+ pnode.width(colwidth - 15)
20341
+ .parent('td').css('overflow', 'visible');
20342
  }
20343
  node.empty().append(input.val(file.name));
20344
  }
20345
 
20346
+ if (cnt > 1) {
20347
  return dfrd.reject();
20348
  }
20349
 
20361
 
20362
  input.trigger('keyup');
20363
 
20364
+ select();
 
 
20365
 
20366
  return dfrd;
20367
  };
20368
 
20369
+ };
20370
 
20371
 
20372
  /*
20391
  return !this._disabled && sel.length == 1 && sel[0].read && sel[0].write && sel[0].mime.indexOf('image/') !== -1 ? 0 : -1;
20392
  };
20393
 
20394
+ this.resizeRequest = function(data, file, dfrd) {
20395
+ var fm = this.fm,
20396
+ file = file || fm.file(data.target),
20397
+ src = file? fm.openUrl(file.hash) : null,
20398
+ tmb = file? file.tmb : null,
20399
+ enabled = fm.isCommandEnabled('resize', data.target);
20400
+
20401
+ if (enabled && (! file || (file && file.read && file.write && file.mime.indexOf('image/') !== -1 ))) {
20402
+ return fm.request({
20403
+ data : $.extend(data, {
20404
+ cmd : 'resize'
20405
+ }),
20406
+ notify : {type : 'resize', cnt : 1},
20407
+ prepare : function(data) {
20408
+ var newfile;
20409
+ if (data) {
20410
+ if (data.added && data.added.length && data.added[0].tmb) {
20411
+ newfile = data.added[0];
20412
+ } else if (data.changed && data.changed.length && data.changed[0].tmb) {
20413
+ newfile = data.changed[0];
20414
+ }
20415
+ if (newfile) {
20416
+ file = newfile;
20417
+ src = fm.openUrl(file.hash);
20418
+ if (file.tmb && file.tmb != '1' && (file.tmb === tmb)) {
20419
+ file.tmb = '';
20420
+ return;
20421
+ }
20422
+ }
20423
+ }
20424
+ tmb = '';
20425
+ }
20426
+ })
20427
+ .fail(function(error) {
20428
+ if (dfrd) {
20429
+ dfrd.reject(error);
20430
+ }
20431
+ })
20432
+ .done(function() {
20433
+ var url = (file.url != '1')? fm.url(file.hash) : '';
20434
+
20435
+ // need tmb reload
20436
+ if (tmb) {
20437
+ fm.one('resizedone', function() {
20438
+ fm.reloadContents(fm.tmb(file).url).done(function() {
20439
+ fm.trigger('tmbreload', {files: [ {hash: file.hash, tmb: tmb} ]});
20440
+ });
20441
+ });
20442
+ }
20443
+
20444
+ fm.reloadContents(src);
20445
+ if (url && url !== src) {
20446
+ fm.reloadContents(url);
20447
+ }
20448
+
20449
+ dfrd && dfrd.resolve();
20450
+ });
20451
+ } else {
20452
+ var error;
20453
+
20454
+ if (file) {
20455
+ if (file.mime.indexOf('image/') === -1) {
20456
+ error = ['errResize', file.name, 'errUsupportType'];
20457
+ } else {
20458
+ error = ['errResize', file.name, 'errPerm'];
20459
+ }
20460
+ } else {
20461
+ error = ['errResize', data.target, 'errPerm'];
20462
+ }
20463
+
20464
+ if (dfrd) {
20465
+ dfrd.reject(error);
20466
+ } else {
20467
+ fm.error(error);
20468
+ }
20469
+ return $.Deferred().reject(error);
20470
+ }
20471
+ }
20472
+
20473
  this.exec = function(hashes) {
20474
+ var self = this,
20475
+ fm = this.fm,
20476
  files = this.files(hashes),
20477
  dfrd = $.Deferred(),
20478
+ api2 = (fm.api > 1),
20479
+ dialogWidth = 650,
20480
+ fmnode = fm.getUI(),
20481
+ ctrgrup = $().controlgroup? 'controlgroup' : 'buttonset',
20482
 
20483
  open = function(file, id) {
20484
  var isJpeg = (file.mime === 'image/jpeg'),
20485
+ dialog = $('<div class="elfinder-dialog-resize '+fm.res('class', 'editing')+'"/>'),
20486
  input = '<input type="text" size="5"/>',
20487
  row = '<div class="elfinder-resize-row"/>',
20488
  label = '<div class="elfinder-resize-label"/>',
20489
+ control = $('<div class="elfinder-resize-control"/>')
20490
+ .on('focus', 'input[type=text]', function() {
20491
+ $(this).select();
20492
+ }),
20493
+ preview = $('<div class="elfinder-resize-preview"/>')
20494
+ .on('touchmove', function(e) {
20495
+ e.stopPropagation();
20496
+ e.preventDefault();
20497
+ }),
20498
  spinner = $('<div class="elfinder-resize-spinner">'+fm.i18n('ntfloadimg')+'</div>'),
20499
+ rhandle = $('<div class="elfinder-resize-handle touch-punch"/>'),
20500
+ rhandlec = $('<div class="elfinder-resize-handle touch-punch"/>'),
20501
  uiresize = $('<div class="elfinder-resize-uiresize"/>'),
20502
  uicrop = $('<div class="elfinder-resize-uicrop"/>'),
20503
+ uirotate = $('<div class="elfinder-resize-rotate"/>'),
20504
+ uideg270 = $('<button/>').attr('title',fm.i18n('rotate-cw')).append($('<span class="elfinder-button-icon elfinder-button-icon-rotate-l"/>')),
20505
+ uideg90 = $('<button/>').attr('title',fm.i18n('rotate-ccw')).append($('<span class="elfinder-button-icon elfinder-button-icon-rotate-r"/>')),
 
 
 
 
 
 
 
 
 
 
 
20506
  uiprop = $('<span />'),
20507
+ reset = $('<button class="elfinder-resize-reset">').text(fm.i18n('reset'))
20508
+ .on('click', function() {
20509
+ resetView();
20510
+ })
20511
+ .button({
20512
+ icons: {
20513
+ primary: 'ui-icon-arrowrefresh-1-n'
20514
+ },
20515
+ text: false
20516
+ }),
20517
  uitype = $('<div class="elfinder-resize-type"/>')
20518
+ .append('<input class="" type="radio" name="type" id="'+id+'-resize" value="resize" checked="checked" /><label for="'+id+'-resize">'+fm.i18n('resize')+'</label>',
20519
+ '<input class="api2" type="radio" name="type" id="'+id+'-crop" value="crop" /><label class="api2" for="'+id+'-crop">'+fm.i18n('crop')+'</label>',
20520
+ '<input class="api2" type="radio" name="type" id="'+id+'-rotate" value="rotate" /><label class="api2" for="'+id+'-rotate">'+fm.i18n('rotate')+'</label>'),
20521
+ mode = 'resize',
20522
+ type = uitype[ctrgrup]()[ctrgrup]('disable').find('input')
20523
  .change(function() {
20524
+ mode = $(this).val();
20525
 
20526
  resetView();
20527
  resizable(true);
20528
  croppable(true);
20529
  rotateable(true);
20530
 
20531
+ if (mode == 'resize') {
20532
  uiresize.show();
20533
  uirotate.hide();
20534
  uicrop.hide();
20535
  resizable();
20536
+ isJpeg && grid8px.insertAfter(uiresize.find('.elfinder-resize-grid8'));
20537
  }
20538
+ else if (mode == 'crop') {
20539
  uirotate.hide();
20540
  uiresize.hide();
20541
  uicrop.show();
20542
  croppable();
20543
+ isJpeg && grid8px.insertAfter(uicrop.find('.elfinder-resize-grid8'));
20544
+ } else if (mode == 'rotate') {
20545
  uiresize.hide();
20546
  uicrop.hide();
20547
  uirotate.show();
20548
  rotateable();
20549
  }
20550
  }),
 
 
 
 
 
 
 
20551
  width = $(input)
20552
  .change(function() {
20553
  var w = parseInt(width.val()),
20570
  }),
20571
  pointX = $(input).change(function(){crop.updateView();}),
20572
  pointY = $(input).change(function(){crop.updateView();}),
20573
+ offsetX = $(input).change(function(){crop.updateView('w');}),
20574
+ offsetY = $(input).change(function(){crop.updateView('h');}),
20575
+ quality = isJpeg && api2?
20576
  $(input).val(fm.option('jpgQuality'))
20577
  .addClass('quality')
20578
  .on('blur', function(){
20584
  .change(function() {
20585
  rotate.update();
20586
  }),
20587
+ uidegslider = $('<div class="elfinder-resize-rotate-slider touch-punch"/>')
20588
  .slider({
20589
  min: 0,
20590
  max: 360,
20598
  slide: function(event, ui) {
20599
  rotate.update(ui.value, false);
20600
  }
20601
+ }).find('.ui-slider-handle')
20602
+ .addClass('elfinder-tabstop')
20603
+ .off('keydown')
20604
+ .on('keydown', function(e) {
20605
+ if (e.keyCode == $.ui.keyCode.LEFT || e.keyCode == $.ui.keyCode.RIGHT) {
20606
+ e.stopPropagation();
20607
+ e.preventDefault();
20608
+ rotate.update(Number(degree.val()) + (e.keyCode == $.ui.keyCode.RIGHT? 1 : -1), false);
20609
+ }
20610
+ })
20611
+ .end(),
20612
+ pickcanv,
20613
+ pickctx,
20614
+ pickc = {},
20615
+ pick = function(e) {
20616
+ var color, r, g, b, h, s, l;
20617
+
20618
+ try {
20619
+ color = pickc[Math.round(e.offsetX)][Math.round(e.offsetY)];
20620
+ } catch(e) {}
20621
+ if (!color) return;
20622
+
20623
+ r = color[0]; g = color[1]; b = color[2];
20624
+ h = color[3]; s = color[4]; l = color[5];
20625
+
20626
+ setbg(r, g, b, (e.type === 'click'));
20627
+ },
20628
+ palpick = function(e) {
20629
+ setbg($(this).css('backgroundColor'), '', '', (e.type === 'click'));
20630
+ },
20631
+ setbg = function(r, g, b, off) {
20632
+ var s, m, cc;
20633
+ if (typeof r === 'string') {
20634
+ g = '';
20635
+ if (r && (s = $('<span>').css('backgroundColor', r).css('backgroundColor')) && (m = s.match(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i))) {
20636
+ r = Number(m[1]);
20637
+ g = Number(m[2]);
20638
+ b = Number(m[3]);
20639
+ }
20640
+ }
20641
+ cc = (g === '')? r : '#' + getColorCode(r, g, b);
20642
+ bg.val(cc).css({ backgroundColor: cc, backgroundImage: 'none', color: (r+g+b < 384? '#fff' : '#000') });
20643
+ preview.css('backgroundColor', cc);
20644
+ if (off) {
20645
+ imgr.off('.picker').removeClass('elfinder-resize-picking');
20646
+ pallet.off('.picker').removeClass('elfinder-resize-picking');
20647
+ }
20648
+ },
20649
+ getColorCode = function(r, g, b) {
20650
+ return $.map([r,g,b], function(c){return ('0'+parseInt(c).toString(16)).slice(-2);}).join('');
20651
+ },
20652
+ picker = $('<button>').text(fm.i18n('colorPicker'))
20653
+ .on('click', function() {
20654
+ imgr.on('mousemove.picker click.picker', pick).addClass('elfinder-resize-picking');
20655
+ pallet.on('mousemove.picker click.picker', 'span', palpick).addClass('elfinder-resize-picking');
20656
+ })
20657
+ .button({
20658
+ icons: {
20659
+ primary: 'ui-icon-pin-s'
20660
+ },
20661
+ text: false
20662
+ }),
20663
+ reseter = $('<button>').text(fm.i18n('reset'))
20664
+ .on('click', function() {
20665
+ setbg('', '', '', true);
20666
+ })
20667
+ .button({
20668
+ icons: {
20669
+ primary: 'ui-icon-arrowrefresh-1-n'
20670
+ },
20671
+ text: false
20672
  }),
20673
+ bg = $('<input class="elfinder-resize-bg" type="text">')
20674
+ .on('focus', function() {
20675
+ $(this).attr('style', '');
20676
+ })
20677
+ .on('blur', function() {
20678
+ setbg($(this).val());
20679
+ }),
20680
+ pallet = $('<div class="elfinder-resize-pallet">').on('click', 'span', function() {
20681
+ setbg($(this).css('backgroundColor'));
20682
+ }),
20683
  ratio = 1,
20684
  prop = 1,
20685
  owidth = 0,
20686
  oheight = 0,
20687
  cratio = true,
20688
+ cratioc = false,
20689
  pwidth = 0,
20690
  pheight = 0,
20691
  rwidth = 0,
20692
  rheight = 0,
20693
  rdegree = 0,
20694
+ grid8 = true,
20695
+ constr = $('<button>').html(fm.i18n('aspectRatio'))
20696
+ .on('click', function() {
20697
+ cratio = ! cratio;
20698
+ constr.button('option', {
20699
+ icons : { primary: cratio? 'ui-icon-locked' : 'ui-icon-unlocked'}
20700
+ });
20701
+ resize.fixHeight();
20702
+ rhandle.resizable('option', 'aspectRatio', cratio).data('uiResizable')._aspectRatio = cratio;
20703
+ })
20704
+ .button({
20705
+ icons : {
20706
+ primary: cratio? 'ui-icon-locked' : 'ui-icon-unlocked'
20707
+ },
20708
+ text: false
20709
+ }),
20710
+ constrc = $('<button>').html(fm.i18n('aspectRatio'))
20711
+ .on('click', function() {
20712
+ cratioc = ! cratioc;
20713
+ constrc.button('option', {
20714
+ icons : { primary: cratioc? 'ui-icon-locked' : 'ui-icon-unlocked'}
20715
+ });
20716
+ rhandlec.resizable('option', 'aspectRatio', cratioc).data('uiResizable')._aspectRatio = cratioc;
20717
+ })
20718
+ .button({
20719
+ icons : {
20720
+ primary: cratioc? 'ui-icon-locked' : 'ui-icon-unlocked'
20721
+ },
20722
+ text: false
20723
+ }),
20724
+ grid8px = $('<button>').html(fm.i18n(grid8? 'enabled' : 'disabled')).toggleClass('ui-state-active', grid8)
20725
+ .on('click', function() {
20726
+ grid8 = ! grid8;
20727
+ grid8px.html(fm.i18n(grid8? 'enabled' : 'disabled')).toggleClass('ui-state-active', grid8);
20728
+ if (grid8) {
20729
+ width.val(round(width.val()));
20730
+ height.val(round(height.val()));
20731
+ offsetX.val(round(offsetX.val()));
20732
+ offsetY.val(round(offsetY.val()));
20733
+ pointX.val(round(pointX.val()));
20734
+ pointY.val(round(pointY.val()));
20735
+ if (uiresize.is(':visible')) {
20736
+ resize.updateView(width.val(), height.val());
20737
+ } else if (uicrop.is(':visible')) {
20738
+ crop.updateView();
20739
+ }
20740
+ }
20741
+ })
20742
+ .button(),
20743
+ setuprimg = function() {
20744
+ var r_scale;
20745
+ r_scale = Math.min(pwidth, pheight) / Math.sqrt(Math.pow(owidth, 2) + Math.pow(oheight, 2));
20746
+ rwidth = Math.ceil(owidth * r_scale);
20747
+ rheight = Math.ceil(oheight * r_scale);
20748
+ imgr.width(rwidth)
20749
+ .height(rheight)
20750
+ .css('margin-top', (pheight-rheight)/2 + 'px')
20751
+ .css('margin-left', (pwidth-rwidth)/2 + 'px');
20752
+ if (imgr.is(':visible') && bg.is(':visible')) {
20753
+ if (file.mime !== 'image/png') {
20754
+ preview.css('backgroundColor', bg.val());
20755
+ setTimeout(function() {
20756
+ if (pickcanv && pickcanv.width !== rwidth) {
20757
+ setColorData();
20758
+ }
20759
+ }, 0);
20760
+ } else {
20761
+ bg.parent().hide();
20762
+ pallet.hide()
20763
+ }
20764
+ }
20765
+ },
20766
+ setupimg = function() {
20767
+ resize.updateView(owidth, oheight);
20768
+ setuprimg();
20769
+ basec
20770
+ .width(img.width())
20771
+ .height(img.height());
20772
+ imgc
20773
+ .width(img.width())
20774
+ .height(img.height());
20775
+ crop.updateView();
20776
+ },
20777
+ setColorData = function() {
20778
+ if (pickctx) {
20779
+ var n, w, h, r, g, b, a, s, l, hsl, hue,
20780
+ data, scale, tx1, tx2, ty1, ty2, rgb,
20781
+ domi = {},
20782
+ domic = [],
20783
+ domiv, palc,
20784
+ rgbToHsl = function (r, g, b) {
20785
+ var h, s, l,
20786
+ max = Math.max(Math.max(r, g), b),
20787
+ min = Math.min(Math.min(r, g), b);
20788
+
20789
+ // Hue, 0 ~ 359
20790
+ if (max === min) {
20791
+ h = 0;
20792
+ } else if (r === max) {
20793
+ h = ((g - b) / (max - min) * 60 + 360) % 360;
20794
+ } else if (g === max) {
20795
+ h = (b - r) / (max - min) * 60 + 120;
20796
+ } else if (b === max) {
20797
+ h = (r - g) / (max - min) * 60 + 240;
20798
+ }
20799
+ // Saturation, 0 ~ 1
20800
+ s = (max - min) / max;
20801
+ // Lightness, 0 ~ 1
20802
+ l = (r * 0.3 + g * 0.59 + b * 0.11) / 255;
20803
+
20804
+ return [h, s, l, 'hsl'];
20805
+ };
20806
+
20807
+ calc:
20808
+ try {
20809
+ w = pickcanv.width = imgr.width();
20810
+ h = pickcanv.height = imgr.height();
20811
+ scale = w / owidth;
20812
+ pickctx.scale(scale, scale);
20813
+ pickctx.drawImage(imgr.get(0), 0, 0);
20814
+
20815
+ data = pickctx.getImageData(0, 0, w, h).data;
20816
+
20817
+ // Range to detect the dominant color
20818
+ tx1 = w * .1;
20819
+ tx2 = w * .9;
20820
+ ty1 = h * .1;
20821
+ ty2 = h * .9;
20822
+
20823
+ for (var y = 0; y < h - 1; y++) {
20824
+ for (var x = 0; x < w - 1; x++) {
20825
+ n = x * 4 + y * w * 4;
20826
+ // RGB
20827
+ r = data[n]; g = data[n + 1]; b = data[n + 2]; a = data[n + 3];
20828
+ // check alpha ch
20829
+ if (a !== 255) {
20830
+ bg.parent().hide();
20831
+ pallet.hide();
20832
+ break calc;
20833
+ }
20834
+ // HSL
20835
+ hsl = rgbToHsl(r, g, b);
20836
+ hue = Math.round(hsl[0]); s = Math.round(hsl[1] * 100); l = Math.round(hsl[2] * 100);
20837
+ if (! pickc[x]) {
20838
+ pickc[x] = {};
20839
+ }
20840
+ // set pickc
20841
+ pickc[x][y] = [r, g, b, hue, s, l];
20842
+ // detect the dominant color
20843
+ if ((x < tx1 || x > tx2) && (y < ty1 || y > ty2)) {
20844
+ rgb = r + ',' + g + ',' + b;
20845
+ if (! domi[rgb]) {
20846
+ domi[rgb] = 1;
20847
+ } else {
20848
+ ++domi[rgb];
20849
+ }
20850
+ }
20851
+ }
20852
+ }
20853
+
20854
+ if (! pallet.children(':first').length) {
20855
+ palc = 1;
20856
+ $.each(domi, function(c, v) {
20857
+ domic.push({c: c, v: v});
20858
+ });
20859
+ $.each(domic.sort(function(a, b) {
20860
+ return (a.v > b.v)? -1 : 1;
20861
+ }), function() {
20862
+ if (this.v < 2 || palc > 10) {
20863
+ return false;
20864
+ }
20865
+ pallet.append($('<span style="width:20px;height:20px;display:inline-block;background-color:rgb('+this.c+');">'));
20866
+ ++palc;
20867
+ });
20868
+ }
20869
+ } catch(e) {
20870
+ picker.hide();
20871
+ pallet.hide();
20872
+ }
20873
+ }
20874
+ },
20875
+ setupPicker = function() {
20876
+ try {
20877
+ pickcanv = document.createElement('canvas');
20878
+ pickctx = pickcanv.getContext('2d');
20879
+ } catch(e) {
20880
+ picker.hide();
20881
+ pallet.hide();
20882
+ }
20883
+ },
20884
  img = $('<img/>')
20885
+ .on('load', function() {
20886
+ owidth = img.get(0).width || img.width();
20887
+ oheight = img.get(0).height || img.height();
20888
+
20889
+ dMinBtn.show();
20890
+
20891
+ var r_scale, inputFirst,
20892
+ imgRatio = oheight / owidth;
20893
+
20894
+ if (imgRatio < 1 && preview.height() > preview.width() * imgRatio) {
20895
+ preview.height(preview.width() * imgRatio);
20896
+ }
20897
+
20898
+ if (preview.height() > img.height() + 20) {
20899
+ preview.height(img.height() + 20);
20900
+ }
20901
+
20902
+ pheight = preview.height() - (rhandle.outerHeight() - rhandle.height());
20903
+
20904
  spinner.remove();
20905
 
 
 
20906
  ratio = owidth/oheight;
 
20907
 
20908
  rhandle.append(img.show()).show();
20909
  width.val(owidth);
20910
  height.val(oheight);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20911
 
20912
+ setupPicker();
20913
+ setupimg();
20914
+
20915
+ uitype[ctrgrup]('enable');
20916
+ inputFirst = control.find('input,select').prop('disabled', false)
20917
+ .filter(':text').on('keydown', function(e) {
20918
+ if (e.keyCode == $.ui.keyCode.ENTER) {
20919
+ e.stopPropagation();
20920
+ e.preventDefault();
20921
  fm.confirm({
20922
  title : $('input:checked', uitype).val(),
20923
  text : 'confirmReq',
20929
  },
20930
  cancel : {
20931
  label : 'btnCancel',
20932
+ callback : function(){
20933
+ $(this).focus();
20934
+ }
20935
  }
20936
  });
20937
  return;
20938
  }
20939
+ })
20940
+ .on('keyup', function() {
20941
+ var $this = $(this);
20942
+ if (! $this.hasClass('elfinder-resize-bg')) {
20943
+ setTimeout(function() {
20944
+ $this.val($this.val().replace(/[^0-9]/g, ''));
20945
+ }, 10);
20946
  }
20947
  })
20948
+ .filter(':first');
20949
 
20950
+ !fm.UA.Mobile && inputFirst.focus();
20951
  resizable();
 
 
 
20952
  })
20953
+ .on('error', function() {
20954
  spinner.text('Unable to load image').css('background', 'transparent');
20955
  }),
20956
  basec = $('<div/>'),
20957
  imgc = $('<img/>'),
20958
  coverc = $('<div/>'),
20959
+ imgr = $('<img class="elfinder-resize-imgrotate" />'),
20960
+ round = function(v, max) {
20961
+ v = grid8? Math.round(v/8)*8 : Math.round(v);
20962
+ v = Math.max(0, v);
20963
+ if (max && v > max) {
20964
+ v = grid8? v - 8 : max;
20965
+ }
20966
+ return v;
20967
  },
20968
  resetView = function() {
20969
  width.val(owidth);
20970
  height.val(oheight);
20971
  resize.updateView(owidth, oheight);
20972
+ pointX.val(0);
20973
+ pointY.val(0);
20974
+ offsetX.val(owidth);
20975
+ offsetY.val(oheight);
20976
+ crop.updateView();
20977
  },
20978
  resize = {
20979
  update : function() {
21006
  var w, h;
21007
  if (cratio) {
21008
  w = width.val();
21009
+ h = round(w/ratio);
21010
  resize.updateView(w, h);
21011
  height.val(h);
21012
  }
21014
  },
21015
  crop = {
21016
  update : function() {
21017
+ pointX.val(round(((rhandlec.data('x')||rhandlec.position().left))/prop, owidth));
21018
+ pointY.val(round(((rhandlec.data('y')||rhandlec.position().top))/prop, oheight));
21019
+ offsetX.val(round((rhandlec.data('w')||rhandlec.width())/prop, owidth - pointX.val()));
21020
+ offsetY.val(round((rhandlec.data('h')||rhandlec.height())/prop, oheight - pointY.val()));
21021
  },
21022
+ updateView : function(change) {
21023
+ if (cratioc) {
21024
+ var r = coverc.width() / coverc.height();
21025
+ if (change === 'w') {
21026
+ offsetY.val(Math.round(parseInt(offsetX.val()) / r));
21027
+ } else if (change === 'h') {
21028
+ offsetX.val(Math.round(parseInt(offsetY.val()) * r));
21029
+ }
21030
+ }
21031
+ var x = Math.round(parseInt(pointX.val()) * prop);
21032
+ var y = Math.round(parseInt(pointY.val()) * prop);
21033
+ var w = Math.round(parseInt(offsetX.val()) * prop);
21034
+ var h = Math.round(parseInt(offsetY.val()) * prop);
21035
  rhandlec.data({x: x, y: y, w: w, h: h})
21036
+ .width(w)
21037
+ .height(h)
21038
+ .css({left: x, top: y});
21039
+ coverc.width(w)
21040
+ .height(h);
21041
  },
21042
+ resize_update : function(e, ui) {
21043
+ rhandlec.data({x: ui.position.left, y: ui.position.top, w: ui.size.width, h: ui.size.height});
21044
  crop.update();
21045
+ crop.updateView();
 
21046
  },
21047
+ drag_update : function(e, ui) {
21048
+ rhandlec.data({x: ui.position.left, y: ui.position.top});
21049
  crop.update();
21050
  }
21051
  },
21158
  resize : resize.update,
21159
  stop : resize.fixHeight
21160
  });
21161
+ dinit();
21162
  }
21163
  }
21164
  },
21170
  basec.hide();
21171
  }
21172
  else {
21173
+ basec.show();
 
 
 
 
 
 
 
 
 
 
21174
 
21175
  rhandlec
 
 
 
21176
  .resizable({
21177
  containment : basec,
21178
+ aspectRatio : cratioc,
21179
  resize : crop.resize_update,
21180
  handles : 'all'
21181
  })
21182
  .draggable({
21183
  handle : coverc,
21184
  containment : imgc,
21185
+ drag : crop.drag_update,
21186
+ stop : crop.updateView
21187
  });
21188
 
21189
+ dinit();
21190
  crop.update();
21191
  }
21192
  }
21197
  imgr.hide();
21198
  }
21199
  else {
21200
+ imgr.show();
21201
+ dinit();
 
 
 
21202
 
21203
  }
21204
  }
21205
  },
21206
  save = function() {
21207
+ var w, h, x, y, d, q, b = '';
 
 
 
21208
 
21209
  if (mode == 'resize') {
21210
  w = parseInt(width.val()) || 0;
21222
  return fm.error('Invalid rotate degree');
21223
  }
21224
  if (d == 0 || d == 360) {
21225
+ return fm.error('errResizeNoChange');
21226
  }
21227
+ b = bg.val();
21228
  }
21229
  q = quality? parseInt(quality.val()) : 0;
21230
 
21235
  }
21236
 
21237
  if (w == owidth && h == oheight) {
21238
+ return fm.error('errResizeNoChange');
21239
  }
21240
 
21241
  }
21242
 
21243
  dialog.elfinderdialog('close');
21244
 
21245
+ self.resizeRequest({
21246
+ target : file.hash,
21247
+ width : w,
21248
+ height : h,
21249
+ x : x,
21250
+ y : y,
21251
+ degree : d,
21252
+ quality: q,
21253
+ bg : b,
21254
+ mode : mode
21255
+ }, file, dfrd);
 
 
 
 
 
 
 
 
 
 
21256
  },
21257
  buttons = {},
21258
  hline = 'elfinder-resize-handle-hline',
21259
  vline = 'elfinder-resize-handle-vline',
21260
  rpoint = 'elfinder-resize-handle-point',
21261
+ src = fm.openUrl(file.hash, fm.isCORS? true : false),
21262
+ dinit = function() {
21263
+ if (base.hasClass('elfinder-dialog-minimized')) {
21264
+ return;
21265
+ }
21266
+ var dw,
21267
+ winH = $(window).height(),
21268
+ winW = $(window).width(),
21269
+ ctrW = dialog.find('div.elfinder-resize-control').width(),
21270
+ prvW = preview.width(),
21271
+ baseW = base.width();
21272
+
21273
+ base.width(Math.min(dialogWidth, winW - 30));
21274
+ preview.attr('style', '');
21275
+ if (owidth && oheight) {
21276
+ pwidth = preview.width() - (rhandle.outerWidth() - rhandle.width());
21277
+ pheight = preview.height() - (rhandle.outerHeight() - rhandle.height());
21278
+ resize.updateView(owidth, oheight);
21279
+ }
21280
+ prvW = preview.width(),
21281
+
21282
+ dw = dialog.width() - 20;
21283
+ if (prvW > dw) {
21284
+ preview.width(dw);
21285
+ } else if ((dw - prvW) < ctrW) {
21286
+ if (winW > winH) {
21287
+ preview.width(dw - ctrW - 20);
21288
+ } else {
21289
+ preview.css({ float: 'none', marginLeft: 'auto', marginRight: 'auto'});
21290
+ }
21291
+ }
21292
+ pwidth = preview.width() - (rhandle.outerWidth() - rhandle.width());
21293
+ if (fmnode.hasClass('elfinder-fullscreen')) {
21294
+ if (base.height() > winH) {
21295
+ winH -= 2;
21296
+ preview.height(winH - base.height() + preview.height());
21297
+ base.css('top', 0 - fmnode.offset().top);
21298
+ }
21299
+ } else {
21300
+ winH -= 30;
21301
+ (preview.height() > winH) && preview.height(winH);
21302
+ }
21303
+ pheight = preview.height() - (rhandle.outerHeight() - rhandle.height());
21304
+ if (owidth && oheight) {
21305
+ setupimg();
21306
+ }
21307
+ if (img.height() && preview.height() > img.height() + 20) {
21308
+ preview.height(img.height() + 20);
21309
+ pheight = preview.height() - (rhandle.outerHeight() - rhandle.height());
21310
+ setuprimg();
21311
+ }
21312
+ },
21313
+ dMinBtn, base;
21314
 
21315
+ if (fm.isCORS) {
21316
+ img.attr('crossorigin', 'use-credentials');
21317
+ imgc.attr('crossorigin', 'use-credentials');
21318
+ imgr.attr('crossorigin', 'use-credentials');
21319
+ }
21320
  imgr.mousedown( rotate.start );
21321
  $(document).mouseup( rotate.stop );
21322
 
21323
  uiresize.append(
21324
+ $(row).append($(label).text(fm.i18n('width')), width),
21325
+ $(row).append($(label).text(fm.i18n('height')), height, $('<div class="elfinder-resize-whctrls">').append(constr, reset)),
 
21326
  (quality? $(row).append($(label).text(fm.i18n('quality')), quality, $('<span/>').text(' (1-100)')) : $()),
21327
+ (isJpeg? $(row).append($(label).text(fm.i18n('8pxgrid')).addClass('elfinder-resize-grid8'), grid8px) : $()),
21328
  $(row).append($(label).text(fm.i18n('scale')), uiprop)
21329
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21330
 
21331
+ if (api2) {
21332
+ uicrop.append(
21333
+ $(row).append($(label).text('X'), pointX),
21334
+ $(row).append($(label).text('Y')).append(pointY),
21335
+ $(row).append($(label).text(fm.i18n('width')), offsetX),
21336
+ $(row).append($(label).text(fm.i18n('height')), offsetY, $('<div class="elfinder-resize-whctrls">').append(constrc, reset.clone(true))),
21337
+ (quality? $(row).append($(label).text(fm.i18n('quality')), quality.clone(true), $('<span/>').text(' (1-100)')) : $()),
21338
+ (isJpeg? $(row).append($(label).text(fm.i18n('8pxgrid')).addClass('elfinder-resize-grid8')) : $())
21339
+ );
21340
+
21341
+ uirotate.append(
21342
+ $(row).addClass('elfinder-resize-degree').append(
21343
+ $(label).text(fm.i18n('rotate')),
21344
+ degree,
21345
+ $('<span/>').text(fm.i18n('degree')),
21346
+ $('<div/>').append(uideg270, uideg90)[ctrgrup]()
21347
+ ),
21348
+ $(row).css('height', '20px').append(uidegslider),
21349
+ (quality? $(row).addClass('elfinder-resize-quality').append(
21350
+ $(label).text(fm.i18n('quality')),
21351
+ quality.clone(true),
21352
+ $('<span/>').text(' (1-100)')) : $()
21353
+ ),
21354
+ $(row).append($(label).text(fm.i18n('bgcolor')), bg, picker, reseter),
21355
+ $(row).css('height', '20px').append(pallet)
21356
+ );
21357
+ uideg270.on('click', function() {
21358
+ rdegree = rdegree - 90;
21359
+ rotate.update(rdegree);
21360
+ });
21361
+ uideg90.on('click', function(){
21362
+ rdegree = rdegree + 90;
21363
+ rotate.update(rdegree);
21364
+ });
21365
+ }
21366
 
21367
  dialog.append(uitype).on('resize', function(e){
21368
  e.stopPropagation();
21369
  });
21370
 
21371
+ if (api2) {
21372
+ control.append($(row), uiresize, uicrop.hide(), uirotate.hide());
21373
+ } else {
21374
+ control.append($(row), uiresize);
21375
+ }
21376
 
21377
  rhandle.append('<div class="'+hline+' '+hline+'-top"/>',
21378
  '<div class="'+hline+' '+hline+'-bottom"/>',
21384
 
21385
  preview.append(spinner).append(rhandle.hide()).append(img.hide());
21386
 
21387
+ if (api2) {
21388
+ rhandlec.css('position', 'absolute')
21389
+ .append('<div class="'+hline+' '+hline+'-top"/>',
21390
+ '<div class="'+hline+' '+hline+'-bottom"/>',
21391
+ '<div class="'+vline+' '+vline+'-left"/>',
21392
+ '<div class="'+vline+' '+vline+'-right"/>',
21393
+ '<div class="'+rpoint+' '+rpoint+'-n"/>',
21394
+ '<div class="'+rpoint+' '+rpoint+'-e"/>',
21395
+ '<div class="'+rpoint+' '+rpoint+'-s"/>',
21396
+ '<div class="'+rpoint+' '+rpoint+'-w"/>',
21397
+ '<div class="'+rpoint+' '+rpoint+'-ne"/>',
21398
+ '<div class="'+rpoint+' '+rpoint+'-se"/>',
21399
+ '<div class="'+rpoint+' '+rpoint+'-sw"/>',
21400
+ '<div class="'+rpoint+' '+rpoint+'-nw"/>');
21401
+
21402
+ preview.append(basec.css('position', 'absolute').hide().append(imgc, rhandlec.append(coverc)));
21403
+
21404
+ preview.append(imgr.hide());
21405
+ }
21406
 
21407
  preview.css('overflow', 'hidden');
21408
 
21411
  buttons[fm.i18n('btnApply')] = save;
21412
  buttons[fm.i18n('btnCancel')] = function() { dialog.elfinderdialog('close'); };
21413
 
21414
+ dialog.find('input,button').addClass('elfinder-tabstop');
21415
+
21416
+ base = fm.dialog(dialog, {
21417
  title : fm.escape(file.name),
21418
+ width : dialogWidth,
21419
  resizable : false,
 
21420
  buttons : buttons,
21421
  open : function() {
21422
+ dMinBtn = base.find('.ui-dialog-titlebar .elfinder-titlebar-minimize').hide();
21423
+ fm.bind('resize', dinit);
 
 
 
21424
  img.attr('src', src + (src.indexOf('?') === -1 ? '?' : '&')+'_='+Math.random());
21425
  imgc.attr('src', img.attr('src'));
21426
  imgr.attr('src', img.attr('src'));
21427
+ },
21428
+ close : function() {
21429
+ fm.unbind('resize', dinit);
21430
+ $(this).elfinderdialog('destroy');
21431
+ },
21432
+ resize : function(e, data) {
21433
+ if (data && data.minimize === false) {
21434
+ dinit();
21435
+ }
21436
  }
21437
+ }).attr('id', id).parent();
21438
 
21439
  // for IE < 9 dialog mising at open second+ time.
21440
  if (fm.UA.ltIE8) {
21441
  $('.elfinder-dialog').css('filter', '');
21442
  }
21443
 
 
 
21444
  coverc.css({ 'opacity': 0.2, 'background-color': '#fff', 'position': 'absolute'}),
21445
  rhandlec.css('cursor', 'move');
21446
  rhandlec.find('.elfinder-resize-handle-point').css({
21449
  'border-color':'#000'
21450
  });
21451
 
21452
+ if (! api2) {
21453
+ uitype.find('.api2').remove();
21454
+ }
21455
 
21456
+ control.find('input,select').prop('disabled', true);
21457
+
21458
  },
21459
 
21460
  id, dialog
21656
  this.getstate = function(sel) {
21657
  var fm = this.fm;
21658
  sel = sel || fm.selected();
21659
+ return !this._disabled && sel.length && $.map(sel, function(h) { var f = fm.file(h); return f && ! f.locked && ! fm.isRoot(f)? h : null }).length == sel.length
21660
  ? 0 : -1;
21661
  }
21662
 
21673
  tpl = '<div class="ui-helper-clearfix elfinder-rm-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}<div class="elfinder-rm-desc">{desc}</div></div>',
21674
  targets, text, f, fname, size, tmb, descs, dialog;
21675
 
21676
+ if (! cnt) {
21677
  return dfrd.reject();
21678
  }
21679
 
21680
  $.each(files, function(i, file) {
21681
+ if (fm.isRoot(file)) {
21682
  return !dfrd.reject(['errRm', file.name, 'errPerm']);
21683
  }
21684
  if (file.locked) {
21710
  text = [$(tpl.replace('{class}', 'elfinder-cwd-icon-group').replace('{title}', '<strong>' + fm.i18n('items')+ ': ' + cnt + '</strong>').replace('{desc}', descs.join('<br>')))];
21711
  } else {
21712
  f = files[0];
21713
+ tmb = fm.tmb(f);
 
 
21714
  if (f.size) {
21715
  descs.push(fm.i18n('size')+': '+fm.formatSize(f.size));
21716
  }
21749
  label : 'btnCancel',
21750
  callback : function() {
21751
  fm.unlockfiles({files : targets});
21752
+ if (targets.length === 1 && fm.file(targets[0]).phash !== cwd) {
21753
+ fm.select({selected : targets});
21754
+ } else {
21755
+ fm.selectfiles({files : targets});
21756
+ }
21757
  dfrd.reject();
21758
  }
21759
  }
21761
  // load thumbnail
21762
  if (tmb) {
21763
  $('<img/>')
21764
+ .on('load', function() { dialog.find('.elfinder-cwd-icon').addClass(tmb.className).css('background-image', "url('"+tmb.url+"')"); })
21765
+ .attr('src', tmb.url);
21766
  }
21767
  }
21768
 
21769
  return dfrd;
21770
  }
21771
 
21772
+ };
21773
+
21774
 
21775
  /*
21776
  * File: /js/commands/search.js
21805
  * @return $.Deferred
21806
  **/
21807
  this.exec = function(q, target, mime) {
21808
+ var fm = this.fm,
21809
+ reqDef = [],
21810
+ onlyMimes = fm.options.onlyMimes,
21811
+ phash;
21812
 
21813
  if (typeof q == 'string' && q) {
21814
  if (typeof target == 'object') {
21816
  target = target.target || '';
21817
  }
21818
  target = target? target : '';
21819
+ if (mime) {
21820
+ mime = $.trim(mime).replace(',', ' ').split(' ');
21821
+ mime = $.map(mime, function(m){
21822
+ m = $.trim(m);
21823
+ return m && ($.inArray(m, onlyMimes) !== -1
21824
+ || $.map(onlyMimes, function(om) { return m.indexOf(om) === 0? true : null }).length
21825
+ )? m : null
21826
+ });
21827
+ } else {
21828
+ mime = [].concat(onlyMimes);
21829
+ }
21830
+
21831
  fm.trigger('searchstart', {query : q, target : target, mimes : mime});
21832
 
21833
+ if (! onlyMimes.length || mime.length) {
21834
+ if (target === '' && fm.api >= 2.1) {
21835
+ $.each(fm.roots, function(id, hash) {
21836
+ reqDef.push(fm.request({
21837
+ data : {cmd : 'search', q : q, target : hash, mimes : mime},
21838
+ notify : {type : 'search', cnt : 1, hideCnt : (reqDef.length? false : true)},
21839
+ cancel : true,
21840
+ preventDone : true
21841
+ }));
21842
+ });
21843
+ } else {
21844
+ reqDef.push(fm.request({
21845
+ data : {cmd : 'search', q : q, target : target, mimes : mime},
21846
+ notify : {type : 'search', cnt : 1, hideCnt : true},
21847
+ cancel : true,
21848
+ preventDone : true
21849
+ }));
21850
+ if (target !== '' && fm.api >= 2.1 && Object.keys(fm.leafRoots).length) {
21851
+ $.each(fm.leafRoots, function(hash, roots) {
21852
+ phash = hash;
21853
+ while(phash) {
21854
+ if (target === phash) {
21855
+ $.each(roots, function() {
21856
+ reqDef.push(fm.request({
21857
+ data : {cmd : 'search', q : q, target : this, mimes : mime},
21858
+ notify : {type : 'search', cnt : 1, hideCnt : false},
21859
+ cancel : true,
21860
+ preventDone : true
21861
+ }));
21862
+ });
21863
+ }
21864
+ phash = (fm.file(phash) || {}).phash;
21865
+ }
21866
+ });
21867
+ }
21868
+ }
21869
+ } else {
21870
+ reqDef = [$.Deferred().resolve({files: []})];
21871
+ }
21872
+
21873
+ fm.searchStatus.mixed = (reqDef.length > 1);
21874
+
21875
+ return $.when.apply($, reqDef).done(function(data) {
21876
+ var argLen = arguments.length,
21877
+ i;
21878
+
21879
+ data.warning && fm.error(data.warning);
21880
+
21881
+ if (argLen > 1) {
21882
+ data.files = (data.files || []);
21883
+ for(i = 1; i < argLen; i++) {
21884
+ arguments[i].warning && fm.error(arguments[i].warning);
21885
+
21886
+ if (arguments[i].files) {
21887
+ data.files.push.apply(data.files, arguments[i].files);
21888
+ }
21889
+ }
21890
+ }
21891
+
21892
+ fm.lazy(function() {
21893
+ fm.trigger('search', data);
21894
+ }).then(function() {
21895
+ // fire event with command name + 'done'
21896
+ return fm.lazy(function() {
21897
+ fm.trigger('searchdone');
21898
+ });
21899
+ }).then(function() {
21900
+ // force update content
21901
+ data.sync && fm.sync();
21902
+ });
21903
  });
21904
  }
21905
  fm.getUI('toolbar').find('.'+fm.res('class', 'searchbtn')+' :text').focus();
21906
  return $.Deferred().reject();
21907
  }
21908
 
21909
+ };
21910
+
21911
 
21912
  /*
21913
  * File: /js/commands/sort.js
21921
  **/
21922
  elFinder.prototype.commands.sort = function() {
21923
  var self = this,
21924
+ fm = self.fm,
21925
+ setVar = function() {
21926
+ self.variants = [];
21927
+ $.each(fm.sortRules, function(name, value) {
21928
+ var sort = {
21929
+ type : name,
21930
+ order : name == fm.sortType ? fm.sortOrder == 'asc' ? 'desc' : 'asc' : fm.sortOrder
21931
+ };
21932
+ if ($.inArray(name, fm.sorters) !== -1) {
21933
+ var arr = name == fm.sortType ? (sort.order == 'asc'? 's' : 'n') : '';
21934
+ self.variants.push([sort, (arr? '<span class="ui-icon ui-icon-arrowthick-1-'+arr+'"></span>' : '') + '&nbsp;' + fm.i18n('sort'+name)]); }
21935
+ });
21936
+ self.variants.push('|');
21937
+ self.variants.push([
21938
+ {
21939
+ type : fm.sortType,
21940
+ order : fm.sortOrder,
21941
+ stick : !fm.sortStickFolders,
21942
+ tree : fm.sortAlsoTreeview
21943
+ },
21944
+ (fm.sortStickFolders? '<span class="ui-icon ui-icon-check"/>' : '') + '&nbsp;' + fm.i18n('sortFoldersFirst')
21945
+ ]);
21946
+ if (fm.ui.tree) {
21947
+ self.variants.push('|');
21948
+ self.variants.push([
21949
+ {
21950
+ type : fm.sortType,
21951
+ order : fm.sortOrder,
21952
+ stick : fm.sortStickFolders,
21953
+ tree : !fm.sortAlsoTreeview
21954
+ },
21955
+ (fm.sortAlsoTreeview? '<span class="ui-icon ui-icon-check"/>' : '') + '&nbsp;' + fm.i18n('sortAlsoTreeview')
21956
+ ]);
21957
+ }
21958
+ };
21959
 
21960
  /**
21961
  * Command options
21964
  */
21965
  this.options = {ui : 'sortbutton'};
21966
 
21967
+ fm.bind('open sortchange', setVar)
21968
+ .bind('open', function() {
21969
+ fm.unbind('add', setVar).one('add', setVar)
21970
+ fm.getUI('toolbar').find('.elfiner-button-sort .elfinder-button-menu .elfinder-button-menu-item').each(function() {
21971
+ var tgt = $(this),
21972
+ rel = tgt.attr('rel');
21973
+ tgt.toggle(! rel || $.inArray(rel, fm.sorters) !== -1);
 
 
21974
  });
21975
+ })
21976
+ .bind('cwdrender', function() {
21977
+ var cols = $(fm.cwd).find('div.elfinder-cwd-wrapper-list table');
21978
+ if (cols.length) {
21979
+ $.each(fm.sortRules, function(name, value) {
21980
+ var td = cols.find('thead tr td.elfinder-cwd-view-th-'+name);
21981
+ if (td.length) {
21982
+ var current = ( name == fm.sortType),
21983
+ sort = {
21984
+ type : name,
21985
+ order : current ? fm.sortOrder == 'asc' ? 'desc' : 'asc' : fm.sortOrder
21986
+ },arr;
21987
+ if (current) {
21988
+ td.addClass('ui-state-active');
21989
+ arr = fm.sortOrder == 'asc' ? 'n' : 's';
21990
+ $('<span class="ui-icon ui-icon-triangle-1-'+arr+'"/>').appendTo(td);
 
 
 
 
 
 
 
 
 
 
 
 
 
21991
  }
21992
+ $(td).on('click', function(e){
21993
+ if (! $(this).data('dragging')) {
21994
+ e.stopPropagation();
21995
+ if (! fm.getUI('cwd').data('longtap')) {
21996
+ self.exec([], sort);
21997
+ }
21998
+ }
21999
+ })
22000
+ .hover(function() {
22001
+ $(this).addClass('ui-state-hover');
22002
+ },function() {
22003
+ $(this).removeClass('ui-state-hover');
22004
+ });
22005
+ }
22006
+
22007
+ });
22008
+ }
22009
  });
22010
 
22011
  this.getstate = function() {
22017
  sort = $.extend({
22018
  type : fm.sortType,
22019
  order : fm.sortOrder,
22020
+ stick : fm.sortStickFolders,
22021
+ tree : fm.sortAlsoTreeview
22022
  }, sortopt);
22023
 
22024
+ return fm.lazy(function() {
22025
+ fm.setSort(sort.type, sort.order, sort.stick, sort.tree);
22026
+ this.resolve();
22027
+ });
22028
  };
22029
 
22030
  };
22031
 
22032
+
22033
  /*
22034
  * File: /js/commands/up.js
22035
  */
22040
  *
22041
  * @author Dmitry (dio) Levashov
22042
  **/
22043
+ (elFinder.prototype.commands.up = function() {
22044
  this.alwaysEnabled = true;
22045
  this.updateOnSelect = false;
22046
 
22053
  }
22054
 
22055
  this.exec = function() {
22056
+ var fm = this.fm,
22057
+ cwdhash = fm.cwd().hash;
22058
+ return this.fm.cwd().phash ? this.fm.exec('open', this.fm.cwd().phash).done(function() {
22059
+ fm.one('opendone', function() {
22060
+ fm.selectfiles({files : [cwdhash]});
22061
+ });
22062
+ }) : $.Deferred().reject();
22063
  }
22064
 
22065
+ }).prototype = { forceLoad : true }; // this is required command
22066
+
22067
 
22068
  /*
22069
  * File: /js/commands/upload.js
22095
  **/
22096
  this.getstate = function(sel) {
22097
  var fm = this.fm, f,
22098
+ sel = (sel || [fm.cwd().hash]);
22099
  if (!this._disabled && sel.length == 1) {
22100
  f = fm.file(sel[0]);
22101
  }
22105
 
22106
  this.exec = function(data) {
22107
  var fm = this.fm,
22108
+ cwdHash = fm.cwd().hash,
22109
+ getTargets = function() {
22110
+ var tgts = data && (data instanceof Array)? data : null,
22111
+ sel;
22112
+ if (! data) {
22113
+ if (! tgts && (sel = fm.selected()).length === 1 && fm.file(sel[0]).mime === 'directory') {
22114
+ tgts = sel;
22115
+ } else {
22116
+ tgts = [ cwdHash ];
22117
+ }
22118
+ }
22119
+ return tgts;
22120
+ },
22121
+ targets = getTargets(),
22122
+ check = !targets && data && data.target? data.target : targets[0],
22123
+ targetDir = check? fm.file(check) : fm.cwd(),
22124
  fmUpload = function(data) {
22125
  fm.upload(data)
22126
  .fail(function(error) {
22127
  dfrd.reject(error);
22128
  })
22129
  .done(function(data) {
22130
+ var cwd = fm.getUI('cwd'),
22131
+ node;
22132
  dfrd.resolve(data);
22133
+ if (data && data.added && data.added[0] && ! fm.ui.notify.children('.elfinder-notify-upload').length) {
22134
+ var newItem = fm.findCwdNodes(data.added);
22135
  if (newItem.length) {
22136
  newItem.trigger('scrolltoview');
22137
+ } else {
22138
+ if (targetDir.hash !== cwdHash) {
22139
+ node = $('<div/>').append(
22140
+ $('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all elfinder-tabstop"><span class="ui-button-text">'+fm.i18n('cmdopendir')+'</span></button>')
22141
+ .on('mouseenter mouseleave', function(e) {
22142
+ $(this).toggleClass('ui-state-hover', e.type == 'mouseenter');
22143
+ }).on('click', function() {
22144
+ fm.exec('open', check).done(function() {
22145
+ fm.one('opendone', function() {
22146
+ fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})});
22147
+ });
22148
+ });
22149
+ })
22150
+ );
22151
+ } else {
22152
+ fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})});
22153
+ }
22154
+ fm.toast({msg: fm.i18n(['complete', fm.i18n('cmdupload')]), extNode: node});
22155
  }
22156
  }
22157
  });
22163
  }
22164
  fmUpload(data);
22165
  },
22166
+ getSelector = function() {
22167
+ var hash = targetDir.hash,
22168
+ dirs = $.map(fm.files(), function(f) {
22169
+ return (f.mime === 'directory' && f.write && f.phash && f.phash === hash)? f : null;
22170
+ });
22171
+
22172
+ if (! dirs.length) {
22173
+ return $();
22174
+ }
22175
+
22176
+ return $('<div class="elfinder-upload-dirselect elfinder-tabstop" title="' + fm.i18n('folders') + '"/>')
22177
+ .on('click', function(e) {
22178
+ e.stopPropagation();
22179
+ e.preventDefault();
22180
+ dirs = fm.sortFiles(dirs);
22181
+ var $this = $(this),
22182
+ cwd = fm.cwd(),
22183
+ base = dialog.closest('div.ui-dialog'),
22184
+ getRaw = function(f, icon) {
22185
+ return {
22186
+ label : fm.escape(f.i18 || f.name),
22187
+ icon : icon,
22188
+ remain : false,
22189
+ callback : function() {
22190
+ var title = base.children('.ui-dialog-titlebar:first').find('span.elfinder-upload-target');
22191
+ targets = [ f.hash ];
22192
+ title.html(' - ' + fm.escape(f.i18 || f.name));
22193
+ $this.focus();
22194
+ },
22195
+ options : {
22196
+ className : (targets && targets.length && f.hash === targets[0])? 'ui-state-active' : '',
22197
+ iconClass : f.csscls || '',
22198
+ iconImg : f.icon || ''
22199
+ }
22200
+ }
22201
+ },
22202
+ raw = [ getRaw(targetDir, 'opendir'), '|' ];
22203
+ $.each(dirs, function(i, f) {
22204
+ raw.push(getRaw(f, 'dir'));
22205
+ });
22206
+ $this.blur();
22207
+ fm.trigger('contextmenu', {
22208
+ raw: raw,
22209
+ x: e.pageX || $(this).offset().left,
22210
+ y: e.pageY || $(this).offset().top,
22211
+ prevNode: base,
22212
+ fitHeight: true
22213
+ });
22214
+ }).append('<span class="elfinder-button-icon elfinder-button-icon-dir" />');
22215
+ },
22216
  dfrd = $.Deferred(),
22217
+ dialog, input, button, dropbox, pastebox, dropUpload, paste, dirs, spinner, uidialog;
 
 
 
 
22218
 
22219
  dropUpload = function(e) {
22220
  e.stopPropagation();
22224
  elfFrom = null,
22225
  mycwd = '',
22226
  data = null,
22227
+ target = e._target || null,
22228
+ trf = e.dataTransfer || null,
22229
+ kind = (trf.items && trf.items.length && trf.items[0].kind)? trf.items[0].kind : '',
22230
+ errors;
22231
+
22232
+ if (trf) {
22233
+ try {
22234
+ elfFrom = trf.getData('elfinderfrom');
22235
+ if (elfFrom) {
22236
+ mycwd = window.location.href + fm.cwd().hash;
22237
+ if ((!target && elfFrom === mycwd) || target === mycwd) {
22238
+ dfrd.reject();
22239
+ return;
22240
+ }
22241
+ }
22242
+ } catch(e) {}
22243
+
22244
+ if (kind === 'file' && (trf.items[0].getAsEntry || trf.items[0].webkitGetAsEntry)) {
22245
+ file = trf;
22246
+ type = 'data';
22247
+ } else if (kind !== 'string' && trf.files && trf.files.length && $.inArray('Text', trf.types) === -1) {
22248
+ file = trf.files;
22249
+ type = 'files';
22250
+ } else {
22251
+ try {
22252
+ if ((data = trf.getData('text/html')) && data.match(/<(?:img|a)/i)) {
22253
+ file = [ data ];
22254
+ type = 'html';
22255
+ }
22256
+ } catch(e) {}
22257
+ if (! file && (data = trf.getData('text'))) {
22258
+ file = [ data ];
22259
+ type = 'text';
22260
+ }
22261
  }
22262
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22263
  if (file) {
22264
  fmUpload({files : file, type : type, target : target});
22265
  } else {
22266
+ errors = ['errUploadNoFiles'];
22267
+ if (kind !== 'string') {
22268
+ errors.push('errFolderUpload');
22269
+ }
22270
+ fm.error(errors);
22271
  dfrd.reject();
22272
  }
22273
  };
22330
  e.originalEvent.dataTransfer.dropEffect = 'copy';
22331
  });
22332
 
22333
+ button = $('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only elfinder-tabstop elfinder-focus"><span class="ui-button-text">'+fm.i18n('selectForUpload')+'</span></div>')
22334
  .append($('<form/>').append(input))
22335
+ .on('click', function(e) {
22336
+ if (e.target === this) {
22337
+ e.stopPropagation();
22338
+ e.preventDefault();
22339
+ input.click();
22340
+ }
22341
+ })
22342
  .hover(function() {
22343
  button.toggleClass(hover)
22344
  });
22346
  dialog = $('<div class="elfinder-upload-dialog-wrapper"/>')
22347
  .append(button);
22348
 
22349
+ if (targetDir.dirs) {
22350
+ if (targetDir.hash === cwdHash || $('#'+fm.navHash2Id(targetDir.hash)).hasClass('elfinder-subtree-loaded')) {
22351
+ getSelector().appendTo(dialog);
22352
+ } else {
22353
+ spinner = $('<div class="elfinder-upload-dirselect" title="' + fm.i18n('nowLoading') + '"/>')
22354
+ .append('<span class="elfinder-button-icon elfinder-button-icon-spinner" />')
22355
+ .appendTo(dialog);
22356
+ fm.request({cmd : 'tree', target : targetDir.hash})
22357
+ .done(function() {
22358
+ fm.one('treedone', function() {
22359
+ spinner.replaceWith(getSelector());
22360
+ uidialog.elfinderdialog('tabstopsInit');
22361
+ });
22362
+ })
22363
+ .fail(function() {
22364
+ spinner.remove();
22365
+ });
22366
+ }
22367
+ }
22368
 
22369
  if (fm.dragUpload) {
22370
+ dropbox = $('<div class="ui-corner-all elfinder-upload-dropbox elfinder-tabstop" contenteditable="true" data-ph="'+fm.i18n('dropPasteFiles')+'"></div>')
22371
  .on('paste', function(e){
22372
  paste(e);
22373
  })
22383
  .on('mouseout', function(){
22384
  $(this).removeClass(hover);
22385
  })
22386
+ .on('dragenter', function(e) {
22387
+ e.stopPropagation();
22388
+ e.preventDefault();
22389
+ $(this).addClass(hover);
22390
+ })
22391
+ .on('dragleave', function(e) {
22392
+ e.stopPropagation();
22393
+ e.preventDefault();
22394
+ $(this).removeClass(hover);
22395
+ })
22396
+ .on('dragover', function(e) {
22397
+ e.stopPropagation();
22398
+ e.preventDefault();
22399
+ e.originalEvent.dataTransfer.dropEffect = 'copy';
22400
+ $(this).addClass(hover);
22401
+ })
22402
+ .on('drop', function(e) {
22403
+ dialog.elfinderdialog('close');
22404
+ targets && (e.originalEvent._target = targets[0]);
22405
+ dropUpload(e.originalEvent);
22406
+ })
22407
  .prependTo(dialog)
22408
  .after('<div class="elfinder-upload-dialog-or">'+fm.i18n('or')+'</div>')[0];
22409
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22410
  } else {
22411
+ pastebox = $('<div class="ui-corner-all elfinder-upload-dropbox" contenteditable="true">'+fm.i18n('dropFilesBrowser')+'</div>')
22412
+ .on('paste drop', function(e){
22413
+ paste(e);
22414
+ })
22415
+ .on('mousedown click', function(){
22416
+ $(this).focus();
22417
+ })
22418
+ .on('focus', function(){
22419
+ this.innerHTML = '';
22420
+ })
22421
+ .on('dragenter mouseover', function(){
22422
+ $(this).addClass(hover);
22423
+ })
22424
+ .on('dragleave mouseout', function(){
22425
+ $(this).removeClass(hover);
22426
+ })
22427
  .prependTo(dialog)
22428
  .after('<div class="elfinder-upload-dialog-or">'+fm.i18n('or')+'</div>')[0];
22429
 
22430
  }
22431
 
22432
+ uidialog = fm.dialog(dialog, {
22433
+ title : this.title + '<span class="elfinder-upload-target">' + (targetDir? ' - ' + fm.escape(targetDir.i18 || targetDir.name) : '') + '</span>',
22434
  modal : true,
22435
  resizable : false,
22436
  destroyOnClose : true
22441
 
22442
  };
22443
 
22444
+
22445
  /*
22446
  * File: /js/commands/view.js
22447
  */
22453
  * @author Dmitry (dio) Levashov
22454
  **/
22455
  elFinder.prototype.commands.view = function() {
22456
+ var fm = this.fm;
22457
+ this.value = fm.viewType;
22458
  this.alwaysEnabled = true;
22459
  this.updateOnSelect = false;
22460
 
22465
  }
22466
 
22467
  this.exec = function() {
22468
+ var self = this,
22469
+ value = fm.storage('view', this.value == 'list' ? 'icons' : 'list');
22470
+ return fm.lazy(function() {
22471
+ fm.viewchange();
22472
+ self.update(void(0), value);
22473
+ this.resolve();
22474
+ });
22475
  }
22476
 
22477
+ };
22478
+
22479
  })(jQuery);
elFinder/js/elfinder.min.js CHANGED
@@ -1,15 +1,19 @@
1
  /*!
2
  * elFinder - file manager for web
3
- * Version 2.1.6 (2016-01-19)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
- * Licensed under a 3 clauses BSD license
8
  */
9
- !function(e){window.elFinder=function(t,n){var i,a,r,o=this,t=e(t),s=e("<div/>").append(t.contents()),l=t.attr("style"),d=t.attr("id")||"",c="elfinder-"+(d||Math.random().toString().substr(2,7)),u="mousedown."+c,p="keydown."+c,h="keypress."+c,f=!0,m=!0,g="",v={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmb:!1},b={},y=[],w={},x={},k=[],C=[],T=[],I=new o.command(o),F="auto",M=400,P="./sounds/",S=e(document.createElement("audio")).hide().appendTo("body")[0],z="",A=function(t){var n,i,a={},r={};o.commandMap=t.options.uiCmdMap&&Object.keys(t.options.uiCmdMap).length?t.options.uiCmdMap:{},z!==JSON.stringify(o.commandMap)&&(z=JSON.stringify(o.commandMap),Object.keys(o.commandMap).length&&(i=o.getUI("contextmenu"),i.data("cmdMaps")||i.data("cmdMaps",{}),n=t.cwd?t.cwd.volumeid:null,n&&!i.data("cmdMaps")[n]&&(i.data("cmdMaps")[n]=o.commandMap))),t.init?b={}:(e.each(Object.keys(b),function(t,n){var i="directory"===b[n].mime,s=b[n].phash;o.res("class","navcollapse"),(!i||a[s]||!r[s]&&e("#"+o.navHash2Id(b[n].hash)).is(":hidden")&&e("#"+o.navHash2Id(s)).next(".elfinder-navbar-subtree").children().length>100)&&(i||s===g)&&-1===e.inArray(n,C)?(i&&!a[s]&&(a[s]=!0),delete b[n]):i&&(r[s]=!0)}),e.each(Object.keys(a),function(t,n){var i="elfinder-subtree-loaded "+o.res("class","navexpand");e("#"+o.navHash2Id(n)).removeClass(i).next(".elfinder-navbar-subtree").empty()})),g=t.cwd.hash,D(t.files),b[g]||D([t.cwd]),o.lastDir(g),o.autoSync()},D=function(e){var t,n,i=e.length;for(n=0;i>n;n++)if(t=e[n],t.name&&t.hash&&t.mime){if(!t.phash){var a="volume_"+t.name,r=o.i18n(a);a!=r&&(t.i18=r),t.volumeid&&(t.disabled&&(o.disabledCmds[t.volumeid]=t.disabled),o.tmbUrls[t.volumeid]=o.option("tmbUrl"))}b[t.hash]=t}},O=function(t){var n=t.keyCode,i=!(!t.ctrlKey&&!t.metaKey);f&&(e.each(x,function(e,a){a.type==t.type&&a.keyCode==n&&a.shiftKey==t.shiftKey&&a.ctrlKey==i&&a.altKey==t.altKey&&(t.preventDefault(),t.stopPropagation(),a.callback(t,o),o.debug("shortcut-exec",e+" : "+a.description))}),9!=n||e(t.target).is(":input")||t.preventDefault(),27==n&&o.clipboard().length&&o.clipboard([]))},U=new Date;return this.api=null,this.newAPI=!1,this.oldAPI=!1,this.netDrivers=[],this.OS=-1!==navigator.userAgent.indexOf("Mac")?"mac":-1!==navigator.userAgent.indexOf("Win")?"win":"other",this.UA=function(){var e=!document.uniqueID&&!window.opera&&!window.sidebar&&window.localStorage&&"undefined"==typeof window.orientation;return{ltIE6:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.documentElement.style.maxHeight,ltIE7:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.querySelectorAll,ltIE8:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:e&&window.chrome,Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart}}(),this.options=e.extend(!0,{},this._options,n||{}),n.ui&&(this.options.ui=n.ui),n.commands&&(this.options.commands=n.commands),n.uiOptions&&n.uiOptions.toolbar&&(this.options.uiOptions.toolbar=n.uiOptions.toolbar),n.uiOptions&&n.uiOptions.cwd&&n.uiOptions.cwd.listView&&n.uiOptions.cwd.listView.columns&&(this.options.uiOptions.cwd.listView.columns=n.uiOptions.cwd.listView.columns),n.uiOptions&&n.uiOptions.cwd&&n.uiOptions.cwd.listView&&n.uiOptions.cwd.listView.columnsCustomName&&(this.options.uiOptions.cwd.listView.columnsCustomName=n.uiOptions.cwd.listView.columnsCustomName),function(){var t,i=document.createElement("a");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(window.location.host!==i.host||t&&window.location.host!==t.host)&&(e.isPlainObject(o.options.customHeaders)||(o.options.customHeaders={}),e.isPlainObject(o.options.xhrFields)||(o.options.xhrFields={}),o.options.requestType="post",o.options.customHeaders["X-Requested-With"]="XMLHttpRequest",o.options.xhrFields.withCredentials=!0)}(),e.extend(this.options.contextmenu,n.contextmenu),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",this.customData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.id=d,this.navPrefix="nav"+(elFinder.prototype.uniqueid?elFinder.prototype.uniqueid:"")+"-",this.cwdPrefix=elFinder.prototype.uniqueid?"cwd"+elFinder.prototype.uniqueid+"-":"",++elFinder.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=c,this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?this.options.lang:"en",r="en"==this.lang?this.i18.en:e.extend(!0,{},this.i18.en,this.i18[this.lang]),this.direction=r.direction,this.messages=r.messages,this.dateFormat=this.options.dateFormat||r.dateFormat,this.fancyFormat=this.options.fancyDateFormat||r.fancyDateFormat,this.today=new Date(U.getFullYear(),U.getMonth(),U.getDate()).getTime()/1e3,this.yesterday=this.today-86400,a=this.options.UTCDate?"UTC":"",this.getHours="get"+a+"Hours",this.getMinutes="get"+a+"Minutes",this.getSeconds="get"+a+"Seconds",this.getDate="get"+a+"Date",this.getDay="get"+a+"Day",this.getMonth="get"+a+"Month",this.getFullYear="get"+a+"FullYear",this.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==this.direction?"rtl":"ltr")+" "+this.options.cssClass,this.storage=function(){try{return"localStorage"in window&&null!==window.localStorage?o.localStorage:o.cookie}catch(e){return o.cookie}}(),this.viewType=this.storage("view")||this.options.defaultView||"icons",this.sortType=this.storage("sortType")||this.options.sortType||"name",this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc",this.sortStickFolders=this.storage("sortStickFolders"),this.sortStickFolders=null===this.sortStickFolders?!!this.options.sortStickFolders:!!this.sortStickFolders,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortsRules),e.each(this.sortRules,function(e,t){"function"!=typeof t&&delete o.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,this.draggable={appendTo:"body",addClasses:!0,delay:30,distance:8,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},start:function(t,n){var i,a,r=e.map(n.helper.data("files")||[],function(e){return e||null}),s=!1;for(o.draggingUiHelper=n.helper,i=r.length;i--;)if(a=r[i],b[a].locked){s=!0,n.helper.data("locked",!0);break}!s&&o.trigger("lockfiles",{files:r})},drag:function(t,n){var i=n.helper;i.data("refreshPositions")&&e(this).draggable("instance")&&(i.data("refreshPositions")>0?(e(this).draggable("option",{refreshPositions:!0}),i.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1}),i.data("refreshPositions",null)))},stop:function(t,n){var i;e(this).draggable("instance")&&e(this).draggable("option",{refreshPositions:!1}),o.draggingUiHelper=null,o.trigger("focus").trigger("dragstop"),n.helper.data("droped")||(i=e.map(n.helper.data("files")||[],function(e){return e||null}),o.trigger("unlockfiles",{files:i}),o.trigger("selectfiles",{files:i}))},helper:function(t){var n,i,a,r=this.id?e(this):e(this).parents("[id]:first"),s=e('<div class="elfinder-drag-helper"><span class="elfinder-drag-helper-icon-status"/></div>'),l=function(t){var n,i=t.mime;return n='<div class="elfinder-cwd-icon '+o.mime2class(i)+' ui-corner-all"/>',t.tmb&&1!==t.tmb&&(n=e(n).css("background","url('"+o.option("tmbUrl")+t.tmb+"') center center no-repeat").get(0).outerHTML),n};return o.draggingUiHelper&&o.draggingUiHelper.stop(!0,!0),o.trigger("dragstart",{target:r[0],originalEvent:t}),n=r.hasClass(o.res("class","cwdfile"))?o.selected():[o.navId2Hash(r.attr("id"))],s.append(l(b[n[0]])).data("files",n).data("locked",!1).data("droped",!1).data("namespace",o.namespace).data("dropover",0),(i=n.length)>1&&s.append(l(b[n[i-1]])+'<span class="elfinder-drag-num">'+i+"</span>"),e(document).on(p+" keyup."+c,function(e){var t=e.shiftKey||e.ctrlKey||e.metaKey;a!==t&&(a=t,s.is(":visible")&&s.data("dropover")&&!s.data("droped")&&(s.toggleClass("elfinder-drag-helper-plus",s.data("locked")?!0:a),o.trigger(a?"unlockfiles":"lockfiles",{files:n,helper:s})))}),s}},this.droppable={greedy:!0,tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename",hoverClass:this.res("class","adroppable"),autoDisable:!0,drop:function(t,n){var i,a,r,s=e(this),l=e.map(n.helper.data("files")||[],function(e){return e||null}),d=[],c=[],u=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),h="class";if(n.helper.data("namespace")!==o.namespace)return!1;for(a=s.hasClass(o.res(h,"cwdfile"))?o.cwdId2Hash(s.attr("id")):s.hasClass(o.res(h,"navdir"))?o.navId2Hash(s.attr("id")):g,i=l.length;i--;)r=l[i],r!=a&&b[r].phash!=a?d.push(r):(p&&r!==a&&b[a].write?c:u).push(r);return u.length?!1:(n.helper.data("droped",!0),c.length&&(n.helper.hide(),o.exec("duplicate",c)),d.length&&(n.helper.hide(),o.clipboard(d,!p),o.exec("paste",a,void 0,a).always(function(){o.trigger("unlockfiles",{files:l})}),o.trigger("drop",{files:l})),void 0)}},this.enabled=function(){return t.is(":visible")&&f},this.visible=function(){return t.is(":visible")},this.root=function(e){for(var t,n=b[e||g];n&&n.phash;)n=b[n.phash];if(n)return n.hash;for(;t in b&&b.hasOwnProperty(t);)if(n=b[t],!n.phash&&"directory"==!n.mime&&n.read)return n.hash;return""},this.cwd=function(){return b[g]||{}},this.option=function(e){return v[e]||""},this.file=function(e){return b[e]},this.files=function(){return e.extend(!0,{},b)},this.parents=function(e){for(var t,n=[];t=this.file(e);)n.unshift(t.hash),e=t.phash;return n},this.path2array=function(e,t){for(var n,i=[];e&&(n=b[e])&&n.hash;)i.unshift(t&&n.i18?n.i18:n.name),e=n.phash;return i},this.path=function(e,t){return b[e]&&b[e].path?b[e].path:this.path2array(e,t).join(v.separator)},this.url=function(t){var n=b[t];if(!n||!n.read)return"";if("1"==n.url&&this.request({data:{cmd:"url",target:t},preventFail:!0,options:{async:!1}}).done(function(e){n.url=e.url||""}).fail(function(){n.url=""}),n.url)return n.url;if(v.url)return v.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var i=e.extend({},this.customData,{cmd:"file",target:n.hash});return this.oldAPI&&(i.cmd="open",i.current=n.phash),this.options.url+(-1===this.options.url.indexOf("?")?"?":"&")+e.param(i,!0)},this.convAbsUrl=function(e){if(e.match(/^http/i))return e;var t,n=window.location.protocol+"//"+window.location.host,i=/[^\/]+\/\.\.\//;for(t="/"===e.substr(0,1)?n+e:n+window.location.pathname+e,t=t.replace("/./","/");i.test(t);)t=t.replace(i,"");return t},this.openUrl=function(t,n){var i=b[t],a="";if(!i||!i.read)return"";if(!n)if(i.url){if(1!=i.url)return i.url}else if(v.url)return v.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");return a=this.options.url,a=a+(-1===a.indexOf("?")?"?":"&")+(this.oldAPI?"cmd=open&current="+i.phash:"cmd=file")+"&target="+i.hash,n&&(a+="&download=1"),e.each(this.options.customData,function(e,t){a+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),a},this.tmb=function(t){var n=b[t],i=function(t){var n=v.tmbUrl;return e.each(o.tmbUrls,function(e){return 0===t.indexOf(e)?(n=o.tmbUrls[e],!1):void 0}),n},a=o.tmbUrls._search&&0!==t.indexOf(o.cwd().volumeid)?i(t):v.tmbUrl,r=n&&n.tmb&&1!=n.tmb?a+n.tmb:"";return r},this.selected=function(){return y.slice(0)},this.selectedFiles=function(){return e.map(y,function(t){return b[t]?e.extend({},b[t]):null})},this.fileByName=function(e,t){var n;for(n in b)if(b.hasOwnProperty(n)&&b[n].phash==t&&b[n].name==e)return b[n]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){var t;return isNaN(e)?(e=e.replace(/b$/i,""),t=e.charAt(e.length-1).toLowerCase(),e=e.replace(/[tgmk]$/i,""),"t"==t?e=1024*1024*1024*1024*e:"g"==t?e=1024*1024*1024*e:"m"==t?e=1024*1024*e:"k"==t&&(e=1024*e),e=isNaN(e)?0:parseInt(e)):(e=parseInt(e),1>e&&(e=0)),e},this.request=function(t){var n,i,a,r=this,o=this.options,s=e.Deferred(),l=e.extend({},o.customData,{mimes:o.onlyMimes},t.data||t),d=l.cmd,c=!(t.preventDefault||t.preventFail),u=!(t.preventDefault||t.preventDone),p=e.extend({},t.notify),h=!!t.raw,f=t.syncOnFail,t=e.extend({url:o.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:l,headers:this.customHeaders,xhrFields:this.xhrFields},t.options||{}),m=function(t){t.warning&&r.error(t.warning),"open"==d&&A(e.extend(!0,{},t)),t.removed&&t.removed.length&&r.remove(t),t.added&&t.added.length&&r.add(t),t.changed&&t.changed.length&&r.change(t),r.trigger(d,t),t.sync&&r.sync()},g=function(e,t){var n;switch(t){case"abort":n=e.quiet?"":["errConnect","errAbort"];break;case"timeout":n=["errConnect","errTimeout"];break;case"parsererror":n=["errResponse","errDataNotJSON"];break;default:n=403==e.status?["errConnect","errAccess"]:404==e.status?["errConnect","errNotFound"]:"errConnect"}s.reject(n,e,t)},b=function(t){return r.currentReqCmd=d,h?s.resolve(t):t?e.isPlainObject(t)?t.error?s.reject(t.error,i):r.validResponse(d,t)?(t=r.normalize(t),r.api||(r.api=t.api||1,r.newAPI=r.api>=2,r.oldAPI=!r.newAPI),t.options&&(v=e.extend({},v,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),"open"==d&&l.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?parseInt(t.uplMaxFile):20),s.resolve(t),t.debug&&r.debug("backend-debug",t.debug),void 0):s.reject("errResponse",i):s.reject(["errResponse","errDataNotJSON"],i):s.reject(["errResponse","errDataEmpty"],i)},y=function(e){if("autosync"==e.type){if("stop"!=e.data.action)return}else if(!e.data.added||!e.data.added.length)return;"pending"==i.state()&&(i.quiet=!0,i.abort(),"unload"!=e.type&&"destroy"!=e.type&&r.autoSync())};if(u&&s.done(m),s.fail(function(e){e&&(c?r.error(e):r.debug("error",r.i18n(e)))}),!d)return s.reject("errCmdReq");if(f&&s.fail(function(e){e&&r.sync()}),p.type&&p.cnt&&(n=setTimeout(function(){r.notify(p),s.always(function(){p.cnt=-(parseInt(p.cnt)||0),r.notify(p)})},r.notifyDelay),s.always(function(){clearTimeout(n)})),"open"==d)for(;a=T.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort());return delete t.preventFail,i=this.transport.send(t).fail(g).done(b),("open"==d||"info"==d&&l.compare)&&(T.unshift(i),r.bind(r.cmdsToAdd+" autosync",y),s.always(function(){var t=e.inArray(i,T);r.unbind(r.cmdsToAdd+" autosync",y),-1!==t&&T.splice(t,1)})),r.bind("unload destroy",y),s.always(function(){r.unbind("unload destroy",y)}),s},this.diff=function(t,n){var i={},a=[],r=[],o=[],s=function(e){for(var t=o.length;t--;)if(o[t].hash==e)return!0};return e.each(t,function(e,t){i[t.hash]=t}),e.each(b,function(e,t){n&&t.phash!==n||!i[e]&&r.push(e)}),e.each(i,function(t,n){var i=b[t];i?e.each(n,function(e){return n[e]!=i[e]?(o.push(n),!1):void 0}):a.push(n)}),e.each(r,function(t,n){var a=b[n],l=a.phash;l&&"directory"==a.mime&&-1===e.inArray(l,r)&&i[l]&&!s(l)&&o.push(i[l])}),{added:a,removed:r,changed:o}},this.sync=function(t,n){this.autoSync("stop");var i=this,a=function(){var i="",a=0,r=0;return t&&n&&e.each(b,function(e,n){n.phash&&n.phash===t&&(++a,r=Math.max(r,n.ts)),i=a+":"+r}),i},r=a(),o=e.Deferred().done(function(){i.trigger("sync")}),s={data:{cmd:"open",reload:1,target:g,tree:!t&&this.ui.tree?1:0,compare:r},preventDefault:!0},l={data:{cmd:"parents",target:g},preventDefault:!0};return e.when(this.request(s),t?null:this.request(l)).fail(function(e){o.reject(e),e&&i.request({data:{cmd:"open",target:i.lastDir("")||i.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})}).done(function(e,n){if(e.cwd.compare&&r===e.cwd.compare)return o.reject();var a=i.diff(e.files.concat(n&&n.tree?n.tree:[]),t);return a.added.push(e.cwd),a.removed.length&&i.remove(a),a.added.length&&i.add(a),a.changed.length&&i.change(a),o.resolve(a)}).always(function(){i.autoSync()}),o},this.upload=function(e){return this.transport.upload(e,this)},this.bind=function(e,t){var n;if("function"==typeof t)for(e=(""+e).toLowerCase().split(/\s+/),n=0;n<e.length;n++)void 0===w[e[n]]&&(w[e[n]]=[]),w[e[n]].push(t);return this},this.unbind=function(e,t){var n=w[(""+e).toLowerCase()]||[],i=n.indexOf(t);return i>-1&&n.splice(i,1),t=null,this},this.trigger=function(t,n){var i,a,r,t=t.toLowerCase(),o="open"===t,s=w[t]||[];if(this.debug("event-"+t,n),o&&(r=JSON.stringify(n)),s.length)for(t=e.Event(t),a=s.length,i=0;a>i;i++){s[i].length&&(t.data=o?JSON.parse(r):e.extend(!0,{},n));try{if(s[i](t,this)===!1||t.isDefaultPrevented()){this.debug("event-stoped",t.type);break}}catch(l){window.console&&window.console.log&&window.console.log(l)}}return this},this.shortcut=function(t){var n,i,a,r,o;if(this.options.allowShortcuts&&t.pattern&&e.isFunction(t.callback))for(n=t.pattern.toUpperCase().split(/\s+/),r=0;r<n.length;r++)i=n[r],o=i.split("+"),a=1==(a=o.pop()).length?a>0?a:a.charCodeAt(0):e.ui.keyCode[a],a&&!x[i]&&(x[i]={keyCode:a,altKey:-1!=e.inArray("ALT",o),ctrlKey:-1!=e.inArray("CTRL",o),shiftKey:-1!=e.inArray("SHIFT",o),type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(x,function(e,n){t.push([n.pattern,o.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(k,function(e){return e.hash})};return void 0!==t&&(k.length&&this.trigger("unlockfiles",{files:i()}),C=[],k=e.map(t||[],function(e){var t=b[e];return t?(C.push(e),{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:k.slice(0,k.length)}),n&&this.trigger("lockfiles",{files:i()})),k.slice(0,k.length)},this.isCommandEnabled=function(t,n){var i;return n&&o.root(n)!==g&&e.each(o.disabledCmds,function(e,t){return 0==n.indexOf(e,0)?(i=t,!1):void 0}),i||(i=v.disabled),this._commands[t]?-1===e.inArray(t,i):!1},this.exec=function(t,n,i,a){return"open"===t&&this.autoSync("stop"),this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("No such command")},this.dialog=function(n,i){var a=e("<div/>").append(n).appendTo(t).elfinderdialog(i);return this.bind("resize",function(){a.elfinderdialog("posInit")}),a},this.getUI=function(e){return this.ui[e]||t},this.command=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(e,n){t.css("width",e).height(n).trigger("resize"),this.trigger("resize",{width:t.width(),height:t.height()})},this.restoreSize=function(){this.resize(F,M)},this.show=function(){t.show(),this.enable().trigger("show")},this.hide=function(){this.disable().trigger("hide"),t.hide()},this.destroy=function(){t&&t[0].elfinder&&(this.autoSync("stop"),this.trigger("destroy").disable(),w={},x={},e(document).add(t).off("."+this.namespace),o.trigger=function(){},t.children().remove(),t.append(s.contents()).removeClass(this.cssClass).attr("style",l),t[0].elfinder=null)},this.autoSync=function(e){var t;if(o.options.sync>=1e3){if(i&&(clearTimeout(i),i=null,o.trigger("autosync",{action:"stop"})),e||!o.options.syncStart)return;t=function(e){var n;v.syncMinMs&&(e||i)&&(e&&o.trigger("autosync",{action:"start"}),n=Math.max(o.options.sync,v.syncMinMs),i&&clearTimeout(i),i=setTimeout(function(){var e=!0,a=g;v.syncChkAsTs?o.request({data:{cmd:"info",targets:[a],compare:b[a].ts,reload:1},preventDefault:!0}).done(function(n){var i;e=!0,n.compare&&(i=n.compare,b[a]&&i==b[a].ts&&(e=!1)),e?o.sync(a).always(function(){i&&(b[a].ts=i),t()}):t()}).fail(function(e){e&&"errConnect"!=e?o.error(e):i=setTimeout(function(){t()},n)}):o.sync(g,!0).always(function(){t()})},n))},t(!0)}},e.fn.selectable&&e.fn.draggable&&e.fn.droppable?t.length?this.options.url?(e.extend(e.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120}),this.dragUpload=!1,this.xhrUpload=("undefined"!=typeof XMLHttpRequestUpload||"undefined"!=typeof XMLHttpRequestEventTarget)&&"undefined"!=typeof File&&"undefined"!=typeof FormData,this.transport={},"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this)),"function"!=typeof this.transport.send&&(this.transport.send=function(t){return e.ajax(t)}),"iframe"==this.transport.upload?this.transport.upload=e.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload&&this.options.dragUploadAllow?(this.transport.upload=e.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=e.proxy(this.uploads.iframe,this),this.error=function(){var e=arguments[0];return 1==arguments.length&&"function"==typeof e?o.bind("error",e):o.trigger("error",{error:e})},e.each(["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],function(t,n){o[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?o.bind(n,t):o.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!f&&o.visible()&&o.ui.overlay.is(":hidden")&&(f=!0,document.activeElement&&document.activeElement.blur(),t.removeClass("elfinder-disabled"))}).disable(function(){m=f,f=!1,t.addClass("elfinder-disabled")}).open(function(){y=[]}).select(function(t){y=e.map(t.data.selected||t.data.value||[],function(e){return b[e]?e:null})}).error(function(t){var n={cssClass:"elfinder-dialog-error",title:o.i18n(o.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};n.buttons[o.i18n(o.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},o.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-error"/>'+o.i18n(t.data.error),n)}).bind("tree parents",function(e){D(e.data.tree||[])}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){b[e]&&(b[e].tmb=t)})}).add(function(e){D(e.data.added||[])}).change(function(t){e.each(t.data.changed||[],function(t,n){var i=n.hash;b[i]&&e.each(["locked","hidden","width","height"],function(e,t){b[i][t]&&!n[t]&&delete b[i][t]}),b[i]=b[i]?e.extend(b[i],n):n})}).remove(function(t){for(var n=t.data.removed||[],i=n.length,a=function(t){var n=b[t];n&&("directory"==n.mime&&n.dirs&&e.each(b,function(e,n){n.phash==t&&a(e)}),delete b[t])};i--;)a(n[i])}).bind("search",function(e){D(e.data.files),o.tmbUrls._search=!0}).bind("searchend",function(){o.tmbUrls._search=!1}).bind("rm",function(){var t=S.canPlayType&&S.canPlayType('audio/wav; codecs="1"');t&&""!=t&&"no"!=t&&e(S).html('<source src="'+P+'rm.wav" type="audio/wav">')[0].play()}),e.each(this.options.handlers,function(e,t){o.bind(e,t)}),this.history=new this.history(this),"function"==typeof this.options.getFileCallback&&this.commands.getfile&&(this.bind("dblclick",function(e){e.preventDefault(),o.exec("getfile").fail(function(){o.exec("open")})}),this.shortcut({pattern:"enter",description:this.i18n("cmdgetfile"),callback:function(){o.exec("getfile").fail(function(){o.exec("mac"==o.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:this.i18n("mac"==this.OS?"cmdrename":"cmdopen"),callback:function(){o.exec("mac"==o.OS?"rename":"open")}})),this._commands={},e.isArray(this.options.commands)||(this.options.commands=[]),e.each(["open","reload","back","forward","up","home","info","quicklook","getfile","help"],function(t,n){-1===e.inArray(n,o.options.commands)&&o.options.commands.push(n)}),e.each(this.options.commands,function(t,n){var i=o.commands[n];e.isFunction(i)&&!o._commands[n]&&(i.prototype=I,o._commands[n]=new i,o._commands[n].setup(n,o.options.commandsOptions[n]||{}))}),this.commandMap={},this.disabledCmds={},this.tmbUrls={},t.addClass(this.cssClass).on(u,function(){!f&&o.enable()}),this.ui={workzone:e("<div/>").appendTo(t).elfinderworkzone(this),navbar:e("<div/>").appendTo(t).elfindernavbar(this,this.options.uiOptions.navbar||{}),contextmenu:e("<div/>").appendTo(t).elfindercontextmenu(this),overlay:e("<div/>").appendTo(t).elfinderoverlay({show:function(){o.disable()},hide:function(){m&&o.enable()}}),cwd:e("<div/>").appendTo(t).elfindercwd(this,this.options.uiOptions.cwd||{}),notify:this.dialog("",{cssClass:"elfinder-dialog-notify",position:this.options.notifyDialog.position,resizable:!1,autoOpen:!1,title:"&nbsp;",width:parseInt(this.options.notifyDialog.width)}),statusbar:e('<div class="ui-widget-header ui-helper-clearfix ui-corner-bottom elfinder-statusbar"/>').hide().appendTo(t)},e.each(this.options.ui||[],function(n,i){var a="elfinder"+i,r=o.options.uiOptions[i]||{};!o.ui[i]&&e.fn[a]&&(o.ui[i]=e("<"+(r.tag||"div")+"/>").appendTo(t)[a](o,r))}),t[0].elfinder=this,this.options.resizable&&!this.UA.Touch&&e.fn.resizable&&t.resizable({handles:"se",minWidth:300,minHeight:200}),this.options.width&&(F=this.options.width),this.options.height&&(M=parseInt(this.options.height)),this.options.soundPath&&(P=this.options.soundPath.replace(/\/+$/,"")+"/"),o.resize(F,M),e(document).on("click."+this.namespace,function(n){f&&!e(n.target).closest(t).length&&o.disable()}).on(p+" "+h,O),o.options.useBrowserHistory&&e(window).on("popstate",function(t){var n=t.originalEvent.state&&t.originalEvent.state.thash;n&&!e.isEmptyObject(o.files())&&o.request({data:{cmd:"open",target:n,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0})}),this.trigger("init").request({data:{cmd:"open",target:o.startDir(),init:1,tree:this.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){o.trigger("fail").disable().lastDir(""),w={},x={},e(document).add(t).off("."+this.namespace),o.trigger=function(){}}).done(function(t){o.load().debug("api",o.api),t=e.extend(!0,{},t),A(t),o.trigger("open",t)}),this.one("load",function(){t.trigger("resize")}),function(){var n;e(window).on("resize",function(){n&&clearTimeout(n),n=setTimeout(function(){o.trigger("resize",{width:t.width(),height:t.height()})},200)}).on("beforeunload",function(){return o.ui.notify.children().length?o.i18n("ntfsmth"):(o.trigger("unload"),void 0)})}(),e(window).on("message",function(e){var t,n,i=e.originalEvent||null;if(i&&0===o.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?o.error(n.error):(n.warning&&o.error(n.warning),n.removed&&n.removed.length&&o.remove(n),n.added&&n.added.length&&o.add(n),n.changed&&n.changed.length&&o.change(n),t.bind&&o.trigger(t.bind,n),n.sync&&o.sync()))}catch(e){o.sync()}}),o.dragUpload&&(t[0].addEventListener("dragenter",function(e){"TEXTAREA"!==e.target.nodeName&&"INPUT"!==e.target.nodeName&&(e.preventDefault(),e.stopPropagation())},!1),t[0].addEventListener("dragleave",function(e){"TEXTAREA"!==e.target.nodeName&&"INPUT"!==e.target.nodeName&&(e.preventDefault(),e.stopPropagation())},!1),t[0].addEventListener("dragover",function(e){"TEXTAREA"!==e.target.nodeName&&"INPUT"!==e.target.nodeName&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="none")},!1),t[0].addEventListener("drop",function(e){"TEXTAREA"!==e.target.nodeName&&"INPUT"!==e.target.nodeName&&(e.stopPropagation(),e.preventDefault())},!1),function(){var n="native-drag-enter",i="native-drag-disable",a="class",r=o.res(a,"navdir"),s=(o.res(a,"droppable"),o.res(a,"navcollapse")),l=o.res(a,"navexpand"),c=o.res(a,"adroppable"),u=o.res(a,"navarrow"),p=o.res(a,"adroppable");t.on("dragenter",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var a,d=e(t.currentTarget),h=t.currentTarget.id||null,f=null;if(h)!d.data(n)&&d.hasClass(r)&&d.is("."+s+":not(."+l+")")&&setTimeout(function(){d.is("."+s+"."+c)&&d.children("."+u).click()},500);else{f=o.cwd(),d.data(i,!1);try{e.each(t.originalEvent.dataTransfer.types,function(e,t){"elfinderfrom:"===t.substr(0,13)&&(a=t.substr(13).toLowerCase())})}catch(t){}}f&&(!f.write||a&&a===(window.location.href+f.hash).toLowerCase())?d.data(i,!0):(t.preventDefault(),t.stopPropagation(),d.data(n,!0),d.addClass(p))}}).on("dragleave",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var i=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),i.data(n)?i.data(n,!1):i.removeClass(p)}}).on("dragover",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var a=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),t.originalEvent.dataTransfer.dropEffect=a.data(i)?"none":"copy",a.data(n,!1)}}).on("drop",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.removeClass(p),d=t.currentTarget.id?n.hasClass(r)?o.navId2Hash(t.currentTarget.id):o.cwdId2Hash(t.currentTarget.id):o.cwd().hash,t.originalEvent._target=d,o.directUploadTarget=d,o.exec("upload",{dropEvt:t.originalEvent,target:d}),o.directUploadTarget=null}})}()),void 0):alert(this.i18n("errURL")):alert(this.i18n("errNode")):alert(this.i18n("errJqui"))},elFinder.prototype={uniqueid:0,res:function(e,t){return this.resources[e]&&this.resources[e][t]},currentReqCmd:"",i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["msJan","msFeb","msMar","msApr","msMay","msJun","msJul","msAug","msSep","msOct","msNov","msDec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/msword":"MsWord","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP","application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO","application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/x-xz":"XZ","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","text/x-markdown":"Markdown","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},rules:{defaults:function(t){return!t||t.added&&!e.isArray(t.added)||t.removed&&!e.isArray(t.removed)||t.changed&&!e.isArray(t.changed)?!1:!0
10
- },open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&e.isArray(t.files)},tree:function(t){return t&&t.tree&&e.isArray(t.tree)},parents:function(t){return t&&t.tree&&e.isArray(t.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||e.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||e.isArray(t.added))},search:function(t){return t&&t.files&&e.isArray(t.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=e.parseJSON(t)}catch(i){return{error:["errResponse","errDataNotJSON"]}}return this.validResponse("upload",n)?(n=this.normalize(n),n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return e.hash})),n):{error:["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,checkExists:function(t,n,i){var a,r,o=e.Deferred(),s=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},l=function(){var l=[],d=[],c=[],u=function(e){var n=e==c.length-1,a={title:i.i18n("cmdupload"),text:["errExists",c[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?o.resolve(l):u(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=c.length;e<a--;)t[c[a].i]._remove=!0;else t[c[e].i]._remove=!0;n||i?o.resolve(l):u(++e)}},cancel:{label:"btnCancel",callback:function(){s(),o.resolve(l)}},buttons:[{label:"btnBackup",callback:function(t){var i;if(t)for(i=c.length;e<i--;)l.push(c[i].name);else l.push(c[e].name);n||t?o.resolve(l):u(++e)}}]};i.iframeCnt>0&&delete a.reject,i.confirm(a)};a=e.map(t,function(e,t){return e.name?{i:t,name:e.name}:null}),r=e.map(a,function(e){return e.name}),i.request({data:{cmd:"upload",target:n,name:r,FILES:""},notify:{type:"preupload",cnt:1,hideCnt:!0},preventFail:!0}).done(function(t){t&&(t.error?s():(t.name&&(d=t.name||[],c=e.map(a,function(t){return-1!==e.inArray(t.name,d)?t:null})),t.list&&n==i.cwd().hash&&t.list.length!=e.map(i.files(),function(e){return e.phash==n?e.name:null}).length&&i.sync())),c.length>0?u(0):o.resolve([])}).fail(function(e){s(),o.resolve([]),e&&i.error(e)})};return i.option("uploadOverwrite")&&"object"==typeof t[0]?(l(),o):o.resolve([])},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,r=e.Deferred(),o=[],s=[],l=[],d=[],c=0,u=function(t){var i=function(e){return Array.prototype.slice.call(e||[])},a=function(t){var n=e.Deferred();return"undefined"==typeof t?n.reject("empty"):t.isFile?t.file(function(e){n.resolve(e)},function(){n.reject()}):n.reject("dirctory"),n.promise()};t.readEntries(function(e){if(e.length)d=d.concat(i(e)),u(t);else{var r=d.length-1,p=function(e){a(d[e]).done(function(t){"win"==n.OS&&t.name.match(/^(?:desktop\.ini|thumbs\.db)$/i)||"mac"==n.OS&&t.name.match(/^\.ds_store$/i)||(s.push(d[e].fullPath),o.push(t))}).fail(function(t){"dirctory"==t&&l.push(d[e])}).always(function(){c--,r>e&&(c++,p(++e))})};c++,p(0),c--}})},p=function(e,t){var n,i;d=[];for(var a=e.length,r=0;a>r;r++)i=t?e[r]:e[r].getAsEntry?e[r].getAsEntry():e[r].webkitGetAsEntry(),i&&(i.isFile?(c++,i.file(function(e){s.push(""),o.push(e),c--})):i.isDirectory&&(c>0?l.push(i):(c=0,n=i.createReader(),c++,u(n))))};return a=e.map(t.files.items,function(e){return e.getAsEntry?e.getAsEntry():e.webkitGetAsEntry()}),a.length>0?(n.uploads.checkExists(a,i,n).done(function(t){var d,u=[];n.option("uploadOverwrite")&&(a=e.map(a,function(a){var r,o,s,l;return a.isDirectory&&(r=e.inArray(a.name,t),-1!==r&&(t.splice(r,1),o=n.uniqueName(a.name+n.options.backupSuffix,null,""),s=n.fileByName(a.name,i),n.lockfiles({files:[s.hash]}),l=n.request({data:{cmd:"rename",target:s.hash,name:o},notify:{type:"rename",cnt:1}}).fail(function(){a._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[s.hash]})}),u.push(l))),a._remove?null:a})),e.when.apply(e,u).done(function(){a.length>0?(d=setTimeout(function(){n.notify({type:"readdir",cnt:1,hideCnt:!0})},n.options.notifyDelay),p(a,!0),setTimeout(function e(){c>0?setTimeout(e,10):l.length>0?(p([l.shift()],!0),setTimeout(e,10)):(d&&clearTimeout(d),n.notify({type:"readdir",cnt:-1}),r.resolve([o,s,t]))},10)):r.reject()})}),r.promise()):r.reject()}var h=[],f=[],m=t.files[0];if("html"==t.type){var g,v=e("<html/>").append(e.parseHTML(m));e("img[src]",v).each(function(){var t,n,i=e(this),a=i.closest("a");a&&a.attr("href")&&a.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(n=a.attr("href")),t=i.attr("src"),t&&(n?(-1==e.inArray(n,h)&&h.push(n),-1==e.inArray(t,f)&&f.push(t)):-1==e.inArray(t,h)&&h.push(t))}),g=e("a[href]",v),g.each(function(){var t,n=function(e){var t=document.createElement("a");return t.href=e,t};e(this).text()&&(t=n(e(this).attr("href")),!t.href||1!==g.length&&t.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||-1==e.inArray(t.href,h)&&-1==e.inArray(t.href,f)&&h.push(t.href))})}else{var b,y,w;for(b=/(http[^<>"{}|\\^\[\]`\s]+)/gi;y=b.exec(m);)w=y[1].replace(/&amp;/g,"&"),-1==e.inArray(w,h)&&h.push(w)}return h},xhr:function(t,n){var i,a=n?n:this,r=new XMLHttpRequest,o=null,s=null,l=t.checked,d=t.isDataType||"data"==t.type,c=0,u="div.elfinder-notify-upload div.elfinder-notify-cancel button",p=e.Deferred().fail(function(e){var t=m.length?d?m[0][0]:m[0]:{};t._cid&&(h=new FormData,m=[{_chunkfail:!0}],h.append("chunk",t._chunk),h.append("cid",t._cid),d=!1,F(m)),m=null,e&&a.error(e)}).done(function(e){r=null,m=null,e&&(e.warning&&a.error(e.warning),e.removed&&a.remove(e),e.added&&a.add(e),e.changed&&a.change(e),a.trigger("upload",e),e.sync&&a.sync())}).always(function(){o&&clearTimeout(o),s&&clearTimeout(s),l&&!t.multiupload&&x()&&a.notify({type:"upload",cnt:-g,progress:0,size:0}),I&&a.ui.notify.children(".elfinder-notify-chunkmerge").length&&a.notify({type:"chunkmerge",cnt:-1}),a.ui.notify.off("click",u,C),e(document).off("keydown",C)}),h=new FormData,f=t.target||a.cwd().hash,m=t.input?t.input.files:a.uploads.checkFile(t,a,f),g=t.checked?d?m[0].length:m.length:m.length,v=0,b=0,y=!1,w=!1,x=function(){return y=y||a.ui.notify.children(".elfinder-notify-upload").length},k=function(e){return e||(e=b),setTimeout(function(){y=!0,a.notify({type:"upload",cnt:g,progress:v-i,size:e,cancel:!0}),i=v},a.options.notifyDelay)},C=function(t){("keydown"!=t.type||t.keyCode==e.ui.keyCode.ESCAPE)&&(t.preventDefault(),t.stopPropagation(),w=!0,r.abort(),p.reject(),a.sync())},T=t.renames||null,I=!1;if(a.ui.notify.one("click",u,C),e(document).on("keydown",C),e(window).on("unload",function(){"pending"==p.state()&&p.reject()}),!I&&(i=v),!d&&!g)return p.reject(["errUploadNoFiles"]);r.addEventListener("error",function(){p.reject("errConnect")},!1),r.addEventListener("abort",function(){p.reject(["errConnect","errAbort"])},!1),r.addEventListener("load",function(){var e,n=r.status,l=0,u="";if(n>=400?u=n>500?"errResponse":"errConnect":(4!=r.readyState&&(u=["errConnect","errTimeout"]),r.responseText||(u=["errResponse","errDataEmpty"])),u){if(I||c++>3){var f=d?m[0][0]:m[0];return f._cid?(h=new FormData,m=[{_chunkfail:!0}],h.append("chunk",f._chunk),h.append("cid",f._cid),h.append("range",f._range),d=!1,F(m),void 0):p.reject(u)}return b=0,r.open("POST",a.uploadURL,!0),r.send(h),void 0}if(v=b,x()&&(l=v-i)&&a.notify({type:"upload",cnt:0,progress:l,size:0}),e=a.parseUploadData(r.responseText),e._chunkmerged){h=new FormData;var y=[{_chunkmerged:e._chunkmerged,_name:e._name}];return I=!0,s=setTimeout(function(){a.notify({type:"chunkmerge",cnt:1})},a.options.notifyDelay),d?F(y,m[1]):F(y),void 0}e._multiupload=t.multiupload?!0:!1,e.error?e._chunkfailure?(w=!0,a.uploads.xhrUploading=!1,o&&clearTimeout(o),a.ui.notify.children(".elfinder-notify-upload").length?(a.notify({type:"upload",cnt:-g,progress:0,size:0}),p.reject(e.error)):p.reject()):p.reject(e.error):p.resolve(e)},!1),r.upload.addEventListener("loadstart",function(e){!I&&e.lengthComputable&&(v=e.loaded,c&&(v=0),b=e.total,v||(v=parseInt(.05*b)),x()&&(a.notify({type:"upload",cnt:0,progress:v-i,size:t.multiupload?0:b}),i=v))},!1),r.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!I&&(v=e.loaded,!t.checked&&v>0&&!o&&(o=k(r._totalSize-v)),b||(c&&(v=0),b=e.total,v||(v=parseInt(.05*b))),n=v-i,x()&&n/e.total>=.05&&(a.notify({type:"upload",cnt:0,progress:n,size:0}),i=v))},!1);var F=function(i,s){var c,u,m,v,b,y,C,I,F,M,P,S,z=0,A=1,D=[],O=0,U=g,E=0,j=[],H=+new Date,R=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),_=!1,N=function(i,r){var s,l=[];if(!w)for(;i.length&&l.length<r;)l.push(i.shift());if(l.length)for(var c=0;c<l.length&&!w;c++)s=d?l[c][0][0]._cid||null:l[c][0]._cid||null,S[s]?P--:n.exec("upload",{type:t.type,isDataType:d,files:l[c],checked:!0,target:f,renames:T,multiupload:!0}).fail(function(){s&&(S[s]=!0)}).always(function(t){t&&t.added&&(F=e.merge(F,t.added)),P<=++M&&(n.trigger("multiupload",{added:F}),o&&clearTimeout(o),x()&&a.notify({type:"upload",cnt:-g,progress:0,size:0})),N(i,1)});else a.uploads.xhrUploading=!1,w&&(o&&clearTimeout(o),x()&&a.notify({type:"upload",cnt:-g,progress:0,size:0}),s&&(S[s]=!0)),p.resolve()},q=function(){a.uploads.xhrUploading?setTimeout(function(){q()},100):(a.uploads.xhrUploading=!0,N(D,3))};if(!l&&(d||"files"==t.type)){for(c=n.option("uploadMaxSize")?n.option("uploadMaxSize"):0,m=0;m<i.length;m++)if(C=i[m],u=C.size,_===!1&&(_="slice"in C?"slice":"mozSlice"in C?"mozSlice":"webkitSlice"in C?"webkitSlice":""),c&&u>c||!_&&n.uplMaxSize&&u>n.uplMaxSize)a.error(a.i18n("errUploadFile",C.name)+" "+a.i18n("errUploadFileSize")),g--,U--;else if(_&&u>R){for(v=0,b=R,y=-1,U=Math.floor(u/R),E+=u,j[H]=0;u>=v;)I=C[_](v,b),I._chunk=C.name+"."+ ++y+"_"+U+".part",I._cid=H,I._range=v+","+I.size+","+u,j[H]++,z&&O++,"undefined"==typeof D[O]&&(D[O]=[],d&&(D[O][0]=[],D[O][1]=[])),z=R,A=1,d?(D[O][0].push(I),D[O][1].push(s[m])):D[O].push(I),v=b,b=v+R;null==I?(a.error(a.i18n("errUploadFile",C.name)+" "+a.i18n("errUploadFileSize")),g--,U--):U+=y}else(n.uplMaxSize&&z+u>=n.uplMaxSize||A>n.uplMaxFile)&&(z=0,A=1,O++),"undefined"==typeof D[O]&&(D[O]=[],d&&(D[O][0]=[],D[O][1]=[])),d?(D[O][0].push(C),D[O][1].push(s[m])):D[O].push(C),z+=u,E+=u,A++;if(0==D.length)return t.checked=!0,!1;if(D.length>1)return o=k(E),F=[],M=0,P=D.length,S=[],q(),!0;d?(i=D[0][0],s=D[0][1]):i=D[0]}return l||(n.UA.Safari&&t.files?r._totalSize=E:o=k(E)),l=!0,i.length||p.reject(["errUploadNoFiles"]),r.open("POST",a.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){r.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in r&&(r[e]=this)}),h.append("cmd","upload"),h.append(a.newAPI?"target":"current",f),T&&(e.each(T,function(e,t){h.append("renames[]",t)}),h.append("suffix",n.options.backupSuffix)),e.each(a.options.customData,function(e,t){h.append(e,t)}),e.each(a.options.onlyMimes,function(e,t){h.append("mimes["+e+"]",t)}),e.each(i,function(e,t){t._chunkmerged?(h.append("chunk",t._chunkmerged),h.append("upload[]",t._name)):(t._chunkfail?(h.append("upload[]","chunkfail"),h.append("mimes","chunkfail")):h.append("upload[]",t),t._chunk&&(h.append("chunk",t._chunk),h.append("cid",t._cid),h.append("range",t._range)))}),d&&e.each(s,function(e,t){h.append("upload_path[]",t)}),r.onreadystatechange=function(){if(4==r.readyState&&0==r.status)if(w)p.reject();else{var n=["errAbort"];!d&&t.files&&e.map(t.files,function(e){return 0===e.size?e:null}).length&&n.push("errFolderUpload"),p.reject(n)}},r.send(h),!0};return d?l?F(m[0],m[1]):m.done(function(e){T=[],g=e[0].length,g?(T=e[2],F(e[0],e[1])):p.reject(["errUploadNoFiles"])}).fail(function(){p.reject()}):m.length>0?null==T?(T=[],a.uploads.checkExists(m,f,n).done(function(t){n.option("uploadOverwrite")&&(T=t,m=e.map(m,function(e){return e._remove?null:e})),g=m.length,g>0?F(m)||p.reject():p.reject()})):F(m)||p.reject():p.reject(),p},iframe:function(t,n){var i,a,r,o,s=n?n:this,l=t.input?t.input:!1,d=l?!1:s.uploads.checkFile(t,s),c=e.Deferred().fail(function(e){e&&s.error(e)}).done(function(e){e.warning&&s.error(e.warning),e.removed&&s.remove(e),e.added&&s.add(e),e.changed&&s.change(e),s.trigger("upload",e),e.sync&&s.sync()}),u="iframe-"+s.namespace+ ++s.iframeCnt,p=e('<form action="'+s.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+u+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),h=this.UA.IE,f=function(){o&&clearTimeout(o),r&&clearTimeout(r),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){h&&e('<iframe src="javascript:false;"/>').appendTo(p),p.remove(),m.remove()},100)},m=e('<iframe src="'+(h?"javascript:false;":"about:blank")+'" name="'+u+'" style="position:absolute;left:-1000px;top:-1000px" />').on("load",function(){m.off("load").on("load",function(){f(),c.reject()}),r=setTimeout(function(){a=!0,s.notify({type:"upload",cnt:i})},s.options.notifyDelay),s.options.iframeTimeout>0&&(o=setTimeout(function(){f(),c.reject([errors.connect,errors.timeout])},s.options.iframeTimeout)),p.submit()}),g=t.target||s.cwd().hash,v=[],b=[],y=[];if(d&&d.length)e.each(d,function(e,t){p.append('<input type="hidden" name="upload[]" value="'+t+'"/>')}),i=1;else{if(!(l&&e(l).is(":file")&&e(l).val()))return c.reject();n.option("uploadOverwrite")&&(v=l.files?l.files:[{name:e(l).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/,"$1")}],b.push(s.uploads.checkExists(v,g,s).done(function(t){y=t,i=e.map(v,function(e){return e._remove?null:e}).length,i!=v.length&&(i=0)}))),i=l.files?l.files.length:1,p.append(l)}return e.when.apply(e,b).done(function(){return 1>i?c.reject():(p.append('<input type="hidden" name="'+(s.newAPI?"target":"current")+'" value="'+g+'"/>').append('<input type="hidden" name="html" value="1"/>').append('<input type="hidden" name="node" value="'+s.id+'"/>').append(e(l).attr("name","upload[]")),y.length>0&&(e.each(y,function(e,t){p.append('<input type="hidden" name="renames[]" value="'+t+'"/>')}),p.append('<input type="hidden" name="suffix" value="'+n.options.backupSuffix+'"/>')),e.each(s.options.onlyMimes||[],function(e,t){p.append('<input type="hidden" name="mimes[]" value="'+t+'"/>')}),e.each(s.options.customData,function(e,t){p.append('<input type="hidden" name="'+e+'" value="'+t+'"/>')}),p.appendTo("body"),m.appendTo("body"),void 0)}),c}},one:function(t,n){var i=this,a=e.proxy(n,function(e){return setTimeout(function(){i.unbind(e.type,a)},3),n.apply(this,arguments)});return this.bind(t,a)},localStorage:function(e,t){var n,i,a=window.localStorage,r="elfinder-"+e+this.id;if(e=window.location.pathname+"-elfinder-"+e+this.id,null===t)return a.removeItem(e);if(void 0===t&&!(n=a.getItem(e))&&(i=a.getItem(r))&&(t=i,a.removeItem(r)),void 0!==t){try{a.setItem(e,t)}catch(o){a.clear(),a.setItem(e,t)}n=a.getItem(e)}return n},cookie:function(t,n){var i,a,r,o;if(t="elfinder-"+t+this.id,void 0===n){if(document.cookie&&""!=document.cookie)for(r=document.cookie.split(";"),t+="=",o=0;o<r.length;o++)if(r[o]=e.trim(r[o]),r[o].substring(0,t.length)==t)return decodeURIComponent(r[o].substring(t.length));return""}return a=e.extend({},this.options.cookie),null===n&&(n="",a.expires=-1),"number"==typeof a.expires&&(i=new Date,i.setTime(i.getTime()+864e5*a.expires),a.expires=i),document.cookie=t+"="+encodeURIComponent(n)+"; expires="+a.expires.toUTCString()+(a.path?"; path="+a.path:"")+(a.domain?"; domain="+a.domain:"")+(a.secure?"; secure":""),n},startDir:function(){var e=window.location.hash;return e&&e.match(/^#elf_/)?e.replace(/^#elf_/,""):this.options.startPathHash?this.options.startPathHash:this.lastDir()},lastDir:function(e){return this.options.rememberLastDir?this.storage("lastdir",e):""},_node:e("<span/>"),escape:function(e){return this._node.text(e).html().replace(/"/g,"&quot;").replace(/'/g,"&#039;")},normalize:function(t){var n=function(e){return e&&e.hash&&e.name&&e.mime?("application/x-empty"==e.mime&&(e.mime="text/plain"),e):null};return t.files&&(t.files=e.map(t.files,n)),t.tree&&(t.tree=e.map(t.tree,n)),t.added&&(t.added=e.map(t.added,n)),t.changed&&(t.changed=e.map(t.changed,n)),t.api&&(t.init=!0),t},setSort:function(e,t,n){this.storage("sortType",this.sortType=this.sortRules[e]?e:"name"),this.storage("sortOrder",this.sortOrder=/asc|desc/.test(t)?t:"asc"),this.storage("sortStickFolders",(this.sortStickFolders=!!n)?1:""),this.trigger("sortchange")},_sortRules:{name:function(e,t){var n,i,a=e.name.toLowerCase(),r=t.name.toLowerCase(),o="",s="",l=elFinder.prototype.naturalCompare;return(n=a.match(/^(.+)(\.[0-9a-z.]+)$/))&&(a=n[1],o=n[2]),(n=r.match(/^(.+)(\.[0-9a-z.]+)$/))&&(r=n[1],s=n[2]),i=l(a,r),0==i&&(o||s)&&o!=s&&(i=l(o,s)),i},size:function(e,t){var n=parseInt(e.size)||0,i=parseInt(t.size)||0;return n==i?0:n>i?1:-1},kind:function(e,t){return elFinder.prototype.naturalCompare(e.mime,t.mime)},date:function(e,t){var n=e.ts||e.date,i=t.ts||t.date;return n==i?0:n>i?1:-1}},naturalCompare:function(e,t){var n=elFinder.prototype.naturalCompare;return"undefined"==typeof n.loc&&(n.loc=navigator.userLanguage||navigator.browserLanguage||navigator.language||"en-US"),"undefined"==typeof n.sort&&("11".localeCompare("2",n.loc,{numeric:!0})>0?n.sort=window.Intl&&window.Intl.Collator?new Intl.Collator(n.loc,{numeric:!0}).compare:function(e,t){return e.localeCompare(t,n.loc,{numeric:!0})}:(n.sort=function(e,t){var i,a,r=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,d=/^0/,c=/^[\x01\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]/,u=function(e){return n.sort.insensitive&&(""+e).toLowerCase()||""+e},p=u(e).replace(o,"").replace(/^_/,"")||"",h=u(t).replace(o,"").replace(/^_/,"")||"",f=p.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=h.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),g=parseInt(p.match(l))||1!=f.length&&p.match(s)&&Date.parse(p),v=parseInt(h.match(l))||g&&h.match(s)&&Date.parse(h)||null,b=0;if(v){if(v>g)return-1;if(g>v)return 1}for(var y=0,w=Math.max(f.length,m.length);w>y;y++){if(i=!(f[y]||"").match(d)&&parseFloat(f[y])||f[y]||0,a=!(m[y]||"").match(d)&&parseFloat(m[y])||m[y]||0,isNaN(i)!==isNaN(a)){if(isNaN(i)&&("string"!=typeof i||!i.match(c)))return 1;if("string"!=typeof a||!a.match(c))return-1}if(0===parseInt(i,10)&&(i=0),0===parseInt(a,10)&&(a=0),typeof i!=typeof a&&(i+="",a+=""),n.sort.insensitive&&"string"==typeof i&&"string"==typeof a&&(b=i.localeCompare(a,n.loc),0!==b))return b;if(a>i)return-1;if(i>a)return 1}return 0},n.sort.insensitive=!0)),n.sort(e,t)},compare:function(e,t){var n,i=this,a=i.sortType,r="asc"==i.sortOrder,o=i.sortStickFolders,s=i.sortRules,l=s[a],d="directory"==e.mime,c="directory"==t.mime;if(o){if(d&&!c)return-1;if(!d&&c)return 1}return n=r?l(e,t):l(t,e),"name"!=a&&0==n?n=r?s.name(e,t):s.name(t,e):n},sortFiles:function(e){return e.sort(this.compare)},notify:function(t){var n,i,a,r,o=t.type,s=this.messages["ntf"+o]?this.i18n("ntf"+o):this.i18n("ntfsmth"),l=this.ui.notify,d=l.children(".elfinder-notify-"+o),c='<div class="elfinder-notify elfinder-notify-{type}"><span class="elfinder-dialog-icon elfinder-dialog-icon-{type}"/><span class="elfinder-notify-msg">{msg}</span> <span class="elfinder-notify-cnt"/><div class="elfinder-notify-progressbar"><div class="elfinder-notify-progress"/></div><div class="elfinder-notify-cancel"/></div></div>',u=t.cnt,p="undefined"!=typeof t.size?parseInt(t.size):null,h="undefined"!=typeof t.progress&&t.progress>=0?t.progress:null,f=t.cancel,m="ui-state-hover";return o?(d.length||(d=e(c.replace(/\{type\}/g,o).replace(/\{msg\}/g,s)).appendTo(l).data("cnt",0),null!=h&&d.data({progress:0,total:0}),f&&(r=e('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+this.i18n("btnCancel")+"</span></button>").hover(function(t){e(this).toggleClass(m,"mouseenter"==t.type)}),d.children("div.elfinder-notify-cancel").append(r))),n=u+parseInt(d.data("cnt")),n>0?(!t.hideCnt&&d.children(".elfinder-notify-cnt").text("("+n+")"),l.is(":hidden")&&l.elfinderdialog("open"),d.data("cnt",n),null!=h&&(i=d.data("total"))>=0&&(a=d.data("progress"))>=0&&(i+=null!=p?p:u,a+=h,null==p&&0>u&&(a+=100*u),d.data({progress:a,total:i}),null!=p&&(a*=100,i=Math.max(1,i)),h=parseInt(a/i),d.find(".elfinder-notify-progress").animate({width:(100>h?h:100)+"%"},20))):(d.remove(),!l.children().length&&l.elfinderdialog("close")),this):this},confirm:function(t){var n,i=this,a=!1,r={cssClass:"elfinder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(t.title||"confirmReq"),buttons:{},close:function(){!a&&t.cancel.callback(),e(this).elfinderdialog("destroy")}},o=this.i18n("apllyAll");return r.buttons[this.i18n(t.accept.label)]=function(){t.accept.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")},t.reject&&(r.buttons[this.i18n(t.reject.label)]=function(){t.reject.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")}),t.buttons&&t.buttons.length>0&&e.each(t.buttons,function(t,o){r.buttons[i.i18n(o.label)]=function(){o.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")}}),r.buttons[this.i18n(t.cancel.label)]=function(){e(this).elfinderdialog("close")},t.all&&(t.reject&&(r.width=370),r.create=function(){n=e('<input type="checkbox" />'),e(this).next().children().before(e("<label>"+o+"</label>").prepend(n))},r.open=function(){var t=e(this).next(),n=parseInt(t.children(":first").outerWidth()+t.children(":last").outerWidth());n>parseInt(t.width())&&e(this).closest(".elfinder-dialog").width(n+30)}),this.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-confirm"/>'+this.i18n(t.text),r)},uniqueName:function(e,t,n){var i,a,r=0,o="";if(e=this.i18n(e),t=t||this.cwd().hash,n="undefined"==typeof n?" ":n,(i=e.match(/^(.+)(\.[^.]+)$/))&&(o=i[2],e=i[1]),a=e+o,!this.fileByName(a,t))return a;for(;1e4>r;)if(a=e+n+ ++r+o,!this.fileByName(a,t))return a;return e+Math.random()+o},i18n:function(){var t,n,i,a=this,r=this.messages,o=[],s=[],l=function(e){var t;return 0===e.indexOf("#")&&(t=a.file(e.substr(1)))?t.name:e};for(t=0;t<arguments.length;t++)if(i=arguments[t],"string"==typeof i)o.push(l(i));else if(e.isArray(i))for(n=0;n<i.length;n++)"string"==typeof i[n]?o.push(l(i[n])):i[n]instanceof jQuery&&o.push(i[n]);else i instanceof jQuery&&o.push(i[n]);for(t=0;t<o.length;t++)-1===e.inArray(t,s)&&(i=o[t],"string"==typeof i?(i=r[i]||a.escape(i),i=i.replace(/\$(\d+)/g,function(e,n){return n=t+parseInt(n),n>0&&o[n]&&s.push(n),a.escape(o[n])||""})):i=i.get(0).outerHTML,o[t]=i);return e.map(o,function(t,n){return-1===e.inArray(n,s)?t:null}).join("<br>")},mime2class:function(e){var t="elfinder-cwd-icon-";return e=e.split("/"),t+e[0]+("image"!=e[0]&&e[1]?" "+t+e[1].replace(/(\.|\+)/g,"-"):"")},mime2kind:function(e){var t,n="object"==typeof e?e.mime:e;return t=e.alias&&"symlink-broken"!=e.mime?"Alias":this.kinds[n]?this.kinds[n]:0===n.indexOf("text")?"Text":0===n.indexOf("image")?"Image":0===n.indexOf("audio")?"Audio":0===n.indexOf("video")?"Video":0===n.indexOf("application")?"App":n,this.messages["kind"+t]?this.i18n("kind"+t):n},formatDate:function(e,t){var n,i,a,r,o,s,l,d,c,u,p,h=this,t=t||e.ts,f=h.i18;return h.options.clientFormatDate&&t>0?(n=new Date(1e3*t),d=n[h.getHours](),c=d>12?d-12:d,u=n[h.getMinutes](),p=n[h.getSeconds](),r=n[h.getDate](),o=n[h.getDay](),s=n[h.getMonth]()+1,l=n[h.getFullYear](),i=t>=this.yesterday?this.fancyFormat:this.dateFormat,a=i.replace(/[a-z]/gi,function(e){switch(e){case"d":return r>9?r:"0"+r;case"j":return r;case"D":return h.i18n(f.daysShort[o]);case"l":return h.i18n(f.days[o]);case"m":return s>9?s:"0"+s;case"n":return s;case"M":return h.i18n(f.monthsShort[s-1]);case"F":return h.i18n(f.months[s-1]);case"Y":return l;case"y":return(""+l).substr(2);case"H":return d>9?d:"0"+d;case"G":return d;case"g":return c;case"h":return c>9?c:"0"+c;case"a":return d>12?"pm":"am";case"A":return d>12?"PM":"AM";case"i":return u>9?u:"0"+u;case"s":return p>9?p:"0"+p}return e}),t>=this.yesterday?a.replace("$1",this.i18n(t>=this.today?"Today":"Yesterday")):a):e.date?e.date.replace(/([a-z]+)\s/i,function(e,t){return h.i18n(t)+" "}):h.i18n("dateUnknown")},perms2class:function(e){var t="";return e.read||e.write?e.read?e.write||(t="elfinder-ro"):t="elfinder-wo":t="elfinder-na",t},formatPermissions:function(e){var t=[];return e.read&&t.push(this.i18n("read")),e.write&&t.push(this.i18n("write")),t.length?t.join(" "+this.i18n("and")+" "):this.i18n("noaccess")},formatSize:function(e){var t=1,n="b";return"unknown"==e?this.i18n("unknown"):(e>1073741824?(t=1073741824,n="GB"):e>1048576?(t=1048576,n="MB"):e>1024&&(t=1024,n="KB"),e/=t,(e>0?t>=1048576?e.toFixed(2):Math.round(e):0)+" "+n)},formatFileMode:function(t,n){var i,a,r,o,s,l,d,c,u;if(n||(n=this.options.fileModeStyle.toLowerCase()),t=e.trim(t),t.match(/[rwxs-]{9}$/i)){if(c=t=t.substr(-9),"string"==n)return c;for(u="",r=0,i=0;7>i;i+=3)a=t.substr(i,3),o=0,a.match(/[r]/i)&&(o+=4),a.match(/[w]/i)&&(o+=2),a.match(/[xs]/i)&&(a.match(/[xs]/)&&(o+=1),a.match(/[s]/i)&&(0==i?r+=4:3==i&&(r+=2))),u+=o.toString(8);r&&(u=r.toString(8)+u)}else{if(t=parseInt(t,8),u=t?t.toString(8):"",!t||"octal"==n)return u;for(a=t.toString(8),r=0,a.length>3&&(a=a.substr(-4),r=parseInt(a.substr(0,1),8),a=a.substr(1)),s=1==(1&r),d=2==(2&r),l=4==(4&r),c="",i=0;3>i;i++)c+=4==(4&parseInt(a.substr(i,1),8))?"r":"-",c+=2==(2&parseInt(a.substr(i,1),8))?"w":"-",c+=1==(1&parseInt(a.substr(i,1),8))?0==i&&l||1==i&&d?"s":"x":"-"}return"both"==n?c+" ("+u+")":"string"==n?c:u},navHash2Id:function(e){return this.navPrefix+e},navId2Hash:function(e){return"string"==typeof e?e.substr(this.navPrefix.length):!1},cwdHash2Id:function(e){return this.cwdPrefix+e},cwdId2Hash:function(e){return"string"==typeof e?e.substr(this.cwdPrefix.length):!1},log:function(e){return window.console&&window.console.log&&window.console.log(e),this},debug:function(t,n){var i=this.options.debug;return("all"==i||i===!0||e.isArray(i)&&-1!=e.inArray(t,i))&&window.console&&window.console.log&&window.console.log("elfinder debug: ["+t+"] ["+this.id+"]",n),this},time:function(e){window.console&&window.console.time&&window.console.time(e)},timeEnd:function(e){window.console&&window.console.timeEnd&&window.console.timeEnd(e)}},Object.keys||(Object.keys=function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],i=n.length;return function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on non-object");var r=[];for(var o in a)e.call(a,o)&&r.push(o);if(t)for(var s=0;i>s;s++)e.call(a,n[s])&&r.push(n[s]);return r}}()),elFinder.prototype.version="2.1.6",function(){if(e.ui&&e.ui.ddmanager){var t=e.ui.ddmanager.prepareOffsets;e.ui.ddmanager.prepareOffsets=function(n,i){var a=function(e){if(e.is(":hidden"))return!0;var t=e[0].getBoundingClientRect();return document.elementFromPoint(t.left,t.top)?!1:!0};if("mousedown"===i.type){var r,o,s=e.ui.ddmanager.droppables[n.options.scope]||[],l=s.length;for(r=0;l>r;r++)o=s[r],o.options.autoDisable&&(!o.options.disabled||o.options.autoDisable>1)&&(o.options.disabled=a(o.element),o.options.autoDisable=o.options.disabled?2:1)}return t(n,i)}}}(),e.fn.elfinder=function(e){return"instance"==e?this.getElFinder():this.each(function(){var t="string"==typeof e?e:"";switch(this.elfinder||new elFinder(this,"object"==typeof e?e:{}),t){case"close":case"hide":this.elfinder.hide();break;case"open":case"show":this.elfinder.show();break;case"destroy":this.elfinder.destroy()}})},e.fn.getElFinder=function(){var e;return this.each(function(){return this.elfinder?(e=this.elfinder,!1):void 0}),e},elFinder.prototype._options={url:"",requestType:"get",transport:{},urlUpload:"",dragUploadAllow:"auto",uploadMaxChunkSize:10485760,iframeTimeout:0,customData:{},handlers:{},customHeaders:{},xhrFields:{},lang:"en",cssClass:"",commands:["open","opendir","reload","home","up","back","forward","getfile","quicklook","download","rm","duplicate","rename","mkdir","mkfile","upload","copy","cut","paste","edit","extract","archive","search","info","view","help","resize","sort","netmount","netunmount","places","chmod"],commandsOptions:{getfile:{onlyURL:!1,multiple:!1,folders:!1,oncomplete:""},upload:{ui:"uploadbutton"},quicklook:{autoplay:!0,jplayer:"extensions/jplayer"},edit:{mimes:[],editors:[]},info:{nullUrlDirLinkSelf:!0,custom:{}},netmount:{ftp:{inputs:{host:e('<input type="text"/>'),port:e('<input type="text" placeholder="21"/>'),path:e('<input type="text" value="/"/>'),user:e('<input type="text"/>'),pass:e('<input type="password"/>'),encoding:e('<input type="text" placeholder="Optional"/>'),locale:e('<input type="text" placeholder="Optional"/>')}},dropbox:{inputs:{host:e('<span><span class="elfinder-info-spinner"/></span></span><input type="hidden"/>'),path:e('<input type="text" value="/"/>'),user:e('<input type="hidden"/>'),pass:e('<input type="hidden"/>')},select:function(e){var t=this;t.inputs.host.find("span").length&&e.request({data:{cmd:"netmount",protocol:"dropbox",host:"dropbox.com",user:"init",pass:"init",options:{url:e.uploadURL,id:e.id}},preventDefault:!0}).done(function(n){t.inputs.host.find("span").removeClass("elfinder-info-spinner"),t.inputs.host.find("span").html(n.body.replace(/\{msg:([^}]+)\}/g,function(t,n){return e.i18n(n,"Dropbox.com")}))}).fail(function(){})},done:function(t,n){var i=this;"makebtn"==n.mode?(i.inputs.host.find("span").removeClass("elfinder-info-spinner"),i.inputs.host.find("input").hover(function(){e(this).toggleClass("ui-state-hover")}),i.inputs.host[1].value=""):(i.inputs.host.find("span").removeClass("elfinder-info-spinner"),i.inputs.host.find("span").html("Dropbox.com"),i.inputs.host[1].value="dropbox",i.inputs.user.val("done"),i.inputs.pass.val("done"))}}},help:{view:["about","shortcuts","help"]}},getFileCallback:null,defaultView:"icons",startPathHash:"",ui:["toolbar","tree","path","stat"],uiOptions:{toolbar:[["back","forward"],["netmount"],["mkdir","mkfile","upload"],["open","download","getfile"],["info","chmod"],["quicklook"],["copy","cut","paste"],["rm"],["duplicate","rename","edit","resize"],["extract","archive"],["search"],["view","sort"],["help"]],tree:{openRootOnLoad:!0,openCwdOnOpen:!0,syncTree:!0},navbar:{minWidth:150,maxWidth:500},cwd:{oldSchool:!1,listView:{columns:["perm","date","size","kind"],columnsCustomName:{}}}},onlyMimes:[],sortRules:{},sortType:"name",sortOrder:"asc",sortStickFolders:!0,clientFormatDate:!0,UTCDate:!1,dateFormat:"",fancyDateFormat:"",fileModeStyle:"both",width:"auto",height:400,resizable:!0,notifyDelay:500,notifyDialog:{position:{top:"12px",right:"12px"},width:280},allowShortcuts:!0,rememberLastDir:!0,reloadClearHistory:!1,useBrowserHistory:!0,showFiles:30,showThreshold:50,validName:!1,backupSuffix:"~",sync:0,syncStart:!0,loadTmbs:5,cookie:{expires:30,domain:"",path:"/",secure:!1},contextmenu:{navbar:["open","|","upload","|","copy","cut","paste","duplicate","|","rm","|","rename","|","places","info","chmod","netunmount"],cwd:["reload","back","|","upload","mkdir","mkfile","paste","|","sort","|","info"],files:["getfile","|","open","opendir","quicklook","|","download","upload","|","copy","cut","paste","duplicate","|","rm","|","edit","rename","resize","|","archive","extract","|","places","info","chmod"]},debug:["error","warning","event-destroy"]},elFinder.prototype.history=function(t){var n,i=this,a=!0,r=[],o=function(){r=[t.cwd().hash],n=0,a=!0},s=t.options.useBrowserHistory&&window.history&&window.history.pushState?window.history:null,l=function(s){return s&&i.canForward()||!s&&i.canBack()?(a=!1,t.exec("open",r[s?++n:--n]).fail(o)):e.Deferred().reject()};this.canBack=function(){return n>0},this.canForward=function(){return n<r.length-1},this.back=l,this.forward=function(){return l(!0)},t.open(function(){var e=r.length,i=t.cwd().hash;a&&(n>=0&&e>n+1&&r.splice(n+1),r[r.length-1]!=i&&r.push(i),n=r.length-1),a=!0,s&&(s.state?s.state.thash!=i&&s.pushState({thash:i},null,location.pathname+location.search+"#elf_"+i):s.replaceState({thash:i},null,location.pathname+location.search+"#elf_"+i))
11
- }).reload(t.options.reloadClearHistory&&o)},elFinder.prototype.command=function(t){this.fm=t,this.name="",this.title="",this.state=-1,this.alwaysEnabled=!1,this._disabled=!1,this.disableOnSearch=!1,this.updateOnSelect=!0,this._handlers={enable:function(){this.update(void 0,this.value)},disable:function(){this.update(-1,this.value)},"open reload load":function(){this._disabled=!(this.alwaysEnabled||this.fm.isCommandEnabled(this.name)),this.update(void 0,this.value),this.change()}},this.handlers={},this.shortcuts=[],this.options={ui:"button"},this.setup=function(t,n){var i,a,r,o=this,s=this.fm;for(this.name=t,this.title=s.messages["cmd"+t]?s.i18n("cmd"+t):t,this.options=e.extend({},this.options,n),this.listeners=[],n.shortcuts&&("function"==typeof n.shortcuts?r=n.shortcuts(this.fm,this.shortcuts):e.isArray(n.shortcuts)&&(r=n.shortcuts),this.shortcuts=r||[]),this.updateOnSelect&&(this._handlers.select=function(){this.update(void 0,this.value)}),e.each(e.extend({},o._handlers,o.handlers),function(t,n){s.bind(t,e.proxy(n,o))}),i=0;i<this.shortcuts.length;i++)a=this.shortcuts[i],a.callback=e.proxy(a.callback||function(){this.exec()},this),!a.description&&(a.description=this.title),s.shortcut(a);this.disableOnSearch&&s.bind("search searchend",function(e){o._disabled="search"==e.type,o.update(void 0,o.value)}),this.init()},this.init=function(){},this.exec=function(){return e.Deferred().reject()},this.disabled=function(){return this.state<0},this.enabled=function(){return this.state>-1},this.active=function(){return this.state>0},this.getstate=function(){return-1},this.update=function(e,t){var n=this.state,i=this.value;this.state=this._disabled?-1:void 0!==e?e:this.getstate(),this.value=t,(n!=this.state||i!=this.value)&&this.change()},this.change=function(e){var t,n;if("function"==typeof e)this.listeners.push(e);else for(n=0;n<this.listeners.length;n++){t=this.listeners[n];try{t(this.state,this.value)}catch(i){this.fm.debug("error",i)}}return this},this.hashes=function(n){return n?e.map(e.isArray(n)?n:[n],function(e){return t.file(e)?e:null}):t.selected()},this.files=function(t){var n=this.fm;return t?e.map(e.isArray(t)?t:[t],function(e){return n.file(e)||null}):n.selectedFiles()}},elFinder.prototype.resources={"class":{hover:"ui-state-hover",active:"ui-state-active",disabled:"ui-state-disabled",draggable:"ui-draggable",droppable:"ui-droppable",adroppable:"elfinder-droppable-active",cwdfile:"elfinder-cwd-file",cwd:"elfinder-cwd",tree:"elfinder-tree",treeroot:"elfinder-navbar-root",navdir:"elfinder-navbar-dir",navdirwrap:"elfinder-navbar-dir-wrapper",navarrow:"elfinder-navbar-arrow",navsubtree:"elfinder-navbar-subtree",navcollapse:"elfinder-navbar-collapsed",navexpand:"elfinder-navbar-expanded",treedir:"elfinder-tree-dir",placedir:"elfinder-place-dir",searchbtn:"elfinder-button-search"},tpl:{perms:'<span class="elfinder-perms"/>',lock:'<span class="elfinder-lock"/>',symlink:'<span class="elfinder-symlink"/>',navicon:'<span class="elfinder-nav-icon"/>',navspinner:'<span class="elfinder-navbar-spinner"/>',navdir:'<div class="elfinder-navbar-wrapper"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree"/></div>',placedir:'<div class="elfinder-navbar-wrapper"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}" title="{title}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree"/></div>'},mimes:{text:["application/x-empty","application/javascript","application/xhtml+xml","audio/x-mp3-playlist","application/x-web-config","application/docbook+xml","application/x-php","application/x-perl","application/x-awk","application/x-config","application/x-csh","application/xml"]},mixin:{make:function(){var t,n,i,a=this.fm,r=this.name,o=a.getUI("cwd"),s="list"!=a.storage("view"),l=function(){s?(m.zIndex("").css("position",""),n.css("max-height","")):(i.css("width",""),i.parent("td").css("overflow",""))},d=e.Deferred().fail(function(e){l(),o.trigger("unselectall"),e&&a.error(e)}).always(function(){g.remove(),m.remove(),a.enable()}),c="tmp_"+parseInt(1e5*Math.random()),u=a.cwd().hash,p=new Date,h={hash:c,name:a.uniqueName(this.prefix),mime:this.mime,read:!0,write:!0,date:"Today "+p.getHours()+":"+p.getMinutes()},f=this.data||{},m=o.trigger("create."+a.namespace,h).find("#"+a.cwdHash2Id(c)),g=e(s?"<textarea/>":'<input type="text"/>').on("keyup text",function(){s?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):t&&(this.style.width=t+"px",this.scrollWidth>t&&(this.style.width=this.scrollWidth+10+"px"))}).keydown(function(t){t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?d.reject():t.keyCode==e.ui.keyCode.ENTER&&g.blur()}).mousedown(function(e){e.stopPropagation()}).blur(function(){var t=e.trim(g.val()),n=g.parent(),i=!0;if(n.length){if(a.options.validName&&a.options.validName.test)try{i=a.options.validName.test(t)}catch(s){i=!1}if(!t||".."===t||!i)return a.error("errInvName"),!1;if(a.fileByName(t,u))return a.error(["errExists",t]),!1;l(),n.html(a.escape(t)),a.lockfiles({files:[c]}),a.request({data:e.extend({cmd:r,name:t,target:u},f||{}),notify:{type:r,cnt:1},preventFail:!0,syncOnFail:!0}).fail(function(e){d.reject(e)}).done(function(e){if(d.resolve(e),e.added&&e.added[0]){var t=o.find("#"+a.cwdHash2Id(e.added[0].hash));t.length&&t.trigger("scrolltoview")}})}});return this.disabled()||!m.length?d.reject():(a.disable(),n=m.find(".elfinder-cwd-filename"),i=n.parent(),s?(m.zIndex(m.parent().zIndex()+1).css("position","relative"),n.css("max-height","none")):(t=i.width(),i.width(t-15),i.parent("td").css("overflow","visible")),n.empty("").append(g.val(h.name)),g.trigger("keyup"),g.select().focus(),g[0].setSelectionRange&&g[0].setSelectionRange(0,h.name.replace(/\..+$/,"").length),d)}}},e.fn.dialogelfinder=function(t){var n="elfinderPosition",i="elfinderDestroyOnClose";if(this.not(".elfinder").each(function(){var a=(e(document),e('<div class="ui-widget-header dialogelfinder-drag ui-corner-top">'+(t.title||"Files")+"</div>")),r=(e('<a href="#" class="dialogelfinder-drag-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>').appendTo(a).click(function(e){e.preventDefault(),r.dialogelfinder("close")}),e(this).addClass("dialogelfinder").css("position","absolute").hide().appendTo("body").draggable({handle:".dialogelfinder-drag",containment:"window"}).elfinder(t).prepend(a));r.elfinder("instance"),r.width(parseInt(r.width())||840).data(i,!!t.destroyOnClose).find(".elfinder-toolbar").removeClass("ui-corner-top"),t.position&&r.data(n,t.position),t.autoOpen!==!1&&e(this).dialogelfinder("open")}),"open"==t){var a=e(this),r=a.data(n)||{top:parseInt(e(document).scrollTop()+(e(window).height()<a.height()?2:(e(window).height()-a.height())/2)),left:parseInt(e(document).scrollLeft()+(e(window).width()<a.width()?2:(e(window).width()-a.width())/2))},o=100;a.is(":hidden")&&(e("body").find(":visible").each(function(){var t,n=e(this);this!==a[0]&&"absolute"==n.css("position")&&(t=parseInt(n.zIndex()))>o&&(o=t+1)}),a.zIndex(o).css(r).show().trigger("resize"),setTimeout(function(){a.trigger("resize").mousedown()},200))}else if("close"==t){var a=e(this);a.is(":visible")&&(a.data(i)?a.elfinder("destroy").remove():a.elfinder("close"))}else if("instance"==t)return e(this).getElFinder();return this},elFinder&&elFinder.prototype&&"object"==typeof elFinder.prototype.i18&&(elFinder.prototype.i18.en={translator:"Troex Nevelin &lt;troex@fury.scancode.ru&gt;",language:"English",direction:"ltr",dateFormat:"M d, Y h:i A",fancyDateFormat:"$1 h:i A",messages:{error:"Error",errUnknown:"Unknown error.",errUnknownCmd:"Unknown command.",errJqui:"Invalid jQuery UI configuration. Selectable, draggable and droppable components must be included.",errNode:"elFinder requires DOM Element to be created.",errURL:"Invalid elFinder configuration! URL option is not set.",errAccess:"Access denied.",errConnect:"Unable to connect to backend.",errAbort:"Connection aborted.",errTimeout:"Connection timeout.",errNotFound:"Backend not found.",errResponse:"Invalid backend response.",errConf:"Invalid backend configuration.",errJSON:"PHP JSON module not installed.",errNoVolumes:"Readable volumes not available.",errCmdParams:'Invalid parameters for command "$1".',errDataNotJSON:"Data is not JSON.",errDataEmpty:"Data is empty.",errCmdReq:"Backend request requires command name.",errOpen:'Unable to open "$1".',errNotFolder:"Object is not a folder.",errNotFile:"Object is not a file.",errRead:'Unable to read "$1".',errWrite:'Unable to write into "$1".',errPerm:"Permission denied.",errLocked:'"$1" is locked and can not be renamed, moved or removed.',errExists:'File named "$1" already exists.',errInvName:"Invalid file name.",errFolderNotFound:"Folder not found.",errFileNotFound:"File not found.",errTrgFolderNotFound:'Target folder "$1" not found.',errPopup:"Browser prevented opening popup window. To open file enable it in browser options.",errMkdir:'Unable to create folder "$1".',errMkfile:'Unable to create file "$1".',errRename:'Unable to rename "$1".',errCopyFrom:'Copying files from volume "$1" not allowed.',errCopyTo:'Copying files to volume "$1" not allowed.',errMkOutLink:"Unable to create a link to outside the volume root.",errUpload:"Upload error.",errUploadFile:'Unable to upload "$1".',errUploadNoFiles:"No files found for upload.",errUploadTotalSize:"Data exceeds the maximum allowed size.",errUploadFileSize:"File exceeds maximum allowed size.",errUploadMime:"File type not allowed.",errUploadTransfer:'"$1" transfer error.',errUploadTemp:"Unable to make temporary file for upload.",errNotReplace:'Object "$1" already exists at this location and can not be replaced by object with another type.',errReplace:'Unable to replace "$1".',errSave:'Unable to save "$1".',errCopy:'Unable to copy "$1".',errMove:'Unable to move "$1".',errCopyInItself:'Unable to copy "$1" into itself.',errRm:'Unable to remove "$1".',errRmSrc:"Unable remove source file(s).",errExtract:'Unable to extract files from "$1".',errArchive:"Unable to create archive.",errArcType:"Unsupported archive type.",errNoArchive:"File is not archive or has unsupported archive type.",errCmdNoSupport:"Backend does not support this command.",errReplByChild:'The folder "$1" can\'t be replaced by an item it contains.',errArcSymlinks:"For security reason denied to unpack archives contains symlinks or files with not allowed names.",errArcMaxSize:"Archive files exceeds maximum allowed size.",errResize:'Unable to resize "$1".',errResizeDegree:"Invalid rotate degree.",errResizeRotate:"Unable to rotate image.",errResizeSize:"Invalid image size.",errResizeNoChange:"Image size not changed.",errUsupportType:"Unsupported file type.",errNotUTF8Content:'File "$1" is not in UTF-8 and cannot be edited.',errNetMount:'Unable to mount "$1".',errNetMountNoDriver:"Unsupported protocol.",errNetMountFailed:"Mount failed.",errNetMountHostReq:"Host required.",errSessionExpires:"Your session has expired due to inactivity.",errCreatingTempDir:'Unable to create temporary directory: "$1"',errFtpDownloadFile:'Unable to download file from FTP: "$1"',errFtpUploadFile:'Unable to upload file to FTP: "$1"',errFtpMkdir:'Unable to create remote directory on FTP: "$1"',errArchiveExec:'Error while archiving files: "$1"',errExtractExec:'Error while extracting files: "$1"',errNetUnMount:"Unable to unmount",errConvUTF8:"Not convertible to UTF-8",errFolderUpload:"Try Google Chrome, If you'd like to upload the folder.",errSearchTimeout:'Timed out while searching "$1". Search result is partial.',cmdarchive:"Create archive",cmdback:"Back",cmdcopy:"Copy",cmdcut:"Cut",cmddownload:"Download",cmdduplicate:"Duplicate",cmdedit:"Edit file",cmdextract:"Extract files from archive",cmdforward:"Forward",cmdgetfile:"Select files",cmdhelp:"About this software",cmdhome:"Home",cmdinfo:"Get info",cmdmkdir:"New folder",cmdmkfile:"New text file",cmdopen:"Open",cmdpaste:"Paste",cmdquicklook:"Preview",cmdreload:"Reload",cmdrename:"Rename",cmdrm:"Delete",cmdsearch:"Find files",cmdup:"Go to parent directory",cmdupload:"Upload files",cmdview:"View",cmdresize:"Resize & Rotate",cmdsort:"Sort",cmdnetmount:"Mount network volume",cmdnetunmount:"Unmount",cmdplaces:"To Places",cmdchmod:"Change mode",cmdopendir:"Open a folder",btnClose:"Close",btnSave:"Save",btnRm:"Remove",btnApply:"Apply",btnCancel:"Cancel",btnNo:"No",btnYes:"Yes",btnMount:"Mount",btnApprove:"Goto $1 & approve",btnUnmount:"Unmount",btnConv:"Convert",btnCwd:"Here",btnVolume:"Volume",btnAll:"All",btnMime:"MIME Type",btnFileName:"Filename",btnSaveClose:"Save & Close",btnBackup:"Backup",ntfopen:"Open folder",ntffile:"Open file",ntfreload:"Reload folder content",ntfmkdir:"Creating directory",ntfmkfile:"Creating files",ntfrm:"Delete files",ntfcopy:"Copy files",ntfmove:"Move files",ntfprepare:"Prepare to copy files",ntfrename:"Rename files",ntfupload:"Uploading files",ntfdownload:"Downloading files",ntfsave:"Save files",ntfarchive:"Creating archive",ntfextract:"Extracting files from archive",ntfsearch:"Searching files",ntfresize:"Resizing images",ntfsmth:"Doing something",ntfloadimg:"Loading image",ntfnetmount:"Mounting network volume",ntfnetunmount:"Unmounting network volume",ntfdim:"Acquiring image dimension",ntfreaddir:"Reading folder infomation",ntfurl:"Getting URL of link",ntfchmod:"Changing file mode",ntfpreupload:"Verifying upload file name",dateUnknown:"unknown",Today:"Today",Yesterday:"Yesterday",msJan:"Jan",msFeb:"Feb",msMar:"Mar",msApr:"Apr",msMay:"May",msJun:"Jun",msJul:"Jul",msAug:"Aug",msSep:"Sep",msOct:"Oct",msNov:"Nov",msDec:"Dec",January:"January",February:"February",March:"March",April:"April",May:"May",June:"June",July:"July",August:"August",September:"September",October:"October",November:"November",December:"December",Sunday:"Sunday",Monday:"Monday",Tuesday:"Tuesday",Wednesday:"Wednesday",Thursday:"Thursday",Friday:"Friday",Saturday:"Saturday",Sun:"Sun",Mon:"Mon",Tue:"Tue",Wed:"Wed",Thu:"Thu",Fri:"Fri",Sat:"Sat",sortname:"by name",sortkind:"by kind",sortsize:"by size",sortdate:"by date",sortFoldersFirst:"Folders first","untitled file.txt":"NewFile.txt","untitled folder":"NewFolder",Archive:"NewArchive",confirmReq:"Confirmation required",confirmRm:"Are you sure you want to remove files?<br/>This cannot be undone!",confirmRepl:"Replace old file with new one?",confirmConvUTF8:"Not in UTF-8<br/>Convert to UTF-8?<br/>Contents become UTF-8 by saving after conversion.",confirmNotSave:"It has been modified.<br/>Losing work if you do not save changes.",apllyAll:"Apply to all",name:"Name",size:"Size",perms:"Permissions",modify:"Modified",kind:"Kind",read:"read",write:"write",noaccess:"no access",and:"and",unknown:"unknown",selectall:"Select all files",selectfiles:"Select file(s)",selectffile:"Select first file",selectlfile:"Select last file",viewlist:"List view",viewicons:"Icons view",places:"Places",calc:"Calculate",path:"Path",aliasfor:"Alias for",locked:"Locked",dim:"Dimensions",files:"Files",folders:"Folders",items:"Items",yes:"yes",no:"no",link:"Link",searcresult:"Search results",selected:"selected items",about:"About",shortcuts:"Shortcuts",help:"Help",webfm:"Web file manager",ver:"Version",protocolver:"protocol version",homepage:"Project home",docs:"Documentation",github:"Fork us on Github",twitter:"Follow us on twitter",facebook:"Join us on facebook",team:"Team",chiefdev:"chief developer",developer:"developer",contributor:"contributor",maintainer:"maintainer",translator:"translator",icons:"Icons",dontforget:"and don't forget to take your towel",shortcutsof:"Shortcuts disabled",dropFiles:"Drop files here",or:"or",selectForUpload:"Select files to upload",moveFiles:"Move files",copyFiles:"Copy files",rmFromPlaces:"Remove from places",aspectRatio:"Aspect ratio",scale:"Scale",width:"Width",height:"Height",resize:"Resize",crop:"Crop",rotate:"Rotate","rotate-cw":"Rotate 90 degrees CW","rotate-ccw":"Rotate 90 degrees CCW",degree:"°",netMountDialogTitle:"Mount network volume",protocol:"Protocol",host:"Host",port:"Port",user:"User",pass:"Password",confirmUnmount:"Are you unmount $1?",dropFilesBrowser:"Drop or Paste files from browser",dropPasteFiles:"Drop or Paste files here",encoding:"Encoding",locale:"Locale",searchTarget:"Target: $1",searchMime:"Search by input MIME Type",owner:"Owner",group:"Group",other:"Other",execute:"Execute",perm:"Permission",mode:"Mode",emptyFolder:"Folder is empty",emptyFolderDrop:"Folder is empty\\A Drop to add items",emptyFolderLTap:"Folder is empty\\A Long tap to add items",quality:"Quality",autoSync:"Auto sync",moveUp:"Move up",kindUnknown:"Unknown",kindFolder:"Folder",kindAlias:"Alias",kindAliasBroken:"Broken alias",kindApp:"Application",kindPostscript:"Postscript document",kindMsOffice:"Microsoft Office document",kindMsWord:"Microsoft Word document",kindMsExcel:"Microsoft Excel document",kindMsPP:"Microsoft Powerpoint presentation",kindOO:"Open Office document",kindAppFlash:"Flash application",kindPDF:"Portable Document Format (PDF)",kindTorrent:"Bittorrent file",kind7z:"7z archive",kindTAR:"TAR archive",kindGZIP:"GZIP archive",kindBZIP:"BZIP archive",kindXZ:"XZ archive",kindZIP:"ZIP archive",kindRAR:"RAR archive",kindJAR:"Java JAR file",kindTTF:"True Type font",kindOTF:"Open Type font",kindRPM:"RPM package",kindText:"Text document",kindTextPlain:"Plain text",kindPHP:"PHP source",kindCSS:"Cascading style sheet",kindHTML:"HTML document",kindJS:"Javascript source",kindRTF:"Rich Text Format",kindC:"C source",kindCHeader:"C header source",kindCPP:"C++ source",kindCPPHeader:"C++ header source",kindShell:"Unix shell script",kindPython:"Python source",kindJava:"Java source",kindRuby:"Ruby source",kindPerl:"Perl script",kindSQL:"SQL source",kindXML:"XML document",kindAWK:"AWK source",kindCSV:"Comma separated values",kindDOCBOOK:"Docbook XML document",kindMarkdown:"Markdown text",kindImage:"Image",kindBMP:"BMP image",kindJPEG:"JPEG image",kindGIF:"GIF Image",kindPNG:"PNG Image",kindTIFF:"TIFF image",kindTGA:"TGA image",kindPSD:"Adobe Photoshop image",kindXBITMAP:"X bitmap image",kindPXM:"Pixelmator image",kindAudio:"Audio media",kindAudioMPEG:"MPEG audio",kindAudioMPEG4:"MPEG-4 audio",kindAudioMIDI:"MIDI audio",kindAudioOGG:"Ogg Vorbis audio",kindAudioWAV:"WAV audio",AudioPlaylist:"MP3 playlist",kindVideo:"Video media",kindVideoDV:"DV movie",kindVideoMPEG:"MPEG movie",kindVideoMPEG4:"MPEG-4 movie",kindVideoAVI:"AVI movie",kindVideoMOV:"Quick Time movie",kindVideoWM:"Windows Media movie",kindVideoFlash:"Flash movie",kindVideoMKV:"Matroska movie",kindVideoOGG:"Ogg movie"}}),e.fn.elfinderbutton=function(t){return this.each(function(){var n,i="class",a=t.fm,r=a.res(i,"disabled"),o=a.res(i,"active"),s=a.res(i,"hover"),l="elfinder-button-menu-item",d="elfinder-button-menu-item-selected",c=e(this).addClass("ui-state-default elfinder-button").attr("title",t.title).append('<span class="elfinder-button-icon elfinder-button-icon-'+t.name+'"/>').hover(function(e){!c.hasClass(r)&&c["mouseleave"==e.type?"removeClass":"addClass"](s)}).click(function(e){c.hasClass(r)||(n&&t.variants.length>1?(n.is(":hidden")&&t.fm.getUI().click(),e.stopPropagation(),n.slideToggle(100)):t.exec())}),u=function(){n.hide()};e.isArray(t.variants)&&(c.addClass("elfinder-menubutton"),n=e('<div class="ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>').hide().appendTo(c).zIndex(12+c.zIndex()).on("mouseenter mouseleave","."+l,function(){e(this).toggleClass(s)}).on("click","."+l,function(i){i.preventDefault(),i.stopPropagation(),c.removeClass(s),n.hide(),t.exec(t.fm.selected(),e(this).data("value"))}),t.fm.bind("disable select",u).getUI().click(u),t.change(function(){n.html(""),e.each(t.variants,function(i,a){n.append(e('<div class="'+l+'">'+a[1]+"</div>").data("value",a[0]).addClass(a[0]==t.value?d:""))})})),t.change(function(){t.disabled()?c.removeClass(o+" "+s).addClass(r):(c.removeClass(r),c[t.active()?"addClass":"removeClass"](o))}).change()})},e.fn.elfindercontextmenu=function(t){return this.each(function(){var n=e(this),i="elfinder-contextmenu-item",a="elfinder-contextsubmenu-item",r="elfinder-contextmenu-extra-icon",o=n.addClass("ui-helper-reset ui-widget ui-state-default ui-corner-all elfinder-contextmenu elfinder-contextmenu-"+t.direction).hide().appendTo("body").on("mouseenter mouseleave","."+i,function(t){e(this).toggleClass("ui-state-hover","mouseenter"===t.type)}).on("mouseenter mouseleave","."+r,function(t){e(this).parent().toggleClass("ui-state-hover","mouseleave"===t.type)}).on("contextmenu",function(){return!1}),s="ltr"==t.direction?"left":"right",l=e.extend({},t.options.contextmenu),d=i+(t.UA.Touch?" elfinder-touch":""),c='<div class="'+d+'"><span class="elfinder-button-icon {icon} elfinder-contextmenu-icon"/><span>{label}</span></div>',u=function(t,n,i){return e(c.replace("{icon}",n?"elfinder-button-icon-"+n:"").replace("{label}",t)).click(function(e){e.stopPropagation(),e.preventDefault(),i()})},p=function(n,i){var a=e(window),r=o.outerWidth(),l=o.outerHeight(),d=a.width(),c=a.height(),u=a.scrollTop(),p=a.scrollLeft(),h=t.UA.Touch?10:0,f={top:c>i-u+h+l?i+h:i-h-l>0?i-h-l:i+h,left:d>n-p+h+r?n+h:n-h-r,"z-index":100+t.getUI("workzone").zIndex()};o.css(f).show(),f={"z-index":f["z-index"]+10},f[s]=parseInt(o.width()),o.find(".elfinder-contextmenu-sub").css(f)},h=function(){o.hide().empty(),t.trigger("closecontextmenu")},f=function(i,r){var s=!1,c={},p=[],f=0===r[0].indexOf(t.cwd().volumeid,0);n.data("cmdMaps")&&e.each(n.data("cmdMaps"),function(e,t){return 0==r[0].indexOf(e,0)?(c=t,!1):void 0}),f||t.disabledCmds&&e.each(t.disabledCmds,function(e,t){return 0==r[0].indexOf(e,0)?(p=t,!1):void 0}),e.each(l[i]||[],function(n,l){var m,g,v,b,y;if("|"==l&&s)return o.append('<div class="elfinder-contextmenu-separator"/>'),s=!1,void 0;if(c[l]&&(l=c[l]),m=t.command(l),m&&!f&&(y=m._disabled,m._disabled=!(m.alwaysEnabled||(t._commands[l]?-1===e.inArray(l,p):!1))),m&&-1!=m.getstate(r)){if(r._type=i,m.variants){if(!m.variants.length)return;g=u(m.title,m.name,function(){}).on("touchend",function(){g.data("touching",!0),setTimeout(function(){g.data("touching",!1)},50)}).on("click touchend","."+a,function(t){t.stopPropagation(),g.data("touching")?(g.data("touching",!1),e(this).removeClass("ui-state-hover"),t.preventDefault()):"click"==t.type&&(o.hide(),m.exec(r,e(this).data("exec")))}),v=e('<div class="ui-corner-all elfinder-contextmenu-sub"/>').appendTo(g.append('<span class="elfinder-contextmenu-arrow"/>')),b=function(){var t,n,i,a=e(window),r=e(g).offset().left,o=e(g).offset().top,s=e(g).outerWidth(),l=v.outerWidth(),d=v.outerHeight(),c=a.scrollLeft()+a.width(),u=a.scrollTop()+a.height(),p=5;i=r+s+l+p-c,t=i>0?s-i:s,i=o+5+d+p-u,n=i>0?5-i:5;var h={left:t,top:n};v.css(h).toggle()},g.addClass("elfinder-contextmenu-group").hover(function(){b()}),e.each(m.variants,function(t,n){v.append(e('<div class="'+d+" "+a+'"><span>'+n[1]+"</span></div>").data("exec",n[0]))})}else g=u(m.title,m.name,function(){h(),m.exec(r)}),m.extra&&m.extra.node?g.append(e('<span class="elfinder-button-icon elfinder-button-icon-'+(m.extra.icon||"")+' elfinder-contextmenu-extra-icon"/>').append(m.extra.node)):g.remove(".elfinder-contextmenu-extra-icon");o.append(g),s=!0}m&&!f&&(m._disabled=y)})},m=function(t){e.each(t,function(e,t){var n;"|"===t?o.append('<div class="elfinder-contextmenu-separator"/>'):t.label&&"function"==typeof t.callback&&(n=u(t.label,t.icon,function(){!t.remain&&h(),t.callback()}),o.append(n))})};t.one("load",function(){t.bind("contextmenu",function(e){var t=e.data;h(),t.type&&t.targets?f(t.type,t.targets):t.raw&&m(t.raw),o.children().length&&p(t.x,t.y)}).one("destroy",function(){o.remove()}).bind("disable select",function(){!n.data("mouseEvInternal")&&h(),n.data("mouseEvInternal",!1)}).getUI().click(h)})})},e.fn.elfindercwd=function(t,n){return this.not(".elfinder-cwd").each(function(){var i=t.UA.Mobile,a="list"==t.viewType,r="select."+t.namespace,o="unselect."+t.namespace,s="disable."+t.namespace,l="enable."+t.namespace,d="class",c=t.res(d,"cwdfile"),u="."+c,p="ui-selected",h=t.res(d,"disabled"),f=t.res(d,"draggable"),m=t.res(d,"droppable"),g=t.res(d,"hover"),v=t.res(d,"adroppable"),b=c+"-tmp",y=t.options.loadTmbs>0?t.options.loadTmbs:5,w="",x=[],k=[],C=function(){for(var e="",n=t.options.uiOptions.cwd.listView.columns,i=0;i<n.length;i++)e+="<td>{"+n[i]+"}</td>";return e},T={icon:'<div id="{id}" class="'+c+(t.UA.Touch?" elfinder-touch":"")+' {permsclass} {dirclass} ui-corner-all" title="{tooltip}"><div class="elfinder-cwd-file-wrapper ui-corner-all"><div class="elfinder-cwd-icon {mime} ui-corner-all" unselectable="on" {style}/>{marker}</div><div class="elfinder-cwd-filename" title="{nametitle}">{name}</div></div>',row:'<tr id="{id}" class="'+c+(t.UA.Touch?" elfinder-touch":"")+' {permsclass} {dirclass}" title="{tooltip}"><td><div class="elfinder-cwd-file-wrapper"><span class="elfinder-cwd-icon {mime}"/>{marker}<span class="elfinder-cwd-filename">{name}</span></div></td>'+C()+"</tr>"},I=t.res("tpl","perms"),F=t.res("tpl","lock"),M=t.res("tpl","symlink"),P={id:function(e){return t.cwdHash2Id(e.hash)},name:function(e){return name=t.escape(e.name),!a&&(name=name.replace(/([_.])/g,"&#8203;$1")),name},nametitle:function(e){return t.escape(e.name)},permsclass:function(e){return t.perms2class(e)},perm:function(e){return t.formatPermissions(e)},dirclass:function(e){return"directory"==e.mime?"directory":""},mime:function(e){return t.mime2class(e.mime)},size:function(e){return t.formatSize(e.size)},date:function(e){return t.formatDate(e)},kind:function(e){return t.mime2kind(e)},mode:function(e){return e.perm?t.formatFileMode(e.perm):""},modestr:function(e){return e.perm?t.formatFileMode(e.perm,"string"):""},modeoct:function(e){return e.perm?t.formatFileMode(e.perm,"octal"):""},modeboth:function(e){return e.perm?t.formatFileMode(e.perm,"both"):""},marker:function(e){return(e.alias||"symlink-broken"==e.mime?M:"")+(e.read&&e.write?"":I)+(e.locked?F:"")},tooltip:function(e){var n=t.formatDate(e)+(e.size>0?" ("+t.formatSize(e.size)+")":""),i="";return i=w&&e.path?t.escape(e.path.replace(/\/[^\/]*$/,"")):e.tooltip?t.escape(e.tooltip).replace(/\r/g,"&#13;"):"",i?i+"&#13;"+n:n}},S=function(e){return T[a?"row":"icon"].replace(/\{([a-z]+)\}/g,function(t,n){return P[n]?P[n](e):e[n]?e[n]:""})},z=!1,A=function(t,n){function i(e,t){return e[t+"All"]("[id]:not(."+h+"):not(.elfinder-cwd-parent):first")}var s,l,d,c,u,f=e.ui.keyCode,m=t==f.LEFT||t==f.UP,g=Z.find("[id]."+p);if(g.length)if(s=g.filter(m?":first":":last"),d=i(s,m?"prev":"next"),d.length)if(a||t==f.LEFT||t==f.RIGHT)l=d;else if(c=s.position().top,u=s.position().left,l=s,m){do l=l.prev("[id]");while(l.length&&!(l.position().top<c&&l.position().left<=u));l.hasClass(h)&&(l=i(l,"next"))}else{do l=l.next("[id]");while(l.length&&!(l.position().top>c&&l.position().left>=u));l.hasClass(h)&&(l=i(l,"prev")),l.length||(d=Z.find("[id]:not(."+h+"):last"),d.position().top>c&&(l=d))}else l=s;else l=Z.find("[id]:not(."+h+"):not(.elfinder-cwd-parent):"+(m?"last":"first"));l&&l.length&&!l.hasClass("elfinder-cwd-parent")&&(n?l=s.add(s[m?"prevUntil":"nextUntil"]("#"+l.attr("id"))).add(l):g.trigger(o),l.trigger(r),H(l.filter(m?":first":":last")),j())},D=[],O=function(n){e("#"+t.cwdHash2Id(n)).trigger(r)},U=function(){var n=t.cwd().hash;Z.find("[id]:not(."+p+"):not(.elfinder-cwd-parent)").trigger(r),D=e.map(t.files(),function(e){return e.phash==n?e.hash:null}),j()},E=function(){z=!1,D=[],Z.find("[id]."+p).trigger(o),j()},j=function(){t.trigger("select",{selected:D})},H=function(e){var t=e.position().top,n=e.outerHeight(!0),i=et.scrollTop(),a=et.innerHeight();t+n>i+a?et.scrollTop(parseInt(t+n-a)):i>t&&et.scrollTop(t)},R=[],_=function(e){for(var t=R.length;t--;)if(R[t].hash==e)return t;return-1},N="scroll."+t.namespace,q={filter:u,stop:j,delay:250,selected:function(t,n){e(n.selected).trigger(r)},unselected:function(t,n){e(n.unselected).trigger(o)}},L=function(){var n=function(){var o,s,l=[],d=!1,c=[],u={},h=R._last||Z.find("[id]:last"),f=!h.length,m=R._place||(a?Z.children("table").children("tbody"):Z);if(f&&(et._top=0),et._mousedown&&et._top!=et.scrollTop())return et._top=et.scrollTop(),setTimeout(function(){n()},50),void 0;if(delete R._timer,!R.length)return tt.hide(),et.off(N);for(;(!h.length||(o=h.position().top-(et.height()+et.scrollTop()+t.options.showThreshold))<=0)&&(s=R.splice(0,t.options.showFiles-(o||0)/(R._hpi||1))).length&&(l=e.map(s,function(e){return e.hash&&e.name?("directory"==e.mime&&(d=!0),e.tmb&&(1===e.tmb?c.push(e.hash):u[e.hash]=e.tmb),S(e)):null}),(f||!R.length)&&tt.hide(),m.append(l.join("")),h=Z.find("[id]:last"),f&&et.scrollTop(0),(f||!R._hpi)&&Y(m,s.length),!f););R._last=h,W(u),c.length&&B(c),d&&!i&&V(),D.length&&m.find("[id]:not(."+p+"):not(.elfinder-cwd-parent)").each(function(){var n=t.cwdId2Hash(this.id);-1!==e.inArray(n,D)&&e(this).trigger(r)})};R._timer&&clearTimeout(R._timer),!R._timer&&n(),R._timer=setTimeout(function(){n()},100)},$=e.extend({},t.droppable,{over:function(n,i){var a,r,o,s=e(this),l=i.helper,c=n.shiftKey||n.ctrlKey||n.metaKey;return n.stopPropagation(),l.data("dropover",l.data("dropover")+1),s.data("dropover",!0),l.data("namespace")!==t.namespace?(s.removeClass(v),!1):(s.hasClass(t.res(d,"cwdfile"))?(a=t.cwdId2Hash(s.attr("id")),s.data("dropover",a)):(a=t.cwd().hash,t.cwd().write&&s.data("dropover",a)),o=t.file(l.data("files")[0]).phash===a,s.data("dropover")===a?e.each(l.data("files"),function(e,t){return t===a||o&&!c&&!l.hasClass("elfinder-drag-helper-plus")?(s.removeClass(v),!1):void 0}):s.removeClass(v),l.data("locked")||o?r="elfinder-drag-helper-plus":(r="elfinder-drag-helper-move",c&&(r+=" elfinder-drag-helper-plus")),s.hasClass(v)&&l.addClass(r),setTimeout(function(){s.hasClass(v)&&l.addClass(r)},20),void 0)},out:function(t,n){var i=n.helper;t.stopPropagation(),i.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus").data("dropover",Math.max(i.data("dropover")-1,0)),e(this).removeData("dropover").removeClass(v)},deactivate:function(){e(this).removeData("dropover").removeClass(v)}}),V=function(){var e=Z.find(".directory:not(."+m+",.elfinder-na,.elfinder-ro)");t.isCommandEnabled("paste")&&e.droppable($),t.isCommandEnabled("upload")&&e.addClass("native-droppable")},W=function(n){var i,a=t.option("tmbUrl"),r=!0;return e.each(n,function(n,o){var s=e("#"+t.cwdHash2Id(n));s.length?function(t,n){e("<img/>").load(function(){t.find(".elfinder-cwd-icon").css("background","url('"+n+"') center center no-repeat")}).attr("src",n)}(s,t.tmbUrls._search?t.tmb(n):a+o):(r=!1,-1!=(i=_(n))&&(R[i].tmb=o))}),r},B=function(e){var n=[];return t.oldAPI?(t.request({data:{cmd:"tmb",current:t.cwd().hash},preventFail:!0}).done(function(e){W(e.images||[])&&e.tmb&&B()}),void 0):(n=n=e.splice(0,y),n.length&&t.request({data:{cmd:"tmb",targets:n},preventFail:!0}).done(function(t){W(t.images||[])&&B(e)}),void 0)},K=function(n){var r,o,s,l,d=a?Z.find("tbody"):Z,c=n.length,u=[],p={},h=!1,f=function(e){for(var n,i=Z.find("[id]:first");i.length;){if(n=t.file(t.cwdId2Hash(i.attr("id"))),!i.hasClass("elfinder-cwd-parent")&&n&&t.compare(e,n)<0)return i;i=i.next("[id]")}},m=function(e){var n,i=R.length;for(n=0;i>n;n++)if(t.compare(e,R[n])<0)return n;return i||-1};for(c&&et.removeClass("elfinder-cwd-wrapper-empty");c--;)r=n[c],o=r.hash,e("#"+t.cwdHash2Id(o)).length||((s=f(r))&&s.length?s.before(S(r)):(l=m(r))>=0?R.splice(l,0,r):d.append(S(r)),e("#"+t.cwdHash2Id(o)).length&&("directory"==r.mime?h=!0:r.tmb&&(1===r.tmb?u.push(o):p[o]=r.tmb)));Y(d),W(p),u.length&&B(u),h&&!i&&V()},J=function(n){var i,a,r,o=n.length;if(!t.cwd().hash&&"open"!==t.currentReqCmd)return e.each(k.reverse(),function(e,n){return t.files()[n]?(t.one(t.currentReqCmd,function(){t.exec("open",n)}),!1):void 0}),void 0;for(;o--;)if(i=n[o],(a=e("#"+t.cwdHash2Id(i))).length)try{a.remove()}catch(s){t.debug("error",s)}else-1!=(r=_(i))&&R.splice(r,1);
12
- Z.children().length<1&&(et.addClass("elfinder-cwd-wrapper-empty"),Z.hide(),setTimeout(function(){Z.show()},0))},G={name:t.i18n("name"),perm:t.i18n("perms"),date:t.i18n("modify"),size:t.i18n("size"),kind:t.i18n("kind"),modestr:t.i18n("mode"),modeoct:t.i18n("mode"),modeboth:t.i18n("mode")},X=function(){for(var n="",i="",a=t.options.uiOptions.cwd.listView.columns,r=e.extend({},G,t.options.uiOptions.cwd.listView.columnsCustomName),o=0;o<a.length;o++)n="undefined"!=typeof r[a[o]]?r[a[o]]:t.i18n(a[o]),i+='<td class="elfinder-cwd-view-th-'+a[o]+'">'+n+"</td>";return i},Y=function(e,t){var n;e=e||(a?Z.find("tbody"):Z),R.length>0&&(e.css({height:"auto"}),n=e.height(),t&&(R._hpi=n/t),tt.css({top:R._hpi*R.length+n+"px"}).show())},Q=function(i,r){var o=t.cwd().hash;k=t.parents(o),E();try{Z.empty()}catch(s){Z.html("")}if(Z.removeClass("elfinder-cwd-view-icons elfinder-cwd-view-list").addClass("elfinder-cwd-view-"+(a?"list":"icons")),Z.css("height","auto"),tt.hide(),et[a?"addClass":"removeClass"]("elfinder-cwd-wrapper-list"),et._padding=parseInt(et.css("padding-top"))+parseInt(et.css("padding-bottom")),a&&Z.html('<table><thead><tr class="ui-state-default'+(t.UA.Touch?" elfinder-touch":"")+'"><td class="elfinder-cwd-view-th-name">'+G.name+"</td>"+X()+"</tr></thead><tbody/></table>"),R=e.map(i,function(e){return r||e.phash==o?e:null}),R=t.sortFiles(R),et[!r&&R.length<1?"addClass":"removeClass"]("elfinder-cwd-wrapper-empty").on(N,L).trigger(N),o=t.cwd().phash,n.oldSchool&&o&&!w){var l=e.extend(!0,{},t.file(o),{name:"..",mime:"directory"});l=e(S(l)).addClass("elfinder-cwd-parent").bind("mousedown click mouseup touchstart touchmove touchend dblclick mouseenter",function(e){e.preventDefault(),e.stopPropagation()}).dblclick(function(){t.exec("open",t.cwdId2Hash(this.id))}),(a?Z.find("tbody"):Z).prepend(l)}r||!t.cwd().write?et.removeClass("native-droppable").droppable("disable"):(et[t.isCommandEnabled("upload")?"addClass":"removeClass"]("native-droppable"),et.droppable("enable"))},Z=e(this).addClass("ui-helper-clearfix elfinder-cwd").attr("unselectable","on").on("click."+t.namespace,u,function(n){var i,a=this.id?e(this):e(this).parents("[id]:first"),s=a.prevAll("."+p+":first"),l=a.nextAll("."+p+":first"),d=s.length,c=l.length;if(Z.data("longtap"))return n.stopPropagation(),void 0;if(n.stopImmediatePropagation(),n.shiftKey&&(d||c))i=d?a.prevUntil("#"+s.attr("id")):a.nextUntil("#"+l.attr("id")),i.add(a).trigger(r);else if(n.ctrlKey||n.metaKey)a.trigger(a.hasClass(p)?o:r);else{if(a.data("touching")&&a.hasClass(p))return a.data("touching",null),t.dblclick({file:t.cwdId2Hash(this.id)}),E(),void 0;E(),a.trigger(r)}j()}).on("dblclick."+t.namespace,u,function(){t.dblclick({file:t.cwdId2Hash(this.id)})}).on("touchstart."+t.namespace,u,function(n){if(n.stopPropagation(),"INPUT"!=n.target.nodeName&&"TEXTAREA"!=n.target.nodeName){var i=this.id?e(this):e(this).parents("[id]:first"),a=i.prevAll("."+p+":first").length+i.nextAll("."+p+":first").length;Z.data("longtap",null),i.addClass(g).data("touching",!0).data("tmlongtap",setTimeout(function(){Z.data("longtap",!0),i.hasClass(p)&&a>0?(i.trigger(o),j()):("TD"!=n.target.nodeName||t.selected().length>0)&&(i.trigger(r),j(),t.trigger("contextmenu",{type:"files",targets:t.selected(),x:n.originalEvent.touches[0].pageX,y:n.originalEvent.touches[0].pageY}))},500))}}).on("touchmove."+t.namespace+" touchend."+t.namespace,u,function(t){if(t.stopPropagation(),"INPUT"!=t.target.nodeName&&"TEXTAREA"!=t.target.nodeName){var n=this.id?e(this):e(this).parents("[id]:first");clearTimeout(n.data("tmlongtap")),"touchmove"==t.type&&n.removeClass(g)}}).on("mouseenter."+t.namespace,u,function(){var n=e(this),o=null,s=a?n:n.children("div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename");i||n.hasClass(b)||s.hasClass(f+" "+h)||s.on("mousedown",function(n){n.shiftKey&&!t.UA.IE&&Z.data("selectable")&&(Z.selectable("destroy").data("selectable",!1),setTimeout(function(){Z.selectable(q).data("selectable",!0)},10)),s.draggable("option","disabled",n.shiftKey),n.shiftKey?s.attr("draggable","true"):s.attr("draggable","false").draggable("option","cursorAt",{left:50-parseInt(e(n.currentTarget).css("margin-left")),top:47})}).on("dragstart",function(n){var i=n.dataTransfer||n.originalEvent.dataTransfer||null;if(o=null,i&&!t.UA.IE){var a,s=this.id?e(this):e(this).parents("[id]:first"),l=e("<span>"),d="",c=null,u=null,p=[],h=function(n){var i,a=n.mime;return i='<div class="elfinder-cwd-icon '+t.mime2class(a)+' ui-corner-all"/>',n.tmb&&1!==n.tmb&&(i=e(i).css("background","url('"+t.option("tmbUrl")+n.tmb+"') center center no-repeat").get(0).outerHTML),i},f=[];if(s.trigger(r),j(),e.each(D,function(n,i){var a=t.file(i),r=a.url;if(a&&"directory"!==a.mime){if(r){if("1"==r)return f.push(i),!0}else r=t.url(a.hash);r&&(r=t.convAbsUrl(r),p.push(i),e("<a>").attr("href",r).text(r).appendTo(l),d+=r+"\n",c||(c=a.mime+":"+a.name+":"+r),u||(u=r+"\n"+a.name))}}),f.length)return e.each(f,function(e,n){var i=t.file(n);i.url="",t.request({data:{cmd:"url",target:n},notify:{type:"url",cnt:1},preventDefault:!0}).always(function(e){i.url=e.url?e.url:"1"})}),!1;if(!d)return!1;i.setDragImage&&(o=e('<div class="elfinder-drag-helper html5-native"></div>').append(h(t.file(p[0]))).appendTo(e(document.body)),(a=p.length)>1&&o.append(h(t.file(p[a-1]))+'<span class="elfinder-drag-num">'+a+"</span>"),i.setDragImage(o.get(0),50,47)),i.effectAllowed="copyLink",i.setData("DownloadURL",c),i.setData("text/x-moz-url",u),i.setData("text/uri-list",d),i.setData("text/plain",d),i.setData("text/html",l.html()),i.setData("elfinderfrom",window.location.href+t.cwd().hash),i.setData("elfinderfrom:"+i.getData("elfinderfrom"),"")}}).on("dragend",function(){E(),o&&o.remove()}).draggable(t.draggable)}).on(r,u,function(){var n=e(this),i=t.cwdId2Hash(n.attr("id"));z||n.hasClass(h)||(n.addClass(p).children().addClass(g),-1===e.inArray(i,D)&&D.push(i))}).on(o,u,function(){var n,i=e(this),a=t.cwdId2Hash(i.attr("id"));z||(e(this).removeClass(p).children().removeClass(g),n=e.inArray(a,D),-1!==n&&D.splice(n,1))}).on(s,u,function(){var t=e(this).removeClass(g+" "+p).addClass(h),n=t.children(),i=a?t:n;n.removeClass(g+" "+p),t.hasClass(m)&&t.droppable("disable"),i.hasClass(f)&&i.draggable("disable")}).on(l,u,function(){var t=e(this).removeClass(h),n=a?t:t.children();t.hasClass(m)&&t.droppable("enable"),n.hasClass(f)&&n.draggable("enable")}).on("scrolltoview",u,function(){H(e(this))}).on("mouseenter."+t.namespace+" mouseleave."+t.namespace,u,function(n){t.trigger("hover",{hash:t.cwdId2Hash(e(this).attr("id")),type:n.type}),e(this).toggleClass(g,"mouseenter"==n.type)}).on("contextmenu."+t.namespace,function(n){var i=e(n.target).closest("."+c);i.length&&("TD"!=n.target.nodeName||e.inArray(t.cwdId2Hash(i.get(0).id),t.selected())>-1)&&(n.stopPropagation(),n.preventDefault(),i.hasClass(h)||i.data("touching")||(i.hasClass(p)||(E(),i.trigger(r),j()),t.trigger("contextmenu",{type:"files",targets:t.selected(),x:n.pageX,y:n.pageY})))}).on("click."+t.namespace,function(e){return Z.data("longtap")?(e.stopPropagation(),void 0):(!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&E(),void 0)}).selectable(q).data("selectable",!0).on("create."+t.namespace,function(t,n){var i=a?Z.find("tbody"):Z,r=i.find(".elfinder-cwd-parent"),n=e(S(n)).addClass(b);E(),r.length?r.after(n):i.prepend(n),Z.parent().scrollTop(0)}).on("unselectall",E).on("selectfile",function(n,i){e("#"+t.cwdHash2Id(i)).trigger(r),j()}),et=e('<div class="elfinder-cwd-wrapper"/>').droppable(e.extend({},$,{autoDisable:!1})).on("contextmenu",function(e){e.preventDefault(),t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:e.pageX,y:e.pageY})}).on("touchstart."+t.namespace,function(n){var i=e(this);Z.data("longtap",null),i.data("touching",!0),i.data("tmlongtap",setTimeout(function(){Z.data("longtap",!0),t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:n.originalEvent.touches[0].pageX,y:n.originalEvent.touches[0].pageY})},500))}).on("touchmove."+t.namespace+" touchend."+t.namespace,function(){clearTimeout(e(this).data("tmlongtap"))}).on("mousedown",function(){et._mousedown=!0}).on("mouseup",function(){et._mousedown=!1}),tt=e("<div>&nbsp;</div>").css({position:"absolute",width:"1px",height:"1px"}).hide(),nt=null,it=function(t){var n=function(){var t=0;et.siblings("div.elfinder-panel:visible").each(function(){t+=e(this).outerHeight(!0)}),et.height(rt.height()-t-et._padding)};t&&n(),nt&&clearTimeout(nt),nt=setTimeout(function(){!t&&n();var e,i;Z.css("height","auto"),e=et[0].clientHeight-parseInt(et.css("padding-top"))-parseInt(et.css("padding-bottom")),i=Z.outerHeight(!0),e>i&&Z.height(e)},20)},at=e(this).parent().resize(it),rt=at.children(".elfinder-workzone").append(et.append(this).append(tt));e("body").on("touchstart touchmove touchend",function(){}),t.one("init",function(){var e,n=document.createElement("style");document.head.appendChild(n),e=n.sheet,e.insertRule('.elfinder-cwd-wrapper-empty .elfinder-cwd:after{ content:"'+t.i18n("emptyFolder")+'" }',0),e.insertRule('.ui-droppable.elfinder-cwd-wrapper-empty .elfinder-cwd:after{ content:"'+t.i18n("emptyFolder"+(i?"LTap":"Drop"))+'" }',1),e.insertRule('.ui-droppable.elfinder-cwd-wrapper-empty.ui-droppable-disabled .elfinder-cwd:after{ content:"'+t.i18n("emptyFolder")+'" }',2)}).bind("open",function(e){Q(e.data.files),it()}).bind("search",function(e){x=e.data.files,Q(x,!0),et.addClass("elfinder-search-result"),t.autoSync("stop"),it()}).bind("searchend",function(e){x=[],w&&(w="",e.data&&e.data.noupdate||Q(t.files())),et.removeClass("elfinder-search-result"),t.autoSync(),it()}).bind("searchstart",function(e){w=e.data.query}).bind("sortchange",function(){Q(w?x:t.files(),!!w)}).bind("viewchange",function(){var n=t.selected(),i="list"==t.storage("view");i!=a&&(a=i,Q(w?x:t.files(),!!w),e.each(n,function(e,t){O(t)}),j()),it()}).bind("resize",function(){var e=a?Z.find("tbody"):Z;it(!0),Y(e,e.find("[id]").length)}).bind("add",function(){it()}).add(function(n){var i=t.cwd().hash,a=w?e.map(n.data.added||[],function(e){return-1===e.name.indexOf(w)?null:e}):e.map(n.data.added||[],function(e){return e.phash==i?e:null});K(a)}).change(function(n){var i=t.cwd().hash,a=t.selected();w?e.each(n.data.changed||[],function(t,n){J([n.hash]),-1!==n.name.indexOf(w)&&(K([n]),-1!==e.inArray(n.hash,a)&&O(n.hash))}):e.each(e.map(n.data.changed||[],function(e){return e.phash==i?e:null}),function(t,n){J([n.hash]),K([n]),-1!==e.inArray(n.hash,a)&&O(n.hash)}),j()}).remove(function(e){J(e.data.removed||[]),j()}).dragstart(function(t){var n=e(t.data.target),i=t.data.originalEvent;n.hasClass(u.substr(1))&&(n.hasClass(p)||(!(i.ctrlKey||i.metaKey||i.shiftKey)&&E(),n.trigger(r),j())),Z.selectable("disable").removeClass(h),z=!0}).dragstop(function(){Z.selectable("enable"),z=!1}).bind("lockfiles unlockfiles selectfiles unselectfiles",function(n){var i,a,d={lockfiles:s,unlockfiles:l,selectfiles:r,unselectfiles:o},c=d[n.type],u=n.data.files||[],p=u.length,h=n.data.helper||e();if(p>0&&(i=t.parents(u[0])),!h.data("locked")){for(;p--;)e("#"+t.cwdHash2Id(u[p])).trigger(c);j()}et.data("dropover")&&-1!==i.indexOf(et.data("dropover"))&&(a="lockfiles"!==n.type,h.toggleClass("elfinder-drag-helper-plus",a),et.toggleClass(v,a))}).bind("mkdir mkfile duplicate upload rename archive extract paste multiupload",function(n){if("upload"!=n.type||!n.data._multiupload){var i=t.cwd().hash;E(),e.each(n.data.added||[],function(e,t){t&&t.phash==i&&O(t.hash)}),j()}}).shortcut({pattern:"ctrl+a",description:"selectall",callback:U}).shortcut({pattern:"left right up down shift+left shift+right shift+up shift+down",description:"selectfiles",type:"keydown",callback:function(e){A(e.keyCode,e.shiftKey)}}).shortcut({pattern:"home",description:"selectffile",callback:function(){E(),H(Z.find("[id]:first").trigger(r)),j()}}).shortcut({pattern:"end",description:"selectlfile",callback:function(){E(),H(Z.find("[id]:last").trigger(r)),j()}})}),this},e.fn.elfinderdialog=function(t){var n;return"string"==typeof t&&(n=this.closest(".ui-dialog")).length&&("open"==t?"none"==n.css("display")&&n.fadeIn(120,function(){n.trigger("open")}):"close"==t?"none"!=n.css("display")&&n.hide().trigger("close"):"destroy"==t?n.hide().remove():"toTop"==t?n.trigger("totop"):"posInit"==t&&n.trigger("posinit")),t=e.extend({},e.fn.elfinderdialog.defaults,t),this.filter(":not(.ui-dialog-content)").each(function(){var n=e(this).addClass("ui-dialog-content ui-widget-content"),i=n.parent(),a="elfinder-dialog-active",r="elfinder-dialog",o="elfinder-dialog-notify",s="ui-state-hover",l=parseInt(1e6*Math.random()),d=i.children(".elfinder-overlay"),c=e('<div class="ui-dialog-buttonset"/>'),u=e('<div class=" ui-helper-clearfix ui-dialog-buttonpane ui-widget-content"/>').append(c),p=-1!=window.navigator.platform.indexOf("Win"),h=e('<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable std42-dialog '+r+" "+t.cssClass+'"/>').hide().append(n).appendTo(i).draggable({handle:".ui-dialog-titlebar",containment:"document",stop:function(){h.css({height:t.height})}}).css({width:t.width,height:t.height}).mousedown(function(t){t.stopPropagation(),e(document).mousedown(),h.hasClass(a)||(i.find("."+r+":visible").removeClass(a),h.addClass(a).zIndex(f()+1))}).on("open",function(){var a=e(this),s=a.outerWidth()>i.width()-10?i.width()-10:null;s&&a.css({width:s,left:"5px"}),h.trigger("totop"),"function"==typeof t.open&&e.proxy(t.open,n[0])(),h.hasClass(o)||i.find("."+r+":visible").not("."+o).each(function(){var t=e(this),n=parseInt(t.css("top")),i=parseInt(t.css("left")),a=parseInt(h.css("top")),r=parseInt(h.css("left"));t[0]==h[0]||n!=a&&i!=r||h.css({top:n+(s?15:10)+"px",left:(s?5:i+10)+"px"})})}).on("close",function(){var a=i.find(".elfinder-dialog:visible"),r=f();e(this).data("modal")&&d.elfinderoverlay("hide"),a.length?a.each(function(){var t=e(this);return t.zIndex()>=r?(t.trigger("totop"),!1):void 0}):setTimeout(function(){i.mousedown().click()},10),"function"==typeof t.close?e.proxy(t.close,n[0])():t.destroyOnClose&&h.hide().remove()}).on("totop",function(){e(this).mousedown().find(".ui-button:"+(p?"first":"last")).focus().end().find(":text:first").focus(),e(this).data("modal")&&d.is(":hidden")&&d.elfinderoverlay("show"),d.zIndex(e(this).zIndex())}).on("posinit",function(){var e=t.position;e||(e={top:Math.max(0,parseInt((i.height()-h.outerHeight())/2-42))+"px",left:Math.max(0,parseInt((i.width()-h.outerWidth())/2))+"px"}),h.css(e)}).data({modal:t.modal}),f=function(){var t=i.zIndex()+10;return i.find("."+r+":visible").each(function(){var n;this!=h[0]&&(n=e(this).zIndex(),n>t&&(t=n))}),t};h.trigger("posinit"),t.closeOnEscape&&e(document).on("keyup."+l,function(t){t.keyCode==e.ui.keyCode.ESCAPE&&h.hasClass(a)&&(n.elfinderdialog("close"),e(document).off("keyup."+l))}),h.prepend(e('<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">'+t.title+"</div>").prepend(e('<a href="#" class="ui-dialog-titlebar-close ui-corner-all"><span class="ui-icon ui-icon-closethick"/></a>').mousedown(function(e){e.preventDefault(),n.elfinderdialog("close")}))),e.each(t.buttons,function(i,a){var r=e('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+i+"</span></button>").click(e.proxy(a,n[0])).hover(function(n){t.btnHoverFocus?e(this)["mouseenter"==n.type?"focus":"blur"]():e(this).toggleClass(s,"mouseenter"==n.type)}).focus(function(){e(this).addClass(s)}).blur(function(){e(this).removeClass(s)}).keydown(function(t){var n;t.keyCode==e.ui.keyCode.ENTER?e(this).click():t.keyCode==e.ui.keyCode.TAB||t.keyCode==e.ui.keyCode.RIGHT?(t.preventDefault(),n=e(this).next(".ui-button"),n.length?n.focus():e(this).parent().children(".ui-button:first").focus()):t.keyCode==e.ui.keyCode.LEFT&&(t.preventDefault(),n=e(this).prev(".ui-button"),n.length?n.focus():e(this).parent().children(".ui-button:last").focus())});p?c.append(r):c.prepend(r)}),c.children().length&&h.append(u),t.resizable&&e.fn.resizable&&h.resizable({minWidth:t.minWidth,minHeight:t.minHeight,alsoResize:this}),"function"==typeof t.create&&e.proxy(t.create,this)(),t.autoOpen&&n.elfinderdialog("open")}),this},e.fn.elfinderdialog.defaults={cssClass:"",title:"",modal:!1,resizable:!0,autoOpen:!0,closeOnEscape:!0,destroyOnClose:!1,buttons:{},btnHoverFocus:!0,position:null,width:320,height:"auto",minWidth:200,minHeight:110},e.fn.elfindernavbar=function(t,n){return this.not(".elfinder-navbar").each(function(){var i,a=e(this).addClass("ui-state-default elfinder-navbar"),r=a.parent().resize(function(){a.height(o.height()-s)}),o=r.children(".elfinder-workzone").append(a),s=a.outerHeight()-a.height(),l="ltr"==t.direction;if(e.fn.resizable){if(i=a.resizable({handles:l?"e":"w",minWidth:n.minWidth||150,maxWidth:n.maxWidth||500}).on("resize scroll",function(){var e=t.UA.Opera&&a.scrollLeft()?20:2;i.css({top:parseInt(a.scrollTop())+"px",left:l?"auto":parseInt(a.scrollLeft()+e),right:l?-1*parseInt(a.scrollLeft()-e):"auto"})}).find(".ui-resizable-handle").zIndex(a.zIndex()+10),t.UA.Touch){var d=function(){i.data("closed")?(i.data("closed",!1).css({backgroundColor:"transparent"}),a.css({width:i.data("width")}).trigger("resize")):(i.data("closed",!0).css({backgroundColor:"inherit"}),a.css({width:8})),i.data({startX:null,endX:null})};i.data({closed:!1,width:a.width()}).on("touchstart",function(e){i.data("startX",e.originalEvent.touches[0].pageX)}).on("touchmove",function(e){var t=e.originalEvent.touches[0].pageX,n=i.data("startX"),a=l?n&&t>n:n>t,r=l?n>t:n&&t>n;(a||r)&&d()}).on("touchend",function(){i.data("startX")&&d()}),t.UA.Mobile&&(i.data("defWidth",a.width()),e(window).on("resize",function(){var e=a.parent().width()/2;i.data("defWidth")>e?a.width(e):a.width(i.data("defWidth")),i.data("width",a.width())}))}t.one("open",function(){setTimeout(function(){a.trigger("resize")},150)})}}),this},e.fn.elfinderoverlay=function(t){if(this.filter(":not(.elfinder-overlay)").each(function(){t=e.extend({},t),e(this).addClass("ui-widget-overlay elfinder-overlay").hide().mousedown(function(e){e.preventDefault(),e.stopPropagation()}).data({cnt:0,show:"function"==typeof t.show?t.show:function(){},hide:"function"==typeof t.hide?t.hide:function(){}})}),"show"==t){var n=this.eq(0),i=n.data("cnt")+1,a=n.data("show");n.data("cnt",i),n.is(":hidden")&&(n.zIndex(n.parent().zIndex()+1),n.show(),a())}if("hide"==t){var n=this.eq(0),i=n.data("cnt")-1,r=n.data("hide");n.data("cnt",i),0==i&&n.is(":visible")&&(n.hide(),r())}return this},e.fn.elfinderpanel=function(t){return this.each(function(){var n=e(this).addClass("elfinder-panel ui-state-default ui-corner-all"),i="margin-"+("ltr"==t.direction?"left":"right");t.one("load",function(){var e=t.getUI("navbar");n.css(i,parseInt(e.outerWidth(!0))),e.on("resize",function(){n.is(":visible")&&n.css(i,parseInt(e.outerWidth(!0)))})})})},e.fn.elfinderpath=function(t){return this.each(function(){var n="",i="",a=[],r=e(this).addClass("elfinder-path").html("&nbsp;").on("click","a",function(i){var r=e(this).attr("href").substr(5);i.preventDefault(),r!=t.cwd().hash&&(n?t.exec("search",n,{target:r,mime:a.join(" ")}):t.exec("open",r))}).prependTo(t.getUI("statusbar").show());t.bind("open searchend parents",function(){var o=[];n="",i="",a=[],e.each(t.parents(t.cwd().hash),function(e,n){o.push('<a href="#elf_'+n+'">'+t.escape(t.file(n).name)+"</a>")}),r.html(o.join(t.option("separator")))}).bind("searchstart",function(e){e.data&&(n=e.data.query||"",i=e.data.target||"",a=e.data.mimes||[])}).bind("search",function(){var n=[],a="";i?(e.each(t.parents(i),function(e,i){n.push('<a href="#elf_'+i+'">'+t.escape(t.file(i).name)+"</a>")}),a=n.join(t.option("separator"))):a=t.i18n("btnAll"),r.html(t.i18n("searcresult")+": "+a)})})},e.fn.elfinderplaces=function(t,n){return this.each(function(){var i={},a="class",r=t.res(a,"navdir"),o=t.res(a,"navcollapse"),s=t.res(a,"navexpand"),l=t.res(a,"hover"),d=t.res(a,"treeroot"),c=t.res(a,"adroppable"),u=t.res("tpl","placedir"),p=t.res("tpl","perms"),h=e(t.res("tpl","navspinner")),f="places"+(n.suffix?n.suffix:""),m=null,g=function(e){return e.substr(6)},v=function(e){return"place-"+e},b=function(){var n=[],a=[];n=e.map(M.children().find("[id]"),function(e){return g(e.id)}),e.each(n.reverse(),function(e,t){a.push(t+"#"+i[t].name)}),t.storage(f,a.join(","))},y=function(n,i){return e(u.replace(/\{id\}/,v(n?n.hash:i)).replace(/\{name\}/,t.escape(n?n.name:i)).replace(/\{cssclass\}/,n?(t.UA.Touch?"elfinder-touch ":"")+t.perms2class(n):"").replace(/\{permissions\}/,!n||n.read&&n.write?"":p).replace(/\{title\}/,n&&n.path?t.escape(n.path):"").replace(/\{symlink\}/,"").replace(/\{style\}/,""))},w=function(e){var n,a;return"directory"!==e.mime?!1:(a=e.hash,t.files().hasOwnProperty(a)||t.trigger("tree",{tree:[e]}),n=y(e,a),e.notfound&&n.addClass("ui-state-disabled"),i[a]=e,M.prepend(n),F.addClass(o),!0)},x=function(t){var n,a=null;return i[t]&&(delete i[t],n=e("#"+v(t)),n.length&&(a=n.text(),n.parent().remove(),M.children().length||(F.removeClass(o),P.removeClass(s),M.slideToggle(!1)))),a},k=function(n){var i=e("#"+v(n)),a=i.parent(),r=a.prev("div"),o="ui-state-hover",s=t.getUI("contextmenu");m&&clearTimeout(m),r.length&&(s.find(":first").data("placesHash",n),i.addClass(o),a.insertBefore(r),r=a.prev("div"),m=setTimeout(function(){i.removeClass(o),s.find(":first").data("placesHash")===n&&s.hide().empty()},1500)),r.length||(i.removeClass(o),s.hide().empty())},C=function(t,n){var a=t.hash,r=e("#"+v(n||a)),o=y(t,a);return r.length>0?(t.notfound&&o.addClass("ui-state-disabled"),r.parent().replaceWith(o),i[a]=t,!0):!1},T=function(){e.each(i,function(n,i){var a=t.file(n)||i,o=y(a,n),s=null;return a||o.hide(),M.children().length&&(e.each(M.children(),function(){var t=e(this);return a.name.localeCompare(t.children("."+r).text())<0?s=!o.insertBefore(t):void 0}),null!==s)?!0:(!e("#"+v(n)).length&&M.append(o),void 0)}),b()},I=y({hash:"root-"+t.namespace,name:t.i18n(n.name,"places"),read:!0,write:!0}),F=I.children("."+r).addClass(d).click(function(e){e.stopPropagation(),F.hasClass(o)&&(P.toggleClass(s),M.slideToggle(),t.storage("placesState",P.hasClass(s)?1:0))}).append(e('<span class="elfinder-button-icon elfinder-button-icon-sort elfinder-places-root-icon" title="'+t.i18n("cmdsort")+'"/>').on("click",function(e){e.stopPropagation(),M.empty(),T()})),M=I.children("."+t.res(a,"navsubtree")).sortable({appendTo:"body",revert:!1,helper:function(n){var i=e(n.target).parent();return i.children().removeClass("ui-state-hover"),e('<div class="ui-widget elfinder-place-drag elfinder-'+t.direction+'"/>').append(e('<div class="elfinder-navbar"/>').show().append(i.clone()))},stop:function(t,n){var i=e(n.item[0]),a=P.offset().top,r=P.offset().left,o=P.width(),s=P.height(),l=t.pageX,d=t.pageY;l>r&&r+o>l&&d>a&&d+s>d||(x(g(i.children(":first").attr("id"))),b())},update:function(){b()}}),P=e(this).addClass(t.res(a,"tree")+" elfinder-places ui-corner-all").hide().append(I).appendTo(t.getUI("navbar")).on("mouseenter mouseleave","."+r,function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click","."+r,function(n){var i=e(this);return i.data("longtap")?(n.stopPropagation(),void 0):(t.exec("open",i.attr("id").substr(6)),void 0)}).on("contextmenu","."+r+":not(."+d+")",function(n){var i=e(this),a=i.attr("id").substr(6);n.preventDefault(),t.trigger("contextmenu",{raw:[{label:t.i18n("moveUp"),icon:"up",remain:!0,callback:function(){k(a),b()}},"|",{label:t.i18n("rmFromPlaces"),icon:"rm",callback:function(){x(a),b()}}],x:n.pageX,y:n.pageY}),i.addClass("ui-state-hover"),t.getUI("contextmenu").children().on("mouseenter",function(){i.addClass("ui-state-hover")}),t.bind("closecontextmenu",function(){i.removeClass("ui-state-hover")})}).droppable({tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-tree-dir,.elfinder-cwd-file",hoverClass:t.res("class","adroppable"),over:function(n,a){var r=a.helper,o=e.map(r.data("files"),function(e){return"directory"!==t.file(e).mime||i[e]?null:e});n.stopPropagation(),r.data("dropover",r.data("dropover")+1),o.length>0?r.addClass("elfinder-drag-helper-plus"):e(this).removeClass(c),t.trigger("unlockfiles",{files:r.data("files"),helper:r})},out:function(n,i){var a=i.helper;n.stopPropagation(),a.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus").data("dropover",Math.max(a.data("dropover")-1,0)),e(this).removeData("dropover").removeClass(c),t.trigger("unlockfiles",{files:a.data("files"),helper:a})},drop:function(n,a){var r=a.helper,o=!0;e.each(r.data("files"),function(e,n){var a=t.file(n);a&&"directory"==a.mime&&!i[a.hash]?w(a):o=!1}),b(),o&&r.hide()}}).on("touchstart","."+r+":not(."+d+")",function(n){var i=e(this).attr("id").substr(6),a=e(this).addClass(l).data("longtap",null).data("tmlongtap",setTimeout(function(){a.data("longtap",!0),t.trigger("contextmenu",{raw:[{label:t.i18n("rmFromPlaces"),icon:"rm",callback:function(){x(i),b()}}],x:n.originalEvent.touches[0].pageX,y:n.originalEvent.touches[0].pageY})},500))}).on("touchmove touchend","."+r+":not(."+d+")",function(t){clearTimeout(e(this).data("tmlongtap")),"touchmove"==t.type&&e(this).removeClass(l)});e(this).on("regist",function(t,n){var a=!1;e.each(n,function(e,t){t&&"directory"==t.mime&&!i[t.hash]&&w(t)&&(a=!0)}),a&&b()}),t.one("load",function(){var n,a;t.oldAPI||(P.show().parent().show(),i={},n=e.map((t.storage(f)||"").split(","),function(e){return e||null}),e.each(n,function(e,t){var n=t.split("#");i[n[0]]=n[1]?n[1]:{hash:n[0],name:n[0]}}),a=Object.keys(i),a.length&&(F.prepend(h),t.request({data:{cmd:"info",targets:a},preventDefault:!0}).done(function(n){var a={};e.each(n.files,function(e,t){var n=t.hash;a[n]=t}),e.each(i,function(e,t){w(a[e]||{hash:e,name:t,mime:"directory",notfound:!0})}),t.storage("placesState")>0&&F.click()}).always(function(){h.remove()})),t.change(function(t){var n=!1;e.each(t.data.changed,function(e,t){i[t.hash]&&("directory"!==t.mime?x(t.hash)&&(n=!0):C(t)&&(n=!0))}),n&&b()}).bind("rename",function(t){var n=!1;t.data.removed&&e.each(t.data.removed,function(e,i){t.data.added[e]&&C(t.data.added[e],i)&&(n=!0)}),n&&b()}).bind("rm paste",function(t){var n=[],i=!1;t.data.removed&&e.each(t.data.removed,function(e,t){var i=x(t);i&&n.push(i)}),n.length&&(i=!0),t.data.added&&n.length&&e.each(t.data.added,function(t,i){1!==e.inArray(i.name,n)&&"directory"==i.mime&&w(i)}),i&&b()}).bind("sync",function(){var n=Object.keys(i);n.length&&(F.prepend(h),t.request({data:{cmd:"info",targets:n},preventDefault:!0}).done(function(n){var a={},r=!1,o=t.cwd().hash;e.each(n.files||[],function(e,n){var i=n.hash;a[i]=n,t.files().hasOwnProperty(n.hash)||t.trigger("tree",{tree:[n]})}),e.each(i,function(e,t){!t.notfound!=!!a[e]&&(t.phash===o||a[e]&&"directory"!==a[e].mime?x(e)&&(r=!0):C(a[e]||{hash:e,name:t.name,mime:"directory",notfound:!0})&&(r=!0))}),r&&b()}).always(function(){h.remove()}))}))})})},e.fn.elfindersearchbutton=function(t){return this.each(function(){var n=!1,i=t.fm,a=function(e){return i.namespace+e},r=i.getUI("toolbar"),o=i.res("class","searchbtn"),s=e(this).hide().addClass("ui-widget-content elfinder-button "+o),l=function(){u.slideUp();var r=e.trim(c.val()),o=!e("#"+a("SearchFromAll")).prop("checked"),s=e("#"+a("SearchMime")).prop("checked");o&&(o=e("#"+a("SearchFromVol")).prop("checked")?i.root(i.cwd().hash):i.cwd().hash),s&&(s=r,r="."),r?t.exec(r,o,s).done(function(){n=!0,c.focus()}):i.trigger("searchend")},d=function(){u.slideUp(),c.val(""),n&&(n=!1,i.trigger("searchend"))},c=e('<input type="text" size="42"/>').focus(function(){u.slideDown()}).blur(function(){u.data("infocus")?u.data("infocus",!1):u.slideUp()}).appendTo(s).keypress(function(e){e.stopPropagation()}).keydown(function(e){e.stopPropagation(),13==e.keyCode&&l(),27==e.keyCode&&(e.preventDefault(),d())}),u=e('<div class="ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>').append(e('<div class="buttonset"/>').append(e('<input id="'+a("SearchFromCwd")+'" name="serchfrom" type="radio" checked="checked"/><label for="'+a("SearchFromCwd")+'">'+i.i18n("btnCwd")+"</label>")).append(e('<input id="'+a("SearchFromVol")+'" name="serchfrom" type="radio"/><label for="'+a("SearchFromVol")+'">'+i.i18n("btnVolume")+"</label>")).append(e('<input id="'+a("SearchFromAll")+'" name="serchfrom" type="radio"/><label for="'+a("SearchFromAll")+'">'+i.i18n("btnAll")+"</label>"))).append(e('<div class="buttonset"/>').append(e('<input id="'+a("SearchName")+'" name="serchcol" type="radio" checked="checked"/><label for="'+a("SearchName")+'">'+i.i18n("btnFileName")+"</label>")).append(e('<input id="'+a("SearchMime")+'" name="serchcol" type="radio"/><label for="'+a("SearchMime")+'">'+i.i18n("btnMime")+"</label>"))).hide().zIndex(12+s.zIndex()).css("overflow","hidden").appendTo(s);e('<span class="ui-icon ui-icon-search" title="'+t.title+'"/>').appendTo(s).click(l),e('<span class="ui-icon ui-icon-close"/>').appendTo(s).click(d),e(function(){u.find("div.buttonset").buttonset(),e("#"+a("SearchFromAll")).next("label").attr("title",i.i18n("searchTarget",i.i18n("btnAll"))),e("#"+a("SearchMime")).next("label").attr("title",i.i18n("searchMime")),u.find("input").on("mousedown",function(){u.data("infocus",!0)}).on("click",function(){e.trim(c.val())&&l()})}),r.on("load",function(){var e=s.parent();if(e.length){if(r.children("."+o).remove(),r.prepend(s.show()),e.remove(),i.UA.ltIE7){var t=s.children("ltr"==i.direction?".ui-icon-close":".ui-icon-search");t.css({right:"",left:parseInt(s.width())-t.outerWidth(!0)})}i.resize()}}),i.select(function(){c.blur()}).bind("searchend",function(){c.val("")}).bind("open parents",function(){var t=[],n=i.file(i.root(i.cwd().hash));n&&(e.each(i.parents(i.cwd().hash),function(e,n){t.push(i.file(n).name)}),e("#"+a("SearchFromCwd")).next("label").attr("title",i.i18n("searchTarget",t.join(i.option("separator")))),e("#"+a("SearchFromVol")).next("label").attr("title",i.i18n("searchTarget",n.name)))}).shortcut({pattern:"ctrl+f f3",description:t.title,callback:function(){c.select().focus()}})})},e.fn.elfindersortbutton=function(t){return this.each(function(){var n=t.fm,i=t.name,a="class",r=n.res(a,"disabled"),o=n.res(a,"hover"),s="elfinder-button-menu-item",l=s+"-selected",d=l+"-asc",c=l+"-desc",u=e(this).addClass("ui-state-default elfinder-button elfinder-menubutton elfiner-button-"+i).attr("title",t.title).append('<span class="elfinder-button-icon elfinder-button-icon-'+i+'"/>').hover(function(){!u.hasClass(r)&&u.toggleClass(o)}).click(function(e){u.hasClass(r)||(e.stopPropagation(),p.is(":hidden")&&t.fm.getUI().click(),p.slideToggle(100))}),p=e('<div class="ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>').hide().appendTo(u).zIndex(12+u.zIndex()).on("mouseenter mouseleave","."+s,function(){e(this).toggleClass(o)}).on("click","."+s,function(e){e.preventDefault(),e.stopPropagation(),f()}),h=function(){p.children(":not(:last)").removeClass(l+" "+d+" "+c).filter('[rel="'+n.sortType+'"]').addClass(l+" "+("asc"==n.sortOrder?d:c)),p.children(":last").toggleClass(l,n.sortStickFolders)},f=function(){p.hide()};e.each(n.sortRules,function(t){p.append(e('<div class="'+s+'" rel="'+t+'"><span class="ui-icon ui-icon-arrowthick-1-n"/><span class="ui-icon ui-icon-arrowthick-1-s"/>'+n.i18n("sort"+t)+"</div>").data("type",t))}),p.children().click(function(){var i=e(this).attr("rel");t.exec([],{type:i,order:i==n.sortType?"asc"==n.sortOrder?"desc":"asc":n.sortOrder,stick:n.sortStickFolders})}),e('<div class="'+s+" "+s+'-separated"><span class="ui-icon ui-icon-check"/>'+n.i18n("sortFoldersFirst")+"</div>").appendTo(p).click(function(){t.exec([],{type:n.sortType,order:n.sortOrder,stick:!n.sortStickFolders})}),n.bind("disable select",f).getUI().click(f),n.bind("sortchange",h),p.children().length>1?t.change(function(){u.toggleClass(r,t.disabled()),h()}).change():u.addClass(r)})},e.fn.elfinderstat=function(t){return this.each(function(){var n=e(this).addClass("elfinder-stat-size"),i=e('<div class="elfinder-stat-selected"/>').on("click","a",function(n){var i=e(this).data("hash");n.preventDefault(),t.exec("opendir",[i])
13
- }),a=t.i18n("size").toLowerCase(),r=t.i18n("items").toLowerCase(),o=t.i18n("selected"),s=function(i,o){var s=0,l=0;e.each(i,function(e,t){o&&t.phash!=o||(s++,l+=parseInt(t.size)||0)}),n.html(r+": "+s+", "+a+": "+t.formatSize(l))},l=!1;t.getUI("statusbar").prepend(n).append(i).show(),t.bind("open reload add remove change searchend",function(){s(t.files(),t.cwd().hash)}).bind("searchend",function(){l=!1}).search(function(e){l=!0,s(e.data.files)}).select(function(){var n,r=0,s=0,d=t.selectedFiles(),c=[];return 1==d.length?(n=d[0],r=n.size,l&&c.push('<a href="#elf_'+n.phash+'" data-hash="'+n.hash+'">'+(n.path?n.path.replace(/\/[^\/]*$/,""):"..")+"</a>"),c.push(t.escape(n.name)),i.html(c.join("/")+(r>0?", "+t.formatSize(r):"")),void 0):(e.each(d,function(e,t){s++,r+=parseInt(t.size)||0}),i.html(s?o+": "+s+", "+a+": "+t.formatSize(r):"&nbsp;"),void 0)})})},e.fn.elfindertoolbar=function(t,n){return this.not(".elfinder-toolbar").each(function(){var i,a,r,o,s,l=t._commands,d=e(this).addClass("ui-helper-clearfix ui-widget-header ui-corner-top elfinder-toolbar"),c=n||[],u=null,p="";d.prev().length&&d.parent().prepend(this);var h=function(t){var n;for(d.empty(),i=c.length;i--;)if(c[i]){for(o=e('<div class="ui-widget-content ui-corner-all elfinder-buttonset"/>'),a=c[i].length;a--;)n=c[i][a],t&&-1!==e.inArray(n,t)||!(r=l[n])||(s="elfinder"+r.options.ui,e.fn[s]&&o.prepend(e("<div/>")[s](r)));o.children().length&&d.prepend(o),o.children(":gt(0)").before('<span class="ui-widget-content elfinder-toolbar-button-separator"/>')}d.children().length?d.show():d.hide(),d.trigger("load")};h(),t.bind("open sync",function(){var n=[],i=t.option("disabled");u&&u.toString()===i.sort().toString()||h(i&&i.length?i:null),u=i.concat().sort(),p!==JSON.stringify(t.commandMap)&&(p=JSON.stringify(t.commandMap),Object.keys(t.commandMap).length&&e.each(t.commandMap,function(i,a){var r=t._commands[a],o=r?"elfinder"+r.options.ui:null;if(o&&e.fn[o]){n.push(i);var s=e("div.elfinder-buttonset div.elfinder-button").has("span.elfinder-button-icon-"+i);s.length&&!s.next().has("span.elfinder-button-icon-"+a).length&&(s.after(e("<div/>")[o](t._commands[a]).data("origin",i)),s.hide())}}),e.each(e("div.elfinder-button"),function(){var t=e(this).data("origin");t&&-1==e.inArray(t,n)&&(e("span.elfinder-button-icon-"+e(this).data("origin")).parent().show(),e(this).remove())}))})}),this},e.fn.elfindertree=function(t,n){var i=t.res("class","tree");return this.not("."+i).each(function(){var a="class",r=t.UA.Mobile,o=t.res(a,"treeroot"),s=n.openRootOnLoad,l=n.openCwdOnOpen,d=t.res(a,"navsubtree"),c=t.res(a,"treedir"),u="span."+c,p=t.res(a,"navcollapse"),h=t.res(a,"navexpand"),f="elfinder-subtree-loaded",m=t.res(a,"navarrow"),g=t.res(a,"active"),v=t.res(a,"adroppable"),b=t.res(a,"hover"),y=t.res(a,"disabled"),w=t.res(a,"draggable"),x=t.res(a,"droppable"),k="elfinder-navbar-wrapper-pastable",C="elfinder-navbar-wrapper-uploadable",T=function(e){var t=$.offset().left;return e>=t&&e<=t+$.width()},I=t.droppable.drop,F=e.extend(!0,{},t.droppable,{over:function(n,i){var a,r,o=e(this),s=i.helper,l=b+" "+v;return n.stopPropagation(),s.data("dropover",s.data("dropover")+1),o.data("dropover",!0),i.helper.data("namespace")!==t.namespace?(o.removeClass(l),!1):(o.addClass(b),o.is("."+p+":not(."+h+")")&&o.data("expandTimer",setTimeout(function(){o.children("."+m).click()},500)),a=t.navId2Hash(o.attr("id")),o.data("dropover",a),e.each(i.helper.data("files"),function(e,n){return n===a||t.file(n).phash===a&&!i.helper.hasClass("elfinder-drag-helper-plus")?(o.removeClass(l),!1):void 0}),s.data("locked")?r="elfinder-drag-helper-plus":(r="elfinder-drag-helper-move",(n.shiftKey||n.ctrlKey||n.metaKey)&&(r+=" elfinder-drag-helper-plus")),o.hasClass(v)&&s.addClass(r),setTimeout(function(){o.hasClass(v)&&s.addClass(r)},20),void 0)},out:function(t,n){var i=e(this),a=n.helper;t.stopPropagation(),a.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus").data("dropover",Math.max(a.data("dropover")-1,0)),i.data("expandTimer")&&clearTimeout(i.data("expandTimer")),i.removeData("dropover").removeClass(b+" "+v)},deactivate:function(){e(this).removeData("dropover").removeClass(b+" "+v)},drop:function(e,t){T(e.clientX)&&I.call(this,e,t)}}),M=e(t.res("tpl","navspinner")),P=t.res("tpl","navdir"),S=t.res("tpl","perms"),z=(t.res("tpl","lock"),t.res("tpl","symlink")),A={id:function(e){return t.navHash2Id(e.hash)},cssclass:function(e){var i=(t.UA.Touch?"elfinder-touch ":"")+(e.phash?"":o)+" "+c+" "+t.perms2class(e);return e.dirs&&!e.link&&(i+=" "+p),n.getClass&&(i+=" "+n.getClass(e)),e.csscls&&(i+=" "+t.escape(e.csscls)),i},permissions:function(e){return e.read&&e.write?"":S},symlink:function(e){return e.alias?z:""},style:function(e){return e.icon?"style=\"background-image:url('"+t.escape(e.icon)+"')\"":""}},D=function(e){return e.name=t.escape(e.i18||e.name),P.replace(/(?:\{([a-z]+)\})/gi,function(t,n){return e[n]||(A[n]?A[n](e):"")})},O=function(t){return e.map(t||[],function(e){return"directory"==e.mime?e:null})},U=function(n){return n?e("#"+t.navHash2Id(n)).next("."+d):L},E=function(n,i){var a,r,o=n.children(":first");for(r=t.naturalCompare;o.length;){if(a=t.file(t.navId2Hash(o.children("[id]").attr("id"))),(a=t.file(t.navId2Hash(o.children("[id]").attr("id"))))&&r(i.name,a.name)<0)return o;o=o.next()}return e("")},j=function(n){for(var i,a,o,s,l,d=n.length,c=[],u=n.length,p={},h=!0;u--;)i=n[u],e("#"+t.navHash2Id(i.hash)).length||((a=U(i.phash)).length?i.phash&&((s=!a.children().length)||(o=E(a,i)).length)?s?(p[i.phash]||(p[i.phash]=[]),p[i.phash].push(i)):o.before(D(i)):(a[h||i.phash?"append":"prepend"](D(i)),h=!1,i.phash||(l=e("#"+t.navHash2Id(i.hash)).parent(),!i.disabled||i.disabled.length<1?l.addClass(k+" "+C):(-1===e.inArray("paste",i.disabled)&&l.addClass(k),-1===e.inArray("upload",i.disabled)&&l.addClass(C)))):c.push(i));return Object.keys(p).length&&e.each(p,function(t,n){var i=U(t),a=[];n.sort(H),e.each(n,function(e,t){a.push(D(t))}),i.append(a.join(""))}),c.length&&c.length<d?j(c):(d&&!r&&N(),void 0)},H=function(e,n){return t.naturalCompare(e.name,n.name)},R=function(){var n=e("#"+t.navHash2Id(t.cwd().hash));if(n.length){var i=L.parent().stop(!1,!0),a=i.offset().top,r=i.height(),o=a+r-n.outerHeight(),s=n.offset().top;(a>s||s>o)&&i.animate({scrollTop:i.scrollTop()+s-a-r/3},{duration:"fast"})}},_=function(i,a){var r,c,v,b,y,w,x=t.cwd(),k=x.hash,C=e("#"+t.navHash2Id(k)),i=i||!1,a=a||[];if(s&&(r=e("#"+t.navHash2Id(t.root())),r.hasClass(f)&&r.addClass(h).next("."+d).show(),s=!1),C.hasClass(g)||(L.find(u+"."+g).removeClass(g),C.addClass(g)),n.syncTree||!C.length){if(C.length)return i||(C.addClass(f),l&&C.hasClass(p)&&C.addClass(h).next("."+d).slideDown()),b=C.parentsUntil("."+o).filter("."+d),y=b.length,w=1,b.show().prev(u).addClass(h,function(){!i&&y==w++&&R()}),!y&&!i&&R(),void 0;if(t.newAPI){if(c=t.file(k),c&&c.phash&&(v=e("#"+t.navHash2Id(c.phash)),v.length&&v.hasClass(f)))return j([c]),_(i),void 0;v=x.root?e("#"+t.navHash2Id(x.root)):null,v&&(M.insertBefore(v.children("."+m)),v.removeClass(p)),t.request({data:{cmd:"parents",target:k},preventFail:!0}).done(function(n){a=e.merge(a,O(n.tree)),j(a),q(a,f),k==t.cwd().hash&&_(i)}).always(function(){v&&(M.remove(),v.addClass(p+" "+f))})}}},N=function(e){var t,n=100;e||(L.find("div."+C).find(u+":not(.elfinder-ro,.elfinder-na)").addClass("native-droppable"),e=L.find("div."+k).find(u+":not(."+x+",.elfinder-ro,.elfinder-na)")),e.length>n&&(t=e.slice(n),e=e.slice(0,n)),e.droppable(F),t&&setTimeout(function(){N(t)},20)},q=function(n,i){var a=i==f?"."+p+":not(."+f+")":":not(."+p+")";e.each(n,function(n,r){e("#"+t.navHash2Id(r.phash)+a).filter(function(){return e(this).next("."+d).children().length>0}).addClass(i)})},L=e(this).addClass(i).on("mouseenter mouseleave",u,function(n){var i=e(this),a="mouseenter"==n.type;i.hasClass(v+" "+y)||(!r&&a&&!i.hasClass(o+" "+w+" elfinder-na elfinder-wo")&&i.draggable(t.draggable),i.toggleClass(b,a))}).on("dropover dropout drop",u,function(t){e(this)["dropover"==t.type?"addClass":"removeClass"](v+" "+b)}).on("click",u,function(n){var i=e(this),a=t.navId2Hash(i.attr("id"));return t.file(a),i.data("longtap")?(n.stopPropagation(),void 0):(t.trigger("searchend",{noupdate:!0}),a==t.cwd().hash||i.hasClass(y)?i.hasClass(p)&&i.children("."+m).click():t.exec("open",a),void 0)}).on("touchstart",u,function(n){n.stopPropagation();var i=n.originalEvent,a=e(this).addClass(b).data("longtap",null).data("tmlongtap",setTimeout(function(){a.data("longtap",!0),t.trigger("contextmenu",{type:"navbar",targets:[t.navId2Hash(a.attr("id"))],x:i.touches[0].pageX,y:i.touches[0].pageY})},500))}).on("touchmove touchend",u,function(t){t.stopPropagation(),clearTimeout(e(this).data("tmlongtap")),"touchmove"==t.type&&e(this).removeClass(b)}).on("click",u+"."+p+" ."+m,function(n){var i,a=e(this),r=a.parent(u),o=r.next("."+d),s=30;n.stopPropagation(),r.hasClass(f)?(r.toggleClass(h),i=r.hasClass(h)?o.children().length+o.find("div.elfinder-navbar-subtree[style*=block]").children().length:o.find("div:visible").length,i>s?(o.toggle(),t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1)):o.stop(!0,!0).slideToggle("normal",function(){t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1)})):(M.insertBefore(a),r.removeClass(p),t.request({cmd:"tree",target:t.navId2Hash(r.attr("id"))}).done(function(e){j(O(e.tree)),o.children().length&&(r.addClass(p+" "+h),o.children().length>s?(o.show(),t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1)):o.stop(!0,!0).slideDown("normal",function(){t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1)})),_(!0)}).always(function(){M.remove(),r.addClass(f)}))}).on("contextmenu",u,function(n){var i=e(this);n.preventDefault(),t.trigger("contextmenu",{type:"navbar",targets:[t.navId2Hash(e(this).attr("id"))],x:n.pageX,y:n.pageY}),i.addClass("ui-state-hover"),t.getUI("contextmenu").children().on("mouseenter",function(){i.addClass("ui-state-hover")}),t.bind("closecontextmenu",function(){i.removeClass("ui-state-hover")})}),$=t.getUI("navbar").append(L).show();t.open(function(n){var i=n.data,a=O(i.files),r=t.getUI("contextmenu");i.init&&L.empty(),a.length&&(r.data("cmdMaps")||r.data("cmdMaps",{}),j(a),q(a,f),e.each(a,function(e,t){t.volumeid&&t.uiCmdMap&&Object.keys(t.uiCmdMap).length&&!r.data("cmdMaps")[t.volumeid]&&(r.data("cmdMaps")[t.volumeid]=t.uiCmdMap)})),_(!1,a)}).add(function(e){var t=O(e.data.added);t.length&&(j(t),q(t,p))}).change(function(n){for(var i,a,o,s,l,c,p,m,g,v=O(n.data.changed),b=v.length,y=b;y--;)if(i=v[y],(a=e("#"+t.navHash2Id(i.hash))).length){if(i.phash){if(s=a.closest("."+d),l=U(i.phash),c=a.parent().next(),p=E(l,i),!l.length)continue;(l[0]!==s[0]||c.get(0)!==p.get(0))&&(p.length?p.before(a):l.append(a))}m=a.hasClass(h),g=a.hasClass(f),o=e(D(i)),a.replaceWith(o.children(u)),i.dirs&&(m||g)&&(a=e("#"+t.navHash2Id(i.hash)))&&a.next("."+d).children().length&&(m&&a.addClass(h),g&&a.addClass(f))}_(),b&&!r&&N()}).remove(function(n){for(var i,a,r=n.data.removed,o=r.length;o--;)(i=e("#"+t.navHash2Id(r[o]))).length&&(a=i.closest("."+d),i.parent().detach(),a.children().length||a.hide().prev(u).removeClass(p+" "+h+" "+f))}).bind("lockfiles unlockfiles",function(n){var i="lockfiles"==n.type,a=n.data.helper?n.data.helper.data("locked"):!1,r=i&&!a?"disable":"enable",o=e.map(n.data.files||[],function(e){var n=t.file(e);return n&&"directory"==n.mime?e:null});e.each(o,function(n,o){var s=e("#"+t.navHash2Id(o));s.length&&!a&&(s.hasClass(w)&&s.draggable(r),s.hasClass(x)&&s.droppable(r),s[i?"addClass":"removeClass"](y))})})}),this},e.fn.elfinderuploadbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t).off("click"),i=e("<form/>").appendTo(n),a=e('<input type="file" multiple="true" title="'+t.fm.i18n("selectForUpload")+'"/>').change(function(){var n=e(this);n.val()&&(t.exec({input:n.remove()[0]}),a.clone(!0).appendTo(i))}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"});i.append(a.clone(!0)),t.change(function(){i[t.disabled()?"hide":"show"]()}).change()})},e.fn.elfinderviewbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t),i=n.children(".elfinder-button-icon");t.change(function(){var e="icons"==t.value;i.toggleClass("elfinder-button-icon-view-list",e),n.attr("title",t.fm.i18n(e?"viewlist":"viewicons"))})})},e.fn.elfinderworkzone=function(){var t="elfinder-workzone";return this.not("."+t).each(function(){var n=e(this).addClass(t),i=n.outerHeight(!0)-n.height(),a=n.parent();a.add(window).on("resize",function(){var r=a.height();a.children(":visible:not(."+t+")").each(function(){var t=e(this);"absolute"!=t.css("position")&&"fixed"!=t.css("position")&&(r-=t.outerHeight(!0))}),n.height(r-i)})}),this},elFinder.prototype.commands.archive=function(){var t,n=this,i=n.fm,a=[];this.variants=[],this.disableOnSearch=!0,i.bind("open reload",function(){n.variants=[],e.each(a=i.option("archivers").create||[],function(e,t){n.variants.push([t,i.mime2kind(t)])}),n.change()}),this.getstate=function(){return!this._disabled&&a.length&&(i.selected().length||t&&"pending"==t.state())&&i.cwd().write?0:-1},this.exec=function(r,o){var s,l,d=this.files(r),c=d.length,u=o||a[0],p=i.cwd(),h=["errArchive","errPerm","errCreatingTempDir","errFtpDownloadFile","errFtpUploadFile","errFtpMkdir","errArchiveExec","errExtractExec","errRm"];if(t=e.Deferred().fail(function(e){e&&i.error(e)}),!(this.enabled()&&c&&a.length&&-1!==e.inArray(u,a)))return t.reject();if(!p.write)return t.reject(h);for(s=0;c>s;s++)if(!d[s].read)return t.reject(h);return n.mime=u,n.prefix=(c>1?"Archive":d[0].name)+"."+i.option("archivers").createext[u],n.data={targets:n.hashes(r),type:u},l=e.proxy(i.res("mixin","make"),n)(),t.reject(),l}},elFinder.prototype.commands.back=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+left backspace"}],this.getstate=function(){return this.fm.history.canBack()?0:-1},this.exec=function(){return this.fm.history.back()}},elFinder.prototype.commands.chmod=function(){this.updateOnSelect=!1;var t=this,n=this.fm,i={0:"owner",1:"group",2:"other"},a={read:n.i18n("read"),write:n.i18n("write"),execute:n.i18n("execute"),perm:n.i18n("perm"),kind:n.i18n("kind"),files:n.i18n("files")},r=function(e){return!isNaN(parseInt(e,8)&&parseInt(e,8)<=511)||e.match(/^([r-][w-][x-]){3}$/i)};this.tpl={main:'<div class="ui-helper-clearfix elfinder-info-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}</div>{dataTable}',itemTitle:'<strong>{name}</strong><span id="elfinder-info-kind">{kind}</span>',groupTitle:"<strong>{items}: {num}</strong>",dataTable:'<table id="{id}-table-perm"><tr><td>{0}</td><td>{1}</td><td>{2}</td></tr></table><div class="">'+a.perm+': <input id="{id}-perm" type="text" size="4" maxlength="3" value="{value}"></div>',fieldset:'<fieldset id="{id}-fieldset-{level}"><legend>{f_title}{name}</legend><input type="checkbox" value="4" id="{id}-read-{level}-perm"{checked-r}> <label for="{id}-read-{level}-perm">'+a.read+"</label><br>"+'<input type="checkbox" value="6" id="{id}-write-{level}-perm"{checked-w}> <label for="{id}-write-{level}-perm">'+a.write+"</label><br>"+'<input type="checkbox" value="5" id="{id}-execute-{level}-perm"{checked-x}> <label for="{id}-execute-{level}-perm">'+a.execute+"</label><br>"},this.shortcuts=[{}],this.getstate=function(e){var n=this.fm;return e=e||n.selected(),0==e.length&&(e=[n.cwd().hash]),!this._disabled&&t.checkstate(this.files(e))?0:-1},this.checkstate=function(t){var n=t.length;if(!n)return!1;var i=e.map(t,function(e){return e.isowner&&e.perm&&r(e.perm)&&(1==n||"directory"!=e.mime)?e:null}).length;return n==i?!0:!1},this.exec=function(t){var n=this.files(t);n.length||(t=[this.fm.cwd().hash],n=this.files(t));var o,s,l=this.fm,d=e.Deferred().always(function(){l.enable()}),c=this.tpl,t=this.hashes(t),u=n.length,p=n[0],h=l.namespace+"-perm-"+p.hash,f=c.main,m=' checked="checked"',g=function(){var e={};return e[l.i18n("btnApply")]=v,e[l.i18n("btnCancel")]=function(){I.elfinderdialog("close")},e},v=function(){var n=e.trim(e("#"+h+"-perm").val());return r(n)?(I.elfinderdialog("close"),l.request({data:{cmd:"chmod",targets:t,mode:n},notify:{type:"chmod",cnt:u}}).fail(function(e){d.reject(e)}).done(function(e){d.resolve(e)}),void 0):!1},b=function(){for(var t,n="",a=0;3>a;a++)t=0,e("#"+h+"-read-"+i[a]+"-perm").is(":checked")&&(t=4|t),e("#"+h+"-write-"+i[a]+"-perm").is(":checked")&&(t=2|t),e("#"+h+"-execute-"+i[a]+"-perm").is(":checked")&&(t=1|t),n+=t.toString(8);e("#"+h+"-perm").val(n)},y=function(t){for(var n,a=0;3>a;a++)n=parseInt(t.slice(a,a+1),8),e("#"+h+"-read-"+i[a]+"-perm").prop("checked",!1),e("#"+h+"-write-"+i[a]+"-perm").prop("checked",!1),e("#"+h+"-execute-"+i[a]+"-perm").prop("checked",!1),4==(4&n)&&e("#"+h+"-read-"+i[a]+"-perm").prop("checked",!0),2==(2&n)&&e("#"+h+"-write-"+i[a]+"-perm").prop("checked",!0),1==(1&n)&&e("#"+h+"-execute-"+i[a]+"-perm").prop("checked",!0);b()},w=function(e){for(var t,n,i,a="777",r="",o=e.length,s=0;o>s;s++){t=C(e[s].perm),r="";for(var l=0;3>l;l++)n=parseInt(t.slice(l,l+1),8),i=parseInt(a.slice(l,l+1),8),4!=(4&n)&&4==(4&i)&&(i-=4),2!=(2&n)&&2==(2&i)&&(i-=2),1!=(1&n)&&1==(1&i)&&(i-=1),r+=i.toString(8);a=r}return a},x=function(e){return e?":"+e:""},k=function(e,t){for(var n,r,o="",s=c.dataTable,d=0;3>d;d++)n=parseInt(e.slice(d,d+1),8),o+=n.toString(8),r=c.fieldset.replace("{f_title}",l.i18n(i[d])).replace("{name}",x(t[i[d]])).replace(/\{level\}/g,i[d]),s=s.replace("{"+d+"}",r).replace("{checked-r}",4==(4&n)?m:"").replace("{checked-w}",2==(2&n)?m:"").replace("{checked-x}",1==(1&n)?m:"");return s=s.replace("{value}",o).replace("{valueCaption}",a.perm)},C=function(e){if(isNaN(parseInt(e,8))){for(var t=e.split(""),n=[],i=0,a=t.length;a>i;i++)0===i||3===i||6===i?t[i].match(/[r]/i)?n.push(1):t[i].match(/[-]/)&&n.push(0):1===i||4===i||7===i?t[i].match(/[w]/i)?n.push(1):t[i].match(/[-]/)&&n.push(0):t[i].match(/[x]/i)?n.push(1):t[i].match(/[-]/)&&n.push(0);n.splice(3,0,","),n.splice(7,0,",");for(var r=n.join(""),o=r.split(","),s=[],l=0,d=o.length;d>l;l++){var c=parseInt(o[l],2).toString(8);s.push(c)}e=s.join("")}else e=parseInt(e,8).toString(8);return e},T={title:this.title,width:"auto",buttons:g(),close:function(){e(this).elfinderdialog("destroy")}},I=l.getUI().find("#"+h),F="";return I.length?(I.elfinderdialog("toTop"),e.Deferred().resolve()):(f=f.replace("{class}",u>1?"elfinder-cwd-icon-group":l.mime2class(p.mime)),u>1?o=c.groupTitle.replace("{items}",l.i18n("items")).replace("{num}",u):(o=c.itemTitle.replace("{name}",p.name).replace("{kind}",l.mime2kind(p)),p.tmb&&(F=l.option("tmbUrl")+p.tmb)),s=k(w(n),1==n.length?n[0]:{}),f=f.replace("{title}",o).replace("{dataTable}",s).replace(/{id}/g,h),I=l.dialog(f,T),I.attr("id",h),F&&e("<img/>").on("load",function(){I.find(".elfinder-cwd-icon").css("background",'url("'+F+'") center center no-repeat')}).attr("src",F),e("#"+h+"-table-perm :checkbox").on("click",function(){b("perm")}),e("#"+h+"-perm").on("keydown",function(e){var t=e.keyCode;return e.stopPropagation(),13==t?(v(),void 0):void 0}).on("focus",function(){e(this).select()}).on("keyup",function(){3==e(this).val().length&&(e(this).select(),y(e(this).val()))}),d)}},elFinder.prototype.commands.copy=function(){this.shortcuts=[{pattern:"ctrl+c ctrl+insert"}],this.getstate=function(t){var t=this.files(t),n=t.length;return!this._disabled&&n&&e.map(t,function(e){return e.phash&&e.read?e:null}).length==n?0:-1},this.exec=function(t){var n=this.fm,i=e.Deferred().fail(function(e){n.error(e)});return e.each(this.files(t),function(e,t){return t.read&&t.phash?void 0:!i.reject(["errCopy",t.name,"errPerm"])}),"rejected"==i.state()?i:i.resolve(n.clipboard(this.hashes(t)))}},elFinder.prototype.commands.cut=function(){this.shortcuts=[{pattern:"ctrl+x shift+insert"}],this.getstate=function(t){var t=this.files(t),n=t.length;return!this._disabled&&n&&e.map(t,function(e){return e.phash&&e.read&&!e.locked?e:null}).length==n?0:-1},this.exec=function(t){var n=this.fm,i=e.Deferred().fail(function(e){n.error(e)});return e.each(this.files(t),function(e,t){return t.read&&t.phash?t.locked?!i.reject(["errLocked",t.name]):void 0:!i.reject(["errCopy",t.name,"errPerm"])}),"rejected"==i.state()?i:i.resolve(n.clipboard(this.hashes(t),!0))}},elFinder.prototype.commands.download=function(){var t=this,n=this.fm,i=function(n){return e.map(t.files(n),function(e){return"directory"==e.mime?null:e})};this.shortcuts=[{pattern:"shift+enter"}],this.getstate=function(){var e=this.fm.selected(),t=e.length;return this._disabled||!t||(n.UA.IE||n.UA.Mobile)&&1!=t||t!=i(e).length?-1:0},this.fm.bind("contextmenu",function(n){var i,a,r=t.fm,o=null,s=function(t){var n=t.url||r.url(t.hash);return{icon:"link",node:e("<a/>").attr({href:n,target:"_blank",title:r.i18n("link")}).text(t.name).on("mousedown click touchstart touchmove touchend contextmenu",function(e){var t=r.getUI("contextmenu");e.stopPropagation(),t.data("mouseEvInternal",!0),setTimeout(function(){t.data("mouseEvInternal",!1)},500)}).on("dragstart",function(n){var i=n.dataTransfer||n.originalEvent.dataTransfer||null;if(o=null,i){var a=function(t){var n,i=t.mime;return n='<div class="elfinder-cwd-icon '+r.mime2class(i)+' ui-corner-all"/>',t.tmb&&1!==t.tmb&&(n=e(n).css("background","url('"+r.option("tmbUrl")+t.tmb+"') center center no-repeat").get(0).outerHTML),n};i.effectAllowed="copyLink",i.setDragImage&&(o=e('<div class="elfinder-drag-helper html5-native">').append(a(t)).appendTo(e(document.body)),i.setDragImage(o.get(0),50,47)),r.UA.IE||(i.setData("elfinderfrom",window.location.href+t.phash),i.setData("elfinderfrom:"+i.getData("elfinderfrom"),""))}}).on("dragend",function(){o&&o.remove()})}};if(t.extra=null,n.data&&(i=n.data.targets||[],1===i.length&&(a=r.file(i[0]))&&"directory"!==a.mime))if("1"!=a.url)t.extra=s(a);else{var l;t.extra={icon:"link",node:e("<a/>").attr({href:"#",title:r.i18n("link"),draggable:"false"}).text(a.name).on("click",function(e){var t=l.parent();e.stopPropagation(),e.preventDefault(),t.removeClass("ui-state-disabled").addClass("elfinder-button-icon-spinner"),r.request({data:{cmd:"url",target:a.hash},preventDefault:!0}).always(function(e){if(e.url){var n=r.file(a.hash);n.url=e.url,t.removeClass("elfinder-button-icon-spinner"),l.replaceWith(s(a).node)}else t.addClass("ui-state-disabled")})})},l=t.extra.node,l.ready(function(){setTimeout(function(){l.parent().addClass("ui-state-disabled")},10)})}}),this.exec=function(t){var n,a,r=this.fm,o=(r.options.url,i(t)),s=e.Deferred(),l="";if(this.disabled())return s.reject();var a,d=e("<a>").hide().appendTo(e("body")),c="string"==typeof d.get(0).download;for(n=0;n<o.length;n++)a=r.openUrl(o[n].hash,!0),c?d.attr("href",a).attr("download",o[n].name).attr("target","_blank").get(0).click():r.UA.Mobile?setTimeout(function(){window.open(a)||r.error("errPopup")},100):l+='<iframe class="downloader" id="downloader-'+o[n].hash+'" style="display:none" src="'+a+'"/>';return d.remove(),e(l).appendTo("body").ready(function(){setTimeout(function(){e(l).each(function(){e("#"+e(this).attr("id")).remove()})},r.UA.Firefox?2e4+1e4*n:1e3)}),r.trigger("download",{files:o}),s.resolve(t)}},elFinder.prototype.commands.duplicate=function(){var t=this.fm;this.getstate=function(n){var n=this.files(n),i=n.length;return!this._disabled&&i&&t.cwd().write&&e.map(n,function(e){return e.phash&&e.read?e:null}).length==i?0:-1},this.exec=function(t){var n=this.fm,i=this.files(t),a=i.length,r=e.Deferred().fail(function(e){e&&n.error(e)});return!a||this._disabled?r.reject():(e.each(i,function(e,t){return t.read&&n.file(t.phash).write?void 0:!r.reject(["errCopy",t.name,"errPerm"])}),"rejected"==r.state()?r:n.request({data:{cmd:"duplicate",targets:this.hashes(t)},notify:{type:"copy",cnt:a}}))}},elFinder.prototype.commands.edit=function(){var t=this,n=this.fm,i=n.res("mimes","text")||[],a=function(e){return e.replace(/\s+$/,"")},r=function(n){return e.map(n,function(n){return 0!==n.mime.indexOf("text/")&&-1===e.inArray(n.mime,i)||!n.mime.indexOf("text/rtf")||t.onlyMimes.length&&-1===e.inArray(n.mime,t.onlyMimes)||!n.read||!n.write?null:n})},o=function(r,o,s){var l=e.Deferred(),d=e('<textarea class="elfinder-file-edit" rows="20" id="'+r+'-ta">'+n.escape(s)+"</textarea>"),c=d.val(),u=function(){d.editor&&d.editor.save(d[0],d.editor.instance),c=d.val(),l.notifyWith(d)},p=function(){var e=function(){l.reject(),d.elfinderdialog("close")};d.editor&&d.editor.save(d[0],d.editor.instance),a(c)!==a(d.val())?(c=d.val(),n.confirm({title:t.title,text:"confirmNotSave",accept:{label:"btnSaveClose",callback:function(){u(),e()}},cancel:{label:"btnClose",callback:e}})):e()},h=function(){u(),p()},f={title:n.escape(o.name),width:t.options.dialogWidth||450,buttons:{},btnHoverFocus:!1,closeOnEscape:!1,close:function(){var i=e(this),r=function(){d.editor&&d.editor.close(d[0],d.editor.instance),i.elfinderdialog("destroy")};d.editor&&d.editor.save(d[0],d.editor.instance),a(c)!==a(d.val())?n.confirm({title:t.title,text:"confirmNotSave",accept:{label:"btnSaveClose",callback:function(){u(),r()}},cancel:{label:"btnClose",callback:r}}):r()},open:function(){n.disable(),d.focus(),d[0].setSelectionRange&&d[0].setSelectionRange(0,0),d.editor&&(d.editor.instance=d.editor.load(d[0])||null,d.editor.focus(d[0],d.editor.instance))}},m=function(t,n){if(n=n||i.concat("text/"),-1!==e.inArray(t,n))return!0;var a,r;for(r=n.length,a=0;r>a;a++)if(0===t.indexOf(n[a]))return!0;return!1},g=function(e,t){if(!t||!t.length)return!0;var n,i,a=e.replace(/^.+\.([^.]+)|(.+)$/,"$1$2").toLowerCase();for(i=t.length,n=0;i>n;n++)if(a===t[n].toLowerCase())return!0;return!1};return d.getContent=function(){return d.val()},e.each(t.options.editors||[],function(e,t){return m(o.mime,t.mimes||null)&&g(o.name,t.exts||null)&&"function"==typeof t.load&&"function"==typeof t.save?(d.editor={load:t.load,save:t.save,close:"function"==typeof t.close?t.close:function(){},focus:"function"==typeof t.focus?t.focus:function(){},instance:null,doSave:u,doCancel:p,doClose:h,file:o},!1):void 0}),d.editor||d.keydown(function(e){var t,n,i=e.keyCode;e.stopPropagation(),9==i&&(e.preventDefault(),this.setSelectionRange&&(t=this.value,n=this.selectionStart,this.value=t.substr(0,n)+" "+t.substr(this.selectionEnd),n+=1,this.setSelectionRange(n,n))),(e.ctrlKey||e.metaKey)&&((81==i||87==i)&&(e.preventDefault(),p()),83==i&&(e.preventDefault(),u()))}).on("mouseenter",function(){this.focus()}),f.buttons[n.i18n("btnSave")]=u,f.buttons[n.i18n("btnSaveClose")]=h,f.buttons[n.i18n("btnCancel")]=p,n.dialog(d,f).attr("id",r),l.promise()},s=function(i,a){var r,l=i.hash,d=(n.options,e.Deferred()),c="edit-"+n.namespace+"-"+i.hash,u=n.getUI().find("#"+c),p=a?1:0;return u.length?(u.elfinderdialog("toTop"),d.resolve()):i.read&&i.write?(n.request({data:{cmd:"get",target:l,conv:p},notify:{type:"file",cnt:1},syncOnFail:!0}).done(function(e){e.doconv?n.confirm({title:t.title,text:"confirmConvUTF8",accept:{label:"btnConv",callback:function(){d=s(i,1)}},cancel:{label:"btnCancel",callback:function(){d.reject()}}}):o(c,i,e.content).progress(function(){var e=this;n.request({options:{type:"post"},data:{cmd:"put",target:l,content:e.getContent()},notify:{type:"save",cnt:1},syncOnFail:!0}).fail(function(e){d.reject(e)}).done(function(t){t.changed&&t.changed.length&&n.change(t),d.resolve(t),setTimeout(function(){e.focus(),e.editor&&e.editor.focus(e[0],e.editor.instance)},50)})})}).fail(function(e){d.reject(e)}),d.promise()):(r=["errOpen",i.name,"errPerm"],n.error(r),d.reject(r))};this.shortcuts=[{pattern:"ctrl+e"}],this.init=function(){this.onlyMimes=this.options.mimes||[]},this.getstate=function(e){var e=this.files(e),t=e.length;return!this._disabled&&t&&r(e).length==t?0:-1},this.exec=function(t){var n,i=r(this.files(t)),a=[];if(this.disabled())return e.Deferred().reject();for(;n=i.shift();)a.push(s(n));return a.length?e.when.apply(null,a):e.Deferred().reject()}},elFinder.prototype.commands.extract=function(){var t=this,n=t.fm,i=[],a=function(t){return e.map(t,function(t){return t.read&&-1!==e.inArray(t.mime,i)?t:null})};this.variants=[],this.disableOnSearch=!0,n.bind("open reload",function(){i=n.option("archivers").extract||[],t.variants=[["makedir",n.i18n("cmdmkdir")],["intohere",n.i18n("btnCwd")]],t.change()}),this.getstate=function(e){var e=this.files(e),t=e.length;return!this._disabled&&t&&this.fm.cwd().write&&a(e).length==t?0:-1},this.exec=function(t,a){var r,o,s,l=this.files(t),d=e.Deferred(),c=l.length,u="makedir"==a?1:0,p=!1,h=!1,f=0,m=e.map(n.files(t),function(e){return e.name}),g={};e.map(n.files(t),function(e){g[e.name]=e});var v=function(e){switch(e){case"overwrite_all":p=!0;break;case"omit_all":h=!0}},b=function(t){t.read&&n.file(t.phash).write?-1===e.inArray(t.mime,i)?(o=["errExtract",t.name,"errNoArchive"],n.error(o),d.reject(o)):n.request({data:{cmd:"extract",target:t.hash,makedir:u},notify:{type:"extract",cnt:1},syncOnFail:!0}).fail(function(e){"rejected"!=d.state()&&d.reject(e)}).done(function(){}):(o=["errExtract",t.name,"errPerm"],n.error(o),d.reject(o))},y=function(t,i){var a=t[i],o=a.name.replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/gi,""),l=e.inArray(o,m)>=0,w=function(){c>i+1?y(t,i+1):d.resolve()};!u&&l&&"directory"!=g[o].mime?n.confirm({title:n.i18n("ntfextract"),text:["errExists",o,"confirmRepl"],accept:{label:"btnYes",callback:function(e){if(s=e?"overwrite_all":"overwrite",v(s),p||h){if(p){for(r=i;c>r;r++)b(t[r]);d.resolve()}}else"overwrite"==s&&b(a),c>i+1?y(t,i+1):d.resolve()}},reject:{label:"btnNo",callback:function(e){s=e?"omit_all":"omit",v(s),!p&&!h&&c>i+1?y(t,i+1):h&&d.resolve()}},cancel:{label:"btnCancel",callback:function(){d.resolve()}},all:c>i+1}):u?(b(a),w()):0==f?n.confirm({title:n.i18n("cmdextract"),text:[n.i18n("cmdextract")+' "'+a.name+'"',"confirmRepl"],accept:{label:"btnYes",callback:function(e){e&&(f=1),b(a),w()}},reject:{label:"btnNo",callback:function(e){e&&(f=-1),w()}},cancel:{label:"btnCancel",callback:function(){d.resolve()}},all:c>i+1}):(f>0&&b(a),w())};return this.enabled()&&c&&i.length?(c>0&&y(l,0),d):d.reject()}},elFinder.prototype.commands.forward=function(){this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+right"}],this.getstate=function(){return this.fm.history.canForward()?0:-1},this.exec=function(){return this.fm.history.forward()}},elFinder.prototype.commands.getfile=function(){var t=this,n=this.fm,i=function(n){var i=t.options;return n=e.map(n,function(e){return"directory"!=e.mime||i.folders?e:null}),i.multiple||1==n.length?n:[]};this.alwaysEnabled=!0,this.callback=n.options.getFileCallback,this._disabled="function"==typeof this.callback,this.getstate=function(e){var e=this.files(e),t=e.length;return this.callback&&t&&i(e).length==t?0:-1},this.exec=function(n){var i,a,r,o=this.fm,s=this.options,l=this.files(n),d=l.length,c=o.option("url"),u=o.option("tmbUrl"),p=e.Deferred().done(function(e){o.trigger("getfile",{files:e}),t.callback(e,o),"close"==s.oncomplete?o.hide():"destroy"==s.oncomplete&&o.destroy()}),h=function(){return s.onlyURL?s.multiple?e.map(l,function(e){return e.url}):l[0].url:s.multiple?l:l[0]},f=[];if(-1==this.getstate(n))return p.reject();for(i=0;d>i;i++){if(a=l[i],"directory"==a.mime&&!s.folders)return p.reject();a.baseUrl=c,"1"==a.url?f.push(o.request({data:{cmd:"url",target:a.hash},notify:{type:"url",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(e){if(e.url){var t=o.file(this.hash);t.url=this.url=e.url}}.bind(a))):a.url=o.url(a.hash),a.path=o.path(a.hash),a.tmb&&1!=a.tmb&&(a.tmb=u+a.tmb),a.width||a.height||(a.dim?(r=a.dim.split("x"),a.width=r[0],a.height=r[1]):-1!==a.mime.indexOf("image")&&f.push(o.request({data:{cmd:"dim",target:a.hash},notify:{type:"dim",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(e){if(e.dim){var t=e.dim.split("x"),n=o.file(this.hash);n.width=this.width=t[0],n.height=this.height=t[1]}}.bind(a))))}return f.length?(e.when.apply(null,f).always(function(){p.resolve(h(l))}),p):p.resolve(h(l))}},elFinder.prototype.commands.help=function(){var t=this.fm,n=this,i='<div class="elfinder-help-link"> <a href="{url}" target="_blank">{link}</a></div>',a='<div class="elfinder-help-team"><div>{author}</div>{work}</div>',r=/\{url\}/,o=/\{link\}/,s=/\{author\}/,l=/\{work\}/,d="replace",c="ui-priority-primary",u="ui-priority-secondary",p="elfinder-help-license",h='<li class="ui-state-default ui-corner-top"><a href="#{id}">{title}</a></li>',f=['<div class="ui-tabs ui-widget ui-widget-content ui-corner-all elfinder-help">','<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'],m='<div class="elfinder-help-shortcut"><div class="elfinder-help-shortcut-pattern">{pattern}</div> {descrip}</div>',g='<div class="elfinder-help-separator"/>',v=function(){f.push('<div id="about" class="ui-tabs-panel ui-widget-content ui-corner-bottom"><div class="elfinder-help-logo"/>'),f.push("<h3>elFinder</h3>"),f.push('<div class="'+c+'">'+t.i18n("webfm")+"</div>"),f.push('<div class="'+u+'">'+t.i18n("ver")+": "+t.version+", "+t.i18n("protocolver")+': <span id="apiver"></span></div>'),f.push('<div class="'+u+'">jQuery/jQuery UI: '+e().jquery+"/"+e.ui.version+"</div>"),f.push(g),f.push(i[d](r,"http://elfinder.org/")[d](o,t.i18n("homepage"))),f.push(i[d](r,"https://github.com/Studio-42/elFinder/wiki")[d](o,t.i18n("docs"))),f.push(i[d](r,"https://github.com/Studio-42/elFinder")[d](o,t.i18n("github"))),f.push(i[d](r,"http://twitter.com/elrte_elfinder")[d](o,t.i18n("twitter"))),f.push(g),f.push('<div class="'+c+'">'+t.i18n("team")+"</div>"),f.push(a[d](s,'Dmitry "dio" Levashov &lt;dio@std42.ru&gt;')[d](l,t.i18n("chiefdev"))),f.push(a[d](s,"Troex Nevelin &lt;troex@fury.scancode.ru&gt;")[d](l,t.i18n("maintainer"))),f.push(a[d](s,"Alexey Sukhotin &lt;strogg@yandex.ru&gt;")[d](l,t.i18n("contributor"))),f.push(a[d](s,"Naoki Sawada &lt;hypweb@gmail.com&gt;")[d](l,t.i18n("contributor"))),t.i18[t.lang].translator&&f.push(a[d](s,t.i18[t.lang].translator)[d](l,t.i18n("translator")+" ("+t.i18[t.lang].language+")")),f.push(g),f.push('<div class="'+p+'">'+t.i18n("icons")+': Pixelmixer, <a href="http://p.yusukekamiyamane.com" target="_blank">Fugue</a></div>'),f.push(g),f.push('<div class="'+p+'">Licence: BSD Licence</div>'),f.push('<div class="'+p+'">Copyright © 2009-2015, Studio 42</div>'),f.push('<div class="'+p+'">„ …'+t.i18n("dontforget")+" ”</div>"),f.push("</div>")
14
- },b=function(){var n=t.shortcuts();f.push('<div id="shortcuts" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),n.length?(f.push('<div class="ui-widget-content elfinder-help-shortcuts">'),e.each(n,function(e,t){f.push(m.replace(/\{pattern\}/,t[0]).replace(/\{descrip\}/,t[1]))}),f.push("</div>")):f.push('<div class="elfinder-help-disabled">'+t.i18n("shortcutsof")+"</div>"),f.push("</div>")},y=function(){f.push('<div id="help" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),f.push('<a href="http://elfinder.org/forum/" target="_blank" class="elfinder-dont-panic"><span>DON\'T PANIC</span></a>'),f.push("</div>")},w="";this.alwaysEnabled=!0,this.updateOnSelect=!1,this.state=0,this.shortcuts=[{pattern:"f1",description:this.title}],setTimeout(function(){var i=n.options.view||["about","shortcuts","help"];e.each(i,function(e,n){f.push(h[d](/\{id\}/,n)[d](/\{title\}/,t.i18n(n)))}),f.push("</ul>"),-1!==e.inArray("about",i)&&v(),-1!==e.inArray("shortcuts",i)&&b(),-1!==e.inArray("help",i)&&y(),f.push("</div>"),w=e(f.join("")),w.find(".ui-tabs-nav li").hover(function(){e(this).toggleClass("ui-state-hover")}).children().click(function(t){var n=e(this);t.preventDefault(),t.stopPropagation(),n.hasClass("ui-tabs-selected")||(n.parent().addClass("ui-tabs-selected ui-state-active").siblings().removeClass("ui-tabs-selected").removeClass("ui-state-active"),w.find(".ui-tabs-panel").hide().filter(n.attr("href")).show())}).filter(":first").click()},200),this.getstate=function(){return 0},this.exec=function(){this.dialog||(w.find("#apiver").text(this.fm.api),this.dialog=this.fm.dialog(w,{title:this.title,width:530,autoOpen:!1,destroyOnClose:!1})),this.dialog.elfinderdialog("open").find(".ui-tabs-nav li a:first").click()}},elFinder.prototype.commands.home=function(){this.title="Home",this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+home ctrl+shift+up",description:"Home"}],this.getstate=function(){var e=this.fm.root(),t=this.fm.cwd().hash;return e&&t&&e!=t?0:-1},this.exec=function(){return this.fm.exec("open",this.fm.root())}},elFinder.prototype.commands.info=function(){var t=this.fm,n="elfinder-info-spinner",i={calc:t.i18n("calc"),size:t.i18n("size"),unknown:t.i18n("unknown"),path:t.i18n("path"),aliasfor:t.i18n("aliasfor"),modify:t.i18n("modify"),perms:t.i18n("perms"),locked:t.i18n("locked"),dim:t.i18n("dim"),kind:t.i18n("kind"),files:t.i18n("files"),folders:t.i18n("folders"),items:t.i18n("items"),yes:t.i18n("yes"),no:t.i18n("no"),link:t.i18n("link"),owner:t.i18n("owner"),group:t.i18n("group"),perm:t.i18n("perm")};this.tpl={main:'<div class="ui-helper-clearfix elfinder-info-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}</div><table class="elfinder-info-tb">{content}</table>',itemTitle:'<strong>{name}</strong><span class="elfinder-info-kind">{kind}</span>',groupTitle:"<strong>{items}: {num}</strong>",row:"<tr><td>{label} : </td><td>{value}</td></tr>",spinner:'<span>{text}</span> <span class="'+n+" "+n+'-{name}"/>'},this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+i"}],this.init=function(){e.each(i,function(e,n){i[e]=t.i18n(n)})},this.getstate=function(){return 0},this.exec=function(t){var a=this.files(t);a.length||(a=this.files([this.fm.cwd().hash]));var r,o,s,l,d,c=this.fm,u=this.options,p=this.tpl,h=p.row,f=a.length,m=[],g=p.main,v="{label}",b="{value}",y={title:this.title,width:"auto",close:function(){e(this).elfinderdialog("destroy")}},w=[],x=function(e,t){C.find("."+n+"-"+t).parent().html(e)},k=c.namespace+"-info-"+e.map(a,function(e){return e.hash}).join("-"),C=c.getUI().find("#"+k),T=[];if(!f)return e.Deferred().reject();if(C.length)return C.elfinderdialog("toTop"),e.Deferred().resolve();if(1==f){if(s=a[0],g=g.replace("{class}",c.mime2class(s.mime)),l=p.itemTitle.replace("{name}",c.escape(s.i18||s.name)).replace("{kind}",c.mime2kind(s)),s.tmb&&(o=c.option("tmbUrl")+s.tmb),s.read?"directory"!=s.mime||s.alias?r=c.formatSize(s.size):(r=p.spinner.replace("{text}",i.calc).replace("{name}","size"),w.push(s.hash)):r=i.unknown,m.push(h.replace(v,i.size).replace(b,r)),s.alias&&m.push(h.replace(v,i.aliasfor).replace(b,s.alias)),m.push(h.replace(v,i.path).replace(b,c.escape(c.path(s.hash,!0)))),s.read){var I,F=c.escape(s.name);if("1"==s.url)m.push(h.replace(v,i.link).replace(b,p.spinner.replace("{text}",i.modify).replace("{name}","url"))),c.request({data:{cmd:"url",target:s.hash},preventDefault:!0}).fail(function(){x(F,"url")}).done(function(e){if(x('<a href="'+e.url+'" target="_blank">'+F+"</a>"||F,"url"),e.url){var t=c.file(s.hash);t.url=e.url}});else{if(u.nullUrlDirLinkSelf&&"directory"==s.mime&&null===s.url){var M=window.location;I=M.pathname+M.search+"#elf_"+s.hash}else I=c.url(s.hash);m.push(h.replace(v,i.link).replace(b,'<a href="'+I+'" target="_blank">'+F+"</a>"))}}s.dim?m.push(h.replace(v,i.dim).replace(b,s.dim)):-1!==s.mime.indexOf("image")&&(s.width&&s.height?m.push(h.replace(v,i.dim).replace(b,s.width+"x"+s.height)):(m.push(h.replace(v,i.dim).replace(b,p.spinner.replace("{text}",i.calc).replace("{name}","dim"))),c.request({data:{cmd:"dim",target:s.hash},preventDefault:!0}).fail(function(){x(i.unknown,"dim")}).done(function(e){if(x(e.dim||i.unknown,"dim"),e.dim){var t=e.dim.split("x"),n=c.file(s.hash);n.width=t[0],n.height=t[1]}}))),m.push(h.replace(v,i.modify).replace(b,c.formatDate(s))),m.push(h.replace(v,i.perms).replace(b,c.formatPermissions(s))),m.push(h.replace(v,i.locked).replace(b,s.locked?i.yes:i.no)),s.owner&&m.push(h.replace(v,i.owner).replace(b,s.owner)),s.group&&m.push(h.replace(v,i.group).replace(b,s.group)),s.perm&&m.push(h.replace(v,i.perm).replace(b,c.formatFileMode(s.perm))),u.custom&&e.each(u.custom,function(t,n){n.mimes&&!e.map(n.mimes,function(e){return s.mime===e||0===s.mime.indexOf(e+"/")?!0:null}).length||n.hashRegex&&!s.hash.match(n.hashRegex)||(m.push(h.replace(v,c.i18n(n.label)).replace(b,n.tpl.replace("{id}",k))),n.action&&"function"==typeof n.action&&T.push(n.action))})}else g=g.replace("{class}","elfinder-cwd-icon-group"),l=p.groupTitle.replace("{items}",i.items).replace("{num}",f),d=e.map(a,function(e){return"directory"==e.mime?1:null}).length,d?(m.push(h.replace(v,i.kind).replace(b,d==f?i.folders:i.folders+" "+d+", "+i.files+" "+(f-d))),m.push(h.replace(v,i.size).replace(b,p.spinner.replace("{text}",i.calc).replace("{name}","size"))),w=e.map(a,function(e){return e.hash})):(r=0,e.each(a,function(e,t){var n=parseInt(t.size);n>=0&&r>=0?r+=n:r="unknown"}),m.push(h.replace(v,i.kind).replace(b,i.files)),m.push(h.replace(v,i.size).replace(b,c.formatSize(r))));g=g.replace("{title}",l).replace("{content}",m.join("")),C=c.dialog(g,y),C.attr("id",k),o&&e("<img/>").load(function(){C.find(".elfinder-cwd-icon").css("background",'url("'+o+'") center center no-repeat')}).attr("src",o),w.length&&c.request({data:{cmd:"size",targets:w},preventDefault:!0}).fail(function(){x(i.unknown,"size")}).done(function(e){var t=parseInt(e.size);x(t>=0?c.formatSize(t):i.unknown,"size")}),T.length&&e.each(T,function(e,t){try{t(s,c,C)}catch(n){c.debug("error",n)}})}},elFinder.prototype.commands.mkdir=function(){this.disableOnSearch=!0,this.updateOnSelect=!1,this.mime="directory",this.prefix="untitled folder",this.exec=e.proxy(this.fm.res("mixin","make"),this),this.shortcuts=[{pattern:"ctrl+shift+n"}],this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1}},elFinder.prototype.commands.mkfile=function(){this.disableOnSearch=!0,this.updateOnSelect=!1,this.mime="text/plain",this.prefix="untitled file.txt",this.exec=e.proxy(this.fm.res("mixin","make"),this),this.getstate=function(){return!this._disabled&&this.fm.cwd().write?0:-1}},elFinder.prototype.commands.netmount=function(){var t=this;this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){this.drivers=this.fm.netDrivers}},this.getstate=function(){return this.drivers.length?0:-1},this.exec=function(){var n=t.fm,i=e.Deferred(),a=t.options,r=function(){var r,o={protocol:e("<select/>").change(function(){var e=this.value;l.find(".elfinder-netmount-tr").hide(),l.find(".elfinder-netmount-tr-"+e).show(),"function"==typeof a[e].select&&a[e].select(n)})},s={title:n.i18n("netMountDialogTitle"),resizable:!1,modal:!0,destroyOnClose:!0,close:function(){delete t.dialog,"pending"==i.state()&&i.reject()},buttons:{}},l=e('<table class="elfinder-info-tb elfinder-netmount-tb"/>'),d=e("<div/>");return l.append(e("<tr/>").append(e("<td>"+n.i18n("protocol")+"</td>")).append(e("<td/>").append(o.protocol))),e.each(t.drivers,function(t,i){o.protocol.append('<option value="'+i+'">'+n.i18n(i)+"</option>"),e.each(a[i].inputs,function(t,a){a.attr("name",t),"hidden"!=a.attr("type")?(a.addClass("ui-corner-all elfinder-netmount-inputs-"+i),l.append(e("<tr/>").addClass("elfinder-netmount-tr elfinder-netmount-tr-"+i).append(e("<td>"+n.i18n(t)+"</td>")).append(e("<td/>").append(a)))):(a.addClass("elfinder-netmount-inputs-"+i),d.append(a))})}),l.append(d),l.find(".elfinder-netmount-tr").hide(),s.buttons[n.i18n("btnMount")]=function(){var a=o.protocol.val(),r={cmd:"netmount",protocol:a};return e.each(l.find("input.elfinder-netmount-inputs-"+a),function(t,n){var i;i="function"==typeof n.val?e.trim(n.val()):e.trim(n.value),i&&(r[n.name]=i)}),r.host?(n.request({data:r,notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){e.added&&e.added.length&&n.exec("open",e.added[0].hash),i.resolve()}).fail(function(e){i.reject(e)}),t.dialog.elfinderdialog("close"),void 0):n.trigger("error",{error:"errNetMountHostReq"})},s.buttons[n.i18n("btnCancel")]=function(){t.dialog.elfinderdialog("close")},r=n.dialog(l,s),r.ready(function(){o.protocol.change(),r.elfinderdialog("posInit")}),r};return n.bind("netmount",function(e){var t=e.data||null;t&&t.protocol&&a[t.protocol]&&"function"==typeof a[t.protocol].done&&a[t.protocol].done(n,t)}),t.dialog||(t.dialog=r()),i.promise()}},elFinder.prototype.commands.netunmount=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){this.drivers=this.fm.netDrivers}},this.getstate=function(e){var t=this.fm;return e&&this.drivers.length&&!this._disabled&&t.file(e[0]).netkey?0:-1},this.exec=function(t){var n=this,i=this.fm,a=e.Deferred().fail(function(e){e&&i.error(e)}),r=i.file(t[0]);return this._disabled?a.reject():("pending"==a.state()&&i.confirm({title:n.title,text:i.i18n("confirmUnmount",r.name),accept:{label:"btnUnmount",callback:function(){i.request({data:{cmd:"netmount",protocol:"netunmount",host:r.netkey,user:r.hash,pass:"dum"},notify:{type:"netunmount",cnt:1,hideCnt:!0},preventFail:!0}).fail(function(e){a.reject(e)}).done(function(e){var t=i.root()==r.hash;if(e.removed=[r.hash],i.remove(e),t){var n=i.files();for(var o in n)if("directory"==i.file(o).mime){i.exec("open",o);break}}a.resolve()})}},cancel:{label:"btnCancel",callback:function(){a.reject()}}}),a)}},elFinder.prototype.commands.open=function(){this.alwaysEnabled=!0,this._handlers={dblclick:function(e){e.preventDefault(),this.exec()},"select enable disable reload":function(e){this.update("disable"==e.type?-1:void 0)}},this.shortcuts=[{pattern:"ctrl+down numpad_enter"+("mac"!=this.fm.OS&&" enter")}],this.getstate=function(t){var t=this.files(t),n=t.length;return 1==n?0:n&&!this.fm.UA.Mobile?e.map(t,function(e){return"directory"==e.mime?null:e}).length==n?0:-1:-1},this.exec=function(t,n){var i,a,r,o,s,l,d,c,u,p,h,f,m=this.fm,g=e.Deferred().fail(function(e){e&&m.error(e)}),v=this.files(t),b=v.length,y="object"==typeof n?n.thash:!1;if(!b&&!y)return g.reject();if(y||1==b&&(i=v[0])&&"directory"==i.mime)return y||!i||i.read?m.request({data:{cmd:"open",target:y||i.hash},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0}):g.reject(["errOpen",i.name,"errPerm"]);if(v=e.map(v,function(e){return"directory"!=e.mime?e:null}),b!=v.length)return g.reject();try{u=new RegExp(m.option("dispInlineRegex"))}catch(w){u=!1}for(p=e("<a>").hide().appendTo(e("body")),h="string"==typeof p.get(0).download,b=v.length;b--;){if(i=v[b],!i.read)return g.reject(["errOpen",i.name,"errPerm"]);if(f=u&&i.mime.match(u),a=m.openUrl(i.hash,!f),m.UA.Mobile||!f)if(h)!f&&p.attr("download",i.name),p.attr("href",a).attr("target","_blank").get(0).click();else{var x=window.open(a);if(!x)return g.reject("errPopup")}else{s=d=Math.round(2*e(window).width()/3),l=c=Math.round(2*e(window).height()/3),parseInt(i.width)&&parseInt(i.height)?(s=parseInt(i.width),l=parseInt(i.height)):i.dim&&(r=i.dim.split("x"),s=parseInt(r[0]),l=parseInt(r[1])),d>=s&&c>=l?(d=s,c=l):s-d>l-c?c=Math.round(l*(d/s)):d=Math.round(s*(c/l)),o="width="+d+",height="+c,0===a.indexOf(m.options.url)&&(a="");var x=window.open(a,"new_window",o+",top=50,left=50,scrollbars=yes,resizable=yes");if(!x)return g.reject("errPopup");if(""===a){var k=document.createElement("form");k.action=m.options.url,k.method="POST",k.target="new_window",k.style.display="none";var C=e.extend({},m.options.customData,{cmd:"file",target:i.hash});e.each(C,function(e,t){var n=document.createElement("input");n.name=e,n.value=t,k.appendChild(n)}),document.body.appendChild(k),k.submit()}x.focus()}}return p.remove(),g.resolve(t)}},elFinder.prototype.commands.opendir=function(){this.alwaysEnabled=!0,this.getstate=function(){var e,t=this.fm.selected(),n=t.length;return 1!==n?-1:(e=this.fm.getUI("cwd").parent(),e.hasClass("elfinder-search-result")?0:-1)},this.exec=function(t){var n,i=this.fm,a=e.Deferred(),r=this.files(t),o=r.length,s=null;return o&&r[0].phash?(n=r[0].phash,i.file(n)||(s=i.request({data:{cmd:"parents",target:n},syncOnFail:!1})),e.when(s).done(function(){i.trigger("searchend",{noupdate:!0}),i.request({data:{cmd:"open",target:n},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!1})}),a):a.reject()}},elFinder.prototype.commands.paste=function(){this.updateOnSelect=!1,this.handlers={changeclipboard:function(){this.update()}},this.shortcuts=[{pattern:"ctrl+v shift+insert"}],this.getstate=function(t){if(this._disabled)return-1;if(t){if(e.isArray(t)){if(1!=t.length)return-1;t=this.fm.file(t[0])}}else t=this.fm.cwd();return this.fm.clipboard().length&&"directory"==t.mime&&t.write?0:-1},this.exec=function(t){var n,i,a=this,r=a.fm,t=t?this.files(t)[0]:r.cwd(),o=r.clipboard(),s=o.length,l=s?o[0].cut:!1,d=l?"errMove":"errCopy",c=[],u=[],p=e.Deferred().fail(function(e){e&&r.error(e)}).always(function(){r.unlockfiles({files:e.map(o,function(e){return e.hash})})}),h=function(t){return t.length&&r._commands.duplicate?r.exec("duplicate",t):e.Deferred().resolve()},f=function(n){var i=e.Deferred(),o=[],s=function(t,n){for(var i=[],a=t.length;a--;)-1!==e.inArray(t[a].name,n)&&i.unshift(a);return i},d=function(e){var t=o[e],a=n[t],s=e==o.length-1;a&&r.confirm({title:r.i18n(l?"moveFiles":"copyFiles"),text:["errExists",a.name,"confirmRepl"],all:!s,accept:{label:"btnYes",callback:function(t){s||t?u(n):d(++e)}},reject:{label:"btnNo",callback:function(t){var i;if(t)for(i=o.length;e<i--;)n[o[i]].remove=!0;else n[o[e]].remove=!0;s||t?u(n):d(++e)}},cancel:{label:"btnCancel",callback:function(){i.resolve()}},buttons:[{label:"btnBackup",callback:function(t){var i;if(t)for(i=o.length;e<i--;)n[o[i]].rename=!0;else n[o[e]].rename=!0;s||t?u(n):d(++e)}}]})},c=function(e){o=s(n,e),o.length?d(0):u(n)},u=function(n){var a,o=[],n=e.map(n,function(e){return e.rename&&o.push(e.name),e.remove?null:e}),s=n.length;return s?(a=n[0].phash,n=e.map(n,function(e){return e.hash}),r.request({data:{cmd:"paste",dst:t.hash,targets:n,cut:l?1:0,src:a,renames:o,suffix:r.options.backupSuffix},notify:{type:l?"move":"copy",cnt:s}}).done(function(e){if(i.resolve(e),e&&e.added&&e.added[0]){var t=r.getUI("cwd").find("#"+r.cwdHash2Id(e.added[0].hash));t.length&&t.trigger("scrolltoview")}}).always(function(){r.unlockfiles({files:n})}),void 0):i.resolve()};return r.isCommandEnabled(a.name,t.hash)&&n.length?(r.oldAPI?u(n):r.option("copyOverwrite")?t.hash==r.cwd().hash?c(e.map(r.files(),function(e){return e.phash==t.hash?e.name:null})):r.request({data:{cmd:"ls",target:t.hash},notify:{type:"prepare",cnt:1,hideCnt:!0},preventFail:!0}).always(function(e){c(e.list||[])}):u(n),i):i.resolve()};return s&&t&&"directory"==t.mime?t.write?(n=r.parents(t.hash),e.each(o,function(a,s){return s.read?l&&s.locked?!p.reject(["errLocked",s.name]):-1!==e.inArray(s.hash,n)?!p.reject(["errCopyInItself",s.name]):(i=r.parents(s.hash),i.pop(),-1!==e.inArray(t.hash,i)&&e.map(i,function(e){var n=r.file(e);return n.phash==t.hash&&n.name==s.name?n:null}).length?!p.reject(["errReplByChild",s.name]):(s.phash==t.hash?u.push(s.hash):c.push({hash:s.hash,phash:s.phash,name:s.name}),void 0)):!p.reject([d,o[0].name,"errPerm"])}),"rejected"==p.state()?p:e.when(h(u),f(c)).always(function(){l&&r.clipboard([])})):p.reject([d,o[0].name,"errPerm"]):p.reject()}},elFinder.prototype.commands.places=function(){var t=this,n=this.fm,i=function(n){return e.map(t.files(n),function(e){return"directory"==e.mime?e:null})},a=null;this.getstate=function(e){var e=this.hashes(e),t=e.length;return a&&t&&t==i(e).length?0:-1},this.exec=function(e){var t=this.files(e);a.trigger("regist",[t])},n.one("load",function(){a=n.ui.places})},elFinder.prototype.commands.quicklook=function(){var t,n,i,a,r=this,o=r.fm,s=0,l=1,d=2,c=s,u="elfinder-quicklook-navbar-icon",p="elfinder-quicklook-fullscreen",h=function(t){e(document).trigger(e.Event("keydown",{keyCode:t,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))},f=function(e){return{opacity:0,width:20,height:"list"==o.view?1:20,top:e.offset().top+"px",left:e.offset().left+"px"}},m=function(){var i=e(window),a=Math.min(t,e(window).width()-10),r=Math.min(n,e(window).height()-80);return{opacity:1,width:a,height:r,top:parseInt((i.height()-r-60)/2+i.scrollTop()),left:parseInt((i.width()-a)/2+i.scrollLeft())}},g=function(e){var t=document.createElement(e.substr(0,e.indexOf("/"))),n=!1;try{n=t.canPlayType&&t.canPlayType(e)}catch(i){}return n&&""!==n&&"no"!=n},v=e('<div class="elfinder-quicklook-title"/>'),b=e("<div/>"),y=e('<div class="elfinder-quicklook-info"/>'),w=e('<div class="'+u+" "+u+'-fullscreen"/>').mousedown(function(t){var n=r.window,a=n.hasClass(p),s="scroll."+o.namespace,l=e(window);t.stopPropagation(),a?(n.css(n.data("position")).unbind("mousemove"),l.unbind(s).trigger(r.resize).unbind(r.resize),x.unbind("mouseenter").unbind("mousemove")):(n.data("position",{left:n.css("left"),top:n.css("top"),width:n.width(),height:n.height()}).css({width:"100%",height:"100%"}),e(window).bind(s,function(){n.css({left:parseInt(e(window).scrollLeft())+"px",top:parseInt(e(window).scrollTop())+"px"})}).bind(r.resize,function(){r.preview.trigger("changesize")}).trigger(s).trigger(r.resize),n.bind("mousemove",function(){x.stop(!0,!0).show().delay(3e3).fadeOut("slow")}).mousemove(),x.mouseenter(function(){x.stop(!0,!0).show()}).mousemove(function(e){e.stopPropagation()})),x.attr("style","").draggable(a?"destroy":{}),n.toggleClass(p),e(this).toggleClass(u+"-fullscreen-off");var d=n;i.is(".ui-resizable")&&(d=d.add(i)),e.fn.resizable&&!o.UA.Touch&&d.resizable(a?"enable":"disable").removeClass("ui-state-disabled")}),x=e('<div class="elfinder-quicklook-navbar"/>').append(e('<div class="'+u+" "+u+'-prev"/>').mousedown(function(){h(37)})).append(w).append(e('<div class="'+u+" "+u+'-next"/>').mousedown(function(){h(39)})).append('<div class="elfinder-quicklook-navbar-separator"/>').append(e('<div class="'+u+" "+u+'-close"/>').mousedown(function(){r.window.trigger("close")}));this.resize="resize."+o.namespace,this.info=e('<div class="elfinder-quicklook-info-wrapper"/>').append(b).append(y),this.preview=e('<div class="elfinder-quicklook-preview ui-helper-clearfix"/>').bind("change",function(){r.info.attr("style","").hide(),b.removeAttr("class").attr("style",""),y.html("")}).bind("update",function(t){var n,i=r.fm,a=(r.preview,t.file),o='<div class="elfinder-quicklook-info-data">{value}</div>';a?(!a.read&&t.stopImmediatePropagation(),r.window.data("hash",a.hash),r.preview.unbind("changesize").trigger("change").children().remove(),v.html(i.escape(a.name)),y.html(o.replace(/\{value\}/,i.escape(a.name))+o.replace(/\{value\}/,i.mime2kind(a))+("directory"==a.mime?"":o.replace(/\{value\}/,i.formatSize(a.size)))+o.replace(/\{value\}/,i.i18n("modify")+": "+i.formatDate(a))),b.addClass("elfinder-cwd-icon ui-corner-all "+i.mime2class(a.mime)),a.tmb&&e("<img/>").hide().appendTo(r.preview).load(function(){b.css("background",'url("'+n+'") center center no-repeat'),e(this).remove()}).attr("src",n=i.tmb(a.hash)),r.info.delay(100).fadeIn(10)):t.stopImmediatePropagation()}),this.window=e('<div class="ui-helper-reset ui-widget elfinder-quicklook" style="position:absolute"/>').click(function(e){e.stopPropagation()}).append(e('<div class="elfinder-quicklook-titlebar"/>').append(v).append(e('<span class="ui-icon ui-icon-circle-close"/>').mousedown(function(e){e.stopPropagation(),r.window.trigger("close")}))).append(this.preview.add(x)).append(r.info.hide()).draggable({handle:"div.elfinder-quicklook-titlebar"}).bind("open",function(){var e,t=r.window,n=r.value;r.closed()&&n&&(e=a.find("#"+o.cwdHash2Id(n.hash))).length&&(x.attr("style",""),c=l,e.trigger("scrolltoview"),t.css(f(e)).show().animate(m(),550,function(){c=d,r.update(1,r.value)}))}).bind("close",function(){var e=r.window,t=r.preview.trigger("change"),n=(r.value,a.find("#"+o.cwdHash2Id(e.data("hash")))),i=function(){c=s,e.hide(),t.children().remove(),r.update(0,r.value)};r.opened()&&(c=l,e.hasClass(p)&&w.mousedown(),n.length?e.animate(f(n),500,i):i())}),this.alwaysEnabled=!0,this.value=null,this.handlers={select:function(){this.update(void 0,this.fm.selectedFiles()[0])},error:function(){r.window.is(":visible")&&r.window.data("hash","").trigger("close")},"searchshow searchhide":function(){this.opened()&&this.window.trigger("close")}},this.shortcuts=[{pattern:"space"}],this.support={audio:{ogg:g('audio/ogg; codecs="vorbis"'),mp3:g("audio/mpeg;"),wav:g('audio/wav; codecs="1"'),m4a:g("audio/x-m4a;")||g("audio/aac;")},video:{ogg:g('video/ogg; codecs="theora"'),webm:g('video/webm; codecs="vp8, vorbis"'),mp4:g('video/mp4; codecs="avc1.42E01E"')||g('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')}},this.closed=function(){return c==s},this.opened=function(){return c==d},this.init=function(){var s=this.options,l=this.window,d=this.preview;t=s.width>0?parseInt(s.width):450,n=s.height>0?parseInt(s.height):300,o.one("load",function(){i=o.getUI(),a=o.getUI("cwd"),l.appendTo("body").zIndex(100+i.zIndex()),e(document).keydown(function(e){27==e.keyCode&&r.opened()&&l.trigger("close")}),e.fn.resizable&&!o.UA.Touch&&l.resizable({handles:"se",minWidth:350,minHeight:120,resize:function(){d.trigger("changesize")}}),r.change(function(){r.opened()&&(r.value?d.trigger(e.Event("update",{file:r.value})):l.trigger("close"))}),e.each(o.commands.quicklook.plugins||[],function(e,t){"function"==typeof t&&new t(r)}),d.bind("update",function(){r.info.show()})})},this.getstate=function(){return 1==this.fm.selected().length?c==d?1:0:-1},this.exec=function(){this.enabled()&&this.window.trigger(this.opened()?"close":"open")},this.hideinfo=function(){this.info.stop(!0).hide()}},elFinder.prototype.commands.quicklook.plugins=[function(t){var n=["image/jpeg","image/png","image/gif"],i=t.preview;e.each(navigator.mimeTypes,function(t,i){var a=i.type;0===a.indexOf("image/")&&e.inArray(a,n)&&n.push(a)}),i.bind("update",function(a){var r,o=a.file;-1!==e.inArray(o.mime,n)&&(a.stopImmediatePropagation(),r=e("<img/>").hide().appendTo(i).load(function(){setTimeout(function(){var e=(r.width()/r.height()).toFixed(2);i.bind("changesize",function(){var t,n,a=parseInt(i.width()),o=parseInt(i.height());e<(a/o).toFixed(2)?(n=o,t=Math.floor(n*e)):(t=a,n=Math.floor(t/e)),r.width(t).height(n).css("margin-top",o>n?Math.floor((o-n)/2):0)}).trigger("changesize"),t.hideinfo(),r.fadeIn(100)},1)}).attr("src",t.fm.openUrl(o.hash)))})},function(t){var n=["text/html","application/xhtml+xml"],i=t.preview,a=t.fm;i.bind("update",function(r){var o,s=r.file;-1!==e.inArray(s.mime,n)&&(r.stopImmediatePropagation(),i.one("change",function(){"pending"==o.state()&&o.reject()}),o=a.request({data:{cmd:"get",target:s.hash,current:s.phash,conv:1},preventDefault:!0}).done(function(n){t.hideinfo(),doc=e('<iframe class="elfinder-quicklook-preview-html"/>').appendTo(i)[0].contentWindow.document,doc.open(),doc.write(n.content),doc.close()}))})},function(t){var n=t.fm,i=n.res("mimes","text"),a=t.preview;a.bind("update",function(r){var o,s=r.file,l=s.mime;(0===l.indexOf("text/")||-1!==e.inArray(l,i))&&(r.stopImmediatePropagation(),a.one("change",function(){"pending"==o.state()&&o.reject()}),o=n.request({data:{cmd:"get",target:s.hash,conv:1},preventDefault:!0}).done(function(i){t.hideinfo(),e('<div class="elfinder-quicklook-preview-text-wrapper"><pre class="elfinder-quicklook-preview-text">'+n.escape(i.content)+"</pre></div>").appendTo(a)}))})},function(t){var n=t.fm,i="application/pdf",a=t.preview,r=!1;n.UA.Safari&&"mac"==n.OS||n.UA.IE?r=!0:e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){return t.type==i?!(r=!0):void 0})}),r&&a.bind("update",function(r){var o,s=r.file;s.mime==i&&(r.stopImmediatePropagation(),a.one("change",function(){o.unbind("load").remove()}),o=e('<iframe class="elfinder-quicklook-preview-pdf"/>').hide().appendTo(a).load(function(){t.hideinfo(),o.show()}).attr("src",n.url(s.hash)))})},function(t){var n=t.fm,i="application/x-shockwave-flash",a=t.preview,r=!1;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){return t.type==i?!(r=!0):void 0})}),r&&a.bind("update",function(r){var o,s=r.file;s.mime==i&&(r.stopImmediatePropagation(),t.hideinfo(),a.append(o=e('<embed class="elfinder-quicklook-preview-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+n.url(s.hash)+'" quality="high" type="application/x-shockwave-flash" />')))})},function(t){var n,i=t.preview,a=!!t.options.autoplay,r={"audio/mpeg":"mp3","audio/mpeg3":"mp3","audio/mp3":"mp3","audio/x-mpeg3":"mp3","audio/x-mp3":"mp3","audio/x-wav":"wav","audio/wav":"wav","audio/x-m4a":"m4a","audio/aac":"m4a","audio/mp4":"m4a","audio/x-mp4":"m4a","audio/ogg":"ogg"};i.bind("update",function(o){var s=o.file,l=r[s.mime];t.support.audio[l]&&(o.stopImmediatePropagation(),n=e('<audio class="elfinder-quicklook-preview-audio" controls preload="auto" autobuffer><source src="'+t.fm.openUrl(s.hash)+'" /></audio>').appendTo(i),a&&n[0].play())}).bind("change",function(){n&&n.parent().length&&(n[0].pause(),n.remove(),n=null)})},function(t){var n,i=t.preview,a=!!t.options.autoplay,r={"video/mp4":"mp4","video/x-m4v":"mp4","video/ogg":"ogg","application/ogg":"ogg","video/webm":"webm"};i.bind("update",function(o){var s=o.file,l=r[s.mime];t.support.video[l]&&(o.stopImmediatePropagation(),t.hideinfo(),n=e('<video class="elfinder-quicklook-preview-video" controls preload="auto" autobuffer><source src="'+t.fm.openUrl(s.hash)+'" /></video>').appendTo(i),a&&n[0].play())}).bind("change",function(){n&&n.parent().length&&(n[0].pause(),n.remove(),n=null)})},function(t){var n,i=t.preview,a=[];e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){(0===t.type.indexOf("audio/")||0===t.type.indexOf("video/"))&&a.push(t.type)})}),i.bind("update",function(r){var o,s=r.file,l=s.mime;-1!==e.inArray(s.mime,a)&&(r.stopImmediatePropagation(),(o=0===l.indexOf("video/"))&&t.hideinfo(),n=e('<embed src="'+t.fm.openUrl(s.hash)+'" type="'+l+'" class="elfinder-quicklook-preview-'+(o?"video":"audio")+'"/>').appendTo(i))}).bind("change",function(){n&&n.parent().length&&(n.remove(),n=null)})}],elFinder.prototype.commands.reload=function(){var t=this,n=!1;this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+shift+r f5"}],this.getstate=function(){return 0},this.init=function(){this.fm.bind("search searchend",function(e){n="search"==e.type})},this.fm.bind("contextmenu",function(){var n=t.fm;if(n.options.sync>=1e3){var i;t.extra={icon:"accept",node:e("<span/>").attr({title:n.i18n("autoSync")}).on("click",function(e){e.stopPropagation(),e.preventDefault(),i.parent().toggleClass("ui-state-disabled",n.options.syncStart).parent().removeClass("ui-state-hover"),n.options.syncStart=!n.options.syncStart,n.autoSync(n.options.syncStart?null:"stop")})},i=t.extra.node,i.ready(function(){setTimeout(function(){i.parent().toggleClass("ui-state-disabled",!n.options.syncStart)},10)})}}),this.exec=function(){var t=this.fm;if(!n){var i=t.sync(),a=setTimeout(function(){t.notify({type:"reload",cnt:1,hideCnt:!0}),i.always(function(){t.notify({type:"reload",cnt:-1})})},t.notifyDelay);return i.always(function(){clearTimeout(a),t.trigger("reload")})}e("div.elfinder-toolbar > div."+t.res("class","searchbtn")+" > span.ui-icon-search").click()}},elFinder.prototype.commands.rename=function(){this.shortcuts=[{pattern:"f2"+("mac"==this.fm.OS?" enter":"")}],this.getstate=function(e){var e=this.files(e);return this._disabled||1!=e.length||!e[0].phash||e[0].locked?-1:0},this.exec=function(t){var n,i=this.fm,a=i.getUI("cwd"),r=t||(i.selected().length?i.selected():!1)||[i.cwd().hash],o=r.length,s=i.file(r.shift()),l=".elfinder-cwd-filename",d=t&&t._type?t._type:i.selected().length?"files":"navbar",c="navbar"===d,u=i.cwd().hash==s.hash,p="files"===d&&"list"!=i.storage("view"),h=function(){p?(b.zIndex("").css("position",""),g.css("max-height","")):c||(b.css("width",""),b.parent("td").css("overflow",""))},f=e.Deferred().done(function(e){u&&i.exec("open",e.added[0].hash)}).fail(function(e){var t=m.parent(),n=i.escape(s.name);p&&(n=n.replace(/([_.])/g,"&#8203;$1")),h(),c?m.replaceWith(n):t.length?(m.remove(),t.html(n)):(a.find("#"+i.cwdHash2Id(s.hash)).find(l).html(n),setTimeout(function(){a.find("#"+i.cwdHash2Id(s.hash)).click()},50)),e&&i.error(e)}).always(function(){i.enable()}),m=e(p?"<textarea/>":'<input type="text"/>').on("keyup text",function(){p?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):n&&(this.style.width=n+"px",this.scrollWidth>n&&(this.style.width=this.scrollWidth+10+"px"))}).keydown(function(t){t.stopPropagation(),t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?f.reject():t.keyCode==e.ui.keyCode.ENTER&&m.blur()}).mousedown(function(e){e.stopPropagation()}).click(function(e){e.stopPropagation()}).dblclick(function(e){e.stopPropagation(),e.preventDefault()}).blur(function(){var t=e.trim(m.val()),n=(m.parent(),!0);if(b.length){if(m[0].setSelectionRange&&m[0].setSelectionRange(0,0),t==s.name)return f.reject();if(i.options.validName&&i.options.validName.test)try{n=i.options.validName.test(t)}catch(r){n=!1}if(!t||".."===t||!n)return i.error("errInvName"),!1;if(i.fileByName(t,s.phash))return i.error(["errExists",t]),!1;h(),(c?b:g).html(i.escape(t)),i.lockfiles({files:[s.hash]}),i.request({data:{cmd:"rename",target:s.hash,name:t},notify:{type:"rename",cnt:1}}).fail(function(){f.reject(),i.sync()}).done(function(e){if(f.resolve(e),!c&&e&&e.added&&e.added[0]){var t=a.find("#"+i.cwdHash2Id(e.added[0].hash));t.length&&t.trigger("scrolltoview")}}).always(function(){i.unlockfiles({files:[s.hash]})})}}),g=c?e("#"+i.navHash2Id(s.hash)).contents().filter(function(){return 3==this.nodeType&&e(this).parent().attr("id")===i.navHash2Id(s.hash)}):a.find("#"+i.cwdHash2Id(s.hash)).find(l),v=s.name.replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/gi,""),b=g.parent();return c?g.replaceWith(m.val(s.name)):(p?(b.zIndex(b.zIndex()+1).css("position","relative"),g.css("max-height","none")):c||(n=b.width(),b.width(n-15),b.parent("td").css("overflow","visible")),g.empty().append(m.val(s.name))),o>1||this.getstate([s.hash])<0?f.reject():s&&g.length?s.locked?f.reject(["errLocked",s.name]):(i.one("select",function(){m.parent().length&&s&&-1===e.inArray(s.hash,i.selected())&&m.blur()}),m.trigger("keyup"),m.select().focus(),m[0].setSelectionRange&&m[0].setSelectionRange(0,v.length),f):f.reject("errCmdParams",this.title)}},elFinder.prototype.commands.resize=function(){this.updateOnSelect=!1,this.getstate=function(){var e=this.fm.selectedFiles();return!this._disabled&&1==e.length&&e[0].read&&e[0].write&&-1!==e[0].mime.indexOf("image/")?0:-1
15
- },this.exec=function(t){var n,i,a=this.fm,r=this.files(t),o=e.Deferred(),s=function(t,n){var i="image/jpeg"===t.mime,r=e('<div class="elfinder-dialog-resize"/>'),s='<input type="text" size="5"/>',l='<div class="elfinder-resize-row"/>',d='<div class="elfinder-resize-label"/>',c=e('<div class="elfinder-resize-control"/>'),u=e('<div class="elfinder-resize-preview"/>'),p=e('<div class="elfinder-resize-spinner">'+a.i18n("ntfloadimg")+"</div>"),h=e('<div class="elfinder-resize-handle"/>'),f=e('<div class="elfinder-resize-handle"/>'),m=e('<div class="elfinder-resize-uiresize"/>'),g=e('<div class="elfinder-resize-uicrop"/>'),v='<div class="ui-widget-content ui-corner-all elfinder-buttonset"/>',b='<div class="ui-state-default elfinder-button"/>',y='<span class="ui-widget-content elfinder-toolbar-button-separator"/>',w=e('<div class="elfinder-resize-rotate"/>'),x=e(b).attr("title",a.i18n("rotate-cw")).append(e('<span class="elfinder-button-icon elfinder-button-icon-rotate-l"/>').click(function(){B-=90,nt.update(B)})),k=e(b).attr("title",a.i18n("rotate-ccw")).append(e('<span class="elfinder-button-icon elfinder-button-icon-rotate-r"/>').click(function(){B+=90,nt.update(B)})),C=e("<span />"),T=e('<div class="ui-state-default ui-corner-all elfinder-resize-reset"><span class="ui-icon ui-icon-arrowreturnthick-1-w"/></div>'),I=e('<div class="elfinder-resize-type"/>').append('<input type="radio" name="type" id="'+n+'-resize" value="resize" checked="checked" /><label for="'+n+'-resize">'+a.i18n("resize")+"</label>").append('<input type="radio" name="type" id="'+n+'-crop" value="crop" /><label for="'+n+'-crop">'+a.i18n("crop")+"</label>").append('<input type="radio" name="type" id="'+n+'-rotate" value="rotate" /><label for="'+n+'-rotate">'+a.i18n("rotate")+"</label>"),F=e("input",I).attr("disabled","disabled").change(function(){var t=e("input:checked",I).val();Z(),it(!0),at(!0),rt(!0),"resize"==t?(m.show(),w.hide(),g.hide(),it()):"crop"==t?(w.hide(),m.hide(),g.show(),at()):"rotate"==t&&(m.hide(),g.hide(),w.show(),rt())}),M=e('<input type="checkbox" checked="checked"/>').change(function(){q=!!M.prop("checked"),et.fixHeight(),it(!0),it()}),P=e(s).change(function(){var e=parseInt(P.val()),t=parseInt(q?Math.round(e/H):S.val());e>0&&t>0&&(et.updateView(e,t),S.val(t))}),S=e(s).change(function(){var e=parseInt(S.val()),t=parseInt(q?Math.round(e*H):P.val());t>0&&e>0&&(et.updateView(t,e),P.val(t))}),z=e(s).change(function(){tt.updateView()}),A=e(s).change(function(){tt.updateView()}),D=e(s).change(function(){tt.updateView()}),O=e(s).change(function(){tt.updateView()}),U=i?e(s).val(a.option("jpgQuality")).addClass("quality").on("blur",function(){var e=Math.min(100,Math.max(1,parseInt(this.value)));r.find("input.quality").val(e)}):null,E=e('<input type="text" size="3" maxlength="3" value="0" />').change(function(){nt.update()}),j=e('<div class="elfinder-resize-rotate-slider"/>').slider({min:0,max:360,value:E.val(),animate:!0,change:function(e,t){t.value!=j.slider("value")&&nt.update(t.value)},slide:function(e,t){nt.update(t.value,!1)}}),H=1,R=1,_=0,N=0,q=!0,L=0,$=0,V=0,W=0,B=0,K=e("<img/>").load(function(){p.remove(),_=K.width(),N=K.height(),H=_/N,et.updateView(_,N),h.append(K.show()).show(),P.val(_),S.val(N);var t=Math.min(L,$)/Math.sqrt(Math.pow(_,2)+Math.pow(N,2));V=_*t,W=N*t,F.button("enable"),c.find("input,select").removeAttr("disabled").filter(":text").keydown(function(t){var n,i=t.keyCode;return t.stopPropagation(),i>=37&&40>=i||i==e.ui.keyCode.BACKSPACE||i==e.ui.keyCode.DELETE||65==i&&(t.ctrlKey||t.metaKey)||27==i?void 0:(9==i&&(n=e(this).parent()[t.shiftKey?"prevAll":"nextAll"]("div.elfinder-resize-row").children(":text"),n.length?n[0].focus():e(this).parent().parent().find(":text:"+(t.shiftKey?"last":"first")).focus()),13==i?(a.confirm({title:e("input:checked",I).val(),text:"confirmReq",accept:{label:"btnApply",callback:function(){ot()}},cancel:{label:"btnCancel",callback:function(){}}}),void 0):(i>=48&&57>=i||i>=96&&105>=i||t.preventDefault(),void 0))}).filter(":first").focus(),it(),T.hover(function(){T.toggleClass("ui-state-hover")}).click(Z)}).error(function(){p.text("Unable to load image").css("background","transparent")}),J=e("<div/>"),G=e("<img/>"),X=e("<div/>"),Y=e("<img/>"),Q=function(e){return i?8*Math.round(e/8):Math.round(e)},Z=function(){P.val(_),S.val(N),et.updateView(_,N)},et={update:function(){P.val(Q(K.width()/R)),S.val(Q(K.height()/R))},updateView:function(e,t){e>L||t>$?e/L>t/$?(R=L/e,K.width(L).height(Math.ceil(t*R))):(R=$/t,K.height($).width(Math.ceil(e*R))):K.width(e).height(t),R=K.width()/e,C.text("1 : "+(1/R).toFixed(2)),et.updateHandle()},updateHandle:function(){h.width(K.width()).height(K.height())},fixHeight:function(){var e,t;q&&(e=P.val(),t=Math.round(e/H),et.updateView(e,t),S.val(t))}},tt={update:function(){D.val(Q((f.data("w")||f.width())/R)),O.val(Q((f.data("h")||f.height())/R)),z.val(Math.round(((f.data("x")||f.offset().left)-G.offset().left)/R)),A.val(Math.round(((f.data("y")||f.offset().top)-G.offset().top)/R))},updateView:function(){var e=parseInt(z.val())*R+G.offset().left,t=parseInt(A.val())*R+G.offset().top,n=D.val()*R,i=O.val()*R;f.data({x:e,y:t,w:n,h:i}).width(Math.round(n)).height(Math.round(i)).offset({left:Math.round(e),top:Math.round(t)}),X.width(f.width()).height(f.height())},resize_update:function(){f.data({w:null,h:null}),tt.update(),X.width(f.width()).height(f.height())},drag_update:function(){f.data({x:null,y:null}),tt.update()}},nt={mouseStartAngle:0,imageStartAngle:0,imageBeingRotated:!1,update:function(e,t){"undefined"==typeof e&&(B=e=parseInt(E.val())),"undefined"==typeof t&&(t=!0),!t||a.UA.Opera||a.UA.ltIE8?Y.rotate(e):Y.animate({rotate:e+"deg"}),e%=360,0>e&&(e+=360),E.val(parseInt(e)),j.slider("value",E.val())},execute:function(e){if(nt.imageBeingRotated){var t=nt.getCenter(Y),n=e.pageX-t[0],i=e.pageY-t[1],a=Math.atan2(i,n),r=a-nt.mouseStartAngle+nt.imageStartAngle;return r=Math.round(180*parseFloat(r)/Math.PI),e.shiftKey&&(r=15*Math.round((r+6)/15)),Y.rotate(r),r%=360,0>r&&(r+=360),E.val(r),j.slider("value",E.val()),!1}},start:function(t){nt.imageBeingRotated=!0;var n=nt.getCenter(Y),i=t.pageX-n[0],a=t.pageY-n[1];return nt.mouseStartAngle=Math.atan2(a,i),nt.imageStartAngle=parseFloat(Y.rotate())*Math.PI/180,e(document).mousemove(nt.execute),!1},stop:function(){return nt.imageBeingRotated?(e(document).unbind("mousemove",nt.execute),setTimeout(function(){nt.imageBeingRotated=!1},10),!1):void 0},getCenter:function(){var e=Y.rotate();Y.rotate(0);var t=Y.offset(),n=t.left+Y.width()/2,i=t.top+Y.height()/2;return Y.rotate(e),Array(n,i)}},it=function(t){e.fn.resizable&&(t?(h.filter(":ui-resizable").resizable("destroy"),h.hide()):(h.show(),h.resizable({alsoResize:K,aspectRatio:q,resize:et.update,stop:et.fixHeight})))},at=function(t){e.fn.draggable&&e.fn.resizable&&(t?(f.filter(":ui-resizable").resizable("destroy").filter(":ui-draggable").draggable("destroy"),J.hide()):(J.show().width(K.width()).height(K.height()),G.width(K.width()).height(K.height()),X.width(K.width()).height(K.height()),f.width(G.width()).height(G.height()).offset(G.offset()).resizable({containment:J,resize:tt.resize_update,handles:"all"}).draggable({handle:X,containment:G,drag:tt.drag_update}),tt.update()))},rt=function(t){e.fn.draggable&&e.fn.resizable&&(t?Y.hide():Y.show().width(V).height(W).css("margin-top",($-W)/2+"px").css("margin-left",(L-V)/2+"px"))},ot=function(){var n,i,s,l,d,c,u=e("input:checked",I).val();if("resize"==u)n=parseInt(P.val())||0,i=parseInt(S.val())||0;else if("crop"==u)n=parseInt(D.val())||0,i=parseInt(O.val())||0,s=parseInt(z.val())||0,l=parseInt(A.val())||0;else if("rotate"==u){if(n=_,i=N,d=parseInt(E.val())||0,0>d||d>360)return a.error("Invalid rotate degree");if(0==d||360==d)return a.error("Image dose not rotated")}if(c=U?parseInt(U.val()):0,"rotate"!=u){if(0>=n||0>=i)return a.error("Invalid image size");if(n==_&&i==N)return a.error("Image size not changed")}r.elfinderdialog("close"),a.request({data:{cmd:"resize",target:t.hash,width:n,height:i,x:s,y:l,degree:d,quality:c,mode:u},notify:{type:"resize",cnt:1}}).fail(function(e){o.reject(e)}).done(function(){o.resolve()})},st={},lt="elfinder-resize-handle-hline",dt="elfinder-resize-handle-vline",ct="elfinder-resize-handle-point",ut=a.url(t.hash);Y.mousedown(nt.start),e(document).mouseup(nt.stop),m.append(e(l).append(e(d).text(a.i18n("width")),P,T),e(l).append(e(d).text(a.i18n("height")),S),e(l).append(e("<label/>").text(a.i18n("aspectRatio")).prepend(M)),U?e(l).append(e(d).text(a.i18n("quality")),U,e("<span/>").text(" (1-100)")):e(),e(l).append(e(d).text(a.i18n("scale")),C)),g.append(e(l).append(e(d).text("X"),z),e(l).append(e(d).text("Y")).append(A),e(l).append(e(d).text(a.i18n("width")),D),e(l).append(e(d).text(a.i18n("height")),O),U?e(l).append(e(d).text(a.i18n("quality")),U.clone(!0),e("<span/>").text(" (1-100)")):e()),w.append(e(l).append(e(d).text(a.i18n("rotate")),E,e("<span/>").text(a.i18n("degree")),e(v).append(x,e(y),k)),e(l).css("height","20px").append(j),U?e(l).append(e(d).text(a.i18n("quality")),U.clone(!0),e("<span/>").text(" (1-100)")):e()),r.append(I).on("resize",function(e){e.stopPropagation()}),c.append(e(l),m,g.hide(),w.hide()).find("input,select").attr("disabled","disabled"),h.append('<div class="'+lt+" "+lt+'-top"/>','<div class="'+lt+" "+lt+'-bottom"/>','<div class="'+dt+" "+dt+'-left"/>','<div class="'+dt+" "+dt+'-right"/>','<div class="'+ct+" "+ct+'-e"/>','<div class="'+ct+" "+ct+'-se"/>','<div class="'+ct+" "+ct+'-s"/>'),u.append(p).append(h.hide()).append(K.hide()),f.css("position","absolute").append('<div class="'+lt+" "+lt+'-top"/>','<div class="'+lt+" "+lt+'-bottom"/>','<div class="'+dt+" "+dt+'-left"/>','<div class="'+dt+" "+dt+'-right"/>','<div class="'+ct+" "+ct+'-n"/>','<div class="'+ct+" "+ct+'-e"/>','<div class="'+ct+" "+ct+'-s"/>','<div class="'+ct+" "+ct+'-w"/>','<div class="'+ct+" "+ct+'-ne"/>','<div class="'+ct+" "+ct+'-se"/>','<div class="'+ct+" "+ct+'-sw"/>','<div class="'+ct+" "+ct+'-nw"/>'),u.append(J.css("position","absolute").hide().append(G,f.append(X))),u.append(Y.hide()),u.css("overflow","hidden"),r.append(u,c),st[a.i18n("btnApply")]=ot,st[a.i18n("btnCancel")]=function(){r.elfinderdialog("close")},a.dialog(r,{title:a.escape(t.name),width:650,resizable:!1,destroyOnClose:!0,buttons:st,open:function(){var t=r.width()-20;u.width()>t&&u.width(t),u.zIndex(1+e(this).parent().zIndex()),L=u.width()-(h.outerWidth()-h.width()),$=u.height()-(h.outerHeight()-h.height()),K.attr("src",ut+(-1===ut.indexOf("?")?"?":"&")+"_="+Math.random()),G.attr("src",K.attr("src")),Y.attr("src",K.attr("src"))}}).attr("id",n),a.UA.ltIE8&&e(".elfinder-dialog").css("filter",""),T.css("left",P.position().left+P.width()+12),X.css({opacity:.2,"background-color":"#fff",position:"absolute"}),f.css("cursor","move"),f.find(".elfinder-resize-handle-point").css({"background-color":"#fff",opacity:.5,"border-color":"#000"}),Y.css("cursor","pointer"),I.buttonset()};return r.length&&-1!==r[0].mime.indexOf("image/")?(n="resize-"+a.namespace+"-"+r[0].hash,i=a.getUI().find("#"+n),i.length?(i.elfinderdialog("toTop"),o.resolve()):(s(r[0],n),o)):o.reject()}},function(e){var t=function(e,t){var n=0;for(n in t)if("undefined"!=typeof e[t[n]])return t[n];return e[t[n]]="",t[n]};if(e.cssHooks.rotate={get:function(t){return e(t).rotate()},set:function(t,n){return e(t).rotate(n),n}},e.cssHooks.transform={get:function(e){var n=t(e.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return e.style[n]},set:function(e,n){var i=t(e.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return e.style[i]=n,n}},e.fn.rotate=function(e){if("undefined"==typeof e){if(window.opera){var t=this.css("transform").match(/rotate\((.*?)\)/);return t&&t[1]?Math.round(180*parseFloat(t[1])/Math.PI):0}var t=this.css("transform").match(/rotate\((.*?)\)/);return t&&t[1]?parseInt(t[1]):0}return this.css("transform",this.css("transform").replace(/none|rotate\(.*?\)/,"")+"rotate("+parseInt(e)+"deg)"),this},e.fx.step.rotate=function(t){0==t.state&&(t.start=e(t.elem).rotate(),t.now=t.start),e(t.elem).rotate(t.now)},"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName){var n=function(e){for(var t=e,n=t.offsetLeft,i=t.offsetTop;t.offsetParent&&(t=t.offsetParent,t==document.body||"static"==t.currentStyle.position);)t!=document.body&&t!=document.documentElement&&(n-=t.scrollLeft,i-=t.scrollTop),n+=t.offsetLeft,i+=t.offsetTop;return{x:n,y:i}},i=function(e){if("static"==e.currentStyle.position){var t=n(e);e.style.position="absolute",e.style.left=t.x+"px",e.style.top=t.y+"px"}},a=function(e,t){var n,a=1,r=1,o=1,s=1;if("undefined"!=typeof e.style.msTransform)return!0;i(e),n=t.match(/rotate\((.*?)\)/);var l=n&&n[1]?parseInt(n[1]):0;l%=360,0>l&&(l=360+l);var d=l*Math.PI/180,c=Math.cos(d),u=Math.sin(d);a*=c,r*=-u,o*=u,s*=c,e.style.filter=(e.style.filter||"").replace(/progid:DXImageTransform\.Microsoft\.Matrix\([^)]*\)/,"")+("progid:DXImageTransform.Microsoft.Matrix(M11="+a+",M12="+r+",M21="+o+",M22="+s+",FilterType='bilinear',sizingMethod='auto expand')");var p=parseInt(e.style.width||e.width||0),h=parseInt(e.style.height||e.height||0),d=l*Math.PI/180,f=Math.abs(Math.cos(d)),m=Math.abs(Math.sin(d)),g=(p-(p*f+h*m))/2,v=(h-(p*m+h*f))/2;return e.style.marginLeft=Math.floor(g)+"px",e.style.marginTop=Math.floor(v)+"px",!0},r=e.cssHooks.transform.set;e.cssHooks.transform.set=function(e,t){return r.apply(this,[e,t]),a(e,t),t}}}(jQuery),elFinder.prototype.commands.rm=function(){this.shortcuts=[{pattern:"delete ctrl+backspace"}],this.getstate=function(t){var n=this.fm;return t=t||n.selected(),!this._disabled&&t.length&&e.map(t,function(e){var t=n.file(e);return t&&t.phash&&!t.locked?e:null}).length==t.length?0:-1},this.exec=function(t){var n,i,a,r,o,s,l,d,c=this,u=this.fm,p=e.Deferred().fail(function(e){e&&u.error(e)}),h=this.files(t),f=h.length,m=(u.cwd().hash,'<div class="ui-helper-clearfix elfinder-rm-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}<div class="elfinder-rm-desc">{desc}</div></div>');return!f||this._disabled?p.reject():(e.each(h,function(e,t){return t.phash?t.locked?!p.reject(["errLocked",t.name]):void 0:!p.reject(["errRm",t.name,"errPerm"])}),"pending"==p.state()&&(n=this.hashes(t),f=h.length,l=[],f>1?(e.map(h,function(e){return"directory"==e.mime?1:null}).length||(o=0,e.each(h,function(e,t){if(!t.size||"unknown"==t.size)return o="unknown",!1;var n=parseInt(t.size);n>=0&&o>=0&&(o+=n)}),l.push(u.i18n("size")+": "+u.formatSize(o))),i=[e(m.replace("{class}","elfinder-cwd-icon-group").replace("{title}","<strong>"+u.i18n("items")+": "+f+"</strong>").replace("{desc}",l.join("<br>")))]):(a=h[0],a.tmb&&(s=u.option("tmbUrl")+a.tmb),a.size&&l.push(u.i18n("size")+": "+u.formatSize(a.size)),l.push(u.i18n("modify")+": "+u.formatDate(a)),r=u.escape(a.i18||a.name).replace(/([_.])/g,"&#8203;$1"),i=[e(m.replace("{class}",u.mime2class(a.mime)).replace("{title}","<strong>"+r+"</strong>").replace("{desc}",l.join("<br>")))]),i.push("confirmRm"),u.lockfiles({files:n}),d=u.confirm({title:c.title,text:i,accept:{label:"btnRm",callback:function(){u.request({data:{cmd:"rm",targets:n},notify:{type:"rm",cnt:f},preventFail:!0}).fail(function(e){p.reject(e)}).done(function(e){p.done(e)}).always(function(){u.unlockfiles({files:n})})}},cancel:{label:"btnCancel",callback:function(){u.unlockfiles({files:n}),u.selectfiles({files:n}),p.reject()}}}),s&&e("<img/>").load(function(){d.find(".elfinder-cwd-icon").css("background",'url("'+s+'") center center no-repeat')}).attr("src",s)),p)}},elFinder.prototype.commands.search=function(){this.title="Find files",this.options={ui:"searchbutton"},this.alwaysEnabled=!0,this.updateOnSelect=!1,this.getstate=function(){return 0},this.exec=function(t,n,i){var a=this.fm;return"string"==typeof t&&t?("object"==typeof n&&(i=n.mime||"",n=n.target||""),n=n?n:"",i=i?e.trim(i).replace(","," ").split(" "):[],e.each(i,function(){return e.trim(this)}),a.trigger("searchstart",{query:t,target:n,mimes:i}),a.request({data:{cmd:"search",q:t,target:n,mimes:i},notify:{type:"search",cnt:1,hideCnt:!0}})):(a.getUI("toolbar").find("."+a.res("class","searchbtn")+" :text").focus(),e.Deferred().reject())}},elFinder.prototype.commands.sort=function(){var t,n=this,i=n.fm;this.options={ui:"sortbutton"},i.bind("open sortchange",function(){n.variants=[],e.each(i.sortRules,function(e){var t={type:e,order:e==i.sortType?"asc"==i.sortOrder?"desc":"asc":i.sortOrder},a=e==i.sortType?"asc"==t.order?"n":"s":"";n.variants.push([t,(a?'<span class="ui-icon ui-icon-arrowthick-1-'+a+'"></span>':"")+"&nbsp;"+i.i18n("sort"+e)])})}),i.bind("open sortchange viewchange search searchend",function(){t&&clearTimeout(t),t=setTimeout(function(){var t=e(i.cwd).find("div.elfinder-cwd-wrapper-list table");t.length&&e.each(i.sortRules,function(a){var r=t.find("thead tr td.elfinder-cwd-view-th-"+a);if(r.length){var o,s=a==i.sortType,l={type:a,order:s?"asc"==i.sortOrder?"desc":"asc":i.sortOrder};s&&(r.addClass("ui-state-active"),o="asc"==i.sortOrder?"n":"s",e('<span class="ui-icon ui-icon-triangle-1-'+o+'"/>').appendTo(r)),e(r).on("click",function(e){e.stopPropagation(),n.exec([],l)}).hover(function(){e(this).addClass("ui-state-hover")},function(){e(this).removeClass("ui-state-hover")})}})},100)}),this.getstate=function(){return 0},this.exec=function(t,n){var i=this.fm,a=e.extend({type:i.sortType,order:i.sortOrder,stick:i.sortStickFolders},n);return this.fm.setSort(a.type,a.order,a.stick),e.Deferred().resolve()}},elFinder.prototype.commands.up=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+up"}],this.getstate=function(){return this.fm.cwd().phash?0:-1},this.exec=function(){return this.fm.cwd().phash?this.fm.exec("open",this.fm.cwd().phash):e.Deferred().reject()}},elFinder.prototype.commands.upload=function(){var t=this.fm.res("class","hover");this.disableOnSearch=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+u"}],this.getstate=function(e){var t,n=this.fm,e=n.directUploadTarget?[n.directUploadTarget]:e||[n.cwd().hash];return this._disabled||1!=e.length||(t=n.file(e[0])),t&&"directory"==t.mime&&t.write?0:-1},this.exec=function(n){var i,a,r,o,s,l,d,c=this.fm,u=n&&n instanceof Array?n:null,p=!u&&n&&n.target?[n.target]:u,h=function(e){c.upload(e).fail(function(e){m.reject(e)}).done(function(e){var t=c.getUI("cwd");if(m.resolve(e),e&&e.added&&e.added[0]){var n=t.find("#"+c.cwdHash2Id(e.added[0].hash));n.length&&n.trigger("scrolltoview")}})},f=function(e){i.elfinderdialog("close"),u&&(e.target=u[0]),h(e)},m=e.Deferred();return this.getstate(p)<0?m.reject():(l=function(e){e.stopPropagation(),e.preventDefault();var t=!1,n="",i=null,a="",r=null,o=e._target||null;try{i=e.dataTransfer.getData("elfinderfrom")}catch(e){}if(i&&(a=window.location.href+c.cwd().hash,!o&&i===a||o===a))return m.reject(),void 0;try{r=e.dataTransfer.getData("text/html")}catch(e){}r?(t=[r],n="html"):e.dataTransfer&&e.dataTransfer.items&&e.dataTransfer.items.length?(t=e.dataTransfer,n="data"):e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files.length?(t=e.dataTransfer.files,n="files"):(r=e.dataTransfer.getData("text"))&&(t=[r],n="text"),t?h({files:t,type:n,target:o}):m.reject()},!u&&n?(n.input||n.files?(n.type="files",h(n)):n.dropEvt&&l(n.dropEvt),m):(d=function(t){var n,t=t.originalEvent||t,i=[],a=[];if(t.clipboardData){if(t.clipboardData.items&&t.clipboardData.items.length){a=t.clipboardData.items;for(var r=0;r<a.length;r++)"file"==t.clipboardData.items[r].kind&&(n=t.clipboardData.items[r].getAsFile(),i.push(n))}else t.clipboardData.files&&t.clipboardData.files.length&&(i=t.clipboardData.files);if(i.length)return f({files:i,type:"files"}),void 0}var o=t.target||t.srcElement;setTimeout(function(){if(o.innerHTML){e(o).find("img").each(function(t,n){n.src.match(/^webkit-fake-url:\/\//)&&e(n).remove()});var t=o.innerHTML.replace(/<br[^>]*>/gi," "),n=t.match(/<[^>]+>/)?"html":"text";o.innerHTML="",f({files:[t],type:n})}},1)},a=e('<input type="file" multiple="true"/>').change(function(){f({input:a[0],type:"files"})}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"}),r=e('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+c.i18n("selectForUpload")+"</span></div>").append(e("<form/>").append(a)).hover(function(){r.toggleClass(t)}),i=e('<div class="elfinder-upload-dialog-wrapper"/>').append(r),s=e('<div class="ui-corner-all elfinder-upload-dropbox" contenteditable="true">'+c.i18n("dropFilesBrowser")+"</div>").on("paste drop",function(e){d(e)}).on("mousedown click",function(){e(this).focus()}).on("focus",function(){this.innerHTML=""}).on("dragenter mouseover",function(){s.addClass(t)}).on("dragleave mouseout",function(){s.removeClass(t)}),c.dragUpload?(o=e('<div class="ui-corner-all elfinder-upload-dropbox" contenteditable="true">'+c.i18n("dropPasteFiles")+"</div>").on("paste",function(e){d(e)}).on("mousedown click",function(){e(this).focus()}).on("focus",function(){this.innerHTML=""}).on("mouseover",function(){e(this).addClass(t)}).on("mouseout",function(){e(this).removeClass(t)}).prependTo(i).after('<div class="elfinder-upload-dialog-or">'+c.i18n("or")+"</div>")[0],o.addEventListener("dragenter",function(n){n.stopPropagation(),n.preventDefault(),e(o).addClass(t)},!1),o.addEventListener("dragleave",function(n){n.stopPropagation(),n.preventDefault(),e(o).removeClass(t)},!1),o.addEventListener("dragover",function(n){n.stopPropagation(),n.preventDefault(),n.dataTransfer.dropEffect="copy",e(o).addClass(t)},!1),o.addEventListener("drop",function(e){i.elfinderdialog("close"),u&&(e._target=u[0]),l(e)},!1)):s.prependTo(i).after('<div class="elfinder-upload-dialog-or">'+c.i18n("or")+"</div>")[0],c.dialog(i,{title:this.title+(u?" - "+c.escape(c.file(u[0]).name):""),modal:!0,resizable:!1,destroyOnClose:!0}),m))}},elFinder.prototype.commands.view=function(){this.value=this.fm.viewType,this.alwaysEnabled=!0,this.updateOnSelect=!1,this.options={ui:"viewbutton"},this.getstate=function(){return 0},this.exec=function(){var e=this.fm.storage("view","list"==this.value?"icons":"list");this.fm.viewchange(),this.update(void 0,e)}}}(jQuery);
1
  /*!
2
  * elFinder - file manager for web
3
+ * Version 2.1.18 (2016-11-21)
4
  * http://elfinder.org
5
  *
6
  * Copyright 2009-2016, Studio 42
7
+ * Licensed under a 3-clauses BSD license
8
  */
9
+ !function(e){window.elFinder=function(t,n){var i,a,r,o=this,t=e(t),s=e("<div/>").append(t.contents()),l=t.attr("style"),d=t.attr("id")||"",c="elfinder-"+(d?d:Math.random().toString().substr(2,7)),u="mousedown."+c,h="keydown."+c,p="keypress."+c,f=!0,m=!0,g=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],v="",b={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmb:!1},y={},w=[],k={},x={},C=[],T=[],z=[],A=[],I=new o.command(o),F="auto",S=400,M="./sounds/",U=e(document.createElement("audio")).hide().appendTo("body")[0],O=0,D="",E=function(n){var i,a,r,s,l,d,c,u,h={},p={};o.api>=2.1?(o.commandMap=n.options.uiCmdMap&&Object.keys(n.options.uiCmdMap).length?n.options.uiCmdMap:{},D!==JSON.stringify(o.commandMap)&&(D=JSON.stringify(o.commandMap),Object.keys(o.commandMap).length&&(a=o.getUI("contextmenu"),a.data("cmdMaps")||a.data("cmdMaps",{}),i=n.cwd?n.cwd.volumeid:null,i&&!a.data("cmdMaps")[i]&&(a.data("cmdMaps")[i]=o.commandMap)))):o.options.sync=0,n.init?y={}:(u=v,r="elfinder-subtree-loaded "+o.res("class","navexpand"),c=o.res("class","navcollapse"),s=Object.keys(y),l=function(t,n){if(!y[n])return!0;var i="directory"===y[n].mime,a=y[n].phash;(!i||h[a]||!p[a]&&e("#"+o.navHash2Id(y[n].hash)).is(":hidden")&&e("#"+o.navHash2Id(a)).next(".elfinder-navbar-subtree").children().length>100)&&(i||a!==v)&&-1===e.inArray(n,T)?(i&&!h[a]&&(h[a]=!0,e("#"+o.navHash2Id(a)).removeClass(r).next(".elfinder-navbar-subtree").empty()),delete y[n]):i&&(p[a]=!0)},d=function(){s.length&&(e.each(s.splice(0,100),l),s.length&&setTimeout(d,20))},o.trigger("filesgc").one("filesgc",function(){s=[]}),o.one("opendone",function(){u!==v&&(t.data("lazycnt")?o.one("lazydone",d):d())})),o.sorters=[],v=n.cwd.hash,P(n.files),y[v]||P([n.cwd]),o.lastDir(v),o.autoSync()},P=function(t){var n,i,a={name:!0,perm:!0,date:!0,size:!0,kind:!0},r=0===o.sorters.length,s=t.length;for(i=0;s>i;i++)n=t[i],n.name&&n.hash&&n.mime&&(r&&n.phash===v&&(e.each(o.sortRules,function(e){(a[e]||"undefined"!=typeof n[e]||"mode"===e&&"undefined"!=typeof n.perm)&&o.sorters.push(e)}),r=!1),n.isroot&&n.phash&&(o.leafRoots[n.phash]?-1===e.inArray(n.hash,o.leafRoots[n.phash])&&o.leafRoots[n.phash].push(n.hash):o.leafRoots[n.phash]=[n.hash],y[n.phash]&&(y[n.phash].dirs||(y[n.phash].dirs=1),n.ts&&(y[n.phash].ts||0)<n.ts&&(y[n.phash].ts=n.ts))),y[n.hash]=n)},R=function(n){var i,a=n.keyCode,r=!(!n.ctrlKey&&!n.metaKey);f&&(e.each(x,function(e,t){t.type==n.type&&t.keyCode==a&&t.shiftKey==n.shiftKey&&t.ctrlKey==r&&t.altKey==n.altKey&&(n.preventDefault(),n.stopPropagation(),t.callback(n,o),o.debug("shortcut-exec",e+" : "+t.description))}),a!=e.ui.keyCode.TAB||e(n.target).is(":input")||n.preventDefault(),"keydown"===n.type&&a==e.ui.keyCode.ESCAPE&&(t.find(".ui-widget:visible").length||o.clipboard().length&&o.clipboard([]),e.ui.ddmanager&&(i=e.ui.ddmanager.current,i&&i.helper&&i.cancel()),t.find(".ui-widget.elfinder-button-menu").hide()))},H=new Date,j=window.parent!==window,N=function(){var t,n;if(j)try{n=e("iframe",window.parent.document),n.length&&e.each(n,function(n,i){return i.contentWindow===window?(t=e(i),!1):void 0})}catch(i){}return t}();return this.api=null,this.newAPI=!1,this.oldAPI=!1,this.netDrivers=[],this.options=e.extend(!0,{},this._options,n||{}),this.optionProperties=["icon","csscls","tmbUrl","uiCmdMap","netkey"],n.ui&&(this.options.ui=n.ui),n.commands&&(this.options.commands=n.commands),n.uiOptions&&n.uiOptions.toolbar&&(this.options.uiOptions.toolbar=n.uiOptions.toolbar),n.uiOptions&&n.uiOptions.cwd&&n.uiOptions.cwd.listView&&n.uiOptions.cwd.listView.columns&&(this.options.uiOptions.cwd.listView.columns=n.uiOptions.cwd.listView.columns),n.uiOptions&&n.uiOptions.cwd&&n.uiOptions.cwd.listView&&n.uiOptions.cwd.listView.columnsCustomName&&(this.options.uiOptions.cwd.listView.columnsCustomName=n.uiOptions.cwd.listView.columnsCustomName),j||this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),this.isCORS=!1,function(){var t,i=document.createElement("a");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(window.location.host!==i.host||t&&window.location.host!==t.host)&&(o.isCORS=!0,e.isPlainObject(o.options.customHeaders)||(o.options.customHeaders={}),e.isPlainObject(o.options.xhrFields)||(o.options.xhrFields={}),o.options.requestType="post",o.options.customHeaders["X-Requested-With"]="XMLHttpRequest",o.options.xhrFields.withCredentials=!0)}(),e.extend(this.options.contextmenu,n.contextmenu),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",this.customData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb"],this.id=d,this.navPrefix="nav"+(elFinder.prototype.uniqueid?elFinder.prototype.uniqueid:"")+"-",this.cwdPrefix=elFinder.prototype.uniqueid?"cwd"+elFinder.prototype.uniqueid+"-":"",++elFinder.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=c,this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?this.options.lang:"en",r="en"==this.lang?this.i18.en:e.extend(!0,{},this.i18.en,this.i18[this.lang]),this.direction=r.direction,this.messages=r.messages,this.dateFormat=this.options.dateFormat||r.dateFormat,this.fancyFormat=this.options.fancyDateFormat||r.fancyDateFormat,this.today=new Date(H.getFullYear(),H.getMonth(),H.getDate()).getTime()/1e3,this.yesterday=this.today-86400,a=this.options.UTCDate?"UTC":"",this.getHours="get"+a+"Hours",this.getMinutes="get"+a+"Minutes",this.getSeconds="get"+a+"Seconds",this.getDate="get"+a+"Date",this.getDay="get"+a+"Day",this.getMonth="get"+a+"Month",this.getFullYear="get"+a+"FullYear",this.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==this.direction?"rtl":"ltr")+(this.UA.Touch?" elfinder-touch"+(this.options.resizable?" touch-punch":""):"")+(this.UA.Mobile?" elfinder-mobile":"")+" "+this.options.cssClass,this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.storage=function(){try{return"localStorage"in window&&null!==window.localStorage?(o.UA.Safari&&(window.localStorage.setItem("elfstoragecheck",1),window.localStorage.removeItem("elfstoragecheck")),o.localStorage):o.cookie}catch(e){return o.cookie}}(),this.viewType=this.storage("view")||this.options.defaultView||"icons",this.sortType=this.storage("sortType")||this.options.sortType||"name",this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc",this.sortStickFolders=this.storage("sortStickFolders"),null===this.sortStickFolders?this.sortStickFolders=!!this.options.sortStickFolders:this.sortStickFolders=!!this.sortStickFolders,this.sortAlsoTreeview=this.storage("sortAlsoTreeview"),null===this.sortAlsoTreeview?this.sortAlsoTreeview=!!this.options.sortAlsoTreeview:this.sortAlsoTreeview=!!this.sortAlsoTreeview,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortRules),e.each(this.sortRules,function(e,t){"function"!=typeof t&&delete o.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,function(){var n,i,a,r,s=h+"draggable keyup."+c+"draggable";o.draggable={appendTo:t,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(s,l){var d,c,u=l.helper,h=e.map(u.data("files")||[],function(e){return e||null}),p=!1;for(r=t.attr("style"),t.width(t.width()).height(t.height()),n="ltr"===o.direction,i=o.getUI("workzone").data("rectangle"),a=i.top+i.height,o.draggingUiHelper=u,d=h.length;d--;)if(c=h[d],y[c].locked){p=!0,u.data("locked",!0);break}!p&&o.trigger("lockfiles",{files:h}),u.data("autoScrTm",setInterval(function(){u.data("autoScr")&&o.autoScroll[u.data("autoScr")](u.data("autoScrVal"))},50))},drag:function(t,r){var o,s=r.helper;(o=i.top>t.pageY)||a<t.pageY?(i.cwdEdge>t.pageX?s.data("autoScr",(n?"navbar":"cwd")+(o?"Up":"Down")):s.data("autoScr",(n?"cwd":"navbar")+(o?"Up":"Down")),s.data("autoScrVal",Math.pow(o?i.top-t.pageY:t.pageY-a,1.3))):s.data("autoScr")&&s.data("refreshPositions",1).data("autoScr",null),s.data("refreshPositions")&&e(this).elfUiWidgetInstance("draggable")&&(s.data("refreshPositions")>0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),s.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),s.data("refreshPositions",null)))},stop:function(n,i){var a,l=i.helper;e(document).off(s),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),o.draggingUiHelper=null,o.trigger("focus").trigger("dragstop"),l.data("droped")||(a=e.map(l.data("files")||[],function(e){return e||null}),o.trigger("unlockfiles",{files:a}),o.trigger("selectfiles",{files:a})),o.enable(),t.attr("style",r),l.data("autoScrTm")&&clearInterval(l.data("autoScrTm"))},helper:function(t,n){var i,a,r,l=this.id?e(this):e(this).parents("[id]:first"),d=e('<div class="elfinder-drag-helper"><span class="elfinder-drag-helper-icon-status"/></div>'),u=function(t){var n,i=t.mime,a=o.tmb(t);return n='<div class="elfinder-cwd-icon '+o.mime2class(i)+' ui-corner-all"/>',a&&(n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML),n};return o.draggingUiHelper&&o.draggingUiHelper.stop(!0,!0),o.trigger("dragstart",{target:l[0],originalEvent:t}),i=l.hasClass(o.res("class","cwdfile"))?o.selected():[o.navId2Hash(l.attr("id"))],d.append(u(y[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",c).data("dropover",0),(a=i.length)>1&&d.append(u(y[i[a-1]])+'<span class="elfinder-drag-num">'+a+"</span>"),e(document).on(s,function(e){var t=e.shiftKey||e.ctrlKey||e.metaKey;r!==t&&(r=t,d.is(":visible")&&d.data("dropover")&&!d.data("droped")&&(d.toggleClass("elfinder-drag-helper-plus",d.data("locked")?!0:r),o.trigger(r?"unlockfiles":"lockfiles",{files:i,helper:d})))}),d}}}(),this.droppable={greedy:!0,tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename",hoverClass:this.res("class","adroppable"),classes:{"ui-droppable-hover":this.res("class","adroppable")},autoDisable:!0,drop:function(t,n){var i,a,r,s=e(this),l=e.map(n.helper.data("files")||[],function(e){return e||null}),d=[],u=[],h=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),f="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==c||!o.insideWorkzone(t.pageX,t.pageY))return!1;for(a=s.hasClass(o.res(f,"cwdfile"))?o.cwdId2Hash(s.attr("id")):s.hasClass(o.res(f,"navdir"))?o.navId2Hash(s.attr("id")):v,i=l.length;i--;)r=l[i],r!=a&&y[r].phash!=a?d.push(r):(p&&r!==a&&y[a].write?u:h).push(r);return h.length?!1:(n.helper.data("droped",!0),u.length&&(n.helper.hide(),o.exec("duplicate",u)),void(d.length&&(n.helper.hide(),o.clipboard(d,!p),o.exec("paste",a,void 0,a).always(function(){o.clipboard([]),o.trigger("unlockfiles",{files:l})}),o.trigger("drop",{files:l}))))}},this.enabled=function(){return f&&this.visible()},this.visible=function(){return t[0].elfinder&&t.is(":visible")},this.isRoot=function(e){return!(!e.isroot&&e.phash)},this.root=function(t,n){t=t||v;var i,a;if(!n&&(e.each(o.roots,function(e,n){return 0===t.indexOf(e)?(i=n,!1):void 0}),i))return i;for(i=y[t];i&&i.phash&&(n||!i.isroot);)i=y[i.phash];if(i)return i.hash;for(;a in y&&y.hasOwnProperty(a);)if(i=y[a],!i.phash&&"directory"==!i.mime&&i.read)return i.hash;return""},this.cwd=function(){return y[v]||{}},this.option=function(t,n){if(n&&v!==n){var i="";return e.each(o.volOptions,function(e,a){return 0===n.indexOf(e)?(i=a[t]||"",!1):void 0}),i}return b[t]||""},this.file=function(e){return e?y[e]:void 0},this.files=function(){return e.extend(!0,{},y)},this.parents=function(e){for(var t,n=[];t=this.file(e);)n.unshift(t.hash),e=t.phash;return n},this.path2array=function(e,t){for(var n,i=[];e;){if(!(n=y[e])||!n.hash){i=[];break}i.unshift(t&&n.i18?n.i18:n.name),e=n.isroot?null:n.phash}return i},this.path=function(t,n,i){var a=y[t]&&y[t].path?y[t].path:this.path2array(t,n).join(b.separator);if(i&&y[t]){i=e.extend({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var r,s=e.Deferred(),l=i.notify,d=!1,c=function(){o.request({data:{cmd:"parents",target:y[t].phash},notify:l,preventFail:!0}).done(u).fail(function(){s.reject()})},u=function(){o.one("parentsdone",function(){a=o.path(t,n),""===a&&d?(d=!1,c()):(l&&(clearTimeout(r),l.cnt=-parseInt(l.cnt||0),o.notify(l)),s.resolve(a))})};return a?s.resolve(a):(o.ui.tree?(l&&(r=setTimeout(function(){o.notify(l)},o.notifyDelay)),d=!0,u(!0)):c(),s)}return a},this.url=function(t){var n,i=y[t];if(!i||!i.read)return"";if("1"==i.url&&this.request({data:{cmd:"url",target:t},preventFail:!0,options:{async:!1}}).done(function(e){i.url=e.url||""}).fail(function(){i.url=""}),i.url)return i.url;if(n=0===i.hash.indexOf(o.cwd().volumeid)?b.url:this.option("url",i.hash))return n+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var a=e.extend({},this.customData,{cmd:"file",target:i.hash});return this.oldAPI&&(a.cmd="open",a.current=i.phash),this.options.url+(-1===this.options.url.indexOf("?")?"?":"&")+e.param(a,!0)},this.convAbsUrl=function(e){if(e.match(/^http/i))return e;if("//"===e.substr(0,2))return window.location.protocol+e;var t,n=window.location.protocol+"//"+window.location.host,i=/[^\/]+\/\.\.\//;for(t="/"===e.substr(0,1)?n+e:n+window.location.pathname.replace(/\/[^\/]+$/,"/")+e,t=t.replace("/./","/");i.test(t);)t=t.replace(i,"");return t},this.openUrl=function(t,n){var i=y[t],a="";if(!i||!i.read)return"";if(!n)if(i.url){if(1!=i.url)return i.url}else if(b.url&&0===i.hash.indexOf(o.cwd().volumeid))return b.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");return a=this.options.url,a=a+(-1===a.indexOf("?")?"?":"&")+(this.oldAPI?"cmd=open&current="+i.phash:"cmd=file")+"&target="+i.hash,n&&(a+="&download=1"),e.each(this.options.customData,function(e,t){a+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),a},this.tmb=function(t){var n,i,a="elfinder-cwd-bgurl",r="";return e.isPlainObject(t)&&(o.searchStatus.state&&0!==t.hash.indexOf(o.cwd().volumeid)?(n=o.option("tmbUrl",t.hash),i=o.option("tmbCrop",t.hash)):(n=b.tmbUrl,i=b.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(r=o.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(o.oldAPI||n)&&t&&t.tmb&&1!=t.tmb&&(r=n+t.tmb),r)?{url:r,className:a}:!1},this.selected=function(){return w.slice(0)},this.selectedFiles=function(){return e.map(w,function(t){return y[t]?e.extend({},y[t]):null})},this.fileByName=function(e,t){var n;for(n in y)if(y.hasOwnProperty(n)&&y[n].phash==t&&y[n].name==e)return y[n]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){var t;return isNaN(e)?(e||(e=""),e=e.replace(/b$/i,""),t=e.charAt(e.length-1).toLowerCase(),e=e.replace(/[tgmk]$/i,""),"t"==t?e=1024*e*1024*1024*1024:"g"==t?e=1024*e*1024*1024:"m"==t?e=1024*e*1024:"k"==t&&(e=1024*e),e=isNaN(e)?0:parseInt(e)):(e=parseInt(e),1>e&&(e=0)),e},this.request=function(t){var n,i,a,r=this,o=this.options,s=e.Deferred(),l=e.extend({},o.customData,{mimes:o.onlyMimes},t.data||t),d=l.cmd,c="open"===d,u=!(t.preventDefault||t.preventFail),h=!(t.preventDefault||t.preventDone),p=e.extend({},t.notify),f=!!t.cancel,m=!!t.raw,g=t.syncOnFail,y=!!t.lazy,w=t.prepare,k=e.extend({url:o.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:l,headers:this.customHeaders,xhrFields:this.xhrFields},t.options||{}),x=function(e){e.warning&&r.error(e.warning),c&&E(e),r.lazy(function(){e.removed&&e.removed.length&&r.remove(e),e.added&&e.added.length&&r.add(e),e.changed&&e.changed.length&&r.change(e)}).then(function(){return r.lazy(function(){r.trigger(d,e)})}).then(function(){return r.lazy(function(){r.trigger(d+"done")})}).then(function(){e.sync&&r.sync()})},C=function(e,t){var n;switch(t){case"abort":n=e.quiet?"":["errConnect","errAbort"];break;case"timeout":n=["errConnect","errTimeout"];break;case"parsererror":n=["errResponse","errDataNotJSON"],e.responseText&&(r.debug("backend-debug",{debug:{phpErrors:[e.responseText]}}),v||e.responseText&&n.push(e.responseText));break;default:if(403==e.status)n=["errConnect","errAccess","HTTP error "+e.status];else if(404==e.status)n=["errConnect","errNotFound","HTTP error "+e.status];else{if(414==e.status&&"get"===k.type)return k.type="post",void(s.xhr=e=r.transport.send(k).fail(n).done(T));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}s.reject(n,e,t)},T=function(t){if(r.currentReqCmd=d,m)return t&&t.debug&&r.debug("backend-debug",t),s.resolve(t);if(!t)return s.reject(["errResponse","errDataEmpty"],i,t);if(!e.isPlainObject(t))return s.reject(["errResponse","errDataNotJSON"],i,t);if(t.error)return s.reject(t.error,i,t);if(!r.validResponse(d,t))return s.reject("errResponse",i,t);var n=function(){var n=function(n){r.leafRoots[l.target]&&t[n]&&e.each(r.leafRoots[l.target],function(e,i){var a;(a=r.file(i))&&t[n].push(a)})};c?n("files"):"tree"===d&&n("tree"),t=r.normalize(t),r.api||(r.api=t.api||1,"2.0"==r.api&&"undefined"!=typeof t.options.uploadMaxSize&&(r.api="2.1"),r.newAPI=r.api>=2,r.oldAPI=!r.newAPI),t.options&&(b=e.extend({},b,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),t.maxTargets&&(r.maxTargets=t.maxTargets),c&&l.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?parseInt(t.uplMaxFile):20),"function"==typeof w&&w(t),s.resolve(t),t.debug&&r.debug("backend-debug",t)};y?r.lazy(n):n()},I=function(e){if("autosync"==e.type){if("stop"!=e.data.action)return}else if(!("unload"==e.type||"destroy"==e.type||"openxhrabort"==e.type||e.data.added&&e.data.added.length))return;"pending"==i.state()&&(i.quiet=!0,i.abort(),"unload"!=e.type&&"destroy"!=e.type&&r.autoSync())};if(s.fail(function(e,t,n){r.trigger(d+"fail",n),e&&(u?r.error(e):r.debug("error",r.i18n(e))),g&&r.sync()}),!d)return g=!1,s.reject("errCmdReq");if(r.maxTargets&&l.targets&&l.targets.length>r.maxTargets)return g=!1,s.reject(["errMaxTargets",r.maxTargets]);if(h&&s.done(x),p.type&&p.cnt&&(f&&(p.cancel=s),n=setTimeout(function(){r.notify(p),s.always(function(){p.cnt=-(parseInt(p.cnt)||0),r.notify(p)})},r.notifyDelay),s.always(function(){clearTimeout(n)})),c){for(;a=z.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort());if(v!==l.target)for(;a=A.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort())}return-1!==e.inArray(d,(r.cmdsToAdd+" autosync").split(" "))&&("autosync"!==d&&(r.autoSync("stop"),s.always(function(){r.autoSync()})),r.trigger("openxhrabort")),delete k.preventFail,s.xhr=i=this.transport.send(k).fail(C).done(T),c||l.compare&&"info"===d?(z.unshift(i),l.compare&&r.bind(r.cmdsToAdd+" autosync openxhrabort",I),s.always(function(){var t=e.inArray(i,z);l.compare&&r.unbind(r.cmdsToAdd+" autosync openxhrabort",I),-1!==t&&z.splice(t,1)})):-1!==e.inArray(d,this.abortCmdsOnOpen)&&(A.unshift(i),s.always(function(){var t=e.inArray(i,A);-1!==t&&A.splice(t,1)})),r.bind("unload destroy",I),s.always(function(){r.unbind("unload destroy",I)}),s},this.diff=function(t,n,i){var a={},r=[],o=[],s=[],l=function(e){for(var t=s.length;t--;)if(s[t].hash==e)return!0};return e.each(t,function(e,t){a[t.hash]=t}),e.each(y,function(e,t){a[e]||n&&t.phash!==n||o.push(e)}),e.each(a,function(t,n){var a=y[t];a?e.each(n,function(t){return i&&-1!==e.inArray(t,i)||n[t]===a[t]?void 0:(s.push(n),!1)}):r.push(n)}),e.each(o,function(t,n){var i=y[n],r=i.phash;r&&"directory"==i.mime&&-1===e.inArray(r,o)&&a[r]&&!l(r)&&s.push(a[r])}),{added:r,removed:o,changed:s}},this.sync=function(t,n){this.autoSync("stop");var i=this,a=function(){var i="",a=0,r=0;return t&&n&&e.each(y,function(e,n){n.phash&&n.phash===t&&(++a,r=Math.max(r,n.ts)),i=a+":"+r}),i},r=a(),o=e.Deferred().done(function(){i.trigger("sync")}),s=[this.request({data:{cmd:"open",reload:1,target:v,tree:!t&&this.ui.tree?1:0,compare:r},preventDefault:!0})],l=function(){for(var e,t=[],n=i.file(i.root(v)),a=n?n.volumeid:null,r=i.cwd().phash;r;)(e=i.file(r))?(0!==r.indexOf(a)&&(i.isRoot(e)||t.push({target:r,cmd:"tree"}),t.push({target:r,cmd:"parents"}),n=i.file(i.root(r)),a=n?n.volumeid:null),r=e.phash):r=null;return t};return t||(v!==this.root()&&s.push(this.request({data:{cmd:"parents",target:v},preventDefault:!0})),e.each(l(),function(e,t){s.push(i.request({data:{cmd:t.cmd,target:t.target},preventDefault:!0}))})),e.when.apply(e,s).fail(function(t,a){n&&-1===e.inArray("errOpen",t)?o.reject(t&&0!=a.status?t:void 0):(o.reject(t),t&&i.request({data:{cmd:"open",target:i.lastDir("")||i.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}}))}).done(function(e){var n,a,s;if(e.cwd.compare&&r===e.cwd.compare)return o.reject();if(n={tree:[]},a=arguments.length,a>1)for(s=1;a>s;s++)arguments[s].tree&&arguments[s].tree.length&&n.tree.push.apply(n.tree,arguments[s].tree);i.api<2.1&&(n.tree=(n.tree||[]).push(e.cwd)),e=i.normalize(e),n=i.normalize(n);var l=i.diff(e.files.concat(n&&n.tree?n.tree:[]),t);return l.added.push(e.cwd),l.removed.length&&i.remove(l),l.added.length&&i.add(l),l.changed.length&&i.change(l),o.resolve(l)}).always(function(){i.autoSync()}),o},this.upload=function(e){return this.transport.upload(e,this)},this.bind=function(e,t){var n;if("function"==typeof t)for(e=(""+e).toLowerCase().split(/\s+/),n=0;n<e.length;n++)void 0===k[e[n]]&&(k[e[n]]=[]),k[e[n]].push(t);return this},this.unbind=function(t,n){var i,a,r;for(t=(""+t).toLowerCase().split(/\s+/),i=0;i<t.length;i++)a=k[t[i]]||[],r=e.inArray(n,a),r>-1&&a.splice(r,1);return n=null,this},this.trigger=function(t,n,i){var a,r,o,t=t.toLowerCase(),s="open"===t,l=k[t]||[];if(this.debug("event-"+t,n),s&&!i&&(o=JSON.stringify(n)),r=l.length)for(t=e.Event(t),i&&(t.data=n),a=0;r>a;a++)if(l[a]){l[a].length&&(i||(t.data=s?JSON.parse(o):e.extend(!0,{},n)));try{if(l[a](t,this)===!1||t.isDefaultPrevented()){this.debug("event-stoped",t.type);break}}catch(d){window.console&&window.console.log&&window.console.log(d)}}return this},this.getListeners=function(e){return e?k[e.toLowerCase()]:k},this.shortcut=function(t){var n,i,a,r,o;if(this.options.allowShortcuts&&t.pattern&&e.isFunction(t.callback))for(n=t.pattern.toUpperCase().split(/\s+/),r=0;r<n.length;r++)i=n[r],o=i.split("+"),a=1==(a=o.pop()).length?a>0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!x[i]&&(x[i]={keyCode:a,altKey:-1!=e.inArray("ALT",o),ctrlKey:-1!=e.inArray("CTRL",o),shiftKey:-1!=e.inArray("SHIFT",o),type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(x,function(e,n){t.push([n.pattern,o.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(C,function(e){return e.hash})};return void 0!==t&&(C.length&&this.trigger("unlockfiles",{files:i()}),T=[],C=e.map(t||[],function(e){var t=y[e];return t?(T.push(e),{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:C.slice(0,C.length)}),n&&this.trigger("lockfiles",{files:i()})),C.slice(0,C.length)},this.isCommandEnabled=function(t,n){var i,a=o.cwd().volumeid||"";return!n||a&&0===n.indexOf(a)?i=b.disabled:(i=o.option("disabled",n),i||(i=[])),this._commands[t]?-1===e.inArray(t,i):!1},this.exec=function(t,n,i,a){return"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("No such command")},this.dialog=function(n,i){var a=e("<div/>").append(n).appendTo(t).elfinderdialog(i,this),r=a.closest(".ui-dialog"),s=function(){!a.data("draged")&&a.is(":visible")&&a.elfinderdialog("posInit")};return r.length&&(o.bind("resize",s),r.on("remove",function(){o.unbind("resize",s)})),a},this.toast=function(t){return e('<div class="ui-front"/>').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(e){return this.ui[e]||t},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(e,n){t.css("width",e).height(n).trigger("resize"),this.trigger("resize",{width:t.width(),height:t.height()})},this.restoreSize=function(){this.resize(F,S)},this.show=function(){t.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(m=f,f=!1),this.disable().trigger("hide"),t.hide()},this.lazy=function(n,i,a){var r=function(e){var n,i=t.data("lazycnt");e?(n=t.data("lazyrepaint")?!1:a.repaint,i?t.data("lazycnt",++i):t.data("lazycnt",1).addClass("elfinder-processing"),n&&t.data("lazyrepaint",!0).css("display")):i&&i>1?t.data("lazycnt",--i):(n=t.data("lazyrepaint"),t.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),n&&t.css("display"),o.trigger("lazydone"))},s=e.Deferred();return i=i||0,a=a||{},r(!0),setTimeout(function(){s.resolve(n.call(s)),r(!1)},i),s},this.destroy=function(){t&&t[0].elfinder&&(this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),C=[],w=[],k={},x={},e(window).off("."+c),e(document).off("."+c),o.trigger=function(){},t.off(),t.removeData(),t.empty(),t[0].elfinder=null,e(U).remove(),t.append(s.contents()).removeClass(this.cssClass).attr("style",l))},this.autoSync=function(t){var n;if(o.options.sync>=1e3){if(i&&(clearTimeout(i),i=null,o.trigger("autosync",{action:"stop"})),"stop"===t?++O:O=Math.max(0,--O),O||"forcestop"===t||!o.options.syncStart)return;n=function(t){var a;b.syncMinMs&&(t||i)&&(t&&o.trigger("autosync",{action:"start"}),a=Math.max(o.options.sync,b.syncMinMs),i&&clearTimeout(i),i=setTimeout(function(){var t,r=!0,s=v;b.syncChkAsTs&&(t=y[s].ts)?o.request({data:{cmd:"info",targets:[s],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;r=!0,e.compare&&(i=e.compare,i==t&&(r=!1)),r?o.sync(s).always(function(){i&&(y[s].ts=i),n()}):n()}).fail(function(t,r){t&&0!=r.status?(o.error(t),-1!==e.inArray("errOpen",t)&&o.request({data:{cmd:"open",target:o.lastDir("")||o.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):i=setTimeout(function(){n()},a)}):o.sync(v,!0).always(function(){n()})},a))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(e<i.left+n||e>i.left+i.width+n||t<i.top+n||t>i.top+i.height+n)},this.toFront=function(n){var i=t.children(":last");n=e(n),i.get(0)!==n.get(0)&&i.after(n)},this.getMaximizeCss=function(){return{width:"100%",height:"100%",margin:0,padding:0,top:0,left:0,display:"block",position:"fixed",zIndex:Math.max(o.zIndex?o.zIndex+1:0,1e3)}},function(){j&&o.UA.Fullscreen&&(o.UA.Fullscreen=!1,N&&"undefined"!=typeof N.attr("allowfullscreen")&&(o.UA.Fullscreen=!0));var n,i,a,r="elfinder-fullscreen",s="elfinder-fullscreen-native",l=function(){var n=0,i=0;e.each(t.children(".ui-dialog,.ui-draggable"),function(t,a){var r=e(a),o=r.position();o.top<0&&(r.css("top",n),n+=20),o.left<0&&(r.css("left",i),i+=20)})},d=o.UA.Fullscreen?{fullElm:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null},exitFull:function(){return document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():void 0},toFull:function(e){return e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():!1}}:{fullElm:function(){var e;return t.hasClass(r)?t.get(0):(e=t.find("."+r),e.length?e.get(0):null)},exitFull:function(){var t;e(window).off("resize."+c,h),void 0!==i&&e("body").css("overflow",i),i=void 0,n&&(t=n.elm,u(t),e(t).trigger("resize",{fullscreen:"off"})),e(window).trigger("resize")},toFull:function(t){return i=e("body").css("overflow")||"",e("body").css("overflow","hidden"),e(t).css(o.getMaximizeCss()).addClass(r).trigger("resize",{fullscreen:"on"}),l(),e(window).on("resize."+c,h).trigger("resize"),!0}},u=function(t){n&&n.elm==t&&(e(t).removeClass(r+" "+s).attr("style",n.style),n=null)},h=function(t){var n;t.target===window&&(a&&clearTimeout(a),a=setTimeout(function(){(n=d.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})},100))};e(document).on("fullscreenchange."+c+" webkitfullscreenchange."+c+" mozfullscreenchange."+c+" MSFullscreenChange."+c,function(t){if(o.UA.Fullscreen){var i=d.fullElm(),p=e(window);a&&clearTimeout(a),null===i?(p.off("resize."+c,h),n&&(i=n.elm,u(i),e(i).trigger("resize",{fullscreen:"off"}))):(e(i).addClass(r+" "+s).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),p.on("resize."+c,h),l()),p.trigger("resize")}}),o.toggleFullscreen=function(t,i){var a=e(t).get(0),r=null;if(r=d.fullElm()){if(r==a){if(i===!0)return r}else if(i===!1)return r;return d.exitFull(),null}return i===!1?null:(n={elm:a,style:e(a).attr("style")},d.toFull(a)!==!1?a:(n=null,null))}}(),function(){var t,n="elfinder-maximized",i=function(e){e.target===window&&e.data&&e.data.elm&&(t&&clearTimeout(t),t=setTimeout(function(){e.data.elm.trigger("resize",{maximize:"on"})},100))},a=function(t){e(window).off("resize."+c,i),e("body").css("overflow",t.data("bodyOvf")),t.removeClass(n).attr("style",t.data("orgStyle")).removeData("bodyOvf").removeData("orgStyle"),t.trigger("resize",{maximize:"off"})},r=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(o.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+c,{elm:t},i).trigger("resize")};o.toggleMaximize=function(t,i){var o=e(t),s=o.hasClass(n);if(s){if(i===!0)return;a(o)}else{if(i===!1)return;r(o)}}}(),e.fn.selectable&&e.fn.draggable&&e.fn.droppable?t.length?this.options.url?(e.extend(e.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,CONTEXTMENU:93}),this.dragUpload=!1,this.xhrUpload=("undefined"!=typeof XMLHttpRequestUpload||"undefined"!=typeof XMLHttpRequestEventTarget)&&"undefined"!=typeof File&&"undefined"!=typeof FormData,this.transport={},"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this)),"function"!=typeof this.transport.send&&(this.transport.send=function(t){return e.ajax(t)}),"iframe"==this.transport.upload?this.transport.upload=e.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload&&this.options.dragUploadAllow?(this.transport.upload=e.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=e.proxy(this.uploads.iframe,this),this.decodeRawString=e.isFunction(this.options.rawStringDecoder)?this.options.rawStringDecoder:function(e){var t=function(e){var t,n,i;for(t=0,n=e.length,i=[];n>t;t++)i.push(e.charCodeAt(t));return i},n=function(e){var n,i,a,r=[];for("string"==typeof e&&(e=t(e)),n=0,i=e.length;a=e[n],i>n;n++)a>=55296&&56319>=a?r.push((1023&a)+64<<10|1023&e[++n]):r.push(a);return r},i=function(e){var t,n,i,a,r=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],n>t;t++)a+=127>=i?r(i):223>=i&&i>=194?r((31&i)<<6|63&e[++t]):239>=i&&i>=224?r((15&i)<<12|(63&e[++t])<<6|63&e[++t]):247>=i&&i>=240?r(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):r(65533);return a};return i(n(e));
10
+ },this.error=function(){var e=arguments[0],t=arguments[1]||null;return 1==arguments.length&&"function"==typeof e?o.bind("error",e):e===!0?this:o.trigger("error",{error:e,opts:t})},e.each(g,function(t,n){o[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?o.bind(n,t):o.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!f&&o.visible()&&o.ui.overlay.is(":hidden")&&(f=!0,document.activeElement&&document.activeElement.blur(),t.removeClass("elfinder-disabled"))}).disable(function(){m=f,f=!1,t.addClass("elfinder-disabled")}).open(function(){w=[]}).select(function(t){var n=0,i=[];w=e.map(t.data.selected||t.data.value||[],function(e){return i.length||o.maxTargets&&++n>o.maxTargets?(i.push(e),null):y[e]?e:null}),i.length&&(o.trigger("unselectfiles",{files:i,inselect:!0}),o.toast({mode:"warning",msg:o.i18n(["errMaxTargets",o.maxTargets])}))}).error(function(t){var n={cssClass:"elfinder-dialog-error",title:o.i18n(o.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};n.buttons[o.i18n(o.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},t.data.opts&&e.isPlainObject(t.data.opts)&&e.extend(n,t.data.opts),o.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-error"/>'+o.i18n(t.data.error),n)}).bind("tree parents",function(e){P(e.data.tree||[])}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){y[e]&&(y[e].tmb=t)})}).add(function(e){P(e.data.added||[])}).change(function(t){e.each(t.data.changed||[],function(t,n){var i=n.hash;y[i]&&e.each(["locked","hidden","width","height"],function(e,t){y[i][t]&&!n[t]&&delete y[i][t]}),y[i]=y[i]?e.extend(y[i],n):n})}).remove(function(t){var n=t.data.removed||[],i=n.length,a={},r=function(t){var n=y[t];n&&("directory"===n.mime&&(a[t]&&delete o.roots[a[t]],e.each(y,function(e,n){n.phash==t&&r(e)})),delete y[t])};for(e.each(o.roots,function(e,t){a[t]=e});i--;)r(n[i])}).bind("searchstart",function(t){e.extend(o.searchStatus,t.data),o.searchStatus.state=1}).bind("search",function(e){o.searchStatus.state=2,P(e.data.files||[])}).bind("searchend",function(){o.searchStatus.state=0,o.searchStatus.mixed=!1}).bind("rm",function(t){var n=U.canPlayType&&U.canPlayType('audio/wav; codecs="1"');n&&""!=n&&"no"!=n&&e(U).html('<source src="'+M+'rm.wav" type="audio/wav">')[0].play()}),e.each(this.options.handlers,function(e,t){o.bind(e,t)}),this.history=new this.history(this),this.commands.getfile&&("function"==typeof this.options.getFileCallback?(this.bind("dblclick",function(e){e.preventDefault(),o.exec("getfile").fail(function(){o.exec("open")})}),this.shortcut({pattern:"enter",description:this.i18n("cmdgetfile"),callback:function(){o.exec("getfile").fail(function(){o.exec("mac"==o.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:this.i18n("mac"==this.OS?"cmdrename":"cmdopen"),callback:function(){o.exec("mac"==o.OS?"rename":"open")}})):this.options.getFileCallback=null),this.roots={},this.leafRoots={},this._commands={},e.isArray(this.options.commands)||(this.options.commands=[]),-1!==e.inArray("*",this.options.commands)&&(this.options.commands=Object.keys(this.commands)),e.each(this.commands,function(t,n){var i,a,r=e.extend({},n.prototype);if(e.isFunction(n)&&!o._commands[t]&&(n.prototype.forceLoad||-1!==e.inArray(t,o.options.commands))){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(o.commands[i]))return!0;n.prototype=e.extend({},I,new o.commands[i],n.prototype)}else n.prototype=e.extend({},I,n.prototype);o._commands[t]=new n,n.prototype=r,a=o.options.commandsOptions[t]||{},i&&o.options.commandsOptions[i]&&(a=e.extend(!0,{},o.options.commandsOptions[i],a)),o._commands[t].setup(t,a),o._commands[t].linkedCmds.length&&e.each(o._commands[t].linkedCmds,function(t,n){var i=o.commands[n];e.isFunction(i)&&!o._commands[n]&&(i.prototype=I,o._commands[n]=new i,o._commands[n].setup(n,o.options.commandsOptions[n]||{}))})}}),this.commandMap={},this.volOptions={},t.addClass(this.cssClass).on(u,function(){!f&&o.enable()}),this.ui={workzone:e("<div/>").appendTo(t).elfinderworkzone(this),navbar:e("<div/>").appendTo(t).elfindernavbar(this,this.options.uiOptions.navbar||{}),contextmenu:e("<div/>").appendTo(t).elfindercontextmenu(this),overlay:e("<div/>").appendTo(t).elfinderoverlay({show:function(){o.disable()},hide:function(){m&&o.enable()}}),cwd:e("<div/>").appendTo(t).elfindercwd(this,this.options.uiOptions.cwd||{}),notify:this.dialog("",{cssClass:"elfinder-dialog-notify",position:this.options.notifyDialog.position,resizable:!1,autoOpen:!1,closeOnEscape:!1,title:"&nbsp;",width:parseInt(this.options.notifyDialog.width)}),statusbar:e('<div class="ui-widget-header ui-helper-clearfix ui-corner-bottom elfinder-statusbar"/>').hide().appendTo(t),toast:e('<div class="elfinder-toast"/>').appendTo(t),bottomtray:e('<div class="elfinder-bottomtray">').appendTo(t)},this.uiAutoHide=[],this.one("open",function(){o.uiAutoHide.length&&setTimeout(function(){o.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){o.uiAutoHide.length&&o.uiAutoHide.shift()()}),e.each(this.options.ui||[],function(n,i){var a="elfinder"+i,r=o.options.uiOptions[i]||{};!o.ui[i]&&e.fn[a]&&(o.ui[i]=e("<"+(r.tag||"div")+"/>").appendTo(t),o.ui[i][a](o,r))}),t[0].elfinder=this,this.options.resizable&&e.fn.resizable&&t.resizable({resize:function(e,t){o.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),this.options.width&&(F=this.options.width),this.options.height&&(S=parseInt(this.options.height)),this.options.soundPath&&(M=this.options.soundPath.replace(/\/+$/,"")+"/"),o.resize(F,S),e(document).on("click."+c,function(n){f&&!o.options.enableAlways&&!e(n.target).closest(t).length&&o.disable()}).on(h+" "+p,R),o.options.useBrowserHistory&&e(window).on("popstate."+c,function(t){var n=t.originalEvent.state&&t.originalEvent.state.thash;n&&!e.isEmptyObject(o.files())&&o.request({data:{cmd:"open",target:n,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0})}),this.trigger("init").request({data:{cmd:"open",target:o.startDir(),init:1,tree:this.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){o.trigger("fail").disable().lastDir(""),k={},x={},e(document).add(t).off("."+c),o.trigger=function(){}}).done(function(n){var i=t.css("z-index");i&&"auto"!==i&&"inherit"!==i?o.zIndex=i:t.parents().each(function(t,n){var i=e(n).css("z-index");return"auto"!==i&&"inherit"!==i&&(i=parseInt(i))?(o.zIndex=i,!1):void 0}),o.load().debug("api",o.api),E(n),o.trigger("open",n),j&&o.options.enableAlways&&e(window).focus()}),this.one("load",function(){t.trigger("resize")}),function(){var n;e(window).on("resize."+c,function(e){e.target===this&&(n&&clearTimeout(n),n=setTimeout(function(){o.trigger("resize",{width:t.width(),height:t.height()})},100))}).on("beforeunload."+c,function(n){var i,a;return t.is(":visible")&&(o.ui.notify.children().length&&-1!==e.inArray("hasNotifyDialog",o.options.windowCloseConfirm)?i=o.i18n("ntfsmth"):t.find("."+o.res("class","editing")).length&&-1!==e.inArray("editingFile",o.options.windowCloseConfirm)?i=o.i18n("editingFile"):(a=Object.keys(o.selected()).length)&&-1!==e.inArray("hasSelectedItem",o.options.windowCloseConfirm)?i=o.i18n("hasSelected",""+a):(a=Object.keys(o.clipboard()).length)&&-1!==e.inArray("hasClipboardData",o.options.windowCloseConfirm)&&(i=o.i18n("hasClipboard",""+a)),i)?(n.returnValue=i,i):void o.trigger("unload")})}(),e(window).on("message."+c,function(e){var t,n,i=e.originalEvent||null;if(i&&0===o.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&o.trigger(t.bind+"fail",n),o.error(n.error)):(n.warning&&o.error(n.warning),n.removed&&n.removed.length&&o.remove(n),n.added&&n.added.length&&o.add(n),n.changed&&n.changed.length&&o.change(n),t.bind&&(o.trigger(t.bind,n),o.trigger(t.bind+"done")),n.sync&&o.sync()))}catch(e){o.sync()}}),o.options.enableAlways?(e(window).on("focus."+c,function(e){e.target===this&&o.enable()}),j&&e(window.top).on("focus."+c,function(){!o.enable()||N&&!N.is(":visible")||setTimeout(function(){e(window).focus()},10)})):j&&e(window).on("blur."+c,function(e){f&&e.target===this&&o.disable()}),function(){var e=o.getUI("navbar"),t=o.getUI("cwd").parent();o.autoScroll={navbarUp:function(t){e.scrollTop(Math.max(0,e.scrollTop()-t))},navbarDown:function(t){e.scrollTop(e.scrollTop()+t)},cwdUp:function(e){t.scrollTop(Math.max(0,t.scrollTop()-e))},cwdDown:function(e){t.scrollTop(t.scrollTop()+e)}}}(),o.dragUpload&&!function(){var n,i,a=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},r="native-drag-enter",s="native-drag-disable",l="class",c=o.res(l,"navdir"),u=(o.res(l,"droppable"),o.res(l,"adroppable"),o.res(l,"navarrow"),o.res(l,"adroppable")),h=o.getUI("workzone"),p="ltr"===o.direction,f=function(){i&&clearTimeout(i),i=null};t.on("dragenter",function(e){f(),a(e)&&(e.preventDefault(),e.stopPropagation(),n=h.data("rectangle"))}).on("dragleave",function(e){f(),a(e)&&(e.preventDefault(),e.stopPropagation())}).on("dragover",function(e){var t;a(e)?(e.preventDefault(),e.stopPropagation(),e.originalEvent.dataTransfer.dropEffect="none",i||(i=setTimeout(function(){var a,r=n.top+n.height;((t=e.pageY<n.top)||e.pageY>r)&&(a=n.cwdEdge>e.pageX?(p?"navbar":"cwd")+(t?"Up":"Down"):(p?"cwd":"navbar")+(t?"Up":"Down"),o.autoScroll[a](Math.pow(t?n.top-e.pageY:e.pageY-r,1.3))),i=null},20))):f()}).on("drop",function(e){f(),a(e)&&(e.stopPropagation(),e.preventDefault())}),t.on("dragenter",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n,i=e(t.currentTarget),a=t.currentTarget.id||null,l=null;if(!a){l=o.cwd(),i.data(s,!1);try{e.each(t.originalEvent.dataTransfer.types,function(e,t){"elfinderfrom:"===t.substr(0,13)&&(n=t.substr(13).toLowerCase())})}catch(t){}}l&&(!l.write||n&&n===(window.location.href+l.hash).toLowerCase())?i.data(s,!0):(t.preventDefault(),t.stopPropagation(),i.data(r,!0),i.addClass(u))}}).on("dragleave",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.data(r)?n.data(r,!1):n.removeClass(u)}}).on("dragover",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),t.originalEvent.dataTransfer.dropEffect=n.data(s)?"none":"copy",n.data(r,!1)}}).on("drop",".native-droppable",function(t){if(t.originalEvent&&t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.removeClass(u),d=t.currentTarget.id?n.hasClass(c)?o.navId2Hash(t.currentTarget.id):o.cwdId2Hash(t.currentTarget.id):o.cwd().hash,t.originalEvent._target=d,o.exec("upload",{dropEvt:t.originalEvent,target:d},void 0,d)}})}(),o.UA.Touch&&!function(){var n,i,a,r,s,l,d,u,h=o.getUI("navbar"),p=o.getUI("toolbar"),f=function(e){e.preventDefault()},m=function(){e(document).off("touchmove",f)},g=50;t.on("touchstart touchmove touchend",function(v){if("touchend"===v.type)return n=!1,i=!1,void m();var b,y,w,k,x,C,T=v.originalEvent.touches||[{}],z=T[0].pageX||null,A=T[0].pageY||null,I="ltr"===o.direction;null===z||null===A||"touchstart"===v.type&&T.length>1||("touchstart"===v.type?(a=t.offset(),r=t.width(),h&&(n=!1,h.is(":hidden")?(u||(u=Math.max(50,r/10)),(I?z-a.left:r+a.left-z)<u&&(n=z)):(l=h.width(),y=Math.max.apply(Math,e.map(h.children(".elfinder-tree"),function(t){return e(t).width()})),w=I?z<a.left+l&&y-h.scrollLeft()-5<=l:z>a.left+r-l&&y+h.scrollLeft()-5<=l,w?(u=Math.max(50,r/10),n=z):n=!1)),p&&(d=p.height(),s=a.top,A-s<(p.is(":hidden")?g:d+30)?(i=A,e(document).on("touchmove."+c,f),setTimeout(function(){m()},500)):i=!1)):(h&&n!==!1&&(b=(I?n>z:z>n)?"navhide":"navshow",k=Math.abs(n-z),("navhide"===b&&k>.6*l||k>("navhide"===b?l/3:45)&&("navshow"===b||(I?z<a.left+20:z>a.left+r-20)))&&(o.getUI("navbar").trigger(b,{handleW:u}),n=!1)),p&&i!==!1&&(x=p.offset().top,Math.abs(i-A)>Math.min(45,d/3)&&(C=i>A?"slideUp":"slideDown",("slideDown"===C||x+20>A)&&(p.is("slideDown"===C?":hidden":":visible")&&(p.stop(!0,!0).trigger("toggle",{duration:100,handleH:g}),m()),i=!1)))))})}(),j&&t.on("click",function(t){e(window).focus()}),void(this.options.enableByMouseOver&&t.on("mouseenter",function(t){j&&e(window).focus(),!o.enabled()&&o.enable()}))):alert(this.i18n("errURL")):alert(this.i18n("errNode")):alert(this.i18n("errJqui"))},elFinder.prototype={uniqueid:0,res:function(e,t){return this.resources[e]&&this.resources[e][t]},OS:-1!==navigator.userAgent.indexOf("Mac")?"mac":-1!==navigator.userAgent.indexOf("Win")?"win":"other",UA:function(){var e=!document.uniqueID&&!window.opera&&!window.sidebar&&window.localStorage&&"WebkitAppearance"in document.documentElement.style;return{ltIE6:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.documentElement.style.maxHeight,ltIE7:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.querySelectorAll,ltIE8:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:e&&window.chrome,Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart,iOS:navigator.platform.match(/^iP(?:[ao]d|hone)/),Fullscreen:"undefined"!=typeof(document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen)}}(),currentReqCmd:"",i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["msJan","msFeb","msMar","msApr","msMay","msJun","msJul","msAug","msSep","msOct","msNov","msDec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/msword":"MsWord","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP","application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO","application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/x-xz":"XZ","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","text/x-markdown":"Markdown","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},rules:{defaults:function(t){return!(!t||t.added&&!e.isArray(t.added)||t.removed&&!e.isArray(t.removed)||t.changed&&!e.isArray(t.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&e.isArray(t.files)},tree:function(t){return t&&t.tree&&e.isArray(t.tree)},parents:function(t){return t&&t.tree&&e.isArray(t.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||e.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||e.isArray(t.added))},search:function(t){return t&&t.files&&e.isArray(t.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=JSON.parse(t)}catch(i){return{error:["errResponse","errDataNotJSON"]}}return this.validResponse("upload",n)?(n=this.normalize(n),n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return e.hash})),n):{error:["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,checkExists:function(t,n,i){var a,r,o=e.Deferred(),s=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},l=function(){var l=[],d={},c=[],u=[],h=function(e){var n=e==u.length-1,a={title:i.i18n("cmdupload"),text:["errExists",u[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?o.resolve(l,d):h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=u.length;e<a--;)t[u[a].i]._remove=!0;else t[u[e].i]._remove=!0;n||i?o.resolve(l,d):h(++e)}},cancel:{label:"btnCancel",callback:function(){s(),o.resolve(l,d)}},buttons:[{label:"btnBackup",callback:function(t){var i;if(t)for(i=u.length;e<i--;)l.push(u[i].name);else l.push(u[e].name);n||t?o.resolve(l,d):h(++e)}}]};i.iframeCnt>0&&delete a.reject,i.confirm(a)};return i.file(n).read?(a=e.map(t,function(e,t){return e.name?{i:t,name:e.name}:null}),r=e.map(a,function(e){return e.name}),void i.request({data:{cmd:"ls",target:n,intersect:r},notify:{type:"preupload",cnt:1,hideCnt:!0},preventFail:!0}).done(function(t){var r,l;t&&(t.error?s():i.options.overwriteUploadConfirm&&!i.UA.iOS&&i.option("uploadOverwrite",n)&&t.list&&(e.isArray(t.list)?c=t.list||[]:(r=[],c=e.map(t.list,function(e){return"string"==typeof e?e:(r=r.concat(e),null)}),r.length&&(c=c.concat(r)),d=t.list),u=e.map(a,function(t){return-1!==e.inArray(t.name,c)?t:null}),c.length&&n==i.cwd().hash&&(l=e.map(i.files(),function(e){return e.phash==n?e.name:null}),e.map(c,function(t){return-1===e.inArray(t,l)?!0:null}).length&&i.sync()))),u.length>0?h(0):o.resolve([])}).fail(function(e){s(),o.resolve([]),e&&i.error(e)})):void o.resolve([])};return i.api>=2.1&&"object"==typeof t[0]?(l(),o):o.resolve([])},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,r=e.Deferred(),o=[],s=[],l=0,d=[],c=function(e){for(var t,i,a=[],r=function(e){return Array.prototype.slice.call(e||[],0)},u=e.length,h=0;u>h;h++)if(i=e[h])if(i.isFile)l++,i.file(function(e){"win"==n.OS&&e.name.match(/^(?:desktop\.ini|thumbs\.db)$/i)||"mac"==n.OS&&e.name.match(/^\.ds_store$/i)||(s.push(i.fullPath||""),o.push(e)),l--});else if(i.isDirectory&&n.api>=2.1){l++,d.push(i.fullPath),t=i.createReader();var a=[],p=function(){t.readEntries(function(e){if(e.length)a=a.concat(r(e)),p();else{for(var t=0;t<a.length;t++)c([a[t]]);l--}},function(){l--})};p()}};return a=e.map(t.files.items,function(e){return e.getAsEntry?e.getAsEntry():e.webkitGetAsEntry()}),a.length>0?(n.uploads.checkExists(a,i,n).done(function(t,u){var h,p=[];n.options.overwriteUploadConfirm&&!n.UA.iOS&&n.option("uploadOverwrite",i)&&(a=e.map(a,function(a){var r,o,s,l;return a.isDirectory&&(r=e.inArray(a.name,t),-1!==r&&(t.splice(r,1),o=n.uniqueName(a.name+n.options.backupSuffix,null,""),e.each(u,function(e,t){return a.name==t?(s=e,!1):void 0}),s||(s=n.fileByName(a.name,i).hash),n.lockfiles({files:[s]}),l=n.request({data:{cmd:"rename",target:s,name:o},notify:{type:"rename",cnt:1}}).fail(function(e){a._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[s]})}),p.push(l))),a._remove?null:a})),e.when.apply(e,p).done(function(){a.length>0?(h=setTimeout(function(){n.notify({type:"readdir",cnt:1,hideCnt:!0})},n.options.notifyDelay),c(a),setTimeout(function e(){l>0?setTimeout(e,10):(h&&clearTimeout(h),n.notify({type:"readdir",cnt:-1}),r.resolve([o,s,t,u,d]))},10)):r.reject()})}),r.promise()):r.reject()}var u=[],h=[],p=t.files[0];if("html"==t.type){var f,m=e("<html/>").append(e.parseHTML(p.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",m).each(function(){var t,n,i=e(this),a=i.closest("a");a&&a.attr("href")&&a.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(n=a.attr("href")),t=i.attr("_elfsrc"),t&&(n?(-1==e.inArray(n,u)&&u.push(n),-1==e.inArray(t,h)&&h.push(t)):-1==e.inArray(t,u)&&u.push(t))}),f=e("a[href]",m),f.each(function(){var t,n=function(e){var t=document.createElement("a");return t.href=e,t};e(this).text()&&(t=n(e(this).attr("href")),!t.href||1!==f.length&&t.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||-1==e.inArray(t.href,u)&&-1==e.inArray(t.href,h)&&u.push(t.href))})}else{var g,v,b;for(g=/(http[^<>"{}|\\^\[\]`\s]+)/gi;v=g.exec(p);)b=v[1].replace(/&amp;/g,"&"),-1==e.inArray(b,u)&&u.push(b)}return u},xhr:function(t,n){var i,a=n?n:this,r=a.getUI(),o=new XMLHttpRequest,s=null,l=null,d=t.checked,c=t.isDataType||"data"==t.type,u=t.target||a.cwd().hash,h=-1!=a.option("uploadMaxConn",u),p=Math.min(5,Math.max(1,a.option("uploadMaxConn",u))),f=3e4,m=1e4,g=18,v=0,b=e.Deferred().fail(function(e){if(a.uploads.xhrUploading){setTimeout(function(){a.sync()},5e3);var t=w.length?c?w[0][0]:w[0]:{};t._cid&&(y=new FormData,w=[{_chunkfail:!0}],y.append("chunk",t._chunk),y.append("cid",t._cid),c=!1,P(w))}a.uploads.xhrUploading=!1,w=null,e&&a.error(e)}).done(function(e){o=null,a.uploads.xhrUploading=!1,w=null,e&&(a.currentReqCmd="upload",e.warning&&a.error(e.warning),e.removed&&a.remove(e),e.added&&a.add(e),e.changed&&a.change(e),a.trigger("upload",e),a.trigger("uploaddone"),e.sync&&a.sync(),e.debug&&n.debug("backend-debug",e))}).always(function(){r.off("uploadabort",S),e(window).off("unload",S),s&&clearTimeout(s),l&&clearTimeout(l),d&&!t.multiupload&&F()&&a.notify({type:"upload",cnt:-k,progress:0,size:0}),E&&z.children(".elfinder-notify-chunkmerge").length&&a.notify({type:"chunkmerge",cnt:-1})}),y=new FormData,w=t.input?t.input.files:a.uploads.checkFile(t,a,u),k=t.checked&&c?w[0].length:w.length,x=0,C=0,T=!1,z=a.ui.notify,A=!0,I=!1,F=function(){return T=T||z.children(".elfinder-notify-upload").length},S=function(){I=!0,o&&(o.quiet=!0,o.abort()),F()&&a.notify({type:"upload",cnt:-1*z.children(".elfinder-notify-upload").data("cnt"),progress:0,size:0})},M=function(e){z.children(".elfinder-notify-upload").children(".elfinder-notify-cancel")[e?"show":"hide"]()},U=function(e){return e||(e=C),setTimeout(function(){T=!0,a.notify({type:"upload",cnt:k,progress:x-i,size:e,cancel:function(){r.trigger("uploadabort")}}),i=x,t.multiupload?A&&M(!0):M(A&&e>x)},a.options.notifyDelay)},O=t.renames||null,D=t.hashes||null,E=!1;if(r.one("uploadabort",S),e(window).one("unload."+n.namespace,S),!E&&(i=x),!c&&!k)return b.reject(["errUploadNoFiles"]);o.addEventListener("error",function(){0==o.status?I?b.reject():!c&&t.files&&e.map(t.files,function(e){return e.size===(a.UA.Safari?1802:0)?e:null}).length?(errors.push("errFolderUpload"),b.reject(["errAbort","errFolderUpload"])):v++<=g?setTimeout(function(){I||(C=0,o.open("POST",a.uploadURL,!0),o.timeout=f,o.send(y))},m):(r.trigger("uploadabort"),b.reject(["errAbort"])):(r.trigger("uploadabort"),b.reject("errConnect"))},!1),o.addEventListener("abort",function(){b.reject(["errConnect","errAbort"])},!1),o.addEventListener("load",function(e){var n,d=o.status,u=0,h="";if(d>=400?h=d>500?"errResponse":"errConnect":(4!=o.readyState&&(h=["errConnect","errTimeout"]),o.responseText||(h=["errResponse","errDataEmpty"])),h){r.trigger("uploadabort");var p=c?w[0][0]:w[0];return b.reject(p._cid?null:h)}if(x=C,F()&&(u=x-i)&&a.notify({type:"upload",cnt:0,progress:u,size:0}),n=a.parseUploadData(o.responseText),n._chunkmerged){y=new FormData;var f=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return E=!0,r.off("uploadabort",S),l=setTimeout(function(){a.notify({type:"chunkmerge",cnt:1})},a.options.notifyDelay),void(c?P(f,w[1]):P(f))}n._multiupload=!!t.multiupload,n.error?(a.trigger("uploadfail",n),n._chunkfailure||n._multiupload?(I=!0,a.uploads.xhrUploading=!1,s&&clearTimeout(s),z.children(".elfinder-notify-upload").length?(a.notify({type:"upload",cnt:-k,progress:0,size:0}),b.reject(n.error)):b.reject()):b.reject(n.error)):b.resolve(n)},!1),o.upload.addEventListener("loadstart",function(e){!E&&e.lengthComputable&&(x=e.loaded,v&&(x=0),C=e.total,x||(x=parseInt(.05*C)),F()&&(a.notify({type:"upload",cnt:0,progress:x-i,size:t.multiupload?0:C}),i=x))},!1),o.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!E&&(x=e.loaded,!t.checked&&x>0&&!s&&(s=U(o._totalSize-x)),C||(v&&(x=0),C=e.total,x||(x=parseInt(.05*C))),n=x-i,F()&&n/e.total>=.05&&(a.notify({type:"upload",cnt:0,progress:n,size:0}),i=x),!t.multiupload&&x>=C&&(A=!1,M(!1)))},!1);var P=function(i,r){var l,m,g,v,w,x,C,T,z,S,E,P,R=0,H=1,j=[],N=0,q=k,_=0,L=[],W=(new Date).getTime().toString().substr(-9),V=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),$=h?!1:"",B=function(i,r){var o,l,d=[],h=0;if(!I){for(;i.length&&d.length<r;)d.push(i.shift());if(h=d.length){l=h;for(var p=0;h>p&&!I;p++)o=c?d[p][0][0]._cid||null:d[p][0]._cid||null,P[o]?E--:n.exec("upload",{type:t.type,isDataType:c,files:d[p],checked:!0,target:u,renames:O,hashes:D,multiupload:!0},void 0,u).fail(function(e){e&&"No such command"===e&&(I=!0,n.error(["errUpload","errPerm"])),o&&(P[o]=!0)}).always(function(t){t&&t.added&&(z=e.merge(z,t.added)),E<=++S&&(n.trigger("multiupload",{added:z}),s&&clearTimeout(s),F()&&a.notify({type:"upload",cnt:-k,progress:0,size:0})),i.length?B(i,1):--l<=1&&(A=!1,M(!1))})}}(d.length<1||I)&&(I?(s&&clearTimeout(s),o&&(P[o]=!0),b.reject()):(b.resolve(),a.uploads.xhrUploading=!1))},G=function(){a.uploads.xhrUploading?setTimeout(function(){G()},100):(a.uploads.xhrUploading=!0,B(j,p))};if(!d&&(c||"files"==t.type)){for((l=n.option("uploadMaxSize",u))||(l=0),g=0;g<i.length;g++)if(C=i[g],m=C.size,$===!1&&($="",a.api>=2.1&&("slice"in C?$="slice":"mozSlice"in C?$="mozSlice":"webkitSlice"in C&&($="webkitSlice"))),l&&m>l||!$&&n.uplMaxSize&&m>n.uplMaxSize)a.error(a.i18n("errUploadFile",C.name)+" "+a.i18n("errUploadFileSize")),k--,q--;else if(!C.type||a.uploadMimeCheck(C.type,u))if($&&m>V){for(v=0,w=V,x=-1,q=Math.floor(m/V),_+=m,L[W]=0;m>=v;)T=C[$](v,w),T._chunk=C.name+"."+ ++x+"_"+q+".part",T._cid=W,T._range=v+","+T.size+","+m,L[W]++,R&&N++,"undefined"==typeof j[N]&&(j[N]=[],c&&(j[N][0]=[],j[N][1]=[])),R=V,H=1,c?(j[N][0].push(T),j[N][1].push(r[g])):j[N].push(T),v=w,w=v+V;null==T?(a.error(a.i18n("errUploadFile",C.name)+" "+a.i18n("errUploadFileSize")),k--,q--):(q+=x,R=0,H=1,N++)}else(n.uplMaxSize&&R+m>=n.uplMaxSize||H>n.uplMaxFile)&&(R=0,H=1,N++),"undefined"==typeof j[N]&&(j[N]=[],c&&(j[N][0]=[],j[N][1]=[])),c?(j[N][0].push(C),j[N][1].push(r[g])):j[N].push(C),R+=m,_+=m,H++;else a.error(a.i18n("errUploadFile",C.name)+" "+a.i18n("errUploadMime")+" ("+a.escape(C.type)+")"),k--,q--;if(0==j.length)return t.checked=!0,!1;if(j.length>1)return s=U(_),z=[],S=0,E=j.length,P=[],G(),!0;c?(i=j[0][0],r=j[0][1]):i=j[0]}return d||(n.UA.Safari&&t.files?o._totalSize=_:s=U(_)),d=!0,i.length||b.reject(["errUploadNoFiles"]),o.open("POST",a.uploadURL,!0),o.timeout=f,n.customHeaders&&e.each(n.customHeaders,function(e){o.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in o&&(o[e]=this)}),y.append("cmd","upload"),y.append(a.newAPI?"target":"current",u),O&&O.length&&(e.each(O,function(e,t){y.append("renames[]",t)}),y.append("suffix",n.options.backupSuffix)),D&&e.each(D,function(e,t){y.append("hashes["+e+"]",t)}),e.each(a.options.customData,function(e,t){y.append(e,t)}),e.each(a.options.onlyMimes,function(e,t){y.append("mimes["+e+"]",t)}),e.each(i,function(e,t){t._chunkmerged?(y.append("chunk",t._chunkmerged),y.append("upload[]",t._name),y.append("mtime[]",t._mtime),o.timeout=0):(t._chunkfail?(y.append("upload[]","chunkfail"),y.append("mimes","chunkfail")):y.append("upload[]",t),t._chunk&&(y.append("chunk",t._chunk),y.append("cid",t._cid),y.append("range",t._range)),y.append("mtime[]",t.lastModified?Math.round(t.lastModified/1e3):0)),n.UA.iOS&&y.append("overwrite",0)}),c&&e.each(r,function(e,t){y.append("upload_path[]",t)}),o.send(y),!0};return c?d?P(w[0],w[1]):w.done(function(t){if(O=[],k=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:u,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length}}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?p=1:(p=0,b.reject(e))}).done(function(n){n.hashes&&(t[1]=e.map(t[1],function(e){return e=e.replace(/\/[^\/]*$/,""),""===e?u:n.hashes[e]}))}).always(function(e){p&&(O=t[2],D=t[3],P(t[0],t[1]))});t[1]=e.map(t[1],function(){return u}),O=t[2],D=t[3],P(t[0],t[1])}else b.reject(["errUploadNoFiles"])}).fail(function(){b.reject()}):w.length>0?null==O?(O=[],D={},a.uploads.checkExists(w,u,n).done(function(t,i){n.options.overwriteUploadConfirm&&!n.UA.iOS&&n.option("uploadOverwrite",u)&&(O=t,D=i,w=e.map(w,function(e){return e._remove?null:e})),k=w.length,k>0?P(w)||b.reject():b.reject()})):P(w)||b.reject():b.reject(),b},iframe:function(t,n){var i,a,r,o,s=n?n:this,l=t.input?t.input:!1,d=l?!1:s.uploads.checkFile(t,s),c=e.Deferred().fail(function(e){e&&s.error(e)}),u="iframe-"+n.namespace+ ++s.iframeCnt,h=e('<form action="'+s.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+u+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),p=this.UA.IE,f=function(){
11
+ o&&clearTimeout(o),r&&clearTimeout(r),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){p&&e('<iframe src="javascript:false;"/>').appendTo(h),h.remove(),m.remove()},100)},m=e('<iframe src="'+(p?"javascript:false;":"about:blank")+'" name="'+u+'" style="position:absolute;left:-1000px;top:-1000px" />').on("load",function(){m.off("load").on("load",function(){f(),c.resolve()}),r=setTimeout(function(){a=!0,s.notify({type:"upload",cnt:i})},s.options.notifyDelay),s.options.iframeTimeout>0&&(o=setTimeout(function(){f(),c.reject([errors.connect,errors.timeout])},s.options.iframeTimeout)),h.submit()}),g=t.target||s.cwd().hash,v=[],b=[],y=[],w={};if(d&&d.length)e.each(d,function(e,t){h.append('<input type="hidden" name="upload[]" value="'+t+'"/>')}),i=1;else{if(!(l&&e(l).is(":file")&&e(l).val()))return c.reject();n.options.overwriteUploadConfirm&&!n.UA.iOS&&n.option("uploadOverwrite",g)&&(v=l.files?l.files:[{name:e(l).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/,"$1")}],b.push(s.uploads.checkExists(v,g,s).done(function(t,n){y=t,w=n,i=e.map(v,function(e){return e._remove?null:e}).length,i!=v.length&&(i=0)}))),i=l.files?l.files.length:1,h.append(l)}return e.when.apply(e,b).done(function(){return 1>i?c.reject():(h.append('<input type="hidden" name="'+(s.newAPI?"target":"current")+'" value="'+g+'"/>').append('<input type="hidden" name="html" value="1"/>').append('<input type="hidden" name="node" value="'+s.id+'"/>').append(e(l).attr("name","upload[]")),y.length>0&&(e.each(y,function(e,t){h.append('<input type="hidden" name="renames[]" value="'+s.escape(t)+'"/>')}),h.append('<input type="hidden" name="suffix" value="'+n.options.backupSuffix+'"/>')),w&&e.each(y,function(e,t){h.append('<input type="hidden" name="['+e+']" value="'+s.escape(t)+'"/>')}),e.each(s.options.onlyMimes||[],function(e,t){h.append('<input type="hidden" name="mimes[]" value="'+s.escape(t)+'"/>')}),e.each(s.options.customData,function(e,t){h.append('<input type="hidden" name="'+e+'" value="'+s.escape(t)+'"/>')}),h.appendTo("body"),void m.appendTo("body"))}),c}},one:function(e,t){var n=this,i=function(a,r){return setTimeout(function(){n.unbind(e,i)},3),t.apply(n.getListeners(a.type),arguments)};return this.bind(e,i)},localStorage:function(e,t){var n,i,a,r=window.localStorage,o="elfinder-"+e+this.id;if(e=window.location.pathname+"-elfinder-"+e+this.id,null===t)return r.removeItem(e);if(void 0===t&&!(n=r.getItem(e))&&(i=r.getItem(o))&&(t=i,r.removeItem(o)),void 0!==t){a=typeof t,"string"!==a&&"number"!==a&&(t=JSON.stringify(t));try{r.setItem(e,t)}catch(s){try{r.clear(),r.setItem(e,t)}catch(s){self.debug("error",s.toString())}}n=r.getItem(e)}if(n&&("{"===n.substr(0,1)||"["===n.substr(0,1)))try{return JSON.parse(n)}catch(s){}return n},cookie:function(t,n){var i,a,r,o,s,l;if(t="elfinder-"+t+this.id,void 0===n){if(document.cookie&&""!=document.cookie)for(r=document.cookie.split(";"),t+="=",o=0;o<r.length;o++)if(r[o]=e.trim(r[o]),r[o].substring(0,t.length)==t){if(s=decodeURIComponent(r[o].substring(t.length)),"{"===s.substr(0,1)||"["===s.substr(0,1))try{return JSON.parse(s)}catch(d){}return s}return""}return a=e.extend({},this.options.cookie),null===n?(n="",a.expires=-1):(l=typeof n,"string"!==l&&"number"!==l&&(n=JSON.stringify(n))),"number"==typeof a.expires&&(i=new Date,i.setTime(i.getTime()+864e5*a.expires),a.expires=i),document.cookie=t+"="+encodeURIComponent(n)+"; expires="+a.expires.toUTCString()+(a.path?"; path="+a.path:"")+(a.domain?"; domain="+a.domain:"")+(a.secure?"; secure":""),n},startDir:function(){var e=window.location.hash;return e&&e.match(/^#elf_/)?e.replace(/^#elf_/,""):this.options.startPathHash?this.options.startPathHash:this.lastDir()},lastDir:function(e){return this.options.rememberLastDir?this.storage("lastdir",e):""},_node:e("<span/>"),escape:function(e){return this._node.text(e).html().replace(/"/g,"&quot;").replace(/'/g,"&#039;")},normalize:function(t){var n,i,a,r,o=this,s=function(t){var s,l;return t&&t.hash&&t.name&&t.mime?("application/x-empty"==t.mime&&(t.mime="text/plain"),t.phash&&"directory"!==t.mime||(t.volumeid&&(s=t.volumeid,o.isRoot(t)&&(o.volOptions[s]||(o.volOptions[s]={}),l=o.volOptions[s],t.options&&(l=e.extend(l,t.options)),t.disabled&&(l.disabled=t.disabled),t.tmbUrl&&(l.tmbUrl=t.tmbUrl),e.each(o.optionProperties,function(e,n){l[n]&&(t[n]=l[n])}),o.roots[s]=t.hash),r!==s&&(r=s,a=o.option("i18nFolderName",s))),!t.i18&&o.isRoot(t)&&(n="volume_"+t.name,i=o.i18n(!1,n),n!==i&&(t.i18=i)),a&&!t.i18&&(n="folder_"+t.name,i=o.i18n(!1,n),n!==i&&(t.i18=i)),o.leafRoots[t.hash]&&(t.dirs||(t.dirs=1),e.each(o.leafRoots[t.hash],function(){var e=o.file(this);e&&e.ts&&(t.ts||0)<e.ts&&(t.ts=e.ts)}))),t):null};return t.cwd&&(t.cwd.volumeid&&t.options&&Object.keys(t.options).length&&(o.volOptions[t.cwd.volumeid]=t.options),t.cwd=s(t.cwd)),t.files&&(t.files=e.map(t.files,s)),t.tree&&(t.tree=e.map(t.tree,s)),t.added&&(t.added=e.map(t.added,s)),t.changed&&(t.changed=e.map(t.changed,s)),t.api&&(t.init=!0),t},setSort:function(e,t,n,i){this.storage("sortType",this.sortType=this.sortRules[e]?e:"name"),this.storage("sortOrder",this.sortOrder=/asc|desc/.test(t)?t:"asc"),this.storage("sortStickFolders",(this.sortStickFolders=!!n)?1:""),this.storage("sortAlsoTreeview",(this.sortAlsoTreeview=!!i)?1:""),this.trigger("sortchange")},_sortRules:{name:function(e,t){return elFinder.prototype.naturalCompare(e.i18||e.name,t.i18||t.name)},size:function(e,t){var n=parseInt(e.size)||0,i=parseInt(t.size)||0;return n===i?0:n>i?1:-1},kind:function(e,t){return elFinder.prototype.naturalCompare(e.mime,t.mime)},date:function(e,t){var n=e.ts||e.date,i=t.ts||t.date;return n===i?0:n>i?1:-1},perm:function(e,t){var n=function(e){return(e.write?2:0)+(e.read?1:0)},i=n(e),a=n(t);return i===a?0:i>a?1:-1},mode:function(e,t){var n=e.mode||e.perm||"",i=t.mode||t.perm||"";return elFinder.prototype.naturalCompare(n,i)},owner:function(e,t){var n=e.owner||"",i=t.owner||"";return elFinder.prototype.naturalCompare(n,i)},group:function(e,t){var n=e.group||"",i=t.group||"";return elFinder.prototype.naturalCompare(n,i)}},sorters:[],naturalCompare:function(e,t){var n=elFinder.prototype.naturalCompare;return"undefined"==typeof n.loc&&(n.loc=navigator.userLanguage||navigator.browserLanguage||navigator.language||"en-US"),"undefined"==typeof n.sort&&("11".localeCompare("2",n.loc,{numeric:!0})>0?window.Intl&&window.Intl.Collator?n.sort=new Intl.Collator(n.loc,{numeric:!0}).compare:n.sort=function(e,t){return e.localeCompare(t,n.loc,{numeric:!0})}:(n.sort=function(e,t){var i,a,r=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,d=/^0/,c=/^[\x01\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]/,u=function(e){return n.sort.insensitive&&(""+e).toLowerCase()||""+e},h=u(e).replace(o,"").replace(/^_/,"")||"",p=u(t).replace(o,"").replace(/^_/,"")||"",f=h.replace(r,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),m=p.replace(r,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),g=parseInt(h.match(l))||1!=f.length&&h.match(s)&&Date.parse(h),v=parseInt(p.match(l))||g&&p.match(s)&&Date.parse(p)||null,b=0;if(v){if(v>g)return-1;if(g>v)return 1}for(var y=0,w=Math.max(f.length,m.length);w>y;y++){if(i=!(f[y]||"").match(d)&&parseFloat(f[y])||f[y]||0,a=!(m[y]||"").match(d)&&parseFloat(m[y])||m[y]||0,isNaN(i)!==isNaN(a)){if(isNaN(i)&&("string"!=typeof i||!i.match(c)))return 1;if("string"!=typeof a||!a.match(c))return-1}if(0===parseInt(i,10)&&(i=0),0===parseInt(a,10)&&(a=0),typeof i!=typeof a&&(i+="",a+=""),n.sort.insensitive&&"string"==typeof i&&"string"==typeof a&&(b=i.localeCompare(a,n.loc),0!==b))return b;if(a>i)return-1;if(i>a)return 1}return 0},n.sort.insensitive=!0)),n.sort(e,t)},compare:function(e,t){var n,i=this,a=i.sortType,r="asc"==i.sortOrder,o=i.sortStickFolders,s=i.sortRules,l=s[a],d="directory"==e.mime,c="directory"==t.mime;if(o){if(d&&!c)return-1;if(!d&&c)return 1}return n=r?l(e,t):l(t,e),"name"!==a&&0===n?n=r?s.name(e,t):s.name(t,e):n},sortFiles:function(e){return e.sort(this.compare)},notify:function(t){var n,i,a,r=t.type,o=this.i18n("undefined"!=typeof t.msg?t.msg:this.messages["ntf"+r]?"ntf"+r:"ntfsmth"),s=this.ui.notify,l=s.children(".elfinder-notify-"+r),d=l.children("div.elfinder-notify-cancel").children("button"),c='<div class="elfinder-notify elfinder-notify-{type}"><span class="elfinder-dialog-icon elfinder-dialog-icon-{type}"/><span class="elfinder-notify-msg">{msg}</span> <span class="elfinder-notify-cnt"/><div class="elfinder-notify-progressbar"><div class="elfinder-notify-progress"/></div><div class="elfinder-notify-cancel"/></div>',u=t.cnt,h="undefined"!=typeof t.size?parseInt(t.size):null,p="undefined"!=typeof t.progress&&t.progress>=0?t.progress:null,f=t.cancel,m="ui-state-hover",g=function(){l._esc&&e(document).off("keydown",l._esc),l.remove(),!s.children().length&&s.elfinderdialog("close")};return r?(l.length?"undefined"!=typeof t.msg&&l.children("span.elfinder-notify-msg").html(o):(l=e(c.replace(/\{type\}/g,r).replace(/\{msg\}/g,o)).appendTo(s).data("cnt",0),null!=p&&l.data({progress:0,total:0}),f&&(d=e('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+this.i18n("btnCancel")+"</span></button>").hover(function(t){e(this).toggleClass(m,"mouseenter"==t.type)}),l.children("div.elfinder-notify-cancel").append(d))),n=u+parseInt(l.data("cnt")),n>0?(f&&d.length&&(e.isFunction(f)||"object"==typeof f&&f.promise)&&(l._esc=function(t){"keydown"==t.type&&t.keyCode!=e.ui.keyCode.ESCAPE||(t.preventDefault(),t.stopPropagation(),g(),f.promise?(f.xhr&&(f.xhr.quiet=!0,f.xhr.abort()),f.reject()):f(t))},d.on("click",function(e){l._esc(e)}),e(document).on("keydown."+this.namespace,l._esc)),!t.hideCnt&&l.children(".elfinder-notify-cnt").text("("+n+")"),s.is(":hidden")&&s.elfinderdialog("open",this),l.data("cnt",n),null!=p&&(i=l.data("total"))>=0&&(a=l.data("progress"))>=0&&(i+=null!=h?h:u,a+=p,null==h&&0>u&&(a+=100*u),l.data({progress:a,total:i}),null!=h&&(a*=100,i=Math.max(1,i)),p=parseInt(a/i),l.find(".elfinder-notify-progress").animate({width:(100>p?p:100)+"%"},20))):g(),this):this},confirm:function(t){var n,i=this,a=!1,r={cssClass:"elfinder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(t.title||"confirmReq"),buttons:{},close:function(){!a&&t.cancel.callback(),e(this).elfinderdialog("destroy")}},o=this.i18n("apllyAll");return r.buttons[this.i18n(t.accept.label)]=function(){t.accept.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")},t.reject&&(r.buttons[this.i18n(t.reject.label)]=function(){t.reject.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")}),t.buttons&&t.buttons.length>0&&e.each(t.buttons,function(t,o){r.buttons[i.i18n(o.label)]=function(){o.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")}}),r.buttons[this.i18n(t.cancel.label)]=function(){e(this).elfinderdialog("close")},t.all&&(r.create=function(){var t=e('<div class="elfinder-dialog-confirm-applyall"/>');n=e('<input type="checkbox" />'),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("<label>"+o+"</label>").prepend(n)))}),this.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-confirm"/>'+this.i18n(t.text),r)},uniqueName:function(e,t,n){var i,a,r=0,o="";if(e=this.i18n(e),t=t||this.cwd().hash,n="undefined"==typeof n?" ":n,(i=e.match(/^(.+)(\.[^.]+)$/))&&(o=i[2],e=i[1]),a=e+o,!this.fileByName(a,t))return a;for(;1e4>r;)if(a=e+n+ ++r+o,!this.fileByName(a,t))return a;return e+Math.random()+o},i18n:function(){var t,n,i,a,r=this,o=this.messages,s=[],l=[],d=function(e){var t;return 0===e.indexOf("#")&&(t=r.file(e.substr(1)))?t.name:e},c=0;for(arguments.length&&arguments[0]===!1&&(a=function(e){return e},c=1),t=c;t<arguments.length;t++)if(i=arguments[t],e.isArray(i))for(n=0;n<i.length;n++)i[n]instanceof jQuery?s.push(i[n]):"undefined"!=typeof i[n]&&s.push(d(""+i[n]));else i instanceof jQuery?s.push(i[n]):"undefined"!=typeof i&&s.push(d(""+i));for(t=0;t<s.length;t++)-1===e.inArray(t,l)&&(i=s[t],"string"==typeof i?(i=o[i]||(a?a(i):r.escape(i)),i=i.replace(/\$(\d+)/g,function(e,n){return n=t+parseInt(n),n>0&&s[n]&&l.push(n),a?a(s[n]):r.escape(s[n])})):i=i.get(0).outerHTML,s[t]=i);return e.map(s,function(t,n){return-1===e.inArray(n,l)?t:null}).join("<br>")},mime2class:function(e){var t="elfinder-cwd-icon-";return e=e.split("/"),t+e[0]+("image"!=e[0]&&e[1]?" "+t+e[1].replace(/(\.|\+)/g,"-"):"")},mime2kind:function(e){var t,n="object"==typeof e,i=n?e.mime:e;return n&&e.alias&&"symlink-broken"!=i?t="Alias":this.kinds[i]&&(t=!n||"directory"!==i||e.phash&&!e.isroot?this.kinds[i]:"Root"),t||(t=0===i.indexOf("text")?"Text":0===i.indexOf("image")?"Image":0===i.indexOf("audio")?"Audio":0===i.indexOf("video")?"Video":0===i.indexOf("application")?"App":i),this.messages["kind"+t]?this.i18n("kind"+t):i},formatDate:function(e,t){var n,i,a,r,o,s,l,d,c,u,h,p=this,t=t||e.ts,f=p.i18;return p.options.clientFormatDate&&t>0?(n=new Date(1e3*t),d=n[p.getHours](),c=d>12?d-12:d,u=n[p.getMinutes](),h=n[p.getSeconds](),r=n[p.getDate](),o=n[p.getDay](),s=n[p.getMonth]()+1,l=n[p.getFullYear](),i=t>=this.yesterday?this.fancyFormat:this.dateFormat,a=i.replace(/[a-z]/gi,function(e){switch(e){case"d":return r>9?r:"0"+r;case"j":return r;case"D":return p.i18n(f.daysShort[o]);case"l":return p.i18n(f.days[o]);case"m":return s>9?s:"0"+s;case"n":return s;case"M":return p.i18n(f.monthsShort[s-1]);case"F":return p.i18n(f.months[s-1]);case"Y":return l;case"y":return(""+l).substr(2);case"H":return d>9?d:"0"+d;case"G":return d;case"g":return c;case"h":return c>9?c:"0"+c;case"a":return d>=12?"pm":"am";case"A":return d>=12?"PM":"AM";case"i":return u>9?u:"0"+u;case"s":return h>9?h:"0"+h}return e}),t>=this.yesterday?a.replace("$1",this.i18n(t>=this.today?"Today":"Yesterday")):a):e.date?e.date.replace(/([a-z]+)\s/i,function(e,t){return p.i18n(t)+" "}):p.i18n("dateUnknown")},perms2class:function(e){var t="";return e.read||e.write?e.read?e.write||(t="elfinder-ro"):t="elfinder-wo":t="elfinder-na",e.type&&(t+=" elfinder-"+this.escape(e.type)),t},formatPermissions:function(e){var t=[];return e.read&&t.push(this.i18n("read")),e.write&&t.push(this.i18n("write")),t.length?t.join(" "+this.i18n("and")+" "):this.i18n("noaccess")},formatSize:function(e){var t=1,n="b";return"unknown"==e?this.i18n("unknown"):(e>1073741824?(t=1073741824,n="GB"):e>1048576?(t=1048576,n="MB"):e>1024&&(t=1024,n="KB"),e/=t,(e>0?t>=1048576?e.toFixed(2):Math.round(e):0)+" "+n)},formatFileMode:function(t,n){var i,a,r,o,s,l,d,c,u;if(n||(n=this.options.fileModeStyle.toLowerCase()),t=e.trim(t),t.match(/[rwxs-]{9}$/i)){if(c=t=t.substr(-9),"string"==n)return c;for(u="",r=0,i=0;7>i;i+=3)a=t.substr(i,3),o=0,a.match(/[r]/i)&&(o+=4),a.match(/[w]/i)&&(o+=2),a.match(/[xs]/i)&&(a.match(/[xs]/)&&(o+=1),a.match(/[s]/i)&&(0==i?r+=4:3==i&&(r+=2))),u+=o.toString(8);r&&(u=r.toString(8)+u)}else{if(t=parseInt(t,8),u=t?t.toString(8):"",!t||"octal"==n)return u;for(a=t.toString(8),r=0,a.length>3&&(a=a.substr(-4),r=parseInt(a.substr(0,1),8),a=a.substr(1)),s=1==(1&r),d=2==(2&r),l=4==(4&r),c="",i=0;3>i;i++)c+=4==(4&parseInt(a.substr(i,1),8))?"r":"-",c+=2==(2&parseInt(a.substr(i,1),8))?"w":"-",c+=1==(1&parseInt(a.substr(i,1),8))?0==i&&l||1==i&&d?"s":"x":"-"}return"both"==n?c+" ("+u+")":"string"==n?c:u},uploadMimeCheck:function(t,n){n=n||this.cwd().hash;var i,a,r=!0,o=this.option("uploadMime",n),s=function(n){var i=!1;return"string"==typeof n&&"all"===n.toLowerCase()?i=!0:e.isArray(n)&&n.length&&e.each(n,function(e,n){return n=n.toLowerCase(),"all"===n||0===t.indexOf(n)?(i=!0,!1):void 0}),i};return t&&e.isPlainObject(o)&&(t=t.toLowerCase(),i=s(o.allow),a=s(o.deny),"allow"===o.firstOrder?(r=!1,a||i!==!0||(r=!0)):(r=!0,a!==!0||i||(r=!1))),r},sequence:function(e){var t=e.length,n=function(t,i){return++i,e[i]?n(t.then(e[i]),i):t};return t>1?n(e[0](),0):e[0]()},reloadContents:function(t){var n,i=e.Deferred();try{n=e('<iframe width="1" height="1" scrolling="no" frameborder="no" style="position:absolute; top:-1px; left:-1px" crossorigin="use-credentials">').attr("src",t).one("load",function(){var n=e(this);try{this.contentDocument.location.reload(!0),n.one("load",function(){n.remove(),i.resolve()})}catch(a){n.attr("src","").attr("src",t).one("load",function(){n.remove(),i.resolve()})}}).appendTo("body")}catch(a){n&&n.remove(),i.reject()}return i},makeNetmountOptionOauth:function(t,n,i,a){return{vars:{},name:n,inputs:{offline:e('<input type="checkbox"/>').on("change",function(){e(this).parents("table.elfinder-netmount-tb").find("select:first").trigger("change","reset")}),host:e('<span><span class="elfinder-info-spinner"/></span><input type="hidden"/>'),path:e('<input type="text" value="root"/>'),user:e('<input type="hidden"/>'),pass:e('<input type="hidden"/>')},select:function(n,r,o){var s=this.inputs,l=s.offline,d=e(s.host[0]),o=o||null;this.vars.mbtn=s.host.closest(".ui-dialog").children(".ui-dialog-buttonpane:first").find("button.elfinder-btncnt-0"),d.data("inrequest")||!d.find("span.elfinder-info-spinner").length&&"reset"!==o&&("winfocus"!==o||d.siblings("span.elfinder-button-icon-reload").length)?(l.closest("tr")[a||s.user.val()?"hide":"show"](),d.data("funcexpup")&&d.data("funcexpup")()):(1===l.parent().children().length&&(s.path.parent().prev().html(n.i18n("folderId")),l.attr("title",n.i18n("offlineAccess")),l.uniqueId().after(e("<label/>").attr("for",l.attr("id")).html(" "+n.i18n("offlineAccess")))),d.data("inrequest",!0).empty().addClass("elfinder-info-spinner").parent().find("span.elfinder-button-icon").remove(),n.request({data:{cmd:"netmount",protocol:t,host:i,user:"init",options:{id:n.id,offline:l.prop("checked")?1:0,pass:s.host[1].value}},preventDefault:!0}).done(function(e){d.removeClass("elfinder-info-spinner").html(e.body.replace(/\{msg:([^}]+)\}/g,function(e,t){return n.i18n(t,i)}))}),a&&l.closest("tr").hide()),this.vars.mbtn[e(s.host[1]).val()?"show":"hide"]()},done:function(n,r){var o=this.inputs,s=this.protocol,l=e(o.host[0]),d=e(o.host[1]),c="&nbsp;";if(a&&o.offline.closest("tr").hide(),"makebtn"==r.mode)l.removeClass("elfinder-info-spinner").removeData("expires").removeData("funcexpup"),o.host.find("input").hover(function(){e(this).toggleClass("ui-state-hover")}),d.val(""),o.path.val("root").next().remove(),o.user.val(""),o.pass.val(""),!a&&o.offline.closest("tr").show(),this.vars.mbtn.hide();else{if(r.expires&&(c="()",l.data("expires",r.expires)),l.html(i+c).removeClass("elfinder-info-spinner"),r.expires&&(l.data("funcexpup",function(){var e=Math.floor((l.data("expires")-+new Date/1e3)/60);3>e?l.parent().children(".elfinder-button-icon-reload").click():(l.text(l.text().replace(/\(.*\)/,"("+n.i18n(["minsLeft",e])+")")),setTimeout(function(){l.is(":visible")&&l.data("funcexpup")()},6e4))}),l.data("funcexpup")()),r.reset)return void s.trigger("change","reset");l.parent().append(e('<span class="elfinder-button-icon elfinder-button-icon-reload" title="'+n.i18n("reAuth")+'">').on("click",function(){d.val("reauth"),s.trigger("change","reset")})),d.val(t),this.vars.mbtn.show(),r.folders&&o.path.next().remove().end().after(e("<div/>").append(e('<select class="ui-corner-all" style="max-width:200px;">').append(e(e.map(r.folders,function(e,t){return'<option value="'+(t+"").trim()+'">'+n.escape(e)+"</option>"}).join(""))).on("change",function(){o.path.val(e(this).val())}))),o.user.val("done"),o.pass.val("done"),o.offline.closest("tr").h