diff --git a/Dockerfile b/Dockerfile index dd167460..ace857ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/clingen-data-model/cgwi-php-11.7-8.0:v1.1.4 +FROM ghcr.io/clingen-data-model/cgwi-php-11.7-8.2:v1.1.6 LABEL maintainer="UNC ClinGen Infrastructure Team" \ io.openshift.tags="gene-tracker:v1" \ diff --git a/app/Actions/SurveyDataExport.php b/app/Actions/SurveyDataExport.php index ddadc779..6500560e 100644 --- a/app/Actions/SurveyDataExport.php +++ b/app/Actions/SurveyDataExport.php @@ -27,10 +27,16 @@ public function handle($class, $limit = null) { $responses = $class::with('volunteer')->get(); $rows = $this->getRows($responses); + $filepath = storage_path('app/reports/'.Str::snake(preg_replace('/\\\/', '', $class)).'_'.Carbon::now()->format('Y-m-d').'.csv'); - $fh = fopen($filepath, 'w'); + + if (count($rows) == 0) { + fputcsv($fh, ['No followup survey data to export.']); + return $filepath; + } + fputcsv($fh, array_keys($rows[0])); foreach ($rows as $idx => $row) { if ($limit && $idx+1 > $limit) { diff --git a/app/Http/Controllers/Admin/CurationGroupCrudController.php b/app/Http/Controllers/Admin/CurationGroupCrudController.php index 2e8046aa..4b70cd61 100644 --- a/app/Http/Controllers/Admin/CurationGroupCrudController.php +++ b/app/Http/Controllers/Admin/CurationGroupCrudController.php @@ -49,8 +49,7 @@ public function setup() $this->crud->modifyField('curation_activity_id', [ 'label' => 'Curation Activity', - 'type' => 'select', - 'entity' => 'curationActivity', + 'type' => 'select2', 'name' => 'curation_activity_id', 'attribute' => 'name', 'model' => CurationActivity::class, @@ -63,12 +62,11 @@ public function setup() ]); $this->crud->modifyField('working_group_id', [ - 'label' => 'Working Group', 'type' => 'select2', 'name' => 'working_group_id', - 'entity' => 'workingGroup', - 'attribute' => 'name', + 'label' => 'Working Group', 'model' => WorkingGroup::class, + 'attribute' => 'name', ]); $this->crud->with('curationActivity'); diff --git a/app/Http/Controllers/Admin/CustomSurveyCrudController.php b/app/Http/Controllers/Admin/CustomSurveyCrudController.php index 48f15538..8cf39938 100644 --- a/app/Http/Controllers/Admin/CustomSurveyCrudController.php +++ b/app/Http/Controllers/Admin/CustomSurveyCrudController.php @@ -95,21 +95,19 @@ protected function setupCreateOperation() * - CRUD::field('price')->type('number'); * - CRUD::addField(['name' => 'price', 'type' => 'number'])); */ - CRUD::modifyField('curation_group_id', [ + $this->crud->modifyField('curation_group_id', [ 'type' => 'select2', 'label' => 'Curation Group', 'name' => 'curation_group_id', 'model' => CurationGroup::class, 'attribute' => 'name', - 'entity' => 'curationGroup' ]); - CRUD::modifyField('volunteer_type_id', [ + $this->crud->modifyField('volunteer_type_id', [ 'type' => 'select2', 'name' => 'volunteer_type_id', 'model' => VolunteerType::class, - 'entity' => 'volunteerType', 'attribute' => 'name', - 'relation_type' => 'belongsTo' + 'lable' => 'Volunteer Type' ]); } diff --git a/app/Http/Controllers/Admin/FaqCrudController.php b/app/Http/Controllers/Admin/FaqCrudController.php index ea9315a0..f513ef5c 100644 --- a/app/Http/Controllers/Admin/FaqCrudController.php +++ b/app/Http/Controllers/Admin/FaqCrudController.php @@ -4,7 +4,6 @@ use App\Faq; use App\Http\Requests\FaqRequest as StoreRequest; -// VALIDATION: change the requests to match your own file names if you need form validation use App\Http\Requests\FaqRequest as UpdateRequest; use Backpack\CRUD\app\Http\Controllers\CrudController; use Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation; @@ -63,9 +62,6 @@ public function setup() $this->crud->modifyField('answer', [ 'type' => 'ckeditor', - 'options' => [ - 'removePlugins' => 'image,maximize,oembed', - ], ]); $this->crud->removeColumn('screenshots'); diff --git a/app/Http/Controllers/Admin/UserCrudController.php b/app/Http/Controllers/Admin/UserCrudController.php index ffbcb46c..054caff6 100644 --- a/app/Http/Controllers/Admin/UserCrudController.php +++ b/app/Http/Controllers/Admin/UserCrudController.php @@ -93,7 +93,6 @@ function ($value) { 'label' => 'Roles', 'type' => 'select2_multiple', 'name' => 'roles', - 'entity' => 'roles', 'attribute' => 'name', 'model' => Role::class, 'pivot' => true, @@ -102,7 +101,6 @@ function ($value) { 'label' => 'Additonal Permissions', 'type' => 'select2_multiple', 'name' => 'permissions', - 'entity' => 'Permissions', 'attribute' => 'name', 'model' => Permission::class, 'pivot' => true, @@ -176,11 +174,11 @@ function ($value) { protected function setupCreateOperation() { - $this->crud->setValidation(StoreRequest::class); + // $this->crud->setValidation(StoreRequest::class); } protected function setupUpdateOperation() { - $this->crud->setValidation(UpdateRequest::class); + // $this->crud->setValidation(UpdateRequest::class); } } diff --git a/app/Http/Controllers/Admin/VolunteerCrudController.php b/app/Http/Controllers/Admin/VolunteerCrudController.php index b27cc861..05fe5dc1 100644 --- a/app/Http/Controllers/Admin/VolunteerCrudController.php +++ b/app/Http/Controllers/Admin/VolunteerCrudController.php @@ -35,9 +35,6 @@ public function setup() $this->crud->setRoute(config('backpack.base.route_prefix').'/volunteer'); $this->crud->setEntityNameStrings('volunteer', 'volunteers'); - $this->crud->allowAccess(['list', 'create', 'delete', 'show']); - $this->crud->denyAccess(['update']); - /* |-------------------------------------------------------------------------- | CrudPanel Configuration @@ -55,22 +52,24 @@ public function setup() $this->crud->setRequiredFields(StoreRequest::class, 'create'); $this->crud->setRequiredFields(UpdateRequest::class, 'edit'); - $this->crud->modifyField('volunteer_type_id',[ - 'label' => 'Volunteer Type', - 'type' => 'select2', - 'name' => 'volunteer_type_id', - 'entity' => 'volunteerType', - 'model' => VolunteerType::class, - 'attribute' => 'name', - ]); + $this->crud->field('volunteer_type_id') + ->type('relationship') + ->label('Volunteer Type'); + + $this->crud->modifyField('volunteer_type_id', [ + 'type' => 'select2', + 'name' => 'volunteer_type_id', + 'model' => VolunteerType::class, + 'label' => "Volunteer Type", + 'attribute' => 'name' + ]); $this->crud->modifyField('volunteer_status_id', [ - 'label' => 'Volunteer Status', - 'type' => 'select2', - 'name' => 'volunteer_status_id', - 'entity' => 'volunteerStatus', - 'model' => VolunteerStatus::class, - 'attribute' => 'name', + 'type' => 'select2', + 'model' => VolunteerStatus::class, + 'label' => 'Volunteer Status', + 'name' => 'volunteerStatus', + 'attribute' => 'name', ]); $this->crud->modifyField( @@ -78,7 +77,6 @@ public function setup() [ 'type' => 'select2', 'name' => 'country_id', - 'entity' => 'country', 'attribute' => 'name', 'model' => Country::class, ] @@ -106,6 +104,7 @@ public function setup() $this->crud->removeFields(['password', 'last_logged_in_at', 'last_logged_out_at']); $this->crud->with('roles'); + } protected function setupCreateOperation() @@ -170,12 +169,14 @@ public function setupListOperation() [ 'label' => 'Type', 'type' => 'relationship', - 'name' => 'volunteerType', + 'name' => 'VolunteerType', + 'relation_type' => 'bleongsTo', ], [ 'label' => 'Status', 'type' => 'relationship', 'name' => 'volunteerStatus', + 'relation_type' => 'bleongsTo', ], ]); } diff --git a/app/Http/Requests/UserRequest.php b/app/Http/Requests/UserRequest.php index 666bf84e..cbdcc86d 100644 --- a/app/Http/Requests/UserRequest.php +++ b/app/Http/Requests/UserRequest.php @@ -28,7 +28,6 @@ public function rules() return [ 'first_name' => 'required|min:2|max:255', 'last_name' => 'required|min:2|max:255', - 'email' => ['required','min:6','max:255'], 'email' => ['required','min:6','max:255', Rule::unique('users', 'email')->ignore(request()->route('id'))], ]; } diff --git a/composer.json b/composer.json index 17be695a..a787731e 100644 --- a/composer.json +++ b/composer.json @@ -7,13 +7,21 @@ "laravel" ], "license": "MIT", - "repositories": [{ - "type": "vcs", - "url": "https://github.com/yugen/surveys" - }], + "repositories": { + "backpack": { + "type": "composer", + "url": "https://repo.backpackforlaravel.com/" + }, + "surveys": { + "type": "vcs", + "url": "https://github.com/yugen/surveys" + } + }, "require": { "php": "^8.2", "backpack/crud": "^6.0", + "backpack/editable-columns": "*", + "backpack/pro": "^2.0", "backpack/theme-coreuiv2": "^1.2", "barryvdh/laravel-elfinder": "^0.5.2", "box/spout": "^3.1", @@ -93,6 +101,8 @@ "post-create-project-cmd": [ "@php artisan key:generate --ansi" ], - "post-install-cmd": ["php artisan storage:link --quiet"] + "post-install-cmd": [ + "php artisan storage:link --quiet" + ] } } diff --git a/composer.lock b/composer.lock index 755c92b9..7ed19d46 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ffe89ede046470ffce19e3575d11011b", + "content-hash": "33dc25203bd545e743b14400bb2f4666", "packages": [ { "name": "backpack/basset", @@ -175,6 +175,144 @@ }, "time": "2023-11-26T11:38:06+00:00" }, + { + "name": "backpack/editable-columns", + "version": "3.0.3", + "source": { + "type": "git", + "url": "git@github.com:Laravel-Backpack/editable-columns.git", + "reference": "794fd41b6bcb9b3d6791f9caf09415d6b4c818bf" + }, + "dist": { + "type": "zip", + "url": "https://repo.backpackforlaravel.com/dist/backpack/editable-columns/backpack-editable-columns-794fd41b6bcb9b3d6791f9caf09415d6b4c818bf-zip-36c882.zip", + "reference": "794fd41b6bcb9b3d6791f9caf09415d6b4c818bf", + "shasum": "1a52a9e3c74f26f483267c98694760b326f62681" + }, + "require": { + "backpack/crud": "^6.0" + }, + "require-dev": { + "orchestra/testbench": "~5|~6", + "phpunit/phpunit": "~9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Backpack\\EditableColumns\\AddonServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Backpack\\EditableColumns\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Backpack\\EditableColumns\\Tests\\": "tests" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpunit --testdox" + ] + }, + "license": [ + "EULA" + ], + "authors": [ + { + "name": "Cristian Tabacitu", + "email": "cristian.tabacitu@backpackforlaravel.com", + "homepage": "https://backpackforlaravel.com" + } + ], + "description": "Add input columns to your tables, to let your admins edit values right then and there.", + "homepage": "https://github.com/backpack/editable-columns", + "keywords": [ + "Backpack", + "Backpack Addon", + "Backpack for Laravel", + "EditableColumns", + "Laravel" + ], + "support": { + "source": "https://github.com/Laravel-Backpack/editable-columns/tree/3.0.3", + "issues": "https://github.com/Laravel-Backpack/editable-columns/issues" + }, + "time": "2023-12-04T12:49:10+00:00" + }, + { + "name": "backpack/pro", + "version": "2.0.20", + "source": { + "type": "git", + "url": "git@github.com:Laravel-Backpack/PRO.git", + "reference": "3f47d4c9faccffdb388ca3c3a8bbd3f7a00c27b3" + }, + "dist": { + "type": "zip", + "url": "https://repo.backpackforlaravel.com/dist/backpack/pro/backpack-pro-3f47d4c9faccffdb388ca3c3a8bbd3f7a00c27b3-zip-2ff8a4.zip", + "reference": "3f47d4c9faccffdb388ca3c3a8bbd3f7a00c27b3", + "shasum": "557ff34499d3db5123a1eb9a6246f5d82a2ce851" + }, + "require": { + "backpack/crud": "^6.0.1" + }, + "require-dev": { + "orchestra/testbench": "~5|~6", + "phpunit/phpunit": "~9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Backpack\\Pro\\AddonServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Backpack\\Pro\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Backpack\\Pro\\Tests\\": "tests" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpunit --testdox" + ] + }, + "license": [ + "Proprietary" + ], + "authors": [ + { + "name": "Cristian Tabacitu", + "email": "cristian.tabacitu@backpackforlaravel.com", + "homepage": "https://backpackforlaravel.com" + } + ], + "description": "Operations, Fields, Columns, Filters and Widgets for not-so-simple admin panels.", + "homepage": "https://github.com/digitallyhappy/backpack-pro", + "keywords": [ + "Backpack", + "Backpack Addon", + "Backpack for Laravel", + "Laravel", + "Pro" + ], + "support": { + "source": "https://github.com/Laravel-Backpack/PRO/tree/2.0.20", + "issues": "https://github.com/Laravel-Backpack/PRO/issues" + }, + "time": "2023-12-06T12:06:23+00:00" + }, { "name": "backpack/theme-coreuiv2", "version": "1.2.2", diff --git a/config/elfinder.php b/config/elfinder.php index 5fc3f928..44546c6e 100644 --- a/config/elfinder.php +++ b/config/elfinder.php @@ -10,7 +10,7 @@ | The dir where to store the images (relative from public). | */ - 'dir' => ['storage/admin_uploads'], + 'dir' => ['storage/admin_uploads', 'storage/faqs'], /* |-------------------------------------------------------------------------- diff --git a/public/packages/barryvdh/elfinder/css/elfinder.full.css b/public/packages/barryvdh/elfinder/css/elfinder.full.css new file mode 100644 index 00000000..34d7e2cd --- /dev/null +++ b/public/packages/barryvdh/elfinder/css/elfinder.full.css @@ -0,0 +1,5350 @@ +/*! + * elFinder - file manager for web + * Version 2.1.62 (2023-06-14) + * http://elfinder.org + * + * Copyright 2009-2023, Studio 42 + * Licensed under a 3-clauses BSD license + */ + +/* File: /css/commands.css */ +/******************************************************************/ +/* COMMANDS STYLES */ +/******************************************************************/ + +/********************** COMMAND "RESIZE" ****************************/ +.elfinder-resize-container { + margin-top: .3em; +} + +.elfinder-resize-type { + float: left; + margin-bottom: .4em; +} + +.elfinder-resize-control { + float: left; +} + +.elfinder-resize-control input[type=number] { + border: 1px solid #aaa; + text-align: right; + width: 4.5em; +} + +.elfinder-mobile .elfinder-resize-control input[type=number] { + width: 3.5em; +} + +.elfinder-resize-control input.elfinder-resize-bg { + text-align: center; + width: 5em; + direction: ltr; +} + +.elfinder-dialog-resize .elfinder-resize-control-panel { + margin-top: 10px; +} + +.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-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: transparent; +} + +.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-dialog.elfinder-dialog-resize .ui-resizable-e { + width: 10px; + height: 100%; +} + +.elfinder-dialog.elfinder-dialog-resize .ui-resizable-s { + width: 100%; + height: 10px; +} + +.elfinder-resize-loading { + 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-resize .elfinder-resize-whctrls { + margin: -20px 5px 0 5px; +} + +.elfinder-ltr .elfinder-dialog-resize .elfinder-resize-whctrls { + float: right; +} + +.elfinder-rtl .elfinder-dialog-resize .elfinder-resize-whctrls { + float: left; +} + +.elfinder-dialog-resize .ui-resizable-e, +.elfinder-dialog-resize .ui-resizable-w { + height: 100%; + width: 10px; +} + +.elfinder-dialog-resize .ui-resizable-s, +.elfinder-dialog-resize .ui-resizable-n { + width: 100%; + height: 10px; +} + +.elfinder-dialog-resize .ui-resizable-e { + margin-right: -7px; +} + +.elfinder-dialog-resize .ui-resizable-w { + margin-left: -7px; +} + +.elfinder-dialog-resize .ui-resizable-s { + margin-bottom: -7px; +} + +.elfinder-dialog-resize .ui-resizable-n { + margin-top: -7px; +} + +.elfinder-dialog-resize .ui-resizable-se, +.elfinder-dialog-resize .ui-resizable-sw, +.elfinder-dialog-resize .ui-resizable-ne, +.elfinder-dialog-resize .ui-resizable-nw { + width: 10px; + height: 10px; +} + +.elfinder-dialog-resize .ui-resizable-se { + background: transparent; + bottom: 0; + right: 0; + margin-right: -7px; + margin-bottom: -7px; +} + +.elfinder-dialog-resize .ui-resizable-sw { + margin-left: -7px; + margin-bottom: -7px; +} + +.elfinder-dialog-resize .ui-resizable-ne { + margin-right: -7px; + margin-top: -7px; +} + +.elfinder-dialog-resize .ui-resizable-nw { + margin-left: -7px; + margin-top: -7px; +} + +.elfinder-touch .elfinder-dialog-resize .ui-resizable-s, +.elfinder-touch .elfinder-dialog-resize .ui-resizable-n { + height: 20px; +} + +.elfinder-touch .elfinder-dialog-resize .ui-resizable-e, +.elfinder-touch .elfinder-dialog-resize .ui-resizable-w { + width: 20px; +} + +.elfinder-touch .elfinder-dialog-resize .ui-resizable-se, +.elfinder-touch .elfinder-dialog-resize .ui-resizable-sw, +.elfinder-touch .elfinder-dialog-resize .ui-resizable-ne, +.elfinder-touch .elfinder-dialog-resize .ui-resizable-nw { + width: 30px; + height: 30px; +} + +.elfinder-touch .elfinder-dialog-resize .elfinder-resize-preview .ui-resizable-se { + width: 30px; + height: 30px; + 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 input.elfinder-resize-quality { + width: 3.5em; +} + +.elfinder-mobile .elfinder-dialog-resize .elfinder-resize-degree input, +.elfinder-mobile .elfinder-dialog-resize input.elfinder-resize-quality { + width: 2.5em; +} + +.elfinder-dialog-resize .elfinder-resize-degree button.ui-button { + padding: 6px 8px; +} + +.elfinder-dialog-resize button.ui-button span { + padding: 0; +} + +.elfinder-dialog-resize .elfinder-resize-jpgsize { + font-size: 90%; +} + +.ui-widget-content .elfinder-resize-container .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-resize-preset-container { + box-sizing: border-box; + border-radius: 5px; +} + +/********************** COMMAND "EDIT" ****************************/ +/* edit text file textarea */ +.elfinder-file-edit { + width: 100%; + height: 100%; + margin: 0; + padding: 2px; + border: 1px solid #ccc; + box-sizing: border-box; + resize: none; +} + +.elfinder-touch .elfinder-file-edit { + font-size: 16px; +} + +/* edit area */ +.elfinder-dialog-edit .ui-dialog-content.elfinder-edit-editor { + background-color: #fff; +} + +.elfinder-dialog-edit .ui-dialog-content.elfinder-edit-editor .elfinder-edit-imageeditor { + width: 100%; + height: 300px; + max-height: 100%; + text-align: center; +} + +.elfinder-dialog-edit .ui-dialog-content.elfinder-edit-editor .elfinder-edit-imageeditor * { + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; +} + +.elfinder-edit-imageeditor .tui-image-editor-main-container .tui-image-editor-main { + top: 0; +} + +.elfinder-edit-imageeditor .tui-image-editor-main-container .tui-image-editor-header { + display: none; +} + +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-crop .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-flip .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-rotate .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-draw .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-shape .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-icon .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-text .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-mask .tui-image-editor-wrap, +.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-filter .tui-image-editor-wrap { + height: calc(100% - 150px); +} + +/* bottom margen for softkeyboard on fullscreen mode */ +.elfinder-touch.elfinder-fullscreen-native textarea.elfinder-file-edit { + padding-bottom: 20em; + margin-bottom: -20em; +} + +.elfinder-dialog-edit .ui-dialog-buttonpane .elfinder-dialog-confirm-encoding { + font-size: 12px; +} + +.ui-dialog-buttonpane .ui-dialog-buttonset.elfinder-edit-extras { + margin: 0 1em 0 .2em; + float: left; +} + +.ui-dialog-buttonpane .ui-dialog-buttonset.elfinder-edit-extras-quality { + padding-top: 6px; +} + +.ui-dialog-buttonpane .ui-dialog-buttonset.elfinder-edit-extras select { + font-size: 12px; + margin-top: 8px; +} + +.elfinder-dialog-edit .ui-dialog-buttonpane .ui-icon { + cursor: pointer; +} + +.elfinder-edit-spinner { + position: absolute; + top: 50%; + text-align: center; + width: 100%; + font-size: 16pt; +} + +.elfinder-dialog-edit .elfinder-edit-spinner .elfinder-spinner, +.elfinder-dialog-edit .elfinder-edit-spinner .elfinder-spinner-text { + float: none; +} + +.elfinder-dialog-edit .elfinder-toast > div { + width: 280px; +} + +.elfinder-edit-onlineconvert-button { + display: inline-block; + width: 180px; + min-height: 30px; + vertical-align: top; +} +.elfinder-edit-onlineconvert-button button, +.elfinder-edit-onlineconvert-bottom-btn button { + cursor: pointer; +} +.elfinder-edit-onlineconvert-bottom-btn button.elfinder-button-ios-multiline { + -webkit-appearance: none; + border-radius: 16px; + color: #000; + text-align: center; + padding: 8px; + background-color: #eee; + background-image: -webkit-linear-gradient(top, hsl(0,0%,98%) 0%,hsl(0,0%,77%) 100%); + background-image: linear-gradient(to bottom, hsl(0,0%,98%) 0%,hsl(0,0%,77%) 100%); +} +.elfinder-edit-onlineconvert-button .elfinder-button-icon { + margin: 0 10px; + vertical-align: middle; + cursor: pointer; +} +.elfinder-edit-onlineconvert-bottom-btn { + text-align: center; + margin: 10px 0 0; +} + +.elfinder-edit-onlineconvert-link { + margin-top: 1em; + text-align: center; +} +.elfinder-edit-onlineconvert-link .elfinder-button-icon { + background-image: url("../img/editor-icons.png"); + background-repeat: no-repeat; + background-position: 0 -144px; + margin-bottom: -3px; +} +.elfinder-edit-onlineconvert-link a { + text-decoration: none; +} + +/********************** COMMAND "SORT" ****************************/ +/* for list table header sort triangle icon */ +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: 4px; + left: 0; + right: 0; + margin: auto 0px 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 0px; +} + +/********************** COMMAND "HELP" ****************************/ +/* help dialog */ +.elfinder-help { + margin-bottom: .5em; + -webkit-overflow-scrolling: touch; +} + +/* fix tabs */ +.elfinder-help .ui-tabs-panel { + padding: .5em; + overflow: auto; + padding: 10px; +} + +.elfinder-dialog .ui-tabs .ui-tabs-nav li { + overflow: hidden; +} + +.elfinder-dialog .ui-tabs .ui-tabs-nav li a { + padding: .2em .8em; + display: inline-block; +} + +.elfinder-touch .elfinder-dialog .ui-tabs .ui-tabs-nav li a { + padding: .5em .5em; +} + +.elfinder-dialog .ui-tabs-active a { + background: inherit; +} + +.elfinder-help-shortcuts { + height: auto; + padding: 10px; + margin: 0; + box-sizing: border-box; +} + +.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 0; +} + +.elfinder-help-separator { + clear: both; + padding: .5em; +} + +.elfinder-help-link { + display: inline-block; + margin-right: 12px; + padding: 2px 0; + white-space: nowrap; +} + +.elfinder-rtl .elfinder-help-link { + margin-right: 0; + margin-left: 12px; +} + +.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: bold; + 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: bold; + text-align: center; + color: #fff; + position: absolute; + left: 0; + top: 45px; +} + +ul.elfinder-help-integrations ul { + margin-bottom: 1em; + padding: 0; + margin: 0 1em 1em; +} + +ul.elfinder-help-integrations a { + text-decoration: none; +} + +ul.elfinder-help-integrations a:hover { + text-decoration: underline; +} + +.elfinder-help-debug { + height: 100%; + padding: 0; + margin: 0; + overflow: none; + border: none; +} + +.elfinder-help-debug .ui-tabs-panel { + padding: 0; + margin: 0; + overflow: auto; +} + +.elfinder-help-debug fieldset { + margin-bottom: 10px; + border-color: #778899; + border-radius: 10px; +} + +.elfinder-help-debug legend { + font-size: 1.2em; + font-weight: bold; + color: #2e8b57; +} + +.elfinder-help-debug dl { + margin: 0; +} + +.elfinder-help-debug dt { + color: #778899; +} + +.elfinder-help-debug dt:before { + content: "["; +} + +.elfinder-help-debug dt:after { + content: "]"; +} + +.elfinder-help-debug dd { + margin-left: 1em; +} + +.elfinder-help-debug dd span { + /*font-size: 1.2em;*/ +} + +/********************** COMMAND "PREFERENCE" ****************************/ +.elfinder-dialog .elfinder-preference .ui-tabs-nav { + margin-bottom: 1px; + height: auto; +} + +/* fix tabs */ +.elfinder-preference .ui-tabs-panel { + padding: 10px 10px 0; + overflow: auto; + box-sizing: border-box; + -webkit-overflow-scrolling: touch; +} + +.elfinder-preference a.ui-state-hover, +.elfinder-preference label.ui-state-hover { + border: none; +} + +.elfinder-preference dl { + width: 100%; + display: inline-block; + margin: .5em 0; +} + +.elfinder-preference dt { + display: block; + width: 200px; + clear: left; + float: left; + max-width: 50%; +} + +.elfinder-rtl .elfinder-preference dt { + clear: right; + float: right; +} + +.elfinder-preference dd { + margin-bottom: 1em; +} + +.elfinder-preference dt label { + cursor: pointer; +} + +.elfinder-preference dd label, +.elfinder-preference dd input[type=checkbox] { + white-space: nowrap; + display: inline-block; + cursor: pointer; +} + +.elfinder-preference dt.elfinder-preference-checkboxes { + width: 100%; + max-width: none; +} + +.elfinder-preference dd.elfinder-preference-checkboxes { + padding-top: 3ex; +} + +.elfinder-preference select { + max-width: 100%; +} + +.elfinder-preference dd.elfinder-preference-iconSize .ui-slider { + width: 50%; + max-width: 100px; + display: inline-block; + margin: 0 10px; +} + +.elfinder-preference button { + margin: 0 16px; +} + +.elfinder-preference button + button { + margin: 0 -10px; +} + +.elfinder-preference .elfinder-preference-taball .elfinder-reference-hide-taball { + display: none; +} + +.elfinder-preference-theme fieldset { + margin-bottom: 10px; +} + +.elfinder-preference-theme legend a { + font-size: 1.8em; + text-decoration: none; + cursor: pointer; +} + +.elfinder-preference-theme dt { + width: 20%; + word-break: break-all; +} + +.elfinder-preference-theme dt:after { + content: " :"; +} + +.elfinder-preference-theme dd { + margin-inline-start: 20%; +} + +.elfinder-preference img.elfinder-preference-theme-image { + display: block; + margin-left: auto; + margin-right: auto; + max-width: 90%; + max-height: 200px; + cursor: pointer; +} + +.elfinder-preference-theme-btn { + text-align: center; +} + +.elfinder-preference-theme button.elfinder-preference-theme-default { + display: inline; + margin: 0 10px; + font-size: 8pt; +} + +/********************** COMMAND "INFO" ****************************/ +.elfinder-rtl .elfinder-info-title .elfinder-cwd-icon:before { + right: 33px; + left: auto; +} + +.elfinder-info-title .elfinder-cwd-icon.elfinder-cwd-bgurl:after { + content: none; +} + +/********************** COMMAND "UPLOAD" ****************************/ +.elfinder-upload-dialog-wrapper .elfinder-upload-dirselect { + position: absolute; + bottom: 2px; + width: 16px; + height: 16px; + padding: 10px; + border: none; + overflow: hidden; + cursor: pointer; +} + +.elfinder-ltr .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect { + left: 2px; +} + +.elfinder-rtl .elfinder-upload-dialog-wrapper .elfinder-upload-dirselect { + right: 2px; +} + +/********************** COMMAND "RM" ****************************/ +.elfinder-ltr .elfinder-rm-title .elfinder-cwd-icon:before { + left: 38px; +} + +.elfinder-rtl .elfinder-rm-title .elfinder-cwd-icon:before { + right: 86px; + left: auto; +} + +.elfinder-rm-title .elfinder-cwd-icon.elfinder-cwd-bgurl:after { + content: none; +} + +/********************** COMMAND "RENAME" ****************************/ +.elfinder-rename-batch div { + margin: 5px 8px; +} + +.elfinder-rename-batch .elfinder-rename-batch-name input { + width: 100%; + font-size: 1.6em; +} + +.elfinder-rename-batch-type { + text-align: center; +} + +.elfinder-rename-batch .elfinder-rename-batch-type label { + margin: 2px; + font-size: .9em; +} + +.elfinder-rename-batch-preview { + padding: 0 8px; + font-size: 1.1em; + min-height: 4ex; +} + + +/* File: /css/common.css */ +/*********************************************/ +/* COMMON ELFINDER STUFFS */ +/*********************************************/ + +/* for old jQuery UI */ +.ui-front { + z-index: 100; +} + +/* style reset */ +div.elfinder *, +div.elfinder :after, +div.elfinder :before { + box-sizing: content-box; +} + +div.elfinder fieldset { + display: block; + margin-inline-start: 2px; + margin-inline-end: 2px; + padding-block-start: 0.35em; + padding-inline-start: 0.75em; + padding-inline-end: 0.75em; + padding-block-end: 0.625em; + min-inline-size: min-content; + border-width: 2px; + border-style: groove; + border-color: threedface; + border-image: initial; +} + +div.elfinder legend { + display: block; + padding-inline-start: 2px; + padding-inline-end: 2px; + border-width: initial; + border-style: none; + border-color: initial; + border-image: initial; + width: auto; + margin-bottom: 0; +} + +/* base container */ +div.elfinder { + padding: 0; + position: relative; + display: block; + visibility: visible; + font-size: 18px; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +/* prevent auto zoom on iOS */ +.elfinder-ios input, +.elfinder-ios select, +.elfinder-ios textarea { + font-size: 16px !important; +} + +/* full screen mode */ +.elfinder.elfinder-fullscreen > .ui-resizable-handle { + display: none; +} + +.elfinder-font-mono { + line-height: 2ex; +} + +/* in lazy execution status */ +.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; +} + +/* for disable select of Touch devices */ +.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-touch-callout:none;*/ + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; +} + +.elfinder .overflow-scrolling-touch { + -webkit-overflow-scrolling: touch; +} + +/* right to left enviroment */ +.elfinder-rtl { + text-align: right; + direction: rtl; +} + +/* nav and cwd container */ +.elfinder-workzone { + padding: 0; + position: relative; + overflow: hidden; +} + +/* dir/file permissions and symlink markers */ +.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-symlink { +} + +/* noaccess */ +.elfinder-na .elfinder-perms { + background-position: 0 -96px; +} + +/* read only */ +.elfinder-ro .elfinder-perms { + background-position: 0 -64px; +} + +/* write only */ +.elfinder-wo .elfinder-perms { + background-position: 0 -80px; +} + +/* volume type group */ +.elfinder-group .elfinder-perms { + background-position: 0 0px; +} + +/* locked */ +.elfinder-lock { + background-position: 0 -656px; +} + +/* drag helper */ +.elfinder-drag-helper { + top: 0px; + left: 0px; + 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; +} + +/* drag helper status icon (default no-drop) */ +.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; +} + +/* show "up-arrow" icon for move item */ +.elfinder-drag-helper-move .elfinder-drag-helper-icon-status { + background-position: 0 -720px; +} + +/* show "plus" icon when ctrl/shift pressed */ +.elfinder-drag-helper-plus .elfinder-drag-helper-icon-status { + background-position: 0 -544px; +} + +/* files num in drag helper */ +.elfinder-drag-num { + display: inline-box; + position: absolute; + top: 0; + left: 0; + width: auto; + height: 14px; + text-align: center; + padding: 1px 3px 1px 3px; + + font-weight: bold; + color: #fff; + background-color: red; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; +} + +/* icon in drag helper */ +.elfinder-drag-helper .elfinder-cwd-icon { + margin: 0 0 0 -24px; + float: left; +} + +/* transparent overlay */ +.elfinder-overlay { + position: absolute; + opacity: .2; + filter: Alpha(Opacity=20); +} + +/* panels under/below cwd (for search field etc) */ +.elfinder .elfinder-panel { + position: relative; + background-image: none; + padding: 7px 12px; +} + +/* for html5 drag and drop */ +[draggable=true] { + -khtml-user-drag: element; +} + +/* for place holder to content editable elements */ +.elfinder [contentEditable=true]:empty:not(:focus):before { + content: attr(data-ph); +} + +/* bottom tray */ +.elfinder div.elfinder-bottomtray { + position: fixed; + bottom: 0; + max-width: 100%; + opacity: .8; +} + +.elfinder div.elfinder-bottomtray > div { + top: initial; + right: initial; + left: initial; +} + +.elfinder.elfinder-ltr div.elfinder-bottomtray { + left: 0; +} + +.elfinder.elfinder-rtl div.elfinder-bottomtray { + right: 0; +} + +/* tooltip */ +.elfinder-ui-tooltip, +.elfinder .elfinder-ui-tooltip { + font-size: 14px; + padding: 2px 4px; +} + +/* progressbar */ +.elfinder-ui-progressbar { + pointer-events: none; + position: absolute; + width: 0; + height: 2px; + top: 0px; + border-radius: 2px; + filter: blur(1px); +} + +.elfinder-ltr .elfinder-ui-progressbar { + left: 0; +} + +.elfinder-rtl .elfinder-ui-progressbar { + right: 0; +} +/* File: /css/contextmenu.css */ +/* menu and submenu */ +.elfinder .elfinder-contextmenu, +.elfinder .elfinder-contextmenu-sub { + position: absolute; + border: 1px solid #aaa; + background: #fff; + color: #555; + padding: 4px 0; + top: 0; + left: 0; +} + +/* submenu */ +.elfinder .elfinder-contextmenu-sub { + top: 5px; +} + +/* submenu in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-sub { + margin-left: -5px; +} + +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub { + margin-right: -5px; +} + +/* menu item */ +.elfinder .elfinder-contextmenu-header { + margin-top: -4px; + padding: 0 .5em .2ex; + border: none; + text-align: center; +} + +.elfinder .elfinder-contextmenu-header span { + font-weight: normal; + font-size: 0.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 .elfinder-contextmenu-ltr .elfinder-contextmenu-item .ui-icon { + left: 2px; +} + +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-item .ui-icon { + right: 2px; +} + +.elfinder-touch .elfinder-contextmenu-item { + padding: 12px 38px; +} + +/* root icon of each volume */ +.elfinder-navbar-root-local.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_local.svg"); + background-size: contain; +} + +.elfinder-navbar-root-trash.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_trash.svg"); + background-size: contain; +} + +.elfinder-navbar-root-ftp.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_ftp.svg"); + background-size: contain; +} + +.elfinder-navbar-root-sql.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_sql.svg"); + background-size: contain; +} + +.elfinder-navbar-root-dropbox.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_dropbox.svg"); + background-size: contain; +} + +.elfinder-navbar-root-googledrive.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_googledrive.svg"); + background-size: contain; +} + +.elfinder-navbar-root-onedrive.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_onedrive.svg"); + background-size: contain; +} + +.elfinder-navbar-root-box.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_box.svg"); + background-size: contain; +} + +.elfinder-navbar-root-zip.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_zip.svg"); + background-size: contain; +} + +.elfinder-navbar-root-network.elfinder-contextmenu-icon { + background-image: url("../img/volume_icon_network.svg"); + background-size: contain; +} + +/* text in item */ +.elfinder .elfinder-contextmenu .elfinder-contextmenu-item span { + display: block; +} + +/* submenu item in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-sub .elfinder-contextmenu-item { + padding-left: 12px; + padding-right: 12px; +} + +.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-contextsubmenu-item-icon { + padding-left: 28px; +} + +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon { + padding-right: 28px; +} + +.elfinder-touch .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon { + padding-left: 36px; +} + +.elfinder-touch .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon { + padding-right: 36px; +} + +/* command/submenu icon */ +.elfinder .elfinder-contextmenu-extra-icon, +.elfinder .elfinder-contextmenu-arrow, +.elfinder .elfinder-contextmenu-icon { + position: absolute; + top: 50%; + margin-top: -8px; + overflow: hidden; +} + +.elfinder-touch .elfinder-button-icon.elfinder-contextmenu-icon { + transform-origin: center center; +} + +/* command icon in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-icon { + left: 8px; +} + +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-icon { + right: 8px; +} + +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-extra-icon { + right: 8px; +} + +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-extra-icon { + left: 8px; +} + +/* arrow icon */ +.elfinder .elfinder-contextmenu-arrow { + width: 16px; + height: 16px; + background: url('../img/arrows-normal.png') 5px 4px no-repeat; +} + +/* arrow icon in rtl/ltr enviroment */ +.elfinder .elfinder-contextmenu-ltr .elfinder-contextmenu-arrow { + right: 5px; +} + +.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-arrow { + left: 5px; + background-position: 0 -10px; +} + +/* command extra icon's , tag */ +.elfinder .elfinder-contextmenu-extra-icon a, +.elfinder .elfinder-contextmenu-extra-icon span { + position: relative; + width: 100%; + height: 100%; + margin: 0; + color: transparent !important; + text-decoration: none; + cursor: pointer; +} + +/* disable ui border/bg image on hover */ +.elfinder .elfinder-contextmenu .ui-state-hover { + border: 0 solid; + background-image: none; +} + +/* separator */ +.elfinder .elfinder-contextmenu-separator { + height: 0px; + border-top: 1px solid #ccc; + margin: 0 1px; +} + +/* for CSS style priority to ui-state-disabled - "background-image: none" */ +.elfinder .elfinder-contextmenu-item .elfinder-button-icon.ui-state-disabled { + background-image: url('../img/toolbar.png'); +} + +/* File: /css/cwd.css */ +/******************************************************************/ +/* CURRENT DIRECTORY STYLES */ +/******************************************************************/ +/* cwd container to avoid selectable on scrollbar */ +.elfinder-cwd-wrapper { + overflow: auto; + position: relative; + padding: 2px; + margin: 0; +} + +.elfinder-cwd-wrapper-list { + padding: 0; +} + +/* container */ +.elfinder-cwd { + position: absolute; + top: 0; + cursor: default; + padding: 0; + margin: 0; + -ms-touch-action: auto; + touch-action: auto; + min-width: 100%; +} + +.elfinder-ltr .elfinder-cwd { + left: 0; +} + +.elfinder-rtl .elfinder-cwd { + right: 0; +} + +.elfinder-cwd.elfinder-table-header-sticky { + position: -webkit-sticky; + position: -ms-sticky; + position: sticky; + top: 0; + left: auto; + right: auto; + width: -webkit-max-content; + width: -moz-max-content; + width: -ms-max-content; + width: max-content; + height: 0; + overflow: visible; +} + +.elfinder-cwd.elfinder-table-header-sticky table { + border-top: 2px solid; + padding-top: 0; +} + +.elfinder-cwd.elfinder-table-header-sticky td { + display: inline-block; +} + +.elfinder-droppable-active .elfinder-cwd.elfinder-table-header-sticky table { + border-top: 2px solid transparent; +} + +/* fixed table header container */ +.elfinder-cwd-fixheader .elfinder-cwd { + position: relative; +} + +/* container active on dropenter */ +.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; + height: auto; + width: 90%; + width: calc(100% - 20px); + position: absolute; + top: 50%; + left: 50%; + -ms-transform: translateY(-50%) translateX(-50%); + -webkit-transform: translateY(-50%) translateX(-50%); + transform: translateY(-50%) translateX(-50%); + line-height: 1.5em; + text-align: center; + white-space: pre-wrap; + opacity: 0.6; + filter: Alpha(Opacity=60); + font-weight: bold; +} + +.elfinder-cwd-file .elfinder-cwd-select { + position: absolute; + top: 0px; + left: 0px; + background-color: transparent; + opacity: .4; + filter: Alpha(Opacity=40); +} + +.elfinder-mobile .elfinder-cwd-file .elfinder-cwd-select { + width: 30px; + height: 30px; +} + +.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: 0px; +} + +.elfinder .elfinder-cwd-selectall { + position: absolute; + width: 30px; + height: 30px; + top: 0px; + opacity: .8; + filter: Alpha(Opacity=80); +} + +.elfinder .elfinder-workzone.elfinder-cwd-wrapper-empty .elfinder-cwd-selectall { + display: none; +} + +/************************** ICONS VIEW ********************************/ + +.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: 0px; +} + +.elfinder-rtl.elfinder-mobile .elfinder-workzone .elfinder-cwd-selectall { + left: 0px; +} + +.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-select.ui-state-hover { + background-color: transparent; +} + +/* file container */ +.elfinder-cwd-view-icons .elfinder-cwd-file { + width: 120px; + height: 90px; + padding-bottom: 2px; + cursor: default; + border: none; + position: relative; +} + +.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-active { + border: none; +} + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file { + float: left; + margin: 0 3px 2px 0; +} + +.elfinder-rtl .elfinder-cwd-view-icons .elfinder-cwd-file { + float: right; + margin: 0 0 5px 3px; +} + +/* remove ui hover class border */ +.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover { + border: 0 solid; +} + +/* icon wrapper to create selected highlight around icon */ +.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper { + width: 52px; + height: 52px; + margin: 1px auto 1px auto; + padding: 2px; + position: relative; +} + +/*** Custom Icon Size size1 - size3 ***/ +/* type badge */ +.elfinder-cwd-size1 .elfinder-cwd-icon:before, +.elfinder-cwd-size2 .elfinder-cwd-icon:before, +.elfinder-cwd-size3 .elfinder-cwd-icon:before { + top: 3px; + display: block; +} + +/* size1 */ +.elfinder-cwd-size1.elfinder-cwd-view-icons .elfinder-cwd-file { + width: 120px; + height: 112px; +} + +.elfinder-cwd-size1.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper { + width: 74px; + height: 74px; +} + +.elfinder-cwd-size1 .elfinder-cwd-icon { + -ms-transform-origin: top center; + -ms-transform: scale(1.5); + -webkit-transform-origin: top center; + -webkit-transform: scale(1.5); + transform-origin: top center; + transform: scale(1.5); +} + +.elfinder-cwd-size1 .elfinder-cwd-icon.elfinder-cwd-bgurl:before { + -ms-transform-origin: top left; + -ms-transform: scale(1.35) translate(-4px, 15%); + -webkit-transform-origin: top left; + -webkit-transform: scale(1.35) translate(-4px, 15%); + transform-origin: top left; + transform: scale(1.35) translate(-4px, 15%); +} + +.elfinder-cwd-size1 .elfinder-cwd-icon.elfinder-cwd-bgurl:after { + -ms-transform: scale(1) translate(10px, -5px); + -webkit-transform: scale(1) translate(10px, -5px); + transform: scale(1) translate(10px, -5px); +} + +.elfinder-cwd-size1 .elfinder-cwd-icon.elfinder-cwd-bgurl { + -ms-transform-origin: center center; + -ms-transform: scale(1); + -webkit-transform-origin: center center; + -webkit-transform: scale(1); + transform-origin: center center; + transform: scale(1); + width: 72px; + height: 72px; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; +} + +/* size2 */ +.elfinder-cwd-size2.elfinder-cwd-view-icons .elfinder-cwd-file { + width: 140px; + height: 134px; +} + +.elfinder-cwd-size2.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper { + width: 98px; + height: 98px; +} + +.elfinder-cwd-size2 .elfinder-cwd-icon { + -ms-transform-origin: top center; + -ms-transform: scale(2); + -webkit-transform-origin: top center; + -webkit-transform: scale(2); + transform-origin: top center; + transform: scale(2); +} + +.elfinder-cwd-size2 .elfinder-cwd-icon.elfinder-cwd-bgurl:before { + -ms-transform-origin: top left; + -ms-transform: scale(1.8) translate(-5px, 18%); + -webkit-transform-origin: top left; + -webkit-transform: scale(1.8) translate(-5px, 18%); + transform-origin: top left; + transform: scale(1.8) translate(-5px, 18%); +} + +.elfinder-cwd-size2 .elfinder-cwd-icon.elfinder-cwd-bgurl:after { + -ms-transform: scale(1.1) translate(0px, 10px); + -webkit-transform: scale(1.1) translate(0px, 10px); + transform: scale(1.1) translate(0px, 10px); +} + +.elfinder-cwd-size2 .elfinder-cwd-icon.elfinder-cwd-bgurl { + -ms-transform-origin: center center; + -ms-transform: scale(1); + -webkit-transform-origin: center center; + -webkit-transform: scale(1); + transform-origin: center center; + transform: scale(1); + width: 96px; + height: 96px; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; +} + +/* size3 */ +.elfinder-cwd-size3.elfinder-cwd-view-icons .elfinder-cwd-file { + width: 174px; + height: 158px; +} + +.elfinder-cwd-size3.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper { + width: 122px; + height: 122px; +} + +.elfinder-cwd-size3 .elfinder-cwd-icon { + -ms-transform-origin: top center; + -ms-transform: scale(2.5); + -webkit-transform-origin: top center; + -webkit-transform: scale(2.5); + transform-origin: top center; + transform: scale(2.5); +} + +.elfinder-cwd-size3 .elfinder-cwd-icon.elfinder-cwd-bgurl:before { + -ms-transform-origin: top left; + -ms-transform: scale(2.25) translate(-6px, 20%); + -webkit-transform-origin: top left; + -webkit-transform: scale(2.25) translate(-6px, 20%); + transform-origin: top left; + transform: scale(2.25) translate(-6px, 20%); +} + +.elfinder-cwd-size3 .elfinder-cwd-icon.elfinder-cwd-bgurl:after { + -ms-transform: scale(1.2) translate(-9px, 22px); + -webkit-transform: scale(1.2) translate(-9px, 22px); + transform: scale(1.2) translate(-9px, 22px); +} + +.elfinder-cwd-size3 .elfinder-cwd-icon.elfinder-cwd-bgurl { + -ms-transform-origin: center center; + -ms-transform: scale(1); + -webkit-transform-origin: center center; + -webkit-transform: scale(1); + transform-origin: center center; + transform: scale(1); + width: 120px; + height: 120px; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +/* file name place */ +.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 1px; + padding: 1px; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; + /* for webkit CSS3 */ + word-break: break-word; + overflow-wrap: break-word; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +/* permissions/symlink markers */ +.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: 0px; +} + +/* icon/thumbnail */ +.elfinder-cwd-icon { + display: block; + width: 48px; + height: 48px; + margin: 0 auto; + background-image: url('../img/icons-big.svg'); + background-image: url('../img/icons-big.png') \9; + background-position: 0 0; + background-repeat: no-repeat; + -moz-background-clip: padding; + -webkit-background-clip: padding-box; + background-clip: padding-box; +} + +/* volume icon of root in folder */ +.elfinder-navbar-root-local .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-local td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_local.svg"); + background-image: url("../img/volume_icon_local.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon { + background-position: 1px -1px; +} + +.elfinder-navbar-root-trash .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-trash.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-trash td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_trash.svg"); + background-image: url("../img/volume_icon_trash.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-cwd .elfinder-navbar-root-trash.elfinder-droppable-active .elfinder-cwd-icon { + background-position: 1px -1px; +} + +.elfinder-navbar-root-ftp .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-ftp td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_ftp.svg"); + background-image: url("../img/volume_icon_ftp.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon { + background-position: 1px -1px; +} + +.elfinder-navbar-root-sql .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-sql td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_sql.svg"); + background-image: url("../img/volume_icon_sql.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon { + background-position: 1px -1px; +} + +.elfinder-navbar-root-dropbox .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-dropbox td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_dropbox.svg"); + background-image: url("../img/volume_icon_dropbox.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon { + background-position: 1px -1px; +} + +.elfinder-navbar-root-googledrive .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-googledrive td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_googledrive.svg"); + background-image: url("../img/volume_icon_googledrive.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-navbar-root-onedrive .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-onedrive td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_onedrive.svg"); + background-image: url("../img/volume_icon_onedrive.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-navbar-root-box .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-box td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_box.svg"); + background-image: url("../img/volume_icon_box.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-navbar-root-zip .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-zip.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-zip td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_zip.svg"); + background-image: url("../img/volume_icon_zip.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon { + background-position: 1px -1px; +} + +.elfinder-navbar-root-network .elfinder-cwd-icon, +.elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon, +.elfinder-cwd-view-list .elfinder-navbar-root-network td .elfinder-cwd-icon { + background-image: url("../img/volume_icon_network.svg"); + background-image: url("../img/volume_icon_network.png") \9; + background-position: 0 0; + background-size: contain; +} + +.elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon { + background-position: 1px -1px; +} + +/* type badge in "icons" view */ +.elfinder-cwd-icon:before { + content: none; + position: absolute; + left: 0px; + top: 5px; + min-width: 20px; + max-width: 84px; + text-align: center; + padding: 0px 4px 1px; + border-radius: 4px; + font-family: Verdana; + font-size: 10px; + line-height: 1.3em; + -webkit-transform: scale(0.9); + -moz-transform: scale(0.9); + -ms-transform: scale(0.9); + -o-transform: scale(0.9); + transform: scale(0.9); +} + +.elfinder-cwd-view-icons .elfinder-cwd-icon.elfinder-cwd-bgurl:before { + left: -10px; +} + +/* addtional type badge name */ +.elfinder-cwd-icon.elfinder-cwd-icon-mp2t:before { + content: 'ts' +} + +.elfinder-cwd-icon.elfinder-cwd-icon-dash-xml:before { + content: 'dash' +} + +.elfinder-cwd-icon.elfinder-cwd-icon-x-mpegurl:before { + content: 'hls' +} + +.elfinder-cwd-icon.elfinder-cwd-icon-x-c:before { + content: 'c++' +} + +/* thumbnail image */ +.elfinder-cwd-icon.elfinder-cwd-bgurl { + background-position: center center; + background-repeat: no-repeat; + -moz-background-size: contain; + background-size: contain; +} + +/* thumbnail self */ +.elfinder-cwd-icon.elfinder-cwd-bgurl.elfinder-cwd-bgself { + -moz-background-size: cover; + background-size: cover; +} + +/* thumbnail crop*/ +.elfinder-cwd-icon.elfinder-cwd-bgurl { + -moz-background-size: cover; + background-size: cover; +} + +.elfinder-cwd-icon.elfinder-cwd-bgurl:after { + content: ' '; +} + +.elfinder-cwd-bgurl:after { + position: relative; + display: inline-block; + top: 36px; + left: -38px; + width: 48px; + height: 48px; + background-image: url('../img/icons-big.svg'); + background-image: url('../img/icons-big.png') \9; + background-repeat: 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); +} + +/* thumbnail image and draging icon */ +.elfinder-cwd-icon.elfinder-cwd-icon-drag { + width: 48px; + height: 48px; +} + +/* thumbnail image and draging icon overlay none */ +.elfinder-cwd-icon.elfinder-cwd-icon-drag:before, +.elfinder-cwd-icon.elfinder-cwd-icon-drag:after, +.elfinder-cwd-icon-image.elfinder-cwd-bgurl:after, +.elfinder-cwd-icon-directory.elfinder-cwd-bgurl:after { + content: none; +} + +/* "opened folder" icon on dragover */ +.elfinder-cwd .elfinder-droppable-active .elfinder-cwd-icon { + background-position: 0 -100px; +} + +.elfinder-cwd .elfinder-droppable-active { + outline: 2px solid #8cafed; + outline-offset: -2px; +} + +/* mimetypes icons */ +.elfinder-cwd-icon-directory { + background-position: 0 -50px; +} + +.elfinder-cwd-icon-application:after, +.elfinder-cwd-icon-application { + background-position: 0 -150px; +} + +.elfinder-cwd-icon-text:after, +.elfinder-cwd-icon-text { + background-position: 0 -1350px; +} + +.elfinder-cwd-icon-plain:after, +.elfinder-cwd-icon-plain, +.elfinder-cwd-icon-x-empty:after, +.elfinder-cwd-icon-x-empty { + background-position: 0 -200px; +} + +.elfinder-cwd-icon-image:after, +.elfinder-cwd-icon-vnd-adobe-photoshop:after, +.elfinder-cwd-icon-image, +.elfinder-cwd-icon-vnd-adobe-photoshop { + background-position: 0 -250px; +} + +.elfinder-cwd-icon-postscript:after, +.elfinder-cwd-icon-postscript { + background-position: 0 -1550px; +} + +.elfinder-cwd-icon-audio:after, +.elfinder-cwd-icon-audio { + background-position: 0 -300px; +} + +.elfinder-cwd-icon-video:after, +.elfinder-cwd-icon-video, +.elfinder-cwd-icon-flash-video, +.elfinder-cwd-icon-dash-xml, +.elfinder-cwd-icon-vnd-apple-mpegurl, +.elfinder-cwd-icon-x-mpegurl { + background-position: 0 -350px; +} + +.elfinder-cwd-icon-rtf:after, +.elfinder-cwd-icon-rtfd:after, +.elfinder-cwd-icon-rtf, +.elfinder-cwd-icon-rtfd { + background-position: 0 -400px; +} + +.elfinder-cwd-icon-pdf:after, +.elfinder-cwd-icon-pdf { + background-position: 0 -450px; +} + +.elfinder-cwd-icon-ms-excel, +.elfinder-cwd-icon-ms-excel: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-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 { + background-position: 0 -1450px +} + +.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 { + background-position: 0 -1700px +} + +.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-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 { + background-position: 0 -1400px +} + +.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 { + background-position: 0 -1650px +} + +.elfinder-cwd-icon-msword, +.elfinder-cwd-icon-msword: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-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 -1500px +} + +.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 { + background-position: 0 -1750px +} + +.elfinder-cwd-icon-vnd-ms-office, +.elfinder-cwd-icon-vnd-ms-office:after { + background-position: 0 -500px +} + +.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-openofficeorg-extension, +.elfinder-cwd-icon-vnd-openofficeorg-extension:after { + background-position: 0 -1600px +} + +.elfinder-cwd-icon-html:after, +.elfinder-cwd-icon-html { + background-position: 0 -550px; +} + +.elfinder-cwd-icon-css:after, +.elfinder-cwd-icon-css { + background-position: 0 -600px; +} + +.elfinder-cwd-icon-javascript:after, +.elfinder-cwd-icon-x-javascript:after, +.elfinder-cwd-icon-javascript, +.elfinder-cwd-icon-x-javascript { + background-position: 0 -650px; +} + +.elfinder-cwd-icon-x-perl:after, +.elfinder-cwd-icon-x-perl { + background-position: 0 -700px; +} + +.elfinder-cwd-icon-x-python:after, +.elfinder-cwd-icon-x-python { + background-position: 0 -750px; +} + +.elfinder-cwd-icon-x-ruby:after, +.elfinder-cwd-icon-x-ruby { + background-position: 0 -800px; +} + +.elfinder-cwd-icon-x-sh:after, +.elfinder-cwd-icon-x-shellscript:after, +.elfinder-cwd-icon-x-sh, +.elfinder-cwd-icon-x-shellscript { + background-position: 0 -850px; +} + +.elfinder-cwd-icon-x-c:after, +.elfinder-cwd-icon-x-csrc:after, +.elfinder-cwd-icon-x-chdr:after, +.elfinder-cwd-icon-x-c--:after, +.elfinder-cwd-icon-x-c--src:after, +.elfinder-cwd-icon-x-c--hdr:after, +.elfinder-cwd-icon-x-java:after, +.elfinder-cwd-icon-x-java-source:after, +.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:after, +.elfinder-cwd-icon-x-php { + background-position: 0 -950px; +} + +.elfinder-cwd-icon-xml:after, +.elfinder-cwd-icon-xml { + background-position: 0 -1000px; +} + +.elfinder-cwd-icon-zip:after, +.elfinder-cwd-icon-x-zip:after, +.elfinder-cwd-icon-x-xz:after, +.elfinder-cwd-icon-x-7z-compressed:after, +.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:after, +.elfinder-cwd-icon-x-tar:after, +.elfinder-cwd-icon-x-gzip, +.elfinder-cwd-icon-x-tar { + background-position: 0 -1100px; +} + +.elfinder-cwd-icon-x-bzip:after, +.elfinder-cwd-icon-x-bzip2:after, +.elfinder-cwd-icon-x-bzip, +.elfinder-cwd-icon-x-bzip2 { + background-position: 0 -1150px; +} + +.elfinder-cwd-icon-x-rar:after, +.elfinder-cwd-icon-x-rar-compressed:after, +.elfinder-cwd-icon-x-rar, +.elfinder-cwd-icon-x-rar-compressed { + background-position: 0 -1200px; +} + +.elfinder-cwd-icon-x-shockwave-flash:after, +.elfinder-cwd-icon-x-shockwave-flash { + background-position: 0 -1250px; +} + +.elfinder-cwd-icon-group { + background-position: 0 -1300px; +} + +/* textfield inside icon */ +.elfinder-cwd-filename input { + width: 100%; + border: none; + margin: 0; + padding: 0; +} + +.elfinder-cwd-view-icons input { + text-align: center; +} + +.elfinder-cwd-view-icons textarea { + width: 100%; + border: 0px solid; + margin: 0; + padding: 0; + text-align: center; + overflow: hidden; + resize: none; +} + +.elfinder-cwd-view-icons { + text-align: center; +} + +/************************************ LIST VIEW ************************************/ + +/*.elfinder-cwd-view-list { padding:0 0 4px 0; }*/ + +.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 0; + border-spacing: 0; + box-sizing: padding-box; + padding: 2px; + position: relative; +} + +.elfinder-cwd table td { + /* fix conflict with Bootstrap CSS */ + box-sizing: content-box; +} + +.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: white; +} + +.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 .elfinder-cwd table tbody.elfinder-cwd-fixheader { + position: relative; +} + +.elfinder-ltr .elfinder-cwd thead .elfinder-cwd-selectall { + text-align: left; + right: auto; + left: 0px; + padding-top: 3px; +} + +.elfinder-rtl .elfinder-cwd thead .elfinder-cwd-selectall { + text-align: right; + right: 0px; + left: auto; + padding-top: 3px; +} + +.elfinder-touch .elfinder-cwd thead .elfinder-cwd-selectall { + padding-top: 4px; +} + +.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-touch .elfinder-cwd table thead td, +.elfinder-touch .elfinder-cwd.elfinder-has-checkbox table thead td:first-child { + padding-top: 8px; + padding-bottom: 8px; +} + +.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: 0 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 { + padding-top: 3px; +} + +.elfinder-mobile tr.elfinder-cwd-file td .elfinder-cwd-select { + width: 40px; +} + +.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 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-rtl .elfinder-cwd table td:first-child { + text-align: right; +} + +.elfinder-odd-row { + background: #eee; +} + +/* filename container */ +.elfinder-cwd-view-list .elfinder-cwd-file-wrapper { + width: 97%; + position: relative; +} + +/* filename container in ltr/rtl enviroment */ +.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-cwd-view-list .elfinder-cwd-filename { + padding-top: 4px; + padding-bottom: 4px; + display: inline-block; +} + +.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-filename { + padding-left: 23px; +} + +.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-filename { + padding-right: 23px; +} + +/* premissions/symlink marker */ +.elfinder-cwd-view-list .elfinder-perms, +.elfinder-cwd-view-list .elfinder-lock, +.elfinder-cwd-view-list .elfinder-symlink { + margin-top: -6px; + opacity: .6; + filter: Alpha(Opacity=60); +} + +.elfinder-cwd-view-list .elfinder-perms { + bottom: -4px; +} + +.elfinder-cwd-view-list .elfinder-lock { + top: 0px; +} + +.elfinder-cwd-view-list .elfinder-symlink { + bottom: -4px; +} + +/* markers in ltr/rtl enviroment */ +.elfinder-ltr .elfinder-cwd-view-list .elfinder-perms { + left: 8px; +} + +.elfinder-rtl .elfinder-cwd-view-list .elfinder-perms { + right: -8px; +} + +.elfinder-ltr .elfinder-cwd-view-list .elfinder-lock { + left: 10px; +} + +.elfinder-rtl .elfinder-cwd-view-list .elfinder-lock { + right: -10px; +} + +.elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink { + left: -7px; +} + +.elfinder-rtl .elfinder-cwd-view-list .elfinder-symlink { + right: 7px; +} + +/* file icon */ +.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); +} + +/* icon in ltr/rtl enviroment */ +.elfinder-ltr .elfinder-cwd-view-list .elfinder-cwd-icon { + left: 0; +} + +.elfinder-rtl .elfinder-cwd-view-list .elfinder-cwd-icon { + right: 0; +} + +/* type badge, thumbnail image overlay */ +.elfinder-cwd-view-list .elfinder-cwd-icon:before, +.elfinder-cwd-view-list .elfinder-cwd-icon:after { + content: none; +} + +/* table header resize handle */ +.elfinder-cwd-view-list thead td .ui-resizable-handle { + height: 100%; + top: 6px; +} + +.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-handle { + top: -4px; + 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; +} + +/* empty message */ +.elfinder-cwd-wrapper-empty .elfinder-cwd-view-list.elfinder-cwd:after { + margin-top: 0; +} + +/* overlay message board */ +.elfinder-cwd-message-board { + position: absolute; + position: -webkit-sticky; + position: sticky; + width: 100%; + height: calc(100% - 0.01px); /* for Firefox scroll problem */ + top: 0; + left: 0; + margin: 0; + padding: 0; + pointer-events: none; + background-color: transparent; +} + +/* overlay message board for trash */ +.elfinder-cwd-wrapper-trash .elfinder-cwd-message-board { + background-image: url(../img/trashmesh.png); +} + +.elfinder-cwd-message-board .elfinder-cwd-trash { + position: absolute; + bottom: 0; + font-size: 30px; + width: 100%; + text-align: right; + display: none; +} + +.elfinder-rtl .elfinder-cwd-message-board .elfinder-cwd-trash { + text-align: left; +} + +.elfinder-mobile .elfinder-cwd-message-board .elfinder-cwd-trash { + font-size: 20px; +} + +.elfinder-cwd-wrapper-trash .elfinder-cwd-message-board .elfinder-cwd-trash { + display: block; + opacity: .3; +} + +/* overlay message board for expires */ +.elfinder-cwd-message-board .elfinder-cwd-expires { + position: absolute; + bottom: 0; + font-size: 24px; + width: 100%; + text-align: right; + opacity: .25; +} + +.elfinder-rtl .elfinder-cwd-message-board .elfinder-cwd-expires { + text-align: left; +} + +.elfinder-mobile .elfinder-cwd-message-board .elfinder-cwd-expires { + font-size: 20px; +} + +/* File: /css/dialog.css */ +/*********************************************/ +/* DIALOGS STYLES */ +/*********************************************/ + +/* common dialogs class */ +.std42-dialog { + padding: 0; + position: absolute; + left: auto; + right: auto; + box-sizing: border-box; +} + +.std42-dialog.elfinder-dialog-minimized { + overFlow: hidden; + position: relative; + float: left; + width: auto; + cursor: pointer; +} + +.elfinder-rtl .std42-dialog.elfinder-dialog-minimized { + float: right; +} + +.std42-dialog input { + border: 1px solid; +} + +/* titlebar */ +.std42-dialog .ui-dialog-titlebar { + border-left: 0 solid transparent; + border-top: 0 solid transparent; + border-right: 0 solid transparent; + font-weight: normal; + 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 1px; + background-color: transparent; + background-image: none; +} + +.elfinder-touch .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button { + -moz-transform: scale(1.2); + zoom: 1.2; + padding-left: 6px; + padding-right: 6px; + height: 24px; +} + +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button-right { + float: right; +} + +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right { + left: 10px; + right: -10px; +} + +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon { + width: 17px; + height: 17px; + border-width: 1px; + opacity: .7; + filter: Alpha(Opacity=70); + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; +} + +.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon { + opacity: .5; + filter: Alpha(Opacity=50); +} + +.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon { + opacity: 1; + filter: Alpha(Opacity=100); +} + +.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar select { + display: none; +} + +.elfinder-spinner { + width: 14px; + height: 14px; + background: url("../img/spinner-mini.gif") center center no-repeat; + margin: 0 5px; + display: inline-block; + vertical-align: middle; +} + +.elfinder-ltr .elfinder-spinner, +.elfinder-ltr .elfinder-spinner-text { + float: left; +} + +.elfinder-rtl .elfinder-spinner, +.elfinder-rtl .elfinder-spinner-text { + float: right; +} + + + +/* resize handle for touch devices */ +.elfinder-touch .std42-dialog.ui-dialog:not(ui-resizable-disabled) .ui-resizable-se { + width: 12px; + height: 12px; + -moz-transform-origin: bottom right; + -moz-transform: scale(1.5); + 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; +} + +/* content */ +.std42-dialog .ui-dialog-content { + padding: .3em .5em; +} + +.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; +} + +.elfinder .std42-dialog .ui-dialog-content label { + border: none; +} + +/* buttons */ +.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: .2em 0 0 .4em; + padding: .2em; + outline: 0px 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; +} + +.std42-dialog select { + border: 1px solid #ccc; +} + +/* error/notify/confirm dialogs icon */ +.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; +} + +/*********************** ERROR DIALOG **************************/ + +.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-error .elfinder-err-var { + word-break: break-all; +} + +/*********************** NOTIFY DIALOG **************************/ + +.elfinder-dialog-notify { + top : 36px; + width : 280px; +} + +.elfinder-ltr .elfinder-dialog-notify { + right : 12px; +} + +.elfinder-rtl .elfinder-dialog-notify { + left : 12px; +} + +.elfinder-dialog-notify .ui-dialog-titlebar { + height: 5px; + overflow: hidden; +} + +.elfinder.elfinder-touch > .elfinder-dialog-notify .ui-dialog-titlebar { + height: 10px; +} + +.elfinder > .elfinder-dialog-notify .ui-dialog-titlebar .elfinder-titlebar-button { + top: 2px; +} + +.elfinder.elfinder-touch > .elfinder-dialog-notify .ui-dialog-titlebar .elfinder-titlebar-button { + top: 4px; +} + +.elfinder > .elfinder-dialog-notify .ui-dialog-titlebar .elfinder-titlebar-button { + left: -18px; + right: 18px; +} + +.elfinder > .elfinder-dialog-notify .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right { + left: 18px; + right: -18px; +} + +.ui-dialog-titlebar .elfinder-ui-progressbar { + position: absolute; + top: 17px; +} + +.elfinder-touch .ui-dialog-titlebar .elfinder-ui-progressbar { + top: 26px; +} + +.elfinder-dialog-notify.elfinder-titlebar-button-hide .ui-dialog-titlebar-close { + display: none; +} + +.elfinder-dialog-notify.elfinder-dialog-minimized.elfinder-titlebar-button-hide .ui-dialog-titlebar span.elfinder-dialog-title { + max-width: initial; +} + +.elfinder-dialog-notify .ui-dialog-content { + padding: 0; +} + +/* one notification container */ +.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; +} + +/* progressbar */ +.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-notify-cancel { + position: relative; + top: -18px; + right: calc(-50% + 15px); +} + +.elfinder-notify-cancel .ui-icon-close { + background-position: -80px -128px; + width: 18px; + height: 18px; + border-radius: 9px; + border: none; + background-position: -80px -128px; + cursor: pointer; +} + +/* icons */ +.elfinder-dialog-icon-open, +.elfinder-dialog-icon-readdir, +.elfinder-dialog-icon-file { + background-position: 0 -225px; +} + +.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 { + background-position: 0 -160px; +} + +.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, +.elfinder-dialog-icon-chkcontent { + background-position: 0 -330px; +} + +.elfinder-dialog-icon-zipdl, +.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-url, +.elfinder-dialog-icon-dim { + background-position: 0 -434px; +} + +/*********************** CONFIRM DIALOG **************************/ + +.elfinder-dialog-confirm-applyall, +.elfinder-dialog-confirm-encoding { + padding: 0 1em; + margin: 0; +} + +.elfinder-ltr .elfinder-dialog-confirm-applyall, +.elfinder-ltr .elfinder-dialog-confirm-encoding { + text-align: left; +} + +.elfinder-rtl .elfinder-dialog-confirm-applyall, +.elfinder-rtl .elfinder-dialog-confirm-encoding { + text-align: right; +} + +.elfinder-dialog-confirm .elfinder-dialog-icon { + background-position: 0 -32px; +} + +.elfinder-dialog-confirm .ui-dialog-buttonset { + width: auto; +} + +/*********************** FILE INFO DIALOG **************************/ + +.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 0; +} + +.elfinder-info-tb { + min-width: 200px; + border: 0 solid; + margin: 1em .2em 1em .2em; + width: 100%; +} + +.elfinder-info-tb td { + white-space: pre-wrap; + padding: 2px; +} + +.elfinder-info-tb td.elfinder-info-label { + white-space: nowrap; +} + +.elfinder-info-tb td.elfinder-info-hash { + display: inline-block; + word-break: break-all; + max-width: 32ch; +} + +.elfinder-ltr .elfinder-info-tb tr td:first-child { + text-align: right; +} + +.elfinder-ltr .elfinder-info-tb span { + float: left; +} + +.elfinder-rtl .elfinder-info-tb tr td:first-child { + text-align: left; +} + +.elfinder-rtl .elfinder-info-tb span { + float: right; +} + +.elfinder-info-tb a { + outline: none; + text-decoration: underline; +} + +.elfinder-info-tb a:hover { + text-decoration: none; +} + +.elfinder-netmount-tb { + margin: 0 auto; +} + +.elfinder-netmount-tb select, +.elfinder-netmount-tb .elfinder-button-icon { + cursor: pointer; +} + +button.elfinder-info-button { + margin: -3.5px 0; + cursor: pointer; +} + +/*********************** UPLOAD DIALOG **************************/ + +.elfinder-upload-dropbox { + display: table-cell; + text-align: center; + vertical-align: middle; + padding: 0.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; + width: 100%; + opacity: 0; + filter: Alpha(Opacity=0); +} + +.elfinder-upload-dialog-wrapper .ui-button form input { + padding: 50px 0 0; + font-size: 3em; + width: 100%; +} + +/* dialog for elFinder itself */ +.dialogelfinder .dialogelfinder-drag { + border-left: 0 solid; + border-top: 0 solid; + border-right: 0 solid; + font-weight: normal; + 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; +} + +/*********************** RM CONFIRM **************************/ +.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; + /*word-wrap: break-word;*/ + white-space: pre-wrap; + word-break: normal; + overflow: hidden; + text-overflow: ellipsis; +} + +.elfinder-rm-title + br { + display: none; +} + +/* File: /css/fonts.css */ +.elfinder-font-mono { + font-family: "Ricty Diminished", "Myrica M", Consolas, "Courier New", Courier, Monaco, monospace; + font-size: 1.1em; +} + +.elfinder-contextmenu .elfinder-contextmenu-item span { + font-size: .72em; +} + +.elfinder-cwd-view-icons .elfinder-cwd-filename { + font-size: .7em; +} + +.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 { + font-size: 1.2em; +} + +.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; + font-weight: normal; +} + +.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-toast { + font-size: .76em; +} + + +/* File: /css/navbar.css */ +/*********************************************/ +/* NAVIGATION PANEL */ +/*********************************************/ + +/* container */ +.elfinder .elfinder-navbar { + /*box-sizing: border-box;*/ + width: 230px; + padding: 3px 5px; + background-image: none; + border-top: 0 solid; + border-bottom: 0 solid; + overflow: auto; + position: relative; +} + +.elfinder .elfinder-navdock { + box-sizing: border-box; + width: 230px; + height: auto; + position: absolute; + bottom: 0; + overflow: auto; +} + +.elfinder-navdock .ui-resizable-n { + top: 0; + height: 20px; +} + +/* ltr/rtl enviroment */ +.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; +} + +/* folders tree container */ +.elfinder-tree { + display: table; + width: 100%; + margin: 0 0 .5em 0; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +/* one folder wrapper */ +.elfinder-navbar-wrapper, .elfinder-place-wrapper { +} + +/* folder */ +.elfinder-navbar-dir { + position: relative; + display: block; + white-space: nowrap; + padding: 3px 12px; + margin: 0; + outline: 0px solid; + border: 1px solid transparent; + cursor: default; +} + +.elfinder-touch .elfinder-navbar-dir { + padding: 12px 12px; +} + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-dir { + padding-left: 35px; +} + +.elfinder-rtl .elfinder-navbar-dir { + padding-right: 35px; +} + +/* arrow before icon */ +.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; + /* border:1px solid #111;*/ +} + +.elfinder-ltr .elfinder-navbar-arrow { + left: 0; +} + +.elfinder-rtl .elfinder-navbar-arrow { + right: 0; +} + +.elfinder-touch .elfinder-navbar-arrow { + -moz-transform-origin: top left; + -moz-transform: scale(1.4); + zoom: 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"); +} + +/* collapsed/expanded arrow view */ +.elfinder-navbar-collapsed .elfinder-navbar-arrow { + display: block; +} + +.elfinder-subtree-chksubdir .elfinder-navbar-arrow { + opacity: .25; + filter: Alpha(Opacity=25); +} + +/* arrow ltr/rtl enviroment */ +.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; +} + +/* folder icon */ +.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; +} + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-icon { + left: 14px; +} + +.elfinder-rtl .elfinder-navbar-icon { + right: 14px; +} + +/* places icon */ +.elfinder-places .elfinder-navbar-root .elfinder-navbar-icon { + background-position: 0 -704px; +} + +/* root folder */ +.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-trash .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-zip .elfinder-navbar-icon, +.elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon { + background-position: 0 0; + background-size: contain; +} + +/* root icon of each volume "\9" for IE8 trick */ +.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon { + background-image: url("../img/volume_icon_local.svg"); + background-image: url("../img/volume_icon_local.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-trash .elfinder-navbar-icon { + background-image: url("../img/volume_icon_trash.svg"); + background-image: url("../img/volume_icon_trash.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon { + background-image: url("../img/volume_icon_ftp.svg"); + background-image: url("../img/volume_icon_ftp.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon { + background-image: url("../img/volume_icon_sql.svg"); + background-image: url("../img/volume_icon_sql.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon { + background-image: url("../img/volume_icon_dropbox.svg"); + background-image: url("../img/volume_icon_dropbox.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon { + background-image: url("../img/volume_icon_googledrive.svg"); + background-image: url("../img/volume_icon_googledrive.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon { + background-image: url("../img/volume_icon_onedrive.svg"); + background-image: url("../img/volume_icon_onedrive.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon { + background-image: url("../img/volume_icon_box.svg"); + background-image: url("../img/volume_icon_box.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-zip .elfinder-navbar-icon { + background-image: url("../img/volume_icon_zip.svg"); + background-image: url("../img/volume_icon_zip.png") \9; +} + +.elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon { + background-image: url("../img/volume_icon_network.svg"); + background-image: url("../img/volume_icon_network.png") \9; +} + +/* icon in active/hove/dropactive state */ +.ui-state-active .elfinder-navbar-icon, +.elfinder-droppable-active .elfinder-navbar-icon, +.ui-state-hover .elfinder-navbar-icon { + background-position: 0 -32px; +} + +/* ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar-subtree { + margin-left: 12px; +} + +.elfinder-rtl .elfinder-navbar-subtree { + margin-right: 12px; +} + +/* spinner */ +.elfinder-tree .elfinder-spinner { + position: absolute; + top: 50%; + margin: -7px 0 0; +} + +/* spinner ltr/rtl enviroment */ +.elfinder-ltr .elfinder-tree .elfinder-spinner { + left: 0; + margin-left: -2px; +} + +.elfinder-rtl .elfinder-tree .elfinder-spinner { + right: 0; + margin-right: -2px; +} + +/* marker */ +.elfinder-navbar .elfinder-perms, +.elfinder-navbar .elfinder-lock, +.elfinder-navbar .elfinder-symlink { + opacity: .6; + filter: Alpha(Opacity=60); +} + +/* permissions marker */ +.elfinder-navbar .elfinder-perms { + bottom: -1px; + margin-top: -8px; +} + +/* locked marker */ +.elfinder-navbar .elfinder-lock { + top: -2px; +} + +/* permissions/symlink markers ltr/rtl enviroment */ +.elfinder-ltr .elfinder-navbar .elfinder-perms { + left: 20px; + transform: scale(0.8); +} + +.elfinder-rtl .elfinder-navbar .elfinder-perms { + right: 20px; + transform: scale(0.8); +} + +.elfinder-ltr .elfinder-navbar .elfinder-lock { + left: 20px; + transform: scale(0.8); +} + +.elfinder-rtl .elfinder-navbar .elfinder-lock { + right: 20px; + transform: scale(0.8); +} + +.elfinder-ltr .elfinder-navbar .elfinder-symlink { + left: 8px; + transform: scale(0.8); +} + +.elfinder-rtl .elfinder-navbar .elfinder-symlink { + right: 8px; + transform: scale(0.8); +} + +/* navbar input */ +.elfinder-navbar input { + width: 100%; + border: 0px solid; + margin: 0; + padding: 0; +} + +/* resizable */ +.elfinder-navbar .ui-resizable-handle { + width: 12px; + background: transparent url('../img/resize.png') center center no-repeat; +} + +.elfinder-nav-handle-icon { + position: absolute; + top: 50%; + margin: -8px 2px 0 2px; + opacity: .5; + filter: Alpha(Opacity=50); +} + +/* pager button */ +.elfinder-navbar-pager { + width: 100%; + box-sizing: border-box; + padding-top: 3px; + padding-bottom: 3px; +} + +.elfinder-touch .elfinder-navbar-pager { + padding-top: 10px; + padding-bottom: 10px; +} + +.elfinder-places { + border: none; + margin: 0; + padding: 0; +} + +.elfinder-places.elfinder-droppable-active { + /*border:1px solid #8cafed;*/ +} + +/* navbar swipe handle */ +.elfinder-navbar-swipe-handle { + position: absolute; + top: 0px; + height: 100%; + width: 50px; + pointer-events: none; +} + +.elfinder-ltr .elfinder-navbar-swipe-handle { + left: 0px; + background: linear-gradient(to right, + rgba(221, 228, 235, 1) 0, + rgba(221, 228, 235, 0.8) 5px, + rgba(216, 223, 230, 0.3) 8px, + rgba(0, 0, 0, 0.1) 95%, + rgba(0, 0, 0, 0) 100%); +} + +.elfinder-rtl .elfinder-navbar-swipe-handle { + right: 0px; + background: linear-gradient(to left, + rgba(221, 228, 235, 1) 0, + rgba(221, 228, 235, 0.8) 5px, + rgba(216, 223, 230, 0.3) 8px, + rgba(0, 0, 0, 0.1) 95%, + rgba(0, 0, 0, 0) 100%); +} + +/* File: /css/places.css */ +/*********************************************/ +/* PLACES STYLES */ +/*********************************************/ +/* root extra icon */ +.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; +} + +/* dragging helper base */ +.elfinder-place-drag { + font-size: 0.8em; +} + +/* File: /css/quicklook.css */ +/* quicklook window */ +.elfinder-quicklook { + position: absolute; + background: url("../img/quicklook-bg.png"); + overflow: hidden; + -moz-border-radius: 7px; + -webkit-border-radius: 7px; + border-radius: 7px; + padding: 20px 0 40px 0; +} + +.elfinder-navdock .elfinder-quicklook { + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + font-size: 90%; + overflow: auto; +} + +.elfinder-quicklook.elfinder-touch { + padding: 30px 0 40px 0; +} + +.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 { + -moz-transform-origin: bottom right; + -moz-transform: scale(1.5); + zoom: 1.5; +} + +/* quicklook fullscreen window */ +.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; +} + +/* hide titlebar in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-titlebar, +.elfinder-quicklook-fullscreen.elfinder-quicklook .ui-resizable-handle { + display: none; +} + +/* hide preview border in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-preview { + border: 0 solid; +} + +/*.elfinder-quicklook-fullscreen iframe { + height: 100%; +}*/ + +.elfinder-quicklook-cover { + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; +} + +.elfinder-quicklook-cover.elfinder-quicklook-coverbg { + /* background need to catch mouse event over browser plugin (eg PDF preview) */ + background-color: #fff; + opacity: 0.000001; + filter: Alpha(Opacity=0.0001); +} + +/* quicklook titlebar */ +.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; + border: none; + line-height: 1.2; +} + +.elfinder-navdock .elfinder-quicklook-titlebar { + -moz-border-radius-topleft: 0; + -webkit-border-top-left-radius: 0; + border-top-left-radius: 0; + -moz-border-radius-topright: 0; + -webkit-border-top-right-radius: 0; + border-top-right-radius: 0; + cursor: default; +} + +.elfinder-touch .elfinder-quicklook-titlebar { + height: 30px; +} + +/* window title */ +.elfinder-quicklook-title { + display: inline-block; + white-space: nowrap; + overflow: hidden; +} + +.elfinder-touch .elfinder-quicklook-title { + padding: 8px 0; +} + +/* icon "close" in titlebar */ +.elfinder-quicklook-titlebar-icon { + position: absolute; + left: 4px; + top: 50%; + margin-top: -8px; + height: 16px; + border: none; +} +.elfinder-touch .elfinder-quicklook-titlebar-icon { + height: 22px; +} + +.elfinder-quicklook-titlebar-icon .ui-icon { + position: relative; + margin: -9px 3px 0px 0px; + cursor: pointer; + border-radius: 10px; + border: 1px solid; + opacity: .7; + filter: Alpha(Opacity=70); +} + +.elfinder-quicklook-titlebar-icon .ui-icon.ui-icon-closethick { + padding-left: 1px; +} + +.elfinder-mobile .elfinder-quicklook-titlebar-icon .ui-icon { + opacity: .6; + filter: Alpha(Opacity=60); +} + +.elfinder-touch .elfinder-quicklook-titlebar-icon .ui-icon { + margin-top: -5px; +} + +.elfinder-quicklook-titlebar-icon.elfinder-titlebar-button-right { + left: auto; + right: 4px; + direction: rtl; +} + +.elfinder-quicklook-titlebar-icon.elfinder-titlebar-button-right .ui-icon { + margin: -9px 0px 0px 3px; +} + +.elfinder-touch .elfinder-quicklook-titlebar .ui-icon { + -moz-transform-origin: center center; + -moz-transform: scale(1.2); + zoom: 1.2; +} + +.elfinder-touch .elfinder-quicklook-titlebar-icon .ui-icon { + margin-right: 10px; +} + +.elfinder-touch .elfinder-quicklook-titlebar-icon.elfinder-titlebar-button-right .ui-icon { + margin-left: 10px; +} + +/* main part of quicklook window */ +.elfinder-quicklook-preview { + overflow: hidden; + position: relative; + border: 0 solid; + border-left: 1px solid transparent; + border-right: 1px solid transparent; + height: 100%; +} + +.elfinder-navdock .elfinder-quicklook-preview { + border-left: 0; + border-right: 0; +} + +.elfinder-quicklook-preview.elfinder-overflow-auto { + overflow: auto; + -webkit-overflow-scrolling: touch; +} + +/* wrapper for file info/icon */ +.elfinder-quicklook-info-wrapper { + display: table; + position: absolute; + width: 100%; + height: 100%; + height: calc(100% - 80px); + left: 0; + top: 20px; +} + +.elfinder-navdock .elfinder-quicklook-info-wrapper { + height: calc(100% - 20px); +} + +/* file info */ +.elfinder-quicklook-info { + display: table-cell; + vertical-align: middle; +} + +.elfinder-ltr .elfinder-quicklook-info { + padding: 0 12px 0 112px; +} + +.elfinder-rtl .elfinder-quicklook-info { + padding: 0 112px 0 12px; +} + +.elfinder-ltr .elfinder-navdock .elfinder-quicklook-info { + padding: 0 0 0 80px; +} + +.elfinder-rtl .elfinder-navdock .elfinder-quicklook-info { + padding: 0 80px 0 0; +} + +/* file name in info */ +.elfinder-quicklook-info .elfinder-quicklook-info-data:first-child { + color: #fff; + font-weight: bold; + padding-bottom: .5em; +} + +/* other data in info */ +.elfinder-quicklook-info-data { + clear: both; + padding-bottom: .2em; + color: #fff; +} + +.elfinder-quicklook-info-progress { + width: 0; + height: 4px; + border-radius: 2px; +} + +/* file icon */ +.elfinder-quicklook .elfinder-cwd-icon { + position: absolute; + left: 32px; + top: 50%; + margin-top: -20px; +} + +.elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon { + left: 16px; +} + +.elfinder-rtl .elfinder-quicklook .elfinder-cwd-icon { + left: auto; + right: 32px; +} + +.elfinder-rtl .elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon { + right: 6px; +} + +.elfinder-quicklook .elfinder-cwd-icon:before { + top: -10px; +} + +.elfinder-ltr .elfinder-quicklook .elfinder-cwd-icon:before { + left: -20px; +} + +.elfinder-ltr .elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon:before { + left: -14px; +} + +.elfinder-ltr .elfinder-quicklook .elfinder-cwd-icon:after { + left: -42px; +} + +.elfinder-ltr .elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon:after { + left: -12px; +} + +.elfinder-rtl .elfinder-quicklook .elfinder-cwd-icon:before { + left: auto; + right: 40px; +} + +.elfinder-rtl .elfinder-quicklook .elfinder-cwd-icon:after { + left: auto; + right: 42px; +} + +/* image in preview */ +.elfinder-quicklook-preview > img, +.elfinder-quicklook-preview > div > canvas { + display: block; + margin: auto; +} + +/* navigation bar on quicklook window bottom */ +.elfinder-quicklook-navbar { + position: absolute; + left: 50%; + bottom: 4px; + width: 140px; + height: 32px; + padding: 0px; + margin-left: -70px; + border: 1px solid transparent; + border-radius: 19px; + -moz-border-radius: 19px; + -webkit-border-radius: 19px; +} + +/* navigation bar in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar { + width: 188px; + margin-left: -94px; + padding: 5px; + border: 1px solid #eee; + background: #000; + opacity: 0.4; + filter: Alpha(Opacity=40); +} + +/* show close icon in fullscreen mode */ +.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-icon-close, +.elfinder-quicklook-fullscreen .elfinder-quicklook-navbar-separator { + display: inline; +} + +/* icons in navbar */ +.elfinder-quicklook-navbar-icon { + width: 32px; + height: 32px; + margin: 0 7px; + float: left; + background: url("../img/quicklook-icons.png") 0 0 no-repeat; + +} + +/* fullscreen icon */ +.elfinder-quicklook-navbar-icon-fullscreen { + background-position: 0 -64px; +} + +/* exit fullscreen icon */ +.elfinder-quicklook-navbar-icon-fullscreen-off { + background-position: 0 -96px; +} + +/* prev file icon */ +.elfinder-quicklook-navbar-icon-prev { + background-position: 0 0; +} + +/* next file icon */ +.elfinder-quicklook-navbar-icon-next { + background-position: 0 -32px; +} + +/* close icon */ +.elfinder-quicklook-navbar-icon-close { + background-position: 0 -128px; + display: none; +} + +/* icons separator */ +.elfinder-quicklook-navbar-separator { + width: 1px; + height: 32px; + float: left; + border-left: 1px solid #fff; + display: none; +} + +/* text encoding selector */ +.elfinder-quicklook-encoding { + height: 40px; +} +.elfinder-quicklook-encoding > select { + color: #fff; + background: #000; + border: 0; + font-size: 12px; + max-width: 100px; + display: inline-block; + position: relative; + top: 6px; + left: 5px; +} +.elfinder-navdock .elfinder-quicklook .elfinder-quicklook-encoding { + display: none; +} + + +/* text files preview wrapper */ +.elfinder-quicklook-preview-text-wrapper { + width: 100%; + height: 100%; + background: #fff; + color: #222; + overflow: auto; + -webkit-overflow-scrolling: touch; +} + +/* archive files preview wrapper */ +.elfinder-quicklook-preview-archive-wrapper { + width: 100%; + height: 100%; + background: #fff; + color: #222; + font-size: 90%; + overflow: auto; + -webkit-overflow-scrolling: touch +} + +/* archive files preview header */ +.elfinder-quicklook-preview-archive-wrapper strong { + padding: 0 5px; +} + +/* text preview */ +pre.elfinder-quicklook-preview-text, +pre.elfinder-quicklook-preview-text.prettyprint { + width: auto; + height: auto; + margin: 0; + padding: 3px 9px; + border: none; + overflow: visible; + -o-tab-size: 4; + -moz-tab-size: 4; + tab-size: 4; +} + +.elfinder-quicklook-preview-charsleft hr { + border: none; + border-top: dashed 1px; +} + +.elfinder-quicklook-preview-charsleft span { + font-size: 90%; + font-style: italic; + cursor: pointer; +} + +/* html/pdf preview */ +.elfinder-quicklook-preview-html, +.elfinder-quicklook-preview-pdf, +.elfinder-quicklook-preview-iframe { + width: 100%; + height: 100%; + background: #fff; + margin: 0; + border: none; + display: block; +} + +/* swf preview container */ +.elfinder-quicklook-preview-flash { + width: 100%; + height: 100%; +} + +/* audio preview container */ +.elfinder-quicklook-preview-audio { + width: 100%; + position: absolute; + bottom: 0; + left: 0; +} + +/* audio preview using embed */ +embed.elfinder-quicklook-preview-audio { + height: 30px; + background: transparent; +} + +/* video preview container */ +.elfinder-quicklook-preview-video { + width: 100%; + height: 100%; +} + +/* video.js error message */ +.elfinder-quicklook-preview .vjs-error .vjs-error-display .vjs-modal-dialog-content { + font-size: 12pt; + padding: 0; + color: #fff; +} + +/* allow user select */ +.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; +} + +/* File: /css/statusbar.css */ +/******************************************************************/ +/* STATUSBAR STYLES */ +/******************************************************************/ + +/* statusbar container */ +.elfinder-statusbar { + display: flex; + justify-content: space-between; + cursor: default; + text-align: center; + font-weight: normal; + padding: .2em .5em; + border-right: 0 solid transparent; + border-bottom: 0 solid transparent; + border-left: 0 solid transparent; +} + +.elfinder-statusbar:before, +.elfinder-statusbar:after { + display: none; +} + +.elfinder-statusbar span { + vertical-align: bottom; + overflow: hidden; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; +} + +.elfinder-statusbar span.elfinder-path-other { + flex-shrink: 0; + text-overflow: clip; + -o-text-overflow: clip; +} + +.elfinder-statusbar span.ui-state-hover, +.elfinder-statusbar span.ui-state-active { + border: none; +} + +.elfinder-statusbar span.elfinder-path-cwd { + cursor: default; +} + +/* path in statusbar */ +.elfinder-path { + display: flex; + order: 1; + flex-grow: 1; + cursor: pointer; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; + max-width: 30%\9; +} + +.elfinder-ltr .elfinder-path { + text-align: left; + float: left\9; +} + +.elfinder-rtl .elfinder-path { + text-align: right; + float: right\9; +} + +/* path in workzone (case of swipe to navbar close) */ +.elfinder-workzone-path { + position: relative; +} + +.elfinder-workzone-path .elfinder-path { + position: relative; + font-size: .75em; + font-weight: normal; + float: none; + max-width: none; + overflow: hidden; + overflow-x: hidden; + text-overflow: initial; + -o-text-overflow: initial; +} + +.elfinder-mobile .elfinder-workzone-path .elfinder-path { + overflow: auto; + overflow-x: scroll; +} + +.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: bold; +} + +.elfinder-workzone-path .elfinder-path span.ui-state-hover, +.elfinder-workzone-path .elfinder-path span.ui-state-active { + 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; +} + +/* total/selected size in statusbar */ +.elfinder-stat-size { + order: 3; + flex-grow: 1; + overflow: hidden; + white-space: nowrap; +} + +.elfinder-ltr .elfinder-stat-size { + text-align: right; + float: right\9; +} + +.elfinder-rtl .elfinder-stat-size { + text-align: left; + float: left\9; +} + +/* info of current selected item */ +.elfinder-stat-selected { + order: 2; + margin: 0 .5em; + white-space: nowrap; + overflow: hidden; +} + +/* File: /css/toast.css */ +/* + * CSS for Toastr + * Copyright 2012-2015 + * Authors: John Papa, Hans Fjällemark, and Tim Ferrell. + * All Rights Reserved. + * Use, reproduction, distribution, and modification of this code is subject to the terms and + * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php + * + * ARIA Support: Greta Krafsig + * + * Project: https://github.com/CodeSeven/toastr + */ + +.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 #999999; + -webkit-box-shadow: 0 0 12px #999999; + box-shadow: 0 0 12px #999999; + color: #FFFFFF; + opacity: 0.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 .elfinder-toast > .toast-info button.ui-button { + background-color: #046580; + color: #FFF; +} + +.elfinder .elfinder-toast > .toast-info button.ui-button.ui-state-hover { + background-color: #7DC6DB; + color: #046580; +} + +.elfinder .elfinder-toast > .toast-warning button.ui-button { + background-color: #dd8c1a; + color: #FFF; +} + +.elfinder .elfinder-toast > .toast-warning button.ui-button.ui-state-hover { + background-color: #e7ae5e; + color: #422a07; +} + +/* File: /css/toolbar.css */ +/*********************************************/ +/* TOOLBAR STYLES */ +/*********************************************/ +/* toolbar container */ +.elfinder-toolbar { + padding: 4px 0 3px 0; + border-left: 0 solid transparent; + border-top: 0 solid transparent; + border-right: 0 solid transparent; + max-height: 50%; + overflow-y: auto; +} + +/* container for button's group */ +.elfinder-buttonset { + margin: 1px 4px; + float: left; + background: transparent; + padding: 0; + overflow: hidden; +} + +/*.elfinder-buttonset:first-child { margin:0; }*/ + +/* button */ +.elfinder .elfinder-button { + min-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; + line-height: 1; + cursor: default; +} + +.elfinder-rtl .elfinder-button { + float: right; +} + +.elfinder-touch .elfinder-button { + min-width: 20px; + height: 20px; +} + +.elfinder .ui-icon-search { + cursor: pointer; +} + +/* separator between buttons, required for berder between button with ui color */ +.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-rtl .elfinder-toolbar-button-separator { + float: right; +} + +.elfinder-touch .elfinder-toolbar-button-separator { + height: 28px; +} + +/* change icon opacity^ not button */ +.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); +} + +/* rtl enviroment */ +.elfinder-rtl .elfinder-buttonset { + float: right; +} + +/* icon inside button */ +.elfinder-button-icon { + width: 16px; + height: 16px; + /*display:block;*/ + 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 { + transform: scale(1.25); + transform-origin: top left; +} + +.elfinder-rtl.elfinder-touch .elfinder-button-icon { + transform-origin: top right; +} + +.elfinder-touch .elfinder-button-text { + transform: translate(3px, 3px); + top: -5px; +} + +.elfinder-rtl.elfinder-touch .elfinder-button-text { + transform: translate(-3px, 3px); +} + +.elfinder-touch .elfinder-button-icon.elfinder-contextmenu-extra-icon { + transform: scale(2); + transform-origin: 12px 8px; +} + +.elfinder-rtl.elfinder-touch .elfinder-button-icon.elfinder-contextmenu-extra-icon { + transform-origin: 4px 8px; +} + +/* buttons icons */ +.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-opendir { + background-position: 0 -32px; +} + +.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 -832px; +} + +.elfinder-button-icon-trash { + background-position: 0 -224px; +} + +.elfinder-button-icon-restore { + background-position: 0 -816px; +} + +.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-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-button-icon-empty { + background-position: 0 -848px; +} + +.elfinder-button-icon-undo { + background-position: 0 -864px; +} + +.elfinder-button-icon-redo { + background-position: 0 -880px; +} + +.elfinder-button-icon-preference { + background-position: 0 -896px; +} + +.elfinder-button-icon-mkdirin { + background-position: 0 -912px; +} + +.elfinder-button-icon-selectall { + background-position: 0 -928px; +} + +.elfinder-button-icon-selectnone { + background-position: 0 -944px; +} + +.elfinder-button-icon-selectinvert { + background-position: 0 -960px; +} + +.elfinder-button-icon-opennew { + background-position: 0 -976px; +} + +.elfinder-button-icon-hide { + background-position: 0 -992px; +} + +.elfinder-button-icon-text { + background-position: 0 -1008px; +} + +/* button icon mirroring for rtl */ +.elfinder-rtl .elfinder-button-icon-back, +.elfinder-rtl .elfinder-button-icon-forward, +.elfinder-rtl .elfinder-button-icon-getfile, +.elfinder-rtl .elfinder-button-icon-help, +.elfinder-rtl .elfinder-button-icon-redo, +.elfinder-rtl .elfinder-button-icon-rename, +.elfinder-rtl .elfinder-button-icon-search, +.elfinder-rtl .elfinder-button-icon-undo, +.elfinder-rtl .elfinder-button-icon-view-list, +.elfinder-rtl .ui-icon-search { + -ms-transform: scale(-1, 1); + -webkit-transform: scale(-1, 1); + transform: scale(-1, 1); +} + +.elfinder-rtl.elfinder-touch .elfinder-button-icon-back, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-forward, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-getfile, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-help, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-redo, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-rename, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-search, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-undo, +.elfinder-rtl.elfinder-touch .elfinder-button-icon-view-list, +.elfinder-rtl.elfinder-touch .ui-icon-search { + -ms-transform: scale(-1.25, 1.25) translateX(16px); + -webkit-transform: scale(-1.25, 1.25) translateX(16px); + transform: scale(-1.25, 1.25) translateX(16px); +} + +/* button with dropdown menu*/ +.elfinder .elfinder-menubutton { + overflow: visible; +} + +/* button with spinner icon */ +.elfinder-button-icon-spinner { + background: url("../img/spinner-mini.gif") center center no-repeat; +} + +/* menu */ +.elfinder-button-menu { + position: absolute; + margin-top: 24px; + padding: 3px 0; + overflow-y: auto; +} + +.elfinder-touch .elfinder-button-menu { + margin-top: 30px; +} + +/* menu item */ +.elfinder-button-menu-item { + white-space: nowrap; + cursor: default; + padding: 5px 19px; + position: relative; +} + +.elfinder-touch .elfinder-button-menu-item { + padding: 12px 19px +} + +/* fix hover ui class */ +.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 { + display: none; +} + +.elfinder-button-menu-item-selected-desc .ui-icon-arrowthick-1-n { + display: none; +} + +/* hack for upload button */ +.elfinder-button form { + position: absolute; + top: 0; + right: 0; + opacity: 0; + filter: Alpha(Opacity=0); + cursor: pointer; +} + +.elfinder .elfinder-button form input { + background: transparent; + cursor: default; +} + +/* search "button" */ +.elfinder .elfinder-button-search { + border: 0 solid; + background: transparent; + padding: 0; + margin: 1px 4px; + height: auto; + min-height: 26px; + width: 70px; + overflow: visible; +} + +.elfinder .elfinder-button-search.ui-state-active { + width: 220px; +} + +/* search "pull down menu" */ +.elfinder .elfinder-button-search-menu { + font-size: 8pt; + text-align: center; + width: auto; + min-width: 180px; + position: absolute; + top: 30px; + padding-right: 5px; + padding-left: 5px; +} + +.elfinder-ltr .elfinder-button-search-menu { + right: 22px; + left: auto; +} + +.elfinder-rtl .elfinder-button-search-menu { + right: auto; + left: 22px; +} + +.elfinder-touch .elfinder-button-search-menu { + top: 34px; +} + +.elfinder .elfinder-button-search-menu div { + margin-left: auto; + margin-right: auto; + margin-top: 5px; + margin-bottom: 5px; + display: table; +} + +.elfinder .elfinder-button-search-menu div .ui-state-hover { + border: 1px solid; +} + +/* ltr/rte enviroment */ +.elfinder-ltr .elfinder-button-search { + float: right; + margin-right: 10px; +} + +.elfinder-rtl .elfinder-button-search { + float: left; + margin-left: 10px; +} + +.elfinder-rtl .ui-controlgroup > .ui-controlgroup-item { + float: right; +} + +/* search text field */ +.elfinder-button-search input[type=text] { + box-sizing: border-box; + width: 100%; + height: 26px; + padding: 0 20px; + line-height: 22px; + border: 0 solid; + border: 1px solid #aaa; + -moz-border-radius: 12px; + -webkit-border-radius: 12px; + border-radius: 12px; + outline: 0px solid; +} + +.elfinder-button-search input::-ms-clear { + display: none; +} + +.elfinder-touch .elfinder-button-search input { + height: 30px; + line-height: 28px; +} + +.elfinder-rtl .elfinder-button-search input { + direction: rtl; +} + +/* icons */ +.elfinder-button-search .ui-icon { + position: absolute; + height: 18px; + top: 50%; + margin: -8px 4px 0 4px; + opacity: .6; + filter: Alpha(Opacity=60); +} + +.elfinder-button-search-menu .ui-checkboxradio-icon { + display: none; +} + +/* search/close icons */ +.elfinder-ltr .elfinder-button-search .ui-icon-search { + left: 0; +} + +.elfinder-rtl .elfinder-button-search .ui-icon-search { + right: 0; +} + +.elfinder-ltr .elfinder-button-search .ui-icon-close { + right: 0; +} + +.elfinder-rtl .elfinder-button-search .ui-icon-close { + left: 0; +} + +/* toolbar swipe handle */ +.elfinder-toolbar-swipe-handle { + position: absolute; + top: 0px; + left: 0px; + height: 50px; + width: 100%; + pointer-events: none; + background: linear-gradient(to bottom, + rgba(221, 228, 235, 1) 0, + rgba(221, 228, 235, 0.8) 2px, + rgba(216, 223, 230, 0.3) 5px, + rgba(0, 0, 0, 0.1) 95%, + rgba(0, 0, 0, 0) 100%); +} + diff --git a/public/packages/barryvdh/elfinder/css/elfinder.min.css b/public/packages/barryvdh/elfinder/css/elfinder.min.css new file mode 100644 index 00000000..956e0ca3 --- /dev/null +++ b/public/packages/barryvdh/elfinder/css/elfinder.min.css @@ -0,0 +1,9 @@ +/*! + * elFinder - file manager for web + * Version 2.1.62 (2023-06-14) + * http://elfinder.org + * + * Copyright 2009-2023, Studio 42 + * Licensed under a 3-clauses BSD license + */ +.elfinder-resize-container{margin-top:.3em}.elfinder-resize-type{float:left;margin-bottom:.4em}.elfinder-resize-control{float:left}.elfinder-resize-control input[type=number]{border:1px solid #aaa;text-align:right;width:4.5em}.elfinder-resize-control input.elfinder-resize-bg{text-align:center;width:5em;direction:ltr}.elfinder-dialog-resize .elfinder-resize-control-panel{margin-top:10px}.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-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-dialog.elfinder-dialog-resize .ui-resizable-e{width:10px;height:100%}.elfinder-dialog.elfinder-dialog-resize .ui-resizable-s{width:100%;height:10px}.elfinder-resize-loading{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-resize .elfinder-resize-whctrls{margin:-20px 5px 0}.elfinder-ltr .elfinder-dialog-resize .elfinder-resize-whctrls{float:right}.elfinder-help-team div,.elfinder-rtl .elfinder-dialog-resize .elfinder-resize-whctrls{float:left}.elfinder-dialog-resize .ui-resizable-e,.elfinder-dialog-resize .ui-resizable-w{height:100%;width:10px}.elfinder-dialog-resize .ui-resizable-n,.elfinder-dialog-resize .ui-resizable-s{width:100%;height:10px}.elfinder-dialog-resize .ui-resizable-e{margin-right:-7px}.elfinder-dialog-resize .ui-resizable-w{margin-left:-7px}.elfinder-dialog-resize .ui-resizable-s{margin-bottom:-7px}.elfinder-dialog-resize .ui-resizable-n{margin-top:-7px}.elfinder-dialog-resize .ui-resizable-ne,.elfinder-dialog-resize .ui-resizable-nw,.elfinder-dialog-resize .ui-resizable-se,.elfinder-dialog-resize .ui-resizable-sw{width:10px;height:10px}.elfinder-dialog-resize .ui-resizable-se{background:0 0;bottom:0;right:0;margin-right:-7px;margin-bottom:-7px}.elfinder-dialog-resize .ui-resizable-sw{margin-left:-7px;margin-bottom:-7px}.elfinder-dialog-resize .ui-resizable-ne{margin-right:-7px;margin-top:-7px}.elfinder-dialog-resize .ui-resizable-nw{margin-left:-7px;margin-top:-7px}.elfinder-touch .elfinder-dialog-resize .ui-resizable-n,.elfinder-touch .elfinder-dialog-resize .ui-resizable-s{height:20px}.elfinder-touch .elfinder-dialog-resize .ui-resizable-e,.elfinder-touch .elfinder-dialog-resize .ui-resizable-w{width:20px}.elfinder-touch .elfinder-dialog-resize .ui-resizable-ne,.elfinder-touch .elfinder-dialog-resize .ui-resizable-nw,.elfinder-touch .elfinder-dialog-resize .ui-resizable-se,.elfinder-touch .elfinder-dialog-resize .ui-resizable-sw{width:30px;height:30px}.elfinder-touch .elfinder-dialog-resize .elfinder-resize-preview .ui-resizable-se{width:30px;height:30px;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 input.elfinder-resize-quality,.elfinder-mobile .elfinder-resize-control input[type=number]{width:3.5em}.elfinder-mobile .elfinder-dialog-resize .elfinder-resize-degree input,.elfinder-mobile .elfinder-dialog-resize input.elfinder-resize-quality{width:2.5em}.elfinder-dialog-resize .elfinder-resize-degree button.ui-button{padding:6px 8px}.elfinder-dialog-resize button.ui-button span{padding:0}.elfinder-dialog-resize .elfinder-resize-jpgsize{font-size:90%}.ui-widget-content .elfinder-resize-container .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-resize-preset-container{box-sizing:border-box;border-radius:5px}.elfinder-file-edit{width:100%;height:100%;margin:0;padding:2px;border:1px solid #ccc;box-sizing:border-box;resize:none}.elfinder-touch .elfinder-file-edit{font-size:16px}.elfinder-dialog-edit .ui-dialog-content.elfinder-edit-editor{background-color:#fff}.elfinder-dialog-edit .ui-dialog-content.elfinder-edit-editor .elfinder-edit-imageeditor{width:100%;height:300px;max-height:100%;text-align:center}.elfinder-dialog-edit .ui-dialog-content.elfinder-edit-editor .elfinder-edit-imageeditor *{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;user-select:none}.elfinder-edit-imageeditor .tui-image-editor-main-container .tui-image-editor-main{top:0}.elfinder-edit-imageeditor .tui-image-editor-main-container .tui-image-editor-header{display:none}.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-crop .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-draw .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-filter .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-flip .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-icon .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-mask .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-rotate .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-shape .tui-image-editor-wrap,.elfinder-edit-imageeditor .tui-image-editor-main.tui-image-editor-menu-text .tui-image-editor-wrap{height:calc(100% - 150px)}.elfinder-touch.elfinder-fullscreen-native textarea.elfinder-file-edit{padding-bottom:20em;margin-bottom:-20em}.elfinder-dialog-edit .ui-dialog-buttonpane .elfinder-dialog-confirm-encoding{font-size:12px}.ui-dialog-buttonpane .ui-dialog-buttonset.elfinder-edit-extras{margin:0 1em 0 .2em;float:left}.ui-dialog-buttonpane .ui-dialog-buttonset.elfinder-edit-extras-quality{padding-top:6px}.ui-dialog-buttonpane .ui-dialog-buttonset.elfinder-edit-extras select{font-size:12px;margin-top:8px}.elfinder-dialog-edit .ui-dialog-buttonpane .ui-icon,.elfinder-edit-onlineconvert-bottom-btn button,.elfinder-edit-onlineconvert-button button,.elfinder-preference dt label{cursor:pointer}.elfinder-edit-spinner{position:absolute;top:50%;text-align:center;width:100%;font-size:16pt}.elfinder-dialog-edit .elfinder-edit-spinner .elfinder-spinner,.elfinder-dialog-edit .elfinder-edit-spinner .elfinder-spinner-text{float:none}.elfinder-dialog-edit .elfinder-toast>div{width:280px}.elfinder-edit-onlineconvert-button{display:inline-block;width:180px;min-height:30px;vertical-align:top}.elfinder-edit-onlineconvert-bottom-btn button.elfinder-button-ios-multiline{-webkit-appearance:none;border-radius:16px;color:#000;text-align:center;padding:8px;background-color:#eee;background-image:-webkit-linear-gradient(top,#fafafa 0%,#c4c4c4 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#c4c4c4 100%)}.elfinder-edit-onlineconvert-button .elfinder-button-icon{margin:0 10px;vertical-align:middle;cursor:pointer}.elfinder-edit-onlineconvert-bottom-btn{text-align:center;margin:10px 0 0}.elfinder-edit-onlineconvert-link{margin-top:1em;text-align:center}.elfinder-edit-onlineconvert-link .elfinder-button-icon{background-image:url(../img/editor-icons.png);background-repeat:no-repeat;background-position:0 -144px;margin-bottom:-3px}.elfinder-edit-onlineconvert-link a,ul.elfinder-help-integrations a{text-decoration:none}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;-webkit-overflow-scrolling:touch}.elfinder-help .ui-tabs-panel{overflow:auto;padding:10px}.elfinder-dialog .ui-tabs .ui-tabs-nav li{overflow:hidden}.elfinder-dialog .ui-tabs .ui-tabs-nav li a{padding:.2em .8em;display:inline-block}.elfinder-touch .elfinder-dialog .ui-tabs .ui-tabs-nav li a{padding:.5em}.elfinder-dialog .ui-tabs-active a{background:inherit}.elfinder-help-shortcuts{height:auto;padding:10px;margin:0;box-sizing:border-box}.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{display:inline-block;margin-right:12px;padding:2px 0;white-space:nowrap}.elfinder-rtl .elfinder-help-link{margin-right:0;margin-left:12px}.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}ul.elfinder-help-integrations ul{padding:0;margin:0 1em 1em}ul.elfinder-help-integrations a:hover{text-decoration:underline}.elfinder-help-debug{height:100%;padding:0;margin:0;overflow:none;border:none}.elfinder-help-debug .ui-tabs-panel{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-dialog .elfinder-preference .ui-tabs-nav{margin-bottom:1px;height:auto}.elfinder-preference .ui-tabs-panel{padding:10px 10px 0;overflow:auto;box-sizing:border-box;-webkit-overflow-scrolling:touch}.elfinder-preference a.ui-state-hover,.elfinder-preference label.ui-state-hover{border:none}.elfinder-preference dl{width:100%;display:inline-block;margin:.5em 0}.elfinder-preference dt{display:block;width:200px;clear:left;float:left;max-width:50%}.elfinder-rtl .elfinder-preference dt{clear:right;float:right}.elfinder-preference dd{margin-bottom:1em}.elfinder-preference dd input[type=checkbox],.elfinder-preference dd label{white-space:nowrap;display:inline-block;cursor:pointer}.elfinder-preference dt.elfinder-preference-checkboxes{width:100%;max-width:none}.elfinder-preference dd.elfinder-preference-checkboxes{padding-top:3ex}.elfinder-preference select{max-width:100%}.elfinder-preference dd.elfinder-preference-iconSize .ui-slider{width:50%;max-width:100px;display:inline-block;margin:0 10px}.elfinder-preference button{margin:0 16px}.elfinder-preference button+button{margin:0 -10px}.elfinder-preference .elfinder-preference-taball .elfinder-reference-hide-taball{display:none}.elfinder-preference-theme fieldset{margin-bottom:10px}.elfinder-preference-theme legend a{font-size:1.8em;text-decoration:none;cursor:pointer}.elfinder-preference-theme dt{width:20%;word-break:break-all}.elfinder-preference-theme dt:after{content:" :"}.elfinder-preference-theme dd{margin-inline-start:20%}.elfinder-preference img.elfinder-preference-theme-image{display:block;margin-left:auto;margin-right:auto;max-width:90%;max-height:200px;cursor:pointer}.elfinder-preference-theme-btn,.elfinder-rename-batch-type{text-align:center}.elfinder-preference-theme button.elfinder-preference-theme-default{display:inline;margin:0 10px;font-size:8pt}.elfinder-rtl .elfinder-info-title .elfinder-cwd-icon:before{right:33px;left:auto}.elfinder-info-title .elfinder-cwd-icon.elfinder-cwd-bgurl:after{content:none}.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}.elfinder-ltr .elfinder-rm-title .elfinder-cwd-icon:before{left:38px}.elfinder-rtl .elfinder-rm-title .elfinder-cwd-icon:before{right:86px;left:auto}.elfinder-rm-title .elfinder-cwd-icon.elfinder-cwd-bgurl:after{content:none}.elfinder-rename-batch div{margin:5px 8px}.elfinder-rename-batch .elfinder-rename-batch-name input{width:100%;font-size:1.6em}.elfinder-rename-batch .elfinder-rename-batch-type label{margin:2px;font-size:.9em}.elfinder-rename-batch-preview{padding:0 8px;font-size:1.1em;min-height:4ex}.ui-front{z-index:100}.elfinder .elfinder-cwd table td div,.elfinder-cwd table td,div.elfinder *,div.elfinder :after,div.elfinder :before{box-sizing:content-box}div.elfinder fieldset{display:block;margin-inline-start:2px;margin-inline-end:2px;padding-block-start:.35em;padding-inline-start:.75em;padding-inline-end:.75em;padding-block-end:.625em;min-inline-size:min-content;border-width:2px;border-style:groove;border-color:threedface;border-image:initial}div.elfinder legend{display:block;padding-inline-start:2px;padding-inline-end:2px;border-width:initial;border-style:none;border-color:initial;border-image:initial;width:auto;margin-bottom:0}div.elfinder{padding:0;position:relative;display:block;visibility:visible;font-size:18px;font-family:Verdana,Arial,Helvetica,sans-serif}.elfinder-ios input,.elfinder-ios select,.elfinder-ios textarea{font-size:16px!important}.elfinder.elfinder-fullscreen>.ui-resizable-handle{display:none}.elfinder-font-mono{line-height:2ex}.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{display:inline-box;position:absolute;top:0;left:0;width:auto;height:14px;text-align:center;padding:1px 3px;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 div.elfinder-bottomtray>div{top:initial;right:initial;left:initial}.elfinder.elfinder-ltr div.elfinder-bottomtray{left:0}.elfinder.elfinder-rtl div.elfinder-bottomtray{right:0}.elfinder .elfinder-ui-tooltip,.elfinder-ui-tooltip{font-size:14px;padding:2px 4px}.elfinder-ui-progressbar{pointer-events:none;position:absolute;width:0;height:2px;top:0;border-radius:2px;filter:blur(1px)}.elfinder-ltr .elfinder-ui-progressbar{left:0}.elfinder-rtl .elfinder-ui-progressbar{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.svg);background-size:contain}.elfinder-navbar-root-trash.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_trash.svg);background-size:contain}.elfinder-navbar-root-ftp.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_ftp.svg);background-size:contain}.elfinder-navbar-root-sql.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_sql.svg);background-size:contain}.elfinder-navbar-root-dropbox.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_dropbox.svg);background-size:contain}.elfinder-navbar-root-googledrive.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_googledrive.svg);background-size:contain}.elfinder-navbar-root-onedrive.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_onedrive.svg);background-size:contain}.elfinder-navbar-root-box.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_box.svg);background-size:contain}.elfinder-navbar-root-zip.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_zip.svg);background-size:contain}.elfinder-navbar-root-network.elfinder-contextmenu-icon{background-image:url(../img/volume_icon_network.svg);background-size:contain}.elfinder .elfinder-contextmenu .elfinder-contextmenu-item span{display:block}.elfinder .elfinder-contextmenu-sub .elfinder-contextmenu-item{padding-left:12px;padding-right:12px}.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-contextsubmenu-item-icon{padding-left:28px}.elfinder .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon{padding-right:28px}.elfinder-touch .elfinder-contextmenu-ltr .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon{padding-left:36px}.elfinder-touch .elfinder-contextmenu-rtl .elfinder-contextmenu-sub .elfinder-contextsubmenu-item-icon{padding-right:36px}.elfinder .elfinder-contextmenu-arrow,.elfinder .elfinder-contextmenu-extra-icon,.elfinder .elfinder-contextmenu-icon{position:absolute;top:50%;margin-top:-8px;overflow:hidden}.elfinder-touch .elfinder-button-icon.elfinder-contextmenu-icon{transform-origin:center center}.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{position:relative;width:100%;height:100%;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-contextmenu-item .elfinder-button-icon.ui-state-disabled{background-image:url(../img/toolbar.png)}.elfinder-cwd-wrapper{overflow:auto;position:relative;padding:2px;margin:0}.elfinder-cwd-wrapper-list{padding:0}.elfinder-cwd{position:absolute;top:0;cursor:default;padding:0;margin:0;-ms-touch-action:auto;touch-action:auto;min-width:100%}.elfinder-ltr .elfinder-cwd{left:0}.elfinder-rtl .elfinder-cwd{right:0}.elfinder-cwd.elfinder-table-header-sticky{position:-webkit-sticky;position:-ms-sticky;position:sticky;top:0;left:auto;right:auto;width:-webkit-max-content;width:-moz-max-content;width:-ms-max-content;width:max-content;height:0;overflow:visible}.elfinder-cwd.elfinder-table-header-sticky table{border-top:2px solid;padding-top:0}.elfinder-cwd.elfinder-table-header-sticky td{display:inline-block}.elfinder-droppable-active .elfinder-cwd.elfinder-table-header-sticky table{border-top:2px solid transparent}.elfinder .elfinder-cwd table tbody.elfinder-cwd-fixheader,.elfinder-cwd-fixheader .elfinder-cwd{position:relative}.elfinder .elfinder-cwd-wrapper.elfinder-droppable-active{outline:2px solid #8cafed;outline-offset:-2px}.elfinder-cwd-wrapper-empty .elfinder-cwd:after{display:block;height:auto;width:90%;width:calc(100% - 20px);position:absolute;top:50%;left:50%;-ms-transform:translateY(-50%) translateX(-50%);-webkit-transform:translateY(-50%) translateX(-50%);transform:translateY(-50%) translateX(-50%);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;background-color:transparent;opacity:.4;filter:Alpha(Opacity=40)}.elfinder-mobile .elfinder-cwd-file .elfinder-cwd-select{width:30px;height:30px}.elfinder .elfinder-cwd-selectall,.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}.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:90px;padding-bottom:2px;cursor:default;border:none;position:relative}.elfinder .std42-dialog .ui-dialog-content label,.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-active{border:none}.elfinder-ltr .elfinder-cwd-view-icons .elfinder-cwd-file{float:left;margin:0 3px 2px 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-size1 .elfinder-cwd-icon:before,.elfinder-cwd-size2 .elfinder-cwd-icon:before,.elfinder-cwd-size3 .elfinder-cwd-icon:before{top:3px;display:block}.elfinder-cwd-size1.elfinder-cwd-view-icons .elfinder-cwd-file{width:120px;height:112px}.elfinder-cwd-size1.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper{width:74px;height:74px}.elfinder-cwd-size1 .elfinder-cwd-icon,.elfinder-cwd-size2 .elfinder-cwd-icon,.elfinder-cwd-size3 .elfinder-cwd-icon{-ms-transform-origin:top center;-ms-transform:scale(1.5);-webkit-transform-origin:top center;-webkit-transform:scale(1.5);transform-origin:top center;transform:scale(1.5)}.elfinder-cwd-size1 .elfinder-cwd-icon.elfinder-cwd-bgurl:before{-ms-transform-origin:top left;-ms-transform:scale(1.35) translate(-4px,15%);-webkit-transform-origin:top left;-webkit-transform:scale(1.35) translate(-4px,15%);transform-origin:top left;transform:scale(1.35) translate(-4px,15%)}.elfinder-cwd-size1 .elfinder-cwd-icon.elfinder-cwd-bgurl:after{-ms-transform:scale(1) translate(10px,-5px);-webkit-transform:scale(1) translate(10px,-5px);transform:scale(1) translate(10px,-5px)}.elfinder-cwd-size1 .elfinder-cwd-icon.elfinder-cwd-bgurl{-ms-transform-origin:center center;-ms-transform:scale(1);-webkit-transform-origin:center center;-webkit-transform:scale(1);transform-origin:center center;transform:scale(1);width:72px;height:72px;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px}.elfinder-cwd-size2.elfinder-cwd-view-icons .elfinder-cwd-file{width:140px;height:134px}.elfinder-cwd-size2.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper{width:98px;height:98px}.elfinder-cwd-size2 .elfinder-cwd-icon,.elfinder-cwd-size3 .elfinder-cwd-icon{-ms-transform:scale(2);-webkit-transform:scale(2);transform:scale(2)}.elfinder-cwd-size2 .elfinder-cwd-icon.elfinder-cwd-bgurl:before{-ms-transform-origin:top left;-ms-transform:scale(1.8) translate(-5px,18%);-webkit-transform-origin:top left;-webkit-transform:scale(1.8) translate(-5px,18%);transform-origin:top left;transform:scale(1.8) translate(-5px,18%)}.elfinder-cwd-size2 .elfinder-cwd-icon.elfinder-cwd-bgurl:after{-ms-transform:scale(1.1) translate(0,10px);-webkit-transform:scale(1.1) translate(0,10px);transform:scale(1.1) translate(0,10px)}.elfinder-cwd-size2 .elfinder-cwd-icon.elfinder-cwd-bgurl{-ms-transform-origin:center center;-ms-transform:scale(1);-webkit-transform-origin:center center;-webkit-transform:scale(1);transform-origin:center center;transform:scale(1);width:96px;height:96px;-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-cwd-size3.elfinder-cwd-view-icons .elfinder-cwd-file{width:174px;height:158px}.elfinder-cwd-size3.elfinder-cwd-view-icons .elfinder-cwd-file-wrapper{width:122px;height:122px}.elfinder-cwd-size3 .elfinder-cwd-icon{-ms-transform:scale(2.5);-webkit-transform:scale(2.5);transform:scale(2.5)}.elfinder-cwd-size3 .elfinder-cwd-icon.elfinder-cwd-bgurl:before{-ms-transform-origin:top left;-ms-transform:scale(2.25) translate(-6px,20%);-webkit-transform-origin:top left;-webkit-transform:scale(2.25) translate(-6px,20%);transform-origin:top left;transform:scale(2.25) translate(-6px,20%)}.elfinder-cwd-size3 .elfinder-cwd-icon.elfinder-cwd-bgurl:after{-ms-transform:scale(1.2) translate(-9px,22px);-webkit-transform:scale(1.2) translate(-9px,22px);transform:scale(1.2) translate(-9px,22px)}.elfinder-cwd-size3 .elfinder-cwd-icon.elfinder-cwd-bgurl{-ms-transform-origin:center center;-ms-transform:scale(1);-webkit-transform-origin:center center;-webkit-transform:scale(1);transform-origin:center center;transform:scale(1);width:120px;height:120px;-moz-border-radius:10px;-webkit-border-radius:10px;border-radius:10px}.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-image:url(../img/icons-big.svg);background-image:url(../img/icons-big.png) \9;background-position:0 0;background-repeat:no-repeat;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box}.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon,.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.svg);background-image:url(../img/volume_icon_local.png) \9;background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-local.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd .elfinder-navbar-root-trash.elfinder-droppable-active .elfinder-cwd-icon,.elfinder-cwd-view-list .elfinder-navbar-root-trash td .elfinder-cwd-icon,.elfinder-navbar-root-trash .elfinder-cwd-icon{background-image:url(../img/volume_icon_trash.svg);background-image:url(../img/volume_icon_trash.png) \9;background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-trash.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon,.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.svg);background-image:url(../img/volume_icon_ftp.png) \9;background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-ftp.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon,.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.svg);background-image:url(../img/volume_icon_sql.png) \9;background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-sql.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon,.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.svg);background-image:url(../img/volume_icon_dropbox.png) \9;background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-dropbox.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd-view-list .elfinder-navbar-root-googledrive td .elfinder-cwd-icon,.elfinder-navbar-root-googledrive .elfinder-cwd-icon{background-position:0 0}.elfinder-cwd .elfinder-navbar-root-googledrive.elfinder-droppable-active .elfinder-cwd-icon,.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.svg);background-image:url(../img/volume_icon_googledrive.png) \9;background-size:contain}.elfinder-cwd-view-list .elfinder-navbar-root-onedrive td .elfinder-cwd-icon,.elfinder-navbar-root-onedrive .elfinder-cwd-icon{background-position:0 0}.elfinder-cwd .elfinder-navbar-root-onedrive.elfinder-droppable-active .elfinder-cwd-icon,.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.svg);background-image:url(../img/volume_icon_onedrive.png) \9;background-size:contain}.elfinder-cwd-view-list .elfinder-navbar-root-box td .elfinder-cwd-icon,.elfinder-navbar-root-box .elfinder-cwd-icon{background-position:0 0}.elfinder-cwd .elfinder-navbar-root-box.elfinder-droppable-active .elfinder-cwd-icon,.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.svg);background-image:url(../img/volume_icon_box.png) \9;background-size:contain}.elfinder-cwd .elfinder-navbar-root-zip.elfinder-droppable-active .elfinder-cwd-icon,.elfinder-cwd-view-list .elfinder-navbar-root-zip td .elfinder-cwd-icon,.elfinder-navbar-root-zip .elfinder-cwd-icon{background-image:url(../img/volume_icon_zip.svg);background-image:url(../img/volume_icon_zip.png) \9;background-position:0 0;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 .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon,.elfinder-cwd-view-list .elfinder-navbar-root-network td .elfinder-cwd-icon,.elfinder-navbar-root-network .elfinder-cwd-icon{background-image:url(../img/volume_icon_network.svg);background-image:url(../img/volume_icon_network.png) \9;background-position:0 0;background-size:contain}.elfinder-cwd .elfinder-navbar-root-network.elfinder-droppable-active .elfinder-cwd-icon{background-position:1px -1px}.elfinder-cwd-icon:before{content:none;position:absolute;left:0;top:5px;min-width:20px;max-width:84px;text-align:center;padding:0 4px 1px;border-radius:4px;font-family:Verdana;font-size:10px;line-height:1.3em;-webkit-transform:scale(.9);-moz-transform:scale(.9);-ms-transform:scale(.9);-o-transform:scale(.9);transform:scale(.9)}.elfinder-cwd-view-icons .elfinder-cwd-icon.elfinder-cwd-bgurl:before{left:-10px}.elfinder-cwd-icon.elfinder-cwd-icon-mp2t:before{content:'ts'}.elfinder-cwd-icon.elfinder-cwd-icon-dash-xml:before{content:'dash'}.elfinder-cwd-icon.elfinder-cwd-icon-x-mpegurl:before{content:'hls'}.elfinder-cwd-icon.elfinder-cwd-icon-x-c:before{content:'c++'}.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-icon.elfinder-cwd-bgurl:after{content:' '}.elfinder-cwd-bgurl:after{position:relative;display:inline-block;top:36px;left:-38px;width:48px;height:48px;background-image:url(../img/icons-big.svg);background-image:url(../img/icons-big.png) \9;background-repeat: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.elfinder-cwd-icon-drag{width:48px;height:48px}.elfinder-cwd-icon-directory.elfinder-cwd-bgurl:after,.elfinder-cwd-icon-image.elfinder-cwd-bgurl:after,.elfinder-cwd-icon.elfinder-cwd-icon-drag:after,.elfinder-cwd-icon.elfinder-cwd-icon-drag:before{content:none}.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{background-position:0 -1350px}.elfinder-cwd-icon-plain,.elfinder-cwd-icon-plain: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-vnd-adobe-photoshop,.elfinder-cwd-icon-vnd-adobe-photoshop:after{background-position:0 -250px}.elfinder-cwd-icon-postscript,.elfinder-cwd-icon-postscript:after{background-position:0 -1550px}.elfinder-cwd-icon-audio,.elfinder-cwd-icon-audio:after{background-position:0 -300px}.elfinder-cwd-icon-dash-xml,.elfinder-cwd-icon-flash-video,.elfinder-cwd-icon-video,.elfinder-cwd-icon-video:after,.elfinder-cwd-icon-vnd-apple-mpegurl,.elfinder-cwd-icon-x-mpegurl{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 -400px}.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-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-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{background-position:0 -1450px}.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{background-position:0 -1700px}.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-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{background-position:0 -1400px}.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{background-position:0 -1650px}.elfinder-cwd-icon-msword,.elfinder-cwd-icon-msword: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-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 -1500px}.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{background-position:0 -1750px}.elfinder-cwd-icon-vnd-ms-office,.elfinder-cwd-icon-vnd-ms-office:after{background-position:0 -500px}.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-openofficeorg-extension,.elfinder-cwd-icon-vnd-openofficeorg-extension:after{background-position:0 -1600px}.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,.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar select{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:4px}.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-touch .elfinder-cwd table thead td,.elfinder-touch .elfinder-cwd.elfinder-has-checkbox table thead td:first-child{padding-top:8px;padding-bottom:8px}.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:0 12px;white-space:pre;overflow:hidden;text-align:right;cursor:default;border:0 solid}.elfinder .elfinder-cwd table tbody td:first-child{position:relative}tr.elfinder-cwd-file td .elfinder-cwd-select{padding-top:3px}.elfinder-mobile tr.elfinder-cwd-file td .elfinder-cwd-select{width:40px}.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 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-ltr .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-cwd-view-list .elfinder-cwd-filename{padding-top:4px;padding-bottom:4px;display:inline-block}.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-cwd-view-list .elfinder-perms{bottom:-4px}.elfinder-cwd-view-list .elfinder-lock{top:0}.elfinder-cwd-view-list .elfinder-symlink{bottom:-4px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-perms{left:8px}.elfinder-rtl .elfinder-cwd-view-list .elfinder-perms{right:-8px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-lock{left:10px}.elfinder-rtl .elfinder-cwd-view-list .elfinder-lock{right:-10px}.elfinder-ltr .elfinder-cwd-view-list .elfinder-symlink{left:-7px}.elfinder-rtl .elfinder-cwd-view-list .elfinder-symlink{right: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}.elfinder-cwd-view-list .elfinder-cwd-icon:after,.elfinder-cwd-view-list .elfinder-cwd-icon:before{content:none}.elfinder-cwd-view-list thead td .ui-resizable-handle{height:100%;top:6px}.elfinder-touch .elfinder-cwd-view-list thead td .ui-resizable-handle{top:-4px;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}.elfinder-cwd-message-board{position:-webkit-sticky;position:sticky;width:100%;height:calc(100% - .01px);top:0;left:0;margin:0;padding:0;pointer-events:none;background-color:transparent}.elfinder-cwd-wrapper-trash .elfinder-cwd-message-board{background-image:url(../img/trashmesh.png)}.elfinder-cwd-message-board .elfinder-cwd-trash{position:absolute;bottom:0;font-size:30px;width:100%;text-align:right;display:none}.elfinder-rtl .elfinder-cwd-message-board .elfinder-cwd-trash{text-align:left}.elfinder-mobile .elfinder-cwd-message-board .elfinder-cwd-trash{font-size:20px}.elfinder-cwd-wrapper-trash .elfinder-cwd-message-board .elfinder-cwd-trash{display:block;opacity:.3}.elfinder-cwd-message-board .elfinder-cwd-expires{position:absolute;bottom:0;font-size:24px;width:100%;text-align:right;opacity:.25}.elfinder-rtl .elfinder-cwd-message-board .elfinder-cwd-expires{text-align:left}.elfinder-mobile .elfinder-cwd-message-board .elfinder-cwd-expires{font-size:20px}.std42-dialog{padding:0;position:absolute;left:auto;right:auto;box-sizing:border-box}.std42-dialog.elfinder-dialog-minimized{overFlow:hidden;position:relative;float:left;width:auto;cursor:pointer}.elfinder-rtl .std42-dialog.elfinder-dialog-minimized{float:right}.std42-dialog input{border:1px solid}.std42-dialog .ui-dialog-titlebar{border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent;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{-moz-transform:scale(1.2);zoom:1.2;padding-left:6px;padding-right:6px;height:24px}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button-right{float:right}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right{left:10px;right:-10px}.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon{width:17px;height:17px;border-width:1px;opacity:.7;filter:Alpha(Opacity=70);-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon{opacity:.5;filter:Alpha(Opacity=50)}.std42-dialog.elfinder-dialog-minimized .ui-dialog-titlebar .elfinder-titlebar-button .ui-icon{opacity:1;filter:Alpha(Opacity=100)}.elfinder-spinner{width:14px;height:14px;background:url(../img/spinner-mini.gif) center center no-repeat;margin:0 5px;display:inline-block;vertical-align:middle}.elfinder-ltr .elfinder-info-tb span,.elfinder-ltr .elfinder-spinner,.elfinder-ltr .elfinder-spinner-text{float:left}.elfinder-rtl .elfinder-info-tb span,.elfinder-rtl .elfinder-spinner,.elfinder-rtl .elfinder-spinner-text{float:right}.elfinder-touch .std42-dialog.ui-dialog:not(ui-resizable-disabled) .ui-resizable-se{width:12px;height:12px;-moz-transform-origin:bottom right;-moz-transform:scale(1.5);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}.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:.2em 0 0 .4em;padding:.2em;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}.std42-dialog select{border:1px solid #ccc}.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-error .elfinder-err-var{word-break:break-all}.elfinder-dialog-notify{top:36px;width:280px}.elfinder-ltr .elfinder-dialog-notify{right:12px}.elfinder-rtl .elfinder-dialog-notify{left:12px}.elfinder-dialog-notify .ui-dialog-titlebar{height:5px;overflow:hidden}.elfinder.elfinder-touch>.elfinder-dialog-notify .ui-dialog-titlebar{height:10px}.elfinder>.elfinder-dialog-notify .ui-dialog-titlebar .elfinder-titlebar-button{top:2px;left:-18px;right:18px}.elfinder.elfinder-touch>.elfinder-dialog-notify .ui-dialog-titlebar .elfinder-titlebar-button{top:4px}.elfinder>.elfinder-dialog-notify .ui-dialog-titlebar .elfinder-titlebar-button.elfinder-titlebar-button-right{left:18px;right:-18px}.ui-dialog-titlebar .elfinder-ui-progressbar{position:absolute;top:17px}.elfinder-touch .ui-dialog-titlebar .elfinder-ui-progressbar{top:26px}.elfinder-dialog-notify.elfinder-titlebar-button-hide .ui-dialog-titlebar-close,.elfinder-rm-title+br{display:none}.elfinder-dialog-notify.elfinder-dialog-minimized.elfinder-titlebar-button-hide .ui-dialog-titlebar span.elfinder-dialog-title{max-width:initial}.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-notify-cancel{position:relative;top:-18px;right:calc(-50% + 15px)}.elfinder-notify-cancel .ui-icon-close{width:18px;height:18px;border-radius:9px;border:none;background-position:-80px -128px;cursor:pointer}.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-chkcontent,.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,.elfinder-dialog-confirm-encoding{padding:0 1em;margin:0}.elfinder-ltr .elfinder-dialog-confirm-applyall,.elfinder-ltr .elfinder-dialog-confirm-encoding{text-align:left}.elfinder-rtl .elfinder-dialog-confirm-applyall,.elfinder-rtl .elfinder-dialog-confirm-encoding{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;width:100%}.elfinder-info-tb td{white-space:pre-wrap;padding:2px}.elfinder-info-tb td.elfinder-info-label{white-space:nowrap}.elfinder-info-tb td.elfinder-info-hash{display:inline-block;word-break:break-all;max-width:32ch}.elfinder-rtl .elfinder-info-tb tr td:first-child{text-align:left}.elfinder-info-tb a{outline:none;text-decoration:underline}.elfinder-info-tb a:hover{text-decoration:none}.elfinder-netmount-tb{margin:0 auto}.elfinder-netmount-tb .elfinder-button-icon,.elfinder-netmount-tb select{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;width:100%;opacity:0;filter:Alpha(Opacity=0)}.elfinder-upload-dialog-wrapper .ui-button form input{padding:50px 0 0;font-size:3em;width:100%}.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-font-mono{font-family:"Ricty Diminished","Myrica M",Consolas,"Courier New",Courier,Monaco,monospace;font-size:1.1em}.elfinder-contextmenu .elfinder-contextmenu-item span{font-size:.72em}.elfinder-cwd-view-icons .elfinder-cwd-filename,.elfinder-cwd-view-list td,.elfinder-statusbar div{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{font-size:.7em;font-weight:400}.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 .elfinder-navdock{box-sizing:border-box;width:230px;height:auto;position:absolute;bottom:0;overflow:auto}.elfinder-navdock .ui-resizable-n{top:0;height:20px}.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,.elfinder-touch .elfinder-quicklook-titlebar-icon.elfinder-titlebar-button-right .ui-icon{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,.elfinder-navbar-icon{position:absolute;top:50%;margin-top:-8px;background-repeat:no-repeat}.elfinder-navbar-arrow{display:none;width:12px;height:14px;background-image:url(../img/arrows-normal.png)}.elfinder-ltr .elfinder-navbar-arrow{left:0}.elfinder-rtl .elfinder-navbar-arrow{right:0}.elfinder-touch .elfinder-navbar-arrow{-moz-transform-origin:top left;-moz-transform:scale(1.4);zoom: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-subtree-chksubdir .elfinder-navbar-arrow{opacity:.25;filter:Alpha(Opacity=25)}.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;background-image:url(../img/toolbar.png);background-position:0 -16px}.elfinder-ltr .elfinder-navbar-icon{left:14px}.elfinder-rtl .elfinder-navbar-icon{right:14px}.elfinder-places .elfinder-navbar-root .elfinder-navbar-icon{background-position:0 -704px}.elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-trash .elfinder-navbar-icon,.elfinder-tree .elfinder-navbar-root-zip .elfinder-navbar-icon{background-position:0 0;background-size:contain}.elfinder-tree .elfinder-navbar-root-local .elfinder-navbar-icon{background-image:url(../img/volume_icon_local.svg);background-image:url(../img/volume_icon_local.png) \9}.elfinder-tree .elfinder-navbar-root-trash .elfinder-navbar-icon{background-image:url(../img/volume_icon_trash.svg);background-image:url(../img/volume_icon_trash.png) \9}.elfinder-tree .elfinder-navbar-root-ftp .elfinder-navbar-icon{background-image:url(../img/volume_icon_ftp.svg);background-image:url(../img/volume_icon_ftp.png) \9}.elfinder-tree .elfinder-navbar-root-sql .elfinder-navbar-icon{background-image:url(../img/volume_icon_sql.svg);background-image:url(../img/volume_icon_sql.png) \9}.elfinder-tree .elfinder-navbar-root-dropbox .elfinder-navbar-icon{background-image:url(../img/volume_icon_dropbox.svg);background-image:url(../img/volume_icon_dropbox.png) \9}.elfinder-tree .elfinder-navbar-root-googledrive .elfinder-navbar-icon{background-image:url(../img/volume_icon_googledrive.svg);background-image:url(../img/volume_icon_googledrive.png) \9}.elfinder-tree .elfinder-navbar-root-onedrive .elfinder-navbar-icon{background-image:url(../img/volume_icon_onedrive.svg);background-image:url(../img/volume_icon_onedrive.png) \9}.elfinder-tree .elfinder-navbar-root-box .elfinder-navbar-icon{background-image:url(../img/volume_icon_box.svg);background-image:url(../img/volume_icon_box.png) \9}.elfinder-tree .elfinder-navbar-root-zip .elfinder-navbar-icon{background-image:url(../img/volume_icon_zip.svg);background-image:url(../img/volume_icon_zip.png) \9}.elfinder-tree .elfinder-navbar-root-network .elfinder-navbar-icon{background-image:url(../img/volume_icon_network.svg);background-image:url(../img/volume_icon_network.png) \9}.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-tree .elfinder-spinner{position:absolute;top:50%;margin:-7px 0 0}.elfinder-ltr .elfinder-tree .elfinder-spinner{left:0;margin-left:-2px}.elfinder-rtl .elfinder-tree .elfinder-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;transform:scale(.8)}.elfinder-rtl .elfinder-navbar .elfinder-perms{right:20px;transform:scale(.8)}.elfinder-ltr .elfinder-navbar .elfinder-lock{left:20px;transform:scale(.8)}.elfinder-rtl .elfinder-navbar .elfinder-lock{right:20px;transform:scale(.8)}.elfinder-ltr .elfinder-navbar .elfinder-symlink{left:8px;transform:scale(.8)}.elfinder-rtl .elfinder-navbar .elfinder-symlink{right:8px;transform:scale(.8)}.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-navbar-pager{width:100%;box-sizing:border-box;padding-top:3px;padding-bottom:3px}.elfinder-touch .elfinder-navbar-pager{padding-top:10px;padding-bottom:10px}.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;-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;padding:20px 0 40px}.elfinder-navdock .elfinder-quicklook{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;font-size:90%;overflow:auto}.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{-moz-transform-origin:bottom right;-moz-transform:scale(1.5);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-cover.elfinder-quicklook-coverbg{background-color:#fff;opacity:.000001;filter:Alpha(Opacity=.0001)}.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;border:none;line-height:1.2}.elfinder-navdock .elfinder-quicklook-titlebar{-moz-border-radius-topleft:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;-moz-border-radius-topright:0;-webkit-border-top-right-radius:0;border-top-right-radius:0;cursor:default}.elfinder-touch .elfinder-quicklook-titlebar{height:30px}.elfinder-quicklook-title{display:inline-block;white-space:nowrap;overflow:hidden}.elfinder-touch .elfinder-quicklook-title{padding:8px 0}.elfinder-quicklook-titlebar-icon{position:absolute;left:4px;top:50%;margin-top:-8px;height:16px;border:none}.elfinder-touch .elfinder-quicklook-titlebar-icon{height:22px}.elfinder-quicklook-titlebar-icon .ui-icon{position:relative;margin:-9px 3px 0 0;cursor:pointer;border-radius:10px;border:1px solid;opacity:.7;filter:Alpha(Opacity=70)}.elfinder-quicklook-titlebar-icon .ui-icon.ui-icon-closethick{padding-left:1px}.elfinder-mobile .elfinder-quicklook-titlebar-icon .ui-icon{opacity:.6;filter:Alpha(Opacity=60)}.elfinder-touch .elfinder-quicklook-titlebar-icon .ui-icon{margin-top:-5px}.elfinder-quicklook-titlebar-icon.elfinder-titlebar-button-right{left:auto;right:4px;direction:rtl}.elfinder-quicklook-titlebar-icon.elfinder-titlebar-button-right .ui-icon{margin:-9px 0 0 3px}.elfinder-touch .elfinder-quicklook-titlebar .ui-icon{-moz-transform-origin:center center;-moz-transform:scale(1.2);zoom:1.2}.elfinder-touch .elfinder-quicklook-titlebar-icon .ui-icon{margin-right:10px}.elfinder-quicklook-preview{overflow:hidden;position:relative;border:0 solid;border-left:1px solid transparent;border-right:1px solid transparent;height:100%}.elfinder-navdock .elfinder-quicklook-preview{border-left:0;border-right:0}.elfinder-quicklook-preview.elfinder-overflow-auto{overflow:auto;-webkit-overflow-scrolling:touch}.elfinder-quicklook-info-wrapper{display:table;position:absolute;width:100%;height:100%;height:calc(100% - 80px);left:0;top:20px}.elfinder-navdock .elfinder-quicklook-info-wrapper{height:calc(100% - 20px)}.elfinder-quicklook-info{display:table-cell;vertical-align:middle}.elfinder-ltr .elfinder-quicklook-info{padding:0 12px 0 112px}.elfinder-rtl .elfinder-quicklook-info{padding:0 112px 0 12px}.elfinder-ltr .elfinder-navdock .elfinder-quicklook-info{padding:0 0 0 80px}.elfinder-rtl .elfinder-navdock .elfinder-quicklook-info{padding:0 80px 0 0}.elfinder-quicklook-info .elfinder-quicklook-info-data:first-child{color:#fff;font-weight:700;padding-bottom:.5em}.elfinder-quicklook-info-data{clear:both;padding-bottom:.2em;color:#fff}.elfinder-quicklook-info-progress{width:0;height:4px;border-radius:2px}.elfinder-quicklook .elfinder-cwd-icon{position:absolute;left:32px;top:50%;margin-top:-20px}.elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon{left:16px}.elfinder-rtl .elfinder-quicklook .elfinder-cwd-icon{left:auto;right:32px}.elfinder-rtl .elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon{right:6px}.elfinder-quicklook .elfinder-cwd-icon:before{top:-10px}.elfinder-ltr .elfinder-quicklook .elfinder-cwd-icon:before{left:-20px}.elfinder-ltr .elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon:before{left:-14px}.elfinder-ltr .elfinder-quicklook .elfinder-cwd-icon:after{left:-42px}.elfinder-ltr .elfinder-navdock .elfinder-quicklook .elfinder-cwd-icon:after{left:-12px}.elfinder-rtl .elfinder-quicklook .elfinder-cwd-icon:before{left:auto;right:40px}.elfinder-rtl .elfinder-quicklook .elfinder-cwd-icon:after{left:auto;right:42px}.elfinder-quicklook-preview>div>canvas,.elfinder-quicklook-preview>img{display:block;margin: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-encoding{height:40px}.elfinder-quicklook-encoding>select{color:#fff;background:#000;border:0;font-size:12px;max-width:100px;display:inline-block;position:relative;top:6px;left:5px}.elfinder-navdock .elfinder-quicklook .elfinder-quicklook-encoding,.elfinder-statusbar:after,.elfinder-statusbar:before{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:90%}.elfinder-quicklook-preview-archive-wrapper strong{padding:0 5px}pre.elfinder-quicklook-preview-text,pre.elfinder-quicklook-preview-text.prettyprint{width:auto;height:auto;margin:0;padding:3px 9px;border:none;overflow:visible;-o-tab-size:4;-moz-tab-size:4;tab-size:4}.elfinder-quicklook-preview-charsleft hr{border:none;border-top:dashed 1px}.elfinder-quicklook-preview-charsleft span{font-size:90%;font-style:italic;cursor:pointer}.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-quicklook-preview .vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:12pt;padding:0;color:#fff}.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{display:flex;justify-content:space-between;cursor:default;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-path,.elfinder-statusbar span{overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.elfinder-statusbar span{vertical-align:bottom}.elfinder-statusbar span.elfinder-path-other{flex-shrink:0;text-overflow:clip;-o-text-overflow:clip}.elfinder-statusbar span.ui-state-active,.elfinder-statusbar span.ui-state-hover{border:none}.elfinder-statusbar span.elfinder-path-cwd{cursor:default}.elfinder-path{display:flex;order:1;flex-grow:1;cursor:pointer;white-space:nowrap;max-width:30%\9}.elfinder-ltr .elfinder-path{text-align:left;float:left\9}.elfinder-rtl .elfinder-path{text-align:right;float:right\9}.elfinder-workzone-path{position:relative}.elfinder-workzone-path .elfinder-path{position:relative;font-size:.75em;font-weight:400;float:none;max-width:none;overflow:hidden;overflow-x:hidden;text-overflow:initial;-o-text-overflow:initial}.elfinder-mobile .elfinder-workzone-path .elfinder-path{overflow:auto;overflow-x:scroll}.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{order:3;flex-grow:1;overflow:hidden;white-space:nowrap}.elfinder-ltr .elfinder-stat-size{text-align:right;float:right\9}.elfinder-rtl .elfinder-stat-size{text-align:left;float:left\9}.elfinder-stat-selected{order:2;margin:0 .5em;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 .elfinder-toast>.toast-info button.ui-button{background-color:#046580;color:#fff}.elfinder .elfinder-toast>.toast-info button.ui-button.ui-state-hover{background-color:#7dc6db;color:#046580}.elfinder .elfinder-toast>.toast-warning button.ui-button{background-color:#dd8c1a;color:#fff}.elfinder .elfinder-toast>.toast-warning button.ui-button.ui-state-hover{background-color:#e7ae5e;color:#422a07}.elfinder-toolbar{padding:4px 0 3px;border-left:0 solid transparent;border-top:0 solid transparent;border-right:0 solid transparent;max-height:50%;overflow-y:auto}.elfinder-buttonset{margin:1px 4px;float:left;background:0 0;padding:0;overflow:hidden}.elfinder .elfinder-button{min-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;line-height:1;cursor:default}.elfinder-rtl .elfinder-button{float:right}.elfinder-touch .elfinder-button{min-width:20px;height:20px}.elfinder .ui-icon-search{cursor:pointer}.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-rtl .elfinder-toolbar-button-separator{float:right}.elfinder-touch .elfinder-toolbar-button-separator{height:28px}.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{transform:scale(1.25);transform-origin:top left}.elfinder-rtl.elfinder-touch .elfinder-button-icon{transform-origin:top right}.elfinder-touch .elfinder-button-text{transform:translate(3px,3px);top:-5px}.elfinder-rtl.elfinder-touch .elfinder-button-text{transform:translate(-3px,3px)}.elfinder-touch .elfinder-button-icon.elfinder-contextmenu-extra-icon{transform:scale(2);transform-origin:12px 8px}.elfinder-rtl.elfinder-touch .elfinder-button-icon.elfinder-contextmenu-extra-icon{transform-origin:4px 8px}.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-opendir{background-position:0 -32px}.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 -832px}.elfinder-button-icon-trash{background-position:0 -224px}.elfinder-button-icon-restore{background-position:0 -816px}.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-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-button-icon-empty{background-position:0 -848px}.elfinder-button-icon-undo{background-position:0 -864px}.elfinder-button-icon-redo{background-position:0 -880px}.elfinder-button-icon-preference{background-position:0 -896px}.elfinder-button-icon-mkdirin{background-position:0 -912px}.elfinder-button-icon-selectall{background-position:0 -928px}.elfinder-button-icon-selectnone{background-position:0 -944px}.elfinder-button-icon-selectinvert{background-position:0 -960px}.elfinder-button-icon-opennew{background-position:0 -976px}.elfinder-button-icon-hide{background-position:0 -992px}.elfinder-button-icon-text{background-position:0 -1008px}.elfinder-rtl .elfinder-button-icon-back,.elfinder-rtl .elfinder-button-icon-forward,.elfinder-rtl .elfinder-button-icon-getfile,.elfinder-rtl .elfinder-button-icon-help,.elfinder-rtl .elfinder-button-icon-redo,.elfinder-rtl .elfinder-button-icon-rename,.elfinder-rtl .elfinder-button-icon-search,.elfinder-rtl .elfinder-button-icon-undo,.elfinder-rtl .elfinder-button-icon-view-list,.elfinder-rtl .ui-icon-search{-ms-transform:scale(-1,1);-webkit-transform:scale(-1,1);transform:scale(-1,1)}.elfinder-rtl.elfinder-touch .elfinder-button-icon-back,.elfinder-rtl.elfinder-touch .elfinder-button-icon-forward,.elfinder-rtl.elfinder-touch .elfinder-button-icon-getfile,.elfinder-rtl.elfinder-touch .elfinder-button-icon-help,.elfinder-rtl.elfinder-touch .elfinder-button-icon-redo,.elfinder-rtl.elfinder-touch .elfinder-button-icon-rename,.elfinder-rtl.elfinder-touch .elfinder-button-icon-search,.elfinder-rtl.elfinder-touch .elfinder-button-icon-undo,.elfinder-rtl.elfinder-touch .elfinder-button-icon-view-list,.elfinder-rtl.elfinder-touch .ui-icon-search{-ms-transform:scale(-1.25,1.25) translateX(16px);-webkit-transform:scale(-1.25,1.25) translateX(16px);transform:scale(-1.25,1.25) translateX(16px)}.elfinder .elfinder-menubutton{overflow:visible}.elfinder-button-icon-spinner{background:url(../img/spinner-mini.gif) center center no-repeat}.elfinder-button-menu{position:absolute;margin-top:24px;padding:3px 0;overflow-y:auto}.elfinder-touch .elfinder-button-menu{margin-top:30px}.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;width:70px;overflow:visible}.elfinder .elfinder-button-search.ui-state-active{width:220px}.elfinder .elfinder-button-search-menu{font-size:8pt;text-align:center;width:auto;min-width:180px;position:absolute;top:30px;padding-right:5px;padding-left:5px}.elfinder-ltr .elfinder-button-search-menu{right:22px;left:auto}.elfinder-rtl .elfinder-button-search-menu{right:auto;left:22px}.elfinder-touch .elfinder-button-search-menu{top:34px}.elfinder .elfinder-button-search-menu div{margin:5px auto;display:table}.elfinder .elfinder-button-search-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-rtl .ui-controlgroup>.ui-controlgroup-item{float:right}.elfinder-button-search input[type=text]{box-sizing:border-box;width:100%;height:26px;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:30px;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-menu .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%)} \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/css/theme.css b/public/packages/barryvdh/elfinder/css/theme.css new file mode 100644 index 00000000..dde05359 --- /dev/null +++ b/public/packages/barryvdh/elfinder/css/theme.css @@ -0,0 +1,430 @@ +/** + * MacOS X like theme for elFinder. + * Required jquery ui "smoothness" theme. + * + * @author Dmitry (dio) Levashov + **/ + +/* scrollbar for Chrome and Safari */ +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar { + width: 10px; + height: 10px; +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-track { + border-radius: 10px; + box-shadow: inset 0 0 6px rgba(0, 0, 0, .1); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-thumb { + background-color: rgba(0, 0, 50, 0.08); + border-radius: 10px; + box-shadow:0 0 0 1px rgba(255, 255, 255, .3); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-thumb:hover { + background-color: rgba(0, 0, 50, 0.16); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-thumb:active { + background-color: rgba(0, 0, 50, 0.24); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-corner { + background-color: transparent; +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-button { + background-color: transparent; + width: 10px; + height: 10px; + border: 5px solid transparent; +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-button:hover { + border: 5px solid rgba(0, 0, 50, 0.08); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-button:active { + border: 5px solid rgba(0, 0, 50, 0.5); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-button:single-button:vertical:decrement { + border-bottom: 8px solid rgba(0, 0, 50, 0.3); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-button:single-button:vertical:increment { + border-top: 8px solid rgba(0, 0, 50, 0.3); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-button:single-button:horizontal:decrement { + border-right: 8px solid rgba(0, 0, 50, 0.3); +} + +.elfinder:not(.elfinder-mobile) *::-webkit-scrollbar-button:single-button:horizontal:increment { + border-left: 8px solid rgba(0, 0, 50, 0.3); +} + +/* input textarea */ +.elfinder input, +.elfinder textarea { + color: #000; + background-color: #FFF; + border-color: #ccc; +} + +/* dialogs */ +.std42-dialog, .std42-dialog .ui-widget-content { + background-color: #ededed; + background-image: none; + background-clip: content-box; +} + +.std42-dialog.elfinder-bg-translucent { + background-color: #fff; + background-color: rgba(255, 255, 255, 0.9); +} + +.std42-dialog.elfinder-bg-translucent .ui-widget-content { + background-color: transparent; +} + +.elfinder-quicklook-title { + color: #fff; +} + +.elfinder-quicklook-titlebar-icon { + background-color: transparent; + background-image: none; +} + +.elfinder-quicklook-titlebar-icon .ui-icon { + background-color: #d4d4d4; + border-color: #8a8a8a; +} + +.elfinder-quicklook-info-progress { + background-color: gray; +} + +.std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:hover .ui-icon, +.elfinder-mobile .std42-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close .ui-icon, +.elfinder-quicklook-titlebar-icon .ui-icon.elfinder-icon-close:hover, +.elfinder-mobile .elfinder-quicklook-titlebar-icon .ui-icon.elfinder-icon-close { + background-color: #ff6252; + border-color: #e5695d; + background-image: url("../img/ui-icons_ffffff_256x240.png"); +} + +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize:hover .ui-icon, +.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-minimize .ui-icon, +.elfinder-quicklook-titlebar-icon .ui-icon.elfinder-icon-minimize:hover, +.elfinder-mobile .elfinder-quicklook-titlebar-icon .ui-icon.elfinder-icon-minimize { + background-color: #ffbc00; + border-color: #e3a40b; + background-image: url("../img/ui-icons_ffffff_256x240.png"); +} + +.std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full:hover .ui-icon, +.elfinder-mobile .std42-dialog .ui-dialog-titlebar .elfinder-titlebar-full .ui-icon, +.elfinder-quicklook-titlebar-icon .ui-icon.elfinder-icon-full:hover, +.elfinder-mobile .elfinder-quicklook-titlebar-icon .ui-icon.elfinder-icon-full { + background-color: #26c82f; + border-color: #13ae10; + background-image: url("../img/ui-icons_ffffff_256x240.png"); +} + +.std42-dialog .elfinder-help, +.std42-dialog .elfinder-help .ui-widget-content { + background: #fff; +} + +/* navbar */ +.elfinder .elfinder-navbar { + background: #dde4eb; +} + +.elfinder-navbar .ui-state-hover { + color: #000; + background-color: #edf1f4; + border-color: #bdcbd8; +} + +.elfinder-navbar .ui-droppable-hover { + background: transparent; +} + +.elfinder-navbar .ui-state-active { + background: #3875d7; + border-color: #3875d7; + color: #fff; +} + +.elfinder-navbar .elfinder-droppable-active { + background: #A7C6E5; +} + +/* disabled elfinder */ +.elfinder-disabled .elfinder-navbar .ui-state-active { + background: #dadada; + border-color: #aaa; + color: #777; +} + +/* workzone */ +.elfinder-workzone { + background: #fff; +} + +/* current directory */ +/* Is in trash */ +.elfinder-cwd-wrapper.elfinder-cwd-wrapper-trash { + background-color: #f0f0f0; +} + +/* selected file in "icons" view */ +.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover, +.elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-active { + background: #ccc; +} + +/* type badge in "icons" view */ +/* default */ +.elfinder-cwd-icon:before { + color: white; + background-color: #798da7; +} + +/* type */ +.elfinder-cwd-icon-text:before { + background-color: #6f99e6 +} + +.elfinder-cwd-icon-image:before { + background-color: #2ea26c +} + +.elfinder-cwd-icon-audio:before { + background-color: #7bad2a +} + +.elfinder-cwd-icon-video:before { + background-color: #322aad +} + +/* subtype */ +.elfinder-cwd-icon-x-empty:before, +.elfinder-cwd-icon-plain:before { + background-color: #719be6 +} + +.elfinder-cwd-icon-rtf:before, +.elfinder-cwd-icon-rtfd:before { + background-color: #83aae7 +} + +.elfinder-cwd-icon-pdf:before { + background-color: #db7424 +} + +.elfinder-cwd-icon-html:before { + background-color: #82bc12 +} + +.elfinder-cwd-icon-xml:before, +.elfinder-cwd-icon-css:before { + background-color: #7c7c7c +} + +.elfinder-cwd-icon-x-shockwave-flash:before { + background-color: #f43a36 +} + +.elfinder-cwd-icon-zip:before, +.elfinder-cwd-icon-x-zip:before, +.elfinder-cwd-icon-x-xz:before, +.elfinder-cwd-icon-x-7z-compressed:before, +.elfinder-cwd-icon-x-gzip:before, +.elfinder-cwd-icon-x-tar:before, +.elfinder-cwd-icon-x-bzip:before, +.elfinder-cwd-icon-x-bzip2:before, +.elfinder-cwd-icon-x-rar:before, +.elfinder-cwd-icon-x-rar-compressed:before { + background-color: #97638e +} + +.elfinder-cwd-icon-javascript:before, +.elfinder-cwd-icon-x-javascript:before, +.elfinder-cwd-icon-x-perl:before, +.elfinder-cwd-icon-x-python:before, +.elfinder-cwd-icon-x-ruby:before, +.elfinder-cwd-icon-x-sh:before, +.elfinder-cwd-icon-x-shellscript:before, +.elfinder-cwd-icon-x-c:before, +.elfinder-cwd-icon-x-csrc:before, +.elfinder-cwd-icon-x-chdr:before, +.elfinder-cwd-icon-x-c--:before, +.elfinder-cwd-icon-x-c--src:before, +.elfinder-cwd-icon-x-c--hdr:before, +.elfinder-cwd-icon-x-java:before, +.elfinder-cwd-icon-x-java-source:before, +.elfinder-cwd-icon-x-php:before { + background-color: #7c607c +} + +.elfinder-cwd-icon-msword:before, +.elfinder-cwd-icon-vnd-ms-office:before, +.elfinder-cwd-icon-vnd-ms-word:before, +.elfinder-cwd-icon-vnd-ms-word-document-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-word-template-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-document:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-wordprocessingml-template:before { + background-color: #2b569a +} + +.elfinder-cwd-icon-ms-excel:before, +.elfinder-cwd-icon-vnd-ms-excel:before, +.elfinder-cwd-icon-vnd-ms-excel-addin-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-excel-sheet-binary-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-excel-sheet-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-excel-template-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-sheet:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-spreadsheetml-template:before { + background-color: #107b10 +} + +.elfinder-cwd-icon-vnd-ms-powerpoint:before, +.elfinder-cwd-icon-vnd-ms-powerpoint-addin-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-powerpoint-presentation-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-powerpoint-slide-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-powerpoint-slideshow-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-ms-powerpoint-template-macroEnabled-12:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-presentation:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slide:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-slideshow:before, +.elfinder-cwd-icon-vnd-openxmlformats-officedocument-presentationml-template:before { + background-color: #d24625 +} + +.elfinder-cwd-icon-vnd-oasis-opendocument-chart:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-database:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-formula:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-graphics:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-graphics-template:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-image:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-presentation:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-presentation-template:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-spreadsheet-template:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-text:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-master:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-template:before, +.elfinder-cwd-icon-vnd-oasis-opendocument-text-web:before, +.elfinder-cwd-icon-vnd-openofficeorg-extension:before { + background-color: #00a500 +} + +.elfinder-cwd-icon-postscript:before { + background-color: #ff5722 +} + +/* list view*/ +.elfinder-cwd table thead td.ui-state-hover { + background: #ddd; +} + +.elfinder-cwd table tr:nth-child(odd) { + background-color: #edf3fe; +} + +.elfinder-cwd table tr { + border: 1px solid transparent; + border-top: 1px solid #fff; +} + +.elfinder-cwd .elfinder-droppable-active td { + background: #A7C6E5; +} + +.elfinder-cwd.elfinder-table-header-sticky table { + border-top-color: #fff; +} + +.elfinder-droppable-active .elfinder-cwd.elfinder-table-header-sticky table { + border-top-color: #A7C6E5; +} + +/* common selected background/color */ +.elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, +.elfinder-cwd table td.ui-state-hover, +.elfinder-button-menu .ui-state-hover { + background: #3875d7; + color: #fff; +} + +/* disabled elfinder */ +.elfinder-disabled .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, +.elfinder-disabled .elfinder-cwd table td.ui-state-hover { + background: #dadada; +} + +/* statusbar */ +.elfinder .elfinder-statusbar { + color: #555; +} + +.elfinder .elfinder-statusbar a { + text-decoration: none; + color: #555; +} + +/* contextmenu */ +.elfinder-contextmenu .ui-state-active { + background: #6293df; + color: #fff; +} + +.elfinder-contextmenu .ui-state-hover { + background: #3875d7; + color: #fff; +} + +.elfinder-contextmenu .ui-state-hover .elfinder-contextmenu-arrow { + background-image: url('../img/arrows-active.png'); +} + +/* dialog */ +.elfinder .ui-dialog input:text.ui-state-hover, +.elfinder .ui-dialog textarea.ui-state-hover { + background-image: none; + background-color: inherit; +} + +.elfinder-notify-cancel .elfinder-notify-button { + background-color: #707070; + background-image: url("../img/ui-icons_ffffff_256x240.png"); +} + +.elfinder-notify-cancel .elfinder-notify-button.ui-state-hover { + background-color: #aaa; +} + +/* edit dialog */ +.elfinder-dialog-edit select.elfinder-edit-changed { + border-bottom: 2px solid #13ae10; +} + +/* tooltip */ +.ui-widget-content.elfinder-ui-tooltip { + background-color: #fff; +} + +.elfinder-ui-tooltip.ui-widget-shadow, +.elfinder .elfinder-ui-tooltip.ui-widget-shadow { + box-shadow: 2px 6px 4px -4px #cecdcd; +} + +/* progressbar */ +.elfinder-ui-progressbar { + background-color: #419bf3; +} \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/arrows-active.png b/public/packages/barryvdh/elfinder/img/arrows-active.png new file mode 100644 index 00000000..eab3fda9 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/arrows-active.png differ diff --git a/public/packages/barryvdh/elfinder/img/arrows-normal.png b/public/packages/barryvdh/elfinder/img/arrows-normal.png new file mode 100644 index 00000000..8bdeb5ab Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/arrows-normal.png differ diff --git a/public/packages/barryvdh/elfinder/img/crop.gif b/public/packages/barryvdh/elfinder/img/crop.gif new file mode 100644 index 00000000..cc55e8c0 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/crop.gif differ diff --git a/public/packages/barryvdh/elfinder/img/dialogs.png b/public/packages/barryvdh/elfinder/img/dialogs.png new file mode 100644 index 00000000..32495536 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/dialogs.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_aceeditor.png b/public/packages/barryvdh/elfinder/img/edit_aceeditor.png new file mode 100644 index 00000000..e8d5ce6c Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_aceeditor.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_ckeditor.png b/public/packages/barryvdh/elfinder/img/edit_ckeditor.png new file mode 100644 index 00000000..be7e076c Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_ckeditor.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_ckeditor5.png b/public/packages/barryvdh/elfinder/img/edit_ckeditor5.png new file mode 100644 index 00000000..9bb20be2 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_ckeditor5.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_codemirror.png b/public/packages/barryvdh/elfinder/img/edit_codemirror.png new file mode 100644 index 00000000..4defa576 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_codemirror.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_creativecloud.png b/public/packages/barryvdh/elfinder/img/edit_creativecloud.png new file mode 100644 index 00000000..ab67ad94 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_creativecloud.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_onlineconvert.png b/public/packages/barryvdh/elfinder/img/edit_onlineconvert.png new file mode 100644 index 00000000..e90d3cf2 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_onlineconvert.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_pixlreditor.png b/public/packages/barryvdh/elfinder/img/edit_pixlreditor.png new file mode 100644 index 00000000..d2e30956 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_pixlreditor.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_pixlrexpress.png b/public/packages/barryvdh/elfinder/img/edit_pixlrexpress.png new file mode 100644 index 00000000..2447ed8d Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_pixlrexpress.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_simplemde.png b/public/packages/barryvdh/elfinder/img/edit_simplemde.png new file mode 100644 index 00000000..0dc676fb Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_simplemde.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_tinymce.png b/public/packages/barryvdh/elfinder/img/edit_tinymce.png new file mode 100644 index 00000000..cc654a1a Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_tinymce.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_tuiimgedit.png b/public/packages/barryvdh/elfinder/img/edit_tuiimgedit.png new file mode 100644 index 00000000..f60b60ae Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_tuiimgedit.png differ diff --git a/public/packages/barryvdh/elfinder/img/edit_zohooffice.png b/public/packages/barryvdh/elfinder/img/edit_zohooffice.png new file mode 100644 index 00000000..badecca5 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/edit_zohooffice.png differ diff --git a/public/packages/barryvdh/elfinder/img/editor-icons.png b/public/packages/barryvdh/elfinder/img/editor-icons.png new file mode 100644 index 00000000..8712b61a Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/editor-icons.png differ diff --git a/public/packages/barryvdh/elfinder/img/icons-big.png b/public/packages/barryvdh/elfinder/img/icons-big.png new file mode 100644 index 00000000..586f912f Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/icons-big.png differ diff --git a/public/packages/barryvdh/elfinder/img/icons-big.svg b/public/packages/barryvdh/elfinder/img/icons-big.svg new file mode 100644 index 00000000..56a3d766 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/icons-big.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/icons-small.png b/public/packages/barryvdh/elfinder/img/icons-small.png new file mode 100644 index 00000000..cca5d0c2 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/icons-small.png differ diff --git a/public/packages/barryvdh/elfinder/img/logo.png b/public/packages/barryvdh/elfinder/img/logo.png new file mode 100644 index 00000000..ea973a30 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/logo.png differ diff --git a/public/packages/barryvdh/elfinder/img/progress.gif b/public/packages/barryvdh/elfinder/img/progress.gif new file mode 100644 index 00000000..385fc57d Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/progress.gif differ diff --git a/public/packages/barryvdh/elfinder/img/quicklook-bg.png b/public/packages/barryvdh/elfinder/img/quicklook-bg.png new file mode 100644 index 00000000..3566b9ed Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/quicklook-bg.png differ diff --git a/public/packages/barryvdh/elfinder/img/quicklook-icons.png b/public/packages/barryvdh/elfinder/img/quicklook-icons.png new file mode 100644 index 00000000..cc66cb98 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/quicklook-icons.png differ diff --git a/public/packages/barryvdh/elfinder/img/resize.png b/public/packages/barryvdh/elfinder/img/resize.png new file mode 100644 index 00000000..25b1fea5 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/resize.png differ diff --git a/public/packages/barryvdh/elfinder/img/spinner-mini.gif b/public/packages/barryvdh/elfinder/img/spinner-mini.gif new file mode 100644 index 00000000..ea4f8f18 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/spinner-mini.gif differ diff --git a/public/packages/barryvdh/elfinder/img/toolbar.png b/public/packages/barryvdh/elfinder/img/toolbar.png new file mode 100644 index 00000000..e31cf94e Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/toolbar.png differ diff --git a/public/packages/barryvdh/elfinder/img/trashmesh.png b/public/packages/barryvdh/elfinder/img/trashmesh.png new file mode 100644 index 00000000..80a91c5b Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/trashmesh.png differ diff --git a/public/packages/barryvdh/elfinder/img/tui-icon-a.svg b/public/packages/barryvdh/elfinder/img/tui-icon-a.svg new file mode 100644 index 00000000..7e1efb81 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/tui-icon-a.svg @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/tui-icon-b.svg b/public/packages/barryvdh/elfinder/img/tui-icon-b.svg new file mode 100644 index 00000000..c1ea6256 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/tui-icon-b.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/tui-icon-c.svg b/public/packages/barryvdh/elfinder/img/tui-icon-c.svg new file mode 100644 index 00000000..8074cf08 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/tui-icon-c.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/tui-icon-d.svg b/public/packages/barryvdh/elfinder/img/tui-icon-d.svg new file mode 100644 index 00000000..52e6ffa3 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/tui-icon-d.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/ui-icons_ffffff_256x240.png b/public/packages/barryvdh/elfinder/img/ui-icons_ffffff_256x240.png new file mode 100644 index 00000000..5d1f1734 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/ui-icons_ffffff_256x240.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_box.png b/public/packages/barryvdh/elfinder/img/volume_icon_box.png new file mode 100644 index 00000000..52eaec2b Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_box.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_box.svg b/public/packages/barryvdh/elfinder/img/volume_icon_box.svg new file mode 100644 index 00000000..721787ef --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_box.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_dropbox.png b/public/packages/barryvdh/elfinder/img/volume_icon_dropbox.png new file mode 100644 index 00000000..db19ef1f Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_dropbox.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_dropbox.svg b/public/packages/barryvdh/elfinder/img/volume_icon_dropbox.svg new file mode 100644 index 00000000..38c09684 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_dropbox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_ftp.png b/public/packages/barryvdh/elfinder/img/volume_icon_ftp.png new file mode 100644 index 00000000..e0bf1296 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_ftp.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_ftp.svg b/public/packages/barryvdh/elfinder/img/volume_icon_ftp.svg new file mode 100644 index 00000000..eec35692 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_ftp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_googledrive.png b/public/packages/barryvdh/elfinder/img/volume_icon_googledrive.png new file mode 100644 index 00000000..92c5f1f1 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_googledrive.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_googledrive.svg b/public/packages/barryvdh/elfinder/img/volume_icon_googledrive.svg new file mode 100644 index 00000000..0f32b8b3 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_googledrive.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_local.png b/public/packages/barryvdh/elfinder/img/volume_icon_local.png new file mode 100644 index 00000000..b77d9a74 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_local.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_local.svg b/public/packages/barryvdh/elfinder/img/volume_icon_local.svg new file mode 100644 index 00000000..97d81fbf --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_local.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_network.png b/public/packages/barryvdh/elfinder/img/volume_icon_network.png new file mode 100644 index 00000000..caf1f60b Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_network.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_network.svg b/public/packages/barryvdh/elfinder/img/volume_icon_network.svg new file mode 100644 index 00000000..c2348c84 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_network.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_onedrive.png b/public/packages/barryvdh/elfinder/img/volume_icon_onedrive.png new file mode 100644 index 00000000..18b97cad Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_onedrive.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_onedrive.svg b/public/packages/barryvdh/elfinder/img/volume_icon_onedrive.svg new file mode 100644 index 00000000..4a69e474 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_onedrive.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_sql.png b/public/packages/barryvdh/elfinder/img/volume_icon_sql.png new file mode 100644 index 00000000..8ac2e537 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_sql.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_sql.svg b/public/packages/barryvdh/elfinder/img/volume_icon_sql.svg new file mode 100644 index 00000000..d02adc45 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_sql.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_trash.png b/public/packages/barryvdh/elfinder/img/volume_icon_trash.png new file mode 100644 index 00000000..551be426 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_trash.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_trash.svg b/public/packages/barryvdh/elfinder/img/volume_icon_trash.svg new file mode 100644 index 00000000..5a9bc573 --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_trash.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_zip.png b/public/packages/barryvdh/elfinder/img/volume_icon_zip.png new file mode 100644 index 00000000..39604ea6 Binary files /dev/null and b/public/packages/barryvdh/elfinder/img/volume_icon_zip.png differ diff --git a/public/packages/barryvdh/elfinder/img/volume_icon_zip.svg b/public/packages/barryvdh/elfinder/img/volume_icon_zip.svg new file mode 100644 index 00000000..022169eb --- /dev/null +++ b/public/packages/barryvdh/elfinder/img/volume_icon_zip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/js/elfinder.full.js b/public/packages/barryvdh/elfinder/js/elfinder.full.js new file mode 100644 index 00000000..84792061 --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/elfinder.full.js @@ -0,0 +1,36036 @@ +/*! + * elFinder - file manager for web + * Version 2.1.62 (2023-06-14) + * http://elfinder.org + * + * Copyright 2009-2023, Studio 42 + * Licensed under a 3-clauses BSD license + */ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery','jquery-ui'], factory); + } else if (typeof exports !== 'undefined') { + // CommonJS + var $, ui; + try { + $ = require('jquery'); + ui = require('jquery-ui'); + } catch (e) {} + module.exports = factory($, ui); + } else { + // Browser globals (Note: root is window) + factory(root.jQuery, root.jQuery.ui, true); + } +}(this, function($, _ui, toGlobal) { +toGlobal = toGlobal || false; + + +/* + * File: /js/elFinder.js + */ + +/** + * @class elFinder - file manager for web + * + * @author Dmitry (dio) Levashov + **/ +var elFinder = function(elm, opts, bootCallback) { + //this.time('load'); + var self = this, + + /** + * Objects array of jQuery.Deferred that calls before elFinder boot up + * + * @type Array + */ + dfrdsBeforeBootup = [], + + /** + * Plugin name to check for conflicts with bootstrap etc + * + * @type Array + **/ + conflictChecks = ['button', 'tooltip'], + + /** + * Node on which elfinder creating + * + * @type jQuery + **/ + node = $(elm), + + /** + * Object of events originally registered in this node + * + * @type Object + */ + prevEvents = $.extend(true, {}, $._data(node.get(0), 'events')), + + /** + * Store node contents. + * + * @see this.destroy + * @type jQuery + **/ + prevContent = $('
').append(node.contents()).attr('class', node.attr('class') || '').attr('style', node.attr('style') || ''), + + /** + * Instance ID. Required to get/set cookie + * + * @type String + **/ + id = node.attr('id') || node.attr('id', 'elfauto' + $('.elfinder').length).attr('id'), + + /** + * Events namespace + * + * @type String + **/ + namespace = 'elfinder-' + id, + + /** + * Mousedown event + * + * @type String + **/ + mousedown = 'mousedown.'+namespace, + + /** + * Keydown event + * + * @type String + **/ + keydown = 'keydown.'+namespace, + + /** + * Keypress event + * + * @type String + **/ + keypress = 'keypress.'+namespace, + + /** + * Keypup event + * + * @type String + **/ + keyup = 'keyup.'+namespace, + + /** + * Is shortcuts/commands enabled + * + * @type Boolean + **/ + enabled = false, + + /** + * Store enabled value before ajax request + * + * @type Boolean + **/ + prevEnabled = false, + + /** + * List of build-in events which mapped into methods with same names + * + * @type Array + **/ + events = ['enable', 'disable', 'load', 'open', 'reload', 'select', 'add', 'remove', 'change', 'dblclick', 'getfile', 'lockfiles', 'unlockfiles', 'selectfiles', 'unselectfiles', 'dragstart', 'dragstop', 'search', 'searchend', 'viewchange'], + + /** + * Rules to validate data from backend + * + * @type Object + **/ + rules = {}, + + /** + * Current working directory hash + * + * @type String + **/ + cwd = '', + + /** + * Current working directory options default + * + * @type Object + **/ + cwdOptionsDefault = { + path : '', + url : '', + tmbUrl : '', + disabled : [], + separator : '/', + archives : [], + extract : [], + copyOverwrite : true, + uploadOverwrite : true, + uploadMaxSize : 0, + jpgQuality : 100, + tmbCrop : false, + tmbReqCustomData : false, + tmb : false // old API + }, + + /** + * Current working directory options + * + * @type Object + **/ + cwdOptions = {}, + + /** + * Files/dirs cache + * + * @type Object + **/ + files = {}, + + /** + * Hidden Files/dirs cache + * + * @type Object + **/ + hiddenFiles = {}, + + /** + * Files/dirs hash cache of each dirs + * + * @type Object + **/ + ownFiles = {}, + + /** + * Selected files hashes + * + * @type Array + **/ + selected = [], + + /** + * Events listeners + * + * @type Object + **/ + listeners = {}, + + /** + * Shortcuts + * + * @type Object + **/ + shortcuts = {}, + + /** + * Buffer for copied files + * + * @type Array + **/ + clipboard = [], + + /** + * Copied/cuted files hashes + * Prevent from remove its from cache. + * Required for dispaly correct files names in error messages + * + * @type Object + **/ + remember = {}, + + /** + * Queue for 'open' requests + * + * @type Array + **/ + queue = [], + + /** + * Queue for only cwd requests e.g. `tmb` + * + * @type Array + **/ + cwdQueue = [], + + /** + * Commands prototype + * + * @type Object + **/ + base = new self.command(self), + + /** + * elFinder node width + * + * @type String + * @default "auto" + **/ + width = 'auto', + + /** + * elFinder node height + * Number: pixcel or String: Number + "%" + * + * @type Number | String + * @default 400 + **/ + height = 400, + + /** + * Base node object or selector + * Element which is the reference of the height percentage + * + * @type Object|String + * @default null | $(window) (if height is percentage) + **/ + heightBase = null, + + /** + * MIME type list(Associative array) handled as a text file + * + * @type Object|null + */ + textMimes = null, + + /** + * elfinder path for sound played on remove + * @type String + * @default ./sounds/ + **/ + soundPath = 'sounds/', + + /** + * JSON.stringify of previous fm.sorters + * @type String + */ + prevSorterStr = '', + + /** + * Map table of file extention to MIME-Type + * @type Object + */ + extToMimeTable, + + /** + * Disabled page unload function + * @type Boolean + */ + diableUnloadCheck = false, + + beeper = $(document.createElement('audio')).hide().appendTo('body')[0], + + syncInterval, + autoSyncStop = 0, + + uiCmdMapPrev = '', + + gcJobRes = null, + + open = function(data) { + // NOTES: Do not touch data object + + var volumeid, contextmenu, emptyDirs = {}, stayDirs = {}, + rmClass, hashes, calc, gc, collapsed, prevcwd, sorterStr, diff; + + if (self.api >= 2.1) { + // support volume driver option `uiCmdMap` + self.commandMap = (data.options.uiCmdMap && Object.keys(data.options.uiCmdMap).length)? data.options.uiCmdMap : {}; + if (uiCmdMapPrev !== JSON.stringify(self.commandMap)) { + uiCmdMapPrev = JSON.stringify(self.commandMap); + } + } else { + self.options.sync = 0; + } + + if (data.init) { + // init - reset cache + files = {}; + ownFiles = {}; + } else { + // remove only files from prev cwd + // and collapsed directory (included 100+ directories) to empty for perfomance tune in DnD + prevcwd = cwd; + rmClass = 'elfinder-subtree-loaded ' + self.res('class', 'navexpand'); + collapsed = self.res('class', 'navcollapse'); + hashes = Object.keys(files); + calc = function(i) { + if (!files[i]) { + return true; + } + + var isDir = (files[i].mime === 'directory'), + phash = files[i].phash, + pnav; + + if ( + (!isDir + || emptyDirs[phash] + || (!stayDirs[phash] + && self.navHash2Elm(files[i].hash).is(':hidden') + && self.navHash2Elm(phash).next('.elfinder-navbar-subtree').children().length > 100 + ) + ) + && (isDir || phash !== cwd) + && ! remember[i] + ) { + if (isDir && !emptyDirs[phash]) { + emptyDirs[phash] = true; + self.navHash2Elm(phash) + .removeClass(rmClass) + .next('.elfinder-navbar-subtree').empty(); + } + deleteCache(files[i]); + } else if (isDir) { + stayDirs[phash] = true; + } + }; + gc = function() { + if (hashes.length) { + gcJobRes && gcJobRes._abort(); + gcJobRes = self.asyncJob(calc, hashes, { + interval : 20, + numPerOnce : 100 + }).done(function() { + var hd = self.storage('hide') || {items: {}}; + if (Object.keys(hiddenFiles).length) { + $.each(hiddenFiles, function(h) { + if (!hd.items[h]) { + delete hiddenFiles[h]; + } + }); + } + }); + } + }; + + self.trigger('filesgc').one('filesgc', function() { + hashes = []; + }); + + self.one('opendone', function() { + if (prevcwd !== cwd) { + if (! node.data('lazycnt')) { + gc(); + } else { + self.one('lazydone', gc); + } + } + }); + } + + self.sorters = {}; + cwd = data.cwd.hash; + cache(data.files); + if (!files[cwd]) { + cache([data.cwd]); + } else { + diff = self.diff([data.cwd], true); + if (diff.changed.length) { + cache(diff.changed, 'change'); + self.change({changed: diff.changed}); + } + } + data.changed && data.changed.length && cache(data.changed, 'change'); + + // trigger event 'sorterupdate' + sorterStr = JSON.stringify(self.sorters); + if (prevSorterStr !== sorterStr) { + self.trigger('sorterupdate'); + prevSorterStr = sorterStr; + } + + self.lastDir(cwd); + + self.autoSync(); + }, + + /** + * Store info about files/dirs in "files" object. + * + * @param Array files + * @param String data type + * @return void + **/ + cache = function(data, type) { + var type = type || 'files', + keeps = ['sizeInfo', 'encoding'], + defsorter = { name: true, perm: true, date: true, size: true, kind: true }, + sorterChk = !self.sorters._checked && (type === 'files'), + l = data.length, + setSorter = function(file) { + var f = file || {}, + sorters = []; + $.each(self.sortRules, function(key) { + if (defsorter[key] || typeof f[key] !== 'undefined' || (key === 'mode' && typeof f.perm !== 'undefined')) { + sorters.push(key); + } + }); + self.sorters = self.arrayFlip(sorters, true); + self.sorters._checked = true; + }, + changedParents = {}, + hideData = self.storage('hide') || {}, + hides = hideData.items || {}, + f, i, i1, keepProp, parents, hidden; + + for (i = 0; i < l; i++) { + f = Object.assign({}, data[i]); + hidden = (!hideData.show && hides[f.hash])? true : false; + if (f.name && f.hash && f.mime) { + if (!hidden) { + if (sorterChk && f.phash === cwd) { + setSorter(f); + sorterChk = false; + } + + if (f.phash && (type === 'add' || (type === 'change' && (!files[f.hash] || f.size !== files[f.hash])))) { + if (parents = self.parents(f.phash)) { + $.each(parents, function() { + changedParents[this] = true; + }); + } + } + } + + if (files[f.hash]) { + for (i1 =0; i1 < keeps.length; i1++) { + if(files[f.hash][keeps[i1]] && ! f[keeps[i1]]) { + f[keeps[i1]] = files[f.hash][keeps[i1]]; + } + } + if (f.sizeInfo && !f.size) { + f.size = f.sizeInfo.size; + } + deleteCache(files[f.hash], true); + } + if (hides[f.hash]) { + hiddenFiles[f.hash] = f; + } + if (hidden) { + l--; + data.splice(i--, 1); + } else { + files[f.hash] = f; + if (f.mime === 'directory' && !ownFiles[f.hash]) { + ownFiles[f.hash] = {}; + } + if (f.phash) { + if (!ownFiles[f.phash]) { + ownFiles[f.phash] = {}; + } + ownFiles[f.phash][f.hash] = true; + } + } + } + } + // delete sizeInfo cache + $.each(Object.keys(changedParents), function() { + var target = files[this]; + if (target && target.sizeInfo) { + delete target.sizeInfo; + } + }); + + // for empty folder + sorterChk && setSorter(); + }, + + /** + * Delete file object from files caches + * + * @param Array removed hashes + * @return void + */ + remove = function(removed) { + var l = removed.length, + roots = {}, + rm = function(hash) { + var file = files[hash], i; + if (file) { + if (file.mime === 'directory') { + if (roots[hash]) { + delete self.roots[roots[hash]]; + } + // restore stats of deleted root parent directory + $.each(self.leafRoots, function(phash, roots) { + var idx, pdir; + if ((idx = $.inArray(hash, roots))!== -1) { + if (roots.length === 1) { + if ((pdir = Object.assign({}, files[phash])) && pdir._realStats) { + $.each(pdir._realStats, function(k, v) { + pdir[k] = v; + }); + remove(files[phash]._realStats); + self.change({ changed: [pdir] }); + } + delete self.leafRoots[phash]; + } else { + self.leafRoots[phash].splice(idx, 1); + } + } + }); + if (self.searchStatus.state < 2) { + $.each(files, function(h, f) { + f.phash == hash && rm(h); + }); + } + } + if (file.phash) { + if (parents = self.parents(file.phash)) { + $.each(parents, function() { + changedParents[this] = true; + }); + } + } + deleteCache(files[hash]); + } + }, + changedParents = {}, + parents; + + $.each(self.roots, function(k, v) { + roots[v] = k; + }); + while (l--) { + rm(removed[l]); + } + // delete sizeInfo cache + $.each(Object.keys(changedParents), function() { + var target = files[this]; + if (target && target.sizeInfo) { + delete target.sizeInfo; + } + }); + }, + + /** + * Update file object in files caches + * + * @param Array changed file objects + * @return void + * @deprecated should be use `cache(updatesArrayData, 'change');` + */ + change = function(changed) { + $.each(changed, function(i, file) { + var hash = file.hash; + if (files[hash]) { + $.each(Object.keys(files[hash]), function(i, v){ + if (typeof file[v] === 'undefined') { + delete files[hash][v]; + } + }); + } + files[hash] = files[hash] ? Object.assign(files[hash], file) : file; + }); + }, + + /** + * Delete cache data of files, ownFiles and self.optionsByHashes + * + * @param Object file + * @param Boolean update + * @return void + */ + deleteCache = function(file, update) { + var hash = file.hash, + phash = file.phash; + + if (phash && ownFiles[phash]) { + delete ownFiles[phash][hash]; + } + if (!update) { + ownFiles[hash] && delete ownFiles[hash]; + self.optionsByHashes[hash] && delete self.optionsByHashes[hash]; + } + delete files[hash]; + }, + + /** + * Maximum number of concurrent connections on request + * + * @type Number + */ + requestMaxConn, + + /** + * Current number of connections + * + * @type Number + */ + requestCnt = 0, + + /** + * Queue waiting for connection + * + * @type Array + */ + requestQueue = [], + + /** + * Current open command instance + * + * @type Object + */ + currentOpenCmd = null, + + /** + * Exec shortcut + * + * @param jQuery.Event keydown/keypress event + * @return void + */ + execShortcut = function(e) { + var code = e.keyCode, + ctrlKey = !!(e.ctrlKey || e.metaKey), + isMousedown = e.type === 'mousedown', + ddm; + + !isMousedown && (self.keyState.keyCode = code); + self.keyState.ctrlKey = ctrlKey; + self.keyState.shiftKey = e.shiftKey; + self.keyState.metaKey = e.metaKey; + self.keyState.altKey = e.altKey; + if (isMousedown) { + return; + } else if (e.type === 'keyup') { + self.keyState.keyCode = null; + return; + } + + if (enabled) { + + $.each(shortcuts, function(i, shortcut) { + if (shortcut.type == e.type + && shortcut.keyCode == code + && shortcut.shiftKey == e.shiftKey + && shortcut.ctrlKey == ctrlKey + && shortcut.altKey == e.altKey) { + e.preventDefault(); + e.stopPropagation(); + shortcut.callback(e, self); + self.debug('shortcut-exec', i+' : '+shortcut.description); + } + }); + + // prevent tab out of elfinder + if (code == $.ui.keyCode.TAB && !$(e.target).is(':input')) { + e.preventDefault(); + } + + // cancel any actions by [Esc] key + if (e.type === 'keydown' && code == $.ui.keyCode.ESCAPE) { + // copy or cut + if (! node.find('.ui-widget:visible').length) { + self.clipboard().length && self.clipboard([]); + } + // dragging + if ($.ui.ddmanager) { + ddm = $.ui.ddmanager.current; + ddm && ddm.helper && ddm.cancel(); + } + // button menus + self.toHide(node.find('.ui-widget.elfinder-button-menu.elfinder-frontmost:visible')); + // trigger keydownEsc + self.trigger('keydownEsc', e); + } + + } + }, + date = new Date(), + utc, + i18n, + inFrame = (window.parent !== window), + parentIframe = (function() { + var pifm, ifms; + if (inFrame) { + try { + ifms = $('iframe', window.parent.document); + if (ifms.length) { + $.each(ifms, function(i, ifm) { + if (ifm.contentWindow === window) { + pifm = $(ifm); + return false; + } + }); + } + } catch(e) {} + } + return pifm; + })(), + /** + * elFinder boot up function + * + * @type Function + */ + bootUp, + /** + * Original function of XMLHttpRequest.prototype.send + * + * @type Function + */ + savedXhrSend; + + // opts must be an object + if (!opts) { + opts = {}; + } + + // set UA.Angle, UA.Rotated for mobile devices + if (self.UA.Mobile) { + $(window).on('orientationchange.'+namespace, function() { + var a = ((screen && screen.orientation && screen.orientation.angle) || window.orientation || 0) + 0; + if (a === -90) { + a = 270; + } + self.UA.Angle = a; + self.UA.Rotated = a % 180 === 0? false : true; + }).trigger('orientationchange.'+namespace); + } + + // check opt.bootCallback + if (opts.bootCallback && typeof opts.bootCallback === 'function') { + (function() { + var func = bootCallback, + opFunc = opts.bootCallback; + bootCallback = function(fm, extraObj) { + func && typeof func === 'function' && func.call(this, fm, extraObj); + opFunc.call(this, fm, extraObj); + }; + })(); + } + delete opts.bootCallback; + + /** + * Protocol version + * + * @type String + **/ + this.api = null; + + /** + * elFinder use new api + * + * @type Boolean + **/ + this.newAPI = false; + + /** + * elFinder use old api + * + * @type Boolean + **/ + this.oldAPI = false; + + /** + * Net drivers names + * + * @type Array + **/ + this.netDrivers = []; + + /** + * Base URL of elfFinder library starting from Manager HTML + * + * @type String + */ + this.baseUrl = ''; + + /** + * Base URL of i18n js files + * baseUrl + "js/i18n/" when empty value + * + * @type String + */ + this.i18nBaseUrl = ''; + + /** + * Base URL of worker js files + * baseUrl + "js/worker/" when empty value + * + * @type String + */ + this.workerBaseUrl = ''; + + /** + * Is elFinder CSS loaded + * + * @type Boolean + */ + this.cssloaded = false; + + /** + * Current theme object + * + * @type Object|Null + */ + this.theme = null; + + this.mimesCanMakeEmpty = {}; + + /** + * Callback function at boot up that option specified at elFinder starting + * + * @type Function + */ + this.bootCallback; + + /** + * Callback function at reload(restart) elFinder + * + * @type Function + */ + this.reloadCallback; + + /** + * ID. Required to create unique cookie name + * + * @type String + **/ + this.id = id; + + /** + * Method to store/fetch data + * + * @type Function + **/ + this.storage = (function() { + try { + if ('localStorage' in window && window.localStorage !== null) { + if (self.UA.Safari) { + // check for Mac/iOS safari private browsing mode + window.localStorage.setItem('elfstoragecheck', 1); + window.localStorage.removeItem('elfstoragecheck'); + } + return self.localStorage; + } else { + return self.cookie; + } + } catch (e) { + return self.cookie; + } + })(); + + /** + * Set pause page unload check function or Get state + * + * @param Boolean state To set state + * @param Boolean keep Keep disabled + * @return Boolean|void + */ + this.pauseUnloadCheck = function(state, keep) { + if (typeof state === 'undefined') { + return diableUnloadCheck; + } else { + diableUnloadCheck = !!state; + if (state && !keep) { + requestAnimationFrame(function() { + diableUnloadCheck = false; + }); + } + } + }; + + /** + * Configuration options + * + * @type Object + **/ + //this.options = $.extend(true, {}, this._options, opts); + this.options = Object.assign({}, this._options); + + // for old type configuration + if (opts.uiOptions) { + if (opts.uiOptions.toolbar && Array.isArray(opts.uiOptions.toolbar)) { + if ($.isPlainObject(opts.uiOptions.toolbar[opts.uiOptions.toolbar.length - 1])) { + self.options.uiOptions.toolbarExtra = Object.assign(self.options.uiOptions.toolbarExtra || {}, opts.uiOptions.toolbar.pop()); + } + } + } + + // Overwrite if opts value is an array + (function() { + var arrOv = function(obj, base) { + if ($.isPlainObject(obj)) { + $.each(obj, function(k, v) { + if ($.isPlainObject(v)) { + if (!base[k]) { + base[k] = {}; + } + arrOv(v, base[k]); + } else { + base[k] = v; + } + }); + } + }; + arrOv(opts, self.options); + })(); + + // join toolbarExtra to toolbar + this.options.uiOptions.toolbar.push(this.options.uiOptions.toolbarExtra); + delete this.options.uiOptions.toolbarExtra; + + /** + * Arrays that has to unbind events + * + * @type Object + */ + this.toUnbindEvents = {}; + + /** + * Attach listener to events + * To bind to multiply events at once, separate events names by space + * + * @param String event(s) name(s) + * @param Object event handler or {done: handler} + * @param Boolean priority first + * @return elFinder + */ + this.bind = function(event, callback, priorityFirst) { + var i, len; + + if (callback && (typeof callback === 'function' || typeof callback.done === 'function')) { + event = ('' + event).toLowerCase().replace(/^\s+|\s+$/g, '').split(/\s+/); + + len = event.length; + for (i = 0; i < len; i++) { + if (listeners[event[i]] === void(0)) { + listeners[event[i]] = []; + } + listeners[event[i]][priorityFirst? 'unshift' : 'push'](callback); + } + } + return this; + }; + + /** + * Remove event listener if exists + * To un-bind to multiply events at once, separate events names by space + * + * @param String event(s) name(s) + * @param Function callback + * @return elFinder + */ + this.unbind = function(event, callback) { + var i, len, l, ci; + + event = ('' + event).toLowerCase().split(/\s+/); + + len = event.length; + for (i = 0; i < len; i++) { + if (l = listeners[event[i]]) { + ci = $.inArray(callback, l); + ci > -1 && l.splice(ci, 1); + } + } + + callback = null; + return this; + }; + + /** + * Fire event - send notification to all event listeners + * In the callback `this` becames an event object + * + * @param String event type + * @param Object data to send across event + * @param Boolean allow modify data (call by reference of data) default: true + * @return elFinder + */ + this.trigger = function(evType, data, allowModify) { + var type = evType.toLowerCase(), + isopen = (type === 'open'), + dataIsObj = (typeof data === 'object'), + handlers = listeners[type] || [], + dones = [], + i, l, jst, event; + + this.debug('event-'+type, data); + + if (! dataIsObj || typeof allowModify === 'undefined') { + allowModify = true; + } + if (l = handlers.length) { + event = $.Event(type); + if (data) { + data._getEvent = function() { + return event; + }; + } + if (allowModify) { + event.data = data; + } + + for (i = 0; i < l; i++) { + if (! handlers[i]) { + // probably un-binded this handler + continue; + } + + // handler is $.Deferred(), call all functions upon completion + if (handlers[i].done) { + dones.push(handlers[i].done); + continue; + } + + // set `event.data` only callback has argument + if (handlers[i].length) { + if (!allowModify) { + // to avoid data modifications. remember about "sharing" passing arguments in js :) + if (typeof jst === 'undefined') { + try { + jst = JSON.stringify(data); + } catch(e) { + jst = false; + } + } + event.data = jst? JSON.parse(jst) : data; + } + } + + try { + if (handlers[i].call(event, event, this) === false || event.isDefaultPrevented()) { + this.debug('event-stoped', event.type); + break; + } + } catch (ex) { + window.console && window.console.log && window.console.log(ex); + } + + } + + // call done functions + if (l = dones.length) { + for (i = 0; i < l; i++) { + try { + if (dones[i].call(event, event, this) === false || event.isDefaultPrevented()) { + this.debug('event-stoped', event.type + '(done)'); + break; + } + } catch (ex) { + window.console && window.console.log && window.console.log(ex); + } + } + } + + if (this.toUnbindEvents[type] && this.toUnbindEvents[type].length) { + $.each(this.toUnbindEvents[type], function(i, v) { + self.unbind(v.type, v.callback); + }); + delete this.toUnbindEvents[type]; + } + } + return this; + }; + + /** + * Get event listeners + * + * @param String event type + * @return Array listed event functions + */ + this.getListeners = function(event) { + return event? listeners[event.toLowerCase()] : listeners; + }; + + // set fm.baseUrl + this.baseUrl = (function() { + var myTag, base, baseUrl; + + if (self.options.baseUrl) { + return self.options.baseUrl; + } else { + baseUrl = ''; + myTag = null; + $('head > script').each(function() { + if (this.src && this.src.match(/js\/elfinder(?:-[a-z0-9_-]+)?\.(?:min|full)\.js(?:$|\?)/i)) { + myTag = $(this); + return false; + } + }); + if (myTag) { + baseUrl = myTag.attr('src').replace(/js\/[^\/]+$/, ''); + if (! baseUrl.match(/^(https?\/\/|\/)/)) { + // check tag + if (base = $('head > base[href]').attr('href')) { + baseUrl = base.replace(/\/$/, '') + '/' + baseUrl; + } + } + } + if (baseUrl !== '') { + self.options.baseUrl = baseUrl; + } else { + if (! self.options.baseUrl) { + self.options.baseUrl = './'; + } + baseUrl = self.options.baseUrl; + } + return baseUrl; + } + })(); + + this.i18nBaseUrl = (this.options.i18nBaseUrl || this.baseUrl + 'js/i18n').replace(/\/$/, '') + '/'; + this.workerBaseUrl = (this.options.workerBaseUrl || this.baseUrl + 'js/worker').replace(/\/$/, '') + '/'; + + this.options.maxErrorDialogs = Math.max(1, parseInt(this.options.maxErrorDialogs || 5)); + + // set dispInlineRegex + cwdOptionsDefault.dispInlineRegex = this.options.dispInlineRegex; + + // auto load required CSS + if (this.options.cssAutoLoad) { + (function() { + var baseUrl = self.baseUrl, + myCss = $('head > link[href$="css/elfinder.min.css"],link[href$="css/elfinder.full.css"]:first').length, + rmTag = function() { + if (node.data('cssautoloadHide')) { + node.data('cssautoloadHide').remove(); + node.removeData('cssautoloadHide'); + } + }, + loaded = function() { + if (!self.cssloaded) { + rmTag(); + self.cssloaded = true; + self.trigger('cssloaded'); + } + }; + + if (! myCss) { + // to request CSS auto loading + self.cssloaded = null; + } + + // additional CSS files + if (Array.isArray(self.options.cssAutoLoad)) { + if (!self.options.themes.default) { + // set as default theme + self.options.themes = Object.assign({ + 'default' : { + 'name': 'default', + 'cssurls': self.options.cssAutoLoad + } + }, self.options.themes); + if (!self.options.theme) { + self.options.theme = 'default'; + } + } else { + if (self.cssloaded === true) { + self.loadCss(self.options.cssAutoLoad); + } else { + self.bind('cssloaded', function() { + self.loadCss(self.options.cssAutoLoad); + }); + } + } + } + + // try to load main css + if (self.cssloaded === null) { + // hide elFinder node while css loading + node.addClass('elfinder') + .data('cssautoloadHide', $('')); + $('head').append(node.data('cssautoloadHide')); + + // set default theme + if (!self.options.themes.default) { + self.options.themes = Object.assign({ + 'default' : { + 'name': 'default', + 'cssurls': 'css/theme.css', + 'author': 'elFinder Project', + 'license': '3-clauses BSD' + } + }, self.options.themes); + if (!self.options.theme) { + self.options.theme = 'default'; + } + } + + // Delay 'visibility' check it required for browsers such as Safari + requestAnimationFrame(function() { + if (node.css('visibility') === 'hidden') { + // load CSS + self.loadCss([baseUrl+'css/elfinder.min.css'], { + dfd: $.Deferred().done(function() { + loaded(); + }).fail(function() { + rmTag(); + if (!self.cssloaded) { + self.cssloaded = false; + self.bind('init', function() { + if (!self.cssloaded) { + self.error(['errRead', 'CSS (elfinder.min)']); + } + }); + } + }) + }); + } else { + loaded(); + } + }); + } + })(); + } + + // load theme if exists + (function() { + var theme, + themes = self.options.themes, + ids = Object.keys(themes || {}); + if (ids.length) { + theme = self.storage('theme') || self.options.theme; + if (!themes[theme]) { + theme = ids[0]; + } + if (self.cssloaded) { + self.changeTheme(theme); + } else { + self.bind('cssloaded', function() { + self.changeTheme(theme); + }); + } + } + })(); + + /** + * Volume option to set the properties of the root Stat + * + * @type Object + */ + this.optionProperties = { + icon: void(0), + csscls: void(0), + tmbUrl: void(0), + uiCmdMap: {}, + netkey: void(0), + disabled: [] + }; + + if (! inFrame && ! this.options.enableAlways && $('body').children().length === 2) { // only node and beeper + this.options.enableAlways = true; + } + + // make options.debug + if (this.options.debug === true) { + this.options.debug = 'all'; + } else if (Array.isArray(this.options.debug)) { + (function() { + var d = {}; + $.each(self.options.debug, function() { + d[this] = true; + }); + self.options.debug = d; + })(); + } else { + this.options.debug = false; + } + + /** + * Original functions evacuated by conflict check + * + * @type Object + */ + this.noConflicts = {}; + + /** + * Check and save conflicts with bootstrap etc + * + * @type Function + */ + this.noConflict = function() { + $.each(conflictChecks, function(i, p) { + if ($.fn[p] && typeof $.fn[p].noConflict === 'function') { + self.noConflicts[p] = $.fn[p].noConflict(); + } + }); + }; + // do check conflict + this.noConflict(); + + /** + * Is elFinder over CORS + * + * @type Boolean + **/ + this.isCORS = false; + + // configure for CORS + (function(){ + if (typeof self.options.cors !== 'undefined' && self.options.cors !== null) { + self.isCORS = self.options.cors? true : false; + } else { + var parseUrl = document.createElement('a'), + parseUploadUrl, + selfProtocol = window.location.protocol, + portReg = function(protocol) { + protocol = (!protocol || protocol === ':')? selfProtocol : protocol; + return protocol === 'https:'? /\:443$/ : /\:80$/; + }, + selfHost = window.location.host.replace(portReg(selfProtocol), ''); + parseUrl.href = opts.url; + if (opts.urlUpload && (opts.urlUpload !== opts.url)) { + parseUploadUrl = document.createElement('a'); + parseUploadUrl.href = opts.urlUpload; + } + if (selfHost !== parseUrl.host.replace(portReg(parseUrl.protocol), '') + || (parseUrl.protocol !== ':'&& parseUrl.protocol !== '' && (selfProtocol !== parseUrl.protocol)) + || (parseUploadUrl && + (selfHost !== parseUploadUrl.host.replace(portReg(parseUploadUrl.protocol), '') + || (parseUploadUrl.protocol !== ':' && parseUploadUrl.protocol !== '' && (selfProtocol !== parseUploadUrl.protocol)) + ) + ) + ) { + self.isCORS = true; + } + } + if (self.isCORS) { + if (!$.isPlainObject(self.options.customHeaders)) { + self.options.customHeaders = {}; + } + if (!$.isPlainObject(self.options.xhrFields)) { + self.options.xhrFields = {}; + } + self.options.requestType = 'post'; + self.options.customHeaders['X-Requested-With'] = 'XMLHttpRequest'; + self.options.xhrFields['withCredentials'] = true; + } + })(); + + /** + * Ajax request type + * + * @type String + * @default "get" + **/ + this.requestType = /^(get|post)$/i.test(this.options.requestType) ? this.options.requestType.toLowerCase() : 'get'; + + // set `requestMaxConn` by option + requestMaxConn = Math.max(parseInt(this.options.requestMaxConn), 1); + + /** + * Custom data that given as options + * + * @type Object + * @default {} + */ + this.optsCustomData = $.isPlainObject(this.options.customData) ? this.options.customData : {}; + + /** + * Any data to send across every ajax request + * + * @type Object + * @default {} + **/ + this.customData = Object.assign({}, this.optsCustomData); + + /** + * Previous custom data from connector + * + * @type Object|null + */ + this.prevCustomData = null; + + /** + * Any custom headers to send across every ajax request + * + * @type Object + * @default {} + */ + this.customHeaders = $.isPlainObject(this.options.customHeaders) ? this.options.customHeaders : {}; + + /** + * Any custom xhrFields to send across every ajax request + * + * @type Object + * @default {} + */ + this.xhrFields = $.isPlainObject(this.options.xhrFields) ? this.options.xhrFields : {}; + + /** + * Replace XMLHttpRequest.prototype.send to extended function for 3rd party libs XHR request etc. + * + * @type Function + */ + this.replaceXhrSend = function() { + if (! savedXhrSend) { + savedXhrSend = XMLHttpRequest.prototype.send; + } + XMLHttpRequest.prototype.send = function() { + var xhr = this; + // set request headers + if (self.customHeaders) { + $.each(self.customHeaders, function(key) { + xhr.setRequestHeader(key, this); + }); + } + // set xhrFields + if (self.xhrFields) { + $.each(self.xhrFields, function(key) { + if (key in xhr) { + xhr[key] = this; + } + }); + } + return savedXhrSend.apply(this, arguments); + }; + }; + + /** + * Restore saved original XMLHttpRequest.prototype.send + * + * @type Function + */ + this.restoreXhrSend = function() { + savedXhrSend && (XMLHttpRequest.prototype.send = savedXhrSend); + }; + + /** + * command names for into queue for only cwd requests + * these commands aborts before `open` request + * + * @type Array + * @default ['tmb', 'parents'] + */ + this.abortCmdsOnOpen = this.options.abortCmdsOnOpen || ['tmb', 'parents']; + + /** + * ui.nav id prefix + * + * @type String + */ + this.navPrefix = 'nav' + (elFinder.prototype.uniqueid? elFinder.prototype.uniqueid : '') + '-'; + + /** + * ui.cwd id prefix + * + * @type String + */ + this.cwdPrefix = elFinder.prototype.uniqueid? ('cwd' + elFinder.prototype.uniqueid + '-') : ''; + + // Increment elFinder.prototype.uniqueid + ++elFinder.prototype.uniqueid; + + /** + * URL to upload files + * + * @type String + **/ + this.uploadURL = opts.urlUpload || opts.url; + + /** + * Events namespace + * + * @type String + **/ + this.namespace = namespace; + + /** + * Today timestamp + * + * @type Number + **/ + this.today = (new Date(date.getFullYear(), date.getMonth(), date.getDate())).getTime()/1000; + + /** + * Yesterday timestamp + * + * @type Number + **/ + this.yesterday = this.today - 86400; + + utc = this.options.UTCDate ? 'UTC' : ''; + + this.getHours = 'get'+utc+'Hours'; + this.getMinutes = 'get'+utc+'Minutes'; + this.getSeconds = 'get'+utc+'Seconds'; + this.getDate = 'get'+utc+'Date'; + this.getDay = 'get'+utc+'Day'; + this.getMonth = 'get'+utc+'Month'; + this.getFullYear = 'get'+utc+'FullYear'; + + /** + * elFinder node z-index (auto detect on elFinder load) + * + * @type null | Number + **/ + this.zIndex; + + /** + * Current search status + * + * @type Object + */ + this.searchStatus = { + state : 0, // 0: search ended, 1: search started, 2: in search result + query : '', + target : '', + mime : '', + mixed : false, // in multi volumes search: false or Array that target volume ids + ininc : false // in incremental search + }; + + /** + * Interface language + * + * @type String + * @default "en" + **/ + this.lang = this.storage('lang') || this.options.lang; + if (this.lang === 'jp') { + this.lang = this.options.lang = 'ja'; + } + + 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'); + if (this.sortStickFolders === null) { + this.sortStickFolders = !!this.options.sortStickFolders; + } else { + this.sortStickFolders = !!this.sortStickFolders; + } + + this.sortAlsoTreeview = this.storage('sortAlsoTreeview'); + if (this.sortAlsoTreeview === null || this.options.sortAlsoTreeview === null) { + this.sortAlsoTreeview = !!this.options.sortAlsoTreeview; + } else { + this.sortAlsoTreeview = !!this.sortAlsoTreeview; + } + + this.sortRules = $.extend(true, {}, this._sortRules, this.options.sortRules); + + $.each(this.sortRules, function(name, method) { + if (typeof method != 'function') { + delete self.sortRules[name]; + } + }); + + this.compare = $.proxy(this.compare, this); + + /** + * Delay in ms before open notification dialog + * + * @type Number + * @default 500 + **/ + this.notifyDelay = this.options.notifyDelay > 0 ? parseInt(this.options.notifyDelay) : 500; + + /** + * Dragging UI Helper object + * + * @type jQuery | null + **/ + this.draggingUiHelper = null; + + /** + * Base droppable options + * + * @type Object + **/ + this.droppable = { + greedy : true, + tolerance : 'pointer', + accept : '.elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename', + hoverClass : this.res('class', 'adroppable'), + classes : { // Deprecated hoverClass jQueryUI>=1.12.0 + 'ui-droppable-hover': this.res('class', 'adroppable') + }, + autoDisable: true, // elFinder original, see jquery.elfinder.js + drop : function(e, ui) { + var dst = $(this), + targets = $.grep(ui.helper.data('files')||[], function(h) { return h? true : false; }), + result = [], + dups = [], + faults = [], + isCopy = ui.helper.hasClass('elfinder-drag-helper-plus'), + c = 'class', + cnt, hash, i, h; + + if (typeof e.button === 'undefined' || ui.helper.data('namespace') !== namespace || ! self.insideWorkzone(e.pageX, e.pageY)) { + return false; + } + if (dst.hasClass(self.res(c, 'cwdfile'))) { + hash = self.cwdId2Hash(dst.attr('id')); + } else if (dst.hasClass(self.res(c, 'navdir'))) { + hash = self.navId2Hash(dst.attr('id')); + } else { + hash = cwd; + } + + cnt = targets.length; + + while (cnt--) { + h = targets[cnt]; + // ignore drop into itself or in own location + if (h != hash && files[h].phash != hash) { + result.push(h); + } else { + ((isCopy && h !== hash && files[hash].write)? dups : faults).push(h); + } + } + + if (faults.length) { + return false; + } + + ui.helper.data('droped', true); + + if (dups.length) { + ui.helper.hide(); + self.exec('duplicate', dups, {_userAction: true}); + } + + if (result.length) { + ui.helper.hide(); + self.clipboard(result, !isCopy); + self.exec('paste', hash, {_userAction: true}, hash).always(function(){ + self.clipboard([]); + self.trigger('unlockfiles', {files : targets}); + }); + self.trigger('drop', {files : targets}); + } + } + }; + + /** + * Return true if filemanager is active + * + * @return Boolean + **/ + this.enabled = function() { + return enabled && this.visible(); + }; + + /** + * Return true if filemanager is visible + * + * @return Boolean + **/ + this.visible = function() { + return node[0].elfinder && node.is(':visible'); + }; + + /** + * Return file is root? + * + * @param Object target file object + * @return Boolean + */ + this.isRoot = function(file) { + return (file.isroot || ! file.phash)? true : false; + }; + + /** + * Return root dir hash for current working directory + * + * @param String target hash + * @param Boolean include fake parent (optional) + * @return String + */ + this.root = function(hash, fake) { + hash = hash || cwd; + var dir, i; + + if (! fake) { + $.each(self.roots, function(id, rhash) { + if (hash.indexOf(id) === 0) { + dir = rhash; + return false; + } + }); + if (dir) { + return dir; + } + } + + dir = files[hash]; + while (dir && dir.phash && (fake || ! dir.isroot)) { + dir = files[dir.phash]; + } + if (dir) { + return dir.hash; + } + + while (i in files && files.hasOwnProperty(i)) { + dir = files[i]; + if (dir.mime === 'directory' && !dir.phash && dir.read) { + return dir.hash; + } + } + + return ''; + }; + + /** + * Return current working directory info + * + * @return Object + */ + this.cwd = function() { + return files[cwd] || {}; + }; + + /** + * Return required cwd option + * + * @param String option name + * @param String target hash (optional) + * @return mixed + */ + this.option = function(name, target) { + var res, item; + target = target || cwd; + if (self.optionsByHashes[target] && typeof self.optionsByHashes[target][name] !== 'undefined') { + return self.optionsByHashes[target][name]; + } + if (self.hasVolOptions && cwd !== target && (!(item = self.file(target)) || item.phash !== cwd)) { + res = ''; + $.each(self.volOptions, function(id, opt) { + if (target.indexOf(id) === 0) { + res = opt[name] || ''; + return false; + } + }); + return res; + } else { + return cwdOptions[name] || ''; + } + }; + + /** + * Return disabled commands by each folder + * + * @param Array target hashes + * @return Array + */ + this.getDisabledCmds = function(targets, flip) { + var disabled = {'hidden': true}; + if (! Array.isArray(targets)) { + targets = [ targets ]; + } + $.each(targets, function(i, h) { + var disCmds = self.option('disabledFlip', h); + if (disCmds) { + Object.assign(disabled, disCmds); + } + }); + return flip? disabled : Object.keys(disabled); + }; + + /** + * Return file data from current dir or tree by it's hash + * + * @param String file hash + * @return Object + */ + this.file = function(hash, alsoHidden) { + return hash? (files[hash] || (alsoHidden? hiddenFiles[hash] : void(0))) : void(0); + }; + + /** + * Return all cached files + * + * @param String parent hash + * @return Object + */ + this.files = function(phash) { + var items = {}; + if (phash) { + if (!ownFiles[phash]) { + return {}; + } + $.each(ownFiles[phash], function(h) { + if (files[h]) { + items[h] = files[h]; + } else { + delete ownFiles[phash][h]; + } + }); + return Object.assign({}, items); + } + return Object.assign({}, files); + }; + + /** + * Return list of file parents hashes include file hash + * + * @param String file hash + * @return Array + */ + this.parents = function(hash) { + var parents = [], + dir; + + while (hash && (dir = this.file(hash))) { + parents.unshift(dir.hash); + hash = dir.phash; + } + return parents; + }; + + this.path2array = function(hash, i18) { + var file, + path = []; + + while (hash) { + if ((file = files[hash]) && file.hash) { + path.unshift(i18 && file.i18 ? file.i18 : file.name); + hash = file.isroot? null : file.phash; + } else { + path = []; + break; + } + } + + return path; + }; + + /** + * Return file path or Get path async with jQuery.Deferred + * + * @param Object file + * @param Boolean i18 + * @param Object asyncOpt + * @return String|jQuery.Deferred + */ + this.path = function(hash, i18, asyncOpt) { + var path = files[hash] && files[hash].path + ? files[hash].path + : this.path2array(hash, i18).join(cwdOptions.separator); + if (! asyncOpt || ! files[hash]) { + return path; + } else { + asyncOpt = Object.assign({notify: {type : 'parents', cnt : 1, hideCnt : true}}, asyncOpt); + + var dfd = $.Deferred(), + notify = asyncOpt.notify, + noreq = false, + req = function() { + self.request({ + data : {cmd : 'parents', target : files[hash].phash}, + notify : notify, + preventFail : true + }) + .done(done) + .fail(function() { + dfd.reject(); + }); + }, + done = function() { + self.one('parentsdone', function() { + path = self.path(hash, i18); + if (path === '' && noreq) { + //retry with request + noreq = false; + req(); + } else { + if (notify) { + clearTimeout(ntftm); + notify.cnt = -(parseInt(notify.cnt || 0)); + self.notify(notify); + } + dfd.resolve(path); + } + }); + }, + ntftm; + + if (path) { + return dfd.resolve(path); + } else { + if (self.ui['tree']) { + // try as no request + if (notify) { + ntftm = setTimeout(function() { + self.notify(notify); + }, self.notifyDelay); + } + noreq = true; + done(true); + } else { + req(); + } + return dfd; + } + } + }; + + /** + * Return file url if set + * + * @param String file hash + * @param Object Options + * @return String|Object of jQuery Deferred + */ + this.url = function(hash, o) { + var file = files[hash], + opts = o || {}, + async = opts.async || false, + temp = opts.temporary || false, + onetm = (opts.onetime && self.option('onetimeUrl', hash)) || false, + absurl = opts.absurl || false, + dfrd = (async || onetm)? $.Deferred() : null, + filter = function(url) { + if (url && absurl) { + url = self.convAbsUrl(url); + } + return url; + }, + getUrl = function(url) { + if (url) { + return filter(url); + } + if (file.url) { + return filter(file.url); + } + + if (typeof baseUrl === 'undefined') { + baseUrl = getBaseUrl(); + } + + if (baseUrl) { + return filter(baseUrl + $.map(self.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/')); + } + + var params = Object.assign({}, self.customData, { + cmd: 'file', + target: file.hash + }); + if (self.oldAPI) { + params.cmd = 'open'; + params.current = file.phash; + } + return filter(self.options.url + (self.options.url.indexOf('?') === -1 ? '?' : '&') + $.param(params, true)); + }, + getBaseUrl = function() { + return self.option('url', (!self.isRoot(file) && file.phash) || file.hash); + }, + baseUrl, res; + + if (!file || !file.read) { + return async? dfrd.resolve('') : ''; + } + + if (onetm && (!file.url || file.url == '1') && !(baseUrl = getBaseUrl())) { + async = true; + this.request({ + data : { cmd : 'url', target : hash, options : { onetime: 1 } }, + preventDefault : true, + options: {async: async}, + notify: {type : 'file', cnt : 1, hideCnt : true}, + progressBar: opts.progressBar + }).done(function(data) { + dfrd.resolve(filter(data.url || '')); + }).fail(function() { + dfrd.resolve(''); + }); + } else { + if (file.url == '1' || (temp && !file.url && !(baseUrl = getBaseUrl()))) { + this.request({ + data : { cmd : 'url', target : hash, options : { temporary: temp? 1 : 0 } }, + preventDefault : true, + options: {async: async}, + notify: async? {type : temp? 'file' : 'url', cnt : 1, hideCnt : true} : {}, + progressBar: opts.progressBar + }) + .done(function(data) { + file.url = data.url || ''; + }) + .fail(function() { + file.url = ''; + }) + .always(function() { + var url; + if (file.url && temp) { + url = file.url; + file.url = '1'; // restore + } + if (async) { + dfrd.resolve(getUrl(url)); + } else { + return getUrl(url); + } + }); + } else { + if (async) { + dfrd.resolve(getUrl()); + } else { + return getUrl(); + } + } + } + if (async) { + return dfrd; + } + }; + + /** + * Return file url for the extarnal service + * + * @param String hash The hash + * @param Object options The options + * @return Object jQuery Deferred + */ + this.forExternalUrl = function(hash, options) { + var onetime = self.option('onetimeUrl', hash), + opts = { + async: true, + absurl: true + }; + + opts[onetime? 'onetime' : 'temporary'] = true; + return self.url(hash, Object.assign({}, options, opts)); + }; + + /** + * Return file url for open in elFinder + * + * @param String file hash + * @param Boolean for download link + * @param Object requestOpts The request options + * @return String + */ + this.openUrl = function(hash, download, callback, requestOpts) { + var file = files[hash], + url = '', + onetimeSize = (requestOpts || {}).onetimeSize || (5 * 1024 * 1024); + + if (!file || !file.read) { + return ''; + } + + if (!download || download === 'sameorigin') { + if (file.url) { + if (file.url != 1) { + url = file.url; + } + } else if (cwdOptions.url && file.hash.indexOf(self.cwd().volumeid) === 0) { + url = cwdOptions.url + $.map(this.path2array(hash), function(n) { return encodeURIComponent(n); }).slice(1).join('/'); + } + if (!download || this.isSameOrigin(url)) { + if (url) { + url += (url.match(/\?/)? '&' : '?') + '_'.repeat((url.match(/[\?&](_+)t=/g) || ['&t=']).sort().shift().match(/[\?&](_*)t=/)[1].length + 1) + 't=' + (file.ts || parseInt(+new Date()/1000)); + if (callback) { + callback(url); + return; + } else { + return url; + } + } + } + } + + if (callback && this.hasParrotHeaders()) { + if (!requestOpts) { + requestOpts = {}; + } else { + delete requestOpts.onetimeSize; + } + if (!requestOpts.onetime && !requestOpts.temporary && file.size > onetimeSize) { + if (file.mime.match(/^video|audio/)) { + requestOpts.temporary = true; + } else { + requestOpts.onetime = true; + } + } + if (requestOpts.onetime || requestOpts.temporary) { + return this.url(file.hash, Object.assign({ + async: true + }, requestOpts)).done(function(url) { + callback(url); + }).fail(function() { + callback(''); + }); + } else { + return this.getContents(hash, 'blob', requestOpts).done(function(blob){ + url = (window.URL || window.webkitURL).createObjectURL(blob); + callback(url); + }).fail(function() { + callback(''); + }); + } + } else { + url = this.options.url; + url = url + (url.indexOf('?') === -1 ? '?' : '&') + + (this.oldAPI ? 'cmd=open¤t='+file.phash : 'cmd=file') + + '&target=' + file.hash + + '&_t=' + (file.ts || parseInt(+new Date()/1000)); + + if (download === true) { + url += '&download=1'; + } + + $.each(this.customData, function(key, val) { + url += '&' + encodeURIComponent(key) + '=' + encodeURIComponent(val); + }); + if (callback) { + callback(url); + return; + } else { + return url; + } + } + }; + + /** + * Return thumbnail url + * + * @param Object file object + * @return String + */ + this.tmb = function(file) { + var tmbUrl, tmbCrop, + cls = 'elfinder-cwd-bgurl', + url = '', + cData = {}, + n = 0; + + if ($.isPlainObject(file)) { + if (self.searchStatus.state && file.hash.indexOf(self.cwd().volumeid) !== 0) { + tmbUrl = self.option('tmbUrl', file.hash); + tmbCrop = self.option('tmbCrop', file.hash); + } else { + tmbUrl = cwdOptions.tmbUrl; + tmbCrop = cwdOptions.tmbCrop; + } + if (tmbCrop) { + cls += ' elfinder-cwd-bgurl-crop'; + } + if (tmbUrl === 'self' && file.mime.indexOf('image/') === 0) { + url = self.openUrl(file.hash); + cls += ' elfinder-cwd-bgself'; + } else if ((self.oldAPI || tmbUrl) && file && file.tmb && file.tmb != 1) { + url = tmbUrl + file.tmb; + } else if (self.newAPI && file && file.tmb && file.tmb != 1) { + url = file.tmb; + } + if (url) { + if (tmbUrl !== 'self') { + if (file.ts) { + cData._t = file.ts; + } + if (cwdOptions.tmbReqCustomData && Object.keys(this.customData).length) { + cData = Object.assign(cData, this.customData); + } + if (Object.keys(cData).length) { + url += (url.match(/\?/) ? '&' : '?'); + $.each(cData, function (key, val) { + url += ((n++ === 0)? '' : '&') + encodeURIComponent(key) + '=' + encodeURIComponent(val); + }); + } + } + return { url: url, className: cls }; + } + } + + return false; + }; + + /** + * Return selected files hashes + * + * @return Array + **/ + this.selected = function() { + return selected.slice(0); + }; + + /** + * Return selected files info + * + * @return Array + */ + this.selectedFiles = function() { + return $.map(selected, function(hash) { return files[hash] ? Object.assign({}, files[hash]) : null; }); + }; + + /** + * Return true if file with required name existsin required folder + * + * @param String file name + * @param String parent folder hash + * @return Boolean + */ + this.fileByName = function(name, phash) { + var hash; + + for (hash in files) { + if (files.hasOwnProperty(hash) && files[hash].phash == phash && files[hash].name == name) { + return files[hash]; + } + } + }; + + /** + * Valid data for required command based on rules + * + * @param String command name + * @param Object cammand's data + * @return Boolean + */ + this.validResponse = function(cmd, data) { + return data.error || this.rules[this.rules[cmd] ? cmd : 'defaults'](data); + }; + + /** + * Return bytes from ini formated size + * + * @param String ini formated size + * @return Integer + */ + this.returnBytes = function(val) { + var last; + if (isNaN(val)) { + if (! val) { + val = ''; + } + // for ex. 1mb, 1KB + val = val.replace(/b$/i, ''); + last = val.charAt(val.length - 1).toLowerCase(); + val = val.replace(/[tgmk]$/i, ''); + if (last == 't') { + val = val * 1024 * 1024 * 1024 * 1024; + } else if (last == 'g') { + val = val * 1024 * 1024 * 1024; + } else if (last == 'm') { + val = val * 1024 * 1024; + } else if (last == 'k') { + val = val * 1024; + } + val = isNaN(val)? 0 : parseInt(val); + } else { + val = parseInt(val); + if (val < 1) val = 0; + } + return val; + }; + + /** + * Process ajax request. + * Fired events : + * @todo + * @example + * @todo + * @return $.Deferred + */ + this.request = function(opts) { + var self = this, + o = this.options, + dfrd = $.Deferred(), + // request ID + reqId = (+ new Date()).toString(16) + Math.floor(1000 * Math.random()).toString(16), + // request data + data = Object.assign({}, self.customData, {mimes : o.onlyMimes}, opts.data || opts), + // command name + cmd = data.cmd, + // request type is binary + isBinary = (opts.options || {}).dataType === 'binary', + // current cmd is "open" + isOpen = (!opts.asNotOpen && cmd === 'open'), + // call default fail callback (display error dialog) ? + deffail = !(isBinary || opts.preventDefault || opts.preventFail), + // call default success callback ? + defdone = !(isBinary || opts.preventDefault || opts.preventDone), + // current progress of receive data + prog = opts.progressVal || 20, + // timer of fake progress + progTm = null, + // whether the notification dialog is currently displayed + hasNotify= false, + // options for notify dialog + notify = !opts.progressBar? (opts.notify? Object.assign({progress: prog * opts.notify.cnt}, opts.notify) : {}) : {}, + // make cancel button + cancel = !!opts.cancel, + // do not normalize data - return as is + raw = isBinary || !!opts.raw, + // sync files on request fail + syncOnFail = opts.syncOnFail, + // use lazy() + lazy = !!opts.lazy, + // prepare function before done() + prepare = opts.prepare, + // navigate option object when cmd done + navigate = opts.navigate, + // open notify dialog timeout + timeout, + // use browser cache + useCache = (opts.options || {}).cache, + // request options + options = Object.assign({ + url : o.url, + async : true, + type : this.requestType, + dataType : 'json', + cache : (self.api >= 2.1029), // api >= 2.1029 has unique request ID + data : data, + headers : this.customHeaders, + xhrFields: this.xhrFields, + progress : function(e) { + var p = e.loaded / e.total * 100; + progTm && clearTimeout(progTm); + if (opts.progressBar) { + try { + opts.progressBar.width(p + '%'); + } catch(e) {} + } else { + if (hasNotify && notify.type) { + p = p * notify.cnt; + if (prog < p) { + self.notify({ + type: notify.type, + progress: p - prog, + cnt: 0, + hideCnt: notify.hideCnt + }); + prog = p; + } + } + } + if (opts.progress) { + try { + opts.progress(e); + } catch(e) {} + } + } + }, opts.options || {}), + /** + * Default success handler. + * Call default data handlers and fire event with command name. + * + * @param Object normalized response data + * @return void + **/ + done = function(data) { + data.warning && self.error(data.warning); + + if (isOpen) { + open(data); + } else { + self.updateCache(data); + } + + self.lazy(function() { + // fire some event to update cache/ui + data.removed && data.removed.length && self.remove(data); + data.added && data.added.length && self.add(data); + data.changed && data.changed.length && self.change(data); + }).then(function() { + // fire event with command name + return self.lazy(function() { + self.trigger(cmd, data, false); + }); + }).then(function() { + // fire event with command name + 'done' + return self.lazy(function() { + self.trigger(cmd + 'done'); + }); + }).then(function() { + // make toast message + if (data.toasts && Array.isArray(data.toasts)) { + $.each(data.toasts, function() { + this.msg && self.toast(this); + }); + } + // force update content + data.sync && self.sync(); + }); + }, + /** + * Request error handler. Reject dfrd with correct error message. + * + * @param jqxhr request object + * @param String request status + * @return void + **/ + error = function(xhr, status) { + var error, data, + d = self.options.debug; + + switch (status) { + case 'abort': + error = xhr.quiet ? '' : ['errConnect', 'errAbort']; + break; + case 'timeout': + error = ['errConnect', 'errTimeout']; + break; + case 'parsererror': + error = ['errResponse', 'errDataNotJSON']; + if (xhr.responseText) { + if (! cwd || (d && (d === 'all' || d['backend-error']))) { + error.push(xhr.responseText); + } + } + break; + default: + if (xhr.responseText) { + // check responseText, Is that JSON? + try { + data = JSON.parse(xhr.responseText); + if (data && data.error) { + error = data.error; + } + } catch(e) {} + } + if (! error) { + if (xhr.status == 403) { + error = ['errConnect', 'errAccess', 'HTTP error ' + xhr.status]; + } else if (xhr.status == 404) { + error = ['errConnect', 'errNotFound', 'HTTP error ' + xhr.status]; + } else if (xhr.status >= 500) { + error = ['errResponse', 'errServerError', 'HTTP error ' + xhr.status]; + } else { + if (xhr.status == 414 && options.type === 'get') { + // retry by POST method + options.type = 'post'; + self.abortXHR(xhr); + dfrd.xhr = xhr = self.transport.send(options).fail(error).done(success); + return; + } + error = xhr.quiet ? '' : ['errConnect', 'HTTP error ' + xhr.status]; + } + } + } + + self.trigger(cmd + 'done'); + dfrd.reject({error: error}, xhr, status); + }, + /** + * Request success handler. Valid response data and reject/resolve dfrd. + * + * @param Object response data + * @param String request status + * @return void + **/ + success = function(response) { + // Set currrent request command name + self.currentReqCmd = cmd; + + response.debug && self.responseDebug(response); + + self.setCustomHeaderByXhr(xhr); + + if (raw) { + self.abortXHR(xhr); + response && response.debug && self.debug('backend-debug', response); + return dfrd.resolve(response); + } + + if (!response) { + return dfrd.reject({error :['errResponse', 'errDataEmpty']}, xhr, response); + } else if (!$.isPlainObject(response)) { + return dfrd.reject({error :['errResponse', 'errDataNotJSON']}, xhr, response); + } else if (response.error) { + if (isOpen) { + // check leafRoots + $.each(self.leafRoots, function(phash, roots) { + self.leafRoots[phash] = $.grep(roots, function(h) { return h !== data.target; }); + }); + } + return dfrd.reject({error :response.error}, xhr, response); + } + + var resolve = function() { + var pushLeafRoots = function(name) { + if (self.leafRoots[data.target] && response[name]) { + $.each(self.leafRoots[data.target], function(i, h) { + var root; + if (root = self.file(h)) { + response[name].push(root); + } + }); + } + }, + setTextMimes = function() { + self.textMimes = {}; + $.each(self.res('mimes', 'text'), function() { + self.textMimes[this.toLowerCase()] = true; + }); + }, + actionTarget; + + if (isOpen) { + pushLeafRoots('files'); + } else if (cmd === 'tree') { + pushLeafRoots('tree'); + } + + response = self.normalize(response); + + if (!self.validResponse(cmd, response)) { + return dfrd.reject({error :(response.norError || 'errResponse')}, xhr, response); + } + + if (isOpen) { + if (!self.api) { + self.api = response.api || 1; + if (self.api == '2.0' && typeof response.options.uploadMaxSize !== 'undefined') { + self.api = '2.1'; + } + self.newAPI = self.api >= 2; + self.oldAPI = !self.newAPI; + } + + if (response.textMimes && Array.isArray(response.textMimes)) { + self.resources.mimes.text = response.textMimes; + setTextMimes(); + } + !self.textMimes && setTextMimes(); + + if (response.options) { + cwdOptions = Object.assign({}, cwdOptionsDefault, response.options); + } + + if (response.netDrivers) { + self.netDrivers = response.netDrivers; + } + + if (response.maxTargets) { + self.maxTargets = response.maxTargets; + } + + if (!!data.init) { + self.uplMaxSize = self.returnBytes(response.uplMaxSize); + self.uplMaxFile = !!response.uplMaxFile? Math.min(parseInt(response.uplMaxFile), 50) : 20; + } + } + + if (typeof prepare === 'function') { + prepare(response); + } + + if (navigate) { + actionTarget = navigate.target || 'added'; + if (response[actionTarget] && response[actionTarget].length) { + self.one(cmd + 'done', function() { + var targets = response[actionTarget], + newItems = self.findCwdNodes(targets), + inCwdHashes = function() { + var cwdHash = self.cwd().hash; + return $.map(targets, function(f) { return (f.phash && cwdHash === f.phash)? f.hash : null; }); + }, + hashes = inCwdHashes(), + makeToast = function(t) { + var node = void(0), + data = t.action? t.action.data : void(0), + cmd, msg, done; + if ((data || hashes.length) && t.action && (msg = t.action.msg) && (cmd = t.action.cmd) && (!t.action.cwdNot || t.action.cwdNot !== self.cwd().hash)) { + done = t.action.done; + data = t.action.data; + node = $('
') + .append( + $('') + .on('mouseenter mouseleave', function(e) { + $(this).toggleClass('ui-state-hover', e.type == 'mouseenter'); + }) + .on('click', function() { + self.exec(cmd, data || hashes, {_userAction: true, _currentType: 'toast', _currentNode: $(this) }); + if (done) { + self.one(cmd+'done', function() { + if (typeof done === 'function') { + done(); + } else if (done === 'select') { + self.trigger('selectfiles', {files : inCwdHashes()}); + } + }); + } + }) + ); + } + delete t.action; + t.extNode = node; + return t; + }; + + if (! navigate.toast) { + navigate.toast = {}; + } + + !navigate.noselect && self.trigger('selectfiles', {files : self.searchStatus.state > 1 ? $.map(targets, function(f) { return f.hash; }) : hashes}); + + if (newItems.length) { + if (!navigate.noscroll) { + newItems.first().trigger('scrolltoview', {blink : false}); + self.resources.blink(newItems, 'lookme'); + } + if ($.isPlainObject(navigate.toast.incwd)) { + self.toast(makeToast(navigate.toast.incwd)); + } + } else { + if ($.isPlainObject(navigate.toast.inbuffer)) { + self.toast(makeToast(navigate.toast.inbuffer)); + } + } + }); + } + } + + dfrd.resolve(response); + + response.debug && self.debug('backend-debug', response); + }; + self.abortXHR(xhr); + lazy? self.lazy(resolve) : resolve(); + }, + xhr, _xhr, + xhrAbort = function(e) { + if (xhr && xhr.state() === 'pending') { + self.abortXHR(xhr, { quiet: true , abort: true }); + if (!e || (e.type !== 'unload' && e.type !== 'destroy')) { + self.autoSync(); + } + } + }, + abort = function(e){ + self.trigger(cmd + 'done'); + if (e.type == 'autosync') { + if (e.data.action != 'stop') return; + } else if (e.type != 'unload' && e.type != 'destroy' && e.type != 'openxhrabort') { + if (!e.data.added || !e.data.added.length) { + return; + } + } + xhrAbort(e); + }, + request = function(mode) { + var queueAbort = function() { + syncOnFail = false; + dfrd.reject(); + }; + + if (mode) { + if (mode === 'cmd') { + return cmd; + } + } + + if (isOpen) { + if (currentOpenCmd && currentOpenCmd.state() === 'pending') { + if (currentOpenCmd._target === data.target) { + return dfrd.reject('openabort'); + } else { + if (currentOpenCmd.xhr) { + currentOpenCmd.xhr.queueAbort(); + } else { + currentOpenCmd.reject('openabort'); + } + } + } + currentOpenCmd = dfrd; + currentOpenCmd._target = data.target; + } + + dfrd.always(function() { + delete options.headers['X-elFinderReqid']; + if (isOpen) { + currentOpenCmd = null; + } + }).fail(function(error, xhr, response) { + var errData, errMsg; + + if (isOpen && error === 'openabort') { + error = ''; + syncOnFail = false; + } + + errData = { + cmd: cmd, + err: error, + xhr: xhr, + rc: response + }; + + // unset this cmd queue when user canceling + // see notify : function - `cancel.reject(0);` + if (error === 0) { + if (requestQueue.length) { + requestQueue = $.grep(requestQueue, function(req) { + return (req('cmd') === cmd) ? false : true; + }); + } + } + // trigger "requestError" event + self.trigger('requestError', errData); + if (errData._getEvent && errData._getEvent().isDefaultPrevented()) { + deffail = false; + syncOnFail = false; + if (error) { + error.error = ''; + } + } + // abort xhr + xhrAbort(); + if (isOpen) { + openDir = self.file(data.target); + openDir && openDir.volumeid && self.isRoot(openDir) && delete self.volumeExpires[openDir.volumeid]; + } + self.trigger(cmd + 'fail', response); + errMsg = (typeof error === 'object')? error.error : error; + if (errMsg) { + deffail ? self.error(errMsg) : self.debug('error', self.i18n(errMsg)); + } + syncOnFail && self.sync(); + }); + + if (!cmd) { + syncOnFail = false; + return dfrd.reject({error :'errCmdReq'}); + } + + if (self.maxTargets && data.targets && data.targets.length > self.maxTargets) { + syncOnFail = false; + return dfrd.reject({error :['errMaxTargets', self.maxTargets]}); + } + + defdone && dfrd.done(done); + + // quiet abort not completed "open" requests + if (isOpen) { + while ((_xhr = queue.pop())) { + _xhr.queueAbort(); + } + if (cwd !== data.target) { + while ((_xhr = cwdQueue.pop())) { + _xhr.queueAbort(); + } + } + } + + // trigger abort autoSync for commands to add the item + if ($.inArray(cmd, (self.cmdsToAdd + ' autosync').split(' ')) !== -1) { + if (cmd !== 'autosync') { + self.autoSync('stop'); + dfrd.always(function() { + self.autoSync(); + }); + } + self.trigger('openxhrabort'); + } + + delete options.preventFail; + + if (self.api >= 2.1029) { + if (useCache) { + options.headers['X-elFinderReqid'] = reqId; + } else { + Object.assign(options.data, { reqid : reqId }); + } + } + + // function for set value of this syncOnFail + dfrd.syncOnFail = function(state) { + syncOnFail = !!state; + }; + + requestCnt++; + + dfrd.xhr = xhr = self.transport.send(options).always(function() { + // set responseURL from native xhr object + if (options._xhr && typeof options._xhr.responseURL !== 'undefined') { + xhr.responseURL = options._xhr.responseURL || ''; + } + --requestCnt; + if (requestQueue.length) { + requestQueue.shift()(); + } + }).fail(error).done(success); + + if (self.api >= 2.1029) { + xhr._requestId = reqId; + } + + if (isOpen || (data.compare && cmd === 'info')) { + // regist function queueAbort + xhr.queueAbort = queueAbort; + // add autoSync xhr into queue + queue.unshift(xhr); + // bind abort() + data.compare && self.bind(self.cmdsToAdd + ' autosync openxhrabort', abort); + dfrd.always(function() { + var ndx = $.inArray(xhr, queue); + data.compare && self.unbind(self.cmdsToAdd + ' autosync openxhrabort', abort); + ndx !== -1 && queue.splice(ndx, 1); + }); + } else if ($.inArray(cmd, self.abortCmdsOnOpen) !== -1) { + // regist function queueAbort + xhr.queueAbort = queueAbort; + // add "open" xhr, only cwd xhr into queue + cwdQueue.unshift(xhr); + dfrd.always(function() { + var ndx = $.inArray(xhr, cwdQueue); + ndx !== -1 && cwdQueue.splice(ndx, 1); + }); + } + + // abort pending xhr on window unload or elFinder destroy + self.bind('unload destroy', abort); + dfrd.always(function() { + self.unbind('unload destroy', abort); + }); + + return dfrd; + }, + queueingRequest = function() { + // show notify + if (notify.type && notify.cnt) { + if (cancel) { + notify.cancel = dfrd; + opts.eachCancel && (notify.id = +new Date()); + } + timeout = setTimeout(function() { + // start fake count up + progTm = setTimeout(progFakeUp, 1000); + self.notify(notify); + hasNotify = true; + dfrd.always(function() { + notify.cnt = -(parseInt(notify.cnt)||0); + self.notify(notify); + hasNotify = false; + }); + }, self.notifyDelay); + + dfrd.always(function() { + clearTimeout(timeout); + }); + } + // queueing + if (requestCnt < requestMaxConn) { + // do request + return request(); + } else { + if (isOpen) { + requestQueue.unshift(request); + } else { + requestQueue.push(request); + } + return dfrd; + } + }, + progFakeUp = function() { + var add; + if (hasNotify && progTm) { + add = 1 * notify.cnt; + progTm = null; + self.notify({ + type: notify.type, + progress: add, + cnt: 0, + hideCnt: notify.hideCnt + }); + prog += add; + if ((prog / notify.cnt) < 80) { + progTm = setTimeout(progFakeUp, 500); + } + } + }, + bindData = {opts: opts, result: true}, + openDir; + + // prevent request initial request is completed + if (!self.api && !data.init) { + syncOnFail = false; + return dfrd.reject(); + } + + // trigger "request.cmd" that callback be able to cancel request by substituting "false" for "event.data.result" + self.trigger('request.' + cmd, bindData, true); + + if (! bindData.result) { + self.trigger(cmd + 'done'); + return dfrd.reject(); + } else if (typeof bindData.result === 'object' && bindData.result.promise) { + bindData.result + .done(queueingRequest) + .fail(function() { + self.trigger(cmd + 'done'); + dfrd.reject(); + }); + return dfrd; + } + + return queueingRequest(); + }; + + /** + * Call cache() + * Store info about files/dirs in "files" object. + * + * @param Array files + * @param String type + * @return void + */ + this.cache = function(dataArray, type) { + if (! Array.isArray(dataArray)) { + dataArray = [ dataArray ]; + } + cache(dataArray, type); + }; + + /** + * Update file object caches by respose data object + * + * @param Object respose data object + * @return void + */ + this.updateCache = function(data) { + if ($.isPlainObject(data)) { + data.files && data.files.length && cache(data.files, 'files'); + data.tree && data.tree.length && cache(data.tree, 'tree'); + data.removed && data.removed.length && remove(data.removed); + data.added && data.added.length && cache(data.added, 'add'); + data.changed && data.changed.length && cache(data.changed, 'change'); + } + }; + + /** + * Compare current files cache with new files and return diff + * + * @param Array new files + * @param String target folder hash + * @param Array exclude properties to compare + * @return Object + */ + this.diff = function(incoming, onlydir, excludeProps) { + var raw = {}, + added = [], + removed = [], + changed = [], + excludes = null, + isChanged = function(hash) { + var l = changed.length; + + while (l--) { + if (changed[l].hash == hash) { + return true; + } + } + }; + + $.each(incoming, function(i, f) { + raw[f.hash] = f; + }); + + // make excludes object + if (excludeProps && excludeProps.length) { + excludes = {}; + $.each(excludeProps, function() { + excludes[this] = true; + }); + } + + // find removed + $.each(files, function(hash, f) { + if (! raw[hash] && (! onlydir || f.phash === onlydir)) { + removed.push(hash); + } + }); + + // compare files + $.each(raw, function(hash, file) { + var origin = files[hash], + orgKeys = {}, + chkKeyLen; + + if (!origin) { + added.push(file); + } else { + // make orgKeys object + $.each(Object.keys(origin), function() { + orgKeys[this] = true; + }); + $.each(file, function(prop) { + delete orgKeys[prop]; + if (! excludes || ! excludes[prop]) { + if (file[prop] !== origin[prop]) { + changed.push(file); + orgKeys = {}; + return false; + } + } + }); + chkKeyLen = Object.keys(orgKeys).length; + if (chkKeyLen !== 0) { + if (excludes) { + $.each(orgKeys, function(prop) { + if (excludes[prop]) { + --chkKeyLen; + } + }); + } + (chkKeyLen !== 0) && changed.push(file); + } + } + }); + + // parents of removed dirs mark as changed (required for tree correct work) + $.each(removed, function(i, hash) { + var file = files[hash], + phash = file.phash; + + if (phash + && file.mime == 'directory' + && $.inArray(phash, removed) === -1 + && raw[phash] + && !isChanged(phash)) { + changed.push(raw[phash]); + } + }); + + return { + added : added, + removed : removed, + changed : changed + }; + }; + + /** + * Sync Stopper + * + * @type Boolean + */ + this.syncStopper = false; + + /** + * Sync content + * + * @return jQuery.Deferred + */ + this.sync = function(onlydir, polling) { + if (this.syncStopper) { + return $.Deferred().reject(); + } + this.syncStopper = true; + this.autoSync('stop'); + var self = this, + compare = function(){ + var c = '', cnt = 0, mtime = 0; + if (onlydir && polling) { + $.each(files, function(h, f) { + if (f.phash && f.phash === onlydir) { + ++cnt; + mtime = Math.max(mtime, f.ts); + } + c = cnt+':'+mtime; + }); + } + return c; + }, + comp = compare(), + dfrd = $.Deferred().always(function() { !reqFail && self.trigger('sync'); }), + opts = [this.request({ + data : {cmd : 'open', reload : 1, target : cwd, tree : (! onlydir && this.ui.tree) ? 1 : 0, compare : comp}, + preventDefault : true + })], + exParents = function() { + var parents = [], + curRoot = self.file(self.root(cwd)), + curId = curRoot? curRoot.volumeid : null, + phash = self.cwd().phash, + isroot,pdir; + + while(phash) { + if (pdir = self.file(phash)) { + if (phash.indexOf(curId) !== 0) { + parents.push( {target: phash, cmd: 'tree'} ); + if (! self.isRoot(pdir)) { + parents.push( {target: phash, cmd: 'parents'} ); + } + curRoot = self.file(self.root(phash)); + curId = curRoot? curRoot.volumeid : null; + } + phash = pdir.phash; + } else { + phash = null; + } + } + return parents; + }, + reqFail; + + if (! onlydir && self.api >= 2) { + (cwd !== this.root()) && opts.push(this.request({ + data : {cmd : 'parents', target : cwd}, + preventDefault : true + })); + $.each(exParents(), function(i, data) { + opts.push(self.request({ + data : {cmd : data.cmd, target : data.target}, + preventDefault : true + })); + }); + } + $.when.apply($, opts) + .fail(function(error, xhr) { + reqFail = (xhr && xhr.status != 200); + if (! polling || $.inArray('errOpen', error) !== -1) { + dfrd.reject(error); + self.parseError(error) && self.request({ + data : {cmd : 'open', target : (self.lastDir('') || self.root()), tree : 1, init : 1}, + notify : {type : 'open', cnt : 1, hideCnt : true} + }); + } else { + dfrd.reject((error && xhr.status != 0)? error : void 0); + } + }) + .done(function(odata) { + var pdata, argLen, i; + + if (odata.cwd.compare) { + if (comp === odata.cwd.compare) { + return dfrd.reject(); + } + } + + // for 2nd and more requests + pdata = {tree : []}; + + // results marge of 2nd and more requests + argLen = arguments.length; + if (argLen > 1) { + for(i = 1; i < argLen; i++) { + if (arguments[i].tree && arguments[i].tree.length) { + pdata.tree.push.apply(pdata.tree, arguments[i].tree); + } + } + } + + if (self.api < 2.1) { + if (! pdata.tree) { + pdata.tree = []; + } + pdata.tree.push(odata.cwd); + } + + // data normalize + odata = self.normalize(odata); + if (!self.validResponse('open', odata)) { + return dfrd.reject((odata.norError || 'errResponse')); + } + pdata = self.normalize(pdata); + if (!self.validResponse('tree', pdata)) { + return dfrd.reject((pdata.norError || 'errResponse')); + } + + var diff = self.diff(odata.files.concat(pdata && pdata.tree ? pdata.tree : []), onlydir); + + diff.added.push(odata.cwd); + + self.updateCache(diff); + + // trigger events + diff.removed.length && self.remove(diff); + diff.added.length && self.add(diff); + diff.changed.length && self.change(diff); + return dfrd.resolve(diff); + }) + .always(function() { + self.syncStopper = false; + self.autoSync(); + }); + + return dfrd; + }; + + this.upload = function(files) { + return this.transport.upload(files, this); + }; + + /** + * Bind keybord shortcut to keydown event + * + * @example + * elfinder.shortcut({ + * pattern : 'ctrl+a', + * description : 'Select all files', + * callback : function(e) { ... }, + * keypress : true|false (bind to keypress instead of keydown) + * }) + * + * @param Object shortcut config + * @return elFinder + */ + this.shortcut = function(s) { + var patterns, pattern, code, i, parts; + + if (this.options.allowShortcuts && s.pattern && $.isFunction(s.callback)) { + patterns = s.pattern.toUpperCase().split(/\s+/); + + for (i= 0; i < patterns.length; i++) { + pattern = patterns[i]; + parts = pattern.split('+'); + code = (code = parts.pop()).length == 1 + ? (code > 0 ? code : code.charCodeAt(0)) + : (code > 0 ? code : $.ui.keyCode[code]); + + if (code && !shortcuts[pattern]) { + shortcuts[pattern] = { + keyCode : code, + altKey : $.inArray('ALT', parts) != -1, + ctrlKey : $.inArray('CTRL', parts) != -1, + shiftKey : $.inArray('SHIFT', parts) != -1, + type : s.type || 'keydown', + callback : s.callback, + description : s.description, + pattern : pattern + }; + } + } + } + return this; + }; + + /** + * Registered shortcuts + * + * @type Object + **/ + this.shortcuts = function() { + var ret = []; + + $.each(shortcuts, function(i, s) { + ret.push([s.pattern, self.i18n(s.description)]); + }); + return ret; + }; + + /** + * Get/set clipboard content. + * Return new clipboard content. + * + * @example + * this.clipboard([]) - clean clipboard + * this.clipboard([{...}, {...}], true) - put 2 files in clipboard and mark it as cutted + * + * @param Array new files hashes + * @param Boolean cut files? + * @return Array + */ + this.clipboard = function(hashes, cut) { + var map = function() { return $.map(clipboard, function(f) { return f.hash; }); }; + + if (hashes !== void(0)) { + clipboard.length && this.trigger('unlockfiles', {files : map()}); + remember = {}; + + clipboard = $.map(hashes||[], function(hash) { + var file = files[hash]; + if (file) { + + remember[hash] = true; + + return { + hash : hash, + phash : file.phash, + name : file.name, + mime : file.mime, + read : file.read, + locked : file.locked, + cut : !!cut + }; + } + return null; + }); + this.trigger('changeclipboard', {clipboard : clipboard.slice(0, clipboard.length)}); + cut && this.trigger('lockfiles', {files : map()}); + } + + // return copy of clipboard instead of refrence + return clipboard.slice(0, clipboard.length); + }; + + /** + * Return true if command enabled + * + * @param String command name + * @param String|void hash for check of own volume's disabled cmds + * @return Boolean + */ + this.isCommandEnabled = function(name, dstHash) { + var disabled, cmd, + cvid = self.cwd().volumeid || ''; + + // In serach results use selected item hash to check + if (!dstHash && self.searchStatus.state > 1 && self.selected().length) { + dstHash = self.selected()[0]; + } + if (dstHash && (! cvid || dstHash.indexOf(cvid) !== 0)) { + disabled = self.option('disabledFlip', dstHash); + //if (! disabled) { + // disabled = {}; + //} + } else { + disabled = cwdOptions.disabledFlip/* || {}*/; + } + cmd = this._commands[name]; + return cmd ? (cmd.alwaysEnabled || !disabled[name]) : false; + }; + + /** + * Exec command and return result; + * + * @param String command name + * @param String|Array usualy files hashes + * @param String|Array command options + * @param String|void hash for enabled check of own volume's disabled cmds + * @return $.Deferred + */ + this.exec = function(cmd, files, opts, dstHash) { + var dfrd, resType; + + // apply commandMap for keyboard shortcut + if (!dstHash && this.commandMap[cmd] && this.commandMap[cmd] !== 'hidden') { + cmd = this.commandMap[cmd]; + } + + if (cmd === 'open') { + if (this.searchStatus.state || this.searchStatus.ininc) { + this.trigger('searchend', { noupdate: true }); + } + this.autoSync('stop'); + } + if (!dstHash && files) { + if ($.isArray(files)) { + if (files.length) { + dstHash = files[0]; + } + } else { + dstHash = files; + } + } + dfrd = this._commands[cmd] && this.isCommandEnabled(cmd, dstHash) + ? this._commands[cmd].exec(files, opts) + : $.Deferred().reject('errUnknownCmd'); + + resType = typeof dfrd; + if (!(resType === 'object' && dfrd.promise)) { + self.debug('warning', '"cmd.exec()" should be returned "$.Deferred" but cmd "' + cmd + '" returned "' + resType + '"'); + dfrd = $.Deferred().resolve(); + } + + this.trigger('exec', { dfrd : dfrd, cmd : cmd, files : files, opts : opts, dstHash : dstHash }); + return dfrd; + }; + + /** + * Create and return dialog. + * + * @param String|DOMElement dialog content + * @param Object dialog options + * @return jQuery + */ + this.dialog = function(content, options) { + var dialog = $('
').append(content).appendTo(node).elfinderdialog(options, self), + dnode = dialog.closest('.ui-dialog'), + resize = function(){ + ! dialog.data('draged') && dialog.is(':visible') && dialog.elfinderdialog('posInit'); + }; + if (dnode.length) { + self.bind('resize', resize); + dnode.on('remove', function() { + self.unbind('resize', resize); + }); + } + return dialog; + }; + + /** + * Create and return toast. + * + * @param Object toast options - see ui/toast.js + * @return jQuery + */ + this.toast = function(options) { + return $('
').appendTo(this.ui.toast).elfindertoast(options || {}, this); + }; + + /** + * Return UI widget or node + * + * @param String ui name + * @return jQuery + */ + this.getUI = function(ui) { + return ui? (this.ui[ui] || $()) : node; + }; + + /** + * Return elFinder.command instance or instances array + * + * @param String command name + * @return Object | Array + */ + this.getCommand = function(name) { + return name === void(0) ? this._commands : this._commands[name]; + }; + + /** + * Resize elfinder node + * + * @param String|Number width + * @param String|Number height + * @return void + */ + this.resize = function(w, h) { + var getMargin = function() { + var m = node.outerHeight(true) - node.innerHeight(), + p = node; + + while(p.get(0) !== heightBase.get(0)) { + p = p.parent(); + m += p.outerHeight(true) - p.innerHeight(); + if (! p.parent().length) { + // reached the document + break; + } + } + return m; + }, + fit = ! node.hasClass('ui-resizable'), + prv = node.data('resizeSize') || {w: 0, h: 0}, + mt, size = {}; + + if (heightBase && heightBase.data('resizeTm')) { + clearTimeout(heightBase.data('resizeTm')); + } + + if (! self.options.noResizeBySelf) { + if (typeof h === 'string') { + if (mt = h.match(/^([0-9.]+)%$/)) { + // setup heightBase + if (! heightBase || ! heightBase.length) { + heightBase = $(window); + } + if (! heightBase.data('marginToMyNode')) { + heightBase.data('marginToMyNode', getMargin()); + } + if (! heightBase.data('fitToBaseFunc')) { + heightBase.data('fitToBaseFunc', function(e) { + var tm = heightBase.data('resizeTm'); + e.preventDefault(); + e.stopPropagation(); + tm && cancelAnimationFrame(tm); + if (! node.hasClass('elfinder-fullscreen') && (!self.UA.Mobile || heightBase.data('rotated') !== self.UA.Rotated)) { + heightBase.data('rotated', self.UA.Rotated); + heightBase.data('resizeTm', requestAnimationFrame(function() { + self.restoreSize(); + })); + } + }); + } + if (typeof heightBase.data('rotated') === 'undefined') { + heightBase.data('rotated', self.UA.Rotated); + } + h = heightBase.height() * (mt[1] / 100) - heightBase.data('marginToMyNode'); + + heightBase.off('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); + fit && heightBase.on('resize.' + self.namespace, heightBase.data('fitToBaseFunc')); + } + } + + node.css({ width : w, height : parseInt(h) }); + } + + size.w = Math.round(node.width()); + size.h = Math.round(node.height()); + node.data('resizeSize', size); + if (size.w !== prv.w || size.h !== prv.h) { + node.trigger('resize'); + this.trigger('resize', {width : size.w, height : size.h}); + } + }; + + /** + * Restore elfinder node size + * + * @return elFinder + */ + this.restoreSize = function() { + this.resize(width, height); + }; + + this.show = function() { + node.show(); + this.enable().trigger('show'); + }; + + this.hide = function() { + if (this.options.enableAlways) { + prevEnabled = enabled; + enabled = false; + } + this.disable(); + this.trigger('hide'); + node.hide(); + }; + + /** + * Lazy execution function + * + * @param Object function + * @param Number delay + * @param Object options + * @return Object jQuery.Deferred + */ + this.lazy = function(func, delay, opts) { + var busy = function(state) { + var cnt = node.data('lazycnt'), + repaint; + + if (state) { + repaint = node.data('lazyrepaint')? false : opts.repaint; + if (! cnt) { + node.data('lazycnt', 1) + .addClass('elfinder-processing'); + } else { + node.data('lazycnt', ++cnt); + } + if (repaint) { + node.data('lazyrepaint', true).css('display'); // force repaint + } + } else { + if (cnt && cnt > 1) { + node.data('lazycnt', --cnt); + } else { + repaint = node.data('lazyrepaint'); + node.data('lazycnt', 0) + .removeData('lazyrepaint') + .removeClass('elfinder-processing'); + repaint && node.css('display'); // force repaint; + self.trigger('lazydone'); + } + } + }, + dfd = $.Deferred(), + callFunc = function() { + dfd.resolve(func.call(dfd)); + busy(false); + }; + + delay = delay || 0; + opts = opts || {}; + busy(true); + + if (delay) { + setTimeout(callFunc, delay); + } else { + requestAnimationFrame(callFunc); + } + + return dfd; + }; + + /** + * Destroy this elFinder instance + * + * @return void + **/ + this.destroy = function() { + if (node && node[0].elfinder) { + node.hasClass('elfinder-fullscreen') && self.toggleFullscreen(node); + this.options.syncStart = false; + this.autoSync('forcestop'); + this.trigger('destroy').disable(); + clipboard = []; + selected = []; + listeners = {}; + shortcuts = {}; + $(window).off('.' + namespace); + $(document).off('.' + namespace); + self.trigger = function(){}; + $(beeper).remove(); + node.off() + .removeData() + .empty() + .append(prevContent.contents()) + .attr('class', prevContent.attr('class')) + .attr('style', prevContent.attr('style')); + delete node[0].elfinder; + // restore kept events + $.each(prevEvents, function(n, arr) { + $.each(arr, function(i, o) { + node.on(o.type + (o.namespace? '.'+o.namespace : ''), o.selector, o.handler); + }); + }); + } + }; + + /** + * Start or stop auto sync + * + * @param String|Bool stop + * @return void + */ + this.autoSync = function(mode) { + var sync; + if (self.options.sync >= 1000) { + if (syncInterval) { + clearTimeout(syncInterval); + syncInterval = null; + self.trigger('autosync', {action : 'stop'}); + } + + if (mode === 'stop') { + ++autoSyncStop; + } else { + autoSyncStop = Math.max(0, --autoSyncStop); + } + + if (autoSyncStop || mode === 'forcestop' || ! self.options.syncStart) { + return; + } + + // run interval sync + sync = function(start){ + var timeout; + if (cwdOptions.syncMinMs && (start || syncInterval)) { + start && self.trigger('autosync', {action : 'start'}); + timeout = Math.max(self.options.sync, cwdOptions.syncMinMs); + syncInterval && clearTimeout(syncInterval); + syncInterval = setTimeout(function() { + var dosync = true, hash = cwd, cts; + if (cwdOptions.syncChkAsTs && files[hash] && (cts = files[hash].ts)) { + self.request({ + data : {cmd : 'info', targets : [hash], compare : cts, reload : 1}, + preventDefault : true + }) + .done(function(data){ + var ts; + dosync = true; + if (data.compare) { + ts = data.compare; + if (ts == cts) { + dosync = false; + } + } + if (dosync) { + self.sync(hash).always(function(){ + if (ts) { + // update ts for cache clear etc. + files[hash].ts = ts; + } + sync(); + }); + } else { + sync(); + } + }) + .fail(function(error, xhr){ + var err = self.parseError(error); + if (err && xhr.status != 0) { + self.error(err); + if (Array.isArray(err) && $.inArray('errOpen', err) !== -1) { + self.request({ + data : {cmd : 'open', target : (self.lastDir('') || self.root()), tree : 1, init : 1}, + notify : {type : 'open', cnt : 1, hideCnt : true} + }); + } + } else { + syncInterval = setTimeout(function() { + sync(); + }, timeout); + } + }); + } else { + self.sync(cwd, true).always(function(){ + sync(); + }); + } + }, timeout); + } + }; + sync(true); + } + }; + + /** + * Return bool is inside work zone of specific point + * + * @param Number event.pageX + * @param Number event.pageY + * @return Bool + */ + this.insideWorkzone = function(x, y, margin) { + var rectangle = this.getUI('workzone').data('rectangle'); + + margin = margin || 1; + if (x < rectangle.left + margin + || x > rectangle.left + rectangle.width + margin + || y < rectangle.top + margin + || y > rectangle.top + rectangle.height + margin) { + return false; + } + return true; + }; + + /** + * Target ui node move to last of children of elFinder node fot to show front + * + * @param Object target Target jQuery node object + */ + this.toFront = function(target) { + var nodes = node.children('.ui-front').removeClass('elfinder-frontmost'), + lastnode = nodes.last(); + nodes.css('z-index', ''); + $(target).addClass('ui-front elfinder-frontmost').css('z-index', lastnode.css('z-index') + 1); + }; + + /** + * Remove class 'elfinder-frontmost' and hide() to target ui node + * + * @param Object target Target jQuery node object + * @param Boolean nohide Do not hide + */ + this.toHide =function(target, nohide) { + var tgt = $(target), + last; + + !nohide && tgt.hide(); + if (tgt.hasClass('elfinder-frontmost')) { + tgt.removeClass('elfinder-frontmost'); + last = node.children('.ui-front:visible:not(.elfinder-frontmost)').last(); + if (last.length) { + requestAnimationFrame(function() { + if (!node.children('.elfinder-frontmost:visible').length) { + self.toFront(last); + last.trigger('frontmost'); + } + }); + } + } + }; + + /** + * Return css object for maximize + * + * @return Object + */ + this.getMaximizeCss = function() { + return { + width : '100%', + height : '100%', + margin : 0, + top : 0, + left : 0, + display : 'block', + position: 'fixed', + zIndex : Math.max(self.zIndex? (self.zIndex + 1) : 0 , 1000), + maxWidth : '', + maxHeight: '' + }; + }; + + // Closure for togglefullscreen + (function() { + // check is in iframe + if (inFrame && self.UA.Fullscreen) { + self.UA.Fullscreen = false; + if (parentIframe && typeof parentIframe.attr('allowfullscreen') !== 'undefined') { + self.UA.Fullscreen = true; + } + } + + var orgStyle, bodyOvf, resizeTm, fullElm, exitFull, toFull, funcObj, + cls = 'elfinder-fullscreen', + clsN = 'elfinder-fullscreen-native', + checkDialog = function() { + var t = 0, + l = 0; + $.each(node.children('.ui-dialog,.ui-draggable'), function(i, d) { + var $d = $(d), + pos = $d.position(); + + if (pos.top < 0) { + $d.css('top', t); + t += 20; + } + if (pos.left < 0) { + $d.css('left', l); + l += 20; + } + }); + }, + setFuncObj = function() { + var useFullscreen = self.storage('useFullscreen'); + funcObj = self.UA.Fullscreen && (useFullscreen? useFullscreen > 0 : self.options.commandsOptions.fullscreen.mode === 'screen') ? { + // native full screen mode + + fullElm: function() { + return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || null; + }, + + exitFull: function() { + if (document.exitFullscreen) { + return document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + return document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + return document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + return document.msExitFullscreen(); + } + }, + + toFull: function(elem) { + if (elem.requestFullscreen) { + return elem.requestFullscreen(); + } else if (elem.webkitRequestFullscreen) { + return elem.webkitRequestFullscreen(); + } else if (elem.mozRequestFullScreen) { + return elem.mozRequestFullScreen(); + } else if (elem.msRequestFullscreen) { + return elem.msRequestFullscreen(); + } + return false; + } + } : { + // node element maximize mode + + fullElm: function() { + var full; + if (node.hasClass(cls)) { + return node.get(0); + } else { + full = node.find('.' + cls); + if (full.length) { + return full.get(0); + } + } + return null; + }, + + exitFull: function() { + var elm; + + $(window).off('resize.' + namespace, resize); + if (bodyOvf !== void(0)) { + $('body').css('overflow', bodyOvf); + } + bodyOvf = void(0); + + if (orgStyle) { + elm = orgStyle.elm; + restoreStyle(elm); + $(elm).trigger('resize', {fullscreen: 'off'}); + } + + $(window).trigger('resize'); + }, + + toFull: function(elem) { + bodyOvf = $('body').css('overflow') || ''; + $('body').css('overflow', 'hidden'); + + $(elem).css(self.getMaximizeCss()) + .addClass(cls) + .trigger('resize', {fullscreen: 'on'}); + + checkDialog(); + + $(window).on('resize.' + namespace, resize).trigger('resize'); + + return true; + } + }; + }, + restoreStyle = function(elem) { + if (orgStyle && orgStyle.elm == elem) { + $(elem).removeClass(cls + ' ' + clsN).attr('style', orgStyle.style); + orgStyle = null; + } + }, + resize = function(e) { + var elm; + if (e.target === window) { + resizeTm && cancelAnimationFrame(resizeTm); + resizeTm = requestAnimationFrame(function() { + if (elm = funcObj.fullElm()) { + $(elm).trigger('resize', {fullscreen: 'on'}); + } + }); + } + }; + + setFuncObj(); + + $(document).on('fullscreenchange.' + namespace + ' webkitfullscreenchange.' + namespace + ' mozfullscreenchange.' + namespace + ' MSFullscreenChange.' + namespace, function(e){ + if (self.UA.Fullscreen) { + var elm = funcObj.fullElm(), + win = $(window); + + resizeTm && cancelAnimationFrame(resizeTm); + if (elm === null) { + win.off('resize.' + namespace, resize); + if (orgStyle) { + elm = orgStyle.elm; + restoreStyle(elm); + $(elm).trigger('resize', {fullscreen: 'off'}); + } + } else { + $(elm).addClass(cls + ' ' + clsN) + .attr('style', 'width:100%; height:100%; margin:0; padding:0;') + .trigger('resize', {fullscreen: 'on'}); + win.on('resize.' + namespace, resize); + checkDialog(); + } + win.trigger('resize'); + } + }); + + /** + * Toggle Full Scrren Mode + * + * @param Object target + * @param Bool full + * @return Object | Null DOM node object of current full scrren + */ + self.toggleFullscreen = function(target, full) { + var elm = $(target).get(0), + curElm = null; + + curElm = funcObj.fullElm(); + if (curElm) { + if (curElm == elm) { + if (full === true) { + return curElm; + } + } else { + if (full === false) { + return curElm; + } + } + funcObj.exitFull(); + return null; + } else { + if (full === false) { + return null; + } + } + + setFuncObj(); + orgStyle = {elm: elm, style: $(elm).attr('style')}; + if (funcObj.toFull(elm) !== false) { + return elm; + } else { + orgStyle = null; + return null; + } + }; + })(); + + // Closure for toggleMaximize + (function(){ + var cls = 'elfinder-maximized', + resizeTm, + resize = function(e) { + if (e.target === window && e.data && e.data.elm) { + var elm = e.data.elm; + resizeTm && cancelAnimationFrame(resizeTm); + resizeTm = requestAnimationFrame(function() { + elm.trigger('resize', {maximize: 'on'}); + }); + } + }, + exitMax = function(elm) { + $(window).off('resize.' + namespace, resize); + $('body').css('overflow', elm.data('bodyOvf')); + elm.removeClass(cls) + .attr('style', elm.data('orgStyle')) + .removeData('bodyOvf') + .removeData('orgStyle'); + elm.trigger('resize', {maximize: 'off'}); + }, + toMax = function(elm) { + elm.data('bodyOvf', $('body').css('overflow') || '') + .data('orgStyle', elm.attr('style')) + .addClass(cls) + .css(self.getMaximizeCss()); + $('body').css('overflow', 'hidden'); + $(window).on('resize.' + namespace, {elm: elm}, resize); + elm.trigger('resize', {maximize: 'on'}); + }; + + /** + * Toggle Maximize target node + * + * @param Object target + * @param Bool max + * @return void + */ + self.toggleMaximize = function(target, max) { + var elm = $(target), + maximized = elm.hasClass(cls); + + if (maximized) { + if (max === true) { + return; + } + exitMax(elm); + } else { + if (max === false) { + return; + } + toMax(elm); + } + }; + })(); + + /************* init stuffs ****************/ + Object.assign($.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, + 'DIG0' : 48, + 'DIG1' : 49, + 'DIG2' : 50, + 'DIG3' : 51, + 'DIG4' : 52, + 'DIG5' : 53, + 'DIG6' : 54, + 'DIG7' : 55, + 'DIG8' : 56, + 'DIG9' : 57, + 'NUM0' : 96, + 'NUM1' : 97, + 'NUM2' : 98, + 'NUM3' : 99, + 'NUM4' : 100, + 'NUM5' : 101, + 'NUM6' : 102, + 'NUM7' : 103, + 'NUM8' : 104, + 'NUM9' : 105, + 'CONTEXTMENU' : 93, + 'DOT' : 190 + }); + + this.dragUpload = false; + this.xhrUpload = (typeof XMLHttpRequestUpload != 'undefined' || typeof XMLHttpRequestEventTarget != 'undefined') && typeof File != 'undefined' && typeof FormData != 'undefined'; + + // configure transport object + this.transport = {}; + + if (typeof(this.options.transport) == 'object') { + this.transport = this.options.transport; + if (typeof(this.transport.init) == 'function') { + this.transport.init(this); + } + } + + if (typeof(this.transport.send) != 'function') { + this.transport.send = function(opts) { + if (!self.UA.IE) { + // keep native xhr object for handling property responseURL + opts._xhr = new XMLHttpRequest(); + opts.xhr = function() { + if (opts.progress) { + opts._xhr.addEventListener('progress', opts.progress); + } + return opts._xhr; + }; + } + return $.ajax(opts); + }; + } + + if (this.transport.upload == 'iframe') { + this.transport.upload = $.proxy(this.uploads.iframe, this); + } else if (typeof(this.transport.upload) == 'function') { + this.dragUpload = !!this.options.dragUploadAllow; + } else if (this.xhrUpload && !!this.options.dragUploadAllow) { + this.transport.upload = $.proxy(this.uploads.xhr, this); + this.dragUpload = true; + } else { + this.transport.upload = $.proxy(this.uploads.iframe, this); + } + + /** + * Decoding 'raw' string converted to unicode + * + * @param String str + * @return String + */ + this.decodeRawString = function(str) { + var charCodes = function(str) { + var i, len, arr; + for (i=0,len=str.length,arr=[]; i= 0xd800 && c <= 0xdbff) { + scalars.push((c & 1023) + 64 << 10 | arr[++i] & 1023); + } else { + scalars.push(c); + } + } + return scalars; + }, + decodeUTF8 = function(arr) { + var i, len, c, str, char = String.fromCharCode; + for (i=0,len=arr.length,str=""; c=arr[i],i= 0xc2) { + str += char((c&31)<<6 | arr[++i]&63); + } else if (c <= 0xef && c >= 0xe0) { + str += char((c&15)<<12 | (arr[++i]&63)<<6 | arr[++i]&63); + } else if (c <= 0xf7 && c >= 0xf0) { + str += char( + 0xd800 | ((c&7)<<8 | (arr[++i]&63)<<2 | arr[++i]>>>4&3) - 64, + 0xdc00 | (arr[i++]&15)<<6 | arr[i]&63 + ); + } else { + str += char(0xfffd); + } + } + return str; + }; + + return decodeUTF8(scalarValues(str)); + }; + + /** + * Gets target file contents by file.hash + * + * @param String hash The hash + * @param String responseType 'blob' or 'arraybuffer' (default) + * @param Object requestOpts The request options + * @return arraybuffer|blob The contents. + */ + this.getContents = function(hash, responseType, requestOpts) { + var self = this, + dfd = $.Deferred(), + type = responseType || 'arraybuffer', + url, req; + + dfd.fail(function() { + req && req.state() === 'pending' && req.reject(); + }); + + url = self.openUrl(hash); + if (!self.isSameOrigin(url)) { + url = self.openUrl(hash, true); + } + req = self.request(Object.assign({ + data : {cmd : 'get'}, + options : { + url: url, + type: 'get', + cache : true, + dataType : 'binary', + responseType : type, + processData: false + }, + notify : { + type: 'file', + cnt: 1, + hideCnt: true + }, + cancel : true + }, requestOpts || {})) + .fail(function() { + dfd.reject(); + }) + .done(function(data) { + dfd.resolve(data); + }); + + return dfd; + }; + + /** + * Gets the binary by url. + * + * @param {Object} opts The options + * @param {Function} callback The callback + * @param {Object} requestOpts The request options + * @return arraybuffer|blob The contents. + */ + this.getBinaryByUrl = function(opts, callback, requestOpts) { + var self = this, + dfd = $.Deferred(), + url, req; + + dfd.fail(function() { + req && req.state() === 'pending' && req.reject(); + }); + + req = self.request(Object.assign({ + data : {cmd : 'get'}, + options : Object.assign({ + type: 'get', + cache : true, + dataType : 'binary', + responseType : 'blob', + processData: false + }, opts) + }, requestOpts || {})) + .fail(function() { + dfd.reject(); + }) + .done(function(data) { + callback && callback(data); + dfd.resolve(data); + }); + + return dfd; + }; + + /** + * Gets the mimetype. + * + * @param {string} name The name + * @param {string} orgMime The organization mime + * @return {string} The mimetype. + */ + this.getMimetype = function(name, orgMime) { + var mime = orgMime, + ext, m; + m = (name + '').match(/\.([^.]+)$/); + if (m && (ext = m[1])) { + if (!extToMimeTable) { + extToMimeTable = self.arrayFlip(self.mimeTypes); + } + if (!(mime = extToMimeTable[ext.toLowerCase()])) { + mime = orgMime; + } + } + return mime; + }; + + /** + * Supported check hash algorisms + * + * @type Array + */ + self.hashCheckers = []; + + /** + * Closure of getContentsHashes() + */ + (function(self) { + var hashLibs = {}; + + if (window.Worker && window.ArrayBuffer) { + // make fm.hashCheckers + if (self.options.cdns.sparkmd5) { + hashLibs.SparkMD5 = true; + self.hashCheckers.push('md5'); + } + if (self.options.cdns.jssha) { + hashLibs.jsSHA = true; + self.hashCheckers = self.hashCheckers.concat(['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512', 'shake128', 'shake256']); + } + } + + /** + * Gets the contents hashes. + * + * @param String target target file.hash + * @param Object needHashes need hash lib names + * @param Object requestOpts The request options + * @return Object hashes with lib name as key + */ + self.getContentsHashes = function(target, needHashes, hashOpts, requestOpts) { + var dfd = $.Deferred(), + needs = self.arrayFlip(needHashes || ['md5'], true), + libs = [], + jobs = [], + res = {}, + opts = hashOpts? hashOpts : { + shake128len : 256, + shake256len : 512 + }, + req; + + dfd.fail(function() { + req && req.reject(); + }); + + if (Object.keys(hashLibs).length) { + req = self.getContents(target, 'arraybuffer', requestOpts).done(function(arrayBuffer) { + if (needs.md5 && hashLibs.SparkMD5) { + jobs.push((function() { + var job = $.Deferred(); + try { + var wk = self.getWorker(); + job.fail(function() { + wk && wk.terminate(); + }); + wk.onmessage = function(ans) { + wk && wk.terminate(); + if (ans.data.hash) { + var f; + res.md5 = ans.data.hash; + if (f = self.file(target)) { + f.md5 = res.md5; + } + } else if (ans.data.error) { + res.md5 = ans.data.error; + } + dfd.notify(res); + job.resolve(); + }; + wk.onerror = function(e) { + job.reject(); + }; + wk.postMessage({ + scripts: [self.options.cdns.sparkmd5, self.getWorkerUrl('calcfilehash.js')], + data: { type: 'md5', bin: arrayBuffer } + }); + dfd.fail(function() { + job.reject(); + }); + } catch(e) { + job.reject(); + delete hashLibs.SparkMD5; + } + return job; + })()); + } + if (hashLibs.jsSHA) { + $.each(['1', '224', '256', '384', '512', '3-224', '3-256', '3-384', '3-512', 'ke128', 'ke256'], function(i, v) { + if (needs['sha' + v]) { + jobs.push((function() { + var job = $.Deferred(); + try { + var wk = self.getWorker(); + job.fail(function() { + wk && wk.terminate(); + }); + wk.onmessage = function(ans) { + wk && wk.terminate(); + if (ans.data.hash) { + var f; + res['sha' + v] = ans.data.hash; + if (f = self.file(target)) { + f['sha' + v] = res['sha' + v]; + } + } else if (ans.data.error) { + res['sha' + v] = ans.data.error; + } + dfd.notify(res); + job.resolve(); + }; + wk.onerror = function(e) { + job.reject(); + }; + wk.postMessage({ + scripts: [self.options.cdns.jssha, self.getWorkerUrl('calcfilehash.js')], + data: { type: v, bin: arrayBuffer, hashOpts: opts } + }); + dfd.fail(function() { + job.reject(); + }); + } catch(e) { + job.reject(); + delete hashLibs.jsSHA; + } + return job; + })()); + } + }); + } + if (jobs.length) { + $.when.apply(null, jobs).always(function() { + dfd.resolve(res); + }); + } else { + dfd.reject(); + } + }).fail(function() { + dfd.reject(); + }); + } else { + dfd.reject(); + } + + return dfd; + }; + })(this); + + /** + * Parse error value to display + * + * @param Mixed error + * @return Mixed parsed error + */ + this.parseError = function(error) { + var arg = error; + if ($.isPlainObject(arg)) { + arg = arg.error; + } + return arg; + }; + + /** + * Alias for this.trigger('error', {error : 'message'}) + * + * @param String error message + * @return elFinder + **/ + this.error = function() { + var arg = arguments[0], + opts = arguments[1] || null, + err; + if (arguments.length == 1 && typeof(arg) === 'function') { + return self.bind('error', arg); + } else { + err = this.parseError(arg); + return (err === true || !err)? this : self.trigger('error', {error: err, opts : opts}); + } + }; + + // create bind/trigger aliases for build-in events + $.each(events, function(i, name) { + self[name] = function() { + var arg = arguments[0]; + return arguments.length == 1 && typeof(arg) == 'function' + ? self.bind(name, arg) + : self.trigger(name, $.isPlainObject(arg) ? arg : {}); + }; + }); + + // bind core event handlers + this + .enable(function() { + if (!enabled && self.api && self.visible() && self.ui.overlay.is(':hidden') && ! node.children('.elfinder-dialog.' + self.res('class', 'editing') + ':visible').length) { + enabled = true; + document.activeElement && document.activeElement.blur(); + node.removeClass('elfinder-disabled'); + } + }) + .disable(function() { + prevEnabled = enabled; + enabled = false; + node.addClass('elfinder-disabled'); + }) + .open(function() { + selected = []; + }) + .select(function(e) { + var cnt = 0, + unselects = []; + selected = $.grep(e.data.selected || e.data.value|| [], function(hash) { + if (unselects.length || (self.maxTargets && ++cnt > self.maxTargets)) { + unselects.push(hash); + return false; + } else { + return files[hash] ? true : false; + } + }); + if (unselects.length) { + self.trigger('unselectfiles', {files: unselects, inselect: true}); + self.toast({mode: 'warning', msg: self.i18n(['errMaxTargets', self.maxTargets])}); + } + }) + .error(function(e) { + var opts = { + cssClass : 'elfinder-dialog-error', + title : self.i18n('error'), + resizable : false, + destroyOnClose : true, + buttons : {} + }, + node = self.getUI(), + cnt = node.children('.elfinder-dialog-error').length, + last, counter; + + if (cnt < self.options.maxErrorDialogs) { + opts.buttons[self.i18n(self.i18n('btnClose'))] = function() { $(this).elfinderdialog('close'); }; + + if (e.data.opts && $.isPlainObject(e.data.opts)) { + Object.assign(opts, e.data.opts); + } + + self.dialog(''+self.i18n(e.data.error), opts); + } else { + last = node.children('.elfinder-dialog-error:last').children('.ui-dialog-content:first'); + counter = last.children('.elfinder-error-counter'); + if (counter.length) { + counter.data('cnt', parseInt(counter.data('cnt')) + 1).html(self.i18n(['moreErrors', counter.data('cnt')])); + } else { + counter = $(''+ self.i18n(['moreErrors', 1]) +'').data('cnt', 1); + last.append('
', counter); + } + } + }) + .bind('tmb', function(e) { + $.each(e.data.images||[], function(hash, tmb) { + if (files[hash]) { + files[hash].tmb = tmb; + } + }); + }) + .bind('searchstart', function(e) { + Object.assign(self.searchStatus, e.data); + self.searchStatus.state = 1; + }) + .bind('search', function(e) { + self.searchStatus.state = 2; + }) + .bind('searchend', function() { + self.searchStatus.state = 0; + self.searchStatus.ininc = false; + self.searchStatus.mixed = false; + }) + .bind('canMakeEmptyFile', function(e) { + var data = e.data, + obj = {}; + if (data && Array.isArray(data.mimes)) { + if (!data.unshift) { + obj = self.mimesCanMakeEmpty; + } + $.each(data.mimes, function() { + if (!obj[this]) { + obj[this] = self.mimeTypes[this]; + } + }); + if (data.unshift) { + self.mimesCanMakeEmpty = Object.assign(obj, self.mimesCanMakeEmpty); + } + } + }) + .bind('themechange', function() { + requestAnimationFrame(function() { + self.trigger('uiresize'); + }); + }) + ; + + // We listen and emit a sound on delete according to option + if (true === this.options.sound) { + this.bind('playsound', function(e) { + var play = beeper.canPlayType && beeper.canPlayType('audio/wav; codecs="1"'), + file = e.data && e.data.soundFile; + + play && file && play != '' && play != 'no' && $(beeper).html('')[0].play(); + }); + } + + // bind external event handlers + $.each(this.options.handlers, function(event, callback) { + self.bind(event, callback); + }); + + /** + * History object. Store visited folders + * + * @type Object + **/ + this.history = new this.history(this); + + /** + * Root hashed + * + * @type Object + */ + this.roots = {}; + + /** + * leaf roots + * + * @type Object + */ + this.leafRoots = {}; + + this.volumeExpires = {}; + + /** + * Loaded commands + * + * @type Object + **/ + this._commands = {}; + + if (!Array.isArray(this.options.commands)) { + this.options.commands = []; + } + + if ($.inArray('*', this.options.commands) !== -1) { + this.options.commands = Object.keys(this.commands); + } + + /** + * UI command map of cwd volume ( That volume driver option `uiCmdMap` ) + * + * @type Object + **/ + this.commandMap = {}; + + /** + * cwd options of each volume + * key: volumeid + * val: options object + * + * @type Object + */ + this.volOptions = {}; + + /** + * Has volOptions data + * + * @type Boolean + */ + this.hasVolOptions = false; + + /** + * Hash of trash holders + * key: trash folder hash + * val: source volume hash + * + * @type Object + */ + this.trashes = {}; + + /** + * cwd options of each folder/file + * key: hash + * val: options object + * + * @type Object + */ + this.optionsByHashes = {}; + + /** + * UI Auto Hide Functions + * Each auto hide function mast be call to `fm.trigger('uiautohide')` at end of process + * + * @type Array + **/ + this.uiAutoHide = []; + + // trigger `uiautohide` + this.one('open', function() { + if (self.uiAutoHide.length) { + setTimeout(function() { + self.trigger('uiautohide'); + }, 500); + } + }); + + // Auto Hide Functions sequential processing start + this.bind('uiautohide', function() { + if (self.uiAutoHide.length) { + self.uiAutoHide.shift()(); + } + }); + + if (this.options.width) { + width = this.options.width; + } + + if (this.options.height) { + height = this.options.height; + } + + if (this.options.heightBase) { + heightBase = $(this.options.heightBase); + } + + if (this.options.soundPath) { + soundPath = this.options.soundPath.replace(/\/+$/, '') + '/'; + } else { + soundPath = this.baseUrl + soundPath; + } + + if (this.options.parrotHeaders && Array.isArray(this.options.parrotHeaders) && this.options.parrotHeaders.length) { + this.parrotHeaders = this.options.parrotHeaders; + // check sessionStorage + $.each(this.parrotHeaders, function(i, h) { + var v = self.sessionStorage('core-ph:' + h); + if (v) { + self.customHeaders[h] = v; + } + }); + } else { + this.parrotHeaders = []; + } + + self.one('opendone', function() { + var tm; + // attach events to document + $(document) + // disable elfinder on click outside elfinder + .on('click.'+namespace, function(e) { enabled && ! self.options.enableAlways && !$(e.target).closest(node).length && self.disable(); }) + // exec shortcuts + .on(keydown+' '+keypress+' '+keyup+' '+mousedown, execShortcut); + + // attach events to window + self.options.useBrowserHistory && $(window) + .on('popstate.' + namespace, function(ev) { + var state = ev.originalEvent.state || {}, + hasThash = state.thash? true : false, + dialog = node.find('.elfinder-frontmost:visible'), + input = node.find('.elfinder-navbar-dir,.elfinder-cwd-filename').find('input,textarea'), + onOpen, toast; + if (!hasThash) { + state = { thash: self.cwd().hash }; + // scroll to elFinder node + $('html,body').animate({ scrollTop: node.offset().top }); + } + if (dialog.length || input.length) { + history.pushState(state, null, location.pathname + location.search + '#elf_' + state.thash); + if (dialog.length) { + if (!dialog.hasClass(self.res('class', 'preventback'))) { + if (dialog.hasClass('elfinder-contextmenu')) { + $(document).trigger($.Event('keydown', { keyCode: $.ui.keyCode.ESCAPE, ctrlKey : false, shiftKey : false, altKey : false, metaKey : false })); + } else if (dialog.hasClass('elfinder-dialog')) { + dialog.elfinderdialog('close'); + } else { + dialog.trigger('close'); + } + } + } else { + input.trigger($.Event('keydown', { keyCode: $.ui.keyCode.ESCAPE, ctrlKey : false, shiftKey : false, altKey : false, metaKey : false })); + } + } else { + if (hasThash) { + !$.isEmptyObject(self.files()) && self.request({ + data : {cmd : 'open', target : state.thash, onhistory : 1}, + notify : {type : 'open', cnt : 1, hideCnt : true}, + syncOnFail : true + }); + } else { + onOpen = function() { + toast.trigger('click'); + }; + self.one('open', onOpen, true); + toast = self.toast({ + msg: self.i18n('pressAgainToExit'), + onHidden: function() { + self.unbind('open', onOpen); + history.pushState(state, null, location.pathname + location.search + '#elf_' + state.thash); + } + }); + } + } + }); + + $(window).on('resize.' + namespace, function(e){ + if (e.target === this) { + tm && cancelAnimationFrame(tm); + tm = requestAnimationFrame(function() { + var prv = node.data('resizeSize') || {w: 0, h: 0}, + size = {w: Math.round(node.width()), h: Math.round(node.height())}; + node.data('resizeSize', size); + if (size.w !== prv.w || size.h !== prv.h) { + node.trigger('resize'); + self.trigger('resize', {width : size.w, height : size.h}); + } + }); + } + }) + .on('beforeunload.' + namespace,function(e){ + var msg, cnt; + if (!self.pauseUnloadCheck()) { + if (node.is(':visible')) { + if (self.ui.notify.children().length && $.inArray('hasNotifyDialog', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('ntfsmth'); + } else if (node.find('.'+self.res('class', 'editing')).length && $.inArray('editingFile', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('editingFile'); + } else if ((cnt = Object.keys(self.selected()).length) && $.inArray('hasSelectedItem', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('hasSelected', ''+cnt); + } else if ((cnt = Object.keys(self.clipboard()).length) && $.inArray('hasClipboardData', self.options.windowCloseConfirm) !== -1) { + msg = self.i18n('hasClipboard', ''+cnt); + } + if (msg) { + e.returnValue = msg; + return msg; + } + } + self.trigger('unload'); + } + }); + + // bind window onmessage for CORS + $(window).on('message.' + namespace, function(e){ + var res = e.originalEvent || null, + obj, data; + if (res && (self.convAbsUrl(self.options.url).indexOf(res.origin) === 0 || self.convAbsUrl(self.uploadURL).indexOf(res.origin) === 0)) { + try { + obj = JSON.parse(res.data); + data = obj.data || null; + if (data) { + if (data.error) { + if (obj.bind) { + self.trigger(obj.bind+'fail', data); + } + self.error(data.error); + } else { + data.warning && self.error(data.warning); + self.updateCache(data); + data.removed && data.removed.length && self.remove(data); + data.added && data.added.length && self.add(data); + data.changed && data.changed.length && self.change(data); + if (obj.bind) { + self.trigger(obj.bind, data); + self.trigger(obj.bind+'done'); + } + data.sync && self.sync(); + } + } + } catch (e) { + self.sync(); + } + } + }); + + // elFinder enable always + if (self.options.enableAlways) { + $(window).on('focus.' + namespace, function(e){ + (e.target === this) && self.enable(); + }); + if (inFrame) { + $(window.top).on('focus.' + namespace, function() { + if (self.enable() && (! parentIframe || parentIframe.is(':visible'))) { + requestAnimationFrame(function() { + $(window).trigger('focus'); + }); + } + }); + } + } else if (inFrame) { + $(window).on('blur.' + namespace, function(e){ + enabled && e.target === this && self.disable(); + }); + } + + // return focus to the window on click (elFInder in the frame) + if (inFrame) { + node.on('click', function(e) { + $(window).trigger('focus'); + }); + } + + // elFinder to enable by mouse over + if (self.options.enableByMouseOver) { + node.on('mouseenter touchstart', function(e) { + (inFrame) && $(window).trigger('focus'); + ! self.enabled() && self.enable(); + }); + } + + // When the browser tab turn to foreground/background + $(window).on('visibilitychange.' + namespace, function(e) { + var background = document.hidden || document.webkitHidden || document.msHidden; + // AutoSync turn On/Off + if (self.options.syncStart) { + self.autoSync(background? 'stop' : void(0)); + } + }); + }); + + // store instance in node + node[0].elfinder = this; + + // auto load language file + dfrdsBeforeBootup.push((function() { + var lang = self.lang, + langJs = self.i18nBaseUrl + 'elfinder.' + lang + '.js', + dfd = $.Deferred().done(function() { + if (self.i18[lang]) { + self.lang = lang; + } + self.trigger('i18load'); + i18n = self.lang === 'en' + ? self.i18['en'] + : $.extend(true, {}, self.i18['en'], self.i18[self.lang]); + }); + + if (!self.i18[lang]) { + self.lang = 'en'; + if (self.hasRequire) { + require([langJs], function() { + dfd.resolve(); + }, function() { + dfd.resolve(); + }); + } else { + self.loadScript([langJs], function() { + dfd.resolve(); + }, { + loadType: 'tag', + error : function() { + dfd.resolve(); + } + }); + } + } else { + dfd.resolve(); + } + return dfd; + })()); + + // elFinder boot up function + bootUp = function() { + var columnNames; + + /** + * i18 messages + * + * @type Object + **/ + self.messages = i18n.messages; + + // check jquery ui + if (!($.fn.selectable && $.fn.draggable && $.fn.droppable && $.fn.resizable && $.fn.button && $.fn.slider)) { + return alert(self.i18n('errJqui')); + } + + // check node + if (!node.length) { + return alert(self.i18n('errNode')); + } + // check connector url + if (!self.options.url) { + return alert(self.i18n('errURL')); + } + + // column key/name map for fm.getColumnName() + columnNames = Object.assign({ + name : self.i18n('name'), + perm : self.i18n('perms'), + date : self.i18n('modify'), + size : self.i18n('size'), + kind : self.i18n('kind'), + modestr : self.i18n('mode'), + modeoct : self.i18n('mode'), + modeboth : self.i18n('mode') + }, self.options.uiOptions.cwd.listView.columnsCustomName); + + /** + * Gets the column name of cwd list view + * + * @param String key The key + * @return String The column name. + */ + self.getColumnName = function(key) { + var res = columnNames[key] || self.i18n(key); + return typeof res === 'function'? res() : res; + }; + + /** + * Interface direction + * + * @type String + * @default "ltr" + **/ + self.direction = i18n.direction; + + /** + * Date/time format + * + * @type String + * @default "m.d.Y" + **/ + self.dateFormat = self.options.dateFormat || i18n.dateFormat; + + /** + * Date format like "Yesterday 10:20:12" + * + * @type String + * @default "{day} {time}" + **/ + self.fancyFormat = self.options.fancyDateFormat || i18n.fancyDateFormat; + + /** + * Date format for if upload file has not original unique name + * e.g. Clipboard image data, Image data taken with iOS + * + * @type String + * @default "ymd-His" + **/ + self.nonameDateFormat = (self.options.nonameDateFormat || i18n.nonameDateFormat).replace(/[\/\\]/g, '_'); + + /** + * Css classes + * + * @type String + **/ + self.cssClass = 'ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-' + +(self.direction == 'rtl' ? 'rtl' : 'ltr') + +(self.UA.Touch? (' elfinder-touch' + (self.options.resizable ? ' touch-punch' : '')) : '') + +(self.UA.Mobile? ' elfinder-mobile' : '') + +(self.UA.iOS? ' elfinder-ios' : '') + +' '+self.options.cssClass; + + // prepare node + node.addClass(self.cssClass) + .on(mousedown, function() { + !enabled && self.enable(); + }); + + // draggable closure + (function() { + var ltr, wzRect, wzBottom, wzBottom2, nodeStyle, + keyEvt = keydown + 'draggable' + ' keyup.' + namespace + 'draggable'; + + /** + * Base draggable options + * + * @type Object + **/ + self.draggable = { + appendTo : node, + addClasses : false, + distance : 4, + revert : true, + refreshPositions : false, + cursor : 'crosshair', + cursorAt : {left : 50, top : 47}, + scroll : false, + start : function(e, ui) { + var helper = ui.helper, + targets = $.grep(helper.data('files')||[], function(h) { + if (h) { + remember[h] = true; + return true; + } + return false; + }), + locked = false, + cnt, h; + + // fix node size + nodeStyle = node.attr('style'); + node.width(node.width()).height(node.height()); + + // set var for drag() + ltr = (self.direction === 'ltr'); + wzRect = self.getUI('workzone').data('rectangle'); + wzBottom = wzRect.top + wzRect.height; + wzBottom2 = wzBottom - self.getUI('navdock').outerHeight(true); + + self.draggingUiHelper = helper; + cnt = targets.length; + while (cnt--) { + h = targets[cnt]; + if (files[h].locked) { + locked = true; + helper.data('locked', true); + break; + } + } + !locked && self.trigger('lockfiles', {files : targets}); + + helper.data('autoScrTm', setInterval(function() { + if (helper.data('autoScr')) { + self.autoScroll[helper.data('autoScr')](helper.data('autoScrVal')); + } + }, 50)); + }, + drag : function(e, ui) { + var helper = ui.helper, + autoScr, autoUp, bottom; + + if ((autoUp = wzRect.top > e.pageY) || wzBottom2 < e.pageY) { + if (wzRect.cwdEdge > e.pageX) { + autoScr = (ltr? 'navbar' : 'cwd') + (autoUp? 'Up' : 'Down'); + } else { + autoScr = (ltr? 'cwd' : 'navbar') + (autoUp? 'Up' : 'Down'); + } + if (!autoUp) { + if (autoScr.substr(0, 3) === 'cwd') { + if (wzBottom < e.pageY) { + bottom = wzBottom; + } else { + autoScr = null; + } + } else { + bottom = wzBottom2; + } + } + if (autoScr) { + helper.data('autoScr', autoScr); + helper.data('autoScrVal', Math.pow((autoUp? wzRect.top - e.pageY : e.pageY - bottom), 1.3)); + } + } + if (! autoScr) { + if (helper.data('autoScr')) { + helper.data('refreshPositions', 1).data('autoScr', null); + } + } + if (helper.data('refreshPositions') && $(this).elfUiWidgetInstance('draggable')) { + if (helper.data('refreshPositions') > 0) { + $(this).draggable('option', { refreshPositions : true, elfRefresh : true }); + helper.data('refreshPositions', -1); + } else { + $(this).draggable('option', { refreshPositions : false, elfRefresh : false }); + helper.data('refreshPositions', null); + } + } + }, + stop : function(e, ui) { + var helper = ui.helper, + files; + + $(document).off(keyEvt); + $(this).elfUiWidgetInstance('draggable') && $(this).draggable('option', { refreshPositions : false }); + self.draggingUiHelper = null; + self.trigger('focus').trigger('dragstop'); + if (! helper.data('droped')) { + files = $.grep(helper.data('files')||[], function(h) { return h? true : false ;}); + self.trigger('unlockfiles', {files : files}); + self.trigger('selectfiles', {files : self.selected()}); + } + self.enable(); + + // restore node style + node.attr('style', nodeStyle); + + helper.data('autoScrTm') && clearInterval(helper.data('autoScrTm')); + }, + helper : function(e, ui) { + var element = this.id ? $(this) : $(this).parents('[id]:first'), + helper = $('
'), + icon = function(f) { + var mime = f.mime, i, tmb = self.tmb(f); + i = '
'; + if (tmb) { + i = $(i).addClass(tmb.className).css('background-image', "url('"+tmb.url+"')").get(0).outerHTML; + } else if (f.icon) { + i = $(i).css(self.getIconStyle(f, true)).get(0).outerHTML; + } + if (f.csscls) { + i = '
' + i + '
'; + } + return i; + }, + hashes, l, ctr; + + self.draggingUiHelper && self.draggingUiHelper.stop(true, true); + + self.trigger('dragstart', {target : element[0], originalEvent : e}, true); + + hashes = element.hasClass(self.res('class', 'cwdfile')) + ? self.selected() + : [self.navId2Hash(element.attr('id'))]; + + helper.append(icon(files[hashes[0]])).data('files', hashes).data('locked', false).data('droped', false).data('namespace', namespace).data('dropover', 0); + + if ((l = hashes.length) > 1) { + helper.append(icon(files[hashes[l-1]]) + ''+l+''); + } + + $(document).on(keyEvt, function(e){ + if (self._commands.copy) { + var chk = (e.shiftKey||e.ctrlKey||e.metaKey); + if (ctr !== chk) { + ctr = chk; + if (helper.is(':visible') && helper.data('dropover') && ! helper.data('droped')) { + helper.toggleClass('elfinder-drag-helper-plus', helper.data('locked')? true : ctr); + self.trigger(ctr? 'unlockfiles' : 'lockfiles', {files : hashes, helper: helper}); + } + } + } + }); + + return helper; + } + }; + })(); + + // in getFileCallback set - change default actions on double click/enter/ctrl+enter + if (self.commands.getfile) { + if (typeof(self.options.getFileCallback) == 'function') { + self.bind('dblclick', function(e) { + e.preventDefault(); + self.exec('getfile').fail(function() { + self.exec('open', e.data && e.data.file? [ e.data.file ]: void(0)); + }); + }); + self.shortcut({ + pattern : 'enter', + description : self.i18n('cmdgetfile'), + callback : function() { self.exec('getfile').fail(function() { self.exec(self.OS == 'mac' ? 'rename' : 'open'); }); } + }) + .shortcut({ + pattern : 'ctrl+enter', + description : self.i18n(self.OS == 'mac' ? 'cmdrename' : 'cmdopen'), + callback : function() { self.exec(self.OS == 'mac' ? 'rename' : 'open'); } + }); + } else { + self.options.getFileCallback = null; + } + } + + // load commands + $.each(self.commands, function(name, cmd) { + var proto = Object.assign({}, cmd.prototype), + extendsCmd, opts; + if ($.isFunction(cmd) && !self._commands[name] && (cmd.prototype.forceLoad || $.inArray(name, self.options.commands) !== -1)) { + extendsCmd = cmd.prototype.extendsCmd || ''; + if (extendsCmd) { + if ($.isFunction(self.commands[extendsCmd])) { + cmd.prototype = Object.assign({}, base, new self.commands[extendsCmd](), cmd.prototype); + } else { + return true; + } + } else { + cmd.prototype = Object.assign({}, base, cmd.prototype); + } + self._commands[name] = new cmd(); + cmd.prototype = proto; + opts = self.options.commandsOptions[name] || {}; + if (extendsCmd && self.options.commandsOptions[extendsCmd]) { + opts = $.extend(true, {}, self.options.commandsOptions[extendsCmd], opts); + } + self._commands[name].setup(name, opts); + // setup linked commands + if (self._commands[name].linkedCmds.length) { + $.each(self._commands[name].linkedCmds, function(i, n) { + var lcmd = self.commands[n]; + if ($.isFunction(lcmd) && !self._commands[n]) { + lcmd.prototype = base; + self._commands[n] = new lcmd(); + self._commands[n].setup(n, self.options.commandsOptions[n]||{}); + } + }); + } + } + }); + + /** + * UI nodes + * + * @type Object + **/ + self.ui = { + // container for nav panel and current folder container + workzone : $('
').appendTo(node).elfinderworkzone(self), + // contaainer for folders tree / places + navbar : $('
').appendTo(node).elfindernavbar(self, self.options.uiOptions.navbar || {}), + // container for for preview etc at below the navbar + navdock : $('
').appendTo(node).elfindernavdock(self, self.options.uiOptions.navdock || {}), + // contextmenu + contextmenu : $('
').appendTo(node).elfindercontextmenu(self), + // overlay + overlay : $('
').appendTo(node).elfinderoverlay({ + show : function() { self.disable(); }, + hide : function() { prevEnabled && self.enable(); } + }), + // current folder container + cwd : $('
').appendTo(node).elfindercwd(self, self.options.uiOptions.cwd || {}), + // notification dialog window + notify : self.dialog('', { + cssClass : 'elfinder-dialog-notify' + (self.options.notifyDialog.canClose? '' : ' elfinder-titlebar-button-hide'), + position : self.options.notifyDialog.position, + absolute : true, + resizable : false, + autoOpen : false, + allowMinimize : true, + closeOnEscape : self.options.notifyDialog.canClose? true : false, + title : ' ', + width : self.options.notifyDialog.width? parseInt(self.options.notifyDialog.width) : null, + minHeight : null, + minimize : function() { self.ui.notify.trigger('minimize'); } + }), + statusbar : $('
').hide().appendTo(node), + toast : $('
').appendTo(node), + bottomtray : $('
').appendTo(node), + progressbar : $('
').appendTo(node) + }; + + self.trigger('uiready'); + + // load required ui + $.each(self.options.ui || [], function(i, ui) { + var name = 'elfinder'+ui, + opts = self.options.uiOptions[ui] || {}; + + if (!self.ui[ui] && $.fn[name]) { + // regist to self.ui before make instance + self.ui[ui] = $('<'+(opts.tag || 'div')+'/>').appendTo(node); + self.ui[ui][name](self, opts); + } + }); + + self.ui.progressbar.appendTo(self.ui.workzone); + self.ui.notify.prev('.ui-dialog-titlebar').append('
'); + + // update size + self.resize(width, height); + + // make node resizable + if (self.options.resizable) { + node.resizable({ + resize : function(e, ui) { + self.resize(ui.size.width, ui.size.height); + }, + handles : 'se', + minWidth : 300, + minHeight : 200 + }); + if (self.UA.Touch) { + node.addClass('touch-punch'); + } + } + + (function() { + var navbar = self.getUI('navbar'), + cwd = self.getUI('cwd').parent(); + + self.autoScroll = { + navbarUp : function(v) { + navbar.scrollTop(Math.max(0, navbar.scrollTop() - v)); + }, + navbarDown : function(v) { + navbar.scrollTop(navbar.scrollTop() + v); + }, + cwdUp : function(v) { + cwd.scrollTop(Math.max(0, cwd.scrollTop() - v)); + }, + cwdDown : function(v) { + cwd.scrollTop(cwd.scrollTop() + v); + } + }; + })(); + + // Swipe on the touch devices to show/hide of toolbar or navbar + if (self.UA.Touch) { + (function() { + var lastX, lastY, nodeOffset, nodeWidth, nodeTop, navbarW, toolbarH, + navbar = self.getUI('navbar'), + toolbar = self.getUI('toolbar'), + moveEv = 'touchmove.stopscroll', + moveTm, + moveUpOn = function(e) { + var touches = e.originalEvent.touches || [{}], + y = touches[0].pageY || null; + if (!lastY || y < lastY) { + e.preventDefault(); + moveTm && clearTimeout(moveTm); + } + }, + moveDownOn = function(e) { + e.preventDefault(); + moveTm && clearTimeout(moveTm); + }, + moveOff = function() { + moveTm = setTimeout(function() { + node.off(moveEv); + }, 100); + }, + handleW, handleH = 50; + + navbar = navbar.children().length? navbar : null; + toolbar = toolbar.length? toolbar : null; + node.on('touchstart touchmove touchend', function(e) { + if (e.type === 'touchend') { + lastX = false; + lastY = false; + moveOff(); + return; + } + + var touches = e.originalEvent.touches || [{}], + x = touches[0].pageX || null, + y = touches[0].pageY || null, + ltr = (self.direction === 'ltr'), + navbarMode, treeWidth, swipeX, moveX, toolbarT, mode; + + if (x === null || y === null || (e.type === 'touchstart' && touches.length > 1)) { + return; + } + + if (e.type === 'touchstart') { + nodeOffset = node.offset(); + nodeWidth = node.width(); + if (navbar) { + lastX = false; + if (navbar.is(':hidden')) { + if (! handleW) { + handleW = Math.max(50, nodeWidth / 10); + } + if ((ltr? (x - nodeOffset.left) : (nodeWidth + nodeOffset.left - x)) < handleW) { + lastX = x; + } + } else if (! e.originalEvent._preventSwipeX) { + navbarW = navbar.width(); + if (ltr) { + swipeX = (x < nodeOffset.left + navbarW); + } else { + swipeX = (x > nodeOffset.left + nodeWidth - navbarW); + } + if (swipeX) { + handleW = Math.max(50, nodeWidth / 10); + lastX = x; + } else { + lastX = false; + } + } + } + if (toolbar) { + lastY = false; + if (! e.originalEvent._preventSwipeY) { + toolbarH = toolbar.height(); + nodeTop = nodeOffset.top; + if (y - nodeTop < (toolbar.is(':hidden')? handleH : (toolbarH + 30))) { + lastY = y; + node.on(moveEv, toolbar.is(':hidden')? moveDownOn: moveUpOn); + } + } + } + } else { + if (navbar && lastX !== false) { + navbarMode = (ltr? (lastX > x) : (lastX < x))? 'navhide' : 'navshow'; + moveX = Math.abs(lastX - x); + if (navbarMode === 'navhide' && moveX > navbarW * 0.6 + || (moveX > (navbarMode === 'navhide'? navbarW / 3 : 45) + && (navbarMode === 'navshow' + || (ltr? x < nodeOffset.left + 20 : x > nodeOffset.left + nodeWidth - 20) + )) + ) { + self.getUI('navbar').trigger(navbarMode, {handleW: handleW}); + lastX = false; + } + } + if (toolbar && lastY !== false ) { + toolbarT = toolbar.offset().top; + if (Math.abs(lastY - y) > Math.min(45, toolbarH / 3)) { + mode = (lastY > y)? 'slideUp' : 'slideDown'; + if (mode === 'slideDown' || toolbarT + 20 > y) { + if (toolbar.is(mode === 'slideDown' ? ':hidden' : ':visible')) { + toolbar.stop(true, true).trigger('toggle', {duration: 100, handleH: handleH}); + } + lastY = false; + } + } + } + } + }); + })(); + } + + if (self.dragUpload) { + // add event listener for HTML5 DnD upload + (function() { + var isin = function(e) { + return (e.target.nodeName !== 'TEXTAREA' && e.target.nodeName !== 'INPUT' && $(e.target).closest('div.ui-dialog-content').length === 0); + }, + ent = 'native-drag-enter', + disable = 'native-drag-disable', + c = 'class', + navdir = self.res(c, 'navdir'), + droppable = self.res(c, 'droppable'), + dropover = self.res(c, 'adroppable'), + arrow = self.res(c, 'navarrow'), + clDropActive = self.res(c, 'adroppable'), + wz = self.getUI('workzone'), + ltr = (self.direction === 'ltr'), + clearTm = function() { + autoScrTm && cancelAnimationFrame(autoScrTm); + autoScrTm = null; + }, + wzRect, autoScrFn, autoScrTm; + + node.on('dragenter', function(e) { + clearTm(); + if (isin(e)) { + e.preventDefault(); + e.stopPropagation(); + wzRect = wz.data('rectangle'); + } + }) + .on('dragleave', function(e) { + clearTm(); + if (isin(e)) { + e.preventDefault(); + e.stopPropagation(); + } + }) + .on('dragover', function(e) { + var autoUp; + if (isin(e)) { + e.preventDefault(); + e.stopPropagation(); + e.originalEvent.dataTransfer.dropEffect = 'none'; + if (! autoScrTm) { + autoScrTm = requestAnimationFrame(function() { + var wzBottom = wzRect.top + wzRect.height, + wzBottom2 = wzBottom - self.getUI('navdock').outerHeight(true), + fn; + if ((autoUp = e.pageY < wzRect.top) || e.pageY > wzBottom2 ) { + if (wzRect.cwdEdge > e.pageX) { + fn = (ltr? 'navbar' : 'cwd') + (autoUp? 'Up' : 'Down'); + } else { + fn = (ltr? 'cwd' : 'navbar') + (autoUp? 'Up' : 'Down'); + } + if (!autoUp) { + if (fn.substr(0, 3) === 'cwd') { + if (wzBottom < e.pageY) { + wzBottom2 = wzBottom; + } else { + fn = ''; + } + } + } + fn && self.autoScroll[fn](Math.pow((autoUp? wzRect.top - e.pageY : e.pageY - wzBottom2), 1.3)); + } + autoScrTm = null; + }); + } + } else { + clearTm(); + } + }) + .on('drop', function(e) { + clearTm(); + if (isin(e)) { + e.stopPropagation(); + e.preventDefault(); + } + }); + + node.on('dragenter', '.native-droppable', function(e){ + if (e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget), + id = e.currentTarget.id || null, + cwd = null, + elfFrom; + if (!id) { // target is cwd + cwd = self.cwd(); + $elm.data(disable, false); + try { + $.each(e.originalEvent.dataTransfer.types, function(i, v){ + if (v.substr(0, 13) === 'elfinderfrom:') { + elfFrom = v.substr(13).toLowerCase(); + } + }); + } catch(e) {} + } + if (!cwd || (cwd.write && (!elfFrom || elfFrom !== (window.location.href + cwd.hash).toLowerCase()))) { + e.preventDefault(); + e.stopPropagation(); + $elm.data(ent, true); + $elm.addClass(clDropActive); + } else { + $elm.data(disable, true); + } + } + }) + .on('dragleave', '.native-droppable', function(e){ + if (e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget); + e.preventDefault(); + e.stopPropagation(); + if ($elm.data(ent)) { + $elm.data(ent, false); + } else { + $elm.removeClass(clDropActive); + } + } + }) + .on('dragover', '.native-droppable', function(e){ + if (e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget); + e.preventDefault(); + e.stopPropagation(); + e.originalEvent.dataTransfer.dropEffect = $elm.data(disable)? 'none' : 'copy'; + $elm.data(ent, false); + } + }) + .on('drop', '.native-droppable', function(e){ + if (e.originalEvent && e.originalEvent.dataTransfer) { + var $elm = $(e.currentTarget), + id; + e.preventDefault(); + e.stopPropagation(); + $elm.removeClass(clDropActive); + if (e.currentTarget.id) { + id = $elm.hasClass(navdir)? self.navId2Hash(e.currentTarget.id) : self.cwdId2Hash(e.currentTarget.id); + } else { + id = self.cwd().hash; + } + e.originalEvent._target = id; + self.exec('upload', {dropEvt: e.originalEvent, target: id}, void 0, id); + } + }); + })(); + } + + // trigger event cssloaded if cssAutoLoad disabled + if (self.cssloaded === false) { + self.cssloaded = true; + self.trigger('cssloaded'); + } + + // calculate elFinder node z-index + self.zIndexCalc(); + + // send initial request and start to pray >_< + self.trigger('init') + .request({ + data : {cmd : 'open', target : self.startDir(), init : 1, tree : 1}, + preventDone : true, + notify : {type : 'open', cnt : 1, hideCnt : true}, + freeze : true + }) + .fail(function() { + self.trigger('fail').disable().lastDir(''); + listeners = {}; + shortcuts = {}; + $(document).add(node).off('.'+namespace); + self.trigger = function() { }; + }) + .done(function(data) { + var trashDisable = function(th) { + var src = self.file(self.trashes[th]), + d = self.options.debug, + error; + + if (src && src.volumeid) { + delete self.volOptions[src.volumeid].trashHash; + } + self.trashes[th] = false; + self.debug('backend-error', 'Trash hash "'+th+'" was not found or not writable.'); + }, + toChkTh = {}; + + // regist rawStringDecoder + if (self.options.rawStringDecoder) { + self.registRawStringDecoder(self.options.rawStringDecoder); + } + + // re-calculate elFinder node z-index + self.zIndexCalc(); + + self.load().debug('api', self.api); + // update ui's size after init + node.trigger('resize'); + // initial open + open(data); + self.trigger('open', data, false); + self.trigger('opendone'); + + if (inFrame && self.options.enableAlways) { + $(window).trigger('focus'); + } + + // check self.trashes + $.each(self.trashes, function(th) { + var dir = self.file(th), + src; + if (! dir) { + toChkTh[th] = true; + } else if (dir.mime !== 'directory' || ! dir.write) { + trashDisable(th); + } + }); + if (Object.keys(toChkTh).length) { + self.request({ + data : {cmd : 'info', targets : Object.keys(toChkTh)}, + preventDefault : true + }).done(function(data) { + if (data && data.files) { + $.each(data.files, function(i, dir) { + if (dir.mime === 'directory' && dir.write) { + delete toChkTh[dir.hash]; + } + }); + } + }).always(function() { + $.each(toChkTh, trashDisable); + }); + } + // to enable / disable + self[self.options.enableAlways? 'enable' : 'disable'](); + }); + + // self.timeEnd('load'); + // End of bootUp() + }; + + // call bootCallback function with elFinder instance, extraObject - { dfrdsBeforeBootup: dfrdsBeforeBootup } + if (bootCallback && typeof bootCallback === 'function') { + self.bootCallback = bootCallback; + bootCallback.call(node.get(0), self, { dfrdsBeforeBootup: dfrdsBeforeBootup }); + } + + // call dfrdsBeforeBootup functions then boot up elFinder + $.when.apply(null, dfrdsBeforeBootup).done(function() { + bootUp(); + }).fail(function(error) { + self.error(error); + }); +}; + +//register elFinder to global scope +if (typeof toGlobal === 'undefined' || toGlobal) { + window.elFinder = elFinder; +} + +/** + * Prototype + * + * @type Object + */ +elFinder.prototype = { + + uniqueid : 0, + + res : function(type, id) { + return this.resources[type] && this.resources[type][id]; + }, + + /** + * User os. Required to bind native shortcuts for open/rename + * + * @type String + **/ + OS : navigator.userAgent.indexOf('Mac') !== -1 ? 'mac' : navigator.userAgent.indexOf('Win') !== -1 ? 'win' : 'other', + + /** + * User browser UA. + * jQuery.browser: version deprecated: 1.3, removed: 1.9 + * + * @type Object + **/ + UA : (function(){ + var self = this, + webkit = !document.unqueID && !window.opera && !window.sidebar && 'localStorage' in window && 'WebkitAppearance' in document.documentElement.style, + chrome = webkit && window.chrome, + /*setRotated = function() { + var a = ((screen && screen.orientation && screen.orientation.angle) || window.orientation || 0) + 0; + if (a === -90) { + a = 270; + } + UA.Angle = a; + UA.Rotated = a % 180 === 0? false : true; + },*/ + UA = { + // Browser IE <= IE 6 + ltIE6 : typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined", + // Browser IE <= IE 7 + ltIE7 : typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined", + // Browser IE <= IE 8 + ltIE8 : typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined", + // Browser IE <= IE 9 + ltIE9 : document.uniqueID && document.documentMode <= 9, + // Browser IE <= IE 10 + ltIE10 : document.uniqueID && document.documentMode <= 10, + // Browser IE >= IE 11 + gtIE11 : document.uniqueID && document.documentMode >= 11, + IE : document.uniqueID, + Firefox : window.sidebar, + Opera : window.opera, + Webkit : webkit, + Chrome : chrome, + Edge : (chrome && window.msCredentials)? true : false, + Safari : webkit && !window.chrome, + Mobile : typeof window.orientation != "undefined", + Touch : typeof window.ontouchstart != "undefined", + iOS : navigator.platform.match(/^iP(?:[ao]d|hone)/), + Mac : navigator.platform.match(/^Mac/), + Fullscreen : (typeof (document.exitFullscreen || document.webkitExitFullscreen || document.mozCancelFullScreen || document.msExitFullscreen) !== 'undefined'), + Angle : 0, + Rotated : false, + CSS : (function() { + var aStyle = document.createElement('a').style, + pStyle = document.createElement('p').style, + css; + css = 'position:sticky;position:-webkit-sticky;'; + css += 'width:-webkit-max-content;width:-moz-max-content;width:-ms-max-content;width:max-content;'; + aStyle.cssText = css; + return { + positionSticky : aStyle.position.indexOf('sticky')!==-1, + widthMaxContent : aStyle.width.indexOf('max-content')!==-1, + flex : typeof pStyle.flex !== 'undefined' + }; + })() + }; + return UA; + })(), + + /** + * Is cookie enabled + * + * @type Boolean + */ + cookieEnabled : window.navigator.cookieEnabled, + + /** + * Has RequireJS? + * + * @type Boolean + */ + hasRequire : (typeof define === 'function' && define.amd), + + /** + * Current request command + * + * @type String + */ + currentReqCmd : '', + + /** + * Current keyboard state + * + * @type Object + */ + keyState : {}, + + /** + * Internationalization object + * + * @type Object + */ + i18 : { + en : { + translator : '', + language : 'English', + direction : 'ltr', + dateFormat : 'd.m.Y H:i', + fancyDateFormat : '$1 H:i', + nonameDateFormat : 'ymd-His', + 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'] + }, + + /** + * File mimetype to kind mapping + * + * @type Object + */ + kinds : { + 'unknown' : 'Unknown', + 'directory' : 'Folder', + 'group' : 'Selects', + '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' + }, + + /** + * File mimetype to file extention mapping + * + * @type Object + * @see elFinder.mimetypes.js + */ + mimeTypes : {}, + + /** + * Ajax request data validation rules + * + * @type Object + */ + rules : { + defaults : function(data) { + if (!data + || (data.added && !Array.isArray(data.added)) + || (data.removed && !Array.isArray(data.removed)) + || (data.changed && !Array.isArray(data.changed))) { + return false; + } + return true; + }, + open : function(data) { return data && data.cwd && data.files && $.isPlainObject(data.cwd) && Array.isArray(data.files); }, + tree : function(data) { return data && data.tree && Array.isArray(data.tree); }, + parents : function(data) { return data && data.tree && Array.isArray(data.tree); }, + tmb : function(data) { return data && data.images && ($.isPlainObject(data.images) || Array.isArray(data.images)); }, + upload : function(data) { return data && ($.isPlainObject(data.added) || Array.isArray(data.added));}, + search : function(data) { return data && data.files && Array.isArray(data.files); } + }, + + /** + * Commands costructors + * + * @type Object + */ + commands : {}, + + /** + * Commands to add the item (space delimited) + * + * @type String + */ + cmdsToAdd : 'archive duplicate extract mkdir mkfile paste rm upload', + + parseUploadData : function(text) { + var self = this, + data; + + if (!$.trim(text)) { + return {error : ['errResponse', 'errDataEmpty']}; + } + + try { + data = JSON.parse(text); + } catch (e) { + return {error : ['errResponse', 'errDataNotJSON']}; + } + + data = self.normalize(data); + if (!self.validResponse('upload', data)) { + return {error : (data.norError || ['errResponse'])}; + } + data.removed = $.merge((data.removed || []), $.map(data.added || [], function(f) { return self.file(f.hash)? f.hash : null; })); + return data; + + }, + + iframeCnt : 0, + + uploads : { + // xhr muiti uploading flag + xhrUploading: false, + + // Timer of request fail to sync + failSyncTm: null, + + // current chunkfail requesting chunk + chunkfailReq: {}, + + // check file/dir exists + checkExists: function(files, target, fm, isDir) { + var dfrd = $.Deferred(), + names, renames = [], hashes = {}, chkFiles = [], + cancel = function() { + var i = files.length; + while (--i > -1) { + files[i]._remove = true; + } + }, + resolve = function() { + dfrd.resolve(renames, hashes); + }, + check = function() { + var existed = [], exists = [], i, c, + pathStr = target !== fm.cwd().hash? fm.path(target, true) + fm.option('separator', target) : '', + confirm = function(ndx) { + var last = ndx == exists.length-1, + opts = { + cssClass : 'elfinder-confirm-upload', + title : fm.i18n('cmdupload'), + text : ['errExists', pathStr + exists[ndx].name, 'confirmRepl'], + all : !last, + accept : { + label : 'btnYes', + callback : function(all) { + !last && !all + ? confirm(++ndx) + : resolve(); + } + }, + reject : { + label : 'btnNo', + callback : function(all) { + var i; + + if (all) { + i = exists.length; + while (ndx < i--) { + files[exists[i].i]._remove = true; + } + } else { + files[exists[ndx].i]._remove = true; + } + + !last && !all + ? confirm(++ndx) + : resolve(); + } + }, + cancel : { + label : 'btnCancel', + callback : function() { + cancel(); + resolve(); + } + }, + buttons : [ + { + label : 'btnBackup', + cssClass : 'elfinder-confirm-btn-backup', + callback : function(all) { + var i; + if (all) { + i = exists.length; + while (ndx < i--) { + renames.push(exists[i].name); + } + } else { + renames.push(exists[ndx].name); + } + !last && !all + ? confirm(++ndx) + : resolve(); + } + } + ] + }; + + if (!isDir) { + opts.buttons.push({ + label : 'btnRename' + (last? '' : 'All'), + cssClass : 'elfinder-confirm-btn-rename', + callback : function() { + renames = null; + resolve(); + } + }); + } + if (fm.iframeCnt > 0) { + delete opts.reject; + } + fm.confirm(opts); + }; + + if (! fm.file(target).read) { + // for dropbox type + resolve(); + return; + } + + names = $.map(files, function(file, i) { return file.name && (!fm.UA.iOS || file.name !== 'image.jpg')? {i: i, name: file.name} : null ;}); + + fm.request({ + data : {cmd : 'ls', target : target, intersect : $.map(names, function(item) { return item.name;})}, + notify : {type : 'preupload', cnt : 1, hideCnt : true}, + preventDefault : true + }) + .done(function(data) { + var existedArr, cwdItems; + if (data) { + if (data.error) { + cancel(); + } else { + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + if (data.list) { + if (Array.isArray(data.list)) { + existed = data.list || []; + } else { + existedArr = []; + existed = $.map(data.list, function(n) { + if (typeof n === 'string') { + return n; + } else { + // support to >=2.1.11 plugin Normalizer, Sanitizer + existedArr = existedArr.concat(n); + return false; + } + }); + if (existedArr.length) { + existed = existed.concat(existedArr); + } + hashes = data.list; + } + exists = $.grep(names, function(name){ + return $.inArray(name.name, existed) !== -1 ? true : false ; + }); + if (exists.length && existed.length && target == fm.cwd().hash) { + cwdItems = $.map(fm.files(target), function(file) { return file.name; } ); + if ($.grep(existed, function(n) { + return $.inArray(n, cwdItems) === -1? true : false; + }).length){ + fm.sync(); + } + } + } + } + } + } + if (exists.length > 0) { + confirm(0); + } else { + resolve(); + } + }) + .fail(function(error) { + cancel(); + resolve(); + error && fm.error(error); + }); + }; + if (fm.api >= 2.1 && typeof files[0] == 'object') { + check(); + } else { + resolve(); + } + return dfrd; + }, + + // check droped contents + checkFile : function(data, fm, target) { + if (!!data.checked || data.type == 'files') { + return data.files; + } else if (data.type == 'data') { + var dfrd = $.Deferred(), + scanDfd = $.Deferred(), + files = [], + paths = [], + dirctorys = [], + processing = 0, + items, + mkdirs = [], + cancel = false, + toArray = function(list) { + return Array.prototype.slice.call(list || [], 0); + }, + doScan = function(items) { + var entry, readEntries, + excludes = fm.options.folderUploadExclude[fm.OS] || null, + length = items.length, + check = function() { + if (--processing < 1 && scanDfd.state() === 'pending') { + scanDfd.resolve(); + } + }, + pushItem = function(file) { + if (! excludes || ! file.name.match(excludes)) { + paths.push(entry.fullPath || ''); + files.push(file); + } + check(); + }, + readEntries = function(dirReader) { + var entries = [], + read = function() { + dirReader.readEntries(function(results) { + if (cancel || !results.length) { + for (var i = 0; i < entries.length; i++) { + if (cancel) { + scanDfd.reject(); + break; + } + doScan([entries[i]]); + } + check(); + } else { + entries = entries.concat(toArray(results)); + read(); + } + }, check); + }; + read(); + }; + + processing++; + for (var i = 0; i < length; i++) { + if (cancel) { + scanDfd.reject(); + break; + } + entry = items[i]; + if (entry) { + if (entry instanceof File) { + pushItem(entry); + } else if (entry.isFile) { + processing++; + entry.file(pushItem, check); + } else if (entry.isDirectory) { + if (fm.api >= 2.1) { + processing++; + mkdirs.push(entry.fullPath); + readEntries(entry.createReader()); // Start reading dirs. + } + } + } + } + check(); + return scanDfd; + }, hasDirs; + + items = $.map(data.files.items, function(item){ + if (item.kind === 'file') { + return (item.getAsEntry? item.getAsEntry() : item.webkitGetAsEntry()) || item.getAsFile(); + } else { + return null; + } + }); + $.each(items, function(i, item) { + if (item.isDirectory) { + hasDirs = true; + return false; + } + }); + if (items.length > 0) { + fm.uploads.checkExists(items, target, fm, hasDirs).done(function(renames, hashes){ + var dfds = []; + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + if (renames === null) { + data.overwrite = 0; + renames = []; + } + items = $.grep(items, function(item){ + var i, bak, hash, dfd, hi; + if (item.isDirectory && renames.length) { + i = $.inArray(item.name, renames); + if (i !== -1) { + renames.splice(i, 1); + bak = fm.uniqueName(item.name + fm.options.backupSuffix , null, ''); + $.each(hashes, function(h, name) { + if (item.name == name) { + hash = h; + return false; + } + }); + if (! hash) { + hash = fm.fileByName(item.name, target).hash; + } + fm.lockfiles({files : [hash]}); + dfd = fm.request({ + data : {cmd : 'rename', target : hash, name : bak}, + notify : {type : 'rename', cnt : 1} + }) + .fail(function() { + item._remove = true; + fm.sync(); + }) + .always(function() { + fm.unlockfiles({files : [hash]}); + }); + dfds.push(dfd); + } + } + return !item._remove? true : false; + }); + } + $.when.apply($, dfds).done(function(){ + var notifyto, msg, + id = +new Date(); + + if (items.length > 0) { + msg = fm.escape(items[0].name); + if (items.length > 1) { + msg += ' ... ' + items.length + fm.i18n('items'); + } + notifyto = setTimeout(function() { + fm.notify({ + type : 'readdir', + id : id, + cnt : 1, + hideCnt: true, + msg : fm.i18n('ntfreaddir') + ' (' + msg + ')', + cancel: function() { + cancel = true; + } + }); + }, fm.options.notifyDelay); + doScan(items).done(function() { + notifyto && clearTimeout(notifyto); + fm.notify({type : 'readdir', id: id, cnt : -1}); + if (cancel) { + dfrd.reject(); + } else { + dfrd.resolve([files, paths, renames, hashes, mkdirs]); + } + }).fail(function() { + dfrd.reject(); + }); + } else { + dfrd.reject(); + } + }); + }); + return dfrd.promise(); + } else { + return dfrd.reject(); + } + } else { + var ret = []; + var check = []; + var str = data.files[0]; + if (data.type == 'html') { + var tmp = $("").append($.parseHTML(str.replace(/ src=/ig, ' _elfsrc='))), + atag; + $('img[_elfsrc]', tmp).each(function(){ + var url, purl, + self = $(this), + pa = self.closest('a'); + if (pa && pa.attr('href') && pa.attr('href').match(/\.(?:jpe?g|gif|bmp|png)/i)) { + purl = pa.attr('href'); + } + url = self.attr('_elfsrc'); + if (url) { + if (purl) { + $.inArray(purl, ret) == -1 && ret.push(purl); + $.inArray(url, check) == -1 && check.push(url); + } else { + $.inArray(url, ret) == -1 && ret.push(url); + } + } + // Probably it's clipboard data + if (ret.length === 1 && ret[0].match(/^data:image\/png/)) { + data.clipdata = true; + } + }); + atag = $('a[href]', tmp); + atag.each(function(){ + var text, loc, + parseUrl = function(url) { + var a = document.createElement('a'); + a.href = url; + return a; + }; + if (text = $(this).text()) { + loc = parseUrl($(this).attr('href')); + if (loc.href && loc.href.match(/^(?:ht|f)tp/i) && (atag.length === 1 || ! loc.pathname.match(/(?:\.html?|\/[^\/.]*)$/i) || $.trim(text).match(/\.[a-z0-9-]{1,10}$/i))) { + if ($.inArray(loc.href, ret) == -1 && $.inArray(loc.href, check) == -1) ret.push(loc.href); + } + } + }); + } else { + var regex, m, url; + regex = /((?:ht|f)tps?:\/\/[-_.!~*\'()a-z0-9;/?:\@&=+\$,%#\*\[\]]+)/ig; + while (m = regex.exec(str)) { + url = m[1].replace(/&/g, '&'); + if ($.inArray(url, ret) == -1) ret.push(url); + } + } + return ret; + } + }, + + // upload transport using XMLHttpRequest + xhr : function(data, fm) { + var self = fm ? fm : this, + node = self.getUI(), + xhr = new XMLHttpRequest(), + notifyto = null, + notifyto1 = null, + notifyto2 = null, + dataChecked = data.checked, + isDataType = (data.isDataType || data.type == 'data'), + target = (data.target || self.cwd().hash), + dropEvt = (data.dropEvt || null), + extraData = data.extraData || null, + chunkEnable = (self.option('uploadMaxConn', target) != -1), + multiMax = Math.min(5, Math.max(1, self.option('uploadMaxConn', target))), + retryWait = 10000, // 10 sec + retryMax = 30, // 10 sec * 30 = 300 secs (Max 5 mins) + retry = 0, + getFile = function(files) { + var dfd = $.Deferred(), + file; + if (files.promise) { + files.always(function(f) { + dfd.resolve(Array.isArray(f) && f.length? (isDataType? f[0][0] : f[0]) : {}); + }); + } else { + dfd.resolve(files.length? (isDataType? files[0][0] : files[0]) : {}); + } + return dfd; + }, + dfrd = $.Deferred() + .fail(function(err) { + var error = self.parseError(err), + userAbort; + if (error === 'userabort') { + userAbort = true; + error = void 0; + } + if (files && (self.uploads.xhrUploading || userAbort)) { + // send request om fail + getFile(files).done(function(file) { + if (!userAbort) { + triggerError(error, file); + } + if (! file._cid) { + // send sync request + self.uploads.failSyncTm && clearTimeout(self.uploads.failSyncTm); + self.uploads.failSyncTm = setTimeout(function() { + self.sync(target); + }, 1000); + } else if (! self.uploads.chunkfailReq[file._cid]) { + // send chunkfail request + self.uploads.chunkfailReq[file._cid] = true; + setTimeout(function() { + fm.request({ + data : { + cmd: 'upload', + target: target, + chunk: file._chunk, + cid: file._cid, + upload: ['chunkfail'], + mimes: 'chunkfail' + }, + options : { + type: 'post', + url: self.uploadURL + }, + preventDefault: true + }).always(function() { + delete self.uploads.chunkfailReq[file._chunk]; + }); + }, 1000); + } + }); + } else { + triggerError(error); + } + !userAbort && self.sync(); + self.uploads.xhrUploading = false; + files = null; + }) + .done(function(data) { + self.uploads.xhrUploading = false; + files = null; + if (data) { + self.currentReqCmd = 'upload'; + data.warning && triggerError(data.warning); + self.updateCache(data); + data.removed && data.removed.length && self.remove(data); + data.added && data.added.length && self.add(data); + data.changed && data.changed.length && self.change(data); + self.trigger('upload', data, false); + self.trigger('uploaddone'); + if (data.toasts && Array.isArray(data.toasts)) { + $.each(data.toasts, function() { + this.msg && self.toast(this); + }); + } + data.sync && self.sync(); + if (data.debug) { + self.responseDebug(data); + fm.debug('backend-debug', data); + } + } + }) + .always(function() { + self.abortXHR(xhr); + // unregist fnAbort function + node.off('uploadabort', fnAbort); + $(window).off('unload', fnAbort); + notifyto && clearTimeout(notifyto); + notifyto1 && clearTimeout(notifyto1); + notifyto2 && clearTimeout(notifyto2); + dataChecked && !data.multiupload && checkNotify() && self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0}); + notifyto1 && uploadedNtf && self.notify({type : 'chunkmerge', cnt : -cnt}); + chunkMerge && notifyElm.children('.elfinder-notify-chunkmerge').length && self.notify({type : 'chunkmerge', cnt : -1}); + }), + formData = new FormData(), + files = data.input ? data.input.files : self.uploads.checkFile(data, self, target), + cnt = data.checked? (isDataType? files[0].length : files.length) : files.length, + isChunked = false, + loaded = 0, + prev = 0, + filesize = 0, + notify = false, + notifyElm = self.ui.notify, + cancelBtn = true, + uploadedNtf = false, + abort = false, + checkNotify = function() { + if (!notify && (ntfUpload = notifyElm.children('.elfinder-notify-upload')).length) { + notify = true; + } + return notify; + }, + fnAbort = function(e, error) { + abort = true; + self.abortXHR(xhr, { quiet: true, abort: true }); + dfrd.reject(error); + if (checkNotify()) { + self.notify({type : 'upload', cnt : ntfUpload.data('cnt') * -1, progress : 0, size : 0}); + } + }, + cancelToggle = function(show, hasChunk) { + ntfUpload.children('.elfinder-notify-cancel')[show? 'show':'hide'](); + cancelBtn = show; + }, + startNotify = function(size) { + if (!size) size = filesize; + return setTimeout(function() { + notify = true; + self.notify({type : 'upload', cnt : cnt, progress : loaded - prev, size : size, + cancel: function() { + node.trigger('uploadabort', 'userabort'); + } + }); + ntfUpload = notifyElm.children('.elfinder-notify-upload'); + prev = loaded; + if (data.multiupload) { + cancelBtn && cancelToggle(true); + } else { + cancelToggle(cancelBtn && loaded < size); + } + }, self.options.notifyDelay); + }, + doRetry = function() { + if (retry++ <= retryMax) { + if (checkNotify() && prev) { + self.notify({type : 'upload', cnt : 0, progress : 0, size : prev}); + } + self.abortXHR(xhr, { quiet: true }); + prev = loaded = 0; + setTimeout(function() { + var reqId; + if (! abort) { + xhr.open('POST', self.uploadURL, true); + if (self.api >= 2.1029) { + reqId = (+ new Date()).toString(16) + Math.floor(1000 * Math.random()).toString(16); + (typeof formData['delete'] === 'function') && formData['delete']('reqid'); + formData.append('reqid', reqId); + xhr._requestId = reqId; + } + xhr.send(formData); + } + }, retryWait); + } else { + node.trigger('uploadabort', ['errAbort', 'errTimeout']); + } + }, + progress = function() { + var node; + if (notify) { + dfrd.notifyWith(ntfUpload, [{ + cnt: ntfUpload.data('cnt'), + progress: ntfUpload.data('progress'), + total: ntfUpload.data('total') + }]); + } + }, + triggerError = function(err, file, unite) { + err && self.trigger('xhruploadfail', { error: err, file: file }); + if (unite) { + if (err) { + if (errCnt < self.options.maxErrorDialogs) { + if (Array.isArray(err)) { + errors = errors.concat(err); + } else { + errors.push(err); + } + } + errCnt++; + } + } else { + if (err) { + self.error(err); + } else { + if (errors.length) { + if (errCnt >= self.options.maxErrorDialogs) { + errors = errors.concat('moreErrors', errCnt - self.options.maxErrorDialogs); + } + self.error(errors); + } + errors = []; + errCnt = 0; + } + } + }, + errors = [], + errCnt = 0, + renames = (data.renames || null), + hashes = (data.hashes || null), + chunkMerge = false, + ntfUpload = $(); + + // regist fnAbort function + node.one('uploadabort', fnAbort); + $(window).one('unload.' + fm.namespace, fnAbort); + + !chunkMerge && (prev = loaded); + + if (!isDataType && !cnt) { + return dfrd.reject(['errUploadNoFiles']); + } + + xhr.addEventListener('error', function() { + if (xhr.status == 0) { + if (abort) { + dfrd.reject(); + } else { + // ff bug while send zero sized file + // for safari - send directory + if (!isDataType && data.files && $.grep(data.files, function(f){return ! f.type && f.size === (self.UA.Safari? 1802 : 0)? true : false;}).length) { + dfrd.reject(['errAbort', 'errFolderUpload']); + } else if (data.input && $.grep(data.input.files, function(f){return ! f.type && f.size === (self.UA.Safari? 1802 : 0)? true : false;}).length) { + dfrd.reject(['errUploadNoFiles']); + } else { + doRetry(); + } + } + } else { + node.trigger('uploadabort', 'errConnect'); + } + }, false); + + xhr.addEventListener('load', function(e) { + var status = xhr.status, res, curr = 0, error = '', errData, errObj; + + self.setCustomHeaderByXhr(xhr); + + if (status >= 400) { + if (status > 500) { + error = 'errResponse'; + } else { + error = ['errResponse', 'errServerError']; + } + } else { + if (!xhr.responseText) { + error = ['errResponse', 'errDataEmpty']; + } + } + + if (error) { + node.trigger('uploadabort'); + getFile(files || {}).done(function(file) { + return dfrd.reject(file._cid? null : error); + }); + } + + loaded = filesize; + + if (checkNotify() && (curr = loaded - prev)) { + self.notify({type : 'upload', cnt : 0, progress : curr, size : 0}); + progress(); + } + + res = self.parseUploadData(xhr.responseText); + + // chunked upload commit + if (res._chunkmerged) { + formData = new FormData(); + var _file = [{_chunkmerged: res._chunkmerged, _name: res._name, _mtime: res._mtime}]; + chunkMerge = true; + node.off('uploadabort', fnAbort); + notifyto2 = setTimeout(function() { + self.notify({type : 'chunkmerge', cnt : 1}); + }, self.options.notifyDelay); + isDataType? send(_file, files[1]) : send(_file); + return; + } + + res._multiupload = data.multiupload? true : false; + if (res.error) { + errData = { + cmd: 'upload', + err: res, + xhr: xhr, + rc: xhr.status + }; + self.trigger('uploadfail', res); + // trigger "requestError" event + self.trigger('requestError', errData); + if (errData._getEvent && errData._getEvent().isDefaultPrevented()) { + res.error = ''; + } + if (res._chunkfailure || res._multiupload) { + abort = true; + self.uploads.xhrUploading = false; + notifyto && clearTimeout(notifyto); + if (ntfUpload.length) { + self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0}); + dfrd.reject(res); + } else { + // for multi connection + dfrd.reject(); + } + } else { + dfrd.reject(res); + } + } else { + dfrd.resolve(res); + } + }, false); + + xhr.upload.addEventListener('loadstart', function(e) { + if (!chunkMerge && e.lengthComputable) { + loaded = e.loaded; + retry && (loaded = 0); + filesize = e.total; + if (!loaded) { + loaded = parseInt(filesize * 0.05); + } + if (checkNotify()) { + self.notify({type : 'upload', cnt : 0, progress : loaded - prev, size : data.multiupload? 0 : filesize}); + prev = loaded; + progress(); + } + } + }, false); + + xhr.upload.addEventListener('progress', function(e) { + var curr; + + if (e.lengthComputable && !chunkMerge && xhr.readyState < 2) { + + loaded = e.loaded; + + // to avoid strange bug in safari (not in chrome) with drag&drop. + // bug: macos finder opened in any folder, + // reset safari cache (option+command+e), reload elfinder page, + // drop file from finder + // on first attempt request starts (progress callback called ones) but never ends. + // any next drop - successfull. + if (!data.checked && loaded > 0 && !notifyto) { + notifyto = startNotify(xhr._totalSize - loaded); + } + + if (!filesize) { + filesize = e.total; + if (!loaded) { + loaded = parseInt(filesize * 0.05); + } + } + + curr = loaded - prev; + if (checkNotify() && (curr/e.total) >= 0.05) { + self.notify({type : 'upload', cnt : 0, progress : curr, size : 0}); + prev = loaded; + progress(); + } + + if (!uploadedNtf && loaded >= filesize && !isChunked) { + // Use "chunkmerge" for "server-in-process" notification + uploadedNtf = true; + notifyto1 = setTimeout(function() { + self.notify({type : 'chunkmerge', cnt : cnt}); + }, self.options.notifyDelay); + } + + if (cancelBtn && ! data.multiupload && loaded >= filesize) { + checkNotify() && cancelToggle(false); + } + } + }, false); + + var send = function(files, paths){ + var size = 0, + fcnt = 1, + sfiles = [], + c = 0, + total = cnt, + maxFileSize, + totalSize = 0, + chunked = [], + chunkID = new Date().getTime().toString().substr(-9), // for take care of the 32bit backend system + BYTES_PER_CHUNK = Math.min((fm.uplMaxSize? fm.uplMaxSize : 2097152) - 8190, fm.options.uploadMaxChunkSize), // uplMaxSize margin 8kb or options.uploadMaxChunkSize + blobSlice = chunkEnable? false : '', + blobSize, blobMtime, blobName, i, start, end, chunks, blob, chunk, added, done, last, failChunk, + multi = function(files, num){ + var sfiles = [], cid, sfilesLen = 0, cancelChk, hasChunk; + if (!abort) { + while(files.length && sfiles.length < num) { + sfiles.push(files.shift()); + } + sfilesLen = sfiles.length; + if (sfilesLen) { + cancelChk = sfilesLen; + for (var i=0; i < sfilesLen; i++) { + if (abort) { + break; + } + cid = isDataType? (sfiles[i][0][0]._cid || null) : (sfiles[i][0]._cid || null); + hasChunk = (hasChunk || cid)? true : false; + if (!!failChunk[cid]) { + last--; + continue; + } + fm.exec('upload', { + type: data.type, + isDataType: isDataType, + files: sfiles[i], + checked: true, + target: target, + dropEvt: dropEvt, + renames: renames, + hashes: hashes, + multiupload: true, + overwrite: data.overwrite === 0? 0 : void 0, + clipdata: data.clipdata + }, void 0, target) + .fail(function(error) { + if (error && error === 'No such command') { + abort = true; + fm.error(['errUpload', 'errPerm']); + } + if (cid) { + failChunk[cid] = true; + } + }) + .always(function(e) { + if (e && e.added) added = $.merge(added, e.added); + if (last <= ++done) { + fm.trigger('multiupload', {added: added}); + notifyto && clearTimeout(notifyto); + if (checkNotify()) { + self.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0}); + } + } + if (files.length) { + multi(files, 1); // Next one + } else { + if (--cancelChk <= 1) { + if (cancelBtn) { + cancelToggle(false, hasChunk); + } + } + dfrd.resolve(); + } + }); + } + } + } + if (sfiles.length < 1 || abort) { + if (abort) { + notifyto && clearTimeout(notifyto); + if (cid) { + failChunk[cid] = true; + } + dfrd.reject(); + } else { + dfrd.resolve(); + self.uploads.xhrUploading = false; + } + } + }, + check = function(){ + if (!self.uploads.xhrUploading) { + self.uploads.xhrUploading = true; + multi(sfiles, multiMax); // Max connection: 3 + } else { + setTimeout(check, 100); + } + }, + reqId, err; + + if (! dataChecked && (isDataType || data.type == 'files')) { + if (! (maxFileSize = fm.option('uploadMaxSize', target))) { + maxFileSize = 0; + } + for (i=0; i < files.length; i++) { + try { + blob = files[i]; + blobSize = blob.size; + if (blobSlice === false) { + blobSlice = ''; + if (self.api >= 2.1) { + if ('slice' in blob) { + blobSlice = 'slice'; + } else if ('mozSlice' in blob) { + blobSlice = 'mozSlice'; + } else if ('webkitSlice' in blob) { + blobSlice = 'webkitSlice'; + } + } + } + } catch(e) { + cnt--; + total--; + continue; + } + + // file size check + if ((maxFileSize && blobSize > maxFileSize) || (!blobSlice && fm.uplMaxSize && blobSize > fm.uplMaxSize)) { + triggerError(['errUploadFile', blob.name, 'errUploadFileSize'], blob, true); + cnt--; + total--; + continue; + } + + // file mime check + if (blob.type && ! self.uploadMimeCheck(blob.type, target)) { + triggerError(['errUploadFile', blob.name, 'errUploadMime', '(' + blob.type + ')'], blob, true); + cnt--; + total--; + continue; + } + + if (blobSlice && blobSize > BYTES_PER_CHUNK) { + start = 0; + end = BYTES_PER_CHUNK; + chunks = -1; + total = Math.floor((blobSize - 1) / BYTES_PER_CHUNK); + blobMtime = blob.lastModified? Math.round(blob.lastModified/1000) : 0; + blobName = data.clipdata? fm.date(fm.nonameDateFormat) + '.png' : blob.name; + + totalSize += blobSize; + chunked[chunkID] = 0; + while(start < blobSize) { + chunk = blob[blobSlice](start, end); + chunk._chunk = blobName + '.' + (++chunks) + '_' + total + '.part'; + chunk._cid = chunkID; + chunk._range = start + ',' + chunk.size + ',' + blobSize; + chunk._mtime = blobMtime; + chunked[chunkID]++; + + if (size) { + c++; + } + if (typeof sfiles[c] == 'undefined') { + sfiles[c] = []; + if (isDataType) { + sfiles[c][0] = []; + sfiles[c][1] = []; + } + } + size = BYTES_PER_CHUNK; + fcnt = 1; + if (isDataType) { + sfiles[c][0].push(chunk); + sfiles[c][1].push(paths[i]); + } else { + sfiles[c].push(chunk); + } + + start = end; + end = start + BYTES_PER_CHUNK; + } + if (chunk == null) { + triggerError(['errUploadFile', blob.name, 'errUploadFileSize'], blob, true); + cnt--; + total--; + } else { + total += chunks; + size = 0; + fcnt = 1; + c++; + } + continue; + } + if ((fm.uplMaxSize && size + blobSize > fm.uplMaxSize) || fcnt > fm.uplMaxFile) { + size = 0; + fcnt = 1; + c++; + } + if (typeof sfiles[c] == 'undefined') { + sfiles[c] = []; + if (isDataType) { + sfiles[c][0] = []; + sfiles[c][1] = []; + } + } + if (isDataType) { + sfiles[c][0].push(blob); + sfiles[c][1].push(paths[i]); + } else { + sfiles[c].push(blob); + } + size += blobSize; + totalSize += blobSize; + fcnt++; + } + + if (errors.length) { + triggerError(); + } + + if (sfiles.length == 0) { + // no data + data.checked = true; + return false; + } + + if (sfiles.length > 1) { + // multi upload + notifyto = startNotify(totalSize); + added = []; + done = 0; + last = sfiles.length; + failChunk = []; + check(); + return true; + } + + // single upload + if (isDataType) { + files = sfiles[0][0]; + paths = sfiles[0][1]; + } else { + files = sfiles[0]; + } + } + + if (!dataChecked) { + if (!fm.UA.Safari || !data.files) { + notifyto = startNotify(totalSize); + } else { + xhr._totalSize = totalSize; + } + } + + dataChecked = true; + + if (! files.length) { + dfrd.reject(['errUploadNoFiles']); + } + + xhr.open('POST', self.uploadURL, true); + + // set request headers + if (fm.customHeaders) { + $.each(fm.customHeaders, function(key) { + xhr.setRequestHeader(key, this); + }); + } + + // set xhrFields + if (fm.xhrFields) { + $.each(fm.xhrFields, function(key) { + if (key in xhr) { + xhr[key] = this; + } + }); + } + + if (self.api >= 2.1029) { + // request ID + reqId = (+ new Date()).toString(16) + Math.floor(1000 * Math.random()).toString(16); + formData.append('reqid', reqId); + xhr._requestId = reqId; + } + formData.append('cmd', 'upload'); + formData.append(self.newAPI ? 'target' : 'current', target); + if (renames && renames.length) { + $.each(renames, function(i, v) { + formData.append('renames[]', v); + }); + formData.append('suffix', fm.options.backupSuffix); + } + if (hashes) { + $.each(hashes, function(i, v) { + formData.append('hashes['+ i +']', v); + }); + } + $.each(self.customData, function(key, val) { + formData.append(key, val); + }); + $.each(self.options.onlyMimes, function(i, mime) { + formData.append('mimes[]', mime); + }); + + $.each(files, function(i, file) { + var name, relpath; + if (file._chunkmerged) { + formData.append('chunk', file._chunkmerged); + formData.append('upload[]', file._name); + formData.append('mtime[]', file._mtime); + data.clipdata && formData.append('overwrite', 0); + isChunked = true; + } else { + if (file._chunkfail) { + formData.append('upload[]', 'chunkfail'); + formData.append('mimes', 'chunkfail'); + } else { + if (data.clipdata) { + if (!file._chunk) { + data.overwrite = 0; + name = fm.date(fm.nonameDateFormat) + '.png'; + } + } else { + if (file.name) { + name = file.name; + if (fm.UA.iOS) { + if (name.match(/^image\.jpe?g$/i)) { + data.overwrite = 0; + name = fm.date(fm.nonameDateFormat) + '.jpg'; + } else if (name.match(/^capturedvideo\.mov$/i)) { + data.overwrite = 0; + name = fm.date(fm.nonameDateFormat) + '.mov'; + } + } + relpath = (file.webkitRelativePath || file.relativePath || file._relativePath || '').replace(/[^\/]+$/, ''); + name = relpath + name; + } + } + name? formData.append('upload[]', file, name) : formData.append('upload[]', file); + } + if (file._chunk) { + formData.append('chunk', file._chunk); + formData.append('cid' , file._cid); + formData.append('range', file._range); + formData.append('mtime[]', file._mtime); + isChunked = true; + } else { + formData.append('mtime[]', file.lastModified? Math.round(file.lastModified/1000) : 0); + } + } + }); + + if (isDataType) { + $.each(paths, function(i, path) { + formData.append('upload_path[]', path); + }); + } + + if (data.overwrite === 0) { + formData.append('overwrite', 0); + } + + // send int value that which meta key was pressed when dropped as `dropWith` + if (dropEvt) { + formData.append('dropWith', parseInt( + (dropEvt.altKey ? '1' : '0')+ + (dropEvt.ctrlKey ? '1' : '0')+ + (dropEvt.metaKey ? '1' : '0')+ + (dropEvt.shiftKey? '1' : '0'), 2)); + } + + // set extraData on current request + if (extraData) { + $.each(extraData, function(key, val) { + formData.append(key, val); + }); + } + + xhr.send(formData); + + return true; + }; + + if (! isDataType) { + if (files.length > 0) { + if (! data.clipdata && renames == null) { + var mkdirs = [], + paths = [], + excludes = fm.options.folderUploadExclude[fm.OS] || null; + $.each(files, function(i, file) { + var relPath = file.webkitRelativePath || file.relativePath || '', + idx, rootDir; + if (! relPath) { + return false; + } + if (excludes && file.name.match(excludes)) { + file._remove = true; + relPath = void(0); + } else { + // add '/' as prefix to make same to folder uploading with DnD, see #2607 + relPath = '/' + relPath.replace(/\/[^\/]*$/, '').replace(/^\//, ''); + if (relPath && $.inArray(relPath, mkdirs) === -1) { + mkdirs.push(relPath); + // checking the root directory to supports see #2378 + idx = relPath.substr(1).indexOf('/'); + if (idx !== -1 && (rootDir = relPath.substr(0, idx + 1)) && $.inArray(rootDir, mkdirs) === -1) { + mkdirs.unshift(rootDir); + } + } + } + paths.push(relPath); + }); + renames = []; + hashes = {}; + if (mkdirs.length) { + (function() { + var checkDirs = $.map(mkdirs, function(name) { return name.substr(1).indexOf('/') === -1 ? {name: name.substr(1)} : null;}), + cancelDirs = []; + fm.uploads.checkExists(checkDirs, target, fm, true).done( + function(res, res2) { + var dfds = [], dfd, bak, hash; + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + cancelDirs = $.map(checkDirs, function(dir) { return dir._remove? dir.name : null ;} ); + checkDirs = $.grep(checkDirs, function(dir) { return !dir._remove? true : false ;} ); + } + if (cancelDirs.length) { + $.each(paths.concat(), function(i, path) { + if ($.inArray(path, cancelDirs) === 0) { + files[i]._remove = true; + paths[i] = void(0); + } + }); + } + files = $.grep(files, function(file) { return file._remove? false : true; }); + paths = $.grep(paths, function(path) { return path === void 0 ? false : true; }); + if (checkDirs.length) { + dfd = $.Deferred(); + if (res.length) { + $.each(res, function(i, existName) { + // backup + bak = fm.uniqueName(existName + fm.options.backupSuffix , null, ''); + $.each(res2, function(h, name) { + if (res[0] == name) { + hash = h; + return false; + } + }); + if (! hash) { + hash = fm.fileByName(res[0], target).hash; + } + fm.lockfiles({files : [hash]}); + dfds.push( + fm.request({ + data : {cmd : 'rename', target : hash, name : bak}, + notify : {type : 'rename', cnt : 1} + }) + .fail(function(error) { + dfrd.reject(error); + fm.sync(); + }) + .always(function() { + fm.unlockfiles({files : [hash]}); + }) + ); + }); + } else { + dfds.push(null); + } + + $.when.apply($, dfds).done(function() { + // ensure directories + fm.request({ + data : {cmd : 'mkdir', target : target, dirs : mkdirs}, + notify : {type : 'mkdir', cnt : mkdirs.length}, + preventFail: true + }) + .fail(function(error) { + error = error || ['errUnknown']; + if (error[0] === 'errCmdParams') { + multiMax = 1; + } else { + multiMax = 0; + dfrd.reject(error); + } + }) + .done(function(data) { + var rm = false; + if (!data.hashes) { + data.hashes = {}; + } + paths = $.map(paths.concat(), function(p, i) { + if (p === '/') { + return target; + } else { + if (data.hashes[p]) { + return data.hashes[p]; + } else { + rm = true; + files[i]._remove = true; + return null; + } + } + }); + if (rm) { + files = $.grep(files, function(file) { return file._remove? false : true; }); + } + }) + .always(function(data) { + if (multiMax) { + isDataType = true; + if (! send(files, paths)) { + dfrd.reject(); + } + } + }); + }); + } else { + dfrd.reject(); + } + } + ); + })(); + } else { + fm.uploads.checkExists(files, target, fm).done( + function(res, res2){ + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + hashes = res2; + if (res === null) { + data.overwrite = 0; + } else { + renames = res; + } + files = $.grep(files, function(file){return !file._remove? true : false ;}); + } + cnt = files.length; + if (cnt > 0) { + if (! send(files)) { + dfrd.reject(); + } + } else { + dfrd.reject(); + } + } + ); + } + } else { + if (! send(files)) { + dfrd.reject(); + } + } + } else { + dfrd.reject(); + } + } else { + if (dataChecked) { + send(files[0], files[1]); + } else { + files.done(function(result) { // result: [files, paths, renames, hashes, mkdirs] + renames = []; + cnt = result[0].length; + if (cnt) { + if (result[4] && result[4].length) { + // ensure directories + fm.request({ + data : {cmd : 'mkdir', target : target, dirs : result[4]}, + notify : {type : 'mkdir', cnt : result[4].length}, + preventFail: true + }) + .fail(function(error) { + error = error || ['errUnknown']; + if (error[0] === 'errCmdParams') { + multiMax = 1; + } else { + multiMax = 0; + dfrd.reject(error); + } + }) + .done(function(data) { + var rm = false; + if (!data.hashes) { + data.hashes = {}; + } + result[1] = $.map(result[1], function(p, i) { + result[0][i]._relativePath = p.replace(/^\//, ''); + p = p.replace(/\/[^\/]*$/, ''); + if (p === '') { + return target; + } else { + if (data.hashes[p]) { + return data.hashes[p]; + } else { + rm = true; + result[0][i]._remove = true; + return null; + } + } + }); + if (rm) { + result[0] = $.grep(result[0], function(file) { return file._remove? false : true; }); + } + }) + .always(function(data) { + if (multiMax) { + renames = result[2]; + hashes = result[3]; + send(result[0], result[1]); + } + }); + return; + } else { + result[1] = $.map(result[1], function() { return target; }); + } + renames = result[2]; + hashes = result[3]; + send(result[0], result[1]); + } else { + dfrd.reject(['errUploadNoFiles']); + } + }).fail(function(){ + dfrd.reject(); + }); + } + } + + return dfrd; + }, + + // upload transport using iframe + iframe : function(data, fm) { + var self = fm ? fm : this, + input = data.input? data.input : false, + files = !input ? self.uploads.checkFile(data, self) : false, + dfrd = $.Deferred() + .fail(function(error) { + error && self.error(error); + }), + name = 'iframe-'+fm.namespace+(++self.iframeCnt), + form = $('
'), + msie = this.UA.IE, + // clear timeouts, close notification dialog, remove form/iframe + onload = function() { + abortto && clearTimeout(abortto); + notifyto && clearTimeout(notifyto); + notify && self.notify({type : 'upload', cnt : -cnt}); + + setTimeout(function() { + msie && $('').appendTo(form); + form.remove(); + iframe.remove(); + }, 100); + }, + iframe = $('') + .on('load', function() { + iframe.off('load') + .on('load', function() { + onload(); + // data will be processed in callback response or window onmessage + dfrd.resolve(); + }); + + // notify dialog + notifyto = setTimeout(function() { + notify = true; + self.notify({type : 'upload', cnt : cnt}); + }, self.options.notifyDelay); + + // emulate abort on timeout + if (self.options.iframeTimeout > 0) { + abortto = setTimeout(function() { + onload(); + dfrd.reject(['errConnect', 'errTimeout']); + }, self.options.iframeTimeout); + } + + form.submit(); + }), + target = (data.target || self.cwd().hash), + names = [], + dfds = [], + renames = [], + hashes = {}, + cnt, notify, notifyto, abortto; + + if (files && files.length) { + $.each(files, function(i, val) { + form.append(''); + }); + cnt = 1; + } else if (input && $(input).is(':file') && $(input).val()) { + if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) { + names = input.files? input.files : [{ name: $(input).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/, '$1') }]; + //names = $.map(names, function(file){return file.name? { name: file.name } : null ;}); + dfds.push(self.uploads.checkExists(names, target, self).done( + function(res, res2){ + hashes = res2; + if (res === null) { + data.overwrite = 0; + } else{ + renames = res; + cnt = $.grep(names, function(file){return !file._remove? true : false ;}).length; + if (cnt != names.length) { + cnt = 0; + } + } + } + )); + } + cnt = input.files ? input.files.length : 1; + form.append(input); + } else { + return dfrd.reject(); + } + + $.when.apply($, dfds).done(function() { + if (cnt < 1) { + return dfrd.reject(); + } + form.append('') + .append('') + .append('') + .append($(input).attr('name', 'upload[]')); + + if (renames.length > 0) { + $.each(renames, function(i, rename) { + form.append(''); + }); + form.append(''); + } + if (hashes) { + $.each(renames, function(i, v) { + form.append(''); + }); + } + + if (data.overwrite === 0) { + form.append(''); + } + + $.each(self.options.onlyMimes||[], function(i, mime) { + form.append(''); + }); + + $.each(self.customData, function(key, val) { + form.append(''); + }); + + form.appendTo('body'); + iframe.appendTo('body'); + }); + + return dfrd; + } + }, + + + /** + * Bind callback to event(s) The callback is executed at most once per event. + * To bind to multiply events at once, separate events names by space + * + * @param String event name + * @param Function callback + * @param Boolan priority first + * @return elFinder + */ + one : function(ev, callback, priorityFirst) { + var self = this, + event = ev.toLowerCase(), + h = function(e, f) { + if (!self.toUnbindEvents[event]) { + self.toUnbindEvents[event] = []; + } + self.toUnbindEvents[event].push({ + type: event, + callback: h + }); + return (callback.done? callback.done : callback).apply(this, arguments); + }; + if (callback.done) { + h = {done: h}; + } + return this.bind(event, h, priorityFirst); + }, + + /** + * Set/get data into/from localStorage + * + * @param String key + * @param String|void value + * @return String|null + */ + localStorage : function(key, val) { + var self = this, + s = window.localStorage, + oldkey = 'elfinder-'+(key || '')+this.id, // old key of elFinder < 2.1.6 + prefix = window.location.pathname+'-elfinder-', + suffix = this.id, + clrs = [], + retval, oldval, t, precnt, sufcnt; + + // reset this node data + if (typeof(key) === 'undefined') { + precnt = prefix.length; + sufcnt = suffix.length * -1; + $.each(s, function(key) { + if (key.substr(0, precnt) === prefix && key.substr(sufcnt) === suffix) { + clrs.push(key); + } + }); + $.each(clrs, function(i, key) { + s.removeItem(key); + }); + return true; + } + + // new key of elFinder >= 2.1.6 + key = prefix+key+suffix; + + if (val === null) { + return s.removeItem(key); + } + + if (val === void(0) && !(retval = s.getItem(key)) && (oldval = s.getItem(oldkey))) { + val = oldval; + s.removeItem(oldkey); + } + + if (val !== void(0)) { + t = typeof val; + if (t !== 'string' && t !== 'number') { + val = JSON.stringify(val); + } + try { + s.setItem(key, val); + } catch (e) { + try { + s.clear(); + s.setItem(key, val); + } catch (e) { + self.debug('error', e.toString()); + } + } + retval = s.getItem(key); + } + + if (retval && (retval.substr(0,1) === '{' || retval.substr(0,1) === '[')) { + try { + return JSON.parse(retval); + } catch(e) {} + } + return retval; + }, + + /** + * Set/get data into/from sessionStorage + * + * @param String key + * @param String|void value + * @return String|null + */ + sessionStorage : function(key, val) { + var self = this, + s, retval, t; + + try { + s = window.sessionStorage; + } catch(e) {} + + if (!s) { + return; + } + + if (val === null) { + return s.removeItem(key); + } + + if (val !== void(0)) { + t = typeof val; + if (t !== 'string' && t !== 'number') { + val = JSON.stringify(val); + } + try { + s.setItem(key, val); + } catch (e) { + try { + s.clear(); + s.setItem(key, val); + } catch (e) { + self.debug('error', e.toString()); + } + } + } + retval = s.getItem(key); + + if (retval && (retval.substr(0,1) === '{' || retval.substr(0,1) === '[')) { + try { + return JSON.parse(retval); + } catch(e) {} + } + return retval; + }, + + /** + * Get/set cookie + * + * @param String cookie name + * @param String|void cookie value + * @return String|null + */ + cookie : function(name, value) { + var d, o, c, i, retval, t; + + name = 'elfinder-'+name+this.id; + + if (value === void(0)) { + if (this.cookieEnabled && document.cookie && document.cookie != '') { + c = document.cookie.split(';'); + name += '='; + for (i=0; i'), + + /** + * Replace not html-safe symbols to html entities + * + * @param String text to escape + * @return String + */ + escape : function(name) { + return this._node.text(name).html().replace(/"/g, '"').replace(/'/g, '''); + }, + + /** + * Cleanup ajax data. + * For old api convert data into new api format + * + * @param String command name + * @param Object data from backend + * @return Object + */ + normalize : function(data) { + var self = this, + fileFilter = (function() { + var func, filter; + if (filter = self.options.fileFilter) { + if (typeof filter === 'function') { + func = function(file) { + return filter.call(self, file); + }; + } else if (filter instanceof RegExp) { + func = function(file) { + return filter.test(file.name); + }; + } + } + return func? func : null; + })(), + chkCmdMap = function(opts) { + // Disable command to replace with other command + var disabled; + if (opts.uiCmdMap) { + if ($.isPlainObject(opts.uiCmdMap) && Object.keys(opts.uiCmdMap).length) { + if (!opts.disabledFlip) { + opts.disabledFlip = {}; + } + disabled = opts.disabledFlip; + $.each(opts.uiCmdMap, function(f, t) { + if (t === 'hidden' && !disabled[f]) { + opts.disabled.push(f); + opts.disabledFlip[f] = true; + } + }); + } else { + delete opts.uiCmdMap; + } + } + }, + normalizeOptions = function(opts) { + var getType = function(v) { + var type = typeof v; + if (type === 'object' && Array.isArray(v)) { + type = 'array'; + } + return type; + }; + $.each(self.optionProperties, function(k, empty) { + if (empty !== void(0)) { + if (opts[k] && getType(opts[k]) !== getType(empty)) { + opts[k] = empty; + } + } + }); + if (opts.disabled) { + opts.disabledFlip = self.arrayFlip(opts.disabled, true); + $.each(self.options.disabledCmdsRels, function(com, rels) { + var m, flg; + if (opts.disabledFlip[com]) { + flg = true; + } else if (m = com.match(/^([^&]+)&([^=]+)=(.*)$/)) { + if (opts.disabledFlip[m[1]] && opts[m[2]] == m[3]) { + flg = true; + } + } + if (flg) { + $.each(rels, function(i, rel) { + if (!opts.disabledFlip[rel]) { + opts.disabledFlip[rel] = true; + opts.disabled.push(rel); + } + }); + } + }); + } else { + opts.disabledFlip = {}; + } + return opts; + }, + filter = function(file, asMap, type) { + var res = asMap? file : true, + ign = asMap? null : false, + vid, targetOptions, isRoot, rootNames; + + if (file && file.hash && file.name && file.mime) { + if (file.mime === 'application/x-empty') { + file.mime = 'text/plain'; + } + + isRoot = self.isRoot(file); + if (isRoot && ! file.volumeid) { + self.debug('warning', 'The volume root statuses requires `volumeid` property.'); + } + if (isRoot || file.mime === 'directory') { + // Prevention of circular reference + if (file.phash) { + if (file.phash === file.hash) { + error = error.concat(['Parent folder of "$1" is itself.', file.name]); + return ign; + } + if (isRoot && file.volumeid && file.phash.indexOf(file.volumeid) === 0) { + error = error.concat(['Parent folder of "$1" is inner itself.', file.name]); + return ign; + } + } + + // set options, tmbUrls for each volume + if (file.volumeid) { + vid = file.volumeid; + + if (isRoot) { + // make or update of leaf roots cache + if (file.phash) { + if (! self.leafRoots[file.phash]) { + self.leafRoots[file.phash] = [ file.hash ]; + } else { + if ($.inArray(file.hash, self.leafRoots[file.phash]) === -1) { + self.leafRoots[file.phash].push(file.hash); + } + } + } + + self.hasVolOptions = true; + if (! self.volOptions[vid]) { + self.volOptions[vid] = { + // set dispInlineRegex + dispInlineRegex: self.options.dispInlineRegex + }; + } + + targetOptions = self.volOptions[vid]; + + if (file.options) { + // >= v.2.1.14 has file.options + Object.assign(targetOptions, file.options); + } + + // for compat <= v2.1.13 + if (file.disabled) { + targetOptions.disabled = file.disabled; + targetOptions.disabledFlip = self.arrayFlip(file.disabled, true); + } + if (file.tmbUrl) { + targetOptions.tmbUrl = file.tmbUrl; + } + + // '/' required at the end of url + if (targetOptions.url && targetOptions.url.substr(-1) !== '/') { + targetOptions.url += '/'; + } + + // check uiCmdMap + chkCmdMap(targetOptions); + + // check trash bin hash + if (targetOptions.trashHash) { + if (self.trashes[targetOptions.trashHash] === false) { + delete targetOptions.trashHash; + } else { + self.trashes[targetOptions.trashHash] = file.hash; + } + } + + // set immediate properties + $.each(self.optionProperties, function(k) { + if (targetOptions[k]) { + file[k] = targetOptions[k]; + } + }); + + // regist fm.roots + if (type !== 'cwd') { + self.roots[vid] = file.hash; + } + + // regist fm.volumeExpires + if (file.expires) { + self.volumeExpires[vid] = file.expires; + } + } + + if (prevId !== vid) { + prevId = vid; + i18nFolderName = self.option('i18nFolderName', vid); + } + } + + // volume root i18n name + if (isRoot && ! file.i18) { + name = 'volume_' + file.name, + i18 = self.i18n(false, name); + + if (name !== i18) { + file.i18 = i18; + } + } + + // i18nFolderName + if (i18nFolderName && ! file.i18) { + name = 'folder_' + file.name, + i18 = self.i18n(false, name); + + if (name !== i18) { + file.i18 = i18; + } + } + + if (isRoot) { + if (rootNames = self.storage('rootNames')) { + if (rootNames[file.hash]) { + file._name = file.name; + file._i18 = file.i18; + file.name = rootNames[file.hash] = rootNames[file.hash]; + delete file.i18; + } + self.storage('rootNames', rootNames); + } + } + + // lock trash bins holder + if (self.trashes[file.hash]) { + file.locked = true; + } + } else { + if (fileFilter) { + try { + if (! fileFilter(file)) { + return ign; + } + } catch(e) { + self.debug(e); + } + } + if (file.size == 0) { + file.mime = self.getMimetype(file.name, file.mime); + } + } + + if (file.options) { + self.optionsByHashes[file.hash] = normalizeOptions(file.options); + } + + delete file.options; + + return res; + } + return ign; + }, + getDescendants = function(hashes) { + var res = []; + $.each(self.files(), function(h, f) { + $.each(self.parents(h), function(i, ph) { + if ($.inArray(ph, hashes) !== -1 && $.inArray(h, hashes) === -1) { + res.push(h); + return false; + } + }); + }); + return res; + }, + applyLeafRootStats = function(dataArr, type) { + $.each(dataArr, function(i, f) { + var pfile, done; + if (self.leafRoots[f.hash]) { + self.applyLeafRootStats(f); + } + // update leaf root parent stat + if (type !== 'change' && f.phash && self.isRoot(f) && (pfile = self.file(f.phash))) { + self.applyLeafRootStats(pfile); + // add to data.changed + if (!data.changed) { + data.changed = [pfile]; + } else { + $.each(data.changed, function(i, f) { + if (f.hash === pfile.hash) { + data.changed[i] = pfile; + done = true; + return false; + } + }); + if (!done) { + data.changed.push(pfile); + } + } + } + }); + }, + error = [], + name, i18, i18nFolderName, prevId, cData; + + // set cunstom data + if (data.customData && (!self.prevCustomData || (JSON.stringify(data.customData) !== JSON.stringify(self.prevCustomData)))) { + self.prevCustomData = data.customData; + try { + cData = JSON.parse(data.customData); + if ($.isPlainObject(cData)) { + self.prevCustomData = cData; + $.each(Object.keys(cData), function(i, key) { + if (cData[key] === null) { + delete cData[key]; + delete self.optsCustomData[key]; + } + }); + self.customData = Object.assign({}, self.optsCustomData, cData); + } + } catch(e) {} + } + + if (data.options) { + normalizeOptions(data.options); + } + + if (data.cwd) { + if (data.cwd.volumeid && data.options && Object.keys(data.options).length && self.isRoot(data.cwd)) { + self.hasVolOptions = true; + self.volOptions[data.cwd.volumeid] = data.options; + } + data.cwd = filter(data.cwd, true, 'cwd'); + } + if (data.files) { + data.files = $.grep(data.files, filter); + } + if (data.tree) { + data.tree = $.grep(data.tree, filter); + } + if (data.added) { + data.added = $.grep(data.added, filter); + } + if (data.changed) { + data.changed = $.grep(data.changed, filter); + } + if (data.removed && data.removed.length && self.searchStatus.state === 2) { + data.removed = data.removed.concat(getDescendants(data.removed)); + } + if (data.api) { + data.init = true; + } + + if (Object.keys(self.leafRoots).length) { + data.files && applyLeafRootStats(data.files); + data.tree && applyLeafRootStats(data.tree); + data.added && applyLeafRootStats(data.added); + data.changed && applyLeafRootStats(data.changed, 'change'); + } + + // merge options that apply only to cwd + if (data.cwd && data.cwd.options && data.options) { + Object.assign(data.options, normalizeOptions(data.cwd.options)); + } + + // '/' required at the end of url + if (data.options && data.options.url && data.options.url.substr(-1) !== '/') { + data.options.url += '/'; + } + + // check error + if (error.length) { + data.norError = ['errResponse'].concat(error); + } + + return data; + }, + + /** + * Update sort options + * + * @param {String} sort type + * @param {String} sort order + * @param {Boolean} show folder first + */ + setSort : function(type, order, stickFolders, alsoTreeview) { + this.storage('sortType', (this.sortType = this.sortRules[type] ? type : 'name')); + this.storage('sortOrder', (this.sortOrder = /asc|desc/.test(order) ? order : 'asc')); + this.storage('sortStickFolders', (this.sortStickFolders = !!stickFolders) ? 1 : ''); + this.storage('sortAlsoTreeview', (this.sortAlsoTreeview = !!alsoTreeview) ? 1 : ''); + this.trigger('sortchange'); + }, + + _sortRules : { + name : function(file1, file2) { + return elFinder.prototype.naturalCompare(file1.i18 || file1.name, file2.i18 || file2.name); + }, + size : function(file1, file2) { + var size1 = parseInt(file1.size) || 0, + size2 = parseInt(file2.size) || 0; + + return size1 === size2 ? 0 : size1 > size2 ? 1 : -1; + }, + kind : function(file1, file2) { + return elFinder.prototype.naturalCompare(file1.mime, file2.mime); + }, + date : function(file1, file2) { + var date1 = file1.ts || file1.date || 0, + date2 = file2.ts || file2.date || 0; + + return date1 === date2 ? 0 : date1 > date2 ? 1 : -1; + }, + perm : function(file1, file2) { + var val = function(file) { return (file.write? 2 : 0) + (file.read? 1 : 0); }, + v1 = val(file1), + v2 = val(file2); + return v1 === v2 ? 0 : v1 > v2 ? 1 : -1; + }, + mode : function(file1, file2) { + var v1 = file1.mode || (file1.perm || ''), + v2 = file2.mode || (file2.perm || ''); + return elFinder.prototype.naturalCompare(v1, v2); + }, + owner : function(file1, file2) { + var v1 = file1.owner || '', + v2 = file2.owner || ''; + return elFinder.prototype.naturalCompare(v1, v2); + }, + group : function(file1, file2) { + var v1 = file1.group || '', + v2 = file2.group || ''; + return elFinder.prototype.naturalCompare(v1, v2); + } + }, + + /** + * Valid sort rule names + * + * @type Object + */ + sorters : {}, + + /** + * Compare strings for natural sort + * + * @param String + * @param String + * @return Number + */ + naturalCompare : function(a, b) { + var self = elFinder.prototype.naturalCompare; + if (typeof self.loc == 'undefined') { + self.loc = (navigator.userLanguage || navigator.browserLanguage || navigator.language || 'en-US'); + } + if (typeof self.sort == 'undefined') { + if ('11'.localeCompare('2', self.loc, {numeric: true}) > 0) { + // Native support + if (window.Intl && window.Intl.Collator) { + self.sort = new Intl.Collator(self.loc, {numeric: true}).compare; + } else { + self.sort = function(a, b) { + return a.localeCompare(b, self.loc, {numeric: true}); + }; + } + } else { + /* + * Edited for elFinder (emulates localeCompare() by numeric) by Naoki Sawada aka nao-pon + */ + /* + * Huddle/javascript-natural-sort (https://github.com/Huddle/javascript-natural-sort) + */ + /* + * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license + * Author: Jim Palmer (based on chunking idea from Dave Koelle) + * http://opensource.org/licenses/mit-license.php + */ + self.sort = function(a, b) { + var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, + sre = /(^[ ]*|[ ]*$)/g, + dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, + hre = /^0x[0-9a-f]+$/i, + ore = /^0/, + syre = /^[\x01\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]/, // symbol first - (Naoki Sawada) + i = function(s) { return self.sort.insensitive && (''+s).toLowerCase() || ''+s; }, + // convert all to strings strip whitespace + // first character is "_", it's smallest - (Naoki Sawada) + x = i(a).replace(sre, '').replace(/^_/, "\x01") || '', + y = i(b).replace(sre, '').replace(/^_/, "\x01") || '', + // chunk/tokenize + xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), + yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), + // numeric, hex or date detection + xD = parseInt(x.match(hre)) || (xN.length != 1 && x.match(dre) && Date.parse(x)), + yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null, + oFxNcL, oFyNcL, + locRes = 0; + + // first try and sort Hex codes or Dates + if (yD) { + if ( xD < yD ) return -1; + else if ( xD > yD ) return 1; + } + // natural sorting through split numeric strings and default strings + for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) { + + // find floats not starting with '0', string or 0 if not defined (Clint Priest) + oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0; + oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0; + + // handle numeric vs string comparison - number < string - (Kyle Adams) + // but symbol first < number - (Naoki Sawada) + if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { + if (isNaN(oFxNcL) && (typeof oFxNcL !== 'string' || ! oFxNcL.match(syre))) { + return 1; + } else if (typeof oFyNcL !== 'string' || ! oFyNcL.match(syre)) { + return -1; + } + } + + // use decimal number comparison if either value is string zero + if (parseInt(oFxNcL, 10) === 0) oFxNcL = 0; + if (parseInt(oFyNcL, 10) === 0) oFyNcL = 0; + + // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2' + if (typeof oFxNcL !== typeof oFyNcL) { + oFxNcL += ''; + oFyNcL += ''; + } + + // use locale sensitive sort for strings when case insensitive + // note: localeCompare interleaves uppercase with lowercase (e.g. A,a,B,b) + if (self.sort.insensitive && typeof oFxNcL === 'string' && typeof oFyNcL === 'string') { + locRes = oFxNcL.localeCompare(oFyNcL, self.loc); + if (locRes !== 0) return locRes; + } + + if (oFxNcL < oFyNcL) return -1; + if (oFxNcL > oFyNcL) return 1; + } + return 0; + }; + self.sort.insensitive = true; + } + } + return self.sort(a, b); + }, + + /** + * Compare files based on elFinder.sort + * + * @param Object file + * @param Object file + * @return Number + */ + compare : function(file1, file2) { + var self = this, + type = self.sortType, + asc = self.sortOrder == 'asc', + stick = self.sortStickFolders, + rules = self.sortRules, + sort = rules[type], + d1 = file1.mime == 'directory', + d2 = file2.mime == 'directory', + res; + + if (stick) { + if (d1 && !d2) { + return -1; + } else if (!d1 && d2) { + return 1; + } + } + + res = asc ? sort(file1, file2) : sort(file2, file1); + + return type !== 'name' && res === 0 + ? res = asc ? rules.name(file1, file2) : rules.name(file2, file1) + : res; + }, + + /** + * Sort files based on config + * + * @param Array files + * @return Array + */ + sortFiles : function(files) { + return files.sort(this.compare); + }, + + /** + * Open notification dialog + * and append/update message for required notification type. + * + * @param Object options + * @example + * this.notify({ + * type : 'copy', + * msg : 'Copy files', // not required for known types @see this.notifyType + * cnt : 3, + * hideCnt : false, // true for not show count + * progress : 10, // progress bar percents (use cnt : 0 to update progress bar) + * cancel : callback // callback function for cancel button + * }) + * @return elFinder + */ + notify : function(opts) { + var self = this, + type = opts.type, + id = opts.id? 'elfinder-notify-'+opts.id : '', + msg = this.i18n((typeof opts.msg !== 'undefined')? opts.msg : (this.messages['ntf'+type] ? 'ntf'+type : 'ntfsmth')), + hiddens = this.arrayFlip(this.options.notifyDialog.hiddens || []), + ndialog = this.ui.notify, + dialog = ndialog.closest('.ui-dialog'), + notify = ndialog.children('.elfinder-notify-'+type+(id? ('.'+id) : '')), + button = notify.children('div.elfinder-notify-cancel').children('button'), + ntpl = '
{msg}
', + delta = opts.cnt + 0, + size = (typeof opts.size != 'undefined')? parseInt(opts.size) : null, + progress = (typeof opts.progress != 'undefined' && opts.progress >= 0) ? opts.progress : null, + fakeint = opts.fakeinterval || 200, + cancel = opts.cancel, + clhover = 'ui-state-hover', + close = function() { + var prog = notify.find('.elfinder-notify-progress'), + rm = function() { + notify.remove(); + if (!ndialog.children(dialog.data('minimized')? void(0) : ':visible').length) { + if (dialog.data('minimized')) { + dialog.data('minimized').hide(); + } else { + ndialog.elfinderdialog('close'); + } + } + setProgressbar(); + }; + notify._esc && $(document).off('keydown', notify._esc); + if (notify.data('cur') < 100) { + prog.animate({ + width : '100%' + }, 50, function() { requestAnimationFrame(function() { rm(); }); }); + } else { + rm(); + } + }, + fakeUp = function(interval) { + var cur; + if (notify.length) { + cur = notify.data('cur') + 1; + if (cur <= 98) { + notify.find('.elfinder-notify-progress').width(cur + '%'); + notify.data('cur', cur); + setProgressbar(); + setTimeout(function() { + interval *= 1.05; + fakeUp(interval); + }, interval); + } + } + }, + setProgressbar = function() { + var cnt = 0, + val = 0, + ntfs = ndialog.children('.elfinder-notify'), + w; + if (ntfs.length) { + ntfs.each(function() { + cnt++; + val += Math.min($(this).data('cur'), 100); + }); + w = cnt? Math.floor(val / (cnt * 100) * 100) + '%' : 0; + self.ui.progressbar.width(w); + if (dialog.data('minimized')) { + dialog.data('minimized').title(w); + dialog.data('minimized').dialog().children('.ui-dialog-titlebar').children('.elfinder-ui-progressbar').width(w); + } + } else { + self.ui.progressbar.width(0); + dialog.data('minimized') && dialog.data('minimized').hide(); + } + }, + cnt, total, prc; + + if (!type) { + return this; + } + + if (!notify.length) { + notify = $(ntpl.replace(/\{type\}/g, type).replace(/\{msg\}/g, msg)); + if (hiddens[type]) { + notify.hide(); + } else { + ndialog.on('minimize', function(e) { + dialog.data('minimized') && setProgressbar(); + }); + } + notify.appendTo(ndialog).data('cnt', 0); + + if (progress != null) { + notify.data({progress : 0, total : 0, cur : 0}); + } else { + notify.data({cur : 0}); + fakeUp(fakeint); + } + + if (cancel) { + button = $('') + .on('mouseenter mouseleave', function(e) { + $(this).toggleClass(clhover, e.type === 'mouseenter'); + }); + notify.children('div.elfinder-notify-cancel').append(button); + } + ndialog.trigger('resize'); + } else if (typeof opts.msg !== 'undefined') { + notify.children('span.elfinder-notify-msg').html(msg); + } + + cnt = delta + parseInt(notify.data('cnt')); + + if (cnt > 0) { + if (cancel && button.length) { + if ($.isFunction(cancel) || (typeof cancel === 'object' && cancel.promise)) { + notify._esc = function(e) { + if (e.type == 'keydown' && e.keyCode != $.ui.keyCode.ESCAPE) { + return; + } + e.preventDefault(); + e.stopPropagation(); + close(); + if (cancel.promise) { + cancel.reject(0); // 0 is canceling flag + } else { + cancel(e); + } + }; + button.on('click', function(e) { + notify._esc(e); + }); + $(document).on('keydown.' + this.namespace, notify._esc); + } + } + + !opts.hideCnt && notify.children('.elfinder-notify-cnt').text('('+cnt+')'); + if (delta > 0 && ndialog.is(':hidden') && !hiddens[type]) { + if (dialog.data('minimized')) { + dialog.data('minimized').show(); + } else { + ndialog.elfinderdialog('open', this).height('auto'); + } + } + notify.data('cnt', cnt); + + if ((progress != null) + && (total = notify.data('total')) >= 0 + && (prc = notify.data('progress')) >= 0) { + + total += size != null? size : delta; + prc += progress; + (size == null && delta < 0) && (prc += delta * 100); + notify.data({progress : prc, total : total}); + if (size != null) { + prc *= 100; + total = Math.max(1, total); + } + progress = Math.min(parseInt(prc/total), 100); + + notify.find('.elfinder-notify-progress') + .animate({ + width : (progress < 100 ? progress : 100)+'%' + }, 20, function() { + notify.data('cur', progress); + setProgressbar(); + }); + } + + } else { + close(); + } + + return this; + }, + + /** + * Open confirmation dialog + * + * @param Object options + * @example + * this.confirm({ + * cssClass : 'elfinder-confirm-mydialog', + * title : 'Remove files', + * text : 'Here is question text', + * accept : { // accept callback - required + * label : 'Continue', + * callback : function(applyToAll) { fm.log('Ok') } + * }, + * cancel : { // cancel callback - required + * label : 'Cancel', + * callback : function() { fm.log('Cancel')} + * }, + * reject : { // reject callback - optionally + * label : 'No', + * callback : function(applyToAll) { fm.log('No')} + * }, + * buttons : [ // additional buttons callback - optionally + * { + * label : 'Btn1', + * callback : function(applyToAll) { fm.log('Btn1')} + * } + * ], + * all : true // display checkbox "Apply to all" + * }) + * @return elFinder + */ + confirm : function(opts) { + var self = this, + complete = false, + options = { + cssClass : 'elfinder-dialog-confirm', + modal : true, + resizable : false, + title : this.i18n(opts.title || 'confirmReq'), + buttons : {}, + close : function() { + !complete && opts.cancel.callback(); + $(this).elfinderdialog('destroy'); + } + }, + apply = this.i18n('apllyAll'), + label, checkbox, btnNum; + + if (opts.cssClass) { + options.cssClass += ' ' + opts.cssClass; + } + options.buttons[this.i18n(opts.accept.label)] = function() { + opts.accept.callback(!!(checkbox && checkbox.prop('checked'))); + complete = true; + $(this).elfinderdialog('close'); + }; + options.buttons[this.i18n(opts.accept.label)]._cssClass = 'elfinder-confirm-accept'; + + if (opts.reject) { + options.buttons[this.i18n(opts.reject.label)] = function() { + opts.reject.callback(!!(checkbox && checkbox.prop('checked'))); + complete = true; + $(this).elfinderdialog('close'); + }; + options.buttons[this.i18n(opts.reject.label)]._cssClass = 'elfinder-confirm-reject'; + } + + if (opts.buttons && opts.buttons.length > 0) { + btnNum = 1; + $.each(opts.buttons, function(i, v){ + options.buttons[self.i18n(v.label)] = function() { + v.callback(!!(checkbox && checkbox.prop('checked'))); + complete = true; + $(this).elfinderdialog('close'); + }; + options.buttons[self.i18n(v.label)]._cssClass = 'elfinder-confirm-extbtn' + (btnNum++); + if (v.cssClass) { + options.buttons[self.i18n(v.label)]._cssClass += ' ' + v.cssClass; + } + }); + } + + options.buttons[this.i18n(opts.cancel.label)] = function() { + $(this).elfinderdialog('close'); + }; + options.buttons[this.i18n(opts.cancel.label)]._cssClass = 'elfinder-confirm-cancel'; + + if (opts.all) { + options.create = function() { + var base = $('
'); + checkbox = $(''); + $(this).next().find('.ui-dialog-buttonset') + .prepend(base.append($('').prepend(checkbox))); + }; + } + + if (opts.optionsCallback && $.isFunction(opts.optionsCallback)) { + opts.optionsCallback(options); + } + + return this.dialog('' + this.i18n(opts.text), options); + }, + + /** + * Create unique file name in required dir + * + * @param String file name + * @param String parent dir hash + * @param String glue + * @return String + */ + uniqueName : function(prefix, phash, glue) { + var i = 0, ext = '', p, name; + + prefix = this.i18n(false, prefix); + phash = phash || this.cwd().hash; + glue = (typeof glue === 'undefined')? ' ' : glue; + + if (p = prefix.match(/^(.+)(\.[^.]+)$/)) { + ext = p[2]; + prefix = p[1]; + } + + name = prefix+ext; + + if (!this.fileByName(name, phash)) { + return name; + } + while (i < 10000) { + name = prefix + glue + (++i) + ext; + if (!this.fileByName(name, phash)) { + return name; + } + } + return prefix + Math.random() + ext; + }, + + /** + * Return message translated onto current language + * Allowed accept HTML element that was wrapped in jQuery object + * To be careful to XSS vulnerability of HTML element Ex. You should use `fm.escape(file.name)` + * + * @param String|Array message[s]|Object jQuery + * @return String + **/ + i18n : function() { + var self = this, + messages = this.messages, + input = [], + ignore = [], + message = function(m) { + var file; + if (m.indexOf('#') === 0) { + if ((file = self.file(m.substr(1)))) { + return file.name; + } + } + return m; + }, + i, j, m, escFunc, start = 0, isErr; + + if (arguments.length && arguments[0] === false) { + escFunc = function(m){ return m; }; + start = 1; + } + for (i = start; i< arguments.length; i++) { + m = arguments[i]; + + if (Array.isArray(m)) { + for (j = 0; j < m.length; j++) { + if (m[j] instanceof jQuery) { + // jQuery object is HTML element + input.push(m[j]); + } else if (typeof m[j] !== 'undefined'){ + input.push(message('' + m[j])); + } + } + } else if (m instanceof jQuery) { + // jQuery object is HTML element + input.push(m[j]); + } else if (typeof m !== 'undefined'){ + input.push(message('' + m)); + } + } + + for (i = 0; i < input.length; i++) { + // dont translate placeholders + if ($.inArray(i, ignore) !== -1) { + continue; + } + m = input[i]; + if (typeof m == 'string') { + isErr = !!(messages[m] && m.match(/^err/)); + // translate message + m = messages[m] || (escFunc? escFunc(m) : self.escape(m)); + // replace placeholders in message + m = m.replace(/\$(\d+)/g, function(match, placeholder) { + var res; + placeholder = i + parseInt(placeholder); + if (placeholder > 0 && input[placeholder]) { + ignore.push(placeholder); + } + res = escFunc? escFunc(input[placeholder]) : self.escape(input[placeholder]); + if (isErr) { + res = '' + res + ''; + } + return res; + }); + } else { + // get HTML from jQuery object + m = m.get(0).outerHTML; + } + + input[i] = m; + } + + return $.grep(input, function(m, i) { return $.inArray(i, ignore) === -1 ? true : false; }).join('
'); + }, + + /** + * Get icon style from file.icon + * + * @param Object elFinder file object + * @return String|Object + */ + getIconStyle : function(file, asObject) { + var self = this, + template = { + 'background' : 'url(\'{url}\') 0 0 no-repeat', + 'background-size' : 'contain' + }, + style = '', + cssObj = {}, + i = 0; + if (file.icon) { + style = 'style="'; + $.each(template, function(k, v) { + if (i++ === 0) { + v = v.replace('{url}', self.escape(file.icon)); + } + if (asObject) { + cssObj[k] = v; + } else { + style += k+':'+v+';'; + } + }); + style += '"'; + } + return asObject? cssObj : style; + }, + + /** + * Convert mimetype into css classes + * + * @param String file mimetype + * @return String + */ + mime2class : function(mimeType) { + var prefix = 'elfinder-cwd-icon-', + mime = mimeType.toLowerCase(), + isText = this.textMimes[mime]; + + mime = mime.split('/'); + if (isText) { + mime[0] += ' ' + prefix + 'text'; + } else if (mime[1] && mime[1].match(/\+xml$/)) { + mime[0] += ' ' + prefix + 'xml'; + } + + return prefix + mime[0] + (mime[1] ? ' ' + prefix + mime[1].replace(/(\.|\+)/g, '-') : ''); + }, + + /** + * Return localized kind of file + * + * @param Object|String file or file mimetype + * @return String + */ + mime2kind : function(f) { + var isObj = typeof(f) == 'object' ? true : false, + mime = isObj ? f.mime : f, + kind; + + + if (isObj && f.alias && mime != 'symlink-broken') { + kind = 'Alias'; + } else if (this.kinds[mime]) { + if (isObj && mime === 'directory' && (! f.phash || f.isroot)) { + kind = 'Root'; + } else { + kind = this.kinds[mime]; + } + } else if (this.mimeTypes[mime]) { + kind = this.mimeTypes[mime].toUpperCase(); + if (!this.messages['kind'+kind]) { + kind = null; + } + } + if (! kind) { + if (mime.indexOf('text') === 0) { + kind = 'Text'; + } else if (mime.indexOf('image') === 0) { + kind = 'Image'; + } else if (mime.indexOf('audio') === 0) { + kind = 'Audio'; + } else if (mime.indexOf('video') === 0) { + kind = 'Video'; + } else if (mime.indexOf('application') === 0) { + kind = 'App'; + } else { + kind = mime; + } + } + + return this.messages['kind'+kind] ? this.i18n('kind'+kind) : mime; + }, + + /** + * Return boolean Is mime-type text file + * + * @param String mime-type + * @return Boolean + */ + mimeIsText : function(mime) { + return (this.textMimes[mime.toLowerCase()] || (mime.indexOf('text/') === 0 && mime.substr(5, 3) !== 'rtf') || mime.match(/^application\/.+\+xml$/))? true : false; + }, + + /** + * Returns a date string formatted according to the given format string + * + * @param String format string + * @param Object Date object + * @return String + */ + date : function(format, date) { + var self = this, + output, d, dw, m, y, h, g, i, s; + + if (! date) { + date = new Date(); + } + + h = date[self.getHours](); + g = h > 12 ? h - 12 : h; + i = date[self.getMinutes](); + s = date[self.getSeconds](); + d = date[self.getDate](); + dw = date[self.getDay](); + m = date[self.getMonth]() + 1; + y = date[self.getFullYear](); + + output = format.replace(/[a-z]/gi, function(val) { + switch (val) { + case 'd': return d > 9 ? d : '0'+d; + case 'j': return d; + case 'D': return self.i18n(self.i18.daysShort[dw]); + case 'l': return self.i18n(self.i18.days[dw]); + case 'm': return m > 9 ? m : '0'+m; + case 'n': return m; + case 'M': return self.i18n(self.i18.monthsShort[m-1]); + case 'F': return self.i18n(self.i18.months[m-1]); + case 'Y': return y; + case 'y': return (''+y).substr(2); + case 'H': return h > 9 ? h : '0'+h; + case 'G': return h; + case 'g': return g; + case 'h': return g > 9 ? g : '0'+g; + case 'a': return h >= 12 ? 'pm' : 'am'; + case 'A': return h >= 12 ? 'PM' : 'AM'; + case 'i': return i > 9 ? i : '0'+i; + case 's': return s > 9 ? s : '0'+s; + } + return val; + }); + + return output; + }, + + /** + * Return localized date + * + * @param Object file object + * @return String + */ + formatDate : function(file, t) { + var self = this, + ts = t || file.ts, + i18 = self.i18, + date, format, output, d, dw, m, y, h, g, i, s; + + if (self.options.clientFormatDate && ts > 0) { + + date = new Date(ts*1000); + format = ts >= this.yesterday + ? this.fancyFormat + : this.dateFormat; + + output = self.date(format, date); + + return ts >= this.yesterday + ? output.replace('$1', this.i18n(ts >= this.today ? 'Today' : 'Yesterday')) + : output; + } else if (file.date) { + return file.date.replace(/([a-z]+)\s/i, function(a1, a2) { return self.i18n(a2)+' '; }); + } + + return self.i18n('dateUnknown'); + }, + + /** + * Return localized number string + * + * @param Number + * @return String + */ + toLocaleString : function(num) { + var v = new Number(num); + if (v) { + if (v.toLocaleString) { + return v.toLocaleString(); + } else { + return String(num).replace( /(\d)(?=(\d\d\d)+(?!\d))/g, '$1,'); + } + } + return num; + }, + + /** + * Return css class marks file permissions + * + * @param Object file + * @return String + */ + perms2class : function(o) { + var c = ''; + + if (!o.read && !o.write) { + c = 'elfinder-na'; + } else if (!o.read) { + c = 'elfinder-wo'; + } else if (!o.write) { + c = 'elfinder-ro'; + } + + if (o.type) { + c += ' elfinder-' + this.escape(o.type); + } + + return c; + }, + + /** + * Return localized string with file permissions + * + * @param Object file + * @return String + */ + formatPermissions : function(f) { + var p = []; + + f.read && p.push(this.i18n('read')); + f.write && p.push(this.i18n('write')); + + return p.length ? p.join(' '+this.i18n('and')+' ') : this.i18n('noaccess'); + }, + + /** + * Return formated file size + * + * @param Number file size + * @return String + */ + formatSize : function(s) { + var n = 1, u = 'b'; + + if (s == 'unknown') { + return this.i18n('unknown'); + } + + if (s > 1073741824) { + n = 1073741824; + u = 'GB'; + } else if (s > 1048576) { + n = 1048576; + u = 'MB'; + } else if (s > 1024) { + n = 1024; + u = 'KB'; + } + s = s/n; + return (s > 0 ? n >= 1048576 ? s.toFixed(2) : Math.round(s) : 0) +' '+u; + }, + + /** + * Return formated file mode by options.fileModeStyle + * + * @param String file mode + * @param String format style + * @return String + */ + formatFileMode : function(p, style) { + var i, o, s, b, sticy, suid, sgid, str, oct; + + if (!style) { + style = this.options.fileModeStyle.toLowerCase(); + } + p = $.trim(p); + if (p.match(/[rwxs-]{9}$/i)) { + str = p = p.substr(-9); + if (style == 'string') { + return str; + } + oct = ''; + s = 0; + for (i=0; i<7; i=i+3) { + o = p.substr(i, 3); + b = 0; + if (o.match(/[r]/i)) { + b += 4; + } + if (o.match(/[w]/i)) { + b += 2; + } + if (o.match(/[xs]/i)) { + if (o.match(/[xs]/)) { + b += 1; + } + if (o.match(/[s]/i)) { + if (i == 0) { + s += 4; + } else if (i == 3) { + s += 2; + } + } + } + oct += b.toString(8); + } + if (s) { + oct = s.toString(8) + oct; + } + } else { + p = parseInt(p, 8); + oct = p? p.toString(8) : ''; + if (!p || style == 'octal') { + return oct; + } + o = p.toString(8); + s = 0; + if (o.length > 3) { + o = o.substr(-4); + s = parseInt(o.substr(0, 1), 8); + o = o.substr(1); + } + sticy = ((s & 1) == 1); // not support + sgid = ((s & 2) == 2); + suid = ((s & 4) == 4); + str = ''; + for(i=0; i<3; i++) { + if ((parseInt(o.substr(i, 1), 8) & 4) == 4) { + str += 'r'; + } else { + str += '-'; + } + if ((parseInt(o.substr(i, 1), 8) & 2) == 2) { + str += 'w'; + } else { + str += '-'; + } + if ((parseInt(o.substr(i, 1), 8) & 1) == 1) { + str += ((i==0 && suid)||(i==1 && sgid))? 's' : 'x'; + } else { + str += '-'; + } + } + } + if (style == 'both') { + return str + ' (' + oct + ')'; + } else if (style == 'string') { + return str; + } else { + return oct; + } + }, + + /** + * Regist this.decodeRawString function + * + * @return void + */ + registRawStringDecoder : function(rawStringDecoder) { + if ($.isFunction(rawStringDecoder)) { + this.decodeRawString = this.options.rawStringDecoder = rawStringDecoder; + } + }, + + /** + * Return boolean that uploadable MIME type into target folder + * + * @param String mime MIME type + * @param String target target folder hash + * @return Bool + */ + uploadMimeCheck : function(mime, target) { + target = target || this.cwd().hash; + var res = true, // default is allow + mimeChecker = this.option('uploadMime', target), + allow, + deny, + check = function(checker) { + var ret = false; + if (typeof checker === 'string' && checker.toLowerCase() === 'all') { + ret = true; + } else if (Array.isArray(checker) && checker.length) { + $.each(checker, function(i, v) { + v = v.toLowerCase(); + if (v === 'all' || mime.indexOf(v) === 0) { + ret = true; + return false; + } + }); + } + return ret; + }; + if (mime && $.isPlainObject(mimeChecker)) { + mime = mime.toLowerCase(); + allow = check(mimeChecker.allow); + deny = check(mimeChecker.deny); + if (mimeChecker.firstOrder === 'allow') { + res = false; // default is deny + if (! deny && allow === true) { // match only allow + res = true; + } + } else { + res = true; // default is allow + if (deny === true && ! allow) { // match only deny + res = false; + } + } + } + return res; + }, + + /** + * call chained sequence of async deferred functions + * + * @param Array tasks async functions + * @return Object jQuery.Deferred + */ + sequence : function(tasks) { + var l = tasks.length, + chain = function(task, idx) { + ++idx; + if (tasks[idx]) { + return chain(task.then(tasks[idx]), idx); + } else { + return task; + } + }; + if (l > 1) { + return chain(tasks[0](), 0); + } else { + return tasks[0](); + } + }, + + /** + * Reload contents of target URL for clear browser cache + * + * @param String url target URL + * @return Object jQuery.Deferred + */ + reloadContents : function(url) { + var dfd = $.Deferred(), + ifm; + try { + ifm = $(''; + } + } + } + link.remove(); + $(iframes) + .appendTo('body') + .ready(function() { + setTimeout(function() { + $(iframes).each(function() { + $('#' + $(this).attr('id')).remove(); + }); + }, 20000 + (10000 * i)); // give 20 sec + 10 sec for each file to be saved + }); + fm.trigger('download', {files : files}); + dfrd.resolve(); + }); + fileCnt = files.length; + urls = []; + for (i = 0; i < files.length; i++) { + fm.openUrl(files[i].hash, true, function(v) { + v && urls.push(v); + if (--fileCnt < 1) { + getUrlDfrd.resolve(urls); + } + }); + } + return dfrd; + } + }; + +}; + + +/* + * File: /js/commands/duplicate.js + */ + +/** + * @class elFinder command "duplicate" + * Create file/folder copy with suffix "copy Number" + * + * @type elFinder.command + * @author Dmitry (dio) Levashov + */ +elFinder.prototype.commands.duplicate = function() { + var fm = this.fm; + + this.getstate = function(select) { + var sel = this.files(select), + cnt = sel.length, + filter = function(files) { + var fres = true; + return $.grep(files, function(f) { + fres = fres && f.read && f.phash === fm.cwd().hash && ! fm.isRoot(f)? true : false; + return fres; + }); + }; + + return cnt && fm.cwd().write && filter(sel).length == cnt ? 0 : -1; + }; + + this.exec = function(hashes) { + var fm = this.fm, + files = this.files(hashes), + cnt = files.length, + dfrd = $.Deferred() + .fail(function(error) { + error && fm.error(error); + }), + args = []; + + if (! cnt) { + return dfrd.reject(); + } + + $.each(files, function(i, file) { + if (!file.read || !fm.file(file.phash).write) { + return !dfrd.reject(['errCopy', file.name, 'errPerm']); + } + }); + + if (dfrd.state() == 'rejected') { + return dfrd; + } + + return fm.request({ + data : {cmd : 'duplicate', targets : this.hashes(hashes)}, + notify : {type : 'copy', cnt : cnt}, + navigate : { + toast : { + inbuffer : {msg: fm.i18n(['complete', fm.i18n('cmdduplicate')])} + } + } + }); + + }; + +}; + + +/* + * File: /js/commands/edit.js + */ + +/** + * @class elFinder command "edit". + * Edit text file in dialog window + * + * @author Dmitry (dio) Levashov, dio@std42.ru + **/ +elFinder.prototype.commands.edit = function() { + var self = this, + fm = this.fm, + clsEditing = fm.res('class', 'editing'), + mimesSingle = [], + mimes = [], + allowAll = false, + rtrim = function(str){ + return str.replace(/\s+$/, ''); + }, + getEncSelect = function(heads) { + var sel = $(''), + hval; + if (heads) { + $.each(heads, function(i, head) { + hval = fm.escape(head.value); + sel.append(''); + }); + } + $.each(self.options.encodings, function(i, v) { + sel.append(''); + }); + return sel; + }, + getDlgWidth = function() { + var win = fm.options.dialogContained? fm.getUI() : $(window), + m, width; + if (typeof self.options.dialogWidth === 'string' && (m = self.options.dialogWidth.match(/(\d+)%/))) { + width = parseInt(win.width() * (m[1] / 100)); + } else { + width = parseInt(self.options.dialogWidth || 650); + } + return Math.min(width, win.width()); + }, + getDlgHeight = function() { + if (!self.options.dialogHeight) { + return void(0); + } + var win = fm.options.dialogContained? fm.getUI() : $(window), + m, height; + if (typeof self.options.dialogHeight === 'string' && (m = self.options.dialogHeight.match(/(\d+)%/))) { + height = parseInt(win.height() * (m[1] / 100)); + } else { + height = parseInt(self.options.dialogHeight || win.height()); + } + return Math.min(height, win.height()); + }, + + /** + * Return files acceptable to edit + * + * @param Array files hashes + * @return Array + **/ + filter = function(files) { + var cnt = files.length, + mime, ext, skip; + + if (cnt > 1) { + mime = files[0].mime; + ext = files[0].name.replace(/^.*(\.[^.]+)$/, '$1'); + } + return $.grep(files, function(file) { + var res; + if (skip || file.mime === 'directory') { + return false; + } + res = file.read + && (allowAll || fm.mimeIsText(file.mime) || $.inArray(file.mime, cnt === 1? mimesSingle : mimes) !== -1) + && (!self.onlyMimes.length || $.inArray(file.mime, self.onlyMimes) !== -1) + && (cnt === 1 || (file.mime === mime && file.name.substr(ext.length * -1) === ext)) + && (fm.uploadMimeCheck(file.mime, file.phash)? true : false) + && setEditors(file, cnt) + && Object.keys(editors).length; + if (!res) { + skip = true; + } + return res; + }); + }, + + fileSync = function(hash) { + var old = fm.file(hash), + f; + fm.request({ + cmd: 'info', + targets: [hash], + preventDefault: true + }).done(function(data) { + var changed; + if (data && data.files && data.files.length) { + f = data.files[0]; + if (old.ts != f.ts || old.size != f.size) { + changed = { changed: [ f ] }; + fm.updateCache(changed); + fm.change(changed); + } + } + }); + }, + + /** + * Open dialog with textarea to edit file + * + * @param String id dialog id + * @param Object file file object + * @param String content file content + * @return $.Deferred + **/ + dialog = function(id, file, content, encoding, editor, toasts) { + + var dfrd = $.Deferred(), + _loaded = false, + loaded = function() { + if (!_loaded) { + fm.toast({ + mode: 'warning', + msg: fm.i18n('nowLoading') + }); + return false; + } + return true; + }, + makeToasts = function() { + // make toast message + if (toasts && Array.isArray(toasts)) { + $.each(toasts, function() { + this.msg && fm.toast(this); + }); + } + }, + save = function() { + var encord = selEncoding? selEncoding.val():void(0), + saveDfd = $.Deferred().fail(function(err) { + dialogNode.show().find('button.elfinder-btncnt-0,button.elfinder-btncnt-1').hide(); + }), + conf, res, tm; + if (!loaded()) { + return saveDfd.resolve(); + } + if (ta.editor) { + ta.editor.save(ta[0], ta.editor.instance); + conf = ta.editor.confObj; + if (conf.info && (conf.info.schemeContent || conf.info.arrayBufferContent)) { + encord = 'scheme'; + } + } + res = getContent(); + setOld(res); + if (res.promise) { + tm = setTimeout(function() { + fm.notify({ + type : 'chkcontent', + cnt : 1, + hideCnt: true, + cancel : function() { + res.reject(); + } + }); + }, 100); + res.always(function() { + tm && clearTimeout(tm); + fm.notify({ type : 'chkcontent', cnt: -1 }); + }).done(function(data) { + dfrd.notifyWith(ta, [encord, ta.data('hash'), old, saveDfd]); + }).fail(function(err) { + saveDfd.reject(err); + }); + } else { + dfrd.notifyWith(ta, [encord, ta.data('hash'), old, saveDfd]); + } + return saveDfd; + }, + saveon = function() { + if (!loaded()) { return; } + save().fail(function(err) { + err && fm.error(err); + }); + }, + cancel = function() { + ta.elfinderdialog('close'); + }, + savecl = function() { + if (!loaded()) { return; } + dialogNode.hide(); + save().done(function() { + _loaded = false; + dialogNode.show(); + cancel(); + }).fail(function(err) { + dialogNode.show(); + err && fm.error(err); + }); + }, + saveAs = function() { + if (!loaded()) { return; } + var prevOld = old, + phash = file.phash, + fail = function(err) { + dialogs.addClass(clsEditing).fadeIn(function() { + err && fm.error(err); + }); + old = prevOld; + fm.disable(); + }, + make = function() { + self.mime = saveAsFile.mime || file.mime; + self.prefix = (saveAsFile.name || file.name).replace(/ \d+(\.[^.]+)?$/, '$1'); + self.requestCmd = 'mkfile'; + self.nextAction = {}; + self.data = {target : phash}; + $.proxy(fm.res('mixin', 'make'), self)() + .done(function(data) { + var oldHash; + if (data.added && data.added.length) { + oldHash = ta.data('hash'); + ta.data('hash', data.added[0].hash); + save().done(function() { + _loaded = false; + dialogNode.show(); + cancel(); + dialogs.fadeIn(); + }).fail(function() { + fm.exec('rm', [data.added[0].hash], { forceRm: true, quiet: true }); + ta.data('hash', oldHash); + dialogNode.find('button.elfinder-btncnt-2').hide(); + fail(); + }); + } else { + fail(); + } + }) + .progress(function(err) { + if (err && err === 'errUploadMime') { + ta.trigger('saveAsFail'); + } + }) + .fail(fail) + .always(function() { + delete self.mime; + delete self.prefix; + delete self.nextAction; + delete self.data; + }); + fm.trigger('unselectfiles', { files: [ file.hash ] }); + }, + reqOpen = null, + reqInfo = null, + dialogs = fm.getUI().children('.' + self.dialogClass + ':visible'); + if (dialogNode.is(':hidden')) { + dialogs = dialogs.add(dialogNode); + } + dialogs.removeClass(clsEditing).fadeOut(); + + fm.enable(); + + if (fm.searchStatus.state < 2 && phash !== fm.cwd().hash) { + reqOpen = fm.exec('open', [phash], {thash: phash}); + } else if (!fm.file(phash)) { + reqInfo = fm.request({cmd: 'info', targets: [phash]}); + } + + $.when([reqOpen, reqInfo]).done(function() { + if (reqInfo) { + fm.one('infodone', function() { + fm.file(phash)? make() : fail('errFolderNotFound'); + }); + } else { + reqOpen? fm.one('cwdrender', make) : make(); + } + }).fail(fail); + }, + changed = function() { + var dfd = $.Deferred(), + res, tm; + if (!_loaded) { + return dfd.resolve(false); + } + ta.editor && ta.editor.save(ta[0], ta.editor.instance); + res = getContent(); + if (res && res.promise) { + tm = setTimeout(function() { + fm.notify({ + type : 'chkcontent', + cnt : 1, + hideCnt: true, + cancel : function() { + res.reject(); + } + }); + }, 100); + res.always(function() { + tm && clearTimeout(tm); + fm.notify({ type : 'chkcontent', cnt: -1 }); + }).done(function(d) { + dfd.resolve(old !== d); + }).fail(function(err) { + dfd.resolve(err || (old === undefined? false : true)); + }); + } else { + dfd.resolve(old !== res); + } + return dfd; + }, + opts = { + title : fm.escape(file.name), + width : getDlgWidth(), + height : getDlgHeight(), + buttons : {}, + cssClass : clsEditing, + maxWidth : 'window', + maxHeight : 'window', + allowMinimize : true, + allowMaximize : true, + openMaximized : editorMaximized() || (editor && editor.info && editor.info.openMaximized), + btnHoverFocus : false, + closeOnEscape : false, + propagationEvents : ['mousemove', 'mouseup', 'click'], + minimize : function() { + var conf; + if (ta.editor && dialogNode.closest('.ui-dialog').is(':hidden')) { + conf = ta.editor.confObj; + if (conf.info && conf.info.syncInterval) { + fileSync(file.hash); + } + } + }, + close : function() { + var close = function() { + var conf; + dfrd.resolve(); + if (ta.editor) { + ta.editor.close(ta[0], ta.editor.instance); + conf = ta.editor.confObj; + if (conf.info && conf.info.syncInterval) { + fileSync(file.hash); + } + } + ta.elfinderdialog('destroy'); + }, + onlySaveAs = (typeof saveAsFile.name !== 'undefined'), + accept = onlySaveAs? { + label : 'btnSaveAs', + callback : function() { + requestAnimationFrame(saveAs); + } + } : { + label : 'btnSaveClose', + callback : function() { + save().done(function() { + close(); + }); + } + }; + changed().done(function(change) { + var msgs = ['confirmNotSave']; + if (change) { + if (typeof change === 'string') { + msgs.unshift(change); + } + fm.confirm({ + title : self.title, + text : msgs, + accept : accept, + cancel : { + label : 'btnClose', + callback : close + }, + buttons : onlySaveAs? null : [{ + label : 'btnSaveAs', + callback : function() { + requestAnimationFrame(saveAs); + } + }] + }); + } else { + close(); + } + }); + }, + open : function() { + var loadRes, conf, interval; + ta.initEditArea.call(ta, id, file, content, fm); + if (ta.editor) { + loadRes = ta.editor.load(ta[0]) || null; + if (loadRes && loadRes.done) { + loadRes.always(function() { + _loaded = true; + }).done(function(instance) { + ta.editor.instance = instance; + ta.editor.focus(ta[0], ta.editor.instance); + setOld(getContent()); + requestAnimationFrame(function() { + dialogNode.trigger('resize'); + }); + }).fail(function(error) { + error && fm.error(error); + ta.elfinderdialog('destroy'); + return; + }).always(makeToasts); + } else { + _loaded = true; + if (loadRes && (typeof loadRes === 'string' || Array.isArray(loadRes))) { + fm.error(loadRes); + ta.elfinderdialog('destroy'); + return; + } + ta.editor.instance = loadRes; + ta.editor.focus(ta[0], ta.editor.instance); + setOld(getContent()); + requestAnimationFrame(function() { + dialogNode.trigger('resize'); + }); + makeToasts(); + } + conf = ta.editor.confObj; + if (conf.info && conf.info.syncInterval) { + if (interval = parseInt(conf.info.syncInterval)) { + setTimeout(function() { + autoSync(interval); + }, interval); + } + } + } else { + _loaded = true; + setOld(getContent()); + } + }, + resize : function(e, data) { + ta.editor && ta.editor.resize(ta[0], ta.editor.instance, e, data || {}); + } + }, + getContent = function() { + var res = ta.getContent.call(ta, ta[0]); + if (res === undefined || res === false || res === null) { + res = $.Deferred().reject(); + } + return res; + }, + setOld = function(res) { + if (res && res.promise) { + res.done(function(d) { + old = d; + }); + } else { + old = res; + } + }, + autoSync = function(interval) { + if (dialogNode.is(':visible')) { + fileSync(file.hash); + setTimeout(function() { + autoSync(interval); + }, interval); + } + }, + stateChange = function() { + if (selEncoding) { + changed().done(function(change) { + if (change) { + selEncoding.attr('title', fm.i18n('saveAsEncoding')).addClass('elfinder-edit-changed'); + } else { + selEncoding.attr('title', fm.i18n('openAsEncoding')).removeClass('elfinder-edit-changed'); + } + }); + } + }, + saveAsFile = {}, + ta, old, dialogNode, selEncoding, extEditor, maxW, syncInterval; + + if (editor) { + if (editor.html) { + ta = $(editor.html); + } + extEditor = { + init : editor.init || null, + load : editor.load, + getContent : editor.getContent || null, + save : editor.save, + beforeclose : typeof editor.beforeclose == 'function' ? editor.beforeclose : void 0, + close : typeof editor.close == 'function' ? editor.close : function() {}, + focus : typeof editor.focus == 'function' ? editor.focus : function() {}, + resize : typeof editor.resize == 'function' ? editor.resize : function() {}, + instance : null, + doSave : saveon, + doCancel : cancel, + doClose : savecl, + file : file, + fm : fm, + confObj : editor, + trigger : function(evName, data) { + fm.trigger('editEditor' + evName, Object.assign({}, editor.info || {}, data)); + } + }; + } + + if (!ta) { + if (!fm.mimeIsText(file.mime)) { + return dfrd.reject('errEditorNotFound'); + } + (function() { + ta = $('') + .on('input propertychange', stateChange); + + if (!editor || !editor.info || editor.info.useTextAreaEvent) { + ta.on('keydown', function(e) { + var code = e.keyCode, + value, start; + + e.stopPropagation(); + if (code == $.ui.keyCode.TAB) { + e.preventDefault(); + // insert tab on tab press + if (this.setSelectionRange) { + value = this.value; + start = this.selectionStart; + this.value = value.substr(0, start) + "\t" + value.substr(this.selectionEnd); + start += 1; + this.setSelectionRange(start, start); + } + } + + if (e.ctrlKey || e.metaKey) { + // close on ctrl+w/q + if (code == 'Q'.charCodeAt(0) || code == 'W'.charCodeAt(0)) { + e.preventDefault(); + cancel(); + } + if (code == 'S'.charCodeAt(0)) { + e.preventDefault(); + saveon(); + } + } + + }) + .on('mouseenter', function(){this.focus();}); + } + + ta.initEditArea = function(id, file, content) { + // ta.hide() for performance tune. Need ta.show() in `load()` if use textarea node. + ta.hide().val(content); + this._setupSelEncoding(content); + }; + })(); + } + + // extended function to setup selector of encoding for text editor + ta._setupSelEncoding = function(content) { + var heads = (encoding && encoding !== 'unknown')? [{value: encoding}] : [], + wfake = $('').hide(), + setSelW = function(init) { + init && wfake.appendTo(selEncoding.parent()); + wfake.empty().append($('').text(selEncoding.val())); + selEncoding.width(wfake.width()); + }; + if (content === '' || ! encoding || encoding !== 'UTF-8') { + heads.push({value: 'UTF-8'}); + } + selEncoding = getEncSelect(heads).on('touchstart', function(e) { + // for touch punch event handler + e.stopPropagation(); + }).on('change', function() { + // reload to change encoding if not edited + changed().done(function(change) { + if (! change && getContent() !== '') { + cancel(); + edit(file, selEncoding.val(), editor).fail(function(err) { err && fm.error(err); }); + } + }); + setSelW(); + }).on('mouseover', stateChange); + ta.parent().next().prepend($('
').append(selEncoding)); + setSelW(true); + }; + + ta.data('hash', file.hash); + + if (extEditor) { + ta.editor = extEditor; + + if (typeof extEditor.beforeclose === 'function') { + opts.beforeclose = function() { + return extEditor.beforeclose(ta[0], extEditor.instance); + }; + } + + if (typeof extEditor.init === 'function') { + ta.initEditArea = extEditor.init; + } + + if (typeof extEditor.getContent === 'function') { + ta.getContent = extEditor.getContent; + } + } + + if (! ta.initEditArea) { + ta.initEditArea = function() {}; + } + + if (! ta.getContent) { + ta.getContent = function() { + return rtrim(ta.val()); + }; + } + + if (!editor || !editor.info || !editor.info.preventGet) { + opts.buttons[fm.i18n('btnSave')] = saveon; + opts.buttons[fm.i18n('btnSaveClose')] = savecl; + opts.buttons[fm.i18n('btnSaveAs')] = saveAs; + opts.buttons[fm.i18n('btnCancel')] = cancel; + } + + if (editor && typeof editor.prepare === 'function') { + editor.prepare(ta, opts, file); + } + + dialogNode = self.fmDialog(ta, opts) + .attr('id', id) + .on('keydown keyup keypress', function(e) { + e.stopPropagation(); + }) + .css({ overflow: 'hidden', minHeight: '7em' }) + .addClass('elfinder-edit-editor') + .closest('.ui-dialog') + .on('changeType', function(e, data) { + if (data.extention && data.mime) { + var ext = data.extention, + mime = data.mime, + btnSet = $(this).children('.ui-dialog-buttonpane').children('.ui-dialog-buttonset'); + btnSet.children('.elfinder-btncnt-0,.elfinder-btncnt-1').hide(); + saveAsFile.name = fm.splitFileExtention(file.name)[0] + '.' + data.extention; + saveAsFile.mime = data.mime; + if (!data.keepEditor) { + btnSet.children('.elfinder-btncnt-2').trigger('click'); + } + } + }); + + // care to viewport scale change with mobile devices + maxW = (fm.options.dialogContained? fm.getUI() : $(window)).width(); + (dialogNode.width() > maxW) && dialogNode.width(maxW); + + return dfrd.promise(); + }, + + /** + * Get file content and + * open dialog with textarea to edit file content + * + * @param String file hash + * @return jQuery.Deferred + **/ + edit = function(file, convert, editor) { + var hash = file.hash, + opts = fm.options, + dfrd = $.Deferred(), + id = 'edit-'+fm.namespace+'-'+file.hash, + d = fm.getUI().find('#'+id), + conv = !convert? 0 : convert, + noContent = false, + req, error, res; + + + if (d.length) { + d.elfinderdialog('toTop'); + return dfrd.resolve(); + } + + if (!file.read || (!file.write && (!editor.info || !editor.info.converter))) { + error = ['errOpen', file.name, 'errPerm']; + return dfrd.reject(error); + } + + if (editor && editor.info) { + if (typeof editor.info.edit === 'function') { + res = editor.info.edit.call(fm, file, editor); + if (res.promise) { + res.done(function() { + dfrd.resolve(); + }).fail(function(error) { + dfrd.reject(error); + }); + } else { + res? dfrd.resolve() : dfrd.reject(); + } + return dfrd; + } + + noContent = editor.info.preventGet || editor.info.noContent; + if (editor.info.urlAsContent || noContent) { + req = $.Deferred(); + if (editor.info.urlAsContent) { + fm.url(hash, { async: true, onetime: true, temporary: true }).done(function(url) { + req.resolve({content: url}); + }); + } else { + req.resolve({}); + } + } else { + if (conv) { + file.encoding = conv; + fm.cache(file, 'change'); + } + req = fm.request({ + data : {cmd : 'get', target : hash, conv : conv, _t : file.ts}, + options : {type: 'get', cache : true}, + notify : {type : 'file', cnt : 1}, + preventDefault : true + }); + } + + req.done(function(data) { + var selEncoding, reg, m, res; + if (data.doconv) { + fm.confirm({ + title : self.title, + text : data.doconv === 'unknown'? 'confirmNonUTF8' : 'confirmConvUTF8', + accept : { + label : 'btnConv', + callback : function() { + dfrd = edit(file, selEncoding.val(), editor); + } + }, + cancel : { + label : 'btnCancel', + callback : function() { dfrd.reject(); } + }, + optionsCallback : function(options) { + options.create = function() { + var base = $('
'), + head = {value: data.doconv}, + detected; + + if (data.doconv === 'unknown') { + head.caption = '-'; + } + selEncoding = getEncSelect([head]); + $(this).next().find('.ui-dialog-buttonset') + .prepend(base.append($('').append(selEncoding))); + }; + } + }); + } else { + if (!noContent && fm.mimeIsText(file.mime)) { + reg = new RegExp('^(data:'+file.mime.replace(/([.+])/g, '\\$1')+';base64,)', 'i'); + if (!editor.info.dataScheme) { + if (window.atob && (m = data.content.match(reg))) { + data.content = atob(data.content.substr(m[1].length)); + } + } else { + if (window.btoa && !data.content.match(reg)) { + data.content = 'data:'+file.mime+';base64,'+btoa(data.content); + } + } + } + dialog(id, file, data.content, data.encoding, editor, data.toasts) + .done(function(data) { + dfrd.resolve(data); + }) + .progress(function(encoding, newHash, data, saveDfd) { + var ta = this; + if (newHash) { + hash = newHash; + } + fm.request({ + options : {type : 'post'}, + data : { + cmd : 'put', + target : hash, + encoding : encoding || data.encoding, + content : data + }, + notify : {type : 'save', cnt : 1}, + syncOnFail : true, + preventFail : true, + navigate : { + target : 'changed', + toast : { + inbuffer : {msg: fm.i18n(['complete', fm.i18n('btnSave')])} + } + } + }) + .fail(function(error) { + dfrd.reject(error); + saveDfd.reject(); + }) + .done(function(data) { + requestAnimationFrame(function(){ + ta.trigger('focus'); + ta.editor && ta.editor.focus(ta[0], ta.editor.instance); + }); + saveDfd.resolve(); + }); + }) + .fail(function(error) { + dfrd.reject(error); + }); + } + }) + .fail(function(error) { + var err = fm.parseError(error); + err = Array.isArray(err)? err[0] : err; + if (file.encoding) { + file.encoding = ''; + fm.cache(file, 'change'); + } + (err !== 'errConvUTF8') && fm.sync(); + dfrd.reject(error); + }); + } + + return dfrd.promise(); + }, + + /** + * Current editors of selected files + * + * @type Object + */ + editors = {}, + + /** + * Fallback editor (Simple text editor) + * + * @type Object + */ + fallbackEditor = { + // Simple Text (basic textarea editor) + info : { + id : 'textarea', + name : 'TextArea', + useTextAreaEvent : true + }, + load : function(textarea) { + // trigger event 'editEditorPrepare' + this.trigger('Prepare', { + node: textarea, + editorObj: void(0), + instance: void(0), + opts: {} + }); + textarea.setSelectionRange && textarea.setSelectionRange(0, 0); + $(textarea).trigger('focus').show(); + }, + save : function(){} + }, + + /** + * Set current editors + * + * @param Object file object + * @param Number cnt count of selected items + * @return Void + */ + setEditors = function(file, cnt) { + var mimeMatch = function(fileMime, editorMimes){ + if (!editorMimes) { + return fm.mimeIsText(fileMime); + } else { + if (editorMimes[0] === '*' || $.inArray(fileMime, editorMimes) !== -1) { + return true; + } + var i, l; + l = editorMimes.length; + for (i = 0; i < l; i++) { + if (fileMime.indexOf(editorMimes[i]) === 0) { + return true; + } + } + return false; + } + }, + extMatch = function(fileName, editorExts){ + if (!editorExts || !editorExts.length) { + return true; + } + var ext = fileName.replace(/^.+\.([^.]+)|(.+)$/, '$1$2').toLowerCase(), + i, l; + l = editorExts.length; + for (i = 0; i < l; i++) { + if (ext === editorExts[i].toLowerCase()) { + return true; + } + } + return false; + }, + optEditors = self.options.editors || [], + cwdWrite = fm.cwd().write; + + stored = fm.storage('storedEditors') || {}; + editors = {}; + if (!optEditors.length) { + optEditors = [fallbackEditor]; + } + $.each(optEditors, function(i, editor) { + var name; + if ((cnt === 1 || !editor.info.single) + && ((!editor.info || !editor.info.converter)? file.write : cwdWrite) + && (file.size > 0 || (!editor.info.converter && editor.info.canMakeEmpty !== false && fm.mimesCanMakeEmpty[file.mime])) + && (!editor.info.maxSize || file.size <= editor.info.maxSize) + && mimeMatch(file.mime, editor.mimes || null) + && extMatch(file.name, editor.exts || null) + && typeof editor.load == 'function' + && typeof editor.save == 'function') { + + name = editor.info.name? editor.info.name : ('Editor ' + i); + editor.id = editor.info.id? editor.info.id : ('editor' + i), + editor.name = name; + editor.i18n = fm.i18n(name); + editors[editor.id] = editor; + } + }); + return Object.keys(editors).length? true : false; + }, + store = function(mime, editor) { + if (mime && editor) { + if (!$.isPlainObject(stored)) { + stored = {}; + } + stored[mime] = editor.id; + fm.storage('storedEditors', stored); + fm.trigger('selectfiles', {files : fm.selected()}); + } + }, + useStoredEditor = function() { + var d = fm.storage('useStoredEditor'); + return d? (d > 0) : self.options.useStoredEditor; + }, + editorMaximized = function() { + var d = fm.storage('editorMaximized'); + return d? (d > 0) : self.options.editorMaximized; + }, + getSubMenuRaw = function(files, callback) { + var subMenuRaw = []; + $.each(editors, function(id, ed) { + subMenuRaw.push( + { + label : fm.escape(ed.i18n), + icon : ed.info && ed.info.icon? ed.info.icon : 'edit', + options : { iconImg: ed.info && ed.info.iconImg? fm.baseUrl + ed.info.iconImg : void(0) }, + callback : function() { + store(files[0].mime, ed); + callback && callback.call(ed); + } + } + ); + }); + return subMenuRaw; + }, + getStoreId = function(name) { + // for compatibility to previous version + return name.toLowerCase().replace(/ +/g, ''); + }, + getStoredEditor = function(mime) { + var name = stored[mime]; + return name && Object.keys(editors).length? editors[getStoreId(name)] : void(0); + }, + infoRequest = function() { + + }, + stored; + + // make public method + this.getEncSelect = getEncSelect; + + this.shortcuts = [{ + pattern : 'ctrl+e' + }]; + + this.init = function() { + var self = this, + fm = this.fm, + opts = this.options, + cmdChecks = [], + ccData, dfd; + + this.onlyMimes = this.options.mimes || []; + + fm.one('open', function() { + // editors setup + if (opts.editors && Array.isArray(opts.editors)) { + fm.trigger('canMakeEmptyFile', {mimes: Object.keys(fm.storage('mkfileTextMimes') || {}).concat(opts.makeTextMimes || ['text/plain'])}); + $.each(opts.editors, function(i, editor) { + if (editor.info && editor.info.cmdCheck) { + cmdChecks.push(editor.info.cmdCheck); + } + }); + if (cmdChecks.length) { + if (fm.api >= 2.1030) { + dfd = fm.request({ + data : { + cmd: 'editor', + name: cmdChecks, + method: 'enabled' + }, + preventDefault : true + }).done(function(d) { + ccData = d; + }).fail(function() { + ccData = {}; + }); + } else { + ccData = {}; + dfd = $.Deferred().resolve(); + } + } else { + dfd = $.Deferred().resolve(); + } + + dfd.always(function() { + if (ccData) { + opts.editors = $.grep(opts.editors, function(e) { + if (e.info && e.info.cmdCheck) { + return ccData[e.info.cmdCheck]? true : false; + } else { + return true; + } + }); + } + $.each(opts.editors, function(i, editor) { + if (editor.setup && typeof editor.setup === 'function') { + editor.setup.call(editor, opts, fm); + } + if (!editor.disabled) { + if (editor.mimes && Array.isArray(editor.mimes)) { + mimesSingle = mimesSingle.concat(editor.mimes); + if (!editor.info || !editor.info.single) { + mimes = mimes.concat(editor.mimes); + } + } + if (!allowAll && editor.mimes && editor.mimes[0] === '*') { + allowAll = true; + } + if (!editor.info) { + editor.info = {}; + } + if (editor.info.integrate) { + fm.trigger('helpIntegration', Object.assign({cmd: 'edit'}, editor.info.integrate)); + } + if (editor.info.canMakeEmpty) { + fm.trigger('canMakeEmptyFile', {mimes: Array.isArray(editor.info.canMakeEmpty)? editor.info.canMakeEmpty : editor.mimes}); + } + } + }); + + mimesSingle = ($.uniqueSort || $.unique)(mimesSingle); + mimes = ($.uniqueSort || $.unique)(mimes); + + opts.editors = $.grep(opts.editors, function(e) { + return e.disabled? false : true; + }); + }); + } + }) + .bind('select', function() { + editors = null; + }) + .bind('contextmenucreate', function(e) { + var file, editor, + single = function(editor) { + var title = self.title; + fm.one('contextmenucreatedone', function() { + self.title = title; + }); + self.title = fm.escape(editor.i18n); + if (editor.info && editor.info.iconImg) { + self.contextmenuOpts = { + iconImg: fm.baseUrl + editor.info.iconImg + }; + } + delete self.variants; + }; + + self.contextmenuOpts = void(0); + if (e.data.type === 'files' && self.enabled()) { + file = fm.file(e.data.targets[0]); + if (setEditors(file, e.data.targets.length)) { + if (Object.keys(editors).length > 1) { + if (!useStoredEditor() || !(editor = getStoredEditor(file.mime))) { + delete self.extra; + self.variants = []; + $.each(editors, function(id, editor) { + self.variants.push([{ editor: editor }, editor.i18n, editor.info && editor.info.iconImg? fm.baseUrl + editor.info.iconImg : 'edit']); + }); + } else { + single(editor); + self.extra = { + icon: 'menu', + node: $('') + .attr({title: fm.i18n('select')}) + .on('click touchstart', function(e){ + if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) { + return; + } + var node = $(this); + e.stopPropagation(); + e.preventDefault(); + fm.trigger('contextmenu', { + raw: getSubMenuRaw(fm.selectedFiles(), function() { + var hashes = fm.selected(); + fm.exec('edit', hashes, {editor: this}); + fm.trigger('selectfiles', {files : hashes}); + }), + x: node.offset().left, + y: node.offset().top + }); + }) + }; + } + } else { + single(editors[Object.keys(editors)[0]]); + delete self.extra; + } + } + } + }) + .bind('canMakeEmptyFile', function(e) { + if (e.data && e.data.resetTexts) { + var defs = fm.arrayFlip(self.options.makeTextMimes || ['text/plain']), + hides = self.getMkfileHides(); + + $.each((fm.storage('mkfileTextMimes') || {}), function(mime, type) { + if (!defs[mime]) { + delete fm.mimesCanMakeEmpty[mime]; + delete hides[mime]; + } + }); + fm.storage('mkfileTextMimes', null); + if (Object.keys(hides).length) { + fm.storage('mkfileHides', hides); + } else { + fm.storage('mkfileHides', null); + } + } + }); + }; + + this.getstate = function(select) { + var sel = this.files(select), + cnt = sel.length; + + return cnt && filter(sel).length == cnt ? 0 : -1; + }; + + this.exec = function(select, opts) { + var fm = this.fm, + files = filter(this.files(select)), + hashes = $.map(files, function(f) { return f.hash; }), + list = [], + editor = opts && opts.editor? opts.editor : null, + node = $(opts && opts._currentNode? opts._currentNode : fm.cwdHash2Elm(hashes[0])), + getEditor = function() { + var dfd = $.Deferred(), + storedId; + + if (!editor && Object.keys(editors).length > 1) { + if (useStoredEditor() && (editor = getStoredEditor(files[0].mime))) { + return dfd.resolve(editor); + } + fm.trigger('contextmenu', { + raw: getSubMenuRaw(files, function() { + dfd.resolve(this); + }), + x: node.offset().left, + y: node.offset().top + 22, + opened: function() { + fm.one('closecontextmenu',function() { + requestAnimationFrame(function() { + if (dfd.state() === 'pending') { + dfd.reject(); + } + }); + }); + } + }); + + fm.trigger('selectfiles', {files : hashes}); + + return dfd; + } else { + Object.keys(editors).length > 1 && editor && store(files[0].mime, editor); + return dfd.resolve(editor? editor : (Object.keys(editors).length? editors[Object.keys(editors)[0]] : null)); + } + }, + dfrd = $.Deferred(), + file; + + if (editors === null) { + setEditors(files[0], hashes.length); + } + + if (!node.length) { + node = fm.getUI('cwd'); + } + + getEditor().done(function(editor) { + while ((file = files.shift())) { + list.push(edit(file, (file.encoding || void(0)), editor).fail(function(error) { + error && fm.error(error); + })); + } + + if (list.length) { + $.when.apply(null, list).done(function() { + dfrd.resolve(); + }).fail(function() { + dfrd.reject(); + }); + } else { + dfrd.reject(); + } + }).fail(function() { + dfrd.reject(); + }); + + return dfrd; + }; + + this.getMkfileHides = function() { + return fm.storage('mkfileHides') || fm.arrayFlip(self.options.mkfileHideMimes || []); + }; + +}; + + +/* + * File: /js/commands/empty.js + */ + +/** + * @class elFinder command "empty". + * Empty the folder + * + * @type elFinder.command + * @author Naoki Sawada + */ +elFinder.prototype.commands.empty = function() { + var self, fm, + selFiles = function(select) { + var sel = self.files(select); + if (!sel.length) { + sel = [ fm.cwd() ]; + } + return sel; + }; + + this.linkedCmds = ['rm']; + + this.init = function() { + // lazy assign to make possible to become superclass + self = this; + fm = this.fm; + }; + + this.getstate = function(select) { + var sel = selFiles(select), + cnt, + filter = function(files) { + var fres = true; + return $.grep(files, function(f) { + fres = fres && f.read && f.write && f.mime === 'directory' ? true : false; + return fres; + }); + }; + + cnt = sel.length; + return filter(sel).length == cnt ? 0 : -1; + }; + + this.exec = function(hashes) { + var dirs = selFiles(hashes), + cnt = dirs.length, + dfrd = $.Deferred() + .done(function() { + var data = {changed: {}}; + fm.toast({msg: fm.i18n(['"'+success.join('", ')+'"', 'complete', fm.i18n('cmdempty')])}); + $.each(dirs, function(i, dir) { + data.changed[dir.hash] = dir; + }); + fm.change(data); + }) + .always(function() { + var cwd = fm.cwd().hash; + fm.trigger('selectfiles', {files: $.map(dirs, function(d) { return cwd === d.phash? d.hash : null; })}); + }), + success = [], + done = function(res) { + if (typeof res === 'number') { + success.push(dirs[res].name); + delete dirs[res].dirs; + } else { + res && fm.error(res); + } + (--cnt < 1) && dfrd[success.length? 'resolve' : 'reject'](); + }; + + $.each(dirs, function(i, dir) { + var tm; + if (!(dir.write && dir.mime === 'directory')) { + done(['errEmpty', dir.name, 'errPerm']); + return null; + } + if (!fm.isCommandEnabled('rm', dir.hash)) { + done(['errCmdNoSupport', '"rm"']); + return null; + } + tm = setTimeout(function() { + fm.notify({type : 'search', cnt : 1, hideCnt : cnt > 1? false : true}); + }, fm.notifyDelay); + fm.request({ + data : {cmd : 'open', target : dir.hash}, + preventDefault : true, + asNotOpen : true + }).done(function(data) { + var targets = []; + tm && clearTimeout(tm); + if (fm.ui.notify.children('.elfinder-notify-search').length) { + fm.notify({type : 'search', cnt : -1, hideCnt : cnt > 1? false : true}); + } + if (data && data.files && data.files.length) { + if (data.files.length > fm.maxTargets) { + done(['errEmpty', dir.name, 'errMaxTargets', fm.maxTargets]); + } else { + fm.updateCache(data); + $.each(data.files, function(i, f) { + if (!f.write || f.locked) { + done(['errEmpty', dir.name, 'errRm', f.name, 'errPerm']); + targets = []; + return false; + } + targets.push(f.hash); + }); + if (targets.length) { + fm.exec('rm', targets, { _userAction : true, addTexts : [ fm.i18n('folderToEmpty', dir.name) ] }) + .fail(function(error) { + fm.trigger('unselectfiles', {files: fm.selected()}); + done(fm.parseError(error) || ''); + }) + .done(function() { done(i); }); + } + } + } else { + fm.toast({ mode: 'warning', msg: fm.i18n('filderIsEmpty', dir.name)}); + done(''); + } + }).fail(function(error) { + done(fm.parseError(error) || ''); + }); + }); + + return dfrd; + }; + +}; + + +/* + * File: /js/commands/extract.js + */ + +/** + * @class elFinder command "extract" + * Extract files from archive + * + * @author Dmitry (dio) Levashov + **/ +elFinder.prototype.commands.extract = function() { + var self = this, + fm = self.fm, + mimes = [], + filter = function(files) { + var fres = true; + return $.grep(files, function(file) { + fres = fres && file.read && $.inArray(file.mime, mimes) !== -1 ? true : false; + return fres; + }); + }; + + this.variants = []; + this.disableOnSearch = true; + + // Update mimes list on open/reload + fm.bind('open reload', function() { + mimes = fm.option('archivers')['extract'] || []; + if (fm.api > 2) { + self.variants = [[{makedir: true}, fm.i18n('cmdmkdir')], [{}, fm.i18n('btnCwd')]]; + } else { + self.variants = [[{}, fm.i18n('btnCwd')]]; + } + self.change(); + }); + + this.getstate = function(select) { + var sel = this.files(select), + cnt = sel.length, + cwdHash, cwdChk; + if (!cnt || filter(sel).length != cnt) { + return -1; + } else if (fm.searchStatus.state > 0) { + cwdHash = this.fm.cwd().hash; + $.each(sel, function(i, file) { + cwdChk = (file.phash === cwdHash); + return cwdChk; + }); + return cwdChk? 0 : -1; + } else { + return this.fm.cwd().write? 0 : -1; + } + }; + + this.exec = function(hashes, opts) { + var files = this.files(hashes), + dfrd = $.Deferred(), + cnt = files.length, + makedir = opts && opts.makedir ? 1 : 0, + i, error, + decision, + + overwriteAll = false, + omitAll = false, + mkdirAll = 0, + siblings = fm.files(files[0].phash), + + names = [], + map = {}; + + $.each(siblings, function(id, file) { + map[file.name] = file; + names.push(file.name); + }); + + var decide = function(decision) { + switch (decision) { + case 'overwrite_all' : + overwriteAll = true; + break; + case 'omit_all': + omitAll = true; + break; + } + }; + + var unpack = function(file) { + if (!(file.read && fm.file(file.phash).write)) { + error = ['errExtract', file.name, 'errPerm']; + fm.error(error); + dfrd.reject(error); + } else if ($.inArray(file.mime, mimes) === -1) { + error = ['errExtract', file.name, 'errNoArchive']; + fm.error(error); + dfrd.reject(error); + } else { + fm.request({ + data:{cmd:'extract', target:file.hash, makedir:makedir}, + notify:{type:'extract', cnt:1}, + syncOnFail:true, + navigate:{ + toast : makedir? { + incwd : {msg: fm.i18n(['complete', fm.i18n('cmdextract')]), action: {cmd: 'open', msg: 'cmdopen'}}, + inbuffer : {msg: fm.i18n(['complete', fm.i18n('cmdextract')]), action: {cmd: 'open', msg: 'cmdopen'}} + } : { + inbuffer : {msg: fm.i18n(['complete', fm.i18n('cmdextract')])} + } + } + }) + .fail(function (error) { + if (dfrd.state() != 'rejected') { + dfrd.reject(error); + } + }) + .done(function () { + }); + } + }; + + var confirm = function(files, index) { + var file = files[index], + name = fm.splitFileExtention(file.name)[0], + existed = ($.inArray(name, names) >= 0), + next = function(){ + if((index+1) < cnt) { + confirm(files, index+1); + } else { + dfrd.resolve(); + } + }; + if (!makedir && existed && map[name].mime != 'directory') { + fm.confirm( + { + title : fm.i18n('ntfextract'), + text : ['errExists', name, 'confirmRepl'], + accept:{ + label : 'btnYes', + callback:function (all) { + decision = all ? 'overwrite_all' : 'overwrite'; + decide(decision); + if(!overwriteAll && !omitAll) { + if('overwrite' == decision) { + unpack(file); + } + if((index+1) < cnt) { + confirm(files, index+1); + } else { + dfrd.resolve(); + } + } else if(overwriteAll) { + for (i = index; i < cnt; i++) { + unpack(files[i]); + } + dfrd.resolve(); + } + } + }, + reject : { + label : 'btnNo', + callback:function (all) { + decision = all ? 'omit_all' : 'omit'; + decide(decision); + if(!overwriteAll && !omitAll && (index+1) < cnt) { + confirm(files, index+1); + } else if (omitAll) { + dfrd.resolve(); + } + } + }, + cancel : { + label : 'btnCancel', + callback:function () { + dfrd.resolve(); + } + }, + all : ((index+1) < cnt) + } + ); + } else if (!makedir) { + if (mkdirAll == 0) { + fm.confirm({ + title : fm.i18n('cmdextract'), + text : [fm.i18n('cmdextract')+' "'+file.name+'"', 'confirmRepl'], + accept:{ + label : 'btnYes', + callback:function (all) { + all && (mkdirAll = 1); + unpack(file); + next(); + } + }, + reject : { + label : 'btnNo', + callback:function (all) { + all && (mkdirAll = -1); + next(); + } + }, + cancel : { + label : 'btnCancel', + callback:function () { + dfrd.resolve(); + } + }, + all : ((index+1) < cnt) + }); + } else { + (mkdirAll > 0) && unpack(file); + next(); + } + } else { + unpack(file); + next(); + } + }; + + if (!(this.enabled() && cnt && mimes.length)) { + return dfrd.reject(); + } + + if(cnt > 0) { + confirm(files, 0); + } + + return dfrd; + }; + +}; + + +/* + * File: /js/commands/forward.js + */ + +/** + * @class elFinder command "forward" + * Open next visited folder + * + * @author Dmitry (dio) Levashov + **/ +(elFinder.prototype.commands.forward = function() { + this.alwaysEnabled = true; + this.updateOnSelect = true; + this.shortcuts = [{ + pattern : 'ctrl+right' + }]; + + this.getstate = function() { + return this.fm.history.canForward() ? 0 : -1; + }; + + this.exec = function() { + return this.fm.history.forward(); + }; + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/fullscreen.js + */ + +/** + * @class elFinder command "fullscreen" + * elFinder node to full scrren mode + * + * @author Naoki Sawada + **/ + +elFinder.prototype.commands.fullscreen = function() { + var self = this, + fm = this.fm, + update = function(e, data) { + var full; + e.preventDefault(); + e.stopPropagation(); + if (data && data.fullscreen) { + full = (data.fullscreen === 'on'); + self.update(void(0), full); + self.title = fm.i18n(full ? 'reinstate' : 'cmdfullscreen'); + } + }; + + this.alwaysEnabled = true; + this.updateOnSelect = false; + this.syncTitleOnChange = true; + this.value = false; + + this.options = { + ui : 'fullscreenbutton' + }; + + this.getstate = function() { + return 0; + }; + + this.exec = function() { + var node = fm.getUI().get(0), + full = (node === fm.toggleFullscreen(node)); + self.title = fm.i18n(full ? 'reinstate' : 'cmdfullscreen'); + self.update(void(0), full); + return $.Deferred().resolve(); + }; + + fm.bind('init', function() { + fm.getUI().off('resize.' + fm.namespace, update).on('resize.' + fm.namespace, update); + }); +}; + + +/* + * File: /js/commands/getfile.js + */ + +/** + * @class elFinder command "getfile". + * Return selected files info into outer callback. + * For use elFinder with wysiwyg editors etc. + * + * @author Dmitry (dio) Levashov, dio@std42.ru + **/ +(elFinder.prototype.commands.getfile = function() { + var self = this, + fm = this.fm, + filter = function(files) { + var o = self.options, + fres = true; + + files = $.grep(files, function(file) { + fres = fres && (file.mime != 'directory' || o.folders) && file.read ? true : false; + return fres; + }); + + return o.multiple || files.length == 1 ? files : []; + }; + + this.alwaysEnabled = true; + this.callback = fm.options.getFileCallback; + this._disabled = typeof(this.callback) == 'function'; + + this.getstate = function(select) { + var sel = this.files(select), + cnt = sel.length; + + return this.callback && cnt && filter(sel).length == cnt ? 0 : -1; + }; + + this.exec = function(hashes) { + var fm = this.fm, + opts = this.options, + files = this.files(hashes), + cnt = files.length, + url = fm.option('url'), + tmb = fm.option('tmbUrl'), + dfrd = $.Deferred() + .done(function(data) { + var res, + done = function() { + if (opts.oncomplete == 'close') { + fm.hide(); + } else if (opts.oncomplete == 'destroy') { + fm.destroy(); + } + }, + fail = function(error) { + if (opts.onerror == 'close') { + fm.hide(); + } else if (opts.onerror == 'destroy') { + fm.destroy(); + } else { + error && fm.error(error); + } + }; + + fm.trigger('getfile', {files : data}); + + try { + res = self.callback(data, fm); + } catch(e) { + fail(['Error in `getFileCallback`.', e.message]); + return; + } + + if (typeof res === 'object' && typeof res.done === 'function') { + res.done(done).fail(fail); + } else { + done(); + } + }), + result = function(file) { + return opts.onlyURL + ? opts.multiple ? $.map(files, function(f) { return f.url; }) : files[0].url + : opts.multiple ? files : files[0]; + }, + req = [], + i, file, dim; + + for (i = 0; i < cnt; i++) { + file = files[i]; + if (file.mime == 'directory' && !opts.folders) { + return dfrd.reject(); + } + file.baseUrl = url; + if (file.url == '1') { + req.push(fm.request({ + data : {cmd : 'url', target : file.hash}, + notify : {type : 'url', cnt : 1, hideCnt : true}, + preventDefault : true + }) + .done(function(data) { + if (data.url) { + var rfile = fm.file(this.hash); + rfile.url = this.url = data.url; + } + }.bind(file))); + } else { + file.url = fm.url(file.hash); + } + if (! opts.onlyURL) { + if (opts.getPath) { + file.path = fm.path(file.hash); + if (file.path === '' && file.phash) { + // get parents + (function() { + var dfd = $.Deferred(); + req.push(dfd); + fm.path(file.hash, false, {}) + .done(function(path) { + file.path = path; + }) + .fail(function() { + file.path = ''; + }) + .always(function() { + dfd.resolve(); + }); + })(); + } + } + if (file.tmb && file.tmb != 1) { + file.tmb = tmb + file.tmb; + } + if (!file.width && !file.height) { + if (file.dim) { + dim = file.dim.split('x'); + file.width = dim[0]; + file.height = dim[1]; + } else if (opts.getImgSize && file.mime.indexOf('image') !== -1) { + req.push(fm.request({ + data : {cmd : 'dim', target : file.hash}, + notify : {type : 'dim', cnt : 1, hideCnt : true}, + preventDefault : true + }) + .done(function(data) { + if (data.dim) { + var dim = data.dim.split('x'); + var rfile = fm.file(this.hash); + rfile.width = this.width = dim[0]; + rfile.height = this.height = dim[1]; + } + }.bind(file))); + } + } + } + } + + if (req.length) { + $.when.apply(null, req).always(function() { + dfrd.resolve(result(files)); + }); + return dfrd; + } + + return dfrd.resolve(result(files)); + }; + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/help.js + */ + +/** + * @class elFinder command "help" + * "About" dialog + * + * @author Dmitry (dio) Levashov + **/ +(elFinder.prototype.commands.help = function() { + var fm = this.fm, + self = this, + linktpl = '
', + linktpltgt = '', + atpl = '
{author}
{work}
', + url = /\{url\}/, + link = /\{link\}/, + author = /\{author\}/, + work = /\{work\}/, + r = 'replace', + prim = 'ui-priority-primary', + sec = 'ui-priority-secondary', + lic = 'elfinder-help-license', + tab = '
  • {title}
  • ', + html = ['
    ', + '
      '], + stpl = '
      {pattern}
      {descrip}
      ', + sep = '
      ', + selfUrl = $('base').length? fm.escape(document.location.href.replace(/#.*$/, '')) : '', + clTabActive = fm.res('class', 'tabsactive'), + + getTheme = function() { + var src; + if (fm.theme && fm.theme.author) { + src = atpl[r]('elfinder-help-team', 'elfinder-help-team elfinder-help-term-theme')[r](author, fm.i18n(fm.theme.author) + (fm.theme.email? ' <'+fm.theme.email+'>' : ''))[r](work, fm.i18n('theme') + ' ('+fm.i18n(fm.theme.name)+')'); + } else { + src = ''; + } + return src; + }, + + about = function() { + html.push('
      '); + html.push('

      elFinder

      '); + html.push('
      '+fm.i18n('webfm')+'
      '); + html.push('
      '+fm.i18n('ver')+': '+fm.version+'
      '); + html.push('
      '+fm.i18n('protocolver')+':
      '); + html.push('
      jQuery/jQuery UI: '+$().jquery+'/'+$.ui.version+'
      '); + + html.push(sep); + + html.push(linktpltgt[r](url, 'https://studio-42.github.io/elFinder/')[r](link, fm.i18n('homepage'))); + html.push(linktpltgt[r](url, 'https://github.com/Studio-42/elFinder/wiki')[r](link, fm.i18n('docs'))); + html.push(linktpltgt[r](url, 'https://github.com/Studio-42/elFinder')[r](link, fm.i18n('github'))); + //html.push(linktpltgt[r](url, 'http://twitter.com/elrte_elfinder')[r](link, fm.i18n('twitter'))); + + html.push(sep); + + html.push('
      '+fm.i18n('team')+'
      '); + + html.push(atpl[r](author, 'Dmitry "dio" Levashov <dio@std42.ru>')[r](work, fm.i18n('chiefdev'))); + html.push(atpl[r](author, 'Naoki Sawada (nao-pon)<hypweb+elfinder@gmail.com>')[r](work, fm.i18n('developer'))); + html.push(atpl[r](author, 'Troex Nevelin <troex@fury.scancode.ru>')[r](work, fm.i18n('maintainer'))); + html.push(atpl[r](author, 'Alexey Sukhotin <strogg@yandex.ru>')[r](work, fm.i18n('contributor'))); + + if (fm.i18[fm.lang].translator) { + $.each(fm.i18[fm.lang].translator.split(', '), function() { + html.push(atpl[r](author, $.trim(this))[r](work, fm.i18n('translator')+' ('+fm.i18[fm.lang].language+')')); + }); + } + + html.push(getTheme()); + + html.push(sep); + html.push('
      '+fm.i18n('icons')+': Pixelmixer, Fugue, Icons8
      '); + + html.push(sep); + html.push('
      Licence: 3-clauses BSD Licence
      '); + html.push('
      Copyright © 2009-2022, Studio 42 / nao-pon
      '); + html.push('
      „ …'+fm.i18n('dontforget')+' ”
      '); + html.push('
      '); + }, + shortcuts = function() { + var sh = fm.shortcuts(); + // shortcuts tab + html.push('
      '); + + if (sh.length) { + html.push('
      '); + $.each(sh, function(i, s) { + html.push(stpl.replace(/\{pattern\}/, s[0]).replace(/\{descrip\}/, s[1])); + }); + + html.push('
      '); + } else { + html.push('
      '+fm.i18n('shortcutsof')+'
      '); + } + + + html.push('
      '); + + }, + help = function() { + // help tab + html.push('
      '); + html.push('DON\'T PANIC'); + html.push('
      '); + // end help + }, + useInteg = false, + integrations = function() { + useInteg = true; + html.push('
      '); + }, + useDebug = false, + debug = function() { + useDebug = true; + // debug tab + html.push('
      '); + html.push('
        '); + html.push('
        '); + // end debug + }, + debugRender = function() { + var render = function(elm, obj) { + $.each(obj, function(k, v) { + elm.append($('
        ').text(k)); + if (typeof v === 'undefined') { + elm.append($('
        ').append($('').text('undfined'))); + } else if (typeof v === 'object' && !v) { + elm.append($('
        ').append($('').text('null'))); + } else if (typeof v === 'object' && ($.isPlainObject(v) || v.length)) { + elm.append( $('
        ').append(render($('
        '), v))); + } else { + elm.append($('
        ').append($('').text((v && typeof v === 'object')? '[]' : (v? v : '""')))); + } + }); + return elm; + }, + cnt = debugUL.children('li').length, + targetL, target, tabId, + info, lastUL, lastDIV; + + if (self.debug.options || self.debug.debug) { + if (cnt >= 5) { + lastUL = debugUL.children('li:last'); + lastDIV = debugDIV.children('div:last'); + if (lastDIV.is(':hidden')) { + lastUL.remove(); + lastDIV.remove(); + } else { + lastUL.prev().remove(); + lastDIV.prev().remove(); + } + } + + tabId = fm.namespace + '-help-debug-' + (+new Date()); + targetL = $('
      • ').html(''+self.debug.debug.cmd+'').prependTo(debugUL); + target = $('
        ').data('debug', self.debug); + + targetL.on('click.debugrender', function() { + var debug = target.data('debug'); + target.removeData('debug'); + if (debug) { + target.hide(); + if (debug.debug) { + info = $('
        ').append($('').text('debug'), render($('
        '), debug.debug)); + target.append(info); + } + if (debug.options) { + info = $('
        ').append($('').text('options'), render($('
        '), debug.options)); + target.append(info); + } + target.show(); + } + targetL.off('click.debugrender'); + }); + + debugUL.after(target); + + opened && debugDIV.tabs('refresh'); + } + }, + content = '', + opened, tabInteg, integDIV, tabDebug, debugDIV, debugUL; + + this.alwaysEnabled = true; + this.updateOnSelect = false; + this.state = -1; + + this.shortcuts = [{ + pattern : 'f1', + description : this.title + }]; + + fm.bind('load', function() { + var parts = self.options.view || ['about', 'shortcuts', 'help', 'integrations', 'debug'], + i, helpSource, tabBase, tabNav, tabs, delta; + + // remove 'preference' tab, it moved to command 'preference' + if ((i = $.inArray('preference', parts)) !== -1) { + parts.splice(i, 1); + } + + // debug tab require jQueryUI Tabs Widget + if (! $.fn.tabs) { + if ((i = $.inArray(parts, 'debug')) !== -1) { + parts.splice(i, 1); + } + } + + $.each(parts, function(i, title) { + html.push(tab[r](/\{id\}/g, title)[r](/\{title\}/, fm.i18n(title))); + }); + + html.push('
      '); + + $.inArray('about', parts) !== -1 && about(); + $.inArray('shortcuts', parts) !== -1 && shortcuts(); + if ($.inArray('help', parts) !== -1) { + helpSource = fm.i18nBaseUrl + 'help/%s.html.js'; + help(); + } + $.inArray('integrations', parts) !== -1 && integrations(); + $.inArray('debug', parts) !== -1 && debug(); + + html.push('
      '); + content = $(html.join('')); + + content.find('.ui-tabs-nav li') + .on('mouseenter mouseleave', function(e) { + $(this).toggleClass('ui-state-hover', e.type === 'mouseenter'); + }) + .on('focus blur', 'a', function(e) { + $(e.delegateTarget).toggleClass('ui-state-focus', e.type === 'focusin'); + }) + .children() + .on('click', function(e) { + var link = $(this); + + e.preventDefault(); + e.stopPropagation(); + + link.parent().addClass(clTabActive).siblings().removeClass(clTabActive); + content.children('.ui-tabs-panel').hide().filter(link.attr('href')).show(); + }) + .filter(':first').trigger('click'); + + if (useInteg) { + tabInteg = content.find('.elfinder-help-tab-integrations').hide(); + integDIV = content.find('#'+fm.namespace+'-help-integrations').hide().append($('
      ').html(fm.i18n('integrationWith'))); + fm.bind('helpIntegration', function(e) { + var ul = integDIV.children('ul:first'), + data, elm, cmdUL, cmdCls; + if (e.data) { + if ($.isPlainObject(e.data)) { + data = Object.assign({ + link: '', + title: '', + banner: '' + }, e.data); + if (data.title || data.link) { + if (!data.title) { + data.title = data.link; + } + if (data.link) { + elm = $('').attr('href', data.link).attr('target', '_blank').text(data.title); + } else { + elm = $('').text(data.title); + } + if (data.banner) { + elm = $('').append($('').attr(data.banner), elm); + } + } + } else { + elm = $(e.data); + elm.filter('a').each(function() { + var tgt = $(this); + if (!tgt.attr('target')) { + tgt.attr('target', '_blank');; + } + }); + } + if (elm) { + tabInteg.show(); + if (!ul.length) { + ul = $('').appendTo(integDIV); + } + if (data && data.cmd) { + cmdCls = 'elfinder-help-integration-' + data.cmd; + cmdUL = ul.find('ul.' + cmdCls); + if (!cmdUL.length) { + cmdUL = $(''); + ul.append($('
    • ').append($('').html(fm.i18n('cmd'+data.cmd))).append(cmdUL)); + } + elm = cmdUL.append($('
    • ').append(elm)); + } else { + ul.append($('
    • ').append(elm)); + } + } + } + }).bind('themechange', function() { + content.find('div.elfinder-help-term-theme').replaceWith(getTheme()); + }); + } + + // debug + if (useDebug) { + tabDebug = content.find('.elfinder-help-tab-debug').hide(); + debugDIV = content.find('#'+fm.namespace+'-help-debug').children('div:first'); + debugUL = debugDIV.children('ul:first').on('click', function(e) { + e.preventDefault(); + e.stopPropagation(); + }); + + self.debug = {}; + + fm.bind('backenddebug', function(e) { + // CAUTION: DO NOT TOUCH `e.data` + if (useDebug && e.data && e.data.debug) { + self.debug = { options : e.data.options, debug : Object.assign({ cmd : fm.currentReqCmd }, e.data.debug) }; + if (self.dialog) { + debugRender(); + } + } + }); + } + + content.find('#'+fm.namespace+'-help-about').find('.apiver').text(fm.api); + self.dialog = self.fmDialog(content, { + title : self.title, + width : 530, + maxWidth: 'window', + maxHeight: 'window', + autoOpen : false, + destroyOnClose : false, + close : function() { + if (useDebug) { + tabDebug.hide(); + debugDIV.tabs('destroy'); + } + opened = false; + } + }) + .on('click', function(e) { + e.stopPropagation(); + }) + .css({ + overflow: 'hidden' + }); + + tabBase = self.dialog.children('.ui-tabs'); + tabNav = tabBase.children('.ui-tabs-nav:first'); + tabs = tabBase.children('.ui-tabs-panel'); + delta = self.dialog.outerHeight(true) - self.dialog.height(); + self.dialog.closest('.ui-dialog').on('resize', function() { + tabs.height(self.dialog.height() - delta - tabNav.outerHeight(true) - 20); + }); + + if (helpSource) { + self.dialog.one('initContents', function() { + $.ajax({ + url: self.options.helpSource? self.options.helpSource : helpSource.replace('%s', fm.lang), + dataType: 'html' + }).done(function(source) { + $('#'+fm.namespace+'-help-help').html(source); + }).fail(function() { + $.ajax({ + url: helpSource.replace('%s', 'en'), + dataType: 'html' + }).done(function(source) { + $('#'+fm.namespace+'-help-help').html(source); + }); + }); + }); + } + + self.state = 0; + + fm.trigger('helpBuilded', self.dialog); + }).one('open', function() { + var debug = false; + fm.one('backenddebug', function() { + debug =true; + }).one('opendone', function() { + requestAnimationFrame(function() { + if (! debug && useDebug) { + useDebug = false; + tabDebug.hide(); + debugDIV.hide(); + debugUL.hide(); + } + }); + }); + }); + + this.getstate = function() { + return 0; + }; + + this.exec = function(sel, opts) { + var tab = opts? opts.tab : void(0), + debugShow = function() { + if (useDebug) { + debugDIV.tabs(); + debugUL.find('a:first').trigger('click'); + tabDebug.show(); + opened = true; + } + }; + debugShow(); + this.dialog.trigger('initContents').elfinderdialog('open').find((tab? '.elfinder-help-tab-'+tab : '.ui-tabs-nav li') + ' a:first').trigger('click'); + return $.Deferred().resolve(); + }; + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/hidden.js + */ + +/** + * @class elFinder command "hidden" + * Always hidden command for uiCmdMap + * + * @author Naoki Sawada + **/ +elFinder.prototype.commands.hidden = function() { + this.hidden = true; + this.updateOnSelect = false; + this.getstate = function() { + return -1; + }; +}; + +/* + * File: /js/commands/hide.js + */ + +/** + * @class elFinder command "hide". + * folders/files to hide as personal setting. + * + * @type elFinder.command + * @author Naoki Sawada + */ +elFinder.prototype.commands.hide = function() { + + var self = this, + nameCache = {}, + hideData, hideCnt, cMenuType, sOrigin; + + this.syncTitleOnChange = true; + + this.shortcuts = [{ + pattern : 'ctrl+shift+dot', + description : this.fm.i18n('toggleHidden') + }]; + + this.init = function() { + var fm = this.fm; + + hideData = fm.storage('hide') || {items: {}}; + hideCnt = Object.keys(hideData.items).length; + + this.title = fm.i18n(hideData.show? 'hideHidden' : 'showHidden'); + self.update(void(0), self.title); + }; + + this.fm.bind('select contextmenucreate closecontextmenu', function(e, fm) { + var sel = (e.data? (e.data.selected || e.data.targets) : null) || fm.selected(); + if (e.type === 'select' && e.data) { + sOrigin = e.data.origin; + } else if (e.type === 'contextmenucreate') { + cMenuType = e.data.type; + } + if (!sel.length || (((e.type !== 'contextmenucreate' && sOrigin !== 'navbar') || cMenuType === 'cwd') && sel[0] === fm.cwd().hash)) { + self.title = fm.i18n(hideData.show? 'hideHidden' : 'showHidden'); + } else { + self.title = fm.i18n('cmdhide'); + } + if (e.type !== 'closecontextmenu') { + self.update(cMenuType === 'cwd'? (hideCnt? 0 : -1) : void(0), self.title); + } else { + cMenuType = ''; + requestAnimationFrame(function() { + self.update(void(0), self.title); + }); + } + }); + + this.getstate = function(sel) { + return (this.fm.cookieEnabled && cMenuType !== 'cwd' && (sel || this.fm.selected()).length) || hideCnt? 0 : -1; + }; + + this.exec = function(hashes, opts) { + var fm = this.fm, + dfrd = $.Deferred() + .done(function() { + fm.trigger('hide', {items: items, opts: opts}); + }) + .fail(function(error) { + fm.error(error); + }), + o = opts || {}, + items = o.targets? o.targets : (hashes || fm.selected()), + added = [], + removed = [], + notifyto, files, res; + + hideData = fm.storage('hide') || {}; + if (!$.isPlainObject(hideData)) { + hideData = {}; + } + if (!$.isPlainObject(hideData.items)) { + hideData.items = {}; + } + if (opts._currentType === 'shortcut' || !items.length || (opts._currentType !== 'navbar' && sOrigin !=='navbar' && items[0] === fm.cwd().hash)) { + if (hideData.show) { + o.hide = true; + } else if (Object.keys(hideData.items).length) { + o.show = true; + } + } + if (o.reset) { + o.show = true; + hideCnt = 0; + } + if (o.show || o.hide) { + if (o.show) { + hideData.show = true; + } else { + delete hideData.show; + } + if (o.show) { + fm.storage('hide', o.reset? null : hideData); + self.title = fm.i18n('hideHidden'); + self.update(o.reset? -1 : void(0), self.title); + $.each(hideData.items, function(h) { + var f = fm.file(h, true); + if (f && (fm.searchStatus.state || !f.phash || fm.file(f.phash))) { + added.push(f); + } + }); + if (added.length) { + fm.updateCache({added: added}); + fm.add({added: added}); + } + if (o.reset) { + hideData = {items: {}}; + } + return dfrd.resolve(); + } + items = Object.keys(hideData.items); + } + + if (items.length) { + $.each(items, function(i, h) { + var f; + if (!hideData.items[h]) { + f = fm.file(h); + if (f) { + nameCache[h] = f.i18 || f.name; + } + hideData.items[h] = nameCache[h]? nameCache[h] : h; + } + }); + hideCnt = Object.keys(hideData.items).length; + files = this.files(items); + fm.storage('hide', hideData); + fm.remove({removed: items}); + if (hideData.show) { + this.exec(void(0), {hide: true}); + } + if (!o.hide) { + res = {}; + res.undo = { + cmd : 'hide', + callback : function() { + var nData = fm.storage('hide'); + if (nData) { + $.each(items, function(i, h) { + delete nData.items[h]; + }); + hideCnt = Object.keys(nData.items).length; + fm.storage('hide', nData); + fm.trigger('hide', {items: items, opts: {}}); + self.update(hideCnt? 0 : -1); + } + fm.updateCache({added: files}); + fm.add({added: files}); + } + }; + res.redo = { + cmd : 'hide', + callback : function() { + return fm.exec('hide', void(0), {targets: items}); + } + }; + } + } + + return dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(res); + }; +}; + + +/* + * File: /js/commands/home.js + */ + +(elFinder.prototype.commands.home = function() { + this.title = 'Home'; + this.alwaysEnabled = true; + this.updateOnSelect = false; + this.shortcuts = [{ + pattern : 'ctrl+home ctrl+shift+up', + description : 'Home' + }]; + + this.getstate = function() { + var root = this.fm.root(), + cwd = this.fm.cwd().hash; + + return root && cwd && root != cwd ? 0: -1; + }; + + this.exec = function() { + return this.fm.exec('open', this.fm.root()); + }; + + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/info.js + */ + +/** + * @class elFinder command "info". + * Display dialog with file properties. + * + * @author Dmitry (dio) Levashov, dio@std42.ru + **/ +(elFinder.prototype.commands.info = function() { + var m = 'msg', + fm = this.fm, + spclass = 'elfinder-spinner', + btnclass = 'elfinder-info-button', + msg = { + calc : fm.i18n('calc'), + size : fm.i18n('size'), + unknown : fm.i18n('unknown'), + path : fm.i18n('path'), + aliasfor : fm.i18n('aliasfor'), + modify : fm.i18n('modify'), + perms : fm.i18n('perms'), + locked : fm.i18n('locked'), + dim : fm.i18n('dim'), + kind : fm.i18n('kind'), + files : fm.i18n('files'), + folders : fm.i18n('folders'), + roots : fm.i18n('volumeRoots'), + items : fm.i18n('items'), + yes : fm.i18n('yes'), + no : fm.i18n('no'), + link : fm.i18n('link'), + owner : fm.i18n('owner'), + group : fm.i18n('group'), + perm : fm.i18n('perm'), + getlink : fm.i18n('getLink') + }, + applyZWSP = function(str, remove) { + if (remove) { + return str.replace(/\u200B/g, ''); + } else { + return str.replace(/(\/|\\)/g, "$1\u200B"); + } + }; + + this.items = ['size', 'aliasfor', 'path', 'link', 'dim', 'modify', 'perms', 'locked', 'owner', 'group', 'perm']; + if (this.options.custom && Object.keys(this.options.custom).length) { + $.each(this.options.custom, function(name, details) { + details.label && this.items.push(details.label); + }); + } + + this.tpl = { + main : '
      {title}
      {content}
      ', + itemTitle : '{name}{kind}', + groupTitle : '{items}: {num}', + row : '{label} : {value}', + spinner : '{text} ' + }; + + this.alwaysEnabled = true; + this.updateOnSelect = false; + this.shortcuts = [{ + pattern : 'ctrl+i' + }]; + + this.init = function() { + $.each(msg, function(k, v) { + msg[k] = fm.i18n(v); + }); + }; + + this.getstate = function() { + return 0; + }; + + this.exec = function(hashes) { + var files = this.files(hashes); + if (! files.length) { + files = this.files([ this.fm.cwd().hash ]); + } + var self = this, + fm = this.fm, + o = this.options, + tpl = this.tpl, + row = tpl.row, + cnt = files.length, + content = [], + view = tpl.main, + l = '{label}', + v = '{value}', + reqs = [], + reqDfrd = null, + opts = { + title : fm.i18n('selectionInfo'), + width : 'auto', + close : function() { + $(this).elfinderdialog('destroy'); + if (reqDfrd && reqDfrd.state() === 'pending') { + reqDfrd.reject(); + } + $.grep(reqs, function(r) { + r && r.state() === 'pending' && r.reject(); + }); + } + }, + count = [], + replSpinner = function(msg, name, className) { + dialog.find('.'+spclass+'-'+name).parent().html(msg).addClass(className || ''); + }, + id = fm.namespace+'-info-'+$.map(files, function(f) { return f.hash; }).join('-'), + dialog = fm.getUI().find('#'+id), + customActions = [], + style = '', + hashClass = 'elfinder-font-mono elfinder-info-hash', + getHashAlgorisms = [], + ndialog = fm.ui.notify, + size, tmb, file, title, dcnt, rdcnt, path, hideItems, hashProg; + + if (ndialog.is(':hidden') && ndialog.children('.elfinder-notify').length) { + ndialog.elfinderdialog('open').height('auto'); + } + + if (!cnt) { + return $.Deferred().reject(); + } + + if (dialog.length) { + dialog.elfinderdialog('toTop'); + return $.Deferred().resolve(); + } + + hideItems = fm.storage('infohides') || fm.arrayFlip(o.hideItems, true); + + if (cnt === 1) { + file = files[0]; + + if (file.icon) { + style = ' '+fm.getIconStyle(file); + } + + view = view.replace('{dirclass}', file.csscls? fm.escape(file.csscls) : '').replace('{class}', fm.mime2class(file.mime)).replace('{style}', style); + title = tpl.itemTitle.replace('{name}', fm.escape(file.i18 || file.name)).replace('{kind}', ''+fm.mime2kind(file)+''); + + tmb = fm.tmb(file); + + if (!file.read) { + size = msg.unknown; + } else if (file.mime != 'directory' || file.alias) { + size = fm.formatSize(file.size); + } else { + size = tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'size'); + count.push(file.hash); + } + + !hideItems.size && content.push(row.replace(l, msg.size).replace(v, size)); + !hideItems.aleasfor && file.alias && content.push(row.replace(l, msg.aliasfor).replace(v, file.alias)); + if (!hideItems.path) { + if (path = fm.path(file.hash, true)) { + content.push(row.replace(l, msg.path).replace(v, applyZWSP(fm.escape(path))).replace('{class}', 'elfinder-info-path')); + } else { + content.push(row.replace(l, msg.path).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'path')).replace('{class}', 'elfinder-info-path')); + reqs.push(fm.path(file.hash, true, {notify: null}) + .fail(function() { + replSpinner(msg.unknown, 'path'); + }) + .done(function(path) { + replSpinner(applyZWSP(path), 'path'); + })); + } + } + if (!hideItems.link && file.read) { + var href, + name_esc = fm.escape(file.name); + if (file.url == '1') { + content.push(row.replace(l, msg.link).replace(v, '')); + } else { + if (file.url) { + href = file.url; + } else if (file.mime === 'directory') { + if (o.nullUrlDirLinkSelf && file.url === null) { + var loc = window.location; + href = loc.pathname + loc.search + '#elf_' + file.hash; + } else if (file.url !== '' && fm.option('url', (!fm.isRoot(file) && file.phash) || file.hash)) { + href = fm.url(file.hash); + } + } else { + href = fm.url(file.hash); + } + href && content.push(row.replace(l, msg.link).replace(v, ''+name_esc+'')); + } + } + + if (!hideItems.dim) { + if (file.dim) { // old api + content.push(row.replace(l, msg.dim).replace(v, file.dim)); + } else if (file.mime.indexOf('image') !== -1) { + if (file.width && file.height) { + content.push(row.replace(l, msg.dim).replace(v, file.width+'x'+file.height)); + } else if (file.size && file.size !== '0') { + content.push(row.replace(l, msg.dim).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'dim'))); + reqs.push(fm.request({ + data : {cmd : 'dim', target : file.hash}, + preventDefault : true + }) + .fail(function() { + replSpinner(msg.unknown, 'dim'); + }) + .done(function(data) { + replSpinner(data.dim || msg.unknown, 'dim'); + if (data.dim) { + var dim = data.dim.split('x'); + var rfile = fm.file(file.hash); + rfile.width = dim[0]; + rfile.height = dim[1]; + } + })); + } + } + } + + !hideItems.modify && content.push(row.replace(l, msg.modify).replace(v, fm.formatDate(file))); + !hideItems.perms && content.push(row.replace(l, msg.perms).replace(v, fm.formatPermissions(file))); + !hideItems.locked && content.push(row.replace(l, msg.locked).replace(v, file.locked ? msg.yes : msg.no)); + !hideItems.owner && file.owner && content.push(row.replace(l, msg.owner).replace(v, file.owner)); + !hideItems.group && file.group && content.push(row.replace(l, msg.group).replace(v, file.group)); + !hideItems.perm && file.perm && content.push(row.replace(l, msg.perm).replace(v, fm.formatFileMode(file.perm))); + + // Get MD5, SHA hashes + if (window.ArrayBuffer && (fm.options.cdns.sparkmd5 || fm.options.cdns.jssha) && file.mime !== 'directory' && file.size > 0 && (!o.showHashMaxsize || file.size <= o.showHashMaxsize)) { + getHashAlgorisms = []; + $.each(fm.storage('hashchekcer') || o.showHashAlgorisms, function(i, n) { + if (!file[n]) { + content.push(row.replace(l, fm.i18n(n)).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', n))); + getHashAlgorisms.push(n); + } else { + content.push(row.replace(l, fm.i18n(n)).replace(v, file[n]).replace('{class}', hashClass)); + } + }); + + if (getHashAlgorisms.length) { + hashProg = $('
      '); + reqs.push( + fm.getContentsHashes(file.hash, getHashAlgorisms, o.showHashOpts, { progressBar : hashProg }).progress(function(hashes) { + $.each(getHashAlgorisms, function(i, n) { + if (hashes[n]) { + replSpinner(hashes[n], n, hashClass); + } + }); + }).always(function() { + $.each(getHashAlgorisms, function(i, n) { + replSpinner(msg.unknown, n); + }); + }) + ); + } + } + + // Add custom info fields + if (o.custom) { + $.each(o.custom, function(name, details) { + if ( + !hideItems[details.label] + && + (!details.mimes || $.grep(details.mimes, function(m){return (file.mime === m || file.mime.indexOf(m+'/') === 0)? true : false;}).length) + && + (!details.hashRegex || file.hash.match(details.hashRegex)) + ) { + // Add to the content + content.push(row.replace(l, fm.i18n(details.label)).replace(v , details.tpl.replace('{id}', id))); + // Register the action + if (details.action && (typeof details.action == 'function')) { + customActions.push(details.action); + } + } + }); + } + } else { + view = view.replace('{class}', 'elfinder-cwd-icon-group'); + title = tpl.groupTitle.replace('{items}', msg.items).replace('{num}', cnt); + dcnt = $.grep(files, function(f) { return f.mime == 'directory' ? true : false ; }).length; + if (!dcnt) { + size = 0; + $.each(files, function(h, f) { + var s = parseInt(f.size); + + if (s >= 0 && size >= 0) { + size += s; + } else { + size = 'unknown'; + } + }); + content.push(row.replace(l, msg.kind).replace(v, msg.files)); + !hideItems.size && content.push(row.replace(l, msg.size).replace(v, fm.formatSize(size))); + } else { + rdcnt = $.grep(files, function(f) { return f.mime === 'directory' && (! f.phash || f.isroot)? true : false ; }).length; + dcnt -= rdcnt; + 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(', '))); + !hideItems.size && content.push(row.replace(l, msg.size).replace(v, tpl.spinner.replace('{text}', msg.calc).replace('{name}', 'size'))); + count = $.map(files, function(f) { return f.hash; }); + + } + } + + view = view.replace('{title}', title).replace('{content}', content.join('').replace(/{class}/g, '')); + + dialog = self.fmDialog(view, opts); + dialog.attr('id', id).one('mousedown', '.elfinder-info-path', function() { + $(this).html(applyZWSP($(this).html(), true)); + }); + + if (getHashAlgorisms.length) { + hashProg.appendTo(dialog.find('.'+spclass+'-'+getHashAlgorisms[0]).parent()); + } + + if (fm.UA.Mobile && $.fn.tooltip) { + dialog.children('.ui-dialog-content .elfinder-info-title').tooltip({ + classes: { + 'ui-tooltip': 'elfinder-ui-tooltip ui-widget-shadow' + }, + tooltipClass: 'elfinder-ui-tooltip ui-widget-shadow', + track: true + }); + } + + if (file && file.url == '1') { + dialog.on('click', '.'+spclass+'-url', function(){ + $(this).parent().html(tpl.spinner.replace('{text}', fm.i18n('ntfurl')).replace('{name}', 'url')); + fm.request({ + data : {cmd : 'url', target : file.hash}, + preventDefault : true + }) + .fail(function() { + replSpinner(name_esc, 'url'); + }) + .done(function(data) { + if (data.url) { + replSpinner(''+name_esc+'' || name_esc, 'url'); + var rfile = fm.file(file.hash); + rfile.url = data.url; + } else { + replSpinner(name_esc, 'url'); + } + }); + }); + } + + // load thumbnail + if (tmb) { + $('') + .on('load', function() { dialog.find('.elfinder-cwd-icon').addClass(tmb.className).css('background-image', "url('"+tmb.url+"')"); }) + .attr('src', tmb.url); + } + + // send request to count total size + if (count.length) { + reqDfrd = fm.getSize(count).done(function(data) { + replSpinner(data.formated, 'size'); + }).fail(function() { + replSpinner(msg.unknown, 'size'); + }); + } + + // call custom actions + if (customActions.length) { + $.each(customActions, function(i, action) { + try { + action(file, fm, dialog); + } catch(e) { + fm.debug('error', e); + } + }); + } + + return $.Deferred().resolve(); + }; + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/mkdir.js + */ + +/** + * @class elFinder command "mkdir" + * Create new folder + * + * @author Dmitry (dio) Levashov + **/ +elFinder.prototype.commands.mkdir = function() { + var fm = this.fm, + self = this, + curOrg; + + this.value = ''; + this.disableOnSearch = true; + this.updateOnSelect = false; + this.syncTitleOnChange = true; + this.mime = 'directory'; + this.prefix = 'untitled folder'; + this.exec = function(select, cOpts) { + var onCwd; + + if (select && select.length && cOpts && cOpts._currentType && cOpts._currentType === 'navbar') { + this.origin = cOpts._currentType; + this.data = { + target: select[0] + }; + } else { + onCwd = fm.cwd().hash === select[0]; + this.origin = curOrg && !onCwd? curOrg : 'cwd'; + delete this.data; + } + if (! select && ! this.options.intoNewFolderToolbtn) { + fm.getUI('cwd').trigger('unselectall'); + } + //this.move = (!onCwd && curOrg !== 'navbar' && fm.selected().length)? true : false; + this.move = this.value === fm.i18n('cmdmkdirin'); + return $.proxy(fm.res('mixin', 'make'), self)(); + }; + + this.shortcuts = [{ + pattern : 'ctrl+shift+n' + }]; + + this.init = function() { + if (this.options.intoNewFolderToolbtn) { + this.syncTitleOnChange = true; + } + }; + + fm.bind('select contextmenucreate closecontextmenu', function(e) { + var sel = (e.data? (e.data.selected || e.data.targets) : null) || fm.selected(); + + self.className = 'mkdir'; + curOrg = e.data && sel.length? (e.data.origin || e.data.type || '') : ''; + if (!self.options.intoNewFolderToolbtn && curOrg === '') { + curOrg = 'cwd'; + } + if (sel.length && curOrg !== 'navbar' && curOrg !== 'cwd' && fm.cwd().hash !== sel[0]) { + self.title = fm.i18n('cmdmkdirin'); + self.className += ' elfinder-button-icon-mkdirin'; + } else { + self.title = fm.i18n('cmdmkdir'); + } + if (e.type !== 'closecontextmenu') { + self.update(void(0), self.title); + } else { + requestAnimationFrame(function() { + self.update(void(0), self.title); + }); + } + }); + + this.getstate = function(select) { + var cwd = fm.cwd(), + sel = (curOrg === 'navbar' || (select && select[0] !== cwd.hash))? this.files(select || fm.selected()) : [], + cnt = sel.length, + filter = function(files) { + var fres = true; + return $.grep(files, function(f) { + fres = fres && f.read && ! f.locked? true : false; + return fres; + }); + }; + + if (curOrg === 'navbar') { + return cnt && sel[0].write && sel[0].read? 0 : -1; + } else { + return cwd.write && (!cnt || filter(sel).length == cnt)? 0 : -1; + } + }; + +}; + + +/* + * File: /js/commands/mkfile.js + */ + +/** + * @class elFinder command "mkfile" + * Create new empty file + * + * @author Dmitry (dio) Levashov + **/ +elFinder.prototype.commands.mkfile = function() { + var self = this; + + this.disableOnSearch = true; + this.updateOnSelect = false; + this.mime = 'text/plain'; + this.prefix = 'untitled file.txt'; + this.variants = []; + + this.getTypeName = function(mime, type) { + var fm = self.fm, + name; + if (name = fm.messages['kind' + fm.kinds[mime]]) { + name = fm.i18n(['extentiontype', type.toUpperCase(), name]); + } else { + name = fm.i18n(['extentionfile', type.toUpperCase()]); + } + return name; + }; + + this.fm.bind('open reload canMakeEmptyFile', function() { + var fm = self.fm, + hides = fm.getCommand('edit').getMkfileHides(); + self.variants = []; + if (fm.mimesCanMakeEmpty) { + $.each(fm.mimesCanMakeEmpty, function(mime, type) { + type && !hides[mime] && fm.uploadMimeCheck(mime) && self.variants.push([mime, self.getTypeName(mime, type)]); + }); + } + self.change(); + }); + + this.getstate = function() { + return this.fm.cwd().write ? 0 : -1; + }; + + this.exec = function(_dum, mime) { + var fm = self.fm, + type, err; + if (type = fm.mimesCanMakeEmpty[mime]) { + if (fm.uploadMimeCheck(mime)) { + this.mime = mime; + this.prefix = fm.i18n(['untitled file', type]); + return $.proxy(fm.res('mixin', 'make'), self)(); + } + err = ['errMkfile', self.getTypeName(mime, type)]; + } + return $.Deferred().reject(err); + }; +}; + + +/* + * File: /js/commands/netmount.js + */ + +/** + * @class elFinder command "netmount" + * Mount network volume with user credentials. + * + * @author Dmitry (dio) Levashov + **/ +elFinder.prototype.commands.netmount = function() { + var self = this, + hasMenus = false, + content; + + this.alwaysEnabled = true; + this.updateOnSelect = false; + + this.drivers = []; + + this.handlers = { + load : function() { + var fm = self.fm; + if (fm.cookieEnabled) { + fm.one('open', function() { + self.drivers = fm.netDrivers; + if (self.drivers.length) { + $.each(self.drivers, function() { + var d = self.options[this]; + if (d) { + hasMenus = true; + if (d.integrateInfo) { + fm.trigger('helpIntegration', Object.assign({cmd: 'netmount'}, d.integrateInfo)); + } + } + }); + } + }); + } + } + }; + + this.getstate = function() { + return hasMenus ? 0 : -1; + }; + + this.exec = function() { + var fm = self.fm, + dfrd = $.Deferred(), + o = self.options, + create = function() { + var winFocus = function() { + inputs.protocol.trigger('change', 'winfocus'); + }, + inputs = { + protocol : $('') + .on('change', function(e, data){ + var protocol = this.value; + content.find('.elfinder-netmount-tr').hide(); + content.find('.elfinder-netmount-tr-'+protocol).show(); + dialogNode && dialogNode.children('.ui-dialog-buttonpane:first').find('button').show(); + if (typeof o[protocol].select == 'function') { + o[protocol].select(fm, e, data); + } + }) + .addClass('ui-corner-all') + }, + opts = { + title : fm.i18n('netMountDialogTitle'), + resizable : true, + modal : true, + destroyOnClose : false, + open : function() { + $(window).on('focus.'+fm.namespace, winFocus); + inputs.protocol.trigger('change'); + }, + close : function() { + dfrd.state() == 'pending' && dfrd.reject(); + $(window).off('focus.'+fm.namespace, winFocus); + }, + buttons : {} + }, + doMount = function() { + var protocol = inputs.protocol.val(), + data = {cmd : 'netmount', protocol: protocol}, + cur = o[protocol], + mnt2res; + $.each(content.find('input.elfinder-netmount-inputs-'+protocol), function(name, input) { + var val, elm; + elm = $(input); + if (elm.is(':radio,:checkbox')) { + if (elm.is(':checked')) { + val = $.trim(elm.val()); + } + } else { + val = $.trim(elm.val()); + } + if (val) { + data[input.name] = val; + } + }); + + if (!data.host) { + return fm.trigger('error', {error : 'errNetMountHostReq', opts : {modal: true}}); + } + + if (data.mnt2res) { + mnt2res = true; + } + + fm.request({data : data, notify : {type : 'netmount', cnt : 1, hideCnt : true}}) + .done(function(data) { + var pdir; + if (data.added && data.added.length) { + mnt2res && inputs.protocol.trigger('change', 'reset'); + if (data.added[0].phash) { + if (pdir = fm.file(data.added[0].phash)) { + if (! pdir.dirs) { + pdir.dirs = 1; + fm.change({ changed: [ pdir ] }); + } + } + } + fm.one('netmountdone', function() { + fm.exec('open', data.added[0].hash); + }); + } + dfrd.resolve(); + }) + .fail(function(error) { + if (cur.fail && typeof cur.fail == 'function') { + cur.fail(fm, fm.parseError(error)); + } + dfrd.reject(error); + }); + + self.dialog.elfinderdialog('close'); + }, + form = $('
      ').on('keydown', 'input', function(e) { + var comp = true, + next; + if (e.keyCode === $.ui.keyCode.ENTER) { + $.each(form.find('input:visible:not(.elfinder-input-optional)'), function() { + if ($(this).val() === '') { + comp = false; + next = $(this); + return false; + } + }); + if (comp) { + doMount(); + } else { + next.trigger('focus'); + } + } + }), + hidden = $('
      '), + dialog; + + content = $('
      ') + .append($('').append($(''+fm.i18n('protocol')+'')).append($('').append(inputs.protocol))); + + $.each(self.drivers, function(i, protocol) { + if (o[protocol]) { + inputs.protocol.append(''); + $.each(o[protocol].inputs, function(name, input) { + input.attr('name', name); + if (input.attr('type') != 'hidden') { + input.addClass('ui-corner-all elfinder-netmount-inputs-'+protocol); + content.append($('').addClass('elfinder-netmount-tr elfinder-netmount-tr-'+protocol).append($(''+fm.i18n(name)+'')).append($('').append(input))); + } else { + input.addClass('elfinder-netmount-inputs-'+protocol); + hidden.append(input); + } + }); + o[protocol].protocol = inputs.protocol; + } + }); + + content.append(hidden); + + content.find('.elfinder-netmount-tr').hide(); + content.find('.elfinder-netmount-tr-' + self.drivers[0]).show(); + + opts.buttons[fm.i18n('btnMount')] = doMount; + + opts.buttons[fm.i18n('btnCancel')] = function() { + self.dialog.elfinderdialog('close'); + }; + + content.find('select,input').addClass('elfinder-tabstop'); + + dialog = self.fmDialog(form.append(content), opts).ready(function() { + inputs.protocol.trigger('change'); + dialog.elfinderdialog('posInit'); + }); + dialogNode = dialog.closest('.ui-dialog'); + return dialog; + }, + dialogNode; + + if (!self.dialog) { + self.dialog = create(); + } else { + self.dialog.elfinderdialog('open'); + } + + return dfrd.promise(); + }; + + self.fm.bind('netmount', function(e) { + var d = e.data || null, + o = self.options, + done = function() { + if (o[d.protocol] && typeof o[d.protocol].done == 'function') { + o[d.protocol].done(self.fm, d); + content.find('select,input').addClass('elfinder-tabstop'); + self.dialog.elfinderdialog('tabstopsInit'); + } + }; + if (d && d.protocol) { + if (d.mode && d.mode === 'redirect') { + // To support of third-party cookie blocking (ITP) on CORS + // On iOS and iPadOS 13.4 and Safari 13.1 on macOS, the session cannot be continued when redirecting OAuth in CORS mode + self.fm.request({ + data : {cmd : 'netmount', protocol : d.protocol, host: d.host, user : 'init', pass : 'return', options: d.options}, + preventDefault : true + }).done(function(data) { + d = JSON.parse(data.body); + done(); + }); + } else { + done(); + } + } + }); + +}; + +elFinder.prototype.commands.netunmount = function() { + var self = this; + + this.alwaysEnabled = true; + this.updateOnSelect = false; + + this.drivers = []; + + this.handlers = { + load : function() { + this.drivers = this.fm.netDrivers; + } + }; + + this.getstate = function(sel) { + var fm = this.fm, + file; + return !!sel && this.drivers.length && !this._disabled && (file = fm.file(sel[0])) && file.netkey ? 0 : -1; + }; + + this.exec = function(hashes) { + var self = this, + fm = this.fm, + dfrd = $.Deferred() + .fail(function(error) { + error && fm.error(error); + }), + drive = fm.file(hashes[0]), + childrenRoots = function(hash) { + var roots = [], + work; + if (fm.leafRoots) { + work = []; + $.each(fm.leafRoots, function(phash, hashes) { + var parents = fm.parents(phash), + idx, deep; + if ((idx = $.inArray(hash, parents)) !== -1) { + idx = parents.length - idx; + $.each(hashes, function(i, h) { + work.push({i: idx, hash: h}); + }); + } + }); + if (work.length) { + work.sort(function(a, b) { return a.i < b.i; }); + $.each(work, function(i, o) { + roots.push(o.hash); + }); + } + } + return roots; + }; + + if (this._disabled) { + return dfrd.reject(); + } + + if (dfrd.state() == 'pending') { + fm.confirm({ + title : self.title, + text : fm.i18n('confirmUnmount', drive.name), + accept : { + label : 'btnUnmount', + callback : function() { + var target = drive.hash, + roots = childrenRoots(target), + requests = [], + removed = [], + doUmount = function() { + $.when(requests).done(function() { + fm.request({ + data : {cmd : 'netmount', protocol : 'netunmount', host: drive.netkey, user : target, pass : 'dum'}, + notify : {type : 'netunmount', cnt : 1, hideCnt : true}, + preventFail : true + }) + .fail(function(error) { + dfrd.reject(error); + }) + .done(function(data) { + drive.volumeid && delete fm.volumeExpires[drive.volumeid]; + dfrd.resolve(); + }); + }).fail(function(error) { + if (removed.length) { + fm.remove({ removed: removed }); + } + dfrd.reject(error); + }); + }; + + if (roots.length) { + fm.confirm({ + title : self.title, + text : (function() { + var msgs = ['unmountChildren']; + $.each(roots, function(i, hash) { + msgs.push([fm.file(hash).name]); + }); + return msgs; + })(), + accept : { + label : 'btnUnmount', + callback : function() { + $.each(roots, function(i, hash) { + var d = fm.file(hash); + if (d.netkey) { + requests.push(fm.request({ + data : {cmd : 'netmount', protocol : 'netunmount', host: d.netkey, user : d.hash, pass : 'dum'}, + notify : {type : 'netunmount', cnt : 1, hideCnt : true}, + preventDefault : true + }).done(function(data) { + if (data.removed) { + d.volumeid && delete fm.volumeExpires[d.volumeid]; + removed = removed.concat(data.removed); + } + })); + } + }); + doUmount(); + } + }, + cancel : { + label : 'btnCancel', + callback : function() { + dfrd.reject(); + } + } + }); + } else { + requests = null; + doUmount(); + } + } + }, + cancel : { + label : 'btnCancel', + callback : function() { dfrd.reject(); } + } + }); + } + + return dfrd; + }; + +}; + + +/* + * File: /js/commands/open.js + */ + +/** + * @class elFinder command "open" + * Enter folder or open files in new windows + * + * @author Dmitry (dio) Levashov + **/ +(elFinder.prototype.commands.open = function() { + var fm = this.fm, + self = this; + this.alwaysEnabled = true; + this.noChangeDirOnRemovedCwd = true; + + this._handlers = { + dblclick : function(e) { + var arg = e.data && e.data.file? [ e.data.file ]: void(0); + if (self.getstate(arg) === 0) { + e.preventDefault(); + fm.exec('open', arg); + } + }, + 'select enable disable reload' : function(e) { this.update(e.type == 'disable' ? -1 : void(0)); } + }; + + this.shortcuts = [{ + pattern : 'ctrl+down numpad_enter'+(fm.OS != 'mac' && ' enter') + }]; + + this.getstate = function(select) { + var sel = this.files(select), + cnt = sel.length, + filter = function(files) { + var fres = true; + return $.grep(files, function(file) { + fres = fres && file.mime == 'directory' || ! file.read ? false : true; + return fres; + }); + }; + + return cnt == 1 + ? (sel[0].read ? 0 : -1) + : (cnt && !fm.UA.Mobile) ? ($.grep(sel, function(file) { return file.mime == 'directory' || ! file.read ? false : true;}).length == cnt ? 0 : -1) : -1; + }; + + this.exec = function(hashes, cOpts) { + var dfrd = $.Deferred().fail(function(error) { error && fm.error(error); }), + files = this.files(hashes), + cnt = files.length, + thash = (typeof cOpts == 'object')? cOpts.thash : false, + opts = this.options, + into = opts.into || 'window', + file, url, s, w, imgW, imgH, winW, winH, reg, link, html5dl, inline, + selAct, cmd; + + if (!cnt && !thash) { + { + return dfrd.reject(); + } + } + + // open folder + if (thash || (cnt == 1 && (file = files[0]) && file.mime == 'directory')) { + if (!thash && file && !file.read) { + return dfrd.reject(['errOpen', file.name, 'errPerm']); + } else { + if (fm.keyState.ctrlKey && (fm.keyState.shiftKey || typeof fm.options.getFileCallback !== 'function')) { + if (fm.getCommand('opennew')) { + return fm.exec('opennew', [thash? thash : file.hash]); + } + } + + return fm.request({ + data : {cmd : 'open', target : thash || file.hash}, + notify : {type : 'open', cnt : 1, hideCnt : true}, + syncOnFail : true, + lazy : false + }); + } + } + + files = $.grep(files, function(file) { return file.mime != 'directory' ? true : false; }); + + // nothing to open or files and folders selected - do nothing + if (cnt != files.length) { + return dfrd.reject(); + } + + var doOpen = function() { + var openCB = function(url) { + var link = $('').hide().appendTo($('body')); + if (fm.UA.Mobile || !inline) { + if (html5dl) { + if (!inline) { + link.attr('download', file.name); + } else { + link.attr('target', '_blank'); + } + link.attr('href', url).get(0).click(); + } else { + wnd = window.open(url); + if (!wnd) { + return dfrd.reject('errPopup'); + } + } + } else { + getOnly = (typeof opts.method === 'string' && opts.method.toLowerCase() === 'get'); + if (!getOnly + && url.indexOf(fm.options.url) === 0 + && fm.customData + && Object.keys(fm.customData).length + // Since playback by POST request can not be done in Chrome, media allows GET request + && !file.mime.match(/^(?:video|audio)/) + ) { + // Send request as 'POST' method to hide custom data at location bar + url = ''; + } + if (into === 'window') { + // set window size for image if set + imgW = winW = Math.round(2 * screen.availWidth / 3); + imgH = winH = Math.round(2 * screen.availHeight / 3); + if (parseInt(file.width) && parseInt(file.height)) { + imgW = parseInt(file.width); + imgH = parseInt(file.height); + } else if (file.dim) { + s = file.dim.split('x'); + imgW = parseInt(s[0]); + imgH = parseInt(s[1]); + } + if (winW >= imgW && winH >= imgH) { + winW = imgW; + winH = imgH; + } else { + if ((imgW - winW) > (imgH - winH)) { + winH = Math.round(imgH * (winW / imgW)); + } else { + winW = Math.round(imgW * (winH / imgH)); + } + } + w = 'width='+winW+',height='+winH; + wnd = window.open(url, target, w + ',top=50,left=50,scrollbars=yes,resizable=yes,titlebar=no'); + } else { + if (into === 'tabs') { + target = file.hash; + } + wnd = window.open('about:blank', target); + } + + if (!wnd) { + return dfrd.reject('errPopup'); + } + + if (url === '') { + var form = document.createElement("form"); + form.action = fm.options.url; + form.method = 'POST'; + form.target = target; + form.style.display = 'none'; + var params = Object.assign({}, fm.customData, { + cmd: 'file', + target: file.hash, + _t: file.ts || parseInt(+new Date()/1000) + }); + $.each(params, function(key, val) + { + var input = document.createElement("input"); + input.name = key; + input.value = val; + form.appendChild(input); + }); + + document.body.appendChild(form); + form.submit(); + } else if (into !== 'window') { + wnd.location = url; + } + $(wnd).trigger('focus'); + } + link.remove(); + }, + wnd, target, getOnly; + + try { + reg = new RegExp(fm.option('dispInlineRegex'), 'i'); + } catch(e) { + reg = false; + } + + // open files + html5dl = (typeof $('').get(0).download === 'string'); + cnt = files.length; + while (cnt--) { + target = 'elf_open_window'; + file = files[cnt]; + + if (!file.read) { + return dfrd.reject(['errOpen', file.name, 'errPerm']); + } + + inline = (reg && file.mime.match(reg)); + fm.openUrl(file.hash, !inline, openCB); + } + return dfrd.resolve(hashes); + }; + + if (cnt > 1) { + fm.confirm({ + title: 'openMulti', + text : ['openMultiConfirm', cnt + ''], + accept : { + label : 'cmdopen', + callback : function() { doOpen(); } + }, + cancel : { + label : 'btnCancel', + callback : function() { + dfrd.reject(); + } + }, + buttons : (fm.getCommand('zipdl') && fm.isCommandEnabled('zipdl', fm.cwd().hash))? [ + { + label : 'cmddownload', + callback : function() { + fm.exec('download', hashes); + dfrd.reject(); + } + } + ] : [] + }); + } else { + selAct = fm.storage('selectAction') || opts.selectAction; + if (selAct) { + $.each(selAct.split('/'), function() { + var cmdName = this.valueOf(); + if (cmdName !== 'open' && (cmd = fm.getCommand(cmdName)) && cmd.enabled()) { + return false; + } + cmd = null; + }); + if (cmd) { + return fm.exec(cmd.name); + } + } + doOpen(); + } + + return dfrd; + }; + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/opendir.js + */ + +/** + * @class elFinder command "opendir" + * Enter parent folder + * + * @author Naoki Sawada + **/ +elFinder.prototype.commands.opendir = function() { + this.alwaysEnabled = true; + + this.getstate = function() { + var sel = this.fm.selected(), + cnt = sel.length, + wz; + if (cnt !== 1) { + return -1; + } + wz = this.fm.getUI('workzone'); + return wz.hasClass('elfinder-search-result')? 0 : -1; + }; + + this.exec = function(hashes) { + var fm = this.fm, + dfrd = $.Deferred(), + files = this.files(hashes), + cnt = files.length, + hash, pcheck = null; + + if (!cnt || !files[0].phash) { + return dfrd.reject(); + } + + hash = files[0].phash; + fm.trigger('searchend', { noupdate: true }); + fm.request({ + data : {cmd : 'open', target : hash}, + notify : {type : 'open', cnt : 1, hideCnt : true}, + syncOnFail : false + }); + + return dfrd; + }; + +}; + + +/* + * File: /js/commands/opennew.js + */ + +/** + * @class elFinder command "opennew" + * Open folder in new window + * + * @author Naoki Sawada + **/ +elFinder.prototype.commands.opennew = function() { + var fm = this.fm; + + this.shortcuts = [{ + pattern : (typeof(fm.options.getFileCallback) === 'function'? 'shift+' : '') + 'ctrl+enter' + }]; + + this.getstate = function(select) { + var sel = this.files(select), + cnt = sel.length; + + return cnt === 1 + ? (sel[0].mime === 'directory' && sel[0].read? 0 : -1) + : -1; + }; + + this.exec = function(hashes) { + var dfrd = $.Deferred(), + files = this.files(hashes), + cnt = files.length, + opts = this.options, + file, loc, url, win; + + // open folder to new tab (window) + if (cnt === 1 && (file = files[0]) && file.mime === 'directory') { + loc = window.location; + if (opts.url) { + url = opts.url; + } else { + url = loc.pathname; + } + if (opts.useOriginQuery) { + if (!url.match(/\?/)) { + url += loc.search; + } else if (loc.search) { + url += '&' + loc.search.substr(1); + } + } + url += '#elf_' + file.hash; + win = window.open(url, '_blank'); + setTimeout(function() { + win.focus(); + }, 1000); + return dfrd.resolve(); + } else { + return dfrd.reject(); + } + }; +}; + + +/* + * File: /js/commands/paste.js + */ + +/** + * @class elFinder command "paste" + * Paste filesfrom clipboard into directory. + * If files pasted in its parent directory - files duplicates will created + * + * @author Dmitry (dio) Levashov + **/ +elFinder.prototype.commands.paste = function() { + this.updateOnSelect = false; + + this.handlers = { + changeclipboard : function() { this.update(); } + }; + + this.shortcuts = [{ + pattern : 'ctrl+v shift+insert' + }]; + + this.getstate = function(dst) { + if (this._disabled) { + return -1; + } + if (dst) { + if (Array.isArray(dst)) { + if (dst.length != 1) { + return -1; + } + dst = this.fm.file(dst[0]); + } + } else { + dst = this.fm.cwd(); + } + + return this.fm.clipboard().length && dst.mime == 'directory' && dst.write ? 0 : -1; + }; + + this.exec = function(select, cOpts) { + var self = this, + fm = self.fm, + opts = cOpts || {}, + dst = select ? this.files(select)[0] : fm.cwd(), + files = fm.clipboard(), + cnt = files.length, + cut = cnt ? files[0].cut : false, + cmd = opts._cmd? opts._cmd : (cut? 'move' : 'copy'), + error = 'err' + cmd.charAt(0).toUpperCase() + cmd.substr(1), + fpaste = [], + fcopy = [], + dfrd = $.Deferred() + .fail(function(error) { + error && fm.error(error); + }) + .always(function() { + fm.unlockfiles({files : $.map(files, function(f) { return f.hash; })}); + }), + copy = function(files) { + return files.length && fm._commands.duplicate + ? fm.exec('duplicate', files) + : $.Deferred().resolve(); + }, + paste = function(files) { + var dfrd = $.Deferred(), + existed = [], + hashes = {}, + intersect = function(files, names) { + var ret = [], + i = files.length; + + while (i--) { + $.inArray(files[i].name, names) !== -1 && ret.unshift(i); + } + return ret; + }, + confirm = function(ndx) { + var i = existed[ndx], + file = files[i], + last = ndx == existed.length-1; + + if (!file) { + return; + } + + fm.confirm({ + title : fm.i18n(cmd + 'Files'), + text : ['errExists', file.name, cmd === 'restore'? 'confirmRest' : 'confirmRepl'], + all : !last, + accept : { + label : 'btnYes', + callback : function(all) { + !last && !all + ? confirm(++ndx) + : paste(files); + } + }, + reject : { + label : 'btnNo', + callback : function(all) { + var i; + + if (all) { + i = existed.length; + while (ndx < i--) { + files[existed[i]].remove = true; + } + } else { + files[existed[ndx]].remove = true; + } + + !last && !all + ? confirm(++ndx) + : paste(files); + } + }, + cancel : { + label : 'btnCancel', + callback : function() { + dfrd.resolve(); + } + }, + buttons : [ + { + label : 'btnBackup', + callback : function(all) { + var i; + if (all) { + i = existed.length; + while (ndx < i--) { + files[existed[i]].rename = true; + } + } else { + files[existed[ndx]].rename = true; + } + !last && !all + ? confirm(++ndx) + : paste(files); + } + } + ] + }); + }, + valid = function(names) { + var exists = {}, existedArr; + if (names) { + if (Array.isArray(names)) { + if (names.length) { + if (typeof names[0] == 'string') { + // elFinder <= 2.1.6 command `is` results + existed = intersect(files, names); + } else { + $.each(names, function(i, v) { + exists[v.name] = v.hash; + }); + existed = intersect(files, $.map(exists, function(h, n) { return n; })); + $.each(files, function(i, file) { + if (exists[file.name]) { + hashes[exists[file.name]] = file.name; + } + }); + } + } + } else { + existedArr = []; + existed = $.map(names, function(n) { + if (typeof n === 'string') { + return n; + } else { + // support to >=2.1.11 plugin Normalizer, Sanitizer + existedArr = existedArr.concat(n); + return false; + } + }); + if (existedArr.length) { + existed = existed.concat(existedArr); + } + existed = intersect(files, existed); + hashes = names; + } + } + existed.length ? confirm(0) : paste(files); + }, + paste = function(selFiles) { + var renames = [], + files = $.grep(selFiles, function(file) { + if (file.rename) { + renames.push(file.name); + } + return !file.remove ? true : false; + }), + cnt = files.length, + groups = {}, + args = [], + targets, reqData; + + if (!cnt) { + return dfrd.resolve(); + } + + targets = $.map(files, function(f) { return f.hash; }); + + reqData = {cmd : 'paste', dst : dst.hash, targets : targets, cut : cut ? 1 : 0, renames : renames, hashes : hashes, suffix : fm.options.backupSuffix}; + if (fm.api < 2.1) { + reqData.src = files[0].phash; + } + + fm.request({ + data : reqData, + notify : {type : cmd, cnt : cnt}, + cancel : true, + navigate : { + toast : opts.noToast? {} : { + inbuffer : {msg: fm.i18n(['complete', fm.i18n('cmd' + cmd)]), action: { + cmd: 'open', + msg: 'cmdopendir', + data: [dst.hash], + done: 'select', + cwdNot: dst.hash + }} + } + } + }) + .done(function(data) { + var dsts = {}, + added = data.added && data.added.length? data.added : null; + if (cut && added) { + // undo/redo + $.each(files, function(i, f) { + var phash = f.phash, + srcHash = function(name) { + var hash; + $.each(added, function(i, f) { + if (f.name === name) { + hash = f.hash; + return false; + } + }); + return hash; + }, + shash = srcHash(f.name); + if (shash) { + if (dsts[phash]) { + dsts[phash].push(shash); + } else { + dsts[phash] = [ shash ]; + } + } + }); + if (Object.keys(dsts).length) { + data.undo = { + cmd : 'move', + callback : function() { + var reqs = []; + $.each(dsts, function(dst, targets) { + reqs.push(fm.request({ + data : {cmd : 'paste', dst : dst, targets : targets, cut : 1}, + notify : {type : 'undo', cnt : targets.length} + })); + }); + return $.when.apply(null, reqs); + } + }; + data.redo = { + cmd : 'move', + callback : function() { + return fm.request({ + data : reqData, + notify : {type : 'redo', cnt : cnt} + }); + } + }; + } + } + dfrd.resolve(data); + }) + .fail(function(flg) { + dfrd.reject(); + if (flg === 0) { + // canceling + fm.sync(); + } + }) + .always(function() { + fm.unlockfiles({files : files}); + }); + }, + internames; + + if (!fm.isCommandEnabled(self.name, dst.hash) || !files.length) { + return dfrd.resolve(); + } + + if (fm.oldAPI) { + paste(files); + } else { + + if (!fm.option('copyOverwrite', dst.hash)) { + paste(files); + } else { + internames = $.map(files, function(f) { return f.name; }); + dst.hash == fm.cwd().hash + ? valid($.map(fm.files(), function(file) { return file.phash == dst.hash ? {hash: file.hash, name: file.name} : null; })) + : fm.request({ + data : {cmd : 'ls', target : dst.hash, intersect : internames}, + notify : {type : 'prepare', cnt : 1, hideCnt : true}, + preventFail : true + }) + .always(function(data) { + valid(data.list); + }); + } + } + + return dfrd; + }, + parents, fparents, cutDfrd; + + + if (!cnt || !dst || dst.mime != 'directory') { + return dfrd.reject(); + } + + if (!dst.write) { + return dfrd.reject([error, files[0].name, 'errPerm']); + } + + parents = fm.parents(dst.hash); + + $.each(files, function(i, file) { + if (!file.read) { + return !dfrd.reject([error, file.name, 'errPerm']); + } + + if (cut && file.locked) { + return !dfrd.reject(['errLocked', file.name]); + } + + if ($.inArray(file.hash, parents) !== -1) { + return !dfrd.reject(['errCopyInItself', file.name]); + } + + if (file.mime && file.mime !== 'directory' && ! fm.uploadMimeCheck(file.mime, dst.hash)) { + return !dfrd.reject([error, file.name, 'errUploadMime']); + } + + fparents = fm.parents(file.hash); + fparents.pop(); + if ($.inArray(dst.hash, fparents) !== -1) { + + if ($.grep(fparents, function(h) { var d = fm.file(h); return d.phash == dst.hash && d.name == file.name ? true : false; }).length) { + return !dfrd.reject(['errReplByChild', file.name]); + } + } + + if (file.phash == dst.hash) { + fcopy.push(file.hash); + } else { + fpaste.push({ + hash : file.hash, + phash : file.phash, + name : file.name + }); + } + }); + + if (dfrd.state() === 'rejected') { + return dfrd; + } + + cutDfrd = $.Deferred(); + if (cut && self.options.moveConfirm) { + fm.confirm({ + title : 'moveFiles', + text : fm.i18n('confirmMove', dst.i18 || dst.name), + accept : { + label : 'btnYes', + callback : function() { + cutDfrd.resolve(); + } + }, + cancel : { + label : 'btnCancel', + callback : function() { + cutDfrd.reject(); + } + } + }); + } else { + cutDfrd.resolve(); + } + + cutDfrd.done(function() { + $.when( + copy(fcopy), + paste(fpaste) + ) + .done(function(cr, pr) { + dfrd.resolve(pr && pr.undo? pr : void(0)); + }) + .fail(function() { + dfrd.reject(); + }) + .always(function() { + cut && fm.clipboard([]); + }); + }).fail(function() { + dfrd.reject(); + }); + + return dfrd; + }; + +}; + + +/* + * File: /js/commands/places.js + */ + +/** + * @class elFinder command "places" + * Regist to Places + * + * @author Naoki Sawada + **/ +elFinder.prototype.commands.places = function() { + var self = this, + fm = this.fm, + filter = function(hashes) { + var fres = true; + return $.grep(self.files(hashes), function(f) { + fres = fres && f.mime == 'directory' ? true : false; + return fres; + }); + }, + places = null; + + this.getstate = function(select) { + var sel = this.hashes(select), + cnt = sel.length; + + return places && cnt && cnt == filter(sel).length ? 0 : -1; + }; + + this.exec = function(hashes) { + var files = this.files(hashes); + places.trigger('regist', [ files ]); + return $.Deferred().resolve(); + }; + + fm.one('load', function(){ + places = fm.ui.places; + }); + +}; + + +/* + * File: /js/commands/preference.js + */ + +/** + * @class elFinder command "preference" + * "Preference" dialog + * + * @author Naoki Sawada + **/ +elFinder.prototype.commands.preference = function() { + var self = this, + fm = this.fm, + r = 'replace', + tab = '
    • {title}
    • ', + base = $('
      '), + ul = $('
        '), + tabs = $('
        '), + sep = '
        ', + selfUrl = $('base').length? document.location.href.replace(/#.*$/, '') : '', + selectTab = function(tab) { + $('#'+fm.namespace+'-preference-tab-'+tab).trigger('mouseover').trigger('click'); + openTab = tab; + }, + clTabActive = fm.res('class', 'tabsactive'), + build = function() { + var cats = self.options.categories || { + 'language' : ['language'], + 'theme' : ['theme'], + 'toolbar' : ['toolbarPref'], + 'workspace' : ['iconSize','columnPref', 'selectAction', 'makefileTypes', 'useStoredEditor', 'editorMaximized', 'useFullscreen', 'showHidden'], + 'dialog' : ['autoFocusDialog'], + 'selectionInfo' : ['infoItems', 'hashChecker'], + 'reset' : ['clearBrowserData'], + 'all' : true + }, + forms = self.options.prefs || ['language', 'theme', 'toolbarPref', 'iconSize', 'columnPref', 'selectAction', 'makefileTypes', 'useStoredEditor', 'editorMaximized', 'useFullscreen', 'showHidden', 'infoItems', 'hashChecker', 'autoFocusDialog', 'clearBrowserData']; + + if (!fm.cookieEnabled) { + delete cats.language; + } + + forms = fm.arrayFlip(forms, true); + + if (fm.options.getFileCallback) { + delete forms.selectAction; + } + if (!fm.UA.Fullscreen) { + delete forms.useFullscreen; + } + + forms.language && (forms.language = (function() { + var langSel = $('').on('change', function() { + var lang = $(this).val(); + fm.storage('lang', lang); + $('#'+fm.id).elfinder('reload'); + }), + optTags = [], + langs = self.options.langs || { + ar: 'العربية', + bg: 'Български', + ca: 'Català', + cs: 'Čeština', + da: 'Dansk', + de: 'Deutsch', + el: 'Ελληνικά', + en: 'English', + es: 'Español', + fa: 'فارسی', + fo: 'Føroyskt', + fr: 'Français', + fr_CA: 'Français (Canada)', + he: 'עברית', + hr: 'Hrvatski', + hu: 'Magyar', + id: 'Bahasa Indonesia', + it: 'Italiano', + ja: '日本語', + ko: '한국어', + nl: 'Nederlands', + no: 'Norsk', + pl: 'Polski', + pt_BR: 'Português', + ro: 'Română', + ru: 'Pусский', + si: 'සිංහල', + sk: 'Slovenčina', + sl: 'Slovenščina', + sr: 'Srpski', + sv: 'Svenska', + tr: 'Türkçe', + ug_CN: 'ئۇيغۇرچە', + uk: 'Український', + vi: 'Tiếng Việt', + zh_CN: '简体中文', + zh_TW: '正體中文' + }; + if (!fm.cookieEnabled) { + return $(); + } + $.each(langs, function(lang, name) { + optTags.push(''); + }); + return langSel.append(optTags.join('')).val(fm.lang); + })()); + + forms.theme && (forms.theme = (function() { + var cnt = fm.options.themes? Object.keys(fm.options.themes).length : 0; + if (cnt === 0 || (cnt === 1 && fm.options.themes.default)) { + return null; + } + var themeSel = $('').on('change', function() { + var theme = $(this).val(); + fm.changeTheme(theme).storage('theme', theme); + }), + optTags = [], + tpl = { + image: '', + link: '$2', + data: '
        $1
        $2
        ' + }, + items = ['image', 'description', 'author', 'email', 'license'], + render = function(key, data) { + }, + defBtn = $('').text(fm.i18n('default')).on('click', function(e) { + themeSel.val('default').trigger('change'); + }), + list = $('
        ').on('click', 'button', function() { + var val = $(this).data('themeid'); + themeSel.val(val).trigger('change'); + }); + + if (!fm.options.themes.default) { + themeSel.append(''); + } + $.each(fm.options.themes, function(id, val) { + var opt = $(''), + dsc = $('
        '+fm.i18n(id)+'
        '), + tm; + themeSel.append(opt); + list.append(dsc); + tm = setTimeout(function() { + dsc.find('span.elfinder-spinner').replaceWith(fm.i18n(['errRead', id])); + }, 10000); + fm.getTheme(id).always(function() { + tm && clearTimeout(tm); + }).done(function(data) { + var link, val = $(), dl = $('
        '); + link = data.link? tpl.link.replace(/\$1/g, data.link).replace(/\$3/g, fm.i18n('website')) : '$2'; + if (data.name) { + opt.html(fm.i18n(data.name)); + } + dsc.children('legend').html(link.replace(/\$2/g, fm.i18n(data.name) || id)); + $.each(items, function(i, key) { + var t = tpl[key] || tpl.data, + elm; + if (data[key]) { + elm = t.replace(/\$0/g, fm.escape(key)).replace(/\$1/g, fm.i18n(key)).replace(/\$2/g, fm.i18n(data[key])); + if (key === 'image' && data.link) { + elm = $(elm).on('click', function() { + themeSel.val(id).trigger('change'); + }).attr('title', fm.i18n('select')); + } + dl.append(elm); + } + }); + val = val.add(dl); + val = val.add($('
        ').append($('').data('themeid', id).html(fm.i18n('select')))); + dsc.find('span.elfinder-spinner').replaceWith(val); + }).fail(function() { + dsc.find('span.elfinder-spinner').replaceWith(fm.i18n(['errRead', id])); + }); + }); + return $('
        ').append(themeSel.val(fm.theme && fm.theme.id? fm.theme.id : 'default'), defBtn, list); + })()); + + forms.toolbarPref && (forms.toolbarPref = (function() { + var pnls = $.map(fm.options.uiOptions.toolbar, function(v) { + return $.isArray(v)? v : null; + }), + tags = [], + hides = fm.storage('toolbarhides') || {}; + $.each(pnls, function() { + var cmd = this, + name = fm.i18n('cmd'+cmd); + if (name === 'cmd'+cmd) { + name = fm.i18n(cmd); + } + tags.push(''); + }); + return $(tags.join(' ')).on('change', 'input', function() { + var v = $(this).val(), + o = $(this).is(':checked'); + if (!o && !hides[v]) { + hides[v] = true; + } else if (o && hides[v]) { + delete hides[v]; + } + fm.storage('toolbarhides', hides); + fm.trigger('toolbarpref'); + }); + })()); + + forms.iconSize && (forms.iconSize = (function() { + var max = fm.options.uiOptions.cwd.iconsView.sizeMax || 3, + size = fm.storage('iconsize') || fm.options.uiOptions.cwd.iconsView.size || 0, + sld = $('
        ').slider({ + classes: { + 'ui-slider-handle': 'elfinder-tabstop', + }, + value: size, + max: max, + slide: function(e, ui) { + fm.getUI('cwd').trigger('iconpref', {size: ui.value}); + }, + change: function(e, ui) { + fm.storage('iconsize', ui.value); + } + }); + fm.getUI('cwd').on('iconpref', function(e, data) { + sld.slider('option', 'value', data.size); + }); + return sld; + })()); + + forms.columnPref && (forms.columnPref = (function() { + var cols = fm.options.uiOptions.cwd.listView.columns, + tags = [], + hides = fm.storage('columnhides') || {}; + $.each(cols, function() { + var key = this, + name = fm.getColumnName(key); + tags.push(''); + }); + return $(tags.join(' ')).on('change', 'input', function() { + var v = $(this).val(), + o = $(this).is(':checked'); + if (!o && !hides[v]) { + hides[v] = true; + } else if (o && hides[v]) { + delete hides[v]; + } + fm.storage('columnhides', hides); + fm.trigger('columnpref', { repaint: true }); + }); + })()); + + forms.selectAction && (forms.selectAction = (function() { + var actSel = $('').on('change', function() { + var act = $(this).val(); + fm.storage('selectAction', act === 'default'? null : act); + }), + optTags = [], + acts = self.options.selectActions, + defAct = fm.getCommand('open').options.selectAction || 'open'; + + if ($.inArray(defAct, acts) === -1) { + acts.unshift(defAct); + } + $.each(acts, function(i, act) { + var names = $.map(act.split('/'), function(cmd) { + var name = fm.i18n('cmd'+cmd); + if (name === 'cmd'+cmd) { + name = fm.i18n(cmd); + } + return name; + }); + optTags.push(''); + }); + return actSel.append(optTags.join('')).val(fm.storage('selectAction') || defAct); + })()); + + forms.makefileTypes && (forms.makefileTypes = (function() { + var hides = fm.getCommand('edit').getMkfileHides(), + getTag = function() { + var tags = []; + // re-assign hides + hides = fm.getCommand('edit').getMkfileHides(); + $.each(fm.mimesCanMakeEmpty, function(mime, type) { + var name = fm.getCommand('mkfile').getTypeName(mime, type); + tags.push(''); + }); + return tags.join(' '); + }, + elm = $('
        ').on('change', 'input', function() { + var v = $(this).val(), + o = $(this).is(':checked'); + if (!o && !hides[v]) { + hides[v] = true; + } else if (o && hides[v]) { + delete hides[v]; + } + fm.storage('mkfileHides', hides); + fm.trigger('canMakeEmptyFile'); + }).append(getTag()), + add = $('
        ').append( + $('').on('keydown', function(e) { + (e.keyCode === $.ui.keyCode.ENTER) && $(this).next().trigger('click'); + }), + $('').html(fm.i18n('add')).on('click', function() { + var input = $(this).prev(), + val = input.val(), + uiToast = fm.getUI('toast'), + err = function() { + uiToast.appendTo(input.closest('.ui-dialog')); + fm.toast({ + msg: fm.i18n('errUsupportType'), + mode: 'warning', + onHidden: function() { + uiToast.children().length === 1 && uiToast.appendTo(fm.getUI()); + } + }); + input.trigger('focus'); + return false; + }, + tmpMimes; + if (!val.match(/\//)) { + val = fm.arrayFlip(fm.mimeTypes)[val]; + if (!val) { + return err(); + } + input.val(val); + } + if (!fm.mimeIsText(val) || !fm.mimeTypes[val]) { + return err(); + } + fm.trigger('canMakeEmptyFile', {mimes: [val], unshift: true}); + tmpMimes = {}; + tmpMimes[val] = fm.mimeTypes[val]; + fm.storage('mkfileTextMimes', Object.assign(tmpMimes, fm.storage('mkfileTextMimes') || {})); + input.val(''); + uiToast.appendTo(input.closest('.ui-dialog')); + fm.toast({ + msg: fm.i18n(['complete', val + ' (' + tmpMimes[val] + ')']), + onHidden: function() { + uiToast.children().length === 1 && uiToast.appendTo(fm.getUI()); + } + }); + }), + $('').html(fm.i18n('reset')).on('click', function() { + fm.one('canMakeEmptyFile', {done: function() { + elm.empty().append(getTag()); + }}); + fm.trigger('canMakeEmptyFile', {resetTexts: true}); + }) + ), + tm; + fm.bind('canMakeEmptyFile', {done: function(e) { + if (e.data && e.data.mimes && e.data.mimes.length) { + elm.empty().append(getTag()); + } + }}); + return $('
        ').append(elm, add); + })()); + + forms.useStoredEditor && (forms.useStoredEditor = $('').prop('checked', (function() { + var s = fm.storage('useStoredEditor'); + return s? (s > 0) : fm.options.commandsOptions.edit.useStoredEditor; + })()).on('change', function(e) { + fm.storage('useStoredEditor', $(this).is(':checked')? 1 : -1); + })); + + forms.editorMaximized && (forms.editorMaximized = $('').prop('checked', (function() { + var s = fm.storage('editorMaximized'); + return s? (s > 0) : fm.options.commandsOptions.edit.editorMaximized; + })()).on('change', function(e) { + fm.storage('editorMaximized', $(this).is(':checked')? 1 : -1); + })); + + forms.useFullscreen && (forms.useFullscreen = $('').prop('checked', (function() { + var s = fm.storage('useFullscreen'); + return s? (s > 0) : fm.options.commandsOptions.fullscreen.mode === 'screen'; + })()).on('change', function(e) { + fm.storage('useFullscreen', $(this).is(':checked')? 1 : -1); + })); + + if (forms.showHidden) { + (function() { + var setTitle = function() { + var s = fm.storage('hide'), + t = [], + v; + if (s && s.items) { + $.each(s.items, function(h, n) { + t.push(fm.escape(n)); + }); + } + elms.prop('disabled', !t.length)[t.length? 'removeClass' : 'addClass']('ui-state-disabled'); + v = t.length? t.join('\n') : ''; + forms.showHidden.attr('title',v); + useTooltip && forms.showHidden.tooltip('option', 'content', v.replace(/\n/g, '
        ')).tooltip('close'); + }, + chk = $('').prop('checked', (function() { + var s = fm.storage('hide'); + return s && s.show; + })()).on('change', function(e) { + var o = {}; + o[$(this).is(':checked')? 'show' : 'hide'] = true; + fm.exec('hide', void(0), o); + }), + btn = $('').append(fm.i18n('reset')).on('click', function() { + fm.exec('hide', void(0), {reset: true}); + $(this).parent().find('input:first').prop('checked', false); + setTitle(); + }), + elms = $().add(chk).add(btn), + useTooltip; + + forms.showHidden = $('
        ').append(chk, btn); + fm.bind('hide', function(e) { + var d = e.data; + if (!d.opts || (!d.opts.show && !d.opts.hide)) { + setTitle(); + } + }); + if (fm.UA.Mobile && $.fn.tooltip) { + useTooltip = true; + forms.showHidden.tooltip({ + classes: { + 'ui-tooltip': 'elfinder-ui-tooltip ui-widget-shadow' + }, + tooltipClass: 'elfinder-ui-tooltip ui-widget-shadow', + track: true + }).css('user-select', 'none'); + btn.css('user-select', 'none'); + } + setTitle(); + })(); + } + + forms.infoItems && (forms.infoItems = (function() { + var items = fm.getCommand('info').items, + tags = [], + hides = fm.storage('infohides') || fm.arrayFlip(fm.options.commandsOptions.info.hideItems, true); + $.each(items, function() { + var key = this, + name = fm.i18n(key); + tags.push(''); + }); + return $(tags.join(' ')).on('change', 'input', function() { + var v = $(this).val(), + o = $(this).is(':checked'); + if (!o && !hides[v]) { + hides[v] = true; + } else if (o && hides[v]) { + delete hides[v]; + } + fm.storage('infohides', hides); + fm.trigger('infopref', { repaint: true }); + }); + })()); + + forms.hashChecker && fm.hashCheckers.length && (forms.hashChecker = (function() { + var tags = [], + enabled = fm.arrayFlip(fm.storage('hashchekcer') || fm.options.commandsOptions.info.showHashAlgorisms, true); + $.each(fm.hashCheckers, function() { + var cmd = this, + name = fm.i18n(cmd); + tags.push(''); + }); + return $(tags.join(' ')).on('change', 'input', function() { + var v = $(this).val(), + o = $(this).is(':checked'); + if (o) { + enabled[v] = true; + } else if (enabled[v]) { + delete enabled[v]; + } + fm.storage('hashchekcer', $.grep(fm.hashCheckers, function(v) { + return enabled[v]; + })); + }); + })()); + + forms.autoFocusDialog && (forms.autoFocusDialog = $('').prop('checked', (function() { + var s = fm.storage('autoFocusDialog'); + return s? (s > 0) : fm.options.uiOptions.dialog.focusOnMouseOver; + })()).on('change', function(e) { + fm.storage('autoFocusDialog', $(this).is(':checked')? 1 : -1); + })); + + forms.clearBrowserData && (forms.clearBrowserData = $('').text(fm.i18n('reset')).button().on('click', function(e) { + e.preventDefault(); + fm.storage(); + $('#'+fm.id).elfinder('reload'); + })); + + $.each(cats, function(id, prefs) { + var dls, found; + if (prefs === true) { + found = 1; + } else if (prefs) { + dls = $(); + $.each(prefs, function(i, n) { + var f, title, chks = '', cbox; + if (f = forms[n]) { + found = 2; + title = fm.i18n(n); + cbox = $(f).filter('input[type="checkbox"]'); + if (!cbox.length) { + cbox = $(f).find('input[type="checkbox"]'); + } + if (cbox.length === 1) { + if (!cbox.attr('id')) { + cbox.attr('id', 'elfinder-preference-'+n+'-checkbox'); + } + title = ''; + } else if (cbox.length > 1) { + chks = ' elfinder-preference-checkboxes'; + } + dls = dls.add($('
        '+title+'
        ')).add($('
        ').append(f)); + } + }); + } + if (found) { + ul.append(tab[r](/\{id\}/g, id)[r](/\{title\}/, fm.i18n(id))[r](/\{class\}/, openTab === id? 'elfinder-focus' : '')); + if (found === 2) { + tabs.append( + $('
        ') + .hide() + .append($('
        ').append(dls)) + ); + } + } + }); + + ul.on('click', 'a', function(e) { + var t = $(e.target), + h = t.attr('href'); + e.preventDefault(); + e.stopPropagation(); + + ul.children().removeClass(clTabActive); + t.removeClass('ui-state-hover').parent().addClass(clTabActive); + + if (h.match(/all$/)) { + tabs.addClass('elfinder-preference-taball').children().show(); + } else { + tabs.removeClass('elfinder-preference-taball').children().hide(); + $(h).show(); + } + }).on('focus blur', 'a', function(e) { + $(this).parent().toggleClass('ui-state-focus', e.type === 'focusin'); + }).on('mouseenter mouseleave', 'li', function(e) { + $(this).toggleClass('ui-state-hover', e.type === 'mouseenter'); + }); + + tabs.find('a,input,select,button').addClass('elfinder-tabstop'); + base.append(ul, tabs); + + dialog = self.fmDialog(base, { + title : self.title, + width : self.options.width || 600, + height: self.options.height || 400, + maxWidth: 'window', + maxHeight: 'window', + autoOpen : false, + destroyOnClose : false, + allowMinimize : false, + open : function() { + openTab && selectTab(openTab); + openTab = null; + }, + resize : function() { + tabs.height(dialog.height() - ul.outerHeight(true) - (tabs.outerHeight(true) - tabs.height()) - 5); + } + }) + .on('click', function(e) { + e.stopPropagation(); + }) + .css({ + overflow: 'hidden' + }); + + dialog.closest('.ui-dialog') + .css({ + overflow: 'hidden' + }) + .addClass('elfinder-bg-translucent'); + + openTab = 'all'; + }, + dialog, openTab; + + this.shortcuts = [{ + pattern : 'ctrl+comma', + description : this.title + }]; + + this.alwaysEnabled = true; + + this.getstate = function() { + return 0; + }; + + this.exec = function(sel, cOpts) { + !dialog && build(); + if (cOpts) { + if (cOpts.tab) { + selectTab(cOpts.tab); + } else if (cOpts._currentType === 'cwd') { + selectTab('workspace'); + } + } + dialog.elfinderdialog('open'); + return $.Deferred().resolve(); + }; + +}; + +/* + * File: /js/commands/quicklook.js + */ + +/** + * @class elFinder command "quicklook" + * Fast preview for some files types + * + * @author Dmitry (dio) Levashov + **/ +(elFinder.prototype.commands.quicklook = function() { + var self = this, + fm = self.fm, + /** + * window closed state + * + * @type Number + **/ + closed = 0, + /** + * window animated state + * + * @type Number + **/ + animated = 1, + /** + * window opened state + * + * @type Number + **/ + opened = 2, + /** + * window docked state + * + * @type Number + **/ + docked = 3, + /** + * window docked and hidden state + * + * @type Number + **/ + dockedhidden = 4, + /** + * window state + * + * @type Number + **/ + state = closed, + /** + * Event name of update + * for fix conflicts with Prototype.JS + * + * `@see https://github.com/Studio-42/elFinder/pull/2346 + * @type String + **/ + evUpdate = Element.update? 'quicklookupdate' : 'update', + /** + * navbar icon class + * + * @type String + **/ + navicon = 'elfinder-quicklook-navbar-icon', + /** + * navbar "fullscreen" icon class + * + * @type String + **/ + fullscreen = 'elfinder-quicklook-fullscreen', + /** + * info wrapper class + * + * @type String + */ + infocls = 'elfinder-quicklook-info-wrapper', + /** + * Triger keydown/keypress event with left/right arrow key code + * + * @param Number left/right arrow key code + * @return void + **/ + navtrigger = function(code) { + $(document).trigger($.Event('keydown', { keyCode: code, ctrlKey : false, shiftKey : false, altKey : false, metaKey : false })); + }, + /** + * Return css for closed window + * + * @param jQuery file node in cwd + * @return void + **/ + closedCss = function(node) { + var elf = fm.getUI().offset(), + base = (function() { + var target = node.find('.elfinder-cwd-file-wrapper'); + return target.length? target : node; + })(), + baseOffset = base.offset() || { top: 0, left: 0 }; + return { + opacity : 0, + width : base.width(), + height : base.height() - 30, + top : baseOffset.top - elf.top, + left : baseOffset.left - elf.left + }; + }, + /** + * Return css for opened window + * + * @return void + **/ + openedCss = function() { + var contain = self.options.contain || fm.options.dialogContained, + win = contain? fm.getUI() : $(window), + elf = fm.getUI().offset(), + w = Math.min(width, win.width()-10), + h = Math.min(height, win.height()-80); + return { + opacity : 1, + width : w, + height : h, + top : parseInt((win.height() - h - 60) / 2 + (contain? 0 : win.scrollTop() - elf.top)), + left : parseInt((win.width() - w) / 2 + (contain? 0 : win.scrollLeft() - elf.left)) + }; + }, + + mediaNode = {}, + support = function(codec, name) { + var node = name || codec.substr(0, codec.indexOf('/')), + media = mediaNode[node]? mediaNode[node] : (mediaNode[node] = document.createElement(node)), + value = false; + + try { + value = media.canPlayType && media.canPlayType(codec); + } catch(e) {} + + return (value && value !== '' && value != 'no')? true : false; + }, + + platformWin = (window.navigator.platform.indexOf('Win') != -1), + + /** + * Opened window width (from config) + * + * @type Number + **/ + width, + /** + * Opened window height (from config) + * + * @type Number + **/ + height, + /** + * Previous style before docked + * + * @type String + **/ + prevStyle, + /** + * elFinder node + * + * @type jQuery + **/ + parent, + /** + * elFinder current directory node + * + * @type jQuery + **/ + cwd, + /** + * Current directory hash + * + * @type String + **/ + cwdHash, + dockEnabled = false, + navdrag = false, + navmove = false, + navtm = null, + leftKey = $.ui.keyCode.LEFT, + rightKey = $.ui.keyCode.RIGHT, + coverEv = 'mousemove touchstart ' + ('onwheel' in document? 'wheel' : 'onmousewheel' in document? 'mousewheel' : 'DOMMouseScroll'), + title = $(''), + icon = $('
        '), + info = $('
        '),//.hide(), + cover = $('
        '), + fsicon = $('
        ') + .on('click touchstart', function(e) { + if (navmove) { + return; + } + + var win = self.window, + full = win.hasClass(fullscreen), + $window = $(window), + resize = function() { self.preview.trigger('changesize'); }; + + e.stopPropagation(); + e.preventDefault(); + + if (full) { + navStyle = ''; + navShow(); + win.toggleClass(fullscreen) + .css(win.data('position')); + $window.trigger(self.resize).off(self.resize, resize); + navbar.off('mouseenter mouseleave'); + cover.off(coverEv); + } else { + win.toggleClass(fullscreen) + .data('position', { + left : win.css('left'), + top : win.css('top'), + width : win.width(), + height : win.height(), + display: 'block' + }) + .removeAttr('style'); + + $(window).on(self.resize, resize) + .trigger(self.resize); + + cover.on(coverEv, function(e) { + if (! navdrag) { + if (e.type === 'mousemove' || e.type === 'touchstart') { + navShow(); + navtm = setTimeout(function() { + if (fm.UA.Mobile || navbar.parent().find('.elfinder-quicklook-navbar:hover').length < 1) { + navbar.fadeOut('slow', function() { + cover.show(); + }); + } + }, 3000); + } + if (cover.is(':visible')) { + coverHide(); + cover.data('tm', setTimeout(function() { + cover.show(); + }, 3000)); + } + } + }).show().trigger('mousemove'); + + navbar.on('mouseenter mouseleave', function(e) { + if (! navdrag) { + if (e.type === 'mouseenter') { + navShow(); + } else { + cover.trigger('mousemove'); + } + } + }); + } + if (fm.zIndex) { + win.css('z-index', fm.zIndex + 1); + } + if (fm.UA.Mobile) { + navbar.attr('style', navStyle); + } else { + navbar.attr('style', navStyle).draggable(full ? 'destroy' : { + start: function() { + navdrag = true; + navmove = true; + cover.show(); + navShow(); + }, + stop: function() { + navdrag = false; + navStyle = self.navbar.attr('style'); + requestAnimationFrame(function() { + navmove = false; + }); + } + }); + } + $(this).toggleClass(navicon+'-fullscreen-off'); + var collection = win; + if (parent.is('.ui-resizable')) { + collection = collection.add(parent); + } + collection.resizable(full ? 'enable' : 'disable').removeClass('ui-state-disabled'); + + win.trigger('viewchange'); + } + ), + + updateOnSel = function() { + self.update(void(0), (function() { + var fm = self.fm, + files = fm.selectedFiles(), + cnt = files.length, + inDock = self.docked(), + getInfo = function() { + var ts = 0; + $.each(files, function(i, f) { + var t = parseInt(f.ts); + if (ts >= 0) { + if (t > ts) { + ts = t; + } + } else { + ts = 'unknown'; + } + }); + return { + hash : files[0].hash + '/' + (+new Date()), + name : fm.i18n('items') + ': ' + cnt, + mime : 'group', + size : spinner, + ts : ts, + files : $.map(files, function(f) { return f.hash; }), + getSize : true + }; + }; + if (! cnt) { + cnt = 1; + files = [fm.cwd()]; + } + return (cnt === 1)? files[0] : getInfo(); + })()); + }, + + navShow = function() { + if (self.window.hasClass(fullscreen)) { + navtm && clearTimeout(navtm); + navtm = null; + // if use `show()` it make infinite loop with old jQuery (jQuery/jQuery UI: 1.8.0/1.9.0) + // see #1478 https://github.com/Studio-42/elFinder/issues/1478 + navbar.stop(true, true).css('display', 'block'); + coverHide(); + } + }, + + coverHide = function() { + cover.data('tm') && clearTimeout(cover.data('tm')); + cover.removeData('tm'); + cover.hide(); + }, + + prev = $('
        ').on('click touchstart', function(e) { ! navmove && navtrigger(leftKey); return false; }), + next = $('
        ').on('click touchstart', function(e) { ! navmove && navtrigger(rightKey); return false; }), + navbar = $('
        ') + .append(prev) + .append(fsicon) + .append(next) + .append('
        ') + .append($('
        ').on('click touchstart', function(e) { ! navmove && self.window.trigger('close'); return false; })) + , + titleClose = $('').on('mousedown', function(e) { + e.stopPropagation(); + self.window.trigger('close'); + }), + titleDock = $('').on('mousedown', function(e) { + e.stopPropagation(); + if (! self.docked()) { + self.window.trigger('navdockin'); + } else { + self.window.trigger('navdockout'); + } + }), + spinner = '' + fm.i18n('calc') + '' + '', + navStyle = '', + init = true, + dockHeight, getSize, tm4cwd, dockedNode, selectTm; + + /** + * Any flags for each plugin + */ + this.flags = {}; + + this.cover = cover; + this.evUpdate = evUpdate; + (this.navbar = navbar)._show = navShow; + this.resize = 'resize.'+fm.namespace; + this.info = $('
        ').addClass(infocls) + .append(icon) + .append(info); + this.autoPlay = function() { + if (self.opened()) { + return !! self.options[self.docked()? 'dockAutoplay' : 'autoplay']; + } + return false; + }; + this.preview = $('
        ') + // clean info/icon + .on('change', function() { + navShow(); + navbar.attr('style', navStyle); + self.docked() && navbar.hide(); + self.preview.attr('style', '').removeClass('elfinder-overflow-auto'); + self.info.attr('style', '').hide(); + self.cover.removeClass('elfinder-quicklook-coverbg'); + icon.removeAttr('class').attr('style', ''); + info.html(''); + }) + // update info/icon + .on(evUpdate, function(e) { + var preview = self.preview, + file = e.file, + tpl = '
        {value}
        ', + update = function() { + var win = self.window.css('overflow', 'hidden'); + name = fm.escape(file.i18 || file.name); + !file.read && e.stopImmediatePropagation(); + self.window.data('hash', file.hash); + self.preview.off('changesize').trigger('change').children().remove(); + title.html(name); + + prev.css('visibility', ''); + next.css('visibility', ''); + if (file.hash === fm.cwdId2Hash(cwd.find('[id]:not(.elfinder-cwd-parent):first').attr('id'))) { + prev.css('visibility', 'hidden'); + } + if (file.hash === fm.cwdId2Hash(cwd.find('[id]:last').attr('id'))) { + next.css('visibility', 'hidden'); + } + + if (file.mime === 'directory') { + getSizeHashes = [ file.hash ]; + } else if (file.mime === 'group' && file.getSize) { + getSizeHashes = file.files; + } + + info.html( + tpl.replace(/\{value\}/, name) + + tpl.replace(/\{value\}/, fm.mime2kind(file)) + + tpl.replace(/\{value\}/, getSizeHashes.length ? spinner : fm.formatSize(file.size)) + + tpl.replace(/\{value\}/, fm.i18n('modify')+': '+ fm.formatDate(file)) + ); + + if (getSizeHashes.length) { + getSize = fm.getSize(getSizeHashes).done(function(data) { + info.find('span.elfinder-spinner').parent().html(data.formated); + }).fail(function() { + info.find('span.elfinder-spinner').parent().html(fm.i18n('unknown')); + }).always(function() { + getSize = null; + }); + getSize._hash = file.hash; + } + + icon.addClass('elfinder-cwd-icon ui-corner-all '+fm.mime2class(file.mime)); + + if (file.icon) { + icon.css(fm.getIconStyle(file, true)); + } + + self.info.attr('class', infocls); + if (file.csscls) { + self.info.addClass(file.csscls); + } + + if (file.read && (tmb = fm.tmb(file))) { + $('') + .hide() + .appendTo(self.preview) + .on('load', function() { + icon.addClass(tmb.className).css('background-image', "url('"+tmb.url+"')"); + $(this).remove(); + }) + .attr('src', tmb.url); + } + self.info.delay(100).fadeIn(10); + if (self.window.hasClass(fullscreen)) { + cover.trigger('mousemove'); + } + win.css('overflow', ''); + }, + tmb, name, getSizeHashes = []; + + if (file && ! Object.keys(file).length) { + file = fm.cwd(); + } + if (file && getSize && getSize.state() === 'pending' && getSize._hash !== file.hash) { + getSize.reject(); + } + if (file && (e.forceUpdate || self.window.data('hash') !== file.hash)) { + update(); + } else { + e.stopImmediatePropagation(); + } + }); + + this.window = $('
        ') + .hide() + .addClass(fm.UA.Touch? 'elfinder-touch' : '') + .on('click', function(e) { + var win = this; + e.stopPropagation(); + if (state === opened) { + requestAnimationFrame(function() { + state === opened && fm.toFront(win); + }); + } + }) + .append( + $('
        ') + .append( + $('').append( + titleClose, titleDock + ), + title + ), + this.preview, + self.info.hide(), + cover.hide(), + navbar + ) + .draggable({handle : 'div.elfinder-quicklook-titlebar'}) + .on('open', function(e, clcss) { + var win = self.window, + file = self.value, + node = fm.getUI('cwd'), + open = function(status) { + state = status; + self.update(1, self.value); + self.change(); + win.trigger('resize.' + fm.namespace); + }; + + if (!init && state === closed) { + if (file && file.hash !== cwdHash) { + node = fm.cwdHash2Elm(file.hash.split('/', 2)[0]); + } + navStyle = ''; + navbar.attr('style', ''); + state = animated; + node.trigger('scrolltoview'); + coverHide(); + win.css(clcss || closedCss(node)) + .show() + .animate(openedCss(), 550, function() { + open(opened); + navShow(); + }); + fm.toFront(win); + } else if (state === dockedhidden) { + fm.getUI('navdock').data('addNode')(dockedNode); + open(docked); + self.preview.trigger('changesize'); + fm.storage('previewDocked', '1'); + if (fm.getUI('navdock').width() === 0) { + win.trigger('navdockout'); + } + } + }) + .on('close', function(e, dfd) { + var win = self.window, + preview = self.preview.trigger('change'), + file = self.value, + hash = (win.data('hash') || '').split('/', 2)[0], + close = function(status, winhide) { + state = status; + winhide && fm.toHide(win); + preview.children().remove(); + self.update(0, self.value); + win.data('hash', ''); + dfd && dfd.resolve(); + }, + node; + + if (self.opened()) { + getSize && getSize.state() === 'pending' && getSize.reject(); + if (! self.docked()) { + state = animated; + win.hasClass(fullscreen) && fsicon.click(); + (hash && (node = cwd.find('#'+hash)).length) + ? win.animate(closedCss(node), 500, function() { + preview.off('changesize'); + close(closed, true); + }) + : close(closed, true); + } else { + dockedNode = fm.getUI('navdock').data('removeNode')(self.window.attr('id'), 'detach'); + close(dockedhidden); + fm.storage('previewDocked', '2'); + } + } + }) + .on('navdockin', function(e, data) { + var w = self.window, + box = fm.getUI('navdock'), + height = dockHeight || box.width(), + opts = data || {}; + + if (init) { + opts.init = true; + } + state = docked; + prevStyle = w.attr('style'); + w.toggleClass('ui-front').removeClass('ui-widget').draggable('disable').resizable('disable').removeAttr('style').css({ + width: '100%', + height: height, + boxSizing: 'border-box', + paddingBottom: 0, + zIndex: 'unset' + }); + navbar.hide(); + titleDock.toggleClass('ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize'); + + fm.toHide(w, true); + box.data('addNode')(w, opts); + + self.preview.trigger('changesize'); + + fm.storage('previewDocked', '1'); + }) + .on('navdockout', function(e) { + var w = self.window, + box = fm.getUI('navdock'), + dfd = $.Deferred(), + clcss = closedCss(self.preview); + + dockHeight = w.outerHeight(); + box.data('removeNode')(w.attr('id'), fm.getUI()); + w.toggleClass('ui-front').addClass('ui-widget').draggable('enable').resizable('enable').attr('style', prevStyle); + titleDock.toggleClass('ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize'); + + state = closed; + w.trigger('open', clcss); + + fm.storage('previewDocked', '0'); + }) + .on('resize.' + fm.namespace, function() { + self.preview.trigger('changesize'); + }); + + /** + * This command cannot be disable by backend + * + * @type Boolean + **/ + this.alwaysEnabled = true; + + /** + * Selected file + * + * @type Object + **/ + this.value = null; + + this.handlers = { + // save selected file + select : function(e, d) { + selectTm && cancelAnimationFrame(selectTm); + if (! e.data || ! e.data.selected || ! e.data.selected.length) { + selectTm = requestAnimationFrame(function() { + self.opened() && updateOnSel(); + }); + } else { + self.opened() && updateOnSel(); + } + }, + error : function() { self.window.is(':visible') && self.window.trigger('close'); }, + 'searchshow searchhide' : function() { this.opened() && this.window.trigger('close'); }, + navbarshow : function() { + requestAnimationFrame(function() { + self.docked() && self.preview.trigger('changesize'); + }); + }, + destroy : function() { self.window.remove(); } + }; + + this.shortcuts = [{ + pattern : 'space' + }]; + + this.support = { + audio : { + ogg : support('audio/ogg;'), + webm: support('audio/webm;'), + mp3 : support('audio/mpeg;'), + wav : support('audio/wav;'), + m4a : support('audio/mp4;') || support('audio/x-m4a;') || support('audio/aac;'), + flac: support('audio/flac;'), + amr : support('audio/amr;') + }, + video : { + ogg : support('video/ogg;'), + webm : support('video/webm;'), + mp4 : support('video/mp4;'), + mkv : support('video/x-matroska;') || support('video/webm;'), + '3gp': support('video/3gpp;') || support('video/mp4;'), // try as mp4 + m3u8 : support('application/x-mpegURL', 'video') || support('application/vnd.apple.mpegURL', 'video'), + mpd : support('application/dash+xml', 'video') + } + }; + // for GC + mediaNode = {}; + + /** + * Return true if quickLoock window is hiddenReturn true if quickLoock window is visible and not animated + * + * @return Boolean + **/ + this.closed = function() { + return (state == closed || state == dockedhidden); + }; + + /** + * Return true if quickLoock window is visible and not animated + * + * @return Boolean + **/ + this.opened = function() { + return state == opened || state == docked; + }; + + /** + * Return true if quickLoock window is in NavDock + * + * @return Boolean + **/ + this.docked = function() { + return state == docked; + }; + + /** + * Adds an integration into help dialog. + * + * @param Object opts options + */ + this.addIntegration = function(opts) { + requestAnimationFrame(function() { + fm.trigger('helpIntegration', Object.assign({cmd: 'quicklook'}, opts)); + }); + }; + + /** + * Init command. + * Add default plugins and init other plugins + * + * @return Object + **/ + this.init = function() { + var o = this.options, + win = this.window, + preview = this.preview, + i, p, cwdDispInlineRegex; + + width = o.width > 0 ? parseInt(o.width) : 450; + height = o.height > 0 ? parseInt(o.height) : 300; + if (o.dockHeight !== 'auto') { + dockHeight = parseInt(o.dockHeight); + if (! dockHeight) { + dockHeight = void(0); + } + } + + fm.one('load', function() { + + dockEnabled = fm.getUI('navdock').data('dockEnabled'); + + ! dockEnabled && titleDock.hide(); + + parent = fm.getUI(); + cwd = fm.getUI('cwd'); + + if (fm.zIndex) { + win.css('z-index', fm.zIndex + 1); + } + + win.appendTo(parent); + + // close window on escape + $(document).on('keydown.'+fm.namespace, function(e) { + e.keyCode == $.ui.keyCode.ESCAPE && self.opened() && ! self.docked() && win.hasClass('elfinder-frontmost') && win.trigger('close'); + }); + + win.resizable({ + handles : 'se', + minWidth : 350, + minHeight : 120, + resize : function() { + // use another event to avoid recursion in fullscreen mode + // may be there is clever solution, but i cant find it :( + preview.trigger('changesize'); + } + }); + + self.change(function() { + if (self.opened()) { + if (self.value) { + if (self.value.tmb && self.value.tmb == 1) { + // try re-get file object + self.value = Object.assign({}, fm.file(self.value.hash)); + } + preview.trigger($.Event(evUpdate, {file : self.value})); + } + } + }); + + preview.on(evUpdate, function(e) { + var file, hash, serach; + + if (file = e.file) { + hash = file.hash; + serach = (fm.searchStatus.mixed && fm.searchStatus.state > 1); + + if (file.mime !== 'directory') { + if (parseInt(file.size) || file.mime.match(o.mimeRegexNotEmptyCheck)) { + // set current dispInlineRegex + self.dispInlineRegex = cwdDispInlineRegex; + if (serach || fm.optionsByHashes[hash]) { + try { + self.dispInlineRegex = new RegExp(fm.option('dispInlineRegex', hash), 'i'); + } catch(e) { + try { + self.dispInlineRegex = new RegExp(!fm.isRoot(file)? fm.option('dispInlineRegex', file.phash) : fm.options.dispInlineRegex, 'i'); + } catch(e) { + self.dispInlineRegex = /^$/; + } + } + } + } else { + // do not preview of file that size = 0 + e.stopImmediatePropagation(); + } + } else { + self.dispInlineRegex = /^$/; + } + + self.info.show(); + } else { + e.stopImmediatePropagation(); + } + }); + + $.each(fm.commands.quicklook.plugins || [], function(i, plugin) { + if (typeof(plugin) == 'function') { + new plugin(self); + } + }); + }).one('open', function() { + var dock = Number(fm.storage('previewDocked') || o.docked), + win; + if (dockEnabled && dock >= 1) { + win = self.window; + self.exec(); + win.trigger('navdockin', { init : true }); + if (dock === 2) { + win.trigger('close'); + } else { + self.update(void(0), fm.cwd()); + self.change(); + } + } + init = false; + }).bind('open', function() { + cwdHash = fm.cwd().hash; + self.value = fm.cwd(); + // set current volume dispInlineRegex + try { + cwdDispInlineRegex = new RegExp(fm.option('dispInlineRegex'), 'i'); + } catch(e) { + cwdDispInlineRegex = /^$/; + } + }).bind('change', function(e) { + if (e.data && e.data.changed && self.opened()) { + $.each(e.data.changed, function() { + if (self.window.data('hash') === this.hash) { + self.window.data('hash', null); + self.preview.trigger(evUpdate); + return false; + } + }); + } + }).bind('navdockresizestart navdockresizestop', function(e) { + cover[e.type === 'navdockresizestart'? 'show' : 'hide'](); + }); + }; + + this.getstate = function() { + return self.opened()? 1 : 0; + }; + + this.exec = function() { + self.closed() && updateOnSel(); + self.enabled() && self.window.trigger(self.opened() ? 'close' : 'open'); + return $.Deferred().resolve(); + }; + + this.hideinfo = function() { + this.info.stop(true, true).hide(); + }; + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/quicklook.plugins.js + */ + +elFinder.prototype.commands.quicklook.plugins = [ + + /** + * Images preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var mimes = ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp'], + getDimSize = ql.fm.returnBytes((ql.options.getDimThreshold || 0)), + preview = ql.preview, + WebP, flipMime; + + // webp support + WebP = new Image(); + WebP.onload = WebP.onerror = function() { + if (WebP.height == 2) { + mimes.push('image/webp'); + } + }; + WebP.src='data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'; + + // what kind of images we can display + $.each(navigator.mimeTypes, function(i, o) { + var mime = o.type; + + if (mime.indexOf('image/') === 0 && $.inArray(mime, mimes)) { + mimes.push(mime); + } + }); + + preview.on(ql.evUpdate, function(e) { + var fm = ql.fm, + file = e.file, + showed = false, + dimreq = null, + setdim = function(dim) { + var rfile = fm.file(file.hash); + rfile.width = dim[0]; + rfile.height = dim[1]; + }, + show = function() { + var elm, varelm, memSize, width, height, prop; + + dimreq && dimreq.state && dimreq.state() === 'pending' && dimreq.reject(); + if (showed) { + return; + } + showed = true; + + elm = img.get(0); + memSize = file.width && file.height? {w: file.width, h: file.height} : (elm.naturalWidth? null : {w: img.width(), h: img.height()}); + + memSize && img.removeAttr('width').removeAttr('height'); + + width = file.width || elm.naturalWidth || elm.width || img.width(); + height = file.height || elm.naturalHeight || elm.height || img.height(); + if (!file.width || !file.height) { + setdim([width, height]); + } + + memSize && img.width(memSize.w).height(memSize.h); + + prop = (width/height).toFixed(2); + preview.on('changesize', function() { + var pw = parseInt(preview.width()), + ph = parseInt(preview.height()), + w, h; + + if (prop < (pw/ph).toFixed(2)) { + h = ph; + w = Math.floor(h * prop); + } else { + w = pw; + h = Math.floor(w/prop); + } + img.width(w).height(h).css('margin-top', h < ph ? Math.floor((ph - h)/2) : 0); + + }) + .trigger('changesize'); + + //show image + img.fadeIn(100); + }, + hideInfo = function() { + loading.remove(); + // hide info/icon + ql.hideinfo(); + }, + url, img, loading, prog, m, opDfd; + + if (!flipMime) { + flipMime = fm.arrayFlip(mimes); + } + if (flipMime[file.mime] && ql.dispInlineRegex.test(file.mime)) { + // this is our file - stop event propagation + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + img = $('') + .hide() + .appendTo(preview) + .on('load', function() { + hideInfo(); + show(); + }) + .on('error', function() { + loading.remove(); + }); + opDfd = fm.openUrl(file.hash, false, function(url) { + img.attr('src', url); + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + + if (file.width && file.height) { + show(); + } else if (file.size > getDimSize) { + dimreq = fm.request({ + data : {cmd : 'dim', target : file.hash}, + preventDefault : true + }) + .done(function(data) { + if (data.dim) { + var dim = data.dim.split('x'); + file.width = dim[0]; + file.height = dim[1]; + setdim(dim); + show(); + } + }); + } + } + + }); + }, + + /** + * TIFF image preview + * + * @param object ql elFinder.commands.quicklook + */ + function(ql) { + var fm = ql.fm, + mime = 'image/tiff', + preview = ql.preview; + if (window.Worker && window.Uint8Array) { + preview.on(ql.evUpdate, function(e) { + var file = e.file, + err = function(e) { + wk && wk.terminate(); + loading.remove(); + fm.debug('error', e); + }, + setdim = function(dim) { + var rfile = fm.file(file.hash); + rfile.width = dim[0]; + rfile.height = dim[1]; + }, + loading, prog, url, base, wk, opDfd; + if (file.mime === mime) { + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + // stop loading on change file if not loaded yet + preview.one('change', function() { + wk && wk.terminate(); + loading.remove(); + }); + + opDfd = fm.getContents(file.hash, 'arraybuffer', { progressBar: prog }).done(function(data) { + if (data) { + base = $('
        ').css({width:'100%',height:'100%'}).hide().appendTo(preview); + try { + wk = fm.getWorker(); + wk.onmessage = function(res) { + var data = res.data, + cv, co, id, prop; + wk && wk.terminate(); + cv = document.createElement('canvas'); + co = cv.getContext('2d'); + cv.width = data.width; + cv.height = data.height; + id = co.createImageData(data.width, data.height); + (id).data.set(new Uint8Array(data.image)); + co.putImageData(id, 0, 0); + base.append(cv).show(); + loading.remove(); + prop = (data.width/data.height).toFixed(2); + preview.on('changesize', function() { + var pw = parseInt(preview.width()), + ph = parseInt(preview.height()), + w, h; + if (prop < (pw/ph).toFixed(2)) { + h = ph; + w = Math.floor(h * prop); + } else { + w = pw; + h = Math.floor(w/prop); + } + $(cv).width(w).height(h).css('margin-top', h < ph ? Math.floor((ph - h)/2) : 0); + }).trigger('changesize'); + if (!file.width || !file.height) { + setdim([data.width, data.height]); + } + ql.hideinfo(); + }; + wk.onerror = err; + wk.postMessage({ + scripts: [fm.options.cdns.tiff, fm.getWorkerUrl('quicklook.tiff.js')], + data: { data: data } + }); + } catch(e) { + err(e); + } + } else { + err(); + } + }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + }); + } + }, + + /** + * PSD(Adobe Photoshop data) preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mimes = fm.arrayFlip(['image/vnd.adobe.photoshop', 'image/x-photoshop']), + preview = ql.preview, + load = function(url, img, loading) { + try { + fm.replaceXhrSend(); + PSD.fromURL(url).then(function(psd) { + var prop; + img.attr('src', psd.image.toBase64()); + requestAnimationFrame(function() { + prop = (img.width()/img.height()).toFixed(2); + preview.on('changesize', function() { + var pw = parseInt(preview.width()), + ph = parseInt(preview.height()), + w, h; + + if (prop < (pw/ph).toFixed(2)) { + h = ph; + w = Math.floor(h * prop); + } else { + w = pw; + h = Math.floor(w/prop); + } + img.width(w).height(h).css('margin-top', h < ph ? Math.floor((ph - h)/2) : 0); + }).trigger('changesize'); + + loading.remove(); + // hide info/icon + ql.hideinfo(); + //show image + img.fadeIn(100); + }); + }, function() { + loading.remove(); + img.remove(); + }); + fm.restoreXhrSend(); + } catch(e) { + fm.restoreXhrSend(); + loading.remove(); + img.remove(); + } + }, + PSD; + + preview.on(ql.evUpdate, function(e) { + var file = e.file, + url, img, loading, prog, m, + _define, _require, opDfd; + + if (mimes[file.mime] && fm.options.cdns.psd && ! fm.UA.ltIE10 && ql.dispInlineRegex.test(file.mime)) { + // this is our file - stop event propagation + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + opDfd = fm.openUrl(file.hash, 'sameorigin', function(url) { + if (url) { + img = $('').hide().appendTo(preview); + if (PSD) { + load(url, img, loading); + } else { + _define = window.define; + _require = window.require; + window.require = null; + window.define = null; + fm.loadScript( + [ fm.options.cdns.psd ], + function() { + PSD = require('psd'); + _define? (window.define = _define) : (delete window.define); + _require? (window.require = _require) : (delete window.require); + load(url, img, loading); + } + ); + } + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + }); + }, + + /** + * HTML preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mimes = fm.arrayFlip(['text/html', 'application/xhtml+xml']), + preview = ql.preview; + + preview.on(ql.evUpdate, function(e) { + var file = e.file, jqxhr, loading, prog; + + if (mimes[file.mime] && ql.dispInlineRegex.test(file.mime) && (!ql.options.getSizeMax || file.size <= ql.options.getSizeMax)) { + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + // stop loading on change file if not loaded yet + preview.one('change', function() { + jqxhr.state() == 'pending' && jqxhr.reject(); + }).addClass('elfinder-overflow-auto'); + + jqxhr = fm.request({ + data : {cmd : 'get', target : file.hash, conv : 1, _t : file.ts}, + options : {type: 'get', cache : true}, + preventDefault : true, + progressBar : prog + }) + .done(function(data) { + ql.hideinfo(); + var doc = $('').appendTo(preview)[0].contentWindow.document; + doc.open(); + doc.write(data.content); + doc.close(); + }) + .always(function() { + loading.remove(); + }); + } + }); + }, + + /** + * MarkDown preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mimes = fm.arrayFlip(['text/x-markdown']), + preview = ql.preview, + marked = null, + show = function(data, loading) { + ql.hideinfo(); + var doc = $('').appendTo(preview)[0].contentWindow.document; + doc.open(); + doc.write((marked.parse || marked)(data.content)); + doc.close(); + loading.remove(); + }, + error = function(loading) { + marked = false; + loading.remove(); + }; + + preview.on(ql.evUpdate, function(e) { + var file = e.file, jqxhr, loading, prog; + + if (mimes[file.mime] && fm.options.cdns.marked && marked !== false && ql.dispInlineRegex.test(file.mime) && (!ql.options.getSizeMax || file.size <= ql.options.getSizeMax)) { + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + // stop loading on change file if not loaded yet + preview.one('change', function() { + jqxhr.state() == 'pending' && jqxhr.reject(); + }).addClass('elfinder-overflow-auto'); + + jqxhr = fm.request({ + data : {cmd : 'get', target : file.hash, conv : 1, _t : file.ts}, + options : {type: 'get', cache : true}, + preventDefault : true, + progressBar : prog + }) + .done(function(data) { + if (marked || window.marked) { + if (!marked) { + marked = window.marked; + } + show(data, loading); + } else { + fm.loadScript([fm.options.cdns.marked], + function(res) { + marked = res || window.marked || false; + delete window.marked; + if (marked) { + show(data, loading); + } else { + error(loading); + } + }, + { + tryRequire: true, + error: function() { + error(loading); + } + } + ); + } + }) + .fail(function() { + error(loading); + }); + } + }); + }, + + /** + * PDF/ODT/ODS/ODP preview with ViewerJS + * + * @param elFinder.commands.quicklook + */ + function(ql) { + if (ql.options.viewerjs) { + var fm = ql.fm, + preview = ql.preview, + opts = ql.options.viewerjs, + mimes = opts.url? fm.arrayFlip(opts.mimes || []) : [], + win = ql.window, + navi = ql.navbar, + setNavi = function() { + navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '30px' : ''); + }; + + if (opts.url) { + preview.on('update', function(e) { + var file = e.file, node, loading, prog, opDfd; + + if (mimes[file.mime] && (file.mime !== 'application/pdf' || !opts.pdfNative || !ql.flags.pdfNative)) { + e.stopImmediatePropagation(); + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + opDfd = fm.openUrl(file.hash, 'sameorigin', function(url) { + if (url) { + node = $('') + .css('background-color', 'transparent') + .on('load', function() { + ql.hideinfo(); + loading.remove(); + node.css('background-color', '#fff'); + }) + .on('error', function() { + loading.remove(); + node.remove(); + }) + .appendTo(preview) + .attr('src', opts.url + '#' + url); + + win.on('viewchange.viewerjs', setNavi); + setNavi(); + + preview.one('change', function() { + win.off('viewchange.viewerjs'); + loading.remove(); + node.off('load').remove(); + }); + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + }); + } + } + }, + + /** + * PDF preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mime = 'application/pdf', + preview = ql.preview, + active = false, + urlhash = '', + firefox, toolbar; + + if ((fm.UA.Safari && fm.OS === 'mac' && !fm.UA.iOS) || fm.UA.IE || fm.UA.Firefox) { + active = true; + } else { + $.each(navigator.plugins, function(i, plugins) { + $.each(plugins, function(i, plugin) { + if (plugin.type === mime) { + return !(active = true); + } + }); + }); + } + + ql.flags.pdfNative = active; + if (active) { + if (typeof ql.options.pdfToolbar !== 'undefined' && !ql.options.pdfToolbar) { + urlhash = '#toolbar=0'; + } + preview.on(ql.evUpdate, function(e) { + var file = e.file, + opDfd; + + if (active && file.mime === mime && ql.dispInlineRegex.test(file.mime)) { + e.stopImmediatePropagation(); + opDfd = fm.openUrl(file.hash, false, function(url) { + if (url) { + ql.hideinfo(); + ql.cover.addClass('elfinder-quicklook-coverbg'); + $('') + .on('error', function(e) { + active = false; + ql.update(void(0), fm.cwd()); + ql.update(void(0), file); + }) + .appendTo(preview); + } + }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + + }); + } + }, + + /** + * Flash preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mime = 'application/x-shockwave-flash', + preview = ql.preview, + active = false; + + $.each(navigator.plugins, function(i, plugins) { + $.each(plugins, function(i, plugin) { + if (plugin.type === mime) { + return !(active = true); + } + }); + }); + + active && preview.on(ql.evUpdate, function(e) { + var file = e.file, + node, opDfd; + + if (file.mime === mime && ql.dispInlineRegex.test(file.mime)) { + e.stopImmediatePropagation(); + opDfd = fm.openUrl(file.hash, false, function(url) { + if (url) { + ql.hideinfo(); + node = $('') + .appendTo(preview); + } + }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + }); + }, + + /** + * HTML5 audio preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + preview = ql.preview, + mimes = { + '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', + 'audio/webm' : 'webm', + 'audio/flac' : 'flac', + 'audio/x-flac' : 'flac', + 'audio/amr' : 'amr' + }, + node, curHash, + win = ql.window, + navi = ql.navbar, + AMR, autoplay, + controlsList = typeof ql.options.mediaControlsList === 'string' && ql.options.mediaControlsList? ' controlsList="' + fm.escape(ql.options.mediaControlsList) + '"' : '', + setNavi = function() { + navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : ''); + }, + getNode = function(src, hash) { + return $('') + .on('change', function(e) { + // Firefox fire change event on seek or volume change + e.stopPropagation(); + }) + .on('error', function(e) { + node && node.data('hash') === hash && reset(); + }) + .data('hash', hash) + .appendTo(preview); + }, + amrToWavUrl = function(hash) { + var dfd = $.Deferred(), + loader = $.Deferred().done(function() { + var opDfd; + opDfd = fm.getContents(hash, 'arraybuffer', { progressBar: prog }).done(function(data) { + try { + var buffer = AMR.toWAV(new Uint8Array(data)); + if (buffer) { + dfd.resolve(URL.createObjectURL(new Blob([buffer], { type: 'audio/x-wav' }))); + } else { + dfd.reject(); + } + } catch(e) { + dfd.reject(); + } + }).fail(function() { + dfd.reject(); + }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + }).fail(function() { + AMR = false; + dfd.reject(); + }), + _AMR; + if (window.TextEncoder && window.URL && URL.createObjectURL && typeof AMR === 'undefined') { + // previous window.AMR + _AMR = window.AMR; + delete window.AMR; + fm.loadScript( + [ fm.options.cdns.amr ], + function() { + AMR = window.AMR? window.AMR : false; + // restore previous window.AMR + window.AMR = _AMR; + loader[AMR? 'resolve':'reject'](); + }, + { + error: function() { + loader.reject(); + } + } + ); + } else { + loader[AMR? 'resolve':'reject'](); + } + return dfd; + }, + play = function(player) { + var hash = node.data('hash'), + playPromise; + autoplay && (playPromise = player.play()); + // uses "playPromise['catch']" instead "playPromise.catch" to support Old IE + if (playPromise && playPromise['catch']) { + playPromise['catch'](function(e) { + if (!player.paused) { + node && node.data('hash') === hash && reset(); + } + }); + } + }, + reset = function() { + if (node && node.parent().length) { + var elm = node[0], + url = node.children('source').attr('src'); + win.off('viewchange.audio'); + try { + elm.pause(); + node.empty(); + if (url.match(/^blob:/)) { + URL.revokeObjectURL(url); + } + elm.src = ''; + elm.load(); + } catch(e) {} + node.remove(); + node = null; + } + }, + loading, prog; + + preview.on(ql.evUpdate, function(e) { + var file = e.file, + type = mimes[file.mime], + html5, opDfd; + + if (mimes[file.mime] && ql.dispInlineRegex.test(file.mime) && ((html5 = ql.support.audio[type]) || (type === 'amr'))) { + autoplay = ql.autoPlay(); + curHash = file.hash; + if (!html5) { + if (fm.options.cdns.amr && type === 'amr' && AMR !== false) { + e.stopImmediatePropagation(); + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + node = getNode('', curHash); + amrToWavUrl(file.hash).done(function(url) { + loading.remove(); + if (curHash === file.hash) { + var elm = node[0]; + try { + node.children('source').attr('src', url); + elm.pause(); + elm.load(); + play(elm); + win.on('viewchange.audio', setNavi); + setNavi(); + } catch(e) { + URL.revokeObjectURL(url); + node.remove(); + } + } else { + URL.revokeObjectURL(url); + } + }).fail(function() { + node.remove(); + }); + } + } else { + e.stopImmediatePropagation(); + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + opDfd = fm.openUrl(curHash, false, function(url) { + loading.remove(); + if (url) { + node = getNode(url, curHash); + play(node[0]); + win.on('viewchange.audio', setNavi); + setNavi(); + } else { + node.remove(); + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + } + }).one('change', reset); + }, + + /** + * HTML5 video preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + preview = ql.preview, + mimes = { + 'video/mp4' : 'mp4', + 'video/x-m4v' : 'mp4', + 'video/quicktime' : 'mp4', + 'video/mpeg' : 'mpeg', + 'video/ogg' : 'ogg', + 'application/ogg' : 'ogg', + 'video/webm' : 'webm', + 'video/x-matroska': 'mkv', + 'video/3gpp' : '3gp', + 'application/vnd.apple.mpegurl' : 'm3u8', + 'application/x-mpegurl' : 'm3u8', + 'application/dash+xml' : 'mpd', + 'video/x-flv' : 'flv', + 'video/x-msvideo' : 'avi' + }, + node, + win = ql.window, + navi = ql.navbar, + cHls, cDash, pDash, cFlv, cVideojs, autoplay, tm, loading, prog, + controlsList = typeof ql.options.mediaControlsList === 'string' && ql.options.mediaControlsList? ' controlsList="' + fm.escape(ql.options.mediaControlsList) + '"' : '', + setNavi = function() { + if (fm.UA.iOS) { + if (win.hasClass('elfinder-quicklook-fullscreen')) { + preview.css('height', '-webkit-calc(100% - 50px)'); + navi._show(); + } else { + preview.css('height', ''); + } + } else { + navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : ''); + } + }, + render = function(file, opts) { + var errTm = function(e) { + if (err > 1) { + tm && clearTimeout(tm); + tm = setTimeout(function() { + !canPlay && reset(true); + }, 800); + } + }, + err = 0, + canPlay; + //reset(); + pDash = null; + opts = opts || {}; + ql.hideinfo(); + node = $('') + .on('change', function(e) { + // Firefox fire change event on seek or volume change + e.stopPropagation(); + }) + .on('timeupdate progress', errTm) + .on('canplay', function() { + canPlay = true; + }) + .data('hash', file.hash); + // can not handling error event with jQuery `on` event handler + node[0].addEventListener('error', function(e) { + if (opts.src && fm.convAbsUrl(opts.src) === fm.convAbsUrl(e.target.src)) { + ++err; + errTm(); + } + }, true); + + if (opts.src) { + node.append(''); + } + + node.appendTo(preview); + + win.on('viewchange.video', setNavi); + setNavi(); + }, + loadHls = function(file) { + var hls, opDfd; + opDfd = fm.openUrl(file.hash, false, function(url) { + loading.remove(); + if (url) { + render(file); + hls = new cHls(); + hls.loadSource(url); + hls.attachMedia(node[0]); + if (autoplay) { + hls.on(cHls.Events.MANIFEST_PARSED, function() { + play(node[0]); + }); + } + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + }, + loadDash = function(file) { + var opDfd; + opDfd = fm.openUrl(file.hash, false, function(url) { + var debug; + loading.remove(); + if (url) { + render(file); + pDash = window.dashjs.MediaPlayer().create(); + debug = pDash.getDebug(); + if (debug.setLogLevel) { + debug.setLogLevel(dashjs.Debug.LOG_LEVEL_FATAL); + } else if (debug.setLogToBrowserConsole) { + debug.setLogToBrowserConsole(false); + } + pDash.initialize(node[0], url, autoplay); + pDash.on('error', function(e) { + reset(true); + }); + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + }, + loadFlv = function(file) { + var opDfd + if (!cFlv.isSupported()) { + cFlv = false; + return; + } + opDfd = fm.openUrl(file.hash, false, function(url) { + loading.remove(); + if (url) { + var player = cFlv.createPlayer({ + type: 'flv', + url: url + }); + render(file); + player.on(cFlv.Events.ERROR, function() { + player.destroy(); + reset(true); + }); + player.attachMediaElement(node[0]); + player.load(); + play(player); + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + }, + loadVideojs = function(file) { + var opDfd; + opDfd = fm.openUrl(file.hash, false, function(url) { + loading.remove(); + if (url) { + render(file); + node[0].src = url; + cVideojs(node[0], { + src: url + }); + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + }, + play = function(player) { + var hash = node.data('hash'), + playPromise; + autoplay && (playPromise = player.play()); + // uses "playPromise['catch']" instead "playPromise.catch" to support Old IE + if (playPromise && playPromise['catch']) { + playPromise['catch'](function(e) { + if (!player.paused) { + node && node.data('hash') === hash && reset(true); + } + }); + } + }, + reset = function(showInfo) { + tm && clearTimeout(tm); + if (node && node.parent().length) { + var elm = node[0]; + win.off('viewchange.video'); + pDash && pDash.reset(); + try { + elm.pause(); + node.empty(); + elm.src = ''; + elm.load(); + } catch(e) {} + node.remove(); + node = null; + } + showInfo && ql.info.show(); + }; + + preview.on(ql.evUpdate, function(e) { + var file = e.file, + mime = file.mime.toLowerCase(), + type = mimes[mime], + stock, playPromise, opDfd; + + if (mimes[mime] && ql.dispInlineRegex.test(file.mime) /*&& (((type === 'm3u8' || (type === 'mpd' && !fm.UA.iOS) || type === 'flv') && !fm.UA.ltIE10) || ql.support.video[type])*/) { + autoplay = ql.autoPlay(); + loading = $('
        '+fm.i18n('nowLoading')+'
        '); + prog = $('
        ').appendTo(loading); + if (ql.support.video[type] && (type !== 'm3u8' || fm.UA.Safari)) { + e.stopImmediatePropagation(); + loading.appendTo(ql.info.find('.elfinder-quicklook-info')); + opDfd = fm.openUrl(file.hash, false, function(url) { + loading.remove(); + if (url) { + render(file, { src: url }); + play(node[0]); + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } else { + if (cHls !== false && fm.options.cdns.hls && type === 'm3u8') { + e.stopImmediatePropagation(); + loading.appendTo(ql.info.find('.elfinder-quicklook-info')); + if (cHls) { + loadHls(file); + } else { + stock = window.Hls; + delete window.Hls; + fm.loadScript( + [ fm.options.cdns.hls ], + function(res) { + cHls = res || window.Hls || false; + window.Hls = stock; + cHls && loadHls(file); + }, + { + tryRequire: true, + error : function() { + cHls = false; + } + } + ); + } + } else if (cDash !== false && fm.options.cdns.dash && type === 'mpd') { + e.stopImmediatePropagation(); + loading.appendTo(ql.info.find('.elfinder-quicklook-info')); + if (cDash) { + loadDash(file); + } else { + fm.loadScript( + [ fm.options.cdns.dash ], + function() { + // dashjs require window.dashjs in global scope + cDash = window.dashjs? true : false; + cDash && loadDash(file); + }, + { + tryRequire: true, + error : function() { + cDash = false; + } + } + ); + } + } else if (cFlv !== false && fm.options.cdns.flv && type === 'flv') { + e.stopImmediatePropagation(); + loading.appendTo(ql.info.find('.elfinder-quicklook-info')); + if (cFlv) { + loadFlv(file); + } else { + stock = window.flvjs; + delete window.flvjs; + fm.loadScript( + [ fm.options.cdns.flv ], + function(res) { + cFlv = res || window.flvjs || false; + window.flvjs = stock; + cFlv && loadFlv(file); + }, + { + tryRequire: true, + error : function() { + cFlv = false; + } + } + ); + } + } else if (fm.options.cdns.videojs) { + e.stopImmediatePropagation(); + loading.appendTo(ql.info.find('.elfinder-quicklook-info')); + if (cVideojs) { + loadVideojs(file); + } else { + fm.loadScript( + [ fm.options.cdns.videojs + '/video.min.js' ], + function(res) { + cVideojs = res || window.videojs || false; + //window.flvjs = stock; + cVideojs && loadVideojs(file); + }, + { + tryRequire: true, + error : function() { + cVideojs = false; + } + } + ).loadCss([fm.options.cdns.videojs + '/video-js.min.css']); + } + } + } + } + }).one('change', reset); + }, + + /** + * Audio/video preview plugin using browser plugins + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var preview = ql.preview, + mimes = [], + node, + win = ql.window, + navi = ql.navbar; + + $.each(navigator.plugins, function(i, plugins) { + $.each(plugins, function(i, plugin) { + (plugin.type.indexOf('audio/') === 0 || plugin.type.indexOf('video/') === 0) && mimes.push(plugin.type); + }); + }); + mimes = ql.fm.arrayFlip(mimes); + + preview.on(ql.evUpdate, function(e) { + var file = e.file, + mime = file.mime, + video, opDfd, loading, prog, + setNavi = function() { + navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : ''); + }; + + if (mimes[file.mime] && ql.dispInlineRegex.test(file.mime)) { + e.stopImmediatePropagation(); + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + opDfd = ql.fm.openUrl(file.hash, false, function(url) { + loading.remove(); + if (url) { + (video = mime.indexOf('video/') === 0) && ql.hideinfo(); + node = $('') + .appendTo(preview); + + win.on('viewchange.embed', setNavi); + setNavi(); + } + }, { progressBar: prog }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + }).one('change', function() { + if (node && node.parent().length) { + win.off('viewchange.embed'); + node.remove(); + node= null; + } + }); + + }, + + /** + * Archive(zip|gzip|tar|bz2) preview plugin using https://github.com/imaya/zlib.js + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mimes = fm.arrayFlip(['application/zip', 'application/x-gzip', 'application/x-tar', 'application/x-bzip2']), + preview = ql.preview, + sizeMax = fm.returnBytes(ql.options.unzipMaxSize || 0), + Zlib = (fm.options.cdns.zlibUnzip && fm.options.cdns.zlibGunzip)? true : false, + bzip2 = fm.options.cdns.bzip2? true : false; + + if (window.Worker && window.Uint8Array && window.DataView) { + preview.on(ql.evUpdate, function(e) { + var file = e.file, + isTar = (file.mime === 'application/x-tar'), + isBzip2 = (file.mime === 'application/x-bzip2'), + isZlib = (file.mime === 'application/zip' || file.mime === 'application/x-gzip'); + if (mimes[file.mime] && (!sizeMax || file.size <= sizeMax) && ( + isTar + || (isBzip2 && bzip2) + || (isZlib && Zlib) + )) { + var jqxhr, wk, loading, prog, url, + req = function() { + jqxhr = fm.getContents(file.hash, 'arraybuffer', { progressBar: prog }) + .fail(function() { + loading.remove(); + }) + .done(function(data) { + var unzip, filenames, + err = function(e) { + wk && wk.terminate(); + loading.remove(); + if (isZlib) { + Zlib = false; + } else if (isBzip2) { + bzip2 = false; + } + fm.debug('error', e); + }; + try { + wk = fm.getWorker(); + wk.onmessage = function(res) { + wk && wk.terminate(); + loading.remove(); + if (!res.data || res.data.error) { + new Error(res.data && res.data.error? res.data.error : ''); + } else { + makeList(res.data.files); + } + }; + wk.onerror = err; + if (file.mime === 'application/x-tar') { + wk.postMessage({ + scripts: [fm.getWorkerUrl('quicklook.unzip.js')], + data: { type: 'tar', bin: data } + }); + } else if (file.mime === 'application/zip') { + wk.postMessage({ + scripts: [fm.options.cdns.zlibUnzip, fm.getWorkerUrl('quicklook.unzip.js')], + data: { type: 'zip', bin: data } + }); + } else if (file.mime === 'application/x-gzip') { + wk.postMessage({ + scripts: [fm.options.cdns.zlibGunzip, fm.getWorkerUrl('quicklook.unzip.js')], + data: { type: 'gzip', bin: data } + }); + + } else if (file.mime === 'application/x-bzip2') { + wk.postMessage({ + scripts: [fm.options.cdns.bzip2, fm.getWorkerUrl('quicklook.unzip.js')], + data: { type: 'bzip2', bin: data } + }); + } + } catch (e) { + err(e); + } + }); + }, + makeList = function(filenames) { + var header, list, doc, tsize = 0; + if (filenames && filenames.length) { + filenames = $.map(filenames, function(str) { + return fm.decodeRawString(str); + }); + filenames.sort(); + list = fm.escape(filenames.join("\n").replace(/\{formatSize\((\d+)\)\}/g, function(m, s) { + tsize += parseInt(s); + return fm.formatSize(s); + })); + header = ''+fm.escape(file.mime)+' ('+fm.formatSize(file.size)+' / '+fm.formatSize(tsize)+')'+'
        '; + doc = $('
        '+header+'
        '+list+'
        ') + .on('touchstart', function(e) { + if ($(this)['scroll' + (fm.direction === 'ltr'? 'Right' : 'Left')]() > 5) { + e.originalEvent._preventSwipeX = true; + } + }) + .appendTo(preview); + ql.hideinfo(); + } + loading.remove(); + }; + + // this is our file - stop event propagation + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + // stop loading on change file if not loaded yet + preview.one('change', function() { + jqxhr.state() === 'pending' && jqxhr.reject(); + wk && wk.terminate(); + loading.remove(); + }); + + req(); + } + }); + } + }, + + /** + * RAR Archive preview plugin using https://github.com/43081j/rar.js + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mimes = fm.arrayFlip(['application/x-rar']), + preview = ql.preview, + RAR; + + if (window.DataView) { + preview.on(ql.evUpdate, function(e) { + var file = e.file; + if (mimes[file.mime] && fm.options.cdns.rar && RAR !== false) { + var loading, prog, url, archive, abort, + getList = function(url) { + if (abort) { + loading.remove(); + return; + } + try { + archive = RAR({ + file: url, + type: 2, + xhrHeaders: fm.customHeaders, + xhrFields: fm.xhrFields + }, function(err) { + loading.remove(); + var filenames = [], + header, doc; + if (abort || err) { + // An error occurred (not a rar, read error, etc) + err && fm.debug('error', err); + return; + } + $.each(archive.entries, function() { + filenames.push(this.path + (this.size? ' (' + fm.formatSize(this.size) + ')' : '')); + }); + if (filenames.length) { + filenames = $.map(filenames, function(str) { + return fm.decodeRawString(str); + }); + filenames.sort(); + header = ''+fm.escape(file.mime)+' ('+fm.formatSize(file.size)+')'+'
        '; + doc = $('
        '+header+'
        '+fm.escape(filenames.join("\n"))+'
        ') + .on('touchstart', function(e) { + if ($(this)['scroll' + (fm.direction === 'ltr'? 'Right' : 'Left')]() > 5) { + e.originalEvent._preventSwipeX = true; + } + }) + .appendTo(preview); + ql.hideinfo(); + } + }); + } catch(e) { + loading.remove(); + } + }, + error = function() { + RAR = false; + loading.remove(); + }, + _RAR, opDfd; + + // this is our file - stop event propagation + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + // stop loading on change file if not loaded yet + preview.one('change', function() { + archive && (archive.abort = true); + loading.remove(); + abort = true; + }); + + opDfd = fm.openUrl(file.hash, 'sameorigin', function(url) { + if (url) { + if (RAR) { + getList(url); + } else { + if (window.RarArchive) { + _RAR = window.RarArchive; + delete window.RarArchive; + } + fm.loadScript( + [ fm.options.cdns.rar ], + function() { + if (fm.hasRequire) { + require(['rar'], function(RarArchive) { + RAR = RarArchive; + getList(url); + }, error); + } else { + if (RAR = window.RarArchive) { + if (_RAR) { + window.RarArchive = _RAR; + } else { + delete window.RarArchive; + } + getList(url); + } else { + error(); + } + } + }, + { + tryRequire: true, + error : error + } + ); + } + } + }, { progressBar: prog, temporary: true }); + // stop loading on change file if not loaded yet + preview.one('change', function() { + opDfd && opDfd.state && opDfd.state() === 'pending' && opDfd.reject(); + }); + } + }); + } + }, + + /** + * CAD-Files and 3D-Models online viewer on sharecad.org + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mimes = fm.arrayFlip(ql.options.sharecadMimes || []), + preview = ql.preview, + win = ql.window, + node; + + if (ql.options.sharecadMimes.length) { + ql.addIntegration({ + title: 'ShareCAD.org CAD and 3D-Models viewer', + link: 'https://sharecad.org/DWGOnlinePlugin' + }); + } + + preview.on(ql.evUpdate, function(e) { + var file = e.file; + if (mimes[file.mime.toLowerCase()] && fm.option('onetimeUrl', file.hash)) { + var win = ql.window, + loading, prog, url; + + e.stopImmediatePropagation(); + if (file.url == '1') { + preview.hide(); + $('
        ').appendTo(ql.info.find('.elfinder-quicklook-info')) + .on('click', function() { + var self = $(this); + self.html(''); + fm.request({ + data : {cmd : 'url', target : file.hash}, + preventDefault : true, + progressBar : prog + }) + .always(function() { + self.html(''); + }) + .done(function(data) { + var rfile = fm.file(file.hash); + file.url = rfile.url = data.url || ''; + if (file.url) { + preview.trigger({ + type: ql.evUpdate, + file: file, + forceUpdate: true + }); + } + }); + }); + } + if (file.url !== '' && file.url != '1') { + preview.one('change', function() { + loading.remove(); + node.off('load').remove(); + node = null; + }).addClass('elfinder-overflow-auto'); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + url = fm.convAbsUrl(fm.url(file.hash)); + node = $('') + .css('background-color', 'transparent') + .appendTo(preview) + .on('load', function() { + ql.hideinfo(); + loading.remove(); + ql.preview.after(ql.info); + $(this).css('background-color', '#fff').show(); + }) + .on('error', function() { + loading.remove(); + ql.preview.after(ql.info); + }) + .attr('src', '//sharecad.org/cadframe/load?url=' + encodeURIComponent(url)); + + ql.info.after(ql.preview); + } + } + + }); + }, + + /** + * KML preview with GoogleMaps API + * + * @param elFinder.commands.quicklook + */ + function(ql) { + var fm = ql.fm, + mimes = { + 'application/vnd.google-earth.kml+xml' : true, + 'application/vnd.google-earth.kmz' : true + }, + preview = ql.preview, + gMaps, loadMap, wGmfail, fail, mapScr; + + if (ql.options.googleMapsApiKey) { + ql.addIntegration({ + title: 'Google Maps', + link: 'https://www.google.com/intl/' + fm.lang.replace('_', '-') + '/help/terms_maps.html' + }); + gMaps = (window.google && google.maps); + // start load maps + loadMap = function(file, node, prog) { + var mapsOpts = ql.options.googleMapsOpts.maps; + fm.forExternalUrl(file.hash, { progressBar: prog }).done(function(url) { + if (url) { + try { + new gMaps.KmlLayer(url, Object.assign({ + map: new gMaps.Map(node.get(0), mapsOpts) + }, ql.options.googleMapsOpts.kml)); + ql.hideinfo(); + } catch(e) { + fail(); + } + } else { + fail(); + } + }); + }; + // keep stored error handler if exists + wGmfail = window.gm_authFailure; + // on error function + fail = function() { + mapScr = null; + }; + // API script url + mapScr = 'https://maps.googleapis.com/maps/api/js?key=' + ql.options.googleMapsApiKey; + // error handler + window.gm_authFailure = function() { + fail(); + wGmfail && wGmfail(); + }; + + preview.on(ql.evUpdate, function(e) { + var file = e.file; + if (mapScr && mimes[file.mime.toLowerCase()]) { + var win = ql.window, + getLink = (file.url == '1' && !fm.option('onetimeUrl', file.hash)), + loading, prog, url, node; + + e.stopImmediatePropagation(); + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + if (getLink) { + preview.hide(); + $('
        ').appendTo(ql.info.find('.elfinder-quicklook-info')) + .on('click', function() { + var self = $(this); + self.html(''); + fm.request({ + data : {cmd : 'url', target : file.hash}, + preventDefault : true, + progressBar : prog + }) + .always(function() { + loading.remove(); + self.html(''); + }) + .done(function(data) { + var rfile = fm.file(file.hash); + file.url = rfile.url = data.url || ''; + if (file.url) { + preview.trigger({ + type: ql.evUpdate, + file: file, + forceUpdate: true + }); + } + }); + }); + } + if (file.url !== '' && !getLink) { + node = $('
        ').appendTo(preview); + preview.one('change', function() { + node.remove(); + node = null; + }); + if (!gMaps) { + fm.loadScript([mapScr], function() { + gMaps = window.google && google.maps; + gMaps && loadMap(file, node, prog); + }); + } else { + loadMap(file, node, prog); + } + } + } + }); + } + }, + + /** + * Any supported files preview plugin using (Google docs | MS Office) online viewer + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + var fm = ql.fm, + mimes = Object.assign(fm.arrayFlip(ql.options.googleDocsMimes || [], 'g'), fm.arrayFlip(ql.options.officeOnlineMimes || [], 'm')), + preview = ql.preview, + win = ql.window, + navi = ql.navbar, + urls = { + g: 'docs.google.com/gview?embedded=true&url=', + m: 'view.officeapps.live.com/op/embed.aspx?wdStartOn=0&src=' + }, + navBottom = { + g: '56px', + m: '24px' + }, + mLimits = { + xls : 5242880, // 5MB + xlsb : 5242880, + xlsx : 5242880, + xlsm : 5242880, + other: 10485760 // 10MB + }, + node, enable; + + if (ql.options.googleDocsMimes.length) { + enable = true; + ql.addIntegration({ + title: 'Google Docs Viewer', + link: 'https://docs.google.com/' + }); + } + if (ql.options.officeOnlineMimes.length) { + enable = true; + ql.addIntegration({ + title: 'MS Online Doc Viewer', + link: 'https://products.office.com/office-online/view-office-documents-online' + }); + } + + if (enable) { + preview.on(ql.evUpdate, function(e) { + var file = e.file, + type, dfd; + // 25MB is maximum filesize of Google Docs prevew + if (file.size <= 26214400 && (type = mimes[file.mime])) { + var win = ql.window, + setNavi = function() { + navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? navBottom[type] : ''); + }, + ext = fm.mimeTypes[file.mime], + getLink = (file.url == '1' && !fm.option('onetimeUrl', file.hash)), + loading, prog, url, tm; + + if (type === 'm') { + if ((mLimits[ext] && file.size > mLimits[ext]) || file.size > mLimits.other) { + type = 'g'; + } + } + if (getLink) { + preview.hide(); + $('
        ').appendTo(ql.info.find('.elfinder-quicklook-info')) + .on('click', function() { + var self = $(this); + self.html(''); + fm.request({ + data : {cmd : 'url', target : file.hash}, + preventDefault : true + }) + .always(function() { + self.html(''); + }) + .done(function(data) { + var rfile = fm.file(file.hash); + file.url = rfile.url = data.url || ''; + if (file.url) { + preview.trigger({ + type: ql.evUpdate, + file: file, + forceUpdate: true + }); + } + }); + }); + } + if (file.url !== '' && !getLink) { + e.stopImmediatePropagation(); + preview.one('change', function() { + dfd && dfd.status && dfd.status() === 'pending' && dfd.reject(); + win.off('viewchange.googledocs'); + loading.remove(); + node.off('load').remove(); + node = null; + }).addClass('elfinder-overflow-auto'); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + node = $('') + .css('background-color', 'transparent') + .appendTo(preview); + + dfd = fm.forExternalUrl(file.hash, { progressBar: prog }).done(function(url) { + var load = function() { + try { + if (node && (!node.attr('src') || node.get(0).contentWindow.document/*maybe HTTP 204*/)) { + node.attr('src', 'https://' + urls[type] + encodeURIComponent(url)); + // Retry because Google Docs viewer sometimes returns HTTP 204 + tm = setTimeout(load, 2000); + } + } catch(e) {} + }; + if (url) { + if (file.ts) { + url += (url.match(/\?/)? '&' : '?') + '_t=' + file.ts; + } + node.on('load', function() { + tm && clearTimeout(tm); + ql.hideinfo(); + loading.remove(); + ql.preview.after(ql.info); + $(this).css('background-color', '#fff').show(); + }) + .on('error', function() { + tm && clearTimeout(tm); + loading.remove(); + ql.preview.after(ql.info); + }); + load(); + } else { + loading.remove(); + node.remove(); + } + }); + + win.on('viewchange.googledocs', setNavi); + setNavi(); + ql.info.after(ql.preview); + } + } + + }); + } + }, + + /** + * Texts preview plugin + * + * @param elFinder.commands.quicklook + **/ + function(ql) { + "use strict"; + var fm = ql.fm, + preview = ql.preview, + textLines = parseInt(ql.options.textInitialLines) || 150, + prettifyLines = parseInt(ql.options.prettifyMaxLines) || 500, + PR, _PR, + error = function() { + prettify = function() { return false; }; + _PR && (window.PR = _PR); + PR = false; + }, + prettify = function(node) { + if (fm.options.cdns.prettify) { + prettify = function(node) { + setTimeout(function() { + PRcheck(node); + }, 100); + return 'pending'; + }; + if (window.PR) { + _PR = window.PR; + } + fm.loadScript([fm.options.cdns.prettify + (fm.options.cdns.prettify.match(/\?/)? '&' : '?') + 'autorun=false'], function(wPR) { + PR = wPR || window.PR; + if (typeof PR === 'object') { + prettify = function() { return true; }; + if (_PR) { + window.PR = _PR; + } else { + delete window.PR; + } + exec(node); + } else { + error(); + } + }, { + tryRequire: true, + error : error + }); + } else { + error(); + } + }, + exec = function(node) { + if (node && !node.hasClass('prettyprinted')) { + node.css('cursor', 'wait'); + requestAnimationFrame(function() { + PR.prettyPrint && PR.prettyPrint(null, node.get(0)); + node.css('cursor', ''); + }); + } + }, + PRcheck = function(node) { + var status = prettify(node); + if (status === true) { + exec(node); + } + }; + + preview.on(ql.evUpdate, function(e) { + var file = e.file, + mime = file.mime, + jqxhr, loading, prog, encSelect; + + if (fm.mimeIsText(file.mime) && (!ql.options.getSizeMax || file.size <= ql.options.getSizeMax) && PR !== false) { + e.stopImmediatePropagation(); + + loading = $('
        '+fm.i18n('nowLoading')+'
        ').appendTo(ql.info.find('.elfinder-quicklook-info')); + prog = $('
        ').appendTo(loading); + + // stop loading on change file if not loadin yet + preview.one('change', function() { + jqxhr.state() == 'pending' && jqxhr.reject(); + encSelect && encSelect.remove(); + }); + + jqxhr = fm.request({ + data : {cmd : 'get', target : file.hash, conv : (file.encoding || 1), _t : file.ts}, + options : {type: 'get', cache : true}, + preventDefault : true, + progressBar : prog + }) + .done(function(data) { + var reg = new RegExp('^(data:'+file.mime.replace(/([.+])/g, '\\$1')+';base64,)', 'i'), + text = data.content, + part, more, node, lines, m; + if (typeof text !== 'string') { + return; + } + ql.hideinfo(); + if (window.atob && (m = text.match(reg))) { + text = atob(text.substr(m[1].length)); + } + + lines = text.match(/([^\r\n]{1,100}[\r\n]*)/g); + more = lines.length - textLines; + if (more > 10) { + part = lines.splice(0, textLines).join(''); + } else { + more = 0; + } + + node = $('
        '); + + if (more) { + node.append($('

        ' + fm.i18n('linesLeft', fm.toLocaleString(more)) + '
        ') + .on('click', function() { + var top = node.scrollTop(); + $(this).remove(); + node.children('pre').removeClass('prettyprinted').text(text).scrollTop(top); + if (lines.length <= prettifyLines) { + PRcheck(node); + } + }) + ); + } + node.children('pre').text(part || text); + + node.on('touchstart', function(e) { + if ($(this)['scroll' + (fm.direction === 'ltr'? 'Right' : 'Left')]() > 5) { + e.originalEvent._preventSwipeX = true; + } + }).appendTo(preview); + + // make toast message + if (data.toasts && Array.isArray(data.toasts)) { + $.each(data.toasts, function() { + this.msg && fm.toast(this); + }); + } + + PRcheck(node); + }) + .always(function(data) { + var cmdEdit, sel, head; + if (cmdEdit = fm.getCommand('edit')) { + head = []; + if (data && data.encoding) { + head.push({value: data.encoding}); + } + head.push({value: 'UTF-8'}); + sel = cmdEdit.getEncSelect(head); + sel.on('change', function() { + file.encoding = sel.val(); + fm.cache(file, 'change'); + preview.trigger({ + type: ql.evUpdate, + file: file, + forceUpdate: true + }); + }); + encSelect = $('
        ').append(sel); + ql.window.append(encSelect); + } + loading.remove(); + }); + } + }); + } +]; + + +/* + * File: /js/commands/reload.js + */ + +/** + * @class elFinder command "reload" + * Sync files and folders + * + * @author Dmitry (dio) Levashov + **/ +(elFinder.prototype.commands.reload = function() { + "use strict"; + var self = this, + search = false; + + this.alwaysEnabled = true; + this.updateOnSelect = true; + + this.shortcuts = [{ + pattern : 'ctrl+shift+r f5' + }]; + + this.getstate = function() { + return 0; + }; + + this.init = function() { + this.fm.bind('search searchend', function() { + search = this.type == 'search'; + }); + }; + + this.fm.bind('contextmenu', function(){ + var fm = self.fm; + if (fm.options.sync >= 1000) { + self.extra = { + icon: 'accept', + node: $('') + .attr({title: fm.i18n('autoSync')}) + .on('click touchstart', function(e){ + if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) { + return; + } + e.stopPropagation(); + e.preventDefault(); + $(this).parent() + .toggleClass('ui-state-disabled', fm.options.syncStart) + .parent().removeClass('ui-state-hover'); + fm.options.syncStart = !fm.options.syncStart; + fm.autoSync(fm.options.syncStart? null : 'stop'); + }).on('ready', function(){ + $(this).parent().toggleClass('ui-state-disabled', !fm.options.syncStart).css('pointer-events', 'auto'); + }) + }; + } + }); + + this.exec = function() { + var fm = this.fm; + if (!search) { + var dfrd = fm.sync(), + timeout = setTimeout(function() { + fm.notify({type : 'reload', cnt : 1, hideCnt : true}); + dfrd.always(function() { fm.notify({type : 'reload', cnt : -1}); }); + }, fm.notifyDelay); + + return dfrd.always(function() { + clearTimeout(timeout); + fm.trigger('reload'); + }); + } else { + $('div.elfinder-toolbar > div.'+fm.res('class', 'searchbtn') + ' > span.ui-icon-search').click(); + } + }; + +}).prototype = { forceLoad : true }; // this is required command + + +/* + * File: /js/commands/rename.js + */ + +/** + * @class elFinder command "rename". + * Rename selected file. + * + * @author Dmitry (dio) Levashov, dio@std42.ru + * @author Naoki Sawada + **/ +elFinder.prototype.commands.rename = function() { + "use strict"; + + // set alwaysEnabled to allow root rename on client size + this.alwaysEnabled = true; + + this.syncTitleOnChange = true; + + var self = this, + fm = self.fm, + request = function(dfrd, targtes, file, name) { + var sel = targtes? [file.hash].concat(targtes) : [file.hash], + cnt = sel.length, + data = {}, rootNames; + + fm.lockfiles({files : sel}); + + if (fm.isRoot(file) && !file.netkey) { + if (!(rootNames = fm.storage('rootNames'))) { + rootNames = {}; + } + if (name === '') { + if (rootNames[file.hash]) { + file.name = file._name; + file.i18 = file._i18; + delete rootNames[file.hash]; + delete file._name; + delete file._i18; + } else { + dfrd && dfrd.reject(); + fm.unlockfiles({files : sel}).trigger('selectfiles', {files : sel}); + return; + } + } else { + if (typeof file._name === 'undefined') { + file._name = file.name; + file._i18 = file.i18; + } + file.name = rootNames[file.hash] = name; + delete file.i18; + } + fm.storage('rootNames', rootNames); + data = { changed: [file] }; + fm.updateCache(data); + fm.change(data); + dfrd && dfrd.resolve(data); + fm.unlockfiles({files : sel}).trigger('selectfiles', {files : sel}); + return; + } + + data = { + cmd : 'rename', + name : name, + target : file.hash + }; + + if (cnt > 1) { + data['targets'] = targtes; + if (name.match(/\*/)) { + data['q'] = name; + } + } + + fm.request({ + data : data, + notify : {type : 'rename', cnt : cnt}, + navigate : {} + }) + .fail(function(error) { + var err = fm.parseError(error); + dfrd && dfrd.reject(); + if (! err || ! Array.isArray(err) || err[0] !== 'errRename') { + fm.sync(); + } + }) + .done(function(data) { + var cwdHash; + if (data.added && data.added.length && cnt === 1) { + data.undo = { + cmd : 'rename', + callback : function() { + return fm.request({ + data : {cmd : 'rename', target : data.added[0].hash, name : file.name}, + notify : {type : 'undo', cnt : 1} + }); + } + }; + data.redo = { + cmd : 'rename', + callback : function() { + return fm.request({ + data : {cmd : 'rename', target : file.hash, name : name}, + notify : {type : 'rename', cnt : 1} + }); + } + }; + } + dfrd && dfrd.resolve(data); + if (!(cwdHash = fm.cwd().hash) || cwdHash === file.hash) { + fm.exec('open', $.map(data.added, function(f) { + return (f.mime === 'directory')? f.hash : null; + })[0]); + } + }) + .always(function() { + fm.unlockfiles({files : sel}).trigger('selectfiles', {files : sel}); + } + ); + }, + getHint = function(name, target) { + var sel = target || fm.selected(), + splits = fm.splitFileExtention(name), + f1 = fm.file(sel[0]), + f2 = fm.file(sel[1]), + ext, hint, add; + + ext = splits[1]? ('.' + splits[1]) : ''; + if (splits[1] && splits[0] === '*') { + // change extention + hint = '"' + fm.splitFileExtention(f1.name)[0] + ext + '", '; + hint += '"' + fm.splitFileExtention(f2.name)[0] + ext + '"'; + } else if (splits[0].length > 1) { + if (splits[0].substr(-1) === '*') { + // add prefix + add = splits[0].substr(0, splits[0].length - 1); + hint = '"' + add + f1.name+'", '; + hint += '"' + add + f2.name+'"'; + } else if (splits[0].substr(0, 1) === '*') { + // add suffix + add = splits[0].substr(1); + hint = '"'+fm.splitFileExtention(f1.name)[0] + add + ext + '", '; + hint += '"'+fm.splitFileExtention(f2.name)[0] + add + ext + '"'; + } + } + if (!hint) { + hint = '"'+splits[0] + '1' + ext + '", "' + splits[0] + '2' + ext + '"'; + } + if (sel.length > 2) { + hint += ' ...'; + } + return hint; + }, + batchRename = function() { + var sel = fm.selected(), + tplr = '', + mkChk = function(node, label) { + return $('').prepend(node); + }, + name = $(''), + num = $(tplr), + prefix = $(tplr), + suffix = $(tplr), + extention = $(tplr), + checks = $('
        ').append( + mkChk(num, 'plusNumber'), + mkChk(prefix, 'asPrefix'), + mkChk(suffix, 'asSuffix'), + mkChk(extention, 'changeExtention') + ), + preview = $('
        '), + node = $('
        ').append( + $('
        ').append(name), + $('
        ').append(checks), + preview + ), + opts = { + title : fm.i18n('batchRename'), + modal : true, + destroyOnClose : true, + width: Math.min(380, fm.getUI().width() - 20), + buttons : {}, + open : function() { + name.on('input', mkPrev).trigger('focus'); + } + }, + getName = function() { + var vName = name.val(), + ext = fm.splitFileExtention(fm.file(sel[0]).name)[1]; + if (vName !== '' || num.is(':checked')) { + if (prefix.is(':checked')) { + vName += '*'; + } else if (suffix.is(':checked')) { + vName = '*' + vName + '.' + ext; + } else if (extention.is(':checked')) { + vName = '*.' + vName; + } else if (ext) { + vName += '.' + ext; + } + } + return vName; + }, + mkPrev = function() { + var vName = getName(); + if (vName !== '') { + preview.html(fm.i18n(['renameMultiple', sel.length, getHint(vName)])); + } else { + preview.empty(); + } + }, + radios = checks.find('input:radio').on('change', mkPrev), + dialog; + + opts.buttons[fm.i18n('btnApply')] = function() { + var vName = getName(), + file, targets; + if (vName !== '') { + dialog.elfinderdialog('close'); + targets = sel; + file = fm.file(targets.shift()); + request(void(0), targets, file, vName); + } + }; + opts.buttons[fm.i18n('btnCancel')] = function() { + dialog.elfinderdialog('close'); + }; + if ($.fn.checkboxradio) { + radios.checkboxradio({ + create: function(e, ui) { + if (this === num.get(0)) { + num.prop('checked', true).change(); + } + } + }); + } else { + checks.buttonset({ + create: function(e, ui) { + num.prop('checked', true).change(); + } + }); + } + dialog = self.fmDialog(node, opts); + }; + + this.noChangeDirOnRemovedCwd = true; + + this.shortcuts = [{ + pattern : 'f2' + (fm.OS == 'mac' ? ' enter' : '') + }, { + pattern : 'shift+f2', + description : 'batchRename', + callback : function() { + fm.selected().length > 1 && batchRename(); + } + }]; + + this.getstate = function(select) { + var sel = this.files(select), + cnt = sel.length, + phash, ext, mime, brk, state, isRoot; + + if (!cnt) { + return -1; + } + + if (cnt > 1 && sel[0].phash) { + phash = sel[0].phash; + ext = fm.splitFileExtention(sel[0].name)[1].toLowerCase(); + mime = sel[0].mime; + } + if (cnt === 1) { + isRoot = fm.isRoot(sel[0]); + } + + state = (cnt === 1 && ((fm.cookieEnabled && isRoot) || !sel[0].locked) || (fm.api > 2.1030 && cnt === $.grep(sel, function(f) { + if (!brk && !f.locked && f.phash === phash && !fm.isRoot(f) && (mime === f.mime || ext === fm.splitFileExtention(f.name)[1].toLowerCase())) { + return true; + } else { + brk && (brk = true); + return false; + } + }).length)) ? 0 : -1; + + // because alwaysEnabled = true, it need check disabled on connector + if (!isRoot && state === 0 && fm.option('disabledFlip', sel[0].hash)['rename']) { + state = -1; + } + + if (state !== -1 && cnt > 1) { + self.extra = { + icon: 'preference', + node: $('') + .attr({title: fm.i18n('batchRename')}) + .on('click touchstart', function(e){ + if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) { + return; + } + e.stopPropagation(); + e.preventDefault(); + fm.getUI().trigger('click'); // to close the context menu immediately + batchRename(); + }) + }; + } else { + delete self.extra; + } + + return state; + }; + + this.exec = function(hashes, cOpts) { + var cwd = fm.getUI('cwd'), + sel = hashes || (fm.selected().length? fm.selected() : false) || [fm.cwd().hash], + cnt = sel.length, + file = fm.file(sel.shift()), + filename = '.elfinder-cwd-filename', + opts = cOpts || {}, + incwd = (fm.cwd().hash == file.hash), + type = (opts._currentType === 'navbar' || opts._currentType === 'files')? opts._currentType : (incwd? 'navbar' : 'files'), + navbar = (type !== 'files'), + target = fm[navbar? 'navHash2Elm' : 'cwdHash2Elm'](file.hash), + tarea = (!navbar && fm.storage('view') != 'list'), + split = function(name) { + var ext = fm.splitFileExtention(name)[1]; + return [name.substr(0, name.length - ext.length - 1), ext]; + }, + unselect = function() { + requestAnimationFrame(function() { + input && input.trigger('blur'); + }); + }, + rest = function(){ + if (!overlay.is(':hidden')) { + overlay.elfinderoverlay('hide').off('click close', cancel); + } + pnode.removeClass('ui-front') + .css('position', '') + .off('unselect.'+fm.namespace, unselect); + if (tarea) { + node && node.css('max-height', ''); + } else if (!navbar) { + pnode.css('width', '') + .parent('td').css('overflow', ''); + } + }, colwidth, + dfrd = $.Deferred() + .fail(function(error) { + var parent = input.parent(), + name = fm.escape(file.i18 || file.name); + + input.off(); + if (tarea) { + name = name.replace(/([_.])/g, '​$1'); + } + requestAnimationFrame(function() { + if (navbar) { + input.replaceWith(name); + } else { + if (parent.length) { + input.remove(); + parent.html(name); + } else { + target.find(filename).html(name); + } + } + }); + error && fm.error(error); + }) + .always(function() { + rest(); + fm.unbind('resize', resize); + fm.enable(); + }), + blur = function(e) { + var name = $.trim(input.val()), + splits = fm.splitFileExtention(name), + valid = true, + req = function() { + input.off(); + rest(); + if (navbar) { + input.replaceWith(fm.escape(name)); + } else { + node.html(fm.escape(name)); + } + request(dfrd, sel, file, name); + }; + + if (!overlay.is(':hidden')) { + pnode.css('z-index', ''); + } + if (name === '') { + if (!fm.isRoot(file)) { + return cancel(); + } + if (navbar) { + input.replaceWith(fm.escape(file.name)); + } else { + node.html(fm.escape(file.name)); + } + } + if (!inError && pnode.length) { + + input.off('blur'); + + if (cnt === 1 && name === file.name) { + return dfrd.reject(); + } + if (fm.options.validName && fm.options.validName.test) { + try { + valid = fm.options.validName.test(name); + } catch(e) { + valid = false; + } + } + if (name === '.' || name === '..' || !valid) { + inError = true; + fm.error(file.mime === 'directory'? 'errInvDirname' : 'errInvName', {modal: true, close: function(){setTimeout(select, 120);}}); + return false; + } + if (cnt === 1 && fm.fileByName(name, file.phash)) { + inError = true; + fm.error(['errExists', name], {modal: true, close: function(){setTimeout(select, 120);}}); + return false; + } + + if (cnt === 1) { + req(); + } else { + fm.confirm({ + title : 'cmdrename', + text : ['renameMultiple', cnt, getHint(name, [file.hash].concat(sel))], + accept : { + label : 'btnYes', + callback : req + }, + cancel : { + label : 'btnCancel', + callback : function() { + setTimeout(function() { + inError = true; + select(); + }, 120); + } + } + }); + setTimeout(function() { + fm.trigger('unselectfiles', {files: fm.selected()}) + .trigger('selectfiles', {files : [file.hash].concat(sel)}); + }, 120); + } + } + }, + input = $(tarea? '' : '') + .on('keyup text', function(){ + if (tarea) { + this.style.height = '1px'; + this.style.height = this.scrollHeight + 'px'; + } else if (colwidth) { + this.style.width = colwidth + 'px'; + if (this.scrollWidth > colwidth) { + this.style.width = this.scrollWidth + 10 + 'px'; + } + } + }) + .on('keydown', function(e) { + e.stopImmediatePropagation(); + if (e.keyCode == $.ui.keyCode.ESCAPE) { + dfrd.reject(); + } else if (e.keyCode == $.ui.keyCode.ENTER) { + e.preventDefault(); + input.trigger('blur'); + } + }) + .on('mousedown click dblclick', function(e) { + e.stopPropagation(); + if (e.type === 'dblclick') { + e.preventDefault(); + } + }) + .on('blur', blur) + .on('dragenter dragleave dragover drop', function(e) { + // stop bubbling to prevent upload with native drop event + e.stopPropagation(); + }), + select = function() { + var name = fm.splitFileExtention(input.val())[0]; + if (!inError && fm.UA.Mobile && !fm.UA.iOS) { // since iOS has a bug? (z-index not effect) so disable it + overlay.on('click close', cancel).elfinderoverlay('show'); + pnode.css('z-index', overlay.css('z-index') + 1); + } + ! fm.enabled() && fm.enable(); + if (inError) { + inError = false; + input.on('blur', blur); + } + input.trigger('focus').trigger('select'); + input[0].setSelectionRange && input[0].setSelectionRange(0, name.length); + }, + node = navbar? target.contents().filter(function(){ return this.nodeType==3 && $(this).parent().attr('id') === fm.navHash2Id(file.hash); }) + : target.find(filename), + pnode = node.parent(), + overlay = fm.getUI('overlay'), + cancel = function(e) { + if (!overlay.is(':hidden')) { + pnode.css('z-index', ''); + } + if (! inError) { + dfrd.reject(); + if (e) { + e.stopPropagation(); + e.preventDefault(); + } + } + }, + resize = function() { + target.trigger('scrolltoview', {blink : false}); + }, + inError = false; + + pnode.addClass('ui-front') + .css('position', 'relative') + .on('unselect.'+fm.namespace, unselect); + fm.bind('resize', resize); + if (navbar) { + node.replaceWith(input.val(file.name)); + } else { + if (tarea) { + node.css('max-height', 'none'); + } else if (!navbar) { + colwidth = pnode.width(); + pnode.width(colwidth - 15) + .parent('td').css('overflow', 'visible'); + } + node.empty().append(input.val(file.name)); + } + + if (cnt > 1 && fm.api <= 2.1030) { + return dfrd.reject(); + } + + if (!file || !node.length) { + return dfrd.reject('errCmdParams', this.title); + } + + if (file.locked && !fm.isRoot(file)) { + return dfrd.reject(['errLocked', file.name]); + } + + fm.one('select', function() { + input.parent().length && file && $.inArray(file.hash, fm.selected()) === -1 && input.trigger('blur'); + }); + + input.trigger('keyup'); + + select(); + + return dfrd; + }; + + fm.bind('select contextmenucreate closecontextmenu', function(e) { + var sel = (e.data? (e.data.selected || e.data.targets) : null) || fm.selected(), + file; + if (sel && sel.length === 1 && (file = fm.file(sel[0])) && fm.isRoot(file)) { + self.title = fm.i18n('kindAlias') + ' (' + fm.i18n('preference') + ')'; + } else { + self.title = fm.i18n('cmdrename'); + } + if (e.type !== 'closecontextmenu') { + self.update(void(0), self.title); + } else { + requestAnimationFrame(function() { + self.update(void(0), self.title); + }); + } + }).remove(function(e) { + var rootNames; + if (e.data && e.data.removed && (rootNames = fm.storage('rootNames'))) { + $.each(e.data.removed, function(i, h) { + if (rootNames[h]) { + delete rootNames[h]; + } + }); + fm.storage('rootNames', rootNames); + } + }); +}; + + +/* + * File: /js/commands/resize.js + */ + +/** + * @class elFinder command "resize" + * Open dialog to resize image + * + * @author Dmitry (dio) Levashov + * @author Alexey Sukhotin + * @author Naoki Sawada + * @author Sergio Jovani + **/ +elFinder.prototype.commands.resize = function() { + "use strict"; + var fm = this.fm, + losslessRotate = 0, + getBounceBox = function(w, h, theta) { + var srcPts = [ + {x: w/2, y: h/2}, + {x: -w/2, y: h/2}, + {x: -w/2, y: -h/2}, + {x: w/2, y: -h/2} + ], + dstPts = [], + min = {x: Number.MAX_VALUE, y: Number.MAX_VALUE}, + max = {x: Number.MIN_VALUE, y: Number.MIN_VALUE}; + $.each(srcPts, function(i, srcPt){ + dstPts.push({ + x: srcPt.x * Math.cos(theta) - srcPt.y * Math.sin(theta), + y: srcPt.x * Math.sin(theta) + srcPt.y * Math.cos(theta) + }); + }); + $.each(dstPts, function(i, pt) { + min.x = Math.min(min.x, pt.x); + min.y = Math.min(min.y, pt.y); + max.x = Math.max(max.x, pt.x); + max.y = Math.max(max.y, pt.y); + }); + return { + width: max.x - min.x, height: max.y - min.y + }; + }; + + this.updateOnSelect = false; + + this.getstate = function() { + var sel = fm.selectedFiles(); + return sel.length == 1 && sel[0].read && sel[0].write && sel[0].mime.indexOf('image/') !== -1 ? 0 : -1; + }; + + this.resizeRequest = function(data, f, dfrd) { + var file = f || fm.file(data.target), + tmb = file? file.tmb : null, + enabled = fm.isCommandEnabled('resize', data.target); + + if (enabled && (! file || (file && file.read && file.write && file.mime.indexOf('image/') !== -1 ))) { + return fm.request({ + data : Object.assign(data, { + cmd : 'resize' + }), + notify : {type : 'resize', cnt : 1} + }) + .fail(function(error) { + if (dfrd) { + dfrd.reject(error); + } + }) + .done(function() { + if (data.quality) { + fm.storage('jpgQuality', data.quality === fm.option('jpgQuality')? null : data.quality); + } + dfrd && dfrd.resolve(); + }); + } else { + var error; + + if (file) { + if (file.mime.indexOf('image/') === -1) { + error = ['errResize', file.name, 'errUsupportType']; + } else { + error = ['errResize', file.name, 'errPerm']; + } + } else { + error = ['errResize', data.target, 'errPerm']; + } + + if (dfrd) { + dfrd.reject(error); + } else { + fm.error(error); + } + return $.Deferred().reject(error); + } + }; + + this.exec = function(hashes) { + var self = this, + files = this.files(hashes), + dfrd = $.Deferred(), + api2 = (fm.api > 1), + options = this.options, + dialogWidth = 650, + fmnode = fm.getUI(), + ctrgrup = $().controlgroup? 'controlgroup' : 'buttonset', + grid8Def = typeof options.grid8px === 'undefined' || options.grid8px !== 'disable'? true : false, + presetSize = Array.isArray(options.presetSize)? options.presetSize : [], + clactive = 'elfinder-dialog-active', + clsediting = fm.res('class', 'editing'), + open = function(file, id, src) { + var isJpeg = (file.mime === 'image/jpeg'), + dialog = $('
        '), + input = '', + row = '
        ', + label = '
        ', + changeTm = null, + operate = false, + opStart = function() { operate = true; }, + opStop = function() { + if (operate) { + operate = false; + control.trigger('change'); + } + }, + control = $('
        ') + .on('focus', 'input[type=text],input[type=number]', function() { + $(this).trigger('select'); + }) + .on('change', function() { + changeTm && cancelAnimationFrame(changeTm); + changeTm = requestAnimationFrame(function() { + var panel, quty, canvas, ctx, img, sx, sy, sw, sh, deg, theta, bb; + if (sizeImg && ! operate && (canvas = sizeImg.data('canvas'))) { + panel = control.children('div.elfinder-resize-control-panel:visible'); + quty = panel.find('input.elfinder-resize-quality'); + if (quty.is(':visible')) { + ctx = sizeImg.data('ctx'); + img = sizeImg.get(0); + if (panel.hasClass('elfinder-resize-uiresize')) { + // resize + sw = canvas.width = width.val(); + sh = canvas.height = height.val(); + ctx.drawImage(img, 0, 0, sw, sh); + } else if (panel.hasClass('elfinder-resize-uicrop')) { + // crop + sx = pointX.val(); + sy = pointY.val(); + sw = offsetX.val(); + sh = offsetY.val(); + canvas.width = sw; + canvas.height = sh; + ctx.drawImage(img, sx, sy, sw, sh, 0, 0, sw, sh); + } else { + // rotate + deg = degree.val(); + theta = (degree.val() * Math.PI) / 180; + bb = getBounceBox(owidth, oheight, theta); + sw = canvas.width = bb.width; + sh = canvas.height = bb.height; + ctx.save(); + if (deg % 90 !== 0) { + ctx.fillStyle = bg.val() || '#FFF'; + ctx.fillRect(0, 0, sw, sh); + } + ctx.translate(sw / 2, sh / 2); + ctx.rotate(theta); + ctx.drawImage(img, -img.width/2, -img.height/2, owidth, oheight); + ctx.restore(); + } + canvas.toBlob(function(blob) { + if (blob) { + size1 = blob.size; + quty.next('span').text(' (' + fm.formatSize(blob.size) + ')'); + } + }, 'image/jpeg', Math.max(Math.min(quty.val(), 100), 1) / 100); + } + } + }); + }) + .on('mouseup', 'input', function(e) { + $(e.target).trigger('change'); + }), + preview = $('
        ') + .on('touchmove', function(e) { + if ($(e.target).hasClass('touch-punch')) { + e.stopPropagation(); + e.preventDefault(); + } + }), + spinner = $('
        '+fm.i18n('ntfloadimg')+'
        '), + rhandle = $('
        '), + rhandlec = $('
        '), + uiresize = $('
        '), + uicrop = $('
        '), + uirotate = $('
        '), + uideg270 = $('').attr('title',fm.i18n('rotate-cw')).append($('')), + uideg90 = $('').attr('title',fm.i18n('rotate-ccw')).append($('')), + uiprop = $(''), + reset = $('') + .on('mouseenter mouseleave', function(e) { + $(this).toggleClass('ui-state-hover', e.type == 'mouseenter'); + }).on('click', function() { + fm.exec('open', check).done(function() { + fm.one('opendone', function() { + fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})}); + }); + }); + }) + ); + } else { + fm.trigger('selectfiles', {files : $.map(data.added, function(f) {return f.hash;})}); + } + fm.toast({msg: fm.i18n(['complete', fm.i18n('cmdupload')]), extNode: node}); + } + } + }) + .progress(function() { + dfrd.notifyWith(this, Array.from(arguments)); + }); + }, + upload = function(data) { + dialog.elfinderdialog('close'); + if (targets) { + data.target = targets[0]; + } + fmUpload(data); + }, + getSelector = function() { + var hash = targetDir.hash, + dirs = $.map(fm.files(hash), function(f) { + return (f.mime === 'directory' && f.write)? f : null; + }); + + if (! dirs.length) { + return $(); + } + + return $('
        ') + .on('click', function(e) { + e.stopPropagation(); + e.preventDefault(); + dirs = fm.sortFiles(dirs); + var $this = $(this), + cwd = fm.cwd(), + base = dialog.closest('div.ui-dialog'), + getRaw = function(f, icon) { + return { + label : fm.escape(f.i18 || f.name), + icon : icon, + remain : false, + callback : function() { + var title = base.children('.ui-dialog-titlebar:first').find('span.elfinder-upload-target'); + targets = [ f.hash ]; + title.html(' - ' + fm.escape(f.i18 || f.name)); + $this.trigger('focus'); + }, + options : { + className : (targets && targets.length && f.hash === targets[0])? 'ui-state-active' : '', + iconClass : f.csscls || '', + iconImg : f.icon || '' + } + }; + }, + raw = [ getRaw(targetDir, 'opendir'), '|' ]; + $.each(dirs, function(i, f) { + raw.push(getRaw(f, 'dir')); + }); + $this.trigger('blur'); + fm.trigger('contextmenu', { + raw: raw, + x: e.pageX || $(this).offset().left, + y: e.pageY || $(this).offset().top, + prevNode: base, + fitHeight: true + }); + }).append(''); + }, + inputButton = function(type, caption) { + var button, + input = $('') + .on('click', function() { + // for IE's bug + if (fm.UA.IE) { + setTimeout(function() { + form.css('display', 'none').css('position', 'relative'); + requestAnimationFrame(function() { + form.css('display', '').css('position', ''); + }); + }, 100); + } + }) + .on('change', function() { + upload({input : input.get(0), type : 'files'}); + }) + .on('dragover', function(e) { + e.originalEvent.dataTransfer.dropEffect = 'copy'; + }), + form = $('
        ').append(input).on('click', function(e) { + e.stopPropagation(); + }); + + return $('
        '+fm.i18n(caption)+'
        ') + .append(form) + .on('click', function(e) { + e.stopPropagation(); + e.preventDefault(); + input.trigger('click'); + }) + .on('mouseenter mouseleave', function(e) { + $(this).toggleClass(hover, e.type === 'mouseenter'); + }); + }, + dfrd = $.Deferred(), + dialog, dropbox, pastebox, dropUpload, paste, dirs, spinner, uidialog; + + dropUpload = function(e) { + e.stopPropagation(); + e.preventDefault(); + var file = false, + type = '', + elfFrom = null, + mycwd = '', + data = null, + target = e._target || null, + trf = e.dataTransfer || null, + kind = '', + idx, errors; + + if (trf) { + if (trf.types && trf.types.length && (idx = $.inArray('Files', trf.types)) !== -1) { + kind = 'file'; + } + else if (trf.items && trf.items.length && trf.items[0].kind) { + kind = trf.items[0].kind; + } + + try { + elfFrom = trf.getData('elfinderfrom'); + if (elfFrom) { + mycwd = window.location.href + fm.cwd().hash; + if ((!target && elfFrom === mycwd) || target === mycwd) { + dfrd.reject(); + return; + } + } + } catch(e) {} + + if (kind === 'file' && (trf.items[idx].getAsEntry || trf.items[idx].webkitGetAsEntry || trf.items[idx].getAsFile)) { + file = trf; + type = 'data'; + } else if (kind !== 'string' && trf.files && trf.files.length && $.inArray('Text', trf.types) === -1) { + file = trf.files; + type = 'files'; + } else { + try { + if ((data = trf.getData('text/html')) && data.match(/<(?:img|a)/i)) { + file = [ data ]; + type = 'html'; + } + } catch(e) {} + if (! file) { + if (data = trf.getData('text')) { + file = [ data ]; + type = 'text'; + } else if (trf && trf.files) { + // maybe folder uploading but this UA dose not support it + kind = 'file'; + } + } + } + } + if (file) { + fmUpload({files : file, type : type, target : target, dropEvt : e}); + } else { + errors = ['errUploadNoFiles']; + if (kind === 'file') { + errors.push('errFolderUpload'); + } + fm.error(errors); + dfrd.reject(); + } + }; + + if (!targets && data) { + if (data.input || data.files) { + data.type = 'files'; + fmUpload(data); + } else if (data.dropEvt) { + dropUpload(data.dropEvt); + } + return dfrd; + } + + paste = function(ev) { + var e = ev.originalEvent || ev; + var files = [], items = []; + var file; + if (e.clipboardData) { + if (e.clipboardData.items && e.clipboardData.items.length){ + items = e.clipboardData.items; + for (var i=0; i < items.length; i++) { + if (e.clipboardData.items[i].kind == 'file') { + file = e.clipboardData.items[i].getAsFile(); + files.push(file); + } + } + } else if (e.clipboardData.files && e.clipboardData.files.length) { + files = e.clipboardData.files; + } + if (files.length) { + upload({files : files, type : 'files', clipdata : true}); + return; + } + } + var my = e.target || e.srcElement; + requestAnimationFrame(function() { + var type = 'text', + src; + if (my.innerHTML) { + $(my).find('img').each(function(i, v){ + if (v.src.match(/^webkit-fake-url:\/\//)) { + // For Safari's bug. + // ref. https://bugs.webkit.org/show_bug.cgi?id=49141 + // https://dev.ckeditor.com/ticket/13029 + $(v).remove(); + } + }); + + if ($(my).find('a,img').length) { + type = 'html'; + } + src = my.innerHTML; + my.innerHTML = ''; + upload({files : [ src ], type : type}); + } + }); + }; + + dialog = $('
        ') + .append(inputButton('multiple', 'selectForUpload')); + + if (! fm.UA.Mobile && (function(input) { + return (typeof input.webkitdirectory !== 'undefined' || typeof input.directory !== 'undefined');})(document.createElement('input'))) { + dialog.append(inputButton('multiple webkitdirectory directory', 'selectFolder')); + } + + if (targetDir.dirs) { + + if (targetDir.hash === cwdHash || fm.navHash2Elm(targetDir.hash).hasClass('elfinder-subtree-loaded')) { + getSelector().appendTo(dialog); + } else { + spinner = $('
        ') + .append('') + .appendTo(dialog); + fm.request({cmd : 'tree', target : targetDir.hash}) + .done(function() { + fm.one('treedone', function() { + spinner.replaceWith(getSelector()); + uidialog.elfinderdialog('tabstopsInit'); + }); + }) + .fail(function() { + spinner.remove(); + }); + } + } + + if (fm.dragUpload) { + dropbox = $('
        ') + .on('paste', function(e){ + paste(e); + }) + .on('mousedown click', function(){ + $(this).trigger('focus'); + }) + .on('focus', function(){ + this.innerHTML = ''; + }) + .on('mouseover', function(){ + $(this).addClass(hover); + }) + .on('mouseout', function(){ + $(this).removeClass(hover); + }) + .on('dragenter', function(e) { + e.stopPropagation(); + e.preventDefault(); + $(this).addClass(hover); + }) + .on('dragleave', function(e) { + e.stopPropagation(); + e.preventDefault(); + $(this).removeClass(hover); + }) + .on('dragover', function(e) { + e.stopPropagation(); + e.preventDefault(); + e.originalEvent.dataTransfer.dropEffect = 'copy'; + $(this).addClass(hover); + }) + .on('drop', function(e) { + dialog.elfinderdialog('close'); + targets && (e.originalEvent._target = targets[0]); + dropUpload(e.originalEvent); + }) + .prependTo(dialog) + .after('
        '+fm.i18n('or')+'
        ')[0]; + + } else { + pastebox = $('
        '+fm.i18n('dropFilesBrowser')+'
        ') + .on('paste drop', function(e){ + paste(e); + }) + .on('mousedown click', function(){ + $(this).trigger('focus'); + }) + .on('focus', function(){ + this.innerHTML = ''; + }) + .on('dragenter mouseover', function(){ + $(this).addClass(hover); + }) + .on('dragleave mouseout', function(){ + $(this).removeClass(hover); + }) + .prependTo(dialog) + .after('
        '+fm.i18n('or')+'
        ')[0]; + + } + + uidialog = this.fmDialog(dialog, { + title : this.title + '' + (targetDir? ' - ' + fm.escape(targetDir.i18 || targetDir.name) : '') + '', + modal : true, + resizable : false, + destroyOnClose : true, + propagationEvents : ['mousemove', 'mouseup', 'click'], + close : function() { + var cm = fm.getUI('contextmenu'); + if (cm.is(':visible')) { + cm.click(); + } + } + }); + + return dfrd; + }; + +}; + + +/* + * File: /js/commands/view.js + */ + +/** + * @class elFinder command "view" + * Change current directory view (icons/list) + * + * @author Dmitry (dio) Levashov + **/ +elFinder.prototype.commands.view = function() { + "use strict"; + var self = this, + fm = this.fm, + subMenuRaw; + this.value = fm.viewType; + this.alwaysEnabled = true; + this.updateOnSelect = false; + + this.options = { ui : 'viewbutton'}; + + this.getstate = function() { + return 0; + }; + + this.extra = { + icon: 'menu', + node: $('') + .attr({title: fm.i18n('viewtype')}) + .on('click touchstart', function(e){ + if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) { + return; + } + var node = $(this); + e.stopPropagation(); + e.preventDefault(); + fm.trigger('contextmenu', { + raw: getSubMenuRaw(), + x: node.offset().left, + y: node.offset().top + }); + }) + }; + + this.exec = function() { + var self = this, + value = this.value == 'list' ? 'icons' : 'list'; + + fm.storage('view', value); + return fm.lazy(function() { + fm.viewchange(); + self.update(void(0), value); + this.resolve(); + }); + }; + + fm.bind('init', function() { + subMenuRaw = (function() { + var cwd = fm.getUI('cwd'), + raws = [], + sizeNames = fm.options.uiOptions.cwd.iconsView.sizeNames, + max = fm.options.uiOptions.cwd.iconsView.sizeMax, + i, size; + for (i = 0; i <= max; i++) { + raws.push( + { + label : fm.i18n(sizeNames[i] || ('Size-' + i + ' icons')), + icon : 'view', + callback : (function(s) { + return function() { + cwd.trigger('iconpref', {size: s}); + fm.storage('iconsize', s); + if (self.value === 'list') { + self.exec(); + } + }; + })(i) + } + ); + } + raws.push('|'); + raws.push( + { + label : fm.i18n('viewlist'), + icon : 'view-list', + callback : function() { + if (self.value !== 'list') { + self.exec(); + } + } + } + ); + return raws; + })(); + }).bind('contextmenucreate', function() { + self.extra = { + icon: 'menu', + node: $('') + .attr({title: fm.i18n('cmdview')}) + .on('click touchstart', function(e){ + if (e.type === 'touchstart' && e.originalEvent.touches.length > 1) { + return; + } + var node = $(this), + raw = subMenuRaw.concat(), + idx, i; + if (self.value === 'list') { + idx = subMenuRaw.length - 1; + } else { + idx = parseInt(fm.storage('iconsize') || 0); + } + for (i = 0; i < subMenuRaw.length; i++) { + if (subMenuRaw[i] !== '|') { + subMenuRaw[i].options = (i === idx? {'className': 'ui-state-active'} : void(0)) + ; + } + } + e.stopPropagation(); + e.preventDefault(); + fm.trigger('contextmenu', { + raw: subMenuRaw, + x: node.offset().left, + y: node.offset().top + }); + }) + }; + }); + +}; + +return elFinder; +})); \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/js/elfinder.min.js b/public/packages/barryvdh/elfinder/js/elfinder.min.js new file mode 100644 index 00000000..c66f915f --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/elfinder.min.js @@ -0,0 +1,25 @@ +/*! + * elFinder - file manager for web + * Version 2.1.62 (2023-06-14) + * http://elfinder.org + * + * Copyright 2009-2023, Studio 42 + * Licensed under a 3-clauses BSD license + */ +!function(e,t){if("function"==typeof define&&define.amd)define(["jquery","jquery-ui"],t);else if("undefined"!=typeof exports){var n,i;try{n=require("jquery"),i=require("jquery-ui")}catch(a){}module.exports=t(n,i)}else t(e.jQuery,e.jQuery.ui,!0)}(this,function(e,t,n){n=n||!1;var i=function(t,n,a){var o,r,s,l,c,d,p,u=this,h=[],f=["button","tooltip"],m=e(t),g=e.extend(!0,{},e._data(m.get(0),"events")),v=e("
        ").append(m.contents()).attr("class",m.attr("class")||"").attr("style",m.attr("style")||""),b=m.attr("id")||m.attr("id","elfauto"+e(".elfinder").length).attr("id"),y="elfinder-"+b,w="mousedown."+y,x="keydown."+y,k="keypress."+y,C="keyup."+y,z=!1,T=!1,A=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],j="",S={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmbReqCustomData:!1,tmb:!1},O={},I={},M={},F={},E=[],D={},U={},P=[],q={},R=[],H=[],_=new u.command(u),N="auto",L=400,W=null,B="sounds/",$="",V=!1,K=e(document.createElement("audio")).hide().appendTo("body")[0],X=0,J="",G=null,Y=function(t){var n,i,a,o,r,s,l,c,d={},p={};u.api>=2.1?(u.commandMap=t.options.uiCmdMap&&Object.keys(t.options.uiCmdMap).length?t.options.uiCmdMap:{},J!==JSON.stringify(u.commandMap)&&(J=JSON.stringify(u.commandMap))):u.options.sync=0,t.init?(I={},F={}):(s=j,n="elfinder-subtree-loaded "+u.res("class","navexpand"),r=u.res("class","navcollapse"),i=Object.keys(I),a=function(e){if(!I[e])return!0;var t="directory"===I[e].mime,i=I[e].phash;!(!t||d[i]||!p[i]&&u.navHash2Elm(I[e].hash).is(":hidden")&&u.navHash2Elm(i).next(".elfinder-navbar-subtree").children().length>100)||!t&&i===j||q[e]?t&&(p[i]=!0):(t&&!d[i]&&(d[i]=!0,u.navHash2Elm(i).removeClass(n).next(".elfinder-navbar-subtree").empty()),ee(I[e]))},o=function(){i.length&&(G&&G._abort(),G=u.asyncJob(a,i,{interval:20,numPerOnce:100}).done(function(){var t=u.storage("hide")||{items:{}};Object.keys(M).length&&e.each(M,function(e){t.items[e]||delete M[e]})}))},u.trigger("filesgc").one("filesgc",function(){i=[]}),u.one("opendone",function(){s!==j&&(m.data("lazycnt")?u.one("lazydone",o):o())})),u.sorters={},j=t.cwd.hash,Q(t.files),I[j]?(c=u.diff([t.cwd],!0),c.changed.length&&(Q(c.changed,"change"),u.change({changed:c.changed}))):Q([t.cwd]),t.changed&&t.changed.length&&Q(t.changed,"change"),l=JSON.stringify(u.sorters),$!==l&&(u.trigger("sorterupdate"),$=l),u.lastDir(j),u.autoSync()},Q=function(t,n){var i,a,o,r,s,n=n||"files",l=["sizeInfo","encoding"],c={name:!0,perm:!0,date:!0,size:!0,kind:!0},d=!u.sorters._checked&&"files"===n,p=t.length,h=function(t){var n=t||{},i=[];e.each(u.sortRules,function(e){(c[e]||"undefined"!=typeof n[e]||"mode"===e&&"undefined"!=typeof n.perm)&&i.push(e)}),u.sorters=u.arrayFlip(i,!0),u.sorters._checked=!0},f={},m=u.storage("hide")||{},g=m.items||{};for(a=0;a-1&&o.splice(r,1));return n=null,this},this.trigger=function(t,n,i){var a,o,r,s,l=t.toLowerCase(),c="object"==typeof n,d=D[l]||[],p=[];if(this.debug("event-"+l,n),c&&"undefined"!=typeof i||(i=!0),o=d.length){for(s=e.Event(l),n&&(n._getEvent=function(){return s}),i&&(s.data=n),a=0;a script").each(function(){if(this.src&&this.src.match(/js\/elfinder(?:-[a-z0-9_-]+)?\.(?:min|full)\.js(?:$|\?)/i))return t=e(this),!1}),t&&(i=t.attr("src").replace(/js\/[^\/]+$/,""),i.match(/^(https?\/\/|\/)/)||(n=e("head > base[href]").attr("href"))&&(i=n.replace(/\/$/,"")+"/"+i)),""!==i?u.options.baseUrl=i:(u.options.baseUrl||(u.options.baseUrl="./"),i=u.options.baseUrl),i)}(),this.i18nBaseUrl=(this.options.i18nBaseUrl||this.baseUrl+"js/i18n").replace(/\/$/,"")+"/",this.workerBaseUrl=(this.options.workerBaseUrl||this.baseUrl+"js/worker").replace(/\/$/,"")+"/",this.options.maxErrorDialogs=Math.max(1,parseInt(this.options.maxErrorDialogs||5)),S.dispInlineRegex=this.options.dispInlineRegex,this.options.cssAutoLoad&&!function(){var t=u.baseUrl,n=e('head > link[href$="css/elfinder.min.css"],link[href$="css/elfinder.full.css"]:first').length,i=function(){m.data("cssautoloadHide")&&(m.data("cssautoloadHide").remove(),m.removeData("cssautoloadHide"))},a=function(){u.cssloaded||(i(),u.cssloaded=!0,u.trigger("cssloaded"))};n||(u.cssloaded=null),Array.isArray(u.options.cssAutoLoad)&&(u.options.themes["default"]?u.cssloaded===!0?u.loadCss(u.options.cssAutoLoad):u.bind("cssloaded",function(){u.loadCss(u.options.cssAutoLoad)}):(u.options.themes=Object.assign({"default":{name:"default",cssurls:u.options.cssAutoLoad}},u.options.themes),u.options.theme||(u.options.theme="default"))),null===u.cssloaded&&(m.addClass("elfinder").data("cssautoloadHide",e("")),e("head").append(m.data("cssautoloadHide")),u.options.themes["default"]||(u.options.themes=Object.assign({"default":{name:"default",cssurls:"css/theme.css",author:"elFinder Project",license:"3-clauses BSD"}},u.options.themes),u.options.theme||(u.options.theme="default")),requestAnimationFrame(function(){"hidden"===m.css("visibility")?u.loadCss([t+"css/elfinder.min.css"],{dfd:e.Deferred().done(function(){a()}).fail(function(){i(),u.cssloaded||(u.cssloaded=!1,u.bind("init",function(){u.cssloaded||u.error(["errRead","CSS (elfinder.min)"])}))})}):a()}))}(),function(){var e,t=u.options.themes,n=Object.keys(t||{});n.length&&(e=u.storage("theme")||u.options.theme,t[e]||(e=n[0]),u.cssloaded?u.changeTheme(e):u.bind("cssloaded",function(){u.changeTheme(e)}))}(),this.optionProperties={icon:void 0,csscls:void 0,tmbUrl:void 0,uiCmdMap:{},netkey:void 0,disabled:[]},re||this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),this.options.debug===!0?this.options.debug="all":Array.isArray(this.options.debug)?!function(){var t={};e.each(u.options.debug,function(){t[this]=!0}),u.options.debug=t}():this.options.debug=!1,this.noConflicts={},this.noConflict=function(){e.each(f,function(t,n){e.fn[n]&&"function"==typeof e.fn[n].noConflict&&(u.noConflicts[n]=e.fn[n].noConflict())})},this.noConflict(),this.isCORS=!1,function(){if("undefined"!=typeof u.options.cors&&null!==u.options.cors)u.isCORS=!!u.options.cors;else{var t,i=document.createElement("a"),a=window.location.protocol,o=function(e){return e=e&&":"!==e?e:a,"https:"===e?/\:443$/:/\:80$/},r=window.location.host.replace(o(a),"");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(r!==i.host.replace(o(i.protocol),"")||":"!==i.protocol&&""!==i.protocol&&a!==i.protocol||t&&(r!==t.host.replace(o(t.protocol),"")||":"!==t.protocol&&""!==t.protocol&&a!==t.protocol))&&(u.isCORS=!0)}u.isCORS&&(e.isPlainObject(u.options.customHeaders)||(u.options.customHeaders={}),e.isPlainObject(u.options.xhrFields)||(u.options.xhrFields={}),u.options.requestType="post",u.options.customHeaders["X-Requested-With"]="XMLHttpRequest",u.options.xhrFields.withCredentials=!0)}(),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",s=Math.max(parseInt(this.options.requestMaxConn),1),this.optsCustomData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customData=Object.assign({},this.optsCustomData),this.prevCustomData=null,this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.replaceXhrSend=function(){p||(p=XMLHttpRequest.prototype.send),XMLHttpRequest.prototype.send=function(){var t=this;return u.customHeaders&&e.each(u.customHeaders,function(e){t.setRequestHeader(e,this)}),u.xhrFields&&e.each(u.xhrFields,function(e){e in t&&(t[e]=this)}),p.apply(this,arguments)}},this.restoreXhrSend=function(){p&&(XMLHttpRequest.prototype.send=p)},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb","parents"],this.navPrefix="nav"+(i.prototype.uniqueid?i.prototype.uniqueid:"")+"-",this.cwdPrefix=i.prototype.uniqueid?"cwd"+i.prototype.uniqueid+"-":"",++i.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=y,this.today=new Date(oe.getFullYear(),oe.getMonth(),oe.getDate()).getTime()/1e3,this.yesterday=this.today-86400,l=this.options.UTCDate?"UTC":"",this.getHours="get"+l+"Hours",this.getMinutes="get"+l+"Minutes",this.getSeconds="get"+l+"Seconds",this.getDate="get"+l+"Date",this.getDay="get"+l+"Day",this.getMonth="get"+l+"Month",this.getFullYear="get"+l+"FullYear",this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.lang=this.storage("lang")||this.options.lang,"jp"===this.lang&&(this.lang=this.options.lang="ja"),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||null===this.options.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 u.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,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,o,r=e(this),s=e.grep(n.helper.data("files")||[],function(e){return!!e}),l=[],c=[],d=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),h="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==y||!u.insideWorkzone(t.pageX,t.pageY))return!1;for(a=r.hasClass(u.res(h,"cwdfile"))?u.cwdId2Hash(r.attr("id")):r.hasClass(u.res(h,"navdir"))?u.navId2Hash(r.attr("id")):j,i=s.length;i--;)o=s[i],o!=a&&I[o].phash!=a?l.push(o):(p&&o!==a&&I[a].write?c:d).push(o);return!d.length&&(n.helper.data("droped",!0),c.length&&(n.helper.hide(),u.exec("duplicate",c,{_userAction:!0})),void(l.length&&(n.helper.hide(),u.clipboard(l,!p),u.exec("paste",a,{_userAction:!0},a).always(function(){u.clipboard([]),u.trigger("unlockfiles",{files:s})}),u.trigger("drop",{files:s}))))}},this.enabled=function(){return z&&this.visible()},this.visible=function(){return m[0].elfinder&&m.is(":visible")},this.isRoot=function(e){return!(!e.isroot&&e.phash)},this.root=function(t,n){t=t||j;var i,a;if(!n&&(e.each(u.roots,function(e,n){if(0===t.indexOf(e))return i=n,!1}),i))return i;for(i=I[t];i&&i.phash&&(n||!i.isroot);)i=I[i.phash];if(i)return i.hash;for(;a in I&&I.hasOwnProperty(a);)if(i=I[a],"directory"===i.mime&&!i.phash&&i.read)return i.hash;return""},this.cwd=function(){return I[j]||{}},this.option=function(t,n){var i,a;return n=n||j,u.optionsByHashes[n]&&"undefined"!=typeof u.optionsByHashes[n][t]?u.optionsByHashes[n][t]:!u.hasVolOptions||j===n||(a=u.file(n))&&a.phash===j?O[t]||"":(i="",e.each(u.volOptions,function(e,a){if(0===n.indexOf(e))return i=a[t]||"",!1}),i)},this.getDisabledCmds=function(t,n){var i={hidden:!0};return Array.isArray(t)||(t=[t]),e.each(t,function(e,t){var n=u.option("disabledFlip",t);n&&Object.assign(i,n)}),n?i:Object.keys(i)},this.file=function(e,t){return e?I[e]||(t?M[e]:void 0):void 0},this.files=function(t){var n={};return t?F[t]?(e.each(F[t],function(e){I[e]?n[e]=I[e]:delete F[t][e]}),Object.assign({},n)):{}:Object.assign({},I)},this.parents=function(e){for(var t,n=[];e&&(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=I[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=I[t]&&I[t].path?I[t].path:this.path2array(t,n).join(O.separator);if(i&&I[t]){i=Object.assign({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var o,r=e.Deferred(),s=i.notify,l=!1,c=function(){u.request({data:{cmd:"parents",target:I[t].phash},notify:s,preventFail:!0}).done(d).fail(function(){r.reject()})},d=function(){u.one("parentsdone",function(){a=u.path(t,n),""===a&&l?(l=!1,c()):(s&&(clearTimeout(o),s.cnt=-parseInt(s.cnt||0),u.notify(s)),r.resolve(a))})};return a?r.resolve(a):(u.ui.tree?(s&&(o=setTimeout(function(){u.notify(s)},u.notifyDelay)),l=!0,d(!0)):c(),r)}return a},this.url=function(t,n){var i,a=I[t],o=n||{},r=o.async||!1,s=o.temporary||!1,l=o.onetime&&u.option("onetimeUrl",t)||!1,c=o.absurl||!1,d=r||l?e.Deferred():null,p=function(e){return e&&c&&(e=u.convAbsUrl(e)),e},h=function(n){if(n)return p(n);if(a.url)return p(a.url);if("undefined"==typeof i&&(i=f()),i)return p(i+e.map(u.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/"));var o=Object.assign({},u.customData,{cmd:"file",target:a.hash});return u.oldAPI&&(o.cmd="open",o.current=a.phash),p(u.options.url+(u.options.url.indexOf("?")===-1?"?":"&")+e.param(o,!0))},f=function(){return u.option("url",!u.isRoot(a)&&a.phash||a.hash)};if(!a||!a.read)return r?d.resolve(""):"";if(!l||a.url&&"1"!=a.url||(i=f()))if("1"==a.url||s&&!a.url&&!(i=f()))this.request({data:{cmd:"url",target:t,options:{temporary:s?1:0}},preventDefault:!0,options:{async:r},notify:r?{type:s?"file":"url",cnt:1,hideCnt:!0}:{},progressBar:o.progressBar}).done(function(e){a.url=e.url||""}).fail(function(){a.url=""}).always(function(){var e;return a.url&&s&&(e=a.url,a.url="1"),r?void d.resolve(h(e)):h(e)});else{if(!r)return h();d.resolve(h())}else r=!0,this.request({data:{cmd:"url",target:t,options:{onetime:1}},preventDefault:!0,options:{async:r},notify:{type:"file",cnt:1,hideCnt:!0},progressBar:o.progressBar}).done(function(e){d.resolve(p(e.url||""))}).fail(function(){d.resolve("")});return r?d:void 0},this.forExternalUrl=function(e,t){var n=u.option("onetimeUrl",e),i={async:!0,absurl:!0};return i[n?"onetime":"temporary"]=!0,u.url(e,Object.assign({},t,i))},this.openUrl=function(t,n,i,a){var o=I[t],r="",s=(a||{}).onetimeSize||5242880;return o&&o.read?n&&"sameorigin"!==n||(o.url?1!=o.url&&(r=o.url):O.url&&0===o.hash.indexOf(u.cwd().volumeid)&&(r=O.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/")),n&&!this.isSameOrigin(r)||!r)?i&&this.hasParrotHeaders()?(a?delete a.onetimeSize:a={},!a.onetime&&!a.temporary&&o.size>s&&(o.mime.match(/^video|audio/)?a.temporary=!0:a.onetime=!0),a.onetime||a.temporary?this.url(o.hash,Object.assign({async:!0},a)).done(function(e){i(e)}).fail(function(){i("")}):this.getContents(t,"blob",a).done(function(e){r=(window.URL||window.webkitURL).createObjectURL(e),i(r)}).fail(function(){i("")})):(r=this.options.url,r=r+(r.indexOf("?")===-1?"?":"&")+(this.oldAPI?"cmd=open¤t="+o.phash:"cmd=file")+"&target="+o.hash+"&_t="+(o.ts||parseInt(+new Date/1e3)),n===!0&&(r+="&download=1"),e.each(this.customData,function(e,t){r+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),i?void i(r):r):(r+=(r.match(/\?/)?"&":"?")+"_".repeat((r.match(/[\?&](_+)t=/g)||["&t="]).sort().shift().match(/[\?&](_*)t=/)[1].length+1)+"t="+(o.ts||parseInt(+new Date/1e3)),i?void i(r):r):""},this.tmb=function(t){var n,i,a="elfinder-cwd-bgurl",o="",r={},s=0;return!(!e.isPlainObject(t)||(u.searchStatus.state&&0!==t.hash.indexOf(u.cwd().volumeid)?(n=u.option("tmbUrl",t.hash),i=u.option("tmbCrop",t.hash)):(n=O.tmbUrl,i=O.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(o=u.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(u.oldAPI||n)&&t&&t.tmb&&1!=t.tmb?o=n+t.tmb:u.newAPI&&t&&t.tmb&&1!=t.tmb&&(o=t.tmb),!o))&&("self"!==n&&(t.ts&&(r._t=t.ts),O.tmbReqCustomData&&Object.keys(this.customData).length&&(r=Object.assign(r,this.customData)),Object.keys(r).length&&(o+=o.match(/\?/)?"&":"?",e.each(r,function(e,t){o+=(0===s++?"":"&")+encodeURIComponent(e)+"="+encodeURIComponent(t)}))),{url:o,className:a})},this.selected=function(){return E.slice(0)},this.selectedFiles=function(){return e.map(E,function(e){return I[e]?Object.assign({},I[e]):null})},this.fileByName=function(e,t){var n;for(n in I)if(I.hasOwnProperty(n)&&I[n].phash==t&&I[n].name==e)return I[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),e<1&&(e=0)),e},this.request=function(t){var n,i,a,o,r=this,l=this.options,c=e.Deferred(),d=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),p=Object.assign({},r.customData,{mimes:l.onlyMimes},t.data||t),u=p.cmd,h="binary"===(t.options||{}).dataType,f=!t.asNotOpen&&"open"===u,m=!(h||t.preventDefault||t.preventFail),g=!(h||t.preventDefault||t.preventDone),v=t.progressVal||20,b=null,y=!1,w=t.progressBar?{}:t.notify?Object.assign({progress:v*t.notify.cnt},t.notify):{},x=!!t.cancel,k=h||!!t.raw,C=t.syncOnFail,z=!!t.lazy,T=t.prepare,A=t.navigate,I=(t.options||{}).cache,M=Object.assign({url:l.url,async:!0,type:this.requestType,dataType:"json",cache:r.api>=2.1029,data:p,headers:this.customHeaders,xhrFields:this.xhrFields,progress:function(e){var n=e.loaded/e.total*100;if(b&&clearTimeout(b),t.progressBar)try{t.progressBar.width(n+"%")}catch(e){}else y&&w.type&&(n*=w.cnt,v=500)n=["errResponse","errServerError","HTTP error "+e.status];else{if(414==e.status&&"get"===M.type)return M.type="post",r.abortXHR(e),void(c.xhr=e=r.transport.send(M).fail(n).done(D));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}r.trigger(u+"done"),c.reject({error:n},e,t)},D=function(t){if(r.currentReqCmd=u,t.debug&&r.responseDebug(t),r.setCustomHeaderByXhr(i),k)return r.abortXHR(i),t&&t.debug&&r.debug("backend-debug",t),c.resolve(t);if(!t)return c.reject({error:["errResponse","errDataEmpty"]},i,t);if(!e.isPlainObject(t))return c.reject({error:["errResponse","errDataNotJSON"]},i,t);if(t.error)return f&&e.each(r.leafRoots,function(t,n){r.leafRoots[t]=e.grep(n,function(e){return e!==p.target})}),c.reject({error:t.error},i,t);var n=function(){var n,a=function(n){r.leafRoots[p.target]&&t[n]&&e.each(r.leafRoots[p.target],function(e,i){var a;(a=r.file(i))&&t[n].push(a)})},o=function(){r.textMimes={},e.each(r.res("mimes","text"),function(){r.textMimes[this.toLowerCase()]=!0})};return f?a("files"):"tree"===u&&a("tree"),t=r.normalize(t),r.validResponse(u,t)?(f&&(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.textMimes&&Array.isArray(t.textMimes)&&(r.resources.mimes.text=t.textMimes,o()),!r.textMimes&&o(),t.options&&(O=Object.assign({},S,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),t.maxTargets&&(r.maxTargets=t.maxTargets),p.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?Math.min(parseInt(t.uplMaxFile),50):20)),"function"==typeof T&&T(t),A&&(n=A.target||"added",t[n]&&t[n].length&&r.one(u+"done",function(){var i=t[n],a=r.findCwdNodes(i),o=function(){var t=r.cwd().hash;return e.map(i,function(e){return e.phash&&t===e.phash?e.hash:null})},s=o(),l=function(t){var n,i,a,l=void 0,c=t.action?t.action.data:void 0;return(c||s.length)&&t.action&&(i=t.action.msg)&&(n=t.action.cmd)&&(!t.action.cwdNot||t.action.cwdNot!==r.cwd().hash)&&(a=t.action.done,c=t.action.data,l=e("
        ").append(e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){r.exec(n,c||s,{_userAction:!0,_currentType:"toast",_currentNode:e(this)}),a&&r.one(n+"done",function(){"function"==typeof a?a():"select"===a&&r.trigger("selectfiles",{files:o()})})}))),delete t.action,t.extNode=l,t};A.toast||(A.toast={}),!A.noselect&&r.trigger("selectfiles",{files:r.searchStatus.state>1?e.map(i,function(e){return e.hash}):s}),a.length?(A.noscroll||(a.first().trigger("scrolltoview",{blink:!1}),r.resources.blink(a,"lookme")),e.isPlainObject(A.toast.incwd)&&r.toast(l(A.toast.incwd))):e.isPlainObject(A.toast.inbuffer)&&r.toast(l(A.toast.inbuffer))})),c.resolve(t),void(t.debug&&r.debug("backend-debug",t))):c.reject({error:t.norError||"errResponse"},i,t)};r.abortXHR(i),z?r.lazy(n):n()},U=function(e){i&&"pending"===i.state()&&(r.abortXHR(i,{quiet:!0,abort:!0}),(!e||"unload"!==e.type&&"destroy"!==e.type)&&r.autoSync())},P=function(e){if(r.trigger(u+"done"),"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;U(e)},q=function(t){var n=function(){C=!1,c.reject()};if(t&&"cmd"===t)return u;if(f){if(ie&&"pending"===ie.state()){if(ie._target===p.target)return c.reject("openabort");ie.xhr?ie.xhr.queueAbort():ie.reject("openabort")}ie=c,ie._target=p.target}if(c.always(function(){delete M.headers["X-elFinderReqid"],f&&(ie=null)}).fail(function(t,n,i){var a,s;f&&"openabort"===t&&(t="",C=!1),a={cmd:u,err:t,xhr:n,rc:i},0===t&&ne.length&&(ne=e.grep(ne,function(e){return e("cmd")!==u})),r.trigger("requestError",a),a._getEvent&&a._getEvent().isDefaultPrevented()&&(m=!1,C=!1,t&&(t.error="")),U(),f&&(o=r.file(p.target),o&&o.volumeid&&r.isRoot(o)&&delete r.volumeExpires[o.volumeid]),r.trigger(u+"fail",i),s="object"==typeof t?t.error:t,s&&(m?r.error(s):r.debug("error",r.i18n(s))),C&&r.sync()}),!u)return C=!1,c.reject({error:"errCmdReq"});if(r.maxTargets&&p.targets&&p.targets.length>r.maxTargets)return C=!1,c.reject({error:["errMaxTargets",r.maxTargets]});if(g&&c.done(F),f){for(;a=R.pop();)a.queueAbort();if(j!==p.target)for(;a=H.pop();)a.queueAbort()}return e.inArray(u,(r.cmdsToAdd+" autosync").split(" "))!==-1&&("autosync"!==u&&(r.autoSync("stop"),c.always(function(){r.autoSync()})),r.trigger("openxhrabort")),delete M.preventFail,r.api>=2.1029&&(I?M.headers["X-elFinderReqid"]=d:Object.assign(M.data,{reqid:d})),c.syncOnFail=function(e){C=!!e},te++,c.xhr=i=r.transport.send(M).always(function(){M._xhr&&"undefined"!=typeof M._xhr.responseURL&&(i.responseURL=M._xhr.responseURL||""),--te,ne.length&&ne.shift()()}).fail(E).done(D),r.api>=2.1029&&(i._requestId=d),f||p.compare&&"info"===u?(i.queueAbort=n,R.unshift(i),p.compare&&r.bind(r.cmdsToAdd+" autosync openxhrabort",P),c.always(function(){var t=e.inArray(i,R);p.compare&&r.unbind(r.cmdsToAdd+" autosync openxhrabort",P),t!==-1&&R.splice(t,1)})):e.inArray(u,r.abortCmdsOnOpen)!==-1&&(i.queueAbort=n,H.unshift(i),c.always(function(){var t=e.inArray(i,H);t!==-1&&H.splice(t,1)})),r.bind("unload destroy",P),c.always(function(){r.unbind("unload destroy",P)}),c},_=function(){return w.type&&w.cnt&&(x&&(w.cancel=c,t.eachCancel&&(w.id=+new Date)),n=setTimeout(function(){b=setTimeout(N,1e3),r.notify(w),y=!0,c.always(function(){w.cnt=-(parseInt(w.cnt)||0),r.notify(w),y=!1})},r.notifyDelay),c.always(function(){clearTimeout(n)})),te=2&&(j!==this.root()&&l.push(this.request({data:{cmd:"parents",target:j},preventDefault:!0})),e.each(c(),function(e,t){l.push(a.request({data:{cmd:t.cmd,target:t.target},preventDefault:!0}))})),e.when.apply(e,l).fail(function(t,o){i=o&&200!=o.status,n&&e.inArray("errOpen",t)===-1?s.reject(t&&0!=o.status?t:void 0):(s.reject(t),a.parseError(t)&&a.request({data:{cmd:"open",target:a.lastDir("")||a.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}}))}).done(function(e){var n,i,o;if(e.cwd.compare&&r===e.cwd.compare)return s.reject();if(n={tree:[]},i=arguments.length,i>1)for(o=1;o0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!U[i]&&(U[i]={keyCode:a,altKey:e.inArray("ALT",r)!=-1,ctrlKey:e.inArray("CTRL",r)!=-1,shiftKey:e.inArray("SHIFT",r)!=-1,type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(U,function(e,n){t.push([n.pattern,u.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(P,function(e){return e.hash})};return void 0!==t&&(P.length&&this.trigger("unlockfiles",{files:i()}),q={},P=e.map(t||[],function(e){var t=I[e];return t?(q[e]=!0,{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:P.slice(0,P.length)}),n&&this.trigger("lockfiles",{files:i()})),P.slice(0,P.length)},this.isCommandEnabled=function(e,t){var n,i,a=u.cwd().volumeid||"";return!t&&u.searchStatus.state>1&&u.selected().length&&(t=u.selected()[0]),n=!t||a&&0===t.indexOf(a)?O.disabledFlip:u.option("disabledFlip",t),i=this._commands[e],!!i&&(i.alwaysEnabled||!n[e])},this.exec=function(t,n,i,a){var o,r;return!a&&this.commandMap[t]&&"hidden"!==this.commandMap[t]&&(t=this.commandMap[t]),"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),!a&&n&&(e.isArray(n)?n.length&&(a=n[0]):a=n),o=this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("errUnknownCmd"),r=typeof o,"object"===r&&o.promise||(u.debug("warning",'"cmd.exec()" should be returned "$.Deferred" but cmd "'+t+'" returned "'+r+'"'),o=e.Deferred().resolve()),this.trigger("exec",{dfrd:o,cmd:t,files:n,opts:i,dstHash:a}),o},this.dialog=function(t,n){var i=e("
        ").append(t).appendTo(m).elfinderdialog(n,u),a=i.closest(".ui-dialog"),o=function(){!i.data("draged")&&i.is(":visible")&&i.elfinderdialog("posInit")};return a.length&&(u.bind("resize",o),a.on("remove",function(){u.unbind("resize",o)})),i},this.toast=function(t){return e('
        ').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(t){return t?this.ui[t]||e():m},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(t,n){var i,a=function(){for(var e=m.outerHeight(!0)-m.innerHeight(),t=m;t.get(0)!==W.get(0)&&(t=t.parent(),e+=t.outerHeight(!0)-t.innerHeight(),t.parent().length););return e},o=!m.hasClass("ui-resizable"),r=m.data("resizeSize")||{w:0,h:0},s={};W&&W.data("resizeTm")&&clearTimeout(W.data("resizeTm")),u.options.noResizeBySelf||("string"==typeof n&&(i=n.match(/^([0-9.]+)%$/))&&(W&&W.length||(W=e(window)),W.data("marginToMyNode")||W.data("marginToMyNode",a()),W.data("fitToBaseFunc")||W.data("fitToBaseFunc",function(e){var t=W.data("resizeTm");e.preventDefault(),e.stopPropagation(),t&&cancelAnimationFrame(t),m.hasClass("elfinder-fullscreen")||u.UA.Mobile&&W.data("rotated")===u.UA.Rotated||(W.data("rotated",u.UA.Rotated),W.data("resizeTm",requestAnimationFrame(function(){u.restoreSize()})))}),"undefined"==typeof W.data("rotated")&&W.data("rotated",u.UA.Rotated),n=W.height()*(i[1]/100)-W.data("marginToMyNode"),W.off("resize."+u.namespace,W.data("fitToBaseFunc")),o&&W.on("resize."+u.namespace,W.data("fitToBaseFunc"))),m.css({width:t,height:parseInt(n)})),s.w=Math.round(m.width()),s.h=Math.round(m.height()),m.data("resizeSize",s),s.w===r.w&&s.h===r.h||(m.trigger("resize"),this.trigger("resize",{width:s.w,height:s.h}))},this.restoreSize=function(){this.resize(N,L)},this.show=function(){m.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(T=z,z=!1),this.disable(),this.trigger("hide"),m.hide()},this.lazy=function(t,n,i){var a=function(e){var t,n=m.data("lazycnt");e?(t=!m.data("lazyrepaint")&&i.repaint,n?m.data("lazycnt",++n):m.data("lazycnt",1).addClass("elfinder-processing"),t&&m.data("lazyrepaint",!0).css("display")):n&&n>1?m.data("lazycnt",--n):(t=m.data("lazyrepaint"),m.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),t&&m.css("display"),u.trigger("lazydone"))},o=e.Deferred(),r=function(){o.resolve(t.call(o)),a(!1)};return n=n||0,i=i||{},a(!0),n?setTimeout(r,n):requestAnimationFrame(r),o},this.destroy=function(){m&&m[0].elfinder&&(m.hasClass("elfinder-fullscreen")&&u.toggleFullscreen(m),this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),P=[],E=[],D={},U={},e(window).off("."+y),e(document).off("."+y),u.trigger=function(){},e(K).remove(),m.off().removeData().empty().append(v.contents()).attr("class",v.attr("class")).attr("style",v.attr("style")),delete m[0].elfinder,e.each(g,function(t,n){e.each(n,function(e,t){m.on(t.type+(t.namespace?"."+t.namespace:""),t.selector,t.handler)})}))},this.autoSync=function(t){var n;if(u.options.sync>=1e3){if(r&&(clearTimeout(r),r=null,u.trigger("autosync",{action:"stop"})),"stop"===t?++X:X=Math.max(0,--X),X||"forcestop"===t||!u.options.syncStart)return;n=function(t){var i;O.syncMinMs&&(t||r)&&(t&&u.trigger("autosync",{action:"start"}),i=Math.max(u.options.sync,O.syncMinMs),r&&clearTimeout(r),r=setTimeout(function(){var t,a=!0,o=j;O.syncChkAsTs&&I[o]&&(t=I[o].ts)?u.request({data:{cmd:"info",targets:[o],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;a=!0,e.compare&&(i=e.compare,i==t&&(a=!1)),a?u.sync(o).always(function(){i&&(I[o].ts=i),n()}):n()}).fail(function(t,a){var o=u.parseError(t);o&&0!=a.status?(u.error(o),Array.isArray(o)&&e.inArray("errOpen",o)!==-1&&u.request({data:{cmd:"open",target:u.lastDir("")||u.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):r=setTimeout(function(){n()},i)}):u.sync(j,!0).always(function(){n()})},i))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(ei.left+i.width+n||ti.top+i.height+n)},this.toFront=function(t){var n=m.children(".ui-front").removeClass("elfinder-frontmost"),i=n.last();n.css("z-index",""),e(t).addClass("ui-front elfinder-frontmost").css("z-index",i.css("z-index")+1)},this.toHide=function(t,n){var i,a=e(t);!n&&a.hide(),a.hasClass("elfinder-frontmost")&&(a.removeClass("elfinder-frontmost"),i=m.children(".ui-front:visible:not(.elfinder-frontmost)").last(),i.length&&requestAnimationFrame(function(){m.children(".elfinder-frontmost:visible").length||(u.toFront(i),i.trigger("frontmost"))}))},this.getMaximizeCss=function(){return{width:"100%",height:"100%",margin:0,top:0,left:0,display:"block",position:"fixed",zIndex:Math.max(u.zIndex?u.zIndex+1:0,1e3),maxWidth:"",maxHeight:""}},function(){re&&u.UA.Fullscreen&&(u.UA.Fullscreen=!1,se&&"undefined"!=typeof se.attr("allowfullscreen")&&(u.UA.Fullscreen=!0));var t,n,i,a,o="elfinder-fullscreen",r="elfinder-fullscreen-native",s=function(){var t=0,n=0;e.each(m.children(".ui-dialog,.ui-draggable"),function(i,a){var o=e(a),r=o.position();r.top<0&&(o.css("top",t),t+=20),r.left<0&&(o.css("left",n),n+=20)})},l=function(){var i=u.storage("useFullscreen");a=u.UA.Fullscreen&&(i?i>0:"screen"===u.options.commandsOptions.fullscreen.mode)?{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()}}:{fullElm:function(){var e;return m.hasClass(o)?m.get(0):(e=m.find("."+o),e.length?e.get(0):null)},exitFull:function(){var i;e(window).off("resize."+y,d),void 0!==n&&e("body").css("overflow",n),n=void 0,t&&(i=t.elm,c(i),e(i).trigger("resize",{fullscreen:"off"})),e(window).trigger("resize")},toFull:function(t){return n=e("body").css("overflow")||"",e("body").css("overflow","hidden"),e(t).css(u.getMaximizeCss()).addClass(o).trigger("resize",{fullscreen:"on"}),s(),e(window).on("resize."+y,d).trigger("resize"),!0}}},c=function(n){t&&t.elm==n&&(e(n).removeClass(o+" "+r).attr("style",t.style),t=null)},d=function(t){var n;t.target===window&&(i&&cancelAnimationFrame(i),i=requestAnimationFrame(function(){(n=a.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})}))};l(),e(document).on("fullscreenchange."+y+" webkitfullscreenchange."+y+" mozfullscreenchange."+y+" MSFullscreenChange."+y,function(n){if(u.UA.Fullscreen){var l=a.fullElm(),p=e(window);i&&cancelAnimationFrame(i),null===l?(p.off("resize."+y,d),t&&(l=t.elm,c(l),e(l).trigger("resize",{fullscreen:"off"}))):(e(l).addClass(o+" "+r).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),p.on("resize."+y,d),s()),p.trigger("resize")}}),u.toggleFullscreen=function(n,i){var o=e(n).get(0),r=null;if(r=a.fullElm()){if(r==o){if(i===!0)return r}else if(i===!1)return r;return a.exitFull(),null}return i===!1?null:(l(),t={elm:o,style:e(o).attr("style")},a.toFull(o)!==!1?o:(t=null,null))}}(),function(){var t,n="elfinder-maximized",i=function(e){if(e.target===window&&e.data&&e.data.elm){var n=e.data.elm;t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){n.trigger("resize",{maximize:"on"})})}},a=function(t){e(window).off("resize."+y,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"})},o=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(u.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+y,{elm:t},i),t.trigger("resize",{maximize:"on"})};u.toggleMaximize=function(t,i){var r=e(t),s=r.hasClass(n);if(s){if(i===!0)return;a(r)}else{if(i===!1)return;o(r)}}}(),Object.assign(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,DIG0:48,DIG1:49,DIG2:50,DIG3:51,DIG4:52,DIG5:53,DIG6:54,DIG7:55,DIG8:56,DIG9:57,NUM0:96,NUM1:97,NUM2:98,NUM3:99,NUM4:100,NUM5:101,NUM6:102,NUM7:103,NUM8:104,NUM9:105,CONTEXTMENU:93,DOT:190}),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 u.UA.IE||(t._xhr=new XMLHttpRequest,t.xhr=function(){return t.progress&&t._xhr.addEventListener("progress",t.progress),t._xhr}),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=function(e){var t=function(e){var t,n,i;for(t=0,n=e.length,i=[];t=55296&&a<=56319?o.push((1023&a)+64<<10|1023&e[++n]):o.push(a);return o},i=function(e){var t,n,i,a,o=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],t=194?o((31&i)<<6|63&e[++t]):i<=239&&i>=224?o((15&i)<<12|(63&e[++t])<<6|63&e[++t]):i<=247&&i>=240?o(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):o(65533);return a};return i(n(e))},this.getContents=function(t,n,i){var a,o,r=this,s=e.Deferred(),l=n||"arraybuffer";return s.fail(function(){o&&"pending"===o.state()&&o.reject()}),a=r.openUrl(t),r.isSameOrigin(a)||(a=r.openUrl(t,!0)),o=r.request(Object.assign({data:{cmd:"get"},options:{url:a,type:"get",cache:!0,dataType:"binary",responseType:l,processData:!1},notify:{type:"file",cnt:1,hideCnt:!0},cancel:!0},i||{})).fail(function(){s.reject()}).done(function(e){s.resolve(e)}),s},this.getBinaryByUrl=function(t,n,i){var a,o=this,r=e.Deferred();return r.fail(function(){a&&"pending"===a.state()&&a.reject()}),a=o.request(Object.assign({data:{cmd:"get"},options:Object.assign({type:"get",cache:!0,dataType:"binary",responseType:"blob",processData:!1},t)},i||{})).fail(function(){r.reject()}).done(function(e){n&&n(e),r.resolve(e)}),r},this.getMimetype=function(e,t){var n,i,a=t;return i=(e+"").match(/\.([^.]+)$/),i&&(n=i[1])&&(o||(o=u.arrayFlip(u.mimeTypes)),(a=o[n.toLowerCase()])||(a=t)),a},u.hashCheckers=[],function(t){var n={};window.Worker&&window.ArrayBuffer&&(t.options.cdns.sparkmd5&&(n.SparkMD5=!0,t.hashCheckers.push("md5")),t.options.cdns.jssha&&(n.jsSHA=!0,t.hashCheckers=t.hashCheckers.concat(["sha1","sha224","sha256","sha384","sha512","sha3-224","sha3-256","sha3-384","sha3-512","shake128","shake256"]))),t.getContentsHashes=function(i,a,o,r){var s,l=e.Deferred(),c=t.arrayFlip(a||["md5"],!0),d=[],p={},u=o?o:{shake128len:256,shake256len:512};return l.fail(function(){s&&s.reject()}),Object.keys(n).length?s=t.getContents(i,"arraybuffer",r).done(function(a){c.md5&&n.SparkMD5&&d.push(function(){var o=e.Deferred();try{var r=t.getWorker();o.fail(function(){r&&r.terminate()}),r.onmessage=function(e){if(r&&r.terminate(),e.data.hash){var n;p.md5=e.data.hash,(n=t.file(i))&&(n.md5=p.md5)}else e.data.error&&(p.md5=e.data.error);l.notify(p),o.resolve()},r.onerror=function(e){o.reject()},r.postMessage({scripts:[t.options.cdns.sparkmd5,t.getWorkerUrl("calcfilehash.js")],data:{type:"md5",bin:a}}),l.fail(function(){o.reject()})}catch(s){o.reject(),delete n.SparkMD5}return o}()),n.jsSHA&&e.each(["1","224","256","384","512","3-224","3-256","3-384","3-512","ke128","ke256"],function(o,r){c["sha"+r]&&d.push(function(){var o=e.Deferred();try{var s=t.getWorker();o.fail(function(){s&&s.terminate()}),s.onmessage=function(e){if(s&&s.terminate(),e.data.hash){var n;p["sha"+r]=e.data.hash,(n=t.file(i))&&(n["sha"+r]=p["sha"+r])}else e.data.error&&(p["sha"+r]=e.data.error);l.notify(p),o.resolve()},s.onerror=function(e){o.reject()},s.postMessage({scripts:[t.options.cdns.jssha,t.getWorkerUrl("calcfilehash.js")],data:{type:r,bin:a,hashOpts:u}}),l.fail(function(){o.reject()})}catch(c){o.reject(),delete n.jsSHA}return o}())}),d.length?e.when.apply(null,d).always(function(){l.resolve(p)}):l.reject()}).fail(function(){l.reject()}):l.reject(),l}}(this),this.parseError=function(t){var n=t;return e.isPlainObject(n)&&(n=n.error),n},this.error=function(){var e,t=arguments[0],n=arguments[1]||null;return 1==arguments.length&&"function"==typeof t?u.bind("error",t):(e=this.parseError(t),e!==!0&&e?u.trigger("error",{error:e,opts:n}):this)},e.each(A,function(t,n){u[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?u.bind(n,t):u.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!z&&u.api&&u.visible()&&u.ui.overlay.is(":hidden")&&!m.children(".elfinder-dialog."+u.res("class","editing")+":visible").length&&(z=!0,document.activeElement&&document.activeElement.blur(),m.removeClass("elfinder-disabled"))}).disable(function(){T=z,z=!1,m.addClass("elfinder-disabled")}).open(function(){E=[]}).select(function(t){var n=0,i=[];E=e.grep(t.data.selected||t.data.value||[],function(e){return i.length||u.maxTargets&&++n>u.maxTargets?(i.push(e),!1):!!I[e]}),i.length&&(u.trigger("unselectfiles",{files:i,inselect:!0}),u.toast({mode:"warning",msg:u.i18n(["errMaxTargets",u.maxTargets])}))}).error(function(t){var n,i,a={cssClass:"elfinder-dialog-error",title:u.i18n("error"),resizable:!1,destroyOnClose:!0,buttons:{}},o=u.getUI(),r=o.children(".elfinder-dialog-error").length;r
        '+u.i18n(t.data.error),a)):(n=o.children(".elfinder-dialog-error:last").children(".ui-dialog-content:first"),i=n.children(".elfinder-error-counter"),i.length?i.data("cnt",parseInt(i.data("cnt"))+1).html(u.i18n(["moreErrors",i.data("cnt")])):(i=e(''+u.i18n(["moreErrors",1])+"").data("cnt",1),n.append("
        ",i)))}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){I[e]&&(I[e].tmb=t)})}).bind("searchstart",function(e){Object.assign(u.searchStatus,e.data),u.searchStatus.state=1}).bind("search",function(e){u.searchStatus.state=2}).bind("searchend",function(){u.searchStatus.state=0,u.searchStatus.ininc=!1,u.searchStatus.mixed=!1}).bind("canMakeEmptyFile",function(t){var n=t.data,i={};n&&Array.isArray(n.mimes)&&(n.unshift||(i=u.mimesCanMakeEmpty),e.each(n.mimes,function(){i[this]||(i[this]=u.mimeTypes[this])}),n.unshift&&(u.mimesCanMakeEmpty=Object.assign(i,u.mimesCanMakeEmpty)))}).bind("themechange",function(){requestAnimationFrame(function(){u.trigger("uiresize")})}),!0===this.options.sound&&this.bind("playsound",function(t){var n=K.canPlayType&&K.canPlayType('audio/wav; codecs="1"'),i=t.data&&t.data.soundFile;n&&i&&""!=n&&"no"!=n&&e(K).html('')[0].play()}),e.each(this.options.handlers,function(e,t){u.bind(e,t)}),this.history=new this.history(this),this.roots={},this.leafRoots={},this.volumeExpires={},this._commands={},Array.isArray(this.options.commands)||(this.options.commands=[]),e.inArray("*",this.options.commands)!==-1&&(this.options.commands=Object.keys(this.commands)),this.commandMap={},this.volOptions={},this.hasVolOptions=!1,this.trashes={},this.optionsByHashes={},this.uiAutoHide=[],this.one("open",function(){u.uiAutoHide.length&&setTimeout(function(){u.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){u.uiAutoHide.length&&u.uiAutoHide.shift()()}),this.options.width&&(N=this.options.width),this.options.height&&(L=this.options.height),this.options.heightBase&&(W=e(this.options.heightBase)),B=this.options.soundPath?this.options.soundPath.replace(/\/+$/,"")+"/":this.baseUrl+B,this.options.parrotHeaders&&Array.isArray(this.options.parrotHeaders)&&this.options.parrotHeaders.length?(this.parrotHeaders=this.options.parrotHeaders,e.each(this.parrotHeaders,function(e,t){var n=u.sessionStorage("core-ph:"+t);n&&(u.customHeaders[t]=n)})):this.parrotHeaders=[],u.one("opendone",function(){var t;e(document).on("click."+y,function(t){z&&!u.options.enableAlways&&!e(t.target).closest(m).length&&u.disable()}).on(x+" "+k+" "+C+" "+w,ae),u.options.useBrowserHistory&&e(window).on("popstate."+y,function(t){var n,i,a=t.originalEvent.state||{},o=!!a.thash,r=m.find(".elfinder-frontmost:visible"),s=m.find(".elfinder-navbar-dir,.elfinder-cwd-filename").find("input,textarea");o||(a={thash:u.cwd().hash},e("html,body").animate({scrollTop:m.offset().top})),r.length||s.length?(history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash),r.length?r.hasClass(u.res("class","preventback"))||(r.hasClass("elfinder-contextmenu")?e(document).trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1})):r.hasClass("elfinder-dialog")?r.elfinderdialog("close"):r.trigger("close")):s.trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))):o?!e.isEmptyObject(u.files())&&u.request({data:{cmd:"open",target:a.thash,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0}):(n=function(){i.trigger("click")},u.one("open",n,!0),i=u.toast({msg:u.i18n("pressAgainToExit"),onHidden:function(){u.unbind("open",n),history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash)}}))}),e(window).on("resize."+y,function(e){e.target===this&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){var e=m.data("resizeSize")||{w:0,h:0},t={w:Math.round(m.width()),h:Math.round(m.height())};m.data("resizeSize",t),t.w===e.w&&t.h===e.h||(m.trigger("resize"),u.trigger("resize",{width:t.w,height:t.h}))}))}).on("beforeunload."+y,function(t){var n,i;if(!u.pauseUnloadCheck()){if(m.is(":visible")&&(u.ui.notify.children().length&&e.inArray("hasNotifyDialog",u.options.windowCloseConfirm)!==-1?n=u.i18n("ntfsmth"):m.find("."+u.res("class","editing")).length&&e.inArray("editingFile",u.options.windowCloseConfirm)!==-1?n=u.i18n("editingFile"):(i=Object.keys(u.selected()).length)&&e.inArray("hasSelectedItem",u.options.windowCloseConfirm)!==-1?n=u.i18n("hasSelected",""+i):(i=Object.keys(u.clipboard()).length)&&e.inArray("hasClipboardData",u.options.windowCloseConfirm)!==-1&&(n=u.i18n("hasClipboard",""+i)),n))return t.returnValue=n,n;u.trigger("unload")}}),e(window).on("message."+y,function(e){var t,n,i=e.originalEvent||null;if(i&&(0===u.convAbsUrl(u.options.url).indexOf(i.origin)||0===u.convAbsUrl(u.uploadURL).indexOf(i.origin)))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&u.trigger(t.bind+"fail",n),u.error(n.error)):(n.warning&&u.error(n.warning),u.updateCache(n),n.removed&&n.removed.length&&u.remove(n),n.added&&n.added.length&&u.add(n),n.changed&&n.changed.length&&u.change(n),t.bind&&(u.trigger(t.bind,n),u.trigger(t.bind+"done")),n.sync&&u.sync()))}catch(e){u.sync()}}),u.options.enableAlways?(e(window).on("focus."+y,function(e){e.target===this&&u.enable()}),re&&e(window.top).on("focus."+y,function(){!u.enable()||se&&!se.is(":visible")||requestAnimationFrame(function(){e(window).trigger("focus")})})):re&&e(window).on("blur."+y,function(e){z&&e.target===this&&u.disable()}),re&&m.on("click",function(t){e(window).trigger("focus")}),u.options.enableByMouseOver&&m.on("mouseenter touchstart",function(t){re&&e(window).trigger("focus"),!u.enabled()&&u.enable()}),e(window).on("visibilitychange."+y,function(e){var t=document.hidden||document.webkitHidden||document.msHidden;u.options.syncStart&&u.autoSync(t?"stop":void 0)})}),m[0].elfinder=this,h.push(function(){var t=u.lang,n=u.i18nBaseUrl+"elfinder."+t+".js",i=e.Deferred().done(function(){u.i18[t]&&(u.lang=t),u.trigger("i18load"),c="en"===u.lang?u.i18.en:e.extend(!0,{},u.i18.en,u.i18[u.lang])});return u.i18[t]?i.resolve():(u.lang="en",u.hasRequire?require([n],function(){i.resolve()},function(){i.resolve()}):u.loadScript([n],function(){i.resolve()},{loadType:"tag",error:function(){i.resolve()}})),i}()),d=function(){var t;return u.messages=c.messages,e.fn.selectable&&e.fn.draggable&&e.fn.droppable&&e.fn.resizable&&e.fn.button&&e.fn.slider?m.length?u.options.url?(t=Object.assign({name:u.i18n("name"),perm:u.i18n("perms"),date:u.i18n("modify"),size:u.i18n("size"),kind:u.i18n("kind"),modestr:u.i18n("mode"),modeoct:u.i18n("mode"),modeboth:u.i18n("mode")},u.options.uiOptions.cwd.listView.columnsCustomName),u.getColumnName=function(e){var n=t[e]||u.i18n(e);return"function"==typeof n?n():n},u.direction=c.direction,u.dateFormat=u.options.dateFormat||c.dateFormat,u.fancyFormat=u.options.fancyDateFormat||c.fancyDateFormat,u.nonameDateFormat=(u.options.nonameDateFormat||c.nonameDateFormat).replace(/[\/\\]/g,"_"),u.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==u.direction?"rtl":"ltr")+(u.UA.Touch?" elfinder-touch"+(u.options.resizable?" touch-punch":""):"")+(u.UA.Mobile?" elfinder-mobile":"")+(u.UA.iOS?" elfinder-ios":"")+" "+u.options.cssClass,m.addClass(u.cssClass).on(w,function(){!z&&u.enable()}),function(){var t,n,i,a,o,r=x+"draggable keyup."+y+"draggable";u.draggable={appendTo:m,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(r,s){var l,c,d=s.helper,p=e.grep(d.data("files")||[],function(e){return!!e&&(q[e]=!0,!0)}),h=!1;for(o=m.attr("style"),m.width(m.width()).height(m.height()),t="ltr"===u.direction,n=u.getUI("workzone").data("rectangle"),i=n.top+n.height,a=i-u.getUI("navdock").outerHeight(!0),u.draggingUiHelper=d,l=p.length;l--;)if(c=p[l],I[c].locked){h=!0,d.data("locked",!0);break}!h&&u.trigger("lockfiles",{files:p}),d.data("autoScrTm",setInterval(function(){d.data("autoScr")&&u.autoScroll[d.data("autoScr")](d.data("autoScrVal"))},50))},drag:function(o,r){var s,l,c,d=r.helper;((l=n.top>o.pageY)||ao.pageX?(t?"navbar":"cwd")+(l?"Up":"Down"):(t?"cwd":"navbar")+(l?"Up":"Down"),l||("cwd"===s.substr(0,3)?i0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),d.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),d.data("refreshPositions",null)))},stop:function(t,n){var i,a=n.helper;e(document).off(r),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),u.draggingUiHelper=null,u.trigger("focus").trigger("dragstop"),a.data("droped")||(i=e.grep(a.data("files")||[],function(e){return!!e}),u.trigger("unlockfiles",{files:i}),u.trigger("selectfiles",{files:u.selected()})),u.enable(),m.attr("style",o),a.data("autoScrTm")&&clearInterval(a.data("autoScrTm"))},helper:function(t,n){var i,a,o,s=this.id?e(this):e(this).parents("[id]:first"),l=e('
        '),c=function(t){var n,i=t.mime,a=u.tmb(t);return n='
        ',a?n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML:t.icon&&(n=e(n).css(u.getIconStyle(t,!0)).get(0).outerHTML),t.csscls&&(n='
        '+n+"
        "),n};return u.draggingUiHelper&&u.draggingUiHelper.stop(!0,!0),u.trigger("dragstart",{target:s[0],originalEvent:t},!0),i=s.hasClass(u.res("class","cwdfile"))?u.selected():[u.navId2Hash(s.attr("id"))],l.append(c(I[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",y).data("dropover",0),(a=i.length)>1&&l.append(c(I[i[a-1]])+''+a+""),e(document).on(r,function(e){if(u._commands.copy){var t=e.shiftKey||e.ctrlKey||e.metaKey;o!==t&&(o=t,l.is(":visible")&&l.data("dropover")&&!l.data("droped")&&(l.toggleClass("elfinder-drag-helper-plus",!!l.data("locked")||o),u.trigger(o?"unlockfiles":"lockfiles",{files:i,helper:l})))}}),l}}}(),u.commands.getfile&&("function"==typeof u.options.getFileCallback?(u.bind("dblclick",function(e){e.preventDefault(),u.exec("getfile").fail(function(){u.exec("open",e.data&&e.data.file?[e.data.file]:void 0)})}),u.shortcut({pattern:"enter",description:u.i18n("cmdgetfile"),callback:function(){u.exec("getfile").fail(function(){u.exec("mac"==u.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:u.i18n("mac"==u.OS?"cmdrename":"cmdopen"),callback:function(){u.exec("mac"==u.OS?"rename":"open")}})):u.options.getFileCallback=null),e.each(u.commands,function(t,n){var i,a,o=Object.assign({},n.prototype);if(e.isFunction(n)&&!u._commands[t]&&(n.prototype.forceLoad||e.inArray(t,u.options.commands)!==-1)){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(u.commands[i]))return!0;n.prototype=Object.assign({},_,new u.commands[i],n.prototype)}else n.prototype=Object.assign({},_,n.prototype);u._commands[t]=new n,n.prototype=o,a=u.options.commandsOptions[t]||{},i&&u.options.commandsOptions[i]&&(a=e.extend(!0,{},u.options.commandsOptions[i],a)),u._commands[t].setup(t,a),u._commands[t].linkedCmds.length&&e.each(u._commands[t].linkedCmds,function(t,n){var i=u.commands[n];e.isFunction(i)&&!u._commands[n]&&(i.prototype=_,u._commands[n]=new i,u._commands[n].setup(n,u.options.commandsOptions[n]||{}))})}}),u.ui={workzone:e("
        ").appendTo(m).elfinderworkzone(u),navbar:e("
        ").appendTo(m).elfindernavbar(u,u.options.uiOptions.navbar||{}),navdock:e("
        ").appendTo(m).elfindernavdock(u,u.options.uiOptions.navdock||{}),contextmenu:e("
        ").appendTo(m).elfindercontextmenu(u),overlay:e("
        ").appendTo(m).elfinderoverlay({show:function(){u.disable()},hide:function(){T&&u.enable()}}),cwd:e("
        ").appendTo(m).elfindercwd(u,u.options.uiOptions.cwd||{}),notify:u.dialog("",{cssClass:"elfinder-dialog-notify"+(u.options.notifyDialog.canClose?"":" elfinder-titlebar-button-hide"),position:u.options.notifyDialog.position,absolute:!0,resizable:!1,autoOpen:!1,allowMinimize:!0,closeOnEscape:!!u.options.notifyDialog.canClose,title:" ",width:u.options.notifyDialog.width?parseInt(u.options.notifyDialog.width):null,minHeight:null,minimize:function(){u.ui.notify.trigger("minimize")}}),statusbar:e('
        ').hide().appendTo(m),toast:e('
        ').appendTo(m),bottomtray:e('
        ').appendTo(m),progressbar:e('
        ').appendTo(m)},u.trigger("uiready"),e.each(u.options.ui||[],function(t,n){var i="elfinder"+n,a=u.options.uiOptions[n]||{};!u.ui[n]&&e.fn[i]&&(u.ui[n]=e("<"+(a.tag||"div")+"/>").appendTo(m),u.ui[n][i](u,a))}),u.ui.progressbar.appendTo(u.ui.workzone),u.ui.notify.prev(".ui-dialog-titlebar").append('
        '),u.resize(N,L),u.options.resizable&&(m.resizable({resize:function(e,t){u.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),u.UA.Touch&&m.addClass("touch-punch")),function(){var e=u.getUI("navbar"),t=u.getUI("cwd").parent();u.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)}}}(),u.UA.Touch&&!function(){var e,t,n,i,a,o,r,s,l,c=u.getUI("navbar"),d=u.getUI("toolbar"),p="touchmove.stopscroll",h=function(e){var n=e.originalEvent.touches||[{}],i=n[0].pageY||null;(!t||i1||("touchstart"===s.type?(n=m.offset(),i=m.width(),c&&(e=!1,c.is(":hidden")?(l||(l=Math.max(50,i/10)),(A?z-n.left:i+n.left-z)n.left+i-o,y?(l=Math.max(50,i/10),e=z):e=!1)),d&&(t=!1,s.originalEvent._preventSwipeY||(r=d.height(),a=n.top,T-a<(d.is(":hidden")?v:r+30)&&(t=T,m.on(p,d.is(":hidden")?f:h))))):(c&&e!==!1&&(b=(A?e>z:e.6*o||w>("navhide"===b?o/3:45)&&("navshow"===b||(A?zn.left+i-20)))&&(u.getUI("navbar").trigger(b,{handleW:l}),e=!1)),d&&t!==!1&&(x=d.offset().top,Math.abs(t-T)>Math.min(45,r/3)&&(k=t>T?"slideUp":"slideDown",("slideDown"===k||x+20>T)&&(d.is("slideDown"===k?":hidden":":visible")&&d.stop(!0,!0).trigger("toggle",{duration:100,handleH:v}),t=!1)))))})}(),u.dragUpload&&!function(){var t,n,i=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},a="native-drag-enter",o="native-drag-disable",r="class",s=u.res(r,"navdir"),l=(u.res(r,"droppable"),u.res(r,"adroppable"),u.res(r,"navarrow"),u.res(r,"adroppable")),c=u.getUI("workzone"),d="ltr"===u.direction,p=function(){n&&cancelAnimationFrame(n),n=null};m.on("dragenter",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation(),t=c.data("rectangle"))}).on("dragleave",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation())}).on("dragover",function(e){var a;i(e)?(e.preventDefault(),e.stopPropagation(),e.originalEvent.dataTransfer.dropEffect="none",n||(n=requestAnimationFrame(function(){var i,o=t.top+t.height,r=o-u.getUI("navdock").outerHeight(!0);((a=e.pageYr)&&(i=t.cwdEdge>e.pageX?(d?"navbar":"cwd")+(a?"Up":"Down"):(d?"cwd":"navbar")+(a?"Up":"Down"),a||"cwd"===i.substr(0,3)&&(o=11,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:t,Edge:!(!t||!window.msCredentials),Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart,iOS:navigator.platform.match(/^iP(?:[ao]d|hone)/),Mac:navigator.platform.match(/^Mac/),Fullscreen:"undefined"!=typeof(document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen),Angle:0,Rotated:!1,CSS:function(){var e,t=document.createElement("a").style,n=document.createElement("p").style;return e="position:sticky;position:-webkit-sticky;",e+="width:-webkit-max-content;width:-moz-max-content;width:-ms-max-content;width:max-content;",t.cssText=e,{positionSticky:t.position.indexOf("sticky")!==-1,widthMaxContent:t.width.indexOf("max-content")!==-1,flex:"undefined"!=typeof n.flex}}()};return n}(),cookieEnabled:window.navigator.cookieEnabled,hasRequire:"function"==typeof define&&define.amd,currentReqCmd:"",keyState:{},i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",nonameDateFormat:"ymd-His",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",group:"Selects",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"},mimeTypes:{},rules:{defaults:function(e){return!(!e||e.added&&!Array.isArray(e.added)||e.removed&&!Array.isArray(e.removed)||e.changed&&!Array.isArray(e.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&Array.isArray(t.files)},tree:function(e){return e&&e.tree&&Array.isArray(e.tree)},parents:function(e){return e&&e.tree&&Array.isArray(e.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||Array.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||Array.isArray(t.added))},search:function(e){return e&&e.files&&Array.isArray(e.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n,i=this;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=JSON.parse(t)}catch(a){return{error:["errResponse","errDataNotJSON"]}}return n=i.normalize(n),i.validResponse("upload",n)?(n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return i.file(e.hash)?e.hash:null})),n):{error:n.norError||["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,failSyncTm:null,chunkfailReq:{},checkExists:function(t,n,i,a){var o,r=e.Deferred(),s=[],l={},c=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},d=function(){r.resolve(s,l)},p=function(){var r=[],p=[],u=n!==i.cwd().hash?i.path(n,!0)+i.option("separator",n):"",h=function(e){var n=e==p.length-1,o={cssClass:"elfinder-confirm-upload",title:i.i18n("cmdupload"),text:["errExists",u+p[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?d():h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=p.length;e0&&delete o.reject,i.confirm(o)};return i.file(n).read?(o=e.map(t,function(e,t){return!e.name||i.UA.iOS&&"image.jpg"===e.name?null:{i:t,name:e.name}}),void i.request({data:{cmd:"ls",target:n,intersect:e.map(o,function(e){return e.name})},notify:{type:"preupload",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(t){var a,s;t&&(t.error?c():i.options.overwriteUploadConfirm&&i.option("uploadOverwrite",n)&&t.list&&(Array.isArray(t.list)?r=t.list||[]:(a=[],r=e.map(t.list,function(e){return"string"==typeof e?e:(a=a.concat(e),!1)}),a.length&&(r=r.concat(a)),l=t.list),p=e.grep(o,function(t){return e.inArray(t.name,r)!==-1}),p.length&&r.length&&n==i.cwd().hash&&(s=e.map(i.files(n),function(e){return e.name}),e.grep(r,function(t){return e.inArray(t,s)===-1}).length&&i.sync()))),p.length>0?h(0):d()}).fail(function(e){c(),d(),e&&i.error(e)})):void d()};return i.api>=2.1&&"object"==typeof t[0]?p():d(),r},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,o,r=e.Deferred(),s=e.Deferred(),l=[],c=[],d=0,p=[],u=!1,h=function(e){return Array.prototype.slice.call(e||[],0)},f=function(e){var t,i,a=n.options.folderUploadExclude[n.OS]||null,o=e.length,r=function(){--d<1&&"pending"===s.state()&&s.resolve()},m=function(e){a&&e.name.match(a)||(c.push(t.fullPath||""),l.push(e)),r()},i=function(e){var t=[],n=function(){e.readEntries(function(e){if(u||!e.length){for(var i=0;i=2.1&&(d++,p.push(t.fullPath),i(t.createReader())))}return r(),s};return a=e.map(t.files.items,function(e){return"file"===e.kind?(e.getAsEntry?e.getAsEntry():e.webkitGetAsEntry())||e.getAsFile():null}),e.each(a,function(e,t){if(t.isDirectory)return o=!0,!1}),a.length>0?(n.uploads.checkExists(a,i,n,o).done(function(o,s){var d=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",i)&&(null===o&&(t.overwrite=0,o=[]),a=e.grep(a,function(t){var a,r,l,c;return t.isDirectory&&o.length&&(a=e.inArray(t.name,o),a!==-1&&(o.splice(a,1),r=n.uniqueName(t.name+n.options.backupSuffix,null,""),e.each(s,function(e,n){if(t.name==n)return l=e,!1}),l||(l=n.fileByName(t.name,i).hash),n.lockfiles({files:[l]}),c=n.request({data:{cmd:"rename",target:l,name:r},notify:{type:"rename",cnt:1}}).fail(function(){t._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[l]})}),d.push(c))),!t._remove})),e.when.apply(e,d).done(function(){var e,t,i=+new Date;a.length>0?(t=n.escape(a[0].name),a.length>1&&(t+=" ... "+a.length+n.i18n("items")),e=setTimeout(function(){n.notify({type:"readdir",id:i,cnt:1,hideCnt:!0,msg:n.i18n("ntfreaddir")+" ("+t+")",cancel:function(){u=!0}})},n.options.notifyDelay),f(a).done(function(){e&&clearTimeout(e),n.notify({type:"readdir",id:i,cnt:-1}),u?r.reject():r.resolve([l,c,o,s,p])}).fail(function(){r.reject()})):r.reject()})}),r.promise()):r.reject()}var m=[],g=[],v=t.files[0];if("html"==t.type){var b,y=e("").append(e.parseHTML(v.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",y).each(function(){var n,i,a=e(this),o=a.closest("a");o&&o.attr("href")&&o.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(i=o.attr("href")),n=a.attr("_elfsrc"),n&&(i?(e.inArray(i,m)==-1&&m.push(i),e.inArray(n,g)==-1&&g.push(n)):e.inArray(n,m)==-1&&m.push(n)),1===m.length&&m[0].match(/^data:image\/png/)&&(t.clipdata=!0)}),b=e("a[href]",y),b.each(function(){var t,n,i=function(e){var t=document.createElement("a");return t.href=e,t};(t=e(this).text())&&(n=i(e(this).attr("href")),n.href&&n.href.match(/^(?:ht|f)tp/i)&&(1===b.length||!n.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||e.trim(t).match(/\.[a-z0-9-]{1,10}$/i))&&e.inArray(n.href,m)==-1&&e.inArray(n.href,g)==-1&&m.push(n.href))})}else{var w,x,k;for(w=/((?:ht|f)tps?:\/\/[-_.!~*\'()a-z0-9;\/?:\@&=+\$,%#\*\[\]]+)/gi;x=w.exec(v);)k=x[1].replace(/&/g,"&"),e.inArray(k,m)==-1&&m.push(k)}return m},xhr:function(t,n){var i=n?n:this,a=i.getUI(),o=new XMLHttpRequest,r=null,s=null,l=null,c=t.checked,d=t.isDataType||"data"==t.type,p=t.target||i.cwd().hash,u=t.dropEvt||null,h=t.extraData||null,f=i.option("uploadMaxConn",p)!=-1,m=Math.min(5,Math.max(1,i.option("uploadMaxConn",p))),g=1e4,v=30,b=0,y=function(t){var n=e.Deferred();return t.promise?t.always(function(e){n.resolve(Array.isArray(e)&&e.length?d?e[0][0]:e[0]:{})}):n.resolve(t.length?d?t[0][0]:t[0]:{}),n},w=e.Deferred().fail(function(e){var t,a=i.parseError(e);"userabort"===a&&(t=!0,a=void 0),k&&(i.uploads.xhrUploading||t)?y(k).done(function(e){t||H(a,e),e._cid?i.uploads.chunkfailReq[e._cid]||(i.uploads.chunkfailReq[e._cid]=!0,setTimeout(function(){n.request({data:{cmd:"upload",target:p,chunk:e._chunk,cid:e._cid,upload:["chunkfail"],mimes:"chunkfail"},options:{type:"post",url:i.uploadURL},preventDefault:!0}).always(function(){delete i.uploads.chunkfailReq[e._chunk]})},1e3)):(i.uploads.failSyncTm&&clearTimeout(i.uploads.failSyncTm),i.uploads.failSyncTm=setTimeout(function(){i.sync(p)},1e3))}):H(a),!t&&i.sync(),i.uploads.xhrUploading=!1,k=null}).done(function(t){i.uploads.xhrUploading=!1,k=null,t&&(i.currentReqCmd="upload",t.warning&&H(t.warning),i.updateCache(t),t.removed&&t.removed.length&&i.remove(t),t.added&&t.added.length&&i.add(t),t.changed&&t.changed.length&&i.change(t),i.trigger("upload",t,!1),i.trigger("uploaddone"),t.toasts&&Array.isArray(t.toasts)&&e.each(t.toasts,function(){this.msg&&i.toast(this)}),t.sync&&i.sync(),t.debug&&(i.responseDebug(t),n.debug("backend-debug",t)))}).always(function(){i.abortXHR(o),a.off("uploadabort",D),e(window).off("unload",D),r&&clearTimeout(r),s&&clearTimeout(s),l&&clearTimeout(l),c&&!t.multiupload&&E()&&i.notify({type:"upload",cnt:-C,progress:0,size:0}),s&&M&&i.notify({type:"chunkmerge",cnt:-C}),B&&O.children(".elfinder-notify-chunkmerge").length&&i.notify({type:"chunkmerge",cnt:-1})}),x=new FormData,k=t.input?t.input.files:i.uploads.checkFile(t,i,p),C=t.checked&&d?k[0].length:k.length,z=!1,T=0,A=0,j=0,S=!1,O=i.ui.notify,I=!0,M=!1,F=!1,E=function(){return!S&&($=O.children(".elfinder-notify-upload")).length&&(S=!0),S},D=function(e,t){F=!0,i.abortXHR(o,{quiet:!0,abort:!0}),w.reject(t),E()&&i.notify({type:"upload",cnt:$.data("cnt")*-1,progress:0,size:0})},U=function(e,t){$.children(".elfinder-notify-cancel")[e?"show":"hide"](),I=e},P=function(e){return e||(e=j),setTimeout(function(){S=!0,i.notify({type:"upload",cnt:C,progress:T-A,size:e,cancel:function(){a.trigger("uploadabort","userabort")}}),$=O.children(".elfinder-notify-upload"),A=T,t.multiupload?I&&U(!0):U(I&&T=2.1029&&(e=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),"function"==typeof x["delete"]&&x["delete"]("reqid"),x.append("reqid",e),o._requestId=e),o.send(x))},g)):a.trigger("uploadabort",["errAbort","errTimeout"])},R=function(){S&&w.notifyWith($,[{cnt:$.data("cnt"),progress:$.data("progress"),total:$.data("total")}])},H=function(e,t,n){e&&i.trigger("xhruploadfail",{error:e,file:t}),n?e&&(N=i.options.maxErrorDialogs&&(_=_.concat("moreErrors",N-i.options.maxErrorDialogs)),i.error(_)),_=[],N=0)},_=[],N=0,L=t.renames||null,W=t.hashes||null,B=!1,$=e();if(a.one("uploadabort",D),e(window).one("unload."+n.namespace,D),!B&&(A=T),!d&&!C)return w.reject(["errUploadNoFiles"]);o.addEventListener("error",function(){0==o.status?F?w.reject():!d&&t.files&&e.grep(t.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?w.reject(["errAbort","errFolderUpload"]):t.input&&e.grep(t.input.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?w.reject(["errUploadNoFiles"]):q():a.trigger("uploadabort","errConnect")},!1),o.addEventListener("load",function(e){var n,s,c=o.status,p=0,u="";if(i.setCustomHeaderByXhr(o),c>=400?u=c>500?"errResponse":["errResponse","errServerError"]:o.responseText||(u=["errResponse","errDataEmpty"]),u&&(a.trigger("uploadabort"),y(k||{}).done(function(e){return w.reject(e._cid?null:u)})),T=j,E()&&(p=T-A)&&(i.notify({type:"upload",cnt:0,progress:p,size:0}),R()),n=i.parseUploadData(o.responseText),n._chunkmerged){x=new FormData;var h=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return B=!0,a.off("uploadabort",D),l=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(d?V(h,k[1]):V(h))}n._multiupload=!!t.multiupload,n.error?(s={cmd:"upload",err:n,xhr:o,rc:o.status},i.trigger("uploadfail",n),i.trigger("requestError",s),s._getEvent&&s._getEvent().isDefaultPrevented()&&(n.error=""),n._chunkfailure||n._multiupload?(F=!0,i.uploads.xhrUploading=!1,r&&clearTimeout(r),$.length?(i.notify({type:"upload",cnt:-C,progress:0,size:0}),w.reject(n)):w.reject()):w.reject(n)):w.resolve(n)},!1),o.upload.addEventListener("loadstart",function(e){!B&&e.lengthComputable&&(T=e.loaded,b&&(T=0),j=e.total,T||(T=parseInt(.05*j)),E()&&(i.notify({type:"upload",cnt:0,progress:T-A,size:t.multiupload?0:j}),A=T,R()))},!1),o.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!B&&o.readyState<2&&(T=e.loaded,!t.checked&&T>0&&!r&&(r=P(o._totalSize-T)),j||(j=e.total,T||(T=parseInt(.05*j))),n=T-A,E()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),A=T,R()),!M&&T>=j&&!z&&(M=!0,s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:C})},i.options.notifyDelay)),I&&!t.multiupload&&T>=j&&E()&&U(!1))},!1);var V=function(a,s){var l,g,v,b,y,k,T,A,j,S,O,M,D,q,R,N=0,B=1,$=[],V=0,K=C,X=0,J=[],G=(new Date).getTime().toString().substr(-9),Y=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),Q=!f&&"",Z=function(a,o){var s,l,c,h=[],f=0;if(!F){for(;a.length&&h.length=2.1&&("slice"in j?Q="slice":"mozSlice"in j?Q="mozSlice":"webkitSlice"in j&&(Q="webkitSlice")))}catch(te){C--,K--;continue}if(l&&g>l||!Q&&n.uplMaxSize&&g>n.uplMaxSize)H(["errUploadFile",j.name,"errUploadFileSize"],j,!0),C--,K--;else if(!j.type||i.uploadMimeCheck(j.type,p))if(Q&&g>Y){for(k=0,T=Y,A=-1,K=Math.floor((g-1)/Y),v=j.lastModified?Math.round(j.lastModified/1e3):0,b=t.clipdata?n.date(n.nonameDateFormat)+".png":j.name,X+=g,J[G]=0;kn.uplMaxSize||B>n.uplMaxFile)&&(N=0,B=1,V++),"undefined"==typeof $[V]&&($[V]=[],d&&($[V][0]=[],$[V][1]=[])),d?($[V][0].push(j),$[V][1].push(s[y])):$[V].push(j),N+=g,X+=g,B++;else H(["errUploadFile",j.name,"errUploadMime","("+j.type+")"],j,!0),C--,K--}if(_.length&&H(),0==$.length)return t.checked=!0,!1;if($.length>1)return r=P(X),O=[],M=0,D=$.length,q=[],ee(),!0;d?(a=$[0][0],s=$[0][1]):a=$[0]}return c||(n.UA.Safari&&t.files?o._totalSize=X:r=P(X)),c=!0,a.length||w.reject(["errUploadNoFiles"]),o.open("POST",i.uploadURL,!0),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)}),i.api>=2.1029&&(R=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),x.append("reqid",R),o._requestId=R),x.append("cmd","upload"),x.append(i.newAPI?"target":"current",p),L&&L.length&&(e.each(L,function(e,t){x.append("renames[]",t)}),x.append("suffix",n.options.backupSuffix)),W&&e.each(W,function(e,t){x.append("hashes["+e+"]",t)}),e.each(i.customData,function(e,t){x.append(e,t)}),e.each(i.options.onlyMimes,function(e,t){x.append("mimes[]",t)}),e.each(a,function(e,i){var a,o;i._chunkmerged?(x.append("chunk",i._chunkmerged),x.append("upload[]",i._name),x.append("mtime[]",i._mtime),t.clipdata&&x.append("overwrite",0),z=!0):(i._chunkfail?(x.append("upload[]","chunkfail"),x.append("mimes","chunkfail")):(t.clipdata?i._chunk||(t.overwrite=0,a=n.date(n.nonameDateFormat)+".png"):i.name&&(a=i.name,n.UA.iOS&&(a.match(/^image\.jpe?g$/i)?(t.overwrite=0,a=n.date(n.nonameDateFormat)+".jpg"):a.match(/^capturedvideo\.mov$/i)&&(t.overwrite=0,a=n.date(n.nonameDateFormat)+".mov")),o=(i.webkitRelativePath||i.relativePath||i._relativePath||"").replace(/[^\/]+$/,""),a=o+a),a?x.append("upload[]",i,a):x.append("upload[]",i)),i._chunk?(x.append("chunk",i._chunk),x.append("cid",i._cid),x.append("range",i._range),x.append("mtime[]",i._mtime),z=!0):x.append("mtime[]",i.lastModified?Math.round(i.lastModified/1e3):0))}),d&&e.each(s,function(e,t){x.append("upload_path[]",t)}),0===t.overwrite&&x.append("overwrite",0),u&&x.append("dropWith",parseInt((u.altKey?"1":"0")+(u.ctrlKey?"1":"0")+(u.metaKey?"1":"0")+(u.shiftKey?"1":"0"),2)),h&&e.each(h,function(e,t){x.append(e,t)}),o.send(x),!0};if(d)c?V(k[0],k[1]):k.done(function(t){if(L=[],C=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:p,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?m=1:(m=0,w.reject(e))}).done(function(n){var i=!1;n.hashes||(n.hashes={}),t[1]=e.map(t[1],function(e,a){return t[0][a]._relativePath=e.replace(/^\//,""),e=e.replace(/\/[^\/]*$/,""),""===e?p:n.hashes[e]?n.hashes[e]:(i=!0,t[0][a]._remove=!0,null)}),i&&(t[0]=e.grep(t[0],function(e){return!e._remove}))}).always(function(e){m&&(L=t[2],W=t[3],V(t[0],t[1]))});t[1]=e.map(t[1],function(){return p}),L=t[2],W=t[3],V(t[0],t[1])}else w.reject(["errUploadNoFiles"])}).fail(function(){w.reject()});else if(k.length>0)if(t.clipdata||null!=L)V(k)||w.reject();else{var K=[],X=[],J=n.options.folderUploadExclude[n.OS]||null;e.each(k,function(t,n){var i,a,o=n.webkitRelativePath||n.relativePath||"";return!!o&&(J&&n.name.match(J)?(n._remove=!0,o=void 0):(o="/"+o.replace(/\/[^\/]*$/,"").replace(/^\//,""),o&&e.inArray(o,K)===-1&&(K.push(o),i=o.substr(1).indexOf("/"),i!==-1&&(a=o.substr(0,i+1))&&e.inArray(a,K)===-1&&K.unshift(a))),void X.push(o))}),L=[],W={},K.length?!function(){var t=e.map(K,function(e){return e.substr(1).indexOf("/")===-1?{name:e.substr(1)}:null}),i=[];n.uploads.checkExists(t,p,n,!0).done(function(a,o){var r,s,l,c=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",p)&&(i=e.map(t,function(e){return e._remove?e.name:null}),t=e.grep(t,function(e){return!e._remove})),i.length&&e.each(X.concat(),function(t,n){0===e.inArray(n,i)&&(k[t]._remove=!0,X[t]=void 0)}),k=e.grep(k,function(e){return!e._remove}),X=e.grep(X,function(e){return void 0!==e}),t.length?(r=e.Deferred(),a.length?e.each(a,function(t,i){s=n.uniqueName(i+n.options.backupSuffix,null,""),e.each(o,function(e,t){if(a[0]==t)return l=e,!1}),l||(l=n.fileByName(a[0],p).hash),n.lockfiles({files:[l]}),c.push(n.request({data:{cmd:"rename",target:l,name:s},notify:{type:"rename",cnt:1}}).fail(function(e){w.reject(e),n.sync()}).always(function(){n.unlockfiles({files:[l]})}))}):c.push(null),e.when.apply(e,c).done(function(){n.request({data:{cmd:"mkdir",target:p,dirs:K},notify:{type:"mkdir",cnt:K.length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?m=1:(m=0,w.reject(e))}).done(function(t){var n=!1;t.hashes||(t.hashes={}),X=e.map(X.concat(),function(e,i){return"/"===e?p:t.hashes[e]?t.hashes[e]:(n=!0,k[i]._remove=!0,null)}),n&&(k=e.grep(k,function(e){return!e._remove}))}).always(function(e){m&&(d=!0,V(k,X)||w.reject())})})):w.reject()})}():n.uploads.checkExists(k,p,n).done(function(i,a){n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",p)&&(W=a,null===i?t.overwrite=0:L=i,k=e.grep(k,function(e){return!e._remove})),C=k.length,C>0?V(k)||w.reject():w.reject()})}else w.reject();return w},iframe:function(t,n){var i,a,o,r,s=n?n:this,l=!!t.input&&t.input,c=!l&&s.uploads.checkFile(t,s),d=e.Deferred().fail(function(e){e&&s.error(e)}),p="iframe-"+n.namespace+ ++s.iframeCnt,u=e('
        '),h=this.UA.IE,f=function(){r&&clearTimeout(r),o&&clearTimeout(o),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){h&&e('').appendTo(u),u.remove(),m.remove()},100)},m=e('').on("load",function(){m.off("load").on("load",function(){f(),d.resolve()}),o=setTimeout(function(){a=!0,s.notify({type:"upload",cnt:i})},s.options.notifyDelay),s.options.iframeTimeout>0&&(r=setTimeout(function(){f(),d.reject(["errConnect","errTimeout"])},s.options.iframeTimeout)),u.submit()}),g=t.target||s.cwd().hash,v=[],b=[],y=[],w={};if(c&&c.length)e.each(c,function(e,t){u.append('')}),i=1;else{if(!(l&&e(l).is(":file")&&e(l).val()))return d.reject();n.options.overwriteUploadConfirm&&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(n,a){w=a,null===n?t.overwrite=0:(y=n,i=e.grep(v,function(e){return!e._remove}).length,i!=v.length&&(i=0))}))),i=l.files?l.files.length:1,u.append(l)}return e.when.apply(e,b).done(function(){return i<1?d.reject():(u.append('').append('').append('').append(e(l).attr("name","upload[]")),y.length>0&&(e.each(y,function(e,t){u.append('')}),u.append('')),w&&e.each(y,function(e,t){u.append('')}),0===t.overwrite&&u.append(''),e.each(s.options.onlyMimes||[],function(e,t){u.append('')}),e.each(s.customData,function(e,t){u.append('')}),u.appendTo("body"),void m.appendTo("body"))}),d}},one:function(e,t,n){var i=this,a=e.toLowerCase(),o=function(e,n){return i.toUnbindEvents[a]||(i.toUnbindEvents[a]=[]),i.toUnbindEvents[a].push({type:a,callback:o}),(t.done?t.done:t).apply(this,arguments)};return t.done&&(o={done:o}),this.bind(a,o,n)},localStorage:function(t,n){var i,a,o,r,s,l=this,c=window.localStorage,d="elfinder-"+(t||"")+this.id,p=window.location.pathname+"-elfinder-",u=this.id,h=[];if("undefined"==typeof t)return r=p.length,s=u.length*-1,e.each(c,function(e){e.substr(0,r)===p&&e.substr(s)===u&&h.push(e)}),e.each(h,function(e,t){c.removeItem(t)}),!0;if(t=p+t+u,null===n)return c.removeItem(t);if(void 0===n&&!(i=c.getItem(t))&&(a=c.getItem(d))&&(n=a,c.removeItem(d)),void 0!==n){o=typeof n,"string"!==o&&"number"!==o&&(n=JSON.stringify(n));try{c.setItem(t,n)}catch(f){try{c.clear(),c.setItem(t,n)}catch(f){l.debug("error",f.toString())}}i=c.getItem(t)}if(i&&("{"===i.substr(0,1)||"["===i.substr(0,1)))try{return JSON.parse(i)}catch(f){}return i},sessionStorage:function(e,t){var n,i,a,o=this;try{n=window.sessionStorage}catch(r){}if(n){if(null===t)return n.removeItem(e);if(void 0!==t){a=typeof t,"string"!==a&&"number"!==a&&(t=JSON.stringify(t));try{n.setItem(e,t)}catch(r){try{n.clear(),n.setItem(e,t)}catch(r){o.debug("error",r.toString())}}}if(i=n.getItem(e),i&&("{"===i.substr(0,1)||"["===i.substr(0,1)))try{return JSON.parse(i)}catch(r){}return i}},cookie:function(t,n){var i,a,o,r,s,l;if(t="elfinder-"+t+this.id,void 0===n){if(this.cookieEnabled&&document.cookie&&""!=document.cookie)for(o=document.cookie.split(";"),t+="=",r=0;r"),escape:function(e){return this._node.text(e).html().replace(/"/g,""").replace(/'/g,"'")},normalize:function(t){var n,i,a,o,r,s=this,l=function(){var e,t;return(t=s.options.fileFilter)&&("function"==typeof t?e=function(e){return t.call(s,e)}:t instanceof RegExp&&(e=function(e){return t.test(e.name)})),e?e:null}(),c=function(t){var n;t.uiCmdMap&&(e.isPlainObject(t.uiCmdMap)&&Object.keys(t.uiCmdMap).length?(t.disabledFlip||(t.disabledFlip={}),n=t.disabledFlip,e.each(t.uiCmdMap,function(e,i){"hidden"!==i||n[e]||(t.disabled.push(e),t.disabledFlip[e]=!0)})):delete t.uiCmdMap)},d=function(t){var n=function(e){var t=typeof e;return"object"===t&&Array.isArray(e)&&(t="array"),t};return e.each(s.optionProperties,function(e,i){void 0!==i&&t[e]&&n(t[e])!==n(i)&&(t[e]=i)}),t.disabled?(t.disabledFlip=s.arrayFlip(t.disabled,!0),e.each(s.options.disabledCmdsRels,function(n,i){var a,o;t.disabledFlip[n]?o=!0:(a=n.match(/^([^&]+)&([^=]+)=(.*)$/))&&t.disabledFlip[a[1]]&&t[a[2]]==a[3]&&(o=!0),o&&e.each(i,function(e,n){t.disabledFlip[n]||(t.disabledFlip[n]=!0,t.disabled.push(n))})})):t.disabledFlip={},t},p=function(t,r,p){var u,h,m,g,v=!r||t,b=!!r&&null;if(t&&t.hash&&t.name&&t.mime){if("application/x-empty"===t.mime&&(t.mime="text/plain"),m=s.isRoot(t),m&&!t.volumeid&&s.debug("warning","The volume root statuses requires `volumeid` property."),m||"directory"===t.mime){if(t.phash){if(t.phash===t.hash)return f=f.concat(['Parent folder of "$1" is itself.',t.name]),b;if(m&&t.volumeid&&0===t.phash.indexOf(t.volumeid))return f=f.concat(['Parent folder of "$1" is inner itself.',t.name]),b}t.volumeid&&(u=t.volumeid,m&&(t.phash&&(s.leafRoots[t.phash]?e.inArray(t.hash,s.leafRoots[t.phash])===-1&&s.leafRoots[t.phash].push(t.hash):s.leafRoots[t.phash]=[t.hash]),s.hasVolOptions=!0,s.volOptions[u]||(s.volOptions[u]={dispInlineRegex:s.options.dispInlineRegex}),h=s.volOptions[u],t.options&&Object.assign(h,t.options),t.disabled&&(h.disabled=t.disabled,h.disabledFlip=s.arrayFlip(t.disabled,!0)),t.tmbUrl&&(h.tmbUrl=t.tmbUrl),h.url&&"/"!==h.url.substr(-1)&&(h.url+="/"),c(h),h.trashHash&&(s.trashes[h.trashHash]===!1?delete h.trashHash:s.trashes[h.trashHash]=t.hash),e.each(s.optionProperties,function(e){h[e]&&(t[e]=h[e])}),"cwd"!==p&&(s.roots[u]=t.hash),t.expires&&(s.volumeExpires[u]=t.expires)),o!==u&&(o=u,a=s.option("i18nFolderName",u))),m&&!t.i18&&(n="volume_"+t.name,i=s.i18n(!1,n),n!==i&&(t.i18=i)),a&&!t.i18&&(n="folder_"+t.name,i=s.i18n(!1,n),n!==i&&(t.i18=i)),m&&(g=s.storage("rootNames"))&&(g[t.hash]&&(t._name=t.name,t._i18=t.i18,t.name=g[t.hash]=g[t.hash],delete t.i18),s.storage("rootNames",g)),s.trashes[t.hash]&&(t.locked=!0)}else{if(l)try{if(!l(t))return b}catch(y){s.debug(y)}0==t.size&&(t.mime=s.getMimetype(t.name,t.mime))}return t.options&&(s.optionsByHashes[t.hash]=d(t.options)),delete t.options,v}return b},u=function(t){var n=[];return e.each(s.files(),function(i,a){e.each(s.parents(i),function(a,o){if(e.inArray(o,t)!==-1&&e.inArray(i,t)===-1)return n.push(i),!1})}),n},h=function(n,i){e.each(n,function(n,a){var o,r;s.leafRoots[a.hash]&&s.applyLeafRootStats(a),"change"!==i&&a.phash&&s.isRoot(a)&&(o=s.file(a.phash))&&(s.applyLeafRootStats(o),t.changed?(e.each(t.changed,function(e,n){if(n.hash===o.hash)return t.changed[e]=o,r=!0,!1}),r||t.changed.push(o)):t.changed=[o])})},f=[];if(t.customData&&(!s.prevCustomData||JSON.stringify(t.customData)!==JSON.stringify(s.prevCustomData))){s.prevCustomData=t.customData;try{r=JSON.parse(t.customData),e.isPlainObject(r)&&(s.prevCustomData=r,e.each(Object.keys(r),function(e,t){null===r[t]&&(delete r[t],delete s.optsCustomData[t])}),s.customData=Object.assign({},s.optsCustomData,r))}catch(m){}}return t.options&&d(t.options),t.cwd&&(t.cwd.volumeid&&t.options&&Object.keys(t.options).length&&s.isRoot(t.cwd)&&(s.hasVolOptions=!0,s.volOptions[t.cwd.volumeid]=t.options),t.cwd=p(t.cwd,!0,"cwd")),t.files&&(t.files=e.grep(t.files,p)),t.tree&&(t.tree=e.grep(t.tree,p)),t.added&&(t.added=e.grep(t.added,p)),t.changed&&(t.changed=e.grep(t.changed,p)),t.removed&&t.removed.length&&2===s.searchStatus.state&&(t.removed=t.removed.concat(u(t.removed))),t.api&&(t.init=!0),Object.keys(s.leafRoots).length&&(t.files&&h(t.files),t.tree&&h(t.tree),t.added&&h(t.added),t.changed&&h(t.changed,"change")),t.cwd&&t.cwd.options&&t.options&&Object.assign(t.options,d(t.cwd.options)),t.options&&t.options.url&&"/"!==t.options.url.substr(-1)&&(t.options.url+="/"),f.length&&(t.norError=["errResponse"].concat(f)),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 i.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 i.prototype.naturalCompare(e.mime,t.mime)},date:function(e,t){var n=e.ts||e.date||0,i=t.ts||t.date||0;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||"",a=t.mode||t.perm||"";return i.prototype.naturalCompare(n,a)},owner:function(e,t){var n=e.owner||"",a=t.owner||"";return i.prototype.naturalCompare(n,a)},group:function(e,t){var n=e.group||"",a=t.group||"";return i.prototype.naturalCompare(n,a)}},sorters:{},naturalCompare:function(e,t){var n=i.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,o=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,r=/(^[ ]*|[ ]*$)/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,c=/^0/,d=/^[\x01\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]/,p=function(e){return n.sort.insensitive&&(""+e).toLowerCase()||""+e},u=p(e).replace(r,"").replace(/^_/,"")||"",h=p(t).replace(r,"").replace(/^_/,"")||"",f=u.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=h.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),g=parseInt(u.match(l))||1!=f.length&&u.match(s)&&Date.parse(u),v=parseInt(h.match(l))||g&&h.match(s)&&Date.parse(h)||null,b=0;if(v){if(gv)return 1}for(var y=0,w=Math.max(f.length,m.length);ya)return 1}return 0},n.sort.insensitive=!0)),n.sort(e,t)},compare:function(e,t){var n,i=this,a=i.sortType,o="asc"==i.sortOrder,r=i.sortStickFolders,s=i.sortRules,l=s[a],c="directory"==e.mime,d="directory"==t.mime;if(r){if(c&&!d)return-1;if(!c&&d)return 1}return n=o?l(e,t):l(t,e),"name"!==a&&0===n?n=o?s.name(e,t):s.name(t,e):n},sortFiles:function(e){return e.sort(this.compare)},notify:function(t){var n,i,a,o=this,r=t.type,s=t.id?"elfinder-notify-"+t.id:"",l=this.i18n("undefined"!=typeof t.msg?t.msg:this.messages["ntf"+r]?"ntf"+r:"ntfsmth"),c=this.arrayFlip(this.options.notifyDialog.hiddens||[]),d=this.ui.notify,p=d.closest(".ui-dialog"),u=d.children(".elfinder-notify-"+r+(s?"."+s:"")),h=u.children("div.elfinder-notify-cancel").children("button"),f='
        {msg}
        ',m=t.cnt+0,g="undefined"!=typeof t.size?parseInt(t.size):null,v="undefined"!=typeof t.progress&&t.progress>=0?t.progress:null,b=t.fakeinterval||200,y=t.cancel,w="ui-state-hover",x=function(){var t=u.find(".elfinder-notify-progress"),n=function(){u.remove(),d.children(p.data("minimized")?void 0:":visible").length||(p.data("minimized")?p.data("minimized").hide():d.elfinderdialog("close")),C()};u._esc&&e(document).off("keydown",u._esc),u.data("cur")<100?t.animate({width:"100%"},50,function(){requestAnimationFrame(function(){n()})}):n()},k=function(e){var t;u.length&&(t=u.data("cur")+1,t<=98&&(u.find(".elfinder-notify-progress").width(t+"%"),u.data("cur",t),C(),setTimeout(function(){e*=1.05,k(e)},e)))},C=function(){var t,n=0,i=0,a=d.children(".elfinder-notify");a.length?(a.each(function(){n++,i+=Math.min(e(this).data("cur"),100)}),t=n?Math.floor(i/(100*n)*100)+"%":0,o.ui.progressbar.width(t),p.data("minimized")&&(p.data("minimized").title(t),p.data("minimized").dialog().children(".ui-dialog-titlebar").children(".elfinder-ui-progressbar").width(t))):(o.ui.progressbar.width(0),p.data("minimized")&&p.data("minimized").hide())};return r?(u.length?"undefined"!=typeof t.msg&&u.children("span.elfinder-notify-msg").html(l):(u=e(f.replace(/\{type\}/g,r).replace(/\{msg\}/g,l)),c[r]?u.hide():d.on("minimize",function(e){p.data("minimized")&&C()}),u.appendTo(d).data("cnt",0),null!=v?u.data({progress:0,total:0,cur:0}):(u.data({cur:0}),k(b)),y&&(h=e('').on("mouseenter mouseleave",function(t){e(this).toggleClass(w,"mouseenter"===t.type)}),u.children("div.elfinder-notify-cancel").append(h)),d.trigger("resize")),n=m+parseInt(u.data("cnt")),n>0?(y&&h.length&&(e.isFunction(y)||"object"==typeof y&&y.promise)&&(u._esc=function(t){"keydown"==t.type&&t.keyCode!=e.ui.keyCode.ESCAPE||(t.preventDefault(),t.stopPropagation(),x(),y.promise?y.reject(0):y(t))},h.on("click",function(e){u._esc(e)}),e(document).on("keydown."+this.namespace,u._esc)),!t.hideCnt&&u.children(".elfinder-notify-cnt").text("("+n+")"),m>0&&d.is(":hidden")&&!c[r]&&(p.data("minimized")?p.data("minimized").show():d.elfinderdialog("open",this).height("auto")),u.data("cnt",n),null!=v&&(i=u.data("total"))>=0&&(a=u.data("progress"))>=0&&(i+=null!=g?g:m,a+=v,null==g&&m<0&&(a+=100*m),u.data({progress:a,total:i}),null!=g&&(a*=100,i=Math.max(1,i)),v=Math.min(parseInt(a/i),100),u.find(".elfinder-notify-progress").animate({width:(v<100?v:100)+"%"},20,function(){u.data("cur",v),C()}))):x(),this):this},confirm:function(t){var n,i,a=this,o=!1,r={cssClass:"elfinder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(t.title||"confirmReq"),buttons:{},close:function(){!o&&t.cancel.callback(),e(this).elfinderdialog("destroy")}},s=this.i18n("apllyAll");return t.cssClass&&(r.cssClass+=" "+t.cssClass),r.buttons[this.i18n(t.accept.label)]=function(){t.accept.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[this.i18n(t.accept.label)]._cssClass="elfinder-confirm-accept",t.reject&&(r.buttons[this.i18n(t.reject.label)]=function(){t.reject.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[this.i18n(t.reject.label)]._cssClass="elfinder-confirm-reject"),t.buttons&&t.buttons.length>0&&(i=1,e.each(t.buttons,function(t,s){r.buttons[a.i18n(s.label)]=function(){s.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[a.i18n(s.label)]._cssClass="elfinder-confirm-extbtn"+i++,s.cssClass&&(r.buttons[a.i18n(s.label)]._cssClass+=" "+s.cssClass)})),r.buttons[this.i18n(t.cancel.label)]=function(){e(this).elfinderdialog("close")},r.buttons[this.i18n(t.cancel.label)]._cssClass="elfinder-confirm-cancel",t.all&&(r.create=function(){var t=e('
        ');n=e(''),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("").prepend(n)))}),t.optionsCallback&&e.isFunction(t.optionsCallback)&&t.optionsCallback(r),this.dialog(''+this.i18n(t.text),r)},uniqueName:function(e,t,n){var i,a,o=0,r="";if(e=this.i18n(!1,e),t=t||this.cwd().hash,n="undefined"==typeof n?" ":n,(i=e.match(/^(.+)(\.[^.]+)$/))&&(r=i[2],e=i[1]),a=e+r,!this.fileByName(a,t))return a;for(;o<1e4;)if(a=e+n+ ++o+r,!this.fileByName(a,t))return a;return e+Math.random()+r},i18n:function(){var t,n,i,a,o,r=this,s=this.messages,l=[],c=[],d=function(e){var t;return 0===e.indexOf("#")&&(t=r.file(e.substr(1)))?t.name:e},p=0;for(arguments.length&&arguments[0]===!1&&(a=function(e){return e},p=1),t=p;t0&&l[n]&&c.push(n),i=a?a(l[n]):r.escape(l[n]),o&&(i=''+i+""),i})):i=i.get(0).outerHTML,l[t]=i);return e.grep(l,function(t,n){return e.inArray(n,c)===-1}).join("
        ")},getIconStyle:function(t,n){var i=this,a={background:"url('{url}') 0 0 no-repeat","background-size":"contain"},o="",r={},s=0;return t.icon&&(o='style="',e.each(a,function(e,a){0===s++&&(a=a.replace("{url}",i.escape(t.icon))),n?r[e]=a:o+=e+":"+a+";"}),o+='"'),n?r:o},mime2class:function(e){var t="elfinder-cwd-icon-",n=e.toLowerCase(),i=this.textMimes[n];return n=n.split("/"),i?n[0]+=" "+t+"text":n[1]&&n[1].match(/\+xml$/)&&(n[0]+=" "+t+"xml"),t+n[0]+(n[1]?" "+t+n[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":this.mimeTypes[i]&&(t=this.mimeTypes[i].toUpperCase(),this.messages["kind"+t]||(t=null)),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},mimeIsText:function(e){return!!(this.textMimes[e.toLowerCase()]||0===e.indexOf("text/")&&"rtf"!==e.substr(5,3)||e.match(/^application\/.+\+xml$/))},date:function(e,t){var n,i,a,o,r,s,l,c,d,p=this;return t||(t=new Date),s=t[p.getHours](),l=s>12?s-12:s,c=t[p.getMinutes](),d=t[p.getSeconds](),i=t[p.getDate](),a=t[p.getDay](),o=t[p.getMonth]()+1,r=t[p.getFullYear](),n=e.replace(/[a-z]/gi,function(e){switch(e){case"d":return i>9?i:"0"+i;case"j":return i;case"D":return p.i18n(p.i18.daysShort[a]);case"l":return p.i18n(p.i18.days[a]);case"m":return o>9?o:"0"+o;case"n":return o;case"M":return p.i18n(p.i18.monthsShort[o-1]);case"F":return p.i18n(p.i18.months[o-1]);case"Y":return r;case"y":return(""+r).substr(2);case"H":return s>9?s:"0"+s;case"G":return s;case"g":return l;case"h":return l>9?l:"0"+l;case"a":return s>=12?"pm":"am";case"A":return s>=12?"PM":"AM";case"i":return c>9?c:"0"+c;case"s":return d>9?d:"0"+d}return e})},formatDate:function(e,t){var n,i,a,o=this,r=t||e.ts;o.i18;return o.options.clientFormatDate&&r>0?(n=new Date(1e3*r),i=r>=this.yesterday?this.fancyFormat:this.dateFormat,a=o.date(i,n),r>=this.yesterday?a.replace("$1",this.i18n(r>=this.today?"Today":"Yesterday")):a):e.date?e.date.replace(/([a-z]+)\s/i,function(e,t){return o.i18n(t)+" "}):o.i18n("dateUnknown")},toLocaleString:function(e){var t=new Number(e);return t?t.toLocaleString?t.toLocaleString():String(e).replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"):e},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,o,r,s,l,c,d,p;if(n||(n=this.options.fileModeStyle.toLowerCase()),t=e.trim(t),t.match(/[rwxs-]{9}$/i)){if(d=t=t.substr(-9),"string"==n)return d;for(p="",o=0,i=0;i<7;i+=3)a=t.substr(i,3),r=0,a.match(/[r]/i)&&(r+=4),a.match(/[w]/i)&&(r+=2),a.match(/[xs]/i)&&(a.match(/[xs]/)&&(r+=1),a.match(/[s]/i)&&(0==i?o+=4:3==i&&(o+=2))),p+=r.toString(8);o&&(p=o.toString(8)+p)}else{if(t=parseInt(t,8),p=t?t.toString(8):"",!t||"octal"==n)return p;for(a=t.toString(8),o=0,a.length>3&&(a=a.substr(-4),o=parseInt(a.substr(0,1),8),a=a.substr(1)),s=1==(1&o),c=2==(2&o),l=4==(4&o),d="",i=0;i<3;i++)d+=4==(4&parseInt(a.substr(i,1),8))?"r":"-",d+=2==(2&parseInt(a.substr(i,1),8))?"w":"-",d+=1==(1&parseInt(a.substr(i,1),8))?0==i&&l||1==i&&c?"s":"x":"-"}return"both"==n?d+" ("+p+")":"string"==n?d:p},registRawStringDecoder:function(t){e.isFunction(t)&&(this.decodeRawString=this.options.rawStringDecoder=t)},uploadMimeCheck:function(t,n){n=n||this.cwd().hash;var i,a,o=!0,r=this.option("uploadMime",n),s=function(n){var i=!1;return"string"==typeof n&&"all"===n.toLowerCase()?i=!0:Array.isArray(n)&&n.length&&e.each(n,function(e,n){if(n=n.toLowerCase(),"all"===n||0===t.indexOf(n))return i=!0,!1}),i};return t&&e.isPlainObject(r)&&(t=t.toLowerCase(),i=s(r.allow),a=s(r.deny),"allow"===r.firstOrder?(o=!1,a||i!==!0||(o=!0)):(o=!0,a!==!0||i||(o=!1))),o},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('';d.remove(),e(x).appendTo("body").ready(function(){setTimeout(function(){e(x).each(function(){e("#"+e(this).attr("id")).remove()})},2e4+1e4*i)}),b.trigger("download",{files:y}),w.resolve()}),u=y.length,g=[],i=0;i');return t&&e.each(t,function(e,t){a=i.escape(t.value),o.append('")}),e.each(n.options.encodings,function(e,t){o.append('")}),o},d=function(){var t,a,o=i.options.dialogContained?i.getUI():e(window);return a="string"==typeof n.options.dialogWidth&&(t=n.options.dialogWidth.match(/(\d+)%/))?parseInt(o.width()*(t[1]/100)):parseInt(n.options.dialogWidth||650),Math.min(a,o.width())},p=function(){if(n.options.dialogHeight){var t,a,o=i.options.dialogContained?i.getUI():e(window);return a="string"==typeof n.options.dialogHeight&&(t=n.options.dialogHeight.match(/(\d+)%/))?parseInt(o.height()*(t[1]/100)):parseInt(n.options.dialogHeight||o.height()),Math.min(a,o.height())}},u=function(t){var a,l,c,d=t.length;return d>1&&(a=t[0].mime,l=t[0].name.replace(/^.*(\.[^.]+)$/,"$1")),e.grep(t,function(t){var p;return!c&&"directory"!==t.mime&&(p=t.read&&(s||i.mimeIsText(t.mime)||e.inArray(t.mime,1===d?o:r)!==-1)&&(!n.onlyMimes.length||e.inArray(t.mime,n.onlyMimes)!==-1)&&(1===d||t.mime===a&&t.name.substr(l.length*-1)===l)&&!!i.uploadMimeCheck(t.mime,t.phash)&&b(t,d)&&Object.keys(g).length,p||(c=!0),p)})},h=function(e){var t,n=i.file(e);i.request({cmd:"info",targets:[e],preventDefault:!0}).done(function(e){var a;e&&e.files&&e.files.length&&(t=e.files[0],n.ts==t.ts&&n.size==t.size||(a={changed:[t]},i.updateCache(a),i.change(a)))})},f=function(t,o,r,s,u,f){var g,v,b,y,w,k,C=e.Deferred(),z=!1,T=function(){return!!z||(i.toast({mode:"warning",msg:i.i18n("nowLoading")}),!1)},A=function(){f&&Array.isArray(f)&&e.each(f,function(){this.msg&&i.toast(this)})},j=function(){var t,n,a,o=y?y.val():void 0,r=e.Deferred().fail(function(e){b.show().find("button.elfinder-btncnt-0,button.elfinder-btncnt-1").hide()});return T()?(g.editor&&(g.editor.save(g[0],g.editor.instance),t=g.editor.confObj,t.info&&(t.info.schemeContent||t.info.arrayBufferContent)&&(o="scheme")),n=D(),U(n),n.promise?(a=setTimeout(function(){i.notify({type:"chkcontent",cnt:1,hideCnt:!0,cancel:function(){n.reject()}})},100),n.always(function(){a&&clearTimeout(a),i.notify({type:"chkcontent",cnt:-1})}).done(function(e){C.notifyWith(g,[o,g.data("hash"),v,r])}).fail(function(e){r.reject(e)})):C.notifyWith(g,[o,g.data("hash"),v,r]),r):r.resolve()},S=function(){T()&&j().fail(function(e){e&&i.error(e)})},O=function(){g.elfinderdialog("close")},I=function(){T()&&(b.hide(),j().done(function(){z=!1,b.show(),O()}).fail(function(e){b.show(),e&&i.error(e)}))},M=function(){if(T()){var t=v,r=o.phash,s=function(e){p.addClass(a).fadeIn(function(){e&&i.error(e)}),v=t,i.disable()},l=function(){n.mime=R.mime||o.mime,n.prefix=(R.name||o.name).replace(/ \d+(\.[^.]+)?$/,"$1"),n.requestCmd="mkfile",n.nextAction={},n.data={target:r},e.proxy(i.res("mixin","make"),n)().done(function(e){var t;e.added&&e.added.length?(t=g.data("hash"),g.data("hash",e.added[0].hash),j().done(function(){z=!1,b.show(),O(),p.fadeIn()}).fail(function(){i.exec("rm",[e.added[0].hash],{forceRm:!0,quiet:!0}),g.data("hash",t),b.find("button.elfinder-btncnt-2").hide(),s()})):s()}).progress(function(e){e&&"errUploadMime"===e&&g.trigger("saveAsFail")}).fail(s).always(function(){delete n.mime,delete n.prefix,delete n.nextAction,delete n.data}),i.trigger("unselectfiles",{files:[o.hash]})},c=null,d=null,p=i.getUI().children("."+n.dialogClass+":visible");b.is(":hidden")&&(p=p.add(b)),p.removeClass(a).fadeOut(),i.enable(),i.searchStatus.state<2&&r!==i.cwd().hash?c=i.exec("open",[r],{thash:r}):i.file(r)||(d=i.request({cmd:"info",targets:[r]})),e.when([c,d]).done(function(){d?i.one("infodone",function(){i.file(r)?l():s("errFolderNotFound")}):c?i.one("cwdrender",l):l()}).fail(s)}},F=function(){var t,n,a=e.Deferred();return z?(g.editor&&g.editor.save(g[0],g.editor.instance),t=D(),t&&t.promise?(n=setTimeout(function(){i.notify({type:"chkcontent",cnt:1,hideCnt:!0,cancel:function(){t.reject()}})},100),t.always(function(){n&&clearTimeout(n),i.notify({type:"chkcontent",cnt:-1})}).done(function(e){a.resolve(v!==e)}).fail(function(e){a.resolve(e||void 0!==v)})):a.resolve(v!==t),a):a.resolve(!1)},E={title:i.escape(o.name),width:d(),height:p(),buttons:{},cssClass:a,maxWidth:"window",maxHeight:"window",allowMinimize:!0,allowMaximize:!0,openMaximized:x()||u&&u.info&&u.info.openMaximized,btnHoverFocus:!1,closeOnEscape:!1,propagationEvents:["mousemove","mouseup","click"],minimize:function(){var e;g.editor&&b.closest(".ui-dialog").is(":hidden")&&(e=g.editor.confObj,e.info&&e.info.syncInterval&&h(o.hash))},close:function(){var e=function(){var e;C.resolve(),g.editor&&(g.editor.close(g[0],g.editor.instance),e=g.editor.confObj,e.info&&e.info.syncInterval&&h(o.hash)),g.elfinderdialog("destroy")},t="undefined"!=typeof R.name,a=t?{label:"btnSaveAs",callback:function(){requestAnimationFrame(M)}}:{label:"btnSaveClose",callback:function(){j().done(function(){e()})}};F().done(function(o){var r=["confirmNotSave"];o?("string"==typeof o&&r.unshift(o),i.confirm({title:n.title,text:r,accept:a,cancel:{label:"btnClose",callback:e},buttons:t?null:[{label:"btnSaveAs",callback:function(){requestAnimationFrame(M)}}]})):e()})},open:function(){var e,n,a;if(g.initEditArea.call(g,t,o,r,i),g.editor){if(e=g.editor.load(g[0])||null,e&&e.done)e.always(function(){z=!0}).done(function(e){g.editor.instance=e,g.editor.focus(g[0],g.editor.instance),U(D()),requestAnimationFrame(function(){b.trigger("resize")})}).fail(function(e){e&&i.error(e),g.elfinderdialog("destroy")}).always(A);else{if(z=!0,e&&("string"==typeof e||Array.isArray(e)))return i.error(e),void g.elfinderdialog("destroy");g.editor.instance=e,g.editor.focus(g[0],g.editor.instance),U(D()),requestAnimationFrame(function(){b.trigger("resize")}),A()}n=g.editor.confObj,n.info&&n.info.syncInterval&&(a=parseInt(n.info.syncInterval))&&setTimeout(function(){P(a)},a)}else z=!0,U(D())},resize:function(e,t){g.editor&&g.editor.resize(g[0],g.editor.instance,e,t||{})}},D=function(){var t=g.getContent.call(g,g[0]);return void 0!==t&&t!==!1&&null!==t||(t=e.Deferred().reject()),t},U=function(e){e&&e.promise?e.done(function(e){v=e}):v=e},P=function(e){b.is(":visible")&&(h(o.hash),setTimeout(function(){P(e)},e))},q=function(){y&&F().done(function(e){e?y.attr("title",i.i18n("saveAsEncoding")).addClass("elfinder-edit-changed"):y.attr("title",i.i18n("openAsEncoding")).removeClass("elfinder-edit-changed")})},R={};if(u&&(u.html&&(g=e(u.html)),w={init:u.init||null,load:u.load,getContent:u.getContent||null,save:u.save,beforeclose:"function"==typeof u.beforeclose?u.beforeclose:void 0,close:"function"==typeof u.close?u.close:function(){},focus:"function"==typeof u.focus?u.focus:function(){},resize:"function"==typeof u.resize?u.resize:function(){},instance:null,doSave:S,doCancel:O,doClose:I,file:o,fm:i,confObj:u,trigger:function(e,t){i.trigger("editEditor"+e,Object.assign({},u.info||{},t))}}),!g){if(!i.mimeIsText(o.mime))return C.reject("errEditorNotFound");!function(){g=e('').on("input propertychange",q),u&&u.info&&!u.info.useTextAreaEvent||g.on("keydown",function(t){var n,i,a=t.keyCode;t.stopPropagation(),a==e.ui.keyCode.TAB&&(t.preventDefault(),this.setSelectionRange&&(n=this.value,i=this.selectionStart,this.value=n.substr(0,i)+"\t"+n.substr(this.selectionEnd),i+=1,this.setSelectionRange(i,i))),(t.ctrlKey||t.metaKey)&&(a!="Q".charCodeAt(0)&&a!="W".charCodeAt(0)||(t.preventDefault(),O()),a=="S".charCodeAt(0)&&(t.preventDefault(),S()))}).on("mouseenter",function(){this.focus()}),g.initEditArea=function(e,t,n){g.hide().val(n),this._setupSelEncoding(n)}}()}return g._setupSelEncoding=function(t){var n=s&&"unknown"!==s?[{value:s}]:[],a=e("").hide(),r=function(t){t&&a.appendTo(y.parent()),a.empty().append(e("").text(y.val())),y.width(a.width())};""!==t&&s&&"UTF-8"===s||n.push({value:"UTF-8"}),y=c(n).on("touchstart",function(e){e.stopPropagation()}).on("change",function(){F().done(function(e){e||""===D()||(O(),m(o,y.val(),u).fail(function(e){e&&i.error(e)}))}),r()}).on("mouseover",q),g.parent().next().prepend(e('
        ').append(y)),r(!0)},g.data("hash",o.hash),w&&(g.editor=w,"function"==typeof w.beforeclose&&(E.beforeclose=function(){return w.beforeclose(g[0],w.instance)}),"function"==typeof w.init&&(g.initEditArea=w.init),"function"==typeof w.getContent&&(g.getContent=w.getContent)),g.initEditArea||(g.initEditArea=function(){}),g.getContent||(g.getContent=function(){return l(g.val())}),u&&u.info&&u.info.preventGet||(E.buttons[i.i18n("btnSave")]=S,E.buttons[i.i18n("btnSaveClose")]=I,E.buttons[i.i18n("btnSaveAs")]=M,E.buttons[i.i18n("btnCancel")]=O),u&&"function"==typeof u.prepare&&u.prepare(g,E,o),b=n.fmDialog(g,E).attr("id",t).on("keydown keyup keypress",function(e){e.stopPropagation()}).css({overflow:"hidden",minHeight:"7em"}).addClass("elfinder-edit-editor").closest(".ui-dialog").on("changeType",function(t,n){if(n.extention&&n.mime){var a=(n.extention,n.mime,e(this).children(".ui-dialog-buttonpane").children(".ui-dialog-buttonset"));a.children(".elfinder-btncnt-0,.elfinder-btncnt-1").hide(),R.name=i.splitFileExtention(o.name)[0]+"."+n.extention,R.mime=n.mime,n.keepEditor||a.children(".elfinder-btncnt-2").trigger("click")}}),k=(i.options.dialogContained?i.getUI():e(window)).width(),b.width()>k&&b.width(k),C.promise()},m=function(t,a,o){var r,s,l,d=t.hash,p=(i.options,e.Deferred()),u="edit-"+i.namespace+"-"+t.hash,h=i.getUI().find("#"+u),g=a?a:0,v=!1;if(h.length)return h.elfinderdialog("toTop"),p.resolve();if(!(t.read&&(t.write||o.info&&o.info.converter)))return s=["errOpen",t.name,"errPerm"],p.reject(s);if(o&&o.info){if("function"==typeof o.info.edit)return l=o.info.edit.call(i,t,o),l.promise?l.done(function(){p.resolve()}).fail(function(e){p.reject(e)}):l?p.resolve():p.reject(),p;v=o.info.preventGet||o.info.noContent,o.info.urlAsContent||v?(r=e.Deferred(),o.info.urlAsContent?i.url(d,{async:!0,onetime:!0,temporary:!0}).done(function(e){r.resolve({content:e})}):r.resolve({})):(g&&(t.encoding=g,i.cache(t,"change")),r=i.request({data:{cmd:"get",target:d,conv:g,_t:t.ts},options:{type:"get",cache:!0},notify:{type:"file",cnt:1},preventDefault:!0})),r.done(function(a){var r,s,l;a.doconv?i.confirm({title:n.title,text:"unknown"===a.doconv?"confirmNonUTF8":"confirmConvUTF8",accept:{label:"btnConv",callback:function(){p=m(t,r.val(),o)}},cancel:{label:"btnCancel",callback:function(){p.reject()}},optionsCallback:function(t){t.create=function(){var t=e('
        '),n={value:a.doconv};"unknown"===a.doconv&&(n.caption="-"),r=c([n]),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("").append(r)))}}}):(!v&&i.mimeIsText(t.mime)&&(s=new RegExp("^(data:"+t.mime.replace(/([.+])/g,"\\$1")+";base64,)","i"),o.info.dataScheme?window.btoa&&!a.content.match(s)&&(a.content="data:"+t.mime+";base64,"+btoa(a.content)):window.atob&&(l=a.content.match(s))&&(a.content=atob(a.content.substr(l[1].length)))),f(u,t,a.content,a.encoding,o,a.toasts).done(function(e){p.resolve(e)}).progress(function(e,t,n,a){var o=this;t&&(d=t),i.request({options:{type:"post"},data:{cmd:"put",target:d,encoding:e||n.encoding,content:n},notify:{type:"save",cnt:1},syncOnFail:!0,preventFail:!0,navigate:{target:"changed",toast:{inbuffer:{msg:i.i18n(["complete",i.i18n("btnSave")])}}}}).fail(function(e){p.reject(e),a.reject()}).done(function(e){requestAnimationFrame(function(){o.trigger("focus"),o.editor&&o.editor.focus(o[0],o.editor.instance)}),a.resolve()})}).fail(function(e){p.reject(e)}))}).fail(function(e){var n=i.parseError(e);n=Array.isArray(n)?n[0]:n,t.encoding&&(t.encoding="",i.cache(t,"change")),"errConvUTF8"!==n&&i.sync(),p.reject(e)})}return p.promise()},g={},v={info:{id:"textarea",name:"TextArea",useTextAreaEvent:!0},load:function(t){this.trigger("Prepare",{node:t,editorObj:void 0,instance:void 0,opts:{}}),t.setSelectionRange&&t.setSelectionRange(0,0),e(t).trigger("focus").show()},save:function(){}},b=function(a,o){var r=function(t,n){if(n){if("*"===n[0]||e.inArray(t,n)!==-1)return!0;var a,o;for(o=n.length,a=0;a0||!t.info.converter&&t.info.canMakeEmpty!==!1&&i.mimesCanMakeEmpty[a.mime])&&(!t.info.maxSize||a.size<=t.info.maxSize)&&r(a.mime,t.mimes||null)&&s(a.name,t.exts||null)&&"function"==typeof t.load&&"function"==typeof t.save&&(n=t.info.name?t.info.name:"Editor "+e,t.id=t.info.id?t.info.id:"editor"+e,t.name=n,t.i18n=i.i18n(n),g[t.id]=t)}),!!Object.keys(g).length},y=function(n,a){n&&a&&(e.isPlainObject(t)||(t={}),t[n]=a.id,i.storage("storedEditors",t),i.trigger("selectfiles",{files:i.selected()}))},w=function(){var e=i.storage("useStoredEditor");return e?e>0:n.options.useStoredEditor},x=function(){var e=i.storage("editorMaximized");return e?e>0:n.options.editorMaximized},k=function(t,n){var a=[];return e.each(g,function(e,o){a.push({label:i.escape(o.i18n),icon:o.info&&o.info.icon?o.info.icon:"edit",options:{iconImg:o.info&&o.info.iconImg?i.baseUrl+o.info.iconImg:void 0},callback:function(){y(t[0].mime,o),n&&n.call(o)}})}),a},C=function(e){return e.toLowerCase().replace(/ +/g,"")},z=function(e){var n=t[e];return n&&Object.keys(g).length?g[C(n)]:void 0};this.getEncSelect=c,this.shortcuts=[{pattern:"ctrl+e"}],this.init=function(){var t,n,i=this,a=this.fm,l=this.options,c=[];this.onlyMimes=this.options.mimes||[],a.one("open",function(){l.editors&&Array.isArray(l.editors)&&(a.trigger("canMakeEmptyFile",{mimes:Object.keys(a.storage("mkfileTextMimes")||{}).concat(l.makeTextMimes||["text/plain"])}),e.each(l.editors,function(e,t){t.info&&t.info.cmdCheck&&c.push(t.info.cmdCheck)}),c.length?a.api>=2.103?n=a.request({data:{cmd:"editor",name:c,method:"enabled"},preventDefault:!0}).done(function(e){t=e}).fail(function(){t={}}):(t={},n=e.Deferred().resolve()):n=e.Deferred().resolve(),n.always(function(){t&&(l.editors=e.grep(l.editors,function(e){return!e.info||!e.info.cmdCheck||!!t[e.info.cmdCheck]})),e.each(l.editors,function(e,t){t.setup&&"function"==typeof t.setup&&t.setup.call(t,l,a),t.disabled||(t.mimes&&Array.isArray(t.mimes)&&(o=o.concat(t.mimes),t.info&&t.info.single||(r=r.concat(t.mimes))),!s&&t.mimes&&"*"===t.mimes[0]&&(s=!0),t.info||(t.info={}),t.info.integrate&&a.trigger("helpIntegration",Object.assign({cmd:"edit"},t.info.integrate)),t.info.canMakeEmpty&&a.trigger("canMakeEmptyFile",{mimes:Array.isArray(t.info.canMakeEmpty)?t.info.canMakeEmpty:t.mimes}))}),o=(e.uniqueSort||e.unique)(o),r=(e.uniqueSort||e.unique)(r),l.editors=e.grep(l.editors,function(e){return!e.disabled})}))}).bind("select",function(){g=null}).bind("contextmenucreate",function(t){var n,o,r=function(e){var t=i.title;a.one("contextmenucreatedone",function(){i.title=t}),i.title=a.escape(e.i18n),e.info&&e.info.iconImg&&(i.contextmenuOpts={iconImg:a.baseUrl+e.info.iconImg}),delete i.variants};i.contextmenuOpts=void 0,"files"===t.data.type&&i.enabled()&&(n=a.file(t.data.targets[0]),b(n,t.data.targets.length)&&(Object.keys(g).length>1?w()&&(o=z(n.mime))?(r(o),i.extra={icon:"menu",node:e("").attr({title:a.i18n("select")}).on("click touchstart",function(t){if(!("touchstart"===t.type&&t.originalEvent.touches.length>1)){var n=e(this);t.stopPropagation(),t.preventDefault(),a.trigger("contextmenu",{raw:k(a.selectedFiles(),function(){var e=a.selected();a.exec("edit",e,{editor:this}),a.trigger("selectfiles",{files:e})}),x:n.offset().left,y:n.offset().top})}})}):(delete i.extra,i.variants=[],e.each(g,function(e,t){i.variants.push([{editor:t},t.i18n,t.info&&t.info.iconImg?a.baseUrl+t.info.iconImg:"edit"])})):(r(g[Object.keys(g)[0]]),delete i.extra)))}).bind("canMakeEmptyFile",function(t){if(t.data&&t.data.resetTexts){var n=a.arrayFlip(i.options.makeTextMimes||["text/plain"]),o=i.getMkfileHides();e.each(a.storage("mkfileTextMimes")||{},function(e,t){n[e]||(delete a.mimesCanMakeEmpty[e],delete o[e])}),a.storage("mkfileTextMimes",null),Object.keys(o).length?a.storage("mkfileHides",o):a.storage("mkfileHides",null)}})},this.getstate=function(e){var t=this.files(e),n=t.length;return n&&u(t).length==n?0:-1},this.exec=function(t,n){var i,a=this.fm,o=u(this.files(t)),r=e.map(o,function(e){return e.hash}),s=[],l=n&&n.editor?n.editor:null,c=e(n&&n._currentNode?n._currentNode:a.cwdHash2Elm(r[0])),d=function(){var t=e.Deferred();return!l&&Object.keys(g).length>1?w()&&(l=z(o[0].mime))?t.resolve(l):(a.trigger("contextmenu",{raw:k(o,function(){t.resolve(this)}),x:c.offset().left,y:c.offset().top+22,opened:function(){a.one("closecontextmenu",function(){requestAnimationFrame(function(){"pending"===t.state()&&t.reject()})})}}),a.trigger("selectfiles",{files:r}),t):(Object.keys(g).length>1&&l&&y(o[0].mime,l),t.resolve(l?l:Object.keys(g).length?g[Object.keys(g)[0]]:null))},p=e.Deferred();return null===g&&b(o[0],r.length),c.length||(c=a.getUI("cwd")),d().done(function(t){for(;i=o.shift();)s.push(m(i,i.encoding||void 0,t).fail(function(e){e&&a.error(e)}));s.length?e.when.apply(null,s).done(function(){p.resolve()}).fail(function(){p.reject()}):p.reject()}).fail(function(){p.reject()}),p},this.getMkfileHides=function(){return i.storage("mkfileHides")||i.arrayFlip(n.options.mkfileHideMimes||[])}},i.prototype.commands.empty=function(){var t,n,i=function(e){var i=t.files(e);return i.length||(i=[n.cwd()]),i};this.linkedCmds=["rm"],this.init=function(){t=this,n=this.fm},this.getstate=function(t){var n,a=i(t),o=function(t){var n=!0;return e.grep(t,function(e){return n=!!(n&&e.read&&e.write&&"directory"===e.mime)})};return n=a.length,o(a).length==n?0:-1},this.exec=function(t){var a=i(t),o=a.length,r=e.Deferred().done(function(){var t={changed:{}};n.toast({msg:n.i18n(['"'+s.join('", ')+'"',"complete",n.i18n("cmdempty")])}),e.each(a,function(e,n){t.changed[n.hash]=n}),n.change(t)}).always(function(){var t=n.cwd().hash;n.trigger("selectfiles",{files:e.map(a,function(e){return t===e.phash?e.hash:null})})}),s=[],l=function(e){"number"==typeof e?(s.push(a[e].name),delete a[e].dirs):e&&n.error(e),--o<1&&r[s.length?"resolve":"reject"]()};return e.each(a,function(t,i){var a;return i.write&&"directory"===i.mime?n.isCommandEnabled("rm",i.hash)?(a=setTimeout(function(){n.notify({type:"search",cnt:1,hideCnt:!(o>1)})},n.notifyDelay),void n.request({data:{cmd:"open",target:i.hash},preventDefault:!0,asNotOpen:!0}).done(function(r){var s=[];a&&clearTimeout(a),n.ui.notify.children(".elfinder-notify-search").length&&n.notify({type:"search",cnt:-1,hideCnt:!(o>1)}),r&&r.files&&r.files.length?r.files.length>n.maxTargets?l(["errEmpty",i.name,"errMaxTargets",n.maxTargets]):(n.updateCache(r),e.each(r.files,function(e,t){return!t.write||t.locked?(l(["errEmpty",i.name,"errRm",t.name,"errPerm"]),s=[],!1):void s.push(t.hash)}),s.length&&n.exec("rm",s,{_userAction:!0,addTexts:[n.i18n("folderToEmpty",i.name)]}).fail(function(e){n.trigger("unselectfiles",{files:n.selected()}),l(n.parseError(e)||"")}).done(function(){l(t)})):(n.toast({mode:"warning",msg:n.i18n("filderIsEmpty",i.name)}),l(""))}).fail(function(e){l(n.parseError(e)||"")})):(l(["errCmdNoSupport",'"rm"']),null):(l(["errEmpty",i.name,"errPerm"]),null)}),r}},i.prototype.commands.extract=function(){var t=this,n=t.fm,i=[],a=function(t){var n=!0;return e.grep(t,function(t){return n=!(!n||!t.read||e.inArray(t.mime,i)===-1)})};this.variants=[],this.disableOnSearch=!0,n.bind("open reload",function(){i=n.option("archivers").extract||[],n.api>2?t.variants=[[{makedir:!0},n.i18n("cmdmkdir")],[{},n.i18n("btnCwd")]]:t.variants=[[{},n.i18n("btnCwd")]],t.change()}),this.getstate=function(t){var i,o,r=this.files(t),s=r.length;return s&&a(r).length==s?n.searchStatus.state>0?(i=this.fm.cwd().hash,e.each(r,function(e,t){return o=t.phash===i}),o?0:-1):this.fm.cwd().write?0:-1:-1},this.exec=function(t,a){var o,r,s,l=this.files(t),c=e.Deferred(),d=l.length,p=a&&a.makedir?1:0,u=!1,h=!1,f=0,m=n.files(l[0].phash),g=[],v={};e.each(m,function(e,t){v[t.name]=t,g.push(t.name)});var b=function(e){switch(e){case"overwrite_all":u=!0;break;case"omit_all":h=!0}},y=function(t){t.read&&n.file(t.phash).write?e.inArray(t.mime,i)===-1?(r=["errExtract",t.name,"errNoArchive"],n.error(r),c.reject(r)):n.request({data:{cmd:"extract",target:t.hash,makedir:p},notify:{type:"extract",cnt:1},syncOnFail:!0,navigate:{toast:p?{incwd:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}},inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}}}:{inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")])}}}}).fail(function(e){"rejected"!=c.state()&&c.reject(e)}).done(function(){}):(r=["errExtract",t.name,"errPerm"],n.error(r),c.reject(r))},w=function(t,i){var a=t[i],r=n.splitFileExtention(a.name)[0],l=e.inArray(r,g)>=0,m=function(){i+10&&y(a),m())};return this.enabled()&&d&&i.length?(d>0&&w(l,0),c):c.reject()}},(i.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()}}).prototype={forceLoad:!0},i.prototype.commands.fullscreen=function(){var t=this,n=this.fm,i=function(e,i){var a;e.preventDefault(),e.stopPropagation(),i&&i.fullscreen&&(a="on"===i.fullscreen,t.update(void 0,a),t.title=n.i18n(a?"reinstate":"cmdfullscreen"))};this.alwaysEnabled=!0,this.updateOnSelect=!1,this.syncTitleOnChange=!0,this.value=!1,this.options={ui:"fullscreenbutton"},this.getstate=function(){return 0},this.exec=function(){var i=n.getUI().get(0),a=i===n.toggleFullscreen(i);return t.title=n.i18n(a?"reinstate":"cmdfullscreen"),t.update(void 0,a),e.Deferred().resolve()},n.bind("init",function(){n.getUI().off("resize."+n.namespace,i).on("resize."+n.namespace,i)})},(i.prototype.commands.getfile=function(){var t=this,n=this.fm,i=function(n){var i=t.options,a=!0;return n=e.grep(n,function(e){return a=!(!a||"directory"==e.mime&&!i.folders||!e.read)}),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 t=this.files(e),n=t.length;return this.callback&&n&&i(t).length==n?0:-1},this.exec=function(n){var i,a,o,r=this.fm,s=this.options,l=this.files(n),c=l.length,d=r.option("url"),p=r.option("tmbUrl"),u=e.Deferred().done(function(e){var n,i=function(){"close"==s.oncomplete?r.hide():"destroy"==s.oncomplete&&r.destroy()},a=function(e){"close"==s.onerror?r.hide():"destroy"==s.onerror?r.destroy():e&&r.error(e)};r.trigger("getfile",{files:e});try{n=t.callback(e,r)}catch(o){return void a(["Error in `getFileCallback`.",o.message])}"object"==typeof n&&"function"==typeof n.done?n.done(i).fail(a):i()}),h=function(t){return s.onlyURL?s.multiple?e.map(l,function(e){return e.url}):l[0].url:s.multiple?l:l[0]},f=[];for(i=0;i {link}
        ',d='
        {author}
        {work}
        ',p=/\{url\}/,u=/\{link\}/,h=/\{author\}/,f=/\{work\}/,m="replace",g="ui-priority-primary",v="ui-priority-secondary",b="elfinder-help-license",y='
      • {title}
      • ',w=['
        ','
          '],x='
          {pattern}
          {descrip}
          ',k='
          ',C=e("base").length?s.escape(document.location.href.replace(/#.*$/,"")):"",z=s.res("class","tabsactive"),T=function(){var e;return e=s.theme&&s.theme.author?d[m]("elfinder-help-team","elfinder-help-team elfinder-help-term-theme")[m](h,s.i18n(s.theme.author)+(s.theme.email?" <"+s.theme.email+">":""))[m](f,s.i18n("theme")+" ("+s.i18n(s.theme.name)+")"):''},A=function(){w.push('
          '),w.push("

          elFinder

          "),w.push('
          '+s.i18n("webfm")+"
          "),w.push('
          '+s.i18n("ver")+": "+s.version+"
          "),w.push('
          '+s.i18n("protocolver")+':
          '),w.push('
          jQuery/jQuery UI: '+e().jquery+"/"+e.ui.version+"
          "),w.push(k),w.push(c[m](p,"https://studio-42.github.io/elFinder/")[m](u,s.i18n("homepage"))),w.push(c[m](p,"https://github.com/Studio-42/elFinder/wiki")[m](u,s.i18n("docs"))),w.push(c[m](p,"https://github.com/Studio-42/elFinder")[m](u,s.i18n("github"))),w.push(k),w.push('
          '+s.i18n("team")+"
          "),w.push(d[m](h,'Dmitry "dio" Levashov <dio@std42.ru>')[m](f,s.i18n("chiefdev"))),w.push(d[m](h,"Naoki Sawada (nao-pon)<hypweb+elfinder@gmail.com>")[m](f,s.i18n("developer"))),w.push(d[m](h,"Troex Nevelin <troex@fury.scancode.ru>")[m](f,s.i18n("maintainer"))),w.push(d[m](h,"Alexey Sukhotin <strogg@yandex.ru>")[m](f,s.i18n("contributor"))),s.i18[s.lang].translator&&e.each(s.i18[s.lang].translator.split(", "),function(){w.push(d[m](h,e.trim(this))[m](f,s.i18n("translator")+" ("+s.i18[s.lang].language+")"))}),w.push(T()),w.push(k),w.push('
          '+s.i18n("icons")+': Pixelmixer, Fugue, Icons8
          '),w.push(k),w.push('
          Licence: 3-clauses BSD Licence
          '),w.push('
          Copyright © 2009-2022, Studio 42 / nao-pon
          '),w.push('
          „ …'+s.i18n("dontforget")+" ”
          "),w.push("
          ")},j=function(){var t=s.shortcuts();w.push('
          '),t.length?(w.push('
          '),e.each(t,function(e,t){w.push(x.replace(/\{pattern\}/,t[0]).replace(/\{descrip\}/,t[1]))}),w.push("
          ")):w.push('
          '+s.i18n("shortcutsof")+"
          "),w.push("
          ")},S=function(){w.push('
          '),w.push('DON\'T PANIC'),w.push("
          ")},O=!1,I=function(){O=!0,w.push('
          ')},M=!1,F=function(){M=!0,w.push('
          '),w.push('
            '),w.push("
            ")},E=function(){var n,i,a,c,d,p,u=function(t,n){return e.each(n,function(n,i){t.append(e("
            ").text(n)),"undefined"==typeof i?t.append(e("
            ").append(e("").text("undfined"))):"object"!=typeof i||i?"object"==typeof i&&(e.isPlainObject(i)||i.length)?t.append(e("
            ").append(u(e("
            "),i))):t.append(e("
            ").append(e("").text(i&&"object"==typeof i?"[]":i?i:'""'))):t.append(e("
            ").append(e("").text("null")))}),t},h=r.children("li").length;(l.debug.options||l.debug.debug)&&(h>=5&&(d=r.children("li:last"),p=o.children("div:last"), +p.is(":hidden")?(d.remove(),p.remove()):(d.prev().remove(),p.prev().remove())),a=s.namespace+"-help-debug-"+ +new Date,n=e("
          • ").html(''+l.debug.debug.cmd+"").prependTo(r),i=e('
            ').data("debug",l.debug),n.on("click.debugrender",function(){var t=i.data("debug");i.removeData("debug"),t&&(i.hide(),t.debug&&(c=e("
            ").append(e("").text("debug"),u(e("
            "),t.debug)),i.append(c)),t.options&&(c=e("
            ").append(e("").text("options"),u(e("
            "),t.options)),i.append(c)),i.show()),n.off("click.debugrender")}),r.after(i),t&&o.tabs("refresh"))},D="";this.alwaysEnabled=!0,this.updateOnSelect=!1,this.state=-1,this.shortcuts=[{pattern:"f1",description:this.title}],s.bind("load",function(){var c,d,p,u,h,f,g=l.options.view||["about","shortcuts","help","integrations","debug"];(c=e.inArray("preference",g))!==-1&&g.splice(c,1),e.fn.tabs||(c=e.inArray(g,"debug"))!==-1&&g.splice(c,1),e.each(g,function(e,t){w.push(y[m](/\{id\}/g,t)[m](/\{title\}/,s.i18n(t)))}),w.push("
          "),e.inArray("about",g)!==-1&&A(),e.inArray("shortcuts",g)!==-1&&j(),e.inArray("help",g)!==-1&&(d=s.i18nBaseUrl+"help/%s.html.js",S()),e.inArray("integrations",g)!==-1&&I(),e.inArray("debug",g)!==-1&&F(),w.push("
          "),D=e(w.join("")),D.find(".ui-tabs-nav li").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"===t.type)}).on("focus blur","a",function(t){e(t.delegateTarget).toggleClass("ui-state-focus","focusin"===t.type)}).children().on("click",function(t){var n=e(this);t.preventDefault(),t.stopPropagation(),n.parent().addClass(z).siblings().removeClass(z),D.children(".ui-tabs-panel").hide().filter(n.attr("href")).show()}).filter(":first").trigger("click"),O&&(n=D.find(".elfinder-help-tab-integrations").hide(),i=D.find("#"+s.namespace+"-help-integrations").hide().append(e('
          ').html(s.i18n("integrationWith"))),s.bind("helpIntegration",function(t){var a,o,r,l,c=i.children("ul:first");t.data&&(e.isPlainObject(t.data)?(a=Object.assign({link:"",title:"",banner:""},t.data),(a.title||a.link)&&(a.title||(a.title=a.link),o=a.link?e("").attr("href",a.link).attr("target","_blank").text(a.title):e("").text(a.title),a.banner&&(o=e("").append(e("").attr(a.banner),o)))):(o=e(t.data),o.filter("a").each(function(){var t=e(this);t.attr("target")||t.attr("target","_blank")})),o&&(n.show(),c.length||(c=e('
            ').appendTo(i)),a&&a.cmd?(l="elfinder-help-integration-"+a.cmd,r=c.find("ul."+l),r.length||(r=e('
              '),c.append(e("
            • ").append(e("").html(s.i18n("cmd"+a.cmd))).append(r))),o=r.append(e("
            • ").append(o))):c.append(e("
            • ").append(o))))}).bind("themechange",function(){D.find("div.elfinder-help-term-theme").replaceWith(T())})),M&&(a=D.find(".elfinder-help-tab-debug").hide(),o=D.find("#"+s.namespace+"-help-debug").children("div:first"),r=o.children("ul:first").on("click",function(e){e.preventDefault(),e.stopPropagation()}),l.debug={},s.bind("backenddebug",function(e){M&&e.data&&e.data.debug&&(l.debug={options:e.data.options,debug:Object.assign({cmd:s.currentReqCmd},e.data.debug)},l.dialog&&E())})),D.find("#"+s.namespace+"-help-about").find(".apiver").text(s.api),l.dialog=l.fmDialog(D,{title:l.title,width:530,maxWidth:"window",maxHeight:"window",autoOpen:!1,destroyOnClose:!1,close:function(){M&&(a.hide(),o.tabs("destroy")),t=!1}}).on("click",function(e){e.stopPropagation()}).css({overflow:"hidden"}),p=l.dialog.children(".ui-tabs"),u=p.children(".ui-tabs-nav:first"),h=p.children(".ui-tabs-panel"),f=l.dialog.outerHeight(!0)-l.dialog.height(),l.dialog.closest(".ui-dialog").on("resize",function(){h.height(l.dialog.height()-f-u.outerHeight(!0)-20)}),d&&l.dialog.one("initContents",function(){e.ajax({url:l.options.helpSource?l.options.helpSource:d.replace("%s",s.lang),dataType:"html"}).done(function(t){e("#"+s.namespace+"-help-help").html(t)}).fail(function(){e.ajax({url:d.replace("%s","en"),dataType:"html"}).done(function(t){e("#"+s.namespace+"-help-help").html(t)})})}),l.state=0,s.trigger("helpBuilded",l.dialog)}).one("open",function(){var e=!1;s.one("backenddebug",function(){e=!0}).one("opendone",function(){requestAnimationFrame(function(){!e&&M&&(M=!1,a.hide(),o.hide(),r.hide())})})}),this.getstate=function(){return 0},this.exec=function(n,i){var s=i?i.tab:void 0,l=function(){M&&(o.tabs(),r.find("a:first").trigger("click"),a.show(),t=!0)};return l(),this.dialog.trigger("initContents").elfinderdialog("open").find((s?".elfinder-help-tab-"+s:".ui-tabs-nav li")+" a:first").trigger("click"),e.Deferred().resolve()}}).prototype={forceLoad:!0},i.prototype.commands.hidden=function(){this.hidden=!0,this.updateOnSelect=!1,this.getstate=function(){return-1}},i.prototype.commands.hide=function(){var t,n,i,a,o=this,r={};this.syncTitleOnChange=!0,this.shortcuts=[{pattern:"ctrl+shift+dot",description:this.fm.i18n("toggleHidden")}],this.init=function(){var e=this.fm;t=e.storage("hide")||{items:{}},n=Object.keys(t.items).length,this.title=e.i18n(t.show?"hideHidden":"showHidden"),o.update(void 0,o.title)},this.fm.bind("select contextmenucreate closecontextmenu",function(e,r){var s=(e.data?e.data.selected||e.data.targets:null)||r.selected();"select"===e.type&&e.data?a=e.data.origin:"contextmenucreate"===e.type&&(i=e.data.type),!s.length||("contextmenucreate"!==e.type&&"navbar"!==a||"cwd"===i)&&s[0]===r.cwd().hash?o.title=r.i18n(t.show?"hideHidden":"showHidden"):o.title=r.i18n("cmdhide"),"closecontextmenu"!==e.type?o.update("cwd"===i?n?0:-1:void 0,o.title):(i="",requestAnimationFrame(function(){o.update(void 0,o.title)}))}),this.getstate=function(e){return this.fm.cookieEnabled&&"cwd"!==i&&(e||this.fm.selected()).length||n?0:-1},this.exec=function(i,s){var l,c,d=this.fm,p=e.Deferred().done(function(){d.trigger("hide",{items:h,opts:s})}).fail(function(e){d.error(e)}),u=s||{},h=u.targets?u.targets:i||d.selected(),f=[];if(t=d.storage("hide")||{},e.isPlainObject(t)||(t={}),e.isPlainObject(t.items)||(t.items={}),("shortcut"===s._currentType||!h.length||"navbar"!==s._currentType&&"navbar"!==a&&h[0]===d.cwd().hash)&&(t.show?u.hide=!0:Object.keys(t.items).length&&(u.show=!0)),u.reset&&(u.show=!0,n=0),u.show||u.hide){if(u.show?t.show=!0:delete t.show,u.show)return d.storage("hide",u.reset?null:t),o.title=d.i18n("hideHidden"),o.update(u.reset?-1:void 0,o.title),e.each(t.items,function(e){var t=d.file(e,!0);t&&(d.searchStatus.state||!t.phash||d.file(t.phash))&&f.push(t)}),f.length&&(d.updateCache({added:f}),d.add({added:f})),u.reset&&(t={items:{}}),p.resolve();h=Object.keys(t.items)}return h.length&&(e.each(h,function(e,n){var i;t.items[n]||(i=d.file(n),i&&(r[n]=i.i18||i.name),t.items[n]=r[n]?r[n]:n)}),n=Object.keys(t.items).length,l=this.files(h),d.storage("hide",t),d.remove({removed:h}),t.show&&this.exec(void 0,{hide:!0}),u.hide||(c={},c.undo={cmd:"hide",callback:function(){var t=d.storage("hide");t&&(e.each(h,function(e,n){delete t.items[n]}),n=Object.keys(t.items).length,d.storage("hide",t),d.trigger("hide",{items:h,opts:{}}),o.update(n?0:-1)),d.updateCache({added:l}),d.add({added:l})}},c.redo={cmd:"hide",callback:function(){return d.exec("hide",void 0,{targets:h})}})),"rejected"==p.state()?p:p.resolve(c)}},(i.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())}}).prototype={forceLoad:!0},(i.prototype.commands.info=function(){var t=this.fm,n="elfinder-spinner",i="elfinder-info-button",a={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"),roots:t.i18n("volumeRoots"),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"),getlink:t.i18n("getLink")},o=function(e,t){return t?e.replace(/\u200B/g,""):e.replace(/(\/|\\)/g,"$1​")};this.items=["size","aliasfor","path","link","dim","modify","perms","locked","owner","group","perm"],this.options.custom&&Object.keys(this.options.custom).length&&e.each(this.options.custom,function(e,t){t.label&&this.items.push(t.label)}),this.tpl={main:'
              {title}
              {content}
              ',itemTitle:'{name}{kind}',groupTitle:"{items}: {num}",row:'{label} : {value}',spinner:'{text} '},this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+i"}],this.init=function(){e.each(a,function(e,n){a[e]=t.i18n(n)})},this.getstate=function(){return 0},this.exec=function(t){var r=this.files(t);r.length||(r=this.files([this.fm.cwd().hash]));var s,l,c,d,p,u,h,f,m,g=this,v=this.fm,b=this.options,y=this.tpl,w=y.row,x=r.length,k=[],C=y.main,z="{label}",T="{value}",A=[],j=null,S={title:v.i18n("selectionInfo"),width:"auto",close:function(){e(this).elfinderdialog("destroy"),j&&"pending"===j.state()&&j.reject(),e.grep(A,function(e){e&&"pending"===e.state()&&e.reject()})}},O=[],I=function(e,t,i){F.find("."+n+"-"+t).parent().html(e).addClass(i||"")},M=v.namespace+"-info-"+e.map(r,function(e){return e.hash}).join("-"),F=v.getUI().find("#"+M),E=[],D="",U="elfinder-font-mono elfinder-info-hash",P=[],q=v.ui.notify;if(q.is(":hidden")&&q.children(".elfinder-notify").length&&q.elfinderdialog("open").height("auto"),!x)return e.Deferred().reject();if(F.length)return F.elfinderdialog("toTop"),e.Deferred().resolve();if(f=v.storage("infohides")||v.arrayFlip(b.hideItems,!0),1===x){if(c=r[0],c.icon&&(D=" "+v.getIconStyle(c)),C=C.replace("{dirclass}",c.csscls?v.escape(c.csscls):"").replace("{class}",v.mime2class(c.mime)).replace("{style}",D),d=y.itemTitle.replace("{name}",v.escape(c.i18||c.name)).replace("{kind}",''+v.mime2kind(c)+""),l=v.tmb(c),c.read?"directory"!=c.mime||c.alias?s=v.formatSize(c.size):(s=y.spinner.replace("{text}",a.calc).replace("{name}","size"),O.push(c.hash)):s=a.unknown,!f.size&&k.push(w.replace(z,a.size).replace(T,s)),!f.aleasfor&&c.alias&&k.push(w.replace(z,a.aliasfor).replace(T,c.alias)),f.path||((h=v.path(c.hash,!0))?k.push(w.replace(z,a.path).replace(T,o(v.escape(h))).replace("{class}","elfinder-info-path")):(k.push(w.replace(z,a.path).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","path")).replace("{class}","elfinder-info-path")),A.push(v.path(c.hash,!0,{notify:null}).fail(function(){I(a.unknown,"path")}).done(function(e){I(o(e),"path")})))),!f.link&&c.read){var R,H=v.escape(c.name);if("1"==c.url)k.push(w.replace(z,a.link).replace(T,'"));else{if(c.url)R=c.url;else if("directory"===c.mime)if(b.nullUrlDirLinkSelf&&null===c.url){var _=window.location;R=_.pathname+_.search+"#elf_"+c.hash}else""!==c.url&&v.option("url",!v.isRoot(c)&&c.phash||c.hash)&&(R=v.url(c.hash));else R=v.url(c.hash);R&&k.push(w.replace(z,a.link).replace(T,''+H+""))}}f.dim||(c.dim?k.push(w.replace(z,a.dim).replace(T,c.dim)):c.mime.indexOf("image")!==-1&&(c.width&&c.height?k.push(w.replace(z,a.dim).replace(T,c.width+"x"+c.height)):c.size&&"0"!==c.size&&(k.push(w.replace(z,a.dim).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","dim"))),A.push(v.request({data:{cmd:"dim",target:c.hash},preventDefault:!0}).fail(function(){I(a.unknown,"dim")}).done(function(e){if(I(e.dim||a.unknown,"dim"),e.dim){var t=e.dim.split("x"),n=v.file(c.hash);n.width=t[0],n.height=t[1]}}))))),!f.modify&&k.push(w.replace(z,a.modify).replace(T,v.formatDate(c))),!f.perms&&k.push(w.replace(z,a.perms).replace(T,v.formatPermissions(c))),!f.locked&&k.push(w.replace(z,a.locked).replace(T,c.locked?a.yes:a.no)),!f.owner&&c.owner&&k.push(w.replace(z,a.owner).replace(T,c.owner)),!f.group&&c.group&&k.push(w.replace(z,a.group).replace(T,c.group)),!f.perm&&c.perm&&k.push(w.replace(z,a.perm).replace(T,v.formatFileMode(c.perm))),window.ArrayBuffer&&(v.options.cdns.sparkmd5||v.options.cdns.jssha)&&"directory"!==c.mime&&c.size>0&&(!b.showHashMaxsize||c.size<=b.showHashMaxsize)&&(P=[],e.each(v.storage("hashchekcer")||b.showHashAlgorisms,function(e,t){c[t]?k.push(w.replace(z,v.i18n(t)).replace(T,c[t]).replace("{class}",U)):(k.push(w.replace(z,v.i18n(t)).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}",t))),P.push(t))}),P.length&&(m=e('
              '),A.push(v.getContentsHashes(c.hash,P,b.showHashOpts,{progressBar:m}).progress(function(t){e.each(P,function(e,n){t[n]&&I(t[n],n,U)})}).always(function(){e.each(P,function(e,t){I(a.unknown,t)})})))),b.custom&&e.each(b.custom,function(t,n){f[n.label]||n.mimes&&!e.grep(n.mimes,function(e){return c.mime===e||0===c.mime.indexOf(e+"/")}).length||n.hashRegex&&!c.hash.match(n.hashRegex)||(k.push(w.replace(z,v.i18n(n.label)).replace(T,n.tpl.replace("{id}",M))),n.action&&"function"==typeof n.action&&E.push(n.action))})}else C=C.replace("{class}","elfinder-cwd-icon-group"),d=y.groupTitle.replace("{items}",a.items).replace("{num}",x),p=e.grep(r,function(e){return"directory"==e.mime}).length,p?(u=e.grep(r,function(e){return!("directory"!==e.mime||e.phash&&!e.isroot)}).length,p-=u,k.push(w.replace(z,a.kind).replace(T,u===x||p===x?a[u?"roots":"folders"]:e.map({roots:u,folders:p,files:x-u-p},function(e,t){return e?a[t]+" "+e:null}).join(", "))),!f.size&&k.push(w.replace(z,a.size).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","size"))),O=e.map(r,function(e){return e.hash})):(s=0,e.each(r,function(e,t){var n=parseInt(t.size);n>=0&&s>=0?s+=n:s="unknown"}),k.push(w.replace(z,a.kind).replace(T,a.files)),!f.size&&k.push(w.replace(z,a.size).replace(T,v.formatSize(s))));return C=C.replace("{title}",d).replace("{content}",k.join("").replace(/{class}/g,"")),F=g.fmDialog(C,S),F.attr("id",M).one("mousedown",".elfinder-info-path",function(){e(this).html(o(e(this).html(),!0))}),P.length&&m.appendTo(F.find("."+n+"-"+P[0]).parent()),v.UA.Mobile&&e.fn.tooltip&&F.children(".ui-dialog-content .elfinder-info-title").tooltip({classes:{"ui-tooltip":"elfinder-ui-tooltip ui-widget-shadow"},tooltipClass:"elfinder-ui-tooltip ui-widget-shadow",track:!0}),c&&"1"==c.url&&F.on("click","."+n+"-url",function(){e(this).parent().html(y.spinner.replace("{text}",v.i18n("ntfurl")).replace("{name}","url")),v.request({data:{cmd:"url",target:c.hash},preventDefault:!0}).fail(function(){I(H,"url")}).done(function(e){if(e.url){I(''+H+""||H,"url");var t=v.file(c.hash);t.url=e.url}else I(H,"url")})}),l&&e("").on("load",function(){F.find(".elfinder-cwd-icon").addClass(l.className).css("background-image","url('"+l.url+"')")}).attr("src",l.url),O.length&&(j=v.getSize(O).done(function(e){I(e.formated,"size")}).fail(function(){I(a.unknown,"size")})),E.length&&e.each(E,function(e,t){try{t(c,v,F)}catch(n){v.debug("error",n)}}),e.Deferred().resolve()}}).prototype={forceLoad:!0},i.prototype.commands.mkdir=function(){var t,n=this.fm,i=this;this.value="",this.disableOnSearch=!0,this.updateOnSelect=!1,this.syncTitleOnChange=!0,this.mime="directory",this.prefix="untitled folder",this.exec=function(a,o){var r;return a&&a.length&&o&&o._currentType&&"navbar"===o._currentType?(this.origin=o._currentType,this.data={target:a[0]}):(r=n.cwd().hash===a[0],this.origin=t&&!r?t:"cwd",delete this.data),a||this.options.intoNewFolderToolbtn||n.getUI("cwd").trigger("unselectall"),this.move=this.value===n.i18n("cmdmkdirin"),e.proxy(n.res("mixin","make"),i)()},this.shortcuts=[{pattern:"ctrl+shift+n"}],this.init=function(){this.options.intoNewFolderToolbtn&&(this.syncTitleOnChange=!0)},n.bind("select contextmenucreate closecontextmenu",function(e){var a=(e.data?e.data.selected||e.data.targets:null)||n.selected();i.className="mkdir",t=e.data&&a.length?e.data.origin||e.data.type||"":"",i.options.intoNewFolderToolbtn||""!==t||(t="cwd"),a.length&&"navbar"!==t&&"cwd"!==t&&n.cwd().hash!==a[0]?(i.title=n.i18n("cmdmkdirin"),i.className+=" elfinder-button-icon-mkdirin"):i.title=n.i18n("cmdmkdir"),"closecontextmenu"!==e.type?i.update(void 0,i.title):requestAnimationFrame(function(){i.update(void 0,i.title)})}),this.getstate=function(i){var a=n.cwd(),o="navbar"===t||i&&i[0]!==a.hash?this.files(i||n.selected()):[],r=o.length,s=function(t){var n=!0;return e.grep(t,function(e){return n=!(!n||!e.read||e.locked)})};return"navbar"===t?r&&o[0].write&&o[0].read?0:-1:!a.write||r&&s(o).length!=r?-1:0}},i.prototype.commands.mkfile=function(){var t=this;this.disableOnSearch=!0,this.updateOnSelect=!1,this.mime="text/plain",this.prefix="untitled file.txt",this.variants=[],this.getTypeName=function(e,n){var i,a=t.fm;return i=(i=a.messages["kind"+a.kinds[e]])?a.i18n(["extentiontype",n.toUpperCase(),i]):a.i18n(["extentionfile",n.toUpperCase()])},this.fm.bind("open reload canMakeEmptyFile",function(){var n=t.fm,i=n.getCommand("edit").getMkfileHides();t.variants=[],n.mimesCanMakeEmpty&&e.each(n.mimesCanMakeEmpty,function(e,a){a&&!i[e]&&n.uploadMimeCheck(e)&&t.variants.push([e,t.getTypeName(e,a)])}),t.change()}),this.getstate=function(){return this.fm.cwd().write?0:-1},this.exec=function(n,i){var a,o,r=t.fm;if(a=r.mimesCanMakeEmpty[i]){if(r.uploadMimeCheck(i))return this.mime=i,this.prefix=r.i18n(["untitled file",a]),e.proxy(r.res("mixin","make"),t)();o=["errMkfile",t.getTypeName(i,a)]}return e.Deferred().reject(o)}},i.prototype.commands.netmount=function(){var t,n=this,i=!1;this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){var t=n.fm;t.cookieEnabled&&t.one("open",function(){n.drivers=t.netDrivers,n.drivers.length&&e.each(n.drivers,function(){var e=n.options[this];e&&(i=!0,e.integrateInfo&&t.trigger("helpIntegration",Object.assign({cmd:"netmount"},e.integrateInfo)))})})}},this.getstate=function(){return i?0:-1},this.exec=function(){var i,a=n.fm,o=e.Deferred(),r=n.options,s=function(){var s,l=function(){c.protocol.trigger("change","winfocus")},c={protocol:e("").on("change",function(e,n){var o=this.value;t.find(".elfinder-netmount-tr").hide(),t.find(".elfinder-netmount-tr-"+o).show(),i&&i.children(".ui-dialog-buttonpane:first").find("button").show(),"function"==typeof r[o].select&&r[o].select(a,e,n)}).addClass("ui-corner-all")},d={title:a.i18n("netMountDialogTitle"),resizable:!0,modal:!0,destroyOnClose:!1,open:function(){e(window).on("focus."+a.namespace,l),c.protocol.trigger("change")},close:function(){"pending"==o.state()&&o.reject(),e(window).off("focus."+a.namespace,l)},buttons:{}},p=function(){var i,s=c.protocol.val(),l={cmd:"netmount",protocol:s},d=r[s];return e.each(t.find("input.elfinder-netmount-inputs-"+s),function(t,n){var i,a;a=e(n),a.is(":radio,:checkbox")?a.is(":checked")&&(i=e.trim(a.val())):i=e.trim(a.val()),i&&(l[n.name]=i)}),l.host?(l.mnt2res&&(i=!0),a.request({data:l,notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){var t;e.added&&e.added.length&&(i&&c.protocol.trigger("change","reset"),e.added[0].phash&&(t=a.file(e.added[0].phash))&&(t.dirs||(t.dirs=1,a.change({changed:[t]}))),a.one("netmountdone",function(){a.exec("open",e.added[0].hash)})),o.resolve()}).fail(function(e){d.fail&&"function"==typeof d.fail&&d.fail(a,a.parseError(e)),o.reject(e)}),void n.dialog.elfinderdialog("close")):a.trigger("error",{error:"errNetMountHostReq",opts:{modal:!0}})},u=e('
              ').on("keydown","input",function(t){var n,i=!0;t.keyCode===e.ui.keyCode.ENTER&&(e.each(u.find("input:visible:not(.elfinder-input-optional)"),function(){if(""===e(this).val())return i=!1,n=e(this),!1}),i?p():n.trigger("focus"))}),h=e("
              ");return t=e('
              ').append(e("").append(e(""+a.i18n("protocol")+"")).append(e("").append(c.protocol))),e.each(n.drivers,function(n,i){r[i]&&(c.protocol.append('"),e.each(r[i].inputs,function(n,o){o.attr("name",n),"hidden"!=o.attr("type")?(o.addClass("ui-corner-all elfinder-netmount-inputs-"+i),t.append(e("").addClass("elfinder-netmount-tr elfinder-netmount-tr-"+i).append(e(""+a.i18n(n)+"")).append(e("").append(o)))):(o.addClass("elfinder-netmount-inputs-"+i),h.append(o))}),r[i].protocol=c.protocol)}),t.append(h),t.find(".elfinder-netmount-tr").hide(),t.find(".elfinder-netmount-tr-"+n.drivers[0]).show(),d.buttons[a.i18n("btnMount")]=p,d.buttons[a.i18n("btnCancel")]=function(){n.dialog.elfinderdialog("close")},t.find("select,input").addClass("elfinder-tabstop"),s=n.fmDialog(u.append(t),d).ready(function(){c.protocol.trigger("change"),s.elfinderdialog("posInit")}),i=s.closest(".ui-dialog"),s};return n.dialog?n.dialog.elfinderdialog("open"):n.dialog=s(),o.promise()},n.fm.bind("netmount",function(e){var i=e.data||null,a=n.options,o=function(){a[i.protocol]&&"function"==typeof a[i.protocol].done&&(a[i.protocol].done(n.fm,i),t.find("select,input").addClass("elfinder-tabstop"),n.dialog.elfinderdialog("tabstopsInit"))};i&&i.protocol&&(i.mode&&"redirect"===i.mode?n.fm.request({data:{cmd:"netmount",protocol:i.protocol,host:i.host,user:"init",pass:"return",options:i.options},preventDefault:!0}).done(function(e){i=JSON.parse(e.body),o()}):o())})},i.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,n=this.fm;return e&&this.drivers.length&&!this._disabled&&(t=n.file(e[0]))&&t.netkey?0:-1},this.exec=function(t){var n=this,i=this.fm,a=e.Deferred().fail(function(e){e&&i.error(e)}),o=i.file(t[0]),r=function(t){var n,a=[];return i.leafRoots&&(n=[],e.each(i.leafRoots,function(a,o){var r,s=i.parents(a);(r=e.inArray(t,s))!==-1&&(r=s.length-r,e.each(o,function(e,t){n.push({i:r,hash:t})}))}),n.length&&(n.sort(function(e,t){return e.i').hide().appendTo(e("body"));if(t.UA.Mobile||!h){if(u)h?p.attr("target","_blank"):p.attr("download",a.name),p.attr("href",n).get(0).click();else if(i=window.open(n),!i)return g.reject("errPopup")}else{if(m="string"==typeof w.method&&"get"===w.method.toLowerCase(),!m&&0===n.indexOf(t.options.url)&&t.customData&&Object.keys(t.customData).length&&!a.mime.match(/^(?:video|audio)/)&&(n=""),"window"===x?(s=c=Math.round(2*screen.availWidth/3),l=d=Math.round(2*screen.availHeight/3),parseInt(a.width)&&parseInt(a.height)?(s=parseInt(a.width),l=parseInt(a.height)):a.dim&&(o=a.dim.split("x"),s=parseInt(o[0]),l=parseInt(o[1])),c>=s&&d>=l?(c=s,d=l):s-c>l-d?d=Math.round(l*(c/s)):c=Math.round(s*(d/l)),r="width="+c+",height="+d,i=window.open(n,f,r+",top=50,left=50,scrollbars=yes,resizable=yes,titlebar=no")):("tabs"===x&&(f=a.hash),i=window.open("about:blank",f)),!i)return g.reject("errPopup");if(""===n){var v=document.createElement("form");v.action=t.options.url,v.method="POST",v.target=f,v.style.display="none";var b=Object.assign({},t.customData,{cmd:"file",target:a.hash,_t:a.ts||parseInt(+new Date/1e3)});e.each(b,function(e,t){var n=document.createElement("input");n.name=e,n.value=t,v.appendChild(n)}),document.body.appendChild(v),v.submit()}else"window"!==x&&(i.location=n);e(i).trigger("focus")}p.remove()};try{p=new RegExp(t.option("dispInlineRegex"),"i")}catch(k){p=!1}for(u="string"==typeof e("").get(0).download,b=v.length;b--;){if(f="elf_open_window",a=v[b],!a.read)return g.reject(["errOpen",a.name,"errPerm"]);h=p&&a.mime.match(p),t.openUrl(a.hash,!h,y)}return g.resolve(n)};if(b>1)t.confirm({title:"openMulti",text:["openMultiConfirm",b+""],accept:{label:"cmdopen",callback:function(){k()}},cancel:{label:"btnCancel",callback:function(){g.reject()}},buttons:t.getCommand("zipdl")&&t.isCommandEnabled("zipdl",t.cwd().hash)?[{label:"cmddownload",callback:function(){t.exec("download",n),g.reject()}}]:[]});else{if(f=t.storage("selectAction")||w.selectAction,f&&(e.each(f.split("/"),function(){var e=this.valueOf();return("open"===e||!(m=t.getCommand(e))||!m.enabled())&&void(m=null)}),m))return t.exec(m.name);k()}return g}}).prototype={forceLoad:!0},i.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("workzone"),e.hasClass("elfinder-search-result")?0:-1)},this.exec=function(t){var n,i=this.fm,a=e.Deferred(),o=this.files(t),r=o.length;return r&&o[0].phash?(n=o[0].phash,i.trigger("searchend",{noupdate:!0}),i.request({data:{cmd:"open",target:n},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!1}),a):a.reject()}},i.prototype.commands.opennew=function(){var t=this.fm;this.shortcuts=[{pattern:("function"==typeof t.options.getFileCallback?"shift+":"")+"ctrl+enter"}],this.getstate=function(e){var t=this.files(e),n=t.length;return 1===n&&"directory"===t[0].mime&&t[0].read?0:-1},this.exec=function(t){var n,i,a,o,r=e.Deferred(),s=this.files(t),l=s.length,c=this.options;return 1===l&&(n=s[0])&&"directory"===n.mime?(i=window.location,a=c.url?c.url:i.pathname,c.useOriginQuery&&(a.match(/\?/)?i.search&&(a+="&"+i.search.substr(1)):a+=i.search),a+="#elf_"+n.hash,o=window.open(a,"_blank"),setTimeout(function(){o.focus()},1e3),r.resolve()):r.reject()}},i.prototype.commands.paste=function(){this.updateOnSelect=!1,this.handlers={changeclipboard:function(){this.update()}},this.shortcuts=[{pattern:"ctrl+v shift+insert"}],this.getstate=function(e){if(this._disabled)return-1;if(e){if(Array.isArray(e)){if(1!=e.length)return-1;e=this.fm.file(e[0])}}else e=this.fm.cwd();return this.fm.clipboard().length&&"directory"==e.mime&&e.write?0:-1},this.exec=function(t,n){var i,a,o,r=this,s=r.fm,l=n||{},c=t?this.files(t)[0]:s.cwd(),d=s.clipboard(),p=d.length,u=!!p&&d[0].cut,h=l._cmd?l._cmd:u?"move":"copy",f="err"+h.charAt(0).toUpperCase()+h.substr(1),m=[],g=[],v=e.Deferred().fail(function(e){e&&s.error(e)}).always(function(){s.unlockfiles({files:e.map(d,function(e){return e.hash})})}),b=function(t){return t.length&&s._commands.duplicate?s.exec("duplicate",t):e.Deferred().resolve()},y=function(t){var n,i=e.Deferred(),a=[],o={},d=function(t,n){for(var i=[],a=t.length;a--;)e.inArray(t[a].name,n)!==-1&&i.unshift(a);return i},p=function(e){var n=a[e],o=t[n],r=e==a.length-1;o&&s.confirm({title:s.i18n(h+"Files"),text:["errExists",o.name,"restore"===h?"confirmRest":"confirmRepl"],all:!r,accept:{label:"btnYes",callback:function(n){r||n?m(t):p(++e)}},reject:{label:"btnNo",callback:function(n){var i;if(n)for(i=a.length;e{title}',s=e('
              '),l=e('
                '),c=e('
                '),d=(e("base").length?document.location.href.replace(/#.*$/,""):"",function(t){e("#"+a.namespace+"-preference-tab-"+t).trigger("mouseover").trigger("click"),n=t}),p=a.res("class","tabsactive"),u=function(){var u=i.options.categories||{language:["language"],theme:["theme"],toolbar:["toolbarPref"],workspace:["iconSize","columnPref","selectAction","makefileTypes","useStoredEditor","editorMaximized","useFullscreen","showHidden"],dialog:["autoFocusDialog"],selectionInfo:["infoItems","hashChecker"],reset:["clearBrowserData"],all:!0},h=i.options.prefs||["language","theme","toolbarPref","iconSize","columnPref","selectAction","makefileTypes","useStoredEditor","editorMaximized","useFullscreen","showHidden","infoItems","hashChecker","autoFocusDialog","clearBrowserData"];a.cookieEnabled||delete u.language,h=a.arrayFlip(h,!0),a.options.getFileCallback&&delete h.selectAction,a.UA.Fullscreen||delete h.useFullscreen,h.language&&(h.language=function(){var t=e("").on("change",function(){var t=e(this).val();a.storage("lang",t),e("#"+a.id).elfinder("reload")}),n=[],o=i.options.langs||{ar:"العربية",bg:"Български",ca:"Català",cs:"Čeština",da:"Dansk",de:"Deutsch",el:"Ελληνικά",en:"English",es:"Español",fa:"فارسی",fo:"Føroyskt",fr:"Français",fr_CA:"Français (Canada)",he:"עברית",hr:"Hrvatski",hu:"Magyar",id:"Bahasa Indonesia",it:"Italiano",ja:"日本語",ko:"한국어",nl:"Nederlands",no:"Norsk",pl:"Polski",pt_BR:"Português",ro:"Română",ru:"Pусский",si:"සිංහල",sk:"Slovenčina",sl:"Slovenščina",sr:"Srpski",sv:"Svenska",tr:"Türkçe",ug_CN:"ئۇيغۇرچە",uk:"Український",vi:"Tiếng Việt",zh_CN:"简体中文",zh_TW:"正體中文"};return a.cookieEnabled?(e.each(o,function(e,t){n.push('")}),t.append(n.join("")).val(a.lang)):e()}()),h.theme&&(h.theme=function(){var t=a.options.themes?Object.keys(a.options.themes).length:0;if(0===t||1===t&&a.options.themes["default"])return null;var n=e("").on("change",function(){var t=e(this).val();a.changeTheme(t).storage("theme",t)}),i={image:'',link:'$2',data:'
                $1
                $2
                '},o=["image","description","author","email","license"],r=e('').text(a.i18n("default")).on("click",function(e){n.val("default").trigger("change")}),s=e('
                ').on("click","button",function(){var t=e(this).data("themeid");n.val(t).trigger("change")});return a.options.themes["default"]||n.append('"),e.each(a.options.themes,function(t,r){var l,c=e('"),d=e('
                '+a.i18n(t)+'
                ');n.append(c),s.append(d),l=setTimeout(function(){d.find("span.elfinder-spinner").replaceWith(a.i18n(["errRead",t]))},1e4),a.getTheme(t).always(function(){l&&clearTimeout(l)}).done(function(r){var s,l=e(),p=e("
                ");s=r.link?i.link.replace(/\$1/g,r.link).replace(/\$3/g,a.i18n("website")):"$2",r.name&&c.html(a.i18n(r.name)),d.children("legend").html(s.replace(/\$2/g,a.i18n(r.name)||t)),e.each(o,function(o,s){var l,c=i[s]||i.data;r[s]&&(l=c.replace(/\$0/g,a.escape(s)).replace(/\$1/g,a.i18n(s)).replace(/\$2/g,a.i18n(r[s])),"image"===s&&r.link&&(l=e(l).on("click",function(){n.val(t).trigger("change")}).attr("title",a.i18n("select"))),p.append(l))}),l=l.add(p),l=l.add(e('
                ').append(e('').data("themeid",t).html(a.i18n("select")))),d.find("span.elfinder-spinner").replaceWith(l)}).fail(function(){d.find("span.elfinder-spinner").replaceWith(a.i18n(["errRead",t]))})}),e("
                ").append(n.val(a.theme&&a.theme.id?a.theme.id:"default"),r,s)}()),h.toolbarPref&&(h.toolbarPref=function(){var t=e.map(a.options.uiOptions.toolbar,function(t){return e.isArray(t)?t:null}),n=[],i=a.storage("toolbarhides")||{};return e.each(t,function(){var e=this,t=a.i18n("cmd"+e);t==="cmd"+e&&(t=a.i18n(e)),n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("toolbarhides",i),a.trigger("toolbarpref")})}()),h.iconSize&&(h.iconSize=function(){var t=a.options.uiOptions.cwd.iconsView.sizeMax||3,n=a.storage("iconsize")||a.options.uiOptions.cwd.iconsView.size||0,i=e('
                ').slider({classes:{"ui-slider-handle":"elfinder-tabstop"},value:n,max:t,slide:function(e,t){a.getUI("cwd").trigger("iconpref",{size:t.value})},change:function(e,t){a.storage("iconsize",t.value)}});return a.getUI("cwd").on("iconpref",function(e,t){i.slider("option","value",t.size)}),i}()),h.columnPref&&(h.columnPref=function(){var t=a.options.uiOptions.cwd.listView.columns,n=[],i=a.storage("columnhides")||{};return e.each(t,function(){var e=this,t=a.getColumnName(e);n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("columnhides",i),a.trigger("columnpref",{repaint:!0})})}()),h.selectAction&&(h.selectAction=function(){var t=e("").on("change",function(){var t=e(this).val();a.storage("selectAction","default"===t?null:t)}),n=[],o=i.options.selectActions,r=a.getCommand("open").options.selectAction||"open";return e.inArray(r,o)===-1&&o.unshift(r),e.each(o,function(t,i){var o=e.map(i.split("/"),function(e){var t=a.i18n("cmd"+e);return t==="cmd"+e&&(t=a.i18n(e)),t});n.push('")}),t.append(n.join("")).val(a.storage("selectAction")||r)}()),h.makefileTypes&&(h.makefileTypes=function(){var t=a.getCommand("edit").getMkfileHides(),n=function(){var n=[];return t=a.getCommand("edit").getMkfileHides(),e.each(a.mimesCanMakeEmpty,function(e,i){var o=a.getCommand("mkfile").getTypeName(e,i);n.push('")}),n.join(" ")},i=e("
                ").on("change","input",function(){var n=e(this).val(),i=e(this).is(":checked");i||t[n]?i&&t[n]&&delete t[n]:t[n]=!0,a.storage("mkfileHides",t),a.trigger("canMakeEmptyFile")}).append(n()),o=e("
                ").append(e('').on("keydown",function(t){t.keyCode===e.ui.keyCode.ENTER&&e(this).next().trigger("click")}),e('').html(a.i18n("add")).on("click",function(){var t,n=e(this).prev(),i=n.val(),o=a.getUI("toast"),r=function(){return o.appendTo(n.closest(".ui-dialog")),a.toast({msg:a.i18n("errUsupportType"),mode:"warning",onHidden:function(){1===o.children().length&&o.appendTo(a.getUI())}}),n.trigger("focus"),!1};if(!i.match(/\//)){if(i=a.arrayFlip(a.mimeTypes)[i],!i)return r();n.val(i)}return a.mimeIsText(i)&&a.mimeTypes[i]?(a.trigger("canMakeEmptyFile",{mimes:[i],unshift:!0}),t={},t[i]=a.mimeTypes[i],a.storage("mkfileTextMimes",Object.assign(t,a.storage("mkfileTextMimes")||{})),n.val(""),o.appendTo(n.closest(".ui-dialog")),void a.toast({msg:a.i18n(["complete",i+" ("+t[i]+")"]),onHidden:function(){1===o.children().length&&o.appendTo(a.getUI())}})):r()}),e('').html(a.i18n("reset")).on("click",function(){a.one("canMakeEmptyFile",{done:function(){i.empty().append(n())}}),a.trigger("canMakeEmptyFile",{resetTexts:!0})}));return a.bind("canMakeEmptyFile",{done:function(e){e.data&&e.data.mimes&&e.data.mimes.length&&i.empty().append(n())}}),e("
                ").append(i,o)}()),h.useStoredEditor&&(h.useStoredEditor=e('').prop("checked",function(){var e=a.storage("useStoredEditor");return e?e>0:a.options.commandsOptions.edit.useStoredEditor}()).on("change",function(t){a.storage("useStoredEditor",e(this).is(":checked")?1:-1)})),h.editorMaximized&&(h.editorMaximized=e('').prop("checked",function(){var e=a.storage("editorMaximized");return e?e>0:a.options.commandsOptions.edit.editorMaximized}()).on("change",function(t){a.storage("editorMaximized",e(this).is(":checked")?1:-1)})),h.useFullscreen&&(h.useFullscreen=e('').prop("checked",function(){var e=a.storage("useFullscreen");return e?e>0:"screen"===a.options.commandsOptions.fullscreen.mode}()).on("change",function(t){a.storage("useFullscreen",e(this).is(":checked")?1:-1)})),h.showHidden&&!function(){var t,n=function(){var n,i=a.storage("hide"),o=[];i&&i.items&&e.each(i.items,function(e,t){o.push(a.escape(t))}),r.prop("disabled",!o.length)[o.length?"removeClass":"addClass"]("ui-state-disabled"),n=o.length?o.join("\n"):"",h.showHidden.attr("title",n),t&&h.showHidden.tooltip("option","content",n.replace(/\n/g,"
                ")).tooltip("close")},i=e('').prop("checked",function(){var e=a.storage("hide");return e&&e.show}()).on("change",function(t){var n={};n[e(this).is(":checked")?"show":"hide"]=!0,a.exec("hide",void 0,n)}),o=e('').append(a.i18n("reset")).on("click",function(){a.exec("hide",void 0,{reset:!0}),e(this).parent().find("input:first").prop("checked",!1),n()}),r=e().add(i).add(o);h.showHidden=e("
                ").append(i,o),a.bind("hide",function(e){var t=e.data;t.opts&&(t.opts.show||t.opts.hide)||n()}),a.UA.Mobile&&e.fn.tooltip&&(t=!0,h.showHidden.tooltip({classes:{"ui-tooltip":"elfinder-ui-tooltip ui-widget-shadow"},tooltipClass:"elfinder-ui-tooltip ui-widget-shadow",track:!0}).css("user-select","none"),o.css("user-select","none")),n()}(),h.infoItems&&(h.infoItems=function(){var t=a.getCommand("info").items,n=[],i=a.storage("infohides")||a.arrayFlip(a.options.commandsOptions.info.hideItems,!0);return e.each(t,function(){var e=this,t=a.i18n(e);n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("infohides",i),a.trigger("infopref",{repaint:!0})})}()),h.hashChecker&&a.hashCheckers.length&&(h.hashChecker=function(){var t=[],n=a.arrayFlip(a.storage("hashchekcer")||a.options.commandsOptions.info.showHashAlgorisms,!0);return e.each(a.hashCheckers,function(){var e=this,i=a.i18n(e);t.push('")}),e(t.join(" ")).on("change","input",function(){var t=e(this).val(),i=e(this).is(":checked");i?n[t]=!0:n[t]&&delete n[t],a.storage("hashchekcer",e.grep(a.hashCheckers,function(e){return n[e]}))})}()),h.autoFocusDialog&&(h.autoFocusDialog=e('').prop("checked",function(){var e=a.storage("autoFocusDialog");return e?e>0:a.options.uiOptions.dialog.focusOnMouseOver}()).on("change",function(t){a.storage("autoFocusDialog",e(this).is(":checked")?1:-1)})),h.clearBrowserData&&(h.clearBrowserData=e("").text(a.i18n("reset")).button().on("click",function(t){t.preventDefault(),a.storage(),e("#"+a.id).elfinder("reload")})),e.each(u,function(t,i){var s,d;i===!0?d=1:i&&(s=e(),e.each(i,function(t,n){var i,o,r,l="";(i=h[n])&&(d=2,o=a.i18n(n),r=e(i).filter('input[type="checkbox"]'),r.length||(r=e(i).find('input[type="checkbox"]')),1===r.length?(r.attr("id")||r.attr("id","elfinder-preference-"+n+"-checkbox"),o='"):r.length>1&&(l=" elfinder-preference-checkboxes"),s=s.add(e('
                '+o+"
                ")).add(e('
                ').append(i)))})),d&&(l.append(r[o](/\{id\}/g,t)[o](/\{title\}/,a.i18n(t))[o](/\{class\}/,n===t?"elfinder-focus":"")),2===d&&c.append(e('
                ').hide().append(e("
                ").append(s))))}),l.on("click","a",function(t){var n=e(t.target),i=n.attr("href");t.preventDefault(),t.stopPropagation(),l.children().removeClass(p),n.removeClass("ui-state-hover").parent().addClass(p),i.match(/all$/)?c.addClass("elfinder-preference-taball").children().show():(c.removeClass("elfinder-preference-taball").children().hide(),e(i).show())}).on("focus blur","a",function(t){e(this).parent().toggleClass("ui-state-focus","focusin"===t.type)}).on("mouseenter mouseleave","li",function(t){e(this).toggleClass("ui-state-hover","mouseenter"===t.type)}),c.find("a,input,select,button").addClass("elfinder-tabstop"),s.append(l,c),t=i.fmDialog(s,{title:i.title,width:i.options.width||600,height:i.options.height||400,maxWidth:"window",maxHeight:"window",autoOpen:!1,destroyOnClose:!1,allowMinimize:!1,open:function(){n&&d(n),n=null},resize:function(){c.height(t.height()-l.outerHeight(!0)-(c.outerHeight(!0)-c.height())-5)}}).on("click",function(e){e.stopPropagation()}).css({overflow:"hidden"}),t.closest(".ui-dialog").css({overflow:"hidden"}).addClass("elfinder-bg-translucent"),n="all"};this.shortcuts=[{pattern:"ctrl+comma",description:this.title}],this.alwaysEnabled=!0,this.getstate=function(){return 0},this.exec=function(n,i){return!t&&u(),i&&(i.tab?d(i.tab):"cwd"===i._currentType&&d("workspace")),t.elfinderdialog("open"),e.Deferred().resolve()}},(i.prototype.commands.quicklook=function(){var t,n,i,a,o,r,s,l,c,d,p=this,u=p.fm,h=0,f=1,m=2,g=3,v=4,b=h,y=Element.update?"quicklookupdate":"update",w="elfinder-quicklook-navbar-icon",x="elfinder-quicklook-fullscreen",k="elfinder-quicklook-info-wrapper",C=function(t){e(document).trigger(e.Event("keydown",{keyCode:t,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))},z=function(e){var t=u.getUI().offset(),n=function(){var t=e.find(".elfinder-cwd-file-wrapper");return t.length?t:e}(),i=n.offset()||{top:0,left:0};return{opacity:0,width:n.width(),height:n.height()-30,top:i.top-t.top,left:i.left-t.left}},T=function(){var i=p.options.contain||u.options.dialogContained,a=i?u.getUI():e(window),o=u.getUI().offset(),r=Math.min(t,a.width()-10),s=Math.min(n,a.height()-80);return{opacity:1,width:r,height:s,top:parseInt((a.height()-s-60)/2+(i?0:a.scrollTop()-o.top)),left:parseInt((a.width()-r)/2+(i?0:a.scrollLeft()-o.left))}},A={},j=function(e,t){var n=t||e.substr(0,e.indexOf("/")),i=A[n]?A[n]:A[n]=document.createElement(n),a=!1;try{a=i.canPlayType&&i.canPlayType(e)}catch(o){}return!(!a||""===a||"no"==a)},S=window.navigator.platform.indexOf("Win")!=-1,O=!1,I=!1,M=!1,F=null,E=e.ui.keyCode.LEFT,D=e.ui.keyCode.RIGHT,U="mousemove touchstart "+("onwheel"in document?"wheel":"onmousewheel"in document?"mousewheel":"DOMMouseScroll"),P=e(''),q=e("
                "),R=e('
                '),H=e('
                '),_=e('
                ').on("click touchstart",function(t){if(!M){var n=p.window,i=n.hasClass(x),o=e(window),r=function(){p.preview.trigger("changesize")};t.stopPropagation(),t.preventDefault(),i?(G="",L(),n.toggleClass(x).css(n.data("position")),o.trigger(p.resize).off(p.resize,r),V.off("mouseenter mouseleave"),H.off(U)):(n.toggleClass(x).data("position",{left:n.css("left"),top:n.css("top"),width:n.width(),height:n.height(),display:"block"}).removeAttr("style"),e(window).on(p.resize,r).trigger(p.resize),H.on(U,function(e){I||("mousemove"!==e.type&&"touchstart"!==e.type||(L(),F=setTimeout(function(){(u.UA.Mobile||V.parent().find(".elfinder-quicklook-navbar:hover").length<1)&&V.fadeOut("slow",function(){H.show()})},3e3)),H.is(":visible")&&(W(),H.data("tm",setTimeout(function(){H.show()},3e3))))}).show().trigger("mousemove"),V.on("mouseenter mouseleave",function(e){I||("mouseenter"===e.type?L():H.trigger("mousemove"))})),u.zIndex&&n.css("z-index",u.zIndex+1),u.UA.Mobile?V.attr("style",G):V.attr("style",G).draggable(i?"destroy":{start:function(){I=!0,M=!0,H.show(),L()},stop:function(){I=!1,G=p.navbar.attr("style"),requestAnimationFrame(function(){M=!1})}}),e(this).toggleClass(w+"-fullscreen-off");var s=n;a.is(".ui-resizable")&&(s=s.add(a)),s.resizable(i?"enable":"disable").removeClass("ui-state-disabled"),n.trigger("viewchange")}}),N=function(){p.update(void 0,function(){var t=p.fm,n=t.selectedFiles(),i=n.length,a=(p.docked(),function(){var a=0;return e.each(n,function(e,t){var n=parseInt(t.ts);a>=0?n>a&&(a=n):a="unknown"}),{hash:n[0].hash+"/"+ +new Date,name:t.i18n("items")+": "+i,mime:"group",size:J,ts:a,files:e.map(n,function(e){return e.hash}),getSize:!0}});return i||(i=1,n=[t.cwd()]),1===i?n[0]:a()}())},L=function(){p.window.hasClass(x)&&(F&&clearTimeout(F),F=null,V.stop(!0,!0).css("display","block"),W())},W=function(){H.data("tm")&&clearTimeout(H.data("tm")),H.removeData("tm"),H.hide()},B=e('
                ').on("click touchstart",function(e){return!M&&C(E),!1}),$=e('
                ').on("click touchstart",function(e){return!M&&C(D),!1}),V=e('
                ').append(B).append(_).append($).append('
                ').append(e('
                ').on("click touchstart",function(e){return!M&&p.window.trigger("close"),!1})),K=e('').on("mousedown",function(e){e.stopPropagation(),p.window.trigger("close")}),X=e('').on("mousedown",function(e){e.stopPropagation(),p.docked()?p.window.trigger("navdockout"):p.window.trigger("navdockin")}),J=''+u.i18n("calc")+'',G="",Y=!0;this.flags={},this.cover=H,this.evUpdate=y,(this.navbar=V)._show=L,this.resize="resize."+u.namespace,this.info=e("
                ").addClass(k).append(q).append(R),this.autoPlay=function(){return!!p.opened()&&!!p.options[p.docked()?"dockAutoplay":"autoplay"]},this.preview=e('
                ').on("change",function(){L(),V.attr("style",G),p.docked()&&V.hide(),p.preview.attr("style","").removeClass("elfinder-overflow-auto"),p.info.attr("style","").hide(),p.cover.removeClass("elfinder-quicklook-coverbg"),q.removeAttr("class").attr("style",""),R.html("")}).on(y,function(t){var n,i,a=(p.preview,t.file),r='
                {value}
                ',s=function(){var s=p.window.css("overflow","hidden");i=u.escape(a.i18||a.name),!a.read&&t.stopImmediatePropagation(),p.window.data("hash",a.hash),p.preview.off("changesize").trigger("change").children().remove(),P.html(i),B.css("visibility",""),$.css("visibility",""),a.hash===u.cwdId2Hash(o.find("[id]:not(.elfinder-cwd-parent):first").attr("id"))&&B.css("visibility","hidden"),a.hash===u.cwdId2Hash(o.find("[id]:last").attr("id"))&&$.css("visibility","hidden"),"directory"===a.mime?c=[a.hash]:"group"===a.mime&&a.getSize&&(c=a.files),R.html(r.replace(/\{value\}/,i)+r.replace(/\{value\}/,u.mime2kind(a))+r.replace(/\{value\}/,c.length?J:u.formatSize(a.size))+r.replace(/\{value\}/,u.i18n("modify")+": "+u.formatDate(a))),c.length&&(l=u.getSize(c).done(function(e){R.find("span.elfinder-spinner").parent().html(e.formated)}).fail(function(){R.find("span.elfinder-spinner").parent().html(u.i18n("unknown"))}).always(function(){l=null}),l._hash=a.hash),q.addClass("elfinder-cwd-icon ui-corner-all "+u.mime2class(a.mime)),a.icon&&q.css(u.getIconStyle(a,!0)),p.info.attr("class",k),a.csscls&&p.info.addClass(a.csscls),a.read&&(n=u.tmb(a))&&e("").hide().appendTo(p.preview).on("load",function(){q.addClass(n.className).css("background-image","url('"+n.url+"')"),e(this).remove()}).attr("src",n.url),p.info.delay(100).fadeIn(10),p.window.hasClass(x)&&H.trigger("mousemove"),s.css("overflow","")},c=[];a&&!Object.keys(a).length&&(a=u.cwd()),a&&l&&"pending"===l.state()&&l._hash!==a.hash&&l.reject(),a&&(t.forceUpdate||p.window.data("hash")!==a.hash)?s():t.stopImmediatePropagation()}),this.window=e('
                ').hide().addClass(u.UA.Touch?"elfinder-touch":"").on("click",function(e){var t=this;e.stopPropagation(),b===m&&requestAnimationFrame(function(){b===m&&u.toFront(t)})}).append(e('
                ').append(e('').append(K,X),P),this.preview,p.info.hide(),H.hide(),V).draggable({handle:"div.elfinder-quicklook-titlebar"}).on("open",function(e,t){var n=p.window,i=p.value,a=u.getUI("cwd"),o=function(e){b=e,p.update(1,p.value),p.change(),n.trigger("resize."+u.namespace)};Y||b!==h?b===v&&(u.getUI("navdock").data("addNode")(c),o(g),p.preview.trigger("changesize"),u.storage("previewDocked","1"),0===u.getUI("navdock").width()&&n.trigger("navdockout")):(i&&i.hash!==r&&(a=u.cwdHash2Elm(i.hash.split("/",2)[0])),G="",V.attr("style",""),b=f,a.trigger("scrolltoview"),W(),n.css(t||z(a)).show().animate(T(),550,function(){o(m),L()}),u.toFront(n))}).on("close",function(e,t){var n,i=p.window,a=p.preview.trigger("change"),r=(p.value,(i.data("hash")||"").split("/",2)[0]),s=function(e,n){b=e,n&&u.toHide(i),a.children().remove(),p.update(0,p.value),i.data("hash",""),t&&t.resolve()};p.opened()&&(l&&"pending"===l.state()&&l.reject(),p.docked()?(c=u.getUI("navdock").data("removeNode")(p.window.attr("id"),"detach"),s(v),u.storage("previewDocked","2")):(b=f,i.hasClass(x)&&_.click(),r&&(n=o.find("#"+r)).length?i.animate(z(n),500,function(){a.off("changesize"),s(h,!0)}):s(h,!0)))}).on("navdockin",function(e,t){var n=p.window,a=u.getUI("navdock"),o=s||a.width(),r=t||{};Y&&(r.init=!0),b=g,i=n.attr("style"),n.toggleClass("ui-front").removeClass("ui-widget").draggable("disable").resizable("disable").removeAttr("style").css({width:"100%",height:o,boxSizing:"border-box",paddingBottom:0,zIndex:"unset"}),V.hide(),X.toggleClass("ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize"),u.toHide(n,!0),a.data("addNode")(n,r),p.preview.trigger("changesize"),u.storage("previewDocked","1")}).on("navdockout",function(t){var n=p.window,a=u.getUI("navdock"),o=(e.Deferred(),z(p.preview));s=n.outerHeight(),a.data("removeNode")(n.attr("id"),u.getUI()),n.toggleClass("ui-front").addClass("ui-widget").draggable("enable").resizable("enable").attr("style",i),X.toggleClass("ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize"),b=h,n.trigger("open",o),u.storage("previewDocked","0")}).on("resize."+u.namespace,function(){p.preview.trigger("changesize")}),this.alwaysEnabled=!0,this.value=null,this.handlers={select:function(e,t){d&&cancelAnimationFrame(d),e.data&&e.data.selected&&e.data.selected.length?p.opened()&&N():d=requestAnimationFrame(function(){p.opened()&&N()})},error:function(){p.window.is(":visible")&&p.window.trigger("close")},"searchshow searchhide":function(){this.opened()&&this.window.trigger("close")},navbarshow:function(){requestAnimationFrame(function(){p.docked()&&p.preview.trigger("changesize")})},destroy:function(){p.window.remove()}},this.shortcuts=[{pattern:"space"}],this.support={audio:{ogg:j("audio/ogg;"),webm:j("audio/webm;"),mp3:j("audio/mpeg;"),wav:j("audio/wav;"),m4a:j("audio/mp4;")||j("audio/x-m4a;")||j("audio/aac;"),flac:j("audio/flac;"),amr:j("audio/amr;")},video:{ogg:j("video/ogg;"),webm:j("video/webm;"),mp4:j("video/mp4;"),mkv:j("video/x-matroska;")||j("video/webm;"),"3gp":j("video/3gpp;")||j("video/mp4;"),m3u8:j("application/x-mpegURL","video")||j("application/vnd.apple.mpegURL","video"),mpd:j("application/dash+xml","video")}},A={},this.closed=function(){return b==h||b==v},this.opened=function(){return b==m||b==g},this.docked=function(){return b==g},this.addIntegration=function(e){requestAnimationFrame(function(){u.trigger("helpIntegration",Object.assign({cmd:"quicklook"},e))})},this.init=function(){var i,l=this.options,c=this.window,d=this.preview;t=l.width>0?parseInt(l.width):450,n=l.height>0?parseInt(l.height):300,"auto"!==l.dockHeight&&(s=parseInt(l.dockHeight),s||(s=void 0)),u.one("load",function(){O=u.getUI("navdock").data("dockEnabled"),!O&&X.hide(),a=u.getUI(),o=u.getUI("cwd"),u.zIndex&&c.css("z-index",u.zIndex+1),c.appendTo(a),e(document).on("keydown."+u.namespace,function(t){t.keyCode==e.ui.keyCode.ESCAPE&&p.opened()&&!p.docked()&&c.hasClass("elfinder-frontmost")&&c.trigger("close")}),c.resizable({handles:"se",minWidth:350,minHeight:120,resize:function(){d.trigger("changesize")}}),p.change(function(){p.opened()&&p.value&&(p.value.tmb&&1==p.value.tmb&&(p.value=Object.assign({},u.file(p.value.hash))),d.trigger(e.Event(y,{file:p.value})))}),d.on(y,function(e){var t,n,a;if(t=e.file){if(n=t.hash,a=u.searchStatus.mixed&&u.searchStatus.state>1,"directory"!==t.mime)if(parseInt(t.size)||t.mime.match(l.mimeRegexNotEmptyCheck)){if(p.dispInlineRegex=i,a||u.optionsByHashes[n])try{p.dispInlineRegex=new RegExp(u.option("dispInlineRegex",n),"i")}catch(e){try{p.dispInlineRegex=new RegExp(u.isRoot(t)?u.options.dispInlineRegex:u.option("dispInlineRegex",t.phash),"i")}catch(e){p.dispInlineRegex=/^$/}}}else e.stopImmediatePropagation();else p.dispInlineRegex=/^$/;p.info.show()}else e.stopImmediatePropagation()}),e.each(u.commands.quicklook.plugins||[],function(e,t){"function"==typeof t&&new t(p)})}).one("open",function(){var e,t=Number(u.storage("previewDocked")||l.docked);O&&t>=1&&(e=p.window,p.exec(),e.trigger("navdockin",{init:!0}),2===t?e.trigger("close"):(p.update(void 0,u.cwd()),p.change())),Y=!1}).bind("open",function(){r=u.cwd().hash,p.value=u.cwd();try{i=new RegExp(u.option("dispInlineRegex"),"i")}catch(e){i=/^$/}}).bind("change",function(t){t.data&&t.data.changed&&p.opened()&&e.each(t.data.changed,function(){if(p.window.data("hash")===this.hash)return p.window.data("hash",null),p.preview.trigger(y),!1})}).bind("navdockresizestart navdockresizestop",function(e){H["navdockresizestart"===e.type?"show":"hide"]()})},this.getstate=function(){return p.opened()?1:0},this.exec=function(){return p.closed()&&N(),p.enabled()&&p.window.trigger(p.opened()?"close":"open"),e.Deferred().resolve()},this.hideinfo=function(){this.info.stop(!0,!0).hide()}}).prototype={forceLoad:!0},i.prototype.commands.quicklook.plugins=[function(t){var n,i,a=["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],o=t.fm.returnBytes(t.options.getDimThreshold||0),r=t.preview;n=new Image,n.onload=n.onerror=function(){2==n.height&&a.push("image/webp")},n.src="data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA",e.each(navigator.mimeTypes,function(t,n){var i=n.type;0===i.indexOf("image/")&&e.inArray(i,a)&&a.push(i)}),r.on(t.evUpdate,function(n){var s,l,c,d,p=t.fm,u=n.file,h=!1,f=null,m=function(e){var t=p.file(u.hash);t.width=e[0],t.height=e[1]},g=function(){var e,t,n,i,a;f&&f.state&&"pending"===f.state()&&f.reject(),h||(h=!0,e=s.get(0),t=u.width&&u.height?{w:u.width,h:u.height}:e.naturalWidth?null:{w:s.width(),h:s.height()},t&&s.removeAttr("width").removeAttr("height"),n=u.width||e.naturalWidth||e.width||s.width(),i=u.height||e.naturalHeight||e.height||s.height(),u.width&&u.height||m([n,i]),t&&s.width(t.w).height(t.h),a=(n/i).toFixed(2),r.on("changesize",function(){var e,t,n=parseInt(r.width()),i=parseInt(r.height());a<(n/i).toFixed(2)?(t=i,e=Math.floor(t*a)):(e=n,t=Math.floor(e/a)),s.width(e).height(t).css("margin-top",t'+p.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
              ').appendTo(l),s=e("").hide().appendTo(r).on("load",function(){v(),g()}).on("error",function(){l.remove()}),d=p.openUrl(u.hash,!1,function(e){s.attr("src",e)},{progressBar:c}),r.one("change",function(){d&&d.state&&"pending"===d.state()&&d.reject()}),u.width&&u.height?g():u.size>o&&(f=p.request({data:{cmd:"dim",target:u.hash},preventDefault:!0}).done(function(e){if(e.dim){var t=e.dim.split("x");u.width=t[0],u.height=t[1],m(t),g()}})))})},function(t){var n=t.fm,i="image/tiff",a=t.preview;window.Worker&&window.Uint8Array&&a.on(t.evUpdate,function(o){var r,s,l,c,d,p=o.file,u=function(e){c&&c.terminate(),r.remove(),n.debug("error",e)},h=function(e){var t=n.file(p.hash);t.width=e[0],t.height=e[1]};p.mime===i&&(o.stopImmediatePropagation(),r=e('
              '+n.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
              ').appendTo(r),a.one("change",function(){c&&c.terminate(),r.remove()}),d=n.getContents(p.hash,"arraybuffer",{progressBar:s}).done(function(i){if(i){l=e("
              ").css({width:"100%",height:"100%"}).hide().appendTo(a);try{c=n.getWorker(),c.onmessage=function(n){var i,o,s,d,u=n.data;c&&c.terminate(),i=document.createElement("canvas"),o=i.getContext("2d"),i.width=u.width,i.height=u.height,s=o.createImageData(u.width,u.height),s.data.set(new Uint8Array(u.image)),o.putImageData(s,0,0),l.append(i).show(),r.remove(),d=(u.width/u.height).toFixed(2), +a.on("changesize",function(){var t,n,o=parseInt(a.width()),r=parseInt(a.height());d<(o/r).toFixed(2)?(n=r,t=Math.floor(n*d)):(t=o,n=Math.floor(t/d)),e(i).width(t).height(n).css("margin-top",n'+i.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),d=e('
              ').appendTo(c),h=i.openUrl(f.hash,"sameorigin",function(t){t&&(l=e("").hide().appendTo(o),n?r(t,l,c):(p=window.define,u=window.require,window.require=null,window.define=null,i.loadScript([i.options.cdns.psd],function(){n=require("psd"),p?window.define=p:delete window.define,u?window.require=u:delete window.require,r(t,l,c)})))},{progressBar:d}),o.one("change",function(){h&&h.state&&"pending"===h.state()&&h.reject()}))})},function(t){var n=t.fm,i=n.arrayFlip(["text/html","application/xhtml+xml"]),a=t.preview;a.on(t.evUpdate,function(o){var r,s,l,c=o.file;i[c.mime]&&t.dispInlineRegex.test(c.mime)&&(!t.options.getSizeMax||c.size<=t.options.getSizeMax)&&(o.stopImmediatePropagation(),s=e('
              '+n.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),l=e('
              ').appendTo(s),a.one("change",function(){"pending"==r.state()&&r.reject()}).addClass("elfinder-overflow-auto"),r=n.request({data:{cmd:"get",target:c.hash,conv:1,_t:c.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:l}).done(function(n){t.hideinfo();var i=e('').appendTo(a)[0].contentWindow.document;i.open(),i.write(n.content),i.close()}).always(function(){s.remove()}))})},function(t){var n=t.fm,i=n.arrayFlip(["text/x-markdown"]),a=t.preview,o=null,r=function(n,i){t.hideinfo();var r=e('').appendTo(a)[0].contentWindow.document;r.open(),r.write((o.parse||o)(n.content)),r.close(),i.remove()},s=function(e){o=!1,e.remove()};a.on(t.evUpdate,function(l){var c,d,p,u=l.file;i[u.mime]&&n.options.cdns.marked&&o!==!1&&t.dispInlineRegex.test(u.mime)&&(!t.options.getSizeMax||u.size<=t.options.getSizeMax)&&(l.stopImmediatePropagation(),d=e('
              '+n.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
              ').appendTo(d),a.one("change",function(){"pending"==c.state()&&c.reject()}).addClass("elfinder-overflow-auto"),c=n.request({data:{cmd:"get",target:u.hash,conv:1,_t:u.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:p}).done(function(e){o||window.marked?(o||(o=window.marked),r(e,d)):n.loadScript([n.options.cdns.marked],function(t){o=t||window.marked||!1,delete window.marked,o?r(e,d):s(d)},{tryRequire:!0,error:function(){s(d)}})}).fail(function(){s(d)}))})},function(t){if(t.options.viewerjs){var n=t.fm,i=t.preview,a=t.options.viewerjs,o=a.url?n.arrayFlip(a.mimes||[]):[],r=t.window,s=t.navbar,l=function(){s.css("bottom",r.hasClass("elfinder-quicklook-fullscreen")?"30px":"")};a.url&&i.on("update",function(s){var c,d,p,u,h=s.file;!o[h.mime]||"application/pdf"===h.mime&&a.pdfNative&&t.flags.pdfNative||(s.stopImmediatePropagation(),d=e('
              '+n.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
              ').appendTo(d),u=n.openUrl(h.hash,"sameorigin",function(n){n&&(c=e('').css("background-color","transparent").on("load",function(){t.hideinfo(),d.remove(),c.css("background-color","#fff")}).on("error",function(){d.remove(),c.remove()}).appendTo(i).attr("src",a.url+"#"+n),r.on("viewchange.viewerjs",l),l(),i.one("change",function(){r.off("viewchange.viewerjs"),d.remove(),c.off("load").remove()}))},{progressBar:p}),i.one("change",function(){u&&u.state&&"pending"===u.state()&&u.reject()}))})}},function(t){var n=t.fm,i="application/pdf",a=t.preview,o=!1,r="";n.UA.Safari&&"mac"===n.OS&&!n.UA.iOS||n.UA.IE||n.UA.Firefox?o=!0:e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){if(t.type===i)return!(o=!0)})}),t.flags.pdfNative=o,o&&("undefined"==typeof t.options.pdfToolbar||t.options.pdfToolbar||(r="#toolbar=0"),a.on(t.evUpdate,function(s){var l,c=s.file;o&&c.mime===i&&t.dispInlineRegex.test(c.mime)&&(s.stopImmediatePropagation(),l=n.openUrl(c.hash,!1,function(i){i&&(t.hideinfo(),t.cover.addClass("elfinder-quicklook-coverbg"),e('').on("error",function(e){o=!1,t.update(void 0,n.cwd()),t.update(void 0,c)}).appendTo(a))}),a.one("change",function(){l&&l.state&&"pending"===l.state()&&l.reject()}))}))},function(t){var n=t.fm,i="application/x-shockwave-flash",a=t.preview,o=!1;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){if(t.type===i)return!(o=!0)})}),o&&a.on(t.evUpdate,function(o){var r,s,l=o.file;l.mime===i&&t.dispInlineRegex.test(l.mime)&&(o.stopImmediatePropagation(),s=n.openUrl(l.hash,!1,function(n){n&&(t.hideinfo(),r=e('').appendTo(a))}),a.one("change",function(){s&&s.state&&"pending"===s.state()&&s.reject()}))})},function(t){var n,i,a,o,r,s,l=t.fm,c=t.preview,d={"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","audio/webm":"webm","audio/flac":"flac","audio/x-flac":"flac","audio/amr":"amr"},p=t.window,u=t.navbar,h="string"==typeof t.options.mediaControlsList&&t.options.mediaControlsList?' controlsList="'+l.escape(t.options.mediaControlsList)+'"':"",f=function(){u.css("bottom",p.hasClass("elfinder-quicklook-fullscreen")?"50px":"")},m=function(t,i){return e('').on("change",function(e){e.stopPropagation()}).on("error",function(e){n&&n.data("hash")===i&&b()}).data("hash",i).appendTo(c)},g=function(t){var n,i=e.Deferred(),o=e.Deferred().done(function(){var e;e=l.getContents(t,"arraybuffer",{progressBar:s}).done(function(e){try{var t=a.toWAV(new Uint8Array(e));t?i.resolve(URL.createObjectURL(new Blob([t],{type:"audio/x-wav"}))):i.reject()}catch(n){i.reject()}}).fail(function(){i.reject()}),c.one("change",function(){e&&e.state&&"pending"===e.state()&&e.reject()})}).fail(function(){a=!1,i.reject()});return window.TextEncoder&&window.URL&&URL.createObjectURL&&"undefined"==typeof a?(n=window.AMR,delete window.AMR,l.loadScript([l.options.cdns.amr],function(){a=!!window.AMR&&window.AMR,window.AMR=n,o[a?"resolve":"reject"]()},{error:function(){o.reject()}})):o[a?"resolve":"reject"](),i},v=function(e){var t,i=n.data("hash");o&&(t=e.play()),t&&t["catch"]&&t["catch"](function(t){e.paused||n&&n.data("hash")===i&&b()})},b=function(){if(n&&n.parent().length){var e=n[0],t=n.children("source").attr("src");p.off("viewchange.audio");try{e.pause(),n.empty(),t.match(/^blob:/)&&URL.revokeObjectURL(t),e.src="",e.load()}catch(i){}n.remove(),n=null}};c.on(t.evUpdate,function(u){var h,b,y=u.file,w=d[y.mime];d[y.mime]&&t.dispInlineRegex.test(y.mime)&&((h=t.support.audio[w])||"amr"===w)&&(o=t.autoPlay(),i=y.hash,h?(u.stopImmediatePropagation(),r=e('
              '+l.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
              ').appendTo(r),b=l.openUrl(i,!1,function(e){r.remove(),e?(n=m(e,i),v(n[0]),p.on("viewchange.audio",f),f()):n.remove()},{progressBar:s}),c.one("change",function(){b&&b.state&&"pending"===b.state()&&b.reject()})):l.options.cdns.amr&&"amr"===w&&a!==!1&&(u.stopImmediatePropagation(),r=e('
              '+l.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
              ').appendTo(r),n=m("",i),g(y.hash).done(function(e){if(r.remove(),i===y.hash){var t=n[0];try{n.children("source").attr("src",e),t.pause(),t.load(),v(t),p.on("viewchange.audio",f),f()}catch(a){URL.revokeObjectURL(e),n.remove()}}else URL.revokeObjectURL(e)}).fail(function(){n.remove()})))}).one("change",b)},function(t){var n,i,a,o,r,s,l,c,d,p,u=t.fm,h=t.preview,f={"video/mp4":"mp4","video/x-m4v":"mp4","video/quicktime":"mp4","video/mpeg":"mpeg","video/ogg":"ogg","application/ogg":"ogg","video/webm":"webm","video/x-matroska":"mkv","video/3gpp":"3gp","application/vnd.apple.mpegurl":"m3u8","application/x-mpegurl":"m3u8","application/dash+xml":"mpd","video/x-flv":"flv","video/x-msvideo":"avi"},m=t.window,g=t.navbar,v="string"==typeof t.options.mediaControlsList&&t.options.mediaControlsList?' controlsList="'+u.escape(t.options.mediaControlsList)+'"':"",b=function(){u.UA.iOS?m.hasClass("elfinder-quicklook-fullscreen")?(h.css("height","-webkit-calc(100% - 50px)"),g._show()):h.css("height",""):g.css("bottom",m.hasClass("elfinder-quicklook-fullscreen")?"50px":"")},y=function(i,a){var r,s=function(e){l>1&&(c&&clearTimeout(c),c=setTimeout(function(){!r&&T(!0)},800))},l=0;o=null,a=a||{},t.hideinfo(),n=e('').on("change",function(e){e.stopPropagation()}).on("timeupdate progress",s).on("canplay",function(){r=!0}).data("hash",i.hash),n[0].addEventListener("error",function(e){a.src&&u.convAbsUrl(a.src)===u.convAbsUrl(e.target.src)&&(++l,s())},!0),a.src&&n.append(''),n.appendTo(h),m.on("viewchange.video",b),b()},w=function(e){var t,a;a=u.openUrl(e.hash,!1,function(a){d.remove(),a&&(y(e),t=new i,t.loadSource(a),t.attachMedia(n[0]),l&&t.on(i.Events.MANIFEST_PARSED,function(){z(n[0])}))},{progressBar:p}),h.one("change",function(){a&&a.state&&"pending"===a.state()&&a.reject()})},x=function(e){var t;t=u.openUrl(e.hash,!1,function(t){var i;d.remove(),t&&(y(e),o=window.dashjs.MediaPlayer().create(),i=o.getDebug(),i.setLogLevel?i.setLogLevel(dashjs.Debug.LOG_LEVEL_FATAL):i.setLogToBrowserConsole&&i.setLogToBrowserConsole(!1),o.initialize(n[0],t,l),o.on("error",function(e){T(!0)}))},{progressBar:p}),h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})},k=function(e){var t;return r.isSupported()?(t=u.openUrl(e.hash,!1,function(t){if(d.remove(),t){var i=r.createPlayer({type:"flv",url:t});y(e),i.on(r.Events.ERROR,function(){i.destroy(),T(!0)}),i.attachMediaElement(n[0]),i.load(),z(i)}},{progressBar:p}),void h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})):void(r=!1)},C=function(e){var t;t=u.openUrl(e.hash,!1,function(t){d.remove(),t&&(y(e),n[0].src=t,s(n[0],{src:t}))},{progressBar:p}),h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})},z=function(e){var t,i=n.data("hash");l&&(t=e.play()),t&&t["catch"]&&t["catch"](function(t){e.paused||n&&n.data("hash")===i&&T(!0)})},T=function(e){if(c&&clearTimeout(c),n&&n.parent().length){var i=n[0];m.off("viewchange.video"),o&&o.reset();try{i.pause(),n.empty(),i.src="",i.load()}catch(a){}n.remove(),n=null}e&&t.info.show()};h.on(t.evUpdate,function(o){var c,m,g=o.file,v=g.mime.toLowerCase(),b=f[v];f[v]&&t.dispInlineRegex.test(g.mime)&&(l=t.autoPlay(),d=e('
              '+u.i18n("nowLoading")+'
              '),p=e('
              ').appendTo(d),t.support.video[b]&&("m3u8"!==b||u.UA.Safari)?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),m=u.openUrl(g.hash,!1,function(e){d.remove(),e&&(y(g,{src:e}),z(n[0]))},{progressBar:p}),h.one("change",function(){m&&m.state&&"pending"===m.state()&&m.reject()})):i!==!1&&u.options.cdns.hls&&"m3u8"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),i?w(g):(c=window.Hls,delete window.Hls,u.loadScript([u.options.cdns.hls],function(e){i=e||window.Hls||!1,window.Hls=c,i&&w(g)},{tryRequire:!0,error:function(){i=!1}}))):a!==!1&&u.options.cdns.dash&&"mpd"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),a?x(g):u.loadScript([u.options.cdns.dash],function(){a=!!window.dashjs,a&&x(g)},{tryRequire:!0,error:function(){a=!1}})):r!==!1&&u.options.cdns.flv&&"flv"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),r?k(g):(c=window.flvjs,delete window.flvjs,u.loadScript([u.options.cdns.flv],function(e){r=e||window.flvjs||!1,window.flvjs=c,r&&k(g)},{tryRequire:!0,error:function(){r=!1}}))):u.options.cdns.videojs&&(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),s?C(g):u.loadScript([u.options.cdns.videojs+"/video.min.js"],function(e){s=e||window.videojs||!1,s&&C(g)},{tryRequire:!0,error:function(){s=!1}}).loadCss([u.options.cdns.videojs+"/video-js.min.css"])))}).one("change",T)},function(t){var n,i=t.preview,a=[],o=t.window,r=t.navbar;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)})}),a=t.fm.arrayFlip(a),i.on(t.evUpdate,function(s){var l,c,d,p,u=s.file,h=u.mime,f=function(){r.css("bottom",o.hasClass("elfinder-quicklook-fullscreen")?"50px":"")};a[u.mime]&&t.dispInlineRegex.test(u.mime)&&(s.stopImmediatePropagation(),d=e('
              '+fm.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
              ').appendTo(d),c=t.fm.openUrl(u.hash,!1,function(a){d.remove(),a&&((l=0===h.indexOf("video/"))&&t.hideinfo(),n=e('').appendTo(i),o.on("viewchange.embed",f),f())},{progressBar:p}),i.one("change",function(){c&&c.state&&"pending"===c.state()&&c.reject()}))}).one("change",function(){n&&n.parent().length&&(o.off("viewchange.embed"),n.remove(),n=null)})},function(t){var n=t.fm,i=n.arrayFlip(["application/zip","application/x-gzip","application/x-tar","application/x-bzip2"]),a=t.preview,o=n.returnBytes(t.options.unzipMaxSize||0),r=!(!n.options.cdns.zlibUnzip||!n.options.cdns.zlibGunzip),s=!!n.options.cdns.bzip2;window.Worker&&window.Uint8Array&&window.DataView&&a.on(t.evUpdate,function(l){var c=l.file,d="application/x-tar"===c.mime,p="application/x-bzip2"===c.mime,u="application/zip"===c.mime||"application/x-gzip"===c.mime;if(i[c.mime]&&(!o||c.size<=o)&&(d||p&&s||u&&r)){var h,f,m,g,v=function(){h=n.getContents(c.hash,"arraybuffer",{progressBar:g}).fail(function(){m.remove()}).done(function(e){var t=function(e){f&&f.terminate(),m.remove(),u?r=!1:p&&(s=!1),n.debug("error",e)};try{f=n.getWorker(),f.onmessage=function(e){f&&f.terminate(),m.remove(),!e.data||e.data.error?new Error(e.data&&e.data.error?e.data.error:""):b(e.data.files)},f.onerror=t,"application/x-tar"===c.mime?f.postMessage({scripts:[n.getWorkerUrl("quicklook.unzip.js")],data:{type:"tar",bin:e}}):"application/zip"===c.mime?f.postMessage({scripts:[n.options.cdns.zlibUnzip,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"zip",bin:e}}):"application/x-gzip"===c.mime?f.postMessage({scripts:[n.options.cdns.zlibGunzip,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"gzip",bin:e}}):"application/x-bzip2"===c.mime&&f.postMessage({scripts:[n.options.cdns.bzip2,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"bzip2",bin:e}})}catch(i){t(i)}})},b=function(i){var o,r,s,l=0;i&&i.length&&(i=e.map(i,function(e){return n.decodeRawString(e)}),i.sort(),r=n.escape(i.join("\n").replace(/\{formatSize\((\d+)\)\}/g,function(e,t){return l+=parseInt(t),n.formatSize(t)})),o=""+n.escape(c.mime)+" ("+n.formatSize(c.size)+" / "+n.formatSize(l)+")
              ",s=e('
              '+o+'
              '+r+"
              ").on("touchstart",function(t){e(this)["scroll"+("ltr"===n.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(a),t.hideinfo()),m.remove()};l.stopImmediatePropagation(),m=e('
              '+n.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),g=e('
              ').appendTo(m),a.one("change",function(){"pending"===h.state()&&h.reject(),f&&f.terminate(),m.remove()}),v()}})},function(t){var n,i=t.fm,a=i.arrayFlip(["application/x-rar"]),o=t.preview;window.DataView&&o.on(t.evUpdate,function(r){var s=r.file;if(a[s.mime]&&i.options.cdns.rar&&n!==!1){var l,c,d,p,u,h,f=function(a){if(p)return void l.remove();try{d=n({file:a,type:2,xhrHeaders:i.customHeaders,xhrFields:i.xhrFields},function(n){l.remove();var a,r,c=[];return p||n?void(n&&i.debug("error",n)):(e.each(d.entries,function(){c.push(this.path+(this.size?" ("+i.formatSize(this.size)+")":""))}),void(c.length&&(c=e.map(c,function(e){return i.decodeRawString(e)}),c.sort(),a=""+i.escape(s.mime)+" ("+i.formatSize(s.size)+")
              ",r=e('
              '+a+'
              '+i.escape(c.join("\n"))+"
              ").on("touchstart",function(t){e(this)["scroll"+("ltr"===i.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(o),t.hideinfo())))})}catch(r){l.remove()}},m=function(){n=!1,l.remove()};r.stopImmediatePropagation(),l=e('
              '+i.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
              ').appendTo(l),o.one("change",function(){d&&(d.abort=!0),l.remove(),p=!0}),h=i.openUrl(s.hash,"sameorigin",function(e){e&&(n?f(e):(window.RarArchive&&(u=window.RarArchive,delete window.RarArchive),i.loadScript([i.options.cdns.rar],function(){i.hasRequire?require(["rar"],function(t){n=t,f(e)},m):(n=window.RarArchive)?(u?window.RarArchive=u:delete window.RarArchive,f(e)):m()},{tryRequire:!0,error:m})))},{progressBar:c,temporary:!0}),o.one("change",function(){h&&h.state&&"pending"===h.state()&&h.reject()})}})},function(t){var n,i=t.fm,a=i.arrayFlip(t.options.sharecadMimes||[]),o=t.preview;t.window;t.options.sharecadMimes.length&&t.addIntegration({title:"ShareCAD.org CAD and 3D-Models viewer",link:"https://sharecad.org/DWGOnlinePlugin"}),o.on(t.evUpdate,function(r){var s=r.file;if(a[s.mime.toLowerCase()]&&i.option("onetimeUrl",s.hash)){var l,c,d;t.window;r.stopImmediatePropagation(),"1"==s.url&&(o.hide(),e('
              ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),i.request({data:{cmd:"url",target:s.hash},preventDefault:!0,progressBar:c}).always(function(){n.html("")}).done(function(e){var n=i.file(s.hash);s.url=n.url=e.url||"",s.url&&o.trigger({type:t.evUpdate,file:s,forceUpdate:!0})})})),""!==s.url&&"1"!=s.url&&(o.one("change",function(){l.remove(),n.off("load").remove(),n=null}).addClass("elfinder-overflow-auto"),l=e('
              '+i.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
              ').appendTo(l),d=i.convAbsUrl(i.url(s.hash)),n=e('').css("background-color","transparent").appendTo(o).on("load",function(){t.hideinfo(),l.remove(),t.preview.after(t.info),e(this).css("background-color","#fff").show()}).on("error",function(){l.remove(),t.preview.after(t.info)}).attr("src","//sharecad.org/cadframe/load?url="+encodeURIComponent(d)),t.info.after(t.preview))}})},function(t){var n,i,a,o,r,s=t.fm,l={"application/vnd.google-earth.kml+xml":!0,"application/vnd.google-earth.kmz":!0},c=t.preview;t.options.googleMapsApiKey&&(t.addIntegration({title:"Google Maps",link:"https://www.google.com/intl/"+s.lang.replace("_","-")+"/help/terms_maps.html"}),n=window.google&&google.maps,i=function(e,i,a){var r=t.options.googleMapsOpts.maps;s.forExternalUrl(e.hash,{progressBar:a}).done(function(e){if(e)try{new n.KmlLayer(e,Object.assign({map:new n.Map(i.get(0),r)},t.options.googleMapsOpts.kml)),t.hideinfo()}catch(a){o()}else o()})},a=window.gm_authFailure,o=function(){r=null},r="https://maps.googleapis.com/maps/api/js?key="+t.options.googleMapsApiKey,window.gm_authFailure=function(){o(),a&&a()},c.on(t.evUpdate,function(a){var o=a.file;if(r&&l[o.mime.toLowerCase()]){var d,p,u,h=(t.window,"1"==o.url&&!s.option("onetimeUrl",o.hash));a.stopImmediatePropagation(),d=e('
              '+s.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
              ').appendTo(d),h&&(c.hide(),e('
              ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),s.request({data:{cmd:"url",target:o.hash},preventDefault:!0,progressBar:p}).always(function(){d.remove(),n.html("")}).done(function(e){var n=s.file(o.hash);o.url=n.url=e.url||"",o.url&&c.trigger({type:t.evUpdate,file:o,forceUpdate:!0})})})),""===o.url||h||(u=e('
              ').appendTo(c),c.one("change",function(){u.remove(),u=null}),n?i(o,u,p):s.loadScript([r],function(){n=window.google&&google.maps,n&&i(o,u,p)}))}}))},function(t){var n,i,a=t.fm,o=Object.assign(a.arrayFlip(t.options.googleDocsMimes||[],"g"),a.arrayFlip(t.options.officeOnlineMimes||[],"m")),r=t.preview,s=(t.window,t.navbar),l={g:"docs.google.com/gview?embedded=true&url=",m:"view.officeapps.live.com/op/embed.aspx?wdStartOn=0&src="},c={g:"56px",m:"24px"},d={xls:5242880,xlsb:5242880,xlsx:5242880,xlsm:5242880,other:10485760};t.options.googleDocsMimes.length&&(i=!0,t.addIntegration({title:"Google Docs Viewer",link:"https://docs.google.com/"})),t.options.officeOnlineMimes.length&&(i=!0,t.addIntegration({title:"MS Online Doc Viewer",link:"https://products.office.com/office-online/view-office-documents-online"})),i&&r.on(t.evUpdate,function(i){var p,u,h=i.file;if(h.size<=26214400&&(p=o[h.mime])){var f,m,g,v=t.window,b=function(){s.css("bottom",v.hasClass("elfinder-quicklook-fullscreen")?c[p]:"")},y=a.mimeTypes[h.mime],w="1"==h.url&&!a.option("onetimeUrl",h.hash);"m"===p&&(d[y]&&h.size>d[y]||h.size>d.other)&&(p="g"),w&&(r.hide(),e('
              ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),a.request({data:{cmd:"url",target:h.hash},preventDefault:!0}).always(function(){n.html("")}).done(function(e){var n=a.file(h.hash);h.url=n.url=e.url||"",h.url&&r.trigger({type:t.evUpdate,file:h,forceUpdate:!0})})})),""===h.url||w||(i.stopImmediatePropagation(),r.one("change",function(){u&&u.status&&"pending"===u.status()&&u.reject(),v.off("viewchange.googledocs"),f.remove(),n.off("load").remove(),n=null}).addClass("elfinder-overflow-auto"),f=e('
              '+a.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),m=e('
              ').appendTo(f),n=e('').css("background-color","transparent").appendTo(r),u=a.forExternalUrl(h.hash,{progressBar:m}).done(function(i){var a=function(){try{!n||n.attr("src")&&!n.get(0).contentWindow.document||(n.attr("src","https://"+l[p]+encodeURIComponent(i)),g=setTimeout(a,2e3))}catch(e){}};i?(h.ts&&(i+=(i.match(/\?/)?"&":"?")+"_t="+h.ts),n.on("load",function(){g&&clearTimeout(g),t.hideinfo(),f.remove(),t.preview.after(t.info),e(this).css("background-color","#fff").show()}).on("error",function(){g&&clearTimeout(g),f.remove(),t.preview.after(t.info)}),a()):(f.remove(),n.remove())}),v.on("viewchange.googledocs",b),b(),t.info.after(t.preview))}})},function(t){"use strict";var n,i,a=t.fm,o=t.preview,r=parseInt(t.options.textInitialLines)||150,s=parseInt(t.options.prettifyMaxLines)||500,l=function(){c=function(){return!1},i&&(window.PR=i),n=!1},c=function(e){a.options.cdns.prettify?(c=function(e){return setTimeout(function(){p(e)},100),"pending"},window.PR&&(i=window.PR),a.loadScript([a.options.cdns.prettify+(a.options.cdns.prettify.match(/\?/)?"&":"?")+"autorun=false"],function(t){n=t||window.PR,"object"==typeof n?(c=function(){return!0},i?window.PR=i:delete window.PR,d(e)):l()},{tryRequire:!0,error:l})):l()},d=function(e){e&&!e.hasClass("prettyprinted")&&(e.css("cursor","wait"),requestAnimationFrame(function(){n.prettyPrint&&n.prettyPrint(null,e.get(0)),e.css("cursor","")}))},p=function(e){var t=c(e);t===!0&&d(e)};o.on(t.evUpdate,function(i){var l,c,d,u,h=i.file;h.mime;a.mimeIsText(h.mime)&&(!t.options.getSizeMax||h.size<=t.options.getSizeMax)&&n!==!1&&(i.stopImmediatePropagation(),c=e('
              '+a.i18n("nowLoading")+'
              ').appendTo(t.info.find(".elfinder-quicklook-info")),d=e('
              ').appendTo(c),o.one("change",function(){"pending"==l.state()&&l.reject(),u&&u.remove()}),l=a.request({data:{cmd:"get",target:h.hash,conv:h.encoding||1,_t:h.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:d}).done(function(n){var i,l,c,d,u,f=new RegExp("^(data:"+h.mime.replace(/([.+])/g,"\\$1")+";base64,)","i"),m=n.content;"string"==typeof m&&(t.hideinfo(),window.atob&&(u=m.match(f))&&(m=atob(m.substr(u[1].length))),d=m.match(/([^\r\n]{1,100}[\r\n]*)/g),l=d.length-r,l>10?i=d.splice(0,r).join(""):l=0,c=e('
              '),l&&c.append(e('

              '+a.i18n("linesLeft",a.toLocaleString(l))+"
              ").on("click",function(){var t=c.scrollTop();e(this).remove(),c.children("pre").removeClass("prettyprinted").text(m).scrollTop(t),d.length<=s&&p(c)})),c.children("pre").text(i||m),c.on("touchstart",function(t){e(this)["scroll"+("ltr"===a.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(o),n.toasts&&Array.isArray(n.toasts)&&e.each(n.toasts,function(){this.msg&&a.toast(this)}),p(c))}).always(function(n){var i,r,s;(i=a.getCommand("edit"))&&(s=[],n&&n.encoding&&s.push({value:n.encoding}),s.push({value:"UTF-8"}),r=i.getEncSelect(s),r.on("change",function(){h.encoding=r.val(),a.cache(h,"change"),o.trigger({type:t.evUpdate,file:h,forceUpdate:!0})}),u=e('
              ').append(r),t.window.append(u)),c.remove()}))})}],(i.prototype.commands.reload=function(){"use strict";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(){n="search"==this.type})},this.fm.bind("contextmenu",function(){var n=t.fm;n.options.sync>=1e3&&(t.extra={icon:"accept",node:e("").attr({title:n.i18n("autoSync")}).on("click touchstart",function(t){"touchstart"===t.type&&t.originalEvent.touches.length>1||(t.stopPropagation(),t.preventDefault(),e(this).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"))}).on("ready",function(){e(this).parent().toggleClass("ui-state-disabled",!n.options.syncStart).css("pointer-events","auto")})})}),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()}}).prototype={forceLoad:!0},i.prototype.commands.rename=function(){"use strict";this.alwaysEnabled=!0,this.syncTitleOnChange=!0;var t=this,n=t.fm,i=function(t,i,a,o){var r,s=i?[a.hash].concat(i):[a.hash],l=s.length,c={};if(n.lockfiles({files:s}),n.isRoot(a)&&!a.netkey){if((r=n.storage("rootNames"))||(r={}),""===o){if(!r[a.hash])return t&&t.reject(),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s});a.name=a._name,a.i18=a._i18,delete r[a.hash],delete a._name,delete a._i18}else"undefined"==typeof a._name&&(a._name=a.name,a._i18=a.i18),a.name=r[a.hash]=o,delete a.i18;return n.storage("rootNames",r),c={changed:[a]},n.updateCache(c),n.change(c),t&&t.resolve(c),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s})}c={cmd:"rename",name:o,target:a.hash},l>1&&(c.targets=i,o.match(/\*/)&&(c.q=o)),n.request({data:c,notify:{type:"rename",cnt:l},navigate:{}}).fail(function(e){var i=n.parseError(e);t&&t.reject(),i&&Array.isArray(i)&&"errRename"===i[0]||n.sync()}).done(function(i){var r;i.added&&i.added.length&&1===l&&(i.undo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:i.added[0].hash,name:a.name},notify:{type:"undo",cnt:1}})}},i.redo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:a.hash,name:o},notify:{type:"rename",cnt:1}})}}),t&&t.resolve(i), +(r=n.cwd().hash)&&r!==a.hash||n.exec("open",e.map(i.added,function(e){return"directory"===e.mime?e.hash:null})[0])}).always(function(){n.unlockfiles({files:s}).trigger("selectfiles",{files:s})})},a=function(e,t){var i,a,o,r=t||n.selected(),s=n.splitFileExtention(e),l=n.file(r[0]),c=n.file(r[1]);return i=s[1]?"."+s[1]:"",s[1]&&"*"===s[0]?(a='"'+n.splitFileExtention(l.name)[0]+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+i+'"'):s[0].length>1&&("*"===s[0].substr(-1)?(o=s[0].substr(0,s[0].length-1),a='"'+o+l.name+'", ',a+='"'+o+c.name+'"'):"*"===s[0].substr(0,1)&&(o=s[0].substr(1),a='"'+n.splitFileExtention(l.name)[0]+o+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+o+i+'"')),a||(a='"'+s[0]+"1"+i+'", "'+s[0]+"2"+i+'"'),r.length>2&&(a+=" ..."),a},o=function(){var o,r=n.selected(),s='',l=function(t,i){return e('").prepend(t)},c=e(''),d=e(s),p=e(s),u=e(s),h=e(s),f=e("
              ").append(l(d,"plusNumber"),l(p,"asPrefix"),l(u,"asSuffix"),l(h,"changeExtention")),m=e('
              '),g=e('
              ').append(e('
              ').append(c),e('
              ').append(f),m),v={title:n.i18n("batchRename"),modal:!0,destroyOnClose:!0,width:Math.min(380,n.getUI().width()-20),buttons:{},open:function(){c.on("input",y).trigger("focus")}},b=function(){var e=c.val(),t=n.splitFileExtention(n.file(r[0]).name)[1];return(""!==e||d.is(":checked"))&&(p.is(":checked")?e+="*":u.is(":checked")?e="*"+e+"."+t:h.is(":checked")?e="*."+e:t&&(e+="."+t)),e},y=function(){var e=b();""!==e?m.html(n.i18n(["renameMultiple",r.length,a(e)])):m.empty()},w=f.find("input:radio").on("change",y);v.buttons[n.i18n("btnApply")]=function(){var e,t,a=b();""!==a&&(o.elfinderdialog("close"),t=r,e=n.file(t.shift()),i(void 0,t,e,a))},v.buttons[n.i18n("btnCancel")]=function(){o.elfinderdialog("close")},e.fn.checkboxradio?w.checkboxradio({create:function(e,t){this===d.get(0)&&d.prop("checked",!0).change()}}):f.buttonset({create:function(e,t){d.prop("checked",!0).change()}}),o=t.fmDialog(g,v)};this.noChangeDirOnRemovedCwd=!0,this.shortcuts=[{pattern:"f2"+("mac"==n.OS?" enter":"")},{pattern:"shift+f2",description:"batchRename",callback:function(){n.selected().length>1&&o()}}],this.getstate=function(i){var a,r,s,l,c,d,p=this.files(i),u=p.length;return u?(u>1&&p[0].phash&&(a=p[0].phash,r=n.splitFileExtention(p[0].name)[1].toLowerCase(),s=p[0].mime),1===u&&(d=n.isRoot(p[0])),c=1===u&&(n.cookieEnabled&&d||!p[0].locked)||n.api>2.103&&u===e.grep(p,function(e){return!(l||e.locked||e.phash!==a||n.isRoot(e)||s!==e.mime&&r!==n.splitFileExtention(e.name)[1].toLowerCase())||(l&&(l=!0),!1)}).length?0:-1,!d&&0===c&&n.option("disabledFlip",p[0].hash).rename&&(c=-1),c!==-1&&u>1?t.extra={icon:"preference",node:e("").attr({title:n.i18n("batchRename")}).on("click touchstart",function(e){"touchstart"===e.type&&e.originalEvent.touches.length>1||(e.stopPropagation(),e.preventDefault(),n.getUI().trigger("click"),o())})}:delete t.extra,c):-1},this.exec=function(t,o){var r,s=(n.getUI("cwd"),t||!!n.selected().length&&n.selected()||[n.cwd().hash]),l=s.length,c=n.file(s.shift()),d=".elfinder-cwd-filename",p=o||{},u=n.cwd().hash==c.hash,h="navbar"===p._currentType||"files"===p._currentType?p._currentType:u?"navbar":"files",f="files"!==h,m=n[f?"navHash2Elm":"cwdHash2Elm"](c.hash),g=!f&&"list"!=n.storage("view"),v=function(){requestAnimationFrame(function(){x&&x.trigger("blur")})},b=function(){T.is(":hidden")||T.elfinderoverlay("hide").off("click close",A),z.removeClass("ui-front").css("position","").off("unselect."+n.namespace,v),g?C&&C.css("max-height",""):f||z.css("width","").parent("td").css("overflow","")},y=e.Deferred().fail(function(e){var t=x.parent(),i=n.escape(c.i18||c.name);x.off(),g&&(i=i.replace(/([_.])/g,"​$1")),requestAnimationFrame(function(){f?x.replaceWith(i):t.length?(x.remove(),t.html(i)):m.find(d).html(i)}),e&&n.error(e)}).always(function(){b(),n.unbind("resize",j),n.enable()}),w=function(t){var o=e.trim(x.val()),r=(n.splitFileExtention(o),!0),d=function(){x.off(),b(),f?x.replaceWith(n.escape(o)):C.html(n.escape(o)),i(y,s,c,o)};if(T.is(":hidden")||z.css("z-index",""),""===o){if(!n.isRoot(c))return A();f?x.replaceWith(n.escape(c.name)):C.html(n.escape(c.name))}if(!S&&z.length){if(x.off("blur"),1===l&&o===c.name)return y.reject();if(n.options.validName&&n.options.validName.test)try{r=n.options.validName.test(o)}catch(t){r=!1}if("."===o||".."===o||!r)return S=!0,n.error("directory"===c.mime?"errInvDirname":"errInvName",{modal:!0,close:function(){setTimeout(k,120)}}),!1;if(1===l&&n.fileByName(o,c.phash))return S=!0,n.error(["errExists",o],{modal:!0,close:function(){setTimeout(k,120)}}),!1;1===l?d():(n.confirm({title:"cmdrename",text:["renameMultiple",l,a(o,[c.hash].concat(s))],accept:{label:"btnYes",callback:d},cancel:{label:"btnCancel",callback:function(){setTimeout(function(){S=!0,k()},120)}}}),setTimeout(function(){n.trigger("unselectfiles",{files:n.selected()}).trigger("selectfiles",{files:[c.hash].concat(s)})},120))}},x=e(g?"":'').on("keyup text",function(){g?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):r&&(this.style.width=r+"px",this.scrollWidth>r&&(this.style.width=this.scrollWidth+10+"px"))}).on("keydown",function(t){t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?y.reject():t.keyCode==e.ui.keyCode.ENTER&&(t.preventDefault(),x.trigger("blur"))}).on("mousedown click dblclick",function(e){e.stopPropagation(),"dblclick"===e.type&&e.preventDefault()}).on("blur",w).on("dragenter dragleave dragover drop",function(e){e.stopPropagation()}),k=function(){var e=n.splitFileExtention(x.val())[0];S||!n.UA.Mobile||n.UA.iOS||(T.on("click close",A).elfinderoverlay("show"),z.css("z-index",T.css("z-index")+1)),!n.enabled()&&n.enable(),S&&(S=!1,x.on("blur",w)),x.trigger("focus").trigger("select"),x[0].setSelectionRange&&x[0].setSelectionRange(0,e.length)},C=f?m.contents().filter(function(){return 3==this.nodeType&&e(this).parent().attr("id")===n.navHash2Id(c.hash)}):m.find(d),z=C.parent(),T=n.getUI("overlay"),A=function(e){T.is(":hidden")||z.css("z-index",""),S||(y.reject(),e&&(e.stopPropagation(),e.preventDefault()))},j=function(){m.trigger("scrolltoview",{blink:!1})},S=!1;return z.addClass("ui-front").css("position","relative").on("unselect."+n.namespace,v),n.bind("resize",j),f?C.replaceWith(x.val(c.name)):(g?C.css("max-height","none"):f||(r=z.width(),z.width(r-15).parent("td").css("overflow","visible")),C.empty().append(x.val(c.name))),l>1&&n.api<=2.103?y.reject():c&&C.length?c.locked&&!n.isRoot(c)?y.reject(["errLocked",c.name]):(n.one("select",function(){x.parent().length&&c&&e.inArray(c.hash,n.selected())===-1&&x.trigger("blur")}),x.trigger("keyup"),k(),y):y.reject("errCmdParams",this.title)},n.bind("select contextmenucreate closecontextmenu",function(e){var i,a=(e.data?e.data.selected||e.data.targets:null)||n.selected();a&&1===a.length&&(i=n.file(a[0]))&&n.isRoot(i)?t.title=n.i18n("kindAlias")+" ("+n.i18n("preference")+")":t.title=n.i18n("cmdrename"),"closecontextmenu"!==e.type?t.update(void 0,t.title):requestAnimationFrame(function(){t.update(void 0,t.title)})}).remove(function(t){var i;t.data&&t.data.removed&&(i=n.storage("rootNames"))&&(e.each(t.data.removed,function(e,t){i[t]&&delete i[t]}),n.storage("rootNames",i))})},i.prototype.commands.resize=function(){"use strict";var t=this.fm,n=0,i=function(t,n,i){var a=[{x:t/2,y:n/2},{x:-t/2,y:n/2},{x:-t/2,y:-n/2},{x:t/2,y:-n/2}],o=[],r={x:Number.MAX_VALUE,y:Number.MAX_VALUE},s={x:Number.MIN_VALUE,y:Number.MIN_VALUE};return e.each(a,function(e,t){o.push({x:t.x*Math.cos(i)-t.y*Math.sin(i),y:t.x*Math.sin(i)+t.y*Math.cos(i)})}),e.each(o,function(e,t){r.x=Math.min(r.x,t.x),r.y=Math.min(r.y,t.y),s.x=Math.max(s.x,t.x),s.y=Math.max(s.y,t.y)}),{width:s.x-r.x,height:s.y-r.y}};this.updateOnSelect=!1,this.getstate=function(){var e=t.selectedFiles();return 1==e.length&&e[0].read&&e[0].write&&e[0].mime.indexOf("image/")!==-1?0:-1},this.resizeRequest=function(n,i,a){var o=i||t.file(n.target),r=(o?o.tmb:null,t.isCommandEnabled("resize",n.target));if(r&&(!o||o&&o.read&&o.write&&o.mime.indexOf("image/")!==-1))return t.request({data:Object.assign(n,{cmd:"resize"}),notify:{type:"resize",cnt:1}}).fail(function(e){a&&a.reject(e)}).done(function(){n.quality&&t.storage("jpgQuality",n.quality===t.option("jpgQuality")?null:n.quality),a&&a.resolve()});var s;return s=o?o.mime.indexOf("image/")===-1?["errResize",o.name,"errUsupportType"]:["errResize",o.name,"errPerm"]:["errResize",n.target,"errPerm"],a?a.reject(s):t.error(s),e.Deferred().reject(s)},this.exec=function(a){var o,r,s,l,c=this,d=this.files(a),p=e.Deferred(),u=t.api>1,h=this.options,f=650,m=t.getUI(),g=e().controlgroup?"controlgroup":"buttonset",v="undefined"==typeof h.grid8px||"disable"!==h.grid8px,b=Array.isArray(h.presetSize)?h.presetSize:[],y="elfinder-dialog-active",w=t.res("class","editing"),x=function(a,o,r){var d,x,k,C,z,T="image/jpeg"===a.mime,A=e('
              '),j='',S='
              ',O='
              ',I=null,M=!1,F=function(){M=!0},E=function(){M&&(M=!1,D.trigger("change"))},D=e('
              ').on("focus","input[type=text],input[type=number]",function(){e(this).trigger("select")}).on("change",function(){I&&cancelAnimationFrame(I),I=requestAnimationFrame(function(){var e,n,a,o,r,s,c,d,p,u,h,f;at&&!M&&(a=at.data("canvas"))&&(e=D.children("div.elfinder-resize-control-panel:visible"),n=e.find("input.elfinder-resize-quality"),n.is(":visible")&&(o=at.data("ctx"),r=at.get(0),e.hasClass("elfinder-resize-uiresize")?(d=a.width=X.val(),p=a.height=J.val(),o.drawImage(r,0,0,d,p)):e.hasClass("elfinder-resize-uicrop")?(s=G.val(),c=Y.val(),d=Q.val(),p=Z.val(),a.width=d,a.height=p,o.drawImage(r,s,c,d,p,0,0,d,p)):(u=te.val(),h=te.val()*Math.PI/180,f=i(fe,me,h),d=a.width=f.width,p=a.height=f.height,o.save(),u%90!==0&&(o.fillStyle=de.val()||"#FFF",o.fillRect(0,0,d,p)),o.translate(d/2,p/2),o.rotate(h),o.drawImage(r,-r.width/2,-r.height/2,fe,me),o.restore()),a.toBlob(function(e){e&&(l=e.size,n.next("span").text(" ("+t.formatSize(e.size)+")"))},"image/jpeg",Math.max(Math.min(n.val(),100),1)/100)))})}).on("mouseup","input",function(t){e(t.target).trigger("change")}),U=e('
              ').on("touchmove",function(t){e(t.target).hasClass("touch-punch")&&(t.stopPropagation(),t.preventDefault())}),P=e('
              '+t.i18n("ntfloadimg")+"
              "),q=e('
              '),R=e('
              '),H=e('
              '),_=e('
              '),N=e('
              '),L=e("").attr("title",t.i18n("rotate-cw")).append(e('')),W=e("").attr("title",t.i18n("rotate-ccw")).append(e('')),B=e(""),$=e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){d.exec("open",f).done(function(){d.one("opendone",function(){d.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})})})})})):d.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})}),d.toast({msg:d.i18n(["complete",d.i18n("cmdupload")]),extNode:n}))}}).progress(function(){w.notifyWith(this,Array.from(arguments))})},v=function(e){i.elfinderdialog("close"),h&&(e.target=h[0]),g(e)},b=function(){var t=m.hash,n=e.map(d.files(t),function(e){return"directory"===e.mime&&e.write?e:null});return n.length?e('
              ').on("click",function(t){t.stopPropagation(),t.preventDefault(),n=d.sortFiles(n);var a=e(this),o=(d.cwd(),i.closest("div.ui-dialog")),r=function(e,t){return{label:d.escape(e.i18||e.name),icon:t,remain:!1,callback:function(){var t=o.children(".ui-dialog-titlebar:first").find("span.elfinder-upload-target");h=[e.hash],t.html(" - "+d.escape(e.i18||e.name)),a.trigger("focus")},options:{className:h&&h.length&&e.hash===h[0]?"ui-state-active":"",iconClass:e.csscls||"",iconImg:e.icon||""}}},s=[r(m,"opendir"),"|"];e.each(n,function(e,t){s.push(r(t,"dir"))}),a.trigger("blur"),d.trigger("contextmenu",{raw:s,x:t.pageX||e(this).offset().left,y:t.pageY||e(this).offset().top,prevNode:o,fitHeight:!0})}).append(''):e()},y=function(n,i){var a=e('").on("click",function(){d.UA.IE&&setTimeout(function(){o.css("display","none").css("position","relative"),requestAnimationFrame(function(){o.css("display","").css("position","")})},100)}).on("change",function(){v({input:a.get(0),type:"files"})}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"}),o=e("
              ").append(a).on("click",function(e){e.stopPropagation()});return e('
              '+d.i18n(i)+"
              ").append(o).on("click",function(e){e.stopPropagation(),e.preventDefault(),a.trigger("click")}).on("mouseenter mouseleave",function(n){e(this).toggleClass(t,"mouseenter"===n.type)})},w=e.Deferred();return r=function(t){t.stopPropagation(),t.preventDefault();var n,i,a=!1,o="",r=null,s="",l=null,c=t._target||null,p=t.dataTransfer||null,u="";if(p){p.types&&p.types.length&&(n=e.inArray("Files",p.types))!==-1?u="file":p.items&&p.items.length&&p.items[0].kind&&(u=p.items[0].kind);try{if(r=p.getData("elfinderfrom"),r&&(s=window.location.href+d.cwd().hash,!c&&r===s||c===s))return void w.reject()}catch(t){}if("file"===u&&(p.items[n].getAsEntry||p.items[n].webkitGetAsEntry||p.items[n].getAsFile))a=p,o="data";else if("string"!==u&&p.files&&p.files.length&&e.inArray("Text",p.types)===-1)a=p.files,o="files";else{try{(l=p.getData("text/html"))&&l.match(/<(?:img|a)/i)&&(a=[l],o="html")}catch(t){}a||((l=p.getData("text"))?(a=[l],o="text"):p&&p.files&&(u="file"))}}a?g({files:a,type:o,target:c,dropEvt:t}):(i=["errUploadNoFiles"],"file"===u&&i.push("errFolderUpload"),d.error(i),w.reject())},!h&&n?(n.input||n.files?(n.type="files",g(n)):n.dropEvt&&r(n.dropEvt),w):(s=function(t){var n,i=t.originalEvent||t,a=[],o=[];if(i.clipboardData){if(i.clipboardData.items&&i.clipboardData.items.length){o=i.clipboardData.items;for(var r=0;r
            ').append(y("multiple","selectForUpload")),!d.UA.Mobile&&function(e){return"undefined"!=typeof e.webkitdirectory||"undefined"!=typeof e.directory}(document.createElement("input"))&&i.append(y("multiple webkitdirectory directory","selectFolder")),m.dirs&&(m.hash===p||d.navHash2Elm(m.hash).hasClass("elfinder-subtree-loaded")?b().appendTo(i):(l=e('
            ').append('').appendTo(i),d.request({cmd:"tree",target:m.hash}).done(function(){d.one("treedone",function(){l.replaceWith(b()),c.elfinderdialog("tabstopsInit")})}).fail(function(){l.remove()}))),d.dragUpload?a=e('
            ').on("paste",function(e){s(e)}).on("mousedown click",function(){e(this).trigger("focus")}).on("focus",function(){this.innerHTML=""}).on("mouseover",function(){e(this).addClass(t)}).on("mouseout",function(){e(this).removeClass(t)}).on("dragenter",function(n){n.stopPropagation(),n.preventDefault(),e(this).addClass(t)}).on("dragleave",function(n){n.stopPropagation(),n.preventDefault(),e(this).removeClass(t)}).on("dragover",function(n){n.stopPropagation(),n.preventDefault(),n.originalEvent.dataTransfer.dropEffect="copy",e(this).addClass(t)}).on("drop",function(e){i.elfinderdialog("close"),h&&(e.originalEvent._target=h[0]),r(e.originalEvent)}).prependTo(i).after('
            '+d.i18n("or")+"
            ")[0]:o=e('
            '+d.i18n("dropFilesBrowser")+"
            ").on("paste drop",function(e){s(e)}).on("mousedown click",function(){e(this).trigger("focus")}).on("focus",function(){this.innerHTML=""}).on("dragenter mouseover",function(){e(this).addClass(t)}).on("dragleave mouseout",function(){e(this).removeClass(t)}).prependTo(i).after('
            '+d.i18n("or")+"
            ")[0],c=this.fmDialog(i,{title:this.title+''+(m?" - "+d.escape(m.i18||m.name):"")+"",modal:!0,resizable:!1,destroyOnClose:!0,propagationEvents:["mousemove","mouseup","click"],close:function(){var e=d.getUI("contextmenu");e.is(":visible")&&e.click()}}),w)}},i.prototype.commands.view=function(){"use strict";var t,n=this,i=this.fm;this.value=i.viewType,this.alwaysEnabled=!0,this.updateOnSelect=!1,this.options={ui:"viewbutton"},this.getstate=function(){return 0},this.extra={icon:"menu",node:e("").attr({title:i.i18n("viewtype")}).on("click touchstart",function(t){if(!("touchstart"===t.type&&t.originalEvent.touches.length>1)){var n=e(this);t.stopPropagation(),t.preventDefault(),i.trigger("contextmenu",{raw:getSubMenuRaw(),x:n.offset().left,y:n.offset().top})}})},this.exec=function(){var e=this,t="list"==this.value?"icons":"list";return i.storage("view",t),i.lazy(function(){i.viewchange(),e.update(void 0,t),this.resolve()})},i.bind("init",function(){t=function(){var e,t=i.getUI("cwd"),a=[],o=i.options.uiOptions.cwd.iconsView.sizeNames,r=i.options.uiOptions.cwd.iconsView.sizeMax;for(e=0;e<=r;e++)a.push({label:i.i18n(o[e]||"Size-"+e+" icons"),icon:"view",callback:function(e){return function(){t.trigger("iconpref",{size:e}),i.storage("iconsize",e),"list"===n.value&&n.exec()}}(e)});return a.push("|"),a.push({label:i.i18n("viewlist"),icon:"view-list",callback:function(){"list"!==n.value&&n.exec()}}),a}()}).bind("contextmenucreate",function(){n.extra={icon:"menu",node:e("").attr({title:i.i18n("cmdview")}).on("click touchstart",function(a){if(!("touchstart"===a.type&&a.originalEvent.touches.length>1)){var o,r,s=e(this);t.concat();for(o="list"===n.value?t.length-1:parseInt(i.storage("iconsize")||0),r=0;r
            ') + .html('' + fm.i18n('ntfloadimg') + '') + .hide() + .appendTo(this), + setup = function() { + node.attr('id', id+'-img') + .attr('src', url || content) + .css({'height':'', 'max-width':'100%', 'max-height':'100%', 'cursor':'pointer'}) + .data('loading', function(done) { + var btns = node.closest('.elfinder-dialog').find('button,.elfinder-titlebar-button'); + btns.prop('disabled', !done)[done? 'removeClass' : 'addClass']('ui-state-disabled'); + node.css('opacity', done? '' : '0.3'); + spnr[done? 'hide' : 'show'](); + return node; + }); + }, + url; + + if (!content.match(/^data:/)) { + fm.openUrl(file.hash, false, function(v) { + url = v; + node.attr('_src', content); + setup(); + }); + } else { + setup(); + } + }, + imgBase64 = function(node, mime) { + var style = node.attr('style'), + img, canvas, ctx, data; + try { + // reset css for getting image size + node.attr('style', ''); + // img node + img = node.get(0); + // New Canvas + canvas = document.createElement('canvas'); + canvas.width = img.width; + canvas.height = img.height; + // restore css + node.attr('style', style); + // Draw Image + canvas.getContext('2d').drawImage(img, 0, 0); + // To Base64 + data = canvas.toDataURL(mime); + } catch(e) { + data = node.attr('src'); + } + return data; + }, + iframeClose = function(ifm) { + var $ifm = $(ifm), + dfd = $.Deferred().always(function() { + $ifm.off('load', load); + }), + ab = 'about:blank', + chk = function() { + tm = setTimeout(function() { + var src; + try { + src = base.contentWindow.location.href; + } catch(e) { + src = null; + } + if (src === ab) { + dfd.resolve(); + } else if (--cnt > 0){ + chk(); + } else { + dfd.reject(); + } + }, 500); + }, + load = function() { + tm && clearTimeout(tm); + dfd.resolve(); + }, + cnt = 20, // 500ms * 20 = 10sec wait + tm; + $ifm.one('load', load); + ifm.src = ab; + chk(); + return dfd; + }; + + // check getfile callback function + if (getfile) { + getfile = getfile[1]; + if (getfile === 'ckeditor') { + elFinder.prototype._options.getFileCallback = function(file, fm) { + window.opener.CKEDITOR.tools.callFunction((function() { + var reParam = new RegExp('(?:[?&]|&)CKEditorFuncNum=([^&]+)', 'i'), + match = window.location.search.match(reParam); + return (match && match.length > 1) ? match[1] : ''; + })(), fm.convAbsUrl(file.url)); + fm.destroy(); + window.close(); + }; + } + } + + // return editors Array + return [ + { + // tui.image-editor - https://github.com/nhnent/tui.image-editor + info : { + id: 'tuiimgedit', + name: 'TUI Image Editor', + iconImg: 'img/editor-icons.png 0 -48', + dataScheme: true, + schemeContent: true, + openMaximized: true, + canMakeEmpty: false, + integrate: { + title: 'TOAST UI Image Editor', + link: 'http://ui.toast.com/tui-image-editor/' + } + }, + // MIME types to accept + mimes : ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp'], + // HTML of this editor + html : '
            ', + // called on initialization of elFinder cmd edit (this: this editor's config object) + setup : function(opts, fm) { + if (fm.UA.ltIE8 || fm.UA.Mobile) { + this.disabled = true; + } else { + this.opts = Object.assign({ + version: 'v3.15.3' + }, opts.extraOptions.tuiImgEditOpts || {}, { + iconsPath : fm.baseUrl + 'img/tui-', + theme : {} + }); + if (!fm.isSameOrigin(this.opts.iconsPath)) { + this.disabled = true; + fm.debug('warning', 'Setting `commandOptions.edit.extraOptions.tuiImgEditOpts.iconsPath` MUST follow the same origin policy.'); + } + } + }, + // Initialization of editing node (this: this editors HTML node) + init : function(id, file, content, fm) { + this.data('url', content); + }, + load : function(base) { + var self = this, + fm = this.fm, + dfrd = $.Deferred(), + cdns = fm.options.cdns, + ver = self.confObj.opts.version, + init = function(editor) { + var $base = $(base), + bParent = $base.parent(), + opts = self.confObj.opts, + iconsPath = opts.iconsPath, + tmpContainer = $('
            ').appendTo(bParent), + tmpDiv = [ + $('
            ').appendTo(tmpContainer), + $('
            ').appendTo(tmpContainer) + ], + iEditor = new editor(base, { + includeUI: { + loadImage: { + path: $base.data('url'), + name: self.file.name + }, + theme: opts.theme, + initMenu: 'filter', + menuBarPosition: 'bottom' + }, + cssMaxWidth: Math.max(300, bParent.width()), + cssMaxHeight: Math.max(200, bParent.height() - (tmpDiv[0].height() + tmpDiv[1].height() + 3 /*margin*/)), + usageStatistics: false + }), + canvas = $base.find('canvas:first').get(0), + zoom = function(v) { + if (typeof v !== 'undefined') { + var c = $(canvas), + w = parseInt(c.attr('width')), + h = parseInt(c.attr('height')), + a = w / h, + z, mw, mh; + if (v === 0) { + mw = w; + mh = h; + } else { + mw = parseInt(c.css('max-width')) + Number(v); + mh = mw / a; + if (mw > w && mh > h) { + mw = w; + mh = h; + } + } + z = Math.round(mw / w * 100); + // Control zoom button of TUI Image Editor + if (z < 100) { + iEditor.resetZoom(); + iEditor.stopDrawingMode(); + tuiZoomCtrls.hide(); + } else { + tuiZoomCtrls.show(); + } + per.text(z + '%'); + iEditor.resizeCanvasDimension({width: mw, height: mh}); + // continually change more + if (zoomMore) { + setTimeout(function() { + zoomMore && zoom(v); + }, 50); + } + } + }, + zup = $('').data('val', 10), + zdown = $('').data('val', -10), + per = $('').css('width', '4em').text('%').attr('title', '100%').data('val', 0), + tuiZoomCtrls, + quty, qutyTm, zoomTm, zoomMore; + + tmpContainer.remove(); + $base.removeData('url').data('mime', self.file.mime); + // jpeg quality controls + if (self.file.mime === 'image/jpeg') { + $base.data('quality', fm.storage('jpgQuality') || fm.option('jpgQuality')); + quty = $('') + .attr('min', '1') + .attr('max', '100') + .attr('title', '1 - 100') + .on('change', function() { + var q = quty.val(); + $base.data('quality', q); + qutyTm && cancelAnimationFrame(qutyTm); + qutyTm = requestAnimationFrame(function() { + canvas.toBlob(function(blob) { + blob && quty.next('span').text(' (' + fm.formatSize(blob.size) + ')'); + }, 'image/jpeg', Math.max(Math.min(q, 100), 1) / 100); + }); + }) + .val($base.data('quality')); + $('
            ') + .append( + $('').html(fm.i18n('quality') + ' : '), quty, $('') + ) + .prependTo($base.parent().next()); + } else if (self.file.mime === 'image/svg+xml') { + $base.closest('.ui-dialog').trigger('changeType', { + extention: 'png', + mime : 'image/png', + keepEditor: true + }); + } + // zoom scale controls + $('
            ') + .append( + zdown, per, zup + ) + .attr('title', fm.i18n('scale')) + .on('click', 'span,button', function() { + zoom($(this).data('val')); + }) + .on('mousedown mouseup mouseleave', 'span', function(e) { + zoomMore = false; + zoomTm && clearTimeout(zoomTm); + if (e.type === 'mousedown') { + zoomTm = setTimeout(function() { + zoomMore = true; + zoom($(e.target).data('val')); + }, 500); + } + }) + .prependTo($base.parent().next()); + + // wait canvas ready + setTimeout(function() { + dfrd.resolve(iEditor); + if (quty) { + quty.trigger('change'); + iEditor.on('redoStackChanged undoStackChanged', function() { + quty.trigger('change'); + }); + } + // ZOOM controls of TUI Image Editor + tuiZoomCtrls = $base.find('.tie-btn-zoomIn,.tie-btn-zoomOut,.tie-btn-hand'); + // show initial scale + zoom(null); + }, 100); + + // show color slider (maybe TUI-Image-Editor's bug) + // see https://github.com/nhn/tui.image-editor/issues/153 + $base.find('.tui-colorpicker-palette-container').on('click', '.tui-colorpicker-palette-preview', function() { + $(this).closest('.color-picker-control').height('auto').find('.tui-colorpicker-slider-container').toggle(); + }); + $base.on('click', function() { + $base.find('.tui-colorpicker-slider-container').hide(); + }); + }, + loader; + + if (!self.confObj.editor) { + loader = $.Deferred(); + fm.loadCss([ + cdns.tui + '/tui-color-picker/latest/tui-color-picker.css', + cdns.tui + '/tui-image-editor/'+ver+'/tui-image-editor.css' + ]); + if (fm.hasRequire) { + require.config({ + paths : { + 'fabric/dist/fabric.require' : cdns.fabric + '/fabric.require.min', // for fabric < 2.0.1 + 'fabric' : cdns.fabric + '/fabric.min', // for fabric >= 2.0.1 + 'tui-code-snippet' : cdns.tui + '/tui.code-snippet/latest/tui-code-snippet.min', + 'tui-color-picker' : cdns.tui + '/tui-color-picker/latest/tui-color-picker.min', + 'tui-image-editor' : cdns.tui + '/tui-image-editor/'+ver+'/tui-image-editor.min' + } + }); + require(['tui-image-editor'], function(ImageEditor) { + loader.resolve(ImageEditor); + }); + } else { + fm.loadScript([ + cdns.fabric + '/fabric.min.js', + cdns.tui + '/tui.code-snippet/latest/tui-code-snippet.min.js' + ], function() { + fm.loadScript([ + cdns.tui + '/tui-color-picker/latest/tui-color-picker.min.js' + ], function() { + fm.loadScript([ + cdns.tui + '/tui-image-editor/'+ver+'/tui-image-editor.min.js' + ], function() { + loader.resolve(window.tui.ImageEditor); + }, { + loadType: 'tag' + }); + }, { + loadType: 'tag' + }); + }, { + loadType: 'tag' + }); + } + loader.done(function(editor) { + self.confObj.editor = editor; + init(editor); + }); + } else { + init(self.confObj.editor); + } + return dfrd; + }, + getContent : function(base) { + var editor = this.editor, + fm = editor.fm, + $base = $(base), + quality = $base.data('quality'); + if (editor.instance) { + if ($base.data('mime') === 'image/jpeg') { + quality = quality || fm.storage('jpgQuality') || fm.option('jpgQuality'); + quality = Math.max(0.1, Math.min(1, quality / 100)); + } + return editor.instance.toDataURL({ + format: getExtention($base.data('mime'), fm, true), + quality: quality + }); + } + }, + save : function(base) { + var $base = $(base), + quality = $base.data('quality'), + hash = $base.data('hash'), + file; + this.instance.deactivateAll(); + if (typeof quality !== 'undefined') { + this.fm.storage('jpgQuality', quality); + } + if (hash) { + file = this.fm.file(hash); + $base.data('mime', file.mime); + } + } + }, + { + // Photopea advanced image editor + info : { + id : 'photopea', + name : 'Photopea', + iconImg : 'img/editor-icons.png 0 -160', + single: true, + noContent: true, + arrayBufferContent: true, + openMaximized: true, + // Disable file types that cannot be saved on Photopea. + canMakeEmpty: ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp', 'image/tiff', /*'image/x-adobe-dng',*/ 'image/webp', /*'image/x-xcf',*/ 'image/vnd.adobe.photoshop', 'application/pdf', 'image/x-portable-pixmap', 'image/x-sketch', 'image/x-icon', 'image/vnd-ms.dds', /*'application/x-msmetafile'*/], + integrate: { + title: 'Photopea', + link: 'https://www.photopea.com/learn/' + } + }, + mimes : ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp', 'image/tiff', 'image/x-adobe-dng', 'image/webp', 'image/x-xcf', 'image/vnd.adobe.photoshop', 'application/pdf', 'image/x-portable-pixmap', 'image/x-sketch', 'image/x-icon', 'image/vnd-ms.dds', 'application/x-msmetafile'], + html : '', + // setup on elFinder bootup + setup : function(opts, fm) { + if (fm.UA.IE || fm.UA.Mobile) { + this.disabled = true; + } + }, + // Initialization of editing node (this: this editors HTML node) + init : function(id, file, dum, fm) { + var orig = 'https://www.photopea.com', + ifm = $(this).hide() + //.css('box-sizing', 'border-box') + .on('load', function() { + //spnr.remove(); + ifm.show(); + }) + .on('error', function() { + spnr.remove(); + ifm.show(); + }), + editor = this.editor, + confObj = editor.confObj, + spnr = $('
            ') + .html('' + fm.i18n('nowLoading') + '') + .appendTo(ifm.parent()), + saveMimes = fm.arrayFlip(confObj.info.canMakeEmpty), + getType = function(mime) { + var ext = getExtention(mime, fm), + extmime = ext2mime[ext]; + + if (!confObj.mimesFlip[extmime]) { + ext = ''; + } else if (ext === 'jpeg') { + ext = 'jpg'; + } + if (!ext || !saveMimes[extmime]) { + ext = 'psd'; + extmime = ext2mime[ext]; + ifm.closest('.ui-dialog').trigger('changeType', { + extention: ext, + mime : extmime, + keepEditor: true + }); + } + return ext; + }, + mime = file.mime, + liveMsg, type, quty; + + if (!confObj.mimesFlip) { + confObj.mimesFlip = fm.arrayFlip(confObj.mimes, true); + } + if (!confObj.liveMsg) { + confObj.liveMsg = function(ifm, spnr, file) { + var wnd = ifm.get(0).contentWindow, + phase = 0, + data = null, + dfdIni = $.Deferred().done(function() { + spnr.remove(); + phase = 1; + wnd.postMessage(data, orig); + }), + dfdGet; + + this.load = function() { + return fm.getContents(file.hash, 'arraybuffer').done(function(d) { + data = d; + }); + }; + + this.receive = function(e) { + var ev = e.originalEvent, + state; + if (ev.origin === orig && ev.source === wnd) { + if (ev.data === 'done') { + if (phase === 0) { + dfdIni.resolve(); + } else if (phase === 1) { + phase = 2; + ifm.trigger('contentsloaded'); + } else { + if (dfdGet && dfdGet.state() === 'pending') { + dfdGet.reject('errDataEmpty'); + } + } + } else if (ev.data === 'Save') { + editor.doSave(); + } else { + if (dfdGet && dfdGet.state() === 'pending') { + if (typeof ev.data === 'object') { + dfdGet.resolve('data:' + mime + ';base64,' + fm.arrayBufferToBase64(ev.data)); + } else { + dfdGet.reject('errDataEmpty'); + } + } + } + } + }; + + this.getContent = function() { + var type, q; + if (phase > 1) { + dfdGet && dfdGet.state() === 'pending' && dfdGet.reject(); + dfdGet = null; + dfdGet = $.Deferred(); + if (phase === 2) { + phase = 3; + dfdGet.resolve('data:' + mime + ';base64,' + fm.arrayBufferToBase64(data)); + data = null; + return dfdGet; + } + if (ifm.data('mime')) { + mime = ifm.data('mime'); + type = getType(mime); + } + if (q = ifm.data('quality')) { + type += ':' + (q / 100); + } + wnd.postMessage('app.activeDocument.saveToOE("' + type + '")', orig); + return dfdGet; + } + }; + }; + } + + ifm.parent().css('padding', 0); + type = getType(file.mime); + liveMsg = editor.liveMsg = new confObj.liveMsg(ifm, spnr, file); + $(window).on('message.' + fm.namespace, liveMsg.receive); + liveMsg.load().done(function() { + var d = JSON.stringify({ + files : [], + environment : { + lang: fm.lang.replace(/_/g, '-'), + customIO: {"save": "app.echoToOE(\"Save\");"} + } + }); + ifm.attr('src', orig + '/#' + encodeURI(d)); + }).fail(function(err) { + err && fm.error(err); + editor.initFail = true; + }); + + // jpeg quality controls + if (file.mime === 'image/jpeg' || file.mime === 'image/webp') { + ifm.data('quality', fm.storage('jpgQuality') || fm.option('jpgQuality')); + quty = $('') + .attr('min', '1') + .attr('max', '100') + .attr('title', '1 - 100') + .on('change', function() { + var q = quty.val(); + ifm.data('quality', q); + }) + .val(ifm.data('quality')); + $('
            ') + .append( + $('').html(fm.i18n('quality') + ' : '), quty, $('') + ) + .prependTo(ifm.parent().next()); + } + }, + load : function(base) { + var dfd = $.Deferred(), + self = this, + fm = this.fm, + $base = $(base); + if (self.initFail) { + dfd.reject(); + } else { + $base.on('contentsloaded', function() { + dfd.resolve(self.liveMsg); + }); + } + return dfd; + }, + getContent : function() { + return this.editor.liveMsg? this.editor.liveMsg.getContent() : void(0); + }, + save : function(base, liveMsg) { + var $base = $(base), + quality = $base.data('quality'), + hash = $base.data('hash'), + file; + if (typeof quality !== 'undefined') { + this.fm.storage('jpgQuality', quality); + } + if (hash) { + file = this.fm.file(hash); + $base.data('mime', file.mime); + } else { + $base.removeData('mime'); + } + }, + // On dialog closed + close : function(base, liveMsg) { + $(base).attr('src', ''); + liveMsg && $(window).off('message.' + this.fm.namespace, liveMsg.receive); + } + }, + { + // Pixo is cross-platform image editor + info : { + id : 'pixo', + name : 'Pixo Editor', + iconImg : 'img/editor-icons.png 0 -208', + dataScheme: true, + schemeContent: true, + single: true, + canMakeEmpty: false, + integrate: { + title: 'Pixo Editor', + link: 'https://pixoeditor.com/privacy-policy/' + } + }, + // MIME types to accept + mimes : ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp'], + // HTML of this editor + html : '
            ', + // called on initialization of elFinder cmd edit (this: this editor's config object) + setup : function(opts, fm) { + if (fm.UA.ltIE8 || !opts.extraOptions || !opts.extraOptions.pixo || !opts.extraOptions.pixo.apikey) { + this.disabled = true; + } else { + this.editorOpts = opts.extraOptions.pixo; + } + }, + // Initialization of editing node (this: this editors HTML node) + init : function(id, file, content, fm) { + initImgTag.call(this, id, file, content, fm); + }, + // Get data uri scheme (this: this editors HTML node) + getContent : function() { + return $(this).children('img:first').attr('src'); + }, + // Launch Pixo editor when dialog open + load : function(base) { + var self = this, + fm = this.fm, + $base = $(base), + node = $base.children('img:first'), + dialog = $base.closest('.ui-dialog'), + elfNode = fm.getUI(), + dfrd = $.Deferred(), + container = $('#elfinder-pixo-container'), + init = function(onload) { + var opts; + + if (!container.length) { + container = $('
            ').css({ + position: 'fixed', + top: 0, + right: 0, + width: '100%', + height: $(window).height(), + overflow: 'hidden' + }).hide().appendTo(elfNode.hasClass('elfinder-fullscreen')? elfNode : 'body'); + // bind switch fullscreen event + elfNode.on('resize.'+fm.namespace, function(e, data) { + e.preventDefault(); + e.stopPropagation(); + data && data.fullscreen && container.appendTo(data.fullscreen === 'on'? elfNode : 'body'); + }); + fm.bind('destroy', function() { + editor && editor.cancelEditing(); + container.remove(); + }); + } else { + // always moves to last + container.appendTo(container.parent()); + } + node.on('click', launch); + // Constructor options + opts = Object.assign({ + type: 'child', + parent: container.get(0), + output: {format: 'png'}, + onSave: function(arg) { + // Check current file.hash, all callbacks are called on multiple instances + var mime = arg.toBlob().type, + ext = getExtention(mime, fm), + draw = function(url) { + node.one('load error', function() { + node.data('loading') && node.data('loading')(true); + }) + .attr('crossorigin', 'anonymous') + .attr('src', url); + }, + url = arg.toDataURL(); + node.data('loading')(); + delete base._canvas; + if (node.data('ext') !== ext) { + changeImageType(url, self.file.mime).done(function(res, cv) { + if (cv) { + base._canvas = canvas = cv; + quty.trigger('change'); + qBase && qBase.show(); + } + draw(res); + }).fail(function() { + dialog.trigger('changeType', { + extention: ext, + mime : mime + }); + draw(url); + }); + } else { + draw(url); + } + }, + onClose: function() { + dialog.removeClass(fm.res('class', 'preventback')); + fm.toggleMaximize(container, false); + container.hide(); + fm.toFront(dialog); + } + }, self.confObj.editorOpts); + // trigger event 'editEditorPrepare' + self.trigger('Prepare', { + node: base, + editorObj: Pixo, + instance: void(0), + opts: opts + }); + // make editor instance + editor = new Pixo.Bridge(opts); + dfrd.resolve(editor); + $base.on('saveAsFail', launch); + if (onload) { + onload(); + } + }, + launch = function() { + dialog.addClass(fm.res('class', 'preventback')); + fm.toggleMaximize(container, true); + fm.toFront(container); + container.show().data('curhash', self.file.hash); + editor.edit(node.get(0)); + node.data('loading')(true); + }, + qBase, quty, qutyTm, canvas, editor; + + node.data('loading')(); + + // jpeg quality controls + if (self.file.mime === 'image/jpeg') { + quty = $('') + .attr('min', '1') + .attr('max', '100') + .attr('title', '1 - 100') + .on('change', function() { + var q = quty.val(); + qutyTm && cancelAnimationFrame(qutyTm); + qutyTm = requestAnimationFrame(function() { + if (canvas) { + canvas.toBlob(function(blob) { + blob && quty.next('span').text(' (' + fm.formatSize(blob.size) + ')'); + }, 'image/jpeg', Math.max(Math.min(q, 100), 1) / 100); + } + }); + }) + .val(fm.storage('jpgQuality') || fm.option('jpgQuality')); + qBase = $('
            ') + .hide() + .append( + $('').html(fm.i18n('quality') + ' : '), quty, $('') + ) + .prependTo($base.parent().next()); + $base.data('quty', quty); + } + + // load script then init + if (typeof Pixo === 'undefined') { + fm.loadScript(['https://pixoeditor.com:8443/editor/scripts/bridge.m.js'], function() { + init(launch); + }, {loadType: 'tag'}); + } else { + init(); + launch(); + } + return dfrd; + }, + // Convert content url to data uri scheme to save content + save : function(base) { + var self = this, + $base = $(base), + node = $base.children('img:first'), + q; + if (base._canvas) { + if ($base.data('quty')) { + q = $base.data('quty').val(); + q && this.fm.storage('jpgQuality', q); + } + node.attr('src', base._canvas.toDataURL(self.file.mime, q? Math.max(Math.min(q, 100), 1) / 100 : void(0))); + } else if (node.attr('src').substr(0, 5) !== 'data:') { + node.attr('src', imgBase64(node, this.file.mime)); + } + }, + close : function(base, editor) { + editor && editor.destroy(); + } + }, + { + // ACE Editor + // called on initialization of elFinder cmd edit (this: this editor's config object) + setup : function(opts, fm) { + if (fm.UA.ltIE8 || !fm.options.cdns.ace) { + this.disabled = true; + } + }, + // `mimes` is not set for support everything kind of text file + info : { + id : 'aceeditor', + name : 'ACE Editor', + iconImg : 'img/editor-icons.png 0 -96' + }, + load : function(textarea) { + var self = this, + fm = this.fm, + dfrd = $.Deferred(), + cdn = fm.options.cdns.ace, + start = function() { + var editor, editorBase, mode, + ta = $(textarea), + taBase = ta.parent(), + dialog = taBase.parent(), + id = textarea.id + '_ace', + ext = self.file.name.replace(/^.+\.([^.]+)|(.+)$/, '$1$2').toLowerCase(), + // MIME/mode map + mimeMode = { + 'text/x-php' : 'php', + 'application/x-php' : 'php', + 'text/html' : 'html', + 'application/xhtml+xml' : 'html', + 'text/javascript' : 'javascript', + 'application/javascript' : 'javascript', + 'text/css' : 'css', + 'text/x-c' : 'c_cpp', + 'text/x-csrc' : 'c_cpp', + 'text/x-chdr' : 'c_cpp', + 'text/x-c++' : 'c_cpp', + 'text/x-c++src' : 'c_cpp', + 'text/x-c++hdr' : 'c_cpp', + 'text/x-shellscript' : 'sh', + 'application/x-csh' : 'sh', + 'text/x-python' : 'python', + 'text/x-java' : 'java', + 'text/x-java-source' : 'java', + 'text/x-ruby' : 'ruby', + 'text/x-perl' : 'perl', + 'application/x-perl' : 'perl', + 'text/x-sql' : 'sql', + 'text/xml' : 'xml', + 'application/docbook+xml' : 'xml', + 'application/xml' : 'xml' + }; + + // set base height + taBase.height(taBase.height()); + + // set basePath of ace + ace.config.set('basePath', cdn); + + // Base node of Ace editor + editorBase = $('
            ').text(ta.val()).insertBefore(ta.hide()); + + // Editor flag + ta.data('ace', true); + + // Aceeditor instance + editor = ace.edit(id); + + // Ace editor configure + editor.$blockScrolling = Infinity; + editor.setOptions({ + theme: 'ace/theme/monokai', + fontSize: '14px', + wrap: true, + }); + ace.config.loadModule('ace/ext/modelist', function() { + // detect mode + mode = ace.require('ace/ext/modelist').getModeForPath('/' + self.file.name).name; + if (mode === 'text') { + if (mimeMode[self.file.mime]) { + mode = mimeMode[self.file.mime]; + } + } + // show MIME:mode in title bar + taBase.prev().children('.elfinder-dialog-title').append(' (' + self.file.mime + ' : ' + mode.split(/[\/\\]/).pop() + ')'); + editor.setOptions({ + mode: 'ace/mode/' + mode + }); + if (dfrd.state() === 'resolved') { + dialog.trigger('resize'); + } + }); + ace.config.loadModule('ace/ext/language_tools', function() { + ace.require('ace/ext/language_tools'); + editor.setOptions({ + enableBasicAutocompletion: true, + enableSnippets: true, + enableLiveAutocompletion: false + }); + }); + ace.config.loadModule('ace/ext/settings_menu', function() { + ace.require('ace/ext/settings_menu').init(editor); + }); + + // Short cuts + editor.commands.addCommand({ + name : "saveFile", + bindKey: { + win : 'Ctrl-s', + mac : 'Command-s' + }, + exec: function(editor) { + self.doSave(); + } + }); + editor.commands.addCommand({ + name : "closeEditor", + bindKey: { + win : 'Ctrl-w|Ctrl-q', + mac : 'Command-w|Command-q' + }, + exec: function(editor) { + self.doCancel(); + } + }); + + editor.resize(); + + // TextArea button and Setting button + $('
            ').css('float', 'left') + .append( + $('').html(self.fm.i18n('TextArea')) + .button() + .on('click', function(){ + if (ta.data('ace')) { + ta.removeData('ace'); + editorBase.hide(); + ta.val(editor.session.getValue()).show().trigger('focus'); + $(this).text('AceEditor'); + } else { + ta.data('ace', true); + editorBase.show(); + editor.setValue(ta.hide().val(), -1); + editor.focus(); + $(this).html(self.fm.i18n('TextArea')); + } + }) + ) + .append( + $('') + .button({ + icons: { + primary: 'ui-icon-gear', + secondary: 'ui-icon-triangle-1-e' + }, + text: false + }) + .on('click', function(){ + editor.showSettingsMenu(); + $('#ace_settingsmenu') + .css('font-size', '80%') + .find('div[contains="setOptions"]').hide().end() + .parent().appendTo($('#elfinder')); + }) + ) + .prependTo(taBase.next()); + + // trigger event 'editEditorPrepare' + self.trigger('Prepare', { + node: textarea, + editorObj: ace, + instance: editor, + opts: {} + }); + + //dialog.trigger('resize'); + dfrd.resolve(editor); + }; + + // check ace & start + if (!self.confObj.loader) { + self.confObj.loader = $.Deferred(); + self.fm.loadScript([ cdn+'/ace.js' ], function() { + self.confObj.loader.resolve(); + }, void 0, {obj: window, name: 'ace'}); + } + self.confObj.loader.done(start); + + return dfrd; + }, + close : function(textarea, instance) { + instance && instance.destroy(); + }, + save : function(textarea, instance) { + instance && $(textarea).data('ace') && (textarea.value = instance.session.getValue()); + }, + focus : function(textarea, instance) { + instance && $(textarea).data('ace') && instance.focus(); + }, + resize : function(textarea, instance, e, data) { + instance && instance.resize(); + } + }, + { + // CodeMirror + // called on initialization of elFinder cmd edit (this: this editor's config object) + setup : function(opts, fm) { + if (fm.UA.ltIE10 || !fm.options.cdns.codemirror) { + this.disabled = true; + } + }, + // `mimes` is not set for support everything kind of text file + info : { + id : 'codemirror', + name : 'CodeMirror', + iconImg : 'img/editor-icons.png 0 -176' + }, + load : function(textarea) { + var fm = this.fm, + cmUrl = fm.convAbsUrl(fm.options.cdns.codemirror), + dfrd = $.Deferred(), + self = this, + start = function(CodeMirror) { + var ta = $(textarea), + base = ta.parent(), + editor, editorBase, opts; + + // set base height + base.height(base.height()); + + // CodeMirror configure options + opts = { + lineNumbers: true, + lineWrapping: true, + extraKeys : { + 'Ctrl-S': function() { self.doSave(); }, + 'Ctrl-Q': function() { self.doCancel(); }, + 'Ctrl-W': function() { self.doCancel(); } + } + }; + + // trigger event 'editEditorPrepare' + self.trigger('Prepare', { + node: textarea, + editorObj: CodeMirror, + instance: void(0), + opts: opts + }); + + // CodeMirror configure + editor = CodeMirror.fromTextArea(textarea, opts); + + // return editor instance + dfrd.resolve(editor); + + // Auto mode set + var info, m, mode, spec; + if (! info) { + info = CodeMirror.findModeByMIME(self.file.mime); + } + if (! info && (m = self.file.name.match(/.+\.([^.]+)$/))) { + info = CodeMirror.findModeByExtension(m[1]); + } + if (info) { + CodeMirror.modeURL = useRequire? 'codemirror/mode/%N/%N.min' : cmUrl + '/mode/%N/%N.min.js'; + mode = info.mode; + spec = info.mime; + editor.setOption('mode', spec); + CodeMirror.autoLoadMode(editor, mode); + // show MIME:mode in title bar + base.prev().children('.elfinder-dialog-title').append(' (' + spec + (mode != 'null'? ' : ' + mode : '') + ')'); + } + + // editor base node + editorBase = $(editor.getWrapperElement()).css({ + // fix CSS conflict to SimpleMDE + padding: 0, + border: 'none' + }); + ta.data('cm', true); + + // fit height to base + editorBase.height('100%'); + + // TextArea button and Setting button + $('
            ').css('float', 'left') + .append( + $('').html(self.fm.i18n('TextArea')) + .button() + .on('click', function(){ + if (ta.data('cm')) { + ta.removeData('cm'); + editorBase.hide(); + ta.val(editor.getValue()).show().trigger('focus'); + $(this).text('CodeMirror'); + } else { + ta.data('cm', true); + editorBase.show(); + editor.setValue(ta.hide().val()); + editor.refresh(); + editor.focus(); + $(this).html(self.fm.i18n('TextArea')); + } + }) + ) + .prependTo(base.next()); + }; + // load script then start + if (!self.confObj.loader) { + self.confObj.loader = $.Deferred(); + if (useRequire) { + require.config({ + packages: [{ + name: 'codemirror', + location: cmUrl, + main: 'codemirror.min' + }], + map: { + 'codemirror': { + 'codemirror/lib/codemirror': 'codemirror' + } + } + }); + require([ + 'codemirror', + 'codemirror/addon/mode/loadmode.min', + 'codemirror/mode/meta.min' + ], function(CodeMirror) { + self.confObj.loader.resolve(CodeMirror); + }); + } else { + self.fm.loadScript([ + cmUrl + '/codemirror.min.js' + ], function() { + self.fm.loadScript([ + cmUrl + '/addon/mode/loadmode.min.js', + cmUrl + '/mode/meta.min.js' + ], function() { + self.confObj.loader.resolve(CodeMirror); + }); + }, {loadType: 'tag'}); + } + self.fm.loadCss(cmUrl + '/codemirror.css'); + } + self.confObj.loader.done(start); + return dfrd; + }, + close : function(textarea, instance) { + instance && instance.toTextArea(); + }, + save : function(textarea, instance) { + instance && $(textarea).data('cm') && (textarea.value = instance.getValue()); + }, + focus : function(textarea, instance) { + instance && $(textarea).data('cm') && instance.focus(); + }, + resize : function(textarea, instance, e, data) { + instance && instance.refresh(); + } + }, + { + // SimpleMDE + // called on initialization of elFinder cmd edit (this: this editor's config object) + setup : function(opts, fm) { + if (fm.UA.ltIE10 || !fm.options.cdns.simplemde) { + this.disabled = true; + } + }, + info : { + id : 'simplemde', + name : 'SimpleMDE', + iconImg : 'img/editor-icons.png 0 -80' + }, + exts : ['md'], + load : function(textarea) { + var self = this, + fm = this.fm, + base = $(textarea).parent(), + dfrd = $.Deferred(), + cdn = fm.options.cdns.simplemde, + start = function(SimpleMDE) { + var h = base.height(), + delta = base.outerHeight(true) - h + 14, + editor, editorBase, opts; + + // fit height function + textarea._setHeight = function(height) { + var h = height || base.height(), + ctrH = 0, + areaH; + base.children('.editor-toolbar,.editor-statusbar').each(function() { + ctrH += $(this).outerHeight(true); + }); + areaH = h - ctrH - delta; + editorBase.height(areaH); + editor.codemirror.refresh(); + return areaH; + }; + + // set base height + base.height(h); + + opts = { + element: textarea, + autofocus: true + }; + + // trigger event 'editEditorPrepare' + self.trigger('Prepare', { + node: textarea, + editorObj: SimpleMDE, + instance: void(0), + opts: opts + }); + + // make editor + editor = new SimpleMDE(opts); + dfrd.resolve(editor); + + // editor base node + editorBase = $(editor.codemirror.getWrapperElement()); + + // fit height to base + editorBase.css('min-height', '50px') + .children('.CodeMirror-scroll').css('min-height', '50px'); + textarea._setHeight(h); + }; + + // check SimpleMDE & start + if (!self.confObj.loader) { + self.confObj.loader = $.Deferred(); + self.fm.loadCss(cdn+'/simplemde.min.css'); + if (useRequire) { + require([ + cdn+'/simplemde.min.js' + ], function(SimpleMDE) { + self.confObj.loader.resolve(SimpleMDE); + }); + } else { + self.fm.loadScript([cdn+'/simplemde.min.js'], function() { + self.confObj.loader.resolve(SimpleMDE); + }, {loadType: 'tag'}); + } + } + self.confObj.loader.done(start); + + return dfrd; + }, + close : function(textarea, instance) { + instance && instance.toTextArea(); + instance = null; + }, + save : function(textarea, instance) { + instance && (textarea.value = instance.value()); + }, + focus : function(textarea, instance) { + instance && instance.codemirror.focus(); + }, + resize : function(textarea, instance, e, data) { + instance && textarea._setHeight(); + } + }, + { + // CKEditor for html file + info : { + id : 'ckeditor', + name : 'CKEditor', + iconImg : 'img/editor-icons.png 0 0' + }, + exts : ['htm', 'html', 'xhtml'], + setup : function(opts, fm) { + var confObj = this; + if (!fm.options.cdns.ckeditor) { + confObj.disabled = true; + } else { + confObj.ckeOpts = {}; + if (opts.extraOptions) { + confObj.ckeOpts = Object.assign({}, opts.extraOptions.ckeditor || {}); + if (opts.extraOptions.managerUrl) { + confObj.managerUrl = opts.extraOptions.managerUrl; + } + } + } + }, + load : function(textarea) { + var self = this, + fm = this.fm, + dfrd = $.Deferred(), + init = function() { + var base = $(textarea).parent(), + dlg = base.closest('.elfinder-dialog'), + h = base.height(), + reg = /([&?]getfile=)[^&]+/, + loc = self.confObj.managerUrl || window.location.href.replace(/#.*$/, ''), + name = 'ckeditor', + opts; + + // make manager location + if (reg.test(loc)) { + loc = loc.replace(reg, '$1' + name); + } else { + loc += '?getfile=' + name; + } + // set base height + base.height(h); + + // CKEditor configure options + opts = { + startupFocus : true, + fullPage: true, + allowedContent: true, + filebrowserBrowseUrl : loc, + toolbarCanCollapse: true, + toolbarStartupExpanded: !fm.UA.Mobile, + removePlugins: 'resize', + extraPlugins: 'colorbutton,justify,docprops', + on: { + 'instanceReady' : function(e) { + var editor = e.editor; + editor.resize('100%', h); + // re-build on dom move + dlg.one('beforedommove.'+fm.namespace, function() { + editor.destroy(); + }).one('dommove.'+fm.namespace, function() { + self.load(textarea).done(function(editor) { + self.instance = editor; + }); + }); + // return editor instance + dfrd.resolve(e.editor); + } + } + }; + + // trigger event 'editEditorPrepare' + self.trigger('Prepare', { + node: textarea, + editorObj: CKEDITOR, + instance: void(0), + opts: opts + }); + + // CKEditor configure + CKEDITOR.replace(textarea.id, Object.assign(opts, self.confObj.ckeOpts)); + CKEDITOR.on('dialogDefinition', function(e) { + var dlg = e.data.definition.dialog; + dlg.on('show', function(e) { + fm.getUI().append($('.cke_dialog_background_cover')).append(this.getElement().$); + }); + dlg.on('hide', function(e) { + $('body:first').append($('.cke_dialog_background_cover')).append(this.getElement().$); + }); + }); + }; + + if (!self.confObj.loader) { + self.confObj.loader = $.Deferred(); + window.CKEDITOR_BASEPATH = fm.options.cdns.ckeditor + '/'; + $.getScript(fm.options.cdns.ckeditor + '/ckeditor.js', function() { + self.confObj.loader.resolve(); + }); + } + self.confObj.loader.done(init); + return dfrd; + }, + close : function(textarea, instance) { + instance && instance.destroy(); + }, + save : function(textarea, instance) { + instance && (textarea.value = instance.getData()); + }, + focus : function(textarea, instance) { + instance && instance.focus(); + }, + resize : function(textarea, instance, e, data) { + var self; + if (instance) { + if (instance.status === 'ready') { + instance.resize('100%', $(textarea).parent().height()); + } + } + } + }, + { + // CKEditor5 balloon mode for html file + info : { + id : 'ckeditor5', + name : 'CKEditor5', + iconImg : 'img/editor-icons.png 0 -16' + }, + exts : ['htm', 'html', 'xhtml'], + html : '
            ', + setup : function(opts, fm) { + var confObj = this; + // check cdn and ES6 support + if (!fm.options.cdns.ckeditor5 || typeof window.Symbol !== 'function' || typeof Symbol() !== 'symbol') { + confObj.disabled = true; + } else { + confObj.ckeOpts = {}; + if (opts.extraOptions) { + // @deprecated option extraOptions.ckeditor5Mode + if (opts.extraOptions.ckeditor5Mode) { + confObj.ckeditor5Mode = opts.extraOptions.ckeditor5Mode; + } + confObj.ckeOpts = Object.assign({}, opts.extraOptions.ckeditor5 || {}); + if (confObj.ckeOpts.mode) { + confObj.ckeditor5Mode = confObj.ckeOpts.mode; + delete confObj.ckeOpts.mode; + } + if (opts.extraOptions.managerUrl) { + confObj.managerUrl = opts.extraOptions.managerUrl; + } + } + } + fm.bind('destroy', function() { + confObj.editor = null; + }); + }, + // Prepare on before show dialog + prepare : function(base, dialogOpts, file) { + $(base).height(base.editor.fm.getUI().height() - 100); + }, + init : function(id, file, data, fm) { + var m = data.match(/^([\s\S]*]*>)([\s\S]+)(<\/body>[\s\S]*)$/i), + header = '', + body = '', + footer =''; + this.css({ + width: '100%', + height: '100%', + 'box-sizing': 'border-box' + }); + if (m) { + header = m[1]; + body = m[2]; + footer = m[3]; + } else { + body = data; + } + this.data('data', { + header: header, + body: body, + footer: footer + }); + this._setupSelEncoding(data); + }, + load : function(editnode) { + var self = this, + fm = this.fm, + dfrd = $.Deferred(), + mode = self.confObj.ckeditor5Mode || 'decoupled-document', + lang = (function() { + var l = fm.lang.toLowerCase().replace('_', '-'); + if (l.substr(0, 2) === 'zh' && l !== 'zh-cn') { + l = 'zh'; + } + return l; + })(), + init = function(cEditor) { + var base = $(editnode).parent(), + opts; + + // set base height + base.height(fm.getUI().height() - 100); + + // CKEditor5 configure options + opts = Object.assign({ + toolbar: ["heading", "|", "fontSize", "fontFamily", "|", "bold", "italic", "underline", "strikethrough", "highlight", "|", "alignment", "|", "numberedList", "bulletedList", "blockQuote", "indent", "outdent", "|", "ckfinder", "link", "imageUpload", "insertTable", "mediaEmbed", "|", "undo", "redo"], + language: lang + }, self.confObj.ckeOpts); + + // trigger event 'editEditorPrepare' + self.trigger('Prepare', { + node: editnode, + editorObj: cEditor, + instance: void(0), + opts: opts + }); + + cEditor + .create(editnode, opts) + .then(function(editor) { + var ckf = editor.commands.get('ckfinder'), + fileRepo = editor.plugins.get('FileRepository'), + prevVars = {}, isImage, insertImages; + if (editor.ui.view.toolbar && (mode === 'classic' || mode === 'decoupled-document')) { + $(editnode).closest('.elfinder-dialog').children('.ui-widget-header').append($(editor.ui.view.toolbar.element).css({marginRight:'-1em',marginLeft:'-1em'})); + } + if (mode === 'classic') { + $(editnode).closest('.elfinder-edit-editor').css('overflow', 'auto'); + } + // Set up this elFinder instead of CKFinder + if (ckf) { + isImage = function(f) { + return f && f.mime.match(/^image\//i); + }; + insertImages = function(urls) { + var imgCmd = editor.commands.get('imageUpload'); + if (!imgCmd.isEnabled) { + var ntf = editor.plugins.get('Notification'), + i18 = editor.locale.t; + ntf.showWarning(i18('Could not insert image at the current position.'), { + title: i18('Inserting image failed'), + namespace: 'ckfinder' + }); + return; + } + editor.execute('imageInsert', { source: urls }); + }; + // Take over ckfinder execute() + ckf.execute = function() { + var dlg = base.closest('.elfinder-dialog'), + gf = fm.getCommand('getfile'), + rever = function() { + if (prevVars.hasVar) { + dlg.off('resize close', rever); + gf.callback = prevVars.callback; + gf.options.folders = prevVars.folders; + gf.options.multiple = prevVars.multi; + fm.commandMap.open = prevVars.open; + prevVars.hasVar = false; + } + }; + dlg.trigger('togleminimize').one('resize close', rever); + prevVars.callback = gf.callback; + prevVars.folders = gf.options.folders; + prevVars.multi = gf.options.multiple; + prevVars.open = fm.commandMap.open; + prevVars.hasVar = true; + gf.callback = function(files) { + var imgs = []; + if (files.length === 1 && files[0].mime === 'directory') { + fm.one('open', function() { + fm.commandMap.open = 'getfile'; + }).getCommand('open').exec(files[0].hash); + return; + } + fm.getUI('cwd').trigger('unselectall'); + $.each(files, function(i, f) { + if (isImage(f)) { + imgs.push(fm.convAbsUrl(f.url)); + } else { + editor.execute('link', fm.convAbsUrl(f.url)); + } + }); + if (imgs.length) { + insertImages(imgs); + } + dlg.trigger('togleminimize'); + }; + gf.options.folders = true; + gf.options.multiple = true; + fm.commandMap.open = 'getfile'; + fm.toast({ + mode: 'info', + msg: fm.i18n('dblclickToSelect') + }); + }; + } + // Set up image uploader + fileRepo.createUploadAdapter = function(loader) { + return new uploder(loader); + }; + editor.setData($(editnode).data('data').body); + // move .ck-body to elFinder node for fullscreen mode + fm.getUI().append($('body > div.ck-body')); + $('div.ck-balloon-panel').css({ + 'z-index': fm.getMaximizeCss().zIndex + 1 + }); + dfrd.resolve(editor); + /*fm.log({ + defaultConfig: cEditor.defaultConfig, + plugins: cEditor.builtinPlugins.map(function(p) { return p.pluginName; }), + toolbars: Array.from(editor.ui.componentFactory.names()) + });*/ + }) + ['catch'](function(error) { // ['cache'] instead .cache for fix error on ie8 + fm.error(error); + }); + }, + uploder = function(loader) { + var upload = function(file, resolve, reject) { + fm.exec('upload', {files: [file]}, void(0), fm.cwd().hash) + .done(function(data){ + if (data.added && data.added.length) { + fm.url(data.added[0].hash, { async: true }).done(function(url) { + resolve({ + 'default': fm.convAbsUrl(url) + }); + }).fail(function() { + reject('errFileNotFound'); + }); + } else { + reject(fm.i18n(data.error? data.error : 'errUpload')); + } + }) + .fail(function(err) { + var error = fm.parseError(err); + reject(fm.i18n(error? (error === 'userabort'? 'errAbort' : error) : 'errUploadNoFiles')); + }) + .progress(function(data) { + loader.uploadTotal = data.total; + loader.uploaded = data.progress; + }); + }; + this.upload = function() { + return new Promise(function(resolve, reject) { + if (loader.file instanceof Promise || (loader.file && typeof loader.file.then === 'function')) { + loader.file.then(function(file) { + upload(file, resolve, reject); + }); + } else { + upload(loader.file, resolve, reject); + } + }); + }; + this.abort = function() { + fm.getUI().trigger('uploadabort'); + }; + }, loader; + + if (!self.confObj.editor) { + loader = $.Deferred(); + self.fm.loadScript([ + fm.options.cdns.ckeditor5 + '/' + mode + '/ckeditor.js' + ], function(editor) { + if (!editor) { + editor = window.BalloonEditor || window.InlineEditor || window.ClassicEditor || window.DecoupledEditor; + } + if (fm.lang !== 'en') { + self.fm.loadScript([ + fm.options.cdns.ckeditor5 + '/' + mode + '/translations/' + lang + '.js' + ], function(obj) { + loader.resolve(editor); + }, { + tryRequire: true, + loadType: 'tag', + error: function(obj) { + lang = 'en'; + loader.resolve(editor); + } + }); + } else { + loader.resolve(editor); + } + }, { + tryRequire: true, + loadType: 'tag' + }); + loader.done(function(editor) { + self.confObj.editor = editor; + init(editor); + }); + } else { + init(self.confObj.editor); + } + return dfrd; + }, + getContent : function() { + var data = $(this).data('data'); + return data.header + data.body + data.footer; + }, + close : function(editnode, instance) { + instance && instance.destroy(); + }, + save : function(editnode, instance) { + var elm = $(editnode), + data = elm.data('data'); + if (instance) { + data.body = instance.getData(); + elm.data('data', data); + } + }, + focus : function(editnode, instance) { + $(editnode).trigger('focus'); + } + }, + { + // TinyMCE for html file + info : { + id : 'tinymce', + name : 'TinyMCE', + iconImg : 'img/editor-icons.png 0 -64' + }, + exts : ['htm', 'html', 'xhtml'], + setup : function(opts, fm) { + var confObj = this; + if (!fm.options.cdns.tinymce) { + confObj.disabled = true; + } else { + confObj.mceOpts = {}; + if (opts.extraOptions) { + confObj.uploadOpts = Object.assign({}, opts.extraOptions.uploadOpts || {}); + confObj.mceOpts = Object.assign({}, opts.extraOptions.tinymce || {}); + } else { + confObj.uploadOpts = {}; + } + } + }, + load : function(textarea) { + var self = this, + fm = this.fm, + dfrd = $.Deferred(), + init = function() { + var base = $(textarea).show().parent(), + dlg = base.closest('.elfinder-dialog'), + h = base.height(), + delta = base.outerHeight(true) - h, + // hide MCE dialog and modal block + hideMceDlg = function() { + var mceW; + if (tinymce.activeEditor.windowManager.windows) { + mceW = tinymce.activeEditor.windowManager.windows[0]; + mceDlg = $(mceW? mceW.getEl() : void(0)).hide(); + mceCv = $('#mce-modal-block').hide(); + } else { + mceDlg = $('.tox-dialog-wrap').hide(); + } + }, + // Show MCE dialog and modal block + showMceDlg = function() { + mceCv && mceCv.show(); + mceDlg && mceDlg.show(); + }, + tVer = tinymce.majorVersion, + opts, mceDlg, mceCv; + + // set base height + base.height(h); + // fit height function + textarea._setHeight = function(height) { + if (tVer < 5) { + var base = $(this).parent(), + h = height || base.innerHeight(), + ctrH = 0, + areaH; + base.find('.mce-container-body:first').children('.mce-top-part,.mce-statusbar').each(function() { + ctrH += $(this).outerHeight(true); + }); + areaH = h - ctrH - delta; + base.find('.mce-edit-area iframe:first').height(areaH); + } + }; + + // TinyMCE configure options + opts = { + selector: '#' + textarea.id, + resize: false, + plugins: 'print preview fullpage searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern help', + toolbar: 'formatselect | bold italic strikethrough forecolor backcolor | link image media | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat', + image_advtab: true, + init_instance_callback : function(editor) { + // fit height on init + textarea._setHeight(h); + // re-build on dom move + dlg.one('beforedommove.'+fm.namespace, function() { + tinymce.execCommand('mceRemoveEditor', false, textarea.id); + }).one('dommove.'+fm.namespace, function() { + self.load(textarea).done(function(editor) { + self.instance = editor; + }); + }); + // return editor instance + dfrd.resolve(editor); + }, + file_picker_callback : function (callback, value, meta) { + var gf = fm.getCommand('getfile'), + revar = function() { + if (prevVars.hasVar) { + gf.callback = prevVars.callback; + gf.options.folders = prevVars.folders; + gf.options.multiple = prevVars.multi; + fm.commandMap.open = prevVars.open; + prevVars.hasVar = false; + } + dlg.off('resize close', revar); + showMceDlg(); + }, + prevVars = {}; + prevVars.callback = gf.callback; + prevVars.folders = gf.options.folders; + prevVars.multi = gf.options.multiple; + prevVars.open = fm.commandMap.open; + prevVars.hasVar = true; + gf.callback = function(file) { + var url, info; + + if (file.mime === 'directory') { + fm.one('open', function() { + fm.commandMap.open = 'getfile'; + }).getCommand('open').exec(file.hash); + return; + } + + // URL normalization + url = fm.convAbsUrl(file.url); + + // Make file info + info = file.name + ' (' + fm.formatSize(file.size) + ')'; + + // Provide file and text for the link dialog + if (meta.filetype == 'file') { + callback(url, {text: info, title: info}); + } + + // Provide image and alt text for the image dialog + if (meta.filetype == 'image') { + callback(url, {alt: info}); + } + + // Provide alternative source and posted for the media dialog + if (meta.filetype == 'media') { + callback(url); + } + dlg.trigger('togleminimize'); + }; + gf.options.folders = true; + gf.options.multiple = false; + fm.commandMap.open = 'getfile'; + + hideMceDlg(); + dlg.trigger('togleminimize').one('resize close', revar); + fm.toast({ + mode: 'info', + msg: fm.i18n('dblclickToSelect') + }); + + return false; + }, + images_upload_handler : function (blobInfo, success, failure) { + var file = blobInfo.blob(), + err = function(e) { + var dlg = e.data.dialog || {}; + if (dlg.hasClass('elfinder-dialog-error') || dlg.hasClass('elfinder-confirm-upload')) { + hideMceDlg(); + dlg.trigger('togleminimize').one('resize close', revert); + fm.unbind('dialogopened', err); + } + }, + revert = function() { + dlg.off('resize close', revert); + showMceDlg(); + }, + clipdata = true; + + // check file object + if (file.name) { + // file blob of client side file object + clipdata = void(0); + } + fm.bind('dialogopened', err).exec('upload', Object.assign({ + files: [file], + clipdata: clipdata // to get unique name on connector + }, self.confObj.uploadOpts), void(0), fm.cwd().hash).done(function(data) { + if (data.added && data.added.length) { + fm.url(data.added[0].hash, { async: true }).done(function(url) { + showMceDlg(); + success(fm.convAbsUrl(url)); + }).fail(function() { + failure(fm.i18n('errFileNotFound')); + }); + } else { + failure(fm.i18n(data.error? data.error : 'errUpload')); + } + }).fail(function(err) { + var error = fm.parseError(err); + if (error) { + if (error === 'errUnknownCmd') { + error = 'errPerm'; + } else if (error === 'userabort') { + error = 'errAbort'; + } + } + failure(fm.i18n(error? error : 'errUploadNoFiles')); + }); + } + }; + + // TinyMCE 5 supports "height: 100%" + if (tVer >= 5) { + opts.height = '100%'; + } + + // trigger event 'editEditorPrepare' + self.trigger('Prepare', { + node: textarea, + editorObj: tinymce, + instance: void(0), + opts: opts + }); + + // TinyMCE configure + tinymce.init(Object.assign(opts, self.confObj.mceOpts)); + }; + + if (!self.confObj.loader) { + self.confObj.loader = $.Deferred(); + self.fm.loadScript([fm.options.cdns.tinymce + (fm.options.cdns.tinymce.match(/\.js/)? '' : '/tinymce.min.js')], function() { + self.confObj.loader.resolve(); + }, { + loadType: 'tag' + }); + } + self.confObj.loader.done(init); + return dfrd; + }, + close : function(textarea, instance) { + instance && tinymce.execCommand('mceRemoveEditor', false, textarea.id); + }, + save : function(textarea, instance) { + instance && instance.save(); + }, + focus : function(textarea, instance) { + instance && instance.focus(); + }, + resize : function(textarea, instance, e, data) { + // fit height to base node on dialog resize + instance && textarea._setHeight(); + } + }, + { + info : { + id : 'zohoeditor', + name : 'Zoho Editor', + iconImg : 'img/editor-icons.png 0 -32', + cmdCheck : 'ZohoOffice', + preventGet: true, + hideButtons: true, + syncInterval : 15000, + canMakeEmpty: true, + integrate: { + title: 'Zoho Office API', + link: 'https://www.zoho.com/officeapi/' + } + }, + mimes : [ + 'application/msword', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + //'application/pdf', + 'application/vnd.oasis.opendocument.text', + 'application/rtf', + 'text/html', + 'application/vnd.ms-excel', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.sun.xml.calc', + 'text/csv', + 'text/tab-separated-values', + 'application/vnd.ms-powerpoint', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.sun.xml.impress' + ], + html : '', + // setup on elFinder bootup + setup : function(opts, fm) { + if (fm.UA.Mobile || fm.UA.ltIE8) { + this.disabled = true; + } + }, + // Prepare on before show dialog + prepare : function(base, dialogOpts, file) { + var elfNode = base.editor.fm.getUI(); + $(base).height(elfNode.height()); + dialogOpts.width = Math.max(dialogOpts.width || 0, elfNode.width() * 0.8); + }, + // Initialization of editing node (this: this editors HTML node) + init : function(id, file, dum, fm) { + var ta = this, + ifm = $(this).hide(), + uiToast = fm.getUI('toast'), + spnr = $('
            ') + .html('' + fm.i18n('nowLoading') + '') + .appendTo(ifm.parent()), + cdata = function() { + var data = ''; + $.each(fm.customData, function(key, val) { + data += '&' + encodeURIComponent(key) + '=' + encodeURIComponent(val); + }); + return data; + }; + + $(ta).data('xhr', fm.request({ + data: { + cmd: 'editor', + name: ta.editor.confObj.info.cmdCheck, + method: 'init', + 'args[target]': file.hash, + 'args[lang]' : fm.lang, + 'args[cdata]' : cdata() + }, + preventDefault : true + }).done(function(data) { + var opts; + if (data.zohourl) { + opts = { + css: { + height: '100%' + } + }; + // trigger event 'editEditorPrepare' + ta.editor.trigger('Prepare', { + node: ta, + editorObj: void(0), + instance: ifm, + opts: opts + }); + + ifm.attr('src', data.zohourl).show().css(opts.css); + if (data.warning) { + uiToast.appendTo(ta.closest('.ui-dialog')); + fm.toast({ + msg: fm.i18n(data.warning), + mode: 'warning', + timeOut: 0, + onHidden: function() { + uiToast.children().length === 1 && uiToast.appendTo(fm.getUI()); + }, + button: { + text: 'btnYes' + } + }); + } + } else { + data.error && fm.error(data.error); + ta.elfinderdialog('destroy'); + } + }).fail(function(error) { + error && fm.error(error); + ta.elfinderdialog('destroy'); + }).always(function() { + spnr.remove(); + })); + }, + load : function() {}, + getContent : function() {}, + save : function() {}, + // Before dialog close + beforeclose : iframeClose, + // On dialog closed + close : function(ta) { + var fm = this.fm, + xhr = $(ta).data('xhr'); + if (xhr.state() === 'pending') { + xhr.reject(); + } + } + }, + { + // Zip Archive with FlySystem + info : { + id : 'ziparchive', + name : 'btnMount', + iconImg : 'img/toolbar.png 0 -416', + cmdCheck : 'ZipArchive', + edit : function(file, editor) { + var fm = this, + dfrd = $.Deferred(); + fm.request({ + data:{ + cmd: 'netmount', + protocol: 'ziparchive', + host: file.hash, + path: file.phash + }, + preventFail: true, + notify : {type : 'netmount', cnt : 1, hideCnt : true} + }).done(function(data) { + var pdir; + if (data.added && data.added.length) { + if (data.added[0].phash) { + if (pdir = fm.file(data.added[0].phash)) { + if (! pdir.dirs) { + pdir.dirs = 1; + fm.change({ changed: [ pdir ] }); + } + } + } + fm.one('netmountdone', function() { + fm.exec('open', data.added[0].hash); + fm.one('opendone', function() { + data.toast && fm.toast(data.toast); + }); + }); + } + dfrd.resolve(); + }) + .fail(function(error) { + dfrd.reject(error); + }); + return dfrd; + } + }, + mimes : ['application/zip'], + load : function() {}, + save : function(){} + }, + { + // Simple Text (basic textarea editor) + info : { + id : 'textarea', + name : 'TextArea', + useTextAreaEvent : true + }, + load : function(textarea) { + // trigger event 'editEditorPrepare' + this.trigger('Prepare', { + node: textarea, + editorObj: void(0), + instance: void(0), + opts: {} + }); + textarea.setSelectionRange && textarea.setSelectionRange(0, 0); + $(textarea).trigger('focus').show(); + }, + save : function(){} + }, + { + // File converter with online-convert.com + info : { + id : 'onlineconvert', + name : 'Online Convert', + iconImg : 'img/editor-icons.png 0 -144', + cmdCheck : 'OnlineConvert', + preventGet: true, + hideButtons: true, + single: true, + converter: true, + canMakeEmpty: false, + integrate: { + title: 'ONLINE-CONVERT.COM', + link: 'https://online-convert.com' + } + }, + mimes : ['*'], + html : '
            ', + // setup on elFinder bootup + setup : function(opts, fm) { + var mOpts = opts.extraOptions.onlineConvert || {maxSize:100,showLink:true}; + if (mOpts.maxSize) { + this.info.maxSize = mOpts.maxSize * 1048576; + } + this.set = Object.assign({ + url : 'https://%s.online-convert.com%s?external_url=', + conv : { + Archive: {'7Z':{}, 'BZ2':{ext:'bz'}, 'GZ':{}, 'ZIP':{}}, + Audio: {'MP3':{}, 'OGG':{ext:'oga'}, 'WAV':{}, 'WMA':{}, 'AAC':{}, 'AIFF':{ext:'aif'}, 'FLAC':{}, 'M4A':{}, 'MMF':{}, 'OPUS':{ext:'oga'}}, + Document: {'DOC':{}, 'DOCX':{}, 'HTML':{}, 'ODT':{}, 'PDF':{}, 'PPT':{}, 'PPTX':{}, 'RTF':{}, 'SWF':{}, 'TXT':{}}, + eBook: {'AZW3':{ext:'azw'}, 'ePub':{}, 'FB2':{ext:'xml'}, 'LIT':{}, 'LRF':{}, 'MOBI':{}, 'PDB':{}, 'PDF':{},'PDF-eBook':{ext:'pdf'}, 'TCR':{}}, + Hash: {'Adler32':{}, 'Apache-htpasswd':{}, 'Blowfish':{}, 'CRC32':{}, 'CRC32B':{}, 'Gost':{}, 'Haval128':{},'MD4':{}, 'MD5':{}, 'RIPEMD128':{}, 'RIPEMD160':{}, 'SHA1':{}, 'SHA256':{}, 'SHA384':{}, 'SHA512':{}, 'Snefru':{}, 'Std-DES':{}, 'Tiger128':{}, 'Tiger128-calculator':{}, 'Tiger128-converter':{}, 'Tiger160':{}, 'Tiger192':{}, 'Whirlpool':{}}, + Image: {'BMP':{}, 'EPS':{ext:'ai'}, 'GIF':{}, 'EXR':{}, 'ICO':{}, 'JPG':{}, 'PNG':{}, 'SVG':{}, 'TGA':{}, 'TIFF':{ext:'tif'}, 'WBMP':{}, 'WebP':{}}, + Video: {'3G2':{}, '3GP':{}, 'AVI':{}, 'FLV':{}, 'HLS':{ext:'m3u8'}, 'MKV':{}, 'MOV':{}, 'MP4':{}, 'MPEG-1':{ext:'mpeg'}, 'MPEG-2':{ext:'mpeg'}, 'OGG':{ext:'ogv'}, 'OGV':{}, 'WebM':{}, 'WMV':{}, 'Android':{link:'/convert-video-for-%s',ext:'mp4'}, 'Blackberry':{link:'/convert-video-for-%s',ext:'mp4'}, 'DPG':{link:'/convert-video-for-%s',ext:'avi'}, 'iPad':{link:'/convert-video-for-%s',ext:'mp4'}, 'iPhone':{link:'/convert-video-for-%s',ext:'mp4'}, 'iPod':{link:'/convert-video-for-%s',ext:'mp4'}, 'Nintendo-3DS':{link:'/convert-video-for-%s',ext:'avi'}, 'Nintendo-DS':{link:'/convert-video-for-%s',ext:'avi'}, 'PS3':{link:'/convert-video-for-%s',ext:'mp4'}, 'Wii':{link:'/convert-video-for-%s',ext:'avi'}, 'Xbox':{link:'/convert-video-for-%s',ext:'wmv'}} + }, + catExts : { + Hash: 'txt' + }, + link : '', + useTabs : ($.fn.tabs && !fm.UA.iOS)? true : false // Can't work on iOS, I don't know why. + }, mOpts); + }, + // Prepare on before show dialog + prepare : function(base, dialogOpts, file) { + var elfNode = base.editor.fm.getUI(); + $(base).height(elfNode.height()); + dialogOpts.width = Math.max(dialogOpts.width || 0, elfNode.width() * 0.8); + }, + // Initialization of editing node (this: this editors HTML node) + init : function(id, file, dum, fm) { + var ta = this, + confObj = ta.editor.confObj, + set = confObj.set, + uiToast = fm.getUI('toast'), + idxs = {}, + allowZip = fm.uploadMimeCheck('application/zip', file.phash), + selfUrl = $('base').length? document.location.href.replace(/#.*$/, '') : '', + getExt = function(cat, con) { + var c; + if (set.catExts[cat]) { + return set.catExts[cat]; + } + if (set.conv[cat] && (c = set.conv[cat][con])) { + return (c.ext || con).toLowerCase(); + } + return con.toLowerCase(); + }, + setOptions = function(cat, done) { + var type, dfdInit, dfd; + if (typeof confObj.api === 'undefined') { + dfdInit = fm.request({ + data: { + cmd: 'editor', + name: 'OnlineConvert', + method: 'init' + }, + preventDefault : true + }); + } else { + dfdInit = $.Deferred().resolve({api: confObj.api}); + } + cat = cat.toLowerCase(); + dfdInit.done(function(data) { + confObj.api = data.api; + if (confObj.api) { + if (cat) { + type = '?category=' + cat; + } else { + type = ''; + cat = 'all'; + } + if (!confObj.conversions) { + confObj.conversions = {}; + } + if (!confObj.conversions[cat]) { + dfd = $.getJSON('https://api2.online-convert.com/conversions' + type); + } else { + dfd = $.Deferred().resolve(confObj.conversions[cat]); + } + dfd.done(function(d) { + confObj.conversions[cat] = d; + $.each(d, function(i, o) { + btns[set.useTabs? 'children' : 'find']('.onlineconvert-category-' + o.category).children('.onlineconvert-' + o.target).trigger('makeoption', o); + }); + done && done(); + }); + } + }); + }, + btns = (function() { + var btns = $('
            ').on('click', 'button', function() { + var b = $(this), + opts = b.data('opts') || null, + cat = b.closest('.onlineconvert-category').data('cname'), + con = b.data('conv'); + if (confObj.api === true) { + api({ + category: cat, + convert: con, + options: opts + }); + } + }).on('change', function(e) { + var t = $(e.target), + p = t.parent(), + b = t.closest('.elfinder-edit-onlineconvert-button').children('button:first'), + o = b.data('opts') || {}, + v = p.data('type') === 'boolean'? t.is(':checked') : t.val(); + e.stopPropagation(); + if (v) { + if (p.data('type') === 'integer') { + v = parseInt(v); + } + if (p.data('pattern')) { + var reg = new RegExp(p.data('pattern')); + if (!reg.test(v)) { + requestAnimationFrame(function() { + fm.error('"' + fm.escape(v) + '" is not match to "/' + fm.escape(p.data('pattern')) + '/"'); + }); + v = null; + } + } + } + if (v) { + o[t.parent().data('optkey')] = v; + } else { + delete o[p.data('optkey')]; + } + b.data('opts', o); + }), + ul = $('
              '), + oform = function(n, o) { + var f = $('

              ').data('optkey', n).data('type', o.type), + checked = '', + disabled = '', + nozip = false, + opts, btn, elm; + if (o.description) { + f.attr('title', fm.i18n(o.description)); + } + if (o.pattern) { + f.data('pattern', o.pattern); + } + f.append($('').text(fm.i18n(n) + ' : ')); + if (o.type === 'boolean') { + if (o['default'] || (nozip = (n === 'allow_multiple_outputs' && !allowZip))) { + checked = ' checked'; + if (nozip) { + disabled = ' disabled'; + } + btn = this.children('button:first'); + opts = btn.data('opts') || {}; + opts[n] = true; + btn.data('opts', opts); + } + f.append($('')); + } else if (o['enum']){ + elm = $('').append($('').text('Select...')); + $.each(o['enum'], function(i, v) { + elm.append($('').text(v)); + }); + f.append(elm); + } else { + f.append($('')); + } + return f; + }, + makeOption = function(o) { + var elm = this, + b = $('').on('click', function() { + f.toggle(); + }), + f = $('
              ').hide(); + if (o.options) { + $.each(o.options, function(k, v) { + k !== 'download_password' && f.append(oform.call(elm, k, v)); + }); + } + elm.append(b, f); + }, + ts = (+new Date()), + i = 0; + + if (!confObj.ext2mime) { + confObj.ext2mime = Object.assign(fm.arrayFlip(fm.mimeTypes), ext2mime); + } + $.each(set.conv, function(t, c) { + var cname = t.toLowerCase(), + id = 'elfinder-edit-onlineconvert-' + cname + ts, + type = $('
              ').data('cname', t), + cext; + $.each(c, function(n, o) { + var nl = n.toLowerCase(), + ext = getExt(t, n); + if (!confObj.ext2mime[ext]) { + if (cname === 'audio' || cname === 'image' || cname === 'video') { + confObj.ext2mime[ext] = cname + '/x-' + nl; + } else { + confObj.ext2mime[ext] = 'application/octet-stream'; + } + } + if (fm.uploadMimeCheck(confObj.ext2mime[ext], file.phash)) { + type.append($('
              ').on('makeoption', function(e, data) { + var elm = $(this); + if (!elm.children('.elfinder-button-icon-preference').length) { + makeOption.call(elm, data); + } + }).append($('').text(n).data('conv', n))); + } + }); + if (type.children().length) { + ul.append($('
            • ').append($('').attr('href', selfUrl + '#' + id).text(t))); + btns.append(type); + idxs[cname] = i++; + } + }); + if (set.useTabs) { + btns.prepend(ul).tabs({ + beforeActivate: function(e, ui) { + setOptions(ui.newPanel.data('cname')); + } + }); + } else { + $.each(set.conv, function(t) { + var tl = t.toLowerCase(); + btns.append($('
              ').append($('').text(t)).append(btns.children('.onlineconvert-category-' + tl))); + }); + } + return btns; + })(), + select = $(this) + .append( + btns, + (set.showLink? $(set.link) : null) + ), + spnr = $('
              ') + .hide() + .html('' + fm.i18n('nowLoading') + '') + .appendTo(select.parent()), + prog = $('
              ').appendTo(spnr), + _url = null, + url = function() { + var onetime; + if (_url) { + return $.Deferred().resolve(_url); + } else { + spnr.show(); + return fm.forExternalUrl(file.hash, { progressBar: prog }).done(function(url) { + _url = url; + }).fail(function(error) { + error && fm.error(error); + ta.elfinderdialog('destroy'); + }).always(function() { + spnr.hide(); + }); + } + }, + api = function(opts) { + $(ta).data('dfrd', url().done(function(url) { + select.fadeOut(); + setStatus({info: 'Start conversion request.'}); + fm.request({ + data: { + cmd: 'editor', + name: 'OnlineConvert', + method: 'api', + 'args[category]' : opts.category.toLowerCase(), + 'args[convert]' : opts.convert.toLowerCase(), + 'args[options]' : JSON.stringify(opts.options), + 'args[source]' : fm.convAbsUrl(url), + 'args[filename]' : fm.splitFileExtention(file.name)[0] + '.' + getExt(opts.category, opts.convert), + 'args[mime]' : file.mime + }, + preventDefault : true + }).done(function(data) { + checkRes(data.apires, opts.category, opts.convert); + }).fail(function(error) { + error && fm.error(error); + ta.elfinderdialog('destroy'); + }); + })); + }, + checkRes = function(res, cat, con) { + var status, err = []; + if (res && res.id) { + status = res.status; + if (status.code === 'failed') { + spnr.hide(); + if (res.errors && res.errors.length) { + $.each(res.errors, function(i, o) { + o.message && err.push(o.message); + }); + } + fm.error(err.length? err : status.info); + select.fadeIn(); + } else if (status.code === 'completed') { + upload(res); + } else { + setStatus(status); + setTimeout(function() { + polling(res.id); + }, 1000); + } + } else { + uiToast.appendTo(ta.closest('.ui-dialog')); + if (res.message) { + fm.toast({ + msg: fm.i18n(res.message), + mode: 'error', + timeOut: 5000, + onHidden: function() { + uiToast.children().length === 1 && uiToast.appendTo(fm.getUI()); + } + }); + } + fm.toast({ + msg: fm.i18n('editorConvNoApi'), + mode: 'error', + timeOut: 3000, + onHidden: function() { + uiToast.children().length === 1 && uiToast.appendTo(fm.getUI()); + } + }); + spnr.hide(); + select.show(); + } + }, + setStatus = function(status) { + spnr.show().children('.elfinder-spinner-text').text(status.info); + }, + polling = function(jobid) { + fm.request({ + data: { + cmd: 'editor', + name: 'OnlineConvert', + method: 'api', + 'args[jobid]': jobid + }, + preventDefault : true + }).done(function(data) { + checkRes(data.apires); + }).fail(function(error) { + error && fm.error(error); + ta.elfinderdialog('destroy'); + }); + }, + upload = function(res) { + var output = res.output, + id = res.id, + url = ''; + spnr.hide(); + if (output && output.length) { + ta.elfinderdialog('destroy'); + $.each(output, function(i, o) { + if (o.uri) { + url += o.uri + '\n'; + } + }); + fm.upload({ + target: file.phash, + files: [url], + type: 'text', + extraData: { + contentSaveId: 'OnlineConvert-' + res.id + } + }); + } + }, + mode = 'document', + cl, m; + select.parent().css({overflow: 'auto'}).addClass('overflow-scrolling-touch'); + if (m = file.mime.match(/^(audio|image|video)/)) { + mode = m[1]; + } + if (set.useTabs) { + if (idxs[mode]) { + btns.tabs('option', 'active', idxs[mode]); + } + } else { + cl = Object.keys(set.conv).length; + $.each(set.conv, function(t) { + if (t.toLowerCase() === mode) { + setOptions(t, function() { + $.each(set.conv, function(t0) { + t0.toLowerCase() !== mode && setOptions(t0); + }); + }); + return false; + } + cl--; + }); + if (!cl) { + $.each(set.conv, function(t) { + setOptions(t); + }); + } + select.parent().scrollTop(btns.children('.onlineconvert-fieldset-' + mode).offset().top); + } + }, + load : function() {}, + getContent : function() {}, + save : function() {}, + // On dialog closed + close : function(ta) { + var fm = this.fm, + dfrd = $(ta).data('dfrd'); + if (dfrd && dfrd.state() === 'pending') { + dfrd.reject(); + } + } + } + ]; +}, window.elFinder)); diff --git a/public/packages/barryvdh/elfinder/js/extras/editors.default.min.js b/public/packages/barryvdh/elfinder/js/extras/editors.default.min.js new file mode 100644 index 00000000..f573d3b8 --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/extras/editors.default.min.js @@ -0,0 +1,2 @@ +!function(e,t){if("function"==typeof define&&define.amd)define(["elfinder"],e);else if(t){var i=t.prototype._options.commandsOptions.edit.editors;t.prototype._options.commandsOptions.edit.editors=i.concat(e(t))}}(function(e){"use strict";var t,i=window.location.search.match(/getfile=([a-z]+)/),n=e.prototype.hasRequire,o={bmp:"image/x-ms-bmp",dng:"image/x-adobe-dng",gif:"image/gif",jpeg:"image/jpeg",jpg:"image/jpeg",pdf:"application/pdf",png:"image/png",ppm:"image/x-portable-pixmap",psd:"image/vnd.adobe.photoshop",pxd:"image/x-pixlr-data",svg:"image/svg+xml",tiff:"image/tiff",webp:"image/webp",xcf:"image/x-xcf",sketch:"application/x-sketch",ico:"image/x-icon",dds:"image/vnd-ms.dds",emf:"application/x-msmetafile"},a=function(e,i,n){t||(t=i.arrayFlip(o));var a=t[e]||i.mimeTypes[e];return n?"jpg"===a&&(a="jpeg"):"jpeg"===a&&(a="jpg"),a},r=function(e,t){var i=$.Deferred();try{var n=document.createElement("canvas"),o=n.getContext("2d"),a=new Image,r=function(){var e,o,a=n.toDataURL(t);e=(o=a.match(/^data:([a-z0-9]+\/[a-z0-9.+-]+)/i))?o[1]:"",e.toLowerCase()===t.toLowerCase()?i.resolve(n.toDataURL(t),n):i.reject()};return a.src=e,$(a).on("load",function(){try{n.width=a.width,n.height=a.height,o.drawImage(a,0,0),r()}catch(e){i.reject()}}).on("error",function(){i.reject()}),i}catch(s){return i.reject()}},s=function(e,t,i,n){var o,r=$(this).children("img:first").data("ext",a(t.mime,n)),s=$('
              ').html(''+n.i18n("ntfloadimg")+'').hide().appendTo(this),d=function(){r.attr("id",e+"-img").attr("src",o||i).css({height:"","max-width":"100%","max-height":"100%",cursor:"pointer"}).data("loading",function(e){var t=r.closest(".elfinder-dialog").find("button,.elfinder-titlebar-button");return t.prop("disabled",!e)[e?"removeClass":"addClass"]("ui-state-disabled"),r.css("opacity",e?"":"0.3"),s[e?"hide":"show"](),r})};i.match(/^data:/)?d():n.openUrl(t.hash,!1,function(e){o=e,r.attr("_src",i),d()})},d=function(e,t){var i,n,o,a=e.attr("style");try{e.attr("style",""),i=e.get(0),n=document.createElement("canvas"),n.width=i.width,n.height=i.height,e.attr("style",a),n.getContext("2d").drawImage(i,0,0),o=n.toDataURL(t)}catch(r){o=e.attr("src")}return o},c=function(e){var t,i=$(e),n=$.Deferred().always(function(){i.off("load",r)}),o="about:blank",a=function(){t=setTimeout(function(){var e;try{e=base.contentWindow.location.href}catch(t){e=null}e===o?n.resolve():--s>0?a():n.reject()},500)},r=function(){t&&clearTimeout(t),n.resolve()},s=20;return i.one("load",r),e.src=o,a(),n};return i&&(i=i[1],"ckeditor"===i&&(e.prototype._options.getFileCallback=function(e,t){window.opener.CKEDITOR.tools.callFunction(function(){var e=new RegExp("(?:[?&]|&)CKEditorFuncNum=([^&]+)","i"),t=window.location.search.match(e);return t&&t.length>1?t[1]:""}(),t.convAbsUrl(e.url)),t.destroy(),window.close()})),[{info:{id:"tuiimgedit",name:"TUI Image Editor",iconImg:"img/editor-icons.png 0 -48",dataScheme:!0,schemeContent:!0,openMaximized:!0,canMakeEmpty:!1,integrate:{title:"TOAST UI Image Editor",link:"http://ui.toast.com/tui-image-editor/"}},mimes:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],html:'
              ',setup:function(e,t){t.UA.ltIE8||t.UA.Mobile?this.disabled=!0:(this.opts=Object.assign({version:"v3.15.3"},e.extraOptions.tuiImgEditOpts||{},{iconsPath:t.baseUrl+"img/tui-",theme:{}}),t.isSameOrigin(this.opts.iconsPath)||(this.disabled=!0,t.debug("warning","Setting `commandOptions.edit.extraOptions.tuiImgEditOpts.iconsPath` MUST follow the same origin policy.")))},init:function(e,t,i,n){this.data("url",i)},load:function(e){var t,i=this,n=this.fm,o=$.Deferred(),a=n.options.cdns,r=i.confObj.opts.version,s=function(t){var a,r,s,d,c,l=$(e),p=l.parent(),m=i.confObj.opts,f=(m.iconsPath,$('
              ').appendTo(p)),u=[$('
              ').appendTo(f),$('
              ').appendTo(f)],g=new t(e,{includeUI:{loadImage:{path:l.data("url"),name:i.file.name},theme:m.theme,initMenu:"filter",menuBarPosition:"bottom"},cssMaxWidth:Math.max(300,p.width()),cssMaxHeight:Math.max(200,p.height()-(u[0].height()+u[1].height()+3)),usageStatistics:!1}),h=l.find("canvas:first").get(0),v=function(e){if("undefined"!=typeof e){var t,i,n,o=$(h),r=parseInt(o.attr("width")),s=parseInt(o.attr("height")),d=r/s;0===e?(i=r,n=s):(i=parseInt(o.css("max-width"))+Number(e),n=i/d,i>r&&n>s&&(i=r,n=s)),t=Math.round(i/r*100),t<100?(g.resetZoom(),g.stopDrawingMode(),a.hide()):a.show(),y.text(t+"%"),g.resizeCanvasDimension({width:i,height:n}),c&&setTimeout(function(){c&&v(e)},50)}},b=$('').data("val",10),x=$('').data("val",-10),y=$("").css("width","4em").text("%").attr("title","100%").data("val",0);f.remove(),l.removeData("url").data("mime",i.file.mime),"image/jpeg"===i.file.mime?(l.data("quality",n.storage("jpgQuality")||n.option("jpgQuality")),r=$('').attr("min","1").attr("max","100").attr("title","1 - 100").on("change",function(){var e=r.val();l.data("quality",e),s&&cancelAnimationFrame(s),s=requestAnimationFrame(function(){h.toBlob(function(e){e&&r.next("span").text(" ("+n.formatSize(e.size)+")")},"image/jpeg",Math.max(Math.min(e,100),1)/100)})}).val(l.data("quality")),$('
              ').append($("").html(n.i18n("quality")+" : "),r,$("")).prependTo(l.parent().next())):"image/svg+xml"===i.file.mime&&l.closest(".ui-dialog").trigger("changeType",{extention:"png",mime:"image/png",keepEditor:!0}),$('
              ').append(x,y,b).attr("title",n.i18n("scale")).on("click","span,button",function(){v($(this).data("val"))}).on("mousedown mouseup mouseleave","span",function(e){c=!1,d&&clearTimeout(d),"mousedown"===e.type&&(d=setTimeout(function(){c=!0,v($(e.target).data("val"))},500))}).prependTo(l.parent().next()),setTimeout(function(){o.resolve(g),r&&(r.trigger("change"),g.on("redoStackChanged undoStackChanged",function(){r.trigger("change")})),a=l.find(".tie-btn-zoomIn,.tie-btn-zoomOut,.tie-btn-hand"),v(null)},100),l.find(".tui-colorpicker-palette-container").on("click",".tui-colorpicker-palette-preview",function(){$(this).closest(".color-picker-control").height("auto").find(".tui-colorpicker-slider-container").toggle()}),l.on("click",function(){l.find(".tui-colorpicker-slider-container").hide()})};return i.confObj.editor?s(i.confObj.editor):(t=$.Deferred(),n.loadCss([a.tui+"/tui-color-picker/latest/tui-color-picker.css",a.tui+"/tui-image-editor/"+r+"/tui-image-editor.css"]),n.hasRequire?(require.config({paths:{"fabric/dist/fabric.require":a.fabric+"/fabric.require.min",fabric:a.fabric+"/fabric.min","tui-code-snippet":a.tui+"/tui.code-snippet/latest/tui-code-snippet.min","tui-color-picker":a.tui+"/tui-color-picker/latest/tui-color-picker.min","tui-image-editor":a.tui+"/tui-image-editor/"+r+"/tui-image-editor.min"}}),require(["tui-image-editor"],function(e){t.resolve(e)})):n.loadScript([a.fabric+"/fabric.min.js",a.tui+"/tui.code-snippet/latest/tui-code-snippet.min.js"],function(){n.loadScript([a.tui+"/tui-color-picker/latest/tui-color-picker.min.js"],function(){n.loadScript([a.tui+"/tui-image-editor/"+r+"/tui-image-editor.min.js"],function(){t.resolve(window.tui.ImageEditor)},{loadType:"tag"})},{loadType:"tag"})},{loadType:"tag"}),t.done(function(e){i.confObj.editor=e,s(e)})),o},getContent:function(e){var t=this.editor,i=t.fm,n=$(e),o=n.data("quality");if(t.instance)return"image/jpeg"===n.data("mime")&&(o=o||i.storage("jpgQuality")||i.option("jpgQuality"),o=Math.max(.1,Math.min(1,o/100))),t.instance.toDataURL({format:a(n.data("mime"),i,!0),quality:o})},save:function(e){var t,i=$(e),n=i.data("quality"),o=i.data("hash");this.instance.deactivateAll(),"undefined"!=typeof n&&this.fm.storage("jpgQuality",n),o&&(t=this.fm.file(o),i.data("mime",t.mime))}},{info:{id:"photopea",name:"Photopea",iconImg:"img/editor-icons.png 0 -160",single:!0,noContent:!0,arrayBufferContent:!0,openMaximized:!0,canMakeEmpty:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp","image/tiff","image/webp","image/vnd.adobe.photoshop","application/pdf","image/x-portable-pixmap","image/x-sketch","image/x-icon","image/vnd-ms.dds"],integrate:{title:"Photopea",link:"https://www.photopea.com/learn/"}},mimes:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp","image/tiff","image/x-adobe-dng","image/webp","image/x-xcf","image/vnd.adobe.photoshop","application/pdf","image/x-portable-pixmap","image/x-sketch","image/x-icon","image/vnd-ms.dds","application/x-msmetafile"],html:'',setup:function(e,t){(t.UA.IE||t.UA.Mobile)&&(this.disabled=!0)},init:function(e,t,i,n){var r,s,d,c="https://www.photopea.com",l=$(this).hide().on("load",function(){l.show()}).on("error",function(){f.remove(),l.show()}),p=this.editor,m=p.confObj,f=$('
              ').html(''+n.i18n("nowLoading")+'').appendTo(l.parent()),u=n.arrayFlip(m.info.canMakeEmpty),g=function(e){var t=a(e,n),i=o[t];return m.mimesFlip[i]?"jpeg"===t&&(t="jpg"):t="",t&&u[i]||(t="psd",i=o[t],l.closest(".ui-dialog").trigger("changeType",{extention:t,mime:i,keepEditor:!0})),t},h=t.mime;m.mimesFlip||(m.mimesFlip=n.arrayFlip(m.mimes,!0)),m.liveMsg||(m.liveMsg=function(e,t,i){var o,a=e.get(0).contentWindow,r=0,s=null,d=$.Deferred().done(function(){t.remove(),r=1,a.postMessage(s,c)});this.load=function(){return n.getContents(i.hash,"arraybuffer").done(function(e){s=e})},this.receive=function(t){var i=t.originalEvent;i.origin===c&&i.source===a&&("done"===i.data?0===r?d.resolve():1===r?(r=2,e.trigger("contentsloaded")):o&&"pending"===o.state()&&o.reject("errDataEmpty"):"Save"===i.data?p.doSave():o&&"pending"===o.state()&&("object"==typeof i.data?o.resolve("data:"+h+";base64,"+n.arrayBufferToBase64(i.data)):o.reject("errDataEmpty")))},this.getContent=function(){var t,i;if(r>1)return o&&"pending"===o.state()&&o.reject(),o=null,o=$.Deferred(),2===r?(r=3,o.resolve("data:"+h+";base64,"+n.arrayBufferToBase64(s)),s=null,o):(e.data("mime")&&(h=e.data("mime"),t=g(h)),(i=e.data("quality"))&&(t+=":"+i/100),a.postMessage('app.activeDocument.saveToOE("'+t+'")',c),o)}}),l.parent().css("padding",0),s=g(t.mime),r=p.liveMsg=new m.liveMsg(l,f,t),$(window).on("message."+n.namespace,r.receive),r.load().done(function(){var e=JSON.stringify({files:[],environment:{lang:n.lang.replace(/_/g,"-"),customIO:{save:'app.echoToOE("Save");'}}});l.attr("src",c+"/#"+encodeURI(e))}).fail(function(e){e&&n.error(e),p.initFail=!0}),"image/jpeg"!==t.mime&&"image/webp"!==t.mime||(l.data("quality",n.storage("jpgQuality")||n.option("jpgQuality")),d=$('').attr("min","1").attr("max","100").attr("title","1 - 100").on("change",function(){var e=d.val();l.data("quality",e)}).val(l.data("quality")),$('
              ').append($("").html(n.i18n("quality")+" : "),d,$("")).prependTo(l.parent().next()))},load:function(e){var t=$.Deferred(),i=this,n=(this.fm,$(e));return i.initFail?t.reject():n.on("contentsloaded",function(){t.resolve(i.liveMsg)}),t},getContent:function(){return this.editor.liveMsg?this.editor.liveMsg.getContent():void 0},save:function(e,t){var i,n=$(e),o=n.data("quality"),a=n.data("hash");"undefined"!=typeof o&&this.fm.storage("jpgQuality",o),a?(i=this.fm.file(a),n.data("mime",i.mime)):n.removeData("mime")},close:function(e,t){$(e).attr("src",""),t&&$(window).off("message."+this.fm.namespace,t.receive)}},{info:{id:"pixo",name:"Pixo Editor",iconImg:"img/editor-icons.png 0 -208",dataScheme:!0,schemeContent:!0,single:!0,canMakeEmpty:!1,integrate:{title:"Pixo Editor",link:"https://pixoeditor.com/privacy-policy/"}},mimes:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],html:'
              ',setup:function(e,t){!t.UA.ltIE8&&e.extraOptions&&e.extraOptions.pixo&&e.extraOptions.pixo.apikey?this.editorOpts=e.extraOptions.pixo:this.disabled=!0},init:function(e,t,i,n){s.call(this,e,t,i,n)},getContent:function(){return $(this).children("img:first").attr("src")},load:function(e){var t,i,n,o,s,d=this,c=this.fm,l=$(e),p=l.children("img:first"),m=l.closest(".ui-dialog"),f=c.getUI(),u=$.Deferred(),g=$("#elfinder-pixo-container"),h=function(n){var h;g.length?g.appendTo(g.parent()):(g=$('
              ').css({position:"fixed",top:0,right:0,width:"100%",height:$(window).height(),overflow:"hidden"}).hide().appendTo(f.hasClass("elfinder-fullscreen")?f:"body"),f.on("resize."+c.namespace,function(e,t){e.preventDefault(),e.stopPropagation(),t&&t.fullscreen&&g.appendTo("on"===t.fullscreen?f:"body")}),c.bind("destroy",function(){s&&s.cancelEditing(),g.remove()})),p.on("click",v),h=Object.assign({type:"child",parent:g.get(0),output:{format:"png"},onSave:function(n){var s=n.toBlob().type,l=a(s,c),f=function(e){p.one("load error",function(){p.data("loading")&&p.data("loading")(!0)}).attr("crossorigin","anonymous").attr("src",e)},u=n.toDataURL();p.data("loading")(),delete e._canvas,p.data("ext")!==l?r(u,d.file.mime).done(function(n,a){a&&(e._canvas=o=a,i.trigger("change"),t&&t.show()),f(n)}).fail(function(){m.trigger("changeType",{extention:l,mime:s}),f(u)}):f(u)},onClose:function(){m.removeClass(c.res("class","preventback")),c.toggleMaximize(g,!1),g.hide(),c.toFront(m)}},d.confObj.editorOpts),d.trigger("Prepare",{node:e,editorObj:Pixo,instance:void 0,opts:h}),s=new Pixo.Bridge(h),u.resolve(s),l.on("saveAsFail",v),n&&n()},v=function(){m.addClass(c.res("class","preventback")),c.toggleMaximize(g,!0),c.toFront(g),g.show().data("curhash",d.file.hash),s.edit(p.get(0)),p.data("loading")(!0)};return p.data("loading")(),"image/jpeg"===d.file.mime&&(i=$('').attr("min","1").attr("max","100").attr("title","1 - 100").on("change",function(){var e=i.val();n&&cancelAnimationFrame(n),n=requestAnimationFrame(function(){o&&o.toBlob(function(e){e&&i.next("span").text(" ("+c.formatSize(e.size)+")")},"image/jpeg",Math.max(Math.min(e,100),1)/100)})}).val(c.storage("jpgQuality")||c.option("jpgQuality")),t=$('
              ').hide().append($("").html(c.i18n("quality")+" : "),i,$("")).prependTo(l.parent().next()),l.data("quty",i)),"undefined"==typeof Pixo?c.loadScript(["https://pixoeditor.com:8443/editor/scripts/bridge.m.js"],function(){h(v)},{loadType:"tag"}):(h(),v()),u},save:function(e){var t,i=this,n=$(e),o=n.children("img:first");e._canvas?(n.data("quty")&&(t=n.data("quty").val(),t&&this.fm.storage("jpgQuality",t)),o.attr("src",e._canvas.toDataURL(i.file.mime,t?Math.max(Math.min(t,100),1)/100:void 0))):"data:"!==o.attr("src").substr(0,5)&&o.attr("src",d(o,this.file.mime))},close:function(e,t){t&&t.destroy()}},{setup:function(e,t){!t.UA.ltIE8&&t.options.cdns.ace||(this.disabled=!0)},info:{id:"aceeditor",name:"ACE Editor",iconImg:"img/editor-icons.png 0 -96"},load:function(e){var t=this,i=this.fm,n=$.Deferred(),o=i.options.cdns.ace,a=function(){var i,a,r,s=$(e),d=s.parent(),c=d.parent(),l=e.id+"_ace",p=(t.file.name.replace(/^.+\.([^.]+)|(.+)$/,"$1$2").toLowerCase(),{"text/x-php":"php","application/x-php":"php","text/html":"html","application/xhtml+xml":"html","text/javascript":"javascript","application/javascript":"javascript","text/css":"css","text/x-c":"c_cpp","text/x-csrc":"c_cpp","text/x-chdr":"c_cpp","text/x-c++":"c_cpp","text/x-c++src":"c_cpp","text/x-c++hdr":"c_cpp","text/x-shellscript":"sh","application/x-csh":"sh","text/x-python":"python","text/x-java":"java","text/x-java-source":"java","text/x-ruby":"ruby","text/x-perl":"perl","application/x-perl":"perl","text/x-sql":"sql","text/xml":"xml","application/docbook+xml":"xml","application/xml":"xml"});d.height(d.height()),ace.config.set("basePath",o),a=$('
              ').text(s.val()).insertBefore(s.hide()),s.data("ace",!0),i=ace.edit(l),i.$blockScrolling=1/0,i.setOptions({theme:"ace/theme/monokai",fontSize:"14px",wrap:!0}),ace.config.loadModule("ace/ext/modelist",function(){r=ace.require("ace/ext/modelist").getModeForPath("/"+t.file.name).name,"text"===r&&p[t.file.mime]&&(r=p[t.file.mime]),d.prev().children(".elfinder-dialog-title").append(" ("+t.file.mime+" : "+r.split(/[\/\\]/).pop()+")"),i.setOptions({mode:"ace/mode/"+r}),"resolved"===n.state()&&c.trigger("resize")}),ace.config.loadModule("ace/ext/language_tools",function(){ace.require("ace/ext/language_tools"),i.setOptions({enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!1})}),ace.config.loadModule("ace/ext/settings_menu",function(){ace.require("ace/ext/settings_menu").init(i)}),i.commands.addCommand({name:"saveFile",bindKey:{win:"Ctrl-s",mac:"Command-s"},exec:function(e){t.doSave()}}),i.commands.addCommand({name:"closeEditor",bindKey:{win:"Ctrl-w|Ctrl-q",mac:"Command-w|Command-q"},exec:function(e){t.doCancel()}}),i.resize(),$('
              ').css("float","left").append($("").html(t.fm.i18n("TextArea")).button().on("click",function(){s.data("ace")?(s.removeData("ace"),a.hide(),s.val(i.session.getValue()).show().trigger("focus"),$(this).text("AceEditor")):(s.data("ace",!0),a.show(),i.setValue(s.hide().val(),-1),i.focus(),$(this).html(t.fm.i18n("TextArea")))})).append($("").button({icons:{primary:"ui-icon-gear",secondary:"ui-icon-triangle-1-e"},text:!1}).on("click",function(){i.showSettingsMenu(),$("#ace_settingsmenu").css("font-size","80%").find('div[contains="setOptions"]').hide().end().parent().appendTo($("#elfinder"))})).prependTo(d.next()),t.trigger("Prepare",{node:e,editorObj:ace,instance:i,opts:{}}),n.resolve(i)};return t.confObj.loader||(t.confObj.loader=$.Deferred(),t.fm.loadScript([o+"/ace.js"],function(){t.confObj.loader.resolve()},void 0,{obj:window,name:"ace"})),t.confObj.loader.done(a),n},close:function(e,t){t&&t.destroy()},save:function(e,t){t&&$(e).data("ace")&&(e.value=t.session.getValue())},focus:function(e,t){t&&$(e).data("ace")&&t.focus()},resize:function(e,t,i,n){t&&t.resize()}},{setup:function(e,t){!t.UA.ltIE10&&t.options.cdns.codemirror||(this.disabled=!0)},info:{id:"codemirror",name:"CodeMirror",iconImg:"img/editor-icons.png 0 -176"},load:function(e){var t=this.fm,i=t.convAbsUrl(t.options.cdns.codemirror),o=$.Deferred(),a=this,r=function(t){var r,s,d,c=$(e),l=c.parent();l.height(l.height()),d={lineNumbers:!0,lineWrapping:!0,extraKeys:{"Ctrl-S":function(){a.doSave()},"Ctrl-Q":function(){a.doCancel()},"Ctrl-W":function(){a.doCancel()}}},a.trigger("Prepare",{node:e,editorObj:t,instance:void 0,opts:d}),r=t.fromTextArea(e,d),o.resolve(r);var p,m,f,u;p||(p=t.findModeByMIME(a.file.mime)),!p&&(m=a.file.name.match(/.+\.([^.]+)$/))&&(p=t.findModeByExtension(m[1])),p&&(t.modeURL=n?"codemirror/mode/%N/%N.min":i+"/mode/%N/%N.min.js",f=p.mode,u=p.mime,r.setOption("mode",u),t.autoLoadMode(r,f),l.prev().children(".elfinder-dialog-title").append(" ("+u+("null"!=f?" : "+f:"")+")")),s=$(r.getWrapperElement()).css({padding:0,border:"none"}),c.data("cm",!0),s.height("100%"),$('
              ').css("float","left").append($("").html(a.fm.i18n("TextArea")).button().on("click",function(){c.data("cm")?(c.removeData("cm"),s.hide(),c.val(r.getValue()).show().trigger("focus"),$(this).text("CodeMirror")):(c.data("cm",!0),s.show(),r.setValue(c.hide().val()),r.refresh(),r.focus(),$(this).html(a.fm.i18n("TextArea")))})).prependTo(l.next())};return a.confObj.loader||(a.confObj.loader=$.Deferred(),n?(require.config({packages:[{name:"codemirror",location:i,main:"codemirror.min"}],map:{codemirror:{"codemirror/lib/codemirror":"codemirror"}}}),require(["codemirror","codemirror/addon/mode/loadmode.min","codemirror/mode/meta.min"],function(e){a.confObj.loader.resolve(e)})):a.fm.loadScript([i+"/codemirror.min.js"],function(){a.fm.loadScript([i+"/addon/mode/loadmode.min.js",i+"/mode/meta.min.js"],function(){a.confObj.loader.resolve(CodeMirror)})},{loadType:"tag"}),a.fm.loadCss(i+"/codemirror.css")),a.confObj.loader.done(r),o},close:function(e,t){t&&t.toTextArea()},save:function(e,t){t&&$(e).data("cm")&&(e.value=t.getValue())},focus:function(e,t){t&&$(e).data("cm")&&t.focus()},resize:function(e,t,i,n){t&&t.refresh()}},{setup:function(e,t){!t.UA.ltIE10&&t.options.cdns.simplemde||(this.disabled=!0)},info:{id:"simplemde",name:"SimpleMDE",iconImg:"img/editor-icons.png 0 -80"},exts:["md"],load:function(e){var t=this,i=this.fm,o=$(e).parent(),a=$.Deferred(),r=i.options.cdns.simplemde,s=function(i){var n,r,s,d=o.height(),c=o.outerHeight(!0)-d+14;e._setHeight=function(e){var t,i=e||o.height(),a=0;return o.children(".editor-toolbar,.editor-statusbar").each(function(){a+=$(this).outerHeight(!0)}),t=i-a-c,r.height(t),n.codemirror.refresh(),t},o.height(d),s={element:e,autofocus:!0},t.trigger("Prepare",{node:e,editorObj:i,instance:void 0,opts:s}),n=new i(s),a.resolve(n),r=$(n.codemirror.getWrapperElement()),r.css("min-height","50px").children(".CodeMirror-scroll").css("min-height","50px"),e._setHeight(d)};return t.confObj.loader||(t.confObj.loader=$.Deferred(),t.fm.loadCss(r+"/simplemde.min.css"),n?require([r+"/simplemde.min.js"],function(e){t.confObj.loader.resolve(e)}):t.fm.loadScript([r+"/simplemde.min.js"],function(){t.confObj.loader.resolve(SimpleMDE)},{loadType:"tag"})),t.confObj.loader.done(s),a},close:function(e,t){t&&t.toTextArea(),t=null},save:function(e,t){t&&(e.value=t.value())},focus:function(e,t){t&&t.codemirror.focus()},resize:function(e,t,i,n){t&&e._setHeight()}},{info:{id:"ckeditor",name:"CKEditor",iconImg:"img/editor-icons.png 0 0"},exts:["htm","html","xhtml"],setup:function(e,t){var i=this;t.options.cdns.ckeditor?(i.ckeOpts={},e.extraOptions&&(i.ckeOpts=Object.assign({},e.extraOptions.ckeditor||{}),e.extraOptions.managerUrl&&(i.managerUrl=e.extraOptions.managerUrl))):i.disabled=!0},load:function(e){var t=this,i=this.fm,n=$.Deferred(),o=function(){var o,a=$(e).parent(),r=a.closest(".elfinder-dialog"),s=a.height(),d=/([&?]getfile=)[^&]+/,c=t.confObj.managerUrl||window.location.href.replace(/#.*$/,""),l="ckeditor";d.test(c)?c=c.replace(d,"$1"+l):c+="?getfile="+l,a.height(s),o={startupFocus:!0,fullPage:!0,allowedContent:!0,filebrowserBrowseUrl:c,toolbarCanCollapse:!0,toolbarStartupExpanded:!i.UA.Mobile,removePlugins:"resize",extraPlugins:"colorbutton,justify,docprops",on:{instanceReady:function(o){var a=o.editor;a.resize("100%",s),r.one("beforedommove."+i.namespace,function(){a.destroy()}).one("dommove."+i.namespace,function(){t.load(e).done(function(e){t.instance=e})}),n.resolve(o.editor)}}},t.trigger("Prepare",{node:e,editorObj:CKEDITOR,instance:void 0,opts:o}),CKEDITOR.replace(e.id,Object.assign(o,t.confObj.ckeOpts)),CKEDITOR.on("dialogDefinition",function(e){var t=e.data.definition.dialog;t.on("show",function(e){i.getUI().append($(".cke_dialog_background_cover")).append(this.getElement().$)}),t.on("hide",function(e){$("body:first").append($(".cke_dialog_background_cover")).append(this.getElement().$)})})};return t.confObj.loader||(t.confObj.loader=$.Deferred(),window.CKEDITOR_BASEPATH=i.options.cdns.ckeditor+"/",$.getScript(i.options.cdns.ckeditor+"/ckeditor.js",function(){t.confObj.loader.resolve()})),t.confObj.loader.done(o),n},close:function(e,t){t&&t.destroy()},save:function(e,t){t&&(e.value=t.getData())},focus:function(e,t){t&&t.focus()},resize:function(e,t,i,n){t&&"ready"===t.status&&t.resize("100%",$(e).parent().height())}},{info:{id:"ckeditor5",name:"CKEditor5",iconImg:"img/editor-icons.png 0 -16"},exts:["htm","html","xhtml"],html:'
              ',setup:function(e,t){var i=this;t.options.cdns.ckeditor5&&"function"==typeof window.Symbol&&"symbol"==typeof Symbol()?(i.ckeOpts={},e.extraOptions&&(e.extraOptions.ckeditor5Mode&&(i.ckeditor5Mode=e.extraOptions.ckeditor5Mode),i.ckeOpts=Object.assign({},e.extraOptions.ckeditor5||{}),i.ckeOpts.mode&&(i.ckeditor5Mode=i.ckeOpts.mode,delete i.ckeOpts.mode),e.extraOptions.managerUrl&&(i.managerUrl=e.extraOptions.managerUrl))):i.disabled=!0,t.bind("destroy",function(){i.editor=null})},prepare:function(e,t,i){$(e).height(e.editor.fm.getUI().height()-100)},init:function(e,t,i,n){var o=i.match(/^([\s\S]*]*>)([\s\S]+)(<\/body>[\s\S]*)$/i),a="",r="",s="";this.css({width:"100%",height:"100%","box-sizing":"border-box"}),o?(a=o[1],r=o[2],s=o[3]):r=i,this.data("data",{header:a,body:r,footer:s}),this._setupSelEncoding(i)},load:function(e){var t,i=this,n=this.fm,o=$.Deferred(),a=i.confObj.ckeditor5Mode||"decoupled-document",r=function(){var e=n.lang.toLowerCase().replace("_","-");return"zh"===e.substr(0,2)&&"zh-cn"!==e&&(e="zh"),e}(),s=function(t){var s,c=$(e).parent();c.height(n.getUI().height()-100),s=Object.assign({toolbar:["heading","|","fontSize","fontFamily","|","bold","italic","underline","strikethrough","highlight","|","alignment","|","numberedList","bulletedList","blockQuote","indent","outdent","|","ckfinder","link","imageUpload","insertTable","mediaEmbed","|","undo","redo"],language:r},i.confObj.ckeOpts),i.trigger("Prepare",{node:e,editorObj:t,instance:void 0,opts:s}),t.create(e,s).then(function(t){var i,r,s=t.commands.get("ckfinder"),l=t.plugins.get("FileRepository"),p={};!t.ui.view.toolbar||"classic"!==a&&"decoupled-document"!==a||$(e).closest(".elfinder-dialog").children(".ui-widget-header").append($(t.ui.view.toolbar.element).css({marginRight:"-1em",marginLeft:"-1em"})),"classic"===a&&$(e).closest(".elfinder-edit-editor").css("overflow","auto"),s&&(i=function(e){return e&&e.mime.match(/^image\//i)},r=function(e){var i=t.commands.get("imageUpload");if(!i.isEnabled){var n=t.plugins.get("Notification"),o=t.locale.t;return void n.showWarning(o("Could not insert image at the current position."),{title:o("Inserting image failed"),namespace:"ckfinder"})}t.execute("imageInsert",{source:e})},s.execute=function(){var e=c.closest(".elfinder-dialog"),o=n.getCommand("getfile"),a=function(){p.hasVar&&(e.off("resize close",a),o.callback=p.callback,o.options.folders=p.folders,o.options.multiple=p.multi,n.commandMap.open=p.open,p.hasVar=!1)};e.trigger("togleminimize").one("resize close",a),p.callback=o.callback,p.folders=o.options.folders,p.multi=o.options.multiple,p.open=n.commandMap.open,p.hasVar=!0,o.callback=function(o){var a=[];return 1===o.length&&"directory"===o[0].mime?void n.one("open",function(){n.commandMap.open="getfile"}).getCommand("open").exec(o[0].hash):(n.getUI("cwd").trigger("unselectall"),$.each(o,function(e,o){i(o)?a.push(n.convAbsUrl(o.url)):t.execute("link",n.convAbsUrl(o.url))}),a.length&&r(a),void e.trigger("togleminimize"))},o.options.folders=!0,o.options.multiple=!0,n.commandMap.open="getfile",n.toast({mode:"info",msg:n.i18n("dblclickToSelect")})}),l.createUploadAdapter=function(e){return new d(e)},t.setData($(e).data("data").body),n.getUI().append($("body > div.ck-body")),$("div.ck-balloon-panel").css({"z-index":n.getMaximizeCss().zIndex+1}),o.resolve(t)})["catch"](function(e){n.error(e)})},d=function(e){var t=function(t,i,o){n.exec("upload",{files:[t]},void 0,n.cwd().hash).done(function(e){e.added&&e.added.length?n.url(e.added[0].hash,{async:!0}).done(function(e){i({"default":n.convAbsUrl(e)})}).fail(function(){o("errFileNotFound")}):o(n.i18n(e.error?e.error:"errUpload"))}).fail(function(e){var t=n.parseError(e);o(n.i18n(t?"userabort"===t?"errAbort":t:"errUploadNoFiles"))}).progress(function(t){e.uploadTotal=t.total,e.uploaded=t.progress})};this.upload=function(){return new Promise(function(i,n){e.file instanceof Promise||e.file&&"function"==typeof e.file.then?e.file.then(function(e){t(e,i,n)}):t(e.file,i,n)})},this.abort=function(){n.getUI().trigger("uploadabort")}};return i.confObj.editor?s(i.confObj.editor):(t=$.Deferred(),i.fm.loadScript([n.options.cdns.ckeditor5+"/"+a+"/ckeditor.js"],function(e){e||(e=window.BalloonEditor||window.InlineEditor||window.ClassicEditor||window.DecoupledEditor),"en"!==n.lang?i.fm.loadScript([n.options.cdns.ckeditor5+"/"+a+"/translations/"+r+".js"],function(i){t.resolve(e)},{tryRequire:!0,loadType:"tag",error:function(i){r="en",t.resolve(e)}}):t.resolve(e)},{tryRequire:!0,loadType:"tag"}),t.done(function(e){i.confObj.editor=e,s(e)})),o},getContent:function(){var e=$(this).data("data");return e.header+e.body+e.footer},close:function(e,t){t&&t.destroy()},save:function(e,t){var i=$(e),n=i.data("data");t&&(n.body=t.getData(),i.data("data",n))},focus:function(e,t){$(e).trigger("focus")}},{info:{id:"tinymce",name:"TinyMCE",iconImg:"img/editor-icons.png 0 -64"},exts:["htm","html","xhtml"],setup:function(e,t){var i=this;t.options.cdns.tinymce?(i.mceOpts={},e.extraOptions?(i.uploadOpts=Object.assign({},e.extraOptions.uploadOpts||{}),i.mceOpts=Object.assign({},e.extraOptions.tinymce||{})):i.uploadOpts={}):i.disabled=!0},load:function(e){var t=this,i=this.fm,n=$.Deferred(),o=function(){var o,a,r,s=$(e).show().parent(),d=s.closest(".elfinder-dialog"),c=s.height(),l=s.outerHeight(!0)-c,p=function(){var e;tinymce.activeEditor.windowManager.windows?(e=tinymce.activeEditor.windowManager.windows[0],a=$(e?e.getEl():void 0).hide(),r=$("#mce-modal-block").hide()):a=$(".tox-dialog-wrap").hide()},m=function(){r&&r.show(),a&&a.show()},f=tinymce.majorVersion;s.height(c),e._setHeight=function(e){if(f<5){var t,i=$(this).parent(),n=e||i.innerHeight(),o=0;i.find(".mce-container-body:first").children(".mce-top-part,.mce-statusbar").each(function(){o+=$(this).outerHeight(!0)}),t=n-o-l,i.find(".mce-edit-area iframe:first").height(t)}},o={selector:"#"+e.id,resize:!1,plugins:"print preview fullpage searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern help",toolbar:"formatselect | bold italic strikethrough forecolor backcolor | link image media | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat",image_advtab:!0,init_instance_callback:function(o){e._setHeight(c),d.one("beforedommove."+i.namespace,function(){tinymce.execCommand("mceRemoveEditor",!1,e.id)}).one("dommove."+i.namespace,function(){t.load(e).done(function(e){t.instance=e})}),n.resolve(o)},file_picker_callback:function(e,t,n){var o=i.getCommand("getfile"),a=function(){r.hasVar&&(o.callback=r.callback,o.options.folders=r.folders,o.options.multiple=r.multi,i.commandMap.open=r.open,r.hasVar=!1),d.off("resize close",a),m()},r={};return r.callback=o.callback,r.folders=o.options.folders,r.multi=o.options.multiple,r.open=i.commandMap.open,r.hasVar=!0,o.callback=function(t){var o,a;return"directory"===t.mime?void i.one("open",function(){i.commandMap.open="getfile"}).getCommand("open").exec(t.hash):(o=i.convAbsUrl(t.url),a=t.name+" ("+i.formatSize(t.size)+")","file"==n.filetype&&e(o,{text:a,title:a}),"image"==n.filetype&&e(o,{alt:a}),"media"==n.filetype&&e(o),void d.trigger("togleminimize"))},o.options.folders=!0,o.options.multiple=!1,i.commandMap.open="getfile",p(),d.trigger("togleminimize").one("resize close",a),i.toast({mode:"info",msg:i.i18n("dblclickToSelect")}),!1},images_upload_handler:function(e,n,o){var a=e.blob(),r=function(e){var t=e.data.dialog||{};(t.hasClass("elfinder-dialog-error")||t.hasClass("elfinder-confirm-upload"))&&(p(),t.trigger("togleminimize").one("resize close",s), +i.unbind("dialogopened",r))},s=function(){d.off("resize close",s),m()},c=!0;a.name&&(c=void 0),i.bind("dialogopened",r).exec("upload",Object.assign({files:[a],clipdata:c},t.confObj.uploadOpts),void 0,i.cwd().hash).done(function(e){e.added&&e.added.length?i.url(e.added[0].hash,{async:!0}).done(function(e){m(),n(i.convAbsUrl(e))}).fail(function(){o(i.i18n("errFileNotFound"))}):o(i.i18n(e.error?e.error:"errUpload"))}).fail(function(e){var t=i.parseError(e);t&&("errUnknownCmd"===t?t="errPerm":"userabort"===t&&(t="errAbort")),o(i.i18n(t?t:"errUploadNoFiles"))})}},f>=5&&(o.height="100%"),t.trigger("Prepare",{node:e,editorObj:tinymce,instance:void 0,opts:o}),tinymce.init(Object.assign(o,t.confObj.mceOpts))};return t.confObj.loader||(t.confObj.loader=$.Deferred(),t.fm.loadScript([i.options.cdns.tinymce+(i.options.cdns.tinymce.match(/\.js/)?"":"/tinymce.min.js")],function(){t.confObj.loader.resolve()},{loadType:"tag"})),t.confObj.loader.done(o),n},close:function(e,t){t&&tinymce.execCommand("mceRemoveEditor",!1,e.id)},save:function(e,t){t&&t.save()},focus:function(e,t){t&&t.focus()},resize:function(e,t,i,n){t&&e._setHeight()}},{info:{id:"zohoeditor",name:"Zoho Editor",iconImg:"img/editor-icons.png 0 -32",cmdCheck:"ZohoOffice",preventGet:!0,hideButtons:!0,syncInterval:15e3,canMakeEmpty:!0,integrate:{title:"Zoho Office API",link:"https://www.zoho.com/officeapi/"}},mimes:["application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.oasis.opendocument.text","application/rtf","text/html","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.oasis.opendocument.spreadsheet","application/vnd.sun.xml.calc","text/csv","text/tab-separated-values","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/vnd.oasis.opendocument.presentation","application/vnd.sun.xml.impress"],html:'',setup:function(e,t){(t.UA.Mobile||t.UA.ltIE8)&&(this.disabled=!0)},prepare:function(e,t,i){var n=e.editor.fm.getUI();$(e).height(n.height()),t.width=Math.max(t.width||0,.8*n.width())},init:function(e,t,i,n){var o=this,a=$(this).hide(),r=n.getUI("toast"),s=$('
              ').html(''+n.i18n("nowLoading")+'').appendTo(a.parent()),d=function(){var e="";return $.each(n.customData,function(t,i){e+="&"+encodeURIComponent(t)+"="+encodeURIComponent(i)}),e};$(o).data("xhr",n.request({data:{cmd:"editor",name:o.editor.confObj.info.cmdCheck,method:"init","args[target]":t.hash,"args[lang]":n.lang,"args[cdata]":d()},preventDefault:!0}).done(function(e){var t;e.zohourl?(t={css:{height:"100%"}},o.editor.trigger("Prepare",{node:o,editorObj:void 0,instance:a,opts:t}),a.attr("src",e.zohourl).show().css(t.css),e.warning&&(r.appendTo(o.closest(".ui-dialog")),n.toast({msg:n.i18n(e.warning),mode:"warning",timeOut:0,onHidden:function(){1===r.children().length&&r.appendTo(n.getUI())},button:{text:"btnYes"}}))):(e.error&&n.error(e.error),o.elfinderdialog("destroy"))}).fail(function(e){e&&n.error(e),o.elfinderdialog("destroy")}).always(function(){s.remove()}))},load:function(){},getContent:function(){},save:function(){},beforeclose:c,close:function(e){var t=(this.fm,$(e).data("xhr"));"pending"===t.state()&&t.reject()}},{info:{id:"ziparchive",name:"btnMount",iconImg:"img/toolbar.png 0 -416",cmdCheck:"ZipArchive",edit:function(e,t){var i=this,n=$.Deferred();return i.request({data:{cmd:"netmount",protocol:"ziparchive",host:e.hash,path:e.phash},preventFail:!0,notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){var t;e.added&&e.added.length&&(e.added[0].phash&&(t=i.file(e.added[0].phash))&&(t.dirs||(t.dirs=1,i.change({changed:[t]}))),i.one("netmountdone",function(){i.exec("open",e.added[0].hash),i.one("opendone",function(){e.toast&&i.toast(e.toast)})})),n.resolve()}).fail(function(e){n.reject(e)}),n}},mimes:["application/zip"],load:function(){},save:function(){}},{info:{id:"textarea",name:"TextArea",useTextAreaEvent:!0},load:function(e){this.trigger("Prepare",{node:e,editorObj:void 0,instance:void 0,opts:{}}),e.setSelectionRange&&e.setSelectionRange(0,0),$(e).trigger("focus").show()},save:function(){}},{info:{id:"onlineconvert",name:"Online Convert",iconImg:"img/editor-icons.png 0 -144",cmdCheck:"OnlineConvert",preventGet:!0,hideButtons:!0,single:!0,converter:!0,canMakeEmpty:!1,integrate:{title:"ONLINE-CONVERT.COM",link:"https://online-convert.com"}},mimes:["*"],html:'
              ',setup:function(e,t){var i=e.extraOptions.onlineConvert||{maxSize:100,showLink:!0};i.maxSize&&(this.info.maxSize=1048576*i.maxSize),this.set=Object.assign({url:"https://%s.online-convert.com%s?external_url=",conv:{Archive:{"7Z":{},BZ2:{ext:"bz"},GZ:{},ZIP:{}},Audio:{MP3:{},OGG:{ext:"oga"},WAV:{},WMA:{},AAC:{},AIFF:{ext:"aif"},FLAC:{},M4A:{},MMF:{},OPUS:{ext:"oga"}},Document:{DOC:{},DOCX:{},HTML:{},ODT:{},PDF:{},PPT:{},PPTX:{},RTF:{},SWF:{},TXT:{}},eBook:{AZW3:{ext:"azw"},ePub:{},FB2:{ext:"xml"},LIT:{},LRF:{},MOBI:{},PDB:{},PDF:{},"PDF-eBook":{ext:"pdf"},TCR:{}},Hash:{Adler32:{},"Apache-htpasswd":{},Blowfish:{},CRC32:{},CRC32B:{},Gost:{},Haval128:{},MD4:{},MD5:{},RIPEMD128:{},RIPEMD160:{},SHA1:{},SHA256:{},SHA384:{},SHA512:{},Snefru:{},"Std-DES":{},Tiger128:{},"Tiger128-calculator":{},"Tiger128-converter":{},Tiger160:{},Tiger192:{},Whirlpool:{}},Image:{BMP:{},EPS:{ext:"ai"},GIF:{},EXR:{},ICO:{},JPG:{},PNG:{},SVG:{},TGA:{},TIFF:{ext:"tif"},WBMP:{},WebP:{}},Video:{"3G2":{},"3GP":{},AVI:{},FLV:{},HLS:{ext:"m3u8"},MKV:{},MOV:{},MP4:{},"MPEG-1":{ext:"mpeg"},"MPEG-2":{ext:"mpeg"},OGG:{ext:"ogv"},OGV:{},WebM:{},WMV:{},Android:{link:"/convert-video-for-%s",ext:"mp4"},Blackberry:{link:"/convert-video-for-%s",ext:"mp4"},DPG:{link:"/convert-video-for-%s",ext:"avi"},iPad:{link:"/convert-video-for-%s",ext:"mp4"},iPhone:{link:"/convert-video-for-%s",ext:"mp4"},iPod:{link:"/convert-video-for-%s",ext:"mp4"},"Nintendo-3DS":{link:"/convert-video-for-%s",ext:"avi"},"Nintendo-DS":{link:"/convert-video-for-%s",ext:"avi"},PS3:{link:"/convert-video-for-%s",ext:"mp4"},Wii:{link:"/convert-video-for-%s",ext:"avi"},Xbox:{link:"/convert-video-for-%s",ext:"wmv"}}},catExts:{Hash:"txt"},link:'',useTabs:!(!$.fn.tabs||t.UA.iOS)},i)},prepare:function(e,t,i){var n=e.editor.fm.getUI();$(e).height(n.height()),t.width=Math.max(t.width||0,.8*n.width())},init:function(e,t,i,n){var a,r,s=this,d=s.editor.confObj,c=d.set,l=n.getUI("toast"),p={},m=n.uploadMimeCheck("application/zip",t.phash),f=$("base").length?document.location.href.replace(/#.*$/,""):"",u=function(e,t){var i;return c.catExts[e]?c.catExts[e]:c.conv[e]&&(i=c.conv[e][t])?(i.ext||t).toLowerCase():t.toLowerCase()},g=function(e,t){var i,o,a;o="undefined"==typeof d.api?n.request({data:{cmd:"editor",name:"OnlineConvert",method:"init"},preventDefault:!0}):$.Deferred().resolve({api:d.api}),e=e.toLowerCase(),o.done(function(n){d.api=n.api,d.api&&(e?i="?category="+e:(i="",e="all"),d.conversions||(d.conversions={}),a=d.conversions[e]?$.Deferred().resolve(d.conversions[e]):$.getJSON("https://api2.online-convert.com/conversions"+i),a.done(function(i){d.conversions[e]=i,$.each(i,function(e,t){h[c.useTabs?"children":"find"](".onlineconvert-category-"+t.category).children(".onlineconvert-"+t.target).trigger("makeoption",t)}),t&&t()}))})},h=function(){var e=$("
              ").on("click","button",function(){var e=$(this),t=e.data("opts")||null,i=e.closest(".onlineconvert-category").data("cname"),n=e.data("conv");d.api===!0&&k({category:i,convert:n,options:t})}).on("change",function(e){var t=$(e.target),i=t.parent(),o=t.closest(".elfinder-edit-onlineconvert-button").children("button:first"),a=o.data("opts")||{},r="boolean"===i.data("type")?t.is(":checked"):t.val();if(e.stopPropagation(),r&&("integer"===i.data("type")&&(r=parseInt(r)),i.data("pattern"))){var s=new RegExp(i.data("pattern"));s.test(r)||(requestAnimationFrame(function(){n.error('"'+n.escape(r)+'" is not match to "/'+n.escape(i.data("pattern"))+'/"')}),r=null)}r?a[t.parent().data("optkey")]=r:delete a[i.data("optkey")],o.data("opts",a)}),i=$("
                "),a=function(e,t){var i,o,a,r=$("

                ").data("optkey",e).data("type",t.type),s="",d="",c=!1;return t.description&&r.attr("title",n.i18n(t.description)),t.pattern&&r.data("pattern",t.pattern),r.append($("").text(n.i18n(e)+" : ")),"boolean"===t.type?((t["default"]||(c="allow_multiple_outputs"===e&&!m))&&(s=" checked",c&&(d=" disabled"),o=this.children("button:first"),i=o.data("opts")||{},i[e]=!0,o.data("opts",i)),r.append($('"))):t["enum"]?(a=$("").append($('').text("Select...")),$.each(t["enum"],function(e,t){a.append($('').text(t))}),r.append(a)):r.append($('')),r},r=function(e){var t=this,i=$('').on("click",function(){n.toggle()}),n=$('
                ').hide();e.options&&$.each(e.options,function(e,i){"download_password"!==e&&n.append(a.call(t,e,i))}),t.append(i,n)},s=+new Date,l=0;return d.ext2mime||(d.ext2mime=Object.assign(n.arrayFlip(n.mimeTypes),o)),$.each(c.conv,function(o,a){var c=o.toLowerCase(),m="elfinder-edit-onlineconvert-"+c+s,g=$('
                ').data("cname",o);$.each(a,function(e,i){var a=e.toLowerCase(),s=u(o,e);d.ext2mime[s]||("audio"===c||"image"===c||"video"===c?d.ext2mime[s]=c+"/x-"+a:d.ext2mime[s]="application/octet-stream"),n.uploadMimeCheck(d.ext2mime[s],t.phash)&&g.append($('
                ').on("makeoption",function(e,t){var i=$(this);i.children(".elfinder-button-icon-preference").length||r.call(i,t)}).append($("").text(e).data("conv",e)))}),g.children().length&&(i.append($("
              • ").append($("").attr("href",f+"#"+m).text(o))),e.append(g),p[c]=l++)}),c.useTabs?e.prepend(i).tabs({beforeActivate:function(e,t){g(t.newPanel.data("cname"))}}):$.each(c.conv,function(t){var i=t.toLowerCase();e.append($('
                ').append($("").text(t)).append(e.children(".onlineconvert-category-"+i)))}),e}(),v=$(this).append(h,c.showLink?$(c.link):null),b=$('
                ').hide().html(''+n.i18n("nowLoading")+'').appendTo(v.parent()),x=$('
                ').appendTo(b),y=null,w=function(){return y?$.Deferred().resolve(y):(b.show(),n.forExternalUrl(t.hash,{progressBar:x}).done(function(e){y=e}).fail(function(e){e&&n.error(e),s.elfinderdialog("destroy")}).always(function(){b.hide()}))},k=function(e){$(s).data("dfrd",w().done(function(i){v.fadeOut(),j({info:"Start conversion request."}),n.request({data:{cmd:"editor",name:"OnlineConvert",method:"api","args[category]":e.category.toLowerCase(),"args[convert]":e.convert.toLowerCase(),"args[options]":JSON.stringify(e.options),"args[source]":n.convAbsUrl(i),"args[filename]":n.splitFileExtention(t.name)[0]+"."+u(e.category,e.convert),"args[mime]":t.mime},preventDefault:!0}).done(function(t){O(t.apires,e.category,e.convert)}).fail(function(e){e&&n.error(e),s.elfinderdialog("destroy")})}))},O=function(e,t,i){var o,a=[];e&&e.id?(o=e.status,"failed"===o.code?(b.hide(),e.errors&&e.errors.length&&$.each(e.errors,function(e,t){t.message&&a.push(t.message)}),n.error(a.length?a:o.info),v.fadeIn()):"completed"===o.code?M(e):(j(o),setTimeout(function(){C(e.id)},1e3))):(l.appendTo(s.closest(".ui-dialog")),e.message&&n.toast({msg:n.i18n(e.message),mode:"error",timeOut:5e3,onHidden:function(){1===l.children().length&&l.appendTo(n.getUI())}}),n.toast({msg:n.i18n("editorConvNoApi"),mode:"error",timeOut:3e3,onHidden:function(){1===l.children().length&&l.appendTo(n.getUI())}}),b.hide(),v.show())},j=function(e){b.show().children(".elfinder-spinner-text").text(e.info)},C=function(e){n.request({data:{cmd:"editor",name:"OnlineConvert",method:"api","args[jobid]":e},preventDefault:!0}).done(function(e){O(e.apires)}).fail(function(e){e&&n.error(e),s.elfinderdialog("destroy")})},M=function(e){var i=e.output,o=(e.id,"");b.hide(),i&&i.length&&(s.elfinderdialog("destroy"),$.each(i,function(e,t){t.uri&&(o+=t.uri+"\n")}),n.upload({target:t.phash,files:[o],type:"text",extraData:{contentSaveId:"OnlineConvert-"+e.id}}))},T="document";v.parent().css({overflow:"auto"}).addClass("overflow-scrolling-touch"),(r=t.mime.match(/^(audio|image|video)/))&&(T=r[1]),c.useTabs?p[T]&&h.tabs("option","active",p[T]):(a=Object.keys(c.conv).length,$.each(c.conv,function(e){return e.toLowerCase()===T?(g(e,function(){$.each(c.conv,function(e){e.toLowerCase()!==T&&g(e)})}),!1):void a--}),a||$.each(c.conv,function(e){g(e)}),v.parent().scrollTop(h.children(".onlineconvert-fieldset-"+T).offset().top))},load:function(){},getContent:function(){},save:function(){},close:function(e){var t=(this.fm,$(e).data("dfrd"));t&&"pending"===t.state()&&t.reject()}}]},window.elFinder); \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/js/extras/quicklook.googledocs.js b/public/packages/barryvdh/elfinder/js/extras/quicklook.googledocs.js new file mode 100644 index 00000000..a22e837e --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/extras/quicklook.googledocs.js @@ -0,0 +1,75 @@ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define(['elfinder'], factory); + } else if (typeof exports !== 'undefined') { + module.exports = factory(require('elfinder')); + } else { + factory(root.elFinder); + } +}(this, function(elFinder) { +"use strict"; +try { + if (! elFinder.prototype.commands.quicklook.plugins) { + elFinder.prototype.commands.quicklook.plugins = []; + } + elFinder.prototype.commands.quicklook.plugins.push(function(ql) { + var fm = ql.fm, + preview = ql.preview; + + preview.on('update', function(e) { + var win = ql.window, + file = e.file, node, loading; + + if (file.mime.indexOf('application/vnd.google-apps.') === 0) { + if (file.url == '1') { + preview.hide(); + $('
                ').appendTo(ql.info.find('.elfinder-quicklook-info')) + .on('click', function() { + $(this).html(''); + fm.request({ + data : {cmd : 'url', target : file.hash}, + preventDefault : true + }) + .always(function() { + preview.show(); + $(this).html(''); + }) + .done(function(data) { + var rfile = fm.file(file.hash); + ql.value.url = rfile.url = data.url || ''; + if (ql.value.url) { + preview.trigger($.Event('update', {file : ql.value})); + } + }); + }); + } + if (file.url !== '' && file.url != '1') { + e.stopImmediatePropagation(); + + loading = $('
                '+fm.i18n('nowLoading')+'
                ').appendTo(ql.info.find('.elfinder-quicklook-info')); + + node = $('') + .css('background-color', 'transparent') + .on('load', function() { + ql.hideinfo(); + loading.remove(); + node.css('background-color', '#fff'); + }) + .on('error', function() { + loading.remove(); + node.remove(); + }) + .appendTo(preview) + .attr('src', fm.url(file.hash)); + + preview.one('change', function() { + loading.remove(); + node.off('load').remove(); + }); + } + } + + }); + }); +} catch(e) {} +})); diff --git a/public/packages/barryvdh/elfinder/js/extras/quicklook.googledocs.min.js b/public/packages/barryvdh/elfinder/js/extras/quicklook.googledocs.min.js new file mode 100644 index 00000000..3c33cb6b --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/extras/quicklook.googledocs.min.js @@ -0,0 +1 @@ +!function(e,n){"function"==typeof define&&define.amd?define(["elfinder"],n):"undefined"!=typeof exports?module.exports=n(require("elfinder")):n(e.elFinder)}(this,function(e){"use strict";try{e.prototype.commands.quicklook.plugins||(e.prototype.commands.quicklook.plugins=[]),e.prototype.commands.quicklook.plugins.push(function(e){var n=e.fm,o=e.preview;o.on("update",function(i){var r,a,t=(e.window,i.file);0===t.mime.indexOf("application/vnd.google-apps.")&&("1"==t.url&&(o.hide(),$('
                ").appendTo(e.info.find(".elfinder-quicklook-info")).on("click",function(){$(this).html(''),n.request({data:{cmd:"url",target:t.hash},preventDefault:!0}).always(function(){o.show(),$(this).html("")}).done(function(i){var r=n.file(t.hash);e.value.url=r.url=i.url||"",e.value.url&&o.trigger($.Event("update",{file:e.value}))})})),""!==t.url&&"1"!=t.url&&(i.stopImmediatePropagation(),a=$('
                '+n.i18n("nowLoading")+'
                ').appendTo(e.info.find(".elfinder-quicklook-info")),r=$('').css("background-color","transparent").on("load",function(){e.hideinfo(),a.remove(),r.css("background-color","#fff")}).on("error",function(){a.remove(),r.remove()}).appendTo(o).attr("src",n.url(t.hash)),o.one("change",function(){a.remove(),r.off("load").remove()})))})})}catch(n){}}); \ No newline at end of file diff --git a/public/packages/barryvdh/elfinder/js/i18n/elfinder.LANG.js b/public/packages/barryvdh/elfinder/js/i18n/elfinder.LANG.js new file mode 100644 index 00000000..34482ef1 --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/i18n/elfinder.LANG.js @@ -0,0 +1,587 @@ +/** + * elFinder translation template + * use this file to create new translation + * submit new translation via https://github.com/Studio-42/elFinder/issues + * or make a pull request + */ + +/** + * XXXXX translation + * @author Translator Name + * @version 201x-xx-xx + */ +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define(['elfinder'], factory); + } else if (typeof exports !== 'undefined') { + module.exports = factory(require('elfinder')); + } else { + factory(root.elFinder); + } +}(this, function(elFinder) { + elFinder.prototype.i18.REPLACE_WITH_xx_OR_xx_YY_LANG_CODE = { + translator : 'Translator name <translator@email.tld>', + language : 'Language of translation in your language', + direction : 'ltr', + dateFormat : 'M d, Y h:i A', // will show like: Mar 13, 2012 05:27 PM + fancyDateFormat : '$1 h:i A', // will show like: Today 12:25 PM + nonameDateFormat : 'ymd-His', // noname upload will show like: 120513-172700 + messages : { + + /********************************** errors **********************************/ + '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' : 'Item named "$1" already exists.', + 'errInvName' : 'Invalid file name.', + 'errInvDirname' : 'Invalid folder name.', // from v2.1.24 added 12.4.2017 + '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.', // from v2.1 added 03.10.2015 + 'errUpload' : 'Upload error.', // old name - errUploadCommon + 'errUploadFile' : 'Unable to upload "$1".', // old name - errUpload + 'errUploadNoFiles' : 'No files found for upload.', + 'errUploadTotalSize' : 'Data exceeds the maximum allowed size.', // old name - errMaxSize + 'errUploadFileSize' : 'File exceeds maximum allowed size.', // old name - errFileMaxSize + 'errUploadMime' : 'File type not allowed.', + 'errUploadTransfer' : '"$1" transfer error.', + 'errUploadTemp' : 'Unable to make temporary file for upload.', // from v2.1 added 26.09.2015 + 'errNotReplace' : 'Object "$1" already exists at this location and can not be replaced by object with another type.', // new + '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".', + 'errTrash' : 'Unable into trash.', // from v2.1.24 added 30.4.2017 + '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.', // edited 24.06.2012 + 'errArcMaxSize' : 'Archive files exceeds maximum allowed size.', + 'errResize' : 'Unable to resize "$1".', + 'errResizeDegree' : 'Invalid rotate degree.', // added 7.3.2013 + 'errResizeRotate' : 'Unable to rotate image.', // added 7.3.2013 + 'errResizeSize' : 'Invalid image size.', // added 7.3.2013 + 'errResizeNoChange' : 'Image size not changed.', // added 7.3.2013 + 'errUsupportType' : 'Unsupported file type.', + 'errNotUTF8Content' : 'File "$1" is not in UTF-8 and cannot be edited.', // added 9.11.2011 + 'errNetMount' : 'Unable to mount "$1".', // added 17.04.2012 + 'errNetMountNoDriver' : 'Unsupported protocol.', // added 17.04.2012 + 'errNetMountFailed' : 'Mount failed.', // added 17.04.2012 + 'errNetMountHostReq' : 'Host required.', // added 18.04.2012 + '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.', // from v2.1 added 30.04.2012 + 'errConvUTF8' : 'Not convertible to UTF-8', // from v2.1 added 08.04.2014 + 'errFolderUpload' : 'Try the modern browser, If you\'d like to upload the folder.', // from v2.1 added 26.6.2015 + 'errSearchTimeout' : 'Timed out while searching "$1". Search result is partial.', // from v2.1 added 12.1.2016 + 'errReauthRequire' : 'Re-authorization is required.', // from v2.1.10 added 24.3.2016 + 'errMaxTargets' : 'Max number of selectable items is $1.', // from v2.1.17 added 17.10.2016 + 'errRestore' : 'Unable to restore from the trash. Can\'t identify the restore destination.', // from v2.1.24 added 3.5.2017 + 'errEditorNotFound' : 'Editor not found to this file type.', // from v2.1.25 added 23.5.2017 + 'errServerError' : 'Error occurred on the server side.', // from v2.1.25 added 16.6.2017 + 'errEmpty' : 'Unable to empty folder "$1".', // from v2.1.25 added 22.6.2017 + 'moreErrors' : 'There are $1 more errors.', // from v2.1.44 added 9.12.2018 + 'errMaxMkdirs' : 'You can create up to $1 folders at one time.', // from v2.1.58 added 20.6.2021 + + /******************************* commands names ********************************/ + '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' : 'Root', + 'cmdinfo' : 'Get info', + 'cmdmkdir' : 'New folder', + 'cmdmkdirin' : 'Into New Folder', // from v2.1.7 added 19.2.2016 + 'cmdmkfile' : 'New file', + 'cmdopen' : 'Open', + 'cmdpaste' : 'Paste', + 'cmdquicklook' : 'Preview', + 'cmdreload' : 'Reload', + 'cmdrename' : 'Rename', + 'cmdrm' : 'Delete', + 'cmdtrash' : 'Into trash', //from v2.1.24 added 29.4.2017 + 'cmdrestore' : 'Restore', //from v2.1.24 added 3.5.2017 + 'cmdsearch' : 'Find files', + 'cmdup' : 'Go to parent folder', + 'cmdupload' : 'Upload files', + 'cmdview' : 'View', + 'cmdresize' : 'Resize & Rotate', + 'cmdsort' : 'Sort', + 'cmdnetmount' : 'Mount network volume', // added 18.04.2012 + 'cmdnetunmount': 'Unmount', // from v2.1 added 30.04.2012 + 'cmdplaces' : 'To Places', // added 28.12.2014 + 'cmdchmod' : 'Change mode', // from v2.1 added 20.6.2015 + 'cmdopendir' : 'Open a folder', // from v2.1 added 13.1.2016 + 'cmdcolwidth' : 'Reset column width', // from v2.1.13 added 12.06.2016 + 'cmdfullscreen': 'Full Screen', // from v2.1.15 added 03.08.2016 + 'cmdmove' : 'Move', // from v2.1.15 added 21.08.2016 + 'cmdempty' : 'Empty the folder', // from v2.1.25 added 22.06.2017 + 'cmdundo' : 'Undo', // from v2.1.27 added 31.07.2017 + 'cmdredo' : 'Redo', // from v2.1.27 added 31.07.2017 + 'cmdpreference': 'Preferences', // from v2.1.27 added 03.08.2017 + 'cmdselectall' : 'Select all', // from v2.1.28 added 15.08.2017 + 'cmdselectnone': 'Select none', // from v2.1.28 added 15.08.2017 + 'cmdselectinvert': 'Invert selection', // from v2.1.28 added 15.08.2017 + 'cmdopennew' : 'Open in new window', // from v2.1.38 added 3.4.2018 + 'cmdhide' : 'Hide (Preference)', // from v2.1.41 added 24.7.2018 + + /*********************************** buttons ***********************************/ + 'btnClose' : 'Close', + 'btnSave' : 'Save', + 'btnRm' : 'Remove', + 'btnApply' : 'Apply', + 'btnCancel' : 'Cancel', + 'btnNo' : 'No', + 'btnYes' : 'Yes', + 'btnMount' : 'Mount', // added 18.04.2012 + 'btnApprove': 'Goto $1 & approve', // from v2.1 added 26.04.2012 + 'btnUnmount': 'Unmount', // from v2.1 added 30.04.2012 + 'btnConv' : 'Convert', // from v2.1 added 08.04.2014 + 'btnCwd' : 'Here', // from v2.1 added 22.5.2015 + 'btnVolume' : 'Volume', // from v2.1 added 22.5.2015 + 'btnAll' : 'All', // from v2.1 added 22.5.2015 + 'btnMime' : 'MIME Type', // from v2.1 added 22.5.2015 + 'btnFileName':'Filename', // from v2.1 added 22.5.2015 + 'btnSaveClose': 'Save & Close', // from v2.1 added 12.6.2015 + 'btnBackup' : 'Backup', // fromv2.1 added 28.11.2015 + 'btnRename' : 'Rename', // from v2.1.24 added 6.4.2017 + 'btnRenameAll' : 'Rename(All)', // from v2.1.24 added 6.4.2017 + 'btnPrevious' : 'Prev ($1/$2)', // from v2.1.24 added 11.5.2017 + 'btnNext' : 'Next ($1/$2)', // from v2.1.24 added 11.5.2017 + 'btnSaveAs' : 'Save As', // from v2.1.25 added 24.5.2017 + + /******************************** notifications ********************************/ + 'ntfopen' : 'Open folder', + 'ntffile' : 'Open file', + 'ntfreload' : 'Reload folder content', + 'ntfmkdir' : 'Creating folder', + 'ntfmkfile' : 'Creating files', + 'ntfrm' : 'Delete items', + 'ntfcopy' : 'Copy items', + 'ntfmove' : 'Move items', + 'ntfprepare' : 'Checking existing items', + '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', // added 18.04.2012 + 'ntfnetunmount': 'Unmounting network volume', // from v2.1 added 30.04.2012 + 'ntfdim' : 'Acquiring image dimension', // added 20.05.2013 + 'ntfreaddir' : 'Reading folder infomation', // from v2.1 added 01.07.2013 + 'ntfurl' : 'Getting URL of link', // from v2.1 added 11.03.2014 + 'ntfchmod' : 'Changing file mode', // from v2.1 added 20.6.2015 + 'ntfpreupload': 'Verifying upload file name', // from v2.1 added 31.11.2015 + 'ntfzipdl' : 'Creating a file for download', // from v2.1.7 added 23.1.2016 + 'ntfparents' : 'Getting path infomation', // from v2.1.17 added 2.11.2016 + 'ntfchunkmerge': 'Processing the uploaded file', // from v2.1.17 added 2.11.2016 + 'ntftrash' : 'Doing throw in the trash', // from v2.1.24 added 2.5.2017 + 'ntfrestore' : 'Doing restore from the trash', // from v2.1.24 added 3.5.2017 + 'ntfchkdir' : 'Checking destination folder', // from v2.1.24 added 3.5.2017 + 'ntfundo' : 'Undoing previous operation', // from v2.1.27 added 31.07.2017 + 'ntfredo' : 'Redoing previous undone', // from v2.1.27 added 31.07.2017 + 'ntfchkcontent' : 'Checking contents', // from v2.1.41 added 3.8.2018 + + /*********************************** volumes *********************************/ + 'volume_Trash' : 'Trash', //from v2.1.24 added 29.4.2017 + + /************************************ dates **********************************/ + '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', + + /******************************** sort variants ********************************/ + 'sortname' : 'by name', + 'sortkind' : 'by kind', + 'sortsize' : 'by size', + 'sortdate' : 'by date', + 'sortFoldersFirst' : 'Folders first', + 'sortperm' : 'by permission', // from v2.1.13 added 13.06.2016 + 'sortmode' : 'by mode', // from v2.1.13 added 13.06.2016 + 'sortowner' : 'by owner', // from v2.1.13 added 13.06.2016 + 'sortgroup' : 'by group', // from v2.1.13 added 13.06.2016 + 'sortAlsoTreeview' : 'Also Treeview', // from v2.1.15 added 01.08.2016 + + /********************************** new items **********************************/ + 'untitled file.txt' : 'NewFile.txt', // added 10.11.2015 + 'untitled folder' : 'NewFolder', // added 10.11.2015 + 'Archive' : 'NewArchive', // from v2.1 added 10.11.2015 + 'untitled file' : 'NewFile.$1', // from v2.1.41 added 6.8.2018 + 'extentionfile' : '$1: File', // from v2.1.41 added 6.8.2018 + 'extentiontype' : '$1: $2', // from v2.1.43 added 17.10.2018 + + /********************************** messages **********************************/ + 'confirmReq' : 'Confirmation required', + 'confirmRm' : 'Are you sure you want to permanently remove items?
                This cannot be undone!', + 'confirmRepl' : 'Replace old file with new one? (If it contains folders, it will be merged. To backup and replace, select Backup.)', + 'confirmRest' : 'Replace existing item with the item in trash?', // fromv2.1.24 added 5.5.2017 + 'confirmConvUTF8' : 'Not in UTF-8
                Convert to UTF-8?
                Contents become UTF-8 by saving after conversion.', // from v2.1 added 08.04.2014 + 'confirmNonUTF8' : 'Character encoding of this file couldn\'t be detected. It need to temporarily convert to UTF-8 for editting.
                Please select character encoding of this file.', // from v2.1.19 added 28.11.2016 + 'confirmNotSave' : 'It has been modified.
                Losing work if you do not save changes.', // from v2.1 added 15.7.2015 + 'confirmTrash' : 'Are you sure you want to move items to trash bin?', //from v2.1.24 added 29.4.2017 + 'confirmMove' : 'Are you sure you want to move items to "$1"?', //from v2.1.50 added 27.7.2019 + '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 items', + 'selectfiles' : 'Select item(s)', + 'selectffile' : 'Select first item', + 'selectlfile' : 'Select last item', + 'viewlist' : 'List view', + 'viewicons' : 'Icons view', + 'viewSmall' : 'Small icons', // from v2.1.39 added 22.5.2018 + 'viewMedium' : 'Medium icons', // from v2.1.39 added 22.5.2018 + 'viewLarge' : 'Large icons', // from v2.1.39 added 22.5.2018 + 'viewExtraLarge' : 'Extra large icons', // from v2.1.39 added 22.5.2018 + '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', + 'moveFiles' : 'Move items', + 'copyFiles' : 'Copy items', + 'restoreFiles' : 'Restore items', // from v2.1.24 added 5.5.2017 + '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', // added 18.04.2012 + 'protocol' : 'Protocol', // added 18.04.2012 + 'host' : 'Host', // added 18.04.2012 + 'port' : 'Port', // added 18.04.2012 + 'user' : 'User', // added 18.04.2012 + 'pass' : 'Password', // added 18.04.2012 + 'confirmUnmount' : 'Are you unmount $1?', // from v2.1 added 30.04.2012 + 'dropFilesBrowser': 'Drop or Paste files from browser', // from v2.1 added 30.05.2012 + 'dropPasteFiles' : 'Drop files, Paste URLs or images(clipboard) here', // from v2.1 added 07.04.2014 + 'encoding' : 'Encoding', // from v2.1 added 19.12.2014 + 'locale' : 'Locale', // from v2.1 added 19.12.2014 + 'searchTarget' : 'Target: $1', // from v2.1 added 22.5.2015 + 'searchMime' : 'Search by input MIME Type', // from v2.1 added 22.5.2015 + 'owner' : 'Owner', // from v2.1 added 20.6.2015 + 'group' : 'Group', // from v2.1 added 20.6.2015 + 'other' : 'Other', // from v2.1 added 20.6.2015 + 'execute' : 'Execute', // from v2.1 added 20.6.2015 + 'perm' : 'Permission', // from v2.1 added 20.6.2015 + 'mode' : 'Mode', // from v2.1 added 20.6.2015 + 'emptyFolder' : 'Folder is empty', // from v2.1.6 added 30.12.2015 + 'emptyFolderDrop' : 'Folder is empty\\A Drop to add items', // from v2.1.6 added 30.12.2015 + 'emptyFolderLTap' : 'Folder is empty\\A Long tap to add items', // from v2.1.6 added 30.12.2015 + 'quality' : 'Quality', // from v2.1.6 added 5.1.2016 + 'autoSync' : 'Auto sync', // from v2.1.6 added 10.1.2016 + 'moveUp' : 'Move up', // from v2.1.6 added 18.1.2016 + 'getLink' : 'Get URL link', // from v2.1.7 added 9.2.2016 + 'selectedItems' : 'Selected items ($1)', // from v2.1.7 added 2.19.2016 + 'folderId' : 'Folder ID', // from v2.1.10 added 3.25.2016 + 'offlineAccess' : 'Allow offline access', // from v2.1.10 added 3.25.2016 + 'reAuth' : 'To re-authenticate', // from v2.1.10 added 3.25.2016 + 'nowLoading' : 'Now loading...', // from v2.1.12 added 4.26.2016 + 'openMulti' : 'Open multiple files', // from v2.1.12 added 5.14.2016 + '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 + 'emptySearch' : 'Search results is empty in search target.', // from v2.1.12 added 5.16.2016 + 'editingFile' : 'It is editing a file.', // from v2.1.13 added 6.3.2016 + 'hasSelected' : 'You have selected $1 items.', // from v2.1.13 added 6.3.2016 + 'hasClipboard' : 'You have $1 items in the clipboard.', // from v2.1.13 added 6.3.2016 + 'incSearchOnly' : 'Incremental search is only from the current view.', // from v2.1.13 added 6.30.2016 + 'reinstate' : 'Reinstate', // from v2.1.15 added 3.8.2016 + 'complete' : '$1 complete', // from v2.1.15 added 21.8.2016 + 'contextmenu' : 'Context menu', // from v2.1.15 added 9.9.2016 + 'pageTurning' : 'Page turning', // from v2.1.15 added 10.9.2016 + 'volumeRoots' : 'Volume roots', // from v2.1.16 added 16.9.2016 + 'reset' : 'Reset', // from v2.1.16 added 1.10.2016 + 'bgcolor' : 'Background color', // from v2.1.16 added 1.10.2016 + 'colorPicker' : 'Color picker', // from v2.1.16 added 1.10.2016 + '8pxgrid' : '8px Grid', // from v2.1.16 added 4.10.2016 + 'enabled' : 'Enabled', // from v2.1.16 added 4.10.2016 + 'disabled' : 'Disabled', // from v2.1.16 added 4.10.2016 + 'emptyIncSearch' : 'Search results is empty in current view.\\APress [Enter] to expand search target.', // from v2.1.16 added 5.10.2016 + 'emptyLetSearch' : 'First letter search results is empty in current view.', // from v2.1.23 added 24.3.2017 + 'textLabel' : 'Text label', // from v2.1.17 added 13.10.2016 + 'minsLeft' : '$1 mins left', // from v2.1.17 added 13.11.2016 + 'openAsEncoding' : 'Reopen with selected encoding', // from v2.1.19 added 2.12.2016 + 'saveAsEncoding' : 'Save with the selected encoding', // from v2.1.19 added 2.12.2016 + 'selectFolder' : 'Select folder', // from v2.1.20 added 13.12.2016 + 'firstLetterSearch': 'First letter search', // from v2.1.23 added 24.3.2017 + 'presets' : 'Presets', // from v2.1.25 added 26.5.2017 + 'tooManyToTrash' : 'It\'s too many items so it can\'t into trash.', // from v2.1.25 added 9.6.2017 + 'TextArea' : 'TextArea', // from v2.1.25 added 14.6.2017 + 'folderToEmpty' : 'Empty the folder "$1".', // from v2.1.25 added 22.6.2017 + 'filderIsEmpty' : 'There are no items in a folder "$1".', // from v2.1.25 added 22.6.2017 + 'preference' : 'Preference', // from v2.1.26 added 28.6.2017 + 'language' : 'Language', // from v2.1.26 added 28.6.2017 + 'clearBrowserData': 'Initialize the settings saved in this browser', // from v2.1.26 added 28.6.2017 + 'toolbarPref' : 'Toolbar settings', // from v2.1.27 added 2.8.2017 + 'charsLeft' : '... $1 chars left.', // from v2.1.29 added 30.8.2017 + 'linesLeft' : '... $1 lines left.', // from v2.1.52 added 16.1.2020 + 'sum' : 'Sum', // from v2.1.29 added 28.9.2017 + 'roughFileSize' : 'Rough file size', // from v2.1.30 added 2.11.2017 + 'autoFocusDialog' : 'Focus on the element of dialog with mouseover', // from v2.1.30 added 2.11.2017 + 'select' : 'Select', // from v2.1.30 added 23.11.2017 + 'selectAction' : 'Action when select file', // from v2.1.30 added 23.11.2017 + 'useStoredEditor' : 'Open with the editor used last time', // from v2.1.30 added 23.11.2017 + 'selectinvert' : 'Invert selection', // from v2.1.30 added 25.11.2017 + 'renameMultiple' : 'Are you sure you want to rename $1 selected items like $2?
                This cannot be undone!', // from v2.1.31 added 4.12.2017 + 'batchRename' : 'Batch rename', // from v2.1.31 added 8.12.2017 + 'plusNumber' : '+ Number', // from v2.1.31 added 8.12.2017 + 'asPrefix' : 'Add prefix', // from v2.1.31 added 8.12.2017 + 'asSuffix' : 'Add suffix', // from v2.1.31 added 8.12.2017 + 'changeExtention' : 'Change extention', // from v2.1.31 added 8.12.2017 + 'columnPref' : 'Columns settings (List view)', // from v2.1.32 added 6.2.2018 + 'reflectOnImmediate' : 'All changes will reflect immediately to the archive.', // from v2.1.33 added 2.3.2018 + 'reflectOnUnmount' : 'Any changes will not reflect until un-mount this volume.', // from v2.1.33 added 2.3.2018 + 'unmountChildren' : 'The following volume(s) mounted on this volume also unmounted. Are you sure to unmount it?', // from v2.1.33 added 5.3.2018 + 'selectionInfo' : 'Selection Info', // from v2.1.33 added 7.3.2018 + 'hashChecker' : 'Algorithms to show the file hash', // from v2.1.33 added 10.3.2018 + 'infoItems' : 'Info Items (Selection Info Panel)', // from v2.1.38 added 28.3.2018 + 'pressAgainToExit': 'Press again to exit.', // from v2.1.38 added 1.4.2018 + 'toolbar' : 'Toolbar', // from v2.1.38 added 4.4.2018 + 'workspace' : 'Work Space', // from v2.1.38 added 4.4.2018 + 'dialog' : 'Dialog', // from v2.1.38 added 4.4.2018 + 'all' : 'All', // from v2.1.38 added 4.4.2018 + 'iconSize' : 'Icon Size (Icons view)', // from v2.1.39 added 7.5.2018 + 'editorMaximized' : 'Open the maximized editor window', // from v2.1.40 added 30.6.2018 + 'editorConvNoApi' : 'Because conversion by API is not currently available, please convert on the website.', //from v2.1.40 added 8.7.2018 + 'editorConvNeedUpload' : 'After conversion, you must be upload with the item URL or a downloaded file to save the converted file.', //from v2.1.40 added 8.7.2018 + 'convertOn' : 'Convert on the site of $1', // from v2.1.40 added 10.7.2018 + 'integrations' : 'Integrations', // from v2.1.40 added 11.7.2018 + 'integrationWith' : 'This elFinder has the following external services integrated. Please check the terms of use, privacy policy, etc. before using it.', // from v2.1.40 added 11.7.2018 + 'showHidden' : 'Show hidden items', // from v2.1.41 added 24.7.2018 + 'hideHidden' : 'Hide hidden items', // from v2.1.41 added 24.7.2018 + 'toggleHidden' : 'Show/Hide hidden items', // from v2.1.41 added 24.7.2018 + 'makefileTypes' : 'File types to enable with "New file"', // from v2.1.41 added 7.8.2018 + 'typeOfTextfile' : 'Type of the Text file', // from v2.1.41 added 7.8.2018 + 'add' : 'Add', // from v2.1.41 added 7.8.2018 + 'theme' : 'Theme', // from v2.1.43 added 19.10.2018 + 'default' : 'Default', // from v2.1.43 added 19.10.2018 + 'description' : 'Description', // from v2.1.43 added 19.10.2018 + 'website' : 'Website', // from v2.1.43 added 19.10.2018 + 'author' : 'Author', // from v2.1.43 added 19.10.2018 + 'email' : 'Email', // from v2.1.43 added 19.10.2018 + 'license' : 'License', // from v2.1.43 added 19.10.2018 + 'exportToSave' : 'This item can\'t be saved. To avoid losing the edits you need to export to your PC.', // from v2.1.44 added 1.12.2018 + 'dblclickToSelect': 'Double click on the file to select it.', // from v2.1.47 added 22.1.2019 + 'useFullscreen' : 'Use fullscreen mode', // from v2.1.47 added 19.2.2019 + + /********************************** mimetypes **********************************/ + 'kindUnknown' : 'Unknown', + 'kindRoot' : 'Volume Root', // from v2.1.16 added 16.10.2016 + 'kindFolder' : 'Folder', + 'kindSelects' : 'Selections', // from v2.1.29 added 29.8.2017 + 'kindAlias' : 'Alias', + 'kindAliasBroken' : 'Broken alias', + // applications + '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', + // texts + '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', // added 20.7.2015 + // images + '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', + // media + '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' + } + }; +})); + diff --git a/public/packages/barryvdh/elfinder/js/i18n/help/en.html.js b/public/packages/barryvdh/elfinder/js/i18n/help/en.html.js new file mode 100644 index 00000000..eae309e5 --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/i18n/help/en.html.js @@ -0,0 +1,10 @@ +

                Operation Tips

                +

                Operation on the UI is similar to operating system's standard file manager. However, Drag and Drop is not possible with mobile browsers.

                +
                  +
                • Right click or long tap to show the context menu.
                • +
                • Drag and drop into the folder tree or the current workspace to move/copy items.
                • +
                • Item selection in the workspace can be extended selection with Shift or Alt (Option) key.
                • +
                • Drag and Drop to the destination folder or workspace to upload files and folders.
                • +
                • The upload dialog can accept paste/drop clipboard data or URL lists and Drag and Drop from other browser or file managers etc.
                • +
                • Drag start with pressing Alt(Option) key to drag out to outside browser. It will became download operation with Google Chrome.
                • +
                diff --git a/public/packages/barryvdh/elfinder/js/proxy/elFinderSupportVer1.js b/public/packages/barryvdh/elfinder/js/proxy/elFinderSupportVer1.js new file mode 100644 index 00000000..d9fb3fbd --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/proxy/elFinderSupportVer1.js @@ -0,0 +1,408 @@ +/** + * elFinder transport to support old protocol. + * + * @example + * $('selector').elfinder({ + * .... + * transport : new elFinderSupportVer1() + * }) + * + * @author Dmitry (dio) Levashov + **/ +window.elFinderSupportVer1 = function(upload) { + "use strict"; + var self = this, + dateObj, today, yesterday, + getDateString = function(date) { + return date.replace('Today', today).replace('Yesterday', yesterday); + }; + + dateObj = new Date(); + today = dateObj.getFullYear() + '/' + (dateObj.getMonth() + 1) + '/' + dateObj.getDate(); + dateObj = new Date(Date.now() - 86400000); + yesterday = dateObj.getFullYear() + '/' + (dateObj.getMonth() + 1) + '/' + dateObj.getDate(); + + this.upload = upload || 'auto'; + + this.init = function(fm) { + this.fm = fm; + this.fm.parseUploadData = function(text) { + var data; + + if (!$.trim(text)) { + return {error : ['errResponse', 'errDataEmpty']}; + } + + try { + data = JSON.parse(text); + } catch (e) { + return {error : ['errResponse', 'errDataNotJSON']}; + } + + return self.normalize('upload', data); + }; + }; + + + this.send = function(opts) { + var self = this, + fm = this.fm, + dfrd = $.Deferred(), + cmd = opts.data.cmd, + args = [], + _opts = {}, + data, + xhr; + + dfrd.abort = function() { + if (xhr.state() == 'pending') { + xhr.quiet = true; + xhr.abort(); + } + }; + + switch (cmd) { + case 'open': + opts.data.tree = 1; + break; + case 'parents': + case 'tree': + return dfrd.resolve({tree : []}); + case 'get': + opts.data.cmd = 'read'; + opts.data.current = fm.file(opts.data.target).phash; + break; + case 'put': + opts.data.cmd = 'edit'; + opts.data.current = fm.file(opts.data.target).phash; + break; + case 'archive': + case 'rm': + opts.data.current = fm.file(opts.data.targets[0]).phash; + break; + case 'extract': + case 'rename': + case 'resize': + opts.data.current = fm.file(opts.data.target).phash; + break; + case 'duplicate': + _opts = $.extend(true, {}, opts); + + $.each(opts.data.targets, function(i, hash) { + $.ajax(Object.assign(_opts, {data : {cmd : 'duplicate', target : hash, current : fm.file(hash).phash}})) + .fail(function(error) { + fm.error(fm.res('error', 'connect')); + }) + .done(function(data) { + data = self.normalize('duplicate', data); + if (data.error) { + fm.error(data.error); + } else if (data.added) { + fm.trigger('add', {added : data.added}); + } + }); + }); + return dfrd.resolve({}); + + case 'mkdir': + case 'mkfile': + opts.data.current = opts.data.target; + break; + case 'paste': + opts.data.current = opts.data.dst; + if (! opts.data.tree) { + $.each(opts.data.targets, function(i, h) { + if (fm.file(h) && fm.file(h).mime === 'directory') { + opts.data.tree = '1'; + return false; + } + }); + } + break; + + case 'size': + return dfrd.resolve({error : fm.res('error', 'cmdsupport')}); + case 'search': + return dfrd.resolve({error : fm.res('error', 'cmdsupport')}); + + case 'file': + opts.data.cmd = 'open'; + opts.data.current = fm.file(opts.data.target).phash; + break; + } + // cmd = opts.data.cmd + + xhr = $.ajax(opts) + .fail(function(error) { + dfrd.reject(error); + }) + .done(function(raw) { + data = self.normalize(cmd, raw); + dfrd.resolve(data); + }); + + return dfrd; + }; + + // fix old connectors errors messages as possible + // this.errors = { + // 'Unknown command' : 'Unknown command.', + // 'Invalid backend configuration' : 'Invalid backend configuration.', + // 'Access denied' : 'Access denied.', + // 'PHP JSON module not installed' : 'PHP JSON module not installed.', + // 'File not found' : 'File not found.', + // 'Invalid name' : 'Invalid file name.', + // 'File or folder with the same name already exists' : 'File named "$1" already exists in this location.', + // 'Not allowed file type' : 'Not allowed file type.', + // 'File exceeds the maximum allowed filesize' : 'File exceeds maximum allowed size.', + // 'Unable to copy into itself' : 'Unable to copy "$1" into itself.', + // 'Unable to create archive' : 'Unable to create archive.', + // 'Unable to extract files from archive' : 'Unable to extract files from "$1".' + // } + + this.normalize = function(cmd, data) { + var self = this, + fm = this.fm, + files = {}, + filter = function(file) { return file && file.hash && file.name && file.mime ? file : null; }, + getDirs = function(items) { + return $.grep(items, function(i) { + return i && i.mime && i.mime === 'directory'? true : false; + }); + }, + getTreeDiff = function(files) { + var dirs = getDirs(files); + treeDiff = fm.diff(dirs, null, ['date', 'ts']); + if (treeDiff.added.length) { + treeDiff.added = getDirs(treeDiff.added); + } + if (treeDiff.changed.length) { + treeDiff.changed = getDirs(treeDiff.changed); + } + if (treeDiff.removed.length) { + var removed = []; + $.each(treeDiff.removed, function(i, h) { + var item; + if ((item = fm.file(h)) && item.mime === 'directory') { + removed.push(h); + } + }); + treeDiff.removed = removed; + } + return treeDiff; + }, + phash, diff, isCwd, treeDiff; + + if ((cmd == 'tmb' || cmd == 'get')) { + return data; + } + + // if (data.error) { + // $.each(data.error, function(i, msg) { + // if (self.errors[msg]) { + // data.error[i] = self.errors[msg]; + // } + // }); + // } + + if (cmd == 'upload' && data.error && data.cwd) { + data.warning = Object.assign({}, data.error); + data.error = false; + } + + + if (data.error) { + return data; + } + + if (cmd == 'put') { + + phash = fm.file(data.target.hash).phash; + return {changed : [this.normalizeFile(data.target, phash)]}; + } + + phash = data.cwd.hash; + + isCwd = (phash == fm.cwd().hash); + + if (data.tree) { + $.each(this.normalizeTree(data.tree), function(i, file) { + files[file.hash] = file; + }); + } + + $.each(data.cdc||[], function(i, file) { + var hash = file.hash, + mcts; + + if (files[hash]) { + if (file.date) { + mcts = Date.parse(getDateString(file.date)); + if (mcts && !isNaN(mcts)) { + files[hash].ts = Math.floor(mcts / 1000); + } else { + files[hash].date = file.date || fm.formatDate(file); + } + } + files[hash].locked = file.hash == phash ? true : file.rm === void(0) ? false : !file.rm; + } else { + files[hash] = self.normalizeFile(file, phash, data.tmb); + } + }); + + if (!data.tree) { + $.each(fm.files(), function(hash, file) { + if (!files[hash] && file.phash != phash && file.mime == 'directory') { + files[hash] = file; + } + }); + } + + if (cmd == 'open') { + return { + cwd : files[phash] || this.normalizeFile(data.cwd), + files : $.map(files, function(f) { return f; }), + options : self.normalizeOptions(data), + init : !!data.params, + debug : data.debug + }; + } + + if (isCwd) { + diff = fm.diff($.map(files, filter)); + } else { + if (data.tree && cmd !== 'paste') { + diff = getTreeDiff(files); + } else { + diff = { + added : [], + removed : [], + changed : [] + }; + if (cmd === 'paste') { + diff.sync = true; + } + } + } + + return Object.assign({ + current : data.cwd.hash, + error : data.error, + warning : data.warning, + options : {tmb : !!data.tmb} + }, diff); + + }; + + /** + * Convert old api tree into plain array of dirs + * + * @param Object root dir + * @return Array + */ + this.normalizeTree = function(root) { + var self = this, + result = [], + traverse = function(dirs, phash) { + var i, dir; + + for (i = 0; i < dirs.length; i++) { + dir = dirs[i]; + result.push(self.normalizeFile(dir, phash)); + dir.dirs.length && traverse(dir.dirs, dir.hash); + } + }; + + traverse([root]); + + return result; + }; + + /** + * Convert file info from old api format into new one + * + * @param Object file + * @param String parent dir hash + * @return Object + */ + this.normalizeFile = function(file, phash, tmb) { + var mime = file.mime || 'directory', + size = mime == 'directory' && !file.linkTo ? 0 : file.size, + mcts = file.date? Date.parse(getDateString(file.date)) : void 0, + info = { + url : file.url, + hash : file.hash, + phash : phash, + name : file.name, + mime : mime, + ts : file.ts, + size : size, + read : file.read, + write : file.write, + locked : !phash ? true : file.rm === void(0) ? false : !file.rm + }; + + if (! info.ts) { + if (mcts && !isNaN(mcts)) { + info.ts = Math.floor(mcts / 1000); + } else { + info.date = file.date || this.fm.formatDate(file); + } + } + + if (file.mime == 'application/x-empty' || file.mime == 'inode/x-empty') { + info.mime = 'text/plain'; + } + + if (file.linkTo) { + info.alias = file.linkTo; + } + + if (file.linkTo) { + info.linkTo = file.linkTo; + } + + if (file.tmb) { + info.tmb = file.tmb; + } else if (info.mime.indexOf('image/') === 0 && tmb) { + info.tmb = 1; + + } + + if (file.dirs && file.dirs.length) { + info.dirs = true; + } + if (file.dim) { + info.dim = file.dim; + } + if (file.resize) { + info.resize = file.resize; + } + return info; + }; + + this.normalizeOptions = function(data) { + var opts = { + path : data.cwd.rel, + disabled : $.merge((data.disabled || []), [ 'search', 'netmount', 'zipdl' ]), + tmb : !!data.tmb, + copyOverwrite : true + }; + + if (data.params) { + opts.api = 1; + opts.url = data.params.url; + opts.archivers = { + create : data.params.archives || [], + extract : data.params.extract || [] + }; + } + + if (opts.path.indexOf('/') !== -1) { + opts.separator = '/'; + } else if (opts.path.indexOf('\\') !== -1) { + opts.separator = '\\'; + } + return opts; + }; +}; diff --git a/public/packages/barryvdh/elfinder/js/standalonepopup.js b/public/packages/barryvdh/elfinder/js/standalonepopup.js new file mode 100644 index 00000000..fdd20664 --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/standalonepopup.js @@ -0,0 +1,20 @@ +$(document).on('click','.popup_selector',function (event) { + event.preventDefault(); + var updateID = $(this).attr('data-inputid'); // Btn id clicked + var elfinderUrl = '/elfinder/popup/'; + + // trigger the reveal modal with elfinder inside + var triggerUrl = elfinderUrl + updateID; + $.colorbox({ + href: triggerUrl, + fastIframe: true, + iframe: true, + width: '70%', + height: '50%' + }); + +}); +// function to update the file selected by elfinder +function processSelectedFile(filePath, requestingField) { + $('#' + requestingField).val(filePath).trigger('change'); +} diff --git a/public/packages/barryvdh/elfinder/js/standalonepopup.min.js b/public/packages/barryvdh/elfinder/js/standalonepopup.min.js new file mode 100644 index 00000000..46957f8c --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/standalonepopup.min.js @@ -0,0 +1 @@ +function processSelectedFile(e,t){$("#"+t).val(e)}$(document).on("click",".popup_selector",function(e){e.preventDefault();var t=$(this).attr("data-inputid");var n="/elfinder/popup/";var r=n+t;$.colorbox({href:r,fastIframe:true,iframe:true,width:"70%",height:"50%"})}) diff --git a/public/packages/barryvdh/elfinder/js/tiny_mce_popup.js b/public/packages/barryvdh/elfinder/js/tiny_mce_popup.js new file mode 100644 index 00000000..c99e4a6b --- /dev/null +++ b/public/packages/barryvdh/elfinder/js/tiny_mce_popup.js @@ -0,0 +1,5 @@ + +// Uncomment and change this document.domain value if you are loading the script cross subdomains +// document.domain = 'moxiecode.com'; + +var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('